hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c8c6d2fbbeedc3f63cb9e3926c0b302dd4cf7b4e | 568 | js | JavaScript | models/Club.js | baszurburg/RCH-app-website | fe70f6d0c6164708064c2db9768b0e54db5cba85 | [
"MIT"
] | null | null | null | models/Club.js | baszurburg/RCH-app-website | fe70f6d0c6164708064c2db9768b0e54db5cba85 | [
"MIT"
] | null | null | null | models/Club.js | baszurburg/RCH-app-website | fe70f6d0c6164708064c2db9768b0e54db5cba85 | [
"MIT"
] | null | null | null | var keystone = require('keystone');
var Types = keystone.Field.Types;
var Club = new keystone.List('Club', {
autokey: { from: 'code', path: 'key', unique: true }
});
Club.add({
code: { type: String },
name: { type: String },
longitude: { type: Number },
latitude: { type: Number },
street: { type: String },
city: { type: String},
url: { type: String},
tenue: { type: String},
logo: { type: String },
tel: { type: String},
tenue: { type: String}
});
Club.track = true;
Club.defaultColumns = 'code';
Club.register();
| 21.846154 | 56 | 0.579225 |
c8c7058bb007056fbb9bbc84a0d90678fbe40b82 | 1,123 | js | JavaScript | ads/vendors/colombiafeed.js | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 16,831 | 2015-10-07T13:08:48.000Z | 2022-03-31T12:52:40.000Z | ads/vendors/colombiafeed.js | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 27,413 | 2015-10-07T12:41:00.000Z | 2022-03-31T23:41:02.000Z | ads/vendors/colombiafeed.js | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 5,001 | 2015-10-07T12:42:26.000Z | 2022-03-31T08:39:56.000Z | import {loadScript, validateData} from '#3p/3p';
/**
* @param {!Window} global
* @param {!Object} data
*/
export function colombiafeed(global, data) {
validateData(data, ['feedslot', 'feedposition', 'feedsection']);
// push the two object into the '_colombiafeed' global
(global._colombiafeed = global._colombiafeed || []).push({
feedslot: data.feedslot,
feedposition: data.feedposition,
feedsection: data.feedsection,
container: 'c',
feedpolicy: data.feedpolicy,
lazyload: data.lazyload,
lazyloadlimit: data.lazyloadlimit,
feedsnippetid: data.feedsnippetid,
feedcustom: data.feedcustom,
});
// install observation on entering/leaving the view
global.context.observeIntersection(function (changes) {
/** @type {!Array} */ (changes).forEach(function (c) {
if (c.intersectionRect.height) {
global._colombiafeed.push({
visible: true,
rect: c,
});
}
});
});
// load the colombiafeed loader asynchronously
loadScript(
global,
'https://static.clmbtech.com/c1e/static/themes/js/colombiafeed-amp.js'
);
}
| 28.075 | 74 | 0.661621 |
c8c70fa42082a131c2bff16493a2bf2cfe36b946 | 251 | js | JavaScript | public/jsc/icons/linear/arrows/keyboard-tab.js | Leragas/muallaf | 3065268ba7776fbb8b0935abeeaa8e61fd241306 | [
"MIT"
] | null | null | null | public/jsc/icons/linear/arrows/keyboard-tab.js | Leragas/muallaf | 3065268ba7776fbb8b0935abeeaa8e61fd241306 | [
"MIT"
] | null | null | null | public/jsc/icons/linear/arrows/keyboard-tab.js | Leragas/muallaf | 3065268ba7776fbb8b0935abeeaa8e61fd241306 | [
"MIT"
] | 1 | 2021-03-29T14:12:05.000Z | 2021-03-29T14:12:05.000Z | (function() { const icons = { "linear/arrows/keyboard-tab": "M63 0H1L0 1v62l1 1h62l1-1V1l-1-1zM47.5 32.9l-7.6 7.5-2.3-2.1 4.8-4.8H11.5v-3h30.9l-4.7-4.8 2.2-2.1 7.6 7.5v1.8zm4 8.6h-3v-19h3v19z" };
if (JSC) {
JSC.internal.registerIcons(icons);
}
})(); | 41.833333 | 195 | 0.653386 |
c8c738e9e51d544e2db1cc1f5ffd30b2104ee5a4 | 2,039 | js | JavaScript | source/components/header/header.js | SBGLevelUpToolkit/continuum-web | 23c334239024ae62a3df3b0a9d2de53eac90c535 | [
"MIT"
] | null | null | null | source/components/header/header.js | SBGLevelUpToolkit/continuum-web | 23c334239024ae62a3df3b0a9d2de53eac90c535 | [
"MIT"
] | null | null | null | source/components/header/header.js | SBGLevelUpToolkit/continuum-web | 23c334239024ae62a3df3b0a9d2de53eac90c535 | [
"MIT"
] | null | null | null | import template from './header.html!text';
import '../../services/security/authFactory';
import 'angular-ui-router';
import 'angular-local-storage';
var app = angular.module('cn.header', [ 'cn.auth', 'cn.assessmentFactory', 'ui.router' ])
.directive('cnHeader', function() {
return {
restrict: 'E',
template: template,
controllerAs: 'ctrl',
bindToController: true,
controller: /*@ngInject*/function(authService, assessmentService, $state, localStorageService) {
let levelNames = [ 'traveller', 'artisan', 'professional', 'expert', 'master' ];
let user = localStorageService.get('userDetails');
this.team = user.Teams[ 0 ].Name;
let gender = user.Teams[ 0 ].AvatarName === 'Barbarian' ? 'male' : 'female';
this.avatarType = `images/menu_${levelNames[ user.Teams[ 0 ].CurrentLevel ]}_${gender}_avatar_icon.png`;
this.signOut = function() {
authService.logOut();
$state.go('login');
};
this.checkAssessmentStatus = function(event) {
assessmentService.query((assessment) => {
if (assessment.Status === 'Closed') {
$state.go('home.assessment');
} else if (assessment.Status === 'Moderating') {
$state.go('home.moderateAssessment');
} else {
$state.go('home.assessment');
}
});
this.setActive(event);
};
this.setActive = function(event) {
$('.btn1').each(function(index, element) {
element.classList.remove('selected');
});
event.currentTarget.className += ' selected';
};
}
};
});
export default app; | 39.980392 | 120 | 0.48308 |
c8c74131ecb3aaf2d8ade524c2045f6f9372ce04 | 2,849 | js | JavaScript | js-test-suite/testsuite/b76e30b93908fa9967f494d367c8af6b.js | hao-wang/Montage | d1c98ec7dbe20d0449f0d02694930cf1f69a5cea | [
"MIT"
] | 16 | 2020-03-23T12:53:10.000Z | 2021-10-11T02:31:50.000Z | js-test-suite/testsuite/b76e30b93908fa9967f494d367c8af6b.js | hao-wang/Montage | d1c98ec7dbe20d0449f0d02694930cf1f69a5cea | [
"MIT"
] | null | null | null | js-test-suite/testsuite/b76e30b93908fa9967f494d367c8af6b.js | hao-wang/Montage | d1c98ec7dbe20d0449f0d02694930cf1f69a5cea | [
"MIT"
] | 1 | 2020-08-17T14:06:59.000Z | 2020-08-17T14:06:59.000Z | load("bf4b12814bc95f34eeb130127d8438ab.js");
load("93fae755edd261212639eed30afa2ca4.js");
load("6b78370695c49b6074ed4ac9ff090dbd.js");
// Copyright (C) 2016 ecmascript_simd authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: simd-store-in-tarray
description: Tests Simdstore functions.
includes: [simdUtilities.js]
---*/
function testStore(type, name, count) {
var storeFn = type.fn[name];
assert.sameValue('function', typeof storeFn);
var bufLanes = 2 * type.lanes; // Test all alignments.
var bufSize = bufLanes * type.laneSize + 8; // Extra for over-alignment test.
var ab = new ArrayBuffer(bufSize);
var buf = new type.view(ab);
var a = createTestValue(type); // Value containing 0, 1, 2, 3 ...
function checkBuffer(offset) {
for (var i = 0; i < count; i++)
if (buf[offset + i] != i) return false;
return true;
}
// Test aligned stores.
for (var i = 0; i < type.lanes; i++) {
assert.sameValue(storeFn(buf, i, a), a);
assert(checkBuffer(i));
}
// Test the 2 over-alignments.
var f64 = new Float64Array(ab);
var stride = 8 / type.laneSize;
for (var i = 0; i < 1; i++) {
assert.sameValue(storeFn(f64, i, a), a);
assert(checkBuffer(stride * i));
}
// Test the 7 mis-alignments.
var i8 = new Int8Array(ab);
for (var misalignment = 1; misalignment < 8; misalignment++) {
assert.sameValue(storeFn(i8, misalignment, a), a);
// Shift the buffer down by misalignment.
for (var i = 0; i < i8.length - misalignment; i++)
i8[i] = i8[i + misalignment];
assert(checkBuffer(0));
}
//Test index coercions
storeFn(buf, "0", a);
assert(checkBuffer(0));
storeFn(buf, "01", a);
assert(checkBuffer(1));
storeFn(buf, " -0.0 ", a);
assert(checkBuffer(0));
storeFn(buf, " +1e0", a);
assert(checkBuffer(1));
storeFn(buf, false, a);
assert(checkBuffer(0));
storeFn(buf, true, a);
assert(checkBuffer(1));
storeFn(buf, null, a);
assert(checkBuffer(0));
function testIndexCheck(buf, index, err) {
assert.throws(err, function () { storeFn(buf, index, type.fn()); });
}
testIndexCheck(buf, -1, RangeError);
testIndexCheck(buf, bufSize / type.laneSize - count + 1, RangeError);
testIndexCheck(buf.buffer, 1, TypeError);
testIndexCheck(buf, "a", RangeError);
}
simdTypes.filter(isNumerical).forEach(function(type) {
testSimdFunction(type.name + ' store', function() {
testStore(type, 'store', type.lanes);
});
});
simdTypes.filter(hasLoadStore123).forEach(function(type) {
testSimdFunction(type.name + ' store1', function() {
testStore(type, 'store1', 1);
});
testSimdFunction(type.name + ' store1', function() {
testStore(type, 'store2', 2);
});
testSimdFunction(type.name + ' store3', function() {
testStore(type, 'store3', 3);
});
});
| 31.655556 | 80 | 0.654265 |
c8c764326c0f253e041de0cfbd56bdee5bb5e55a | 12,557 | js | JavaScript | src/web/InputWaiter.js | crashdemons-external-archives/3301chef | a27ed815175d74215c7f113af2b327dd20a05d89 | [
"Apache-2.0"
] | 2 | 2021-05-31T14:37:56.000Z | 2022-02-03T01:53:35.000Z | src/web/InputWaiter.js | crashdemons-external/3301chef | a27ed815175d74215c7f113af2b327dd20a05d89 | [
"Apache-2.0"
] | 4 | 2021-11-21T02:42:57.000Z | 2022-03-24T06:53:56.000Z | src/web/InputWaiter.js | crashdemons-external/3301chef | a27ed815175d74215c7f113af2b327dd20a05d89 | [
"Apache-2.0"
] | 1 | 2021-03-13T17:14:13.000Z | 2021-03-13T17:14:13.000Z | import Utils from "../core/Utils.js";
import LiberPages from "../core/operations/LiberPages.js";
require("./static/images/cicada/0.jpg");
require("./static/images/cicada/1.jpg");
require("./static/images/cicada/2.jpg");
require("./static/images/cicada/3.jpg");
require("./static/images/cicada/4.jpg");
require("./static/images/cicada/5.jpg");
require("./static/images/cicada/6.jpg");
require("./static/images/cicada/7.jpg");
require("./static/images/cicada/8.jpg");
require("./static/images/cicada/9.jpg");
require("./static/images/cicada/10.jpg");
require("./static/images/cicada/11.jpg");
require("./static/images/cicada/12.jpg");
require("./static/images/cicada/13.jpg");
require("./static/images/cicada/14.jpg");
require("./static/images/cicada/15.jpg");
require("./static/images/cicada/16.jpg");
require("./static/images/cicada/17.jpg");
require("./static/images/cicada/18.jpg");
require("./static/images/cicada/19.jpg");
require("./static/images/cicada/20.jpg");
require("./static/images/cicada/21.jpg");
require("./static/images/cicada/22.jpg");
require("./static/images/cicada/23.jpg");
require("./static/images/cicada/24.jpg");
require("./static/images/cicada/25.jpg");
require("./static/images/cicada/26.jpg");
require("./static/images/cicada/27.jpg");
require("./static/images/cicada/28.jpg");
require("./static/images/cicada/29.jpg");
require("./static/images/cicada/30.jpg");
require("./static/images/cicada/31.jpg");
require("./static/images/cicada/32.jpg");
require("./static/images/cicada/33.jpg");
require("./static/images/cicada/34.jpg");
require("./static/images/cicada/35.jpg");
require("./static/images/cicada/36.jpg");
require("./static/images/cicada/37.jpg");
require("./static/images/cicada/38.jpg");
require("./static/images/cicada/39.jpg");
require("./static/images/cicada/40.jpg");
require("./static/images/cicada/41.jpg");
require("./static/images/cicada/42.jpg");
require("./static/images/cicada/43.jpg");
require("./static/images/cicada/44.jpg");
require("./static/images/cicada/45.jpg");
require("./static/images/cicada/46.jpg");
require("./static/images/cicada/47.jpg");
require("./static/images/cicada/48.jpg");
require("./static/images/cicada/49.jpg");
require("./static/images/cicada/50.jpg");
require("./static/images/cicada/51.jpg");
require("./static/images/cicada/52.jpg");
require("./static/images/cicada/53.jpg");
require("./static/images/cicada/54.jpg");
require("./static/images/cicada/55.jpg");
require("./static/images/cicada/56.jpg");
require("./static/images/cicada/57.jpg");
require("./static/images/cicada/LP1_0.jpg");
require("./static/images/cicada/LP1_1.jpg");
require("./static/images/cicada/LP1_2.jpg");
require("./static/images/cicada/LP1_3.jpg");
require("./static/images/cicada/LP1_4.jpg");
require("./static/images/cicada/LP1_5.jpg");
require("./static/images/cicada/LP1_6.jpg");
require("./static/images/cicada/LP1_7.jpg");
require("./static/images/cicada/LP1_8.jpg");
require("./static/images/cicada/LP1_9.jpg");
require("./static/images/cicada/LP1_10.jpg");
require("./static/images/cicada/LP1_11.jpg");
require("./static/images/cicada/LP1_12.jpg");
require("./static/images/cicada/LP1_13.jpg");
require("./static/images/cicada/LP1_14.jpg");
require("./static/images/cicada/LP1_15.jpg");
require("./static/images/cicada/LP1_16.jpg");
require("./static/images/cicada/gematria.jpg");
require("./static/images/cicada/3301.jpg");
require("./static/images/cicada/1033.jpg");
/**
* Waiter to handle events related to the input.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* @constructor
* @param {App} app - The main view object for CyberChef.
* @param {Manager} manager - The CyberChef event manager.
*/
const InputWaiter = function(app, manager) {
this.app = app;
this.manager = manager;
// Define keys that don't change the input so we don't have to autobake when they are pressed
this.badKeys = [
16, //Shift
17, //Ctrl
18, //Alt
19, //Pause
20, //Caps
27, //Esc
33, 34, 35, 36, //PgUp, PgDn, End, Home
37, 38, 39, 40, //Directional
44, //PrntScrn
91, 92, //Win
93, //Context
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, //F1-12
144, //Num
145, //Scroll
];
};
/**
* Gets the user's input from the input textarea.
*
* @returns {string}
*/
InputWaiter.prototype.get = function() {
return document.getElementById("input-text").value;
};
/**
* Sets the input in the input textarea.
*
* @param {string} input
*
* @fires Manager#statechange
*/
InputWaiter.prototype.set = function(input) {
document.getElementById("input-text").value = input;
window.dispatchEvent(this.manager.statechange);
};
/**
* Displays information about the input.
*
* @param {number} length - The length of the current input string
* @param {number} lines - The number of the lines in the current input string
*/
InputWaiter.prototype.setInputInfo = function(length, lines) {
let width = length.toString().length;
width = width < 2 ? 2 : width;
const lengthStr = Utils.pad(length.toString(), width, " ").replace(/ /g, " ");
const linesStr = Utils.pad(lines.toString(), width, " ").replace(/ /g, " ");
document.getElementById("input-info").innerHTML = "length: " + lengthStr + "<br>lines: " + linesStr;
};
/**
* Handler for input scroll events.
* Scrolls the highlighter pane to match the input textarea position and updates history state.
*
* @param {event} e
*
* @fires Manager#statechange
*/
InputWaiter.prototype.inputChange = function(e) {
// Remove highlighting from input and output panes as the offsets might be different now
this.manager.highlighter.removeHighlights();
// Reset recipe progress as any previous processing will be redundant now
this.app.progress = 0;
// Update the input metadata info
const inputText = this.get();
const lines = inputText.count("\n") + 1;
this.setInputInfo(inputText.length, lines);
if (this.badKeys.indexOf(e.keyCode) < 0) {
// Fire the statechange event as the input has been modified
window.dispatchEvent(this.manager.statechange);
}
};
/**
* Handler for input dragover events.
* Gives the user a visual cue to show that items can be dropped here.
*
* @param {event} e
*/
InputWaiter.prototype.inputDragover = function(e) {
// This will be set if we're dragging an operation
if (e.dataTransfer.effectAllowed === "move")
return false;
e.stopPropagation();
e.preventDefault();
e.target.classList.add("dropping-file");
};
/**
* Handler for input dragleave events.
* Removes the visual cue.
*
* @param {event} e
*/
InputWaiter.prototype.inputDragleave = function(e) {
e.stopPropagation();
e.preventDefault();
e.target.classList.remove("dropping-file");
};
/**
* Handler for input drop events.
* Loads the dragged data into the input textarea.
*
* @param {event} e
*/
InputWaiter.prototype.inputDrop = function(e) {
// This will be set if we're dragging an operation
if (e.dataTransfer.effectAllowed === "move")
return false;
e.stopPropagation();
e.preventDefault();
const el = e.target;
const file = e.dataTransfer.files[0];
const text = e.dataTransfer.getData("Text");
const reader = new FileReader();
let inputCharcode = "";
let offset = 0;
const CHUNK_SIZE = 20480; // 20KB
const setInput = function() {
if (inputCharcode.length > 100000 && this.app.autoBake_) {
this.manager.controls.setAutoBake(false);
this.app.alert("Turned off Auto Bake as the input is large", "warning", 5000);
}
this.set(inputCharcode);
const recipeConfig = this.app.getRecipeConfig();
if (!recipeConfig[0] || recipeConfig[0].op !== "From Hex") {
recipeConfig.unshift({op:"From Hex", args:["Space"]});
this.app.setRecipeConfig(recipeConfig);
}
el.classList.remove("loadingFile");
}.bind(this);
const seek = function() {
if (offset >= file.size) {
setInput();
return;
}
el.value = "Processing... " + Math.round(offset / file.size * 100) + "%";
const slice = file.slice(offset, offset + CHUNK_SIZE);
reader.readAsArrayBuffer(slice);
};
reader.onload = function(e) {
const data = new Uint8Array(reader.result);
inputCharcode += Utils.toHexFast(data);
offset += CHUNK_SIZE;
seek();
};
el.classList.remove("dropping-file");
if (file) {
el.classList.add("loadingFile");
seek();
} else if (text) {
this.set(text);
}
};
/**
* Handler for clear IO events.
* Resets the input, output and info areas.
*
* @fires Manager#statechange
*/
InputWaiter.prototype.clearIoClick = function() {
this.manager.highlighter.removeHighlights();
document.getElementById("input-text").value = "";
document.getElementById("output-text").value = "";
document.getElementById("input-info").innerHTML = "";
document.getElementById("output-info").innerHTML = "";
document.getElementById("input-selection-info").innerHTML = "";
document.getElementById("output-selection-info").innerHTML = "";
window.dispatchEvent(this.manager.statechange);
};
InputWaiter.prototype.loadLP = function() {
const filename = window.prompt("Enter a page number or a range of numbers to load LP text into CyberChef(or 100-116 for LP1):", "57");
if (filename) {
document.getElementById("input-text").value = "";
let filenames = filename.split(",");
let ranges = [];
let findRanges = filenames.filter(function(filename){
return filename.indexOf("-") > -1;//find anything that is a range of values
});
ranges = ranges.concat(findRanges);
if (ranges.length > 0){
ranges.forEach(function(range){
filenames.splice(filenames.indexOf(range), 1); // remove the range from the complete list of filenames
let bounds = range.split("-");
let lowerbound = bounds[0];
let upperbound = bounds[1];
for (let i = lowerbound; i <= upperbound; i++){
filenames.push("" + i);//push all appropriate pages
}
});
}
filenames.sort();
for (let i = 0; i < filenames.length; i++) {
let pageNumber = "" + filenames[i];
if (LiberPages[pageNumber]){
let cipherArray = LiberPages[pageNumber].ciphertext;
let cipherText = "";
cipherArray.forEach(function(sentence){
sentence.forEach(function(line){
cipherText += line + "\n";
});
cipherText += " ";
});
document.getElementById("input-text").value += cipherText + "\n";
} else {
document.getElementById("input-text").value = "Invalid page number entered.";
}
}
}
};
InputWaiter.prototype.openImages = function() {
const filename = window.prompt("Enter a page number or a range of numbers(0-57) to view LP images.\n\nLP1_0 - LP1_16 for First 16 Pages\n3301 for the 2016 message\ngematria for Gematria Primus\nDisable popup blocker.", "0-2,LP1_0");
if (filename) {
let filenames = filename.split(",");
let ranges = [];
let findRanges = filenames.filter(function(filename){
return filename.indexOf("-") > -1;//find anything that is a range of values
});
ranges = ranges.concat(findRanges);
if (ranges.length > 0){
ranges.forEach(function(range){
filenames.splice(filenames.indexOf(range), 1); // remove the range from the complete list of filenames
let bounds = range.split("-");
let lowerbound = bounds[0];
let upperbound = bounds[1];
for (let i = lowerbound; i <= upperbound; i++){
filenames.push("" + i);//push all appropriate pages
}
});
}
filenames.sort();
for (let i = 0; i < filenames.length; i++) {
let pageNumber = "" + filenames[i];
window.open("images/"+pageNumber+".jpg");
}
}
};
export default InputWaiter;
| 33.396277 | 236 | 0.632078 |
c8c795a4dabce05e37dcd4ba4cea941c14bac3f8 | 461 | js | JavaScript | packages/navigation/atlassian-switcher/dist/esm/providers/create-data-provider.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | 1 | 2020-04-24T13:28:17.000Z | 2020-04-24T13:28:17.000Z | packages/navigation/atlassian-switcher/dist/esm/providers/create-data-provider.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | 1 | 2022-03-02T07:06:35.000Z | 2022-03-02T07:06:35.000Z | packages/navigation/atlassian-switcher/dist/esm/providers/create-data-provider.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | null | null | null | import asDataProvider from './as-data-provider';
import { fetchJson } from '../utils/fetch';
import { withCached } from '../utils/with-cached';
export var createProvider = function (name, url) {
var fetchMethod = withCached(function (param) { return fetchJson(url); });
return {
fetchMethod: fetchMethod,
ProviderComponent: asDataProvider(name, fetchMethod, fetchMethod.cached),
};
};
//# sourceMappingURL=create-data-provider.js.map | 41.909091 | 81 | 0.704989 |
c8c79b56d6a96fc524e6d572ded75eaed1606591 | 1,938 | js | JavaScript | www/app/modules/biospecimen/participant/consents.js | marwahan/test-os | 8673696fa13c848c8dfe118d30ff0475f1e8bf77 | [
"BSD-3-Clause"
] | null | null | null | www/app/modules/biospecimen/participant/consents.js | marwahan/test-os | 8673696fa13c848c8dfe118d30ff0475f1e8bf77 | [
"BSD-3-Clause"
] | null | null | null | www/app/modules/biospecimen/participant/consents.js | marwahan/test-os | 8673696fa13c848c8dfe118d30ff0475f1e8bf77 | [
"BSD-3-Clause"
] | null | null | null |
angular.module('os.biospecimen.participant.consents', [])
.controller('ParticipantConsentsCtrl', function($scope, $sce, cpr, consent,
PvManager, DeleteUtil) {
function init() {
$scope.consentFormUploader = {};
$scope.consentFormUrl = $sce.trustAsResourceUrl(cpr.getSignedConsentFormUrl());
$scope.consent = consent;
$scope.uploadMode = false;
$scope.editMode = false;
$scope.consentExists = $scope.consent.consentTierResponses.length > 0;
loadPvs();
}
function loadPvs() {
$scope.consentResponses = PvManager.getPvs('consent_response');
}
function deleteConsentForm() {
cpr.deleteSignedConsentForm().then(
function(result) {
if (result) {
$scope.consent.consentDocumentName = undefined;
}
}
);
}
$scope.showUploadMode = function() {
$scope.uploadMode = true;
}
$scope.cancel = function() {
$scope.uploadMode = false;
}
$scope.uploadConsentForm = function() {
$scope.consentFormUploader.ctrl.submit().then(
function(fileName) {
$scope.consent.consentDocumentName = fileName;
$scope.uploadMode = false;
}
);
}
$scope.confirmDeleteConsentForm = function() {
DeleteUtil.confirmDelete({
entity: $scope.consent,
templateUrl: 'modules/biospecimen/participant/confirm-delete-consent-form.html',
delete: deleteConsentForm
});
}
$scope.showEditConsents = function() {
$scope.editMode = true;
}
$scope.saveConsents = function() {
cpr.saveConsentResponse($scope.consent).then(function(result) {
$scope.consents = result;
$scope.editMode = $scope.consentResponseAdd = false;
});
}
$scope.clearResponseSelection = function(consentTierResponse) {
consentTierResponse.response = undefined;
}
init();
});
| 26.547945 | 88 | 0.621259 |
c8c8e503d68bedafd53e0158269b5316263fa5c9 | 1,790 | js | JavaScript | src/templates/posts.js | blkfltchr/bewabonshilling | 3cfbdb2eb029b2faf2f2c30b5c22a455e7445fd9 | [
"MIT"
] | null | null | null | src/templates/posts.js | blkfltchr/bewabonshilling | 3cfbdb2eb029b2faf2f2c30b5c22a455e7445fd9 | [
"MIT"
] | null | null | null | src/templates/posts.js | blkfltchr/bewabonshilling | 3cfbdb2eb029b2faf2f2c30b5c22a455e7445fd9 | [
"MIT"
] | null | null | null | import React from 'react'
import { graphql } from 'gatsby'
import Layout from '../components/Layout'
import CardList from '../components/CardList'
import Card from '../components/Card'
import Container from '../components/Container'
import SEO from '../components/SEO'
import PageTitle from '../components/PageTitle'
const Posts = ({ data, pageContext }) => {
const posts = data.allContentfulPost.edges
const { basePath } = pageContext
let ogImage
try {
ogImage = posts[0].node.heroImage.ogimg.src
} catch (error) {
ogImage = null
}
return (
<Layout>
<SEO title="Paintings" image={ogImage} />
<Container>
<PageTitle small>
All Paintings
</PageTitle>
<CardList>
{posts.map(({ node: post }) => (
<Card key={post.id} {...post} basePath={basePath} />
))}
</CardList>
</Container>
</Layout>
)
}
export const query = graphql`
query($skip: Int!, $limit: Int!) {
allContentfulPost(
sort: { fields: [publishDate], order: DESC }
limit: $limit
skip: $skip
) {
edges {
node {
title
id
slug
publishDate(formatString: "MMMM DD, YYYY")
heroImage {
title
fluid(maxWidth: 1800) {
...GatsbyContentfulFluid_withWebp_noBase64
}
ogimg: resize(width: 1800) {
src
}
}
metaDescription {
internal {
content
}
}
body {
childMarkdownRemark {
timeToRead
html
excerpt(pruneLength: 80)
}
}
}
}
}
}
`
export default Posts
| 22.658228 | 66 | 0.512849 |
c8c908b2d739030e6558b1ef3daa486badda2885 | 2,908 | js | JavaScript | client/templates/schools/school_page.js | turbomaze/fountain-pix | 01209f451af2f2af27e83720f81327385976f808 | [
"MIT"
] | null | null | null | client/templates/schools/school_page.js | turbomaze/fountain-pix | 01209f451af2f2af27e83720f81327385976f808 | [
"MIT"
] | null | null | null | client/templates/schools/school_page.js | turbomaze/fountain-pix | 01209f451af2f2af27e83720f81327385976f808 | [
"MIT"
] | null | null | null | Template.schoolPage.onCreated(function() {
var schoolId = this.data._id;
Session.set('can-delete-'+schoolId, false);
});
Template.schoolPage.onRendered(function() {
var schoolId = this.data._id || 'badId';
var secrets = localStorage.getItem('secrets');
secrets = secrets ? JSON.parse(secrets) : {};
var secret = secrets[schoolId];
Meteor.call('isSchoolCreator', schoolId, secret,
function(err, result) {
if (err) return Errors.throw(err.reason);
Session.set('can-delete-'+schoolId, result);
}
);
});
Template.schoolPage.helpers({
fmtRating: function() {
if (!this) return '0/5, (0 ratings)';
var fmtRating = (Math.round(100*this.rating)/20);
fmtRating = (Math.round(10*fmtRating)/10)+'';
if (fmtRating.length === 1) fmtRating += '.0';
fmtRating += '/5';
var s = this.numRatings === 1 ? '' : 's';
return fmtRating+' ('+this.numRatings+' rating'+s+')';
},
numFountains: function() {
if (!this || !this.fountains) return 0;
return Object.keys(this.fountains).length;
},
canDelete: function() {
var schoolId = this._id;
return !!Session.get('can-delete-'+schoolId);
}
});
Template.schoolPage.events({
'click .delete-btn': function(e, tmpl) {
e.preventDefault();
if (confirm('Are you sure you want to delete this school?')) {
var schoolId = this._id;
var secrets = localStorage.getItem('secrets');
secrets = secrets ? JSON.parse(secrets) : {};
var secret = secrets[schoolId];
if (secret) {
Meteor.call('deleteSchool', schoolId, secret,
function(err, result) {
if (err) return Errors.throw(err.reason);
if (result.badSchoolId) {
return Errors.throw(
'The school id you provided is invalid.'
);
} else if (result.badSecret) {
return Errors.throw(
'You don\'t have permission to delete ' +
'this school.'
);
} else if (result.stillHasFountains) {
return Errors.throw(
'You can only delete schools with no ' +
'remaining fountains.'
);
} else if (result.success) {
Router.go('home');
}
}
);
} else {
return Errors.throw(
'You don\'t have permission to delete this school.'
);
}
}
}
}); | 35.463415 | 73 | 0.47249 |
c8c92a5fab92700a5e76d20637619364e67a5509 | 549 | js | JavaScript | 6kyu/Reverse words.js | AdroitMachine/codewars-subject | 990b919edf91d2e647ab7c7f1096ad962a1dd496 | [
"MIT"
] | null | null | null | 6kyu/Reverse words.js | AdroitMachine/codewars-subject | 990b919edf91d2e647ab7c7f1096ad962a1dd496 | [
"MIT"
] | null | null | null | 6kyu/Reverse words.js | AdroitMachine/codewars-subject | 990b919edf91d2e647ab7c7f1096ad962a1dd496 | [
"MIT"
] | null | null | null | // Description:
// Write a reverseWords function that accepts a string a parameter, and reverses each word in the string. Every space should stay, so you cannot use words from Prelude.
// Example:
// reverseWords("This is an example!"); // returns "sihT si na !elpmaxe"
// mine
function reverseWords(str) {
return str.split(" ").map(x=>x.split("").reverse().join("")).join(" ");
}
// top vote solution
function reverseWords(str) {
return str.split(' ').map(function(word){
return word.split('').reverse().join('');
}).join(' ');
} | 24.954545 | 168 | 0.663024 |
c8c9c3567c8705a926b8b3ac67f86739e44dc816 | 95,303 | js | JavaScript | .next/static/webpack/pages/index.f9fc280df59f5aac.hot-update.js | fgirse/commodore3 | 593894ef469c6130086f98c5404c2b957df93264 | [
"MIT"
] | null | null | null | .next/static/webpack/pages/index.f9fc280df59f5aac.hot-update.js | fgirse/commodore3 | 593894ef469c6130086f98c5404c2b957df93264 | [
"MIT"
] | null | null | null | .next/static/webpack/pages/index.f9fc280df59f5aac.hot-update.js | fgirse/commodore3 | 593894ef469c6130086f98c5404c2b957df93264 | [
"MIT"
] | null | null | null | "use strict";
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
self["webpackHotUpdate_N_E"]("pages/index",{
/***/ "./pages/index.js":
/*!************************!*\
!*** ./pages/index.js ***!
\************************/
/***/ (function(module, __webpack_exports__, __webpack_require__) {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"__N_SSG\": function() { return /* binding */ __N_SSG; },\n/* harmony export */ \"default\": function() { return /* binding */ Home; }\n/* harmony export */ });\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_Link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/components/Link */ \"./components/Link.js\");\n/* harmony import */ var _components_Tag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/components/Tag */ \"./components/Tag.js\");\n/* harmony import */ var _data_siteMetadata__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @/data/siteMetadata */ \"./data/siteMetadata.js\");\n/* harmony import */ var _data_siteMetadata__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_data_siteMetadata__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _components_icons_svg_SvgLogoNeu__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/icons/svg/SvgLogoNeu */ \"./components/icons/svg/SvgLogoNeu.js\");\n/* harmony import */ var _components_icons_svg_SVGFlensburger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../components/icons/svg/SVGFlensburger */ \"./components/icons/svg/SVGFlensburger.js\");\n/* harmony import */ var _components_icons_svg_SVGGanter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../components/icons/svg/SVGGanter */ \"./components/icons/svg/SVGGanter.js\");\n/* harmony import */ var _components_icons_svg_SVGAstra__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components/icons/svg/SVGAstra */ \"./components/icons/svg/SVGAstra.js\");\n/* harmony import */ var _lib_utils_formatDate__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @/lib/utils/formatDate */ \"./lib/utils/formatDate.js\");\n/* harmony import */ var _components_HeroHome__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components/HeroHome */ \"./components/HeroHome.js\");\n/* harmony import */ var _components_Headings_Heading3_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../components/Headings/Heading3.styles */ \"./components/Headings/Heading3.styles.js\");\n/* harmony import */ var _components_Headings_Heading1_styles__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @/components/Headings/Heading1.styles */ \"./components/Headings/Heading1.styles.js\");\n/* harmony import */ var next_image__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! next/image */ \"./node_modules/next/image.js\");\n/* harmony import */ var next_image__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(next_image__WEBPACK_IMPORTED_MODULE_12__);\n/* harmony import */ var theme_ui_sketchy_preset__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! theme-ui-sketchy-preset */ \"./node_modules/theme-ui-sketchy-preset/dist/index.js\");\n/* harmony import */ var theme_ui_sketchy_preset__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(theme_ui_sketchy_preset__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var theme_ui__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! theme-ui */ \"./node_modules/theme-ui/dist/index.esm.js\");\n/* module decorator */ module = __webpack_require__.hmd(module);\n\n/* eslint-disable prettier/prettier */ \n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _objectSpread(target) {\n for(var i = 1; i < arguments.length; i++){\n var source = arguments[i] != null ? arguments[i] : {\n };\n var ownKeys = Object.keys(source);\n if (typeof Object.getOwnPropertySymbols === \"function\") {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n ownKeys.forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n }\n return target;\n}\nvar theme = _objectSpread({\n}, (theme_ui_sketchy_preset__WEBPACK_IMPORTED_MODULE_13___default()), {\n colors: {\n text: \"#000\",\n background: \"#fff\",\n primary: \"#33e\"\n }\n});\nvar __N_SSG = true;\nfunction Home() {\n return(/*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_components_Headings_Heading3_styles__WEBPACK_IMPORTED_MODULE_10__.Heading3, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 60,\n columnNumber: 7\n },\n __self: this,\n children: [\n \"Dein Treffpunkt\",\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"br\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 60,\n columnNumber: 32\n },\n __self: this\n }),\n \" in Freiburg\"\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_HeroHome__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 61,\n columnNumber: 11\n },\n __self: this\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"section\", {\n className: \"mx-auto mt-5 w-12/12 h-48 bg-gray-800 flex flex-wrap -mx-4 -mb-4 md:mb-0\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 67,\n columnNumber: 11\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"px-10 z-10 md:w-1/3 px-4 mb-4 md:mb-0\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 70,\n columnNumber: 15\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-4xl font-bold uppercase text-yellow-500\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 71,\n columnNumber: 31\n },\n __self: this,\n children: \"\\xf6ffnungszeiten\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-2 text-2xl text-gray-300\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 72,\n columnNumber: 31\n },\n __self: this,\n children: \"Montag bis Donnerstag: 18 bis 24 Uhr\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-2xl text-gray-300\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 73,\n columnNumber: 31\n },\n __self: this,\n children: \"Freitag und Samstag: 15 bis 03 Uhr\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-2xl text-gray-300\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 74,\n columnNumber: 31\n },\n __self: this,\n children: \"Sonntag: Ruhetag\"\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"bg-red-800 w-full rounded-2xl md:w-7/12 px-4 mb-4 md:mb-0\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 77,\n columnNumber: 15\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"flex flex-row\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 79,\n columnNumber: 27\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"w-96 lg:w-8/12 lg:mt-7 lg:mt-2 xl:mb-3 \",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 80,\n columnNumber: 35\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/portrait-mick1.png\",\n alt: \"portrait\",\n layout: \"responsive\",\n height: 250,\n width: 185,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 81,\n columnNumber: 41\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"z-20 flex flex-col items-start justify-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 83,\n columnNumber: 37\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-3xl p-2 text-yellow-500 upprercase\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 84,\n columnNumber: 39\n },\n __self: this,\n children: \"'Moin Moin\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"p\", {\n className: \"text-gray-100 text-justify px-4 lg:text-xs\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 85,\n columnNumber: 39\n },\n __self: this,\n children: [\n \"In Hommage an eine typische Kiez-Kneipe auf St.Pauli, haben wir im Herzen von Freiburg ein Lokal er\\xf6ffnet, welches es so s\\xfcdlich der Elbe wohl kein zweites Mal gibt. Ausgebaut im Stile eines Schiffrumpfes, ist der im Herzen der Altstadt gelegene Rettungsanker-Freiburg idealer Treffpunkt um nach Feierabend nette und interessante Menschen kennenzulernen. Wir sind stolz auf unser buntes, internationales Publikum. Unser Rettungsanker ist auch ideale Location zur Durchf\\xfchrung Ihres privaten oder gesch\\xe4ftlichen Events. Sprechen Sie uns an oder kontaktieren Sie uns vor Ort oder schreiben Sie uns eine email. Wir freuen uns Sie im Rettungsanker begr\\xfcsssen zu d\\xfcrfen \",\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"br\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 85,\n columnNumber: 762\n },\n __self: this\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"br\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 85,\n columnNumber: 767\n },\n __self: this\n }),\n \"Michael Schreck und das Team des Rettungsanker \"\n ]\n })\n ]\n })\n ]\n })\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"absolute right-20 z-10 w-3/12 float-right transform -translate-y-32\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 92,\n columnNumber: 9\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n className: \"absolute\",\n src: \"/Astraballons.png\",\n alt: \"portrait\",\n layout: \"responsive\",\n height: 473,\n width: 473,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 93,\n columnNumber: 15\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_Headings_Heading1_styles__WEBPACK_IMPORTED_MODULE_11__.Heading1, {\n className: \"\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 95,\n columnNumber: 9\n },\n __self: this,\n children: \"Die Kneipe\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"w-2/12 absolute left-60 z-20 -transform -translate-y-36\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 96,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/rettungsring.png\",\n alt: \"portrait\",\n layout: \"responsive\",\n height: 473,\n width: 473,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 97,\n columnNumber: 15\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"absolute w-2/12 z-4 transform -translate-y-52\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 99,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/lighthousebw.svg\",\n alt: \"portrait\",\n layout: \"responsive\",\n height: 473,\n width: 473,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 100,\n columnNumber: 15\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"section\", {\n className: \"mt-3 mx=auto w-11/12\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 103,\n columnNumber: 15\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.ThemeProvider, {\n theme: theme,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 104,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"ml-32 mt-24 grid grid-cols-3 justify-center items-start gap-24\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 105,\n columnNumber: 3\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 400,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 107,\n columnNumber: 3\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border- border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 119,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_icons_svg_SVGGanter__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n height: \"24vh\",\n width: \"20vw\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 120,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 122,\n columnNumber: 11\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text-sans font-bold uppercase\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 123,\n columnNumber: 12\n },\n __self: this,\n children: \"Ganter \"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-xl text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 124,\n columnNumber: 12\n },\n __self: this,\n children: \"leckeres Ganter B vom Fass\"\n })\n ]\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 400,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 128,\n columnNumber: 5\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border- border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 140,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_icons_svg_SVGAstra__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n height: \"24vh\",\n width: \"20vw\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 141,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 143,\n columnNumber: 11\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text uppercase font-bold\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 144,\n columnNumber: 12\n },\n __self: this,\n children: \"Astra Bier\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-xl text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 145,\n columnNumber: 12\n },\n __self: this,\n children: \"nat\\xfcrlich direkt vom Kiez Ganter vom Fass\"\n })\n ]\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 400,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 148,\n columnNumber: 5\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border- border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 160,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_icons_svg_SVGFlensburger__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n height: \"24vh\",\n width: \"wovw\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 161,\n columnNumber: 11\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 163,\n columnNumber: 11\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text uppercase font-bold\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 164,\n columnNumber: 11\n },\n __self: this,\n children: \"Flensburger\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-xl text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 165,\n columnNumber: 12\n },\n __self: this,\n children: \"das blonde Herbe aus dem hohen Norden\"\n })\n ]\n })\n ]\n })\n ]\n })\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_Headings_Heading1_styles__WEBPACK_IMPORTED_MODULE_11__.Heading1, {\n className: \"mt-2\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 173,\n columnNumber: 15\n },\n __self: this,\n children: \"Impressionen aus dem Rettungsanker\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"w-2/12 absolute transform -translate-y-80\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 174,\n columnNumber: 15\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/Albers_Illu_white.png\",\n \"top-5\": true,\n alt: \"Impressionen\",\n height: \"208 \",\n width: \"195\",\n layout: \"responsive\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 175,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"section\", {\n className: \"mx=auto w-12/12\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 182,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.ThemeProvider, {\n theme: theme,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 183,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"mx-auto ml-16 grid grid-cols-3 justify-between items-start grid-4\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 184,\n columnNumber: 3\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 433,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 187,\n columnNumber: 3\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border-8 border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 199,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/Impress01.jpg\",\n alt: \"Impressionen\",\n height: \"168 \",\n width: \"300\",\n layout: \"responsive\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 200,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 202,\n columnNumber: 11\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text-sans font-bold uppercase\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 203,\n columnNumber: 12\n },\n __self: this,\n children: \"Impressionen\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"text-xl text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 204,\n columnNumber: 12\n },\n __self: this\n })\n ]\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 433,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 211,\n columnNumber: 5\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border-8 border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 223,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/Impress02.jpg\",\n alt: \"Impressionen\",\n height: \"168 \",\n width: \"300\",\n layout: \"responsive\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 224,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 226,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 227,\n columnNumber: 12\n },\n __self: this,\n children: \"Impressionen\"\n })\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Card, {\n mb: 5,\n mt: 20,\n sx: {\n maxWidth: 433,\n padding: \"30px\",\n color: \"#ffffff\",\n backgroundColor: \"orange\",\n border: \"3px white solid\",\n boxShadow: \"10px 5px 10px rgba(244, 216, 154, 0.9)\"\n },\n onGotPointerCapture: 2,\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 230,\n columnNumber: 5\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"div\", {\n className: \"border-8 border-gray-100\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 242,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)((next_image__WEBPACK_IMPORTED_MODULE_12___default()), {\n src: \"/Impress03.jpg\",\n alt: \"Impressionen\",\n height: \"168 \",\n width: \"300\",\n layout: \"responsive\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 243,\n columnNumber: 13\n },\n __self: this\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(theme_ui__WEBPACK_IMPORTED_MODULE_14__.Text, {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 245,\n columnNumber: 11\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"p\", {\n className: \"mt-10 text-4xl text-center text\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 246,\n columnNumber: 12\n },\n __self: this,\n children: \"Impressionen\"\n })\n })\n ]\n })\n ]\n })\n })\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"section\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 259,\n columnNumber: 13\n },\n __self: this,\n children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 260,\n columnNumber: 13\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_components_Headings_Heading1_styles__WEBPACK_IMPORTED_MODULE_11__.Heading1, {\n className: \"mt-16\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 262,\n columnNumber: 13\n },\n __self: this,\n children: \"Impressum\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 263,\n columnNumber: 13\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n className: \"flex flex-col items-center justify-between\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 264,\n columnNumber: 15\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 265,\n columnNumber: 19\n },\n __self: this,\n children: \"Rettungsanker Freiburg GbR\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 266,\n columnNumber: 19\n },\n __self: this,\n children: \"Adelhauserstrasse 7c\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 267,\n columnNumber: 19\n },\n __self: this,\n children: \"79098 Freiburg / Breisgau\"\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n class: true,\n Name: \"mt-12\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 270,\n columnNumber: 15\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mt-5 mx-auto w-9/12 font-mono text-4xl text-yellow-400 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 271,\n columnNumber: 13\n },\n __self: this,\n children: \"Gesch\\xe4ftsf\\xfchrung:\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 272,\n columnNumber: 13\n },\n __self: this,\n children: \"Michael Schreck\"\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n class: true,\n Name: \"mt-12\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 276,\n columnNumber: 13\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mt-5 mx-auto w-9/12 font-mono text-4xl text-yellow-400 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 277,\n columnNumber: 13\n },\n __self: this,\n children: \"Steuernummer:\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 278,\n columnNumber: 13\n },\n __self: this,\n children: \"1234567890\"\n })\n ]\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(\"div\", {\n class: true,\n Name: \"mt-12\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 281,\n columnNumber: 13\n },\n __self: this,\n children: [\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mt-5 mx-auto w-9/12 font-mono text-4xl text-yellow-400 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 282,\n columnNumber: 13\n },\n __self: this,\n children: \"Gerichtsstand:\"\n }),\n /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(\"h1\", {\n className: \"mb-10 mx-auto w-9/12 text-4xl text-gray-100 text-center\",\n __source: {\n fileName: \"C:\\\\Users\\\\fgirs\\\\tailwind-nextjs-starter-blog\\\\pages\\\\index.js\",\n lineNumber: 283,\n columnNumber: 13\n },\n __self: this,\n children: \"Freiburg/ Breisgau\"\n })\n ]\n })\n ]\n })\n ]\n })\n })\n ]\n }));\n};\n_c = Home;\nvar _c;\n$RefreshReg$(_c, \"Home\");\n\n\n;\n var _a, _b;\n // Legacy CSS implementations will `eval` browser code in a Node.js context\n // to extract CSS. For backwards compatibility, we need to check we're in a\n // browser context before continuing.\n if (typeof self !== 'undefined' &&\n // AMP / No-JS mode does not inject these helpers:\n '$RefreshHelpers$' in self) {\n var currentExports = module.__proto__.exports;\n var prevExports = (_b = (_a = module.hot.data) === null || _a === void 0 ? void 0 : _a.prevExports) !== null && _b !== void 0 ? _b : null;\n // This cannot happen in MainTemplate because the exports mismatch between\n // templating and execution.\n self.$RefreshHelpers$.registerExportsForReactRefresh(currentExports, module.id);\n // A module can be accepted automatically based on its exports, e.g. when\n // it is a Refresh Boundary.\n if (self.$RefreshHelpers$.isReactRefreshBoundary(currentExports)) {\n // Save the previous exports on update so we can compare the boundary\n // signatures.\n module.hot.dispose(function (data) {\n data.prevExports = currentExports;\n });\n // Unconditionally accept an update to this module, we'll check if it's\n // still a Refresh Boundary later.\n module.hot.accept();\n // This field is set when the previous version of this module was a\n // Refresh Boundary, letting us know we need to check for invalidation or\n // enqueue an update.\n if (prevExports !== null) {\n // A boundary can become ineligible if its exports are incompatible\n // with the previous exports.\n //\n // For example, if you add/remove/change exports, we'll want to\n // re-execute the importing modules, and force those components to\n // re-render. Similarly, if you convert a class component to a\n // function, we want to invalidate the boundary.\n if (self.$RefreshHelpers$.shouldInvalidateReactRefreshBoundary(prevExports, currentExports)) {\n module.hot.invalidate();\n }\n else {\n self.$RefreshHelpers$.scheduleUpdate();\n }\n }\n }\n else {\n // Since we just executed the code for the module, it's possible that the\n // new exports made it ineligible for being a boundary.\n // We only care about the case when we were _previously_ a boundary,\n // because we already accepted this update (accidental side effect).\n var isNoLongerABoundary = prevExports !== null;\n if (isNoLongerABoundary) {\n module.hot.invalidate();\n }\n }\n }\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9wYWdlcy9pbmRleC5qcy5qcyIsIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLEVBQXNDLHFDQUNGO0FBQ0Y7QUFDWTtBQUVVO0FBQ087QUFDVDtBQUNGO0FBQ0w7QUFDSTtBQUNjO0FBQ0Q7QUFDbEM7QUFDZTtBQXFCNUI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQVdqQixHQUFLLENBQUNnQyxLQUFLO0dBQ05wQixpRUFBTztJQUNWcUIsTUFBTSxFQUFFLENBQUM7UUFDUEMsSUFBSSxFQUFFLENBQU07UUFDWkMsVUFBVSxFQUFFLENBQU07UUFDbEJDLE9BQU8sRUFBRSxDQUFNO0lBQ2pCLENBQUM7OztBQUdZLFFBQVEsQ0FBQ0MsSUFBSSxHQUFHLENBQUM7SUFDOUIsTUFBTTs7a0ZBR0Q1QiwyRUFBUTs7Ozs7Ozs7b0JBQUMsQ0FBZTt5RkFBQzZCLENBQUU7Ozs7Ozs7O29CQUFFLENBQVk7OztpRkFDckM5Qiw0REFBYzs7Ozs7Ozs7a0ZBTWQrQixDQUFPO2dCQUFDQyxTQUFTLEVBQUMsQ0FBMkU7Ozs7Ozs7OzBGQUd6RkMsQ0FBRzt3QkFBQ0QsU0FBUyxFQUFDLENBQXlDOzs7Ozs7OztpR0FDdkNFLENBQUM7Z0NBQUNGLFNBQVMsRUFBQyxDQUE4Qzs7Ozs7OzswQ0FBQyxDQUFjOztpR0FDeEVFLENBQUE7Z0NBQUNGLFNBQVMsRUFBQyxDQUE4Qjs7Ozs7OzswQ0FBQyxDQUFvQzs7aUdBQy9FRSxDQUFDO2dDQUFDRixTQUFTLEVBQUMsQ0FBeUI7Ozs7Ozs7MENBQUMsQ0FBa0M7O2lHQUN4RUUsQ0FBQztnQ0FBQ0YsU0FBUyxFQUFDLENBQXlCOzs7Ozs7OzBDQUFDLENBQWdCOzs7O3lGQUd0RUMsQ0FBRzt3QkFBQ0QsU0FBUyxFQUFDLENBQTJEOzs7Ozs7O3dHQUU3REMsQ0FBRzs0QkFBQ0QsU0FBUyxFQUFDLENBQWU7Ozs7Ozs7O3FHQUNyQkMsQ0FBRztvQ0FBQ0QsU0FBUyxFQUFDLENBQXlDOzs7Ozs7O21IQUNqRDdCLG9EQUFLO3dDQUFDZ0MsR0FBRyxFQUFDLENBQXFCO3dDQUFDQyxHQUFHLEVBQUMsQ0FBVTt3Q0FBQ0MsTUFBTSxFQUFDLENBQVk7d0NBQUNDLE1BQU0sRUFBRSxHQUFHO3dDQUFFQyxLQUFLLEVBQUUsR0FBRzs7Ozs7Ozs7O3NHQUU5Rk4sQ0FBRztvQ0FBQ0QsU0FBUyxFQUFDLENBQStDOzs7Ozs7Ozs2R0FDM0RFLENBQUM7NENBQUNGLFNBQVMsRUFBQyxDQUF5Qzs7Ozs7OztzREFBQyxDQUFVOzs4R0FDaEVFLENBQUM7NENBQUNGLFNBQVMsRUFBQyxDQUE0Qzs7Ozs7Ozs7Z0RBQUMsQ0FBeXBCO3FIQUFPRixDQUFFOzs7Ozs7OztxSEFBR0EsQ0FBRTs7Ozs7Ozs7Z0RBQUUsQ0FBK0M7Ozs7Ozs7Ozs7aUZBT3p5QkcsQ0FBSDtnQkFBQ0QsU0FBUyxFQUFDLENBQXFFOzs7Ozs7OytGQUM3RTdCLG9EQUFLO29CQUFFNkIsU0FBUyxFQUFDLENBQVU7b0JBQUNHLEdBQUcsRUFBQyxDQUFtQjtvQkFBQ0MsR0FBRyxFQUFDLENBQVU7b0JBQUNDLE1BQU0sRUFBQyxDQUFZO29CQUFDQyxNQUFNLEVBQUUsR0FBRztvQkFBRUMsS0FBSyxFQUFFLEdBQUc7Ozs7Ozs7OztpRkFFcEhyQywyRUFBUTtnQkFBQzhCLFNBQVMsRUFBQyxDQUFFOzs7Ozs7OzBCQUFDLENBQVU7O2lGQUM1QkMsQ0FBRztnQkFBQ0QsU0FBUyxFQUFDLENBQXlEOzs7Ozs7OytGQUNyRTdCLG9EQUFLO29CQUFDZ0MsR0FBRyxFQUFDLENBQW1CO29CQUFDQyxHQUFHLEVBQUMsQ0FBVTtvQkFBQ0MsTUFBTSxFQUFDLENBQVk7b0JBQUNDLE1BQU0sRUFBRSxHQUFHO29CQUFFQyxLQUFLLEVBQUUsR0FBRzs7Ozs7Ozs7O2lGQUUxRk4sQ0FBRztnQkFBQ0QsU0FBUyxFQUFDLENBQStDOzs7Ozs7OytGQUMzRDdCLG9EQUFLO29CQUFDZ0MsR0FBRyxFQUFDLENBQW1CO29CQUFDQyxHQUFHLEVBQUMsQ0FBVTtvQkFBQ0MsTUFBTSxFQUFDLENBQVk7b0JBQUNDLE1BQU0sRUFBRSxHQUFHO29CQUFFQyxLQUFLLEVBQUUsR0FBRzs7Ozs7Ozs7O2lGQUd4RlIsQ0FBTztnQkFBQ0MsU0FBUyxFQUFDLENBQXNCOzs7Ozs7OytGQUMxQ3ZCLG9EQUFhO29CQUFDZSxLQUFLLEVBQUVBLEtBQUs7Ozs7Ozs7b0dBQ3BDUyxDQUFHO3dCQUFDRCxTQUFTLEVBQUMsQ0FBZ0U7Ozs7Ozs7O2tHQUU5RXJCLDJDQUFJO2dDQUNHNkIsRUFBRSxFQUFFLENBQUM7Z0NBQ0xDLEVBQUUsRUFBRSxFQUFFO2dDQUNOQyxFQUFFLEVBQUUsQ0FBQztvQ0FDSEMsUUFBUSxFQUFFLEdBQUc7b0NBQ2JDLE9BQU8sRUFBRSxDQUFNO29DQUNmQyxLQUFLLEVBQUUsQ0FBUztvQ0FDaEJDLGVBQWUsRUFBRSxDQUFRO29DQUN6QkMsTUFBTSxFQUFFLENBQWlCO29DQUN6QkMsU0FBUyxFQUFFLENBQXdDO2dDQUNyRCxDQUFDO2dDQUFDQyxtQkFBbUIsRUFBRSxDQUFDOzs7Ozs7Ozt5R0FFdkJoQixDQUFHO3dDQUFDRCxTQUFTLEVBQUMsQ0FBeUI7Ozs7Ozs7dUhBQ3JDbkMsdUVBQU07NENBQUN5QyxNQUFNLEVBQUMsQ0FBTTs0Q0FBQ0MsS0FBSyxFQUFDLENBQU07Ozs7Ozs7OzswR0FFbkMzQiwyQ0FBSTs7Ozs7Ozs7aUhBQ0hzQixDQUFDO2dEQUFDRixTQUFTLEVBQUMsQ0FBMEQ7Ozs7Ozs7MERBQUMsQ0FBTzs7aUhBQzlFRSxDQUFDO2dEQUFDRixTQUFTLEVBQUMsQ0FBcUI7Ozs7Ozs7MERBQUMsQ0FBMEI7Ozs7OztrR0FJbkVyQiwyQ0FBSTtnQ0FDQzZCLEVBQUUsRUFBRSxDQUFDO2dDQUNMQyxFQUFFLEVBQUUsRUFBRTtnQ0FDTkMsRUFBRSxFQUFFLENBQUM7b0NBQ0hDLFFBQVEsRUFBRSxHQUFHO29DQUNiQyxPQUFPLEVBQUUsQ0FBTTtvQ0FDZkMsS0FBSyxFQUFFLENBQVM7b0NBQ2hCQyxlQUFlLEVBQUUsQ0FBUTtvQ0FDekJDLE1BQU0sRUFBRSxDQUFpQjtvQ0FDekJDLFNBQVMsRUFBRSxDQUF3QztnQ0FDckQsQ0FBQztnQ0FBQ0MsbUJBQW1CLEVBQUUsQ0FBQzs7Ozs7Ozs7eUdBRXZCaEIsQ0FBRzt3Q0FBQ0QsU0FBUyxFQUFDLENBQXlCOzs7Ozs7O3VIQUNyQ2xDLHNFQUFLOzRDQUFDd0MsTUFBTSxFQUFDLENBQU07NENBQUNDLEtBQUssRUFBQyxDQUFNOzs7Ozs7Ozs7MEdBRWxDM0IsMkNBQUk7Ozs7Ozs7O2lIQUNIc0IsQ0FBQztnREFBQ0YsU0FBUyxFQUFDLENBQXFEOzs7Ozs7OzBEQUFFLENBQVU7O2lIQUM3RUUsQ0FBQztnREFBQ0YsU0FBUyxFQUFDLENBQXFCOzs7Ozs7OzBEQUFDLENBQXlDOzs7Ozs7a0dBR2pGckIsMkNBQUc7Z0NBQ0M2QixFQUFFLEVBQUUsQ0FBQztnQ0FDTEMsRUFBRSxFQUFFLEVBQUU7Z0NBQ05DLEVBQUUsRUFBRSxDQUFDO29DQUNIQyxRQUFRLEVBQUUsR0FBRztvQ0FDYkMsT0FBTyxFQUFFLENBQU07b0NBQ2ZDLEtBQUssRUFBRSxDQUFTO29DQUNoQkMsZUFBZSxFQUFFLENBQVE7b0NBQ3pCQyxNQUFNLEVBQUUsQ0FBaUI7b0NBQ3pCQyxTQUFTLEVBQUUsQ0FBd0M7Z0NBQ3JELENBQUM7Z0NBQUNDLG1CQUFtQixFQUFFLENBQUM7Ozs7Ozs7O3lHQUV2QmhCLENBQUc7d0NBQUNELFNBQVMsRUFBQyxDQUF5Qjs7Ozs7Ozt1SEFDdkNwQyw0RUFBVzs0Q0FBQzBDLE1BQU0sRUFBQyxDQUFNOzRDQUFDQyxLQUFLLEVBQUMsQ0FBTTs7Ozs7Ozs7OzBHQUV0QzNCLDJDQUFJOzs7Ozs7OztpSEFDSnNCLENBQUM7Z0RBQUNGLFNBQVMsRUFBQyxDQUFxRDs7Ozs7OzswREFBQyxDQUFXOztpSEFDNUVFLENBQUM7Z0RBQUNGLFNBQVMsRUFBQyxDQUFxQjs7Ozs7OzswREFBQyxDQUFxQzs7Ozs7Ozs7OztpRkFRcEU5QiwyRUFBUTtnQkFBQzhCLFNBQVMsRUFBQyxDQUFNOzs7Ozs7OzBCQUFDLENBQWtDOztpRkFDNURDLENBQUc7Z0JBQUNELFNBQVMsRUFBQyxDQUEyQzs7Ozs7OzsrRkFDM0Q3QixvREFBSztvQkFBQ2dDLEdBQUcsRUFBQyxDQUF3QjtvQkFBQ2UsQ0FBSztvQkFBQ2QsR0FBRyxFQUFDLENBQWM7b0JBQUNFLE1BQU0sRUFBQyxDQUFNO29CQUFDQyxLQUFLLEVBQUMsQ0FBSztvQkFBQ0YsTUFBTSxFQUFDLENBQVk7Ozs7Ozs7OztpRkFPekdOLENBQU87Z0JBQUNDLFNBQVMsRUFBQyxDQUFpQjs7Ozs7OzsrRkFDbkN2QixvREFBYTtvQkFBQ2UsS0FBSyxFQUFFQSxLQUFLOzs7Ozs7O29HQUNwQ1MsQ0FBRzt3QkFBQ0QsU0FBUyxFQUFDLENBQW1FOzs7Ozs7OztrR0FHakZyQiwyQ0FBSTtnQ0FDRzZCLEVBQUUsRUFBRSxDQUFDO2dDQUNMQyxFQUFFLEVBQUUsRUFBRTtnQ0FDTkMsRUFBRSxFQUFFLENBQUM7b0NBQ0hDLFFBQVEsRUFBRSxHQUFHO29DQUNiQyxPQUFPLEVBQUUsQ0FBTTtvQ0FDZkMsS0FBSyxFQUFFLENBQVM7b0NBQ2hCQyxlQUFlLEVBQUUsQ0FBUTtvQ0FDekJDLE1BQU0sRUFBRSxDQUFpQjtvQ0FDekJDLFNBQVMsRUFBRSxDQUF3QztnQ0FDckQsQ0FBQztnQ0FBQ0MsbUJBQW1CLEVBQUUsQ0FBQzs7Ozs7Ozs7eUdBRXZCaEIsQ0FBRzt3Q0FBQ0QsU0FBUyxFQUFDLENBQTBCOzs7Ozs7O3VIQUN0QzdCLG9EQUFLOzRDQUFDZ0MsR0FBRyxFQUFDLENBQWdCOzRDQUFDQyxHQUFHLEVBQUMsQ0FBYzs0Q0FBQ0UsTUFBTSxFQUFDLENBQU07NENBQUNDLEtBQUssRUFBQyxDQUFLOzRDQUFDRixNQUFNLEVBQUMsQ0FBWTs7Ozs7Ozs7OzBHQUU3RnpCLDJDQUFJOzs7Ozs7OztpSEFDSHNCLENBQUM7Z0RBQUNGLFNBQVMsRUFBQyxDQUEwRDs7Ozs7OzswREFBQyxDQUFZOztpSEFDbkZFLENBQUM7Z0RBQUNGLFNBQVMsRUFBQyxDQUFxQjs7Ozs7Ozs7Ozs7O2tHQU94Q3JCLDJDQUFJO2dDQUNDNkIsRUFBRSxFQUFFLENBQUM7Z0NBQ0xDLEVBQUUsRUFBRSxFQUFFO2dDQUNOQyxFQUFFLEVBQUUsQ0FBQztvQ0FDSEMsUUFBUSxFQUFFLEdBQUc7b0NBQ2JDLE9BQU8sRUFBRSxDQUFNO29DQUNmQyxLQUFLLEVBQUUsQ0FBUztvQ0FDaEJDLGVBQWUsRUFBRSxDQUFRO29DQUN6QkMsTUFBTSxFQUFFLENBQWlCO29DQUN6QkMsU0FBUyxFQUFFLENBQXdDO2dDQUNyRCxDQUFDO2dDQUFDQyxtQkFBbUIsRUFBRSxDQUFDOzs7Ozs7Ozt5R0FFdkJoQixDQUFHO3dDQUFDRCxTQUFTLEVBQUMsQ0FBMEI7Ozs7Ozs7dUhBQ3RDN0Isb0RBQUs7NENBQUNnQyxHQUFHLEVBQUMsQ0FBZ0I7NENBQUNDLEdBQUcsRUFBQyxDQUFjOzRDQUFDRSxNQUFNLEVBQUMsQ0FBTTs0Q0FBQ0MsS0FBSyxFQUFDLENBQUs7NENBQUNGLE1BQU0sRUFBQyxDQUFZOzs7Ozs7Ozs7eUdBRTdGekIsMkNBQUk7Ozs7Ozs7dUhBQ0hzQixDQUFDOzRDQUFDRixTQUFTLEVBQUMsQ0FBaUM7Ozs7Ozs7c0RBQUMsQ0FBWTs7Ozs7a0dBR2pFckIsMkNBQUk7Z0NBQ0M2QixFQUFFLEVBQUUsQ0FBQztnQ0FDTEMsRUFBRSxFQUFFLEVBQUU7Z0NBQ05DLEVBQUUsRUFBRSxDQUFDO29DQUNIQyxRQUFRLEVBQUUsR0FBRztvQ0FDYkMsT0FBTyxFQUFFLENBQU07b0NBQ2ZDLEtBQUssRUFBRSxDQUFTO29DQUNoQkMsZUFBZSxFQUFFLENBQVE7b0NBQ3pCQyxNQUFNLEVBQUUsQ0FBaUI7b0NBQ3pCQyxTQUFTLEVBQUUsQ0FBd0M7Z0NBQ3JELENBQUM7Z0NBQUNDLG1CQUFtQixFQUFFLENBQUM7Ozs7Ozs7O3lHQUV2QmhCLENBQUc7d0NBQUNELFNBQVMsRUFBQyxDQUEwQjs7Ozs7Ozt1SEFDdEM3QixvREFBSzs0Q0FBQ2dDLEdBQUcsRUFBQyxDQUFnQjs0Q0FBQ0MsR0FBRyxFQUFDLENBQWM7NENBQUNFLE1BQU0sRUFBQyxDQUFNOzRDQUFDQyxLQUFLLEVBQUMsQ0FBSzs0Q0FBQ0YsTUFBTSxFQUFDLENBQVk7Ozs7Ozs7Ozt5R0FFN0Z6QiwyQ0FBSTs7Ozs7Ozt1SEFDSHNCLENBQUM7NENBQUNGLFNBQVMsRUFBQyxDQUFpQzs7Ozs7OztzREFBQyxDQUFZOzs7Ozs7Ozs7aUZBYXpERCxDQUFPOzs7Ozs7O2dHQUNQRSxDQUFHOzs7Ozs7Ozs2RkFFSC9CLDJFQUFROzRCQUFDOEIsU0FBUyxFQUFDLENBQU87Ozs7Ozs7c0NBQUMsQ0FBUzs7OEZBQ3BDQyxDQUFHOzs7Ozs7OztzR0FDREEsQ0FBRztvQ0FBQ0QsU0FBUyxFQUFDLENBQTRDOzs7Ozs7Ozs2R0FDdERtQixDQUFFOzRDQUFDbkIsU0FBUyxFQUFDLENBQW1EOzs7Ozs7O3NEQUFDLENBQTBCOzs2R0FDM0ZtQixDQUFFOzRDQUFDbkIsU0FBUyxFQUFDLENBQW1EOzs7Ozs7O3NEQUFDLENBQW9COzs2R0FDckZtQixDQUFFOzRDQUFDbkIsU0FBUyxFQUFDLENBQW1EOzs7Ozs7O3NEQUFDLENBQXlCOzs7O3NHQUc5RkMsQ0FBRztvQ0FBQ21CLEtBQUs7b0NBQUNDLElBQUksRUFBQyxDQUFPOzs7Ozs7Ozs2R0FDeEJGLENBQUU7NENBQUNuQixTQUFTLEVBQUMsQ0FBb0U7Ozs7Ozs7c0RBQUMsQ0FBaUI7OzZHQUNuR21CLENBQUU7NENBQUNuQixTQUFTLEVBQUMsQ0FBbUQ7Ozs7Ozs7c0RBQUMsQ0FBZTs7OztzR0FJaEZDLENBQUc7b0NBQUNtQixLQUFLO29DQUFDQyxJQUFJLEVBQUMsQ0FBTzs7Ozs7Ozs7NkdBQ3RCRixDQUFFOzRDQUFDbkIsU0FBUyxFQUFDLENBQW9FOzs7Ozs7O3NEQUFDLENBQWE7OzZHQUMvRm1CLENBQUU7NENBQUNuQixTQUFTLEVBQUMsQ0FBbUQ7Ozs7Ozs7c0RBQUMsQ0FBVTs7OztzR0FHM0VDLENBQUc7b0NBQUNtQixLQUFLO29DQUFDQyxJQUFJLEVBQUMsQ0FBTzs7Ozs7Ozs7NkdBQ3RCRixDQUFFOzRDQUFDbkIsU0FBUyxFQUFDLENBQW9FOzs7Ozs7O3NEQUFDLENBQWM7OzZHQUNoR21CLENBQUU7NENBQUNuQixTQUFTLEVBQUMsQ0FBeUQ7Ozs7Ozs7c0RBQUMsQ0FBa0I7Ozs7Ozs7Ozs7O0FBaUJuRyxDQUFDO0tBcFBvQkgsSUFBSSIsInNvdXJjZXMiOlsid2VicGFjazovL19OX0UvLi9wYWdlcy9pbmRleC5qcz9iZWU3Il0sInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIHByZXR0aWVyL3ByZXR0aWVyICovXG5pbXBvcnQgTGluayBmcm9tICdAL2NvbXBvbmVudHMvTGluaydcbmltcG9ydCBUYWcgZnJvbSAnQC9jb21wb25lbnRzL1RhZydcbmltcG9ydCBzaXRlTWV0YWRhdGEgZnJvbSAnQC9kYXRhL3NpdGVNZXRhZGF0YSdcbmltcG9ydCB7IGdldEFsbEZpbGVzRnJvbnRNYXR0ZXIgfSBmcm9tICdAL2xpYi9tZHgnXG5pbXBvcnQgTG9nb05ldSBmcm9tICcuLi9jb21wb25lbnRzL2ljb25zL3N2Zy9TdmdMb2dvTmV1J1xuaW1wb3J0IEZsZW5zYnVyZ2VyIGZyb20nLi4vY29tcG9uZW50cy9pY29ucy9zdmcvU1ZHRmxlbnNidXJnZXInXG5pbXBvcnQgR2FudGVyIGZyb20gJy4uL2NvbXBvbmVudHMvaWNvbnMvc3ZnL1NWR0dhbnRlcidcbmltcG9ydCBBc3RyYSBmcm9tICcuLi9jb21wb25lbnRzL2ljb25zL3N2Zy9TVkdBc3RyYSdcbmltcG9ydCBmb3JtYXREYXRlIGZyb20gJ0AvbGliL3V0aWxzL2Zvcm1hdERhdGUnXG5pbXBvcnQgU3R5bGVkSGVyb0hvbWUgZnJvbSAnLi4vY29tcG9uZW50cy9IZXJvSG9tZSdcbmltcG9ydCB7IEhlYWRpbmczIH0gZnJvbSAnLi4vY29tcG9uZW50cy9IZWFkaW5ncy9IZWFkaW5nMy5zdHlsZXMnXG5pbXBvcnQgeyBIZWFkaW5nMSB9IGZyb20gJ0AvY29tcG9uZW50cy9IZWFkaW5ncy9IZWFkaW5nMS5zdHlsZXMnXG5pbXBvcnQgSW1hZ2UgZnJvbSAnbmV4dC9pbWFnZSdcbmltcG9ydCBza2V0Y2h5IGZyb20gXCJ0aGVtZS11aS1za2V0Y2h5LXByZXNldFwiXG5cbmltcG9ydCB7XG4gIGpzeCxcbiAgRmxleCxcbiAgQm94LFxuICBOYXZMaW5rLFxuICBUaGVtZVByb3ZpZGVyLFxuICBCdXR0b24sXG4gIENhcmQsXG4gIFRleHQsXG4gIExhYmVsLFxuICBDaGVja2JveCxcbiAgU2VsZWN0LFxuICBUZXh0YXJlYSxcbiAgUmFkaW8sXG4gIElucHV0LFxuICBCYWRnZSxcbiAgQWxlcnQsXG4gIERpdmlkZXIsXG4gIFN0eWxlZCBhcyBTXG59IGZyb20gXCJ0aGVtZS11aVwiO1xuXG5cblxuXG4gZXhwb3J0IGFzeW5jIGZ1bmN0aW9uIGdldFN0YXRpY1Byb3BzKCkge1xuICAgY29uc3QgcG9zdHMgPSBhd2FpdCBnZXRBbGxGaWxlc0Zyb250TWF0dGVyKCdibG9nJylcblxuICByZXR1cm4geyBwcm9wczogeyBwb3N0cyB9IH1cbn1cblxuY29uc3QgdGhlbWUgPSB7XG4gIC4uLnNrZXRjaHksXG4gIGNvbG9yczoge1xuICAgIHRleHQ6IFwiIzAwMFwiLFxuICAgIGJhY2tncm91bmQ6IFwiI2ZmZlwiLFxuICAgIHByaW1hcnk6IFwiIzMzZVwiLFxuICB9LFxuXG59XG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBIb21lKCkge1xuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICBcbiAgICAgIDxIZWFkaW5nMz5EZWluIFRyZWZmcHVua3Q8YnIvPiBpbiBGcmVpYnVyZzwvSGVhZGluZzM+XG4gICAgICAgICAgPFN0eWxlZEhlcm9Ib21lPlxuICBcbiAgICAgICAgICAgICAgICBcbiAgXG4gICAgICAgICAgPC9TdHlsZWRIZXJvSG9tZT4gXG5cbiAgICAgICAgICA8c2VjdGlvbiBjbGFzc05hbWU9XCJteC1hdXRvIG10LTUgdy0xMi8xMiBoLTQ4ICBiZy1ncmF5LTgwMCBmbGV4IGZsZXgtd3JhcCAtbXgtNCAtbWItNCBtZDptYi0wXCI+XG4gXG4gXG4gICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPVwicHgtMTAgei0xMCAgIG1kOnctMS8zIHB4LTQgbWItNCBtZDptYi0wXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cCBjbGFzc05hbWU9XCJ0ZXh0LTR4bCBmb250LWJvbGQgdXBwZXJjYXNlIHRleHQteWVsbG93LTUwMFwiPsO2ZmZudW5nc3plaXRlbjwvcD5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwIGNsYXNzTmFtZT1cIm10LTIgdGV4dC0yeGwgIHRleHQtZ3JheS0zMDBcIj5Nb250YWcgYmlzIERvbm5lcnN0YWc6IDE4IGJpcyAyNCBVaHI8L3A+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cCBjbGFzc05hbWU9XCJ0ZXh0LTJ4bCAgdGV4dC1ncmF5LTMwMFwiPkZyZWl0YWcgdW5kIFNhbXN0YWc6IDE1IGJpcyAwMyBVaHI8L3A+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8cCBjbGFzc05hbWU9XCJ0ZXh0LTJ4bCAgdGV4dC1ncmF5LTMwMFwiPlNvbm50YWc6IFJ1aGV0YWc8L3A+XG4gICAgICAgICAgICAgIDwvZGl2PlxuXG4gICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPVwiYmctcmVkLTgwMCB3LWZ1bGwgcm91bmRlZC0yeGwgbWQ6dy03LzEyIHB4LTQgbWItNCBtZDptYi0wXCI+XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzc05hbWU9J2ZsZXggZmxleC1yb3cnPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPVwidy05NiBsZzp3LTgvMTIgbGc6bXQtNyBsZzptdC0yIHhsOm1iLTMgXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPEltYWdlIHNyYz1cIi9wb3J0cmFpdC1taWNrMS5wbmdcIiBhbHQ9XCJwb3J0cmFpdFwiIGxheW91dD1cInJlc3BvbnNpdmVcIiBoZWlnaHQ9ezI1MH0gd2lkdGg9ezE4NX0vPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzc05hbWU9J3otMjAgZmxleCBmbGV4LWNvbCBpdGVtcy1zdGFydCBqdXN0aWZ5LWNlbnRlcic+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwIGNsYXNzTmFtZT1cInRleHQtM3hsIHAtMiB0ZXh0LXllbGxvdy01MDAgdXBwcmVyY2FzZVwiPidNb2luIE1vaW48L3A+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwIGNsYXNzTmFtZT1cInRleHQtZ3JheS0xMDAgdGV4dC1qdXN0aWZ5IHB4LTQgbGc6dGV4dC14c1wiPkluIEhvbW1hZ2UgYW4gZWluZSB0eXBpc2NoZSBLaWV6LUtuZWlwZSBhdWYgU3QuUGF1bGksIGhhYmVuIHdpciBpbSBIZXJ6ZW4gdm9uIEZyZWlidXJnIGVpbiBMb2thbCBlcsO2ZmZuZXQsIHdlbGNoZXMgZXMgc28gc8O8ZGxpY2ggZGVyIEVsYmUgd29obCBrZWluIHp3ZWl0ZXMgTWFsIGdpYnQuIEF1c2dlYmF1dCBpbSBTdGlsZSBlaW5lcyBTY2hpZmZydW1wZmVzLCBpc3QgZGVyIGltIEhlcnplbiBkZXIgQWx0c3RhZHQgZ2VsZWdlbmUgUmV0dHVuZ3Nhbmtlci1GcmVpYnVyZyBpZGVhbGVyIFRyZWZmcHVua3QgdW0gbmFjaCBGZWllcmFiZW5kIG5ldHRlIHVuZCBpbnRlcmVzc2FudGUgTWVuc2NoZW4ga2VubmVuenVsZXJuZW4uIFdpciBzaW5kIHN0b2x6IGF1ZiB1bnNlciBidW50ZXMsIGludGVybmF0aW9uYWxlcyBQdWJsaWt1bS4gVW5zZXIgUmV0dHVuZ3NhbmtlciBpc3QgYXVjaCBpZGVhbGUgTG9jYXRpb24genVyIER1cmNoZsO8aHJ1bmcgSWhyZXMgcHJpdmF0ZW4gb2RlciBnZXNjaMOkZnRsaWNoZW4gRXZlbnRzLiBTcHJlY2hlbiBTaWUgdW5zIGFuIG9kZXIga29udGFrdGllcmVuIFNpZSB1bnMgdm9yIE9ydCBvZGVyIHNjaHJlaWJlbiBTaWUgdW5zIGVpbmUgZW1haWwuIFdpciBmcmV1ZW4gdW5zIFNpZSBpbSBSZXR0dW5nc2Fua2VyIGJlZ3LDvHNzc2VuIHp1IGTDvHJmZW4gPGJyLz48YnIvPk1pY2hhZWwgU2NocmVjayB1bmQgZGFzIFRlYW0gZGVzIFJldHR1bmdzYW5rZXIgPC9wPiAgICAgIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj4gICAgIFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICAgICAgICA8L3NlY3Rpb24+IFxuICAgICAgICA8ZGl2IGNsYXNzTmFtZT0nYWJzb2x1dGUgcmlnaHQtMjAgei0xMCB3LTMvMTIgZmxvYXQtcmlnaHQgdHJhbnNmb3JtIC10cmFuc2xhdGUteS0zMicgPiAgIFxuICAgICAgICAgICAgICA8SW1hZ2UgIGNsYXNzTmFtZT0nYWJzb2x1dGUnIHNyYz1cIi9Bc3RyYWJhbGxvbnMucG5nXCIgYWx0PVwicG9ydHJhaXRcIiBsYXlvdXQ9XCJyZXNwb25zaXZlXCIgaGVpZ2h0PXs0NzN9IHdpZHRoPXs0NzN9Lz4gIFxuICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgIDxIZWFkaW5nMSBjbGFzc05hbWU9Jyc+RGllIEtuZWlwZTwvSGVhZGluZzE+XG4gICAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT0ndy0yLzEyIGFic29sdXRlIGxlZnQtNjAgei0yMCAtdHJhbnNmb3JtIC10cmFuc2xhdGUteS0zNicgPiAgIFxuICAgICAgICAgICAgICA8SW1hZ2Ugc3JjPVwiL3JldHR1bmdzcmluZy5wbmdcIiBhbHQ9XCJwb3J0cmFpdFwiIGxheW91dD1cInJlc3BvbnNpdmVcIiBoZWlnaHQ9ezQ3M30gd2lkdGg9ezQ3M30vPiAgXG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPSdhYnNvbHV0ZSB3LTIvMTIgei00IHRyYW5zZm9ybSAtdHJhbnNsYXRlLXktNTInID4gICBcbiAgICAgICAgICAgICAgPEltYWdlIHNyYz1cIi9saWdodGhvdXNlYncuc3ZnXCIgYWx0PVwicG9ydHJhaXRcIiBsYXlvdXQ9XCJyZXNwb25zaXZlXCIgaGVpZ2h0PXs0NzN9IHdpZHRoPXs0NzN9Lz4gIFxuICAgICAgICAgICAgPC9kaXY+ICAgICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgIDxzZWN0aW9uIGNsYXNzTmFtZT0nbXQtMyBteD1hdXRvIHctMTEvMTInPlxuICAgICAgICAgICAgPFRoZW1lUHJvdmlkZXIgdGhlbWU9e3RoZW1lfT5cbiAgPGRpdiBjbGFzc05hbWU9XCJtbC0zMiBtdC0yNCBncmlkIGdyaWQtY29scy0zIGp1c3RpZnktY2VudGVyIGl0ZW1zLXN0YXJ0IGdhcC0yNFwiID5cbiAgXG4gIDxDYXJkXG4gICAgICAgICAgbWI9ezV9XG4gICAgICAgICAgbXQ9ezIwfVxuICAgICAgICAgIHN4PXt7XG4gICAgICAgICAgICBtYXhXaWR0aDogNDAwLFxuICAgICAgICAgICAgcGFkZGluZzogXCIzMHB4XCIsXG4gICAgICAgICAgICBjb2xvcjogXCIjZmZmZmZmXCIsXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFwib3JhbmdlXCIsXG4gICAgICAgICAgICBib3JkZXI6IFwiM3B4IHdoaXRlIHNvbGlkXCIsXG4gICAgICAgICAgICBib3hTaGFkb3c6IFwiMTBweCA1cHggMTBweCByZ2JhKDI0NCwgMjE2LCAxNTQsIDAuOSlcIixcbiAgICAgICAgICB9fW9uR290UG9pbnRlckNhcHR1cmU9ezJ9XG4gICAgICAgID5cbiAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT0nYm9yZGVyLSBib3JkZXItZ3JheS0xMDAnPlxuICAgICAgICAgICAgPEdhbnRlciBoZWlnaHQ9XCIyNHZoXCIgd2lkdGg9XCIyMHZ3XCI+PC9HYW50ZXI+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgPFRleHQ+XG4gICAgICAgICAgIDxwIGNsYXNzTmFtZT1cIm10LTEwIHRleHQtNHhsIHRleHQtY2VudGVyIHRleHQtc2FucyBmb250LWJvbGQgdXBwZXJjYXNlXCI+R2FudGVyIDwvcD5cbiAgICAgICAgICAgPHAgY2xhc3NOYW1lPVwidGV4dC14bCB0ZXh0LWNlbnRlclwiPmxlY2tlcmVzIEdhbnRlciBCIHZvbSBGYXNzPC9wPlxuICAgICAgICAgIDwvVGV4dD5cbiAgICAgICAgPC9DYXJkPlxuICAgIFxuICAgIDxDYXJkXG4gICAgICAgICAgbWI9ezV9XG4gICAgICAgICAgbXQ9ezIwfVxuICAgICAgICAgIHN4PXt7XG4gICAgICAgICAgICBtYXhXaWR0aDogNDAwLFxuICAgICAgICAgICAgcGFkZGluZzogXCIzMHB4XCIsXG4gICAgICAgICAgICBjb2xvcjogXCIjZmZmZmZmXCIsXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFwib3JhbmdlXCIsXG4gICAgICAgICAgICBib3JkZXI6IFwiM3B4IHdoaXRlIHNvbGlkXCIsXG4gICAgICAgICAgICBib3hTaGFkb3c6IFwiMTBweCA1cHggMTBweCByZ2JhKDI0NCwgMjE2LCAxNTQsIDAuOSlcIixcbiAgICAgICAgICB9fW9uR290UG9pbnRlckNhcHR1cmU9ezJ9XG4gICAgICAgID5cbiAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT0nYm9yZGVyLSBib3JkZXItZ3JheS0xMDAnPlxuICAgICAgICAgICAgPEFzdHJhIGhlaWdodD1cIjI0dmhcIiB3aWR0aD1cIjIwdndcIj48L0FzdHJhPlxuICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgIDxUZXh0PlxuICAgICAgICAgICA8cCBjbGFzc05hbWU9XCJtdC0xMCB0ZXh0LTR4bCB0ZXh0LWNlbnRlciB0ZXh0IHVwcGVyY2FzZSBmb250LWJvbGRcIiA+QXN0cmEgQmllcjwvcD5cbiAgICAgICAgICAgPHAgY2xhc3NOYW1lPVwidGV4dC14bCB0ZXh0LWNlbnRlclwiPm5hdMO8cmxpY2ggZGlyZWt0IHZvbSBLaWV6IEdhbnRlciB2b20gRmFzczwvcD5cbiAgICAgICAgICAgPC9UZXh0PlxuICAgICAgICAgICA8L0NhcmQ+XG4gICAgPENhcmRcbiAgICAgICAgICBtYj17NX1cbiAgICAgICAgICBtdD17MjB9XG4gICAgICAgICAgc3g9e3tcbiAgICAgICAgICAgIG1heFdpZHRoOiA0MDAsXG4gICAgICAgICAgICBwYWRkaW5nOiBcIjMwcHhcIixcbiAgICAgICAgICAgIGNvbG9yOiBcIiNmZmZmZmZcIixcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogXCJvcmFuZ2VcIixcbiAgICAgICAgICAgIGJvcmRlcjogXCIzcHggd2hpdGUgc29saWRcIixcbiAgICAgICAgICAgIGJveFNoYWRvdzogXCIxMHB4IDVweCAxMHB4IHJnYmEoMjQ0LCAyMTYsIDE1NCwgMC45KVwiLFxuICAgICAgICAgIH19b25Hb3RQb2ludGVyQ2FwdHVyZT17Mn1cbiAgICAgICAgPlxuICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPSdib3JkZXItIGJvcmRlci1ncmF5LTEwMCc+XG4gICAgICAgICAgPEZsZW5zYnVyZ2VyIGhlaWdodD1cIjI0dmhcIiB3aWR0aD1cIndvdndcIj48L0ZsZW5zYnVyZ2VyPlxuICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgIDxUZXh0PlxuICAgICAgICAgIDxwIGNsYXNzTmFtZT1cIm10LTEwIHRleHQtNHhsIHRleHQtY2VudGVyIHRleHQgdXBwZXJjYXNlIGZvbnQtYm9sZFwiPkZsZW5zYnVyZ2VyPC9wPlxuICAgICAgICAgICA8cCBjbGFzc05hbWU9XCJ0ZXh0LXhsIHRleHQtY2VudGVyXCI+ZGFzIGJsb25kZSBIZXJiZSBhdXMgZGVtIGhvaGVuIE5vcmRlbjwvcD5cbiAgICAgICAgICAgIDwvVGV4dD5cbiAgICAgICAgICA8L0NhcmQ+XG48L2Rpdj5cbiAgICA8L1RoZW1lUHJvdmlkZXI+XG5cbiAgICAgICAgICAgIDwvc2VjdGlvbj5cbiAgICAgICAgICAgXG4gICAgICAgICAgICAgIDxIZWFkaW5nMSBjbGFzc05hbWU9XCJtdC0yXCI+SW1wcmVzc2lvbmVuIGF1cyBkZW0gUmV0dHVuZ3NhbmtlcjwvSGVhZGluZzE+XG4gICAgICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPSd3LTIvMTIgYWJzb2x1dGUgdHJhbnNmb3JtIC10cmFuc2xhdGUteS04MCc+XG4gICAgICAgICAgICA8SW1hZ2Ugc3JjPVwiL0FsYmVyc19JbGx1X3doaXRlLnBuZ1wiIHRvcC01IGFsdD1cIkltcHJlc3Npb25lblwiIGhlaWdodD1cIjIwOCBcIiB3aWR0aD1cIjE5NVwiIGxheW91dD1cInJlc3BvbnNpdmVcIi8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICBcblxuXG4gXG4gICAgICAgICAgICAgIFxuICAgICAgICAgICAgPHNlY3Rpb24gY2xhc3NOYW1lPSdteD1hdXRvIHctMTIvMTInPlxuICAgICAgICAgICAgPFRoZW1lUHJvdmlkZXIgdGhlbWU9e3RoZW1lfT5cbiAgPGRpdiBjbGFzc05hbWU9XCJteC1hdXRvIG1sLTE2IGdyaWQgZ3JpZC1jb2xzLTMganVzdGlmeS1iZXR3ZWVuIGl0ZW1zLXN0YXJ0IGdyaWQtNFwiID5cblxuICBcbiAgPENhcmRcbiAgICAgICAgICBtYj17NX1cbiAgICAgICAgICBtdD17MjB9XG4gICAgICAgICAgc3g9e3tcbiAgICAgICAgICAgIG1heFdpZHRoOiA0MzMsXG4gICAgICAgICAgICBwYWRkaW5nOiBcIjMwcHhcIixcbiAgICAgICAgICAgIGNvbG9yOiBcIiNmZmZmZmZcIixcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogXCJvcmFuZ2VcIixcbiAgICAgICAgICAgIGJvcmRlcjogXCIzcHggd2hpdGUgc29saWRcIixcbiAgICAgICAgICAgIGJveFNoYWRvdzogXCIxMHB4IDVweCAxMHB4IHJnYmEoMjQ0LCAyMTYsIDE1NCwgMC45KVwiLFxuICAgICAgICAgIH19b25Hb3RQb2ludGVyQ2FwdHVyZT17Mn1cbiAgICAgICAgPlxuICAgICAgICAgIDxkaXYgY2xhc3NOYW1lPSdib3JkZXItOCBib3JkZXItZ3JheS0xMDAnPlxuICAgICAgICAgICAgPEltYWdlIHNyYz1cIi9JbXByZXNzMDEuanBnXCIgYWx0PVwiSW1wcmVzc2lvbmVuXCIgaGVpZ2h0PVwiMTY4IFwiIHdpZHRoPVwiMzAwXCIgbGF5b3V0PVwicmVzcG9uc2l2ZVwiLz5cbiAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICA8VGV4dD5cbiAgICAgICAgICAgPHAgY2xhc3NOYW1lPVwibXQtMTAgdGV4dC00eGwgdGV4dC1jZW50ZXIgdGV4dC1zYW5zIGZvbnQtYm9sZCB1cHBlcmNhc2VcIj5JbXByZXNzaW9uZW48L3A+XG4gICAgICAgICAgIDxwIGNsYXNzTmFtZT1cInRleHQteGwgdGV4dC1jZW50ZXJcIj48L3A+XG4gICAgICAgICAgPC9UZXh0PlxuICAgICAgICA8L0NhcmQ+XG4gICAgXG5cblxuICAgIFxuICAgIDxDYXJkXG4gICAgICAgICAgbWI9ezV9XG4gICAgICAgICAgbXQ9ezIwfVxuICAgICAgICAgIHN4PXt7XG4gICAgICAgICAgICBtYXhXaWR0aDogNDMzLFxuICAgICAgICAgICAgcGFkZGluZzogXCIzMHB4XCIsXG4gICAgICAgICAgICBjb2xvcjogXCIjZmZmZmZmXCIsXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFwib3JhbmdlXCIsXG4gICAgICAgICAgICBib3JkZXI6IFwiM3B4IHdoaXRlIHNvbGlkXCIsXG4gICAgICAgICAgICBib3hTaGFkb3c6IFwiMTBweCA1cHggMTBweCByZ2JhKDI0NCwgMjE2LCAxNTQsIDAuOSlcIixcbiAgICAgICAgICB9fW9uR290UG9pbnRlckNhcHR1cmU9ezJ9XG4gICAgICAgID5cbiAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT0nYm9yZGVyLTggYm9yZGVyLWdyYXktMTAwJz5cbiAgICAgICAgICAgIDxJbWFnZSBzcmM9XCIvSW1wcmVzczAyLmpwZ1wiIGFsdD1cIkltcHJlc3Npb25lblwiIGhlaWdodD1cIjE2OCBcIiB3aWR0aD1cIjMwMFwiIGxheW91dD1cInJlc3BvbnNpdmVcIi8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgPFRleHQ+XG4gICAgICAgICAgIDxwIGNsYXNzTmFtZT1cIm10LTEwIHRleHQtNHhsIHRleHQtY2VudGVyIHRleHRcIj5JbXByZXNzaW9uZW48L3A+XG4gICAgICAgICAgIDwvVGV4dD5cbiAgICAgICAgICAgPC9DYXJkPlxuICAgIDxDYXJkXG4gICAgICAgICAgbWI9ezV9XG4gICAgICAgICAgbXQ9ezIwfVxuICAgICAgICAgIHN4PXt7XG4gICAgICAgICAgICBtYXhXaWR0aDogNDMzLFxuICAgICAgICAgICAgcGFkZGluZzogXCIzMHB4XCIsXG4gICAgICAgICAgICBjb2xvcjogXCIjZmZmZmZmXCIsXG4gICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFwib3JhbmdlXCIsXG4gICAgICAgICAgICBib3JkZXI6IFwiM3B4IHdoaXRlIHNvbGlkXCIsXG4gICAgICAgICAgICBib3hTaGFkb3c6IFwiMTBweCA1cHggMTBweCByZ2JhKDI0NCwgMjE2LCAxNTQsIDAuOSlcIixcbiAgICAgICAgICB9fW9uR290UG9pbnRlckNhcHR1cmU9ezJ9XG4gICAgICAgID5cbiAgICAgICAgICA8ZGl2IGNsYXNzTmFtZT0nYm9yZGVyLTggYm9yZGVyLWdyYXktMTAwJz5cbiAgICAgICAgICAgIDxJbWFnZSBzcmM9XCIvSW1wcmVzczAzLmpwZ1wiIGFsdD1cIkltcHJlc3Npb25lblwiIGhlaWdodD1cIjE2OCBcIiB3aWR0aD1cIjMwMFwiIGxheW91dD1cInJlc3BvbnNpdmVcIi8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgPFRleHQ+XG4gICAgICAgICAgIDxwIGNsYXNzTmFtZT1cIm10LTEwIHRleHQtNHhsIHRleHQtY2VudGVyIHRleHRcIj5JbXByZXNzaW9uZW48L3A+XG4gICAgICAgICAgPC9UZXh0PlxuICAgICAgICAgIDwvQ2FyZD5cbjwvZGl2PlxuICAgIDwvVGhlbWVQcm92aWRlcj5cblxuXG5cblxuXG5cbiAgICAgICAgICAgIDwvc2VjdGlvbj5cblxuICAgICAgICAgICAgPHNlY3Rpb24+XG4gICAgICAgICAgICA8ZGl2PlxuXG4gICAgICAgICAgICA8SGVhZGluZzEgY2xhc3NOYW1lPVwibXQtMTZcIj5JbXByZXNzdW08L0hlYWRpbmcxPlxuICAgICAgICAgICAgPGRpdj5cbiAgICAgICAgICAgICAgPGRpdiBjbGFzc05hbWU9XCJmbGV4IGZsZXgtY29sIGl0ZW1zLWNlbnRlciBqdXN0aWZ5LWJldHdlZW5cIj5cbiAgICAgICAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J214LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPlJldHR1bmdzYW5rZXIgRnJlaWJ1cmcgR2JSPC9oMT5cbiAgICAgICAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J214LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPkFkZWxoYXVzZXJzdHJhc3NlIDdjPC9oMT5cbiAgICAgICAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J214LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPjc5MDk4IEZyZWlidXJnIC8gQnJlaXNnYXU8L2gxPlxuICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgIFxuICAgICAgICAgICAgICA8ZGl2IGNsYXNzIE5hbWU9XCJtdC0xMlwiPlxuICAgICAgICAgICAgPGgxIGNsYXNzTmFtZT0nbXQtNSBteC1hdXRvIHctOS8xMiBmb250LW1vbm8gdGV4dC00eGwgdGV4dC15ZWxsb3ctNDAwIHRleHQtY2VudGVyJz5HZXNjaMOkZnRzZsO8aHJ1bmc6PC9oMT5cbiAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J214LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPk1pY2hhZWwgU2NocmVjazwvaDE+XG4gICAgICAgICAgICA8L2Rpdj5cblxuXG4gICAgICAgICAgICA8ZGl2IGNsYXNzIE5hbWU9XCJtdC0xMlwiPlxuICAgICAgICAgICAgPGgxIGNsYXNzTmFtZT0nbXQtNSBteC1hdXRvIHctOS8xMiBmb250LW1vbm8gdGV4dC00eGwgdGV4dC15ZWxsb3ctNDAwIHRleHQtY2VudGVyJz5TdGV1ZXJudW1tZXI6PC9oMT5cbiAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J214LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPjEyMzQ1Njc4OTA8L2gxPlxuICAgICAgICAgICAgPC9kaXY+XG5cbiAgICAgICAgICAgIDxkaXYgY2xhc3MgTmFtZT1cIm10LTEyXCI+XG4gICAgICAgICAgICA8aDEgY2xhc3NOYW1lPSdtdC01IG14LWF1dG8gdy05LzEyIGZvbnQtbW9ubyB0ZXh0LTR4bCB0ZXh0LXllbGxvdy00MDAgdGV4dC1jZW50ZXInPkdlcmljaHRzc3RhbmQ6PC9oMT5cbiAgICAgICAgICAgIDxoMSBjbGFzc05hbWU9J21iLTEwIG14LWF1dG8gdy05LzEyIHRleHQtNHhsIHRleHQtZ3JheS0xMDAgdGV4dC1jZW50ZXInPkZyZWlidXJnLyBCcmVpc2dhdTwvaDE+XG4gICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgXG4gICAgICAgICAgIDwvZGl2PlxuXG5cblxuXG5cbiAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgXG4gICAgICAgICAgICAgIFxuICAgICAgICAgICAgPC9zZWN0aW9uPlxuPC8+XG5cbiAgXG4gICAgICAgIFxuICApfSJdLCJuYW1lcyI6WyJMaW5rIiwiVGFnIiwic2l0ZU1ldGFkYXRhIiwiTG9nb05ldSIsIkZsZW5zYnVyZ2VyIiwiR2FudGVyIiwiQXN0cmEiLCJmb3JtYXREYXRlIiwiU3R5bGVkSGVyb0hvbWUiLCJIZWFkaW5nMyIsIkhlYWRpbmcxIiwiSW1hZ2UiLCJza2V0Y2h5IiwianN4IiwiRmxleCIsIkJveCIsIk5hdkxpbmsiLCJUaGVtZVByb3ZpZGVyIiwiQnV0dG9uIiwiQ2FyZCIsIlRleHQiLCJMYWJlbCIsIkNoZWNrYm94IiwiU2VsZWN0IiwiVGV4dGFyZWEiLCJSYWRpbyIsIklucHV0IiwiQmFkZ2UiLCJBbGVydCIsIkRpdmlkZXIiLCJTdHlsZWQiLCJTIiwidGhlbWUiLCJjb2xvcnMiLCJ0ZXh0IiwiYmFja2dyb3VuZCIsInByaW1hcnkiLCJIb21lIiwiYnIiLCJzZWN0aW9uIiwiY2xhc3NOYW1lIiwiZGl2IiwicCIsInNyYyIsImFsdCIsImxheW91dCIsImhlaWdodCIsIndpZHRoIiwibWIiLCJtdCIsInN4IiwibWF4V2lkdGgiLCJwYWRkaW5nIiwiY29sb3IiLCJiYWNrZ3JvdW5kQ29sb3IiLCJib3JkZXIiLCJib3hTaGFkb3ciLCJvbkdvdFBvaW50ZXJDYXB0dXJlIiwidG9wLTUiLCJoMSIsImNsYXNzIiwiTmFtZSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./pages/index.js\n");
/***/ })
}); | 4,331.954545 | 94,488 | 0.543288 |
c8cb75d1cd4c34c67641885209f80c311dfa8020 | 490 | js | JavaScript | src/components/Board/components/SelectionIndicator.js | maximpertsov/react-xiangqi | cb88968e5c26fddd48741720fe0811dc912720dc | [
"MIT"
] | 1 | 2019-07-13T18:39:03.000Z | 2019-07-13T18:39:03.000Z | src/components/Board/components/SelectionIndicator.js | maximpertsov/react-xiangqi | cb88968e5c26fddd48741720fe0811dc912720dc | [
"MIT"
] | 20 | 2019-12-27T03:20:30.000Z | 2022-02-26T14:52:48.000Z | src/components/Board/components/SelectionIndicator.js | maximpertsov/react-xiangqi | cb88968e5c26fddd48741720fe0811dc912720dc | [
"MIT"
] | null | null | null | import React from 'react';
import styled from '@emotion/styled';
import { fillParentElement, SELECTION_COLOR } from 'commonStyles';
import { useSquareContext } from 'contexts/SquareProvider';
const Wrapper = styled.div({
backgroundColor: SELECTION_COLOR,
zIndex: '-1',
...fillParentElement,
});
const SelectionIndicator = () => {
const { isSelected } = useSquareContext();
return isSelected && <Wrapper className="SelectionIndicator" />;
};
export default SelectionIndicator;
| 25.789474 | 66 | 0.736735 |
c8cbb170751fbdf27820e64fa7e90e2b054bb838 | 1,360 | js | JavaScript | public/assets/script/scripts.js | Adeyemi-Timilehin/communityforum-juke4devs- | f16c8f932db7f642c1571dd374f29315e228d00d | [
"MIT"
] | null | null | null | public/assets/script/scripts.js | Adeyemi-Timilehin/communityforum-juke4devs- | f16c8f932db7f642c1571dd374f29315e228d00d | [
"MIT"
] | null | null | null | public/assets/script/scripts.js | Adeyemi-Timilehin/communityforum-juke4devs- | f16c8f932db7f642c1571dd374f29315e228d00d | [
"MIT"
] | null | null | null | /*!
* Start Bootstrap - Simple Sidebar v6.0.1 (https://startbootstrap.com/template/simple-sidebar)
* Copyright 2013-2021 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-simple-sidebar/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Toggle the side navigation
const sidebarToggle = document.body.querySelector('#sidebarToggle');
if (sidebarToggle) {
// Uncomment Below to persist sidebar toggle between refreshes
// if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
// document.body.classList.toggle('sb-sidenav-toggled');
// }
sidebarToggle.addEventListener('click', event => {
event.preventDefault();
document.body.classList.toggle('sb-sidenav-toggled');
localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled'));
});
}
});
$(document).ready(function(){
$("#post").click(function(){
$('#re').removeClass('post');
})
$("#user").click(function(){
$("#page-content-wrapper").removeClass('user');
$("#up").addClass("uprofile");
});
$("#profile").click(function(){
$("#page-content-wrapper").addClass('user');
$("#up").removeClass("uprofile");
})
})
| 33.170732 | 110 | 0.622059 |
c8cbd0a633bca3d80fa7c2a067c800e9e9548b62 | 973 | js | JavaScript | lib/cluster/storage/logs.js | ops-guru/teraslice | 83e729a98d3d2964e1da436c31da21d2c224423f | [
"Apache-2.0"
] | null | null | null | lib/cluster/storage/logs.js | ops-guru/teraslice | 83e729a98d3d2964e1da436c31da21d2c224423f | [
"Apache-2.0"
] | null | null | null | lib/cluster/storage/logs.js | ops-guru/teraslice | 83e729a98d3d2964e1da436c31da21d2c224423f | [
"Apache-2.0"
] | 1 | 2021-10-15T00:37:34.000Z | 2021-10-15T00:37:34.000Z | 'use strict';
const Promise = require('bluebird');
const _ = require('lodash');
const getClient = require('../../utils/config').getClient;
module.exports = function module(context) {
if (_.includes(context.sysconfig.terafoundation.logging, 'elasticsearch')) {
const client = getClient(context, context.sysconfig.teraslice.state, 'elasticsearch');
const template = require('./backends/mappings/logs.json');
const elasticsearch = require('elasticsearch_api')(client, context.logger, null);
const clusterName = context.sysconfig.teraslice.name;
const name = `${clusterName}_logs_template`;
// setting template name to reflect current teraslice instance name to help prevent
// conflicts with differing versions of teraslice with same elastic db
template.template = `${clusterName}${template.template}`;
return elasticsearch.putTemplate(template, name);
}
return Promise.resolve(true);
};
| 42.304348 | 94 | 0.704008 |
c8ccdb1388d54ce1fc032b568c708051fd95694c | 1,462 | js | JavaScript | Facebook/js/index.js | Grandclosing/UserInterfaceChallenges | 7a4aa673ebf55997696c1d353dccbf7ae9a862ee | [
"MIT"
] | null | null | null | Facebook/js/index.js | Grandclosing/UserInterfaceChallenges | 7a4aa673ebf55997696c1d353dccbf7ae9a862ee | [
"MIT"
] | null | null | null | Facebook/js/index.js | Grandclosing/UserInterfaceChallenges | 7a4aa673ebf55997696c1d353dccbf7ae9a862ee | [
"MIT"
] | null | null | null |
var buttonState = 0;
var fontSize = 0.85;
window.onload = function() {
var bannerContent = document.getElementsByClassName('fb-banner-content-container')[0];
var contentContainer = document.getElementsByClassName('content-container')[0];
bannerContent.style.width = window.outerWidth * 0.703 + "px";
contentContainer.style.width = window.outerWidth * 0.703 + "px";
}
function toggleSearchButton(state) {
var searchButton = document.getElementsByClassName('search-button')[0];
if(state == 1) {
searchButton.style.backgroundColor = "#4c81f7";
buttonState = state;
} else if(state == 0) {
searchButton.style.backgroundColor = "#f7f8f9";
buttonState = state;
} else if(state == 2) {
if(buttonState != 1) {
searchButton.style.backgroundColor = "#e9ebee";
buttonState = state;
}
} else if(state == 3) {
if(buttonState != 1) {
searchButton.style.backgroundColor = "#f7f8f9";
buttonState = state;
}
}
}
function resizeTextBox(elem) {
elem.style.height = "1px";
elem.style.height = 5 + elem.scrollHeight + "px";
if(elem.value.length < 86 && elem.value.length != 0) {
if(fontSize != 1.4) {
fontSize = 1.4;
elem.style.fontSize = fontSize + "em";
}
} else if(elem.value.length >= 86) {
if(fontSize != 0.85) {
fontSize = 0.85;
elem.style.fontSize = fontSize + "em";
}
} else if(elem.value.length == 0) {
if(fontSize != 0.85) {
fontSize = 0.85;
elem.style.fontSize = fontSize + "em";
}
}
}
| 25.649123 | 87 | 0.659371 |
c8ccdef752ab76c15623f4038582d633a815afb3 | 13,556 | js | JavaScript | scripts/MVC/view/icons/MBaseIconView.js | PetrViitman/XibalbasGems | 143caf35125578f6d1f36c5221b4533e0df0acb8 | [
"Apache-2.0"
] | null | null | null | scripts/MVC/view/icons/MBaseIconView.js | PetrViitman/XibalbasGems | 143caf35125578f6d1f36c5221b4533e0df0acb8 | [
"Apache-2.0"
] | null | null | null | scripts/MVC/view/icons/MBaseIconView.js | PetrViitman/XibalbasGems | 143caf35125578f6d1f36c5221b4533e0df0acb8 | [
"Apache-2.0"
] | null | null | null | class MBaseIconView extends MView
{
constructor(aSymbolId_int)
{
super();
this._fSymbolId_int = aSymbolId_int;
this._fContentWrapperContainer_mdc = this.addChild(new MDisplayContainer());
this._fContentContainer_mdc = this._fContentWrapperContainer_mdc.addChild(new MDisplayContainer());
this._fBodyContainer_mdc = this._fContentContainer_mdc.addChild(this.generateBody());
this._fBlackoutContainer_mdc = this._fContentContainer_mdc.addChild(this.generateBlackout());
this._fGlowContainer_mdc = this._fContentContainer_mdc.addChild(this.generateGlow());
this._fTensionContainer_mdc = this._fContentContainer_mdc.addChild(this.generateTensionContainer());
this._fFreeSpinsAwardContainer_mdc = this._fContentContainer_mdc.addChild(this.generateFreeSpinsAwardContainer());
this._fSpecialEffectsContainer_mdc = this._fContentContainer_mdc.addChild(this.generateSpecialEffectsContainer());
this._fConstantLoopAnimation_mt = this.generateConstantLoopAnimation();
this._fStartSpinAnimation_mt = this.generateStartSpinAnimation();
this._fFinishSpinAnimation_mt = this.generateFinishSpinAnimation();
this._fFinishCascadeAnimation_mt = this.generateFinishCascadeAnimation();
this._fBlackoutIntroAnimation_mt = this.generateBlackoutIntroAnimation();
this._fBlackoutOutroAnimation_mt = this.generateBlackoutOutroAnimation();
this._fPrimarayWinIntroAnimation_mt = this.generatePrimarayWinIntroAnimation();
this._fPrimarayWinOutroAnimation_mt = this.generatePrimarayWinOutroAnimation();
this._fNonPrimarayWinIntroAnimation_mt = this.generateNonPrimarayWinIntroAnimation();
this._fNonPrimarayWinOutroAnimation_mt = this.generateNonPrimarayWinOutroAnimation();
this._fFreeSpinsAwardAnimation_mt = this.generateFreeSpinsAwardAnimation();
this._fConstantLoopAnimation_mt.play(MAnimation.ANIMATION_PLAY_MODE_ID_LOOP);
this._fBlackoutContainer_mdc && this._fBlackoutContainer_mdc.setAlpha(0);
this._fGlowContainer_mdc && this._fGlowContainer_mdc.setAlpha(0);
//VFX LEVEL...
this._fGlowContainer_mdc.setVFXLevel(0.25);
this._fTensionContainer_mdc.setVFXLevel(0.25);
this._fFreeSpinsAwardContainer_mdc.setVFXLevel(0.5);
//...VFX LEVEL
}
generateBody()
{
let lPicture_mp = null;
switch(this._fSymbolId_int)
{
case MReelsModel.SYMBOL_ID_A:
lPicture_mp = STORAGE.iconA_mp;
break;
case MReelsModel.SYMBOL_ID_J:
lPicture_mp = STORAGE.iconJ_mp;
break;
case MReelsModel.SYMBOL_ID_Q:
lPicture_mp = STORAGE.iconQ_mp;
break;
case MReelsModel.SYMBOL_ID_K:
lPicture_mp = STORAGE.iconK_mp;
break;
case MReelsModel.SYMBOL_ID_10:
lPicture_mp = STORAGE.icon10_mp;
break;
case MReelsModel.SYMBOL_ID_MID_1:
lPicture_mp = STORAGE.iconBat_mp;
break;
case MReelsModel.SYMBOL_ID_MID_2:
lPicture_mp = STORAGE.iconFist_mp;
break;
case MReelsModel.SYMBOL_ID_MID_3:
lPicture_mp = STORAGE.iconTurtle_mp;
break;
case MReelsModel.SYMBOL_ID_MID_4:
lPicture_mp = STORAGE.iconSnake_mp;
break;
case MReelsModel.SYMBOL_ID_MID_5:
lPicture_mp = STORAGE.iconMeduze_mp;
break;
case MReelsModel.SYMBOL_ID_WILD:
lPicture_mp = STORAGE.iconWild_mp;
break;
case MReelsModel.SYMBOL_ID_SCATTER:
lPicture_mp = STORAGE.iconScatter_mp;
break;
default:
console.error("unknown icon ID: ", this._fSymbolId_int);
break;
}
let lDisplayObject_mdo = new MDisplayObject(lPicture_mp);
lDisplayObject_mdo.setXY(this.getWidth()/2, this.getHeight()/2);
lDisplayObject_mdo.setRegPointToCenter();
return lDisplayObject_mdo;
}
generateGlow()
{
let lPictureGlow_mp = null;
switch(this._fSymbolId_int)
{
case MReelsModel.SYMBOL_ID_A:
lPictureGlow_mp = STORAGE.iconGlowA_mp;
break;
case MReelsModel.SYMBOL_ID_J:
lPictureGlow_mp = STORAGE.iconGlowJ_mp;
break;
case MReelsModel.SYMBOL_ID_Q:
lPictureGlow_mp = STORAGE.iconGlowQ_mp;
break;
case MReelsModel.SYMBOL_ID_K:
lPictureGlow_mp = STORAGE.iconGlowK_mp;
break;
case MReelsModel.SYMBOL_ID_10:
lPictureGlow_mp = STORAGE.iconGlow10_mp;
break;
case MReelsModel.SYMBOL_ID_MID_1:
lPictureGlow_mp = STORAGE.iconGlowBat_mp;
break;
case MReelsModel.SYMBOL_ID_MID_2:
lPictureGlow_mp = STORAGE.iconGlowFist_mp;
break;
case MReelsModel.SYMBOL_ID_MID_3:
lPictureGlow_mp = STORAGE.iconGlowTurtle_mp;
break;
case MReelsModel.SYMBOL_ID_MID_4:
lPictureGlow_mp = STORAGE.iconGlowSnake_mp;
break;
case MReelsModel.SYMBOL_ID_MID_5:
lPictureGlow_mp = STORAGE.iconGlowMeduze_mp;
break;
case MReelsModel.SYMBOL_ID_WILD:
lPictureGlow_mp = STORAGE.iconGlowWild_mp;
break;
case MReelsModel.SYMBOL_ID_SCATTER:
lPictureGlow_mp = STORAGE.iconGlowScatter_mp;
break;
default:
console.error("unknown icon ID: ", this._fSymbolId_int);
break;
}
let lDisplayObject_mdo = new MDisplayObject(lPictureGlow_mp);
lDisplayObject_mdo.setXY(this.getWidth()/2, this.getHeight()/2);
lDisplayObject_mdo.setRegPointToCenter();
return lDisplayObject_mdo;
}
generateBlackout()
{
let lPictureBlackout_mp = null;
switch(this._fSymbolId_int)
{
case MReelsModel.SYMBOL_ID_A:
lPictureBlackout_mp = STORAGE.iconBlackoutA_mp;
break;
case MReelsModel.SYMBOL_ID_J:
lPictureBlackout_mp = STORAGE.iconBlackoutJ_mp;
break;
case MReelsModel.SYMBOL_ID_Q:
lPictureBlackout_mp = STORAGE.iconBlackoutQ_mp;
break;
case MReelsModel.SYMBOL_ID_K:
lPictureBlackout_mp = STORAGE.iconBlackoutK_mp;
break;
case MReelsModel.SYMBOL_ID_10:
lPictureBlackout_mp = STORAGE.iconBlackout10_mp;
break;
case MReelsModel.SYMBOL_ID_MID_1:
lPictureBlackout_mp = STORAGE.iconBlackoutBat_mp;
break;
case MReelsModel.SYMBOL_ID_MID_2:
lPictureBlackout_mp = STORAGE.iconBlackoutFist_mp;
break;
case MReelsModel.SYMBOL_ID_MID_3:
lPictureBlackout_mp = STORAGE.iconBlackoutTurtle_mp;
break;
case MReelsModel.SYMBOL_ID_MID_4:
lPictureBlackout_mp = STORAGE.iconBlackoutSnake_mp;
break;
case MReelsModel.SYMBOL_ID_MID_5:
lPictureBlackout_mp = STORAGE.iconBlackoutMeduze_mp;
break;
case MReelsModel.SYMBOL_ID_WILD:
lPictureBlackout_mp = STORAGE.iconBlackoutWild_mp;
break;
case MReelsModel.SYMBOL_ID_SCATTER:
lPictureBlackout_mp = STORAGE.iconBlackoutScatter_mp;
break;
default:
console.error("unknown icon ID: ", this._fSymbolId_int);
break;
}
let lDisplayObject_mdo = new MDisplayObject(lPictureBlackout_mp);
lDisplayObject_mdo.setXY(
this.getWidth()/2,
this.getHeight()/2);
lDisplayObject_mdo.setRegPointToCenter();
return lDisplayObject_mdo;
}
generateTensionContainer()
{
return new MDisplayContainer();
}
generateFreeSpinsAwardContainer()
{
return new MDisplayContainer();
}
generateSpecialEffectsContainer()
{
return new MDisplayContainer();
}
//ANIMATIONS...
//CONSTANT LOOP...
generateConstantLoopAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentWrapperContainer_mdc,
MTimeLine.SET_X,
0,
[
[-12, 25],
[12, 50],
[0, 25],
]
);
return l_mt;
}
//...CONSTANT LOOP
//START SPIN...
generateStartSpinAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
0,
[
[1, 15],
]
);
return l_mt;
}
//...START SPIN
//FINISH SPIN...
generateFinishSpinAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
1,
[
[0, 15],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_Y,
0,
[
[-15, 5],
[10, 5],
[-5, 5],
[0, 5],
]
);
return l_mt;
}
//...FINISH SPIN
//FINISH CASCADE...
generateFinishCascadeAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_Y,
0,
[
[-15, 5],
[10, 5],
[-5, 5],
[0, 5],
]
);
return l_mt;
}
//...FINISH CASCADE
//BLACKOUT INTRO...
generateBlackoutIntroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fBlackoutContainer_mdc,
MTimeLine.SET_ALPHA,
0,
[
[1, 8],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
0,
[
[5, 5],
[25, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.1, 4],
[0.8, 4],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_Y,
1,
[
[0.9, 8],
]
);
return l_mt;
}
//...BLACKOUT INTRO
//BLACKOUT OUTRO...
generateBlackoutOutroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fBlackoutContainer_mdc,
MTimeLine.SET_ALPHA,
1,
[
[0, 8],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
25,
[
[-5, 5],
[0, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
0.8,
[
[1.1, 4],
[1, 4],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_Y,
0.9,
[
[1, 8],
]
);
return l_mt;
}
//...BLACKOUT OUTRO
//PRIMARY WIN...
//INTRO...
generatePrimarayWinIntroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
0,
[
[-5, 5],
[-10, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.25, 5],
[1, 5],
]
);
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
0,
[
[1, 5],
]
);
return l_mt;
}
//INTRO...
//OUTRO...
generatePrimarayWinOutroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
-10,
[
[5, 5],
[0, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.25, 5],
[1, 5],
]
);
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
1,
[
[0, 5],
]
);
return l_mt;
}
//...OUTRO
//...PRIMARY WIN
//NON PRIMARY WIN...
//INTRO...
generateNonPrimarayWinIntroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
0,
[
[-5, 5],
[-10, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.25, 5],
[1, 5],
]
);
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
0,
[
[1, 5],
]
);
return l_mt;
}
//...INTRO
//OUTRO...
generateNonPrimarayWinOutroAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
-10,
[
[5, 5],
[0, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.25, 5],
[1, 5],
]
);
l_mt.addAnimation(
this._fGlowContainer_mdc,
MTimeLine.SET_ALPHA,
1,
[
[0, 5],
]
);
return l_mt;
}
//...OUTRO
//...NON PRIMARY WIN
//FREE SPINS AWARD...
generateFreeSpinsAwardAnimation()
{
let l_mt = new MTimeLine();
l_mt.addAnimation(
this._fBlackoutContainer_mdc,
MTimeLine.SET_ALPHA,
0,
[
[1, 8],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_X,
0,
[
[5, 5],
[25, 5],
]
);
l_mt.addAnimation(
this._fContentContainer_mdc,
MTimeLine.SET_SCALE_X,
1,
[
[1.25, 10],
[1, 10],
]
);
return l_mt;
}
//...FREE SPINS AWARD
//...ANIMATIONS
//GETTERS...
getContentContainer()
{
return this._fContentContainer_mdc;
}
getBodyContainer()
{
return this._fBodyContainer_mdc;
}
getGlowContainer()
{
return this._fGlowContainer_mdc;
}
getTensionContainer()
{
return this._fTensionContainer_mdc;
}
getFreeSpinsAwardContainer()
{
return this._fFreeSpinsAwardContainer_mdc;
}
getSpecialEffectsContainer()
{
return this._fSpecialEffectsContainer_mdc;
}
//...GETTERS
//EXTERNAL CONTROL METHODS...
onStartSpin()
{
this._fStartSpinAnimation_mt.play();
}
onFinishSpin()
{
this._fFinishSpinAnimation_mt.play();
}
onFinishCascade()
{
this._fFinishCascadeAnimation_mt.play();
}
showBlackoutIntro()
{
this._fBlackoutIntroAnimation_mt.play();
}
showBlackoutOutro()
{
this._fBlackoutOutroAnimation_mt.play();
}
showPrimarayWinIntroPresentation()
{
this._fPrimarayWinIntroAnimation_mt.play();
}
showPrimarayWinOutroPresentation()
{
this._fPrimarayWinOutroAnimation_mt.play();
}
showNonPrimarayWinIntroPresentation()
{
this._fNonPrimarayWinIntroAnimation_mt.play();
}
showNonPrimarayWinOutroPresentation()
{
this._fNonPrimarayWinOutroAnimation_mt.play();
}
showFreeSpinsAwardPresentation()
{
this._fFreeSpinsAwardAnimation_mt.play();
}
restore()
{
//CONTENT CONTAINER...
this._fContentContainer_mdc.setX(0);
this._fContentContainer_mdc.setScale(1);
//...CONTENT CONTAINER
//BODY...
this._fBodyContainer_mdc.setAlpha(1);
//...BODY
//BLACKOUT...
this._fBlackoutContainer_mdc.setAlpha(0);
//...BLACKOUT
//GLOW...
this._fGlowContainer_mdc.setAlpha(0);
//...GLOW
}
//...EXTERNAL CONTROL METHODS
} | 19.617945 | 116 | 0.686412 |
c8ccf4387299c324091209c7b14cbb6f0ef1604a | 3,363 | js | JavaScript | src/templates/TNMCategoryTemplate.js | mcode/mcode-extraction-framework | 58af417ac444c58361b9415bc02b34c1ebb04cb9 | [
"Apache-2.0"
] | 15 | 2020-04-28T18:15:48.000Z | 2022-03-06T12:16:09.000Z | src/templates/TNMCategoryTemplate.js | mcode/mcode-extraction-framework | 58af417ac444c58361b9415bc02b34c1ebb04cb9 | [
"Apache-2.0"
] | 95 | 2020-05-08T15:12:26.000Z | 2022-01-20T15:29:34.000Z | src/templates/TNMCategoryTemplate.js | mcode/mcode-extraction-framework | 58af417ac444c58361b9415bc02b34c1ebb04cb9 | [
"Apache-2.0"
] | 1 | 2020-12-07T21:25:02.000Z | 2020-12-07T21:25:02.000Z | const { coding, reference, stagingMethodTemplate, valueX } = require('./snippets');
// Returns category specific data based on stage and category type
function getCategorySpecificData(stageType, categoryType) {
if (stageType === 'Clinical') {
const categoryCode = 'survey';
if (categoryType === 'Tumor') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-clinical-primary-tumor-category',
code: '21905-5',
};
}
if (categoryType === 'Metastases') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-clinical-distant-metastases-category',
code: '21907-1',
};
}
if (categoryType === 'Nodes') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-clinical-regional-nodes-category',
code: '21906-3',
};
}
} else if (stageType === 'Pathologic') {
const categoryCode = 'laboratory';
if (categoryType === 'Tumor') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-pathological-primary-tumor-category',
code: '21899-0',
};
}
if (categoryType === 'Metastases') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-pathological-distant-metastases-category',
code: '21901-4',
};
}
if (categoryType === 'Nodes') {
return {
categoryCode,
profileUrl: 'http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-tnm-pathological-regional-nodes-category',
code: '21900-6',
};
}
}
throw new Error('Provided stage and category types are not valid.');
}
function tnmCategoryTemplate({
categoryType,
conditionId,
effectiveDateTime,
id,
stageType,
stagingSystem,
stagingCodeSystem,
subjectId,
valueCode,
}) {
if (!(id && subjectId && conditionId && valueCode && effectiveDateTime && categoryType && stageType)) {
throw Error('Trying to render a TNMCategoryTemplate, but a required argument is missing;'
+ ' ensure that id, subjectId, conditionId, valueCode, effectiveDateTime, categoryType, and stageType, are all present');
}
const categorySpecificData = getCategorySpecificData(stageType, categoryType);
const { categoryCode, code, profileUrl } = categorySpecificData;
return {
resourceType: 'Observation',
id,
meta: {
profile: [profileUrl],
},
status: 'final',
category: [
{
coding: [
coding({
system:
'http://terminology.hl7.org/CodeSystem/observation-category',
code: categoryCode,
}),
],
},
],
code: {
coding: [
coding({
system: 'http://loinc.org',
code,
}),
],
},
subject: reference({ id: subjectId, resourceType: 'Patient' }),
...stagingMethodTemplate({ code: stagingSystem, system: stagingCodeSystem }),
effectiveDateTime,
...valueX({ code: valueCode, system: 'http://cancerstaging.org' }, 'valueCodeableConcept'),
focus: [reference({ id: conditionId, resourceType: 'Condition' })],
};
}
module.exports = {
tnmCategoryTemplate,
};
| 30.026786 | 127 | 0.622658 |
c8cd0cd1f0986cea69b823b7bb2575654a9bfe50 | 1,890 | js | JavaScript | app/lib/aggregators/HystrixCommandAggregator.js | bluestatedigital/oscilloscope | 60ac736faf20e6d4b9b353576bf6bfe0f686d338 | [
"Apache-2.0"
] | null | null | null | app/lib/aggregators/HystrixCommandAggregator.js | bluestatedigital/oscilloscope | 60ac736faf20e6d4b9b353576bf6bfe0f686d338 | [
"Apache-2.0"
] | null | null | null | app/lib/aggregators/HystrixCommandAggregator.js | bluestatedigital/oscilloscope | 60ac736faf20e6d4b9b353576bf6bfe0f686d338 | [
"Apache-2.0"
] | null | null | null | var Sorting = require('../sorting.js')
var Constants = require('../constants.js')
var Utility = require('../utility.js')
var HystrixCommandAggregator = function() {
var state = {
type: Constants.HystrixCommandType,
values: {},
sorting: new Sorting()
}
return {
// Adds a value to this aggregator.
addValue: function(value) {
if(value.type != state.type) {
return
}
// Invalidate our sorting when we see a new command to force a timely resort.
if(state.values[value.name] === undefined) {
state.sorting.invalidate()
}
// Preprocess our value and store it.
var processedValue = this.preprocess(value)
state.values[value.name] = processedValue
},
// Sets the key to sort our values on.
sortBy: function(key) {
state.sorting.setSortKey(key)
},
// Gets the type string for this aggregator.
getType: function() {
return state.type
},
// Gets all of our current values, sorted.
getValues: function() {
var values = Object.keys(state.values).map(function (k) { return state.values[k] })
// This returns a copy. It is not the same as Array.sort().
return state.sorting.sort(values)
},
// Preprocesses the value to add some values we don't get off the bat.
preprocess: function(value) {
var numberSeconds = value.statsWindowMs / 1000
var totalRequests = value.requestCount
if (totalRequests < 0) {
totalRequests = 0
}
var ratePerSecond = Utility.getRoundedNumber(totalRequests / numberSeconds)
var ratePerSecondPerHost = Utility.getRoundedNumber(totalRequests / numberSeconds / value.reportingHosts)
value.ratePerSecond = ratePerSecond
value.ratePerSecondPerHost = ratePerSecondPerHost
return value
}
}
}
module.exports = HystrixCommandAggregator
| 27.794118 | 112 | 0.653968 |
c8cdbda9f45ebdc9a5b19647979491dc5cf235d3 | 517 | js | JavaScript | src/PresentationalComponents/Snippets/SystemUpToDate.test.js | Josca/patchman-ui | 18eaa9528dc74bfe7553b540ec4e90610f25c66e | [
"Apache-2.0"
] | 2 | 2021-07-07T11:12:40.000Z | 2021-12-12T22:26:59.000Z | src/PresentationalComponents/Snippets/SystemUpToDate.test.js | Josca/patchman-ui | 18eaa9528dc74bfe7553b540ec4e90610f25c66e | [
"Apache-2.0"
] | 705 | 2019-11-22T11:31:59.000Z | 2022-03-23T14:36:08.000Z | src/PresentationalComponents/Snippets/SystemUpToDate.test.js | mkholjuraev/patchman-ui | 769cbb3722c4415ce887cd103fc1e10b80e2fbf0 | [
"Apache-2.0"
] | 12 | 2019-12-12T14:47:36.000Z | 2022-02-14T15:53:12.000Z | import { SystemUpToDate } from './SystemUpToDate';
import toJson from 'enzyme-to-json';
const wrapper = shallow(<SystemUpToDate />);
describe('SystemUpToDate', () => {
it('Should match the snapshot', () => {
expect(toJson(wrapper)).toMatchSnapshot();
});
it('Should render CheckCircleIcon', () => {
const iconRender = wrapper.find('EmptyStateIcon').props().icon;
const component = iconRender();
expect(component.type.displayName).toEqual('CheckCircleIcon');
});
});
| 30.411765 | 71 | 0.644101 |
c8ce3f97e6ba852a9e6da0c2a09241ff0969de8a | 937 | js | JavaScript | build/bin/entities/Token/logic/makeDelayTokens.js | monx-dev/figmagic | 3cbf8ae086652b6bb58b4bc211aea983ebd249ac | [
"MIT"
] | 1 | 2021-02-20T03:26:45.000Z | 2021-02-20T03:26:45.000Z | build/bin/entities/Token/logic/makeDelayTokens.js | gongchunhui2018/figmagic | 4a24ced081cbfe7f27371285b934cfcf4987f710 | [
"MIT"
] | null | null | null | build/bin/entities/Token/logic/makeDelayTokens.js | gongchunhui2018/figmagic | 4a24ced081cbfe7f27371285b934cfcf4987f710 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDelayTokens = void 0;
const camelize_1 = require("../../../frameworks/string/camelize");
const errors_1 = require("../../../frameworks/errors/errors");
function makeDelayTokens(delayFrame) {
if (!delayFrame)
throw new Error(errors_1.ErrorMakeDelayTokensNoFrame);
if (!delayFrame.children)
throw new Error(errors_1.ErrorMakeDelayTokensNoChildren);
const delays = {};
const TOKENS = delayFrame.children;
TOKENS.forEach((item) => makeDelayToken(item, delays));
return delays;
}
exports.makeDelayTokens = makeDelayTokens;
function makeDelayToken(item, delays) {
if (!item.name || !item.characters)
throw new Error(errors_1.ErrorMakeDelayTokensMissingProps);
const NAME = camelize_1.camelize(item.name);
delays[NAME] = parseFloat(item.characters);
}
//# sourceMappingURL=makeDelayTokens.js.map | 40.73913 | 67 | 0.723586 |
c8ce53ebf767cecea53c3c6e20bd079b949a2bb8 | 1,233 | js | JavaScript | src/utils/setupTests.js | mattcolman/react-prebid | c737e445278740bc632054675023fb8c47001a55 | [
"MIT"
] | null | null | null | src/utils/setupTests.js | mattcolman/react-prebid | c737e445278740bc632054675023fb8c47001a55 | [
"MIT"
] | null | null | null | src/utils/setupTests.js | mattcolman/react-prebid | c737e445278740bc632054675023fb8c47001a55 | [
"MIT"
] | 1 | 2020-04-02T19:25:44.000Z | 2020-04-02T19:25:44.000Z | import chai from 'chai';
import sinonChai from 'sinon-chai';
import chaiEnzyme from 'chai-enzyme';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'regenerator-runtime/runtime';
configure({ adapter: new Adapter() });
chai.should();
chai.use(sinonChai);
chai.use(chaiEnzyme());
// Make sure chai and jasmine ".not" play nice together
const originalNot = Object.getOwnPropertyDescriptor(chai.Assertion.prototype, 'not').get;
Object.defineProperty(chai.Assertion.prototype, 'not', {
get() {
Object.assign(this, this.assignedNot);
return originalNot.apply(this);
},
set(newNot) {
this.assignedNot = newNot;
return newNot;
}
});
// Combine both jest and chai matchers on expect
const jestExpect = global.expect;
global.expect = actual => {
const originalMatchers = jestExpect(actual);
const chaiMatchers = chai.expect(actual);
return Object.assign(chaiMatchers, originalMatchers);
};
// Fix error message “A "describe" callback must not return a value.”
// https://stackoverflow.com/a/55211488/1253156
const realDescribe = global.describe;
global.describe = (name, fn) => {
realDescribe(name, () => {
fn();
});
};
| 28.022727 | 89 | 0.694242 |
c8cf8224a0a2a33319ffbec6af9bcfd96b17b179 | 3,805 | js | JavaScript | src/Login/Login.test.js | ox2/login-ui | d2fe2e65c0ae73a2f97af59e4a2b19bc93c08a25 | [
"MIT"
] | null | null | null | src/Login/Login.test.js | ox2/login-ui | d2fe2e65c0ae73a2f97af59e4a2b19bc93c08a25 | [
"MIT"
] | null | null | null | src/Login/Login.test.js | ox2/login-ui | d2fe2e65c0ae73a2f97af59e4a2b19bc93c08a25 | [
"MIT"
] | null | null | null | /* eslint-disable no-unused-vars */
import React from 'react';
import { shallow, render, mount } from 'enzyme';
import Theme from '@ox2/theme-wrapper/Theme';
import Login from './Login';
import injectTapEventPlugin from 'react-tap-event-plugin';
// Material UI
// Needed for onTouchTap
// http://stackoverflow.com/a/34015469/988941
injectTapEventPlugin();
const handler = () => true;
it('renders valid email with guest', () => {
const wrapper = mount(
<Theme>
<Login
codeSent={false}
codeValue={''}
emailAccepted={false}
emailValidationError={''}
emailValue={'info@some.io'}
guestLoginEnabled={true}
loggingIn={false}
loginValidationError={''}
logo={'http://i.imgur.com/aNF7yFO.gif'}
onCodeEnterKeyPress={handler}
onCodeUpdate={handler}
onEmailEnterKeyPress={handler}
onEmailSubmit={handler}
onEmailUpdate={handler}
onLogin={handler}
onResendCode={handler}
onReset={handler}
resendingCode={false}
resendingCodeDone={false}
sendingCode={false}
validCodeFormat={false}
validEmailFormat={true}
/>
</Theme>,
);
expect(wrapper).toMatchSnapshot();
});
it('renders valid code format', () => {
const wrapper = mount(
<Theme>
<Login
codeSent={true}
codeValue={'33221'}
emailAccepted={true}
emailValidationError={''}
emailValue={'info@some.io'}
guestLoginEnabled={false}
loggingIn={false}
loginValidationError={''}
logo={'http://i.imgur.com/aNF7yFO.gif'}
onCodeEnterKeyPress={handler}
onCodeUpdate={handler}
onEmailEnterKeyPress={handler}
onEmailSubmit={handler}
onEmailUpdate={handler}
onLogin={handler}
onResendCode={handler}
onReset={handler}
resendingCode={false}
resendingCodeDone={false}
sendingCode={false}
validCodeFormat={true}
validEmailFormat={false}
/>
</Theme>,
);
expect(wrapper).toMatchSnapshot();
});
it('renders sending code', () => {
const wrapper = mount(
<Theme>
<Login
codeSent={false}
codeValue={''}
emailAccepted={false}
emailValidationError={''}
emailValue={''}
guestLoginEnabled={false}
loggingIn={false}
loginValidationError={''}
logo={'http://i.imgur.com/aNF7yFO.gif'}
onCodeEnterKeyPress={handler}
onCodeUpdate={handler}
onEmailEnterKeyPress={handler}
onEmailSubmit={handler}
onEmailUpdate={handler}
onLogin={handler}
onResendCode={handler}
onReset={handler}
resendingCode={false}
resendingCodeDone={false}
sendingCode={true}
validCodeFormat={false}
validEmailFormat={false}
/>
</Theme>,
);
expect(wrapper).toMatchSnapshot();
});
it('renders logging in', () => {
const wrapper = mount(
<Theme>
<Login
codeSent={false}
codeValue={''}
emailAccepted={false}
emailValidationError={''}
emailValue={''}
guestLoginEnabled={false}
loggingIn={true}
loginValidationError={''}
logo={'http://i.imgur.com/aNF7yFO.gif'}
onCodeEnterKeyPress={handler}
onCodeUpdate={handler}
onEmailEnterKeyPress={handler}
onEmailSubmit={handler}
onEmailUpdate={handler}
onLogin={handler}
onResendCode={handler}
onReset={handler}
resendingCode={false}
resendingCodeDone={false}
sendingCode={false}
validCodeFormat={false}
validEmailFormat={false}
/>
</Theme>,
);
expect(wrapper).toMatchSnapshot();
});
| 26.061644 | 58 | 0.595795 |
c8d0f62a071c58203840e031acff90c77e6ed49c | 2,905 | js | JavaScript | src/families/polkadot/SimpleOperationFlow/index.js | quietbits/ledger-live-mobile | b7a4d1912b4bc936c93a406a7092482683c1e8ac | [
"Apache-2.0"
] | 11 | 2018-01-08T11:01:14.000Z | 2018-04-19T19:13:48.000Z | src/families/polkadot/SimpleOperationFlow/index.js | quietbits/ledger-live-mobile | b7a4d1912b4bc936c93a406a7092482683c1e8ac | [
"Apache-2.0"
] | 5 | 2018-03-05T12:01:48.000Z | 2018-04-13T13:08:34.000Z | src/families/polkadot/SimpleOperationFlow/index.js | quietbits/ledger-live-mobile | b7a4d1912b4bc936c93a406a7092482683c1e8ac | [
"Apache-2.0"
] | 7 | 2018-01-08T15:25:58.000Z | 2018-03-29T03:08:39.000Z | // @flow
import React, { useMemo } from "react";
import { useTranslation } from "react-i18next";
import { createStackNavigator } from "@react-navigation/stack";
import { useTheme } from "@react-navigation/native";
import { ScreenName } from "../../../const";
import { getStackNavigatorConfig } from "../../../navigation/navigatorConfig";
import StepHeader from "../../../components/StepHeader";
import Started from "./01-Started";
import SelectDevice from "../../../screens/SelectDevice";
import ConnectDevice from "../../../screens/ConnectDevice";
import ValidationSuccess from "./03-ValidationSuccess";
import ValidationError from "./03-ValidationError";
const totalSteps = "2";
function SimpleOperationFlow() {
const { t } = useTranslation();
const { colors } = useTheme();
const stackNavigatorConfig = useMemo(
() => getStackNavigatorConfig(colors, true),
[colors],
);
return (
<Stack.Navigator screenOptions={stackNavigatorConfig}>
<Stack.Screen
name={ScreenName.PolkadotSimpleOperationStarted}
component={Started}
options={({ route }) => ({
title: route.params.mode
? t(`polkadot.simpleOperation.modes.${route.params.mode}.title`)
: t("polkadot.simpleOperation.stepperHeader.info"),
headerLeft: null,
})}
/>
<Stack.Screen
name={ScreenName.PolkadotSimpleOperationSelectDevice}
component={SelectDevice}
options={{
headerTitle: () => (
<StepHeader
title={t("polkadot.simpleOperation.stepperHeader.selectDevice")}
subtitle={t("polkadot.simpleOperation.stepperHeader.stepRange", {
currentStep: "1",
totalSteps,
})}
/>
),
}}
/>
<Stack.Screen
name={ScreenName.PolkadotSimpleOperationConnectDevice}
component={ConnectDevice}
options={{
headerTitle: () => (
<StepHeader
title={t("polkadot.simpleOperation.stepperHeader.connectDevice")}
subtitle={t("polkadot.simpleOperation.stepperHeader.stepRange", {
currentStep: "2",
totalSteps,
})}
/>
),
}}
/>
<Stack.Screen
name={ScreenName.PolkadotSimpleOperationValidationSuccess}
component={ValidationSuccess}
options={{
headerTitle: "",
gestureEnabled: false,
headerLeft: null,
headerRight: null,
}}
/>
<Stack.Screen
name={ScreenName.PolkadotSimpleOperationValidationError}
component={ValidationError}
options={{ headerShown: false }}
/>
</Stack.Navigator>
);
}
const options = {
headerShown: false,
};
export { SimpleOperationFlow as component, options };
const Stack = createStackNavigator();
| 30.260417 | 79 | 0.603442 |
c8d229f669b94852d3edb1ab316680363d46dac1 | 825 | js | JavaScript | public/js/myjs.js | arturorenteriia/pvguide | 50b49488b2b65589f5cfdb5fc5719f260db74e3a | [
"MIT"
] | null | null | null | public/js/myjs.js | arturorenteriia/pvguide | 50b49488b2b65589f5cfdb5fc5719f260db74e3a | [
"MIT"
] | null | null | null | public/js/myjs.js | arturorenteriia/pvguide | 50b49488b2b65589f5cfdb5fc5719f260db74e3a | [
"MIT"
] | null | null | null | $(window).scroll(function() {
if ($(document).scrollTop() > 150) {
alert('hi');
$('.logo').height(200);
}
else {
$('.logo').height(100);
};
$(document).ready(function() {
$.simpleWeather({
location: 'Austin, TX',
woeid: '',
unit: 'f',
success: function(weather) {
html = '<h2><i class="icon-'+weather.code+'"></i> '+weather.temp+'°'+weather.units.temp+'</h2>';
html += '<ul><li>'+weather.city+', '+weather.region+'</li>';
html += '<li class="currently">'+weather.currently+'</li>';
html += '<li>'+weather.wind.direction+' '+weather.wind.speed+' '+weather.units.speed+'</li></ul>';
$("#weather").html(html);
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
});
| 27.5 | 106 | 0.493333 |
c8d2339352318763ad9464c240890b3f4bb2a4d9 | 6,524 | js | JavaScript | node_modules/@apollographql/apollo-tools/lib/buildServiceDefinition.js | yoorw/GraphQLNestPrisma | d6604826347d11c07a6860f4737f463f2ae65ab3 | [
"MIT"
] | 6 | 2017-02-06T09:26:48.000Z | 2022-02-03T01:51:10.000Z | node_modules/@apollographql/apollo-tools/lib/buildServiceDefinition.js | yoorw/GraphQLNestPrisma | d6604826347d11c07a6860f4737f463f2ae65ab3 | [
"MIT"
] | 13 | 2019-12-30T04:46:46.000Z | 2022-02-18T13:12:06.000Z | node_modules/@apollographql/apollo-tools/lib/buildServiceDefinition.js | yoorw/GraphQLNestPrisma | d6604826347d11c07a6860f4737f463f2ae65ab3 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const graphql_1 = require("graphql");
const graphql_2 = require("./utilities/graphql");
const predicates_1 = require("./utilities/predicates");
function buildServiceDefinition(modules) {
const errors = [];
const typeDefinitionsMap = Object.create(null);
const typeExtensionsMap = Object.create(null);
const directivesMap = Object.create(null);
const schemaDefinitions = [];
const schemaExtensions = [];
for (let module of modules) {
if (graphql_2.isNode(module) && graphql_2.isDocumentNode(module)) {
module = { typeDefs: module };
}
for (const definition of module.typeDefs.definitions) {
if (graphql_1.isTypeDefinitionNode(definition)) {
const typeName = definition.name.value;
if (typeDefinitionsMap[typeName]) {
typeDefinitionsMap[typeName].push(definition);
}
else {
typeDefinitionsMap[typeName] = [definition];
}
}
else if (graphql_1.isTypeExtensionNode(definition)) {
const typeName = definition.name.value;
if (typeExtensionsMap[typeName]) {
typeExtensionsMap[typeName].push(definition);
}
else {
typeExtensionsMap[typeName] = [definition];
}
}
else if (definition.kind === graphql_1.Kind.DIRECTIVE_DEFINITION) {
const directiveName = definition.name.value;
if (directivesMap[directiveName]) {
directivesMap[directiveName].push(definition);
}
else {
directivesMap[directiveName] = [definition];
}
}
else if (definition.kind === graphql_1.Kind.SCHEMA_DEFINITION) {
schemaDefinitions.push(definition);
}
else if (definition.kind === graphql_1.Kind.SCHEMA_EXTENSION) {
schemaExtensions.push(definition);
}
}
}
for (const [typeName, typeDefinitions] of Object.entries(typeDefinitionsMap)) {
if (typeDefinitions.length > 1) {
errors.push(new graphql_1.GraphQLError(`Type "${typeName}" was defined more than once.`, typeDefinitions));
}
}
for (const [directiveName, directives] of Object.entries(directivesMap)) {
if (directives.length > 1) {
errors.push(new graphql_1.GraphQLError(`Directive "${directiveName}" was defined more than once.`, directives));
}
}
let operationTypeMap;
if (schemaDefinitions.length > 0 || schemaExtensions.length > 0) {
operationTypeMap = {};
const schemaDefinition = schemaDefinitions[schemaDefinitions.length - 1];
const operationTypes = [schemaDefinition, ...schemaExtensions]
.map(node => node.operationTypes)
.filter(predicates_1.isNotNullOrUndefined)
.flat();
for (const operationType of operationTypes) {
const typeName = operationType.type.name.value;
const operation = operationType.operation;
if (operationTypeMap[operation]) {
throw new graphql_1.GraphQLError(`Must provide only one ${operation} type in schema.`, [schemaDefinition]);
}
if (!(typeDefinitionsMap[typeName] || typeExtensionsMap[typeName])) {
throw new graphql_1.GraphQLError(`Specified ${operation} type "${typeName}" not found in document.`, [schemaDefinition]);
}
operationTypeMap[operation] = typeName;
}
}
else {
operationTypeMap = {
query: "Query",
mutation: "Mutation",
subscription: "Subscription"
};
}
for (const [typeName, typeExtensions] of Object.entries(typeExtensionsMap)) {
if (!typeDefinitionsMap[typeName]) {
if (Object.values(operationTypeMap).includes(typeName)) {
typeDefinitionsMap[typeName] = [
{
kind: graphql_1.Kind.OBJECT_TYPE_DEFINITION,
name: {
kind: graphql_1.Kind.NAME,
value: typeName
}
}
];
}
else {
errors.push(new graphql_1.GraphQLError(`Cannot extend type "${typeName}" because it does not exist in the existing schema.`, typeExtensions));
}
}
}
if (errors.length > 0) {
return { errors };
}
try {
const typeDefinitions = Object.values(typeDefinitionsMap).flat();
const directives = Object.values(directivesMap).flat();
let schema = graphql_1.buildASTSchema({
kind: graphql_1.Kind.DOCUMENT,
definitions: [...typeDefinitions, ...directives]
});
const typeExtensions = Object.values(typeExtensionsMap).flat();
if (typeExtensions.length > 0) {
schema = graphql_1.extendSchema(schema, {
kind: graphql_1.Kind.DOCUMENT,
definitions: typeExtensions
});
}
for (const module of modules) {
if (!module.resolvers)
continue;
addResolversToSchema(schema, module.resolvers);
}
return { schema };
}
catch (error) {
return { errors: [error] };
}
}
exports.buildServiceDefinition = buildServiceDefinition;
function addResolversToSchema(schema, resolvers) {
for (const [typeName, fieldConfigs] of Object.entries(resolvers)) {
const type = schema.getType(typeName);
if (!graphql_1.isObjectType(type))
continue;
const fieldMap = type.getFields();
for (const [fieldName, fieldConfig] of Object.entries(fieldConfigs)) {
if (fieldName.startsWith("__")) {
type[fieldName.substring(2)] = fieldConfig;
continue;
}
const field = fieldMap[fieldName];
if (!field)
continue;
if (typeof fieldConfig === "function") {
field.resolve = fieldConfig;
}
else {
field.resolve = fieldConfig.resolve;
}
}
}
}
//# sourceMappingURL=buildServiceDefinition.js.map | 40.775 | 158 | 0.564684 |
c8d2ef565678ac26c0452db5bde46c99ae172c64 | 1,330 | js | JavaScript | app/routes/events/CalendarRoute.js | Mathiazom/lego-webapp | 4b2dff37aec8f97e9cc769b10ad0f90c3c4b9fb5 | [
"MIT"
] | null | null | null | app/routes/events/CalendarRoute.js | Mathiazom/lego-webapp | 4b2dff37aec8f97e9cc769b10ad0f90c3c4b9fb5 | [
"MIT"
] | 125 | 2020-10-12T04:33:58.000Z | 2022-03-28T04:37:16.000Z | app/routes/events/CalendarRoute.js | Mathiazom/lego-webapp | 4b2dff37aec8f97e9cc769b10ad0f90c3c4b9fb5 | [
"MIT"
] | null | null | null | // @flow
import moment from 'moment-timezone';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { fetchList } from 'app/actions/EventActions';
import prepare from 'app/utils/prepare';
import Calendar from './components/Calendar';
const getDate = ({ params }) => {
const year = params.year || moment().year();
const month = params.month || moment().month() + 1;
return moment([parseInt(year, 10), parseInt(month, 10) - 1]);
};
const loadData = (props, dispatch) => {
const date = getDate(props.match);
if (date.isValid()) {
const dateAfter = date.clone().startOf('month').startOf('week');
const dateBefore = date.clone().endOf('month').endOf('week');
return dispatch(
fetchList({
dateAfter: dateAfter.format('YYYY-MM-DD'),
dateBefore: dateBefore.format('YYYY-MM-DD'),
})
);
}
};
const mapStateToProps = (state, ownProps) => {
const user = ownProps.currentUser;
const icalToken = user ? user.icalToken : null;
const actionGrant = state.events.actionGrant;
return {
date: getDate(ownProps.match),
actionGrant,
icalToken,
};
};
const mapDispatchToProps = { fetchList };
export default compose(
prepare(loadData, ['match.params.year', 'match.params.month']),
connect(mapStateToProps, mapDispatchToProps)
)(Calendar);
| 28.297872 | 68 | 0.666917 |
c8d324b162e2525473a749e3facd1fb5497bd0ea | 1,558 | js | JavaScript | lib/doc/anchor.js | kog13/exceljs | 017b68ec0fbd1483470aeabee2c41fbadcb4ee24 | [
"MIT"
] | null | null | null | lib/doc/anchor.js | kog13/exceljs | 017b68ec0fbd1483470aeabee2c41fbadcb4ee24 | [
"MIT"
] | null | null | null | lib/doc/anchor.js | kog13/exceljs | 017b68ec0fbd1483470aeabee2c41fbadcb4ee24 | [
"MIT"
] | null | null | null | 'use strict';
var Anchor = module.exports = function (model = {}) {
this.nativeCol = model.nativeCol || 0;
this.nativeColOff = model.nativeColOff || 0;
this.nativeRow = model.nativeRow || 0;
this.nativeRowOff = model.nativeRowOff || 0;
if (model.col) {
this.col = model.col;
}
if (model.row) {
this.row = model.row;
}
};
Anchor.asInstance = function (model) {
return model instanceof Anchor || model == null ? model : new Anchor(model);
};
Anchor.prototype = {
worksheet: null,
get col() {
return this.nativeCol + Math.min(this.colWidth - 1, this.nativeColOff) / this.colWidth;
},
set col(v) {
if (v === this.col) return;
this.nativeCol = Math.floor(v);
this.nativeColOff = Math.floor((v - this.nativeCol) * this.colWidth);
},
get row() {
return this.nativeRow + Math.min(this.rowHeight - 1, this.nativeRowOff) / this.rowHeight;
},
set row(v) {
if (v === this.row) return;
this.nativeRow = Math.floor(v);
this.nativeRowOff = Math.floor((v - this.nativeRow) * this.rowHeight);
},
get colWidth() {
return this.worksheet && this.worksheet.getColumn(this.nativeCol + 1) && this.worksheet.getColumn(this.nativeCol + 1).isCustomWidth ?
Math.floor(this.worksheet.getColumn(this.nativeCol + 1).width * 10000) :
640000;
},
get rowHeight() {
return this.worksheet && this.worksheet.getRow(this.nativeRow + 1) && this.worksheet.getRow(this.nativeRow + 1).height ?
Math.floor(this.worksheet.getRow(this.nativeRow + 1).height * 10000) :
180000;
}
};
| 30.54902 | 137 | 0.648909 |
c8d332aceec0faaeb17434accbd8529ba29f64ca | 8,695 | js | JavaScript | src/components/fxRunner/outputHandler.js | LegendProjects/txAdmin | 106f58fd7c912998d528b94788c5f912af7d4263 | [
"MIT"
] | 1 | 2021-02-19T22:07:19.000Z | 2021-02-19T22:07:19.000Z | src/components/fxRunner/outputHandler.js | TasoOneAsia/txAdmin | 6c39faab8f7fd0c950ea8e0649d04ea8495518e8 | [
"MIT"
] | null | null | null | src/components/fxRunner/outputHandler.js | TasoOneAsia/txAdmin | 6c39faab8f7fd0c950ea8e0649d04ea8495518e8 | [
"MIT"
] | null | null | null | //Requires
const modulename = 'OutputHandler';
const fs = require('fs');
const chalk = require('chalk');
const bytes = require('bytes');
const { dir, log, logOk, logWarn, logError } = require('../../extras/console')(modulename);
//Helpers
const anyUndefined = (...args) => { return [...args].some((x) => (typeof x === 'undefined')); };
const deferError = (m, t = 500) => {
setTimeout(() => {
logError(m);
}, t);
};
/**
* FXServer output buffer helper.
*
* FIXME: optimize this, we can have only one buffer using offset variables
* @param {string} logPath
* @param {int} saveInterval
*/
module.exports = class OutputHandler {
constructor(logPath, saveInterval) {
this.logFileSize = null;
this.logPath = logPath;
this.enableCmdBuffer = false;
this.cmdBuffer = '';
this.webConsoleBuffer = '';
this.webConsoleBufferSize = 128 * 1024; //128kb
this.fileBuffer = '';
//Start log file
try {
fs.writeFileSync(this.logPath, '');
} catch (error) {
logError(`Failed to create log file '${this.logPath}' with error: ${error.message}`);
}
//Cron Function
setInterval(this.saveLog.bind(this), saveInterval * 1000);
}
/**
* Processes FD3 traces
*
* Mapped straces:
* nucleus_connected
* watchdog_bark
* bind_error
* script_log
* script_structured_trace (not used)
*
* @param {object} data
*/
trace(trace) {
//Filter valid packages
if (anyUndefined(trace, trace.value, trace.value.data, trace.value.channel)) return;
const {channel, data} = trace.value;
//DEBUG
// if(trace.value.func == 'ScriptTrace') return;
// dir({channel,data});
//Handle bind errors
if (channel == 'citizen-server-impl' && data.type == 'bind_error') {
try {
if (!globals.fxRunner.restartDelayOverride) {
globals.fxRunner.restartDelayOverride = 10000;
} else if (globals.fxRunner.restartDelayOverride <= 45000) {
globals.fxRunner.restartDelayOverride += 5000;
}
const [_ip, port] = data.address.split(':');
deferError(`Detected FXServer error: Port ${port} is busy! Increasing restart delay to ${globals.fxRunner.restartDelayOverride}.`);
} catch (e) {}
return;
}
//Handle watchdog
if (channel == 'citizen-server-impl' && data.type == 'watchdog_bark') {
try {
deferError(`Detected FXServer thread ${data.thread} hung with stack:`);
deferError(`\t${data.stack}`);
deferError('Please check the resource above to prevent further hangs.');
} catch (e) {}
return;
}
//Handle script traces
if (channel == 'citizen-server-impl' && data.type == 'script_structured_trace') {
// dir(data.payload)
if (data.payload.type === 'txAdminHeartBeat') {
globals.monitor.handleHeartBeat('fd3');
} else if (data.payload.type === 'txAdminLogData') {
globals.databus.serverLog = globals.databus.serverLog.concat(data.payload.logs);
/*
NOTE: Expected time cap based on log size cap to prevent memory leak
Big server: 300 events/min (freeroam/dm with 100+ players)
Medium servers: 30 events/min (rp with up to 64 players)
64k cap: 3.5h big, 35.5h medium, 24mb, 620ms/1000 seek time
32k cap: 1.7h big, 17.7h medium, 12mb, 307ms/1000 seek time
16k cap: 0.9h big, 9h medium, 6mb, 150ms/1000 seek time
> Seek time based on getting 500 items older than cap - 1000 (so near the end of the array) run 1k times
> Memory calculated with process.memoryUsage().heapTotal considering every event about 300 bytes
FIXME: after testing, I could not reproduce just with log array the memory leak numbers seen in issues.
Investigate if there are other memory leaks, or maybe if the array.concat(payload) is the issue
To match the issue on issue #427, we would need 300k events to be a 470mb increase in rss and I
measured only 94mb worst case scenario
NOTE: Although we could comfortably do 64k cap, even if showing 500 lines per page, nobody would
navigate through 128 pages, so let's do 16k cap since there is not even a way for the admin to skip
pages since it's all relative (older/newer) just like github's tags/releases page.
NOTE: maybe a way to let big servers filter what is logged or not? That would be an export in fxs,
before sending it to fd3
*/
//NOTE: limiting to 16k requests which should be about 1h to big server (266 events/min)
// if (globals.databus.serverLog.length > 128e3) globals.databus.serverLog.shift();
//FIXME: this is super wrong
if (globals.databus.serverLog.length > 64e3) globals.databus.serverLog = globals.databus.serverLog.slice(-100);
}
}
}
/**
* Write data to all buffers
* @param {string} data
* @param {string} markType
*/
write(data, markType = false) {
//NOTE: not sure how this would throw any errors, but anyways...
data = data.toString();
try {
globals.webServer.webSocket.buffer('liveconsole', data, markType);
//NOTE: There used to be a rule "\x0B-\x1F" that was replaced with "x0B-\x1A\x1C-\x1F" to allow the \x1B terminal escape character.
//This is neccessary for the terminal to have color, but beware of side effects.
//This regex was done in the first place to prevent fxserver output to be interpreted as txAdmin output by the host terminal
//IIRC the issue was that one user with a TM on their nick was making txAdmin's console to close or freeze. I couldn't reproduce the issue.
if (!globals.fxRunner.config.quiet) process.stdout.write(data.replace(/[\x00-\x08\x0B-\x1A\x1C-\x1F\x7F-\x9F\x80-\x9F\u2122]/g, ''));
} catch (error) {
if (GlobalData.verbose) logError(`Buffer write error: ${error.message}`);
}
//Adding data to the buffers
if (this.enableCmdBuffer) this.cmdBuffer += data;
this.fileBuffer += data;
this.webConsoleBuffer = this.webConsoleBuffer + data;
if (this.webConsoleBuffer.length > this.webConsoleBufferSize) {
this.webConsoleBuffer = this.webConsoleBuffer.slice(-0.5 * this.webConsoleBufferSize);
this.webConsoleBuffer = this.webConsoleBuffer.substr(this.webConsoleBuffer.indexOf('\n'));
}
}
/**
* Print fxChild's stderr to the webconsole and to the terminal
* @param {string} data
*/
writeError(data) {
//FIXME: this should be saving to a file, and should be persistent to the web console
data = data.toString();
try {
globals.webServer.webSocket.buffer('liveconsole', data, 'error');
if (!globals.fxRunner.config.quiet) process.stdout.write(chalk.red(data.replace(/[\x00-\x08\x0B-\x1F\x7F-\x9F\x80-\x9F\u2122]/g, '')));
} catch (error) {
if (GlobalData.verbose) logError(`Buffer write error: ${error.message}`);
}
}
/**
* Save the log file and clear buffer
*/
writeHeader() {
let sep = '='.repeat(64);
let timestamp = new Date().toLocaleString();
let header = `\r\n${sep}\r\n======== FXServer starting - ${timestamp}\r\n${sep}\r\n`;
this.write(header, 'info');
}
/**
* Save the log file and clear buffer
*/
saveLog() {
if (!this.fileBuffer.length) return;
let cleanBuff = this.fileBuffer.replace(/\u001b\[\d+(;\d)?m/g, '');
fs.appendFile(this.logPath, cleanBuff, {encoding: 'utf8'}, (error) => {
if (error) {
if (GlobalData.verbose) logError(`File Write Buffer error: ${error.message}`);
} else {
this.fileBuffer = '';
}
});
fs.stat(this.logPath, (error, stats) => {
if (error) {
if (GlobalData.verbose) logError(`Log File get stats error: ${error.message}`);
} else {
this.logFileSize = bytes(stats.size);
}
});
}
}; //Fim OutputHandler()
| 40.44186 | 151 | 0.584934 |
c8d3520232b4aac7c6ad8cd4250d48164d77cec0 | 51 | js | JavaScript | themes/gatsby-theme-ripperoni-account/src/components/OrderLineItems/index.js | packdigital/ripperoni | 1b8bc3a28ebe980e1c8134cae6236b1517c6b225 | [
"MIT"
] | null | null | null | themes/gatsby-theme-ripperoni-account/src/components/OrderLineItems/index.js | packdigital/ripperoni | 1b8bc3a28ebe980e1c8134cae6236b1517c6b225 | [
"MIT"
] | null | null | null | themes/gatsby-theme-ripperoni-account/src/components/OrderLineItems/index.js | packdigital/ripperoni | 1b8bc3a28ebe980e1c8134cae6236b1517c6b225 | [
"MIT"
] | null | null | null | export { OrderLineItems } from './OrderLineItems';
| 25.5 | 50 | 0.745098 |
c8d49ad1667c4b8189ccc4f52a0f82b737e90718 | 3,291 | js | JavaScript | lib/emoji-mart/assets/src/Emoji_1f955.js | SphereSoftware/RebelChat | 0faba327d1074773a3d7844139a06b3933153497 | [
"MIT"
] | 17 | 2017-01-07T15:50:20.000Z | 2019-08-29T19:12:31.000Z | lib/emoji-mart/assets/src/Emoji_1f955.js | SphereSoftware/RebelChat | 0faba327d1074773a3d7844139a06b3933153497 | [
"MIT"
] | 4 | 2017-01-09T10:27:14.000Z | 2020-05-29T13:11:00.000Z | lib/emoji-mart/assets/src/Emoji_1f955.js | SphereSoftware/RebelChat | 0faba327d1074773a3d7844139a06b3933153497 | [
"MIT"
] | 2 | 2017-01-07T15:41:54.000Z | 2020-06-23T23:13:14.000Z | 'use babel';
import React from 'react'
import IconBase from './IconBase'
export default function Emoji_1f955(props) {
return (
<IconBase viewBox="0 0 64 64" {...props}>
<g><path fill="#E88F27" d="M40.117 30.085c-1.362-.803-6.11-5.551-6.913-6.913-1.842-3.13-4.94 1.307-5.677 2.571-.734 1.267-2.059 3.237-3.225 4.087-1.168.851-3.357 2.549-4.102 4.794-.746 2.247-3.518 4.37-4.252 5.497-.735 1.126-1.915 3.234-3.815 4.791-1.896 1.559-3.288 3.457-3.667 5.07-.378 1.612-2.553 2.053-2.932 3.667-.377 1.61-1.789 4.365-2.595 5.281-2.131 2.428-.299 4.261 2.128 2.129.917-.806 4.48-5.121 6.093-5.501 1.613-.38 4.232-2.492 5.791-4.389 1.557-1.9 5.64-4.121 7.244-5.806 2.521-2.646 6.241-3.037 9.264-6.378 2.783-3.075 12.068-5.714 6.658-8.9z"/><g fill="#FFCE31"><path d="M9.279 53.327c1.128.341-1.442-1.834-2.006-.611-.563 1.223-1.31 1.804-1.673 3.008-.362 1.205-2.014 2.848-2.496 4.001-.481 1.151-.274 2.044.822.131 1.095-1.914 1.517-2.641 2.613-3.688 1.097-1.047.739-3.449 2.74-2.841zM11.027 51.795c.495-.495-1.104-.746-.579-1.491.673-.956 1.987-1.671 3.417-4.598.043.028 1.945 1.509 2.395.907.588-.791-1.795-2.415-2.374-2.248-1.101.317-1.504 2.663-4.368 5.495-1.038 1.026.757 2.688 1.509 1.935zM27.951 32.953c.649-.741-1.669-2.661-2.269-2.555-1.139.203-1.701 2.552-4.798 5.13-1.122.933.597 2.827 1.411 2.142.536-.451-1.074-.884-.493-1.587.747-.902 2.129-1.486 3.772-4.316.043.032 1.882 1.752 2.377 1.186zM20.408 39.585c-.237.475-.982-.645-1.416-.093-.555.707-.697 1.83-2.609 3.53.037.026 1.891 1.095 1.547 1.559-.447.605-2.58-.782-2.639-1.244-.111-.879 1.672-1.696 3.024-4.431.49-.989 2.456-.04 2.093.679zM31.513 24.417c-.925-.045-1.475 1.853-4.071 3.458-.941.582.363 2.525 1.047 2.096.449-.281-.828-.958-.332-1.445.638-.627 1.775-.862 3.214-2.964.032.036 1.442 1.854 1.864 1.466.552-.509-1.234-2.59-1.722-2.611z"/></g><path fill="#699635" d="M62 14.023c-13.055.943-6.16-8.104-6.16-8.104s-5.136 2.664-6.424 1.621L49.623 2s-4.152 3.085-5.732 3.021l-5.084-1.753s.611 2.873.258 4.685l-3.823.177c9.46 7.87.295 5.482.295 5.482 8.17 5.681 1.976 11.734-.294 13.714-.86.751 1.256 2.676 1.703 2.063 2.083-2.854 8.197-11.474 13.621-1.571 0 0-.398-7.796 5.43-1.749-2.514-7.534 5.133-5.133 5.133-5.133l-3.67-2.657c-.001-.002.886-2.458 4.54-4.256z"/><path fill="#83BF4F" d="M61.129 20.935s-.367-3.728-3.756-4.936C55.896 15.473 62 14.023 62 14.023c-3.189-2.127-7.31-.599-6.013-2.593 1.975-3.035-.147-5.512-.147-5.512s-5.154 4.093-5.01 1.945C51.084 4.104 49.623 2 49.623 2s-3.367 4.502-4.32 3.352c-2.017-2.438-6.496-2.084-6.496-2.084s4.186 4.665 1.146 4.512c-2.414-.121-4.712.35-4.712.35s7.072 4.932 4.917 4.651c-2.206-.288-4.622.831-4.622.831s6.207 1.916 4.301 8.182c-.478 1.566-2.395 4.173-4.771 6.189.441 1.281 1.252 1.424 1.252 1.424s3.73-4.504 5.053-5.476c6.613-4.856 9.195 3.886 9.195 3.886s1.723-1.989 1.855-5.334c.118-2.972 3.574 3.585 3.574 3.585s1.288-2.907.257-5.412c-1.113-2.706 4.877.279 4.877.279z"/><path fill="#699635" d="M48.437 5.455c-.044 6.809-3.773 12.791-3.773 12.791 6.69-6.337 3.773-12.791 3.773-12.791zM41.174 8.946c1.731 5.97.024 12.176.024 12.176 4.208-7.287-.024-12.176-.024-12.176zM56.99 18.077c-8.945-1.062-17.168 5.901-17.168 5.901 9.233-10.477 17.168-5.901 17.168-5.901zM47.188 16.801s5.06-3.008 10.02-2.704c-.001 0-4.351-2.916-10.02 2.704z"/></g>
</IconBase>
);
}
| 253.153846 | 3,090 | 0.669401 |
c8d4b812f2ae94d9f04400fc360b1a1a1eff53c7 | 888 | js | JavaScript | website-prototyping-tools/evalSchema.js | OpenGov/relay | e9a6b7c8e94484e928a361a9be6094ce4f91ec1c | [
"BSD-3-Clause"
] | 4 | 2016-05-15T12:06:18.000Z | 2021-09-13T12:38:40.000Z | website-prototyping-tools/evalSchema.js | OpenGov/relay | e9a6b7c8e94484e928a361a9be6094ce4f91ec1c | [
"BSD-3-Clause"
] | null | null | null | website-prototyping-tools/evalSchema.js | OpenGov/relay | e9a6b7c8e94484e928a361a9be6094ce4f91ec1c | [
"BSD-3-Clause"
] | 4 | 2017-05-10T14:41:29.000Z | 2022-01-18T02:03:12.000Z | /**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
/* eslint-disable no-unused-vars, no-eval */
import babel from 'babel-core/browser';
var GraphQL = require('graphql');
var GraphQLRelay = require('graphql-relay');
export default function(source) {
// Make these modules available to the schema author through a require shim.
function require(path) {
switch (path) {
case 'graphql': return GraphQL;
case 'graphql-relay': return GraphQLRelay;
default: throw new Error(`Cannot find module "${path}"`);
}
}
var {code} = babel.transform(source, {code: true, ast: false});
return eval(code);
}
| 29.6 | 78 | 0.695946 |
c8d58b450bfbc85b7666b9a38285141ee4ce6c60 | 2,265 | js | JavaScript | web/weather.js | fredsmit/ets | 8da59e448164b16a7d4168c6c50e9fb329e6bfdf | [
"CC0-1.0"
] | null | null | null | web/weather.js | fredsmit/ets | 8da59e448164b16a7d4168c6c50e9fb329e6bfdf | [
"CC0-1.0"
] | 7 | 2022-02-21T19:48:34.000Z | 2022-03-29T13:33:11.000Z | web/weather.js | fredsmit/ets | 8da59e448164b16a7d4168c6c50e9fb329e6bfdf | [
"CC0-1.0"
] | null | null | null | const electronWindow = window;
const electronApi = electronWindow.electronApi;
import { queryRequiredElement } from "./pageUtils.js";
const select = queryRequiredElement("select", "weather");
const selectTheme = queryRequiredElement("select", "theme");
const para = queryRequiredElement("p", "weatherDescription");
const themes = {
"white": { color: "black", backgroundColor: "white" },
"black": { color: "white", backgroundColor: "black" }
};
const currentTheme = { color: "black", backgroundColor: "white" };
updateColors();
selectTheme.addEventListener("change", function (ev) {
const selectedSchene = this.value === "white"
? themes.white
: themes.black;
// assign<T, U>(target: T, source: U): T & U;
const o1 = Object.assign(currentTheme, selectedSchene);
const o2 = { ...currentTheme, ...selectedSchene };
console.log("o1:", o1);
console.log("o2:", o2);
updateColors();
});
select.addEventListener('change', setWeather);
function setWeather() {
const choice = select.value;
const weather = electronApi.getWeather();
const [, description] = weather.find(([weatherType, weatherDescription]) => weatherType === choice) ?? [choice, void 0];
if (description) {
para.textContent = description;
}
else {
para.textContent = "";
}
// if (choice === 'sunny') {
// para.textContent = 'It is nice and sunny outside today. Wear shorts! Go to the beach, or the park, and get an ice cream.';
// } else if (choice === 'rainy') {
// para.textContent = 'Rain is falling outside; take a rain coat and an umbrella, and don\'t stay out for too long.';
// } else if (choice === 'snowing') {
// para.textContent = 'The snow is coming down — it is freezing! Best to stay in with a cup of hot chocolate, or go build a snowman.';
// } else if (choice === 'overcast') {
// para.textContent = 'It isn\'t raining, but the sky is grey and gloomy; it could turn any minute, so take a rain coat just in case.';
// } else {
// para.textContent = '';
// }
}
function updateColors() {
const bodyStyle = document.body.style;
bodyStyle.backgroundColor = currentTheme.backgroundColor;
bodyStyle.color = currentTheme.color;
}
| 43.557692 | 143 | 0.648565 |
c8d595a6a4dee39a0f4f84046f5647d8247c1c9b | 457 | js | JavaScript | lib/gcph.js | JamesMGreene/node-gcph-client | 519496819f2e699f67ad9c4f1c45a847f7c10a02 | [
"MIT"
] | 1 | 2022-02-05T16:43:52.000Z | 2022-02-05T16:43:52.000Z | lib/gcph.js | JamesMGreene/node-gcph-client | 519496819f2e699f67ad9c4f1c45a847f7c10a02 | [
"MIT"
] | null | null | null | lib/gcph.js | JamesMGreene/node-gcph-client | 519496819f2e699f67ad9c4f1c45a847f7c10a02 | [
"MIT"
] | null | null | null | /*
* gcph-client
* https://github.com/JamesMGreene/node-gcph-client
*
* Copyright (c) 2012 James M. Greene
* Licensed under the MIT license.
*/
'use strict';
var Api = {
Client: require('./client'),
Query: require('./query'),
Issue: require('./issue'),
Comment: require('./comment')
};
// Define some read-only properties
Object.defineProperty(Api, 'version', {
value: require('../package.json').version
});
// Export!
module.exports = Api;
| 17.576923 | 51 | 0.658643 |
c8d5f868d714dd04d0d3de86ff71e77d1cf1a48d | 2,476 | js | JavaScript | Gruntfile.js | 7022Andre/bloc-jams-angular | e812997987766c46fc3bc67e79b6daae8ad8175d | [
"Apache-2.0"
] | null | null | null | Gruntfile.js | 7022Andre/bloc-jams-angular | e812997987766c46fc3bc67e79b6daae8ad8175d | [
"Apache-2.0"
] | null | null | null | Gruntfile.js | 7022Andre/bloc-jams-angular | e812997987766c46fc3bc67e79b6daae8ad8175d | [
"Apache-2.0"
] | null | null | null | module.exports = function(grunt) {
grunt.registerTask( 'default', [ 'clean', 'copy', 'hapi', 'watch'] );
grunt.registerTask( 'build', [ 'clean', 'copy' ] );
grunt.registerTask( 'run', [ 'hapi', 'watch' ]);
grunt.registerTask('eslint', ['eslint']);
grunt.initConfig({
watch: {
hapi: {
files: [
'./app/assets/**/*.{png,jpg,jpeg,mp3}',
'./app/scripts/**/*.js',
'./app/styles/**/*.css',
'./app/pages/**/*.html',
'./app/templates/**/*.html',
'Gruntfile.js'
],
tasks: [
'clean',
'copy'
],
options: {
spawn: false
}
}
},
copy: {
dist: {
files: [{
expand: true,
src: [ './assets/**/*.{png,jpg,jpeg,mp3}' ],
dest: './dist',
cwd: './app'
}, {
expand: true,
src: [ './**/*.html' ],
dest: './dist',
cwd: './app/pages'
}, {
expand: true,
src: [ './**/*.css' ],
dest: './dist/styles',
cwd: './app/styles'
}, {
expand: true,
src: [ './**/*.js' ],
dest: './dist/scripts',
cwd: './app/scripts'
}, {
expand: true,
src: [ './**/*.html' ],
dest: './dist/templates',
cwd: './app/templates'
}]
}
},
hapi: {
custom_options: {
options: {
server: require('path').resolve('./server'),
bases: {
'/dist': require('path').resolve('./dist/')
}
}
}
},
eslint: {
target: ['./app/*']
},
clean: ['./dist']
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-hapi');
grunt.loadNpmTasks('grunt-eslint');
};
| 28.136364 | 73 | 0.321486 |
c8d6367afd5b3214cc0fd34cee6751f9fb1b4c8c | 151,762 | js | JavaScript | node_modules/@nuxt/webpack/dist/webpack.js | AlexanderChow9333/SilverConnect | 22c98a34a712372a72a69828d319a9375f5af423 | [
"MIT"
] | null | null | null | node_modules/@nuxt/webpack/dist/webpack.js | AlexanderChow9333/SilverConnect | 22c98a34a712372a72a69828d319a9375f5af423 | [
"MIT"
] | null | null | null | node_modules/@nuxt/webpack/dist/webpack.js | AlexanderChow9333/SilverConnect | 22c98a34a712372a72a69828d319a9375f5af423 | [
"MIT"
] | null | null | null | /*!
* @nuxt/webpack v2.14.7 (c) 2016-2020
* - All the amazing contributors
* Released under the MIT License.
* Website: https://nuxtjs.org
*/
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const path = require('path');
const pify = require('pify');
const webpack = require('webpack');
const Glob = require('glob');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const consola = require('consola');
const utils = require('@nuxt/utils');
const MFS = require('memory-fs');
const querystring = require('querystring');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const BundleAnalyzer = require('webpack-bundle-analyzer');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('@nuxt/friendly-errors-webpack-plugin');
const EventEmitter = require('events');
const hash = require('hash-sum');
const TimeFixPlugin = require('time-fix-plugin');
const VueLoader = require('vue-loader');
const ExtractCssChunksPlugin = require('extract-css-chunks-webpack-plugin');
const HardSourcePlugin = require('hard-source-webpack-plugin');
const TerserWebpackPlugin = require('terser-webpack-plugin');
const WebpackBar = require('webpackbar');
const env = require('std-env');
const semver = require('semver');
const createRequire = require('create-require');
const threadLoader = require('thread-loader');
const fs = require('fs');
const createResolver = require('postcss-import-resolver');
const nodeExternals = require('webpack-node-externals');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
const path__default = /*#__PURE__*/_interopDefaultLegacy(path);
const pify__default = /*#__PURE__*/_interopDefaultLegacy(pify);
const webpack__default = /*#__PURE__*/_interopDefaultLegacy(webpack);
const Glob__default = /*#__PURE__*/_interopDefaultLegacy(Glob);
const webpackDevMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(webpackDevMiddleware);
const webpackHotMiddleware__default = /*#__PURE__*/_interopDefaultLegacy(webpackHotMiddleware);
const consola__default = /*#__PURE__*/_interopDefaultLegacy(consola);
const MFS__default = /*#__PURE__*/_interopDefaultLegacy(MFS);
const querystring__default = /*#__PURE__*/_interopDefaultLegacy(querystring);
const HtmlWebpackPlugin__default = /*#__PURE__*/_interopDefaultLegacy(HtmlWebpackPlugin);
const BundleAnalyzer__default = /*#__PURE__*/_interopDefaultLegacy(BundleAnalyzer);
const OptimizeCSSAssetsPlugin__default = /*#__PURE__*/_interopDefaultLegacy(OptimizeCSSAssetsPlugin);
const FriendlyErrorsWebpackPlugin__default = /*#__PURE__*/_interopDefaultLegacy(FriendlyErrorsWebpackPlugin);
const EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
const hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
const TimeFixPlugin__default = /*#__PURE__*/_interopDefaultLegacy(TimeFixPlugin);
const VueLoader__default = /*#__PURE__*/_interopDefaultLegacy(VueLoader);
const ExtractCssChunksPlugin__default = /*#__PURE__*/_interopDefaultLegacy(ExtractCssChunksPlugin);
const HardSourcePlugin__default = /*#__PURE__*/_interopDefaultLegacy(HardSourcePlugin);
const TerserWebpackPlugin__default = /*#__PURE__*/_interopDefaultLegacy(TerserWebpackPlugin);
const WebpackBar__default = /*#__PURE__*/_interopDefaultLegacy(WebpackBar);
const env__default = /*#__PURE__*/_interopDefaultLegacy(env);
const semver__default = /*#__PURE__*/_interopDefaultLegacy(semver);
const createRequire__default = /*#__PURE__*/_interopDefaultLegacy(createRequire);
const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
const createResolver__default = /*#__PURE__*/_interopDefaultLegacy(createResolver);
const nodeExternals__default = /*#__PURE__*/_interopDefaultLegacy(nodeExternals);
class AsyncMFS extends MFS__default['default'] {}
const syncRegex = /Sync$/;
const propsToPromisify = Object.getOwnPropertyNames(MFS__default['default'].prototype).filter(n => syncRegex.test(n));
for (const prop of propsToPromisify) {
const asyncProp = prop.replace(syncRegex, '');
const origAsync = AsyncMFS.prototype[asyncProp];
AsyncMFS.prototype[asyncProp] = function (...args) {
// Callback support for webpack
if (origAsync && args.length && typeof args[args.length - 1] === 'function') {
return origAsync.call(this, ...args)
}
try {
return Promise.resolve(MFS__default['default'].prototype[prop].call(this, ...args))
} catch (error) {
return Promise.reject(error)
}
};
}
class CorsPlugin {
constructor ({ crossorigin }) {
this.crossorigin = crossorigin;
}
apply (compiler) {
const ID = 'vue-cors-plugin';
compiler.hooks.compilation.tap(ID, (compilation) => {
HtmlWebpackPlugin__default['default'].getHooks(compilation).alterAssetTagGroups.tap(ID, (data) => {
if (!this.crossorigin) {
return
}
[...data.headTags, ...data.bodyTags].forEach((tag) => {
if (['script', 'link'].includes(tag.tagName)) {
if (tag.attributes) {
tag.attributes.crossorigin = this.crossorigin;
}
}
});
});
});
}
}
/*
* This file is based on @vue/cli-service (MIT) ModernModePlugin
* https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/webpack/ModernModePlugin.js
*/
const legacyTemplateTags = {};
const legacyTemplateWatcher = new EventEmitter__default['default']();
class ModernModePlugin {
constructor ({ targetDir, isModernBuild, noUnsafeInline }) {
this.targetDir = targetDir;
this.isModernBuild = isModernBuild;
this.noUnsafeInline = noUnsafeInline;
}
apply (compiler) {
if (!this.isModernBuild) {
this.applyLegacy(compiler);
} else {
this.applyModern(compiler);
}
}
getLegacyTemplateTags (name) {
return new Promise((resolve) => {
const tags = legacyTemplateTags[name];
if (tags) {
return resolve(tags)
}
return legacyTemplateWatcher.once(name, () => {
const tags = legacyTemplateTags[name];
return tags && resolve(tags)
})
})
}
applyLegacy (compiler) {
const ID = 'nuxt-legacy-bundle';
compiler.hooks.compilation.tap(ID, (compilation) => {
HtmlWebpackPlugin__default['default'].getHooks(compilation).alterAssetTagGroups.tap(ID, (data) => {
HtmlWebpackPlugin__default['default'].getHooks(compilation).afterEmit.tap(ID, ({ outputName }) => {
// get stats, write to disk
legacyTemplateTags[data.plugin.options.filename] = data.bodyTags;
legacyTemplateWatcher.emit(outputName);
});
return data
});
});
}
applyModern (compiler) {
const ID = 'nuxt-modern-bundle';
compiler.hooks.compilation.tap(ID, (compilation) => {
HtmlWebpackPlugin__default['default'].getHooks(compilation).alterAssetTagGroups.tapPromise(ID, async (data) => {
// use <script type="module"> for modern assets
data.bodyTags.forEach((tag) => {
if (tag.tagName === 'script' && tag.attributes) {
tag.attributes.type = 'module';
}
});
// use <link rel="modulepreload"> instead of <link rel="preload">
// for modern assets
data.headTags.forEach((tag) => {
if (tag.tagName === 'link' &&
tag.attributes.rel === 'preload' &&
tag.attributes.as === 'script') {
tag.attributes.rel = 'modulepreload';
}
});
// inject links for legacy assets as <script nomodule>
const fileName = data.plugin.options.filename;
const legacyScriptTags = (await this.getLegacyTemplateTags(fileName))
.filter(a => a.tagName === 'script' && a.attributes);
for (const a of legacyScriptTags) {
a.attributes.nomodule = true;
data.bodyTags.push(a);
}
if (this.noUnsafeInline) {
// inject the fix as an external script
const safariFixFilename = 'safari-nomodule-fix.js';
const safariFixPath = legacyScriptTags[0].attributes.src
.split('/')
.slice(0, -1)
.concat([safariFixFilename])
.join('/');
compilation.assets[safariFixFilename] = {
source: () => Buffer.from(utils.safariNoModuleFix),
size: () => Buffer.byteLength(utils.safariNoModuleFix)
};
data.bodyTags.push({
tagName: 'script',
closeTag: true,
attributes: {
src: safariFixPath
}
});
} else {
// inject Safari 10 nomodule fix
data.bodyTags.push({
tagName: 'script',
closeTag: true,
innerHTML: utils.safariNoModuleFix
});
}
delete legacyTemplateTags[fileName];
return data
});
});
}
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = _freeGlobal || freeSelf || Function('return this')();
var _root = root;
/** Built-in value references. */
var Symbol = _root.Symbol;
var _Symbol = Symbol;
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
var _getRawTag = getRawTag;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$1.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
var _objectToString = objectToString;
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag$1 && symToStringTag$1 in Object(value))
? _getRawTag(value)
: _objectToString(value);
}
var _baseGetTag = baseGetTag;
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
var isObject_1 = isObject;
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject_1(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = _baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_1 = isFunction;
/** Used to detect overreaching core-js shims. */
var coreJsData = _root['__core-js_shared__'];
var _coreJsData = coreJsData;
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
var _isMasked = isMasked;
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
var _toSource = toSource;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto$1 = Function.prototype,
objectProto$2 = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$1 = funcProto$1.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject_1(value) || _isMasked(value)) {
return false;
}
var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
return pattern.test(_toSource(value));
}
var _baseIsNative = baseIsNative;
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
var _getValue = getValue;
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = _getValue(object, key);
return _baseIsNative(value) ? value : undefined;
}
var _getNative = getNative;
/* Built-in method references that are verified to be native. */
var nativeCreate = _getNative(Object, 'create');
var _nativeCreate = nativeCreate;
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
this.size = 0;
}
var _hashClear = hashClear;
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
var _hashDelete = hashDelete;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto$3 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (_nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
}
var _hashGet = hashGet;
/** Used for built-in method references. */
var objectProto$4 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
}
var _hashHas = hashHas;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
return this;
}
var _hashSet = hashSet;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = _hashClear;
Hash.prototype['delete'] = _hashDelete;
Hash.prototype.get = _hashGet;
Hash.prototype.has = _hashHas;
Hash.prototype.set = _hashSet;
var _Hash = Hash;
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
var _listCacheClear = listCacheClear;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
var eq_1 = eq;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq_1(array[length][0], key)) {
return length;
}
}
return -1;
}
var _assocIndexOf = assocIndexOf;
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
var _listCacheDelete = listCacheDelete;
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = _assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
var _listCacheGet = listCacheGet;
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return _assocIndexOf(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas;
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = _assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
var _listCacheSet = listCacheSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = _listCacheClear;
ListCache.prototype['delete'] = _listCacheDelete;
ListCache.prototype.get = _listCacheGet;
ListCache.prototype.has = _listCacheHas;
ListCache.prototype.set = _listCacheSet;
var _ListCache = ListCache;
/* Built-in method references that are verified to be native. */
var Map = _getNative(_root, 'Map');
var _Map = Map;
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new _Hash,
'map': new (_Map || _ListCache),
'string': new _Hash
};
}
var _mapCacheClear = mapCacheClear;
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
var _isKeyable = isKeyable;
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return _isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
var _getMapData = getMapData;
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = _getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
var _mapCacheDelete = mapCacheDelete;
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return _getMapData(this, key).get(key);
}
var _mapCacheGet = mapCacheGet;
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return _getMapData(this, key).has(key);
}
var _mapCacheHas = mapCacheHas;
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = _getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
var _mapCacheSet = mapCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = _mapCacheClear;
MapCache.prototype['delete'] = _mapCacheDelete;
MapCache.prototype.get = _mapCacheGet;
MapCache.prototype.has = _mapCacheHas;
MapCache.prototype.set = _mapCacheSet;
var _MapCache = MapCache;
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED$2);
return this;
}
var _setCacheAdd = setCacheAdd;
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
var _setCacheHas = setCacheHas;
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new _MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
SetCache.prototype.has = _setCacheHas;
var _SetCache = SetCache;
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
var _baseFindIndex = baseFindIndex;
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
var _baseIsNaN = baseIsNaN;
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
var _strictIndexOf = strictIndexOf;
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? _strictIndexOf(array, value, fromIndex)
: _baseFindIndex(array, _baseIsNaN, fromIndex);
}
var _baseIndexOf = baseIndexOf;
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && _baseIndexOf(array, value, 0) > -1;
}
var _arrayIncludes = arrayIncludes;
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
var _arrayIncludesWith = arrayIncludesWith;
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
var _cacheHas = cacheHas;
/* Built-in method references that are verified to be native. */
var Set$1 = _getNative(_root, 'Set');
var _Set = Set$1;
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
var noop_1 = noop;
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
var _setToArray = setToArray;
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(_Set && (1 / _setToArray(new _Set([,-0]))[1]) == INFINITY) ? noop_1 : function(values) {
return new _Set(values);
};
var _createSet = createSet;
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = _arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = _arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : _createSet(array);
if (set) {
return _setToArray(set);
}
isCommon = false;
includes = _cacheHas;
seen = new _SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
var _baseUniq = baseUniq;
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? _baseUniq(array) : [];
}
var uniq_1 = uniq;
/**
* This file is based on Vue.js (MIT) webpack plugins
* https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/util.js
*/
const validate = (compiler) => {
if (compiler.options.target !== 'node') {
consola__default['default'].warn('webpack config `target` should be "node".');
}
if (compiler.options.output && compiler.options.output.libraryTarget !== 'commonjs2') {
consola__default['default'].warn('webpack config `output.libraryTarget` should be "commonjs2".');
}
if (!compiler.options.externals) {
consola__default['default'].info(
'It is recommended to externalize dependencies in the server build for ' +
'better build performance.'
);
}
};
const isJSRegExp = /\.js(\?[^.]+)?$/;
const isJS = file => isJSRegExp.test(file);
const extractQueryPartJS = file => isJSRegExp.exec(file)[1];
const isCSS = file => /\.css(\?[^.]+)?$/.test(file);
/**
* This file is based on Vue.js (MIT) webpack plugins
* https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/client.js
*/
class VueSSRClientPlugin {
constructor (options = {}) {
this.options = Object.assign({
filename: null
}, options);
}
apply (compiler) {
compiler.hooks.emit.tapAsync('vue-client-plugin', (compilation, cb) => {
const stats = compilation.getStats().toJson();
const allFiles = uniq_1(stats.assets
.map(a => a.name));
const initialFiles = uniq_1(Object.keys(stats.entrypoints)
.map(name => stats.entrypoints[name].assets)
.reduce((assets, all) => all.concat(assets), [])
.filter(file => isJS(file) || isCSS(file)));
const asyncFiles = allFiles
.filter(file => isJS(file) || isCSS(file))
.filter(file => !initialFiles.includes(file));
const assetsMapping = {};
stats.assets
.filter(({ name }) => isJS(name))
.forEach(({ name, chunkNames }) => {
const componentHash = hash__default['default'](chunkNames.join('|'));
if (!assetsMapping[componentHash]) {
assetsMapping[componentHash] = [];
}
assetsMapping[componentHash].push(name);
});
const manifest = {
publicPath: stats.publicPath,
all: allFiles,
initial: initialFiles,
async: asyncFiles,
modules: { /* [identifier: string]: Array<index: number> */ },
assetsMapping
};
const { entrypoints, namedChunkGroups } = stats;
const assetModules = stats.modules.filter(m => m.assets.length);
const fileToIndex = file => manifest.all.indexOf(file);
stats.modules.forEach((m) => {
// Ignore modules duplicated in multiple chunks
if (m.chunks.length === 1) {
const [cid] = m.chunks;
const chunk = stats.chunks.find(c => c.id === cid);
if (!chunk || !chunk.files) {
return
}
const id = m.identifier.replace(/\s\w+$/, ''); // remove appended hash
const filesSet = new Set(chunk.files.map(fileToIndex));
for (const chunkName of chunk.names) {
if (!entrypoints[chunkName]) {
const chunkGroup = namedChunkGroups[chunkName];
if (chunkGroup) {
for (const asset of chunkGroup.assets) {
filesSet.add(fileToIndex(asset));
}
}
}
}
const files = Array.from(filesSet);
manifest.modules[hash__default['default'](id)] = files;
// In production mode, modules may be concatenated by scope hoisting
// Include ConcatenatedModule for not losing module-component mapping
if (Array.isArray(m.modules)) {
for (const concatenatedModule of m.modules) {
const id = hash__default['default'](concatenatedModule.identifier.replace(/\s\w+$/, ''));
if (!manifest.modules[id]) {
manifest.modules[id] = files;
}
}
}
// Find all asset modules associated with the same chunk
assetModules.forEach((m) => {
if (m.chunks.some(id => id === cid)) {
files.push.apply(files, m.assets.map(fileToIndex));
}
});
}
});
const src = JSON.stringify(manifest, null, 2);
compilation.assets[this.options.filename] = {
source: () => src,
size: () => src.length
};
cb();
});
}
}
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new _ListCache;
this.size = 0;
}
var _stackClear = stackClear;
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
var _stackDelete = stackDelete;
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
var _stackGet = stackGet;
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
var _stackHas = stackHas;
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE$1 = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof _ListCache) {
var pairs = data.__data__;
if (!_Map || (pairs.length < LARGE_ARRAY_SIZE$1 - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new _MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
var _stackSet = stackSet;
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new _ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = _stackClear;
Stack.prototype['delete'] = _stackDelete;
Stack.prototype.get = _stackGet;
Stack.prototype.has = _stackHas;
Stack.prototype.set = _stackSet;
var _Stack = Stack;
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
var _arrayEach = arrayEach;
var defineProperty = (function() {
try {
var func = _getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
var _defineProperty = defineProperty;
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && _defineProperty) {
_defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
var _baseAssignValue = baseAssignValue;
/** Used for built-in method references. */
var objectProto$5 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty$4.call(object, key) && eq_1(objValue, value)) ||
(value === undefined && !(key in object))) {
_baseAssignValue(object, key, value);
}
}
var _assignValue = assignValue;
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
_baseAssignValue(object, key, newValue);
} else {
_assignValue(object, key, newValue);
}
}
return object;
}
var _copyObject = copyObject;
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
var _baseTimes = baseTimes;
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
var isObjectLike_1 = isObjectLike;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
}
var _baseIsArguments = baseIsArguments;
/** Used for built-in method references. */
var objectProto$6 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
return isObjectLike_1(value) && hasOwnProperty$5.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
var isArguments_1 = isArguments;
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
var isArray_1 = isArray;
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
var stubFalse_1 = stubFalse;
var isBuffer_1 = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? _root.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse_1;
module.exports = isBuffer;
});
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}
var _isIndex = isIndex;
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER$1 = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$1;
}
var isLength_1 = isLength;
/** `Object#toString` result references. */
var argsTag$1 = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag$1 = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike_1(value) &&
isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
}
var _baseIsTypedArray = baseIsTypedArray;
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
var _baseUnary = baseUnary;
var _nodeUtil = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && _freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
module.exports = nodeUtil;
});
/* Node.js helper references. */
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
var isTypedArray_1 = isTypedArray;
/** Used for built-in method references. */
var objectProto$7 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray_1(value),
isArg = !isArr && isArguments_1(value),
isBuff = !isArr && !isArg && isBuffer_1(value),
isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? _baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty$6.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
_isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
var _arrayLikeKeys = arrayLikeKeys;
/** Used for built-in method references. */
var objectProto$8 = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
return value === proto;
}
var _isPrototype = isPrototype;
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
var _overArg = overArg;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = _overArg(Object.keys, Object);
var _nativeKeys = nativeKeys;
/** Used for built-in method references. */
var objectProto$9 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!_isPrototype(object)) {
return _nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
var _baseKeys = baseKeys;
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength_1(value.length) && !isFunction_1(value);
}
var isArrayLike_1 = isArrayLike;
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
}
var keys_1 = keys;
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && _copyObject(source, keys_1(source), object);
}
var _baseAssign = baseAssign;
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
var _nativeKeysIn = nativeKeysIn;
/** Used for built-in method references. */
var objectProto$a = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject_1(object)) {
return _nativeKeysIn(object);
}
var isProto = _isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty$8.call(object, key)))) {
result.push(key);
}
}
return result;
}
var _baseKeysIn = baseKeysIn;
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
}
var keysIn_1 = keysIn;
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && _copyObject(source, keysIn_1(source), object);
}
var _baseAssignIn = baseAssignIn;
var _cloneBuffer = createCommonjsModule(function (module, exports) {
/** Detect free variable `exports`. */
var freeExports = exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? _root.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
module.exports = cloneBuffer;
});
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
var _copyArray = copyArray;
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
var _arrayFilter = arrayFilter;
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
var stubArray_1 = stubArray;
/** Used for built-in method references. */
var objectProto$b = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable$1 = objectProto$b.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return _arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable$1.call(object, symbol);
});
};
var _getSymbols = getSymbols;
/**
* Copies own symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return _copyObject(source, _getSymbols(source), object);
}
var _copySymbols = copySymbols;
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
var _arrayPush = arrayPush;
/** Built-in value references. */
var getPrototype = _overArg(Object.getPrototypeOf, Object);
var _getPrototype = getPrototype;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
/**
* Creates an array of the own and inherited enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !nativeGetSymbols$1 ? stubArray_1 : function(object) {
var result = [];
while (object) {
_arrayPush(result, _getSymbols(object));
object = _getPrototype(object);
}
return result;
};
var _getSymbolsIn = getSymbolsIn;
/**
* Copies own and inherited symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbolsIn(source, object) {
return _copyObject(source, _getSymbolsIn(source), object);
}
var _copySymbolsIn = copySymbolsIn;
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
}
var _baseGetAllKeys = baseGetAllKeys;
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return _baseGetAllKeys(object, keys_1, _getSymbols);
}
var _getAllKeys = getAllKeys;
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return _baseGetAllKeys(object, keysIn_1, _getSymbolsIn);
}
var _getAllKeysIn = getAllKeysIn;
/* Built-in method references that are verified to be native. */
var DataView = _getNative(_root, 'DataView');
var _DataView = DataView;
/* Built-in method references that are verified to be native. */
var Promise$1 = _getNative(_root, 'Promise');
var _Promise = Promise$1;
/* Built-in method references that are verified to be native. */
var WeakMap = _getNative(_root, 'WeakMap');
var _WeakMap = WeakMap;
/** `Object#toString` result references. */
var mapTag$1 = '[object Map]',
objectTag$1 = '[object Object]',
promiseTag = '[object Promise]',
setTag$1 = '[object Set]',
weakMapTag$1 = '[object WeakMap]';
var dataViewTag$1 = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = _toSource(_DataView),
mapCtorString = _toSource(_Map),
promiseCtorString = _toSource(_Promise),
setCtorString = _toSource(_Set),
weakMapCtorString = _toSource(_WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = _baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
(_Map && getTag(new _Map) != mapTag$1) ||
(_Promise && getTag(_Promise.resolve()) != promiseTag) ||
(_Set && getTag(new _Set) != setTag$1) ||
(_WeakMap && getTag(new _WeakMap) != weakMapTag$1)) {
getTag = function(value) {
var result = _baseGetTag(value),
Ctor = result == objectTag$1 ? value.constructor : undefined,
ctorString = Ctor ? _toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag$1;
case mapCtorString: return mapTag$1;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag$1;
case weakMapCtorString: return weakMapTag$1;
}
}
return result;
};
}
var _getTag = getTag;
/** Used for built-in method references. */
var objectProto$c = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$9 = objectProto$c.hasOwnProperty;
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty$9.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
var _initCloneArray = initCloneArray;
/** Built-in value references. */
var Uint8Array = _root.Uint8Array;
var _Uint8Array = Uint8Array;
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
return result;
}
var _cloneArrayBuffer = cloneArrayBuffer;
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? _cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
var _cloneDataView = cloneDataView;
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
var _cloneRegExp = cloneRegExp;
/** Used to convert symbols to primitives and strings. */
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
var _cloneSymbol = cloneSymbol;
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
var _cloneTypedArray = cloneTypedArray;
/** `Object#toString` result references. */
var boolTag$1 = '[object Boolean]',
dateTag$1 = '[object Date]',
mapTag$2 = '[object Map]',
numberTag$1 = '[object Number]',
regexpTag$1 = '[object RegExp]',
setTag$2 = '[object Set]',
stringTag$1 = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag$1 = '[object ArrayBuffer]',
dataViewTag$2 = '[object DataView]',
float32Tag$1 = '[object Float32Array]',
float64Tag$1 = '[object Float64Array]',
int8Tag$1 = '[object Int8Array]',
int16Tag$1 = '[object Int16Array]',
int32Tag$1 = '[object Int32Array]',
uint8Tag$1 = '[object Uint8Array]',
uint8ClampedTag$1 = '[object Uint8ClampedArray]',
uint16Tag$1 = '[object Uint16Array]',
uint32Tag$1 = '[object Uint32Array]';
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag$1:
return _cloneArrayBuffer(object);
case boolTag$1:
case dateTag$1:
return new Ctor(+object);
case dataViewTag$2:
return _cloneDataView(object, isDeep);
case float32Tag$1: case float64Tag$1:
case int8Tag$1: case int16Tag$1: case int32Tag$1:
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
return _cloneTypedArray(object, isDeep);
case mapTag$2:
return new Ctor;
case numberTag$1:
case stringTag$1:
return new Ctor(object);
case regexpTag$1:
return _cloneRegExp(object);
case setTag$2:
return new Ctor;
case symbolTag:
return _cloneSymbol(object);
}
}
var _initCloneByTag = initCloneByTag;
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject_1(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined;
return result;
};
}());
var _baseCreate = baseCreate;
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !_isPrototype(object))
? _baseCreate(_getPrototype(object))
: {};
}
var _initCloneObject = initCloneObject;
/** `Object#toString` result references. */
var mapTag$3 = '[object Map]';
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike_1(value) && _getTag(value) == mapTag$3;
}
var _baseIsMap = baseIsMap;
/* Node.js helper references. */
var nodeIsMap = _nodeUtil && _nodeUtil.isMap;
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
var isMap = nodeIsMap ? _baseUnary(nodeIsMap) : _baseIsMap;
var isMap_1 = isMap;
/** `Object#toString` result references. */
var setTag$3 = '[object Set]';
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike_1(value) && _getTag(value) == setTag$3;
}
var _baseIsSet = baseIsSet;
/* Node.js helper references. */
var nodeIsSet = _nodeUtil && _nodeUtil.isSet;
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
var isSet = nodeIsSet ? _baseUnary(nodeIsSet) : _baseIsSet;
var isSet_1 = isSet;
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/** `Object#toString` result references. */
var argsTag$2 = '[object Arguments]',
arrayTag$1 = '[object Array]',
boolTag$2 = '[object Boolean]',
dateTag$2 = '[object Date]',
errorTag$1 = '[object Error]',
funcTag$2 = '[object Function]',
genTag$1 = '[object GeneratorFunction]',
mapTag$4 = '[object Map]',
numberTag$2 = '[object Number]',
objectTag$2 = '[object Object]',
regexpTag$2 = '[object RegExp]',
setTag$4 = '[object Set]',
stringTag$2 = '[object String]',
symbolTag$1 = '[object Symbol]',
weakMapTag$2 = '[object WeakMap]';
var arrayBufferTag$2 = '[object ArrayBuffer]',
dataViewTag$3 = '[object DataView]',
float32Tag$2 = '[object Float32Array]',
float64Tag$2 = '[object Float64Array]',
int8Tag$2 = '[object Int8Array]',
int16Tag$2 = '[object Int16Array]',
int32Tag$2 = '[object Int32Array]',
uint8Tag$2 = '[object Uint8Array]',
uint8ClampedTag$2 = '[object Uint8ClampedArray]',
uint16Tag$2 = '[object Uint16Array]',
uint32Tag$2 = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag$2] = cloneableTags[arrayTag$1] =
cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] =
cloneableTags[boolTag$2] = cloneableTags[dateTag$2] =
cloneableTags[float32Tag$2] = cloneableTags[float64Tag$2] =
cloneableTags[int8Tag$2] = cloneableTags[int16Tag$2] =
cloneableTags[int32Tag$2] = cloneableTags[mapTag$4] =
cloneableTags[numberTag$2] = cloneableTags[objectTag$2] =
cloneableTags[regexpTag$2] = cloneableTags[setTag$4] =
cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] =
cloneableTags[uint8Tag$2] = cloneableTags[uint8ClampedTag$2] =
cloneableTags[uint16Tag$2] = cloneableTags[uint32Tag$2] = true;
cloneableTags[errorTag$1] = cloneableTags[funcTag$2] =
cloneableTags[weakMapTag$2] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject_1(value)) {
return value;
}
var isArr = isArray_1(value);
if (isArr) {
result = _initCloneArray(value);
if (!isDeep) {
return _copyArray(value, result);
}
} else {
var tag = _getTag(value),
isFunc = tag == funcTag$2 || tag == genTag$1;
if (isBuffer_1(value)) {
return _cloneBuffer(value, isDeep);
}
if (tag == objectTag$2 || tag == argsTag$2 || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : _initCloneObject(value);
if (!isDeep) {
return isFlat
? _copySymbolsIn(value, _baseAssignIn(result, value))
: _copySymbols(value, _baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = _initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new _Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet_1(value)) {
value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap_1(value)) {
value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
}
var keysFunc = isFull
? (isFlat ? _getAllKeysIn : _getAllKeys)
: (isFlat ? keysIn_1 : keys_1);
var props = isArr ? undefined : keysFunc(value);
_arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
_assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
var _baseClone = baseClone;
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG$1 = 1,
CLONE_SYMBOLS_FLAG$1 = 4;
/**
* This method is like `_.clone` except that it recursively clones `value`.
*
* @static
* @memberOf _
* @since 1.0.0
* @category Lang
* @param {*} value The value to recursively clone.
* @returns {*} Returns the deep cloned value.
* @see _.clone
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var deep = _.cloneDeep(objects);
* console.log(deep[0] === objects[0]);
* // => false
*/
function cloneDeep(value) {
return _baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
}
var cloneDeep_1 = cloneDeep;
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
var _arrayMap = arrayMap;
/** `Object#toString` result references. */
var symbolTag$2 = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag$2);
}
var isSymbol_1 = isSymbol;
/** Used as references for various `Number` constants. */
var INFINITY$1 = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto$1 = _Symbol ? _Symbol.prototype : undefined,
symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray_1(value)) {
// Recursively convert values (susceptible to call stack limits).
return _arrayMap(value, baseToString) + '';
}
if (isSymbol_1(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
}
var _baseToString = baseToString;
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : _baseToString(value);
}
var toString_1 = toString;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar$1.source);
/**
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escapeRegExp('[lodash](https://lodash.com/)');
* // => '\[lodash\]\(https://lodash\.com/\)'
*/
function escapeRegExp(string) {
string = toString_1(string);
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar$1, '\\$&')
: string;
}
var escapeRegExp_1 = escapeRegExp;
// https://github.com/webpack-contrib/thread-loader
// https://github.com/webpack-contrib/cache-loader
class PerfLoader {
constructor (name, buildContext) {
this.name = name;
this.buildContext = buildContext;
this.workerPools = PerfLoader.defaultPools({ dev: buildContext.options.dev });
return new Proxy(this, {
get (target, name) {
return target[name] ? target[name] : target.use.bind(target, name)
}
})
}
static defaultPools ({ dev }) {
const poolTimeout = dev ? Infinity : 2000;
return {
js: { name: 'js', poolTimeout },
css: { name: 'css', poolTimeout }
}
}
static warmupAll ({ dev }) {
const pools = PerfLoader.defaultPools({ dev });
PerfLoader.warmup(pools.js, [
require.resolve('babel-loader'),
require.resolve('@babel/preset-env')
]);
PerfLoader.warmup(pools.css, ['css-loader']);
}
static warmup (...args) {
threadLoader.warmup(...args);
}
use (poolName) {
const loaders = [];
if (this.buildContext.buildOptions.cache) {
loaders.push({
loader: 'cache-loader',
options: {
cacheDirectory: path__default['default'].resolve(`node_modules/.cache/cache-loader/${this.name}`)
}
});
}
if (this.buildContext.buildOptions.parallel) {
const pool = this.workerPools[poolName];
if (pool) {
loaders.push({
loader: 'thread-loader',
options: pool
});
}
}
return loaders
}
}
/**
* This method returns the first argument it receives.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Util
* @param {*} value Any value.
* @returns {*} Returns `value`.
* @example
*
* var object = { 'a': 1 };
*
* console.log(_.identity(object) === object);
* // => true
*/
function identity(value) {
return value;
}
var identity_1 = identity;
/**
* A faster alternative to `Function#apply`, this function invokes `func`
* with the `this` binding of `thisArg` and the arguments of `args`.
*
* @private
* @param {Function} func The function to invoke.
* @param {*} thisArg The `this` binding of `func`.
* @param {Array} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
switch (args.length) {
case 0: return func.call(thisArg);
case 1: return func.call(thisArg, args[0]);
case 2: return func.call(thisArg, args[0], args[1]);
case 3: return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
var _apply = apply;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**
* A specialized version of `baseRest` which transforms the rest array.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @param {Function} transform The rest array transform.
* @returns {Function} Returns the new function.
*/
function overRest(func, start, transform) {
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
return function() {
var args = arguments,
index = -1,
length = nativeMax(args.length - start, 0),
array = Array(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform(array);
return _apply(func, this, otherArgs);
};
}
var _overRest = overRest;
/**
* Creates a function that returns `value`.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
* @returns {Function} Returns the new constant function.
* @example
*
* var objects = _.times(2, _.constant({ 'a': 1 }));
*
* console.log(objects);
* // => [{ 'a': 1 }, { 'a': 1 }]
*
* console.log(objects[0] === objects[1]);
* // => true
*/
function constant(value) {
return function() {
return value;
};
}
var constant_1 = constant;
/**
* The base implementation of `setToString` without support for hot loop shorting.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
return _defineProperty(func, 'toString', {
'configurable': true,
'enumerable': false,
'value': constant_1(string),
'writable': true
});
};
var _baseSetToString = baseSetToString;
/** Used to detect hot functions by number of calls within a span of milliseconds. */
var HOT_COUNT = 800,
HOT_SPAN = 16;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeNow = Date.now;
/**
* Creates a function that'll short out and invoke `identity` instead
* of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
* milliseconds.
*
* @private
* @param {Function} func The function to restrict.
* @returns {Function} Returns the new shortable function.
*/
function shortOut(func) {
var count = 0,
lastCalled = 0;
return function() {
var stamp = nativeNow(),
remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined, arguments);
};
}
var _shortOut = shortOut;
/**
* Sets the `toString` method of `func` to return `string`.
*
* @private
* @param {Function} func The function to modify.
* @param {Function} string The `toString` result.
* @returns {Function} Returns `func`.
*/
var setToString = _shortOut(_baseSetToString);
var _setToString = setToString;
/**
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
*
* @private
* @param {Function} func The function to apply a rest parameter to.
* @param {number} [start=func.length-1] The start position of the rest parameter.
* @returns {Function} Returns the new function.
*/
function baseRest(func, start) {
return _setToString(_overRest(func, start, identity_1), func + '');
}
var _baseRest = baseRest;
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject_1(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike_1(object) && _isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq_1(object[index], value);
}
return false;
}
var _isIterateeCall = isIterateeCall;
/** Used for built-in method references. */
var objectProto$d = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$a = objectProto$d.hasOwnProperty;
/**
* Assigns own and inherited enumerable string keyed properties of source
* objects to the destination object for all destination properties that
* resolve to `undefined`. Source objects are applied from left to right.
* Once a property is set, additional values of the same property are ignored.
*
* **Note:** This method mutates `object`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @see _.defaultsDeep
* @example
*
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
* // => { 'a': 1, 'b': 2 }
*/
var defaults = _baseRest(function(object, sources) {
object = Object(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined;
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn_1(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined ||
(eq_1(value, objectProto$d[key]) && !hasOwnProperty$a.call(object, key))) {
object[key] = source[key];
}
}
}
return object;
});
var defaults_1 = defaults;
/**
* This function is like `assignValue` except that it doesn't assign
* `undefined` values.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignMergeValue(object, key, value) {
if ((value !== undefined && !eq_1(object[key], value)) ||
(value === undefined && !(key in object))) {
_baseAssignValue(object, key, value);
}
}
var _assignMergeValue = assignMergeValue;
/**
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
*
* @private
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {Function} Returns the new base function.
*/
function createBaseFor(fromRight) {
return function(object, iteratee, keysFunc) {
var index = -1,
iterable = Object(object),
props = keysFunc(object),
length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
var _createBaseFor = createBaseFor;
/**
* The base implementation of `baseForOwn` which iterates over `object`
* properties returned by `keysFunc` and invokes `iteratee` for each property.
* Iteratee functions may exit iteration early by explicitly returning `false`.
*
* @private
* @param {Object} object The object to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @param {Function} keysFunc The function to get the keys of `object`.
* @returns {Object} Returns `object`.
*/
var baseFor = _createBaseFor();
var _baseFor = baseFor;
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike_1(value) && isArrayLike_1(value);
}
var isArrayLikeObject_1 = isArrayLikeObject;
/** `Object#toString` result references. */
var objectTag$3 = '[object Object]';
/** Used for built-in method references. */
var funcProto$2 = Function.prototype,
objectProto$e = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString$2 = funcProto$2.toString;
/** Used to check objects for own properties. */
var hasOwnProperty$b = objectProto$e.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString$2.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag$3) {
return false;
}
var proto = _getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty$b.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString$2.call(Ctor) == objectCtorString;
}
var isPlainObject_1 = isPlainObject;
/**
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
if (key === 'constructor' && typeof object[key] === 'function') {
return;
}
if (key == '__proto__') {
return;
}
return object[key];
}
var _safeGet = safeGet;
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return _copyObject(value, keysIn_1(value));
}
var toPlainObject_1 = toPlainObject;
/**
* A specialized version of `baseMerge` for arrays and objects which performs
* deep merges and tracks traversed objects enabling objects with circular
* references to be merged.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {string} key The key of the value to merge.
* @param {number} srcIndex The index of `source`.
* @param {Function} mergeFunc The function to merge values.
* @param {Function} [customizer] The function to customize assigned values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = _safeGet(object, key),
srcValue = _safeGet(source, key),
stacked = stack.get(srcValue);
if (stacked) {
_assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer
? customizer(objValue, srcValue, (key + ''), object, source, stack)
: undefined;
var isCommon = newValue === undefined;
if (isCommon) {
var isArr = isArray_1(srcValue),
isBuff = !isArr && isBuffer_1(srcValue),
isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray_1(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject_1(objValue)) {
newValue = _copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = _cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = _cloneTypedArray(srcValue, true);
}
else {
newValue = [];
}
}
else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
newValue = objValue;
if (isArguments_1(objValue)) {
newValue = toPlainObject_1(objValue);
}
else if (!isObject_1(objValue) || isFunction_1(objValue)) {
newValue = _initCloneObject(srcValue);
}
}
else {
isCommon = false;
}
}
if (isCommon) {
// Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack['delete'](srcValue);
}
_assignMergeValue(object, key, newValue);
}
var _baseMergeDeep = baseMergeDeep;
/**
* The base implementation of `_.merge` without support for multiple sources.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @param {number} srcIndex The index of `source`.
* @param {Function} [customizer] The function to customize merged values.
* @param {Object} [stack] Tracks traversed source values and their merged
* counterparts.
*/
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
_baseFor(source, function(srcValue, key) {
stack || (stack = new _Stack);
if (isObject_1(srcValue)) {
_baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
}
else {
var newValue = customizer
? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
: undefined;
if (newValue === undefined) {
newValue = srcValue;
}
_assignMergeValue(object, key, newValue);
}
}, keysIn_1);
}
var _baseMerge = baseMerge;
/**
* Creates a function like `_.assign`.
*
* @private
* @param {Function} assigner The function to assign values.
* @returns {Function} Returns the new assigner function.
*/
function createAssigner(assigner) {
return _baseRest(function(object, sources) {
var index = -1,
length = sources.length,
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined : customizer;
length = 1;
}
object = Object(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
var _createAssigner = createAssigner;
/**
* This method is like `_.assign` except that it recursively merges own and
* inherited enumerable string keyed properties of source objects into the
* destination object. Source properties that resolve to `undefined` are
* skipped if a destination value exists. Array and plain object properties
* are merged recursively. Other objects and value types are overridden by
* assignment. Source objects are applied from left to right. Subsequent
* sources overwrite property assignments of previous sources.
*
* **Note:** This method mutates `object`.
*
* @static
* @memberOf _
* @since 0.5.0
* @category Object
* @param {Object} object The destination object.
* @param {...Object} [sources] The source objects.
* @returns {Object} Returns `object`.
* @example
*
* var object = {
* 'a': [{ 'b': 2 }, { 'd': 4 }]
* };
*
* var other = {
* 'a': [{ 'c': 3 }, { 'e': 5 }]
* };
*
* _.merge(object, other);
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
*/
var merge = _createAssigner(function(object, source, srcIndex) {
_baseMerge(object, source, srcIndex);
});
var merge_1 = merge;
const orderPresets = {
cssnanoLast (names) {
const nanoIndex = names.indexOf('cssnano');
if (nanoIndex !== names.length - 1) {
names.push(names.splice(nanoIndex, 1)[0]);
}
return names
},
presetEnvLast (names) {
const nanoIndex = names.indexOf('postcss-preset-env');
if (nanoIndex !== names.length - 1) {
names.push(names.splice(nanoIndex, 1)[0]);
}
return names
},
presetEnvAndCssnanoLast (names) {
return orderPresets.cssnanoLast(orderPresets.presetEnvLast(names))
}
};
function postcssConfigFileWarning () {
if (postcssConfigFileWarning.executed) {
return
}
consola__default['default'].warn('Please use `build.postcss` in your nuxt.config.js instead of an external config file. Support for such files will be removed in Nuxt 3 as they remove all defaults set by Nuxt and can cause severe problems with features like alias resolving inside your CSS.');
postcssConfigFileWarning.executed = true;
}
class PostcssConfig {
constructor (buildContext) {
this.buildContext = buildContext;
}
get postcssOptions () {
return this.buildContext.buildOptions.postcss
}
get postcssImportAlias () {
const alias = { ...this.buildContext.options.alias };
for (const key in alias) {
if (key.startsWith('~')) {
continue
}
const newKey = '~' + key;
if (!alias[newKey]) {
alias[newKey] = alias[key];
}
}
return alias
}
get defaultConfig () {
const { dev, srcDir, rootDir, modulesDir } = this.buildContext.options;
return {
sourceMap: this.buildContext.buildOptions.cssSourceMap,
plugins: {
// https://github.com/postcss/postcss-import
'postcss-import': {
resolve: createResolver__default['default']({
alias: this.postcssImportAlias,
modules: [srcDir, rootDir, ...modulesDir]
})
},
// https://github.com/postcss/postcss-url
'postcss-url': {},
// https://github.com/csstools/postcss-preset-env
'postcss-preset-env': this.preset || {},
cssnano: dev ? false : {
preset: ['default', {
// Keep quotes in font values to prevent from HEX conversion
// https://github.com/nuxt/nuxt.js/issues/6306
minifyFontValues: { removeQuotes: false }
}]
}
},
// Array, String or Function
order: 'presetEnvAndCssnanoLast'
}
}
searchConfigFile () {
// Search for postCSS config file and use it if exists
// https://github.com/michael-ciniawsky/postcss-load-config
// TODO: Remove in Nuxt 3
const { srcDir, rootDir } = this.buildContext.options;
for (const dir of [srcDir, rootDir]) {
for (const file of [
'postcss.config.js',
'.postcssrc.js',
'.postcssrc',
'.postcssrc.json',
'.postcssrc.yaml'
]) {
const configFile = path__default['default'].resolve(dir, file);
if (fs__default['default'].existsSync(configFile)) {
postcssConfigFileWarning();
return configFile
}
}
}
}
configFromFile () {
const loaderConfig = (this.postcssOptions && this.postcssOptions.config) || {};
loaderConfig.path = loaderConfig.path || this.searchConfigFile();
if (loaderConfig.path) {
return {
sourceMap: this.buildContext.buildOptions.cssSourceMap,
config: loaderConfig
}
}
}
normalize (config) {
// TODO: Remove in Nuxt 3
if (Array.isArray(config)) {
consola__default['default'].warn('Using an Array as `build.postcss` will be deprecated in Nuxt 3. Please switch to the object' +
' declaration');
config = { plugins: config };
}
return config
}
sortPlugins ({ plugins, order }) {
const names = Object.keys(plugins);
if (typeof order === 'string') {
order = orderPresets[order];
}
return typeof order === 'function' ? order(names, orderPresets) : (order || names)
}
loadPlugins (config) {
const { plugins } = config;
if (utils.isPureObject(plugins)) {
// Map postcss plugins into instances on object mode once
config.plugins = this.sortPlugins(config)
.map((p) => {
const plugin = this.buildContext.nuxt.resolver.requireModule(p);
const opts = plugins[p];
if (opts === false) {
return // Disabled
}
return plugin(opts)
})
.filter(Boolean);
}
}
config () {
/* istanbul ignore if */
if (!this.postcssOptions) {
return false
}
let config = this.configFromFile();
if (config) {
return config
}
config = this.normalize(cloneDeep_1(this.postcssOptions));
// Apply default plugins
if (utils.isPureObject(config)) {
if (config.preset) {
this.preset = config.preset;
delete config.preset;
}
if (Array.isArray(config.plugins)) {
defaults_1(config, this.defaultConfig);
} else {
// Keep the order of default plugins
config = merge_1({}, this.defaultConfig, config);
this.loadPlugins(config);
}
return config
}
}
}
class StyleLoader {
constructor (buildContext, { isServer, perfLoader }) {
this.buildContext = buildContext;
this.isServer = isServer;
this.perfLoader = perfLoader;
if (buildContext.options.build.postcss) {
this.postcssConfig = new PostcssConfig(buildContext);
}
}
get extractCSS () {
return this.buildContext.buildOptions.extractCSS
}
get onlyLocals () {
return Boolean(this.isServer && this.extractCSS)
}
normalize (loaders) {
loaders = utils.wrapArray(loaders);
return loaders.map(loader => (typeof loader === 'string' ? { loader } : loader))
}
styleResource (ext) {
const { buildOptions: { styleResources }, options: { rootDir } } = this.buildContext;
const extResource = styleResources[ext];
// style-resources-loader
// https://github.com/yenshih/style-resources-loader
if (!extResource) {
return
}
const patterns = utils.wrapArray(extResource).map(p => path__default['default'].resolve(rootDir, p));
return {
loader: 'style-resources-loader',
options: Object.assign(
{ patterns },
styleResources.options || {}
)
}
}
postcss () {
// postcss-loader
// https://github.com/postcss/postcss-loader
if (!this.postcssConfig) {
return
}
const config = this.postcssConfig.config();
if (!config) {
return
}
return {
loader: 'postcss-loader',
options: Object.assign({ sourceMap: this.buildContext.buildOptions.cssSourceMap }, config)
}
}
css (options) {
options.onlyLocals = this.onlyLocals;
const cssLoader = { loader: 'css-loader', options };
if (options.onlyLocals) {
return [cssLoader]
}
return [this.styleLoader(), cssLoader]
}
cssModules (options) {
return this.css(options)
}
extract () {
if (this.extractCSS) {
const isDev = this.buildContext.options.dev;
return {
loader: ExtractCssChunksPlugin__default['default'].loader,
options: {
// TODO: https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/issues/132
// https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/issues/161#issuecomment-500162574
reloadAll: isDev,
hot: isDev
}
}
}
}
styleLoader () {
return this.extract() || {
loader: 'vue-style-loader',
options: this.buildContext.buildOptions.loaders.vueStyle
}
}
apply (ext, loaders = []) {
const { css, cssModules } = this.buildContext.buildOptions.loaders;
const customLoaders = [].concat(
this.postcss(),
this.normalize(loaders),
this.styleResource(ext)
).filter(Boolean);
css.importLoaders = cssModules.importLoaders = customLoaders.length;
return [
// This matches <style module>
{
resourceQuery: /module/,
use: this.perfLoader.css().concat(
this.cssModules(cssModules),
customLoaders
)
},
// This matches plain <style> or <style scoped>
{
use: this.perfLoader.css().concat(
this.css(css),
customLoaders
)
}
]
}
}
class WarningIgnorePlugin {
constructor (filter) {
this.filter = filter;
}
apply (compiler) /* istanbul ignore next */ {
compiler.hooks.done.tap('warnfix-plugin', (stats) => {
stats.compilation.warnings = stats.compilation.warnings.filter(this.filter);
});
}
}
const reservedVueTags = [
// HTML tags
'html', 'body', 'base', 'head', 'link', 'meta', 'style', 'title', 'address',
'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'hgroup', 'nav', 'section', 'div', 'dd', 'dl', 'dt', 'figcaption', 'figure',
'picture', 'hr', 'img', 'li', 'main', 'ol', 'p', 'pre', 'ul', 'a', 'b', 'abbr',
'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark',
'q', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub',
'sup', 'time', 'u', 'var', 'wbr', 'area', 'audio', 'map', 'track', 'video',
'embed', 'object', 'param', 'source', 'canvas', 'script', 'noscript', 'del',
'ins', 'caption', 'col', 'colgroup', 'table', 'thead', 'tbody', 'td', 'th', 'tr',
'button', 'datalist', 'fieldset', 'form', 'input', 'label', 'legend', 'meter',
'optgroup', 'option', 'output', 'progress', 'select', 'textarea', 'details',
'dialog', 'menu', 'menuitem', 'summary', 'content', 'element', 'shadow', 'template',
'blockquote', 'iframe', 'tfoot',
// SVG tags
'svg', 'animate', 'circle', 'clippath', 'cursor', 'defs', 'desc', 'ellipse', 'filter',
'font-face', 'foreignObject', 'g', 'glyph', 'image', 'line', 'marker', 'mask',
'missing-glyph', 'path', 'pattern', 'polygon', 'polyline', 'rect', 'switch', 'symbol',
'text', 'textpath', 'tspan', 'use', 'view',
// Vue built-in tags
'slot', 'component'
];
class WebpackBaseConfig {
constructor (builder) {
this.builder = builder;
this.buildContext = builder.buildContext;
}
get colors () {
return {
client: 'green',
server: 'orange',
modern: 'blue'
}
}
get nuxtEnv () {
return {
isDev: this.dev,
isServer: this.isServer,
isClient: !this.isServer,
isModern: Boolean(this.isModern),
isLegacy: Boolean(!this.isModern)
}
}
get mode () {
return this.dev ? 'development' : 'production'
}
get target () {
return this.buildContext.target
}
get dev () {
return this.buildContext.options.dev
}
get loaders () {
if (!this._loaders) {
this._loaders = cloneDeep_1(this.buildContext.buildOptions.loaders);
// sass-loader<8 support (#6460)
const sassLoaderPKG = utils.getPKG('sass-loader');
if (sassLoaderPKG && semver__default['default'].lt(sassLoaderPKG.version, '8.0.0')) {
const { sass } = this._loaders;
sass.indentedSyntax = sass.sassOptions.indentedSyntax;
delete sass.sassOptions.indentedSyntax;
}
}
return this._loaders
}
get modulesToTranspile () {
return [
/\.vue\.js/i, // include SFCs in node_modules
/consola\/src/,
...this.normalizeTranspile({ pathNormalize: true })
]
}
normalizeTranspile ({ pathNormalize = false } = {}) {
const transpile = [];
for (let pattern of this.buildContext.buildOptions.transpile) {
if (typeof pattern === 'function') {
pattern = pattern(this.nuxtEnv);
}
if (pattern instanceof RegExp) {
transpile.push(pattern);
} else if (typeof pattern === 'string') {
const posixModule = pattern.replace(/\\/g, '/');
transpile.push(new RegExp(escapeRegExp_1(
pathNormalize ? path__default['default'].normalize(posixModule) : posixModule
)));
}
}
return transpile
}
getBabelOptions () {
const envName = this.name;
const { buildOptions: { corejs }, options: { rootDir } } = this.buildContext;
const options = {
...this.buildContext.buildOptions.babel,
envName
};
if (options.configFile || options.babelrc) {
return options
}
if (typeof options.plugins === 'function') {
options.plugins = options.plugins(
{
envName,
...this.nuxtEnv
}
);
}
// Auto detect corejs version
let corejsVersion = corejs;
if (corejsVersion === 'auto') {
try {
corejsVersion = Number.parseInt(createRequire__default['default'](rootDir)('core-js/package.json').version.split('.')[0]);
} catch (_err) {
corejsVersion = 2;
}
} else {
corejsVersion = Number.parseInt(corejsVersion);
}
if (![2, 3].includes(corejsVersion)) {
consola__default['default'].warn(`Invalid corejs version ${corejsVersion}! Please set "build.corejs" to either "auto", 2 or 3.`);
corejsVersion = 2;
}
const defaultPreset = [require.resolve('@nuxt/babel-preset-app'), {
corejs: {
version: corejsVersion
}
}];
if (typeof options.presets === 'function') {
options.presets = options.presets(
{
envName,
...this.nuxtEnv
},
defaultPreset
);
}
if (!options.presets) {
options.presets = [defaultPreset];
}
return options
}
getFileName (key) {
let fileName = this.buildContext.buildOptions.filenames[key];
if (typeof fileName === 'function') {
fileName = fileName(this.nuxtEnv);
}
if (this.dev) {
const hash = /\[(chunkhash|contenthash|hash)(?::(\d+))?]/.exec(fileName);
if (hash) {
consola__default['default'].warn(`Notice: Please do not use ${hash[1]} in dev mode to prevent memory leak`);
}
}
if (this.buildContext.buildOptions.analyze && !fileName.includes('[name]')) {
fileName = '[name].' + fileName;
}
return fileName
}
env () {
const env = {
'process.env.NODE_ENV': JSON.stringify(this.mode),
'process.mode': JSON.stringify(this.mode),
'process.dev': this.dev,
'process.static': this.target === utils.TARGETS.static,
'process.target': JSON.stringify(this.target)
};
if (this.buildContext.buildOptions.aggressiveCodeRemoval) {
env['typeof process'] = JSON.stringify(this.isServer ? 'object' : 'undefined');
env['typeof window'] = JSON.stringify(!this.isServer ? 'object' : 'undefined');
env['typeof document'] = JSON.stringify(!this.isServer ? 'object' : 'undefined');
}
Object.entries(this.buildContext.options.env).forEach(([key, value]) => {
env['process.env.' + key] =
['boolean', 'number'].includes(typeof value)
? value
: JSON.stringify(value);
});
return env
}
output () {
const {
options: { buildDir, router },
buildOptions: { publicPath }
} = this.buildContext;
return {
path: path__default['default'].resolve(buildDir, 'dist', this.isServer ? 'server' : 'client'),
filename: this.getFileName('app'),
futureEmitAssets: true, // TODO: Remove when using webpack 5
chunkFilename: this.getFileName('chunk'),
publicPath: utils.isUrl(publicPath) ? publicPath : utils.urlJoin(router.base, publicPath)
}
}
optimization () {
const optimization = cloneDeep_1(this.buildContext.buildOptions.optimization);
if (optimization.minimize && optimization.minimizer === undefined) {
optimization.minimizer = this.minimizer();
}
return optimization
}
resolve () {
// Prioritize nested node_modules in webpack search path (#2558)
const webpackModulesDir = ['node_modules'].concat(this.buildContext.options.modulesDir);
return {
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.json', '.vue', '.jsx'],
alias: this.alias(),
modules: webpackModulesDir
},
resolveLoader: {
modules: [
path__default['default'].resolve(__dirname, '../node_modules'),
...webpackModulesDir
]
}
}
}
minimizer () {
const minimizer = [];
const { terser, cache } = this.buildContext.buildOptions;
// https://github.com/webpack-contrib/terser-webpack-plugin
if (terser) {
minimizer.push(
new TerserWebpackPlugin__default['default'](Object.assign({
cache,
extractComments: {
condition: 'some',
filename: 'LICENSES'
},
terserOptions: {
compress: {
ecma: this.isModern ? 6 : undefined
},
mangle: {
reserved: reservedVueTags
}
}
}, terser))
);
}
return minimizer
}
alias () {
return {
...this.buildContext.options.alias,
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
}
}
rules () {
const perfLoader = new PerfLoader(this.name, this.buildContext);
const styleLoader = new StyleLoader(
this.buildContext,
{ isServer: this.isServer, perfLoader }
);
const babelLoader = {
loader: require.resolve('babel-loader'),
options: this.getBabelOptions()
};
return [
{
test: /\.vue$/i,
loader: 'vue-loader',
options: this.loaders.vue
},
{
test: /\.pug$/i,
oneOf: [
{
resourceQuery: /^\?vue/i,
use: [{
loader: 'pug-plain-loader',
options: this.loaders.pugPlain
}]
},
{
use: [
'raw-loader',
{
loader: 'pug-plain-loader',
options: this.loaders.pugPlain
}
]
}
]
},
{
test: /\.m?jsx?$/i,
exclude: (file) => {
file = file.split('node_modules', 2)[1];
// not exclude files outside node_modules
if (!file) {
return false
}
// item in transpile can be string or regex object
return !this.modulesToTranspile.some(module => module.test(file))
},
use: perfLoader.js().concat(babelLoader)
},
{
test: /\.css$/i,
oneOf: styleLoader.apply('css')
},
{
test: /\.p(ost)?css$/i,
oneOf: styleLoader.apply('postcss')
},
{
test: /\.less$/i,
oneOf: styleLoader.apply('less', {
loader: 'less-loader',
options: this.loaders.less
})
},
{
test: /\.sass$/i,
oneOf: styleLoader.apply('sass', {
loader: 'sass-loader',
options: this.loaders.sass
})
},
{
test: /\.scss$/i,
oneOf: styleLoader.apply('scss', {
loader: 'sass-loader',
options: this.loaders.scss
})
},
{
test: /\.styl(us)?$/i,
oneOf: styleLoader.apply('stylus', {
loader: 'stylus-loader',
options: this.loaders.stylus
})
},
{
test: /\.(png|jpe?g|gif|svg|webp|avif)$/i,
use: [{
loader: 'url-loader',
options: Object.assign(
this.loaders.imgUrl,
{ name: this.getFileName('img') }
)
}]
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i,
use: [{
loader: 'url-loader',
options: Object.assign(
this.loaders.fontUrl,
{ name: this.getFileName('font') }
)
}]
},
{
test: /\.(webm|mp4|ogv)$/i,
use: [{
loader: 'file-loader',
options: Object.assign(
this.loaders.file,
{ name: this.getFileName('video') }
)
}]
}
]
}
plugins () {
const plugins = [];
const { nuxt, buildOptions } = this.buildContext;
// Add timefix-plugin before others plugins
if (this.dev) {
plugins.push(new TimeFixPlugin__default['default']());
}
// CSS extraction)
if (buildOptions.extractCSS) {
plugins.push(new ExtractCssChunksPlugin__default['default'](Object.assign({
filename: this.getFileName('css'),
chunkFilename: this.getFileName('css')
}, buildOptions.extractCSS)));
}
plugins.push(new VueLoader__default['default'].VueLoaderPlugin());
plugins.push(...(buildOptions.plugins || []));
plugins.push(new WarningIgnorePlugin(this.warningIgnoreFilter()));
// Build progress indicator
plugins.push(new WebpackBar__default['default']({
name: this.name,
color: this.colors[this.name],
reporters: [
'basic',
'fancy',
'profile',
'stats'
],
basic: !buildOptions.quiet && env__default['default'].minimalCLI,
fancy: !buildOptions.quiet && !env__default['default'].minimalCLI,
profile: !buildOptions.quiet && buildOptions.profile,
stats: !buildOptions.quiet && !this.dev && buildOptions.stats,
reporter: {
change: (_, { shortPath }) => {
if (!this.isServer) {
nuxt.callHook('bundler:change', shortPath);
}
},
done: (buildContext) => {
if (buildContext.hasErrors) {
nuxt.callHook('bundler:error');
}
},
allDone: () => {
nuxt.callHook('bundler:done');
},
progress ({ statesArray }) {
nuxt.callHook('bundler:progress', statesArray);
}
}
}));
if (buildOptions.hardSource) {
// https://github.com/mzgoddard/hard-source-webpack-plugin
plugins.push(new HardSourcePlugin__default['default']({
info: {
level: 'warn'
},
...buildOptions.hardSource
}));
}
return plugins
}
warningIgnoreFilter () {
const filters = [
// Hide warnings about plugins without a default export (#1179)
warn => warn.name === 'ModuleDependencyWarning' &&
warn.message.includes('export \'default\'') &&
warn.message.includes('nuxt_plugin_'),
...(this.buildContext.buildOptions.warningIgnoreFilters || [])
];
return warn => !filters.some(ignoreFilter => ignoreFilter(warn))
}
extendConfig (config) {
const { extend } = this.buildContext.buildOptions;
if (typeof extend === 'function') {
const extendedConfig = extend.call(
this.builder, config, { loaders: this.loaders, ...this.nuxtEnv }
) || config;
const pragma = /@|#/;
const { devtool } = extendedConfig;
if (typeof devtool === 'string' && pragma.test(devtool)) {
extendedConfig.devtool = devtool.replace(pragma, '');
consola__default['default'].warn(`devtool has been normalized to ${extendedConfig.devtool} as webpack documented value`);
}
return extendedConfig
}
return config
}
config () {
const config = {
name: this.name,
mode: this.mode,
devtool: this.devtool,
optimization: this.optimization(),
output: this.output(),
performance: {
maxEntrypointSize: 1000 * 1024,
hints: this.dev ? false : 'warning'
},
module: {
rules: this.rules()
},
plugins: this.plugins(),
...this.resolve()
};
// Clone deep avoid leaking config between Client and Server
const extendedConfig = cloneDeep_1(this.extendConfig(config));
return extendedConfig
}
}
class WebpackClientConfig extends WebpackBaseConfig {
constructor (builder) {
super(builder);
this.name = 'client';
this.isServer = false;
this.isModern = false;
}
get devtool () {
if (!this.dev) {
return false
}
const scriptPolicy = this.getCspScriptPolicy();
const noUnsafeEval = scriptPolicy && !scriptPolicy.includes('\'unsafe-eval\'');
return noUnsafeEval
? 'cheap-module-source-map'
: 'cheap-module-eval-source-map'
}
getCspScriptPolicy () {
const { csp } = this.buildContext.options.render;
if (csp) {
const { policies = {} } = csp;
return policies['script-src'] || policies['default-src'] || []
}
}
env () {
return Object.assign(
super.env(),
{
'process.env.VUE_ENV': JSON.stringify('client'),
'process.browser': true,
'process.client': true,
'process.server': false,
'process.modern': false
}
)
}
optimization () {
const optimization = super.optimization();
const { splitChunks } = optimization;
const { cacheGroups } = splitChunks;
// Small, known and common modules which are usually used project-wise
// Sum of them may not be more than 244 KiB
if (
this.buildContext.buildOptions.splitChunks.commons === true &&
cacheGroups.commons === undefined
) {
cacheGroups.commons = {
test: /node_modules[\\/](vue|vue-loader|vue-router|vuex|vue-meta|core-js|@babel\/runtime|axios|webpack|setimmediate|timers-browserify|process|regenerator-runtime|cookie|js-cookie|is-buffer|dotprop|nuxt\.js)[\\/]/,
chunks: 'all',
name: true,
priority: 10
};
}
return optimization
}
minimizer () {
const minimizer = super.minimizer();
const { optimizeCSS } = this.buildContext.buildOptions;
// https://github.com/NMFR/optimize-css-assets-webpack-plugin
// https://github.com/webpack-contrib/mini-css-extract-plugin#minimizing-for-production
// TODO: Remove OptimizeCSSAssetsPlugin when upgrading to webpack 5
if (optimizeCSS) {
minimizer.push(new OptimizeCSSAssetsPlugin__default['default'](Object.assign({}, optimizeCSS)));
}
return minimizer
}
alias () {
const aliases = super.alias();
for (const p of this.buildContext.plugins) {
if (!aliases[p.name]) {
// Do not load server-side plugins on client-side
aliases[p.name] = p.mode === 'server' ? './empty.js' : p.src;
}
}
return aliases
}
plugins () {
const plugins = super.plugins();
const { buildOptions, options: { appTemplatePath, buildDir, modern, render } } = this.buildContext;
// Generate output HTML for SSR
if (buildOptions.ssr) {
plugins.push(
new HtmlWebpackPlugin__default['default']({
filename: '../server/index.ssr.html',
template: appTemplatePath,
minify: buildOptions.html.minify,
inject: false // Resources will be injected using bundleRenderer
})
);
}
plugins.push(
new HtmlWebpackPlugin__default['default']({
filename: '../server/index.spa.html',
template: appTemplatePath,
minify: buildOptions.html.minify,
inject: true
}),
new VueSSRClientPlugin({
filename: `../server/${this.name}.manifest.json`
}),
new webpack__default['default'].DefinePlugin(this.env())
);
if (this.dev) {
// TODO: webpackHotUpdate is not defined: https://github.com/webpack/webpack/issues/6693
plugins.push(new webpack__default['default'].HotModuleReplacementPlugin());
}
// Webpack Bundle Analyzer
// https://github.com/webpack-contrib/webpack-bundle-analyzer
if (!this.dev && buildOptions.analyze) {
const statsDir = path__default['default'].resolve(buildDir, 'stats');
plugins.push(new BundleAnalyzer__default['default'].BundleAnalyzerPlugin(Object.assign({
analyzerMode: 'static',
defaultSizes: 'gzip',
generateStatsFile: true,
openAnalyzer: !buildOptions.quiet,
reportFilename: path__default['default'].resolve(statsDir, `${this.name}.html`),
statsFilename: path__default['default'].resolve(statsDir, `${this.name}.json`)
}, buildOptions.analyze)));
}
if (modern) {
const scriptPolicy = this.getCspScriptPolicy();
const noUnsafeInline = scriptPolicy && !scriptPolicy.includes('\'unsafe-inline\'');
plugins.push(new ModernModePlugin({
targetDir: path__default['default'].resolve(buildDir, 'dist', 'client'),
isModernBuild: this.isModern,
noUnsafeInline
}));
}
if (render.crossorigin) {
plugins.push(new CorsPlugin({
crossorigin: render.crossorigin
}));
}
return plugins
}
config () {
const config = super.config();
const {
options: { router, buildDir },
buildOptions: { hotMiddleware, quiet, friendlyErrors }
} = this.buildContext;
const { client = {} } = hotMiddleware || {};
const { ansiColors, overlayStyles, ...options } = client;
const hotMiddlewareClientOptions = {
reload: true,
timeout: 30000,
ansiColors: JSON.stringify(ansiColors),
overlayStyles: JSON.stringify(overlayStyles),
path: `${router.base}/__webpack_hmr/${this.name}`.replace(/\/\//g, '/'),
...options,
name: this.name
};
const hotMiddlewareClientOptionsStr = querystring__default['default'].stringify(hotMiddlewareClientOptions);
// Entry points
config.entry = Object.assign({}, config.entry, {
app: [path__default['default'].resolve(buildDir, 'client.js')]
});
// Add HMR support
if (this.dev) {
config.entry.app.unshift(
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/53#issuecomment-162823945
'eventsource-polyfill',
// https://github.com/glenjamin/webpack-hot-middleware#config
`webpack-hot-middleware/client?${hotMiddlewareClientOptionsStr}`
);
}
// Add friendly error plugin
if (this.dev && !quiet && friendlyErrors) {
config.plugins.push(
new FriendlyErrorsWebpackPlugin__default['default']({
clearConsole: false,
reporter: 'consola',
logLevel: 'WARNING'
})
);
}
return config
}
}
class WebpackModernConfig extends WebpackClientConfig {
constructor (...args) {
super(...args);
this.name = 'modern';
this.isModern = true;
}
env () {
return Object.assign(super.env(), {
'process.modern': true
})
}
}
class VueSSRServerPlugin {
constructor (options = {}) {
this.options = Object.assign({
filename: null
}, options);
}
apply (compiler) {
validate(compiler);
compiler.hooks.emit.tapAsync('vue-server-plugin', (compilation, cb) => {
const stats = compilation.getStats().toJson();
const [entryName] = Object.keys(stats.entrypoints);
const entryInfo = stats.entrypoints[entryName];
if (!entryInfo) {
// #5553
return cb()
}
const entryAssets = entryInfo.assets.filter(isJS);
if (entryAssets.length > 1) {
throw new Error(
'Server-side bundle should have one single entry file. ' +
'Avoid using CommonsChunkPlugin in the server config.'
)
}
const [entry] = entryAssets;
if (!entry || typeof entry !== 'string') {
throw new Error(
`Entry "${entryName}" not found. Did you specify the correct entry option?`
)
}
const bundle = {
entry,
files: {},
maps: {}
};
stats.assets.forEach((asset) => {
if (isJS(asset.name)) {
const queryPart = extractQueryPartJS(asset.name);
if (queryPart !== undefined) {
bundle.files[asset.name] = asset.name.replace(queryPart, '');
} else {
bundle.files[asset.name] = asset.name;
}
} else if (asset.name.match(/\.js\.map$/)) {
bundle.maps[asset.name.replace(/\.map$/, '')] = asset.name;
} else {
// Do not emit non-js assets for server
delete compilation.assets[asset.name];
}
});
const src = JSON.stringify(bundle, null, 2);
compilation.assets[this.options.filename] = {
source: () => src,
size: () => src.length
};
cb();
});
}
}
const nativeFileExtensions = [
'.json',
'.js'
];
class WebpackServerConfig extends WebpackBaseConfig {
constructor (...args) {
super(...args);
this.name = 'server';
this.isServer = true;
}
get devtool () {
return 'cheap-module-source-map'
}
get externalsAllowlist () {
return [
this.isNonNativeImport.bind(this),
...this.normalizeTranspile()
]
}
/**
* files *not* ending on js|json should be processed by webpack
*
* this might generate false-positives for imports like
* - "someFile.umd" (actually requiring someFile.umd.js)
* - "some.folder" (some.folder being a directory containing a package.json)
*/
isNonNativeImport (modulePath) {
const extname = path__default['default'].extname(modulePath);
return extname !== '' && !nativeFileExtensions.includes(extname)
}
env () {
return Object.assign(
super.env(),
{
'process.env.VUE_ENV': JSON.stringify('server'),
'process.browser': false,
'process.client': false,
'process.server': true,
'process.modern': false
}
)
}
optimization () {
const { _minifyServer } = this.buildContext.buildOptions;
return {
splitChunks: false,
minimizer: _minifyServer ? this.minimizer() : []
}
}
resolve () {
const resolveConfig = super.resolve();
resolveConfig.resolve.mainFields = ['main', 'module'];
return resolveConfig
}
alias () {
const aliases = super.alias();
for (const p of this.buildContext.plugins) {
if (!aliases[p.name]) {
// Do not load client-side plugins on server-side
aliases[p.name] = p.mode === 'client' ? './empty.js' : p.src;
}
}
return aliases
}
plugins () {
const plugins = super.plugins();
plugins.push(
new VueSSRServerPlugin({ filename: `${this.name}.manifest.json` }),
new webpack.DefinePlugin(this.env())
);
const { serverURLPolyfill } = this.buildContext.options.build;
if (serverURLPolyfill) {
plugins.push(new webpack.ProvidePlugin({
URL: [serverURLPolyfill, 'URL'],
URLSearchParams: [serverURLPolyfill, 'URLSearchParams']
}));
}
return plugins
}
config () {
const config = super.config();
Object.assign(config, {
target: 'node',
node: false,
entry: Object.assign({}, config.entry, {
app: [path__default['default'].resolve(this.buildContext.options.buildDir, 'server.js')]
}),
output: Object.assign({}, config.output, {
filename: 'server.js',
chunkFilename: '[name].js',
libraryTarget: 'commonjs2'
}),
performance: {
hints: false,
maxEntrypointSize: Infinity,
maxAssetSize: Infinity
},
externals: [].concat(config.externals || [])
});
// https://webpack.js.org/configuration/externals/#externals
// https://github.com/liady/webpack-node-externals
// https://vue-loader.vuejs.org/migrating.html#ssr-externals
if (!this.buildContext.buildOptions.standalone) {
this.buildContext.options.modulesDir.forEach((dir) => {
if (fs__default['default'].existsSync(dir)) {
config.externals.push(
nodeExternals__default['default']({
allowlist: this.externalsAllowlist,
modulesDir: dir
})
);
}
});
}
return config
}
}
const WebpackConfigs = /*#__PURE__*/Object.freeze({
__proto__: null,
client: WebpackClientConfig,
modern: WebpackModernConfig,
server: WebpackServerConfig
});
const glob = pify__default['default'](Glob__default['default']);
class WebpackBundler {
constructor (buildContext) {
this.buildContext = buildContext;
// Class fields
this.compilers = [];
this.compilersWatching = [];
this.devMiddleware = {};
this.hotMiddleware = {};
// Bind middleware to self
this.middleware = this.middleware.bind(this);
// Initialize shared MFS for dev
if (this.buildContext.options.dev) {
this.mfs = new AsyncMFS();
}
}
getWebpackConfig (name) {
const Config = WebpackConfigs[name.toLowerCase()]; // eslint-disable-line import/namespace
if (!Config) {
throw new Error(`Unsupported webpack config ${name}`)
}
const config = new Config(this);
return config.config()
}
async build () {
const { options } = this.buildContext;
const webpackConfigs = [
this.getWebpackConfig('Client')
];
if (options.modern) {
webpackConfigs.push(this.getWebpackConfig('Modern'));
}
if (options.build.ssr) {
webpackConfigs.push(this.getWebpackConfig('Server'));
}
await this.buildContext.nuxt.callHook('webpack:config', webpackConfigs);
// Check styleResource existence
const { styleResources } = this.buildContext.options.build;
if (styleResources && Object.keys(styleResources).length) {
consola__default['default'].warn(
'Using styleResources without the @nuxtjs/style-resources is not suggested and can lead to severe performance issues.',
'Please use https://github.com/nuxt-community/style-resources-module'
);
for (const ext of Object.keys(styleResources)) {
await Promise.all(utils.wrapArray(styleResources[ext]).map(async (p) => {
const styleResourceFiles = await glob(path__default['default'].resolve(this.buildContext.options.rootDir, p));
if (!styleResourceFiles || styleResourceFiles.length === 0) {
throw new Error(`Style Resource not found: ${p}`)
}
}));
}
}
// Configure compilers
this.compilers = webpackConfigs.map((config) => {
const compiler = webpack__default['default'](config);
// In dev, write files in memory FS
if (options.dev) {
compiler.outputFileSystem = this.mfs;
}
return compiler
});
// Warm up perfLoader before build
if (options.build.parallel) {
consola__default['default'].info('Warming up worker pools');
PerfLoader.warmupAll({ dev: options.dev });
consola__default['default'].success('Worker pools ready');
}
// Start Builds
const runner = options.dev ? utils.parallel : utils.sequence;
await runner(this.compilers, compiler => this.webpackCompile(compiler));
}
async webpackCompile (compiler) {
const { name } = compiler.options;
const { nuxt, options } = this.buildContext;
await nuxt.callHook('build:compile', { name, compiler });
// Load renderer resources after build
compiler.hooks.done.tap('load-resources', async (stats) => {
await nuxt.callHook('build:compiled', {
name,
compiler,
stats
});
// Reload renderer
await nuxt.callHook('build:resources', this.mfs);
});
// --- Dev Build ---
if (options.dev) {
// Client Build, watch is started by dev-middleware
if (['client', 'modern'].includes(name)) {
return new Promise((resolve, reject) => {
compiler.hooks.done.tap('nuxt-dev', () => resolve());
return this.webpackDev(compiler)
})
}
// Server, build and watch for changes
return new Promise((resolve, reject) => {
const watching = compiler.watch(options.watchers.webpack, (err) => {
if (err) {
return reject(err)
}
resolve();
});
watching.close = pify__default['default'](watching.close);
this.compilersWatching.push(watching);
})
}
// --- Production Build ---
compiler.run = pify__default['default'](compiler.run);
const stats = await compiler.run();
if (stats.hasErrors()) {
// non-quiet mode: errors will be printed by webpack itself
const error = new Error('Nuxt build error');
if (options.build.quiet === true) {
error.stack = stats.toString('errors-only');
}
throw error
}
// Await for renderer to load resources (programmatic, tests and generate)
await nuxt.callHook('build:resources');
}
async webpackDev (compiler) {
consola__default['default'].debug('Creating webpack middleware...');
const { name } = compiler.options;
const buildOptions = this.buildContext.options.build;
const { client, ...hotMiddlewareOptions } = buildOptions.hotMiddleware || {};
// Create webpack dev middleware
this.devMiddleware[name] = pify__default['default'](
webpackDevMiddleware__default['default'](
compiler, {
publicPath: buildOptions.publicPath,
stats: false,
logLevel: 'silent',
watchOptions: this.buildContext.options.watchers.webpack,
fs: compiler.outputFileSystem,
...buildOptions.devMiddleware
})
);
this.devMiddleware[name].close = pify__default['default'](this.devMiddleware[name].close);
this.compilersWatching.push(this.devMiddleware[name].context.watching);
this.hotMiddleware[name] = pify__default['default'](
webpackHotMiddleware__default['default'](
compiler, {
log: false,
heartbeat: 10000,
path: `/__webpack_hmr/${name}`,
...hotMiddlewareOptions
})
);
// Register devMiddleware on server
await this.buildContext.nuxt.callHook('server:devMiddleware', this.middleware);
}
async middleware (req, res, next) {
const name = utils.isModernRequest(req, this.buildContext.options.modern) ? 'modern' : 'client';
if (this.devMiddleware && this.devMiddleware[name]) {
await this.devMiddleware[name](req, res);
}
if (this.hotMiddleware && this.hotMiddleware[name]) {
await this.hotMiddleware[name](req, res);
}
next();
}
async unwatch () {
await Promise.all(this.compilersWatching.map(watching => watching.close()));
}
async close () {
if (this.__closed) {
return
}
this.__closed = true;
// Unwatch
await this.unwatch();
// Stop webpack middleware
for (const devMiddleware of Object.values(this.devMiddleware)) {
await devMiddleware.close();
}
// Cleanup MFS
if (this.mfs) {
delete this.mfs.data;
delete this.mfs;
}
// Cleanup more resources
delete this.compilers;
delete this.compilersWatching;
delete this.devMiddleware;
delete this.hotMiddleware;
}
forGenerate () {
this.buildContext.target = utils.TARGETS.static;
}
}
exports.BundleBuilder = WebpackBundler;
| 27.090682 | 295 | 0.63759 |
c8d63fffff61f74fa390af9cf7b54aed3674a716 | 2,658 | js | JavaScript | src/components/Draggable.js | btcven/locha-mesh-chat | fd661f4910830091d51c4322faf9c0bbfe4b1b1b | [
"Apache-2.0"
] | 31 | 2019-11-24T10:39:35.000Z | 2022-03-07T05:45:38.000Z | src/components/Draggable.js | btcven/locha-mesh-chat | fd661f4910830091d51c4322faf9c0bbfe4b1b1b | [
"Apache-2.0"
] | 112 | 2019-11-09T15:15:30.000Z | 2022-03-24T11:01:07.000Z | src/components/Draggable.js | btcven/locha-mesh-chat | fd661f4910830091d51c4322faf9c0bbfe4b1b1b | [
"Apache-2.0"
] | 17 | 2019-11-24T10:39:42.000Z | 2022-01-07T06:12:24.000Z | /* eslint-disable no-return-assign */
/* eslint-disable no-underscore-dangle */
import React, { Component } from 'react';
import {
PanResponder, Animated, View
} from 'react-native';
export default class Draggable extends Component {
constructor(props) {
super(props);
this.state = {
showDraggable: true,
// eslint-disable-next-line react/no-unused-state
dropAreaValues: null,
pan: new Animated.ValueXY(),
// eslint-disable-next-line react/no-unused-state
opacity: new Animated.Value(1)
};
this.init();
}
init() {
this._val = { x: 0, y: 0 };
this.state.pan.addListener((value) => (this._val = value));
this.panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => true,
onPanResponderGrant: () => {
this.state.pan.setOffset({
x: this._val.x,
y: this._val.y
});
this.state.pan.setValue({ x: 0, y: 0 });
},
onStartShouldSetPanResponderCapture: () => true,
// eslint-disable-next-line no-dupe-keys
onPanResponderGrant: () => {
this.props.onPressIn();
this.state.pan.setOffset({
x: this._val.x,
y: this._val.y
});
this.state.pan.setValue({ x: 0, y: 0 });
},
onPanResponderMove: (e, gesture) => {
const postion = this.state.pan.__getValue();
if (postion.x > -65) {
this.props.moveText(this.state.pan);
Animated.event(
[null, { dx: this.state.pan.x, dy: new Animated.Value(0) }],
{ useNativeDriver: false }
)(e, gesture);
} else {
this.props.onPressOut();
this.state.pan.setValue({ x: 0, y: 0 });
}
},
onPanResponderTerminationRequest: () => true,
onPanResponderRelease: () => {
this.props.onPressOut();
Animated.spring(this.state.pan, {
toValue: { x: 0, y: 0 },
useNativeDriver: false
}).start();
}
});
}
// eslint-disable-next-line class-methods-use-this
isDropArea(gesture) {
return gesture.moveY < 200;
}
// eslint-disable-next-line react/sort-comp
render() {
return (
<View style={{ alignItems: 'center' }}>{this.renderDraggable()}</View>
);
}
// eslint-disable-next-line consistent-return
renderDraggable() {
const panStyle = {
transform: this.state.pan.getTranslateTransform()
};
if (this.state.showDraggable) {
return (
<Animated.View {...this.panResponder.panHandlers} style={panStyle}>
{this.props.children}
</Animated.View>
);
}
}
}
| 26.316832 | 76 | 0.568096 |
c8d6461633d2b37195a35295f715e28bdf09a6c6 | 1,989 | js | JavaScript | app/components/Master/Master.js | Qolzam/react-mobile-social | 4f2a190e4b905abe7704d7b82ede185c207f788d | [
"MIT"
] | 54 | 2017-09-19T08:18:42.000Z | 2021-04-05T14:34:00.000Z | app/components/Master/Master.js | Surik266/react-mobile-social | 4f2a190e4b905abe7704d7b82ede185c207f788d | [
"MIT"
] | 3 | 2018-03-27T11:59:45.000Z | 2018-09-29T16:58:50.000Z | app/components/Master/Master.js | Surik266/react-mobile-social | 4f2a190e4b905abe7704d7b82ede185c207f788d | [
"MIT"
] | 53 | 2017-10-26T19:02:37.000Z | 2021-12-28T15:42:03.000Z | // - Import react components
import React, { Component } from 'react'
import { connect } from 'react-redux'
import {
StyleSheet,
View,
Text,
Dimensions,
StatusBar
} from 'react-native'
import UserAvatar from 'react-native-user-avatar'
import Icon from 'react-native-vector-icons/MaterialIcons'
import { Card, CardSection, Input, Button, Spinner } from './../../layouts'
// - Import Actions
import * as globalActions from './../../actions/globalActions'
// - Import component styles
import styles from './styles'
// - Import app components
import Router from './../../routes/Router'
/**
* Create component class
*
* @export
* @class Home
* @extends {Component}
*/
export class Master extends Component {
constructor(props) {
super(props)
}
resize = ({ window }) => {
const {windowResize} = this.props
windowResize(window.height,window.width)
}
componentDidMount() {
Dimensions.addEventListener('change', this.resize)
const window = Dimensions.get('window')
this.resize({window})
}
componentWillUnMount() {
Dimensions.removeEventListener('change', this.resize)
}
render() {
const {windowSize,error} = this.props
return (
<View style={{ flex: 1 }}>
<View style={[styles.loadingLayout,{left: (windowSize.width * 0.5) - 20}]}>
{(this.props.loading) ? <Spinner size="small" /> : <Text></Text>
}
</View>
<Router />
</View>
)
}
}
// - Map dispatch to props
const mapDispatchToProps = (dispatch, ownProps) => {
return {
windowResize : (height,width) => {
dispatch(globalActions.changeWindowSize(height,width))
}
}
}
/**
* Map state to props
* @param {object} param0
*/
const mapStateToProps = ({ global }) => {
const { loading, windowSize,error } = global
return { loading ,windowSize, error}
}
/**
* Connect component to redux store
*/
export default connect(mapStateToProps, mapDispatchToProps)(Master)
| 19.89 | 83 | 0.641528 |
c8d69909fdae1ad8bb9e60de6164658dd820b64a | 4,479 | js | JavaScript | plots.js | dhoebbel/bButton_Biodiversity | 76f886c1b95b66d277d1d904847aac8481b5c5e7 | [
"MIT"
] | null | null | null | plots.js | dhoebbel/bButton_Biodiversity | 76f886c1b95b66d277d1d904847aac8481b5c5e7 | [
"MIT"
] | null | null | null | plots.js | dhoebbel/bButton_Biodiversity | 76f886c1b95b66d277d1d904847aac8481b5c5e7 | [
"MIT"
] | null | null | null | // Getting references
var selDataset = document.getElementById("selDataset");
var PANEL = document.getElementById("sample-metadata");
var PIE = document.getElementById("pie");
var BUBBLE = document.getElementById("bubble");
var Gauge = document.getElementById("gauge");
function updateMetaData(data) {
// Reference to Panel element for sample metadata
var PANEL = document.getElementById("sample-metadata");
// Clear any existing metadata
PANEL.innerHTML = '';
// Loop through all of the keys in the json response and
// create new metadata tags
for(var key in data) {
h6tag = document.createElement("h6");
h6Text = document.createTextNode(`${key}: ${data[key]}`);
h6tag.append(h6Text);
PANEL.appendChild(h6tag);
}
}
function buildCharts(sampleData, otuData) {
// Loop through sample data and find the OTU Taxonomic Name
var labels = sampleData[0]['otu_ids'].map(function(item) {
return otuData[item]
});
// Build Bubble Chart
var bubbleLayout = {
margin: { t: 0 },
hovermode: 'closest',
xaxis: { title: 'OTU ID' }
};
var bubbleData = [{
x: sampleData[0]['otu_ids'],
y: sampleData[0]['sample_values'],
text: labels,
mode: 'markers',
marker: {
size: sampleData[0]['sample_values'],
color: sampleData[0]['otu_ids'],
colorscale: "Earth",
}
}];
var BUBBLE = document.getElementById('bubble');
Plotly.plot(BUBBLE, bubbleData, bubbleLayout);
// Build Pie Chart
console.log(sampleData[0]['sample_values'].slice(0, 10))
var pieData = [{
values: sampleData[0]['sample_values'].slice(0, 10),
labels: sampleData[0]['otu_ids'].slice(0, 10),
hovertext: labels.slice(0, 10),
hoverinfo: 'hovertext',
type: 'pie'
}];
var pieLayout = {
margin: { t: 0, l: 0 }
};
var PIE = document.getElementById('pie');
Plotly.plot(PIE, pieData, pieLayout);
};
function updateCharts(sampleData, otuData) {
var sampleValues = sampleData[0]['sample_values'];
var otuIDs = sampleData[0]['otu_ids'];
// Return the OTU Description for each otuID in the dataset
var labels = otuIDs.map(function(item) {
return otuData[item]
});
// Update the Bubble Chart with the new data
var BUBBLE = document.getElementById('bubble');
Plotly.restyle(BUBBLE, 'x', [otuIDs]);
Plotly.restyle(BUBBLE, 'y', [sampleValues]);
Plotly.restyle(BUBBLE, 'text', [labels]);
Plotly.restyle(BUBBLE, 'marker.size', [sampleValues]);
Plotly.restyle(BUBBLE, 'marker.color', [otuIDs]);
// Update the Pie Chart with the new data
// Use slice to select only the top 10 OTUs for the pie chart
var PIE = document.getElementById('pie');
var pieUpdate = {
values: [sampleValues.slice(0, 10)],
labels: [otuIDs.slice(0, 10)],
hovertext: [labels.slice(0, 10)],
hoverinfo: 'hovertext',
type: 'pie'
};
Plotly.restyle(PIE, pieUpdate);
}
function getData(sample, callback) {
// Use a request to grab the json data needed for all charts
Plotly.d3.json(`/samples/${sample}`, function(error, sampleData) {
if (error) return console.warn(error);
Plotly.d3.json('/otu', function(error, otuData) {
if (error) return console.warn(error);
callback(sampleData, otuData);
});
});
Plotly.d3.json(`/metadata/${sample}`, function(error, metaData) {
if (error) return console.warn(error);
updateMetaData(metaData);
})
// BONUS - Build the Gauge Chart
buildGauge(sample);
}
function getOptions() {
// Grab a reference to the dropdown select element
var selector = document.getElementById('selDataset');
// Use the list of sample names to populate the select options
Plotly.d3.json('/names', function(error, sampleNames) {
for (var i = 0; i < sampleNames.length; i++) {
var currentOption = document.createElement('option');
currentOption.text = sampleNames[i];
currentOption.value = sampleNames[i]
selector.appendChild(currentOption);
}
getData(sampleNames[0], buildCharts);
})
}
function optionChanged(newSample) {
// Fetch new data each time a new sample is selected
getData(newSample, updateCharts);
}
function init() {
getOptions();
}
// Initialize the dashboard
init();
| 31.104167 | 70 | 0.629382 |
c8d6ab7976e33615e5e04313e4605a6043de69db | 246 | js | JavaScript | docs/search/defines_5.js | amatushkin/foleys_video_engine | 63dce248d2ed126b0a58d06afac40f1255450380 | [
"Unlicense"
] | 41 | 2019-05-26T19:02:24.000Z | 2022-03-31T14:54:47.000Z | docs/search/defines_5.js | amatushkin/foleys_video_engine | 63dce248d2ed126b0a58d06afac40f1255450380 | [
"Unlicense"
] | 4 | 2019-04-30T14:15:22.000Z | 2021-03-04T19:50:58.000Z | docs/search/defines_5.js | amatushkin/foleys_video_engine | 63dce248d2ed126b0a58d06afac40f1255450380 | [
"Unlicense"
] | 9 | 2019-12-16T13:23:20.000Z | 2022-02-07T21:48:14.000Z | var searchData=
[
['extern_5fasm_18250',['EXTERN_ASM',['../config_8h.html#a8b5e390d213eb96d942b1844fe41c7ef',1,'config.h']]],
['extern_5fprefix_18251',['EXTERN_PREFIX',['../config_8h.html#ae1f207a3f9384c3461caff04450840d8',1,'config.h']]]
];
| 41 | 114 | 0.743902 |
c8d7a7c65fb71ae08b53457e0b0d2918f7a31bbf | 1,693 | js | JavaScript | frontend/app/duck/index.js | nogamenofun98/openreplay | 543384496fbfd5bd95482bd51b15865acba78bda | [
"MIT"
] | 3,614 | 2021-05-22T08:23:31.000Z | 2022-03-31T19:46:01.000Z | frontend/app/duck/index.js | nogamenofun98/openreplay | 543384496fbfd5bd95482bd51b15865acba78bda | [
"MIT"
] | 245 | 2021-05-25T14:49:35.000Z | 2022-03-30T22:15:28.000Z | frontend/app/duck/index.js | nogamenofun98/openreplay | 543384496fbfd5bd95482bd51b15865acba78bda | [
"MIT"
] | 151 | 2021-05-22T07:57:17.000Z | 2022-03-29T00:37:31.000Z | import { combineReducers } from 'redux-immutable';
import jwt from './jwt';
import user from './user';
import sessions from './sessions';
import issues from './issues';
import assignments from './assignments';
import target from './target';
import targetCustom from './targetCustom';
import runs from './runs';
import filters from './filters';
import funnelFilters from './funnelFilters';
import tests from './tests';
import steps from './steps';
import schedules from './schedules';
import events from './events';
import environments from './environments';
import variables from './variables';
import templates from './templates';
import alerts from './alerts';
import notifications from './notifications';
import dashboard from './dashboard';
import components from './components';
import sources from './sources';
import members from './member';
import site from './site';
import customFields from './customField';
import webhooks from './webhook';
import integrations from './integrations';
import watchdogs from './watchdogs';
import rehydrate from './rehydrate';
import announcements from './announcements';
import errors from './errors';
import funnels from './funnels';
import config from './config';
import roles from './roles';
export default combineReducers({
jwt,
user,
sessions,
issues,
assignments,
target,
targetCustom,
runs,
filters,
funnelFilters,
tests,
steps,
schedules,
events,
environments,
variables,
templates,
alerts,
notifications,
dashboard,
components,
members,
site,
customFields,
webhooks,
watchdogs,
rehydrate,
announcements,
errors,
funnels,
config,
roles,
...integrations,
...sources,
});
| 22.878378 | 50 | 0.720614 |
c8d8371f17fce9aa457b52bfbfdce6b1004c58c6 | 66 | js | JavaScript | tests/for to length with continue/case-true and false.js | jimmydief/babel-plugin-transform-async-to-promises | b409b91db5d3cef756f3028fa3f67ded6b820120 | [
"MIT"
] | 233 | 2018-01-07T16:09:06.000Z | 2022-02-15T14:08:38.000Z | tests/for to length with continue/case-true and false.js | jimmydief/babel-plugin-transform-async-to-promises | b409b91db5d3cef756f3028fa3f67ded6b820120 | [
"MIT"
] | 75 | 2018-02-21T21:32:11.000Z | 2022-02-25T12:03:22.000Z | tests/for to length with continue/case-true and false.js | jimmydief/babel-plugin-transform-async-to-promises | b409b91db5d3cef756f3028fa3f67ded6b820120 | [
"MIT"
] | 22 | 2018-04-02T12:44:06.000Z | 2022-03-07T17:20:57.000Z | expect((await f([async _ => true, async _ => false]))).toBe(false) | 66 | 66 | 0.636364 |
c8d89729de8f191a2d8829742636f94984433bb1 | 14,214 | js | JavaScript | js/ui/accordion.js | ValantIO/DevExtreme | 942a4b4fb602f999038c0c8b8a501c132a85ff7f | [
"Apache-2.0"
] | 1,725 | 2017-04-11T17:28:12.000Z | 2022-03-31T07:18:37.000Z | js/ui/accordion.js | alirezavafi/devextreme-persian | c1496cca0ce7c3f17be552f16695bcc8f12f29ff | [
"Apache-2.0"
] | 1,330 | 2017-04-26T20:46:54.000Z | 2022-03-28T07:16:01.000Z | js/ui/accordion.js | alirezavafi/devextreme-persian | c1496cca0ce7c3f17be552f16695bcc8f12f29ff | [
"Apache-2.0"
] | 647 | 2017-04-25T18:52:11.000Z | 2022-03-31T13:28:46.000Z | import { getOuterHeight, setHeight, getHeight } from '../core/utils/size';
import $ from '../core/renderer';
import eventsEngine from '../events/core/events_engine';
import fx from '../animation/fx';
import { name as clickEventName } from '../events/click';
import devices from '../core/devices';
import domAdapter from '../core/dom_adapter';
import { extend } from '../core/utils/extend';
import { deferRender } from '../core/utils/common';
import { getPublicElement } from '../core/element';
import * as iteratorUtils from '../core/utils/iterator';
import { isPlainObject, isDefined } from '../core/utils/type';
import registerComponent from '../core/component_registrator';
import { addNamespace } from '../events/utils/index';
import CollectionWidget from './collection/ui.collection_widget.live_update';
import { when, Deferred } from '../core/utils/deferred';
import { BindableTemplate } from '../core/templates/bindable_template';
import { getImageContainer } from '../core/utils/icon';
import { isMaterial } from './themes';
// STYLE accordion
const ACCORDION_CLASS = 'dx-accordion';
const ACCORDION_WRAPPER_CLASS = 'dx-accordion-wrapper';
const ACCORDION_ITEM_CLASS = 'dx-accordion-item';
const ACCORDION_ITEM_OPENED_CLASS = 'dx-accordion-item-opened';
const ACCORDION_ITEM_CLOSED_CLASS = 'dx-accordion-item-closed';
const ACCORDION_ITEM_TITLE_CLASS = 'dx-accordion-item-title';
const ACCORDION_ITEM_BODY_CLASS = 'dx-accordion-item-body';
const ACCORDION_ITEM_TITLE_CAPTION_CLASS = 'dx-accordion-item-title-caption';
const ACCORDION_ITEM_DATA_KEY = 'dxAccordionItemData';
const Accordion = CollectionWidget.inherit({
_activeStateUnit: '.' + ACCORDION_ITEM_CLASS,
_getDefaultOptions: function() {
return extend(this.callBase(), {
hoverStateEnabled: true,
height: undefined,
itemTitleTemplate: 'title',
onItemTitleClick: null,
selectedIndex: 0,
collapsible: false,
multiple: false,
animationDuration: 300,
deferRendering: true,
selectionByClick: true,
activeStateEnabled: true,
_itemAttributes: { role: 'tab' },
_animationEasing: 'ease'
});
},
_defaultOptionsRules: function() {
return this.callBase().concat([
{
device: function() {
return devices.real().deviceType === 'desktop' && !devices.isSimulator();
},
options: {
focusStateEnabled: true
}
},
{
device: function() {
return isMaterial();
},
options: {
animationDuration: 200,
_animationEasing: 'cubic-bezier(0.4, 0, 0.2, 1)'
}
}
]);
},
_itemElements: function() {
return this._itemContainer().children(this._itemSelector());
},
_init: function() {
this.callBase();
this.option('selectionRequired', !this.option('collapsible'));
this.option('selectionMode', this.option('multiple') ? 'multiple' : 'single');
const $element = this.$element();
$element.addClass(ACCORDION_CLASS);
this._$container = $('<div>').addClass(ACCORDION_WRAPPER_CLASS);
$element.append(this._$container);
},
_initTemplates: function() {
this.callBase();
this._templateManager.addDefaultTemplates({
title: new BindableTemplate(function($container, data) {
if(isPlainObject(data)) {
const $iconElement = getImageContainer(data.icon);
if($iconElement) {
$container.append($iconElement);
}
if(isDefined(data.title) && !isPlainObject(data.title)) {
$container.append(domAdapter.createTextNode(data.title));
}
} else {
if(isDefined(data)) {
$container.text(String(data));
}
}
$container.wrapInner($('<div>').addClass(ACCORDION_ITEM_TITLE_CAPTION_CLASS));
}, ['title', 'icon'], this.option('integrationOptions.watchMethod'))
});
},
_initMarkup: function() {
this._deferredItems = [];
this.callBase();
this.setAria({
'role': 'tablist',
'multiselectable': this.option('multiple')
});
deferRender(() => {
const selectedItemIndices = this._getSelectedItemIndices();
this._renderSelection(selectedItemIndices, []);
});
},
_render: function() {
this.callBase();
this._updateItemHeightsWrapper(true);
},
_itemDataKey: function() {
return ACCORDION_ITEM_DATA_KEY;
},
_itemClass: function() {
return ACCORDION_ITEM_CLASS;
},
_itemContainer: function() {
return this._$container;
},
_itemTitles: function() {
return this._itemElements().find('.' + ACCORDION_ITEM_TITLE_CLASS);
},
_itemContents: function() {
return this._itemElements().find('.' + ACCORDION_ITEM_BODY_CLASS);
},
_getItemData: function(target) {
return $(target).parent().data(this._itemDataKey()) || this.callBase.apply(this, arguments);
},
_executeItemRenderAction: function(itemData) {
if(itemData.type) {
return;
}
this.callBase.apply(this, arguments);
},
_itemSelectHandler: function(e) {
if($(e.target).closest(this._itemContents()).length) {
return;
}
this.callBase.apply(this, arguments);
},
_afterItemElementDeleted: function($item, deletedActionArgs) {
this._deferredItems.splice(deletedActionArgs.itemIndex, 1);
this.callBase.apply(this, arguments);
},
_renderItemContent: function(args) {
const itemTitle = this.callBase(extend({}, args, {
contentClass: ACCORDION_ITEM_TITLE_CLASS,
templateProperty: 'titleTemplate',
defaultTemplateName: this.option('itemTitleTemplate')
}));
this._attachItemTitleClickAction(itemTitle);
const deferred = new Deferred();
if(isDefined(this._deferredItems[args.index])) {
this._deferredItems[args.index] = deferred;
} else {
this._deferredItems.push(deferred);
}
if(!this.option('deferRendering') || this._getSelectedItemIndices().indexOf(args.index) >= 0) {
deferred.resolve();
}
deferred.done(this.callBase.bind(this, extend({}, args, {
contentClass: ACCORDION_ITEM_BODY_CLASS,
container: getPublicElement($('<div>').appendTo($(itemTitle).parent()))
})));
},
_attachItemTitleClickAction: function(itemTitle) {
const eventName = addNamespace(clickEventName, this.NAME);
eventsEngine.off(itemTitle, eventName);
eventsEngine.on(itemTitle, eventName, this._itemTitleClickHandler.bind(this));
},
_itemTitleClickHandler: function(e) {
this._itemDXEventHandler(e, 'onItemTitleClick');
},
_renderSelection: function(addedSelection, removedSelection) {
this._itemElements().addClass(ACCORDION_ITEM_CLOSED_CLASS);
this.setAria('hidden', true, this._itemContents());
this._updateItems(addedSelection, removedSelection);
},
_updateSelection: function(addedSelection, removedSelection) {
this._updateItems(addedSelection, removedSelection);
this._updateItemHeightsWrapper(false);
},
_updateItems: function(addedSelection, removedSelection) {
const $items = this._itemElements();
iteratorUtils.each(addedSelection, (_, index) => {
this._deferredItems[index].resolve();
const $item = $items.eq(index)
.addClass(ACCORDION_ITEM_OPENED_CLASS)
.removeClass(ACCORDION_ITEM_CLOSED_CLASS);
this.setAria('hidden', false, $item.find('.' + ACCORDION_ITEM_BODY_CLASS));
});
iteratorUtils.each(removedSelection, (_, index) => {
const $item = $items.eq(index)
.removeClass(ACCORDION_ITEM_OPENED_CLASS);
this.setAria('hidden', true, $item.find('.' + ACCORDION_ITEM_BODY_CLASS));
});
},
_updateItemHeightsWrapper: function(skipAnimation) {
if(this.option('templatesRenderAsynchronously')) {
this._animationTimer = setTimeout(function() {
this._updateItemHeights(skipAnimation);
}.bind(this));
} else {
this._updateItemHeights(skipAnimation);
}
},
_updateItemHeights: function(skipAnimation) {
const that = this;
const deferredAnimate = that._deferredAnimate;
const itemHeight = this._splitFreeSpace(this._calculateFreeSpace());
clearTimeout(this._animationTimer);
return when.apply($, [].slice.call(this._itemElements()).map(function(item) {
return that._updateItemHeight($(item), itemHeight, skipAnimation);
})).done(function() {
if(deferredAnimate) {
deferredAnimate.resolveWith(that);
}
});
},
_updateItemHeight: function($item, itemHeight, skipAnimation) {
const $title = $item.children('.' + ACCORDION_ITEM_TITLE_CLASS);
if(fx.isAnimating($item)) {
fx.stop($item);
}
const startItemHeight = getOuterHeight($item);
let finalItemHeight;
if($item.hasClass(ACCORDION_ITEM_OPENED_CLASS)) {
finalItemHeight = itemHeight + getOuterHeight($title);
if(!finalItemHeight) {
setHeight($item, 'auto');
finalItemHeight = getOuterHeight($item);
}
} else {
finalItemHeight = getOuterHeight($title);
}
return this._animateItem($item, startItemHeight, finalItemHeight, skipAnimation, !!itemHeight);
},
_animateItem: function($element, startHeight, endHeight, skipAnimation, fixedHeight) {
let d;
if(skipAnimation || startHeight === endHeight) {
$element.css('height', endHeight);
d = new Deferred().resolve();
} else {
d = fx.animate($element, {
type: 'custom',
from: { height: startHeight },
to: { height: endHeight },
duration: this.option('animationDuration'),
easing: this.option('_animationEasing')
});
}
return d.done(function() {
if($element.hasClass(ACCORDION_ITEM_OPENED_CLASS) && !fixedHeight) {
$element.css('height', '');
}
$element
.not('.' + ACCORDION_ITEM_OPENED_CLASS)
.addClass(ACCORDION_ITEM_CLOSED_CLASS);
});
},
_splitFreeSpace: function(freeSpace) {
if(!freeSpace) {
return freeSpace;
}
return freeSpace / this.option('selectedItems').length;
},
_calculateFreeSpace: function() {
const height = this.option('height');
if(height === undefined || height === 'auto') {
return;
}
const $titles = this._itemTitles();
let itemsHeight = 0;
iteratorUtils.each($titles, function(_, title) {
itemsHeight += getOuterHeight(title);
});
return getHeight(this.$element()) - itemsHeight;
},
_visibilityChanged: function(visible) {
if(visible) {
this._dimensionChanged();
}
},
_dimensionChanged: function() {
this._updateItemHeights(true);
},
_clean: function() {
clearTimeout(this._animationTimer);
this.callBase();
},
_tryParseItemPropertyName: function(fullName) {
const matches = fullName.match(/.*\.(.*)/);
if(isDefined(matches) && (matches.length >= 1)) {
return matches[1];
}
},
_optionChanged: function(args) {
switch(args.name) {
case 'items':
this.callBase(args);
if(this._tryParseItemPropertyName(args.fullName) === 'title') {
this._renderSelection(this._getSelectedItemIndices(), []);
}
if(this._tryParseItemPropertyName(args.fullName) === 'visible') {
this._updateItemHeightsWrapper(true);
}
if(this.option('repaintChangesOnly') === true && args.fullName === 'items') {
this._updateItemHeightsWrapper(true);
this._renderSelection(this._getSelectedItemIndices(), []);
}
break;
case 'animationDuration':
case 'onItemTitleClick':
case '_animationEasing':
break;
case 'collapsible':
this.option('selectionRequired', !this.option('collapsible'));
break;
case 'itemTitleTemplate':
case 'height':
case 'deferRendering':
this._invalidate();
break;
case 'multiple':
this.option('selectionMode', args.value ? 'multiple' : 'single');
break;
default:
this.callBase(args);
}
},
expandItem: function(index) {
this._deferredAnimate = new Deferred();
this.selectItem(index);
return this._deferredAnimate.promise();
},
collapseItem: function(index) {
this._deferredAnimate = new Deferred();
this.unselectItem(index);
return this._deferredAnimate.promise();
},
updateDimensions: function() {
return this._updateItemHeights(false);
}
});
registerComponent('dxAccordion', Accordion);
export default Accordion;
/**
* @name dxAccordionItem
* @inherits CollectionWidgetItem
* @type object
*/
| 31.377483 | 103 | 0.583298 |
c8d8cc3bc87e8fd18f0d7cecdd2d0d4d4be4e67a | 205 | js | JavaScript | Demo/Vue/HelloWorld.WebPack/src/index.js | Simcon/dotNetify | dfaf6c927a765f1dd3f693c6404937d18751fcc8 | [
"Apache-2.0"
] | 1,084 | 2015-12-02T00:07:30.000Z | 2022-03-21T13:08:32.000Z | Demo/Vue/HelloWorld.WebPack/src/index.js | Simcon/dotNetify | dfaf6c927a765f1dd3f693c6404937d18751fcc8 | [
"Apache-2.0"
] | 261 | 2015-12-09T17:23:56.000Z | 2022-01-25T13:25:06.000Z | Demo/Vue/HelloWorld.WebPack/src/index.js | Simcon/dotNetify | dfaf6c927a765f1dd3f693c6404937d18751fcc8 | [
"Apache-2.0"
] | 191 | 2015-12-02T17:30:03.000Z | 2022-03-12T22:55:22.000Z | import { createApp } from "vue";
import HelloWorld from "./HelloWorld.vue";
document.getElementById("App").innerHTML = "<hello-world />";
createApp({}).component("hello-world", HelloWorld).mount("#App");
| 34.166667 | 65 | 0.707317 |
c8d8f053bf362802e6544085b1f7902dc4b9dfb3 | 26,010 | js | JavaScript | dist/angular-gridster.min.js | spsvn/sps-angular-gridster | a5f8037ab41df021fac88d8ee5a6b2783e258733 | [
"MIT"
] | null | null | null | dist/angular-gridster.min.js | spsvn/sps-angular-gridster | a5f8037ab41df021fac88d8ee5a6b2783e258733 | [
"MIT"
] | null | null | null | dist/angular-gridster.min.js | spsvn/sps-angular-gridster | a5f8037ab41df021fac88d8ee5a6b2783e258733 | [
"MIT"
] | null | null | null | /*
* sps-angular-gridster
* https://github.com/spsvn/sps-angular-gridsterhttps://github.com/spsvn/sps-angular-gridster
*
* @version: 0.13.15
* @license: MIT
*/
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(["angular"],b):"object"==typeof exports?module.exports=b(require("angular")):b(a.angular)}(this,function(a){"use strict";return a.module("gridster",[]).constant("gridsterConfig",{columns:8,pushing:!0,floating:!0,swapping:!1,width:"auto",colWidth:"auto",rowHeight:"fit",margins:[10,10],outerMargin:!0,sparse:!1,isMobile:!1,isStatic:!1,mobileBreakPoint:600,mobileModeEnabled:!0,minColumns:2,minRows:8,maxRows:8,defaultSizeX:2,defaultSizeY:1,minSizeX:1,maxSizeX:null,minSizeY:1,maxSizeY:null,saveGridItemCalculatedHeightInMobile:!1,resizable:{enabled:!0,handles:["s","e","n","w","se","ne","sw","nw"]},draggable:{enabled:!0,scrollSensitivity:20,scrollSpeed:15}}).controller("GridsterCtrl",["gridsterConfig","$timeout",function(b,c){var d=this;a.extend(this,b),this.resizable=a.extend({},b.resizable||{}),this.draggable=a.extend({},b.draggable||{});var e=!1;this.layoutChanged=function(){e||(e=!0,c(function(){e=!1,d.loaded&&d.floatItemsUp(),d.updateHeight(d.movingItem?d.movingItem.sizeY:0)},30))},this.grid=[],this.allItems=[],this.destroy=function(){this.grid&&(this.grid=[]),this.$element=null,this.allItems&&(this.allItems.length=0,this.allItems=null)},this.setOptions=function(b){if(b)if(b=a.extend({},b),b.draggable&&(a.extend(this.draggable,b.draggable),delete b.draggable),b.resizable&&(a.extend(this.resizable,b.resizable),delete b.resizable),a.extend(this,b),this.margins&&2===this.margins.length)for(var c=0,d=this.margins.length;c<d;++c)this.margins[c]=parseInt(this.margins[c],10),isNaN(this.margins[c])&&(this.margins[c]=0);else this.margins=[0,0]},this.canItemOccupy=function(a,b,c){return b>-1&&c>-1&&a.sizeX+c<=this.columns&&a.sizeY+b<=this.maxRows},this.autoSetItemPosition=function(a){for(var b=0;b<this.maxRows;++b)for(var c=0;c<this.columns;++c){var d=this.getItems(b,c,a.sizeX,a.sizeY,a);if(0===d.length&&this.canItemOccupy(a,b,c))return void this.putItem(a,b,c)}throw new Error("Unable to place item!")},this.getItems=function(a,b,c,d,e){var f=[];c&&d||(c=d=1),!e||e instanceof Array||(e=[e]);var g;if(this.sparse===!1)for(var h=0;h<d;++h)for(var i=0;i<c;++i)g=this.getItem(a+h,b+i,e),!g||e&&e.indexOf(g)!==-1||f.indexOf(g)!==-1||f.push(g);else for(var j=a+d-1,k=b+c-1,l=0;l<this.allItems.length;++l)g=this.allItems[l],!g||e&&e.indexOf(g)!==-1||f.indexOf(g)!==-1||!this.intersect(g,b,k,a,j)||f.push(g);return f},this.getBoundingBox=function(a){if(0===a.length)return null;if(1===a.length)return{row:a[0].row,col:a[0].col,sizeY:a[0].sizeY,sizeX:a[0].sizeX};for(var b=0,c=0,d=9999,e=9999,f=0,g=a.length;f<g;++f){var h=a[f];d=Math.min(h.row,d),e=Math.min(h.col,e),b=Math.max(h.row+h.sizeY,b),c=Math.max(h.col+h.sizeX,c)}return{row:d,col:e,sizeY:b-d,sizeX:c-e}},this.intersect=function(a,b,c,d,e){return b<=a.col+a.sizeX-1&&c>=a.col&&d<=a.row+a.sizeY-1&&e>=a.row},this.removeItem=function(a){for(var b,c=0,d=this.grid.length;c<d;++c){var e=this.grid[c];if(e&&(b=e.indexOf(a),b!==-1)){e[b]=null;break}}this.sparse&&(b=this.allItems.indexOf(a),b!==-1&&this.allItems.splice(b,1)),this.layoutChanged()},this.getItem=function(a,b,c){!c||c instanceof Array||(c=[c]);for(var d=1;a>-1;){for(var e=1,f=b;f>-1;){var g=this.grid[a];if(g){var h=g[f];if(h&&(!c||c.indexOf(h)===-1)&&h.sizeX>=e&&h.sizeY>=d)return h}++e,--f}--a,++d}return null},this.putItems=function(a){for(var b=0,c=a.length;b<c;++b)this.putItem(a[b])},this.putItem=function(a,b,c,d){if(("undefined"==typeof b||null===b)&&(b=a.row,c=a.col,"undefined"==typeof b||null===b))return void this.autoSetItemPosition(a);if(this.canItemOccupy(a,b,c)||(c=Math.min(this.columns-a.sizeX,Math.max(0,c)),b=Math.min(this.maxRows-a.sizeY,Math.max(0,b))),null!==a.oldRow&&"undefined"!=typeof a.oldRow){var e=a.oldRow===b&&a.oldColumn===c,f=this.grid[b]&&this.grid[b][c]===a;if(e&&f)return a.row=b,void(a.col=c);var g=this.grid[a.oldRow];g&&g[a.oldColumn]===a&&delete g[a.oldColumn]}a.oldRow=a.row=b,a.oldColumn=a.col=c,this.moveOverlappingItems(a,d),this.grid[b]||(this.grid[b]=[]),this.grid[b][c]=a,this.sparse&&this.allItems.indexOf(a)===-1&&this.allItems.push(a),this.movingItem===a&&this.floatItemUp(a),this.layoutChanged()},this.swapItems=function(a,b){this.grid[a.row][a.col]=b,this.grid[b.row][b.col]=a;var c=a.row,d=a.col;a.row=b.row,a.col=b.col,b.row=c,b.col=d},this.moveOverlappingItems=function(a,b){b?b.indexOf(a)===-1&&(b=b.slice(0),b.push(a)):b=[a];var c=this.getItems(a.row,a.col,a.sizeX,a.sizeY,b);this.moveItemsDown(c,a.row+a.sizeY,b)},this.moveItemsDown=function(a,b,c){if(a&&0!==a.length){a.sort(function(a,b){return a.row-b.row}),c=c?c.slice(0):[];var d,e,f,g={};for(e=0,f=a.length;e<f;++e){d=a[e];var h=g[d.col];("undefined"==typeof h||d.row<h)&&(g[d.col]=d.row)}for(e=0,f=a.length;e<f;++e){d=a[e];var i=b-g[d.col];this.moveItemDown(d,d.row+i,c),c.push(d)}}},this.moveItemDown=function(a,b,c){if(!(a.row>=b)){for(;a.row<b;)++a.row,this.moveOverlappingItems(a,c);this.putItem(a,a.row,a.col,c)}},this.floatItemsUp=function(){if(this.floating!==!1)for(var a=0,b=this.grid.length;a<b;++a){var c=this.grid[a];if(c)for(var d=0,e=c.length;d<e;++d){var f=c[d];f&&this.floatItemUp(f)}}},this.floatItemUp=function(a){if(this.floating!==!1){for(var b=a.col,c=a.sizeY,d=a.sizeX,e=null,f=null,g=a.row-1;g>-1;){var h=this.getItems(g,b,d,c,a);if(0!==h.length)break;e=g,f=b,--g}null!==e&&this.putItem(a,e,f)}},this.updateHeight=function(a){var b=this.minRows;a=a||0;for(var c=this.grid.length;c>=0;--c){var d=this.grid[c];if(d)for(var e=0,f=d.length;e<f;++e)d[e]&&(b=Math.max(b,c+a+d[e].sizeY))}this.gridHeight=this.maxRows-b>0?Math.min(this.maxRows,b):Math.max(this.maxRows,b)},this.pixelsToRows=function(a,b){return this.outerMargin||(a+=this.margins[0]/2),b===!0?Math.ceil(a/this.curRowHeight):b===!1?Math.floor(a/this.curRowHeight):Math.round(a/this.curRowHeight)},this.pixelsToColumns=function(a,b){return this.outerMargin||(a+=this.margins[1]/2),b===!0?Math.ceil(a/this.curColWidth):b===!1?Math.floor(a/this.curColWidth):Math.round(a/this.curColWidth)}}]).directive("gridsterPreview",function(){return{replace:!0,scope:!0,require:"^gridster",template:'<div ng-style="previewStyle()" class="gridster-item gridster-preview-holder"></div>',link:function(a,b,c,d){a.previewStyle=function(){return d.movingItem?{display:"block",height:d.movingItem.sizeY*d.curRowHeight-d.margins[0]+"px",width:d.movingItem.sizeX*d.curColWidth-d.margins[1]+"px",top:d.movingItem.row*d.curRowHeight+(d.outerMargin?d.margins[0]:0)+"px",left:d.movingItem.col*d.curColWidth+(d.outerMargin?d.margins[1]:0)+"px"}:{display:"none"}}}}}).directive("gridster",["$timeout","$window","$rootScope","gridsterDebounce","$log",function(b,c,d,e,f){return{scope:!0,restrict:"EAC",controller:"GridsterCtrl",controllerAs:"gridster",compile:function(f){return f.prepend('<div ng-if="gridster.movingItem" gridster-preview></div>'),function(f,g,h,i){function j(){a.equals(i.rowHeight,"fit")?b(function(){g.css("height",l.clientHeight)}):g.css("height",i.gridHeight*i.curRowHeight+(i.outerMargin?i.margins[0]:-i.margins[0])+"px")}function k(b){if(i.setOptions(b),m(g[0])){if("auto"===i.width?i.curWidth=g[0].offsetWidth||parseInt(g.css("width"),10):i.curWidth=i.width,"auto"===i.colWidth?i.curColWidth=(i.curWidth+(i.outerMargin?-i.margins[1]:i.margins[1]))/i.columns:i.curColWidth=i.colWidth,i.curRowHeight=i.rowHeight,"string"==typeof i.rowHeight)if("match"===i.rowHeight)i.curRowHeight=Math.round(i.curColWidth);else if(i.rowHeight.indexOf("*")!==-1)i.curRowHeight=Math.round(i.curColWidth*i.rowHeight.replace("*","").replace(" ",""));else if(i.rowHeight.indexOf("/")!==-1)i.curRowHeight=Math.round(i.curColWidth/i.rowHeight.replace("/","").replace(" ",""));else if(a.equals(i.rowHeight,"fit")){var c=l.clientHeight-(i.outerMargin?2*i.margins[1]:0);i.curRowHeight=c/i.maxRows}i.isMobile=i.mobileModeEnabled&&i.curWidth<=i.mobileBreakPoint;for(var d=0,e=i.grid.length;d<e;++d){var f=i.grid[d];if(f)for(var h=0,k=f.length;h<k;++h)if(f[h]){var n=f[h];n.setElementPosition(),n.setElementSizeY(),n.setElementSizeX()}}j()}}i.loaded=!1,i.$element=g,f.gridster=i,g.addClass("gridster");var l=g[0].parentNode,m=function(a){return"hidden"!==a.style.visibility&&"none"!==a.style.display};f.$watch(function(){return i.gridHeight},j),f.$watch(function(){return l.clientHeight},function(){k({}),j()}),f.$watch(function(){return i.movingItem},function(){i.updateHeight(i.movingItem?i.movingItem.sizeY:0)});var n=h.gridster;n?f.$parent.$watch(n,function(a){k(a)},!0):k({}),f.$watch(function(){return i.loaded},function(){i.loaded?(g.addClass("gridster-loaded"),d.$broadcast("gridster-loaded",i)):g.removeClass("gridster-loaded")}),f.$watch(function(){return i.isMobile},function(){i.isMobile?g.addClass("gridster-mobile").removeClass("gridster-desktop"):g.removeClass("gridster-mobile").addClass("gridster-desktop"),d.$broadcast("gridster-mobile-changed",i)}),f.$watch(function(){return i.draggable},function(){d.$broadcast("gridster-draggable-changed",i)},!0),f.$watch(function(){return i.resizable},function(){d.$broadcast("gridster-resizable-changed",i)},!0);var o=g[0].offsetWidth||parseInt(g.css("width"),10),p=function(){var a=g[0].offsetWidth||parseInt(g.css("width"),10);a&&a!==o&&!i.movingItem&&(o=a,i.loaded&&g.removeClass("gridster-loaded"),k(),i.loaded&&g.addClass("gridster-loaded"),d.$broadcast("gridster-resized",[a,g[0].offsetHeight],i))},q=e(function(){p(),b(function(){f.$apply()})},100);f.$watch(function(){return m(g[0])},q),"function"==typeof window.addResizeListener?window.addResizeListener(g[0],q):f.$watch(function(){return g[0].offsetWidth||parseInt(g.css("width"),10)},p);var r=a.element(c);r.on("resize",q),f.$on("$destroy",function(){i.destroy(),r.off("resize",q),"function"==typeof window.removeResizeListener&&window.removeResizeListener(g[0],q)}),b(function(){f.$watch("gridster.floating",function(){i.floatItemsUp()}),i.loaded=!0},100)}}}}]).controller("GridsterItemCtrl",function(){this.$element=null,this.gridster=null,this.row=null,this.col=null,this.sizeX=null,this.sizeY=null,this.minSizeX=0,this.minSizeY=0,this.maxSizeX=null,this.maxSizeY=null,this.init=function(a,b){this.$element=a,this.gridster=b,this.sizeX=b.defaultSizeX,this.sizeY=b.defaultSizeY},this.destroy=function(){this.gridster=null,this.$element=null},this.toJSON=function(){return{row:this.row,col:this.col,sizeY:this.sizeY,sizeX:this.sizeX}},this.isMoving=function(){return this.gridster.movingItem===this},this.setPosition=function(a,b){this.gridster.putItem(this,a,b),this.isMoving()||this.setElementPosition()},this.setSize=function(a,b,c){a=a.toUpperCase();var d="size"+a,e="Size"+a;if(""!==b){b=parseInt(b,10),(isNaN(b)||0===b)&&(b=this.gridster["default"+e]);var f="X"===a?this.gridster.columns:this.gridster.maxRows;this["max"+e]&&(f=Math.min(this["max"+e],f)),this.gridster["max"+e]&&(f=Math.min(this.gridster["max"+e],f)),"X"===a&&this.cols?f-=this.cols:"Y"===a&&this.rows&&(f-=this.rows);var g=0;this["min"+e]&&(g=Math.max(this["min"+e],g)),this.gridster["min"+e]&&(g=Math.max(this.gridster["min"+e],g)),b=Math.max(Math.min(b,f),g);var h=this[d]!==b||this["old"+e]&&this["old"+e]!==b;return this["old"+e]=this[d]=b,this.isMoving()||this["setElement"+e](),!c&&h&&(this.gridster.moveOverlappingItems(this),this.gridster.layoutChanged()),h}},this.setSizeY=function(a,b){return this.setSize("Y",a,b)},this.setSizeX=function(a,b){return this.setSize("X",a,b)},this.setElementPosition=function(){this.gridster.isMobile?this.$element.css({marginLeft:this.gridster.margins[0]+"px",marginRight:this.gridster.margins[0]+"px",marginTop:this.gridster.margins[1]+"px",marginBottom:this.gridster.margins[1]+"px",top:"",left:""}):this.$element.css({margin:0,top:this.row*this.gridster.curRowHeight+(this.gridster.outerMargin?this.gridster.margins[0]:0)+"px",left:this.col*this.gridster.curColWidth+(this.gridster.outerMargin?this.gridster.margins[1]:0)+"px"})},this.setElementSizeY=function(){this.gridster.isMobile&&!this.gridster.saveGridItemCalculatedHeightInMobile?this.$element.css("height",""):this.$element.css("height",this.sizeY*this.gridster.curRowHeight-this.gridster.margins[0]+"px")},this.setElementSizeX=function(){this.gridster.isMobile?this.$element.css("width",""):this.$element.css("width",this.sizeX*this.gridster.curColWidth-this.gridster.margins[1]+"px")},this.getElementSizeX=function(){return this.sizeX*this.gridster.curColWidth-this.gridster.margins[1]},this.getElementSizeY=function(){return this.sizeY*this.gridster.curRowHeight-this.gridster.margins[0]}}).factory("GridsterTouch",[function(){return function(a,b,c,d){var e,f,g={},h=function(a){if(Object.keys)return Object.keys(a).length;var b,c=0;for(b in a)++c;return c},i=function(a){for(var b=0,c=0,d=navigator.userAgent.match(/\bMSIE\b/),e=a;null!=e;e=e.offsetParent)d&&(!document.documentMode||document.documentMode<8)&&"relative"===e.currentStyle.position&&e.offsetParent&&"relative"===e.offsetParent.currentStyle.position&&e.offsetLeft===e.offsetParent.offsetLeft?c+=e.offsetTop:(b+=e.offsetLeft,c+=e.offsetTop);return{x:b,y:c}},j=i(a),k=!1,l=function(e){if("mousemove"!==e.type||0!==h(g)){for(var f=!0,m=e.changedTouches?e.changedTouches:[e],n=0;n<m.length;++n){var o=m[n],p="undefined"!=typeof o.identifier?o.identifier:"undefined"!=typeof o.pointerId?o.pointerId:1;if("undefined"==typeof o.pageX)if(o.pageX=o.offsetX+j.x,o.pageY=o.offsetY+j.y,o.srcElement.offsetParent===a&&document.documentMode&&8===document.documentMode&&"mousedown"===o.type)o.pageX+=o.srcElement.offsetLeft,o.pageY+=o.srcElement.offsetTop;else if(o.srcElement!==a&&!document.documentMode||document.documentMode<8){for(var q=-2,r=-2,s=o.srcElement;null!==s;s=s.parentNode)q+=s.scrollLeft?s.scrollLeft:0,r+=s.scrollTop?s.scrollTop:0;o.pageX=o.clientX+q,o.pageY=o.clientY+r}var t=o.pageX,u=o.pageY;e.type.match(/(start|down)$/i)?(j=i(a),g[p]&&(d&&d({target:e.target,which:e.which,pointerId:p,pageX:t,pageY:u}),delete g[p]),b&&f&&(f=b({target:e.target,which:e.which,pointerId:p,pageX:t,pageY:u})),g[p]={x:t,y:u},a.msSetPointerCapture&&f?a.msSetPointerCapture(p):"mousedown"===e.type&&1===h(g)&&(k?a.setCapture(!0):(document.addEventListener("mousemove",l,!1),document.addEventListener("mouseup",l,!1)))):e.type.match(/move$/i)?!g[p]||g[p].x===t&&g[p].y===u||(c&&f&&(f=c({target:e.target,which:e.which,pointerId:p,pageX:t,pageY:u})),g[p].x=t,g[p].y=u):g[p]&&e.type.match(/(up|end|cancel)$/i)&&(d&&f&&(f=d({target:e.target,which:e.which,pointerId:p,pageX:t,pageY:u})),delete g[p],a.msReleasePointerCapture?a.msReleasePointerCapture(p):"mouseup"===e.type&&0===h(g)&&(k?a.releaseCapture():(document.removeEventListener("mousemove",l,!1),document.removeEventListener("mouseup",l,!1))))}f&&(e.preventDefault&&e.preventDefault(),e.preventManipulation&&e.preventManipulation(),e.preventMouseEvent&&e.preventMouseEvent())}};return this.enable=function(){window.navigator.msPointerEnabled?(a.addEventListener("MSPointerDown",l,!1),a.addEventListener("MSPointerMove",l,!1),a.addEventListener("MSPointerUp",l,!1),a.addEventListener("MSPointerCancel",l,!1),"undefined"!=typeof a.style.msContentZooming&&(e=a.style.msContentZooming,a.style.msContentZooming="none"),"undefined"!=typeof a.style.msTouchAction&&(f=a.style.msTouchAction,a.style.msTouchAction="none")):a.addEventListener?(a.addEventListener("touchstart",l,!1),a.addEventListener("touchmove",l,!1),a.addEventListener("touchend",l,!1),a.addEventListener("touchcancel",l,!1),a.addEventListener("mousedown",l,!1),a.setCapture&&!window.navigator.userAgent.match(/\bGecko\b/)&&(k=!0,a.addEventListener("mousemove",l,!1),a.addEventListener("mouseup",l,!1))):a.attachEvent&&a.setCapture&&(k=!0,a.attachEvent("onmousedown",function(){return l(window.event),window.event.returnValue=!1,!1}),a.attachEvent("onmousemove",function(){return l(window.event),window.event.returnValue=!1,!1}),a.attachEvent("onmouseup",function(){return l(window.event),window.event.returnValue=!1,!1}))},this.disable=function(){window.navigator.msPointerEnabled?(a.removeEventListener("MSPointerDown",l,!1),a.removeEventListener("MSPointerMove",l,!1),a.removeEventListener("MSPointerUp",l,!1),a.removeEventListener("MSPointerCancel",l,!1),e&&(a.style.msContentZooming=e),f&&(a.style.msTouchAction=f)):a.removeEventListener?(a.removeEventListener("touchstart",l,!1),a.removeEventListener("touchmove",l,!1),a.removeEventListener("touchend",l,!1),a.removeEventListener("touchcancel",l,!1),a.removeEventListener("mousedown",l,!1),a.setCapture&&!window.navigator.userAgent.match(/\bGecko\b/)&&(k=!0,a.removeEventListener("mousemove",l,!1),a.removeEventListener("mouseup",l,!1))):a.detachEvent&&a.setCapture&&(k=!0,a.detachEvent("onmousedown"),a.detachEvent("onmousemove"),a.detachEvent("onmouseup"))},this}}]).factory("GridsterDraggable",["$document","$window","GridsterTouch",function(b,c,d){function e(e,f,g,h,i){function j(a){e.addClass("gridster-item-moving"),g.movingItem=h,g.updateHeight(h.sizeY),f.$apply(function(){g.draggable&&g.draggable.start&&g.draggable.start(a,e,i,h)})}function k(a){var b=h.row,d=h.col,j=g.draggable&&g.draggable.drag,k=g.draggable.scrollSensitivity,l=g.draggable.scrollSpeed,m=Math.min(g.pixelsToRows(q),g.maxRows-1),n=Math.min(g.pixelsToColumns(p),g.columns-1),o=g.getItems(m,n,h.sizeX,h.sizeY,h),r=0!==o.length;if(g.swapping===!0&&r){var s=g.getBoundingBox(o),t=s.sizeX===h.sizeX&&s.sizeY===h.sizeY,u=s.row===b,v=s.col===d,w=s.row===m&&s.col===n,x=u||v;if(t&&1===o.length){if(w)g.swapItems(h,o[0]);else if(x)return}else if(s.sizeX<=h.sizeX&&s.sizeY<=h.sizeY&&x)for(var y=h.row<=m?h.row:m+h.sizeY,z=h.col<=n?h.col:n+h.sizeX,A=y-s.row,B=z-s.col,C=0,E=o.length;C<E;++C){var F=o[C],G=g.getItems(F.row+A,F.col+B,F.sizeX,F.sizeY,h);0===G.length&&g.putItem(F,F.row+A,F.col+B)}}g.pushing===!1&&r||(h.row=m,h.col=n),a.pageY-D.body.scrollTop<k?D.body.scrollTop=D.body.scrollTop-l:c.innerHeight-(a.pageY-D.body.scrollTop)<k&&(D.body.scrollTop=D.body.scrollTop+l),a.pageX-D.body.scrollLeft<k?D.body.scrollLeft=D.body.scrollLeft-l:c.innerWidth-(a.pageX-D.body.scrollLeft)<k&&(D.body.scrollLeft=D.body.scrollLeft+l),(j||b!==h.row||d!==h.col)&&f.$apply(function(){j&&g.draggable.drag(a,e,i,h)})}function l(a){e.removeClass("gridster-item-moving");var b=Math.min(g.pixelsToRows(q),g.maxRows-1),c=Math.min(g.pixelsToColumns(p),g.columns-1);g.pushing===!1&&0!==g.getItems(b,c,h.sizeX,h.sizeY,h).length||(h.row=b,h.col=c),g.movingItem=null,h.setPosition(h.row,h.col),f.$apply(function(){g.draggable&&g.draggable.stop&&g.draggable.stop(a,e,i,h)})}function m(b){if(E.indexOf(b.target.nodeName.toLowerCase())!==-1)return!1;var c=a.element(b.target);if(c.hasClass("gridster-item-resizable-handler"))return!1;if(c.attr("onclick")||c.attr("ng-click"))return!1;if(c.closest&&c.closest(".gridster-no-drag").length)return!1;if(g.draggable&&g.draggable.handle){var d=a.element(e[0].querySelectorAll(g.draggable.handle)),f=!1;a:for(var i=0,k=d.length;i<k;++i){var l=d[i];if(l===b.target){f=!0;break}for(var m=b.target,n=0;n<20;++n){var o=m.parentNode;if(o===e[0]||!o)break;if(o===l){f=!0;break a}m=o}}if(!f)return!1}switch(b.which){case 1:break;case 2:case 3:return}return x=b.pageX,y=b.pageY,p=parseInt(e.css("left"),10),q=parseInt(e.css("top"),10),r=e[0].offsetWidth,s=e[0].offsetHeight,t=h.col,u=h.row,j(b),!0}function n(a){if(!e.hasClass("gridster-item-moving")||e.hasClass("gridster-item-resizing"))return!1;var b=g.curWidth-1,c=g.curRowHeight*g.maxRows-1;v=a.pageX,w=a.pageY;var d=v-x+z,f=w-y+A;z=A=0,x=v,y=w;var h=d,i=f;return p+h<C?(d=C-p,z=h-d):p+r+h>b&&(d=b-p-r,z=h-d),q+i<B?(f=B-q,A=i-f):q+s+i>c&&(f=c-q-s,A=i-f),p+=d,q+=f,e.css({top:q+"px",left:p+"px"}),k(a),!0}function o(a){return!(!e.hasClass("gridster-item-moving")||e.hasClass("gridster-item-resizing"))&&(z=A=0,l(a),!0)}var p,q,r,s,t,u,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=b[0],E=["select","option","input","textarea","button"],F=null,G=null;this.enable=function(){if(F!==!0){if(F=!0,G)return void G.enable();G=new d(e[0],m,n,o),G.enable()}},this.disable=function(){F!==!1&&(F=!1,G&&G.disable())},this.toggle=function(a){a?this.enable():this.disable()},this.destroy=function(){this.disable()}}return e}]).factory("GridsterResizable",["GridsterTouch",function(b){function c(c,d,e,f,g){function h(h){function i(a){c.addClass("gridster-item-moving"),c.addClass("gridster-item-resizing"),e.movingItem=f,f.setElementSizeX(),f.setElementSizeY(),f.setElementPosition(),e.updateHeight(1),d.$apply(function(){e.resizable&&e.resizable.start&&e.resizable.start(a,c,g,f)})}function j(a){var b=f.row,i=f.col,j=f.sizeX,k=f.sizeY,l=e.resizable&&e.resizable.resize,m=f.col;["w","nw","sw"].indexOf(h)!==-1&&(m=e.pixelsToColumns(o,!1));var n=f.row;["n","ne","nw"].indexOf(h)!==-1&&(n=e.pixelsToRows(p,!1));var s=f.sizeX;["n","s"].indexOf(h)===-1&&(s=e.pixelsToColumns(q,!0));var t=f.sizeY;["e","w"].indexOf(h)===-1&&(t=e.pixelsToRows(r,!0));var u=n>-1&&m>-1&&s+m<=e.columns&&t+n<=e.maxRows;!u||e.pushing===!1&&0!==e.getItems(n,m,s,t,f).length||(f.row=n,f.col=m,f.sizeX=s,f.sizeY=t);var v=f.row!==b||f.col!==i||f.sizeX!==j||f.sizeY!==k;(l||v)&&d.$apply(function(){l&&e.resizable.resize(a,c,g,f)})}function k(a){c.removeClass("gridster-item-moving"),c.removeClass("gridster-item-resizing"),e.movingItem=null,f.setPosition(f.row,f.col),f.setSizeY(f.sizeY),f.setSizeX(f.sizeX),d.$apply(function(){e.resizable&&e.resizable.stop&&e.resizable.stop(a,c,g,f)})}function l(a){switch(a.which){case 1:break;case 2:case 3:return}return u=e.draggable.enabled,u&&(e.draggable.enabled=!1,d.$broadcast("gridster-draggable-changed",e)),z=a.pageX,A=a.pageY,o=parseInt(c.css("left"),10),p=parseInt(c.css("top"),10),q=c[0].offsetWidth,r=c[0].offsetHeight,s=f.sizeX,t=f.sizeY,i(a),!0}function m(a){var b=e.curWidth-1;x=a.pageX,y=a.pageY;var d=x-z+B,f=y-A+C;B=C=0,z=x,A=y;var g=f,h=d;return w.indexOf("n")>=0&&(r-g<G()?(f=r-G(),C=g-f):p+g<D&&(f=D-p,C=g-f),p+=f,r-=f),w.indexOf("s")>=0&&(r+g<G()?(f=G()-r,C=g-f):p+r+g>E&&(f=E-p-r,C=g-f),r+=f),w.indexOf("w")>=0&&(q-h<H()?(d=q-H(),B=h-d):o+h<F&&(d=F-o,B=h-d),o+=d,q-=d),w.indexOf("e")>=0&&(q+h<H()?(d=H()-q,B=h-d):o+q+h>b&&(d=b-o-q,B=h-d),q+=d),c.css({top:p+"px",left:o+"px",width:q+"px",height:r+"px"}),j(a),!0}function n(a){return e.draggable.enabled!==u&&(e.draggable.enabled=u,d.$broadcast("gridster-draggable-changed",e)),B=C=0,k(a),!0}var o,p,q,r,s,t,u,v,w=h,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=9999,F=0,G=function(){return(f.minSizeY?f.minSizeY:1)*e.curRowHeight-e.margins[0]},H=function(){return(f.minSizeX?f.minSizeX:1)*e.curColWidth-e.margins[1]},I=null;this.enable=function(){I||(I=a.element('<div class="gridster-item-resizable-handler handle-'+w+'"></div>'),c.append(I)),v=new b(I[0],l,m,n),v.enable()},this.disable=function(){I&&(I.remove(),I=null),v.disable(),v=void 0},this.destroy=function(){this.disable()}}var i=[],j=e.resizable.handles;"string"==typeof j&&(j=e.resizable.handles.split(","));for(var k=!1,l=0,m=j.length;l<m;l++)i.push(new h(j[l]));this.enable=function(){if(!k){for(var a=0,b=i.length;a<b;a++)i[a].enable();k=!0}},this.disable=function(){if(k){for(var a=0,b=i.length;a<b;a++)i[a].disable();k=!1}},this.toggle=function(a){a?this.enable():this.disable()},this.destroy=function(){for(var a=0,b=i.length;a<b;a++)i[a].destroy()}}return c}]).factory("gridsterDebounce",function(){return function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}}}).directive("gridsterItem",["$parse","GridsterDraggable","GridsterResizable","gridsterDebounce",function(a,b,c,d){return{scope:!0,restrict:"EA",controller:"GridsterItemCtrl",controllerAs:"gridsterItem",require:["^gridster","gridsterItem"],link:function(e,f,g,h){function i(){o.setPosition(o.row,o.col),r.row&&r.row.assign&&r.row.assign(e,o.row),r.col&&r.col.assign&&r.col.assign(e,o.col)}function j(){var a=o.setSizeX(o.sizeX,!0);a&&r.sizeX&&r.sizeX.assign&&r.sizeX.assign(e,o.sizeX);var b=o.setSizeY(o.sizeY,!0);b&&r.sizeY&&r.sizeY.assign&&r.sizeY.assign(e,o.sizeY),(a||b)&&(o.gridster.moveOverlappingItems(o),n.layoutChanged(),e.$broadcast("gridster-item-resized",o))}function k(){var a=document.createElement("div"),b={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var c in b)if(void 0!==a.style[c])return b[c]}var l,m=g.gridsterItem,n=h[0],o=h[1];if(e.gridster=n,m){var p=a(m);l=p(e)||{},!l&&p.assign&&(l={row:o.row,col:o.col,sizeX:o.sizeX,sizeY:o.sizeY,minSizeX:0,minSizeY:0,maxSizeX:null,maxSizeY:null},p.assign(e,l))}else l=g;o.init(f,n),f.addClass("gridster-item");for(var q=["minSizeX","maxSizeX","minSizeY","maxSizeY","sizeX","sizeY","row","col"],r={},s=[],t=function(b){var c;if("string"==typeof l[b])c=l[b];else if("string"==typeof l[b.toLowerCase()])c=l[b.toLowerCase()];else{if(!m)return;c=m+"."+b}s.push('"'+b+'":'+c),r[b]=a(c);var d=r[b](e);"number"==typeof d&&(o[b]=d)},u=0,v=q.length;u<v;++u)t(q[u]);var w="{"+s.join(",")+"}";e.$watchCollection(w,function(a,b){for(var c in a){var d=a[c],e=b[c];e!==d&&(d=parseInt(d,10),isNaN(d)||(o[c]=d))}}),e.$watch(function(){return o.row+","+o.col},i),e.$watch(function(){return o.sizeY+","+o.sizeX+","+o.minSizeX+","+o.maxSizeX+","+o.minSizeY+","+o.maxSizeY},j);var x=new b(f,e,n,o,l),y=new c(f,e,n,o,l),z=function(){y.toggle(!n.isMobile&&n.resizable&&n.resizable.enabled)};z();var A=function(){x.toggle(!n.isMobile&&n.draggable&&n.draggable.enabled)};A(),e.$on("gridster-draggable-changed",A),e.$on("gridster-resizable-changed",z),e.$on("gridster-resized",z),e.$on("gridster-mobile-changed",function(){z(),A()});var B=d(function(){e.$apply(function(){e.$broadcast("gridster-item-transition-end",o)})},50);return f.on(k(),B),e.$broadcast("gridster-item-initialized",o),e.$on("$destroy",function(){try{y.destroy(),x.destroy()}catch(a){}try{n.removeItem(o)}catch(a){}try{o.destroy()}catch(a){}})}}}]).directive("gridsterNoDrag",function(){return{restrict:"A",link:function(a,b){b.addClass("gridster-no-drag")}}})}); | 3,251.25 | 25,844 | 0.701999 |
c8d97b24c4c462e632328d6c6f86a573d13ac716 | 1,790 | js | JavaScript | utils/backend-helpers/get-todo.js | chanson5000/xilution-react-todomvc | b73e952b8583083dd12dd89b2d5291bd59425c8a | [
"MIT"
] | null | null | null | utils/backend-helpers/get-todo.js | chanson5000/xilution-react-todomvc | b73e952b8583083dd12dd89b2d5291bd59425c8a | [
"MIT"
] | null | null | null | utils/backend-helpers/get-todo.js | chanson5000/xilution-react-todomvc | b73e952b8583083dd12dd89b2d5291bd59425c8a | [
"MIT"
] | null | null | null | require('babel-polyfill');
const {promisify} = require('util');
const AWS = require('aws-sdk');
const prompt = require('prompt');
const index = require('../../dist/backend/index');
const secretsmanager = new AWS.SecretsManager({
region: 'us-east-1'
});
const secretsmanagerGetSecretValueAsync = promisify(secretsmanager.getSecretValue.bind(secretsmanager));
const promptGetAsync = promisify(prompt.get);
const doAuthenticateAsync = promisify(index.doAuthenticate);
const doGetTodo = promisify(index.doGetTodo);
const run = async () => {
const secretsmanagerResponse = await secretsmanagerGetSecretValueAsync({
SecretId: 'XilutionSubscriberApiKey'
});
process.env.XilutionSubscriberApiKey = secretsmanagerResponse.SecretString;
prompt.start();
const input = await promptGetAsync({
properties: {
username: {
required: true
},
// eslint-disable-next-line sort-keys
password: {
hidden: true,
required: true
},
// eslint-disable-next-line sort-keys
id: {
required: true
}
}
});
const authenticationResponse = await doAuthenticateAsync({
body: JSON.stringify({
password: input.password,
username: input.username
})
}, {});
const IdToken = JSON.parse(authenticationResponse.body).IdToken;
return doGetTodo({
headers: {
Authorization: IdToken
},
pathParameters: {
id: input.id
}
}, {});
};
// eslint-disable-next-line no-console
run().then((response) => console.log(`Response: ${JSON.stringify(response, null, 2)}`)).catch((error) => console.error(error));
| 27.121212 | 127 | 0.60838 |
c8da5fe8e1b246a30d30e34b74c4958ea0b06b34 | 1,319 | js | JavaScript | proj/apgsembly-emulator-2/src/components/MUL.js | rei1024/rei1024.github.io | dedad60f4a89eb5374f49cdc4b58966a022d56c9 | [
"MIT"
] | 1 | 2021-12-24T04:33:39.000Z | 2021-12-24T04:33:39.000Z | proj/apgsembly-emulator-2/src/components/MUL.js | rei1024/rei1024.github.io | dedad60f4a89eb5374f49cdc4b58966a022d56c9 | [
"MIT"
] | 1 | 2020-11-12T16:40:59.000Z | 2020-11-13T12:43:13.000Z | proj/apgsembly-emulator-2/src/components/MUL.js | rei1024/rei1024.github.io | dedad60f4a89eb5374f49cdc4b58966a022d56c9 | [
"MIT"
] | null | null | null | // @ts-check
import { MulAction, MUL_0, MUL_1 } from "../actions/MulAction.js";
/**
* `MUL`
*/
export class MUL {
constructor() {
/**
* 0 ~ 31
* @private
*/
this.value = 0;
}
/**
*
* @param {MulAction} act
* @returns {0 | 1}
*/
action(act) {
switch (act.op) {
// MUL0 200740
// MUL1 21110
case MUL_0: return this.mul0();
case MUL_1: return this.mul1();
default: throw Error('MUL: action');
}
}
/**
*
* @returns {number}
*/
getValue() {
return this.value;
}
/**
*
* @returns {0 | 1}
*/
mul0() {
const r = this.value % 2;
this.value = this.value >> 1;
// @ts-ignore
return r;
}
/**
*
* @returns {0 | 1}
*/
mul1() {
const r = this.value % 2;
if (this.value <= 21) {
// (x / 2) + 5
// (x + 10) / 2
this.value = (this.value >> 1) + 5;
} else {
this.value = (this.value - 22) >> 1;
}
// @ts-ignore
return r;
}
/**
*
* @returns {string}
*/
toString() {
return this.value.toString(2).padStart(5, '0');
}
}
| 17.355263 | 66 | 0.380591 |
c8da6ed8bade502877b570ee9a064779a9e0f6b9 | 2,243 | js | JavaScript | src/main/resources/static/js/sensor.js | adriancierpka/ChillImport-1 | 1fc919d1af9a3802b25035aa54911564dfd08bb8 | [
"MIT"
] | null | null | null | src/main/resources/static/js/sensor.js | adriancierpka/ChillImport-1 | 1fc919d1af9a3802b25035aa54911564dfd08bb8 | [
"MIT"
] | null | null | null | src/main/resources/static/js/sensor.js | adriancierpka/ChillImport-1 | 1fc919d1af9a3802b25035aa54911564dfd08bb8 | [
"MIT"
] | null | null | null | /*global addToLog, closeModal*/
function initSensor() {
var data = [ {
id : "",
text : ""
}, {
id : "application/pdf",
text : "application/pdf"
}, {
id : "application/json",
text : "application/json"
}, {
id : "text",
text : "text"
} ];
$("#senEncTypes").select2({
data : data,
placeholder : "Choose an encoding type",
width : "style",
dropdownAutoWidth : true
});
}
function createSensor() {
var name = $("#senname").val();
var desc = $("#sendescription").val();
var encType = $("#senEncTypes").val();
if (!encType || encType === "") {
alert("Choose an encryption type.");
return false;
}
var meta = $("#senmeta").val();
var mySensor = {
name : name,
description : desc,
encoding_TYPE : encType,
metadata : meta
};
var url = document.getElementById("serverurlbox").innerText;
var mydata = {
entity : mySensor,
string : url
};
$
.ajax({
type : "POST",
url : "sensor/create",
datatype : "json",
contentType : "application/json",
data : JSON.stringify(mydata),
error : function(e) {
$
.notify(
{
message : "Sensor could not be created, check the Log for errors"
}, {
allow_dismiss : true,
type : "danger",
placement : {
from : "top",
align : "left"
},
animate : {
enter : "animated fadeInDown",
exit : "animated fadeOutUp"
},
z_index : 9000
});
addToLog(e.responseText);
},
success : function(e) {
$.notify({
message : "Sensor created."
}, {
allow_dismiss : true,
type : "info",
placement : {
from : "top",
align : "left"
},
animate : {
enter : "animated fadeInDown",
exit : "animated fadeOutUp"
},
z_index : 9000
});
addToLog("Sensor created.");
closeModal("dsdialog");
var text = e.name + " (" + e.frostId + ")";
var option = new Option(text, text, null, null);
option.setAttribute("data-value", JSON
.stringify(e, null, 4));
var sensors = $("#streamsensors");
sensors.append(option).trigger("change");
sensors.val(text);
}
});
} | 21.567308 | 75 | 0.52831 |
c8da9f29dbf8cde3f471a213e9a552d0351d6534 | 134 | js | JavaScript | tests/dummy/app/components/first-spell.js | ezpuzz/ember-enchanter | 2a3fe2693dc999259ffcae418521e6bd53784abd | [
"MIT"
] | 1 | 2015-09-02T07:17:36.000Z | 2015-09-02T07:17:36.000Z | tests/dummy/app/components/first-spell.js | ezpuzz/ember-enchanter | 2a3fe2693dc999259ffcae418521e6bd53784abd | [
"MIT"
] | 1 | 2015-08-27T18:00:00.000Z | 2015-09-16T22:59:49.000Z | tests/dummy/app/components/first-spell.js | ezpuzz/ember-enchanter | 2a3fe2693dc999259ffcae418521e6bd53784abd | [
"MIT"
] | 2 | 2015-09-02T07:17:37.000Z | 2018-09-17T23:35:56.000Z | import Spell from 'ember-enchanter/components/enchant-spell';
export default Spell.extend({
pages: ['first-spell.first-page'],
});
| 22.333333 | 61 | 0.738806 |
c8daab5294885f2a5e8522ea237dcb2dda635383 | 15,941 | js | JavaScript | lib/export/src/export-panel.js | ZHONG007/vxe-table | 0b30735e7a23338d6d56d19c735f65c8d7acd664 | [
"MIT"
] | null | null | null | lib/export/src/export-panel.js | ZHONG007/vxe-table | 0b30735e7a23338d6d56d19c735f65c8d7acd664 | [
"MIT"
] | null | null | null | lib/export/src/export-panel.js | ZHONG007/vxe-table | 0b30735e7a23338d6d56d19c735f65c8d7acd664 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _vue = require("vue");
var _xeUtils = _interopRequireDefault(require("xe-utils"));
var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf"));
var _utils = require("../../tools/utils");
var _modal = _interopRequireDefault(require("../../modal/src/modal"));
var _input = _interopRequireDefault(require("../../input/src/input"));
var _checkbox = _interopRequireDefault(require("../../checkbox/src/checkbox"));
var _select = _interopRequireDefault(require("../../select/src/select"));
var _button = _interopRequireDefault(require("../../button/src/button"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default2 = (0, _vue.defineComponent)({
name: 'VxeExportPanel',
props: {
defaultOptions: Object,
storeData: Object
},
setup: function setup(props) {
var $xetable = (0, _vue.inject)('$xetable', {});
var _a = $xetable.getComputeMaps(),
computeExportOpts = _a.computeExportOpts,
computePrintOpts = _a.computePrintOpts;
var reactData = (0, _vue.reactive)({
isAll: false,
isIndeterminate: false,
loading: false
});
var xButtonConfirm = (0, _vue.ref)();
var xInputFilename = (0, _vue.ref)();
var xInputSheetname = (0, _vue.ref)();
var computeCheckedAll = (0, _vue.computed)(function () {
var storeData = props.storeData;
return storeData.columns.every(function (column) {
return column.checked;
});
});
var computeShowSheet = (0, _vue.computed)(function () {
var defaultOptions = props.defaultOptions;
return ['html', 'xml', 'xlsx', 'pdf'].indexOf(defaultOptions.type) > -1;
});
var computeSupportMerge = (0, _vue.computed)(function () {
var storeData = props.storeData,
defaultOptions = props.defaultOptions;
return !defaultOptions.original && defaultOptions.mode === 'current' && (storeData.isPrint || ['html', 'xlsx'].indexOf(defaultOptions.type) > -1);
});
var computeSupportStyle = (0, _vue.computed)(function () {
var defaultOptions = props.defaultOptions;
return !defaultOptions.original && ['xlsx'].indexOf(defaultOptions.type) > -1;
});
var handleOptionCheck = function handleOptionCheck(column) {
var storeData = props.storeData;
var matchObj = _xeUtils.default.findTree(storeData.columns, function (item) {
return item === column;
});
if (matchObj && matchObj.parent) {
var parent_1 = matchObj.parent;
if (parent_1.children && parent_1.children.length) {
parent_1.checked = parent_1.children.every(function (column) {
return column.checked;
});
parent_1.halfChecked = !parent_1.checked && parent_1.children.some(function (column) {
return column.checked || column.halfChecked;
});
handleOptionCheck(parent_1);
}
}
};
var checkStatus = function checkStatus() {
var storeData = props.storeData;
var columns = storeData.columns;
reactData.isAll = columns.every(function (column) {
return column.disabled || column.checked;
});
reactData.isIndeterminate = !reactData.isAll && columns.some(function (column) {
return !column.disabled && (column.checked || column.halfChecked);
});
};
var changeOption = function changeOption(column) {
var isChecked = !column.checked;
_xeUtils.default.eachTree([column], function (item) {
item.checked = isChecked;
item.halfChecked = false;
});
handleOptionCheck(column);
checkStatus();
};
var allColumnEvent = function allColumnEvent() {
var storeData = props.storeData;
var isAll = !reactData.isAll;
_xeUtils.default.eachTree(storeData.columns, function (column) {
if (!column.disabled) {
column.checked = isAll;
column.halfChecked = false;
}
});
reactData.isAll = isAll;
checkStatus();
};
var showEvent = function showEvent() {
(0, _vue.nextTick)(function () {
var filenameInp = xInputFilename.value;
var sheetnameInp = xInputSheetname.value;
var confirmBtn = xButtonConfirm.value;
var targetElem = filenameInp || sheetnameInp || confirmBtn;
if (targetElem) {
targetElem.focus();
}
});
checkStatus();
};
var getExportOption = function getExportOption() {
var storeData = props.storeData,
defaultOptions = props.defaultOptions;
var hasMerge = storeData.hasMerge,
columns = storeData.columns;
var checkedAll = computeCheckedAll.value;
var supportMerge = computeSupportMerge.value;
var expColumns = _xeUtils.default.searchTree(columns, function (column) {
return column.checked;
}, {
children: 'children',
mapChildren: 'childNodes',
original: true
});
return Object.assign({}, defaultOptions, {
columns: expColumns,
isMerge: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false
});
};
var printEvent = function printEvent() {
var storeData = props.storeData;
var printOpts = computePrintOpts.value;
storeData.visible = false;
$xetable.print(Object.assign({}, printOpts, getExportOption()));
};
var exportEvent = function exportEvent() {
var storeData = props.storeData;
var exportOpts = computeExportOpts.value;
reactData.loading = true;
$xetable.exportData(Object.assign({}, exportOpts, getExportOption())).then(function () {
reactData.loading = false;
storeData.visible = false;
}).catch(function () {
reactData.loading = false;
});
};
var cancelEvent = function cancelEvent() {
var storeData = props.storeData;
storeData.visible = false;
};
var confirmEvent = function confirmEvent() {
var storeData = props.storeData;
if (storeData.isPrint) {
printEvent();
} else {
exportEvent();
}
};
var renderVN = function renderVN() {
var defaultOptions = props.defaultOptions,
storeData = props.storeData;
var isAll = reactData.isAll,
isIndeterminate = reactData.isIndeterminate;
var hasTree = storeData.hasTree,
hasMerge = storeData.hasMerge,
isPrint = storeData.isPrint,
hasColgroup = storeData.hasColgroup;
var isHeader = defaultOptions.isHeader;
var cols = [];
var checkedAll = computeCheckedAll.value;
var showSheet = computeShowSheet.value;
var supportMerge = computeSupportMerge.value;
var supportStyle = computeSupportStyle.value;
_xeUtils.default.eachTree(storeData.columns, function (column) {
var colTitle = (0, _utils.formatText)(column.getTitle(), 1);
var isColGroup = column.children && column.children.length;
cols.push((0, _vue.h)('li', {
class: ['vxe-export--panel-column-option', "level--" + column.level, {
'is--group': isColGroup,
'is--checked': column.checked,
'is--indeterminate': column.halfChecked,
'is--disabled': column.disabled
}],
title: colTitle,
onClick: function onClick() {
if (!column.disabled) {
changeOption(column);
}
}
}, [(0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--checked-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--unchecked-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--indeterminate-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--label'
}, colTitle)]));
});
return (0, _vue.h)(_modal.default, {
modelValue: storeData.visible,
title: _conf.default.i18n(isPrint ? 'vxe.export.printTitle' : 'vxe.export.expTitle'),
width: 660,
mask: true,
lockView: true,
showFooter: false,
escClosable: true,
maskClosable: true,
loading: reactData.loading,
'onUpdate:modelValue': function onUpdateModelValue(value) {
storeData.visible = value;
},
onShow: showEvent
}, {
default: function _default() {
return (0, _vue.h)('div', {
class: 'vxe-export--panel'
}, [(0, _vue.h)('table', {
cellspacing: 0,
cellpadding: 0,
border: 0
}, [(0, _vue.h)('tbody', [[isPrint ? (0, _vue.createCommentVNode)() : (0, _vue.h)('tr', [(0, _vue.h)('td', _conf.default.i18n('vxe.export.expName')), (0, _vue.h)('td', [(0, _vue.h)(_input.default, {
ref: xInputFilename,
modelValue: defaultOptions.filename,
type: 'text',
clearable: true,
placeholder: _conf.default.i18n('vxe.export.expNamePlaceholder'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.filename = value;
}
})])]), isPrint ? (0, _vue.createCommentVNode)() : (0, _vue.h)('tr', [(0, _vue.h)('td', _conf.default.i18n('vxe.export.expType')), (0, _vue.h)('td', [(0, _vue.h)(_select.default, {
modelValue: defaultOptions.type,
options: storeData.typeList.map(function (item) {
return {
value: item.value,
label: _conf.default.i18n(item.label)
};
}),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.type = value;
}
})])]), isPrint || showSheet ? (0, _vue.h)('tr', [(0, _vue.h)('td', _conf.default.i18n('vxe.export.expSheetName')), (0, _vue.h)('td', [(0, _vue.h)(_input.default, {
ref: xInputSheetname,
modelValue: defaultOptions.sheetName,
type: 'text',
clearable: true,
placeholder: _conf.default.i18n('vxe.export.expSheetNamePlaceholder'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.sheetName = value;
}
})])]) : (0, _vue.createCommentVNode)(), (0, _vue.h)('tr', [(0, _vue.h)('td', _conf.default.i18n('vxe.export.expMode')), (0, _vue.h)('td', [(0, _vue.h)(_select.default, {
modelValue: defaultOptions.mode,
options: storeData.modeList.map(function (item) {
return {
value: item.value,
label: _conf.default.i18n(item.label)
};
}),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.mode = value;
}
})])]), (0, _vue.h)('tr', [(0, _vue.h)('td', [_conf.default.i18n('vxe.export.expColumn')]), (0, _vue.h)('td', [(0, _vue.h)('div', {
class: 'vxe-export--panel-column'
}, [(0, _vue.h)('ul', {
class: 'vxe-export--panel-column-header'
}, [(0, _vue.h)('li', {
class: ['vxe-export--panel-column-option', {
'is--checked': isAll,
'is--indeterminate': isIndeterminate
}],
title: _conf.default.i18n('vxe.table.allTitle'),
onClick: allColumnEvent
}, [(0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--checked-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--unchecked-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--icon vxe-checkbox--indeterminate-icon'
}), (0, _vue.h)('span', {
class: 'vxe-checkbox--label'
}, _conf.default.i18n('vxe.export.expCurrentColumn'))])]), (0, _vue.h)('ul', {
class: 'vxe-export--panel-column-body'
}, cols)])])]), (0, _vue.h)('tr', [(0, _vue.h)('td', _conf.default.i18n('vxe.export.expOpts')), (0, _vue.h)('td', [(0, _vue.h)('div', {
class: 'vxe-export--panel-option-row'
}, [(0, _vue.h)(_checkbox.default, {
modelValue: defaultOptions.isHeader,
title: _conf.default.i18n('vxe.export.expHeaderTitle'),
content: _conf.default.i18n('vxe.export.expOptHeader'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.isHeader = value;
}
}), (0, _vue.h)(_checkbox.default, {
modelValue: defaultOptions.isFooter,
disabled: !storeData.hasFooter,
title: _conf.default.i18n('vxe.export.expFooterTitle'),
content: _conf.default.i18n('vxe.export.expOptFooter'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.isFooter = value;
}
}), (0, _vue.h)(_checkbox.default, {
modelValue: defaultOptions.original,
title: _conf.default.i18n('vxe.export.expOriginalTitle'),
content: _conf.default.i18n('vxe.export.expOptOriginal'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.original = value;
}
})]), (0, _vue.h)('div', {
class: 'vxe-export--panel-option-row'
}, [(0, _vue.h)(_checkbox.default, {
modelValue: isHeader && hasColgroup && supportMerge ? defaultOptions.isColgroup : false,
title: _conf.default.i18n('vxe.export.expColgroupTitle'),
disabled: !isHeader || !hasColgroup || !supportMerge,
content: _conf.default.i18n('vxe.export.expOptColgroup'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.isColgroup = value;
}
}), (0, _vue.h)(_checkbox.default, {
modelValue: hasMerge && supportMerge && checkedAll ? defaultOptions.isMerge : false,
title: _conf.default.i18n('vxe.export.expMergeTitle'),
disabled: !hasMerge || !supportMerge || !checkedAll,
content: _conf.default.i18n('vxe.export.expOptMerge'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.isMerge = value;
}
}), isPrint ? (0, _vue.createCommentVNode)() : (0, _vue.h)(_checkbox.default, {
modelValue: supportStyle ? defaultOptions.useStyle : false,
disabled: !supportStyle,
title: _conf.default.i18n('vxe.export.expUseStyleTitle'),
content: _conf.default.i18n('vxe.export.expOptUseStyle'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.useStyle = value;
}
}), (0, _vue.h)(_checkbox.default, {
modelValue: hasTree ? defaultOptions.isAllExpand : false,
disabled: !hasTree,
title: _conf.default.i18n('vxe.export.expAllExpandTitle'),
content: _conf.default.i18n('vxe.export.expOptAllExpand'),
'onUpdate:modelValue': function onUpdateModelValue(value) {
defaultOptions.isAllExpand = value;
}
})])])])]])]), (0, _vue.h)('div', {
class: 'vxe-export--panel-btns'
}, [(0, _vue.h)(_button.default, {
content: _conf.default.i18n('vxe.export.expCancel'),
onClick: cancelEvent
}), (0, _vue.h)(_button.default, {
ref: xButtonConfirm,
status: 'primary',
content: _conf.default.i18n(isPrint ? 'vxe.export.expPrint' : 'vxe.export.expConfirm'),
onClick: confirmEvent
})])]);
}
});
};
return renderVN;
}
});
exports.default = _default2; | 39.654229 | 208 | 0.585409 |
c8dac53187a6dce4ae1f0d25727976923146e478 | 673 | js | JavaScript | node_modules/@material-ui/core/es/test-utils/getClasses.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 6 | 2019-04-02T04:11:07.000Z | 2020-12-26T10:30:05.000Z | node_modules/@material-ui/core/es/test-utils/getClasses.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 2 | 2019-08-05T10:19:03.000Z | 2019-11-07T09:17:27.000Z | node_modules/@material-ui/core/es/test-utils/getClasses.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 4 | 2018-08-28T09:09:29.000Z | 2019-11-10T07:36:12.000Z | import _objectSpread from "@babel/runtime/helpers/builtin/objectSpread";
import * as ns from 'react-jss/lib/ns';
import { SheetsRegistry } from 'jss';
import createShallow from './createShallow';
import { sheetsManager } from '../styles/withStyles';
const shallow = createShallow(); // Helper function to extract the classes from a styleSheet.
export default function getClasses(element, options = {}) {
const sheetsRegistry = new SheetsRegistry();
sheetsManager.clear();
shallow(element, _objectSpread({}, options, {
context: _objectSpread({
[ns.sheetsRegistry]: sheetsRegistry
}, options.context)
}));
return sheetsRegistry.registry[0].classes;
} | 39.588235 | 93 | 0.736999 |
c8db0917ee23b2665e8212404cc0ac4665801702 | 1,551 | js | JavaScript | routes/message-api-routes.js | nickfp1985/project2 | c36f0d8faaaeba2665d3fd4a99d88f2d4fe4d5e6 | [
"MIT"
] | null | null | null | routes/message-api-routes.js | nickfp1985/project2 | c36f0d8faaaeba2665d3fd4a99d88f2d4fe4d5e6 | [
"MIT"
] | 5 | 2018-08-22T02:43:58.000Z | 2021-05-07T16:01:37.000Z | routes/message-api-routes.js | nickfp1985/project2 | c36f0d8faaaeba2665d3fd4a99d88f2d4fe4d5e6 | [
"MIT"
] | null | null | null | var db = require("../models");
module.exports = function(app) {
// Get all examples
app.get("/api/messages", function(req, res) {
db.Message.findAll({
order: [["createdAt", "ASC"]]
}).then(function(chitchat) {
res.json(chitchat);
});
});
// Create a new example
app.post("/api/message", function(req, res) {
db.Message.create(req.body).then(function(chitchat) {
res.json(chitchat);
});
});
// Delete an example by id
// app.delete("/api/examples/:id", function(req, res) {
// });
// });
app.get("/api/users", function(req, res) {
// Here we add an "include" property to our options in our findAll query
// We set the value to an array of the models we want to include in a left outer join
// In this case, just db.Post
db.Message.findAll({
}).then(function(dbUser) {
res.json(dbUser);
});
});
app.get("/api/users/:id", function(req, res) {
// Here we add an "include" property to our options in our findOne query
// We set the value to an array of the models we want to include in a left outer join
// In this case, just db.Post
db.Message.findOne({
where: {
id: req.params.id
}
}).then(function(dbUser) {
res.json(dbUser);
});
});
app.delete("/api/users/:id", function(req, res) {
db.Message.destroy({
where: {
id: req.params.id
}
}).then(function(dbUser) {
res.json(dbUser);
});
});
};
// POSSIBLE ADDITIONS
//
// show chats from a specific user | 25.016129 | 89 | 0.58285 |
c8db54142b310ef9bb25c9e16c83a4951ed27d97 | 2,733 | js | JavaScript | packages/SwingSet/test/test-transcript.js | hxrts/agoric-sdk | 75a7402b0e831f67671d5e27c37d87c788d5ad15 | [
"Apache-2.0"
] | null | null | null | packages/SwingSet/test/test-transcript.js | hxrts/agoric-sdk | 75a7402b0e831f67671d5e27c37d87c788d5ad15 | [
"Apache-2.0"
] | null | null | null | packages/SwingSet/test/test-transcript.js | hxrts/agoric-sdk | 75a7402b0e831f67671d5e27c37d87c788d5ad15 | [
"Apache-2.0"
] | null | null | null | import path from 'path';
import { test } from 'tape-promise/tape';
// import fs from 'fs';
import { buildVatController, loadBasedir } from '../src/index';
import { buildStorageInMemory } from '../src/hostStorage';
async function buildTrace(c, storage) {
const states = [];
while (c.dump().runQueue.length) {
states.push(storage.getState());
// eslint-disable-next-line no-await-in-loop
await c.step();
}
states.push(storage.getState());
return states;
}
async function testSaveState(t, withSES) {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
const storage = buildStorageInMemory();
config.hostStorage = storage.storage;
const c1 = await buildVatController(config, withSES, ['one']);
const states1 = await buildTrace(c1, storage);
/*
states1.forEach( (s, i) =>
fs.writeFileSync(`kdata-${i}.json`, JSON.stringify(s))
); */
const storage2 = buildStorageInMemory();
config.hostStorage = storage2.storage;
const c2 = await buildVatController(config, withSES, ['one']);
const states2 = await buildTrace(c2, storage2);
states1.forEach((s, i) => {
t.deepEqual(s, states2[i]);
});
t.end();
}
test('transcript-one save with SES', async t => {
await testSaveState(t, true);
});
test('transcript-one save without SES', async t => {
await testSaveState(t, false);
});
async function testLoadState(t, withSES) {
const config = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
const s0 = buildStorageInMemory();
config.hostStorage = s0.storage;
const c0 = await buildVatController(config, withSES, ['one']);
const states = await buildTrace(c0, s0);
// states.forEach((s,j) =>
// fs.writeFileSync(`kdata-${j}.json`,
// JSON.stringify(states[j])));
for (let i = 0; i < states.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
const cfg = await loadBasedir(
path.resolve(__dirname, 'basedir-transcript'),
);
const s = buildStorageInMemory(states[i]);
cfg.hostStorage = s.storage;
// eslint-disable-next-line no-await-in-loop
const c = await buildVatController(cfg, withSES, ['one']);
// eslint-disable-next-line no-await-in-loop
const newstates = await buildTrace(c, s);
// newstates.forEach((s,j) =>
// fs.writeFileSync(`kdata-${i+j}-${i}+${j}.json`,
// JSON.stringify(newstates[j])));
t.deepEqual(states.slice(i), newstates);
}
t.end();
}
test('transcript-one load with SES', async t => {
await testLoadState(t, true);
});
test('transcript-one load without SES', async t => {
await testLoadState(t, false);
});
| 31.056818 | 72 | 0.640322 |
c8db89f62838069eafbf2816cb0e22718d741bd3 | 20,807 | js | JavaScript | src/App.js | Yokohama-Miyazawa/dora-editor | 18fb227e05770349f0b1544398cf72dc87599505 | [
"MIT"
] | 1 | 2020-07-28T00:16:10.000Z | 2020-07-28T00:16:10.000Z | src/App.js | Yokohama-Miyazawa/dora-editor | 18fb227e05770349f0b1544398cf72dc87599505 | [
"MIT"
] | null | null | null | src/App.js | Yokohama-Miyazawa/dora-editor | 18fb227e05770349f0b1544398cf72dc87599505 | [
"MIT"
] | 1 | 2018-04-27T04:27:06.000Z | 2018-04-27T04:27:06.000Z | import React, { Component } from 'react';
import { connect } from 'react-redux'
import StartButton from './components/Button';
import Column from './components/Column';
import AceEditor from 'react-ace';
import {
playSpeech,
stopSpeech,
playScenario,
stopScenario,
save,
create,
load,
list,
remove,
changeLayout,
setParams,
loadAutostart,
saveAutostart,
} from './reducers'
import './App.css';
import ReactTable from "react-table";
import 'react-table/react-table.css'
import {
Modal,
Button,
} from 'react-bootstrap';
import FileView from './components/FileView';
import parsePath from 'parse-filepath';
import 'brace/mode/plain_text';
import './libs/senario_editor_mode';
import 'brace/theme/monokai';
import 'brace/theme/chrome';
function buttonValue(v, height, host) {
if (typeof v !== 'object') {
return <p> { v } </p>;
}
if (v.image) {
return <div style={{ marginTop: 10, }} >
<img
alt="icon"
style={{
margin: 'auto',
padding: 0,
pointerEvents: 'none',
}}
height={height-4}
src={(host) ? host+v.image : v.image}
/>
</div>
}
return <p> { v.value } </p>;
}
class App extends Component {
constructor(props) {
super(props);
this.state = {
value: '',
log_value: '',
row: 0,
width: window.innerWidth,
height: window.innerHeight,
show_selector: false,
selectedFilename: null,
show_create_file: false,
show_delete_file: false,
show_log_editor: false,
new_filename: '',
}
this.saveTimeout = null;
}
// box() {
// return {
// offsetWidth: this.container.offsetWidth,
// offsetHeight: this.container.offsetHeight,
// }
// }
onResize = () => {
this.props.onLayout({
width: window.innerWidth,
height: window.innerHeight,
});
//this.props.onUpdate(this.box());
}
componentDidMount() {
//this.props.onUpdate(this.box());
window.addEventListener('resize', this.onResize, false);
this.props.loadAutostart();
}
componentWillUnmount() {
//this.props.onUpdate(null);
window.removeEventListener('resize', this.onResize);
}
componentWillReceiveProps(nextProps) {
if (nextProps.text !== this.props.text) {
this.setState({
value: nextProps.text,
});
}
}
onChange = (newValue) => {
this.setState({
value: newValue,
});
if (this.saveTimeout) {
clearTimeout(this.saveTimeout);
}
this.saveTimeout = setTimeout(() => {
this.props.save(this.state.value, (err) => {
if (err.status !== 'OK') {
window.alert('ファイルの保存に失敗しました');
}
this.saveTimeout = null;
});
}, 1000);
}
onLogChange = (newValue) => {
this.setState({
log_value: newValue,
});
}
onCursorChange = (selection, event) => {
const srow = selection.getRange().start.row;
const erow = selection.getRange().end.row;
this.setState({
startRow: srow,
endRow: erow,
row: selection.getSelectionLead().row,
});
}
debug = () => {
}
play = (range) => {
// this.props.playScenario(this.state.value, range, (err, msg) => {
// if (err) {
// window.alert(`${err.info.lineNumber}行目でエラーが発生しました。\n\n${err.info.code}\n\n${err.info.reason}`);
// }
// console.log(msg);
// console.log('END');
// });
this.props.setParams({ playing: true });
this.props.playScenario(this.props.filename, range);
}
playAll = () => {
this.play({});
}
playRange = () => {
if (this.state.startRow === this.state.endRow) {
this.play({ start: this.state.startRow });
} else {
this.play({ start: this.state.startRow, end: this.state.startRow+Math.max(1, this.state.endRow-this.state.startRow) });
}
}
stop = () => {
this.props.stopScenario();
this.props.setParams({ playing: false });
}
_play = (scenario) => {
const s = scenario.map( (v,i) => {
if (v === '' && i > 0) {
return ':1s';
}
return v;
}).join('\n').replace(/(\/\*[^*]*\*\/)|(\/\/.*)/g, '//').trim()
this.props.playSpeech(s);
}
_playAll = () => {
this.play(this.state.value.split('\n'));
}
_playRange = () => {
if (this.state.startRow === this.state.endRow) {
this.play(this.state.value.trim().split('\n').slice(this.state.startRow));
} else {
this.play(this.state.value.trim().split('\n').slice(this.state.startRow, this.state.startRow+Math.max(1, this.state.endRow-this.state.startRow)));
}
}
_stop = () => {
this.props.stopSpeech();
}
rename = () => {
this.setState({
changeName: true,
}, () => {
this.entryName.value = this.props.name;
});
}
startQuiz = () => {
if (this.entryName.value.trim() !== '') {
this.props.setParams({ name: this.entryName.value.trim(), filename: '最初のファイル.txt' }, () => {
this.setState({
changeName: false,
}, () => {
this.props.list(() => {
this.props.load();
});
});
});
}
}
render() {
if (typeof this.props.name === 'undefined' || this.props.name === '' || this.props.name.length <= 1 || this.state.changeName) {
return this.renderTitle({});
}
if (this.state.show_selector) {
return this.renderSelector();
}
return this.renderEditor();
}
renderSelector() {
return (
<div style={{ fontSize: 12, }} >
<div style={{ borderBottom: 'solid 1px gray', }}>
<input style={{ marginLeft: 10, marginRight: 10, }} type="button" value="すべて再生" onClick={this.playAll}/>
<input type="button" value="新規作成" onClick={() => {
this.setState({
show_create_file: true,
new_filename: '',
});
}}/>
<input style={{ marginRight: 10, }} type="button" value="削除" onClick={() => {
this.setState({
show_delete_file: true,
});
}}/>
<select style={{ marginLeft: 10, height: 23,}} value={this.props.filename} onChange={(event) => {
this.props.setParams({ filename: event.target.value }, () => {
this.props.load();
});
}}>
{
(this.props.items) ? this.props.items.map( (p, i) => {
return <option key={i} value={p}> {p} </option>
}) : null
}
</select>
<input type="button" value="編集" onClick={() => {
this.setState({
show_selector: false,
});
}}/>
<input style={{ marginLeft: 10, }} type="button" value="自動起動" onClick={() => {
if (this.props.autostart && this.props.name === this.props.autostart.username && this.props.filename === this.props.autostart.filename) {
this.props.saveAutostart({
}, () => {
this.props.loadAutostart();
})
} else {
this.props.saveAutostart({
username: this.props.name,
filename: this.props.filename,
}, () => {
this.props.loadAutostart();
})
}
}}/>
{
(this.props.loading) ? <span style={{ color: 'blue', fontSize: 12, paddingLeft: 5, paddingRight: 5, }}> {`読み込み中... : ${this.props.filename}`} </span> : null
}
{
(this.props.saving) ? <span style={{ color: 'blue', fontSize: 12, paddingLeft: 5, paddingRight: 5, }}> {`保存中... : ${this.props.filename}`} </span> : null
}
<div style={{ display: 'inline', float: 'right' }}>
<p style={{ display: 'inline', fontSize: 12}}> { this.props.name } </p>
<input style={{ display: 'inline', }} disabled type="button" value="名前の変更" onClick={this.rename}/>
</div>
</div>
<div>
<FileView
styles={{
position: 'absolute',
left: (this.props.width-2-300),
width: 300,
height: this.props.height-40,
}}
subDirectory={`${parsePath(this.state.filename || this.props.filename).name}`}
/>
<ReactTable
style={{
margin: 0,
fontSize: 12,
position: 'absolute',
top: 22,
left: 10,
width: (this.props.width-2-300-10),
height: (this.props.height-40)+"px",
}}
data={this.props.items.map( v => {
return {
filename: v,
}
})}
columns={[{
accessor: 'filename',
Header: 'ファイル名',
Cell: (props) => {
if (this.props.name === this.props.autostart.username && props.value === this.props.autostart.filename) {
return <div style={{color: 'red', fontWeight: 'bold'}}> { props.value } </div>
}
return <div> { props.value } </div>
},
}]}
getTrProps={(state, rowInfo) => {
return {
onClick: () => {
this.props.setParams({ filename: rowInfo.original.filename }, () => {
this.props.load((err) => {
if (err.status !== 'OK') {
window.alert('ファイルの読み込みに失敗しました');
}
});
})
},
style: {
backgroundColor: `${(rowInfo && rowInfo.original.filename === this.props.filename) ? 'lightgreen' : 'inherit'}`,
},
}
}}
className="-striped -highlight"
defaultSorted={[
{
id: "filename",
desc: false,
}
]}
defaultPageSize={100}
/>
</div>
<Modal
show={this.state.show_create_file}
size="lg"
onHide={() => {
this.setState({
show_create_file: false,
});
}}
>
<Modal.Header closeButton>
<Modal.Title>
新規ファイルの作成
</Modal.Title>
</Modal.Header>
<Modal.Body>
<label>ファイル名:</label>
<input
type="text"
style={{ width: '100%', }}
value={this.state.new_filename}
onChange={ (e) => {
this.setState({
new_filename: e.target.value,
})
}}
/>
</Modal.Body>
<Modal.Footer>
<Button onClick={() => {
this.setState({
show_create_file: false,
});
}}>キャンセル</Button>
<Button onClick={() => {
this.setState({
show_create_file: false,
}, () => {
this.props.create(this.state.new_filename, (res) => {
if (res.status !== 'OK' || typeof res.filename === 'undefined' ) {
window.alert('ファイルの保存に失敗しました');
return;
}
this.props.setParams({ filename: res.filename }, () => {
this.props.list((res) => {
if (res.status !== 'OK') {
window.alert('リストの読み込みに失敗しました');
return;
}
this.props.load((res) => {
if (res.status !== 'OK') {
window.alert('ファイルの読み込みに失敗しました');
return;
}
this.setState({
show_selector: false,
});
});
})
})
});
});
}}>作成</Button>
</Modal.Footer>
</Modal>
<Modal
show={this.state.show_delete_file}
size="lg"
onHide={() => {
this.setState({
show_delete_file: false,
});
}}
>
<Modal.Header closeButton>
<Modal.Title>
ファイルの削除
</Modal.Title>
</Modal.Header>
<Modal.Body>
<p style={{ fontSize: 16, marginBottom: 10, }} > ファイルを削除しますか? </p>
<p style={{ color: 'red', fontSize: 16, marginBottom: 10, }} > { this.props.filename } </p>
</Modal.Body>
<Modal.Footer>
<Button onClick={() => {
this.setState({
show_delete_file: false,
});
}}>キャンセル</Button>
<Button onClick={() => {
this.setState({
show_delete_file: false,
}, () => {
this.props.remove(this.props.filename, (res) => {
if (res.status !== 'OK') {
window.alert('ファイルの削除に失敗しました');
return;
}
this.props.list((res) => {
if (res.status !== 'OK') {
window.alert('リストの読み込みに失敗しました');
return;
}
})
});
});
}}>削除</Button>
</Modal.Footer>
</Modal>
</div>
)
}
renderEditor() {
return (
<div style={{ fontSize: 12, }} >
<div style={{ borderBottom: 'solid 1px gray', }}>
<input style={{ marginLeft: 10, marginRight: 10, }} type="button" value="すべて再生" onClick={this.playAll}/>
<input type="button" value="選択範囲を再生" onClick={this.playRange}/>
<input type="button" value="停止" onClick={this.stop}/>
<select style={{ marginLeft: 10, height: 23,}} value={this.props.filename} onChange={(event) => {
this.props.setParams({ filename: event.target.value }, () => {
this.props.load();
});
}}>
{
(this.props.items) ? this.props.items.map( (p, i) => {
return <option key={i} value={p}> {p} </option>
}) : null
}
</select>
<input type="button" value="一覧" onClick={() => {
this.setState({
show_selector: true,
});
}}/>
{/* <input type="button" value="ログ" onClick={() => {
this.setState({
show_log_editor: !(this.state.show_log_editor),
});
}}/> */}
{
(this.props.loading) ? <span style={{ color: 'blue', fontSize: 12, paddingLeft: 5, paddingRight: 5, }}> {`読み込み中... : ${this.props.filename}`} </span> : null
}
{
(this.props.saving) ? <span style={{ color: 'blue', fontSize: 12, paddingLeft: 5, paddingRight: 5, }}> {`保存中... : ${this.props.filename}`} </span> : null
}
{/* <input type="button" value="デバッグ" onClick={this.debug}/> */}
<div style={{ display: 'inline', float: 'right' }}>
<p style={{ display: 'inline', fontSize: 12 }}> { this.props.name } </p>
<input style={{ display: 'inline',}} type="button" value="名前の変更" onClick={this.rename}/>
</div>
</div>
<FileView
styles={{
position: 'absolute',
left: (this.props.width-2-300),
width: 300,
height: this.props.height-40,
}}
subDirectory={`${parsePath(this.state.filename || this.props.filename).name}`}
deleteButton={false}
/>
{
<AceEditor
ref={ r => this.editor = r }
style={{ display: 'inline-block', }}
mode="senario_editor"
theme="monokai"
value={this.state.value}
width={(this.props.width-300)+"px"}
height={(this.props.height-40)+"px"}
onChange={this.onChange}
showPrintMargin={false}
fontSize={18}
onCursorChange={this.onCursorChange}
name="senario_editor"
editorProps={{$blockScrolling: Infinity}}
/>
}
{
(this.state.show_log_editor) ? <AceEditor
ref={ r => this.log_editor = r }
mode="text"
theme="chrome"
value={this.state.log_value}
width="50%"
height={(this.props.height-40)+"px"}
onChange={this.onLogChange}
fontSize={18}
name="log_editor"
style={{ display: 'inline-block', }}
/> : null
}
</div>
)
}
renderTitle() {
return (
<div className="App">
<Column style={{ height: '100%', }}>
<div style={{ margin: 'auto', width: '100%', }}>
<div style={{ marginBottom: 100, }}>
<p style={{
overflow: 'hidden',
fontSize: this.props.fontSize,
textAlign: 'middle',
margin: 8,
flex: 1,
}}> おしゃべりロボエディタ </p>
<div style={{ fontSize: this.props.fontSize*0.5, flex: 1, margin: 30, marginBottom: 0 }}>
<label> あなたの名前: </label>
<input ref={ d => this.entryName = d } type="text" className="Name-Input"/>
</div>
<select name="members" style={{
appearance: 'none',
marginLeft: 100,
marginBottom: 30,
border: '1px solid #999',
//background: '#eee',
width: '25%',
height: 32,
}} onChange={(event) => {
if (event.target.value !== '-') {
this.entryName.value = event.target.value;
}
}}>
{
(this.props.members) ? this.props.members.map( p => {
return <option value={p}> {p} </option>
}) : null
}
</select>
<div style={{
flex: 1,
width: '30%',
margin: 'auto',
}}>
<div>
<StartButton onClick={this.startQuiz}>
{
buttonValue("スタート", this.props.fontSize*4)
}
</StartButton>
</div>
<div>
<form method="GET" action="/logout/editor">
<input className="logoutButton" type="submit" value="logout" />
</form>
</div>
</div>
</div>
</div>
</Column>
</div>
)
}
}
App.defaultProps = {
width: window.innerWidth,
height: window.innerHeight,
fontSize: 16,
}
function makeItems(state) {
const t = (!state.app.items || state.app.items.length <= 0) ? ['最初のファイル.txt'] : state.app.items;
if (!t.some( v => v === '最初のファイル.txt')) {
t.push('最初のファイル.txt');
}
return t;
}
export default connect(
state => ( {
name: state.app.name,
text: state.app.text,
fontSize: state.app.fontSize,
width: state.app.width,
height: state.app.height,
members: state.app.members,
items: makeItems(state),
filename: state.app.filename,
loading: state.app.loading,
saving: state.app.saving,
autostart: {
username: (state.app.autostart) ? state.app.autostart.username : null,
filename: (state.app.autostart) ? state.app.autostart.filename : null,
},
} ),
dispatch => ( {
playSpeech: (text, callback) => dispatch( playSpeech(text, callback) ),
stopSpeech: (text, callback) => dispatch( stopSpeech(text, callback) ),
playScenario: (text, range, callback) => dispatch( playScenario(text, range, callback) ),
stopScenario: (callback) => dispatch( stopScenario(callback) ),
save: (text, callback) => dispatch( save(text, callback) ),
create: (filename, callback) => dispatch( create(filename, callback) ),
remove: (filename, callback) => dispatch( remove(filename, callback) ),
load: (callback) => dispatch( load(callback) ),
list: (callback) => dispatch( list(callback) ),
onLayout: (size) => dispatch( changeLayout(size) ),
setParams: (payload, callback) => dispatch( setParams(payload, callback) ),
loadAutostart: (callback) => dispatch( loadAutostart(callback) ),
saveAutostart: (payload, callback) => dispatch( saveAutostart(payload, callback) ),
})
)(App);
| 31.573596 | 168 | 0.472005 |
c8dbb19598b35e33d733d52fd11d31a4bfde5701 | 56,952 | js | JavaScript | dist/js/cv-mobile-5.5.js | passiweinberger/MOMWorldBrowser | 29951d9255e5f826ab11315560f8b72a1ae1d080 | [
"MIT"
] | null | null | null | dist/js/cv-mobile-5.5.js | passiweinberger/MOMWorldBrowser | 29951d9255e5f826ab11315560f8b72a1ae1d080 | [
"MIT"
] | null | null | null | dist/js/cv-mobile-5.5.js | passiweinberger/MOMWorldBrowser | 29951d9255e5f826ab11315560f8b72a1ae1d080 | [
"MIT"
] | null | null | null | "use strict";
zip.workerScriptsPath = '/lib/zip/';
var oneBlob;
var thisKMZ;
function isUrlValid(url) {
return /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(url);
}
var urlRegex = /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/;
function convertlink(text) {
return text.replace(urlRegex, function (url) {
return '<a href="' + url + '">' + geturl(url) + '</a>';
})
}
function geturl(url){
if (url.length > 20){
return url.substr(0,20) + "...";
} else {
return url;
}
}
// Check for mobile devices, set body class accordingly
function resize() {
var clientHeight = $(window).height(), clientWidth = $(window).width(), mobile = 767, tiny = 481;
$('.control-sidebar').height(clientHeight - 50);
$('.tab-content').height(clientHeight - 100);
$('html').height(clientHeight).width(clientWidth);
$('body').height(clientHeight).width(clientWidth);
if (clientWidth > mobile) {
$('#map').height(clientHeight - 50).width(clientWidth - 50).css('min-height', (clientHeight - 50)).addClass('left-50');
} else {
$('#map').height(clientHeight - 50).width(clientWidth).css('min-height', (clientHeight - 50));
}
if (clientWidth < tiny) {
$('#siderbar-toggle').removeClass('active');
$('.control-sidebar').removeClass('control-sidebar-open');
}
}
$(window).resize(function () {
resize();
});
var _xml = {
_str2xml : function(strXML) {
if (window.ActiveXObject) {
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(strXML);
} else { // code for Mozilla, Firefox, Opera, etc.
var parser=new DOMParser();
var doc=parser.parseFromString(strXML,'text/xml');
}// documentElement always represents the root node
return doc;
},
_xml2string : function(xmlDom){
var strs = null;
var doc = xmlDom.documentElement;
if(doc.xml == undefined) {
strs = (new XMLSerializer()).serializeToString(xmlDom);
} else strs = doc.xml;
return strs;
}
};
// create map
var map = L.map('map', {
center: [40, -100],
zoom: 4,
minZoom: 4,
worldCopyJump: false,
inertia: false
});
map.options.crs = L.CRS.EPSG3857;
// L.esri.basemapLayer("ImageryLabels").addTo(map);
var baseMapUrl = new L.BingLayer('AiQDjsWpddVOFEnVY6j4Jb0S0Hoy9QMa30rvbZT1A8qd0it10NkYAgvb5sa3OeLw', {type: 'AerialWithLabels'}).addTo(map);
/* L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
zIndex: 1,
attribution: '© <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> © <a href="http://cartodb.com/attributions" target="_blank">CartoDB</a>',
subdomains: 'abcd',
maxZoom: 19
}).addTo(map); */
/*
var src = L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
zIndex : 2,
attribution: 'Copyright:© 2013 ESRI, i-cubed, GeoEye',
subdomains: 'abcd',
maxZoom: 19
}).addTo(map);
*/
$('.content-wrapper').show();
resize();
// Set web root url
var homeURL = window.location.protocol + "//" + window.location.host + "/mobile/";
var shareURL = "http://nostradamiq.org/mobile/"; // production
var proxyURL = 'http://climateviewer.org/proxy/proxy'; // production
var activeLayers = {};
var layerEnabled = {}; // whether the label is in some way enabled
var me = Self();
nobjectsIn(layers, function (x) {
//console.log(x);
}, function (s, p, o) {
me.addEdge(s, p, o);
});
var today = new Date();
var yesterday = today.setDate(today.getDate() - 1);
Date.prototype.getJulian = function() {
return Math.floor((this / 86400000) - (this.getTimezoneOffset()/1440) + 2440587.5);
};
var date = new Date();
date.setDate(date.getDate() - 1);
var $input = $( '#datepicker' ).pickadate({
formatSubmit: 'yyyy-mm-dd',
min: [2012, 4, 8],
max: today,
container: '#datepicker-container',
// editable: true,
closeOnSelect: true,
closeOnClear: false
});
var picker = $input.pickadate('picker');
picker.set('select', yesterday);
picker.on({
set: function() {
var selectedDate = picker.get('select', 'yyyy-mm-dd');
console.log(selectedDate);
$('.nasa-gibs.active').each(function () {
loadGIBS($(this).attr('id'), selectedDate);
});
}
});
var start = picker.get('select', 'yyyy-mm-dd');
// GET URL
function getURLParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1));
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
}
function loading(layerId) {
$('.' + layerId + '-load').removeClass('play').addClass('spinner loading active');
}
function loaded(layerId) {
$('.' + layerId + '-load').removeClass('spinner loading').addClass('check');
}
function loadError(layerId, geoDataSrc, error) {
console.log('loading ' + layerId + ' failed: ' + error);
var target = $('#' + layerId);
$('<div class="ui card layer-sliders" style="display:block"><div class="content"><div class="ui divided list"><div class="item"><i class="circular inverted warning icon"></i><div class="content"><div class="header">Load Failed</div>Please use <a href="mailto:info@nostradamiq.org?subject=MOM WorldBrowser broken link - ' + layerId + '&body=Unfortunately this ( ' + geoDataSrc + ' ) URL is not working properly due to ( ' + error + ' ), please look into it. Sent from http://nostradamiq.org/webapp/mobile.html" target="_blank">this link</a> to report this error.<br><br><strong>ERROR:</strong> ' + error + '</div></div></div></div>').appendTo(target);
var icon = $('.' + layerId + '-load');
var span = $('#' + layerId + ' span');
icon.removeClass('spinner loading').addClass('close fail');
span.removeClass('active').addClass('fail');
}
function NSlider(opt) {
var src = opt.src;
var mod = opt.mod;
opt = opt || { };
if (!opt.element) opt.element = $('<div class="item slider"></div>');
if (!opt.min) opt.min = 0;
if (!opt.max) opt.max = 1;
if (!opt.start) opt.start = 1;
if (!opt.label) opt.label = '';
$('<div class="label">' + opt.label + '</div>').appendTo(opt.element);
var slider = $('<input class="' + opt.label + '" type="range">').appendTo(opt.element);
var begin = (opt.start/opt.max)*100;
slider.attr('min', 0);
slider.attr('max', 100);
slider.attr('step', 1);
slider.attr('value', begin);
slider.on("change", function() {
var newValue = slider.val();
var percent = (newValue/100).toFixed( 2 );
var sum = (opt.max * percent);
if (opt.label == 'opacity') src.setOpacity(sum);
//if (opt.label == 'contrast') src.contrast = sum;
//if (opt.label == 'saturation') src.saturation = sum;
//if (opt.label == 'brightness') src.brightness = sum;
//if (opt.label == 'gamma') src.gamma = sum;
});
return opt.element;
}
function loadSliders(src, layerId, datePicker) {
var target = $('#' + layerId + ' .lb');
var sPanel = $('<div class="details ' + layerId + '-sliders layer-sliders" />').insertAfter(target);
var content = $('<div class="slider-content" />').appendTo(sPanel);
var list = $('<div class="ui divided list" />').appendTo(content);
NSlider({ 'label': 'opacity', 'src': src }).appendTo(list);
//NSlider({ 'max': 2, 'label': 'brightness', 'src': src }).appendTo(list);
//NSlider({ 'max': 2, 'label': 'contrast', 'src': src }).appendTo(list);
//NSlider({ 'max': 2, 'label': 'saturation', 'src': src }).appendTo(list);
//NSlider({ 'max': 2, 'label': 'gamma', 'src': src }).appendTo(list);
//src.alpha = 1;
//src.brightness = 1;
//src.contrast = 1;
//src.saturation = 1;
//src.gamma = 1;
var details = $('.' + layerId + '-details');
if (datePicker) {
var dpicker = $('.' + layerId + '-picker');
if (details.is(':visible')) { sPanel.show(); dpicker.show(); }
} else {
if (details.is(':visible')) { sPanel.show(); }
}
loaded(layerId);
}
function loadGIBS(layerId, selectedDate) {
var template = "//map1{s}.vis.earthdata.nasa.gov/wmts-webmerc/" + "{layer}/default/{time}/{tileMatrixSet}/{z}/{y}/{x}.jpg";
if (activeLayers[layerId]) removeImagery(layerId);
var assetLayerGroup = new L.LayerGroup();
var src = L.tileLayer(template, {
layer: layerId,
tileMatrixSet: "GoogleMapsCompatible_Level9",
maxZoom: 9,
time: selectedDate,
tileSize: 256,
subdomains: "abc",
noWrap: true,
continuousWorld: true,
// Prevent Leaflet from retrieving non-existent tiles on the
// borders.
bounds: [
[-85.0511287776, -179.999999975],
[85.0511287776, 179.999999975]
],
attribution:
"<a href='https://wiki.earthdata.nasa.gov/display/GIBS' target='_blank'>" +
"NASA EOSDIS GIBS</a> " +
"<a href='https://github.com/nasa-gibs/web-examples/blob/release/examples/leaflet/webmercator-epsg3857.js' target='_blank'>" +
"View Source" +
"</a>"
});
assetLayerGroup.addLayer(src);
assetLayerGroup.addTo(map);
activeLayers[layerId] = assetLayerGroup;
$('.' + layerId + '-sliders').remove();
loadSliders(src, layerId);
}
function loadWmts(layerId, geoDataSrc, geoLayers) {
var assetLayerGroup = new L.LayerGroup();
var src = viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
url : geoDataSrc,
layers : geoLayers,
style: "",
format: "image/png",
tileMatrixSetID: "GoogleMapsCompatible_Level9",
maximumLevel: 9,
tileWidth: 256,
tileHeight: 256,
tilingScheme: new Cesium.WebMercatorTilingScheme()
}));
assetLayerGroup.addLayer(src);
assetLayerGroup.addTo(map);
activeLayers[layerId] = assetLayerGroup;
loadSliders(src, layerId);
}
function loadWms(layerId, geoDataSrc, geoLayers) {
var assetLayerGroup = new L.LayerGroup();
var src = L.tileLayer.wms(geoDataSrc, {
layers: geoLayers,
format: 'image/png',
transparent: true
// TODO attribution: "Weather data © 2012 IEM Nexrad"
}).setZIndex("200");
assetLayerGroup.addLayer(src);
assetLayerGroup.addTo(map);
activeLayers[layerId] = assetLayerGroup;
loadSliders(src, layerId);
}
function loadOsmLayer(layerId, geoDataSrc) {
var baseLayerGroup = new L.LayerGroup();
var src = L.tileLayer(geoDataSrc + '{z}/{x}/{y}.png', {
zIndex : 2,
attribution: '© <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> © <a href="http://cartodb.com/attributions" target="_blank">CartoDB</a>',
subdomains: 'abcd',
maxZoom: 19
});
baseLayerGroup.addLayer(src);
baseLayerGroup.addTo(map);
activeLayers[layerId] = baseLayerGroup;
loadSliders(src, layerId);
}
function loadCartoDB(layerId, geoDataSrc) {
var baseLayerGroup = new L.LayerGroup();
var src = L.tileLayer(geoDataSrc, {
zIndex: 1,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>',
maxZoom: 19
});
baseLayerGroup.addLayer(src);
baseLayerGroup.addTo(map);
activeLayers[layerId] = baseLayerGroup;
loadSliders(src, layerId);
}
function loadBingLayer(layerId, geoDataSrc) {
var baseLayerGroup = new L.LayerGroup();
var src, bingKey = 'AiQDjsWpddVOFEnVY6j4Jb0S0Hoy9QMa30rvbZT1A8qd0it10NkYAgvb5sa3OeLw';
if (geoDataSrc == 'AERIAL') {
src = new L.BingLayer(bingKey, {type: 'Aerial'});
} else if (geoDataSrc == 'AERIAL_WITH_LABELS') {
src = new L.BingLayer(bingKey, {type: 'AerialWithLabels'});
} else {
src = new L.BingLayer(bingKey, {type: 'Road'});
}
baseLayerGroup.addLayer(src);
baseLayerGroup.addTo(map);
activeLayers[layerId] = baseLayerGroup;
loadSliders(src, layerId);
}
function loadArcGisLayer(layerId, geoDataSrc, geoLayers) {
var baseLayerGroup = new L.LayerGroup();
var src = L.esri.dynamicMapLayer({
url: geoDataSrc,
layers: [geoLayers],
//from: new Date(startTimeInput.value),
//to: new Date(endTimeInput.value)
opacity: 1,
useCors: false
});
// TODO
// http://esri.github.io/esri-leaflet/examples/customizing-popups.html
src.bindPopup(function (error, featureCollection) {
var feature = featureCollection.features[0];
if (feature) console.log(feature.properties);
var title, content;
content = $('<p />');
title = '<h3>Details</h3>';
if (error || featureCollection.features.length === 0) {
return false;
} /* else {
if (feature.properties.HAZARD_NAME) content.append(feature.properties.HAZARD_NAME + '<br>');
if (feature.properties.TYPE) content.append('Hazard Type: ' + feature.properties.TYPE + '<br>');
if (feature.properties['START_DATE']) content.append('Start Date:' + feature.properties["START_DATE"] + '<br>');
if (feature.properties['END_DATE']) content.append('End Date:' + feature.properties["END_DATE"] + '<br>');
if (feature.properties.MAGNITUDE) content.append('<h3>USGS Earthquake Alert</h3>Magnitude: ' + feature.properties.MAGNITUDE + '<br>');
if (feature.properties.DEPTH) content.append('Depth: ' + feature.properties.DEPTH + 'km<br>');
if (feature.properties.referencedate) content.append('Start Time: ' + feature.properties.referencedate + '<br>');
if (feature.properties.todate) content.append('End Time: ' + feature.properties.todate + '<br>');
if (feature.properties.UTC_START) content.append('Issued: ' + feature.properties.UTC_START + '<br>');
if (feature.properties.UTC_END) content.append('Expires: ' + feature.properties.UTC_END + '<br>');
if (feature.properties['Smoke mcgm per m3']) content.append('Smoke mcgm per m3: ' + feature.properties['Smoke mcgm per m3'] + '<br>');
if (feature.properties['EVENT']) content.append(feature.properties["EVENT"] + ' in ' + feature.properties["AREA_DESC"]);
if (feature.properties.CERTAINTY) content.append('Certainty: ' + feature.properties.CERTAINTY + '<br>');
if (feature.properties.SEVERITY) content.append('Severity: ' + feature.properties.SEVERITY + '<br>');
if (feature.properties.INC_DESC) content.append(feature.properties.INC_DESC + '<br>');
if (feature.properties.INC_LINK) content.append('Link: <a href="' + feature.properties.INC_LINK + '" target="_blank">' + feature.properties.INC_LINK + '</a><br>');
if (feature.properties.UTC_ISSUE) content.append('Issued: ' + feature.properties.UTC_ISSUE + '<br>');
if (feature.properties.UTC_EXPIRE) content.append('Expires: ' + feature.properties.UTC_EXPIRE + '<br>');
if (feature.properties.WFILE) content.append('Link: <a href="' + feature.properties.WFILE + '" target="_blank">' + feature.properties.WFILE + '</a><br>');
if (feature.properties.prod_type) content.append('Warning: ' + feature.properties.prod_type + '<br>');
if (feature.properties.starttime) content.append('Start Time: ' + feature.properties.starttime + '<br>');
if (feature.properties.endtime) content.append('End Time: ' + feature.properties.endtime + '<br>');
if (feature.properties.UTC_DATETIME) content.append('Time: ' + feature.properties.UTC_DATETIME + '<br>');
if (feature.properties.HAIL_SIZE) content.append('Hail Size: ' + feature.properties.HAIL_SIZE + ' ”<br>');
if (feature.properties.SPEED) content.append('Wind Speed: ' + feature.properties.SPEED + '<br>');
if (feature.properties["LOCATION"]) content.append('Location: ' + feature.properties["LOCATION"] + ', ');
if (feature.properties["COUNTY"]) content.append(feature.properties["COUNTY"] + ', ');
if (feature.properties["STATE"]) content.append(feature.properties["STATE"] + '<br>');
if (feature.properties['COMMENTS']) content.append('Details: ' + feature.properties['COMMENTS'] + '<br>');
if (feature.properties["Station Identification"]) content.append('Station ID: ' + feature.properties["Station Identification"] + '<br>');
if (feature.properties["Station Name"]) content.append(', ' + feature.properties["Station Name"] + '<br>');
if (feature.properties["Country Name"]) content.append(', ' + feature.properties["Country Name"] + '<br>');
if (feature.properties["Observation Date/Time"]) content.append('Observation Time: ' + feature.properties["Observation Date/Time"] + '<br>');
if (feature.properties["Station Elevation (Meters)"]) content.append('Observation Elevation: ' + feature.properties["Station Elevation (Meters)"] + ' meters elevation.<br>');
if (feature.properties["Wind Speed (km/h)"]) content.append('Wind Speed: ' + feature.properties["Wind Speed (km/h)"] + ' km/h<br>');
if (feature.properties["Wind Gust (km/h)"]) content.append('Wind Gust: ' + feature.properties["Wind Gust (km/h)"] + ' km/h<br>');
if (feature.properties["Air Temperature (°F)"]) content.append('Air Temperature: ' + feature.properties["Air Temperature (°F)"] + ' °F<br>');
if (feature.properties["Dew Point Temperature (°F)"]) content.append('Dew Point Temperature: ' + feature.properties["Dew Point Temperature (°F)"] + ' °F<br>');
if (feature.properties["Relative Humidity (%)"]) content.append('Relative Humidity: ' + feature.properties["Relative Humidity (%)"] + ' %<br>');
if (feature.properties["Altimeter Pressure (Millibars)"]) content.append('Altimeter Pressure: ' + feature.properties["Altimeter Pressure (Millibars)"] + ' Millibars<br>');
if (feature.properties["Horizontal Visibility (Meters)"]) content.append('Horizontal Visibility: ' + feature.properties["Horizontal Visibility (Meters)"] + ' meters.<br>');
if (feature.properties["Sky Conditions"]) content.append('Sky Conditions: ' + feature.properties["Sky Conditions"] + '<br>');
if (feature.properties["Remarks"]) content.append('Remarks: ' + feature.properties["Remarks"] + '<br>');
if (feature.properties["Weather Conditions"]) content.append('Weather Conditions: ' + feature.properties["Weather Conditions"] + '<br>');
if (feature.properties['Brightness T31']) content.append('Time: ' + feature.properties['Acquisition date'] + '<br>Brightness: ' + feature.properties.Brightness + '<br>Brightness T31: ' + feature.properties['Brightness T31'] + '<br>Confidence: ' + feature.properties.Confidence + '%<br>');
if (feature.properties.stormtype) {
if (feature.properties.stormtype == 'HU') {
content.append('Type: Hurricane<br>');
} else {
content.append('Type: ' + feature.properties.stormtype + '<br>');
}
}
if (feature.properties.STORMTYPE) {
if (feature.properties.STORMTYPE == 'HU') {
content.append('Type: Hurricane<br>');
} else {
content.append('Type: ' + feature.properties.stormtype + '<br>');
}
}
if (feature.properties.TCDVLP) content.append(feature.properties.TCDVLP + '<br>');
if (feature.properties.STORMNAME) content.append(feature.properties.STORMNAME + '<br>');
if (feature.properties.stormname) content.append(feature.properties.stormname + '<br>');
if (feature.properties.FLDATELBL) content.append('Time: ' + feature.properties.FLDATELBL + '<br>');
if (feature.properties.GUST) content.append('Gusts: ' + feature.properties.GUST + ' Kts<br>');
if (feature.properties.MAXWIND) content.append('Max Wind Speed: ' + feature.properties.MAXWIND + ' Kts<br>');
if (feature.properties.fldatelbl) content.append('Time: ' + feature.properties.fldatelbl + '<br>');
if (feature.properties.gust) content.append('Gusts: ' + feature.properties.gust + ' Kts<br>');
if (feature.properties.maxwind) content.append('Max Wind Speed: ' + feature.properties.maxwind + ' Kts<br>');
if (feature.properties.url) content.append('Link: <a href="' + feature.properties.url + '" target="_blank">' + feature.properties.url + '</a><br>');
if (feature.properties.URL) content.append('Link: <a href="' + feature.properties.URL + '" target="_blank">' + feature.properties.URL + '</a><br>');
if (feature.properties["SNC_URL"]) content.append('Link: <a href="' + feature.properties["SNC_URL"] + '" target="_blank">' + feature.properties["SNC_URL"] + '</a><br>');
} */
var fContent = $("#feature-content");
var featureDetails = $('<p/>').appendTo(fContent);
$.map(feature.properties, function(index, value) {
$('<strong>' + value + '</strong> • <span>' + (isUrlValid(index) ? '<a href="' + index + '" target="_blank">' + index + '</a>' : index) + '</span><br>').appendTo(featureDetails);
});
$("#featureModal").modal("show").modal({
onHidden: function() {
$('.null').remove();
}
});
}); // end bind popup
baseLayerGroup.addLayer(src);
baseLayerGroup.addTo(map);
activeLayers[layerId] = baseLayerGroup;
loadSliders(src, layerId);
}
function loadArcGisBasemap(layerId, geoDataSrc) {
var baseLayerGroup = new L.LayerGroup();
var src = L.tileLayer(geoDataSrc + '/tile/{z}/{y}/{x}', {
zIndex : 2,
attribution: 'Copyright:© 2013 ESRI, i-cubed, GeoEye',
subdomains: 'abcd',
maxZoom: 19
});
baseLayerGroup.addLayer(src);
baseLayerGroup.addTo(map);
activeLayers[layerId] = baseLayerGroup;
loadSliders(src, layerId);
}
function loadKml(layerId, geoDataSrc, proxy, zoom) {
var assetLayerGroup = new L.LayerGroup();
var proxyKml = (proxyURL + "?" + geoDataSrc);
var loadUrl;
if (proxy) {
loadUrl = proxyKml;
//console.log('loading ' + proxyKml);
} else {
loadUrl = geoDataSrc;
//console.log('loading ' + geoDataSrc);
}
var src;
if (loadUrl.indexOf(".kmz") >= 0 || loadUrl.indexOf("MapServer") >= 0) {
console.log('kmz');
src = new L.KMZ(loadUrl, {
imageOverlayBoundingBoxCreatePopUp: true,
imageOverlayBoundingBoxDrawOptions: {
stroke: true,
weight: 2,
fillOpacity: 0.05,
clickable: true
}
},'KMZ');
} else {
console.log('kml');
src = new L.KML(loadUrl, {async: true});
}
src.on('loaded', function(data) {
$(data.features).each(function(key, data) {
//map.removeLayer(src);
L.KML(data, {
onEachFeature: function (feature, layer) {
if (feature.properties) {
var title, details;
if (feature.properties.title) {
title = '<h3>' + feature.properties.title + '</h3>';
} else if (feature.properties.Name) {
title = '<h3>' + feature.properties.Name + '</h3>';
} else if (feature.properties.name) {
title = '<h3>' + feature.properties.name + '</h3>';
} else if (feature.properties.LICENSEE) {
title = '<h3>' + feature.properties.LICENSEE + '</h3>';
} else {
title = '';
}
if (feature.properties.mag) {
details = '<div>Place: ' + feature.properties.place + '<br>Magnitude: ' + feature.properties.mag + '<br><a href="' + feature.properties.url + '" target="_blank">Click here for more info.</a></div>';
} else if (feature.properties.Description) {
details = '<div>' + feature.properties.Description + '</div>';
} else if (feature.properties.description) {
details = '<div>' + feature.properties.description + '</div>';
} else if (feature.properties.desc) {
details = '<div>' + feature.properties.desc + '</div>';
} else if (feature.properties.FREQUENCY) {
details = '<div>FREQUENCY: ' + feature.properties.FREQUENCY + '<br>CALLSIGN: ' + feature.properties.CALLSIGN + '<br>SERVICE: ' + feature.properties.SERVICE + '<br></div>';
} else {
details = '';
}
convertlink(details);
layer.on({
click: function (e) {
e.preventDefault;
var fContent = $("#feature-content");
fContent.html('<h3>' + title + '</h3>');
fContent.append(details);
$("#featureModal").modal("show");
resize();
}
});
}
//console.log(feature.properties)
}
});
});
assetLayerGroup.addLayer(src);
assetLayerGroup.addTo(map);
activeLayers[layerId] = assetLayerGroup;
loaded(layerId);
if (zoom) {
if (zoom === true) {
map.fitBounds(src.getBounds());
} else {
map.setView(new L.LatLng(40, -100), 3);
}
}
});
}
function loadGeoJson(layerId, geoDataSrc, markerLabel, markerScale, markerImg, zoom, noList) {
var assetLayerGroup = new L.LayerGroup();
var loadUrl = geoDataSrc;
if (noList === false) {
var layerTarget = $('.' + layerId + '-details');
var markerList = $('<div class="details ' + layerId + '-list marker-list" />').insertAfter(layerTarget);
var items = [];
}
var promise = $.getJSON(loadUrl);
// map.removeLayer(layerId);
promise.then(function(data) { //do a bunch of stuff here
$(data.features).each(function(key, data) {
//map.removeLayer(src);
var src = L.geoJson(data, {
pointToLayer: function(feature, latlng) {
var mImg = L.icon({
iconUrl: markerImg,
iconRetinaUrl: markerImg,
iconSize: [32,32],
});
//return new L.CircleMarker(latlng, {radius: 5, fillOpacity: 0.85});
return L.marker(latlng, {
icon: mImg
});
},
onEachFeature: function (feature, layer) {
if (feature.properties) {
var title, details;
if (feature.properties.title) {
title = '<h3>' + feature.properties.title + '</h3>';
} else if (feature.properties.Name) {
title = '<h3>' + feature.properties.Name + '</h3>';
} else if (feature.properties.name) {
title = '<h3>' + feature.properties.name + '</h3>';
} else if (feature.properties.LICENSEE) {
title = '<h3>' + feature.properties.LICENSEE + '</h3>';
} else {
title = '';
}
if (feature.properties.mag) {
details = '<div>Place: ' + feature.properties.place + '<br>Magnitude: ' + feature.properties.mag + '<br><a href="' + feature.properties.url + '" target="_blank">Click here for more info.</a></div>';
} else if (feature.properties.Description) {
details = '<div>' + feature.properties.Description + '</div>';
} else if (feature.properties.description) {
details = '<div>' + feature.properties.description + '</div>';
} else if (feature.properties.desc) {
details = '<div>' + feature.properties.desc + '</div>';
} else if (feature.properties.FREQUENCY) {
details = '<div>FREQUENCY: ' + feature.properties.FREQUENCY + '<br>CALLSIGN: ' + feature.properties.CALLSIGN + '<br>SERVICE: ' + feature.properties.SERVICE + '<br></div>';
} else {
details = '';
}
if (noList === false) {
var latlon = data.geometry.coordinates;
// console.log(latlon);
var lon = latlon[0];
var lat = latlon[1];
//var lon = _.initial(latlon);
//var lat = _.last(latlon);
console.log(lon + " - " + lat);
items.push('<li data-lon="' + lon + '" data-lat="' + lat + '">' + title + '</li>');
}
layer.on({
click: function (e) {
e.preventDefault;
var fContent = $("#feature-content");
fContent.html('<h3>' + title + '</h3>');
fContent.append(details);
$("#featureModal").modal("show");
resize();
}
});
}
//console.log(feature.properties)
}
});
assetLayerGroup.addLayer(src);
assetLayerGroup.addTo(map);
activeLayers[layerId] = assetLayerGroup;
loaded(layerId);
});
if (noList === false) {
$('<ol/>', {
'class': 'markers',
html: items.join('')
}).appendTo(markerList);
$('.markers li').click(function () {
var lon = $(this).attr('data-lon');
var lat = $(this).attr('data-lat');
map.setView(new L.LatLng(lat, lon), 15);
});
}
/* if (zoom) {
if (zoom === true) {
map.fitBounds(src.getBounds());
} else {
map.setView([40, -100], 3);
}
} */
}, function (error) {
loadError(layerId, geoDataSrc, error);
});
};
function removeImagery(layerId) {
var src = activeLayers[layerId];
map.removeLayer(src);
delete activeLayers[layerId];
}
// REMOVE LAYERS
function disableLayer(l) {
var layerId = l.I;
var mlt = l.T;
if (layerEnabled[l.I] === undefined) return;
// Update Globe
if (mlt === ("nasa-gibs") || mlt === ("cartodb-layer") || mlt === ("wmts") || mlt === ("wms") || mlt === ("base-layer") || mlt === ("arcgis") || mlt === ("arcgis-layer") ) {
//removeImagery(layerId);
$('.' + layerId + '-sliders').remove();
$('.' + layerId + '-picker').remove();
var src = activeLayers[layerId];
map.removeLayer(src);
delete activeLayers[layerId];
} else {
var src = activeLayers[layerId];
map.removeLayer(src);
delete activeLayers[layerId];
}
if (mlt === ("geojson")) {
$('.' + layerId + '-list').remove();
}
delete layerEnabled[layerId];
}
// LOAD LAYERS
function updateLayer(layerId) {
loading(layerId);
var l = me.node(layerId);
if (!l) {
console.error('missing layer', layerId);
//return false;
}
var geoDataSrc = l.G,
geoLayers = l.L,
//source = l.S,
markerMod = l.M,
markerImg = l.MI,
markerScale = l.MS,
markerLabel = l.ML,
noList = l.Y,
proxy = l.P;
var selectedDate = picker.get('select', 'yyyy-mm-dd');
if (!includeOnly) var zoom = l.Z;
if (noList) {
noList = true;
} else {
noList = false;
}
if (layerEnabled[layerId] === undefined) {
//put it in a temporary state to disallow loading while loading
layerEnabled[layerId] = false;
// Load layers by Type
if (l.T === ("wms")) {
loadWms(layerId, geoDataSrc, geoLayers);
} else if (l.T === ("wtms")) {
loadGIBS(layerId);
} else if (l.T === ("nasa-gibs")) {
loadGIBS(layerId, selectedDate);
} else if (l.T === ("wtms")) {
loadWmts(layerId, geoDataSrc, geoLayers);
} else if (l.T === ("cartodb-layer")) {
loadCartoDB(layerId, geoDataSrc);
} else if (l.T === ("base-layer")) {
loadOsmLayer(layerId, geoDataSrc);
} else if (l.T === ("arcgis")) {
loadArcGisBasemap(layerId, geoDataSrc);
} else if (l.T === ("arcgis-layer")) {
loadArcGisLayer(layerId, geoDataSrc, geoLayers);
} else if (l.T === ("geojson")) {
loadGeoJson(layerId, geoDataSrc, markerLabel, markerScale, markerImg, zoom, noList);
} else if (l.T === ('kml')) {
loadKml(layerId, geoDataSrc, proxy, zoom, markerImg, markerScale, markerLabel, markerMod);
} else if (l.T === ('bing')) {
loadBingLayer(layerId, geoDataSrc, geoLayers);
} else {
console.log(layerId + ' failed to load map type: ' + l.T);
}
shareLink();
// if (timeline) toggleTimeline(true);
}
}
function newFolderLabel(l, child, ic) {
if (ic) {
var icon = '<i class="fa fa-fw ' + ic + '"></i>'
} else {
icon = ''
}
var menuToggle = $('<h2>').addClass('toggle').html(icon + l.N).click(function () {
if (child.is(':visible')) {
child.hide();
menuToggle.removeClass('active');
}
else {
child.show();
menuToggle.addClass('active');
}
});
return menuToggle;
}
function initDetails(layerId, layerType, details, source, sourceUrl, geoDataSrc) {
var list = $('<div class="details ' + layerId + '-content" />').appendTo(details);
$('<div class="header"><i class="fa fa-fw fa-info-circle"></i> Layer Details</div><span>' + source + ' • <a href="' + sourceUrl + '" target="_blank" rel="nofollow">More Info</a></span>').appendTo(list);
if (layerType == ('kml')) {
$('<div class="header"><i class="fa fa-fw fa-download"></i> Data Source</div><span>Keyhole Markup Language (KML) • <a href="' + geoDataSrc + '">Download</a></span>').appendTo(list);
}
if (layerType == ('geojson')) {
$('<div class="header"><i class="fa fa-fw fa-download"></i> Data Source</div><span>GeoJSON • <a href="' + geoDataSrc + '">Download</a></span>').appendTo(list);
}
if (layerType == ('nasa-gibs')) {
$('<div class="header"><i class="fa fa-fw fa-file-o"></i> Data Source</div><span>Web Map Tile Service (WMTS)</span>').appendTo(list);
}
if (layerType == ('wms')) {
$('<div class="header"><i class="fa fa-fw fa-file-o"></i> Data Source</div><span>Web Mapping Service (WMS)<br><a target="_blank" rel="nofollow" href="' + geoDataSrc + '?request=GetCapabilities&service=WMS">Get Capabilities</a></span>').appendTo(list);
}
if (layerType == ('base-layer')) {
$('<div class="header"><i class="fa fa-fw fa-file-o"></i> Data Source</div><span>OpenStreetMap (OSM) Base Map</span>').appendTo(list);
}
if (layerType == ('arcgis') || layerType == ('arcgis-layer')) {
$('<div class="header"><i class="fa fa-fw fa-file-o"></i> Data Source</div><span>ArcGIS MapServer<br><a target="_blank" rel="nofollow" href="' + geoDataSrc + '/legend">Map Legend</a> • <a target="_blank" rel="nofollow" href="' + geoDataSrc + '">MapServer Information</a></span>>').appendTo(list);
}
$('<div class="details-bottom-content"><a href="' + homeURL + 'index.html?layersOn=' + layerId + '" class="pull-right" target="_self">Share Link</a><a href="mailto:info@nostradamiq.org?subject=MOM WorldBrowser broken link - ' + layerId + '&body=Unfortunately this ( ' + geoDataSrc + ' ) URL is not working properly, please look into it. Sent from http://climateviewer.com/3D/" target="_self">Report Error</a></div>').appendTo(details);
//shareLink();
}
function addTree(parent/* nodes */, lb /*target */, includeOnly) {
var layers = me.successors(parent);
_.each(layers, function (l) {
var h = me.node(l),
content,
layerId = h.I,
layerType = h.T;
var child = $('<div class="folder" />').html(h);
if (!h.T) {
var ic = h.icon;
//Folder Label
content = newFolderLabel(h, child, ic);
} else { // not a folder
var present = true;
if (present) {
var geoDataSrc = h.G,
source = h.S,
sourceUrl = h.U,
largeLayer = h.H,
newLayer = h.NL,
timeline = h.C,
layerButton, details, loadIcon, optIcon, label;
content = $('<div>').data('l', h).attr('id', h.I).addClass('lbw').addClass(h.T); //layer button wrapper
layerButton = $('<div>').addClass('lb').appendTo(content); // layer button
//expand layer options
optIcon = $('<i>').addClass('fa fa-fw fa-folder-o').toggle(
function () {
if (details.children().length == 0) {
initDetails(layerId, layerType, details, source, sourceUrl, geoDataSrc);
}
details.show();
details.focus();
optIcon.removeClass('fa-folder-o').addClass('fa-folder-open-o active');
$('.' + h.I + '-sliders').show();
$('.' + h.I + '-picker').show();
},
function () {
$('.' + h.I + '-sliders').hide();
$('.' + h.I + '-picker').hide();
details.hide();
optIcon.removeClass('fa-folder-open-o active').addClass('fa-folder-o');
}
).appendTo(layerButton);
loadIcon = $('<i class="fa fa-fw fa-play ' + layerId + '-load"></i>');
if (largeLayer) loadIcon.addClass('large-layer');
if (newLayer) loadIcon.addClass('new-layer');
loadIcon.toggle(
function () {
setTimeout(function() {
if (loadIcon.hasClass('fa-play')) {
if (includeOnly) {
updateLayer(layerId, includeOnly);
} else {
updateLayer(layerId);
} if (details.is(':visible')) $('.' + h.I + '-picker').show();
if (!label.hasClass('active')) label.addClass('active');
if (!content.hasClass('active')) content.addClass('active');
if (timeline) toggleTimeline(true);
}
});
},
function () {
setTimeout(function() {
if (loadIcon.hasClass('check')) {
disableLayer(h);
loadIcon.removeClass('check active').addClass('play');
$('.' + h.I + '-picker').hide();
if (label.hasClass('active')) label.removeClass('active');
if (content.hasClass('active')) content.removeClass('active');
}
});
}
).appendTo(layerButton);
label = $('<span>').html(h.N).addClass('label');
label.toggle(
function () {
if (!label.hasClass('fail')) {
if (!label.hasClass('active'))
label.addClass('active');
loadIcon.trigger('click');
}
},
function () {
if (!label.hasClass('fail')) {
if (label.hasClass('active'))
label.removeClass('active');
loadIcon.trigger('click');
}
}
).appendTo(layerButton);
details = $('<div class="ui card ' + layerId + '-details layer-details" />').appendTo(content);
details.hide(); //begin hidden
} // end present
}
if (content != null) {
lb.append(content);
var ll = addTree(h.I, child, includeOnly);
if (ll.length) {
lb.append(child);
}
}
});
return layers;
}
/* Build Sidebar */
function initLayers(includeOnly) {
var lb = $('#map-layers');
if (includeOnly) {
_.each(me.sources(), function (s) {
addTree(s, lb, includeOnly);
});
} else {
_.each(me.sources(), function (s) {
addTree(s, lb);
});
}
}
$('.do-video').one("click", function() {
$('.do-video-div').append('<div class="videoWrapper"><iframe width="420" height="236" src="https://www.youtube-nocookie.com/embed/ZwFmez0ef6A" frameborder="0" allowfullscreen></iframe></div>');
});
// CHECK URL
var initialLayers = (getURLParameter("layersOn") || '').split(',');
var disabledLayers = (getURLParameter("layersOff") || '').split(",");
if (initialLayers[0] === '') initialLayers = [];
if (disabledLayers[0] === '') disabledLayers = [];
var allLayers = initialLayers.concat(disabledLayers);
// LOAD LAYERS
if (allLayers.length > 0) {
var latView = (getURLParameter("lat") || '40');
var lonView = (getURLParameter("lon") || '-100');
var zoomView = (getURLParameter("zoom") || '5');
var dateView = (getURLParameter("date") || start);
if (dateView !== start) {
picker.set('select', dateView, { format: 'yyyy-mm-dd' })
}
if (latView !== '40') {
var includeOnly = true;
initLayers(includeOnly);
map.setView(new L.LatLng(latView, lonView), zoomView);
} else {
initLayers();
}
var shared = $('<div class="folder" style="display: block;"></div>').prependTo('#map-layers');
$('<h2 class="toggle active">Shared Layers</h2>').prependTo('#map-layers').show();
for (var i = 0; i < allLayers.length; i++) {
$('#' + allLayers[i]).detach().appendTo(shared).show();
}
for (var i = 0; i < initialLayers.length; i++) {
$('.' + initialLayers[i] + '-load').click();
}
$('div.folder:empty').prev().remove();
$('div.folder:empty').remove();
} else {
initLayers();
}
function shareLink() {
var layers = "";
var url = homeURL;
var ll = $('.lbw');
ll.each(function() {
var X = $(this);
if (X.hasClass('active')) {
var L = X.attr('id');
layers += L + ',';
}
});
url += 'index.html?';
if (layers.length > 0)
layers = layers.substring(0, layers.length-1);
url += 'layersOn=' + layers;
var shareToggle = $('.share-all-layers');
shareToggle.attr('href', url).html(url);
}
// LAYER FOOTER BUTTONS
$('.clear-layers').click(function (e) {
e.preventDefault();
$('i.active').trigger('click');
});
$('.collapse-menu').click(function (e) {
e.preventDefault();
$('.fa-folder-open-o.active').trigger('click');
$('.folder h2.active').trigger('click');
$('h2.active').trigger('click');
});
$('.top-layers').click(function (e) {
e.preventDefault();
$('.tab-content').animate({
scrollTop: ($('#top').offset().top - 90)
}, 500);
});
$('.about-jim').click(function () {
window.location = 'http://climateviewer.com/rezn8d/';
});
// SIDEBAR CONTROL & MAIN SCREEN BUTTONS
$('.reset-view').click(function (e) {
e.preventDefault();
map.setView([40, -100], 3);
});
$('.sharing-tab').click(function () {
$('#welcomeModal').modal('hide').on('hidden.bs.modal', function () {
$('a[href="#control-sidebar-share-tab"]').tab('show');
$('#sharing-tab').click();
});
});
$('.instructions').click(function () {
$('#welcomeModal').modal('hide').on('hidden.bs.modal', function () {
$('a[href="#control-sidebar-about-tab"]').tab('show');
$('#CV-about').click();
});
});
$('.report-tab').click(function (e) {
e.preventDefault();
var clientWidth = $(window).width(),
clientHeight = $(window).height();
if (clientWidth < 1024) {
window.open('https://climateviewer.crowdmap.com/', '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=' + clientHeight + ',width=' + clientWidth + '');return false;
} else {
window.open('https://climateviewer.crowdmap.com/', '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=800,width=1024');return false;
}
});
$(document).ready(function () {
$('#CV-TV').one('click', function () {
$('#load-youtube').html('<div class="videoWrapper"><iframe width="560" height="315" src="http://www.youtube.com/embed/videoseries?list=UUxi8wqtADZckzLvWqkW5Kvg" frameborder="0" allowfullscreen=""></iframe></div>');
$('#load-twitter').html('<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/rezn8d" data-widget-id="426353335990353920">Tweets by @rezn8d</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>');
});
if ($(".resources-intro")) {
var clientHeight = $(window).height();
$('.resources-intro').height(clientHeight);
}
var config = {
siteURL: 'climateviewer.com', // Change this to your site
blogURL: 'climateviewer.org', // Change this to your site
searchSite: true,
type: 'web',
append: false,
perPage: 8, // A maximum of 8 is allowed by Google
page: 0 // The start page
}
// The small arrow that marks the active search icon:
// Adding the site domain as a label for the first radio button:
$('#siteNameLabel').append(' ' + config.siteURL);
$('#search').click(function () {
$('#searchInContainer').slideDown("slow");
})
$('#searchForm').submit(function () {
googleSearch();
return false;
});
$('#searchSite,#searchWeb').change(function () {
// Listening for a click on one of the radio buttons.
// config.searchSite is either true or false.
config.searchSite = this.id == 'searchSite';
});
function googleSearch(settings) {
// If no parameters are supplied to the function,
// it takes its defaults from the config object above:
settings = $.extend({}, config, settings);
settings.term = settings.term || $('#search').val();
if (settings.searchSite) {
// Using the Google site:example.com to limit the search to a
// specific domain:
settings.term = 'site:' + settings.siteURL + ' ' + settings.term;
} else {
settings.term = 'site:' + settings.blogURL + ' ' + settings.term;
}
// URL of Google's AJAX search API
var apiURL = 'http://ajax.googleapis.com/ajax/services/search/' + settings.type + '?v=1.0&callback=?';
var resultsDiv = $('#resultsDiv');
$.getJSON(apiURL, {
q: settings.term,
rsz: settings.perPage,
start: settings.page * settings.perPage
}, function (r) {
var results = r.responseData.results;
$('#more').remove();
if (results.length) {
// If results were returned, add them to a pageContainer div,
// after which append them to the #resultsDiv:
var pageContainer = $('<div>', {className: 'pageContainer'});
for (var i = 0; i < results.length; i++) {
// Creating a new result object and firing its toString method:
pageContainer.append(new result(results[i]) + '');
}
if (!settings.append) {
// This is executed when running a new search,
// instead of clicking on the More button:
resultsDiv.empty();
}
pageContainer.append('<div class="clear"></div>')
.hide().appendTo(resultsDiv)
.fadeIn('slow');
var cursor = r.responseData.cursor;
// Checking if there are more pages with results,
// and deciding whether to show the More button:
if (+cursor.estimatedResultCount > (settings.page + 1) * settings.perPage) {
$('<div>', {id: 'more'}).html('<div class="btn btn-default">More</div>').appendTo(resultsDiv).click(function () {
googleSearch({append: true, page: settings.page + 1});
$(this).fadeOut();
});
}
$('#searchModal').modal();
}
else {
// No results were found for this search.
resultsDiv.empty();
$('<p>', {className: 'notFound', html: 'No Results Were Found!'}).hide().appendTo(resultsDiv).fadeIn();
$('#searchModal').modal();
}
});
}
function result(r) {
// This is class definition. Object of this class are created for
// each result. The markup is generated by the .toString() method.
var arr = [];
// GsearchResultClass is passed by the google API
switch (r.GsearchResultClass) {
case 'GwebSearch':
arr = [
'<div class="webResult">',
'<h2><a href="', r.unescapedUrl, '" target="_blank">', r.title, '</a></h2>',
'<p>', r.content, '<br><a href="', r.unescapedUrl, '" target="_blank">', r.visibleUrl, '</a></p>',
'</div>'
];
break;
}
// The toString method.
this.toString = function () {
return arr.join('');
}
}
$('#map').click(function () {
if ($('.control-sidebar').hasClass('control-sidebar-open')) {
$('#siderbar-toggle').click();
}
});
// TODO
//$('#welcomeModal').modal();
toggleTimeline(false);
resize();
if ($('.control-sidebar').hasClass('control-sidebar-open')) {
$('#siderbar-toggle').addClass('active');
}
function shareLink() {
var layers = "";
var shareLink = shareURL;
var ll = $('.lbw');
ll.each(function() {
var X = $(this);
if (X.hasClass('active')) {
var L = X.attr('id');
layers += L + ',';
}
});
var lat = map.getCenter().lat;
var lon = map.getCenter().lng;
var zoom = map.getZoom();
var date = picker.get('select', 'yyyy-mm-dd');
shareLink += 'index.html?';
if (layers.length > 0)
layers = layers.substring(0, layers.length-1);
shareLink += 'layersOn=' + layers;
shareLink += '&lat=' + lat;
shareLink += '&lon=' + lon;
shareLink += '&zoom=' + zoom;
shareLink += '&date=' + date;
var shareToggle = $('.share-all-layers');
shareToggle.attr('href', shareLink).html(shareLink);
var encodeLink = encodeURIComponent(shareLink);
console.log(encodeLink);
function bit_url(shareLink)
{
var url=shareLink;
console.log(url);
var username="r3zn8d"; // bit.ly username
var key="b5c2d6d1704074b0741a7449a98e3fcef2790699";
$.ajax({
url:"https://api-ssl.bitly.com/v3/shorten",
data:{longUrl:url,access_token:key,login:username},
dataType:"jsonp",
success:function(v)
{
var bit_url=v.data.url;
$("#result").html('<a href="'+bit_url+'" target="_self">'+bit_url+'</a>');
}
});
}
bit_url(shareLink);
}
$('.share-active-layers').click( function(e){
e.preventDefault();
shareLink();
$('#shareModal').modal();
});
});
| 43.047619 | 1,212 | 0.531096 |
c8dcab9a469da6183eb4f77c4883d97cc16b623b | 498 | js | JavaScript | public/js/user/tabbarclick.js | JasonCai1204/zl-my | 78a55d99078c751752f0460dd8f84ae775d7562f | [
"MIT"
] | null | null | null | public/js/user/tabbarclick.js | JasonCai1204/zl-my | 78a55d99078c751752f0460dd8f84ae775d7562f | [
"MIT"
] | null | null | null | public/js/user/tabbarclick.js | JasonCai1204/zl-my | 78a55d99078c751752f0460dd8f84ae775d7562f | [
"MIT"
] | 2 | 2017-06-06T08:21:35.000Z | 2021-01-02T07:34:11.000Z | /**
* Created by xiaoguoquan on 2016/11/9.
*/
$(function () {
if($(".weui-tabbar__item").length == 4){
$(".weui-tabbar__item").siblings().removeClass('my_tabbar_click');
var itemarr = ['container_home','container_news','container_recommend','container_user'];
var itemid = $(".container").attr("id");
var index = itemarr.indexOf(itemid);
$(".weui-tabbar__item").eq(index).addClass('my_tabbar_click').siblings().removeClass('my_tabbar_click');
}
}) | 38.307692 | 112 | 0.63253 |
c8dcf31124d4db76a00cd2d4f29a4042d603d3c9 | 4,503 | js | JavaScript | client/src/components/MarketValue.js | AnshuJalan/newton | 7caaae6cfc6a5663e509538105d6c0144d86b3a9 | [
"MIT"
] | 2 | 2021-04-08T02:05:18.000Z | 2022-03-28T22:43:36.000Z | client/src/components/MarketValue.js | AnshuJalan/newton | 7caaae6cfc6a5663e509538105d6c0144d86b3a9 | [
"MIT"
] | 2 | 2020-07-25T04:34:33.000Z | 2021-09-02T13:15:57.000Z | client/src/components/MarketValue.js | AnshuJalan/newton | 7caaae6cfc6a5663e509538105d6c0144d86b3a9 | [
"MIT"
] | 1 | 2020-08-27T17:53:45.000Z | 2020-08-27T17:53:45.000Z | import React, { Component } from 'react';
import getWeb3 from '../getWeb3';
import UsingPriceFeed from '../contracts/UsingPriceFeed.json';
class MarketValue extends Component {
state = {
web3: null,
eth: 235.25,
ethColor: '',
ethSign: '',
dai: 1.0025,
daiSign: '',
daiColor: '',
ethdai: 235.14,
ethdaiSign: '',
ethDiff: 1.2,
ethdaiColor: '',
daiDiff: 0.005,
ethdaiDiff: 1.3,
};
componentDidMount = async () => {
const web3 = this.props.web3;
const networkId = this.props.networkId;
const address = UsingPriceFeed.networks[networkId].address;
const instance = new web3.eth.Contract(UsingPriceFeed.abi, address);
this.setState({ web3, contract: instance }, () => {
this.updateData();
setInterval(this.updateData, 30000);
});
};
updateData = async () => {
const ethList = await this.state.contract.methods.getEthRange().call();
let eth = ethList[1] / 1000000;
let ethDiff = ((ethList[1] - ethList[0]) / 1000000).toFixed(1);
let ethSign;
let ethColor;
if (ethDiff >= 0) {
ethSign = 'fa fa-caret-up';
ethColor = 'text-success';
} else {
ethSign = 'fa fa-caret-down';
ethColor = 'text-danger';
}
ethDiff = Math.abs(ethDiff);
const daiList = await this.state.contract.methods.getDaiRange().call();
let dai = daiList[1] / 1000000;
let daiDiff = ((daiList[1] - daiList[0]) / 1000000).toFixed(6);
let daiSign;
let daiColor;
if (daiDiff >= 0) {
daiSign = 'fa fa-caret-up';
daiColor = 'text-success';
} else {
daiSign = 'fa fa-caret-down';
daiColor = 'text-danger';
}
daiDiff = Math.abs(daiDiff);
let ethdai = ethList[1] / daiList[1];
let ethdaiDiff = (ethdai - ethList[0] / daiList[0]).toFixed(6);
let ethdaiSign;
let ethdaiColor;
if (ethdaiDiff >= 0) {
ethdaiSign = 'fa fa-caret-up';
ethdaiColor = 'text-success';
} else {
ethdaiSign = 'fa fa-caret-down';
ethdaiColor = 'text-danger';
}
ethdaiDiff = Math.abs(ethdaiDiff);
eth = eth.toFixed(2);
dai = dai.toFixed(3);
ethdai = ethdai.toFixed(2);
this.setState({
eth,
dai,
ethDiff,
daiDiff,
ethdai,
daiSign,
ethSign,
ethdaiSign,
ethColor,
daiColor,
ethdaiColor,
});
};
render() {
return (
<div className='sec-bg market-val'>
<table className='text-center text-white' style={{ width: '100%' }}>
<tbody>
<tr>
<td>
<img
className='mr-2'
src={require('../images/eth.png')}
width='36'
/>
<span className='font-weight-bold ml-2 text-secondary'>
ETH/USD
</span>
</td>
<td>
<span>$ {this.state.eth}</span>
<span className={'ml-2 ' + this.state.ethColor}>
<i className={this.state.ethSign}></i> {this.state.ethDiff}
</span>
</td>
</tr>
<tr>
<td>
<img
className='mr-2'
src={require('../images/dai.png')}
width='36'
/>
<span className='font-weight-bold ml-2 text-secondary'>
DAI/USD
</span>
</td>
<td>
<span>$ {this.state.dai}</span>
<span className={'ml-2 ' + this.state.daiColor}>
<i className={this.state.daiSign}></i> {this.state.daiDiff}
</span>
</td>
</tr>
<tr>
<td>
<img
className='mr-2'
src={require('../images/ethdai.png')}
width='36'
/>
<span className='font-weight-bold ml-2 text-secondary'>
ETH/DAI
</span>
</td>
<td>
<span>DAI {this.state.ethdai}</span>
<span className={'ml-2 ' + this.state.ethdaiColor}>
<i className={this.state.ethdaiSign}></i>{' '}
{this.state.ethdaiDiff}
</span>
</td>
</tr>
</tbody>
</table>
</div>
);
}
}
export default MarketValue;
| 25.87931 | 77 | 0.480346 |
c8dd1d7dfa648573a9e82ff5d8bcb279a79c8e15 | 3,091 | js | JavaScript | cap5/js/ex5_1.js | Douug019/Estudos-projetos-JavaScript | 30eee92c723cf9d62c6c6c2a2ead1b7b00280227 | [
"MIT"
] | null | null | null | cap5/js/ex5_1.js | Douug019/Estudos-projetos-JavaScript | 30eee92c723cf9d62c6c6c2a2ead1b7b00280227 | [
"MIT"
] | null | null | null | cap5/js/ex5_1.js | Douug019/Estudos-projetos-JavaScript | 30eee92c723cf9d62c6c6c2a2ead1b7b00280227 | [
"MIT"
] | null | null | null | var pacientes = [] // declara vetor global
function adicionarPacientes () {
// criar referência aos elementos de entrada e saída de dados da página
var inPaciente = document.getElementById('inPaciente')
var outLista = document.getElementById('outLista')
var nome = inPaciente.value // obtém o nome do paciente
// verificar preenchimento do nome do paciente
if (nome == '') {
alert('Informe o nome do paciente')
inPaciente.focus()
return
}
pacientes.push(nome) // adiciona o nome no final do vetor
var lista = '' // string para concatenar paciente
// percorre os elementos do vetor
for ( i = 0 ; i < pacientes.length; i++) {
lista += (i + 1) + " . " + pacientes[i] + "\n"
}
// altera o conteudo da tag outLista
outLista.textContent = lista
// limpar campo e posiciona curso em inPaciente
inPaciente.value = ""
inPaciente.focus()
}
// cria referência ao btAdicionar e associa funcion ao evento click
var btAdicionar = document.getElementById('btAdicionar')
btAdicionar.addEventListener('click', adicionarPacientes)
var pacientes = [] // declara vetor global
function adicionarPacientesUrgencia () {
// criar referência aos elementos de entrada e saída de dados da página
var inPaciente = document.getElementById('inPaciente')
var outLista = document.getElementById('outLista')
var nome = inPaciente.value // obtém o nome do paciente
// verificar preenchimento do nome do paciente
if (nome == '') {
alert('Informe o nome do paciente')
inPaciente.focus()
return
}
pacientes.unshift(nome) // adiciona o nome no inicio do vetor
var lista = '' // string para concatenar paciente
// percorre os elementos do vetor
for ( i = 0 ; i < pacientes.length; i++) {
lista += (i + 1) + " . " + pacientes[i] + "\n"
}
// altera o conteudo da tag outLista
outLista.textContent = lista
// limpar campo e posiciona curso em inPaciente
inPaciente.value = ""
inPaciente.focus()
}
// cria referência ao btAdicionar e associa funcion ao evento click
var btUrgencia = document.getElementById('btUrgencia')
btUrgencia.addEventListener('click', adicionarPacientesUrgencia)
function atenderPaciente () {
// verifica se vator pacientes está vázio
if (pacientes.length == 0) {
alert('Não há pacientes na lista de espera')
inPaciente.focus()
return
}
// cria referência aos elementos de saída de dados
var outAtendimento = document.getElementById('outAtendimento')
var outLista = document.getElementById('outLista')
// remove paciente do inicio da fila (e obtém nome)
var atender = pacientes.shift()
// exibe nome do paciente em atendimento
outAtendimento.textContent = atender
// string para concatenar pacientes
var lista = ""
// percorre os elementos do vetor
for (i = 0; i < pacientes.length; i++) {
lista =+ (i + 1) + " . " + pacientes[i] + " \n "
}
// altera o conteudo da tag outLista
outLista.textContent = lista
}
var btAtender = document.getElementById('btAtender')
btAtender.addEventListener('click', atenderPaciente) | 27.353982 | 71 | 0.695891 |
c8dd568839bbe59e2296cb88667c349ba345bb2e | 19,728 | js | JavaScript | src/mariadb/routesbk.js | denisduarte/tofani | 16be4b67d88ac58bbeb3e74efd1541b9b47a2438 | [
"MIT"
] | null | null | null | src/mariadb/routesbk.js | denisduarte/tofani | 16be4b67d88ac58bbeb3e74efd1541b9b47a2438 | [
"MIT"
] | null | null | null | src/mariadb/routesbk.js | denisduarte/tofani | 16be4b67d88ac58bbeb3e74efd1541b9b47a2438 | [
"MIT"
] | null | null | null | const express = require("express");
const Sequelize = require("sequelize");
const router = express.Router();
const auth = require("./middleware/auth");
const fs = require('fs');
const sendBorrowMail = require("../../mailer")
const { Book, Author, Organiser, Translator, Local, Tag, Comment, User, Token, sequelize } = require('./sequelize')
const UserController = require("./controllers/user.controller");
const BookController = require("./controllers/book.controller");
const TagController = require("./controllers/tag.controller");
const AuthorController = require("./controllers/author.controller");
const OrganiserController = require("./controllers/organiser.controller");
const TranslatorController = require("./controllers/translator.controller");
const LocalController = require("./controllers/local.controller");
const CommentController = require("./controllers/comment.controller");
function toJSON(data) {
return JSON.parse(JSON.stringify(data));
}
function formatBook(book) {
var formattedBook = {
"author": [],
"tags": [],
"comments": [],
"_id": book._id,
"title": book.title,
"isbn": book.isbn,
"subtitle": book.subtitle,
"press": book.press,
"year": book.year,
"isAvailable": book.isAvailable,
"createdAt": book.createdAt,
"description": book.description,
"coverURL": book.coverURL
};
for (let tag of book.Tags) {
formattedBook.tags.push(tag.tag);
}
for (let author of book.Authors) {
formattedBook.author.push(author.name);
}
for (let comment of book.Comments) {
formattedBook.comments.push({
"_id": comment._id,
"comment": comment.comment,
"bookID": book._id,
"userID": comment.userID,
"userName": comment.userName,
"createdAt": comment.createdAt
});
}
return formattedBook;
}
/******* USER CREATION AND LOGIN *******/
// Create a new user
router.post('/users/add', async (req, res) => {
const user = await UserController.create(req.body);
res.status(200).send(user)
});
router.post('/users/update', async(req, res) => {
console.log(req.body.wishlist);
let userid = req.body._id;
try {
const result = await sequelize.transaction(async (t) => {
const user = await User.findOne({
where: { _id: userid },
include: {
model: Book,
as: "wishlist",
attributes: [['_id', 'BookID']],
through: {
attributes: ["createdAt"],
}
}
});
user.update({ name: req.body.name,
email: req.body.email,
acceptMailling: req.body.acceptMailling
});
var storedBooks = [];
var newWishlist = [];
for (let book of user.wishlist) {
storedBooks.push(book.toJSON().BookID);
}
for (let book of req.body.wishlist) {
newWishlist.push(book.BookID);
user.addWishlist(book.BookID);
}
let missing = storedBooks.filter(entry => newWishlist.indexOf(entry) < 0);
for (let book of missing) {
user.removeWishlist(book);
}
return 1;
});
res.send(req.body)
} catch (error) {
console.log(error);
res.status(500).send(error)
}
})
//Login a registered user
router.post('/users/login', async(req, res) => {
const user = UserController.login(req.body)
.then(user => {
res.status(200).send(user)
})
.catch(error => {
console.log(error);
res.status(500).send({error: error.message})
});
})
// Log user out of the application in current device
router.post('/users/me/logout', auth, async (req, res) => {
try {
const token = await Token.findOne({ where: {
token: req.token,
UserId: req.user._id
}
});
token.destroy();
console.log(token);
res.status(200).send();
} catch (error) {
res.status(500).send(error);
}
});
/******* BOOKS *******/
//list all available tags
router.get("/tags", async (req, res) => {
const tags = await Tag.findAll()
.then(tags => {
//console.log(tags);
var data = JSON.stringify(tags);
data = JSON.parse(data);
var tagList = [];
for (var i in data)
tagList.push(data[i].tag);
res.json(tag_list);
})
});
//Add a new book
router.post("/books/add", async (req, res) => {
console.log('addBook', req.body);
//Add new book
/*const bookData = { code: req.body.code,
title: req.body.title,
subtitle: req.body.subtitle,
description: req.body.description,
press: req.body.press,
year: req.body.year,
collection: req.body.collection,
volume: req.body.volume,
edition: req.body.edition,
pages: req.body.pages,
ex: req.body.ex,
format: req.body.format,
status: req.body.status,
condition: req.body.condition,
isbn: req.body.isbn,
coverURL: req.body.coverURL,
isAvailable: true,
Authors: [{ name: 'Denis'}]
};*/
const book = await BookController.create(req.body);
const bookID = book._id;
/*
//Add tags or retrieve IDs
const tagPromises = req.body.tags.map(async tag => {
return TagController.create({
tag: tag,
})
});
//Add book_tag relationship
Promise.all(tagPromises)
.then(storedTags => {
storedTags.map(tag => {
TagController.addBook(tag[0]._id, bookID)
})
});
//Add author or retrieve IDs
const authorPromises = req.body.author.map(async author => {
return AuthorController.create({
name: author,
})
});
//Add book_author relationship
Promise.all(authorPromises)
.then(storedAuthor => {
storedAuthor.map(author => {
AuthorController.addBook(author[0]._id, bookID)
})
});
//Add organiser or retrieve IDs
const organiserPromises = req.body.organiser.map(async organiser => {
return OrganiserController.create({
name: organiser,
})
});
//Add book_organiser relationship
Promise.all(organiserPromises)
.then(storedOrganiser => {
storedOrganiser.map(organiser => {
OrganiserController.addBook(organiser[0]._id, bookID)
})
});
//Add translator or retrieve IDs
const translatorPromises = req.body.translator.map(async translator => {
return TranslatorController.create({
name: translator,
})
});
//Add book_translator relationship
Promise.all(translatorPromises)
.then(storedTranslator => {
storedTranslator.map(translator => {
TranslatorController.addBook(translator[0]._id, bookID)
})
});
//Add local or retrieve IDs
const localPromises = req.body.local.map(async local => {
return LocalController.create({
name: local,
})
});
//Add book_local relationship
Promise.all(localPromises)
.then(storedLocal => {
storedLocal.map(local => {
LocalController.addBook(local[0]._id, bookID)
})
});
*/
res.status(200).send(book)
});
//List all books
router.get("/books", async (req, res) => {
let query = { attributes: ['_id'], /*remover*/limit: 30 };
const tagsArray = JSON.parse(req.query.tag)
if (tagsArray.length > 0) {
const tagPromises = tagsArray.map(async tag => {
return TagController.findByTag({
tag: tag,
})
});
//Add book_tag relationship
var tagIDList = await Promise.all(tagPromises)
.then(tags => {
var tagList = [];
for (let tag of tags) {
tagList.push(tag[0]._id);
}
return tagList
})
.catch((err) => {
console.log(">> Error while creating Tag: ", err);
});
query = {
attributes: ['_id', [Sequelize.fn('COUNT', 'Book._id'), 'tagCount']],
group: ["Book._id"],
having: {'tagCount': {[Sequelize.Op.gte]: tagsArray.length}},
include: [{
model: Tag,
attributes: [],
where: { _id: { [Sequelize.Op.or]: tagIDList } },
through: {
attributes: []
}
}]
};
}
const search = req.query.search ? req.query.search : "";
const bookIDs = await Book.findAll(query)
.then((books) => {
var bookIDs = [];
for (let i in books) {
bookIDs.push(books[i]._id)
}
return bookIDs;
});
const bookList = await Book.findAll({
where: {
[Sequelize.Op.and]: [
{ _id: { [Sequelize.Op.or]: bookIDs } },
{
[Sequelize.Op.or]: [
{ title: { [Sequelize.Op.like]: '%' + search + '%' } },
{ subtitle: { [Sequelize.Op.like]: '%' + search + '%' } },
Sequelize.literal("`Authors`.`name` LIKE '%" + search + "%'"),
]
}
]
},
//limit: +req.query.booksPerPage,
//offset: req.query.page * req.query.booksPerPage,
include: [
{
model: Author,
attributes: ['name'],
through: {
attributes: []
}
},
{
model: Tag,
attributes: ['tag'],
through: {
attributes: []
}
},
{
model: Comment,
attributes: ['_id', 'comment', "userName", "userID", "createdAt"],
limit: 10
}
]
})
.then((books) => {
console.log('find2');
var bookList = [];
for (let book of books) {
bookList.push(formatBook(book))
}
return bookList;
});
var object = { "books": bookList,
"total": { "count": await Book.count({})
}
}
res.status(200).send(object);
});
//Borrow a single book
router.get("/book/available", async (req, res) => {
console.log('available', req.query);
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
res.status(200).send(book.isAvailable);
});
//Borrow a single book
router.get("/book/borrow", async (req, res) => {
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
let user = await User.findOne({
where: { _id: req.query.userID }
});
try {
const result = await sequelize.transaction(async (t) => {
await user.removeQueue(book);
borrowedBook = await user.addLending(book);
book = await book.update({ isAvailable: false });
borrowedBook = await user.getLending({
where: { _id: req.query.bookID }
});
return borrowedBook[0];
});
sendBorrowMail(book, user);
res.status(200).send(result);
} catch (error) {
console.log(error);
res.status(500).send(error)
}
});
//Return a single book
router.get("/book/return", async (req, res) => {
console.log('return', req.query);
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
let user = await User.findOne({
where: { _id: req.query.userID }
});
try {
const result = await sequelize.transaction(async (t) => {
returnedBook = await user.removeLending(book);
book = await book.update({ isAvailable: true });
return book;
});
res.status(200).send(result);
} catch (error) {
console.log(error);
res.status(500).send(error)
}
});
//Enter book waiting list
router.get("/book/wait", async (req, res) => {
console.log('wait', req.query);
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
let user = await User.findOne({
where: { _id: req.query.userID }
});
console.log('user', user);
console.log('book', book);
let wait = await user.addQueue(book);
res.status(200).send(book);
});
//Leave book waiting list
router.get("/book/unwait", async (req, res) => {
console.log('unwait', req.query);
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
let user = await User.findOne({
where: { _id: req.query.userID }
});
let wait = await user.removeQueue(book);
res.status(200).send(book);
});
//Fetch a single book
router.get("/book/:id", async (req, res) => {
console.log('fetch book');
try {
const book = await Book.findOne({
where: { _id: req.params.id },
include: [
{
model: Tag,
attributes: ['tag'],
through: {
attributes: []
}
},
{
model: Author,
attributes: ['name'],
through: {
attributes: []
}
},
{
model: Organiser,
attributes: ['name'],
through: {
attributes: []
}
},
{
model: Translator,
attributes: ['name'],
through: {
attributes: []
}
},
{
model: Local,
attributes: ['name'],
through: {
attributes: []
}
},
{
model: Comment,
attributes: ['_id', 'comment', "userName", "userID", "createdAt"],
limit: 10
}
],
})
if (!book)
throw 'null book';
res.status(200).send(book);
} catch (error) {
console.log(error);
res.status(404).send({ error: "Book doesn't exist!" })
}
});
/************ ADMIN ************/
router.get("/admin/set", async (req, res) => {
let user = await User.findOne({
where: { _id: req.query.userID }
});
user.update({ administrator: req.query.isAdmin });
res.status(200);
});
router.get("/admin/lendings", async (req, res) => {
try {
const lendings = await Book.findAll({
include: [
{
model: User,
as: 'borrowing',
required: true,
through: {
attributes: ['createdAt']
}
},
{
model: User,
as: 'waiting',
required: false,
through: {
attributes: ['createdAt']
}
}
],
order: [
[{ model: User, as: 'waiting' }, 'createdAt', 'DESC']
]
});
if (!lendings)
throw 'null book';
console.log('lendings!!!!!');
res.status(200).send(lendings);
} catch (error) {
console.log(error);
res.status(404).send({ error: "Lending doesn't exist!" })
}
});
//Return a single book
router.get("/admin/return", async (req, res) => {
let book = await Book.findOne({
where: { _id: req.query.bookID }
});
let user = await User.findOne({
include: [
{
model: Book,
required: true,
as: 'lending',
where: { _id: req.query.bookID }
}
]
});
try {
const result = await sequelize.transaction(async (t) => {
returnedBook = await user.removeLending(book);
book = await book.update({ isAvailable: true });
return book;
});
res.status(200).send(result);
} catch (error) {
console.log(error);
res.status(500).send(error)
}
});
//Return a single book
router.get("/admin/users", async (req, res) => {
console.log('users', req.query.letter);
let users;
if (req.query.letter) {
console.log('with');
query = { where: { name: { [Sequelize.Op.like]: req.query.letter + '%' } } }
users = await User.findAll(query);
} else {
console.log('without');
users = await User.findAll();
}
res.status(200).send(users);
});
const StreamArray = require('stream-json/streamers/StreamArray');
router.post("/populate", async (req, res) => {
console.log("populate");
new Promise((resolve, reject) => {
fs.createReadStream('../resources/livros.json')
.pipe(StreamArray.withParser())
.on("data", row => {
const bookData = { code: row.value.Code,
title: row.value.Title,
subtitle: row.value.Subtitle,
description: row.value.Description,
year: row.value.Year,
collection: row.value.Collection,
volume: row.value.Volume,
press: row.value.Press,
local: row.value.Local,
edition: row.value.Edition,
pages: row.value.Pages,
ex: row.value.Ex,
isbn: row.value.ISBN,
format: row.value.Format,
status: row.value.Status,
condition: row.value.Condition,
isAvailable: row.value.isAvailable,
coverURL: row.value.CoverURL,
createdAt: new Date()
};
const book = BookController.create(bookData)
.then(book => {
const bookID = book._id;
//Add tags or retrieve IDs
const tagPromises = row.value.Tags.map(async tag => {
return TagController.create({
tag: tag,
})
});
//Add book_tag relationship
Promise.all(tagPromises)
.then(storedTags => {
storedTags.map(tag => {
TagController.addBook(tag[0]._id, bookID)
})
});
//Add author or retrieve IDs
const authorPromises = row.value.Author.map(async author => {
return AuthorController.create({
name: author,
})
});
//Add book_author relationship
Promise.all(authorPromises)
.then(storedAuthor => {
storedAuthor.map(author => {
AuthorController.addBook(author[0]._id, bookID)
})
});
//Add organiser or retrieve IDs
const organiserPromises = row.value.Organiser.map(async organiser => {
return OrganiserController.create({
name: organiser,
})
});
//Add book_organiser relationship
Promise.all(organiserPromises)
.then(storedOrganiser => {
storedOrganiser.map(organiser => {
OrganiserController.addBook(organiser[0]._id, bookID)
})
});
//Add tags or retrieve IDs
const translatorPromises = row.value.Translator.map(async translator => {
return TranslatorController.create({
name: translator,
})
});
//Add book_author relationship
Promise.all(translatorPromises)
.then(storedTranslator => {
storedTranslator.map(translator => {
TranslatorController.addBook(translator[0]._id, bookID)
})
});
//Add tags or retrieve IDs
const localPromises = row.value.Local.map(async local => {
return LocalController.create({
name: local,
})
});
//Add book_author relationship
Promise.all(localPromises)
.then(storedLocal => {
storedLocal.map(local => {
LocalController.addBook(local[0]._id, bookID)
})
});
});
})
.on("error", err => {
reject(err);
})
.on("end", () => {
console.log("CSV file successfully processed");
resolve();
});
});
res.status(200).send("oi")
})
//log all other routes
router.post("**", async (req, res) => {
console.log("**");
res.status(404).send("Invalid route")
})
module.exports = router
| 24.117359 | 115 | 0.535077 |
b9d33b06da476ad1cc33ee9b8f3ee0c8c3cf7268 | 5,491 | js | JavaScript | dist/index.js | mihalik/storyshots | db9c225ae5ddd521765415a4d1f70bffdb78d4d4 | [
"MIT"
] | null | null | null | dist/index.js | mihalik/storyshots | db9c225ae5ddd521765415a4d1f70bffdb78d4d4 | [
"MIT"
] | null | null | null | dist/index.js | mihalik/storyshots | db9c225ae5ddd521765415a4d1f70bffdb78d4d4 | [
"MIT"
] | null | null | null | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = testStorySnapshots;
var _enzyme = require('enzyme');
var _enzymeToJson = require('enzyme-to-json');
var _enzymeToJson2 = _interopRequireDefault(_enzymeToJson);
var _path = require('path');
var _path2 = _interopRequireDefault(_path);
var _readPkgUp = require('read-pkg-up');
var _readPkgUp2 = _interopRequireDefault(_readPkgUp);
var _storybookAddons = require('@kadira/storybook-addons');
var _storybookAddons2 = _interopRequireDefault(_storybookAddons);
var _require_context = require('./require_context');
var _require_context2 = _interopRequireDefault(_require_context);
var _storybookChannelMock = require('./storybook-channel-mock');
var _storybookChannelMock2 = _interopRequireDefault(_storybookChannelMock);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _global = global,
describe = _global.describe,
it = _global.it,
expect = _global.expect;
var storybook = void 0;
var configPath = void 0;
var babel = require('babel-core');
var pkg = _readPkgUp2.default.sync().pkg;
var isStorybook = pkg.devDependencies && pkg.devDependencies['@kadira/storybook'] || pkg.dependencies && pkg.dependencies['@kadira/storybook'];
var isRNStorybook = pkg.devDependencies && pkg.devDependencies['@kadira/react-native-storybook'] || pkg.dependencies && pkg.dependencies['@kadira/react-native-storybook'];
function testStorySnapshots() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_storybookAddons2.default.setChannel((0, _storybookChannelMock2.default)());
if (isStorybook) {
storybook = require.requireActual('@kadira/storybook');
var loadBabelConfig = require('@kadira/storybook/dist/server/babel_config').default;
var configDirPath = _path2.default.resolve(options.configPath || '.storybook');
configPath = _path2.default.join(configDirPath, 'config.js');
var content = babel.transformFileSync(configPath, babelConfig).code;
var contextOpts = {
filename: configPath,
dirname: configDirPath
};
var babelConfig = loadBabelConfig(configDirPath);
(0, _require_context2.default)(content, contextOpts);
} else if (isRNStorybook) {
storybook = require.requireActual('@kadira/react-native-storybook');
configPath = _path2.default.resolve(options.configPath || 'storybook');
require.requireActual(configPath);
} else {
throw new Error('storyshots is intended only to be used with react storybook or react native storybook');
}
if (typeof describe !== 'function') {
throw new Error('testStorySnapshots is intended only to be used inside jest');
}
var suit = options.suit || 'Storyshots';
var stories = storybook.getStorybook();
// Added not to break existing storyshots configs (can be removed in a future major release)
options.storyNameRegex = options.storyNameRegex || options.storyRegex;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
var _loop = function _loop() {
var group = _step.value;
if (options.storyKindRegex && !group.kind.match(options.storyKindRegex)) {
return 'continue';
}
describe(suit, function () {
describe(group.kind, function () {
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
var _loop2 = function _loop2() {
var story = _step2.value;
if (options.storyNameRegex && !story.name.match(options.storyNameRegex)) {
return 'continue';
}
it(story.name, function () {
var context = { kind: group.kind, story: story.name };
var renderedStory = story.render(context);
var tree = (0, _enzymeToJson2.default)((0, _enzyme.render)(renderedStory));
expect(tree).toMatchSnapshot();
});
};
for (var _iterator2 = (0, _getIterator3.default)(group.stories), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var _ret2 = _loop2();
if (_ret2 === 'continue') continue;
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
});
});
};
for (var _iterator = (0, _getIterator3.default)(stories), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ret = _loop();
if (_ret === 'continue') continue;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
} | 32.491124 | 188 | 0.654708 |
b9d3a549482e9364d5c64e8e0b6fe619797d3cf3 | 3,165 | js | JavaScript | src/main/webapp/app/tasks/task-form/task-form.component.spec.js | jinuccherian/tiny-tasks | 863c1dd14f3d66603e2482a8a87cba82b47aaf98 | [
"MIT"
] | null | null | null | src/main/webapp/app/tasks/task-form/task-form.component.spec.js | jinuccherian/tiny-tasks | 863c1dd14f3d66603e2482a8a87cba82b47aaf98 | [
"MIT"
] | null | null | null | src/main/webapp/app/tasks/task-form/task-form.component.spec.js | jinuccherian/tiny-tasks | 863c1dd14f3d66603e2482a8a87cba82b47aaf98 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var testing_1 = require("@angular/core/testing");
var rxjs_1 = require("rxjs");
var task_form_component_1 = require("./task-form.component");
describe('TaskFormComponent', function () {
var component;
var fixture;
var taskService;
beforeEach(testing_1.waitForAsync(function () {
taskService = jasmine.createSpyObj('taskService', ['create']);
testing_1.TestBed.configureTestingModule({
declarations: [task_form_component_1.TaskFormComponent],
providers: [{
provide: 'TaskService',
useValue: taskService
}]
}).overrideTemplate(task_form_component_1.TaskFormComponent, '')
.compileComponents();
}));
beforeEach(function () {
fixture = testing_1.TestBed.createComponent(task_form_component_1.TaskFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', function () {
expect(component).toBeTruthy();
});
it('should validate a task', function () {
expect(component.taskForm.invalid).toBe(true);
component.taskForm.setValue({ name: 'My task' });
expect(component.taskForm.invalid).toBe(false);
});
it('should create a task', function () {
// given
component.taskForm.setValue({ name: 'My task' });
taskService.create.and.returnValue(rxjs_1.of({ id: 'id', name: 'My task' }));
// when
component.onSubmit();
// then
expect(taskService.create).toHaveBeenCalledWith('My task');
});
it('should emit the task after creation', function () {
// given
component.taskForm.setValue({ name: 'My task' });
taskService.create.and.returnValue(rxjs_1.of({ id: 'id', name: 'My task' }));
var createEmitter = spyOn(component.created, 'emit');
// when
component.onSubmit();
// then
expect(createEmitter).toHaveBeenCalledWith({ id: 'id', name: 'My task' });
});
it('should reset the form after creation', function () {
// given
component.taskForm.setValue({ name: 'My task' });
taskService.create.and.returnValue(rxjs_1.of({ id: 'id', name: 'My task' }));
var formReset = spyOn(component.taskForm, 'reset');
// when
component.onSubmit();
// then
expect(formReset).toHaveBeenCalled();
});
it('should search a task', function () {
// given
component.taskForm.setValue({ searchTxt: 'name or id' });
// when
component.onSearch();
// then
expect(taskService.readTasksByNameAndId).toHaveBeenCalledWith('name or id');
});
it('should clear a search', function () {
// given
component.taskForm.setValue({ searchTxt: 'name or id' });
var searchEmitter = spyOn(component.clearedSearch, 'emit');
// when
component.onSearch();
// then
expect(searchEmitter).toHaveBeenCalled();
});
});
//# sourceMappingURL=task-form.component.spec.js.map | 39.074074 | 93 | 0.606003 |
b9d3e0fbecf399cc22cd6a68cedced7df4bd6399 | 109 | js | JavaScript | tests/containers/Display.test.js | Portgass/escapade-foundry | 8466a5a94a3f1048a96ff13c640709519fa791da | [
"MIT"
] | null | null | null | tests/containers/Display.test.js | Portgass/escapade-foundry | 8466a5a94a3f1048a96ff13c640709519fa791da | [
"MIT"
] | null | null | null | tests/containers/Display.test.js | Portgass/escapade-foundry | 8466a5a94a3f1048a96ff13c640709519fa791da | [
"MIT"
] | null | null | null | import { shallow } from 'enzyme';
describe('(Component) Display', () => {
it('exists', () => {
});
});
| 13.625 | 39 | 0.504587 |
b9d41d4d2143cebf8f54c7267e81d40cb524907c | 1,280 | js | JavaScript | assets/lib/simple-icons/icons/beijingsubway.js | vincedani/FeelIt | 56be4e9a3833448a67a1cc78b5ce9ae57f7cd091 | [
"MIT"
] | 89 | 2021-06-01T08:25:32.000Z | 2022-03-30T07:24:44.000Z | assets/lib/simple-icons/icons/beijingsubway.js | vincedani/FeelIt | 56be4e9a3833448a67a1cc78b5ce9ae57f7cd091 | [
"MIT"
] | 72 | 2021-05-31T09:35:03.000Z | 2022-03-17T13:44:42.000Z | assets/lib/simple-icons/icons/beijingsubway.js | vincedani/FeelIt | 56be4e9a3833448a67a1cc78b5ce9ae57f7cd091 | [
"MIT"
] | 44 | 2021-06-06T06:59:52.000Z | 2022-03-30T14:11:18.000Z | module.exports={title:"Beijing Subway",slug:"beijingsubway",svg:'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Beijing Subway</title><path d="M7.8857.7537C11.2092-.5 15.09-.1816 18.1547 1.6493c2.826 1.6916 5.055 4.7166 5.5526 7.5028-1.2538 0-1.5523.0398-2.7862.0398-.796-2.5872-3.7216-5.4729-6.1097-6.07-3.1246-.6567-5.6321-.199-7.8014 1.3335C5.418 5.55 3.9253 7.4604 3.368 9.3312c-.8159 2.408-.1592 5.8112 1.234 7.9208 1.0945 1.5722 3.005 3.0648 4.836 3.642 1.7911.5572 4.7166.0397 6.4878-.5971 2.4877-.9155 4.3186-3.1842 5.1147-5.6918l-3.4628.0398c-.1593 1.1543-.3384 1.5523-1.035 2.8857l-9.4929-.0199V6.4257h9.473c1.1345 1.4328 1.3136 3.6817 1.3335 5.5723 0 0 3.8011.02 6.1296 0-.0398 3.6022-1.5523 7.1645-4.4181 9.3935-2.0897 1.6518-4.7166 2.607-7.3834 2.607-3.7216.0598-7.4232-1.7314-9.6522-4.7166C1.0992 17.451.343 15.2021.0445 12.9334c-.0796-1.3931.02-2.0897.0398-2.1693C.343 9.1521.761 7.56 1.577 6.167 2.9501 3.6792 5.219 1.7289 7.8857.7537m1.811 8.1795v6.2291l4.5972.02c1.0349-1.1942.995-1.9703-.0398-3.0649 1.0349-1.0946 1.0946-2.2488.02-3.1842H9.6966Z"/></svg>',get path(){return this.svg.match(/<path\s+d="([^"]*)/)[1]},source:"https://zh.wikipedia.org/wiki/File:Beijing_Subway_Logo.svg",hex:"004A9D",guidelines:void 0,license:void 0}; | 1,280 | 1,280 | 0.715625 |
b9d45e5fa3de8ea073090ac44f727ff500005713 | 2,559 | js | JavaScript | resources/assets/js/App/pages/Posts/CreatePost/postform.js | thygon/al-api | 6b6e2c313fe289a4abc03c40eeb0f7377287e0ce | [
"MIT"
] | null | null | null | resources/assets/js/App/pages/Posts/CreatePost/postform.js | thygon/al-api | 6b6e2c313fe289a4abc03c40eeb0f7377287e0ce | [
"MIT"
] | null | null | null | resources/assets/js/App/pages/Posts/CreatePost/postform.js | thygon/al-api | 6b6e2c313fe289a4abc03c40eeb0f7377287e0ce | [
"MIT"
] | null | null | null | import React , { Component} from 'react';
import { Field, reduxForm,actions} from 'redux-form';
import renderField from './../../../components/FormInputs/renderField';
//import './file.scss';
const validate = (values) =>{
const errors = {};
if (!values.title) {
errors.title = 'Title is required';
}
if (values.title && values.title.length > 60) {
errors.title = 'Title is too long';
}
if (!values.content) {
errors.content = 'Post Content is required';
}else if(values.content.length > 2000){
errors.content = 'Too Long Content';
}
return errors;
}
class PostForm extends Component{
constructor(props){
super(props);
this.state = {image:''};
this.getFile = this.getFile.bind(this);
}
getFile(file){
this.props.onFileLoaded(file);
}
componentDidMount() {
this.props.initialize({
publish:false
})
}
render(){
const {handleSubmit} = this.props;
return (
<form onSubmit={handleSubmit} className='form' >
<div className="form-group">
<label className="control-label col-md-3">Title</label>
<Field
className='form-control'
name="title"
type="text"
component={renderField} />
</div>
<div className="form-group">
<label className="control-label col-md-3">Content</label>
<Field
className='form-control'
name='content'
type='textarea'
rows='6'
placeholder='Article content..'
component={renderField}
/>
</div>
<div className="form-group">
<label className="control-label col-md-3">Featured Image</label>
<Field
className='form-control'
name='image'
type='file'
accept='image'
file={this.getFile}
component={renderField}
/>
</div>
<div className="form-group">
<Field
name="publish"
type="checkbox"
component={renderField}
label="Publish Post" />
</div>
<div className="form-group">
<button type='submit' className='btn btn-primary'>Create Post</button>
</div>
</form>
);
}
}
export default reduxForm({
form: 'newpostform',
validate
})(PostForm); | 24.84466 | 80 | 0.513873 |
b9d4c3be7a0d8d4051cb43bce7f9ea5e7825de87 | 715 | js | JavaScript | test.js | Jam3/threejs-generate-tonemap | eb5fbd94c8ce78321a6ec58250464317e75612dc | [
"MIT"
] | 1 | 2017-08-10T06:51:51.000Z | 2017-08-10T06:51:51.000Z | test.js | Jam3/threejs-generate-tonemap | eb5fbd94c8ce78321a6ec58250464317e75612dc | [
"MIT"
] | null | null | null | test.js | Jam3/threejs-generate-tonemap | eb5fbd94c8ce78321a6ec58250464317e75612dc | [
"MIT"
] | 2 | 2020-12-27T09:49:44.000Z | 2021-11-10T04:57:27.000Z | THREE = require('three');
var palette = require('./palette');
var ToneMapGeneratorHelper = require('./');
var PassThrough = require('./PassThrough');
var renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0x000000, 1);
renderer.setSize(512, 512);
var originalTonemap = THREE.ImageUtils.loadTexture(
'original.png',
THREE.UVMapping,
function() {
var tonemapGeneratorHelper = new ToneMapGeneratorHelper(renderer, originalTonemap, palette);
var finalPassThrough = new PassThrough(renderer, tonemapGeneratorHelper.finalRenderTarget, true);
finalPassThrough.update();
document.body.appendChild(renderer.domElement);
finalPassThrough.dispose();
tonemapGeneratorHelper.dispose();
}
);
| 24.655172 | 99 | 0.760839 |
b9d500a70769c42f83440d07d798be653d766687 | 1,469 | js | JavaScript | appcms/areanet/PIM-UI/default/assets/scripts/services/token.service.js | appcms/server | 82142aa5371bc8a10ac66dbf60d3fc8df653de00 | [
"MIT"
] | 3 | 2018-11-28T12:44:48.000Z | 2022-01-23T12:37:52.000Z | appcms/areanet/PIM-UI/default/assets/scripts/services/token.service.js | appcms/server | 82142aa5371bc8a10ac66dbf60d3fc8df653de00 | [
"MIT"
] | 146 | 2018-02-21T07:44:22.000Z | 2021-05-12T09:36:40.000Z | appcms/areanet/PIM-UI/default/assets/scripts/services/token.service.js | area-net-gmbh/appcms-server | 82142aa5371bc8a10ac66dbf60d3fc8df653de00 | [
"MIT"
] | 2 | 2018-05-29T01:08:09.000Z | 2019-07-28T12:30:14.000Z | (function() {
'use strict';
angular
.module('app')
.factory('TokenService', TokenService);
function TokenService(localStorageService, $http){
return{
delete: doDelete,
add: add,
generate: generate,
list: list
}
//////////////////////////////////////////////////////
function list(id){
return $http({
method: 'POST',
url: '/system/do',
data: {
method: 'listTokens'
}
});
}
function doDelete(id){
return $http({
method: 'POST',
url: '/system/do',
data: {
method: 'deleteToken',
id: id
}
});
}
function add(referrer, token, user){
return $http({
method: 'POST',
url: '/system/do',
data: {
method: 'addToken',
referrer: referrer,
user: user,
token: token
}
});
}
function generate(){
return $http({
method: 'POST',
url: '/system/do',
data: {
method: 'generateToken'
}
});
}
}
})(); | 21.925373 | 62 | 0.324711 |
b9d58d434bd39b4b8142c0fe9063be17f5669174 | 4,038 | js | JavaScript | webpack.config.js | Artur-/base-starter-connect | daee03b81f358af43b2840902cf25f8f83e13b2b | [
"Unlicense"
] | null | null | null | webpack.config.js | Artur-/base-starter-connect | daee03b81f358af43b2840902cf25f8f83e13b2b | [
"Unlicense"
] | null | null | null | webpack.config.js | Artur-/base-starter-connect | daee03b81f358af43b2840902cf25f8f83e13b2b | [
"Unlicense"
] | null | null | null | const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const {BabelMultiTargetPlugin} = require('webpack-babel-multi-target-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// This folder is served as static in a spring-boot installation
const outputFolder = 'target/classes/META-INF/resources';
module.exports = {
// Default build mode (the frontend development server forces 'development')
mode: 'production',
// Include source maps in the build
devtool: 'source-map',
// The directory with the frontend sources
context: path.resolve(__dirname, 'frontend'),
entry: {
polyfills: './polyfills.js',
index: './index.js'
},
resolve: {
// Prefer ES module dependencies when declared in package.json
mainFields: [
'es2015',
'module',
'main'
]
},
module: {
rules: [
// Process .js files though Babel with multiple targets
{
test: /\.js$/,
use: [
BabelMultiTargetPlugin.loader(),
'uglify-template-string-loader'
],
}
]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, outputFolder)
},
performance: {
maxAssetSize: 500000,
maxEntrypointSize: 500000
},
plugins: [
// Copy static assets
new CopyWebpackPlugin(['**/*'], {context: path.resolve(__dirname, 'static')}),
// Copy @webcomponents/webcomponentsjs
new CopyWebpackPlugin(
['webcomponentsjs/**/*'],
{context: path.resolve(__dirname, 'node_modules', '@webcomponents')}
),
// Provide regeneratorRuntime for Babel async transforms
new webpack.ProvidePlugin({
regeneratorRuntime: 'regenerator-runtime'
}),
// Babel configuration for multiple output bundles targeting different sets
// of browsers
new BabelMultiTargetPlugin({
babel: {
plugins: [
[
require('babel-plugin-template-html-minifier'),
{
modules: {
'@polymer/polymer/lib/utils/html-tag.js': ['html']
},
htmlMinifier: {
collapseWhitespace: true,
minifyCSS: true,
removeComments: true
}
}
]
],
// @babel/preset-env options common for all bundles
presetOptions: {
// debug: true, // uncomment to debug the babel configuration
// Don’t add polyfills, they are provided from webcomponents-loader.js
useBuiltIns: false
}
},
// Modules excluded from targeting into different bundles
doNotTarget: [
// Array of RegExp patterns
],
// Modules that should not be transpiled
exclude: [
// Array of RegExp patterns
],
// Target browsers with and without ES modules support
targets: {
'es6': {
browsers: [
'last 2 Chrome major versions',
'last 2 ChromeAndroid major versions',
'last 2 Edge major versions',
'last 2 Firefox major versions',
'last 2 Safari major versions',
'last 2 iOS major versions'
],
tagAssetsWithKey: false, // don’t append a suffix to the file name
esModule: true // marks the bundle used with <script type="module">
},
'es5': {
browsers: [
'ie 11'
],
tagAssetsWithKey: true, // append a suffix to the file name
noModule: true // marks the bundle included without `type="module"`
}
}
}),
// Insert the bundles in the html file
new HtmlWebpackPlugin({
template: 'index.html',
// Prevent adding multiple bunldles for polyfills, browsers that have ES
// modules support don’t need them. The polyfills are listed directly in
// the html template to ensure correct loading order.
excludeChunks: ['polyfills']
})
]
};
| 27.469388 | 82 | 0.589896 |
b9d5cd59e4a08948dcb337b6bacb178bc02b915b | 1,435 | js | JavaScript | Docs/html/search/variables_10.js | toastisme/BehaviourTreeDesigner | e000635da508bbf13c01a4e75430c289d71ffd05 | [
"MIT"
] | null | null | null | Docs/html/search/variables_10.js | toastisme/BehaviourTreeDesigner | e000635da508bbf13c01a4e75430c289d71ffd05 | [
"MIT"
] | 1 | 2021-08-03T21:46:15.000Z | 2021-08-03T21:46:15.000Z | Docs/html/search/variables_10.js | toastisme/BehaviourTreeDesigner | e000635da508bbf13c01a4e75430c289d71ffd05 | [
"MIT"
] | null | null | null | var searchData=
[
['savetreeoverwritepanel_772',['saveTreeOverwritePanel',['../class_gui_tab_controller.html#a6a63088a60061998abf1df562dfd17e4',1,'GuiTabController']]],
['savetreepanel_773',['saveTreePanel',['../class_gui_tab_controller.html#ade3adb433012fd9dc06c48f879de4f89',1,'GuiTabController']]],
['sequencecolor_774',['sequenceColor',['../class_gui_node.html#a10df2c8cbf1244f3585cff963c5ced20',1,'GuiNode']]],
['shootingrange_775',['shootingRange',['../class_guard_sight.html#acf9eaa52e9b93a75ca08fec98b0afb67',1,'GuardSight']]],
['shootrange_776',['shootRange',['../class_guard_attributes.html#a45c6944596c2afed1587c8362f5a643e',1,'GuardAttributes']]],
['showdecoratorbutton_777',['showDecoratorButton',['../class_gui_node.html#a8b0db0e4759b2016596daa5815fe3e4d',1,'GuiNode']]],
['showdecoratorbuttonarrowimg_778',['showDecoratorButtonArrowImg',['../class_debug_gui_node.html#a99c24fac9ca9a689c30590c02f9b8d86',1,'DebugGuiNode']]],
['showdecoratorbuttonimg_779',['showDecoratorButtonImg',['../class_debug_gui_node.html#a217510c16eb03d87043284e743827662',1,'DebugGuiNode']]],
['sightrange_780',['sightRange',['../class_guard_sight.html#a3322476e5434f8104226629613dc076d',1,'GuardSight']]],
['sleepsightrange_781',['sleepSightRange',['../class_guard_sight.html#a315876da191d71b9cc46a8488a25c3b6',1,'GuardSight']]],
['state_782',['state',['../class_node.html#a0efe883a92895bdb6d7d42cc76c914ca',1,'Node']]]
];
| 95.666667 | 154 | 0.788153 |
b9d655c27b40d62bd023efab80bcacb6f0a330a4 | 145 | js | JavaScript | packages/joy/src/build/polyfills/fetch/whatwg-fetch.js | lnlfps/symphony-js | d3d2dfac7ed60d5fcbc1c445f4ccdfacf7f36f54 | [
"MIT"
] | 1 | 2018-03-28T10:01:17.000Z | 2018-03-28T10:01:17.000Z | packages/joy/src/build/polyfills/fetch/whatwg-fetch.js | lnlfps/symphony-js | d3d2dfac7ed60d5fcbc1c445f4ccdfacf7f36f54 | [
"MIT"
] | null | null | null | packages/joy/src/build/polyfills/fetch/whatwg-fetch.js | lnlfps/symphony-js | d3d2dfac7ed60d5fcbc1c445f4ccdfacf7f36f54 | [
"MIT"
] | null | null | null | /* globals self */
exports.Headers = self.Headers;
exports.Request = self.Request;
exports.Response = self.Response;
exports.fetch = self.fetch;
| 24.166667 | 33 | 0.751724 |
b9d6f6e11fdda2faf55a5e31afddcaa286d2d779 | 9,957 | js | JavaScript | dapp/src/App.js | rayyan808/bsc-project | 2ccba94a160500cf2942262aebaf6526dc1c3a1a | [
"MIT"
] | 1 | 2021-06-24T10:08:37.000Z | 2021-06-24T10:08:37.000Z | dapp/src/App.js | rayyan808/bsc-project | 2ccba94a160500cf2942262aebaf6526dc1c3a1a | [
"MIT"
] | null | null | null | dapp/src/App.js | rayyan808/bsc-project | 2ccba94a160500cf2942262aebaf6526dc1c3a1a | [
"MIT"
] | null | null | null | import './assets/css/Login-Form-Dark.css';
import './assets/css/styles.css';
import {Component} from 'react';
import { Link} from 'react-router-dom';
import {Button} from 'react-bootstrap';
import Select from 'react-select';
import {Election, Accounts, iniAccounts} from './components/web3_utility';
import {iniZokrates} from './components/zkProvider';
class App extends Component {
/*=================== INITIALIZATION & BINDING =========================*/
constructor(props){
super(props);
this.state = {
electionName: "SNARK-Web Election",
candidateA: "Donald Trump",
candidateB: "Kim Jong-Un",
account: null,
accountSelected: false,
accountToAuthorize: null,
accountList: [],
accountLabels: [{}],
publicKeyN: "",
publicKeyG: "",
privateKey: null,
privateKeyFile: {}
};
/*
* Defining the binders within the constructors assure one-to-one mapping per instance
* and provides better performance
*/
this.handleChange = this.handleChange.bind(this);
this.conductElection = this.conductElection.bind(this);
this.authorizeAccount = this.authorizeAccount.bind(this);
this.handleAuthorizeAccountChange = this.handleAuthorizeAccountChange.bind(this);
iniAccounts();
iniZokrates();
}
/*
* Generic handling function called upon when the user updates a selection
*/
handleChange = (e) => {
const val = e.target.value;
this.setState({
[e.target.name]: val
});
console.log('State: ' + e.target.name + ' Value:' + val);
};
/* ================================================ SMART CONTRACT CALL =================================================> */
/*
* Called upon when the user invokes conduct election with appropiate parameters selected.
*/
conductElection = async (e) => {
e.preventDefault();
if(this.state.electionName !== undefined && this.state.candidateA !== undefined && this.state.candidateB !== null && this.state.publicKey !== null){
console.log("Sending request to Blockchain network \n");
console.log("Invoking election: " + this.state.electionName + " on the blockchain.")
await Election.methods
.conductElection(this.state.electionName, this.state.candidateA, this.state.candidateB)
.send({ from: Accounts[this.state.account], gas: 4000000 }).then(async (receipt) => {
console.log(receipt);
});
console.log("End of Conduct \n");
} else {
console.log("Enter values for Election Name & Candidates");
}
}
/*
* Called upon when a user authorizes a node for Vote-Key submission
*/
authorizeAccount = async (e) => {
e.preventDefault();
await Election.methods
.authorize(Accounts[this.state.accountToAuthorize])
.send({ from: Accounts[this.state.account], gas: 4000000 }).then(async (receipt) => {
console.log(receipt);
});
}
/* =========================================== ACCOUNT MANAGEMENT ==================================================================== */
/*
* Retrieve the accounts available within the current node (Within a local environment, this is your test-RPC or Ganache Accounts)
*/
getAccounts = async (e) => {
if( e !== undefined) {e.preventDefault();}
if(!this.state.accountLoaded){
console.log("Retrieving Accounts from Blockchain.");
await iniAccounts().then(( ) => {
if(Accounts !== undefined){
this.setState({accountList : Accounts});
this.setState({accountLoaded: true});
var labels = new Array();
for(var i =0; i < Accounts.length; i++){
var x = {label : Accounts[i], "value" : i};
labels.push(x);
}
this.setState({accountLabels : labels});
console.log(this.state.accountLabels);
} else {
console.log("Could not connect to blockchain. Check if Ganache is running. Is your contract address configured?")
}
});
}
}
/* Called upon when the user selects a new Invoker Account */
handleAccountChange = (e) => {
//e.preventDefault();
this.setState({account: e.value});
this.setState({accountSelected: true});
console.log("Account selected: " + this.state.accountList[e.value]);
}
/* Called upon when the user selects a new account to Authorize */
handleAuthorizeAccountChange = (e) => {
//e.preventDefault();
this.setState({accountToAuthorize: e.value});
console.log("Account to authorize selected: " + this.state.accountList[e.value]);
}
/*================================== COMPONENT RENDER ============================================*/
render() {
return (
<div>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<title>DApp</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alfa+Slab+One" />
<link rel="stylesheet" href="assets/fonts/ionicons.min.css" />
<link rel="stylesheet" href="assets/css/Login-Form-Dark.css" />
<link rel="stylesheet" href="assets/css/styles.css" />
<section className="login-dark">
<nav className="navbar navbar-light navbar-expand-md">
<div className="container-fluid"><a className="navbar-brand link-light" href="#" style={{color: 'var(--bs-yellow)', fontFamily: '"Alfa Slab One", serif'}}> NFT AUCTION</a><button data-bs-toggle="collapse" className="navbar-toggler" data-bs-target="#navcol-1"><span className="visually-hidden">Toggle navigation</span><span className="navbar-toggler-icon" /></button>
<div className="collapse navbar-collapse" id="navcol-1">
<ul className="navbar-nav">
<li className="nav-item"><a className="nav-link active" style={{fontFamily: '"Alfa Slab One", serif', color: 'var(--bs-yellow)'}}><Link to="/conductElection">Conduct Election</Link></a></li>
<li className="nav-item"><a className="nav-link" style={{color: 'var(--bs-yellow)', fontFamily: '"Alfa Slab One", serif'}}><Link to="/generateVoteKey">Generate Vote Key</Link></a></li>
<li className="nav-item"><a className="nav-link" style={{fontFamily: '"Alfa Slab One", serif', color: 'var(--bs-yellow)'}}><Link to="/submitVote">Submit Vote</Link></a></li>
<li className="nav-item"><a className="nav-link" style={{fontFamily: '"Alfa Slab One", serif', color: 'var(--bs-yellow)'}}><Link to="/results">Results</Link></a></li>
<li className="nav-item" />
</ul>
</div>
</div>
</nav>
<form method="post" id="conductElectionForm">
<h2 className="visually-hidden">Election Form</h2>
<div className="illustration"><i className="icon ion-ios-locked-outline" /></div>
<div className="mb-3" />
<div className="mb-3">
<input className="form-control" onChange={this.handleChange} value={this.state.electionName} type="text" name="electionName" placeholder="Election Name" id="name" />
<input className="form-control" onChange={this.handleChange} value = {this.state.candidateA} type="text" placeholder="Candidate A" name="candidateA" id="candidateA" />
<input className="form-control" onChange={this.handleChange} value={this.state.candidateB} type="text" placeholder="Candidate B" name="candidateB" id="candidateB" /></div>
<div className="mb-3">
<div><p>Delegate an Invoker Account: </p>
<Select label="Select an Account"
theme={(theme) => ({
...theme,
borderRadius: 0,
colors: {
...theme.colors,
text: 'orangered',
neutral0: 'black',
primary25: 'hotpink',
primary: 'black',
},
})}
options={this.state.accountLabels} onChange={this.handleAccountChange}/>
</div>
</div>
<div className="mb-3"><Button variant="btn btn-outline-success d-block w-100" onClick={this.conductElection} disabled={this.state.account == null}>{this.state.account == null ? 'Select an Invoker Account':'Conduct Election'}</Button></div>
<div className="mb-3"/>
<div className="mb-3">
<Button variant="btn btn-outline-danger d-block w-100" type="sm" onClick={this.getAccounts}>{this.state.accountLoaded ? 'Refresh Accounts' : 'Get Accounts'}</Button>
<div className="mb-3"></div>
<div className="mb-3"></div>
<div className="mb-3">
<div><p>Select an account to authorize: </p>
<Select name="accountToAuthorize" label="Select an Account"
theme={(theme) => ({
...theme,
borderRadius: 0,
colors: {
...theme.colors,
text: 'orangered',
neutral0: 'black',
primary25: 'hotpink',
primary: 'black',
},
})}
options={this.state.accountLabels} onChange={this.handleAuthorizeAccountChange}/>
</div>
</div>
<Button variant="btn btn-outline-danger d-block w-100" type="sm" onClick={this.authorizeAccount}disabled={this.state.account == null}>{this.state.accountLoaded ? 'Authorize Node' : 'Select Owner as Invoker Account'}</Button>
</div>
<a className="forgot" href="#">Rayyan Jafri</a>
</form>
</section>
<transactionresult />
</div>
);
}
}
export default App; | 48.101449 | 378 | 0.575977 |
b9d754d4dc41082c885049565cd7f771af3557bc | 16,289 | js | JavaScript | apps/costcontrol/js/views/datausage.js | marshall/gaia | 00722269f5d559595fd2f79d9dd70310758af08c | [
"Apache-2.0"
] | null | null | null | apps/costcontrol/js/views/datausage.js | marshall/gaia | 00722269f5d559595fd2f79d9dd70310758af08c | [
"Apache-2.0"
] | null | null | null | apps/costcontrol/js/views/datausage.js | marshall/gaia | 00722269f5d559595fd2f79d9dd70310758af08c | [
"Apache-2.0"
] | null | null | null | /* global _, debug, ConfigManager, CostControl, Formatting,
SimManager, Common, ChartUtils */
/* jshint -W120 */
/*
* The data usage tab is in charge of usage charts of mobile and wi-fi networks.
*
* It has several canvas areas layered one above the others.
*/
'use strict';
var DataUsageTab = (function() {
var graphicArea, graphicPattern;
var backgroundLayer, wifiLayer, mobileLayer, axisLayer, todayLayer,
warningLayer, limitsLayer;
var wifiOverview, mobileOverview;
var wifiToggle, mobileToggle;
var appList, noData;
var costcontrol, initialized, model;
var SYSTEM_MANIFEST = 'app://system.gaiamobile.org/manifest.webapp';
function setupTab() {
if (initialized) {
return;
}
CostControl.getInstance(function _onCostControl(instance) {
costcontrol = instance;
// HTML entities
graphicArea = document.getElementById('graphic-area');
graphicPattern = document.getElementById('graphic-pattern');
backgroundLayer = document.getElementById('background-layer');
wifiLayer = document.getElementById('wifi-layer');
mobileLayer = document.getElementById('mobile-layer');
axisLayer = document.getElementById('axis-layer');
todayLayer = document.getElementById('today-layer');
warningLayer = document.getElementById('warning-layer');
limitsLayer = document.getElementById('limits-layer');
wifiOverview = document.getElementById('wifiOverview');
mobileOverview = document.getElementById('mobileOverview');
wifiToggle = document.getElementById('wifiCheck');
mobileToggle = document.getElementById('mobileCheck');
appList = document.getElementById('app-usage-list');
noData = document.getElementById('app-usage-no-data');
window.addEventListener('localized', localize);
// Update and chart visibility
document.addEventListener('visibilitychange', updateWhenVisible);
wifiToggle.addEventListener('click', toggleWifi);
mobileToggle.addEventListener('click', toggleMobile);
// Setup the model
SimManager.requestDataSimIcc(function(dataSimIcc) {
ConfigManager.requestSettings(dataSimIcc.iccId,
function _onSettings(settings) {
debug('First time setup for model');
model = {
height: ChartUtils.toDevicePixels(graphicArea.clientHeight),
width: ChartUtils.toDevicePixels(graphicArea.clientWidth),
originX: Math.floor(
ChartUtils.toDevicePixels(graphicArea.clientWidth) * 0.15),
endX: Math.floor(
ChartUtils.toDevicePixels(graphicArea.clientWidth) * 0.95),
axis: {
Y: {
lower: 0,
margin: 0.20
},
X: {
lower: ChartUtils.calculateLowerDate(settings),
upper: ChartUtils.calculateUpperDate(settings)
}
},
limits: {
enabled: settings.dataLimit,
value: ChartUtils.getLimitInBytes(settings)
},
data: {
wifi: {
enabled: true
},
mobile: {
enabled: true
}
},
todayLabel: {}
};
ChartUtils.expandModel(model);
resetButtonState(settings);
ConfigManager.observe('dataLimit', toggleDataLimit, true);
ConfigManager.observe('dataLimitValue', setDataLimit, true);
ConfigManager.observe('lastCompleteDataReset', updateDataUsage, true);
ConfigManager.observe('lastDataReset', updateDataUsage, true);
ConfigManager.observe('nextReset', changeNextReset, true);
function finishInit() {
initialized = true;
updateDataUsage();
}
Common.loadApps()
.then(finishInit)
.catch(function(reason) {
debug(reason);
finishInit();
});
});
});
});
}
function localize() {
if (initialized) {
ChartUtils.drawTodayLayer(todayLayer, model);
ChartUtils.drawAxisLayer(axisLayer, model, mobileToggle.checked);
ChartUtils.drawLimits(limitsLayer, model, mobileToggle.checked);
}
}
function finalize() {
if (!initialized) {
return;
}
document.removeEventListener('visibilitychange', updateWhenVisible);
wifiToggle.removeEventListener('click', toggleWifi);
mobileToggle.removeEventListener('click', toggleMobile);
ConfigManager.removeObserver('dataLimit', toggleDataLimit);
ConfigManager.removeObserver('dataLimitValue', setDataLimit);
ConfigManager.removeObserver('lastCompleteDataReset', updateDataUsage);
ConfigManager.removeObserver('lastDataReset', updateDataUsage);
ConfigManager.removeObserver('nextReset', changeNextReset);
initialized = false;
}
function resetButtonState(settings) {
var isMobileChartVisible = settings.isMobileChartVisible;
if (typeof isMobileChartVisible === 'undefined') {
isMobileChartVisible = true;
}
if (isMobileChartVisible !== mobileToggle.checked) {
mobileToggle.checked = isMobileChartVisible;
toggleMobile();
}
var isWifiChartVisible = settings.isWifiChartVisible;
if (typeof isWifiChartVisible === 'undefined') {
isWifiChartVisible = false;
}
if (isWifiChartVisible !== wifiToggle.checked) {
wifiToggle.checked = isWifiChartVisible;
toggleWifi();
}
}
// UPDATES
// On visibility change
function updateWhenVisible(evt) {
if (!document.hidden) {
updateDataUsage();
}
}
function requestDataUsage(perApp) {
return new Promise(function(resolve) {
SimManager.requestDataSimIcc(function(dataSimIcc) {
ConfigManager.requestSettings(dataSimIcc.iccId,
function _onSettings(settings) {
var request = { type: 'datausage' };
if (perApp) {
request.apps = Common.allApps.map(function(app) {
return app.manifestURL;
});
}
costcontrol.request(request, resolve);
});
});
});
}
function maybeRequestPerAppUsage() {
if (!model) {
return;
}
if (!model.data.mobile.total) {
noData.hidden = false;
appList.hidden = true;
// Repeated here to not rely on the deferred `updateApps()` call which
// would add an annoying delay until clearing the data.
clearAppList();
} else {
noData.hidden = true;
appList.hidden = false;
// Bug 1064491: request per-app data usage on the next tick of
// the main loop to avoid performance regression in startup
setTimeout(function() {
requestDataUsage(true).then(updateApps);
}, 0);
}
}
function updateCharts(result) {
return new Promise(function(resolve, reject) {
if (result.status === 'success') {
SimManager.requestDataSimIcc(function(dataSimIcc) {
ConfigManager.requestSettings(dataSimIcc.iccId,
function _onSettings(settings) {
var modelData = result.data;
model.data.wifi.samples = modelData.wifi.samples;
model.data.wifi.total = modelData.wifi.total;
model.data.mobile.samples = modelData.mobile.samples;
model.data.mobile.total = modelData.mobile.total;
model.limits.enabled = settings.dataLimit;
model.limits.value = ChartUtils.getLimitInBytes(settings);
model.axis.X.upper = ChartUtils.calculateUpperDate(settings);
model.axis.X.lower = ChartUtils.calculateLowerDate(settings);
ChartUtils.expandModel(model);
resolve();
debug('Rendering');
drawCharts();
});
});
} else {
reject(new Error(
'Error requesting data usage. This should not happen.'));
}
});
}
function updateApps(result) {
if (result.status === 'success') {
model.data.wifi.apps = result.data.wifi.apps;
model.data.mobile.apps = result.data.mobile.apps;
drawApps(model);
}
}
// OBSERVERS
function toggleDataLimit(value) {
model.limits.enabled = value;
ChartUtils.drawBackgroundLayer(backgroundLayer, model,
mobileToggle.checked);
ChartUtils.drawAxisLayer(axisLayer, model, mobileToggle.checked);
ChartUtils.drawLimits(limitsLayer, model, mobileToggle.checked);
ChartUtils.drawWarningLayer(warningLayer, model);
}
function setDataLimit(value, old, key, settings) {
model.limits.value = ChartUtils.getLimitInBytes(settings);
ChartUtils.expandModel(model);
drawCharts();
}
function updateDataUsage() {
requestDataUsage()
.then(updateCharts)
.then(maybeRequestPerAppUsage);
}
function changeNextReset(value, old, key, settings) {
model.axis.X.upper = ChartUtils.calculateUpperDate(settings);
model.axis.X.lower = ChartUtils.calculateLowerDate(settings);
ChartUtils.expandModel(model);
drawCharts();
}
// USER INTERFACE
// On tapping on wifi toggle
function toggleWifi() {
var isChecked = wifiToggle.checked;
wifiLayer.hidden = !isChecked;
// save wifi toggled state
ConfigManager.setOption({ isWifiChartVisible: isChecked });
if (model) {
drawApps(model);
}
}
// On tapping on mobile toggle
function toggleMobile() {
var isChecked = mobileToggle.checked;
mobileLayer.hidden = !isChecked;
warningLayer.hidden = !isChecked;
limitsLayer.hidden = !isChecked;
// save wifi toggled state
ConfigManager.setOption({ isMobileChartVisible: isChecked });
if (model) {
ChartUtils.drawBackgroundLayer(backgroundLayer, model, isChecked);
ChartUtils.drawAxisLayer(axisLayer, model, isChecked);
ChartUtils.drawLimits(limitsLayer, model, isChecked);
drawApps(model);
}
}
function drawCharts() {
// Update overview
var wifiData = Formatting.roundData(model.data.wifi.total);
var mobileData = Formatting.roundData(model.data.mobile.total);
wifiOverview.textContent = Formatting.formatData(wifiData);
mobileOverview.textContent = Formatting.formatData(mobileData);
// Render the charts
ChartUtils.drawBackgroundLayer(backgroundLayer, model,
mobileToggle.checked);
ChartUtils.drawTodayLayer(todayLayer, model);
ChartUtils.drawAxisLayer(axisLayer, model, mobileToggle.checked);
ChartUtils.drawDataLayer(wifiLayer, model, 'wifi', {
stroke: ChartUtils.WIFI_CHART_STROKE,
fill: ChartUtils.WIFI_CHART_FILL
});
ChartUtils.drawDataLayer(mobileLayer, model, 'mobile', {
stroke: ChartUtils.MOBILE_CHART_STROKE,
fill: ChartUtils.MOBILE_CHART_FILL,
pattern: graphicPattern
});
ChartUtils.drawWarningLayer(warningLayer, model);
ChartUtils.drawLimits(limitsLayer, model, mobileToggle.checked);
drawApps(model);
}
var cachedAppItems = {};
function drawApps(model) {
function createAppItem(app) {
var isSystem = app.manifestURL === SYSTEM_MANIFEST;
var appElement = document.createElement('li');
appElement.className = 'app-item';
var linkElement = document.createElement('a');
if (!isSystem) {
linkElement.href = '##appdetail-view?manifestURL=' + app.manifestURL;
}
appElement.appendChild(linkElement);
var imgElement = document.createElement('img');
imgElement.className = 'app-image';
imgElement.src = Common.getAppIcon(app);
imgElement.setAttribute('role', 'presentation');
imgElement.onerror = function() {
console.warn('Unable to load icon: ' + this.src);
this.src = '/style/images/app/icons/default.png';
};
linkElement.appendChild(imgElement);
var appInfoElement = document.createElement('div');
appInfoElement.className = 'app-info';
linkElement.appendChild(appInfoElement);
var nameElement = document.createElement('div');
nameElement.className = 'app-info-row app-name';
nameElement.textContent = isSystem ?
_('data-usage-other-apps') :
Common.getLocalizedAppName(app);
appInfoElement.appendChild(nameElement);
var barElement = document.createElement('div');
barElement.className = 'app-info-row app-usage-bar';
barElement.setAttribute('role', 'presentation');
appInfoElement.appendChild(barElement);
var usedBarElement = document.createElement('div');
usedBarElement.className = 'app-usage-bar-used';
usedBarElement.setAttribute('role', 'presentation');
barElement.appendChild(usedBarElement);
var usageElement = document.createElement('div');
usageElement.className = 'app-info-row app-usage-total';
appInfoElement.appendChild(usageElement);
return appElement;
}
function updateAppItemUsage(appItem, total) {
var usedBarElement =
appItem.getElementsByClassName('app-usage-bar-used')[0];
var totalElement =
appItem.getElementsByClassName('app-usage-total')[0];
var barTotal = mobileTotal;
if (model.limits.enabled && model.limits.value !== null) {
barTotal = Math.max(barTotal, model.limits.value);
}
var usedPercent = (total / barTotal) * 100;
usedBarElement.style.width = usedPercent + '%';
totalElement.textContent = '' + Formatting.formatData(
Formatting.roundData(total));
}
// Front-end workaround for Bug 1083680: Noticeable difference between by
// application breakdown totals and the total displayed in chart and widget.
// This method adds the residual traffic (the traffic that cannot be not
// allocated to an app) to the System application.
function fixResidualTraffic() {
var breakdownTotal = 0;
if (manifests.length > 0) {
breakdownTotal =
manifests.reduce(function(accumulatedTraffic, appManifest) {
return accumulatedTraffic + mobileApps[appManifest].total;
}, 0);
}
var residualTraffic = mobileTotal - breakdownTotal;
// Updating System traffic to add the residual traffic
if (residualTraffic > 0) {
// Ensure system app exists
mobileApps[SYSTEM_MANIFEST] = mobileApps[SYSTEM_MANIFEST] || {total: 0};
var systemTraffic = mobileApps[SYSTEM_MANIFEST].total + residualTraffic;
mobileApps[SYSTEM_MANIFEST].total = systemTraffic;
if (!manifests[SYSTEM_MANIFEST]) {
manifests.push(SYSTEM_MANIFEST);
}
}
}
clearAppList();
var mobileTotal = model.data.mobile.total;
var mobileApps = model.data.mobile.apps;
if (!mobileApps) {
return;
}
// Filter out apps that have not used any data yet.
var manifests = Object.keys(mobileApps).filter(function(key) {
return mobileApps[key].total > 0;
});
// Note: The second premise (mobileTotal === 0) must be removed when the
// fixResidualTraffic method will be eliminated.
if (manifests.length === 0 && mobileTotal === 0) {
return;
}
fixResidualTraffic();
// Sort by total data usage, descending
manifests.sort(function(a, b) {
return mobileApps[b].total - mobileApps[a].total;
});
var fragment = document.createDocumentFragment();
manifests.forEach(function(manifestURL) {
var app = Common.allApps.find(function(app) {
return app.manifestURL === manifestURL;
});
if (!app) {
debug('No app with manifest URL: ' + manifestURL);
return;
}
var appTotal = mobileApps[manifestURL].total;
var appItem = cachedAppItems[manifestURL];
if (!appItem) {
appItem = cachedAppItems[manifestURL] = createAppItem(app);
}
updateAppItemUsage(appItem, appTotal);
fragment.appendChild(appItem);
});
appList.appendChild(fragment);
}
function clearAppList() {
appList.innerHTML = '';
}
return {
initialize: setupTab,
finalize: finalize
};
}());
DataUsageTab.initialize();
| 32.907071 | 80 | 0.648229 |
b9d79877eb3fc0ad2ed5cb5b666f15115690cdf0 | 216 | js | JavaScript | src/entities/bosses/atlas/segments/right_segment.js | gaudeon/interstice | 7e21a84b4164900ddf2e37a493a21fa36fbfb676 | [
"MIT"
] | null | null | null | src/entities/bosses/atlas/segments/right_segment.js | gaudeon/interstice | 7e21a84b4164900ddf2e37a493a21fa36fbfb676 | [
"MIT"
] | null | null | null | src/entities/bosses/atlas/segments/right_segment.js | gaudeon/interstice | 7e21a84b4164900ddf2e37a493a21fa36fbfb676 | [
"MIT"
] | null | null | null | import BossSegment from '../../../boss/segment';
export default class AtlasRightSegment extends BossSegment {
constructor (segments) {
super(segments, 0, 48, "game_atlas", "atlasSegRightThrust");
}
} | 30.857143 | 68 | 0.689815 |
b9d7f088362a019aac9d4523df7cbc6ab6fcfb9e | 6,515 | js | JavaScript | node_modules/gatsby-source-filesystem/gatsby-node.js | roarinLion/dcsitenew | f3552e1dc823f0041b7e95cee79fa03092b1d540 | [
"RSA-MD"
] | 8 | 2021-09-20T13:25:37.000Z | 2022-01-02T06:59:10.000Z | node_modules/gatsby-source-filesystem/gatsby-node.js | roarinLion/dcsitenew | f3552e1dc823f0041b7e95cee79fa03092b1d540 | [
"RSA-MD"
] | 10 | 2021-06-25T09:08:13.000Z | 2021-07-03T10:58:01.000Z | node_modules/gatsby-source-filesystem/gatsby-node.js | TheMattSykes/iups-website | 7739365641afbd9594c2b3d69bb00d9215eae3cc | [
"FSFAP"
] | 3 | 2021-10-06T13:00:51.000Z | 2021-10-17T06:38:40.000Z | "use strict";
const chokidar = require(`chokidar`);
const fs = require(`fs`);
const path = require(`path`);
const {
Machine,
interpret
} = require(`xstate`);
const {
createFileNode
} = require(`./create-file-node`);
const {
ERROR_MAP
} = require(`./error-utils`);
exports.onPreInit = ({
reporter
}) => {
if (reporter.setErrorMap) {
reporter.setErrorMap(ERROR_MAP);
}
};
/**
* Create a state machine to manage Chokidar's not-ready/ready states.
*/
const createFSMachine = ({
actions: {
createNode,
deleteNode
},
getNode,
createNodeId,
reporter
}, pluginOptions) => {
const createAndProcessNode = path => {
const fileNodePromise = createFileNode(path, createNodeId, pluginOptions).then(fileNode => {
createNode(fileNode);
return null;
});
return fileNodePromise;
};
const deletePathNode = path => {
const node = getNode(createNodeId(path)); // It's possible the node was never created as sometimes tools will
// write and then immediately delete temporary files to the file system.
if (node) {
deleteNode(node);
}
}; // For every path that is reported before the 'ready' event, we throw them
// into a queue and then flush the queue when 'ready' event arrives.
// After 'ready', we handle the 'add' event without putting it into a queue.
let pathQueue = [];
const flushPathQueue = () => {
const queue = pathQueue.slice();
pathQueue = null;
return Promise.all( // eslint-disable-next-line consistent-return
queue.map(({
op,
path
}) => {
switch (op) {
case `delete`:
return deletePathNode(path);
case `upsert`:
return createAndProcessNode(path);
}
}));
};
const log = expr => (ctx, action, meta) => {
if (meta.state.matches(`BOOTSTRAP.BOOTSTRAPPED`)) {
reporter.info(expr(ctx, action, meta));
}
};
const fsMachine = Machine({
id: `fs`,
type: `parallel`,
states: {
BOOTSTRAP: {
initial: `BOOTSTRAPPING`,
states: {
BOOTSTRAPPING: {
on: {
BOOTSTRAP_FINISHED: `BOOTSTRAPPED`
}
},
BOOTSTRAPPED: {
type: `final`
}
}
},
CHOKIDAR: {
initial: `NOT_READY`,
states: {
NOT_READY: {
on: {
CHOKIDAR_READY: `READY`,
CHOKIDAR_ADD: {
actions: `queueNodeProcessing`
},
CHOKIDAR_CHANGE: {
actions: `queueNodeProcessing`
},
CHOKIDAR_UNLINK: {
actions: `queueNodeDeleting`
}
},
exit: `flushPathQueue`
},
READY: {
on: {
CHOKIDAR_ADD: {
actions: [`createAndProcessNode`, log((_, {
pathType,
path
}) => `added ${pathType} at ${path}`)]
},
CHOKIDAR_CHANGE: {
actions: [`createAndProcessNode`, log((_, {
pathType,
path
}) => `changed ${pathType} at ${path}`)]
},
CHOKIDAR_UNLINK: {
actions: [`deletePathNode`, log((_, {
pathType,
path
}) => `deleted ${pathType} at ${path}`)]
}
}
}
}
}
}
}, {
actions: {
createAndProcessNode(_, {
pathType,
path
}) {
createAndProcessNode(path).catch(err => reporter.error(err));
},
deletePathNode(_, {
pathType,
path
}, {
state
}) {
deletePathNode(path);
},
flushPathQueue(_, {
resolve,
reject
}) {
flushPathQueue().then(resolve, reject);
},
queueNodeDeleting(_, {
path
}) {
pathQueue.push({
op: `delete`,
path
});
},
queueNodeProcessing(_, {
path
}) {
pathQueue.push({
op: `upsert`,
path
});
}
}
});
return interpret(fsMachine).start();
};
exports.pluginOptionsSchema = ({
Joi
}) => Joi.object({
name: Joi.string(),
path: Joi.string(),
ignore: Joi.array().items(Joi.string(), Joi.object().regex(), Joi.function())
});
exports.sourceNodes = (api, pluginOptions) => {
// Validate that the path exists.
if (!fs.existsSync(pluginOptions.path)) {
api.reporter.panic(`
The path passed to gatsby-source-filesystem does not exist on your file system:
${pluginOptions.path}
Please pick a path to an existing directory.
See docs here - https://www.gatsbyjs.org/packages/gatsby-source-filesystem/
`);
} // Validate that the path is absolute.
// Absolute paths are required to resolve images correctly.
if (!path.isAbsolute(pluginOptions.path)) {
pluginOptions.path = path.resolve(process.cwd(), pluginOptions.path);
}
const fsMachine = createFSMachine(api, pluginOptions); // Once bootstrap is finished, we only let one File node update go through
// the system at a time.
api.emitter.on(`BOOTSTRAP_FINISHED`, () => {
fsMachine.send(`BOOTSTRAP_FINISHED`);
});
const watcher = chokidar.watch(pluginOptions.path, {
ignored: [`**/*.un~`, `**/.DS_Store`, `**/.gitignore`, `**/.npmignore`, `**/.babelrc`, `**/yarn.lock`, `**/bower_components`, `**/node_modules`, `../**/dist/**`, ...(pluginOptions.ignore || [])]
});
watcher.on(`add`, path => {
fsMachine.send({
type: `CHOKIDAR_ADD`,
pathType: `file`,
path
});
});
watcher.on(`change`, path => {
fsMachine.send({
type: `CHOKIDAR_CHANGE`,
pathType: `file`,
path
});
});
watcher.on(`unlink`, path => {
fsMachine.send({
type: `CHOKIDAR_UNLINK`,
pathType: `file`,
path
});
});
watcher.on(`addDir`, path => {
fsMachine.send({
type: `CHOKIDAR_ADD`,
pathType: `directory`,
path
});
});
watcher.on(`unlinkDir`, path => {
fsMachine.send({
type: `CHOKIDAR_UNLINK`,
pathType: `directory`,
path
});
});
return new Promise((resolve, reject) => {
watcher.on(`ready`, () => {
fsMachine.send({
type: `CHOKIDAR_READY`,
resolve,
reject
});
});
});
};
exports.setFieldsOnGraphQLNodeType = require(`./extend-file-node`); | 23.519856 | 198 | 0.53231 |
b9d886d123ed54cf8a24a3753a8a6cd113877829 | 1,218 | js | JavaScript | dist/js/app.js | vipulism/gulphtml | ddef93534f72f19d5b77db16c1bf049d8eae0531 | [
"MIT"
] | null | null | null | dist/js/app.js | vipulism/gulphtml | ddef93534f72f19d5b77db16c1bf049d8eae0531 | [
"MIT"
] | null | null | null | dist/js/app.js | vipulism/gulphtml | ddef93534f72f19d5b77db16c1bf049d8eae0531 | [
"MIT"
] | null | null | null | "use strict";
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
console.log('5ppp5');
var p = ["lo0", "kjh"];
p = _toConsumableArray(p).concat(["ko"]);
hukoo();
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC5qcyJdLCJuYW1lcyI6WyJjb25zb2xlIiwibG9nIiwicCIsImh1a29vIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUFBLE9BQU8sQ0FBQ0MsR0FBUixDQUFZLE9BQVo7QUFFQSxJQUFJQyxDQUFDLEdBQUcsQ0FBQyxLQUFELEVBQVEsS0FBUixDQUFSO0FBQ0FBLENBQUMsc0JBQU9BLENBQVAsVUFBVSxJQUFWLEVBQUQ7QUFDQUMsS0FBSyIsInNvdXJjZXNDb250ZW50IjpbImNvbnNvbGUubG9nKCc1cHBwNScpOyBcclxuXHJcbnZhciBwID0gW1wibG8wXCIsIFwia2poXCJdO1xyXG5wID0gWy4uLnAsIFwia29cIl0gIFxyXG5odWtvbygpO1xyXG4gXHJcbiAiXSwiZmlsZSI6ImFwcC5qcyJ9
| 76.125 | 547 | 0.825944 |
b9d8c4f74bbf959d8782056de5ba63a69ba01154 | 5,154 | js | JavaScript | static/assets/javascripts/search.js | ujihisa/slacklog-generator | 82617d62372d63f33838f1f0914171984c117683 | [
"CC-BY-4.0"
] | null | null | null | static/assets/javascripts/search.js | ujihisa/slacklog-generator | 82617d62372d63f33838f1f0914171984c117683 | [
"CC-BY-4.0"
] | null | null | null | static/assets/javascripts/search.js | ujihisa/slacklog-generator | 82617d62372d63f33838f1f0914171984c117683 | [
"CC-BY-4.0"
] | null | null | null | const onLoad = () => {
const GRAM_N = 2;
const toHexString = (n) => {
return n.toString(16).padStart(2, "0");
};
const to2dString = (n) => {
return n.toString().padStart(2, "0");
};
class Uint8ArrayReader {
constructor(u8ary) {
this.u8ary = u8ary;
this.i = 0;
}
get length() {
return this.u8ary.length;
}
readInt() {
const n = (this.u8ary[this.i] << 24) | (this.u8ary[this.i + 1] << 16) | (this.u8ary[this.i + 2] << 8) | this.u8ary[this.i + 3];
this.i += 4;
return n;
}
readVInt() {
let n = 0;
let cont = true;
for (; cont; this.i++) {
n <<= 7;
n |= this.u8ary[this.i] & 0b01111111;
cont = (this.u8ary[this.i] & 0b10000000) != 0;
}
return n;
}
isEOF() {
return this.u8ary.length <= this.i;
}
}
class Index {
constructor() {
this.indexes = new Map();
}
async get(key) {
const cached = this.indexes.get(key);
if (cached) {
return cached;
}
const paths = [];
for (let i = 0; i < key.length; i++) {
const n = key.charCodeAt(i);
paths.push(toHexString(n >> 8));
paths.push(toHexString(n & 0xff));
}
const res = await fetch(`./index/${paths.join("/")}.index`);
const index = new Map();
if (res.ok) {
const blob = await res.blob();
const reader = new Uint8ArrayReader(new Uint8Array(await blob.arrayBuffer()));
while (!reader.isEOF()) {
const channelNumber = reader.readVInt();
let mesCount = reader.readVInt();
while (0 <= --mesCount) {
const tsSec = reader.readInt();
const tsMicrosec = reader.readVInt();
const ts = `${tsSec}.${tsMicrosec.toString().padStart(6, "0")}`;
const key = `${channelNumber}:${ts}`;
let posSet = index.get(key);
if (posSet == null) {
posSet = new Set();
index.set(key, posSet);
}
for (;;) {
const pos = reader.readVInt();
if (pos === 0) {
break;
}
posSet.add(pos - 1);
}
}
}
} else {
// TODO: check error type
}
this.indexes.set(key, index);
return index;
}
}
const index = new Index();
const sepRegexp = new RegExp(`.{1,${GRAM_N}}`, "g");
const numToChannel = new Map();
(async () => {
const res = await fetch("./index/channel");
for (const line of (await res.text()).split("\n")) {
const [n, channelID, channelName] = line.split("\t");
if (channelID != null) {
numToChannel.set(n - 0, {channelID, channelName});
}
}
})();
const searchByWord = async (word) => {
const indexes = await Promise.all(
[...word.matchAll(sepRegexp)].map(async (chunk) => index.get(chunk[0]))
);
const result = indexes.reduce((acc, cur) => {
const next = new Map();
for (const [key, prevPosSet] of acc.entries()) {
const currentPosSet = cur.get(key);
for (const prevPos of prevPosSet.values()) {
if (currentPosSet?.has(prevPos + GRAM_N)) {
let nestPosSet = next.get(key);
if (nestPosSet == null) {
nestPosSet = new Set();
next.set(key, nestPosSet);
}
nestPosSet.add(prevPos + GRAM_N);
}
}
}
return next;
});
return result;
};
const parseQuery = (query) => {
// TODO: parse
return query;
};
const search = async (query) => {
const word = parseQuery(query);
return searchByWord(word);
};
const execute = async () => {
const resultElement = document.getElementById("result");
try {
const startTime = Date.now();
const text = document.getElementById("search-text");
const result = await search(text.value);
const links = [...result.keys()].map((doc) => {
const [channelNumber, ts] = doc.split(":");
const {channelID, channelName} = numToChannel.get(channelNumber - 0);
const date = new Date(ts.split(".")[0] * 1000);
const link = `${channelID}/${date.getFullYear()}/${(date.getMonth() + 1).toString().padStart(2, "0")}/#ts-${ts}`;
return `<a href="${link}">#${channelName}: ${date.getFullYear()}-${to2dString(date.getMonth() + 1)}-${to2dString(date.getDay())} ${to2dString(date.getHours())}:${to2dString(date.getMinutes())}:${to2dString(date.getSeconds())}</a>`;
});
const processTime = Date.now() - startTime;
resultElement.innerHTML = `<p>${links.length} 件ヒットしました (${processTime / 1000} 秒)</p>${links.join("<br>")}`;
} catch (e) {
resultElement.innerHTML = `検索中にエラーが発生しました: ${e.name}: ${e.message}`;
}
}
document.getElementById("search-button").addEventListener("click", execute);
document.getElementById("search-text").addEventListener("keypress", (event) => {
if (event.key === "Enter") {
execute();
}
});
};
window.addEventListener('DOMContentLoaded', () => {
onLoad();
});
| 29.284091 | 243 | 0.526193 |
b9d8c6504eedc86478ac0716c073ff13c621aba2 | 724 | js | JavaScript | setEnv.js | weiishere/portal-cms | 82c704f7938de3815a7e5b75f1a64063d0b1b12f | [
"MIT"
] | null | null | null | setEnv.js | weiishere/portal-cms | 82c704f7938de3815a7e5b75f1a64063d0b1b12f | [
"MIT"
] | null | null | null | setEnv.js | weiishere/portal-cms | 82c704f7938de3815a7e5b75f1a64063d0b1b12f | [
"MIT"
] | null | null | null | /**
* Created by tanxiangyuan on 2016/10/24.
*/
const path = require('path');
const fs = require('fs');
console.log(`in setEnv , process.env.NODE_ENV is [${process.env.NODE_ENV}]`);
//根据当前编译环境的配置拼接对应的配置文件地址
const envFilePath = path.join(__dirname, 'server/config', process.env.NODE_ENV, 'index.js');
if (!fs.existsSync(envFilePath)) {
console.error(`error : 根据当前NODE_ENV[${process.env.NODE_ENV}]定义,没有找到对应的环境配置文件:${envFilePath}`);
process.exit(1);
}
const validEnvPath = path.join(__dirname, 'server/config/index.js');
//检查bin目录是否已经存在对应的配置文件,有就删除
if (fs.existsSync(validEnvPath)) {
fs.unlinkSync(validEnvPath);
}
//将编译环境对应的配置文件拷贝到bin目录
fs.createReadStream(envFilePath).pipe(fs.createWriteStream(validEnvPath)); | 27.846154 | 96 | 0.740331 |
b9d911188d91350fba1b90de570bc2ec46520e1c | 82,946 | js | JavaScript | ckeditor/static/ckeditor/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js | 4nzor/django-ckeditor | 3aa4b7b61c41e254d302d868470edfbcd1e4c6a9 | [
"BSD-3-Clause"
] | null | null | null | ckeditor/static/ckeditor/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js | 4nzor/django-ckeditor | 3aa4b7b61c41e254d302d868470edfbcd1e4c6a9 | [
"BSD-3-Clause"
] | null | null | null | ckeditor/static/ckeditor/ckeditor/plugins/codemirror/js/codemirror.mode.php.min.js | 4nzor/django-ckeditor | 3aa4b7b61c41e254d302d868470edfbcd1e4c6a9 | [
"BSD-3-Clause"
] | 1 | 2022-03-11T11:10:18.000Z | 2022-03-11T11:10:18.000Z | (function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],a)}else{a(CodeMirror)}}})(function(d){var g={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]};function f(n,j,k){var m=n.current(),l=m.search(j);if(l>-1){n.backUp(m.length-l)}else{if(m.match(/<\/?$/)){n.backUp(m.length);if(!n.match(j,false)){n.match(m)}}}return k}var e={};function c(j){var k=e[j];if(k){return k}return e[j]=new RegExp("\\s+"+j+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function a(l,j){var k=l.match(c(j));return k?k[2]:""}function i(k,j){return new RegExp((j?"^":"")+"</s*"+k+"s*>","i")}function h(o,n){for(var j in o){var k=n[j]||(n[j]=[]);var m=o[j];for(var l=m.length-1;l>=0;l--){k.unshift(m[l])}}}function b(l,m){for(var k=0;k<l.length;k++){var j=l[k];if(!j[0]||j[1].test(a(m,j[0]))){return j[2]}}}d.defineMode("htmlmixed",function(k,o){var q=d.getMode(k,{name:"xml",htmlMode:true,multilineTagIndentFactor:o.multilineTagIndentFactor,multilineTagIndentPastTag:o.multilineTagIndentPastTag});var j={};var p=o&&o.tags,n=o&&o.scriptTypes;h(g,j);if(p){h(p,j)}if(n){for(var m=n.length-1;m>=0;m--){j.script.unshift(["type",n[m].matches,n[m].mode])}}function l(z,r){var s=q.token(z,r.htmlState),A=/\btag\b/.test(s),u;if(A&&!/[<>\s\/]/.test(z.current())&&(u=r.htmlState.tagName&&r.htmlState.tagName.toLowerCase())&&j.hasOwnProperty(u)){r.inTag=u+" "}else{if(r.inTag&&A&&/>$/.test(z.current())){var t=/^([\S]+) (.*)/.exec(r.inTag);r.inTag=null;var y=z.current()==">"&&b(j[t[1]],t[2]);var x=d.getMode(k,y);var w=i(t[1],true),v=i(t[1],false);r.token=function(C,B){if(C.match(w,false)){B.token=l;B.localState=B.localMode=null;return null}return f(C,v,B.localMode.token(C,B.localState))};r.localMode=x;r.localState=d.startState(x,q.indent(r.htmlState,""))}else{if(r.inTag){r.inTag+=z.current();if(z.eol()){r.inTag+=" "}}}}return s}return{startState:function(){var r=q.startState();return{token:l,inTag:null,localMode:null,localState:null,htmlState:r}},copyState:function(s){var r;if(s.localState){r=d.copyState(s.localMode,s.localState)}return{token:s.token,inTag:s.inTag,localMode:s.localMode,localState:r,htmlState:d.copyState(q,s.htmlState)}},token:function(s,r){return r.token(s,r)},indent:function(s,r){if(!s.localMode||/^\s*<\//.test(r)){return q.indent(s.htmlState,r)}else{if(s.localMode.indent){return s.localMode.indent(s.localState,r)}else{return d.Pass}}},innerMode:function(r){return{state:r.localState||r.htmlState,mode:r.localMode||q}}}},"xml","javascript","css");d.defineMIME("text/html","htmlmixed")});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(a){var b={autoSelfClosers:{area:true,base:true,br:true,col:true,command:true,embed:true,frame:true,hr:true,img:true,input:true,keygen:true,link:true,meta:true,param:true,source:true,track:true,wbr:true,menuitem:true},implicitlyClosed:{dd:true,li:true,optgroup:true,option:true,p:true,rp:true,rt:true,tbody:true,td:true,tfoot:true,th:true,tr:true},contextGrabbers:{dd:{dd:true,dt:true},dt:{dd:true,dt:true},li:{li:true},option:{option:true,optgroup:true},optgroup:{optgroup:true},p:{address:true,article:true,aside:true,blockquote:true,dir:true,div:true,dl:true,fieldset:true,footer:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,header:true,hgroup:true,hr:true,menu:true,nav:true,ol:true,p:true,pre:true,section:true,table:true,ul:true},rp:{rp:true,rt:true},rt:{rp:true,rt:true},tbody:{tbody:true,tfoot:true},td:{td:true,th:true},tfoot:{tbody:true},th:{td:true,th:true},thead:{tbody:true,tfoot:true},tr:{tr:true}},doNotIndent:{pre:true},allowUnquoted:true,allowMissing:true,caseFold:true};var c={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:false,allowMissing:false,caseFold:false};a.defineMode("xml",function(m,y){var r=m.indentUnit;var z={};var l=y.htmlMode?b:c;for(var f in l){z[f]=l[f]}for(var f in y){z[f]=y[f]}var g,h;function p(G,F){function D(H){F.tokenize=H;return H(G,F)}var E=G.next();if(E=="<"){if(G.eat("!")){if(G.eat("[")){if(G.match("CDATA[")){return D(x("atom","]]>"))}else{return null}}else{if(G.match("--")){return D(x("comment","-->"))}else{if(G.match("DOCTYPE",true,true)){G.eatWhile(/[\w\._\-]/);return D(A(1))}else{return null}}}}else{if(G.eat("?")){G.eatWhile(/[\w\._\-]/);F.tokenize=x("meta","?>");return"meta"}else{g=G.eat("/")?"closeTag":"openTag";F.tokenize=o;return"tag bracket"}}}else{if(E=="&"){var C;if(G.eat("#")){if(G.eat("x")){C=G.eatWhile(/[a-fA-F\d]/)&&G.eat(";")}else{C=G.eatWhile(/[\d]/)&&G.eat(";")}}else{C=G.eatWhile(/[\w\.\-:]/)&&G.eat(";")}return C?"atom":"error"}else{G.eatWhile(/[^&<]/);return null}}}p.isInText=true;function o(F,E){var D=F.next();if(D==">"||(D=="/"&&F.eat(">"))){E.tokenize=p;g=D==">"?"endTag":"selfcloseTag";return"tag bracket"}else{if(D=="="){g="equals";return null}else{if(D=="<"){E.tokenize=p;E.state=n;E.tagName=E.tagStart=null;var C=E.tokenize(F,E);return C?C+" tag error":"tag error"}else{if(/[\'\"]/.test(D)){E.tokenize=k(D);E.stringStartCol=F.column();return E.tokenize(F,E)}else{F.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);return"word"}}}}}function k(C){var D=function(F,E){while(!F.eol()){if(F.next()==C){E.tokenize=o;break}}return"string"};D.isInAttribute=true;return D}function x(D,C){return function(F,E){while(!F.eol()){if(F.match(C)){E.tokenize=p;break}F.next()}return D}}function A(C){return function(F,E){var D;while((D=F.next())!=null){if(D=="<"){E.tokenize=A(C+1);return E.tokenize(F,E)}else{if(D==">"){if(C==1){E.tokenize=p;break}else{E.tokenize=A(C-1);return E.tokenize(F,E)}}}}return"meta"}}function t(D,C,E){this.prev=D.context;this.tagName=C;this.indent=D.indented;this.startOfLine=E;if(z.doNotIndent.hasOwnProperty(C)||(D.context&&D.context.noIndent)){this.noIndent=true}}function w(C){if(C.context){C.context=C.context.prev}}function s(E,D){var C;while(true){if(!E.context){return}C=E.context.tagName;if(!z.contextGrabbers.hasOwnProperty(C)||!z.contextGrabbers[C].hasOwnProperty(D)){return}w(E)}}function n(C,E,D){if(C=="openTag"){D.tagStart=E.column();return d}else{if(C=="closeTag"){return v}else{return n}}}function d(C,E,D){if(C=="word"){D.tagName=E.current();h="tag";return e}else{h="error";return d}}function v(D,F,E){if(D=="word"){var C=F.current();if(E.context&&E.context.tagName!=C&&z.implicitlyClosed.hasOwnProperty(E.context.tagName)){w(E)}if((E.context&&E.context.tagName==C)||z.matchClosing===false){h="tag";return u}else{h="tag error";return B}}else{h="error";return B}}function u(D,C,E){if(D!="endTag"){h="error";return u}w(E);return n}function B(C,E,D){h="error";return u(C,E,D)}function e(F,D,G){if(F=="word"){h="attribute";return j}else{if(F=="endTag"||F=="selfcloseTag"){var E=G.tagName,C=G.tagStart;G.tagName=G.tagStart=null;if(F=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(E)){s(G,E)}else{s(G,E);G.context=new t(G,E,C==G.indented)}return n}}h="error";return e}function j(C,E,D){if(C=="equals"){return q}if(!z.allowMissing){h="error"}return e(C,E,D)}function q(C,E,D){if(C=="string"){return i}if(C=="word"&&z.allowUnquoted){h="string";return e}h="error";return e(C,E,D)}function i(C,E,D){if(C=="string"){return i}return e(C,E,D)}return{startState:function(C){var D={tokenize:p,state:n,indented:C||0,tagName:null,tagStart:null,context:null};if(C!=null){D.baseIndent=C}return D},token:function(E,D){if(!D.tagName&&E.sol()){D.indented=E.indentation()}if(E.eatSpace()){return null}g=null;var C=D.tokenize(E,D);if((C||g)&&C!="comment"){h=null;D.state=D.state(g||C,E,D);if(h){C=h=="error"?C+" error":h}}return C},indent:function(H,D,G){var F=H.context;if(H.tokenize.isInAttribute){if(H.tagStart==H.indented){return H.stringStartCol+1}else{return H.indented+r}}if(F&&F.noIndent){return a.Pass}if(H.tokenize!=o&&H.tokenize!=p){return G?G.match(/^(\s*)/)[0].length:0}if(H.tagName){if(z.multilineTagIndentPastTag!==false){return H.tagStart+H.tagName.length+2}else{return H.tagStart+r*(z.multilineTagIndentFactor||1)}}if(z.alignCDATA&&/<!\[CDATA\[/.test(D)){return 0}var C=D&&/^<(\/)?([\w_:\.-]*)/.exec(D);if(C&&C[1]){while(F){if(F.tagName==C[2]){F=F.prev;break}else{if(z.implicitlyClosed.hasOwnProperty(F.tagName)){F=F.prev}else{break}}}}else{if(C){while(F){var E=z.contextGrabbers[F.tagName];if(E&&E.hasOwnProperty(C[2])){F=F.prev}else{break}}}}while(F&&F.prev&&!F.startOfLine){F=F.prev}if(F){return F.indent+r}else{return H.baseIndent||0}},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(C){if(C.state==q){C.state=e}}}});a.defineMIME("text/xml","xml");a.defineMIME("application/xml","xml");if(!a.mimeModes.hasOwnProperty("text/html")){a.defineMIME("text/html",{name:"xml",htmlMode:true})}});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(a){function b(e,d,c){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(d.lastType)||(d.lastType=="quasi"&&/\{\s*$/.test(e.string.slice(0,e.pos-(c||0))))}a.defineMode("javascript",function(ac,am){var m=ac.indentUnit;var C=am.statementIndent;var aE=am.jsonld;var B=am.json||aE;var h=am.typescript;var ax=am.wordCharacters||/[\w$\xa1-\uffff]/;var av=function(){function aU(aW){return{type:aW,style:"keyword"}}var aP=aU("keyword a"),aN=aU("keyword b"),aM=aU("keyword c");var aO=aU("operator"),aS={type:"atom",style:"atom"};var aQ={"if":aU("if"),"while":aP,"with":aP,"else":aN,"do":aN,"try":aN,"finally":aN,"return":aM,"break":aM,"continue":aM,"new":aU("new"),"delete":aM,"throw":aM,"debugger":aM,"var":aU("var"),"const":aU("var"),let:aU("var"),"function":aU("function"),"catch":aU("catch"),"for":aU("for"),"switch":aU("switch"),"case":aU("case"),"default":aU("default"),"in":aO,"typeof":aO,"instanceof":aO,"true":aS,"false":aS,"null":aS,"undefined":aS,"NaN":aS,"Infinity":aS,"this":aU("this"),"class":aU("class"),"super":aU("atom"),yield:aM,"export":aU("export"),"import":aU("import"),"extends":aM};if(h){var aV={type:"variable",style:"variable-3"};var aR={"interface":aU("class"),"implements":aM,namespace:aM,module:aU("module"),"enum":aU("module"),"public":aU("modifier"),"private":aU("modifier"),"protected":aU("modifier"),"abstract":aU("modifier"),as:aO,string:aV,number:aV,"boolean":aV,any:aV};for(var aT in aR){aQ[aT]=aR[aT]}}return aQ}();var R=/[+\-*&%=<>!?|~^]/;var au=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function H(aP){var aN=false,aM,aO=false;while((aM=aP.next())!=null){if(!aN){if(aM=="/"&&!aO){return}if(aM=="["){aO=true}else{if(aO&&aM=="]"){aO=false}}}aN=!aN&&aM=="\\"}}var U,I;function N(aO,aN,aM){U=aO;I=aM;return aN}function W(aQ,aO){var aM=aQ.next();if(aM=='"'||aM=="'"){aO.tokenize=T(aM);return aO.tokenize(aQ,aO)}else{if(aM=="."&&aQ.match(/^\d+(?:[eE][+\-]?\d+)?/)){return N("number","number")}else{if(aM=="."&&aQ.match("..")){return N("spread","meta")}else{if(/[\[\]{}\(\),;\:\.]/.test(aM)){return N(aM)}else{if(aM=="="&&aQ.eat(">")){return N("=>","operator")}else{if(aM=="0"&&aQ.eat(/x/i)){aQ.eatWhile(/[\da-f]/i);return N("number","number")}else{if(aM=="0"&&aQ.eat(/o/i)){aQ.eatWhile(/[0-7]/i);return N("number","number")}else{if(aM=="0"&&aQ.eat(/b/i)){aQ.eatWhile(/[01]/i);return N("number","number")}else{if(/\d/.test(aM)){aQ.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);return N("number","number")}else{if(aM=="/"){if(aQ.eat("*")){aO.tokenize=aD;return aD(aQ,aO)}else{if(aQ.eat("/")){aQ.skipToEnd();return N("comment","comment")}else{if(b(aQ,aO,1)){H(aQ);aQ.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);return N("regexp","string-2")}else{aQ.eatWhile(R);return N("operator","operator",aQ.current())}}}}else{if(aM=="`"){aO.tokenize=aF;return aF(aQ,aO)}else{if(aM=="#"){aQ.skipToEnd();return N("error","error")}else{if(R.test(aM)){aQ.eatWhile(R);return N("operator","operator",aQ.current())}else{if(ax.test(aM)){aQ.eatWhile(ax);var aP=aQ.current(),aN=av.propertyIsEnumerable(aP)&&av[aP];return(aN&&aO.lastType!=".")?N(aN.type,aN.style,aP):N("variable","variable",aP)}}}}}}}}}}}}}}}function T(aM){return function(aQ,aO){var aP=false,aN;if(aE&&aQ.peek()=="@"&&aQ.match(au)){aO.tokenize=W;return N("jsonld-keyword","meta")}while((aN=aQ.next())!=null){if(aN==aM&&!aP){break}aP=!aP&&aN=="\\"}if(!aP){aO.tokenize=W}return N("string","string")}}function aD(aP,aO){var aM=false,aN;while(aN=aP.next()){if(aN=="/"&&aM){aO.tokenize=W;break}aM=(aN=="*")}return N("comment","comment")}function aF(aP,aN){var aO=false,aM;while((aM=aP.next())!=null){if(!aO&&(aM=="`"||aM=="$"&&aP.eat("{"))){aN.tokenize=W;break}aO=!aO&&aM=="\\"}return N("quasi","string-2",aP.current())}var n="([{}])";function aA(aS,aP){if(aP.fatArrowAt){aP.fatArrowAt=null}var aO=aS.string.indexOf("=>",aS.start);if(aO<0){return}var aR=0,aN=false;for(var aT=aO-1;aT>=0;--aT){var aM=aS.string.charAt(aT);var aQ=n.indexOf(aM);if(aQ>=0&&aQ<3){if(!aR){++aT;break}if(--aR==0){break}}else{if(aQ>=3&&aQ<6){++aR}else{if(ax.test(aM)){aN=true}else{if(/["'\/]/.test(aM)){return}else{if(aN&&!aR){++aT;break}}}}}}if(aN&&!aR){aP.fatArrowAt=aT}}var c={atom:true,number:true,variable:true,string:true,regexp:true,"this":true,"jsonld-keyword":true};function L(aR,aN,aM,aQ,aO,aP){this.indented=aR;this.column=aN;this.type=aM;this.prev=aO;this.info=aP;if(aQ!=null){this.align=aQ}}function u(aP,aO){for(var aN=aP.localVars;aN;aN=aN.next){if(aN.name==aO){return true}}for(var aM=aP.context;aM;aM=aM.prev){for(var aN=aM.vars;aN;aN=aN.next){if(aN.name==aO){return true}}}}function g(aQ,aN,aM,aP,aR){var aS=aQ.cc;F.state=aQ;F.stream=aR;F.marked=null,F.cc=aS;F.style=aN;if(!aQ.lexical.hasOwnProperty("align")){aQ.lexical.align=true}while(true){var aO=aS.length?aS.pop():B?aq:aK;if(aO(aM,aP)){while(aS.length&&aS[aS.length-1].lex){aS.pop()()}if(F.marked){return F.marked}if(aM=="variable"&&u(aQ,aP)){return"variable-2"}return aN}}}var F={state:null,column:null,marked:null,cc:null};function ad(){for(var aM=arguments.length-1;aM>=0;aM--){F.cc.push(arguments[aM])}}function ai(){ad.apply(null,arguments);return true}function az(aN){function aM(aQ){for(var aP=aQ;aP;aP=aP.next){if(aP.name==aN){return true}}return false}var aO=F.state;F.marked="def";if(aO.context){if(aM(aO.localVars)){return}aO.localVars={name:aN,next:aO.localVars}}else{if(aM(aO.globalVars)){return}if(am.globalVars){aO.globalVars={name:aN,next:aO.globalVars}}}}var s={name:"this",next:{name:"arguments"}};function y(){F.state.context={prev:F.state.context,vars:F.state.localVars};F.state.localVars=s}function z(){F.state.localVars=F.state.context.vars;F.state.context=F.state.context.prev}function aI(aN,aO){var aM=function(){var aR=F.state,aP=aR.indented;if(aR.lexical.type=="stat"){aP=aR.lexical.indented}else{for(var aQ=aR.lexical;aQ&&aQ.type==")"&&aQ.align;aQ=aQ.prev){aP=aQ.indented}}aR.lexical=new L(aP,F.stream.column(),aN,null,aR.lexical,aO)};aM.lex=true;return aM}function i(){var aM=F.state;if(aM.lexical.prev){if(aM.lexical.type==")"){aM.indented=aM.lexical.indented}aM.lexical=aM.lexical.prev}}i.lex=true;function t(aM){function aN(aO){if(aO==aM){return ai()}else{if(aM==";"){return ad()}else{return ai(aN)}}}return aN}function aK(aM,aN){if(aM=="var"){return ai(aI("vardef",aN.length),e,t(";"),i)}if(aM=="keyword a"){return ai(aI("form"),aq,aK,i)}if(aM=="keyword b"){return ai(aI("form"),aK,i)}if(aM=="{"){return ai(aI("}"),A,i)}if(aM==";"){return ai()}if(aM=="if"){if(F.state.lexical.info=="else"&&F.state.cc[F.state.cc.length-1]==i){F.state.cc.pop()()}return ai(aI("form"),aq,aK,i,f)}if(aM=="function"){return ai(O)}if(aM=="for"){return ai(aI("form"),w,aK,i)}if(aM=="variable"){return ai(aI("stat"),aL)}if(aM=="switch"){return ai(aI("form"),aq,aI("}","switch"),t("{"),A,i,i)}if(aM=="case"){return ai(aq,t(":"))}if(aM=="default"){return ai(t(":"))}if(aM=="catch"){return ai(aI("form"),y,t("("),ag,t(")"),aK,i,z)}if(aM=="class"){return ai(aI("form"),Y,i)}if(aM=="export"){return ai(aI("stat"),aJ,i)}if(aM=="import"){return ai(aI("stat"),aj,i)}if(aM=="module"){return ai(aI("form"),j,aI("}"),t("{"),A,i,i)}return ad(aI("stat"),aq,t(";"),i)}function aq(aM){return ab(aM,false)}function aH(aM){return ab(aM,true)}function ab(aN,aP){if(F.state.fatArrowAt==F.stream.start){var aM=aP?P:Z;if(aN=="("){return ai(y,aI(")"),aw(j,")"),i,t("=>"),aM,z)}else{if(aN=="variable"){return ad(y,j,t("=>"),aM,z)}}}var aO=aP?k:ae;if(c.hasOwnProperty(aN)){return ai(aO)}if(aN=="function"){return ai(O,aO)}if(aN=="keyword c"){return ai(aP?an:al)}if(aN=="("){return ai(aI(")"),al,aC,t(")"),i,aO)}if(aN=="operator"||aN=="spread"){return ai(aP?aH:aq)}if(aN=="["){return ai(aI("]"),o,i,aO)}if(aN=="{"){return aB(v,"}",null,aO)}if(aN=="quasi"){return ad(S,aO)}if(aN=="new"){return ai(J(aP))}return ai()}function al(aM){if(aM.match(/[;\}\)\],]/)){return ad()}return ad(aq)}function an(aM){if(aM.match(/[;\}\)\],]/)){return ad()}return ad(aH)}function ae(aM,aN){if(aM==","){return ai(aq)}return k(aM,aN,false)}function k(aM,aO,aQ){var aN=aQ==false?ae:k;var aP=aQ==false?aq:aH;if(aM=="=>"){return ai(y,aQ?P:Z,z)}if(aM=="operator"){if(/\+\+|--/.test(aO)){return ai(aN)}if(aO=="?"){return ai(aq,t(":"),aP)}return ai(aP)}if(aM=="quasi"){return ad(S,aN)}if(aM==";"){return}if(aM=="("){return aB(aH,")","call",aN)}if(aM=="."){return ai(ao,aN)}if(aM=="["){return ai(aI("]"),al,t("]"),i,aN)}}function S(aM,aN){if(aM!="quasi"){return ad()}if(aN.slice(aN.length-2)!="${"){return ai(S)}return ai(aq,r)}function r(aM){if(aM=="}"){F.marked="string-2";F.state.tokenize=aF;return ai(S)}}function Z(aM){aA(F.stream,F.state);return ad(aM=="{"?aK:aq)}function P(aM){aA(F.stream,F.state);return ad(aM=="{"?aK:aH)}function J(aM){return function(aN){if(aN=="."){return ai(aM?p:X)}else{return ad(aM?aH:aq)}}}function X(aM,aN){if(aN=="target"){F.marked="keyword";return ai(ae)}}function p(aM,aN){if(aN=="target"){F.marked="keyword";return ai(k)}}function aL(aM){if(aM==":"){return ai(i,aK)}return ad(ae,t(";"),i)}function ao(aM){if(aM=="variable"){F.marked="property";return ai()}}function v(aM,aN){if(aM=="variable"||F.style=="keyword"){F.marked="property";if(aN=="get"||aN=="set"){return ai(K)}return ai(M)}else{if(aM=="number"||aM=="string"){F.marked=aE?"property":(F.style+" property");return ai(M)}else{if(aM=="jsonld-keyword"){return ai(M)}else{if(aM=="modifier"){return ai(v)}else{if(aM=="["){return ai(aq,t("]"),M)}else{if(aM=="spread"){return ai(aq)}}}}}}}function K(aM){if(aM!="variable"){return ad(M)}F.marked="property";return ai(O)}function M(aM){if(aM==":"){return ai(aH)}if(aM=="("){return ad(O)}}function aw(aO,aM){function aN(aQ){if(aQ==","){var aP=F.state.lexical;if(aP.info=="call"){aP.pos=(aP.pos||0)+1}return ai(aO,aN)}if(aQ==aM){return ai()}return ai(t(aM))}return function(aP){if(aP==aM){return ai()}return ad(aO,aN)}}function aB(aP,aM,aO){for(var aN=3;aN<arguments.length;aN++){F.cc.push(arguments[aN])}return ai(aI(aM,aO),aw(aP,aM),i)}function A(aM){if(aM=="}"){return ai()}return ad(aK,A)}function V(aM){if(h&&aM==":"){return ai(ah)}}function ay(aM,aN){if(aN=="="){return ai(aH)}}function ah(aM){if(aM=="variable"){F.marked="variable-3";return ai()}}function e(){return ad(j,V,af,aa)}function j(aM,aN){if(aM=="modifier"){return ai(j)}if(aM=="variable"){az(aN);return ai()}if(aM=="spread"){return ai(j)}if(aM=="["){return aB(j,"]")}if(aM=="{"){return aB(aG,"}")}}function aG(aM,aN){if(aM=="variable"&&!F.stream.match(/^\s*:/,false)){az(aN);return ai(af)}if(aM=="variable"){F.marked="property"}if(aM=="spread"){return ai(j)}if(aM=="}"){return ad()}return ai(t(":"),j,af)}function af(aM,aN){if(aN=="="){return ai(aH)}}function aa(aM){if(aM==","){return ai(e)}}function f(aM,aN){if(aM=="keyword b"&&aN=="else"){return ai(aI("form","else"),aK,i)}}function w(aM){if(aM=="("){return ai(aI(")"),G,t(")"),i)}}function G(aM){if(aM=="var"){return ai(e,t(";"),E)}if(aM==";"){return ai(E)}if(aM=="variable"){return ai(x)}return ad(aq,t(";"),E)}function x(aM,aN){if(aN=="in"||aN=="of"){F.marked="keyword";return ai(aq)}return ai(ae,E)}function E(aM,aN){if(aM==";"){return ai(D)}if(aN=="in"||aN=="of"){F.marked="keyword";return ai(aq)}return ad(aq,t(";"),D)}function D(aM){if(aM!=")"){ai(aq)}}function O(aM,aN){if(aN=="*"){F.marked="keyword";return ai(O)}if(aM=="variable"){az(aN);return ai(O)}if(aM=="("){return ai(y,aI(")"),aw(ag,")"),i,aK,z)}}function ag(aM){if(aM=="spread"){return ai(ag)}return ad(j,V,ay)}function Y(aM,aN){if(aM=="variable"){az(aN);return ai(Q)}}function Q(aM,aN){if(aN=="extends"){return ai(aq,Q)}if(aM=="{"){return ai(aI("}"),q,i)}}function q(aM,aN){if(aM=="variable"||F.style=="keyword"){if(aN=="static"){F.marked="keyword";return ai(q)}F.marked="property";if(aN=="get"||aN=="set"){return ai(d,O,q)}return ai(O,q)}if(aN=="*"){F.marked="keyword";return ai(q)}if(aM==";"){return ai(q)}if(aM=="}"){return ai()}}function d(aM){if(aM!="variable"){return ad()}F.marked="property";return ai()}function aJ(aM,aN){if(aN=="*"){F.marked="keyword";return ai(ak,t(";"))}if(aN=="default"){F.marked="keyword";return ai(aq,t(";"))}return ad(aK)}function aj(aM){if(aM=="string"){return ai()}return ad(at,ak)}function at(aM,aN){if(aM=="{"){return aB(at,"}")}if(aM=="variable"){az(aN)}if(aN=="*"){F.marked="keyword"}return ai(l)}function l(aM,aN){if(aN=="as"){F.marked="keyword";return ai(at)}}function ak(aM,aN){if(aN=="from"){F.marked="keyword";return ai(aq)}}function o(aM){if(aM=="]"){return ai()}return ad(aH,ap)}function ap(aM){if(aM=="for"){return ad(aC,t("]"))}if(aM==","){return ai(aw(an,"]"))}return ad(aw(aH,"]"))}function aC(aM){if(aM=="for"){return ai(w,aC)}if(aM=="if"){return ai(aq,aC)}}function ar(aN,aM){return aN.lastType=="operator"||aN.lastType==","||R.test(aM.charAt(0))||/[,.]/.test(aM.charAt(0))}return{startState:function(aN){var aM={tokenize:W,lastType:"sof",cc:[],lexical:new L((aN||0)-m,0,"block",false),localVars:am.localVars,context:am.localVars&&{vars:am.localVars},indented:aN||0};if(am.globalVars&&typeof am.globalVars=="object"){aM.globalVars=am.globalVars}return aM},token:function(aO,aN){if(aO.sol()){if(!aN.lexical.hasOwnProperty("align")){aN.lexical.align=false}aN.indented=aO.indentation();aA(aO,aN)}if(aN.tokenize!=aD&&aO.eatSpace()){return null}var aM=aN.tokenize(aO,aN);if(U=="comment"){return aM}aN.lastType=U=="operator"&&(I=="++"||I=="--")?"incdec":U;return g(aN,aM,U,I,aO)},indent:function(aS,aM){if(aS.tokenize==aD){return a.Pass}if(aS.tokenize!=W){return 0}var aR=aM&&aM.charAt(0),aP=aS.lexical;if(!/^\s*else\b/.test(aM)){for(var aO=aS.cc.length-1;aO>=0;--aO){var aT=aS.cc[aO];if(aT==i){aP=aP.prev}else{if(aT!=f){break}}}}if(aP.type=="stat"&&aR=="}"){aP=aP.prev}if(C&&aP.type==")"&&aP.prev.type=="stat"){aP=aP.prev}var aQ=aP.type,aN=aR==aQ;if(aQ=="vardef"){return aP.indented+(aS.lastType=="operator"||aS.lastType==","?aP.info+1:0)}else{if(aQ=="form"&&aR=="{"){return aP.indented}else{if(aQ=="form"){return aP.indented+m}else{if(aQ=="stat"){return aP.indented+(ar(aS,aM)?C||m:0)}else{if(aP.info=="switch"&&!aN&&am.doubleIndentSwitch!=false){return aP.indented+(/^(?:case|default)\b/.test(aM)?m:2*m)}else{if(aP.align){return aP.column+(aN?0:1)}else{return aP.indented+(aN?0:m)}}}}}}},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:B?null:"/*",blockCommentEnd:B?null:"*/",lineComment:B?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:B?"json":"javascript",jsonldMode:aE,jsonMode:B,expressionAllowed:b,skipExpression:function(aM){var aN=aM.cc[aM.cc.length-1];if(aN==aq||aN==aH){aM.cc.pop()}}}});a.registerHelper("wordChars","javascript",/[\w$]/);a.defineMIME("text/javascript","javascript");a.defineMIME("text/ecmascript","javascript");a.defineMIME("application/javascript","javascript");a.defineMIME("application/x-javascript","javascript");a.defineMIME("application/ecmascript","javascript");a.defineMIME("application/json",{name:"javascript",json:true});a.defineMIME("application/x-json",{name:"javascript",json:true});a.defineMIME("application/ld+json",{name:"javascript",jsonld:true});a.defineMIME("text/typescript",{name:"javascript",typescript:true});a.defineMIME("application/typescript",{name:"javascript",typescript:true})});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(r){r.defineMode("css",function(Y,J){var D=J.inline;if(!J.propertyKeywords){J=r.resolveMode("text/css")}var Q=Y.indentUnit,A=J.tokenHooks,y=J.documentTypes||{},X=J.mediaTypes||{},L=J.mediaFeatures||{},P=J.mediaValueKeywords||{},I=J.propertyKeywords||{},B=J.nonStandardPropertyKeywords||{},E=J.fontProperties||{},W=J.counterDescriptors||{},O=J.colorKeywords||{},S=J.valueKeywords||{},M=J.allowNested,U=J.supportsAtComponent===true;var C,N;function Z(ac,ad){C=ad;return ac}function ab(af,ae){var ad=af.next();if(A[ad]){var ac=A[ad](af,ae);if(ac!==false){return ac}}if(ad=="@"){af.eatWhile(/[\w\\\-]/);return Z("def",af.current())}else{if(ad=="="||(ad=="~"||ad=="|")&&af.eat("=")){return Z(null,"compare")}else{if(ad=='"'||ad=="'"){ae.tokenize=K(ad);return ae.tokenize(af,ae)}else{if(ad=="#"){af.eatWhile(/[\w\\\-]/);return Z("atom","hash")}else{if(ad=="!"){af.match(/^\s*\w*/);return Z("keyword","important")}else{if(/\d/.test(ad)||ad=="."&&af.eat(/\d/)){af.eatWhile(/[\w.%]/);return Z("number","unit")}else{if(ad==="-"){if(/[\d.]/.test(af.peek())){af.eatWhile(/[\w.%]/);return Z("number","unit")}else{if(af.match(/^-[\w\\\-]+/)){af.eatWhile(/[\w\\\-]/);if(af.match(/^\s*:/,false)){return Z("variable-2","variable-definition")}return Z("variable-2","variable")}else{if(af.match(/^\w+-/)){return Z("meta","meta")}}}}else{if(/[,+>*\/]/.test(ad)){return Z(null,"select-op")}else{if(ad=="."&&af.match(/^-?[_a-z][_a-z0-9-]*/i)){return Z("qualifier","qualifier")}else{if(/[:;{}\[\]\(\)]/.test(ad)){return Z(null,ad)}else{if((ad=="u"&&af.match(/rl(-prefix)?\(/))||(ad=="d"&&af.match("omain("))||(ad=="r"&&af.match("egexp("))){af.backUp(1);ae.tokenize=aa;return Z("property","word")}else{if(/[\w\\\-]/.test(ad)){af.eatWhile(/[\w\\\-]/);return Z("property","word")}else{return Z(null,null)}}}}}}}}}}}}}function K(ac){return function(ag,ae){var af=false,ad;while((ad=ag.next())!=null){if(ad==ac&&!af){if(ac==")"){ag.backUp(1)}break}af=!af&&ad=="\\"}if(ad==ac||!af&&ac!=")"){ae.tokenize=null}return Z("string","string")}}function aa(ad,ac){ad.next();if(!ad.match(/\s*[\"\')]/,false)){ac.tokenize=K(")")}else{ac.tokenize=null}return Z(null,"(")}function R(ad,ac,ae){this.type=ad;this.indent=ac;this.prev=ae}function G(ae,af,ad,ac){ae.context=new R(ad,af.indentation()+(ac===false?0:Q),ae.context);return ad}function T(ac){if(ac.context.prev){ac.context=ac.context.prev}return ac.context.type}function z(ac,ae,ad){return F[ad.context.type](ac,ae,ad)}function V(ad,af,ae,ag){for(var ac=ag||1;ac>0;ac--){ae.context=ae.context.prev}return z(ad,af,ae)}function H(ad){var ac=ad.current().toLowerCase();if(S.hasOwnProperty(ac)){N="atom"}else{if(O.hasOwnProperty(ac)){N="keyword"}else{N="variable"}}}var F={};F.top=function(ac,ae,ad){if(ac=="{"){return G(ad,ae,"block")}else{if(ac=="}"&&ad.context.prev){return T(ad)}else{if(U&&/@component/.test(ac)){return G(ad,ae,"atComponentBlock")}else{if(/^@(-moz-)?document$/.test(ac)){return G(ad,ae,"documentTypes")}else{if(/^@(media|supports|(-moz-)?document|import)$/.test(ac)){return G(ad,ae,"atBlock")}else{if(/^@(font-face|counter-style)/.test(ac)){ad.stateArg=ac;return"restricted_atBlock_before"}else{if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(ac)){return"keyframes"}else{if(ac&&ac.charAt(0)=="@"){return G(ad,ae,"at")}else{if(ac=="hash"){N="builtin"}else{if(ac=="word"){N="tag"}else{if(ac=="variable-definition"){return"maybeprop"}else{if(ac=="interpolation"){return G(ad,ae,"interpolation")}else{if(ac==":"){return"pseudo"}else{if(M&&ac=="("){return G(ad,ae,"parens")}}}}}}}}}}}}}}return ad.context.type};F.block=function(ac,af,ad){if(ac=="word"){var ae=af.current().toLowerCase();if(I.hasOwnProperty(ae)){N="property";return"maybeprop"}else{if(B.hasOwnProperty(ae)){N="string-2";return"maybeprop"}else{if(M){N=af.match(/^\s*:(?:\s|$)/,false)?"property":"tag";return"block"}else{N+=" error";return"maybeprop"}}}}else{if(ac=="meta"){return"block"}else{if(!M&&(ac=="hash"||ac=="qualifier")){N="error";return"block"}else{return F.top(ac,af,ad)}}}};F.maybeprop=function(ac,ae,ad){if(ac==":"){return G(ad,ae,"prop")}return z(ac,ae,ad)};F.prop=function(ac,ae,ad){if(ac==";"){return T(ad)}if(ac=="{"&&M){return G(ad,ae,"propBlock")}if(ac=="}"||ac=="{"){return V(ac,ae,ad)}if(ac=="("){return G(ad,ae,"parens")}if(ac=="hash"&&!/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(ae.current())){N+=" error"}else{if(ac=="word"){H(ae)}else{if(ac=="interpolation"){return G(ad,ae,"interpolation")}}}return"prop"};F.propBlock=function(ad,ac,ae){if(ad=="}"){return T(ae)}if(ad=="word"){N="property";return"maybeprop"}return ae.context.type};F.parens=function(ac,ae,ad){if(ac=="{"||ac=="}"){return V(ac,ae,ad)}if(ac==")"){return T(ad)}if(ac=="("){return G(ad,ae,"parens")}if(ac=="interpolation"){return G(ad,ae,"interpolation")}if(ac=="word"){H(ae)}return"parens"};F.pseudo=function(ac,ae,ad){if(ac=="word"){N="variable-3";return ad.context.type}return z(ac,ae,ad)};F.documentTypes=function(ac,ae,ad){if(ac=="word"&&y.hasOwnProperty(ae.current())){N="tag";return ad.context.type}else{return F.atBlock(ac,ae,ad)}};F.atBlock=function(ac,af,ad){if(ac=="("){return G(ad,af,"atBlock_parens")}if(ac=="}"||ac==";"){return V(ac,af,ad)}if(ac=="{"){return T(ad)&&G(ad,af,M?"block":"top")}if(ac=="interpolation"){return G(ad,af,"interpolation")}if(ac=="word"){var ae=af.current().toLowerCase();if(ae=="only"||ae=="not"||ae=="and"||ae=="or"){N="keyword"}else{if(X.hasOwnProperty(ae)){N="attribute"}else{if(L.hasOwnProperty(ae)){N="property"}else{if(P.hasOwnProperty(ae)){N="keyword"}else{if(I.hasOwnProperty(ae)){N="property"}else{if(B.hasOwnProperty(ae)){N="string-2"}else{if(S.hasOwnProperty(ae)){N="atom"}else{if(O.hasOwnProperty(ae)){N="keyword"}else{N="error"}}}}}}}}}return ad.context.type};F.atComponentBlock=function(ac,ae,ad){if(ac=="}"){return V(ac,ae,ad)}if(ac=="{"){return T(ad)&&G(ad,ae,M?"block":"top",false)}if(ac=="word"){N="error"}return ad.context.type};F.atBlock_parens=function(ac,ae,ad){if(ac==")"){return T(ad)}if(ac=="{"||ac=="}"){return V(ac,ae,ad,2)}return F.atBlock(ac,ae,ad)};F.restricted_atBlock_before=function(ac,ae,ad){if(ac=="{"){return G(ad,ae,"restricted_atBlock")}if(ac=="word"&&ad.stateArg=="@counter-style"){N="variable";return"restricted_atBlock_before"}return z(ac,ae,ad)};F.restricted_atBlock=function(ac,ae,ad){if(ac=="}"){ad.stateArg=null;return T(ad)}if(ac=="word"){if((ad.stateArg=="@font-face"&&!E.hasOwnProperty(ae.current().toLowerCase()))||(ad.stateArg=="@counter-style"&&!W.hasOwnProperty(ae.current().toLowerCase()))){N="error"}else{N="property"}return"maybeprop"}return"restricted_atBlock"};F.keyframes=function(ac,ae,ad){if(ac=="word"){N="variable";return"keyframes"}if(ac=="{"){return G(ad,ae,"top")}return z(ac,ae,ad)};F.at=function(ac,ae,ad){if(ac==";"){return T(ad)}if(ac=="{"||ac=="}"){return V(ac,ae,ad)}if(ac=="word"){N="tag"}else{if(ac=="hash"){N="builtin"}}return"at"};F.interpolation=function(ac,ae,ad){if(ac=="}"){return T(ad)}if(ac=="{"||ac==";"){return V(ac,ae,ad)}if(ac=="word"){N="variable"}else{if(ac!="variable"&&ac!="("&&ac!=")"){N="error"}}return"interpolation"};return{startState:function(ac){return{tokenize:null,state:D?"block":"top",stateArg:null,context:new R(D?"block":"top",ac||0,null)}},token:function(ae,ad){if(!ad.tokenize&&ae.eatSpace()){return null}var ac=(ad.tokenize||ab)(ae,ad);if(ac&&typeof ac=="object"){C=ac[1];ac=ac[0]}N=ac;ad.state=F[ad.state](C,ae,ad);return N},indent:function(ag,ae){var ad=ag.context,af=ae&&ae.charAt(0);var ac=ad.indent;if(ad.type=="prop"&&(af=="}"||af==")")){ad=ad.prev}if(ad.prev){if(af=="}"&&(ad.type=="block"||ad.type=="top"||ad.type=="interpolation"||ad.type=="restricted_atBlock")){ad=ad.prev;ac=ad.indent}else{if(af==")"&&(ad.type=="parens"||ad.type=="atBlock_parens")||af=="{"&&(ad.type=="at"||ad.type=="atBlock")){ac=Math.max(0,ad.indent-Q);ad=ad.prev}}}return ac},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});function g(A){var z={};for(var y=0;y<A.length;++y){z[A[y]]=true}return z}var k=["domain","regexp","url","url-prefix"],a=g(k);var b=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],v=g(b);var x=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],i=g(x);var l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],p=g(l);var d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],h=g(d);var n=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],e=g(n);var t=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],f=g(t);var q=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],u=g(q);var c=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],m=g(c);var j=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],s=g(j);var o=k.concat(b).concat(x).concat(l).concat(d).concat(n).concat(c).concat(j);r.registerHelper("hintWords","css",o);function w(B,A){var y=false,z;while((z=B.next())!=null){if(y&&z=="/"){A.tokenize=null;break}y=(z=="*")}return["comment","comment"]}r.defineMIME("text/css",{documentTypes:a,mediaTypes:v,mediaFeatures:i,mediaValueKeywords:p,propertyKeywords:h,nonStandardPropertyKeywords:e,fontProperties:f,counterDescriptors:u,colorKeywords:m,valueKeywords:s,tokenHooks:{"/":function(z,y){if(!z.eat("*")){return false}y.tokenize=w;return w(z,y)}},name:"css"});r.defineMIME("text/x-scss",{mediaTypes:v,mediaFeatures:i,mediaValueKeywords:p,propertyKeywords:h,nonStandardPropertyKeywords:e,colorKeywords:m,valueKeywords:s,fontProperties:f,allowNested:true,tokenHooks:{"/":function(z,y){if(z.eat("/")){z.skipToEnd();return["comment","comment"]}else{if(z.eat("*")){y.tokenize=w;return w(z,y)}else{return["operator","operator"]}}},":":function(y){if(y.match(/\s*\{/)){return[null,"{"]}return false},"$":function(y){y.match(/^[\w-]+/);if(y.match(/^\s*:/,false)){return["variable-2","variable-definition"]}return["variable-2","variable"]},"#":function(y){if(!y.eat("{")){return false}return[null,"interpolation"]}},name:"css",helperType:"scss"});r.defineMIME("text/x-less",{mediaTypes:v,mediaFeatures:i,mediaValueKeywords:p,propertyKeywords:h,nonStandardPropertyKeywords:e,colorKeywords:m,valueKeywords:s,fontProperties:f,allowNested:true,tokenHooks:{"/":function(z,y){if(z.eat("/")){z.skipToEnd();return["comment","comment"]}else{if(z.eat("*")){y.tokenize=w;return w(z,y)}else{return["operator","operator"]}}},"@":function(y){if(y.eat("{")){return[null,"interpolation"]}if(y.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,false)){return false}y.eatWhile(/[\w\\\-]/);if(y.match(/^\s*:/,false)){return["variable-2","variable-definition"]}return["variable-2","variable"]},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"});r.defineMIME("text/x-gss",{documentTypes:a,mediaTypes:v,mediaFeatures:i,propertyKeywords:h,nonStandardPropertyKeywords:e,fontProperties:f,counterDescriptors:u,colorKeywords:m,valueKeywords:s,supportsAtComponent:true,tokenHooks:{"/":function(z,y){if(!z.eat("*")){return false}y.tokenize=w;return w(z,y)}},name:"css",helperType:"gss"})});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}}})(function(s){function r(B,y,x,A,z){this.indented=B;this.column=y;this.type=x;this.align=A;this.prev=z}function k(x){return x=="statement"||x=="switchstatement"||x=="namespace"}function g(A,y,z){var x=A.indented;if(A.context&&k(A.context.type)&&!k(z)){x=A.context.indented}return A.context=new r(x,y,z,null,A.context)}function u(y){var x=y.context.type;if(x==")"||x=="]"||x=="}"){y.indented=y.context.indented}return y.context=y.context.prev}function a(y,x){if(x.prevToken=="variable"||x.prevToken=="variable-3"){return true}if(/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(y.string.slice(0,y.start))){return true}}function q(x){for(;;){if(!x||x.type=="top"){return true}if(x.type=="}"&&x.prev.type!="namespace"){return false}x=x.prev}}s.defineMode("clike",function(U,F){var Q=U.indentUnit,N=F.statementIndentUnit||Q,R=F.dontAlignCalls,I=F.keywords||{},L=F.types||{},V=F.builtin||{},S=F.blockKeywords||{},P=F.defKeywords||{},A=F.atoms||{},y=F.hooks||{},M=F.multiLineStrings,K=F.indentStatements!==false,H=F.indentSwitch!==false,C=F.namespaceSeparator,E=F.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,B=F.numberStart||/[\d\.]/,x=F.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,J=F.isOperatorChar||/[+\-*&%=<>!?|\/]/,z=F.endStatement||/^[;:,]$/;var T,D;function W(ab,Z){var Y=ab.next();if(y[Y]){var X=y[Y](ab,Z);if(X!==false){return X}}if(Y=='"'||Y=="'"){Z.tokenize=G(Y);return Z.tokenize(ab,Z)}if(E.test(Y)){T=Y;return null}if(B.test(Y)){ab.backUp(1);if(ab.match(x)){return"number"}ab.next()}if(Y=="/"){if(ab.eat("*")){Z.tokenize=O;return O(ab,Z)}if(ab.eat("/")){ab.skipToEnd();return"comment"}}if(J.test(Y)){while(!ab.match(/^\/[\/*]/,false)&&ab.eat(J)){}return"operator"}ab.eatWhile(/[\w\$_\xa1-\uffff]/);if(C){while(ab.match(C)){ab.eatWhile(/[\w\$_\xa1-\uffff]/)}}var aa=ab.current();if(h(I,aa)){if(h(S,aa)){T="newstatement"}if(h(P,aa)){D=true}return"keyword"}if(h(L,aa)){return"variable-3"}if(h(V,aa)){if(h(S,aa)){T="newstatement"}return"builtin"}if(h(A,aa)){return"atom"}return"variable"}function G(X){return function(ac,aa){var ab=false,Z,Y=false;while((Z=ac.next())!=null){if(Z==X&&!ab){Y=true;break}ab=!ab&&Z=="\\"}if(Y||!(ab||M)){aa.tokenize=null}return"string"}}function O(aa,Z){var X=false,Y;while(Y=aa.next()){if(Y=="/"&&X){Z.tokenize=null;break}X=(Y=="*")}return"comment"}return{startState:function(X){return{tokenize:null,context:new r((X||0)-Q,0,"top",false),indented:0,startOfLine:true,prevToken:null}},token:function(ac,ab){var Y=ab.context;if(ac.sol()){if(Y.align==null){Y.align=false}ab.indented=ac.indentation();ab.startOfLine=true}if(ac.eatSpace()){return null}T=D=null;var aa=(ab.tokenize||W)(ac,ab);if(aa=="comment"||aa=="meta"){return aa}if(Y.align==null){Y.align=true}if(z.test(T)){while(k(ab.context.type)){u(ab)}}else{if(T=="{"){g(ab,ac.column(),"}")}else{if(T=="["){g(ab,ac.column(),"]")}else{if(T=="("){g(ab,ac.column(),")")}else{if(T=="}"){while(k(Y.type)){Y=u(ab)}if(Y.type=="}"){Y=u(ab)}while(k(Y.type)){Y=u(ab)}}else{if(T==Y.type){u(ab)}else{if(K&&(((Y.type=="}"||Y.type=="top")&&T!=";")||(k(Y.type)&&T=="newstatement"))){var Z="statement";if(T=="newstatement"&&H&&ac.current()=="switch"){Z="switchstatement"}else{if(aa=="keyword"&&ac.current()=="namespace"){Z="namespace"}}g(ab,ac.column(),Z)}}}}}}}if(aa=="variable"&&((ab.prevToken=="def"||(F.typeFirstDefinitions&&a(ac,ab)&&q(ab.context)&&ac.match(/^\s*\(/,false))))){aa="def"}if(y.token){var X=y.token(ac,ab,aa);if(X!==undefined){aa=X}}if(aa=="def"&&F.styleDefs===false){aa="variable"}ab.startOfLine=false;ab.prevToken=D?"def":aa||T;return aa},indent:function(ad,Y){if(ad.tokenize!=W&&ad.tokenize!=null){return s.Pass}var X=ad.context,ab=Y&&Y.charAt(0);if(k(X.type)&&ab=="}"){X=X.prev}if(y.indent){var ac=y.indent(ad,X,Y);if(typeof ac=="number"){return ac}}var Z=ab==X.type;var aa=X.prev&&X.prev.type=="switchstatement";if(F.allmanIndentation&&/[{(]/.test(ab)){while(X.type!="top"&&X.type!="}"){X=X.prev}return X.indented}if(k(X.type)){return X.indented+(ab=="{"?0:N)}if(X.align&&(!R||X.type!=")")){return X.column+(Z?0:1)}if(X.type==")"&&!Z){return X.indented+N}return X.indented+(Z?0:Q)+(!Z&&aa&&!/^(?:case|default)\b/.test(Y)?Q:0)},electricInput:H?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});function p(A){var y={},z=A.split(" ");for(var x=0;x<z.length;++x){y[z[x]]=true}return y}function h(y,x){if(typeof y==="function"){return y(x)}else{return y.propertyIsEnumerable(x)}}var m="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile";var t="int long char short double float unsigned signed void size_t ptrdiff_t";function n(A,z){if(!z.startOfLine){return false}for(var y,x=null;y=A.peek();){if(y=="\\"&&A.match(/^.$/)){x=n;break}else{if(y=="/"&&A.match(/^\/[\/\*]/,false)){break}}A.next()}z.tokenize=x;return"meta"}function d(x,y){if(y.prevToken=="variable-3"){return"variable-3"}return false}function f(x){x.eatWhile(/[\w\.']/);return"number"}function o(z,y){z.backUp(1);if(z.match(/(R|u8R|uR|UR|LR)/)){var x=z.match(/"([^\s\\()]{0,16})\(/);if(!x){return false}y.cpp11RawStringDelim=x[1];y.tokenize=i;return i(z,y)}if(z.match(/(u8|u|U|L)/)){if(z.match(/["']/,false)){return"string"}return false}z.next();return false}function w(y){var x=/(\w+)::(\w+)$/.exec(y);return x&&x[1]==x[2]}function v(z,y){var x;while((x=z.next())!=null){if(x=='"'&&!z.eat('"')){y.tokenize=null;break}}return"string"}function i(A,y){var z=y.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");var x=A.match(new RegExp(".*?\\)"+z+'"'));if(x){y.tokenize=null}else{A.skipToEnd()}return"string"}function l(x,B){if(typeof x=="string"){x=[x]}var A=[];function z(C){if(C){for(var D in C){if(C.hasOwnProperty(D)){A.push(D)}}}}z(B.keywords);z(B.types);z(B.builtin);z(B.atoms);if(A.length){B.helperType=x[0];s.registerHelper("hintWords",x[0],A)}for(var y=0;y<x.length;++y){s.defineMIME(x[y],B)}}l(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:p(m),types:p(t+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:p("case do else for if switch while struct"),defKeywords:p("struct"),typeFirstDefinitions:true,atoms:p("null true false"),hooks:{"#":n,"*":d},modeProps:{fold:["brace","include"]}});l(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:p(m+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:p(t+" bool wchar_t"),blockKeywords:p("catch class do else finally for if struct switch try while"),defKeywords:p("class namespace struct enum union"),typeFirstDefinitions:true,atoms:p("true false null"),hooks:{"#":n,"*":d,u:o,U:o,L:o,R:o,"0":f,"1":f,"2":f,"3":f,"4":f,"5":f,"6":f,"7":f,"8":f,"9":f,token:function(z,y,x){if(x=="variable"&&z.peek()=="("&&(y.prevToken==";"||y.prevToken==null||y.prevToken=="}")&&w(z.current())){return"def"}}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}});l("text/x-java",{name:"clike",keywords:p("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:p("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:p("catch class do else finally for if switch try while"),defKeywords:p("class interface package enum"),typeFirstDefinitions:true,atoms:p("true false null"),endStatement:/^[;:]$/,hooks:{"@":function(x){x.eatWhile(/[\w\$_]/);return"meta"}},modeProps:{fold:["brace","import"]}});l("text/x-csharp",{name:"clike",keywords:p("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:p("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:p("catch class do else finally for foreach if struct switch try while"),defKeywords:p("class interface namespace struct var"),typeFirstDefinitions:true,atoms:p("true false null"),hooks:{"@":function(y,x){if(y.eat('"')){x.tokenize=v;return v(y,x)}y.eatWhile(/[\w\$_]/);return"meta"}}});function c(z,x){var y=false;while(!z.eol()){if(!y&&z.match('"""')){x.tokenize=null;break}y=z.next()=="\\"&&!y}return"string"}l("text/x-scala",{name:"clike",keywords:p("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:p("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:true,blockKeywords:p("catch class do else finally for forSome if match switch try while"),defKeywords:p("class def object package trait type val var"),atoms:p("true false null"),indentStatements:false,indentSwitch:false,hooks:{"@":function(x){x.eatWhile(/[\w\$_]/);return"meta"},'"':function(y,x){if(!y.match('""')){return false}x.tokenize=c;return x.tokenize(y,x)},"'":function(x){x.eatWhile(/[\w\$_\xa1-\uffff]/);return"atom"},"=":function(z,y){var x=y.context;if(x.type=="}"&&x.align&&z.eat(">")){y.context=new r(x.indented,x.column,x.type,null,x.prev);return"operator"}else{return false}}},modeProps:{closeBrackets:{triples:'"'}}});function b(x){return function(C,A){var B=false,z,y=false;while(!C.eol()){if(!x&&!B&&C.match('"')){y=true;break}if(x&&C.match('"""')){y=true;break}z=C.next();if(!B&&z=="$"&&C.match("{")){C.skipTo("}")}B=!B&&z=="\\"&&!x}if(y||!x){A.tokenize=null}return"string"}}l("text/x-kotlin",{name:"clike",keywords:p("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:p("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:false,indentStatements:false,multiLineStrings:true,blockKeywords:p("catch class do else finally for if where try while enum"),defKeywords:p("class val var object package interface fun"),atoms:p("true false null this"),hooks:{'"':function(y,x){x.tokenize=b(y.match('""'));return x.tokenize(y,x)}},modeProps:{closeBrackets:{triples:'"'}}});l(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:p("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:p("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:p("for while do if else struct"),builtin:p("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:p("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:false,hooks:{"#":n},modeProps:{fold:["brace","include"]}});l("text/x-nesc",{name:"clike",keywords:p(m+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:p(t),blockKeywords:p("case do else for if switch while struct"),atoms:p("null true false"),hooks:{"#":n},modeProps:{fold:["brace","include"]}});l("text/x-objectivec",{name:"clike",keywords:p(m+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:p(t),atoms:p("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(x){x.eatWhile(/[\w\$]/);return"keyword"},"#":n,indent:function(z,x,y){if(x.type=="statement"&&/^@\w/.test(y)){return x.indented}}},modeProps:{fold:"brace"}});l("text/x-squirrel",{name:"clike",keywords:p("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:p(t),blockKeywords:p("case catch class else for foreach if switch try while"),defKeywords:p("function local class"),typeFirstDefinitions:true,atoms:p("true false null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}});var e=null;function j(x){return function(C,A){var B=false,z,y=false;while(!C.eol()){if(!B&&C.match('"')&&(x=="single"||C.match('""'))){y=true;break}if(!B&&C.match("``")){e=j(x);y=true;break}z=C.next();B=x=="single"&&!B&&z=="\\"}if(y){A.tokenize=null}return"string"}}l("text/x-ceylon",{name:"clike",keywords:p("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(x){var y=x.charAt(0);return(y===y.toUpperCase()&&y!==y.toLowerCase())},blockKeywords:p("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:p("class dynamic function interface module object package value"),builtin:p("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:true,typeFirstDefinitions:true,atoms:p("true false null larger smaller equal empty finished"),indentSwitch:false,styleDefs:false,hooks:{"@":function(x){x.eatWhile(/[\w\$_]/);return"meta"},'"':function(y,x){x.tokenize=j(y.match('""')?"triple":"single");return x.tokenize(y,x)},"`":function(y,x){if(!e||!y.match("`")){return false}x.tokenize=e;e=null;return x.tokenize(y,x)},"'":function(x){x.eatWhile(/[\w\$_\xa1-\uffff]/);return"atom"},token:function(x,z,y){if((y=="variable"||y=="variable-3")&&z.prevToken=="."){return"variable-2"}}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})});(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike"))}else{if(typeof define=="function"&&define.amd){define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],a)}else{a(CodeMirror)}}})(function(d){function f(m){var k={},l=m.split(" ");for(var j=0;j<l.length;++j){k[l[j]]=true}return k}function e(l,j,k){if(l.length==0){return b(j)}return function(p,o){var n=l[0];for(var m=0;m<n.length;m++){if(p.match(n[m][0])){o.tokenize=e(l.slice(1),j);return n[m][1]}}o.tokenize=b(j,k);return"string"}}function b(k,j){return function(m,l){return c(m,l,k,j)}}function c(n,l,k,j){if(j!==false&&n.match("${",false)||n.match("{$",false)){l.tokenize=null;return"string"}if(j!==false&&n.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)){if(n.match("[",false)){l.tokenize=e([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],k,j)}if(n.match(/\-\>\w/,false)){l.tokenize=e([[["->",null]],[[/[\w]+/,"variable"]]],k,j)}return"variable-2"}var m=false;while(!n.eol()&&(m||j===false||(!n.match("{$",false)&&!n.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,false)))){if(!m&&n.match(k)){l.tokenize=null;l.tokStack.pop();l.tokStack.pop();break}m=n.next()=="\\"&&!m}return"string"}var h="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally";var i="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";var a="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";d.registerHelper("hintWords","php",[h,i,a].join(" ").split(" "));d.registerHelper("wordChars","php",/[\w$]/);var g={name:"clike",helperType:"php",keywords:f(h),blockKeywords:f("catch do else elseif for foreach if switch try while finally"),defKeywords:f("class function interface namespace trait"),atoms:f(i),builtin:f(a),multiLineStrings:true,hooks:{"$":function(j){j.eatWhile(/[\w\$_]/);return"variable-2"},"<":function(n,l){var k;if(k=n.match(/<<\s*/)){var j=n.eat(/['"]/);n.eatWhile(/[\w\.]/);var m=n.current().slice(k[0].length+(j?2:1));if(j){n.eat(j)}if(m){(l.tokStack||(l.tokStack=[])).push(m,0);l.tokenize=b(m,j!="'");return"string"}}return false},"#":function(j){while(!j.eol()&&!j.match("?>",false)){j.next()}return"comment"},"/":function(j){if(j.eat("/")){while(!j.eol()&&!j.match("?>",false)){j.next()}return"comment"}return false},'"':function(j,k){(k.tokStack||(k.tokStack=[])).push('"',0);k.tokenize=b('"');return"string"},"{":function(j,k){if(k.tokStack&&k.tokStack.length){k.tokStack[k.tokStack.length-1]++}return false},"}":function(j,k){if(k.tokStack&&k.tokStack.length>0&&!--k.tokStack[k.tokStack.length-1]){k.tokenize=b(k.tokStack[k.tokStack.length-2])}return false}}};d.defineMode("php",function(l,m){var n=d.getMode(l,"text/html");var j=d.getMode(l,g);function k(u,s){var r=s.curMode==j;if(u.sol()&&s.pending&&s.pending!='"'&&s.pending!="'"){s.pending=null}if(!r){if(u.match(/^<\?\w*/)){s.curMode=j;if(!s.php){s.php=d.startState(j,n.indent(s.html,""))}s.curState=s.php;return"meta"}if(s.pending=='"'||s.pending=="'"){while(!u.eol()&&u.next()!=s.pending){}var q="string"}else{if(s.pending&&u.pos<s.pending.end){u.pos=s.pending.end;var q=s.pending.style}else{var q=n.token(u,s.curState)}}if(s.pending){s.pending=null}var t=u.current(),p=t.search(/<\?/),o;if(p!=-1){if(q=="string"&&(o=t.match(/[\'\"]$/))&&!/\?>/.test(t)){s.pending=o[0]}else{s.pending={end:u.pos,style:q}}u.backUp(t.length-p)}return q}else{if(r&&s.php.tokenize==null&&u.match("?>")){s.curMode=n;s.curState=s.html;if(!s.php.context.prev){s.php=null}return"meta"}else{return j.token(u,s.curState)}}}return{startState:function(){var o=d.startState(n);var p=m.startOpen?d.startState(j):null;return{html:o,php:p,curMode:m.startOpen?j:n,curState:m.startOpen?p:o,pending:null}},copyState:function(r){var p=r.html,q=d.copyState(n,p),t=r.php,o=t&&d.copyState(j,t),s;if(r.curMode==n){s=q}else{s=o}return{html:q,php:o,curMode:r.curMode,curState:s,pending:r.pending}},token:k,indent:function(p,o){if((p.curMode!=j&&/^\s*<\//.test(o))||(p.curMode==j&&/^\?>/.test(o))){return n.indent(p.html,o)}return p.curMode.indent(p.curState,o)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(o){return{state:o.curState,mode:o.curMode}}}},"htmlmixed","clike");d.defineMIME("application/x-httpd-php","php");d.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:true});d.defineMIME("text/x-php",g)}); | 82,946 | 82,946 | 0.720071 |
b9d96dc49e0af37a6718799876b8a0d79e5d672c | 12,030 | js | JavaScript | lib/util/problem.js | florianm/central-backend | 8d1133acfa7b4c4036af096856a23d131c01a7fb | [
"Apache-2.0"
] | null | null | null | lib/util/problem.js | florianm/central-backend | 8d1133acfa7b4c4036af096856a23d131c01a7fb | [
"Apache-2.0"
] | null | null | null | lib/util/problem.js | florianm/central-backend | 8d1133acfa7b4c4036af096856a23d131c01a7fb | [
"Apache-2.0"
] | null | null | null | // Copyright 2017 ODK Central Developers
// See the NOTICE file at the top-level directory of this distribution and at
// https://github.com/opendatakit/central-backend/blob/master/NOTICE.
// This file is part of ODK Central. It is subject to the license terms in
// the LICENSE file found in the top-level directory of this distribution and at
// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central,
// including this file, may be copied, modified, propagated, or distributed
// except according to the terms contained in the LICENSE file.
//
// Problem is our generic catch-all for all things that may go wrong in the
// system, and any layer. Our infrastructure is set up to automatically interpret
// a thrown or returned Problem into an HTTP response to be sent to the user.
//
// A list of our Problems with their codes and messages can be found below.
const { floor } = Math;
const { printPairs } = require('./util');
class Problem extends Error {
constructor(code, message, details) {
super(message);
Error.captureStackTrace(this, Problem);
this.problemCode = code;
this.problemDetails = details;
}
get isProblem() { return true; }
get httpCode() { return floor(this.problemCode); }
static serializable(error) {
return (error.isProblem === true)
? { message: error.message, stack: error.stack, code: error.problemCode, details: error.problemDetails }
: { message: error.message, stack: error.stack };
}
static translate(type, result) {
return (problem) =>
// we don't import util/promise for reject because it'd cause a loop
Promise.reject((problem.problemCode === type.code) ? result(problem) : problem);
}
}
// Simplifies some boilerplate for the next block of code.
const problem = (code, messageForDetails) => {
const result = (details) => new Problem(code, messageForDetails(details), details);
result.code = code;
return result;
};
// The actual generator functions for use in userland code.
const problems = {
user: {
// { format: "the data parsing format; eg json, xml", rawLength: "the length of the string which failed parsing" }
unparseable: problem(400.1, ({ format, rawLength }) => `Could not parse the given data (${rawLength} chars) as ${format}.`),
// { field: "the name of the missing field" }
missingParameter: problem(400.2, ({ field }) => `Required parameter ${field} missing.`),
// { expected: [ array of expected fields ], got: { object of given fields } }
missingParameters: problem(400.3, ({ expected, got }) => `Required parameters missing. Expected (${expected.join(', ')}), got (${printPairs(got)}).`),
// { field: "the name of the extraneous parameter" }
unexpectedAttribute: problem(400.4, ({ field }) => `Passed parameter ${field} was not expected.`),
// { header: "the problematic header", value: "the supplied (problematic) value" }
invalidHeader: problem(400.6, ({ field, value }) => `An expected header field (${field}) did not match the expected format (got: ${(value == null) ? '[nothing]' : value}).`),
// { field: "the name of the missing field" }
missingMultipartField: problem(400.7, ({ field }) => `Required multipart POST field ${field} missing.`),
// { field: "the name of the problem field", value: "the problem value", reason: "description" }
unexpectedValue: problem(400.8, ({ field, value, reason }) => `Unexpected ${field} value ${value}; ${reason}`),
// generic passthrough for oauth problems.
oauth: problem(400.9, ({ reason }) => `Problem completing cross-platform authentication. ${reason}`),
invalidDataTypeOfParameter: problem(400.11, ({ value, expected }) => `Invalid input data type: expected '${value}' to be (${expected})`),
undecryptable: problem(400.12, () => 'Could not perform decryption. Double check your passphrase and your data and try again.'),
valueTooLong: problem(400.13, () => 'Length of value too long for a field'),
keyDoesNotExist: problem(400.14, ({ field, value, table }) => `The given ${field} ${value} for ${table} does not exist.`),
xlsformNotValid: problem(400.15, () => 'The given XLSForm file was not valid. Please see the error details for more information.'),
xlsformWarnings: problem(400.16, () => 'The XLSForm is valid, but with warnings. Please check the warnings and if they are acceptable resubmit with ?ignoreWarnings=true'),
fieldTypeConflict: problem(400.17, ({ path, type }) => `The form you have uploaded attempts to change the type of the field at ${path}. In a previous version, it had the type ${type}. Please either return that field to its previous type, or rename the field so it lives at a new path.`),
unparseableODataExpression: problem(400.18, (({ reason }) => `The OData filter expression you provided could not be parsed: ${reason}`)),
// no detail information for security reasons.
authenticationFailed: problem(401.2, () => 'Could not authenticate with the provided credentials.'),
httpsOnly: problem(401.3, () => 'This authentication method is only available over HTTPS'),
openRosaAuthenticationRequired: problem(401.4, () => 'This resource requires authentication.'),
// TODO: should have details but not sure what yet.
insufficientRights: problem(403.1, () => 'The authenticated actor does not have rights to perform that action.'),
// no detail information as the problem should be self-evident by REST conventions.
notFound: problem(404.1, () => 'Could not find the resource you were looking for.'),
// missing API version.
missingApiVersion: problem(404.2, () => 'Expected an API version (eg /v1) at the start of the request URL.'),
// unexpected API version.
unexpectedApiVersion: problem(404.3, ({ got }) => `Unexpected an API version (accepts: 1) (got: ${got}).`),
// failed draft access.
failedDraftAccess: problem(404.4, () => 'You tried to access a draft testing endpoint, but it does not exist anymore or your access is no longer valid. If the form has been published and you would like to submit to it, you should configure your device with an App User token. If there is a new draft, you may have to reconfigure your device from the draft settings.'),
// deprecated id does not exist.
deprecatedIdNotFound: problem(404.5, ({ deprecatedId }) => `You tried to update an existing submission, but we can't find that submission to update (${deprecatedId})`),
// { allowed: [ acceptable formats ], got }
unacceptableFormat: problem(406.1, ({ allowed }) => `Requested format not acceptable; this resource allows: ${allowed.join()}.`),
// no detail information; too lengthy to provide.
xmlConflict: problem(409.1, () => 'A submission already exists with this ID, but with different XML. Resubmissions to attach additional multimedia must resubmit an identical xml_submission_file.'),
// form is not accepting submissions.
notAcceptingSubmissions: problem(409.2, () => 'This form is not currently accepting submissions. Please talk to your program staff if this is unexpected.'),
// { field: "the unique field", value: "the supplied (conflicting) value",
// table: "(optional) the table in question" }
uniquenessViolation: problem(409.3, ({ fields, values }) => `A resource already exists with ${fields} value(s) of ${values}.`),
// tried to activate some feature when it was already activated.
alreadyActive: problem(409.4, ({ feature }) => `Could not activate feature (${feature}) as it was already activated`),
// tried to create a form while encryption was being enabled.
encryptionActivating: problem(409.5, () => 'Could not create form, because the project was being prepared for managed encryption. Please try again in a moment.'),
// tried to delete a draft w no published version.
noPublishedVersion: problem(409.7, () => 'Could not delete draft, because the form has not been published. Either delete the whole form, or replace the draft.'),
// special version of uniquenessViolation to be more informative about the publish-version
// conflict case.
versionUniquenessViolation: problem(409.6, ({ xmlFormId, version }) => `You tried to publish the form '${xmlFormId}' with version '${version}', but a published form has already existed in this project with those identifiers. Please choose a new name and try again. You can re-request with ?version=xyz to have the version changed in-place for you.`),
// tried to reuse an instanceId
instanceIdConflict: problem(409.8, () => 'You tried to update a submission, but the instanceID you provided already exists on this server. Please try again with a unique instanceID.'),
// tried to deprecate an already-deprecated submission version
deprecatingOldSubmission: problem(409.9, ({ deprecatedId }) => `You tried to update a submission, but the copy you were editing (${deprecatedId}) is now out of date. Please get the new version that has been submitted, and make your edits again.`)
},
internal: {
// no detail information, as this is only called when we don't know what happened.
unknown: problem(500.1, () => 'An unknown internal problem has occurred. Please try again later.'),
// { table: "the table missing a row", row: "a descriptor of the missing row" }
missingSystemRow: problem(500.2, ({ table }) => `Could not find an expected system ${table} record in your database.`),
// only called for development, theoretically.
emptyResponse: problem(500.3, () => 'The resource returned no data. This is likely a developer problem.'),
// used to indicate missing odata functionality.
notImplemented: problem(501.1, ({ feature }) => `The requested feature ${feature} is not supported by this server.`),
// used for our bizarre project deep PUT in case of formlist mismatch.
unexpectedFormsList: problem(501.2, () => 'This endpoint does not allow creation or deletion of forms. Please check that you have sent the correct detail for all forms in this project.'),
// returned in case no xlsform conversion service is configured.
xlsformNotConfigured: problem(501.3, () => 'This ODK Central has not been configured to allow XLSForm conversion. Please upload an XForms XML file (try XLSForm Online) or contact your server administrator.'),
// returned when we don't support certain kinds of odata filter expressions.
unsupportedODataExpression: problem(501.4, (({ at, type, text }) => `The given OData filter expression uses features not supported by this server: ${type} at ${at} ("${text}")`)),
unsupportedODataField: problem(501.5, (({ at, text }) => `The given OData filter expression references fields not supported by this server: ${text} at ${at}`)),
unsupportedODataExpandExpression: problem(501.6, (({ text }) => `The given OData expand expression is not supported by this server: "${text}". Currently, only "$expand=*" is supported.`)),
// used internally when a task fails to complete in a reasonable length of time.
timeout: problem(502.1, () => 'The task took too long to run.'),
// returned if an xlsform service is configured but it cannot be contacted.
xlsformNotAvailable: problem(502.2, () => 'The XLSForm conversion service could not be contacted.'),
// returned in case no Enketo service is configured.
enketoNotConfigured: problem(501.4, () => 'This ODK Central has not been configured to use Enketo. Please contact your server administrator.'),
// returned if Enketo is configured but it cannot be contacted.
enketoNotAvailable: problem(502.3, () => 'Enketo could not be contacted.'),
// returned if Enketo returns an unexpected response.
enketoUnexpectedResponse: problem(500.4, () => 'The Enketo service returned an unexpected response.')
}
};
// Decorate the Problem class with statics allowing access to the generators
// above.
for (const key of Object.keys(problems))
Problem[key] = problems[key];
module.exports = Problem;
| 60.757576 | 372 | 0.705902 |
b9d99ab279d20fb37eb4891aab44295db617875e | 1,533 | js | JavaScript | packages/admin/src/components/Table/Head.js | inceptjs/incept.js | e3ea1da9752962ff5a84e3447e3ffee07678a7c7 | [
"MIT"
] | null | null | null | packages/admin/src/components/Table/Head.js | inceptjs/incept.js | e3ea1da9752962ff5a84e3447e3ffee07678a7c7 | [
"MIT"
] | 2 | 2021-10-15T04:50:39.000Z | 2021-10-15T15:08:35.000Z | packages/admin/src/components/Table/Head.js | inceptjs/incept.js | e3ea1da9752962ff5a84e3447e3ffee07678a7c7 | [
"MIT"
] | null | null | null | //vendor imports
import React from 'react'
import PropTypes from 'prop-types'
//self imports
import classes from './Table.module.css'
//main component
export default function TableHead(props) {
//styles
const style = {}
let stickies = 0
if (props.stickyLeft) {
style.position = 'sticky'
style.zIndex = 2
style.left = 0
stickies++
}
if (props.stickyRight) {
style.position = 'sticky'
style.zIndex = 2
style.right = 0
stickies++
}
if (props.stickyTop) {
style.position = 'sticky'
style.zIndex = 2
style.top = 0
stickies++
}
if (stickies) {
style.zIndex += stickies
}
if (props.noWrap) {
style.whiteSpace = 'nowrap'
}
if (props.style && typeof props.style === 'object') {
Object.assign(style, props.style)
}
//props
const extras = {}
if ('rowspan' in props) {
extras.rowSpan = props.rowspan
}
if ('colspan' in props) {
extras.colSpan = props.colspan
}
if ('rowSpan' in props) {
extras.rowSpan = props.rowSpan
}
if ('colSpan' in props) {
extras.colSpan = props.colSpan
}
return (
<th
className={classes['table-head']}
style={style}
{...extras}
>
{props.children}
</th>
)
}
TableHead.propTypes = {
colSpan: PropTypes.number,
noWrap: PropTypes.bool,
rowSpan: PropTypes.number,
stickyLeft: PropTypes.bool,
stickyRight: PropTypes.bool,
stickyTop: PropTypes.bool
}
TableHead.defaultProps = {
stickyLeft: false,
stickyRight: false,
stickyTop: false
} | 19.405063 | 55 | 0.626875 |
b9da493a7b1a2445a46d9d8c8fe7bcc9de5a8002 | 763 | js | JavaScript | src/models/module.js | olivierhabi/codemade-API | 8de238a3a326b56c94d47fed2fca7b56281ab6d9 | [
"MIT"
] | null | null | null | src/models/module.js | olivierhabi/codemade-API | 8de238a3a326b56c94d47fed2fca7b56281ab6d9 | [
"MIT"
] | 1 | 2021-05-11T11:23:18.000Z | 2021-05-11T11:23:18.000Z | src/models/module.js | olivierhabi/codemade-API | 8de238a3a326b56c94d47fed2fca7b56281ab6d9 | [
"MIT"
] | null | null | null | "use strict";
module.exports = (sequelize, DataTypes) => {
const Module = sequelize.define(
"Module",
{
title: {
type: DataTypes.STRING(1024),
allowNull: false,
unique: true,
},
body: {
type: DataTypes.STRING(1024),
allowNull: false,
unique: true,
},
chapters: {
type: DataTypes.STRING(1024),
allowNull: false,
unique: true,
},
},
{}
);
Module.associate = (models) => {
// associations can be defined here
Module.belongsTo(models.User, {
foreignKey: "createdUserId",
as: "owner",
});
Module.belongsTo(models.User, {
foreignKey: "courseId",
as: "ownerCourse",
});
};
return Module;
};
| 20.078947 | 44 | 0.526868 |
b9daba51ce719bcf0db64af19b233c6d130dcfc6 | 1,973 | js | JavaScript | examples/using-remark/src/layouts/index.js | rrs94/gatsby | 2a7a8710ff579dcf4f3489d4e7b995dfb8de298c | [
"MIT"
] | 1 | 2020-11-20T20:02:13.000Z | 2020-11-20T20:02:13.000Z | examples/using-remark/src/layouts/index.js | rrs94/gatsby | 2a7a8710ff579dcf4f3489d4e7b995dfb8de298c | [
"MIT"
] | null | null | null | examples/using-remark/src/layouts/index.js | rrs94/gatsby | 2a7a8710ff579dcf4f3489d4e7b995dfb8de298c | [
"MIT"
] | null | null | null | import React from "react"
import { Link, StaticQuery, graphql } from "gatsby"
import { scale } from "../utils/typography"
import styles from "../styles"
import "typeface-space-mono"
import "typeface-spectral"
import "prismjs/themes/prism-solarizedlight.css"
import "prismjs/plugins/line-numbers/prism-line-numbers.css"
class Layout extends React.Component {
render() {
return (
<StaticQuery
query={graphql`
query {
site {
siteMetadata {
author
homepage
}
}
}
`}
render={data => {
const { author, homepage } = data.site.siteMetadata
return (
<div>
<div {...styles.container} {...styles.verticalPadding}>
<Link
to="/"
css={{
display: `inline-block`,
textDecoration: `none`,
}}
>
<h1
css={{
...scale(0),
color: styles.colors.light,
fontWeight: `normal`,
lineHeight: 1,
margin: 0,
}}
>
gatsby-example-using-remark
</h1>
</Link>
</div>
<div {...styles.container} {...styles.verticalPadding}>
{this.props.children}
<div
css={{
...scale(-0.5),
color: styles.colors.light,
}}
>
powered by{` `}
<a target="_blank" rel="noopener noreferrer" href={homepage}>
{author}
</a>
</div>
</div>
</div>
)
}}
/>
)
}
}
export default Layout
| 26.662162 | 79 | 0.390775 |
b9db72f34bcde99df86c1783209a7129e72b21bc | 300 | js | JavaScript | app/containers/ColumnManager/actions.js | austinhuang0131/PixivDeck | 681d6a3e0e6bf629f1e94387a08bc07c7e20adce | [
"MIT"
] | 1 | 2020-08-06T05:35:11.000Z | 2020-08-06T05:35:11.000Z | app/containers/ColumnManager/actions.js | austinhuang0131/PixivDeck | 681d6a3e0e6bf629f1e94387a08bc07c7e20adce | [
"MIT"
] | null | null | null | app/containers/ColumnManager/actions.js | austinhuang0131/PixivDeck | 681d6a3e0e6bf629f1e94387a08bc07c7e20adce | [
"MIT"
] | null | null | null | // @flow
import type { Action } from './actionTypes.js'
import { ADD_TABLE } from './constants'
import type { ColumnManagerId, ColumnManager } from './reducer'
export function addTable(id: ColumnManagerId, maneger: ColumnManager): Action {
return {
type: ADD_TABLE,
id,
maneger,
}
}
| 23.076923 | 79 | 0.69 |
b9dc0535b920b11c8366434e809322264dee07cf | 362 | js | JavaScript | browser/store.js | snickers495/foodie | 6e9bf1dc38f392474440d5312fcfabc7d95cbdd2 | [
"MIT"
] | null | null | null | browser/store.js | snickers495/foodie | 6e9bf1dc38f392474440d5312fcfabc7d95cbdd2 | [
"MIT"
] | null | null | null | browser/store.js | snickers495/foodie | 6e9bf1dc38f392474440d5312fcfabc7d95cbdd2 | [
"MIT"
] | null | null | null | import { createStore, applyMiddleware } from 'redux';
import loggerMiddleware from 'redux-logger';
import thunkMiddleware from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension';
import rootReducer from './redux';
export default createStore(
rootReducer,
composeWithDevTools(applyMiddleware(thunkMiddleware, loggerMiddleware))
);
| 32.909091 | 73 | 0.801105 |
b9dc21e77554a067d7a400cda3744bce03bf7123 | 247 | js | JavaScript | frontend/src/pages/newIncident/styles.js | maiquelp/beTheHero | 41596c151b7888db217a445d58277d9c925dafdd | [
"MIT"
] | 1 | 2020-05-30T20:36:08.000Z | 2020-05-30T20:36:08.000Z | frontend/src/pages/newIncident/styles.js | maiquelp/beTheHero | 41596c151b7888db217a445d58277d9c925dafdd | [
"MIT"
] | 21 | 2021-08-31T19:05:56.000Z | 2022-02-27T20:26:30.000Z | frontend/src/pages/newIncident/styles.js | maiquelp/beTheHero | 41596c151b7888db217a445d58277d9c925dafdd | [
"MIT"
] | null | null | null | import styled from 'styled-components';
export const Form = styled.form`
width: 100%;
max-width: 450px;
`;
export const Input = styled.input`
margin-top: 8px;
`;
export const TextArea = styled.textarea`
margin-top: 8px;
`;
| 15.4375 | 40 | 0.65587 |
b9dd4e376aa9cdd1091ffb0b7952f453da6b9ef8 | 6,101 | js | JavaScript | test/abort-event-emitter.js | lpinca/undici | 062c64240bb96e5a5e391d69506295bb27524c37 | [
"MIT"
] | null | null | null | test/abort-event-emitter.js | lpinca/undici | 062c64240bb96e5a5e391d69506295bb27524c37 | [
"MIT"
] | null | null | null | test/abort-event-emitter.js | lpinca/undici | 062c64240bb96e5a5e391d69506295bb27524c37 | [
"MIT"
] | null | null | null | 'use strict'
const { test } = require('tap')
const EventEmitter = require('events')
const { Client, errors } = require('..')
const { createServer } = require('http')
const { createReadStream } = require('fs')
const { Readable } = require('stream')
test('Abort before sending request (no body)', (t) => {
t.plan(4)
let count = 0
const server = createServer((req, res) => {
if (count === 1) {
t.fail('The second request should never be executed')
}
count += 1
res.end('hello')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
const ee = new EventEmitter()
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'GET' }, (err, response) => {
t.error(err)
const bufs = []
response.body.on('data', (buf) => {
bufs.push(buf)
})
response.body.on('end', () => {
t.equal('hello', Buffer.concat(bufs).toString('utf8'))
})
})
const body = new Readable({ read () { } })
body.on('error', (err) => {
t.type(err, errors.RequestAbortedError)
})
client.request({
path: '/',
method: 'GET',
signal: ee,
body
}, (err, response) => {
t.type(err, errors.RequestAbortedError)
})
ee.emit('abort')
})
})
test('Abort while waiting response (no body)', (t) => {
t.plan(1)
const ee = new EventEmitter()
const server = createServer((req, res) => {
ee.emit('abort')
res.setHeader('content-type', 'text/plain')
res.end('hello world')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'GET', signal: ee }, (err, response) => {
t.type(err, errors.RequestAbortedError)
})
})
})
test('Abort while waiting response (write headers started) (no body)', (t) => {
t.plan(1)
const ee = new EventEmitter()
const server = createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' })
res.flushHeaders()
ee.emit('abort')
res.end('hello world')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'GET', signal: ee }, (err, response) => {
t.type(err, errors.RequestAbortedError)
})
})
})
test('Abort while waiting response (write headers and write body started) (no body)', (t) => {
t.plan(2)
const ee = new EventEmitter()
const server = createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' })
res.write('hello')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'GET', signal: ee }, (err, response) => {
t.error(err)
response.body.on('data', () => {
ee.emit('abort')
})
response.body.on('error', err => {
t.type(err, errors.RequestAbortedError)
})
})
})
})
function waitingWithBody (body, type) {
test(`Abort while waiting response (with body ${type})`, (t) => {
t.plan(1)
const ee = new EventEmitter()
const server = createServer((req, res) => {
ee.emit('abort')
res.setHeader('content-type', 'text/plain')
res.end('hello world')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'POST', body, signal: ee }, (err, response) => {
t.type(err, errors.RequestAbortedError)
})
})
})
}
waitingWithBody('hello', 'string')
waitingWithBody(createReadStream(__filename), 'stream')
waitingWithBody(new Uint8Array([42]), 'Uint8Array')
function writeHeadersStartedWithBody (body, type) {
test(`Abort while waiting response (write headers started) (with body ${type})`, (t) => {
t.plan(1)
const ee = new EventEmitter()
const server = createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' })
res.flushHeaders()
ee.emit('abort')
res.end('hello world')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'POST', body, signal: ee }, (err, response) => {
t.type(err, errors.RequestAbortedError)
})
})
})
}
writeHeadersStartedWithBody('hello', 'string')
writeHeadersStartedWithBody(createReadStream(__filename), 'stream')
writeHeadersStartedWithBody(new Uint8Array([42]), 'Uint8Array')
function writeBodyStartedWithBody (body, type) {
test(`Abort while waiting response (write headers and write body started) (with body ${type})`, (t) => {
t.plan(2)
const ee = new EventEmitter()
const server = createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' })
res.write('hello')
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const client = new Client(`http://localhost:${server.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({ path: '/', method: 'POST', body, signal: ee }, (err, response) => {
t.error(err)
response.body.on('data', () => {
ee.emit('abort')
})
response.body.on('error', err => {
t.type(err, errors.RequestAbortedError)
})
})
})
})
}
writeBodyStartedWithBody('hello', 'string')
writeBodyStartedWithBody(createReadStream(__filename), 'stream')
writeBodyStartedWithBody(new Uint8Array([42]), 'Uint8Array')
| 28.778302 | 106 | 0.60318 |
b9dd7b0c6767f9da6879473b3163ae9132bad146 | 751 | js | JavaScript | src/components/imageFixed.js | unozerocode/gem-project | f94890724548cd2ed5ef1ce7ec9ac7b8fc0efc87 | [
"MIT"
] | null | null | null | src/components/imageFixed.js | unozerocode/gem-project | f94890724548cd2ed5ef1ce7ec9ac7b8fc0efc87 | [
"MIT"
] | null | null | null | src/components/imageFixed.js | unozerocode/gem-project | f94890724548cd2ed5ef1ce7ec9ac7b8fc0efc87 | [
"MIT"
] | 1 | 2020-02-06T23:56:10.000Z | 2020-02-06T23:56:10.000Z | import React from "react"
import Img from 'gatsby-image';
import { StaticQuery, graphql } from 'gatsby';
function renderImageFixed(file) {
return <Img fixed={file.node.childImageSharp.fixed} />
}
const ImageFixed = function (props) {
return <StaticQuery
query={graphql`
query {
images: allFile(filter:{ extension: { regex: "/jpeg|jpg|png|gif/"}}) {
edges {
node {
extension
relativePath
childImageSharp {
fixed(width: 60) {
...GatsbyImageSharpFixed
}
}
}
}
}
}
`}
render={({ images }) => renderImageFixed(images.edges.find(image => image.node.relativePath === props.src))}
/>
}
export default ImageFixed; | 25.896552 | 112 | 0.577896 |
b9ddc0af668f2af1f709d0d794e20769f91a9c59 | 2,697 | js | JavaScript | src/ionicons/socialAndroid.js | danielkov/react-icons-kit | 160bc967ed1ba9cad75a86fb40a449e1f79d1fe0 | [
"MIT"
] | 372 | 2017-01-07T01:54:27.000Z | 2022-03-02T10:16:01.000Z | src/ionicons/socialAndroid.js | danielkov/react-icons-kit | 160bc967ed1ba9cad75a86fb40a449e1f79d1fe0 | [
"MIT"
] | 72 | 2016-12-17T04:04:02.000Z | 2022-02-26T03:35:19.000Z | src/ionicons/socialAndroid.js | qza7849467chensh5/react-icons-kit | 09aeaf39d13e33c45bd032cc1b42a64c5a334dd9 | [
"MIT"
] | 66 | 2017-05-14T21:52:41.000Z | 2021-12-08T12:15:09.000Z | export const socialAndroid = {"viewBox":"0 0 512 512","children":[{"name":"g","attribs":{},"children":[{"name":"g","attribs":{},"children":[{"name":"g","attribs":{},"children":[{"name":"path","attribs":{"d":"M144,268.4V358c0,6.9,4.5,14,11.4,14H184v52c0,13.3,10.7,24,24,24s24-10.7,24-24v-52h49v52c0,7.5,3.4,14.2,8.8,18.6\r\n\t\t\tc3.9,3.4,9.1,5.4,14.7,5.4c0.1,0,0.2,0,0.3,0c0.1,0,0.1,0,0.2,0c13.3,0,24-10.7,24-24v-52h27.6c7,0,11.4-7.1,11.4-13.9v-89.6V192\r\n\t\t\tH144V268.4z"},"children":[{"name":"path","attribs":{"d":"M144,268.4V358c0,6.9,4.5,14,11.4,14H184v52c0,13.3,10.7,24,24,24s24-10.7,24-24v-52h49v52c0,7.5,3.4,14.2,8.8,18.6\r\n\t\t\tc3.9,3.4,9.1,5.4,14.7,5.4c0.1,0,0.2,0,0.3,0c0.1,0,0.1,0,0.2,0c13.3,0,24-10.7,24-24v-52h27.6c7,0,11.4-7.1,11.4-13.9v-89.6V192\r\n\t\t\tH144V268.4z"},"children":[]}]},{"name":"path","attribs":{"d":"M408,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C432,186.7,421.3,176,408,176z"},"children":[{"name":"path","attribs":{"d":"M408,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C432,186.7,421.3,176,408,176z"},"children":[]}]},{"name":"path","attribs":{"d":"M104,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C128,186.7,117.3,176,104,176z"},"children":[{"name":"path","attribs":{"d":"M104,176c-13.3,0-24,10.7-24,24v96c0,13.3,10.7,24,24,24s24-10.7,24-24v-96C128,186.7,117.3,176,104,176z"},"children":[]}]}]}]},{"name":"g","attribs":{},"children":[{"name":"g","attribs":{},"children":[{"name":"path","attribs":{"d":"M311.2,89.1l18.5-21.9c0.4-0.5-0.2-1.6-1.3-2.5c-1.1-0.8-2.4-1-2.7-0.4l-19.2,22.8c-13.6-5.4-30.2-8.8-50.6-8.8\r\n\t\t\tc-20.5-0.1-37.2,3.2-50.8,8.5l-19-22.4c-0.4-0.5-1.6-0.4-2.7,0.4c-1.1,0.8-1.7,1.8-1.3,2.5l18.3,21.6\r\n\t\t\tc-48.2,20.9-55.4,72.2-56.4,87.2h223.6C366.7,161,359.6,110.4,311.2,89.1z M206.8,138.9c-7.4,0-13.5-6-13.5-13.3\r\n\t\t\tc0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C220.3,132.9,214.3,138.9,206.8,138.9z M305.2,138.9c-7.4,0-13.5-6-13.5-13.3\r\n\t\t\tc0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C318.7,132.9,312.6,138.9,305.2,138.9z"},"children":[{"name":"path","attribs":{"d":"M311.2,89.1l18.5-21.9c0.4-0.5-0.2-1.6-1.3-2.5c-1.1-0.8-2.4-1-2.7-0.4l-19.2,22.8c-13.6-5.4-30.2-8.8-50.6-8.8\r\n\t\t\tc-20.5-0.1-37.2,3.2-50.8,8.5l-19-22.4c-0.4-0.5-1.6-0.4-2.7,0.4c-1.1,0.8-1.7,1.8-1.3,2.5l18.3,21.6\r\n\t\t\tc-48.2,20.9-55.4,72.2-56.4,87.2h223.6C366.7,161,359.6,110.4,311.2,89.1z M206.8,138.9c-7.4,0-13.5-6-13.5-13.3\r\n\t\t\tc0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C220.3,132.9,214.3,138.9,206.8,138.9z M305.2,138.9c-7.4,0-13.5-6-13.5-13.3\r\n\t\t\tc0-7.3,6-13.3,13.5-13.3c7.4,0,13.5,6,13.5,13.3C318.7,132.9,312.6,138.9,305.2,138.9z"},"children":[]}]}]}]}]}]}; | 2,697 | 2,697 | 0.616611 |
b9dde67d0638d10aaac5c7d4d84ea50155d6313d | 5,619 | js | JavaScript | resources/js/router/routes.js | donPabloNow/phive | 4f06c46e43c82e0070d5373df61b1a71e2ef7fda | [
"MIT"
] | 56 | 2021-03-10T02:35:44.000Z | 2022-03-13T21:00:49.000Z | resources/js/router/routes.js | donPabloNow/phive | 4f06c46e43c82e0070d5373df61b1a71e2ef7fda | [
"MIT"
] | 2 | 2021-10-01T02:58:43.000Z | 2022-02-24T17:01:47.000Z | resources/js/router/routes.js | donPabloNow/phive | 4f06c46e43c82e0070d5373df61b1a71e2ef7fda | [
"MIT"
] | 6 | 2021-08-15T06:17:46.000Z | 2022-03-11T03:30:14.000Z | function page(path) {
return () => import(/* webpackChunkName: '' */ `~/pages/${path}`).then(m => m.default || m)
}
export default [
{ path: '/', name: 'index', component: page('Home.vue') },
{ path: '/login', name: 'login', meta: { title: 'Log In' }, component: page('auth/Login.vue') },
{ path: '/register', name: 'register', meta: { title: 'Register' }, component: page('auth/Register.vue') },
{ path: '/password/reset', name: 'password.request', component: page('auth/password/ForgotPassword.vue') },
{ path: '/password/reset/:token', name: 'password.reset', component: page('auth/password/ResetPassword.vue') },
{ path: '/email/verify/:id', name: 'verification.verify', component: page('auth/verification/VerifyAccount.vue') },
{ path: '/email/resend', name: 'verification.resend', component: page('auth/verification/ResendVerification.vue') },
{ path: '/email/check', name: 'verification.check', component: page('auth/verification/CheckEmail.vue') },
{
path: '/profile',
component: page('profile'),
children: [
{ path: '', redirect: { name: 'profile.projects' } },
{ path: 'projects', name: 'profile.projects', meta: { title: 'Profile' }, component: page('profile/ProfileProjects.vue') },
{ path: 'wishlists', name: 'profile.wishlist', meta: { title: 'Profile' }, component: page('profile/ProfileWishlist.vue') },
{ path: 'info', name: 'profile.info', meta: { title: 'Profile' }, component: page('profile/ProfileInfo.vue') }
]
},
{ path: '/leaderboard', name: 'leaderboard', meta: { title: 'Leaderboard' }, component: page('Leaderboard.vue') },
{ path: '/inbox', name: 'inbox', meta: { title: 'Inbox' }, component: page('Inbox.vue') },
{ path: '/projectbox', name: 'projectbox', meta: { title: 'Project Box' }, component: page('ProjectBox.vue') },
{
path: '/party',
component: page('party'),
children: [
{ path: '', redirect: { name: 'party.leader' } },
{ path: 'leader', name: 'party.leader', meta: { title: 'Party' }, component: page('party/PartyAsLeader.vue') },
{ path: 'member', name: 'party.member', meta: { title: 'Party' }, component: page('party/PartyAsMember.vue') },
]
},
{
path: '/newcomer',
component: page('auth/newcomer'),
children: [
{ path: '', redirect: { name: 'newcomer.page1' } },
{ path: '1', name: 'newcomer.page1', component: page('auth/newcomer/NewcomerPage1.vue') },
{ path: '2', name: 'newcomer.page2', component: page('auth/newcomer/NewcomerPage2.vue') },
{ path: '3', name: 'newcomer.page3', component: page('auth/newcomer/NewcomerPage3.vue') }
]
},
{
path: '/profile/edit',
component: page('editprofile'),
children: [
{ path: '', redirect: { name: 'editprofile.page1' } },
{ path: 'page1', name: 'editprofile.page1', meta: { title: 'Edit Profile' }, component: page('editprofile/EditProfilePage1.vue') },
{ path: 'page2', name: 'editprofile.page2', meta: { title: 'Edit Profile' }, component: page('editprofile/EditProfilePage2.vue') }
]
},
{
path: '/@/:tagname',
component: page('visit'),
children: [
{ path: '', redirect: { name: '@.info' } },
{ path: 'projects', name: '@.projects', component: page('visit/VisitProjects.vue') },
{ path: 'wishlists', name: '@.wishlist', component: page('visit/VisitWishlist.vue') },
{ path: 'info', name: '@.info', component: page('visit/VisitInfo.vue') }
]
},
{ path: '/@/:tagname/message', name: 'message', component: page('Message.vue') },
{ path: '/settings', name: 'settings', meta: { title: 'Settings' }, component: page('settings') },
{ path: '/explore', name: 'explore', meta: { title: 'Explore' }, component: page('Explore.vue') },
{ path: '/project/post', name: 'project.post', meta: { title: 'Post Project' }, component: page('project/ProjectPost.vue') },
{ path: '/project/:id/edit-post', name: 'project.editpost', meta: { title: 'Edit Project' }, component: page('project/ProjectEdit.vue') },
{ path: '/project/:id', name: 'project.details', meta: { title: 'Project' }, component: page('project/ProjectDetails.vue') },
{ path: '/project/:id/review', name: 'project.review', meta: { title: 'Review Project' }, component: page('project/ProjectReview.vue') },
{ path: '/project/:id/dashboard', name: 'project.dashboard', meta: { title: 'Project' }, component: page('project/dashboard') },
{
path: '/project/:id/shorlisted',
component: page('project/shortlist'),
children: [
{ path: '', redirect: { name: 'shortlist.individual' } },
{ path: '/project/:id/shorlisted/individual', name: 'shortlist.individual', meta: { title: 'Apply Project' }, component: page('project/shortlist/ShortlistIndividual.vue') },
{ path: '/project/:id/shorlisted/team', name: 'shortlist.team', meta: { title: 'Apply Project' }, component: page('project/shortlist/ShortlistTeam.vue') }
]
},
{
path: '/project/:id/apply',
component: page('project/apply'),
children: [
{ path: '', redirect: { name: 'project.apply.individual' } },
{ path: '/project/:id/apply/individual', name: 'project.apply.individual', meta: { title: 'Apply Project' }, component: page('project/apply/ApplyIndividual.vue') },
{ path: '/project/:id/apply/team', name: 'project.apply.team', meta: { title: 'Apply Project' }, component: page('project/apply/ApplyTeam.vue') }
]
},
{ path: '/:url/404', name: '404', meta: { title: 'Error' }, component: page('errors/404.vue') },
{ path: '*', meta: { title: 'Error' }, component: page('errors/404.vue') }
]
| 52.027778 | 179 | 0.618082 |
b9de1a205a8ebb1c129982319ed08439f79b710c | 4,097 | js | JavaScript | lib/emit-command.js | Florian77/alice-runtime-1 | 82eff9cfddbd2b1ffd3cad0a5590bc4679aee3f9 | [
"MIT"
] | null | null | null | lib/emit-command.js | Florian77/alice-runtime-1 | 82eff9cfddbd2b1ffd3cad0a5590bc4679aee3f9 | [
"MIT"
] | null | null | null | lib/emit-command.js | Florian77/alice-runtime-1 | 82eff9cfddbd2b1ffd3cad0a5590bc4679aee3f9 | [
"MIT"
] | null | null | null | const dc = require("node-dev-console");
const R = require("ramda");
const {sleep} = require("./helper/sleep");
const {makeCommandId} = require("./helper/make-command-id");
const {v1: uuid} = require("uuid"); // todo -> change !!!!
const {
getCollectionCommandIndex,
getCollectionCommandPayload,
} = require("./database");
const {upsertStatsCommandContextAggregate} = require("./upsert-stats");
const {storeError} = require("./database");
const {isCommandControlPaused} = require("./command-control");
async function emitCommand({
context,
aggregate, // mandatory or optional ???
command,
payload = {},
invokeId = "",
priority = 0,
paused = false,
callbackFrom = false,
},
callbackList = []) {
// todo -> verify Data
const hasCallback = !R.isEmpty(callbackList);
// load global paused setting // todo -> make system option
if (await isCommandControlPaused({context, aggregate, command})) {
paused = true;
}
// const hasPayload = !R.isEmpty(payload);
let uniqueId, commandId, commandData
// const commandPayload = {
// _id: commandId,
// payload,
// };
// dc.l(("insertOne(%s)", dc.stringify(commandData))
let commandInserted = false, tryCount = 0;
// todo -> move retry logic to separate function like in nextSequenceNumber_dataStream -> to understand the logic better
do {
try {
uniqueId = uuid();
commandId = makeCommandId(context, aggregate, command, invokeId, uniqueId);
commandData = {
_id: commandId,
// commandId,
context,
aggregate,
command,
invokeId,
uniqueId,
multiInvoke: false,
createdAt: new Date(),
running: false,
runningSince: null,
handled: false,
handledAt: null,
priority,
paused,
pausedAt: paused ? (new Date()) : null,
// payload: {},
payload,
// hasPayload,
hasSubscriptions: false,
subscription: [],
hasCallback,
callbackList,
callbackFrom: !callbackFrom ? [] : [callbackFrom],
};
// insert payload before command
// if (hasPayload) {
// const result = await getCollectionCommandPayload().insertOne(commandPayload);
// dc.l("insertOne(commandPayload).result", result.insertedId);
// }
// const result =
await getCollectionCommandIndex().insertOne(commandData);
// dc.l("insertOne(commandData).result", result.insertedId);
commandInserted = true;
} catch (e) {
// run again on for example duplicate key error
console.error(e);
await storeError(__filename, 91, "emitCommand", e);
if (++tryCount >= 3) {
throw Error(`emitCommand insert CommandIndex [${commandId}] failed`);
}
await sleep(20);
}
} while (!commandInserted);
await upsertStatsCommandContextAggregate({context, aggregate, command});
/*if (hasCallback) {
for (let callbackCommand of callbackList) {
callbackCommand["callback"] = commandId;
dc.j(callbackCommand, "callbackCommand");
const result = await emitCommand(callbackCommand);
dc.j(result, "callbackCommand result");
}
}*/
// if (hasPayload) {
// return {
// ...commandData,
// payload,
// };
// }
return commandData;
}
module.exports = {
emitCommand,
};
| 29.905109 | 124 | 0.509397 |
b9de1e283da82422511255054149814e3f803b1d | 686 | js | JavaScript | sites/ccjdigital.com/server/routes/top250.js | Shinsina/randall-reilly-websites | 345267243a47dc1a03eba2abff2c803cf6c66147 | [
"MIT"
] | null | null | null | sites/ccjdigital.com/server/routes/top250.js | Shinsina/randall-reilly-websites | 345267243a47dc1a03eba2abff2c803cf6c66147 | [
"MIT"
] | null | null | null | sites/ccjdigital.com/server/routes/top250.js | Shinsina/randall-reilly-websites | 345267243a47dc1a03eba2abff2c803cf6c66147 | [
"MIT"
] | null | null | null | const { withWebsiteSection } = require('@parameter1/base-cms-marko-web/middleware');
const queryFragment = require('@randall-reilly/package-global/graphql/fragments/website-section-page');
const config = require('../../config/top250');
const template = require('../templates/website-section/top250');
const guide = require('../templates/website-section/top250/guide');
module.exports = (app) => {
const { rootAlias = 'ccj-top-250' } = config;
app.get(`/:alias(${rootAlias})`, withWebsiteSection({ template, queryFragment }));
Object.keys(config.guides).forEach((alias) => {
app.get(`/${rootAlias}/${alias}`, (_, res) => {
res.marko(guide, { alias });
});
});
};
| 40.352941 | 103 | 0.670554 |
b9de851a1e041114778d27bb79427900ca80c58b | 7,622 | js | JavaScript | js/main.js | 7725497142/7725497142.github.io | 21da2a0789a01fd64dc2ef4ebc25c32c372195c4 | [
"MIT"
] | 1 | 2019-12-17T19:32:24.000Z | 2019-12-17T19:32:24.000Z | js/main.js | 7725497142/7725497142.github.io | 21da2a0789a01fd64dc2ef4ebc25c32c372195c4 | [
"MIT"
] | null | null | null | js/main.js | 7725497142/7725497142.github.io | 21da2a0789a01fd64dc2ef4ebc25c32c372195c4 | [
"MIT"
] | null | null | null | (function ($) {
"use strict";
var window_width = $(window).width(),
window_height = window.innerHeight,
header_height = $(".default-header").height(),
header_height_static = $(".site-header.static").outerHeight(),
fitscreen = window_height - header_height;
$(".fullscreen").css("height", window_height)
$(".fitscreen").css("height", fitscreen);
$(window).on('scroll', function () {
if ($(this).scrollTop() > 600) {
$('.scroll-top').fadeIn(600);
} else {
$('.scroll-top').fadeOut(600);
}
});
$('.scroll-top').on("click", function () {
$("html,body").animate({
scrollTop: 0
}, 500);
return false;
});
// ------------------------------------------------------------------------------ //
// Preloader
// ------------------------------------------------------------------------------ //
$(document).ready(function () {
setTimeout(function () {
$('body').addClass('loaded');
}, 1000);
});
// ------------------------------------------------------------------------------ //
// Active Menu
// ------------------------------------------------------------------------------ //
$('#dopeNav').dopeNav({
stickyNav: true,
});
//Smooth Scrolling Using Navigation Menu
$('a[href*="#"]').on('click', function (e) {
$('html,body').animate({
scrollTop: $($(this).attr('href')).offset().top - 70
}, 500);
e.preventDefault();
});
// ------------------------------------------------------------------------------ //
// Team carousel
// ------------------------------------------------------------------------------ //
$("#team-carusel").owlCarousel({
items: 4,
loop: true,
margin: 30,
dots: true,
autoplayHoverPause: true,
smartSpeed: 500,
autoplay: false,
responsive: {
0: {
items: 1
},
767: {
items: 2
},
992: {
items: 4
}
}
});
// ------------------------------------------------------------------------------ //
// Service carousel
// ------------------------------------------------------------------------------ //
$("#service-carusel").owlCarousel({
items: 4,
loop: true,
margin: 15,
dots: true,
autoplayHoverPause: true,
smartSpeed: 500,
autoplay: true,
responsive: {
0: {
items: 1
},
767: {
items: 2
},
992: {
items: 4
}
}
});
// ------------------------------------------------------------------------------ //
// Testimonial carousel
// ------------------------------------------------------------------------------ //
$("#testimonial-carusel").owlCarousel({
items: 2,
loop: true,
margin: 30,
dots: true,
autoplayHoverPause: true,
smartSpeed: 500,
autoplay: true,
responsive: {
0: {
items: 1
},
768: {
items: 2
}
}
});
$("#testimonial-carusel2").owlCarousel({
items: 1,
loop: true,
margin: 30,
dots: true,
autoplayHoverPause: true,
smartSpeed: 500,
autoplay: true,
});
// ------------------------------------------------------------------------------ //
// Screenshot carousel
// ------------------------------------------------------------------------------ //
$('#screenshot-carusel').owlCarousel({
loop: true,
responsiveClass: true,
nav: true,
margin: 5,
autoplayTimeout: 4000,
smartSpeed: 500,
center: true,
navText: ['<span class="ti ti-angle-left"></span>', '<span class="ti ti-angle-right"></span>'],
responsive: {
0: {
items: 1,
},
600: {
items: 3
},
1200: {
items: 5
}
}
});
// ------------------------------------------------------------------------------ //
// Stat Counter
// ------------------------------------------------------------------------------ //
$('.counter').counterUp({
delay: 10,
time: 1000
});
// ------------------------------------------------------------------------------ //
// Skill Section
// ------------------------------------------------------------------------------ //
$(document).ready(function () {
$(".skills").addClass("active");
$(".skills .skill .skill-bar span").each(function () {
$(this).animate({
"width": $(this).parent().attr("data-bar") + "%"
}, 1000);
$(this).append('<b>' + $(this).parent().attr("data-bar") + '%</b>');
});
setTimeout(function () {
$(".skills .skill .skill-bar span b").animate({
"opacity": "1"
}, 1000);
}, 2000);
});
// ------------------------------------------------------------------------------ //
// Accordian
// ------------------------------------------------------------------------------ //
var allPanels = $(".accordion > dd").hide();
allPanels.first().slideDown("easeOutExpo");
$(".accordion").each(function () {
$(this).find("dt > a").first().addClass("active").parent().next().css({
display: "block"
});
});
$(document).on('click', '.accordion > dt > a', function (e) {
var current = $(this).parent().next("dd");
$(this).parents(".accordion").find("dt > a").removeClass("active");
$(this).addClass("active");
$(this).parents(".accordion").find("dd").slideUp("easeInExpo");
$(this).parent().next().slideDown("easeOutExpo");
return false;
});
// ------------------------------------------------------------------------------ //
// Skillbar
// ------------------------------------------------------------------------------ //
$(".skill_main").each(function() {
$(this).waypoint(function() {
var progressBar = $(".progress-bar");
progressBar.each(function(indx){
$(this).css("width", $(this).attr("aria-valuenow") + "%")
})
}, {
triggerOnce: true,
offset: 'bottom-in-view'
});
});
// ------------------------------------------------------------------------------ //
// Parallux Background
// ------------------------------------------------------------------------------ //
$(window).stellar();
// ------------------------------------------------------------------------------ //
// Contact Form
// ------------------------------------------------------------------------------ //
var submitContact = $('#submit-message'),
message = $('#msg');
submitContact.on('click', function (e) {
e.preventDefault();
var $this = $(this);
$.ajax({
type: "POST",
url: 'contact.php',
dataType: 'json',
cache: false,
data: $('#contact-form').serialize(),
success: function (data) {
if (data.info !== 'error') {
$this.parents('form').find('input[type=text],input[type=email],textarea,select').filter(':visible').val('');
message.hide().removeClass('success').removeClass('error').addClass('success').html(data.msg).fadeIn('slow').delay(5000).fadeOut('slow');
} else {
message.hide().removeClass('success').removeClass('error').addClass('error').html(data.msg).fadeIn('slow').delay(5000).fadeOut('slow');
}
}
});
});
})(jQuery);
| 25.92517 | 148 | 0.356862 |
b9deda21fac59b2f3827972c1ec55333bb29384e | 1,327 | js | JavaScript | src/promise/tests/cli/assets/aplus.js | maniekmankowski/yui3 | 25264e3629b1c07fb779d203c4a25c0879ec862c | [
"MIT"
] | 1,958 | 2015-01-01T02:46:43.000Z | 2022-03-26T20:25:44.000Z | src/promise/tests/cli/assets/aplus.js | Genhir/yui3 | 25264e3629b1c07fb779d203c4a25c0879ec862c | [
"MIT"
] | 58 | 2021-02-09T14:20:36.000Z | 2021-02-09T14:41:51.000Z | src/promise/tests/cli/assets/aplus.js | Genhir/yui3 | 25264e3629b1c07fb779d203c4a25c0879ec862c | [
"MIT"
] | 720 | 2015-01-01T02:49:26.000Z | 2022-03-04T10:23:18.000Z | YUI.add('aplus-tests', function(Y) {
var Assert = Y.Assert;
var adapter = {
fulfilled: function (value) {
return new Y.Promise(function (fulfill) {
fulfill(value);
});
},
rejected: function (value) {
return new Y.Promise(function (fulfill, reject) {
reject(value);
});
},
pending: function () {
var fulfill, reject, promise;
promise = new Y.Promise(function (f, r) {
fulfill = f;
reject = r;
});
return {
promise: promise,
fulfill: fulfill,
reject: reject
};
}
};
var promisesAplusTests = require("promises-aplus-tests");
var suite = new Y.Test.Suite('Promise Aplus');
suite.add(new Y.Test.Case({
name: "Promise Aplus",
'should run the full test suite': function() {
var test = this;
promisesAplusTests(adapter, {reporter: 'dot'}, function (err) {
test.resume(function() {
Assert.isNull(err, 'All promises tests should pass');
});
});
test.wait(9999999);
}
}));
Y.Test.Runner.add(suite);
});
| 24.574074 | 75 | 0.461944 |
b9dedd94252ccd3c39a9c684eb955cba691430f4 | 151 | js | JavaScript | server/util/index.js | ldsn/fly | e8df7a8c1ebd166229539e4748859dbe5c11ad5b | [
"MIT"
] | 1 | 2017-12-10T16:25:45.000Z | 2017-12-10T16:25:45.000Z | server/util/index.js | ldsn/fly | e8df7a8c1ebd166229539e4748859dbe5c11ad5b | [
"MIT"
] | null | null | null | server/util/index.js | ldsn/fly | e8df7a8c1ebd166229539e4748859dbe5c11ad5b | [
"MIT"
] | null | null | null | const _ = require('ramda');
const { allowMIMETypes } = require('../config/index');
exports.checkMIMETypes = type => _.contains(type, allowMIMETypes);
| 30.2 | 66 | 0.708609 |
b9e0100b09bff8bbe7b0457a7436a6ef228fb0ea | 2,633 | js | JavaScript | src/main/webapp/js/components/dev/simulationcontrols/buttons/LoadButton.js | VirtualFlyBrain/org.geppetto.frontend | a5c5f1151cb514e9d67935efe824b2491870c998 | [
"MIT"
] | null | null | null | src/main/webapp/js/components/dev/simulationcontrols/buttons/LoadButton.js | VirtualFlyBrain/org.geppetto.frontend | a5c5f1151cb514e9d67935efe824b2491870c998 | [
"MIT"
] | null | null | null | src/main/webapp/js/components/dev/simulationcontrols/buttons/LoadButton.js | VirtualFlyBrain/org.geppetto.frontend | a5c5f1151cb514e9d67935efe824b2491870c998 | [
"MIT"
] | null | null | null | /*******************************************************************************
*
* Copyright (c) 2011, 2016 OpenWorm.
* http://openworm.org
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License
* which accompanies this distribution, and is available at
* http://opensource.org/licenses/MIT
*
* Contributors:
* OpenWorm - http://openworm.org/people.html
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*******************************************************************************/
define(function (require) {
var React = require('react'),
ReactDOM = require('react-dom'),
GEPPETTO = require('geppetto'),
LoadSimModal = require('jsx!../LoadSimulationModal');
return React.createClass({
mixins: [require('mixins/TutorialMixin'), require('mixins/Button')],
popoverTitle: 'Load a Simulation',
popoverContent: 'Use this button to load an existing simulation or enter the URL to your own simulation. ' +
'Click this button to continue with tutorial.',
componentDidMount: function() {
GEPPETTO.on('start:tutorial', this.showPopover);
},
getDefaultProps: function() {
return {
label: 'Load Simulation',
className: 'pull-right',
icon:'fa fa-folder-open',
onClick: function(){ ReactDOM.render(React.createFactory(LoadSimModal)({show:true, keyboard:false}), document.getElementById('modal-region')); }
}
}
});
}); | 41.793651 | 160 | 0.644512 |
b9e027efb451a75db40fc4c05bf152cee3b92575 | 281 | js | JavaScript | webpack/development/index.babel.js | ortenheim/erlyeditor | fe6aefdf88e53d191cf4a869e09eb41578221f98 | [
"MIT"
] | null | null | null | webpack/development/index.babel.js | ortenheim/erlyeditor | fe6aefdf88e53d191cf4a869e09eb41578221f98 | [
"MIT"
] | null | null | null | webpack/development/index.babel.js | ortenheim/erlyeditor | fe6aefdf88e53d191cf4a869e09eb41578221f98 | [
"MIT"
] | 1 | 2019-09-22T09:41:03.000Z | 2019-09-22T09:41:03.000Z | import merge from 'webpack-merge';
import base from '../base';
import loaders from './loaders';
import preLoaders from './preLoaders';
export default merge(base, {
debug: false,
cache: true,
module: { preLoaders, loaders },
devtool: 'cheap-module-inline-source-map'
});
| 20.071429 | 43 | 0.697509 |
b9e0e3cf640f52e235e02389a5bb43a0fc8b1190 | 2,588 | js | JavaScript | open-hackathon-client/src/client/static/js/views/oh.manage.testtemplate.js | 99Kies/open-hackathon | 55042fac2f01cb2dc1316b407548302297694f65 | [
"MIT"
] | 37 | 2018-03-28T06:03:34.000Z | 2021-11-05T05:38:37.000Z | open-hackathon-client/src/client/static/js/views/oh.manage.testtemplate.js | 99Kies/open-hackathon | 55042fac2f01cb2dc1316b407548302297694f65 | [
"MIT"
] | 103 | 2018-08-31T07:45:53.000Z | 2021-09-02T12:01:06.000Z | open-hackathon-client/src/client/static/js/views/oh.manage.testtemplate.js | 99Kies/open-hackathon | 55042fac2f01cb2dc1316b407548302297694f65 | [
"MIT"
] | 34 | 2015-02-02T03:05:18.000Z | 2018-01-22T01:17:11.000Z | /*
* This file is covered by the LICENSING file in the root of this project.
*/
(function($, oh) {
function getUrlParam(){
return {
hackathon_name: $.getUrlParam('hackathon_name'),
temp_name : $.getUrlParam('temp_name')
}
}
function createRemotes(data){
removeLoading();
var remotes = $('#remotes');
var tabs = $('#tabs');
$.each(data.remote_servers,function(i,remote){
var ifrem = $('<iframe>').attr({
src: remote.url+'&oh='+$.cookie('token'),
id: remote.name,
width: '100%',
height: '100%',
frameborder: 'no',
marginwidth: '0',
scrolling: 'no',
class: 'v-hidden'
}).appendTo(remotes);
var li = $('<li><a href="#'+ remote.name+'">'+ remote.name +'</a></li>').appendTo(tabs);
});
tabs.find('a:eq(0)').trigger('click');
}
function showError(error){
removeLoading();
var remotes = $('#remotes');
remotes.append($('<p>').text(JSON.stringify(error)));
}
function removeLoading(){
$('.loading').detach();
$('.full-main').show();
}
function bindEvent(){
var remotes = $('#remotes').bind('tab',function(e,id){
remotes.find('iframe').addClass('v-hidden');
remotes.find(id).removeClass('v-hidden');
}).on('mouseover', 'iframe', function (e) {
$(this).focus();
});
var tabs = $('#tabs').on('click','a',function(e){
e.preventDefault();
var _self = $(this)
var li = _self .parents('li');
if(!li.hasClass('active')){
tabs.find('li').removeClass('active');
li.addClass('active');
remotes.trigger('tab',[_self.attr('href')])
}
});
}
function loadingTemp(){
var param = getUrlParam();
oh.api.admin.experiment.post({
body:{name:param.temp_name},
header:{hackathon_name:param.hackathon_name}
},function(data){
if(data.error){
showError(data.error);
}
else if(data.status == 1){
setTimeout(loadingTemp,60000);
}else if(data.status == 2){
createRemotes(data);
}
})
}
function init(){
loadingTemp();
bindEvent();
}
$(function(){
init();
});
})(window.jQuery,window.oh); | 28.755556 | 100 | 0.472566 |
b9e1a231dd9297c26320a2c57e29663a1b90831b | 2,959 | js | JavaScript | bundle/common/test/cache/cache.module.js | dzzzzzy/nest | 852f5cca87538d26347f818fd85e2bc3262f9e7a | [
"MIT"
] | 1 | 2020-09-04T09:59:53.000Z | 2020-09-04T09:59:53.000Z | bundle/common/test/cache/cache.module.js | dzzzzzy/nest | 852f5cca87538d26347f818fd85e2bc3262f9e7a | [
"MIT"
] | null | null | null | bundle/common/test/cache/cache.module.js | dzzzzzy/nest | 852f5cca87538d26347f818fd85e2bc3262f9e7a | [
"MIT"
] | 1 | 2022-02-14T20:52:28.000Z | 2022-02-14T20:52:28.000Z | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const cache_constants_1 = require("../../cache/cache.constants");
const cache_module_1 = require("./../../cache/cache.module");
describe('CacheModule', () => {
describe('register', () => {
it('should provide an options', () => {
const options = {
test: 'test',
};
const dynamicModule = cache_module_1.CacheModule.register(options);
chai_1.expect(dynamicModule.providers).to.have.length(1);
chai_1.expect(dynamicModule.imports).to.be.empty;
chai_1.expect(dynamicModule.exports).to.contain(cache_constants_1.CACHE_MODULE_OPTIONS);
chai_1.expect(dynamicModule.providers).to.contain({
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
useValue: options,
});
});
});
describe('register async', () => {
describe('when useFactory', () => {
it('should provide an options', () => {
const options = {};
const asyncOptions = {
useFactory: () => options,
};
const dynamicModule = cache_module_1.CacheModule.registerAsync(asyncOptions);
chai_1.expect(dynamicModule.providers).to.have.length(1);
chai_1.expect(dynamicModule.imports).to.be.empty;
chai_1.expect(dynamicModule.exports).to.contain(cache_constants_1.CACHE_MODULE_OPTIONS);
chai_1.expect(dynamicModule.providers).to.contain({
provide: cache_constants_1.CACHE_MODULE_OPTIONS,
useFactory: asyncOptions.useFactory,
inject: [],
});
});
});
describe('when useExisting', () => {
it('should provide an options', () => {
const asyncOptions = {
useExisting: Object,
};
const dynamicModule = cache_module_1.CacheModule.registerAsync(asyncOptions);
chai_1.expect(dynamicModule.providers).to.have.length(1);
chai_1.expect(dynamicModule.imports).to.be.empty;
chai_1.expect(dynamicModule.exports).to.contain(cache_constants_1.CACHE_MODULE_OPTIONS);
});
});
describe('when useClass', () => {
it('should provide an options', () => {
const asyncOptions = {
useClass: Object,
};
const dynamicModule = cache_module_1.CacheModule.registerAsync(asyncOptions);
chai_1.expect(dynamicModule.providers).to.have.length(2);
chai_1.expect(dynamicModule.imports).to.be.empty;
chai_1.expect(dynamicModule.exports).to.contain(cache_constants_1.CACHE_MODULE_OPTIONS);
});
});
});
});
| 46.234375 | 104 | 0.563704 |
b9e1ab6cbf9ba531caff50f0222a437c2ad13dba | 4,054 | js | JavaScript | src/overlay/__tests__/Overlay.web.test.js | sebgreg/react-native-elements | 182428e70c2b666e1e3a8dd814d9c09c9c77c2ef | [
"MIT"
] | 1 | 2018-04-03T10:38:19.000Z | 2018-04-03T10:38:19.000Z | src/overlay/__tests__/Overlay.web.test.js | Gregor1971/react-native-elements | d7a51e7796a4c59b51d3fc1c4669e536ad88061a | [
"MIT"
] | null | null | null | src/overlay/__tests__/Overlay.web.test.js | Gregor1971/react-native-elements | d7a51e7796a4c59b51d3fc1c4669e536ad88061a | [
"MIT"
] | 2 | 2018-07-19T20:21:22.000Z | 2018-07-30T19:00:18.000Z | import React from 'react';
import { Text, TouchableHighlight, View } from 'react-native';
import foreach from 'lodash.foreach';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import parseSamples, {
assignRef,
genRefId,
} from 'enzyme-styleguidist-sample-parser';
import options, {
snapShot,
buildJsxForGuideMethod,
ensureCalled,
onlyEnsureCalled,
onlySnapshots,
} from '../../../samples';
import Overlay from '../Overlay';
const children = <Text>here's something</Text>;
const childrenString = `<Text>here's something</Text>`;
const getJsx = propString => {
const jsx = `initialState = { isVisible: false };
const View = RN.View;
const TouchableHighlight = RN.TouchableHighlight;
const Text = RN.Text;
<View>
<TouchableHighlight
onPress={() => {
setState({ isVisible: true });
setTimeout(() => {
setState({ isVisible: false });
}, 4000);
}}
style={{ backgroundColor: '#aaa', padding: 10, marginBottom: 15 }}
>
<Text>Show Overlay for 4 sec</Text>
</TouchableHighlight>
<Overlay ${propString} isVisible={state.isVisible}>
${childrenString}
</Overlay>
</View>
`;
console.warn(jsx);
return jsx;
};
// const props = {
// containerStyle: {
// component: Overlay,
// children,
// props: {
// containerStyle: { borderWidth: 5 },
// },
// enzyme: {
// tests: { shallow: { snapshot: snapShot() } },
// },
// styleguidist: {
// getJsxString: getJsx('containerStyle={{ borderWidth: 5 }}'),
// },
// },
// overlayStyle: {
// component: Overlay,
// children,
// props: {
// overlayStyle: { borderWidth: 5 },
// },
// enzyme: {
// tests: { shallow: { snapshot: snapShot() } },
// },
// styleguidist: {
// getJsxString: getJsx('overlayStyle={{ borderWidth: 5 }}'),
// },
// },
// };
const props = {
containerStyle: {
component: Overlay,
children,
props: {
isVisible: true,
containerStyle: { borderWidth: 5 },
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
overlayStyle: {
component: Overlay,
children,
props: {
isVisible: true,
overlayStyle: { borderWidth: 5 },
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
overlayBackgroundColor: {
component: Overlay,
children,
props: {
isVisible: true,
overlayBackgroundColor: '#aaa',
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
windowBackgroundColor: {
component: Overlay,
children,
props: {
isVisible: true,
windowBackgroundColor: '#aaa',
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
borderRadius: {
component: Overlay,
children,
props: {
isVisible: true,
borderRadius: 20,
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
width: {
component: Overlay,
children,
props: {
isVisible: true,
width: 50,
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
height: {
component: Overlay,
children,
props: {
isVisible: true,
height: 50,
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
fullScreen: {
component: Overlay,
children,
props: {
isVisible: true,
fullScreen: true,
},
enzyme: {
tests: { shallow: { snapshot: snapShot() } },
},
styleguidist: {},
},
};
const samples = {
props,
};
parseSamples(
{
Misc: { sectionComponents: { Overlay: { samples } } },
},
options
);
| 21.679144 | 71 | 0.531574 |
b9e1d998b780458f6488e649a515208c8e8a57a2 | 753 | js | JavaScript | commands/rename.js | Lazyy233/Lazyyyyy | cad1b10d05fa1ec5d54fa23eddfeb5d4728e4d80 | [
"CC0-1.0"
] | 1 | 2020-10-24T08:27:09.000Z | 2020-10-24T08:27:09.000Z | commands/rename.js | Lazyy233/Lazyyyyy | cad1b10d05fa1ec5d54fa23eddfeb5d4728e4d80 | [
"CC0-1.0"
] | null | null | null | commands/rename.js | Lazyy233/Lazyyyyy | cad1b10d05fa1ec5d54fa23eddfeb5d4728e4d80 | [
"CC0-1.0"
] | null | null | null | const botconfig = require("../botconfig.json");
const prefix = botconfig.prefix
const Discord = module.require('discord.js');
module.exports.run = async (bot, message, args) => {
if(!message.content.startsWith(prefix))return;
if(message.member.hasPermission("ADMINISTRATOR")) {
if(!args[0]){
return message.channel.send(":x: " + "| Please enter a new name for me!").then(msg => msg.delete(3000));
}
message.guild.member(bot.user).setNickname(args.join(" ")).then(user => message.channel.send("My New NickName is " + args.join(" ") + "!")).catch(console.error);
} else {
return message.reply(":x: " + "| You need to have the \"ADMINISTRATOR\" Permission").then(msg => msg.delete(3000));
}
}
module.exports.help = {
name: "rename"
}
| 34.227273 | 163 | 0.667995 |
b9e24c1e51eedd645051c38358d28225edc3bd3c | 1,393 | js | JavaScript | src/commands/Music/LyricsCommand.js | DaanGamesDG/discordjs-music-bot | c20a3e283ab397f06fb58c7be5c87c2804fdc220 | [
"Apache-2.0"
] | null | null | null | src/commands/Music/LyricsCommand.js | DaanGamesDG/discordjs-music-bot | c20a3e283ab397f06fb58c7be5c87c2804fdc220 | [
"Apache-2.0"
] | null | null | null | src/commands/Music/LyricsCommand.js | DaanGamesDG/discordjs-music-bot | c20a3e283ab397f06fb58c7be5c87c2804fdc220 | [
"Apache-2.0"
] | null | null | null | const BaseCommand = require('../../utils/structures/BaseCommand');
const lryicsfinder = require('lyrics-finder');
const { MessageEmbed } = require('discord.js');
module.exports = class LyricsCommand extends BaseCommand {
constructor() {
super('lyrics', 'Music', ['lyr', 'l'], 'Gives the lyrics the song playing in the guild');
}
async run(client, message, args) {
const queue = client.queue.get(message.guild.id);
if (!queue || !queue.songs[0]) return message.channel.send(`> ${client.emojis.cache.find(m => m.name === 'redtick').toString()} This server doesnt have a queue!`);
let songTitle = queue.songs[0].title
.toLowerCase()
.replace('(official video)', '')
.replace('lyrics', '')
.replace('(video)', '')
await lryicsfinder(songTitle, '').then(lyrics => {
if (!lyrics) return message.channel.send(`> 📑 No lyrics for **${queue.songs[0].title}** found!`);
const embed = new MessageEmbed()
.setAuthor(`Lyrics for ${queue.songs[0].title}`, queue.playing ? 'https://emoji.gg/assets/emoji/6935_Plak_Emoji.gif' : 'https://imgur.com/Y9XRC6N.png')
.setDescription(lyrics)
.setColor(message.member.displayHexColor || 'BLUE')
if (embed.description.length >= 2048)
embed.description = `${embed.description.substr(0, 2045)}...`;
return message.channel.send(embed).catch(console.error);
})
}
}
| 43.53125 | 167 | 0.649677 |