code
stringlengths 2
1.05M
|
---|
/**
* This is file is the entry point of the application
* You can import any supported file or modules here
* To see more detail check out the README.md file
*/
// Import your Sass
import './styles/index.scss';
// And CSS files
import './styles/index.css';
|
module.exports = function (grunt) {
'use strict';
// check task runtime
require('time-grunt')(grunt);
// load generic configs
var configs = require('dalek-build-tools');
// project config
grunt.initConfig({
// load module meta data
pkg: grunt.file.readJSON('package.json'),
// define a src set of files for other tasks
src: {
lint: ['Gruntfile.js', 'index.js', 'test/*.js'],
complexity: ['index.js'],
test: ['test/*.js'],
src: ['index.js']
},
// clean automatically generated helper files & docs
clean: configs.clean,
// speed up build by defining concurrent tasks
concurrent: configs.concurrent,
// linting
jshint: configs.jshint,
// testing
mochaTest: configs.mocha,
// code metrics
complexity: configs.complexity,
plato: configs.plato(grunt.file.readJSON('.jshintrc')),
// api docs
yuidoc: configs.yuidocs(),
// user docs
documantix: {
options: {
header: 'dalekjs/dalekjs.com/master/assets/header.html',
footer: 'dalekjs/dalekjs.com/master/assets/footer.html',
target: 'report/docs',
vars: {
title: 'DalekJS - Documentation - Browser - Mobile Safari on iOS',
desc: 'DalekJS - Documentation - Browser - Mobile Safari on iOS',
docs: true
}
},
src: ['index.js']
},
// add current timestamp to the html document
includereplace: {
dist: {
options: {
globals: {
timestamp: '<%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %>'
},
},
src: 'report/docs/*.html',
dest: './'
}
},
// up version, tag & commit
bump: configs.bump({
pushTo: 'git@github.com:dalekjs/dalek-browser-ios.git',
files: ['package.json', 'CONTRIBUTORS.md', 'CHANGELOG.md']
}),
// generate contributors file
contributors: configs.contributors,
// compress artifacts
compress: configs.compress,
// prepare files for grunt-plato to
// avoid error messages (weird issue...)
preparePlato: {
options: {
folders: [
'coverage',
'report',
'report/coverage',
'report/complexity',
'report/complexity/files',
'report/complexity/files/index_js'
],
files: [
'report.history.json',
'files/index_js/report.history.json'
]
}
},
// prepare files & folders for coverage
prepareCoverage: {
options: {
folders: ['coverage', 'report', 'report/coverage'],
pattern: '[require("fs").realpathSync(__dirname + "/../index.js")]'
}
},
// list requires that need to be changed
// for generating a canary build
'release-canary': {
options: {
files: ['index.js']
}
},
// archives the docs if a new version appears
archive: {
options: {
file: 'ios.html'
}
}
});
// load 3rd party tasks
require('load-grunt-tasks')(grunt);
grunt.loadTasks('./node_modules/dalek-build-tools/tasks');
// define runner tasks
grunt.registerTask('lint', 'jshint');
// split test & docs for speed
grunt.registerTask('test', ['clean:coverage', 'prepareCoverage', 'concurrent:test', 'generateCoverageBadge']);
grunt.registerTask('docs', ['clean:reportZip', 'clean:report', 'preparePlato', 'documantix', 'includereplace', 'concurrent:docs', 'compress']);
// release tasks
grunt.registerTask('releasePatch', ['test', 'bump-only:patch', 'contributors', 'changelog', 'bump-commit']);
grunt.registerTask('releaseMinor', ['test', 'bump-only:minor', 'contributors', 'changelog', 'bump-commit']);
grunt.registerTask('releaseMajor', ['test', 'bump-only:major', 'contributors', 'changelog', 'bump-commit']);
// clean, test, generate docs (the CI task)
grunt.registerTask('all', ['clean', 'test', 'docs']);
};
|
'use strict';
var expect = require('chai').expect,
path = require('path'),
load = requireTest('load');
describe('Error test: swig-loader', function() {
it('should throw nicely formatted error', function(done) {
load(path.resolve(__dirname, 'template.js'), function(err, mod) {
expect(err).to.exist;
expect(err.message)
.to.contain('Could not resolve swig template.')
.and.to.contain('Cause: Error: Unexpected tag "xyz asd" on line 1 in file ')
.and.to.contain('template.html.');
expect(mod).to.not.exist;
done();
});
});
});
|
/*! Element Plus v2.0.4 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ElementPlusLocaleKk = factory());
})(this, (function () { 'use strict';
var kk = {
name: "kk",
el: {
colorpicker: {
confirm: "\u049A\u0430\u0431\u044B\u043B\u0434\u0430\u0443",
clear: "\u0422\u0430\u0437\u0430\u043B\u0430\u0443"
},
datepicker: {
now: "\u049A\u0430\u0437\u0456\u0440",
today: "\u0411\u04AF\u0433\u0456\u043D",
cancel: "\u0411\u043E\u043B\u0434\u044B\u0440\u043C\u0430\u0443",
clear: "\u0422\u0430\u0437\u0430\u043B\u0430\u0443",
confirm: "\u049A\u0430\u0431\u044B\u043B\u0434\u0430\u0443",
selectDate: "\u041A\u04AF\u043D\u0434\u0456 \u0442\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437",
selectTime: "\u0421\u0430\u0493\u0430\u0442\u0442\u044B \u0442\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437",
startDate: "\u0411\u0430\u0441\u0442\u0430\u043B\u0443 \u043A\u04AF\u043D\u0456",
startTime: "\u0411\u0430\u0441\u0442\u0430\u043B\u0443 \u0441\u0430\u0493\u0430\u0442\u044B",
endDate: "\u0410\u044F\u049B\u0442\u0430\u043B\u0443 \u043A\u04AF\u043D\u0456",
endTime: "\u0410\u044F\u049B\u0442\u0430\u043B\u0443 \u0441\u0430\u0493\u0430\u0442\u044B",
prevYear: "\u0410\u043B\u0434\u044B\u04A3\u0493\u044B \u0436\u044B\u043B",
nextYear: "\u041A\u0435\u043B\u0435\u0441\u0456 \u0436\u044B\u043B",
prevMonth: "\u0410\u043B\u0434\u044B\u04A3\u0493\u044B \u0430\u0439",
nextMonth: "\u041A\u0435\u043B\u0435\u0441\u0456 \u0430\u0439",
year: "\u0416\u044B\u043B",
month1: "\u049A\u0430\u04A3\u0442\u0430\u0440",
month2: "\u0410\u049B\u043F\u0430\u043D",
month3: "\u041D\u0430\u0443\u0440\u044B\u0437",
month4: "\u0421\u04D9\u0443\u0456\u0440",
month5: "\u041C\u0430\u043C\u044B\u0440",
month6: "\u041C\u0430\u0443\u0441\u044B\u043C",
month7: "\u0428\u0456\u043B\u0434\u0435",
month8: "\u0422\u0430\u043C\u044B\u0437",
month9: "\u049A\u044B\u0440\u043A\u04AF\u0439\u0435\u043A",
month10: "\u049A\u0430\u0437\u0430\u043D",
month11: "\u049A\u0430\u0440\u0430\u0448\u0430",
month12: "\u0416\u0435\u043B\u0442\u043E\u049B\u0441\u0430\u043D",
week: "\u0410\u043F\u0442\u0430",
weeks: {
sun: "\u0416\u0435\u043A",
mon: "\u0414\u04AF\u0439",
tue: "\u0421\u0435\u0439",
wed: "\u0421\u04D9\u0440",
thu: "\u0411\u0435\u0439",
fri: "\u0416\u04B1\u043C",
sat: "\u0421\u0435\u043D"
},
months: {
jan: "\u049A\u0430\u04A3",
feb: "\u0410\u049B\u043F",
mar: "\u041D\u0430\u0443",
apr: "\u0421\u04D9\u0443",
may: "\u041C\u0430\u043C",
jun: "\u041C\u0430\u0443",
jul: "\u0428\u0456\u043B",
aug: "\u0422\u0430\u043C",
sep: "\u049A\u044B\u0440",
oct: "\u049A\u0430\u0437",
nov: "\u049A\u0430\u0440",
dec: "\u0416\u0435\u043B"
}
},
select: {
loading: "\u0416\u04AF\u043A\u0442\u0435\u043B\u0443\u0434\u0435",
noMatch: "\u0421\u04D9\u0439\u043A\u0435\u0441 \u0434\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
noData: "\u0414\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
placeholder: "\u0422\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437"
},
cascader: {
noMatch: "\u0421\u04D9\u0439\u043A\u0435\u0441 \u0434\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
loading: "\u0416\u04AF\u043A\u0442\u0435\u043B\u0443\u0434\u0435",
placeholder: "\u0422\u0430\u04A3\u0434\u0430\u04A3\u044B\u0437",
noData: "\u0414\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B"
},
pagination: {
goto: "\u0411\u0430\u0440\u0443",
pagesize: "/page",
total: "\u0411\u0430\u0440\u043B\u044B\u0493\u044B {total}",
pageClassifier: ""
},
messagebox: {
title: "\u0425\u0430\u0431\u0430\u0440",
confirm: "\u049A\u0430\u0431\u044B\u043B\u0434\u0430\u0443",
cancel: "\u0411\u043E\u043B\u0434\u044B\u0440\u043C\u0430\u0443",
error: "\u0416\u0430\u0440\u0430\u043C\u0441\u044B\u0437 \u0435\u043D\u0433\u0456\u0437\u0443\u043B\u0435\u0440"
},
upload: {
deleteTip: "\u04E8\u0448\u0456\u0440\u0443\u0434\u0456 \u0431\u0430\u0441\u044B\u043F \u04E9\u0448\u0456\u0440\u0456\u04A3\u0456\u0437",
delete: "\u04E8\u0448\u0456\u0440\u0443",
preview: "\u0410\u043B\u0434\u044B\u043D \u0430\u043B\u0430 \u049B\u0430\u0440\u0430\u0443",
continue: "\u0416\u0430\u043B\u0493\u0430\u0441\u0442\u044B\u0440\u0443"
},
table: {
emptyText: "\u0414\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
confirmFilter: "\u049A\u0430\u0431\u044B\u043B\u0434\u0430\u0443",
resetFilter: "\u049A\u0430\u043B\u043F\u044B\u043D\u0430 \u043A\u0435\u043B\u0442\u0456\u0440\u0443",
clearFilter: "\u0411\u0430\u0440\u043B\u044B\u0493\u044B",
sumText: "\u0421\u043E\u043C\u0430\u0441\u044B"
},
tree: {
emptyText: "\u0414\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B"
},
transfer: {
noMatch: "\u0421\u04D9\u0439\u043A\u0435\u0441 \u0434\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
noData: "\u0414\u0435\u0440\u0435\u043A\u0442\u0435\u0440 \u0436\u043E\u049B",
titles: ["List 1", "List 2"],
filterPlaceholder: "\u041A\u0456\u043B\u0442 \u0441\u04E9\u0437\u0434\u0456 \u0435\u043D\u0433\u0456\u0437\u0456\u04A3\u0456\u0437",
noCheckedFormat: "{total} \u044D\u043B\u044D\u043C\u044D\u043D\u0442",
hasCheckedFormat: "{checked}/{total} \u049B\u04B1\u0441\u0431\u0435\u043B\u0433\u0456\u0441\u0456 \u049B\u043E\u0439\u044B\u043B\u0434\u044B"
},
image: {
error: "FAILED"
},
pageHeader: {
title: "Back"
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No"
}
}
};
return kk;
}));
|
import debug from 'debug';
import { browserHistory } from 'react-router';
// Paths are relative to `app` directory
import createFlux from 'flux/createFlux';
import ApiClient from '../shared/api-client';
import universalRender from '../shared/universal-render';
const { NODE_ENV } = process.env;
if (NODE_ENV === 'development') debug.enable('dev,koa');
const client = new ApiClient();
const flux = createFlux(client);
universalRender({ flux, history: browserHistory })
.catch(err => debug('dev')(err));
|
define( 'argumenta/widgets/Proposition',
[
"require-jquery",
"argumenta/widgets/Base",
"argumenta/widgets/AddTag",
"argumenta/widgets/Tags",
"text!./Proposition/template.html.mustache"
],
function( $, Base, AddTag, Tags, Template ) {
var Proposition = Base.module( {
moduleID: 'Proposition',
template: Template,
defaults: {
index: 'P'
},
init: function( options ) {
this.initProposition( options );
},
prototype: {
// Gets the object type.
getType: function() {
return 'proposition';
},
// Gets the object sha1.
getSha1: function() {
return this.options.sha1;
},
// Inits this proposition widget.
initProposition: function( options ) {
var self = this;
// Initial state.
self.addTagVisible = false;
self.tagsVisible = false;
// Elements.
self.main = self.element.children('.proposition-main');
self.addTagButton = self.main.find('.add-tag-button');
// Toggle details on click.
self.element.on('click', function(event) {
// Don't toggle when behind other widgets.
var clickedWidget = $(event.target).closest('div[class*="widget"]');
if ( !clickedWidget.is(self.element) ) {
return;
}
// Don't expand on mouse release after dragging.
if (self.element.hasClass('ui-state-just-dragged')) {
return;
}
// Don't interfere with links.
if ($(event.target).is('a')) {
return;
}
self.toggleDetails();
});
self._bindAddTagButton();
self._makeDraggable();
},
// Toggles details for this proposition.
toggleDetails: function() {
var self = this;
self._toggleTags();
},
// Toggles tags for this proposition.
_toggleTags: function() {
var self = this;
if ( typeof self.tags === "undefined" ) {
self._initTags();
}
else {
self.tags.element.toggle( 300 );
self.tagsVisible = !self.tagsVisible;
}
},
// Toggles AddTag widget.
toggleAddTag: function() {
var self = this;
// Initialize if necessary.
if ( typeof self.addTag === "undefined" ) {
self._initAddTag();
self.addTag.element.hide();
}
// Fade in or out.
self.addTag.element.toggle( 300 );
self.addTagVisible = !self.addTagVisible;
},
// Inits the AddTag widget.
_initAddTag: function() {
var self = this;
// Create a new widget targeting this proposition.
var addTag = new AddTag( {
target_type: 'proposition',
target_sha1: self.getSha1()
} );
// Append the widget element.
self.element.children('.add-tag-widget-container')
.append( addTag.element );
// Save a reference to the nested widget.
self.addTag = addTag;
},
// Inits any tags for this proposition.
_initTags: function() {
var self = this;
var tagsContainer = self.element
.children('.proposition-details')
.children('.tags-widget-container');
// Hide the container.
tagsContainer.hide();
// Create a new Tags widget targeting this proposition.
var tags = new Tags( {
target_type: self.getType(),
target_sha1: self.getSha1(),
onLoad: function( tagsWidget ) {
// Append the element and reveal the container.
tagsContainer.append( tagsWidget.element );
tagsContainer.show( 300 );
self.tagsVisible = true;
}
} );
// Save a reference to the nested widget
self.tags = tags;
},
// Binds AddTag button behavior.
_bindAddTagButton: function() {
var self = this;
var link = $('.add-tag-link', self.element).first();
link.on( 'click', function(event) {
self.toggleAddTag();
link.blur(); // Defocus.
return false; // Prevent default and stop propagation.
} );
},
// Makes this widget draggable.
_makeDraggable: function() {
var self = this;
this.element.draggable( {
helper: 'clone',
appendTo: $('.drag-container')[0] || $('body'),
revert: true,
cancel: 'input',
handle: self.element.children(".proposition-main"),
cursor: 'move',
start: function(event, ui) {
// Add drag class to body.
$('body').addClass('argumenta-drag');
// Prevent other actions on drag.
ui.helper.addClass('ui-state-just-dragged drag');
// Fix clone size.
ui.helper.css( {
'height': self.element.outerHeight() + 'px',
'width': self.element.outerWidth() + 'px'
} );
// Hide original.
self.element.css('visibility', "hidden");
},
stop: function(event, ui) {
// Remove drag class from body.
$('body').removeClass('argumenta-drag');
// Prevent other actions on drag, then cleanup.
var removeDrag = function() {
ui.helper.removeClass('ui-state-just-dragged')
}
setTimeout(removeDrag, 300);
// Reveal original.
self.element.css('visibility', "");
}
} );
},
// Renders UI, extending Base behavior.
_renderUI: function() {
var self = this;
self._super('_renderUI');
var textElem = self.element.find('.text').first();
var textHtml = textElem.html();
var newHtml = textHtml.replace(/\r?\n|\r/g, '<br>');
textElem.html( newHtml );
return;
},
// Gets view options for template, extending Base behavior.
_getViewOptions: function() {
var self = this;
var role_desc;
switch ( self.options.index ) {
case 'P': role_desc = ''; break;
case 'C': role_desc = ' (Conclusion)'; break;
default : role_desc = ' (Premise)'; break;
}
var viewOptions = {
partial_sha1: self.options.sha1.substr(0, 20),
proposition_desc: 'Proposition' + role_desc,
details_desc: 'Proposition details\r\nSHA1: ' + self.options.sha1
}
return $.extend( viewOptions, self.options );
}
}
} );
return Proposition;
} );
|
/*!
* DevExtreme (dx.messages.en.js)
* Version: 20.2.4 (build 20365-0316)
* Build date: Wed Dec 30 2020
*
* Copyright (c) 2012 - 2020 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict";
! function(root, factory) {
if ("function" === typeof define && define.amd) {
define(function(require) {
factory(require("devextreme/localization"))
})
} else {
if ("object" === typeof module && module.exports) {
factory(require("devextreme/localization"))
} else {
factory(DevExpress.localization)
}
}
}(this, function(localization) {
localization.loadMessages({
en: {
Yes: "Yes",
No: "No",
Cancel: "Cancel",
Clear: "Clear",
Done: "Done",
Loading: "Loading...",
Select: "Select...",
Search: "Search",
Back: "Back",
OK: "OK",
"dxCollectionWidget-noDataText": "No data to display",
"dxDropDownEditor-selectLabel": "Select",
"validation-required": "Required",
"validation-required-formatted": "{0} is required",
"validation-numeric": "Value must be a number",
"validation-numeric-formatted": "{0} must be a number",
"validation-range": "Value is out of range",
"validation-range-formatted": "{0} is out of range",
"validation-stringLength": "The length of the value is not correct",
"validation-stringLength-formatted": "The length of {0} is not correct",
"validation-custom": "Value is invalid",
"validation-custom-formatted": "{0} is invalid",
"validation-async": "Value is invalid",
"validation-async-formatted": "{0} is invalid",
"validation-compare": "Values do not match",
"validation-compare-formatted": "{0} does not match",
"validation-pattern": "Value does not match pattern",
"validation-pattern-formatted": "{0} does not match pattern",
"validation-email": "Email is invalid",
"validation-email-formatted": "{0} is invalid",
"validation-mask": "Value is invalid",
"dxLookup-searchPlaceholder": "Minimum character number: {0}",
"dxList-pullingDownText": "Pull down to refresh...",
"dxList-pulledDownText": "Release to refresh...",
"dxList-refreshingText": "Refreshing...",
"dxList-pageLoadingText": "Loading...",
"dxList-nextButtonText": "More",
"dxList-selectAll": "Select All",
"dxListEditDecorator-delete": "Delete",
"dxListEditDecorator-more": "More",
"dxScrollView-pullingDownText": "Pull down to refresh...",
"dxScrollView-pulledDownText": "Release to refresh...",
"dxScrollView-refreshingText": "Refreshing...",
"dxScrollView-reachBottomText": "Loading...",
"dxDateBox-simulatedDataPickerTitleTime": "Select time",
"dxDateBox-simulatedDataPickerTitleDate": "Select date",
"dxDateBox-simulatedDataPickerTitleDateTime": "Select date and time",
"dxDateBox-validation-datetime": "Value must be a date or time",
"dxFileUploader-selectFile": "Select file",
"dxFileUploader-dropFile": "or Drop file here",
"dxFileUploader-bytes": "bytes",
"dxFileUploader-kb": "kb",
"dxFileUploader-Mb": "Mb",
"dxFileUploader-Gb": "Gb",
"dxFileUploader-upload": "Upload",
"dxFileUploader-uploaded": "Uploaded",
"dxFileUploader-readyToUpload": "Ready to upload",
"dxFileUploader-uploadAbortedMessage": "Upload cancelled",
"dxFileUploader-uploadFailedMessage": "Upload failed",
"dxFileUploader-invalidFileExtension": "File type is not allowed",
"dxFileUploader-invalidMaxFileSize": "File is too large",
"dxFileUploader-invalidMinFileSize": "File is too small",
"dxRangeSlider-ariaFrom": "From",
"dxRangeSlider-ariaTill": "Till",
"dxSwitch-switchedOnText": "ON",
"dxSwitch-switchedOffText": "OFF",
"dxForm-optionalMark": "optional",
"dxForm-requiredMessage": "{0} is required",
"dxNumberBox-invalidValueMessage": "Value must be a number",
"dxNumberBox-noDataText": "No data",
"dxDataGrid-columnChooserTitle": "Column Chooser",
"dxDataGrid-columnChooserEmptyText": "Drag a column here to hide it",
"dxDataGrid-groupContinuesMessage": "Continues on the next page",
"dxDataGrid-groupContinuedMessage": "Continued from the previous page",
"dxDataGrid-groupHeaderText": "Group by This Column",
"dxDataGrid-ungroupHeaderText": "Ungroup",
"dxDataGrid-ungroupAllText": "Ungroup All",
"dxDataGrid-editingEditRow": "Edit",
"dxDataGrid-editingSaveRowChanges": "Save",
"dxDataGrid-editingCancelRowChanges": "Cancel",
"dxDataGrid-editingDeleteRow": "Delete",
"dxDataGrid-editingUndeleteRow": "Undelete",
"dxDataGrid-editingConfirmDeleteMessage": "Are you sure you want to delete this record?",
"dxDataGrid-validationCancelChanges": "Cancel changes",
"dxDataGrid-groupPanelEmptyText": "Drag a column header here to group by that column",
"dxDataGrid-noDataText": "No data",
"dxDataGrid-searchPanelPlaceholder": "Search...",
"dxDataGrid-filterRowShowAllText": "(All)",
"dxDataGrid-filterRowResetOperationText": "Reset",
"dxDataGrid-filterRowOperationEquals": "Equals",
"dxDataGrid-filterRowOperationNotEquals": "Does not equal",
"dxDataGrid-filterRowOperationLess": "Less than",
"dxDataGrid-filterRowOperationLessOrEquals": "Less than or equal to",
"dxDataGrid-filterRowOperationGreater": "Greater than",
"dxDataGrid-filterRowOperationGreaterOrEquals": "Greater than or equal to",
"dxDataGrid-filterRowOperationStartsWith": "Starts with",
"dxDataGrid-filterRowOperationContains": "Contains",
"dxDataGrid-filterRowOperationNotContains": "Does not contain",
"dxDataGrid-filterRowOperationEndsWith": "Ends with",
"dxDataGrid-filterRowOperationBetween": "Between",
"dxDataGrid-filterRowOperationBetweenStartText": "Start",
"dxDataGrid-filterRowOperationBetweenEndText": "End",
"dxDataGrid-applyFilterText": "Apply filter",
"dxDataGrid-trueText": "true",
"dxDataGrid-falseText": "false",
"dxDataGrid-sortingAscendingText": "Sort Ascending",
"dxDataGrid-sortingDescendingText": "Sort Descending",
"dxDataGrid-sortingClearText": "Clear Sorting",
"dxDataGrid-editingSaveAllChanges": "Save changes",
"dxDataGrid-editingCancelAllChanges": "Discard changes",
"dxDataGrid-editingAddRow": "Add a row",
"dxDataGrid-summaryMin": "Min: {0}",
"dxDataGrid-summaryMinOtherColumn": "Min of {1} is {0}",
"dxDataGrid-summaryMax": "Max: {0}",
"dxDataGrid-summaryMaxOtherColumn": "Max of {1} is {0}",
"dxDataGrid-summaryAvg": "Avg: {0}",
"dxDataGrid-summaryAvgOtherColumn": "Avg of {1} is {0}",
"dxDataGrid-summarySum": "Sum: {0}",
"dxDataGrid-summarySumOtherColumn": "Sum of {1} is {0}",
"dxDataGrid-summaryCount": "Count: {0}",
"dxDataGrid-columnFixingFix": "Fix",
"dxDataGrid-columnFixingUnfix": "Unfix",
"dxDataGrid-columnFixingLeftPosition": "To the left",
"dxDataGrid-columnFixingRightPosition": "To the right",
"dxDataGrid-exportTo": "Export",
"dxDataGrid-exportToExcel": "Export to Excel file",
"dxDataGrid-exporting": "Exporting...",
"dxDataGrid-excelFormat": "Excel file",
"dxDataGrid-selectedRows": "Selected rows",
"dxDataGrid-exportSelectedRows": "Export selected rows",
"dxDataGrid-exportAll": "Export all data",
"dxDataGrid-headerFilterEmptyValue": "(Blanks)",
"dxDataGrid-headerFilterOK": "OK",
"dxDataGrid-headerFilterCancel": "Cancel",
"dxDataGrid-ariaColumn": "Column",
"dxDataGrid-ariaValue": "Value",
"dxDataGrid-ariaFilterCell": "Filter cell",
"dxDataGrid-ariaCollapse": "Collapse",
"dxDataGrid-ariaExpand": "Expand",
"dxDataGrid-ariaDataGrid": "Data grid",
"dxDataGrid-ariaSearchInGrid": "Search in data grid",
"dxDataGrid-ariaSelectAll": "Select all",
"dxDataGrid-ariaSelectRow": "Select row",
"dxDataGrid-filterBuilderPopupTitle": "Filter Builder",
"dxDataGrid-filterPanelCreateFilter": "Create Filter",
"dxDataGrid-filterPanelClearFilter": "Clear",
"dxDataGrid-filterPanelFilterEnabledHint": "Enable the filter",
"dxTreeList-ariaTreeList": "Tree list",
"dxTreeList-editingAddRowToNode": "Add",
"dxPager-infoText": "Page {0} of {1} ({2} items)",
"dxPager-pagesCountText": "of",
"dxPager-pageSizesAllText": "All",
"dxPivotGrid-grandTotal": "Grand Total",
"dxPivotGrid-total": "{0} Total",
"dxPivotGrid-fieldChooserTitle": "Field Chooser",
"dxPivotGrid-showFieldChooser": "Show Field Chooser",
"dxPivotGrid-expandAll": "Expand All",
"dxPivotGrid-collapseAll": "Collapse All",
"dxPivotGrid-sortColumnBySummary": 'Sort "{0}" by This Column',
"dxPivotGrid-sortRowBySummary": 'Sort "{0}" by This Row',
"dxPivotGrid-removeAllSorting": "Remove All Sorting",
"dxPivotGrid-dataNotAvailable": "N/A",
"dxPivotGrid-rowFields": "Row Fields",
"dxPivotGrid-columnFields": "Column Fields",
"dxPivotGrid-dataFields": "Data Fields",
"dxPivotGrid-filterFields": "Filter Fields",
"dxPivotGrid-allFields": "All Fields",
"dxPivotGrid-columnFieldArea": "Drop Column Fields Here",
"dxPivotGrid-dataFieldArea": "Drop Data Fields Here",
"dxPivotGrid-rowFieldArea": "Drop Row Fields Here",
"dxPivotGrid-filterFieldArea": "Drop Filter Fields Here",
"dxScheduler-editorLabelTitle": "Subject",
"dxScheduler-editorLabelStartDate": "Start Date",
"dxScheduler-editorLabelEndDate": "End Date",
"dxScheduler-editorLabelDescription": "Description",
"dxScheduler-editorLabelRecurrence": "Repeat",
"dxScheduler-openAppointment": "Open appointment",
"dxScheduler-recurrenceNever": "Never",
"dxScheduler-recurrenceMinutely": "Every minute",
"dxScheduler-recurrenceHourly": "Hourly",
"dxScheduler-recurrenceDaily": "Daily",
"dxScheduler-recurrenceWeekly": "Weekly",
"dxScheduler-recurrenceMonthly": "Monthly",
"dxScheduler-recurrenceYearly": "Yearly",
"dxScheduler-recurrenceRepeatEvery": "Repeat Every",
"dxScheduler-recurrenceRepeatOn": "Repeat On",
"dxScheduler-recurrenceEnd": "End repeat",
"dxScheduler-recurrenceAfter": "After",
"dxScheduler-recurrenceOn": "On",
"dxScheduler-recurrenceRepeatMinutely": "minute(s)",
"dxScheduler-recurrenceRepeatHourly": "hour(s)",
"dxScheduler-recurrenceRepeatDaily": "day(s)",
"dxScheduler-recurrenceRepeatWeekly": "week(s)",
"dxScheduler-recurrenceRepeatMonthly": "month(s)",
"dxScheduler-recurrenceRepeatYearly": "year(s)",
"dxScheduler-switcherDay": "Day",
"dxScheduler-switcherWeek": "Week",
"dxScheduler-switcherWorkWeek": "Work Week",
"dxScheduler-switcherMonth": "Month",
"dxScheduler-switcherAgenda": "Agenda",
"dxScheduler-switcherTimelineDay": "Timeline Day",
"dxScheduler-switcherTimelineWeek": "Timeline Week",
"dxScheduler-switcherTimelineWorkWeek": "Timeline Work Week",
"dxScheduler-switcherTimelineMonth": "Timeline Month",
"dxScheduler-recurrenceRepeatOnDate": "on date",
"dxScheduler-recurrenceRepeatCount": "occurrence(s)",
"dxScheduler-allDay": "All day",
"dxScheduler-confirmRecurrenceEditMessage": "Do you want to edit only this appointment or the whole series?",
"dxScheduler-confirmRecurrenceDeleteMessage": "Do you want to delete only this appointment or the whole series?",
"dxScheduler-confirmRecurrenceEditSeries": "Edit series",
"dxScheduler-confirmRecurrenceDeleteSeries": "Delete series",
"dxScheduler-confirmRecurrenceEditOccurrence": "Edit appointment",
"dxScheduler-confirmRecurrenceDeleteOccurrence": "Delete appointment",
"dxScheduler-noTimezoneTitle": "No timezone",
"dxScheduler-moreAppointments": "{0} more",
"dxCalendar-todayButtonText": "Today",
"dxCalendar-ariaWidgetName": "Calendar",
"dxColorView-ariaRed": "Red",
"dxColorView-ariaGreen": "Green",
"dxColorView-ariaBlue": "Blue",
"dxColorView-ariaAlpha": "Transparency",
"dxColorView-ariaHex": "Color code",
"dxTagBox-selected": "{0} selected",
"dxTagBox-allSelected": "All selected ({0})",
"dxTagBox-moreSelected": "{0} more",
"vizExport-printingButtonText": "Print",
"vizExport-titleMenuText": "Exporting/Printing",
"vizExport-exportButtonText": "{0} file",
"dxFilterBuilder-and": "And",
"dxFilterBuilder-or": "Or",
"dxFilterBuilder-notAnd": "Not And",
"dxFilterBuilder-notOr": "Not Or",
"dxFilterBuilder-addCondition": "Add Condition",
"dxFilterBuilder-addGroup": "Add Group",
"dxFilterBuilder-enterValueText": "<enter a value>",
"dxFilterBuilder-filterOperationEquals": "Equals",
"dxFilterBuilder-filterOperationNotEquals": "Does not equal",
"dxFilterBuilder-filterOperationLess": "Is less than",
"dxFilterBuilder-filterOperationLessOrEquals": "Is less than or equal to",
"dxFilterBuilder-filterOperationGreater": "Is greater than",
"dxFilterBuilder-filterOperationGreaterOrEquals": "Is greater than or equal to",
"dxFilterBuilder-filterOperationStartsWith": "Starts with",
"dxFilterBuilder-filterOperationContains": "Contains",
"dxFilterBuilder-filterOperationNotContains": "Does not contain",
"dxFilterBuilder-filterOperationEndsWith": "Ends with",
"dxFilterBuilder-filterOperationIsBlank": "Is blank",
"dxFilterBuilder-filterOperationIsNotBlank": "Is not blank",
"dxFilterBuilder-filterOperationBetween": "Is between",
"dxFilterBuilder-filterOperationAnyOf": "Is any of",
"dxFilterBuilder-filterOperationNoneOf": "Is none of",
"dxHtmlEditor-dialogColorCaption": "Change Font Color",
"dxHtmlEditor-dialogBackgroundCaption": "Change Background Color",
"dxHtmlEditor-dialogLinkCaption": "Add Link",
"dxHtmlEditor-dialogLinkUrlField": "URL",
"dxHtmlEditor-dialogLinkTextField": "Text",
"dxHtmlEditor-dialogLinkTargetField": "Open link in new window",
"dxHtmlEditor-dialogImageCaption": "Add Image",
"dxHtmlEditor-dialogImageUrlField": "URL",
"dxHtmlEditor-dialogImageAltField": "Alternate text",
"dxHtmlEditor-dialogImageWidthField": "Width (px)",
"dxHtmlEditor-dialogImageHeightField": "Height (px)",
"dxHtmlEditor-dialogInsertTableRowsField": "Rows",
"dxHtmlEditor-dialogInsertTableColumnsField": "Columns",
"dxHtmlEditor-dialogInsertTableCaption": "Insert Table",
"dxHtmlEditor-heading": "Heading",
"dxHtmlEditor-normalText": "Normal text",
"dxFileManager-newDirectoryName": "Untitled directory",
"dxFileManager-rootDirectoryName": "Files",
"dxFileManager-errorNoAccess": "Access Denied. Operation could not be completed.",
"dxFileManager-errorDirectoryExistsFormat": "Directory '{0}' already exists.",
"dxFileManager-errorFileExistsFormat": "File '{0}' already exists.",
"dxFileManager-errorFileNotFoundFormat": "File '{0}' not found.",
"dxFileManager-errorDirectoryNotFoundFormat": "Directory '{0}' not found.",
"dxFileManager-errorWrongFileExtension": "File extension is not allowed.",
"dxFileManager-errorMaxFileSizeExceeded": "File size exceeds the maximum allowed size.",
"dxFileManager-errorInvalidSymbols": "This name contains invalid characters.",
"dxFileManager-errorDefault": "Unspecified error.",
"dxFileManager-errorDirectoryOpenFailed": "The directory cannot be opened",
"dxFileManager-commandCreate": "New directory",
"dxFileManager-commandRename": "Rename",
"dxFileManager-commandMove": "Move to",
"dxFileManager-commandCopy": "Copy to",
"dxFileManager-commandDelete": "Delete",
"dxFileManager-commandDownload": "Download",
"dxFileManager-commandUpload": "Upload files",
"dxFileManager-commandRefresh": "Refresh",
"dxFileManager-commandThumbnails": "Thumbnails View",
"dxFileManager-commandDetails": "Details View",
"dxFileManager-commandClearSelection": "Clear selection",
"dxFileManager-commandShowNavPane": "Toggle navigation pane",
"dxFileManager-dialogDirectoryChooserMoveTitle": "Move to",
"dxFileManager-dialogDirectoryChooserMoveButtonText": "Move",
"dxFileManager-dialogDirectoryChooserCopyTitle": "Copy to",
"dxFileManager-dialogDirectoryChooserCopyButtonText": "Copy",
"dxFileManager-dialogRenameItemTitle": "Rename",
"dxFileManager-dialogRenameItemButtonText": "Save",
"dxFileManager-dialogCreateDirectoryTitle": "New directory",
"dxFileManager-dialogCreateDirectoryButtonText": "Create",
"dxFileManager-dialogDeleteItemTitle": "Delete",
"dxFileManager-dialogDeleteItemButtonText": "Delete",
"dxFileManager-dialogDeleteItemSingleItemConfirmation": "Are you sure you want to delete {0}?",
"dxFileManager-dialogDeleteItemMultipleItemsConfirmation": "Are you sure you want to delete {0} items?",
"dxFileManager-dialogButtonCancel": "Cancel",
"dxFileManager-editingCreateSingleItemProcessingMessage": "Creating a directory inside {0}",
"dxFileManager-editingCreateSingleItemSuccessMessage": "Created a directory inside {0}",
"dxFileManager-editingCreateSingleItemErrorMessage": "Directory was not created",
"dxFileManager-editingCreateCommonErrorMessage": "Directory was not created",
"dxFileManager-editingRenameSingleItemProcessingMessage": "Renaming an item inside {0}",
"dxFileManager-editingRenameSingleItemSuccessMessage": "Renamed an item inside {0}",
"dxFileManager-editingRenameSingleItemErrorMessage": "Item was not renamed",
"dxFileManager-editingRenameCommonErrorMessage": "Item was not renamed",
"dxFileManager-editingDeleteSingleItemProcessingMessage": "Deleting an item from {0}",
"dxFileManager-editingDeleteMultipleItemsProcessingMessage": "Deleting {0} items from {1}",
"dxFileManager-editingDeleteSingleItemSuccessMessage": "Deleted an item from {0}",
"dxFileManager-editingDeleteMultipleItemsSuccessMessage": "Deleted {0} items from {1}",
"dxFileManager-editingDeleteSingleItemErrorMessage": "Item was not deleted",
"dxFileManager-editingDeleteMultipleItemsErrorMessage": "{0} items were not deleted",
"dxFileManager-editingDeleteCommonErrorMessage": "Some items were not deleted",
"dxFileManager-editingMoveSingleItemProcessingMessage": "Moving an item to {0}",
"dxFileManager-editingMoveMultipleItemsProcessingMessage": "Moving {0} items to {1}",
"dxFileManager-editingMoveSingleItemSuccessMessage": "Moved an item to {0}",
"dxFileManager-editingMoveMultipleItemsSuccessMessage": "Moved {0} items to {1}",
"dxFileManager-editingMoveSingleItemErrorMessage": "Item was not moved",
"dxFileManager-editingMoveMultipleItemsErrorMessage": "{0} items were not moved",
"dxFileManager-editingMoveCommonErrorMessage": "Some items were not moved",
"dxFileManager-editingCopySingleItemProcessingMessage": "Copying an item to {0}",
"dxFileManager-editingCopyMultipleItemsProcessingMessage": "Copying {0} items to {1}",
"dxFileManager-editingCopySingleItemSuccessMessage": "Copied an item to {0}",
"dxFileManager-editingCopyMultipleItemsSuccessMessage": "Copied {0} items to {1}",
"dxFileManager-editingCopySingleItemErrorMessage": "Item was not copied",
"dxFileManager-editingCopyMultipleItemsErrorMessage": "{0} items were not copied",
"dxFileManager-editingCopyCommonErrorMessage": "Some items were not copied",
"dxFileManager-editingUploadSingleItemProcessingMessage": "Uploading an item to {0}",
"dxFileManager-editingUploadMultipleItemsProcessingMessage": "Uploading {0} items to {1}",
"dxFileManager-editingUploadSingleItemSuccessMessage": "Uploaded an item to {0}",
"dxFileManager-editingUploadMultipleItemsSuccessMessage": "Uploaded {0} items to {1}",
"dxFileManager-editingUploadSingleItemErrorMessage": "Item was not uploaded",
"dxFileManager-editingUploadMultipleItemsErrorMessage": "{0} items were not uploaded",
"dxFileManager-editingUploadCanceledMessage": "Canceled",
"dxFileManager-listDetailsColumnCaptionName": "Name",
"dxFileManager-listDetailsColumnCaptionDateModified": "Date Modified",
"dxFileManager-listDetailsColumnCaptionFileSize": "File Size",
"dxFileManager-listThumbnailsTooltipTextSize": "Size",
"dxFileManager-listThumbnailsTooltipTextDateModified": "Date Modified",
"dxFileManager-notificationProgressPanelTitle": "Progress",
"dxFileManager-notificationProgressPanelEmptyListText": "No operations",
"dxFileManager-notificationProgressPanelOperationCanceled": "Canceled",
"dxDiagram-categoryGeneral": "General",
"dxDiagram-categoryFlowchart": "Flowchart",
"dxDiagram-categoryOrgChart": "Org Chart",
"dxDiagram-categoryContainers": "Containers",
"dxDiagram-categoryCustom": "Custom",
"dxDiagram-commandExportToSvg": "Export to SVG",
"dxDiagram-commandExportToPng": "Export to PNG",
"dxDiagram-commandExportToJpg": "Export to JPEG",
"dxDiagram-commandUndo": "Undo",
"dxDiagram-commandRedo": "Redo",
"dxDiagram-commandFontName": "Font Name",
"dxDiagram-commandFontSize": "Font Size",
"dxDiagram-commandBold": "Bold",
"dxDiagram-commandItalic": "Italic",
"dxDiagram-commandUnderline": "Underline",
"dxDiagram-commandTextColor": "Font Color",
"dxDiagram-commandLineColor": "Line Color",
"dxDiagram-commandLineWidth": "Line Width",
"dxDiagram-commandLineStyle": "Line Style",
"dxDiagram-commandLineStyleSolid": "Solid",
"dxDiagram-commandLineStyleDotted": "Dotted",
"dxDiagram-commandLineStyleDashed": "Dashed",
"dxDiagram-commandFillColor": "Fill Color",
"dxDiagram-commandAlignLeft": "Align Left",
"dxDiagram-commandAlignCenter": "Align Center",
"dxDiagram-commandAlignRight": "Align Right",
"dxDiagram-commandConnectorLineType": "Connector Line Type",
"dxDiagram-commandConnectorLineStraight": "Straight",
"dxDiagram-commandConnectorLineOrthogonal": "Orthogonal",
"dxDiagram-commandConnectorLineStart": "Connector Line Start",
"dxDiagram-commandConnectorLineEnd": "Connector Line End",
"dxDiagram-commandConnectorLineNone": "None",
"dxDiagram-commandConnectorLineArrow": "Arrow",
"dxDiagram-commandFullscreen": "Full Screen",
"dxDiagram-commandUnits": "Units",
"dxDiagram-commandPageSize": "Page Size",
"dxDiagram-commandPageOrientation": "Page Orientation",
"dxDiagram-commandPageOrientationLandscape": "Landscape",
"dxDiagram-commandPageOrientationPortrait": "Portrait",
"dxDiagram-commandPageColor": "Page Color",
"dxDiagram-commandShowGrid": "Show Grid",
"dxDiagram-commandSnapToGrid": "Snap to Grid",
"dxDiagram-commandGridSize": "Grid Size",
"dxDiagram-commandZoomLevel": "Zoom Level",
"dxDiagram-commandAutoZoom": "Auto Zoom",
"dxDiagram-commandFitToContent": "Fit to Content",
"dxDiagram-commandFitToWidth": "Fit to Width",
"dxDiagram-commandAutoZoomByContent": "Auto Zoom by Content",
"dxDiagram-commandAutoZoomByWidth": "Auto Zoom by Width",
"dxDiagram-commandSimpleView": "Simple View",
"dxDiagram-commandCut": "Cut",
"dxDiagram-commandCopy": "Copy",
"dxDiagram-commandPaste": "Paste",
"dxDiagram-commandSelectAll": "Select All",
"dxDiagram-commandDelete": "Delete",
"dxDiagram-commandBringToFront": "Bring to Front",
"dxDiagram-commandSendToBack": "Send to Back",
"dxDiagram-commandLock": "Lock",
"dxDiagram-commandUnlock": "Unlock",
"dxDiagram-commandInsertShapeImage": "Insert Image...",
"dxDiagram-commandEditShapeImage": "Change Image...",
"dxDiagram-commandDeleteShapeImage": "Delete Image",
"dxDiagram-commandLayoutLeftToRight": "Left-to-right",
"dxDiagram-commandLayoutRightToLeft": "Right-to-left",
"dxDiagram-commandLayoutTopToBottom": "Top-to-bottom",
"dxDiagram-commandLayoutBottomToTop": "Bottom-to-top",
"dxDiagram-unitIn": "in",
"dxDiagram-unitCm": "cm",
"dxDiagram-unitPx": "px",
"dxDiagram-dialogButtonOK": "OK",
"dxDiagram-dialogButtonCancel": "Cancel",
"dxDiagram-dialogInsertShapeImageTitle": "Insert Image",
"dxDiagram-dialogEditShapeImageTitle": "Change Image",
"dxDiagram-dialogEditShapeImageSelectButton": "Select image",
"dxDiagram-dialogEditShapeImageLabelText": "or drop file here",
"dxDiagram-uiExport": "Export",
"dxDiagram-uiProperties": "Properties",
"dxDiagram-uiSettings": "Settings",
"dxDiagram-uiShowToolbox": "Show Toolbox",
"dxDiagram-uiSearch": "Search",
"dxDiagram-uiStyle": "Style",
"dxDiagram-uiLayout": "Layout",
"dxDiagram-uiLayoutTree": "Tree",
"dxDiagram-uiLayoutLayered": "Layered",
"dxDiagram-uiDiagram": "Diagram",
"dxDiagram-uiText": "Text",
"dxDiagram-uiObject": "Object",
"dxDiagram-uiConnector": "Connector",
"dxDiagram-uiPage": "Page",
"dxDiagram-shapeText": "Text",
"dxDiagram-shapeRectangle": "Rectangle",
"dxDiagram-shapeEllipse": "Ellipse",
"dxDiagram-shapeCross": "Cross",
"dxDiagram-shapeTriangle": "Triangle",
"dxDiagram-shapeDiamond": "Diamond",
"dxDiagram-shapeHeart": "Heart",
"dxDiagram-shapePentagon": "Pentagon",
"dxDiagram-shapeHexagon": "Hexagon",
"dxDiagram-shapeOctagon": "Octagon",
"dxDiagram-shapeStar": "Star",
"dxDiagram-shapeArrowLeft": "Left Arrow",
"dxDiagram-shapeArrowUp": "Up Arrow",
"dxDiagram-shapeArrowRight": "Right Arrow",
"dxDiagram-shapeArrowDown": "Down Arrow",
"dxDiagram-shapeArrowUpDown": "Up Down Arrow",
"dxDiagram-shapeArrowLeftRight": "Left Right Arrow",
"dxDiagram-shapeProcess": "Process",
"dxDiagram-shapeDecision": "Decision",
"dxDiagram-shapeTerminator": "Terminator",
"dxDiagram-shapePredefinedProcess": "Predefined Process",
"dxDiagram-shapeDocument": "Document",
"dxDiagram-shapeMultipleDocuments": "Multiple Documents",
"dxDiagram-shapeManualInput": "Manual Input",
"dxDiagram-shapePreparation": "Preparation",
"dxDiagram-shapeData": "Data",
"dxDiagram-shapeDatabase": "Database",
"dxDiagram-shapeHardDisk": "Hard Disk",
"dxDiagram-shapeInternalStorage": "Internal Storage",
"dxDiagram-shapePaperTape": "Paper Tape",
"dxDiagram-shapeManualOperation": "Manual Operation",
"dxDiagram-shapeDelay": "Delay",
"dxDiagram-shapeStoredData": "Stored Data",
"dxDiagram-shapeDisplay": "Display",
"dxDiagram-shapeMerge": "Merge",
"dxDiagram-shapeConnector": "Connector",
"dxDiagram-shapeOr": "Or",
"dxDiagram-shapeSummingJunction": "Summing Junction",
"dxDiagram-shapeContainerDefaultText": "Container",
"dxDiagram-shapeVerticalContainer": "Vertical Container",
"dxDiagram-shapeHorizontalContainer": "Horizontal Container",
"dxDiagram-shapeCardDefaultText": "Person's Name",
"dxDiagram-shapeCardWithImageOnLeft": "Card with Image on the Left",
"dxDiagram-shapeCardWithImageOnTop": "Card with Image on the Top",
"dxDiagram-shapeCardWithImageOnRight": "Card with Image on the Right",
"dxGantt-dialogTitle": "Title",
"dxGantt-dialogStartTitle": "Start",
"dxGantt-dialogEndTitle": "End",
"dxGantt-dialogProgressTitle": "Progress",
"dxGantt-dialogResourcesTitle": "Resources",
"dxGantt-dialogResourceManagerTitle": "Resource Manager",
"dxGantt-dialogTaskDetailsTitle": "Task Details",
"dxGantt-dialogEditResourceListHint": "Edit Resource List",
"dxGantt-dialogEditNoResources": "No resources",
"dxGantt-dialogButtonAdd": "Add",
"dxGantt-contextMenuNewTask": "New Task",
"dxGantt-contextMenuNewSubtask": "New Subtask",
"dxGantt-contextMenuDeleteTask": "Delete Task",
"dxGantt-contextMenuDeleteDependency": "Delete Dependency",
"dxGantt-dialogTaskDeleteConfirmation": "Deleting a task also deletes all its dependencies and subtasks. Are you sure you want to delete this task?",
"dxGantt-dialogDependencyDeleteConfirmation": "Are you sure you want to delete the dependency from the task?",
"dxGantt-dialogResourcesDeleteConfirmation": "Deleting a resource also deletes it from tasks to which this resource is assigned. Are you sure you want to delete these resources? Resource: {0}",
"dxGantt-dialogConstraintCriticalViolationMessage": "The task you are attempting to move is linked to a second task by a dependency relation. This change would conflict with dependency rules. How would you like to proceed?",
"dxGantt-dialogConstraintViolationMessage": "The task you are attempting to move is linked to a second task by a dependency relation. How would you like to proceed?",
"dxGantt-dialogCancelOperationMessage": "Cancel the operation",
"dxGantt-dialogDeleteDependencyMessage": "Delete the dependency",
"dxGantt-dialogMoveTaskAndKeepDependencyMessage": "Move the task and keep the dependency",
"dxGantt-undo": "Undo",
"dxGantt-redo": "Redo",
"dxGantt-expandAll": "Expand All",
"dxGantt-collapseAll": "Collapse All",
"dxGantt-addNewTask": "Add New Task",
"dxGantt-deleteSelectedTask": "Delete Selected Task",
"dxGantt-zoomIn": "Zoom In",
"dxGantt-zoomOut": "Zoom Out",
"dxGantt-fullScreen": "Full Screen"
}
})
});
|
// ==================================
// flaresMemberReports.js
// Generates PDF or Excel reports of
// member data
// ==================================
|
import { combineReducers } from 'redux';
import { wealth } from '../Wealth/reducers';
import { users } from '../Home/reducers';
const reducer = combineReducers({
wealth,
users,
});
export default reducer;
/**
combineReducers({ reducer1, reducer2 }) -> function reducer(state, action) {
keys => { // keys = ['reducer1', 'reducer2']
currentReducer = reducers[key];
nextState[key] = currentReducer(state[key], action);
}
return nextState;
}
*/
|
import React from 'react';
import classNames from 'classnames';
export default class Input extends React.Component {
constructor(props) {
super(props);
this.state = {
value: this.props.value,
};
}
/**
* Public Methods
*/
getValue() {
return this.state.value;
}
/**
* Private Methods
*/
_handleInputChange(e) {
this.setState({
value: e.target.value,
});
}
render() {
const labelClass = classNames(
this.props.labelClassName,
'control-label'
);
const inputClass = classNames(
this.props.inputClassName
);
return (
<div className="form-group">
<label className={labelClass}>
{this.props.label}
</label>
<div className={inputClass}>
<input
type={this.props.type}
className="form-control"
placeholder={this.props.placeholder}
value={this.state.value}
onChange={this._handleInputChange.bind(this)} />
</div>
</div>
);
}
};
Input.propTypes = {
type: React.PropTypes.oneOf([
'text',
'password',
'textarea',
'checkbox',
]),
label: React.PropTypes.string,
labelClassName: React.PropTypes.string,
inputClassName: React.PropTypes.string,
disabled: React.PropTypes.bool,
value: React.PropTypes.any,
};
Input.defaultProps = {
type: 'text',
disabled: false,
labelClassName: 'col-sm-2',
inputClassName: 'col-sm-10',
};
|
/*! Buefy v0.8.14 | MIT License | github.com/buefy/buefy */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.Field = {}));
}(this, function (exports) { 'use strict';
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
var config = {
defaultContainerElement: null,
defaultIconPack: 'mdi',
defaultIconComponent: null,
defaultIconPrev: 'chevron-left',
defaultIconNext: 'chevron-right',
defaultDialogConfirmText: null,
defaultDialogCancelText: null,
defaultSnackbarDuration: 3500,
defaultSnackbarPosition: null,
defaultToastDuration: 2000,
defaultToastPosition: null,
defaultNotificationDuration: 2000,
defaultNotificationPosition: null,
defaultTooltipType: 'is-primary',
defaultTooltipAnimated: false,
defaultTooltipDelay: 0,
defaultInputAutocomplete: 'on',
defaultDateFormatter: null,
defaultDateParser: null,
defaultDateCreator: null,
defaultTimeCreator: null,
defaultDayNames: null,
defaultMonthNames: null,
defaultFirstDayOfWeek: null,
defaultUnselectableDaysOfWeek: null,
defaultTimeFormatter: null,
defaultTimeParser: null,
defaultModalCanCancel: ['escape', 'x', 'outside', 'button'],
defaultModalScroll: null,
defaultDatepickerMobileNative: true,
defaultTimepickerMobileNative: true,
defaultNoticeQueue: true,
defaultInputHasCounter: true,
defaultTaginputHasCounter: true,
defaultUseHtml5Validation: true,
defaultDropdownMobileModal: true,
defaultFieldLabelPosition: null,
defaultDatepickerYearsRange: [-100, 3],
defaultDatepickerNearbyMonthDays: true,
defaultDatepickerNearbySelectableMonthDays: false,
defaultDatepickerShowWeekNumber: false,
defaultDatepickerMobileModal: true,
defaultTrapFocus: false,
defaultButtonRounded: false,
defaultCarouselInterval: 3500,
defaultLinkTags: ['a', 'button', 'input', 'router-link', 'nuxt-link', 'n-link', 'RouterLink', 'NuxtLink', 'NLink'],
customIconPacks: null
}; // TODO defaultTrapFocus to true in the next breaking change
var script = {
name: 'BFieldBody',
props: {
message: {
type: String
},
type: {
type: [String, Object]
}
},
render: function render(createElement) {
var _this = this;
return createElement('div', {
attrs: {
'class': 'field-body'
}
}, this.$slots.default.map(function (element) {
// skip returns and comments
if (!element.tag) {
return element;
}
if (_this.message) {
return createElement('b-field', {
attrs: {
message: _this.message,
'type': _this.type
}
}, [element]);
}
return createElement('b-field', {
attrs: {
'type': _this.type
}
}, [element]);
}));
}
};
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier
/* server only */
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
} // Vue.extend constructor export interop.
var options = typeof script === 'function' ? script.options : script; // render functions
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true; // functional template
if (isFunctionalTemplate) {
options.functional = true;
}
} // scopedId
if (scopeId) {
options._scopeId = scopeId;
}
var hook;
if (moduleIdentifier) {
// server build
hook = function hook(context) {
// 2.3 injection
context = context || // cached call
this.$vnode && this.$vnode.ssrContext || // stateful
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
} // inject component styles
if (style) {
style.call(this, createInjectorSSR(context));
} // register component module identifier for async chunk inference
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
}; // used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook;
} else if (style) {
hook = shadowMode ? function () {
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot));
} : function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
// register for functional component in vue file
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
var normalizeComponent_1 = normalizeComponent;
/* script */
const __vue_script__ = script;
/* template */
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = undefined;
/* style inject */
/* style inject SSR */
var FieldBody = normalizeComponent_1(
{},
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
undefined,
undefined
);
var script$1 = {
name: 'BField',
components: _defineProperty({}, FieldBody.name, FieldBody),
props: {
type: [String, Object],
label: String,
labelFor: String,
message: [String, Array, Object],
grouped: Boolean,
groupMultiline: Boolean,
position: String,
expanded: Boolean,
horizontal: Boolean,
addons: {
type: Boolean,
default: true
},
customClass: String,
labelPosition: {
type: String,
default: function _default() {
return config.defaultFieldLabelPosition;
}
}
},
data: function data() {
return {
newType: this.type,
newMessage: this.message,
fieldLabelSize: null,
_isField: true // Used internally by Input and Select
};
},
computed: {
rootClasses: function rootClasses() {
return [this.newPosition, {
'is-expanded': this.expanded,
'is-grouped-multiline': this.groupMultiline,
'is-horizontal': this.horizontal,
'is-floating-in-label': this.hasLabel && !this.horizontal && this.labelPosition === 'inside',
'is-floating-label': this.hasLabel && !this.horizontal && this.labelPosition === 'on-border'
}, this.numberInputClasses];
},
/**
* Correct Bulma class for the side of the addon or group.
*
* This is not kept like the others (is-small, etc.),
* because since 'has-addons' is set automatically it
* doesn't make sense to teach users what addons are exactly.
*/
newPosition: function newPosition() {
if (this.position === undefined) return;
var position = this.position.split('-');
if (position.length < 1) return;
var prefix = this.grouped ? 'is-grouped-' : 'has-addons-';
if (this.position) return prefix + position[1];
},
/**
* Formatted message in case it's an array
* (each element is separated by <br> tag)
*/
formattedMessage: function formattedMessage() {
if (typeof this.newMessage === 'string') {
return this.newMessage;
} else {
var messages = [];
if (Array.isArray(this.newMessage)) {
this.newMessage.forEach(function (message) {
if (typeof message === 'string') {
messages.push(message);
} else {
for (var key in message) {
if (message[key]) {
messages.push(key);
}
}
}
});
} else {
for (var key in this.newMessage) {
if (this.newMessage[key]) {
messages.push(key);
}
}
}
return messages.filter(function (m) {
if (m) return m;
}).join(' <br> ');
}
},
hasLabel: function hasLabel() {
return this.label || this.$slots.label;
},
numberInputClasses: function numberInputClasses() {
if (this.$slots.default) {
var numberinput = this.$slots.default.filter(function (node) {
return node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0;
})[0];
if (numberinput) {
var classes = ['has-numberinput'];
var controlsPosition = numberinput.componentOptions.propsData.controlsPosition;
var size = numberinput.componentOptions.propsData.size;
if (controlsPosition) {
classes.push("has-numberinput-".concat(controlsPosition));
}
if (size) {
classes.push("has-numberinput-".concat(size));
}
return classes;
}
}
return null;
}
},
watch: {
/**
* Set internal type when prop change.
*/
type: function type(value) {
this.newType = value;
},
/**
* Set internal message when prop change.
*/
message: function message(value) {
this.newMessage = value;
}
},
methods: {
/**
* Field has addons if there are more than one slot
* (element / component) in the Field.
* Or is grouped when prop is set.
* Is a method to be called when component re-render.
*/
fieldType: function fieldType() {
if (this.grouped) return 'is-grouped';
var renderedNode = 0;
if (this.$slots.default) {
renderedNode = this.$slots.default.reduce(function (i, node) {
return node.tag ? i + 1 : i;
}, 0);
}
if (renderedNode > 1 && this.addons && !this.horizontal) {
return 'has-addons';
}
}
},
mounted: function mounted() {
if (this.horizontal) {
// Bulma docs: .is-normal for any .input or .button
var elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider');
if (elements.length > 0) {
this.fieldLabelSize = 'is-normal';
}
}
}
};
/* script */
const __vue_script__$1 = script$1;
/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"field",class:[_vm.rootClasses, _vm.fieldType()]},[(_vm.horizontal)?_c('div',{staticClass:"field-label",class:[_vm.customClass, _vm.fieldLabelSize]},[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()]):[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()],_vm._v(" "),(_vm.horizontal)?_c('b-field-body',{attrs:{"message":_vm.newMessage ? _vm.formattedMessage : '',"type":_vm.newType}},[_vm._t("default")],2):[_vm._t("default")],_vm._v(" "),(_vm.newMessage && !_vm.horizontal)?_c('p',{staticClass:"help",class:_vm.newType,domProps:{"innerHTML":_vm._s(_vm.formattedMessage)}}):_vm._e()],2)};
var __vue_staticRenderFns__ = [];
/* style */
const __vue_inject_styles__$1 = undefined;
/* scoped */
const __vue_scope_id__$1 = undefined;
/* module identifier */
const __vue_module_identifier__$1 = undefined;
/* functional template */
const __vue_is_functional_template__$1 = false;
/* style inject */
/* style inject SSR */
var Field = normalizeComponent_1(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__$1,
__vue_script__$1,
__vue_scope_id__$1,
__vue_is_functional_template__$1,
__vue_module_identifier__$1,
undefined,
undefined
);
var use = function use(plugin) {
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(plugin);
}
};
var registerComponent = function registerComponent(Vue, component) {
Vue.component(component.name, component);
};
var Plugin = {
install: function install(Vue) {
registerComponent(Vue, Field);
}
};
use(Plugin);
exports.BField = Field;
exports.default = Plugin;
Object.defineProperty(exports, '__esModule', { value: true });
}));
|
/* *
*
* X-range series module
*
* (c) 2010-2021 Torstein Honsi, Lars A. V. Cabrera
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
'use strict';
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import H from '../../Core/Globals.js';
import Color from '../../Core/Color/Color.js';
var color = Color.parse;
import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
var Series = SeriesRegistry.series, ColumnSeries = SeriesRegistry.seriesTypes.column;
var columnProto = ColumnSeries.prototype;
import U from '../../Core/Utilities.js';
var clamp = U.clamp, correctFloat = U.correctFloat, defined = U.defined, extend = U.extend, find = U.find, isNumber = U.isNumber, isObject = U.isObject, merge = U.merge, pick = U.pick;
import XRangePoint from './XRangePoint.js';
import './XRangeComposition.js';
/* *
* @interface Highcharts.PointOptionsObject in parts/Point.ts
*/ /**
* The ending X value of the range point.
* @name Highcharts.PointOptionsObject#x2
* @type {number|undefined}
* @requires modules/xrange
*/
/**
* @private
* @class
* @name Highcharts.seriesTypes.xrange
*
* @augments Highcharts.Series
*/
var XRangeSeries = /** @class */ (function (_super) {
__extends(XRangeSeries, _super);
function XRangeSeries() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/* *
*
* Properties
*
* */
_this.data = void 0;
_this.options = void 0;
_this.points = void 0;
return _this;
/*
// Override to remove stroke from points. For partial fill.
pointAttribs: function () {
var series = this,
retVal = columnType.prototype.pointAttribs
.apply(series, arguments);
//retVal['stroke-width'] = 0;
return retVal;
}
//*/
/* eslint-enable valid-jsdoc */
}
/* *
*
* Functions
*
* */
/* eslint-disable valid-jsdoc */
/**
* @private
* @function Highcarts.seriesTypes.xrange#init
* @return {void}
*/
XRangeSeries.prototype.init = function () {
ColumnSeries.prototype.init.apply(this, arguments);
this.options.stacking = void 0; // #13161
};
/**
* Borrow the column series metrics, but with swapped axes. This gives
* free access to features like groupPadding, grouping, pointWidth etc.
*
* @private
* @function Highcharts.Series#getColumnMetrics
*
* @return {Highcharts.ColumnMetricsObject}
*/
XRangeSeries.prototype.getColumnMetrics = function () {
var metrics, chart = this.chart;
/**
* @private
*/
function swapAxes() {
chart.series.forEach(function (s) {
var xAxis = s.xAxis;
s.xAxis = s.yAxis;
s.yAxis = xAxis;
});
}
swapAxes();
metrics = columnProto.getColumnMetrics.call(this);
swapAxes();
return metrics;
};
/**
* Override cropData to show a point where x or x2 is outside visible
* range, but one of them is inside.
*
* @private
* @function Highcharts.Series#cropData
*
* @param {Array<number>} xData
*
* @param {Array<number>} yData
*
* @param {number} min
*
* @param {number} max
*
* @param {number} [cropShoulder]
*
* @return {*}
*/
XRangeSeries.prototype.cropData = function (xData, yData, min, max) {
// Replace xData with x2Data to find the appropriate cropStart
var cropData = Series.prototype.cropData, crop = cropData.call(this, this.x2Data, yData, min, max);
// Re-insert the cropped xData
crop.xData = xData.slice(crop.start, crop.end);
return crop;
};
/**
* Finds the index of an existing point that matches the given point
* options.
*
* @private
* @function Highcharts.Series#findPointIndex
* @param {object} options The options of the point.
* @returns {number|undefined} Returns index of a matching point,
* returns undefined if no match is found.
*/
XRangeSeries.prototype.findPointIndex = function (options) {
var _a = this, cropped = _a.cropped, cropStart = _a.cropStart, points = _a.points;
var id = options.id;
var pointIndex;
if (id) {
var point = find(points, function (point) {
return point.id === id;
});
pointIndex = point ? point.index : void 0;
}
if (typeof pointIndex === 'undefined') {
var point = find(points, function (point) {
return (point.x === options.x &&
point.x2 === options.x2 &&
!point.touched);
});
pointIndex = point ? point.index : void 0;
}
// Reduce pointIndex if data is cropped
if (cropped &&
isNumber(pointIndex) &&
isNumber(cropStart) &&
pointIndex >= cropStart) {
pointIndex -= cropStart;
}
return pointIndex;
};
/**
* @private
* @function Highcharts.Series#translatePoint
*
* @param {Highcharts.Point} point
*/
XRangeSeries.prototype.translatePoint = function (point) {
var _a, _b;
var series = this, xAxis = series.xAxis, yAxis = series.yAxis, metrics = series.columnMetrics, options = series.options, minPointLength = options.minPointLength || 0, oldColWidth = ((_a = point.shapeArgs) === null || _a === void 0 ? void 0 : _a.width) / 2, seriesXOffset = series.pointXOffset = metrics.offset, plotX = point.plotX, posX = pick(point.x2, point.x + (point.len || 0)), plotX2 = xAxis.translate(posX, 0, 0, 0, 1), length = Math.abs(plotX2 - plotX), widthDifference, shapeArgs, partialFill, inverted = this.chart.inverted, borderWidth = pick(options.borderWidth, 1), crisper = borderWidth % 2 / 2, yOffset = metrics.offset, pointHeight = Math.round(metrics.width), dlLeft, dlRight, dlWidth, clipRectWidth, tooltipYOffset;
if (minPointLength) {
widthDifference = minPointLength - length;
if (widthDifference < 0) {
widthDifference = 0;
}
plotX -= widthDifference / 2;
plotX2 += widthDifference / 2;
}
plotX = Math.max(plotX, -10);
plotX2 = clamp(plotX2, -10, xAxis.len + 10);
// Handle individual pointWidth
if (defined(point.options.pointWidth)) {
yOffset -= ((Math.ceil(point.options.pointWidth) - pointHeight) / 2);
pointHeight = Math.ceil(point.options.pointWidth);
}
// Apply pointPlacement to the Y axis
if (options.pointPlacement &&
isNumber(point.plotY) &&
yAxis.categories) {
point.plotY = yAxis.translate(point.y, 0, 1, 0, 1, options.pointPlacement);
}
point.shapeArgs = {
x: Math.floor(Math.min(plotX, plotX2)) + crisper,
y: Math.floor(point.plotY + yOffset) + crisper,
width: Math.round(Math.abs(plotX2 - plotX)),
height: pointHeight,
r: series.options.borderRadius
};
// Move tooltip to default position
if (!inverted) {
point.tooltipPos[0] -= oldColWidth +
seriesXOffset -
((_b = point.shapeArgs) === null || _b === void 0 ? void 0 : _b.width) / 2;
}
else {
point.tooltipPos[1] += seriesXOffset +
oldColWidth;
}
// Align data labels inside the shape and inside the plot area
dlLeft = point.shapeArgs.x;
dlRight = dlLeft + point.shapeArgs.width;
if (dlLeft < 0 || dlRight > xAxis.len) {
dlLeft = clamp(dlLeft, 0, xAxis.len);
dlRight = clamp(dlRight, 0, xAxis.len);
dlWidth = dlRight - dlLeft;
point.dlBox = merge(point.shapeArgs, {
x: dlLeft,
width: dlRight - dlLeft,
centerX: dlWidth ? dlWidth / 2 : null
});
}
else {
point.dlBox = null;
}
// Tooltip position
var tooltipPos = point.tooltipPos;
var xIndex = !inverted ? 0 : 1;
var yIndex = !inverted ? 1 : 0;
tooltipYOffset = series.columnMetrics ?
series.columnMetrics.offset : -metrics.width / 2;
// Centering tooltip position (#14147)
if (!inverted) {
tooltipPos[xIndex] += (xAxis.reversed ? -1 : 0) * point.shapeArgs.width;
}
else {
tooltipPos[xIndex] += point.shapeArgs.width / 2;
}
tooltipPos[yIndex] = clamp(tooltipPos[yIndex] + ((inverted ? -1 : 1) * tooltipYOffset), 0, yAxis.len - 1);
// Add a partShapeArgs to the point, based on the shapeArgs property
partialFill = point.partialFill;
if (partialFill) {
// Get the partial fill amount
if (isObject(partialFill)) {
partialFill = partialFill.amount;
}
// If it was not a number, assume 0
if (!isNumber(partialFill)) {
partialFill = 0;
}
shapeArgs = point.shapeArgs;
point.partShapeArgs = {
x: shapeArgs.x,
y: shapeArgs.y,
width: shapeArgs.width,
height: shapeArgs.height,
r: series.options.borderRadius
};
clipRectWidth = Math.max(Math.round(length * partialFill + point.plotX -
plotX), 0);
point.clipRectArgs = {
x: xAxis.reversed ? // #10717
shapeArgs.x + length - clipRectWidth :
shapeArgs.x,
y: shapeArgs.y,
width: clipRectWidth,
height: shapeArgs.height
};
}
};
/**
* @private
* @function Highcharts.Series#translate
*/
XRangeSeries.prototype.translate = function () {
columnProto.translate.apply(this, arguments);
this.points.forEach(function (point) {
this.translatePoint(point);
}, this);
};
/**
* Draws a single point in the series. Needed for partial fill.
*
* This override turns point.graphic into a group containing the
* original graphic and an overlay displaying the partial fill.
*
* @private
* @function Highcharts.Series#drawPoint
*
* @param {Highcharts.Point} point
* An instance of Point in the series.
*
* @param {"animate"|"attr"} verb
* 'animate' (animates changes) or 'attr' (sets options)
*/
XRangeSeries.prototype.drawPoint = function (point, verb) {
var series = this, seriesOpts = series.options, renderer = series.chart.renderer, graphic = point.graphic, type = point.shapeType, shapeArgs = point.shapeArgs, partShapeArgs = point.partShapeArgs, clipRectArgs = point.clipRectArgs, pfOptions = point.partialFill, cutOff = seriesOpts.stacking && !seriesOpts.borderRadius, pointState = point.state, stateOpts = (seriesOpts.states[pointState || 'normal'] ||
{}), pointStateVerb = typeof pointState === 'undefined' ?
'attr' : verb, pointAttr = series.pointAttribs(point, pointState), animation = pick(series.chart.options.chart.animation, stateOpts.animation), fill;
if (!point.isNull && point.visible !== false) {
// Original graphic
if (graphic) { // update
graphic.rect[verb](shapeArgs);
}
else {
point.graphic = graphic = renderer.g('point')
.addClass(point.getClassName())
.add(point.group || series.group);
graphic.rect = renderer[type](merge(shapeArgs))
.addClass(point.getClassName())
.addClass('highcharts-partfill-original')
.add(graphic);
}
// Partial fill graphic
if (partShapeArgs) {
if (graphic.partRect) {
graphic.partRect[verb](merge(partShapeArgs));
graphic.partialClipRect[verb](merge(clipRectArgs));
}
else {
graphic.partialClipRect = renderer.clipRect(clipRectArgs.x, clipRectArgs.y, clipRectArgs.width, clipRectArgs.height);
graphic.partRect =
renderer[type](partShapeArgs)
.addClass('highcharts-partfill-overlay')
.add(graphic)
.clip(graphic.partialClipRect);
}
}
// Presentational
if (!series.chart.styledMode) {
graphic
.rect[verb](pointAttr, animation)
.shadow(seriesOpts.shadow, null, cutOff);
if (partShapeArgs) {
// Ensure pfOptions is an object
if (!isObject(pfOptions)) {
pfOptions = {};
}
if (isObject(seriesOpts.partialFill)) {
pfOptions = merge(seriesOpts.partialFill, pfOptions);
}
fill = (pfOptions.fill ||
color(pointAttr.fill).brighten(-0.3).get() ||
color(point.color || series.color)
.brighten(-0.3).get());
pointAttr.fill = fill;
graphic
.partRect[pointStateVerb](pointAttr, animation)
.shadow(seriesOpts.shadow, null, cutOff);
}
}
}
else if (graphic) {
point.graphic = graphic.destroy(); // #1269
}
};
/**
* @private
* @function Highcharts.Series#drawPoints
*/
XRangeSeries.prototype.drawPoints = function () {
var series = this, verb = series.getAnimationVerb();
// Draw the columns
series.points.forEach(function (point) {
series.drawPoint(point, verb);
});
};
/**
* Returns "animate", or "attr" if the number of points is above the
* animation limit.
*
* @private
* @function Highcharts.Series#getAnimationVerb
*
* @return {string}
*/
XRangeSeries.prototype.getAnimationVerb = function () {
return (this.chart.pointCount < (this.options.animationLimit || 250) ?
'animate' :
'attr');
};
/**
* @private
* @function Highcharts.XRangeSeries#isPointInside
*/
XRangeSeries.prototype.isPointInside = function (point) {
var shapeArgs = point.shapeArgs, plotX = point.plotX, plotY = point.plotY;
if (!shapeArgs) {
return _super.prototype.isPointInside.apply(this, arguments);
}
var isInside = typeof plotX !== 'undefined' &&
typeof plotY !== 'undefined' &&
plotY >= 0 &&
plotY <= this.yAxis.len &&
shapeArgs.x + shapeArgs.width >= 0 &&
plotX <= this.xAxis.len;
return isInside;
};
/* *
*
* Static properties
*
* */
/**
* The X-range series displays ranges on the X axis, typically time
* intervals with a start and end date.
*
* @sample {highcharts} highcharts/demo/x-range/
* X-range
* @sample {highcharts} highcharts/css/x-range/
* Styled mode X-range
* @sample {highcharts} highcharts/chart/inverted-xrange/
* Inverted X-range
*
* @extends plotOptions.column
* @since 6.0.0
* @product highcharts highstock gantt
* @excluding boostThreshold, crisp, cropThreshold, depth, edgeColor,
* edgeWidth, findNearestPointBy, getExtremesFromAll,
* negativeColor, pointInterval, pointIntervalUnit,
* pointPlacement, pointRange, pointStart, softThreshold,
* stacking, threshold, data, dataSorting, boostBlending
* @requires modules/xrange
* @optionparent plotOptions.xrange
*/
XRangeSeries.defaultOptions = merge(ColumnSeries.defaultOptions, {
/**
* A partial fill for each point, typically used to visualize how much
* of a task is performed. The partial fill object can be set either on
* series or point level.
*
* @sample {highcharts} highcharts/demo/x-range
* X-range with partial fill
*
* @product highcharts highstock gantt
* @apioption plotOptions.xrange.partialFill
*/
/**
* The fill color to be used for partial fills. Defaults to a darker
* shade of the point color.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @product highcharts highstock gantt
* @apioption plotOptions.xrange.partialFill.fill
*/
/**
* A partial fill for each point, typically used to visualize how much
* of a task is performed. See [completed](series.gantt.data.completed).
*
* @sample gantt/demo/progress-indicator
* Gantt with progress indicator
*
* @product gantt
* @apioption plotOptions.gantt.partialFill
*/
/**
* In an X-range series, this option makes all points of the same Y-axis
* category the same color.
*/
colorByPoint: true,
dataLabels: {
formatter: function () {
var point = this.point, amount = point.partialFill;
if (isObject(amount)) {
amount = amount.amount;
}
if (isNumber(amount) && amount > 0) {
return correctFloat(amount * 100) + '%';
}
},
inside: true,
verticalAlign: 'middle'
},
tooltip: {
headerFormat: '<span style="font-size: 10px">{point.x} - {point.x2}</span><br/>',
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.yCategory}</b><br/>'
},
borderRadius: 3,
pointRange: 0
});
return XRangeSeries;
}(ColumnSeries));
extend(XRangeSeries.prototype, {
type: 'xrange',
parallelArrays: ['x', 'x2', 'y'],
requireSorting: false,
animate: Series.prototype.animate,
cropShoulder: 1,
getExtremesFromAll: true,
autoIncrement: H.noop,
buildKDTree: H.noop,
pointClass: XRangePoint
});
SeriesRegistry.registerSeriesType('xrange', XRangeSeries);
/* *
*
* Default Export
*
* */
export default XRangeSeries;
/* *
*
* API Options
*
* */
/**
* An `xrange` series. If the [type](#series.xrange.type) option is not
* specified, it is inherited from [chart.type](#chart.type).
*
* @extends series,plotOptions.xrange
* @excluding boostThreshold, crisp, cropThreshold, depth, edgeColor, edgeWidth,
* findNearestPointBy, getExtremesFromAll, negativeColor,
* pointInterval, pointIntervalUnit, pointPlacement, pointRange,
* pointStart, softThreshold, stacking, threshold, dataSorting,
* boostBlending
* @product highcharts highstock gantt
* @requires modules/xrange
* @apioption series.xrange
*/
/**
* An array of data points for the series. For the `xrange` series type,
* points can be given in the following ways:
*
* 1. An array of objects with named values. The objects are point configuration
* objects as seen below.
* ```js
* data: [{
* x: Date.UTC(2017, 0, 1),
* x2: Date.UTC(2017, 0, 3),
* name: "Test",
* y: 0,
* color: "#00FF00"
* }, {
* x: Date.UTC(2017, 0, 4),
* x2: Date.UTC(2017, 0, 5),
* name: "Deploy",
* y: 1,
* color: "#FF0000"
* }]
* ```
*
* @sample {highcharts} highcharts/series/data-array-of-objects/
* Config objects
*
* @declare Highcharts.XrangePointOptionsObject
* @type {Array<*>}
* @extends series.line.data
* @product highcharts highstock gantt
* @apioption series.xrange.data
*/
/**
* The starting X value of the range point.
*
* @sample {highcharts} highcharts/demo/x-range
* X-range
*
* @type {number}
* @product highcharts highstock gantt
* @apioption series.xrange.data.x
*/
/**
* The ending X value of the range point.
*
* @sample {highcharts} highcharts/demo/x-range
* X-range
*
* @type {number}
* @product highcharts highstock gantt
* @apioption series.xrange.data.x2
*/
/**
* The Y value of the range point.
*
* @sample {highcharts} highcharts/demo/x-range
* X-range
*
* @type {number}
* @product highcharts highstock gantt
* @apioption series.xrange.data.y
*/
/**
* A partial fill for each point, typically used to visualize how much of
* a task is performed. The partial fill object can be set either on series
* or point level.
*
* @sample {highcharts} highcharts/demo/x-range
* X-range with partial fill
*
* @declare Highcharts.XrangePointPartialFillOptionsObject
* @product highcharts highstock gantt
* @apioption series.xrange.data.partialFill
*/
/**
* The amount of the X-range point to be filled. Values can be 0-1 and are
* converted to percentages in the default data label formatter.
*
* @type {number}
* @product highcharts highstock gantt
* @apioption series.xrange.data.partialFill.amount
*/
/**
* The fill color to be used for partial fills. Defaults to a darker shade
* of the point color.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @product highcharts highstock gantt
* @apioption series.xrange.data.partialFill.fill
*/
''; // adds doclets above to transpiled file
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Mootable = {}));
}(this, (function (exports) { 'use strict';
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null) break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get(target, property, receiver) {
var base = _superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(receiver);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
if (_i == null) return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function () {};
return {
s: F,
n: function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function (e) {
throw e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function () {
it = it.call(o);
},
n: function () {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function (e) {
didErr = true;
err = e;
},
f: function () {
try {
if (!normalCompletion && it.return != null) it.return();
} finally {
if (didErr) throw err;
}
}
};
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var runtime = {exports: {}};
(function (module) {
var runtime = (function (exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1;
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
}
try {
define({}, "");
} catch (err) {
define = function(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
}
exports.wrap = wrap;
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
var ContinueSentinel = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
IteratorPrototype = NativeIteratorPrototype;
}
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunction.displayName = define(
GeneratorFunctionPrototype,
toStringTagSymbol,
"GeneratorFunction"
);
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
}
genFun.prototype = Object.create(Gp);
return genFun;
};
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
}
return PromiseImpl.resolve(value).then(function(unwrapped) {
result.value = unwrapped;
resolve(result);
}, function(error) {
return invoke("throw", error, resolve, reject);
});
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
}
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList),
PromiseImpl
);
return exports.isGeneratorFunction(outerFn)
? iter
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
context.method = "throw";
context.arg = record.arg;
}
}
};
}
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
context.delegate = null;
if (context.method === "throw") {
if (delegate.iterator["return"]) {
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
context[delegate.resultName] = info.value;
context.next = delegate.nextLoc;
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
}
} else {
return info;
}
context.delegate = null;
return ContinueSentinel;
}
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator");
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
}
function Context(tryLocsList) {
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
}
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined$1, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
context.method = "next";
context.arg = undefined$1;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
this.arg = undefined$1;
}
return ContinueSentinel;
}
};
return exports;
}(
module.exports
));
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
Function("r", "regeneratorRuntime = r")(runtime);
}
}(runtime));
var fails$g = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var toString$2 = {}.toString;
var classofRaw$1 = function (it) {
return toString$2.call(it).slice(8, -1);
};
var fails$f = fails$g;
var classof$5 = classofRaw$1;
var split = ''.split;
var indexedObject = fails$f(function () {
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classof$5(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
var requireObjectCoercible$4 = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
var IndexedObject$1 = indexedObject;
var requireObjectCoercible$3 = requireObjectCoercible$4;
var toIndexedObject$7 = function (it) {
return IndexedObject$1(requireObjectCoercible$3(it));
};
var check = function (it) {
return it && it.Math == Math && it;
};
var global$j =
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
(function () { return this; })() || Function('return this')();
var shared$5 = {exports: {}};
var fails$e = fails$g;
var descriptors = !fails$e(function () {
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
var objectDefineProperty = {};
var isObject$e = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var global$i = global$j;
var isObject$d = isObject$e;
var document$1 = global$i.document;
var EXISTS = isObject$d(document$1) && isObject$d(document$1.createElement);
var documentCreateElement$1 = function (it) {
return EXISTS ? document$1.createElement(it) : {};
};
var DESCRIPTORS$9 = descriptors;
var fails$d = fails$g;
var createElement = documentCreateElement$1;
var ie8DomDefine = !DESCRIPTORS$9 && !fails$d(function () {
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
var isObject$c = isObject$e;
var anObject$8 = function (it) {
if (!isObject$c(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
var isObject$b = isObject$e;
var toPrimitive$5 = function (input, PREFERRED_STRING) {
if (!isObject$b(input)) return input;
var fn, val;
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$b(val = fn.call(input))) return val;
if (typeof (fn = input.valueOf) == 'function' && !isObject$b(val = fn.call(input))) return val;
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject$b(val = fn.call(input))) return val;
throw TypeError("Can't convert object to primitive value");
};
var DESCRIPTORS$8 = descriptors;
var IE8_DOM_DEFINE$1 = ie8DomDefine;
var anObject$7 = anObject$8;
var toPrimitive$4 = toPrimitive$5;
var $defineProperty$1 = Object.defineProperty;
objectDefineProperty.f = DESCRIPTORS$8 ? $defineProperty$1 : function defineProperty(O, P, Attributes) {
anObject$7(O);
P = toPrimitive$4(P, true);
anObject$7(Attributes);
if (IE8_DOM_DEFINE$1) try {
return $defineProperty$1(O, P, Attributes);
} catch (error) { }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var createPropertyDescriptor$5 = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var DESCRIPTORS$7 = descriptors;
var definePropertyModule$6 = objectDefineProperty;
var createPropertyDescriptor$4 = createPropertyDescriptor$5;
var createNonEnumerableProperty$9 = DESCRIPTORS$7 ? function (object, key, value) {
return definePropertyModule$6.f(object, key, createPropertyDescriptor$4(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var global$h = global$j;
var createNonEnumerableProperty$8 = createNonEnumerableProperty$9;
var setGlobal$3 = function (key, value) {
try {
createNonEnumerableProperty$8(global$h, key, value);
} catch (error) {
global$h[key] = value;
} return value;
};
var global$g = global$j;
var setGlobal$2 = setGlobal$3;
var SHARED = '__core-js_shared__';
var store$3 = global$g[SHARED] || setGlobal$2(SHARED, {});
var sharedStore = store$3;
var store$2 = sharedStore;
(shared$5.exports = function (key, value) {
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.12.1',
mode: 'global',
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});
var requireObjectCoercible$2 = requireObjectCoercible$4;
var toObject$5 = function (argument) {
return Object(requireObjectCoercible$2(argument));
};
var toObject$4 = toObject$5;
var hasOwnProperty = {}.hasOwnProperty;
var has$e = function hasOwn(it, key) {
return hasOwnProperty.call(toObject$4(it), key);
};
var id$1 = 0;
var postfix = Math.random();
var uid$4 = function (key) {
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id$1 + postfix).toString(36);
};
var global$f = global$j;
var path$2 = global$f;
var path$1 = path$2;
var global$e = global$j;
var aFunction$2 = function (variable) {
return typeof variable == 'function' ? variable : undefined;
};
var getBuiltIn$5 = function (namespace, method) {
return arguments.length < 2 ? aFunction$2(path$1[namespace]) || aFunction$2(global$e[namespace])
: path$1[namespace] && path$1[namespace][method] || global$e[namespace] && global$e[namespace][method];
};
var getBuiltIn$4 = getBuiltIn$5;
var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
var global$d = global$j;
var userAgent = engineUserAgent;
var process = global$d.process;
var versions = process && process.versions;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
version = match[0] < 4 ? 1 : match[0] + match[1];
} else if (userAgent) {
match = userAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent.match(/Chrome\/(\d+)/);
if (match) version = match[1];
}
}
var engineV8Version = version && +version;
var V8_VERSION$1 = engineV8Version;
var fails$c = fails$g;
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$c(function () {
return !String(Symbol()) ||
!Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
});
var NATIVE_SYMBOL$2 = nativeSymbol;
var useSymbolAsUid = NATIVE_SYMBOL$2
&& !Symbol.sham
&& typeof Symbol.iterator == 'symbol';
var global$c = global$j;
var shared$4 = shared$5.exports;
var has$d = has$e;
var uid$3 = uid$4;
var NATIVE_SYMBOL$1 = nativeSymbol;
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
var WellKnownSymbolsStore$1 = shared$4('wks');
var Symbol$1 = global$c.Symbol;
var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$3;
var wellKnownSymbol$f = function (name) {
if (!has$d(WellKnownSymbolsStore$1, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore$1[name] == 'string')) {
if (NATIVE_SYMBOL$1 && has$d(Symbol$1, name)) {
WellKnownSymbolsStore$1[name] = Symbol$1[name];
} else {
WellKnownSymbolsStore$1[name] = createWellKnownSymbol('Symbol.' + name);
}
} return WellKnownSymbolsStore$1[name];
};
var ceil = Math.ceil;
var floor$1 = Math.floor;
var toInteger$4 = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor$1 : ceil)(argument);
};
var toInteger$3 = toInteger$4;
var min$2 = Math.min;
var toLength$4 = function (argument) {
return argument > 0 ? min$2(toInteger$3(argument), 0x1FFFFFFFFFFFFF) : 0;
};
var toInteger$2 = toInteger$4;
var max$2 = Math.max;
var min$1 = Math.min;
var toAbsoluteIndex$3 = function (index, length) {
var integer = toInteger$2(index);
return integer < 0 ? max$2(integer + length, 0) : min$1(integer, length);
};
var toIndexedObject$6 = toIndexedObject$7;
var toLength$3 = toLength$4;
var toAbsoluteIndex$2 = toAbsoluteIndex$3;
var createMethod$3 = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject$6($this);
var length = toLength$3(O.length);
var index = toAbsoluteIndex$2(fromIndex, length);
var value;
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
if (value != value) return true;
} else for (;length > index; index++) {
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var arrayIncludes = {
includes: createMethod$3(true),
indexOf: createMethod$3(false)
};
var hiddenKeys$6 = {};
var has$c = has$e;
var toIndexedObject$5 = toIndexedObject$7;
var indexOf = arrayIncludes.indexOf;
var hiddenKeys$5 = hiddenKeys$6;
var objectKeysInternal = function (object, names) {
var O = toIndexedObject$5(object);
var i = 0;
var result = [];
var key;
for (key in O) !has$c(hiddenKeys$5, key) && has$c(O, key) && result.push(key);
while (names.length > i) if (has$c(O, key = names[i++])) {
~indexOf(result, key) || result.push(key);
}
return result;
};
var enumBugKeys$3 = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
var internalObjectKeys$1 = objectKeysInternal;
var enumBugKeys$2 = enumBugKeys$3;
var objectKeys$2 = Object.keys || function keys(O) {
return internalObjectKeys$1(O, enumBugKeys$2);
};
var DESCRIPTORS$6 = descriptors;
var definePropertyModule$5 = objectDefineProperty;
var anObject$6 = anObject$8;
var objectKeys$1 = objectKeys$2;
var objectDefineProperties = DESCRIPTORS$6 ? Object.defineProperties : function defineProperties(O, Properties) {
anObject$6(O);
var keys = objectKeys$1(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) definePropertyModule$5.f(O, key = keys[index++], Properties[key]);
return O;
};
var getBuiltIn$3 = getBuiltIn$5;
var html$1 = getBuiltIn$3('document', 'documentElement');
var shared$3 = shared$5.exports;
var uid$2 = uid$4;
var keys$2 = shared$3('keys');
var sharedKey$4 = function (key) {
return keys$2[key] || (keys$2[key] = uid$2(key));
};
var anObject$5 = anObject$8;
var defineProperties = objectDefineProperties;
var enumBugKeys$1 = enumBugKeys$3;
var hiddenKeys$4 = hiddenKeys$6;
var html = html$1;
var documentCreateElement = documentCreateElement$1;
var sharedKey$3 = sharedKey$4;
var GT = '>';
var LT = '<';
var PROTOTYPE$1 = 'prototype';
var SCRIPT = 'script';
var IE_PROTO$1 = sharedKey$3('IE_PROTO');
var EmptyConstructor = function () { };
var scriptTag = function (content) {
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};
var NullProtoObjectViaActiveX = function (activeXDocument) {
activeXDocument.write(scriptTag(''));
activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
activeXDocument = null;
return temp;
};
var NullProtoObjectViaIFrame = function () {
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};
var activeXDocument;
var NullProtoObject = function () {
try {
activeXDocument = document.domain && new ActiveXObject('htmlfile');
} catch (error) { }
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
var length = enumBugKeys$1.length;
while (length--) delete NullProtoObject[PROTOTYPE$1][enumBugKeys$1[length]];
return NullProtoObject();
};
hiddenKeys$4[IE_PROTO$1] = true;
var objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
EmptyConstructor[PROTOTYPE$1] = anObject$5(O);
result = new EmptyConstructor();
EmptyConstructor[PROTOTYPE$1] = null;
result[IE_PROTO$1] = O;
} else result = NullProtoObject();
return Properties === undefined ? result : defineProperties(result, Properties);
};
var wellKnownSymbol$e = wellKnownSymbol$f;
var create$2 = objectCreate;
var definePropertyModule$4 = objectDefineProperty;
var UNSCOPABLES = wellKnownSymbol$e('unscopables');
var ArrayPrototype = Array.prototype;
if (ArrayPrototype[UNSCOPABLES] == undefined) {
definePropertyModule$4.f(ArrayPrototype, UNSCOPABLES, {
configurable: true,
value: create$2(null)
});
}
var addToUnscopables$3 = function (key) {
ArrayPrototype[UNSCOPABLES][key] = true;
};
var store$1 = sharedStore;
var functionToString = Function.toString;
if (typeof store$1.inspectSource != 'function') {
store$1.inspectSource = function (it) {
return functionToString.call(it);
};
}
var inspectSource$2 = store$1.inspectSource;
var global$b = global$j;
var inspectSource$1 = inspectSource$2;
var WeakMap$1 = global$b.WeakMap;
var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(inspectSource$1(WeakMap$1));
var NATIVE_WEAK_MAP = nativeWeakMap;
var global$a = global$j;
var isObject$a = isObject$e;
var createNonEnumerableProperty$7 = createNonEnumerableProperty$9;
var objectHas = has$e;
var shared$2 = sharedStore;
var sharedKey$2 = sharedKey$4;
var hiddenKeys$3 = hiddenKeys$6;
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
var WeakMap = global$a.WeakMap;
var set, get, has$b;
var enforce = function (it) {
return has$b(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject$a(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (NATIVE_WEAK_MAP || shared$2.state) {
var store = shared$2.state || (shared$2.state = new WeakMap());
var wmget = store.get;
var wmhas = store.has;
var wmset = store.set;
set = function (it, metadata) {
if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
wmset.call(store, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store, it) || {};
};
has$b = function (it) {
return wmhas.call(store, it);
};
} else {
var STATE = sharedKey$2('state');
hiddenKeys$3[STATE] = true;
set = function (it, metadata) {
if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it;
createNonEnumerableProperty$7(it, STATE, metadata);
return metadata;
};
get = function (it) {
return objectHas(it, STATE) ? it[STATE] : {};
};
has$b = function (it) {
return objectHas(it, STATE);
};
}
var internalState = {
set: set,
get: get,
has: has$b,
enforce: enforce,
getterFor: getterFor
};
var objectGetOwnPropertyDescriptor = {};
var objectPropertyIsEnumerable = {};
var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor$2(this, V);
return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable$1;
var DESCRIPTORS$5 = descriptors;
var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
var createPropertyDescriptor$3 = createPropertyDescriptor$5;
var toIndexedObject$4 = toIndexedObject$7;
var toPrimitive$3 = toPrimitive$5;
var has$a = has$e;
var IE8_DOM_DEFINE = ie8DomDefine;
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject$4(O);
P = toPrimitive$3(P, true);
if (IE8_DOM_DEFINE) try {
return $getOwnPropertyDescriptor$1(O, P);
} catch (error) { }
if (has$a(O, P)) return createPropertyDescriptor$3(!propertyIsEnumerableModule$1.f.call(O, P), O[P]);
};
var redefine$7 = {exports: {}};
var global$9 = global$j;
var createNonEnumerableProperty$6 = createNonEnumerableProperty$9;
var has$9 = has$e;
var setGlobal$1 = setGlobal$3;
var inspectSource = inspectSource$2;
var InternalStateModule$3 = internalState;
var getInternalState$3 = InternalStateModule$3.get;
var enforceInternalState$1 = InternalStateModule$3.enforce;
var TEMPLATE = String(String).split('String');
(redefine$7.exports = function (O, key, value, options) {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
var state;
if (typeof value == 'function') {
if (typeof key == 'string' && !has$9(value, 'name')) {
createNonEnumerableProperty$6(value, 'name', key);
}
state = enforceInternalState$1(value);
if (!state.source) {
state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
}
}
if (O === global$9) {
if (simple) O[key] = value;
else setGlobal$1(key, value);
return;
} else if (!unsafe) {
delete O[key];
} else if (!noTargetGet && O[key]) {
simple = true;
}
if (simple) O[key] = value;
else createNonEnumerableProperty$6(O, key, value);
})(Function.prototype, 'toString', function toString() {
return typeof this == 'function' && getInternalState$3(this).source || inspectSource(this);
});
var objectGetOwnPropertyNames = {};
var internalObjectKeys = objectKeysInternal;
var enumBugKeys = enumBugKeys$3;
var hiddenKeys$2 = enumBugKeys.concat('length', 'prototype');
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return internalObjectKeys(O, hiddenKeys$2);
};
var objectGetOwnPropertySymbols = {};
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
var getBuiltIn$2 = getBuiltIn$5;
var getOwnPropertyNamesModule$1 = objectGetOwnPropertyNames;
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
var anObject$4 = anObject$8;
var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
var keys = getOwnPropertyNamesModule$1.f(anObject$4(it));
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
};
var has$8 = has$e;
var ownKeys = ownKeys$1;
var getOwnPropertyDescriptorModule$1 = objectGetOwnPropertyDescriptor;
var definePropertyModule$3 = objectDefineProperty;
var copyConstructorProperties$2 = function (target, source) {
var keys = ownKeys(source);
var defineProperty = definePropertyModule$3.f;
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule$1.f;
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (!has$8(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
}
};
var fails$b = fails$g;
var replacement = /#|\.prototype\./;
var isForced$3 = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails$b(detection)
: !!detection;
};
var normalize = isForced$3.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced$3.data = {};
var NATIVE = isForced$3.NATIVE = 'N';
var POLYFILL = isForced$3.POLYFILL = 'P';
var isForced_1 = isForced$3;
var global$8 = global$j;
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var createNonEnumerableProperty$5 = createNonEnumerableProperty$9;
var redefine$6 = redefine$7.exports;
var setGlobal = setGlobal$3;
var copyConstructorProperties$1 = copyConstructorProperties$2;
var isForced$2 = isForced_1;
var _export = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = global$8;
} else if (STATIC) {
target = global$8[TARGET] || setGlobal(TARGET, {});
} else {
target = (global$8[TARGET] || {}).prototype;
}
if (target) for (key in source) {
sourceProperty = source[key];
if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor$1(target, key);
targetProperty = descriptor && descriptor.value;
} else targetProperty = target[key];
FORCED = isForced$2(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
if (!FORCED && targetProperty !== undefined) {
if (typeof sourceProperty === typeof targetProperty) continue;
copyConstructorProperties$1(sourceProperty, targetProperty);
}
if (options.sham || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty$5(sourceProperty, 'sham', true);
}
redefine$6(target, key, sourceProperty, options);
}
};
var fails$a = fails$g;
var correctPrototypeGetter = !fails$a(function () {
function F() { }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
var has$7 = has$e;
var toObject$3 = toObject$5;
var sharedKey$1 = sharedKey$4;
var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
var IE_PROTO = sharedKey$1('IE_PROTO');
var ObjectPrototype$1 = Object.prototype;
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
O = toObject$3(O);
if (has$7(O, IE_PROTO)) return O[IE_PROTO];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectPrototype$1 : null;
};
var fails$9 = fails$g;
var getPrototypeOf$1 = objectGetPrototypeOf;
var createNonEnumerableProperty$4 = createNonEnumerableProperty$9;
var has$6 = has$e;
var wellKnownSymbol$d = wellKnownSymbol$f;
var ITERATOR$2 = wellKnownSymbol$d('iterator');
var BUGGY_SAFARI_ITERATORS$1 = false;
var returnThis$1 = function () { return this; };
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
else {
PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
}
}
var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails$9(function () {
var test = {};
return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
});
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
if (!has$6(IteratorPrototype$2, ITERATOR$2)) {
createNonEnumerableProperty$4(IteratorPrototype$2, ITERATOR$2, returnThis$1);
}
var iteratorsCore = {
IteratorPrototype: IteratorPrototype$2,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
};
var defineProperty$5 = objectDefineProperty.f;
var has$5 = has$e;
var wellKnownSymbol$c = wellKnownSymbol$f;
var TO_STRING_TAG$3 = wellKnownSymbol$c('toStringTag');
var setToStringTag$3 = function (it, TAG, STATIC) {
if (it && !has$5(it = STATIC ? it : it.prototype, TO_STRING_TAG$3)) {
defineProperty$5(it, TO_STRING_TAG$3, { configurable: true, value: TAG });
}
};
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
var create$1 = objectCreate;
var createPropertyDescriptor$2 = createPropertyDescriptor$5;
var setToStringTag$2 = setToStringTag$3;
var createIteratorConstructor$1 = function (IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor$2(1, next) });
setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
return IteratorConstructor;
};
var isObject$9 = isObject$e;
var aPossiblePrototype$1 = function (it) {
if (!isObject$9(it) && it !== null) {
throw TypeError("Can't set " + String(it) + ' as a prototype');
} return it;
};
var anObject$3 = anObject$8;
var aPossiblePrototype = aPossiblePrototype$1;
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { }
return function setPrototypeOf(O, proto) {
anObject$3(O);
aPossiblePrototype(proto);
if (CORRECT_SETTER) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
var $$d = _export;
var createIteratorConstructor = createIteratorConstructor$1;
var getPrototypeOf = objectGetPrototypeOf;
var setPrototypeOf$1 = objectSetPrototypeOf;
var setToStringTag$1 = setToStringTag$3;
var createNonEnumerableProperty$3 = createNonEnumerableProperty$9;
var redefine$5 = redefine$7.exports;
var wellKnownSymbol$b = wellKnownSymbol$f;
var IteratorsCore = iteratorsCore;
var IteratorPrototype = IteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR$1 = wellKnownSymbol$b('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis = function () { return this; };
var defineIterator$2 = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function (KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
switch (KIND) {
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
} return function () { return new IteratorConstructor(this); };
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator = IterablePrototype[ITERATOR$1]
|| IterablePrototype['@@iterator']
|| DEFAULT && IterablePrototype[DEFAULT];
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
if (anyNativeIterator) {
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
if (setPrototypeOf$1) {
setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
} else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
createNonEnumerableProperty$3(CurrentIteratorPrototype, ITERATOR$1, returnThis);
}
}
setToStringTag$1(CurrentIteratorPrototype, TO_STRING_TAG, true);
}
}
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return nativeIterator.call(this); };
}
if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
createNonEnumerableProperty$3(IterablePrototype, ITERATOR$1, defaultIterator);
}
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED) for (KEY in methods) {
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
redefine$5(IterablePrototype, KEY, methods[KEY]);
}
} else $$d({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
}
return methods;
};
var toIndexedObject$3 = toIndexedObject$7;
var addToUnscopables$2 = addToUnscopables$3;
var InternalStateModule$2 = internalState;
var defineIterator$1 = defineIterator$2;
var ARRAY_ITERATOR = 'Array Iterator';
var setInternalState$2 = InternalStateModule$2.set;
var getInternalState$2 = InternalStateModule$2.getterFor(ARRAY_ITERATOR);
var es_array_iterator = defineIterator$1(Array, 'Array', function (iterated, kind) {
setInternalState$2(this, {
type: ARRAY_ITERATOR,
target: toIndexedObject$3(iterated),
index: 0,
kind: kind
});
}, function () {
var state = getInternalState$2(this);
var target = state.target;
var kind = state.kind;
var index = state.index++;
if (!target || index >= target.length) {
state.target = undefined;
return { value: undefined, done: true };
}
if (kind == 'keys') return { value: index, done: false };
if (kind == 'values') return { value: target[index], done: false };
return { value: [index, target[index]], done: false };
}, 'values');
addToUnscopables$2('keys');
addToUnscopables$2('values');
addToUnscopables$2('entries');
var wellKnownSymbol$a = wellKnownSymbol$f;
var TO_STRING_TAG$2 = wellKnownSymbol$a('toStringTag');
var test = {};
test[TO_STRING_TAG$2] = 'z';
var toStringTagSupport = String(test) === '[object z]';
var TO_STRING_TAG_SUPPORT$2 = toStringTagSupport;
var classofRaw = classofRaw$1;
var wellKnownSymbol$9 = wellKnownSymbol$f;
var TO_STRING_TAG$1 = wellKnownSymbol$9('toStringTag');
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { }
};
var classof$4 = TO_STRING_TAG_SUPPORT$2 ? classofRaw : function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
: CORRECT_ARGUMENTS ? classofRaw(O)
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};
var TO_STRING_TAG_SUPPORT$1 = toStringTagSupport;
var classof$3 = classof$4;
var objectToString = TO_STRING_TAG_SUPPORT$1 ? {}.toString : function toString() {
return '[object ' + classof$3(this) + ']';
};
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
var redefine$4 = redefine$7.exports;
var toString$1 = objectToString;
if (!TO_STRING_TAG_SUPPORT) {
redefine$4(Object.prototype, 'toString', toString$1, { unsafe: true });
}
var domIterables = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
var global$7 = global$j;
var DOMIterables$1 = domIterables;
var ArrayIteratorMethods = es_array_iterator;
var createNonEnumerableProperty$2 = createNonEnumerableProperty$9;
var wellKnownSymbol$8 = wellKnownSymbol$f;
var ITERATOR = wellKnownSymbol$8('iterator');
var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
var ArrayValues = ArrayIteratorMethods.values;
for (var COLLECTION_NAME$1 in DOMIterables$1) {
var Collection$1 = global$7[COLLECTION_NAME$1];
var CollectionPrototype$1 = Collection$1 && Collection$1.prototype;
if (CollectionPrototype$1) {
if (CollectionPrototype$1[ITERATOR] !== ArrayValues) try {
createNonEnumerableProperty$2(CollectionPrototype$1, ITERATOR, ArrayValues);
} catch (error) {
CollectionPrototype$1[ITERATOR] = ArrayValues;
}
if (!CollectionPrototype$1[TO_STRING_TAG]) {
createNonEnumerableProperty$2(CollectionPrototype$1, TO_STRING_TAG, COLLECTION_NAME$1);
}
if (DOMIterables$1[COLLECTION_NAME$1]) for (var METHOD_NAME in ArrayIteratorMethods) {
if (CollectionPrototype$1[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
createNonEnumerableProperty$2(CollectionPrototype$1, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
} catch (error) {
CollectionPrototype$1[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
}
}
}
}
var aFunction$1 = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
var aFunction = aFunction$1;
var functionBindContext = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
var classof$2 = classofRaw$1;
var isArray$3 = Array.isArray || function isArray(arg) {
return classof$2(arg) == 'Array';
};
var isObject$8 = isObject$e;
var isArray$2 = isArray$3;
var wellKnownSymbol$7 = wellKnownSymbol$f;
var SPECIES$3 = wellKnownSymbol$7('species');
var arraySpeciesCreate$2 = function (originalArray, length) {
var C;
if (isArray$2(originalArray)) {
C = originalArray.constructor;
if (typeof C == 'function' && (C === Array || isArray$2(C.prototype))) C = undefined;
else if (isObject$8(C)) {
C = C[SPECIES$3];
if (C === null) C = undefined;
}
} return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
};
var bind = functionBindContext;
var IndexedObject = indexedObject;
var toObject$2 = toObject$5;
var toLength$2 = toLength$4;
var arraySpeciesCreate$1 = arraySpeciesCreate$2;
var push = [].push;
var createMethod$2 = function (TYPE) {
var IS_MAP = TYPE == 1;
var IS_FILTER = TYPE == 2;
var IS_SOME = TYPE == 3;
var IS_EVERY = TYPE == 4;
var IS_FIND_INDEX = TYPE == 6;
var IS_FILTER_OUT = TYPE == 7;
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function ($this, callbackfn, that, specificCreate) {
var O = toObject$2($this);
var self = IndexedObject(O);
var boundFunction = bind(callbackfn, that, 3);
var length = toLength$2(self.length);
var index = 0;
var create = specificCreate || arraySpeciesCreate$1;
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
var value, result;
for (;length > index; index++) if (NO_HOLES || index in self) {
value = self[index];
result = boundFunction(value, index, O);
if (TYPE) {
if (IS_MAP) target[index] = result;
else if (result) switch (TYPE) {
case 3: return true;
case 5: return value;
case 6: return index;
case 2: push.call(target, value);
} else switch (TYPE) {
case 4: return false;
case 7: push.call(target, value);
}
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
};
};
var arrayIteration = {
forEach: createMethod$2(0),
map: createMethod$2(1),
filter: createMethod$2(2),
some: createMethod$2(3),
every: createMethod$2(4),
find: createMethod$2(5),
findIndex: createMethod$2(6),
filterOut: createMethod$2(7)
};
var fails$8 = fails$g;
var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
var method = [][METHOD_NAME];
return !!method && fails$8(function () {
method.call(null, argument || function () { throw 1; }, 1);
});
};
var $forEach$1 = arrayIteration.forEach;
var arrayMethodIsStrict = arrayMethodIsStrict$1;
var STRICT_METHOD = arrayMethodIsStrict('forEach');
var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn ) {
return $forEach$1(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
} : [].forEach;
var global$6 = global$j;
var DOMIterables = domIterables;
var forEach = arrayForEach;
var createNonEnumerableProperty$1 = createNonEnumerableProperty$9;
for (var COLLECTION_NAME in DOMIterables) {
var Collection = global$6[COLLECTION_NAME];
var CollectionPrototype = Collection && Collection.prototype;
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
createNonEnumerableProperty$1(CollectionPrototype, 'forEach', forEach);
} catch (error) {
CollectionPrototype.forEach = forEach;
}
}
var wellKnownSymbolWrapped = {};
var wellKnownSymbol$6 = wellKnownSymbol$f;
wellKnownSymbolWrapped.f = wellKnownSymbol$6;
var path = path$2;
var has$4 = has$e;
var wrappedWellKnownSymbolModule$1 = wellKnownSymbolWrapped;
var defineProperty$4 = objectDefineProperty.f;
var defineWellKnownSymbol$2 = function (NAME) {
var Symbol = path.Symbol || (path.Symbol = {});
if (!has$4(Symbol, NAME)) defineProperty$4(Symbol, NAME, {
value: wrappedWellKnownSymbolModule$1.f(NAME)
});
};
var defineWellKnownSymbol$1 = defineWellKnownSymbol$2;
defineWellKnownSymbol$1('iterator');
var toInteger$1 = toInteger$4;
var requireObjectCoercible$1 = requireObjectCoercible$4;
var createMethod$1 = function (CONVERT_TO_STRING) {
return function ($this, pos) {
var S = String(requireObjectCoercible$1($this));
var position = toInteger$1(pos);
var size = S.length;
var first, second;
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
first = S.charCodeAt(position);
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
? CONVERT_TO_STRING ? S.charAt(position) : first
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
};
};
var stringMultibyte = {
codeAt: createMethod$1(false),
charAt: createMethod$1(true)
};
var charAt = stringMultibyte.charAt;
var InternalStateModule$1 = internalState;
var defineIterator = defineIterator$2;
var STRING_ITERATOR = 'String Iterator';
var setInternalState$1 = InternalStateModule$1.set;
var getInternalState$1 = InternalStateModule$1.getterFor(STRING_ITERATOR);
defineIterator(String, 'String', function (iterated) {
setInternalState$1(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
}, function next() {
var state = getInternalState$1(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = charAt(string, index);
state.index += point.length;
return { value: point, done: false };
});
var objectGetOwnPropertyNamesExternal = {};
var toIndexedObject$2 = toIndexedObject$7;
var $getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return $getOwnPropertyNames$1(it);
} catch (error) {
return windowNames.slice();
}
};
objectGetOwnPropertyNamesExternal.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]'
? getWindowNames(it)
: $getOwnPropertyNames$1(toIndexedObject$2(it));
};
var $$c = _export;
var global$5 = global$j;
var getBuiltIn$1 = getBuiltIn$5;
var DESCRIPTORS$4 = descriptors;
var NATIVE_SYMBOL = nativeSymbol;
var USE_SYMBOL_AS_UID = useSymbolAsUid;
var fails$7 = fails$g;
var has$3 = has$e;
var isArray$1 = isArray$3;
var isObject$7 = isObject$e;
var anObject$2 = anObject$8;
var toObject$1 = toObject$5;
var toIndexedObject$1 = toIndexedObject$7;
var toPrimitive$2 = toPrimitive$5;
var createPropertyDescriptor$1 = createPropertyDescriptor$5;
var nativeObjectCreate = objectCreate;
var objectKeys = objectKeys$2;
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
var getOwnPropertyNamesExternal = objectGetOwnPropertyNamesExternal;
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
var definePropertyModule$2 = objectDefineProperty;
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
var createNonEnumerableProperty = createNonEnumerableProperty$9;
var redefine$3 = redefine$7.exports;
var shared$1 = shared$5.exports;
var sharedKey = sharedKey$4;
var hiddenKeys$1 = hiddenKeys$6;
var uid$1 = uid$4;
var wellKnownSymbol$5 = wellKnownSymbol$f;
var wrappedWellKnownSymbolModule = wellKnownSymbolWrapped;
var defineWellKnownSymbol = defineWellKnownSymbol$2;
var setToStringTag = setToStringTag$3;
var InternalStateModule = internalState;
var $forEach = arrayIteration.forEach;
var HIDDEN = sharedKey('hidden');
var SYMBOL = 'Symbol';
var PROTOTYPE = 'prototype';
var TO_PRIMITIVE = wellKnownSymbol$5('toPrimitive');
var setInternalState = InternalStateModule.set;
var getInternalState = InternalStateModule.getterFor(SYMBOL);
var ObjectPrototype = Object[PROTOTYPE];
var $Symbol = global$5.Symbol;
var $stringify = getBuiltIn$1('JSON', 'stringify');
var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
var nativeDefineProperty = definePropertyModule$2.f;
var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
var AllSymbols = shared$1('symbols');
var ObjectPrototypeSymbols = shared$1('op-symbols');
var StringToSymbolRegistry = shared$1('string-to-symbol-registry');
var SymbolToStringRegistry = shared$1('symbol-to-string-registry');
var WellKnownSymbolsStore = shared$1('wks');
var QObject = global$5.QObject;
var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
var setSymbolDescriptor = DESCRIPTORS$4 && fails$7(function () {
return nativeObjectCreate(nativeDefineProperty({}, 'a', {
get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
})).a != 7;
}) ? function (O, P, Attributes) {
var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
nativeDefineProperty(O, P, Attributes);
if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
}
} : nativeDefineProperty;
var wrap = function (tag, description) {
var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
setInternalState(symbol, {
type: SYMBOL,
tag: tag,
description: description
});
if (!DESCRIPTORS$4) symbol.description = description;
return symbol;
};
var isSymbol = USE_SYMBOL_AS_UID ? function (it) {
return typeof it == 'symbol';
} : function (it) {
return Object(it) instanceof $Symbol;
};
var $defineProperty = function defineProperty(O, P, Attributes) {
if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
anObject$2(O);
var key = toPrimitive$2(P, true);
anObject$2(Attributes);
if (has$3(AllSymbols, key)) {
if (!Attributes.enumerable) {
if (!has$3(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor$1(1, {}));
O[HIDDEN][key] = true;
} else {
if (has$3(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor$1(0, false) });
} return setSymbolDescriptor(O, key, Attributes);
} return nativeDefineProperty(O, key, Attributes);
};
var $defineProperties = function defineProperties(O, Properties) {
anObject$2(O);
var properties = toIndexedObject$1(Properties);
var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
$forEach(keys, function (key) {
if (!DESCRIPTORS$4 || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
});
return O;
};
var $create = function create(O, Properties) {
return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
};
var $propertyIsEnumerable = function propertyIsEnumerable(V) {
var P = toPrimitive$2(V, true);
var enumerable = nativePropertyIsEnumerable.call(this, P);
if (this === ObjectPrototype && has$3(AllSymbols, P) && !has$3(ObjectPrototypeSymbols, P)) return false;
return enumerable || !has$3(this, P) || !has$3(AllSymbols, P) || has$3(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
var it = toIndexedObject$1(O);
var key = toPrimitive$2(P, true);
if (it === ObjectPrototype && has$3(AllSymbols, key) && !has$3(ObjectPrototypeSymbols, key)) return;
var descriptor = nativeGetOwnPropertyDescriptor(it, key);
if (descriptor && has$3(AllSymbols, key) && !(has$3(it, HIDDEN) && it[HIDDEN][key])) {
descriptor.enumerable = true;
}
return descriptor;
};
var $getOwnPropertyNames = function getOwnPropertyNames(O) {
var names = nativeGetOwnPropertyNames(toIndexedObject$1(O));
var result = [];
$forEach(names, function (key) {
if (!has$3(AllSymbols, key) && !has$3(hiddenKeys$1, key)) result.push(key);
});
return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject$1(O));
var result = [];
$forEach(names, function (key) {
if (has$3(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has$3(ObjectPrototype, key))) {
result.push(AllSymbols[key]);
}
});
return result;
};
if (!NATIVE_SYMBOL) {
$Symbol = function Symbol() {
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
var tag = uid$1(description);
var setter = function (value) {
if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
if (has$3(this, HIDDEN) && has$3(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
setSymbolDescriptor(this, tag, createPropertyDescriptor$1(1, value));
};
if (DESCRIPTORS$4 && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
return wrap(tag, description);
};
redefine$3($Symbol[PROTOTYPE], 'toString', function toString() {
return getInternalState(this).tag;
});
redefine$3($Symbol, 'withoutSetter', function (description) {
return wrap(uid$1(description), description);
});
propertyIsEnumerableModule.f = $propertyIsEnumerable;
definePropertyModule$2.f = $defineProperty;
getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
wrappedWellKnownSymbolModule.f = function (name) {
return wrap(wellKnownSymbol$5(name), name);
};
if (DESCRIPTORS$4) {
nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
configurable: true,
get: function description() {
return getInternalState(this).description;
}
});
{
redefine$3(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
}
}
}
$$c({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
Symbol: $Symbol
});
$forEach(objectKeys(WellKnownSymbolsStore), function (name) {
defineWellKnownSymbol(name);
});
$$c({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
'for': function (key) {
var string = String(key);
if (has$3(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
var symbol = $Symbol(string);
StringToSymbolRegistry[string] = symbol;
SymbolToStringRegistry[symbol] = string;
return symbol;
},
keyFor: function keyFor(sym) {
if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
if (has$3(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
},
useSetter: function () { USE_SETTER = true; },
useSimple: function () { USE_SETTER = false; }
});
$$c({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS$4 }, {
create: $create,
defineProperty: $defineProperty,
defineProperties: $defineProperties,
getOwnPropertyDescriptor: $getOwnPropertyDescriptor
});
$$c({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
getOwnPropertyNames: $getOwnPropertyNames,
getOwnPropertySymbols: $getOwnPropertySymbols
});
$$c({ target: 'Object', stat: true, forced: fails$7(function () { getOwnPropertySymbolsModule.f(1); }) }, {
getOwnPropertySymbols: function getOwnPropertySymbols(it) {
return getOwnPropertySymbolsModule.f(toObject$1(it));
}
});
if ($stringify) {
var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails$7(function () {
var symbol = $Symbol();
return $stringify([symbol]) != '[null]'
|| $stringify({ a: symbol }) != '{}'
|| $stringify(Object(symbol)) != '{}';
});
$$c({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
stringify: function stringify(it, replacer, space) {
var args = [it];
var index = 1;
var $replacer;
while (arguments.length > index) args.push(arguments[index++]);
$replacer = replacer;
if (!isObject$7(replacer) && it === undefined || isSymbol(it)) return;
if (!isArray$1(replacer)) replacer = function (key, value) {
if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
if (!isSymbol(value)) return value;
};
args[1] = replacer;
return $stringify.apply(null, args);
}
});
}
if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
}
setToStringTag($Symbol, SYMBOL);
hiddenKeys$1[HIDDEN] = true;
var $$b = _export;
var DESCRIPTORS$3 = descriptors;
var global$4 = global$j;
var has$2 = has$e;
var isObject$6 = isObject$e;
var defineProperty$3 = objectDefineProperty.f;
var copyConstructorProperties = copyConstructorProperties$2;
var NativeSymbol = global$4.Symbol;
if (DESCRIPTORS$3 && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
NativeSymbol().description !== undefined
)) {
var EmptyStringDescriptionStore = {};
var SymbolWrapper = function Symbol() {
var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
var result = this instanceof SymbolWrapper
? new NativeSymbol(description)
: description === undefined ? NativeSymbol() : NativeSymbol(description);
if (description === '') EmptyStringDescriptionStore[result] = true;
return result;
};
copyConstructorProperties(SymbolWrapper, NativeSymbol);
var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
symbolPrototype.constructor = SymbolWrapper;
var symbolToString = symbolPrototype.toString;
var native = String(NativeSymbol('test')) == 'Symbol(test)';
var regexp = /^Symbol\((.*)\)[^)]+$/;
defineProperty$3(symbolPrototype, 'description', {
configurable: true,
get: function description() {
var symbol = isObject$6(this) ? this.valueOf() : this;
var string = symbolToString.call(symbol);
if (has$2(EmptyStringDescriptionStore, symbol)) return '';
var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
return desc === '' ? undefined : desc;
}
});
$$b({ global: true, forced: true }, {
Symbol: SymbolWrapper
});
}
var sameValue$1 = Object.is || function is(x, y) {
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
};
var $$a = _export;
var is = sameValue$1;
$$a({ target: 'Object', stat: true }, {
is: is
});
var $$9 = _export;
$$9({ target: 'Number', stat: true }, {
isNaN: function isNaN(number) {
return number != number;
}
});
var isObject$5 = isObject$e;
var setPrototypeOf = objectSetPrototypeOf;
var inheritIfRequired$2 = function ($this, dummy, Wrapper) {
var NewTarget, NewTargetPrototype;
if (
setPrototypeOf &&
typeof (NewTarget = dummy.constructor) == 'function' &&
NewTarget !== Wrapper &&
isObject$5(NewTargetPrototype = NewTarget.prototype) &&
NewTargetPrototype !== Wrapper.prototype
) setPrototypeOf($this, NewTargetPrototype);
return $this;
};
var whitespaces$1 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
var requireObjectCoercible = requireObjectCoercible$4;
var whitespaces = whitespaces$1;
var whitespace = '[' + whitespaces + ']';
var ltrim = RegExp('^' + whitespace + whitespace + '*');
var rtrim = RegExp(whitespace + whitespace + '*$');
var createMethod = function (TYPE) {
return function ($this) {
var string = String(requireObjectCoercible($this));
if (TYPE & 1) string = string.replace(ltrim, '');
if (TYPE & 2) string = string.replace(rtrim, '');
return string;
};
};
var stringTrim = {
start: createMethod(1),
end: createMethod(2),
trim: createMethod(3)
};
var DESCRIPTORS$2 = descriptors;
var global$3 = global$j;
var isForced$1 = isForced_1;
var redefine$2 = redefine$7.exports;
var has$1 = has$e;
var classof$1 = classofRaw$1;
var inheritIfRequired$1 = inheritIfRequired$2;
var toPrimitive$1 = toPrimitive$5;
var fails$6 = fails$g;
var create = objectCreate;
var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
var defineProperty$2 = objectDefineProperty.f;
var trim = stringTrim.trim;
var NUMBER = 'Number';
var NativeNumber = global$3[NUMBER];
var NumberPrototype = NativeNumber.prototype;
var BROKEN_CLASSOF = classof$1(create(NumberPrototype)) == NUMBER;
var toNumber = function (argument) {
var it = toPrimitive$1(argument, false);
var first, third, radix, maxCode, digits, length, index, code;
if (typeof it == 'string' && it.length > 2) {
it = trim(it);
first = it.charCodeAt(0);
if (first === 43 || first === 45) {
third = it.charCodeAt(2);
if (third === 88 || third === 120) return NaN;
} else if (first === 48) {
switch (it.charCodeAt(1)) {
case 66: case 98: radix = 2; maxCode = 49; break;
case 79: case 111: radix = 8; maxCode = 55; break;
default: return +it;
}
digits = it.slice(2);
length = digits.length;
for (index = 0; index < length; index++) {
code = digits.charCodeAt(index);
if (code < 48 || code > maxCode) return NaN;
} return parseInt(digits, radix);
}
} return +it;
};
if (isForced$1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
var NumberWrapper = function Number(value) {
var it = arguments.length < 1 ? 0 : value;
var dummy = this;
return dummy instanceof NumberWrapper
&& (BROKEN_CLASSOF ? fails$6(function () { NumberPrototype.valueOf.call(dummy); }) : classof$1(dummy) != NUMBER)
? inheritIfRequired$1(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
};
for (var keys$1 = DESCRIPTORS$2 ? getOwnPropertyNames$1(NativeNumber) : (
'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
'fromString,range'
).split(','), j = 0, key; keys$1.length > j; j++) {
if (has$1(NativeNumber, key = keys$1[j]) && !has$1(NumberWrapper, key)) {
defineProperty$2(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
}
}
NumberWrapper.prototype = NumberPrototype;
NumberPrototype.constructor = NumberWrapper;
redefine$2(global$3, NUMBER, NumberWrapper);
}
function isFunction(func) {
return !!(func && func.constructor && func.call && func.apply);
}
function isIterable(iterable) {
return !!(iterable && isFunction(iterable[Symbol.iterator]));
}
function isString(str) {
return !!(str && (typeof str === 'string' || str instanceof String));
}
var sameValue = Object.is;
function sameValueZero(x, y) {
return x === y || Number.isNaN(x) && Number.isNaN(y);
}
function abstractEquals(x, y) {
return x == y;
}
function strictEquals(x, y) {
return x === y;
}
function hammingWeight(flags) {
flags -= flags >>> 1 & 0x55555555;
flags = (flags & 0x33333333) + (flags >>> 2 & 0x33333333);
return (flags + (flags >> 4) & 0xF0F0F0F) * 0x1010101 >>> 24;
}
var fails$5 = fails$g;
var wellKnownSymbol$4 = wellKnownSymbol$f;
var V8_VERSION = engineV8Version;
var SPECIES$2 = wellKnownSymbol$4('species');
var arrayMethodHasSpeciesSupport$3 = function (METHOD_NAME) {
return V8_VERSION >= 51 || !fails$5(function () {
var array = [];
var constructor = array.constructor = {};
constructor[SPECIES$2] = function () {
return { foo: 1 };
};
return array[METHOD_NAME](Boolean).foo !== 1;
});
};
var $$8 = _export;
var $map = arrayIteration.map;
var arrayMethodHasSpeciesSupport$2 = arrayMethodHasSpeciesSupport$3;
var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport$2('map');
$$8({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
map: function map(callbackfn ) {
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
var $$7 = _export;
var $find = arrayIteration.find;
var addToUnscopables$1 = addToUnscopables$3;
var FIND = 'find';
var SKIPS_HOLES$1 = true;
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; });
$$7({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
find: function find(callbackfn ) {
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
addToUnscopables$1(FIND);
var toPrimitive = toPrimitive$5;
var definePropertyModule$1 = objectDefineProperty;
var createPropertyDescriptor = createPropertyDescriptor$5;
var createProperty$2 = function (object, key, value) {
var propertyKey = toPrimitive(key);
if (propertyKey in object) definePropertyModule$1.f(object, propertyKey, createPropertyDescriptor(0, value));
else object[propertyKey] = value;
};
var $$6 = _export;
var toAbsoluteIndex$1 = toAbsoluteIndex$3;
var toInteger = toInteger$4;
var toLength$1 = toLength$4;
var toObject = toObject$5;
var arraySpeciesCreate = arraySpeciesCreate$2;
var createProperty$1 = createProperty$2;
var arrayMethodHasSpeciesSupport$1 = arrayMethodHasSpeciesSupport$3;
var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport$1('splice');
var max$1 = Math.max;
var min = Math.min;
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
$$6({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
splice: function splice(start, deleteCount ) {
var O = toObject(this);
var len = toLength$1(O.length);
var actualStart = toAbsoluteIndex$1(start, len);
var argumentsLength = arguments.length;
var insertCount, actualDeleteCount, A, k, from, to;
if (argumentsLength === 0) {
insertCount = actualDeleteCount = 0;
} else if (argumentsLength === 1) {
insertCount = 0;
actualDeleteCount = len - actualStart;
} else {
insertCount = argumentsLength - 2;
actualDeleteCount = min(max$1(toInteger(deleteCount), 0), len - actualStart);
}
if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
}
A = arraySpeciesCreate(O, actualDeleteCount);
for (k = 0; k < actualDeleteCount; k++) {
from = actualStart + k;
if (from in O) createProperty$1(A, k, O[from]);
}
A.length = actualDeleteCount;
if (insertCount < actualDeleteCount) {
for (k = actualStart; k < len - actualDeleteCount; k++) {
from = k + actualDeleteCount;
to = k + insertCount;
if (from in O) O[to] = O[from];
else delete O[to];
}
for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
} else if (insertCount > actualDeleteCount) {
for (k = len - actualDeleteCount; k > actualStart; k--) {
from = k + actualDeleteCount - 1;
to = k + insertCount - 1;
if (from in O) O[to] = O[from];
else delete O[to];
}
}
for (k = 0; k < insertCount; k++) {
O[k + actualStart] = arguments[k + 2];
}
O.length = len - actualDeleteCount + insertCount;
return A;
}
});
var $$5 = _export;
var $findIndex = arrayIteration.findIndex;
var addToUnscopables = addToUnscopables$3;
var FIND_INDEX = 'findIndex';
var SKIPS_HOLES = true;
if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
$$5({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
findIndex: function findIndex(callbackfn ) {
return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
addToUnscopables(FIND_INDEX);
var $$4 = _export;
var isObject$4 = isObject$e;
var isArray = isArray$3;
var toAbsoluteIndex = toAbsoluteIndex$3;
var toLength = toLength$4;
var toIndexedObject = toIndexedObject$7;
var createProperty = createProperty$2;
var wellKnownSymbol$3 = wellKnownSymbol$f;
var arrayMethodHasSpeciesSupport = arrayMethodHasSpeciesSupport$3;
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
var SPECIES$1 = wellKnownSymbol$3('species');
var nativeSlice = [].slice;
var max = Math.max;
$$4({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
slice: function slice(start, end) {
var O = toIndexedObject(this);
var length = toLength(O.length);
var k = toAbsoluteIndex(start, length);
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
var Constructor, result, n;
if (isArray(O)) {
Constructor = O.constructor;
if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
Constructor = undefined;
} else if (isObject$4(Constructor)) {
Constructor = Constructor[SPECIES$1];
if (Constructor === null) Constructor = undefined;
}
if (Constructor === Array || Constructor === undefined) {
return nativeSlice.call(O, k, fin);
}
}
result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
result.length = n;
return result;
}
});
var fails$4 = fails$g;
var freezing = !fails$4(function () {
return Object.isExtensible(Object.preventExtensions({}));
});
var internalMetadata = {exports: {}};
var hiddenKeys = hiddenKeys$6;
var isObject$3 = isObject$e;
var has = has$e;
var defineProperty$1 = objectDefineProperty.f;
var uid = uid$4;
var FREEZING$1 = freezing;
var METADATA = uid('meta');
var id = 0;
var isExtensible = Object.isExtensible || function () {
return true;
};
var setMetadata = function (it) {
defineProperty$1(it, METADATA, { value: {
objectID: 'O' + ++id,
weakData: {}
} });
};
var fastKey = function (it, create) {
if (!isObject$3(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, METADATA)) {
if (!isExtensible(it)) return 'F';
if (!create) return 'E';
setMetadata(it);
} return it[METADATA].objectID;
};
var getWeakData = function (it, create) {
if (!has(it, METADATA)) {
if (!isExtensible(it)) return true;
if (!create) return false;
setMetadata(it);
} return it[METADATA].weakData;
};
var onFreeze$1 = function (it) {
if (FREEZING$1 && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
return it;
};
var meta = internalMetadata.exports = {
REQUIRED: false,
fastKey: fastKey,
getWeakData: getWeakData,
onFreeze: onFreeze$1
};
hiddenKeys[METADATA] = true;
var $$3 = _export;
var FREEZING = freezing;
var fails$3 = fails$g;
var isObject$2 = isObject$e;
var onFreeze = internalMetadata.exports.onFreeze;
var $freeze = Object.freeze;
var FAILS_ON_PRIMITIVES = fails$3(function () { $freeze(1); });
$$3({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !FREEZING }, {
freeze: function freeze(it) {
return $freeze && isObject$2(it) ? $freeze(onFreeze(it)) : it;
}
});
var Option = function () {
function Option(has, value) {
_classCallCheck(this, Option);
this.has = has;
this.value = value;
Object.freeze(this);
}
_createClass(Option, [{
key: "size",
get:
function get() {
return this.has ? 1 : 0;
}
}, {
key: Symbol.iterator,
value:
regeneratorRuntime.mark(function value() {
return regeneratorRuntime.wrap(function value$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!this.has) {
_context.next = 3;
break;
}
_context.next = 3;
return this.value;
case 3:
case "end":
return _context.stop();
}
}
}, value, this);
})
}], [{
key: "none",
get: function get() {
return none;
}
}, {
key: "some",
value: function some(value) {
return _some(value);
}
}]);
return Option;
}();
var _some = function _some(value) {
return new Option(true, value);
};
var none = new Option(false, undefined);
var Container = function () {
function Container(map, parent, hash) {
_classCallCheck(this, Container);
this.size = 0;
this.contents = [];
this.map = map;
this.parent = parent;
this.hash = hash;
}
_createClass(Container, [{
key: "hashConflicts",
value: function hashConflicts(hash) {
return hash !== this.hash;
}
}, {
key: "get",
value: function get(key, options) {
if (this.size !== 0) {
var equals = options.equals;
var _iterator = _createForOfIteratorHelper(this.contents),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var entry = _step.value;
if (entry && equals(key, entry[0])) {
return entry[1];
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
return undefined;
}
}, {
key: "optionalGet",
value: function optionalGet(key, options) {
if (this.size !== 0) {
var equals = options.equals;
var entry = this.contents.find(function (entry) {
return equals(key, entry[0]);
});
if (entry) {
return _some(entry[1]);
}
}
return none;
}
}, {
key: "set",
value: function set(key, value, options) {
var equals = options.equals;
var _iterator2 = _createForOfIteratorHelper(this.contents),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var entry = _step2.value;
if (equals(key, entry[0])) {
this.updateEntry(entry, value, options);
return;
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
this.createEntry(key, value, options);
}
}, {
key: "emplace",
value: function emplace(key, handler, options) {
var equals = options.equals;
var _iterator3 = _createForOfIteratorHelper(this.contents),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var entry = _step3.value;
if (equals(key, entry[0])) {
if ('update' in handler) {
var _value = handler.update(entry[1], key, this.map);
this.updateEntry(entry, _value, options);
return _value;
}
return entry[1];
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
var value = handler.insert(key, this.map);
this.createEntry(key, value, options);
return value;
}
}, {
key: "createEntry",
value: function createEntry(key, value) {
var entry = [key, value];
entry.parent = this;
this.contents.push(entry);
this.size += 1;
return entry;
}
}, {
key: "updateEntry",
value: function updateEntry(entry, newValue) {
entry[1] = newValue;
}
}, {
key: "deleteEntry",
value: function deleteEntry(entry) {
var idx = this.contents.indexOf(entry);
if (idx !== -1) {
this.deleteIndex(idx);
var parent = this.parent;
while (parent) {
parent.size -= 1;
parent = parent.parent;
}
}
}
}, {
key: "deleteIndex",
value: function deleteIndex(idx) {
this.size -= 1;
if (idx === 0) {
return this.contents.shift();
} else if (idx === this.size) {
return this.contents.pop();
} else {
return this.contents.splice(idx, 1)[0];
}
}
}, {
key: "has",
value: function has(key, options) {
if (this.size !== 0) {
var equals = options.equals;
return this.contents.some(function (entry) {
return equals(key, entry[0]);
});
}
return false;
}
}, {
key: "delete",
value: function _delete(key, options) {
var equals = options.equals;
var idx = this.contents.findIndex(function (entry) {
return equals(key, entry[0]);
});
if (idx === -1) {
return false;
}
this.deleteIndex(idx);
return true;
}
}, {
key: Symbol.iterator,
value: regeneratorRuntime.mark(function value() {
var _iterator4, _step4, entry;
return regeneratorRuntime.wrap(function value$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_iterator4 = _createForOfIteratorHelper(this.contents);
_context.prev = 1;
_iterator4.s();
case 3:
if ((_step4 = _iterator4.n()).done) {
_context.next = 9;
break;
}
entry = _step4.value;
_context.next = 7;
return entry.slice();
case 7:
_context.next = 3;
break;
case 9:
_context.next = 14;
break;
case 11:
_context.prev = 11;
_context.t0 = _context["catch"](1);
_iterator4.e(_context.t0);
case 14:
_context.prev = 14;
_iterator4.f();
return _context.finish(14);
case 17:
case "end":
return _context.stop();
}
}
}, value, this, [[1, 11, 14, 17]]);
})
}, {
key: "entriesRight",
value: regeneratorRuntime.mark(function entriesRight() {
var idx;
return regeneratorRuntime.wrap(function entriesRight$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
idx = this.contents.length - 1;
case 1:
if (!(idx >= 0)) {
_context2.next = 7;
break;
}
_context2.next = 4;
return this.contents[idx].slice();
case 4:
idx--;
_context2.next = 1;
break;
case 7:
case "end":
return _context2.stop();
}
}
}, entriesRight, this);
})
}, {
key: "keys",
value: regeneratorRuntime.mark(function keys() {
var _iterator5, _step5, entry;
return regeneratorRuntime.wrap(function keys$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_iterator5 = _createForOfIteratorHelper(this.contents);
_context3.prev = 1;
_iterator5.s();
case 3:
if ((_step5 = _iterator5.n()).done) {
_context3.next = 9;
break;
}
entry = _step5.value;
_context3.next = 7;
return entry[0];
case 7:
_context3.next = 3;
break;
case 9:
_context3.next = 14;
break;
case 11:
_context3.prev = 11;
_context3.t0 = _context3["catch"](1);
_iterator5.e(_context3.t0);
case 14:
_context3.prev = 14;
_iterator5.f();
return _context3.finish(14);
case 17:
case "end":
return _context3.stop();
}
}
}, keys, this, [[1, 11, 14, 17]]);
})
}, {
key: "values",
value: regeneratorRuntime.mark(function values() {
var _iterator6, _step6, entry;
return regeneratorRuntime.wrap(function values$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_iterator6 = _createForOfIteratorHelper(this.contents);
_context4.prev = 1;
_iterator6.s();
case 3:
if ((_step6 = _iterator6.n()).done) {
_context4.next = 9;
break;
}
entry = _step6.value;
_context4.next = 7;
return entry[1];
case 7:
_context4.next = 3;
break;
case 9:
_context4.next = 14;
break;
case 11:
_context4.prev = 11;
_context4.t0 = _context4["catch"](1);
_iterator6.e(_context4.t0);
case 14:
_context4.prev = 14;
_iterator6.f();
return _context4.finish(14);
case 17:
case "end":
return _context4.stop();
}
}
}, values, this, [[1, 11, 14, 17]]);
})
}, {
key: "keysRight",
value: regeneratorRuntime.mark(function keysRight() {
var idx;
return regeneratorRuntime.wrap(function keysRight$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
idx = this.contents.length - 1;
case 1:
if (!(idx >= 0)) {
_context5.next = 7;
break;
}
_context5.next = 4;
return this.contents[idx][0];
case 4:
idx--;
_context5.next = 1;
break;
case 7:
case "end":
return _context5.stop();
}
}
}, keysRight, this);
})
}, {
key: "valuesRight",
value: regeneratorRuntime.mark(function valuesRight() {
var idx;
return regeneratorRuntime.wrap(function valuesRight$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
idx = this.contents.length - 1;
case 1:
if (!(idx >= 0)) {
_context6.next = 7;
break;
}
_context6.next = 4;
return this.contents[idx][1];
case 4:
idx--;
_context6.next = 1;
break;
case 7:
case "end":
return _context6.stop();
}
}
}, valuesRight, this);
})
}]);
return Container;
}();
var SHIFT = 7;
var WIDTH = 1 << SHIFT;
var MASK = WIDTH - 1;
var DEPTH = 5;
var SHIFT_HAMT = 5;
var WIDTH_HAMT = 1 << SHIFT_HAMT;
var MASK_HAMT = WIDTH_HAMT - 1;
var DEPTH_HAMT = DEPTH - 1;
var HashBuckets = function () {
function HashBuckets(map) {
_classCallCheck(this, HashBuckets);
this.map = map;
this.buckets = [];
this.size = 0;
}
_createClass(HashBuckets, [{
key: "clear",
value: function clear() {
this.buckets = [];
this.size = 0;
}
}, {
key: "bucketFor",
value: function bucketFor(hash) {
var idx = hash & MASK;
if (idx < this.buckets.length) {
return this.buckets[idx];
}
return undefined;
}
}, {
key: "set",
value: function set(key, value, options) {
var hash = options.hash;
var idx = hash & MASK;
var bucket = this.buckets[idx];
if (!bucket) {
bucket = this.map.createContainer(this, hash);
bucket.createEntry(key, value, options);
this.buckets[idx] = bucket;
this.size += 1;
return;
} else if (bucket.hashConflicts(hash)) {
bucket = new HamtBuckets(this.map, this, DEPTH_HAMT, SHIFT).replacing(bucket);
this.buckets[idx] = bucket;
}
this.size -= bucket.size;
bucket.set(key, value, options);
this.size += bucket.size;
}
}, {
key: "emplace",
value: function emplace(key, handler, options) {
var hash = options.hash;
var idx = hash & MASK;
var bucket = this.buckets[idx];
if (!bucket) {
bucket = this.map.createContainer(this, hash);
this.buckets[idx] = bucket;
} else if (bucket.hashConflicts(hash)) {
bucket = new HamtBuckets(this.map, this, DEPTH_HAMT, SHIFT).replacing(bucket);
this.buckets[idx] = bucket;
}
this.size -= bucket.size;
var value = bucket.emplace(key, handler, options);
this.size += bucket.size;
return value;
}
}, {
key: "delete",
value: function _delete(key, options) {
var hash = options.hash;
var idx = hash & MASK;
var bucket = this.buckets[idx];
if (bucket) {
var deleted = bucket.delete(key, options);
if (deleted) {
this.size -= 1;
return true;
}
}
return false;
}
}, {
key: "get",
value: function get(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.get(key, options);
}
return undefined;
}
}, {
key: "optionalGet",
value: function optionalGet(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.optionalGet(key, options);
}
return none;
}
}, {
key: "has",
value: function has(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.has(key, options);
}
return false;
}
}, {
key: Symbol.iterator,
value: regeneratorRuntime.mark(function value() {
var _iterator, _step, bucket;
return regeneratorRuntime.wrap(function value$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_iterator = _createForOfIteratorHelper(this.buckets);
_context.prev = 1;
_iterator.s();
case 3:
if ((_step = _iterator.n()).done) {
_context.next = 9;
break;
}
bucket = _step.value;
if (!bucket) {
_context.next = 7;
break;
}
return _context.delegateYield(bucket, "t0", 7);
case 7:
_context.next = 3;
break;
case 9:
_context.next = 14;
break;
case 11:
_context.prev = 11;
_context.t1 = _context["catch"](1);
_iterator.e(_context.t1);
case 14:
_context.prev = 14;
_iterator.f();
return _context.finish(14);
case 17:
case "end":
return _context.stop();
}
}
}, value, this, [[1, 11, 14, 17]]);
})
}, {
key: "entriesRight",
value: regeneratorRuntime.mark(function entriesRight() {
var idx, bucket;
return regeneratorRuntime.wrap(function entriesRight$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context2.next = 8;
break;
}
bucket = this.buckets[idx];
if (!bucket) {
_context2.next = 5;
break;
}
return _context2.delegateYield(bucket.entriesRight(), "t0", 5);
case 5:
idx--;
_context2.next = 1;
break;
case 8:
case "end":
return _context2.stop();
}
}
}, entriesRight, this);
})
}, {
key: "keys",
value: regeneratorRuntime.mark(function keys() {
var _iterator2, _step2, bucket;
return regeneratorRuntime.wrap(function keys$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_iterator2 = _createForOfIteratorHelper(this.buckets);
_context3.prev = 1;
_iterator2.s();
case 3:
if ((_step2 = _iterator2.n()).done) {
_context3.next = 9;
break;
}
bucket = _step2.value;
if (!bucket) {
_context3.next = 7;
break;
}
return _context3.delegateYield(bucket.keys(), "t0", 7);
case 7:
_context3.next = 3;
break;
case 9:
_context3.next = 14;
break;
case 11:
_context3.prev = 11;
_context3.t1 = _context3["catch"](1);
_iterator2.e(_context3.t1);
case 14:
_context3.prev = 14;
_iterator2.f();
return _context3.finish(14);
case 17:
case "end":
return _context3.stop();
}
}
}, keys, this, [[1, 11, 14, 17]]);
})
}, {
key: "values",
value: regeneratorRuntime.mark(function values() {
var _iterator3, _step3, bucket;
return regeneratorRuntime.wrap(function values$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_iterator3 = _createForOfIteratorHelper(this.buckets);
_context4.prev = 1;
_iterator3.s();
case 3:
if ((_step3 = _iterator3.n()).done) {
_context4.next = 9;
break;
}
bucket = _step3.value;
if (!bucket) {
_context4.next = 7;
break;
}
return _context4.delegateYield(bucket.values(), "t0", 7);
case 7:
_context4.next = 3;
break;
case 9:
_context4.next = 14;
break;
case 11:
_context4.prev = 11;
_context4.t1 = _context4["catch"](1);
_iterator3.e(_context4.t1);
case 14:
_context4.prev = 14;
_iterator3.f();
return _context4.finish(14);
case 17:
case "end":
return _context4.stop();
}
}
}, values, this, [[1, 11, 14, 17]]);
})
}, {
key: "keysRight",
value: regeneratorRuntime.mark(function keysRight() {
var idx, bucket;
return regeneratorRuntime.wrap(function keysRight$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context5.next = 8;
break;
}
bucket = this.buckets[idx];
if (!bucket) {
_context5.next = 5;
break;
}
return _context5.delegateYield(bucket.keysRight(), "t0", 5);
case 5:
idx--;
_context5.next = 1;
break;
case 8:
case "end":
return _context5.stop();
}
}
}, keysRight, this);
})
}, {
key: "valuesRight",
value: regeneratorRuntime.mark(function valuesRight() {
var idx, bucket;
return regeneratorRuntime.wrap(function valuesRight$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context6.next = 8;
break;
}
bucket = this.buckets[idx];
if (!bucket) {
_context6.next = 5;
break;
}
return _context6.delegateYield(bucket.valuesRight(), "t0", 5);
case 5:
idx--;
_context6.next = 1;
break;
case 8:
case "end":
return _context6.stop();
}
}
}, valuesRight, this);
})
}]);
return HashBuckets;
}();
var HamtBuckets = function () {
function HamtBuckets(map, parent, depth, shift) {
_classCallCheck(this, HamtBuckets);
this.map = map;
this.parent = parent;
this.buckets = [];
this.size = 0;
this.idxFlags = 0;
this.depth = depth;
this.shift = shift;
}
_createClass(HamtBuckets, [{
key: "hashConflicts",
value: function hashConflicts() {
return false;
}
}, {
key: "clear",
value: function clear() {
this.size = 0;
this.buckets = [];
this.idxFlags = 0;
}
}, {
key: "bucketFor",
value: function bucketFor(hash) {
var idxFlags = this.idxFlags;
var hashIdx = hash >>> this.shift & MASK_HAMT;
var flag = 1 << hashIdx;
var idx = hammingWeight(idxFlags & flag - 1);
if (idxFlags & flag) {
return this.buckets[idx];
}
return undefined;
}
}, {
key: "replacing",
value: function replacing(oldBucket) {
var new_flag = 1 << (oldBucket.hash >>> this.shift & MASK_HAMT);
this.idxFlags |= new_flag;
this.buckets[0] = oldBucket;
this.size = oldBucket.size;
oldBucket.parent = this;
return this;
}
}, {
key: "set",
value: function set(key, value, options) {
var hash = options.hash;
var idxFlags = this.idxFlags;
var hashIdx = hash >>> this.shift & MASK_HAMT;
var flag = 1 << hashIdx;
var idx = hammingWeight(idxFlags & flag - 1);
var bucket;
if (idxFlags & flag) {
bucket = this.buckets[idx];
if (this.depth && bucket.hashConflicts(hash)) {
bucket = new HamtBuckets(this.map, this, this.depth - 1, this.shift + SHIFT_HAMT).replacing(bucket);
this.buckets[idx] = bucket;
}
this.size -= bucket.size;
bucket.set(key, value, options);
this.size += bucket.size;
} else {
bucket = this.map.createContainer(this, hash);
bucket.createEntry(key, value, options);
this.buckets.splice(idx, 0, bucket);
this.idxFlags |= flag;
this.size += 1;
}
}
}, {
key: "emplace",
value: function emplace(key, handler, options) {
var hash = options.hash;
var idxFlags = this.idxFlags;
var hashIdx = hash >>> this.shift & MASK_HAMT;
var flag = 1 << hashIdx;
var idx = hammingWeight(idxFlags & flag - 1);
var bucket;
if (idxFlags & flag) {
bucket = this.buckets[idx];
if (this.depth && bucket.hashConflicts(hash)) {
bucket = new HamtBuckets(this.map, this, this.depth - 1, this.shift + SHIFT_HAMT).replacing(bucket);
this.buckets[idx] = bucket;
}
} else {
bucket = this.map.createContainer(this, hash);
this.buckets.splice(idx, 0, bucket);
this.idxFlags |= flag;
}
this.size -= bucket.size;
var value = bucket.emplace(key, handler, options);
this.size += bucket.size;
return value;
}
}, {
key: "delete",
value: function _delete(key, options) {
var hash = options.hash;
var idxFlags = this.idxFlags;
var hashIdx = hash >>> this.shift & MASK_HAMT;
var flag = 1 << hashIdx;
if (idxFlags & flag) {
var idx = hammingWeight(idxFlags & flag - 1);
var bucket = this.buckets[idx];
var deleted = bucket.delete(key, options);
if (deleted) {
this.size -= 1;
if (bucket.size === 0) {
if (idx === 0) {
this.buckets.shift();
} else if (this.buckets.length === idx + 1) {
this.buckets.pop();
} else {
this.buckets.splice(idx, 1);
}
this.idxFlags ^= flag;
}
return true;
}
}
return false;
}
}, {
key: "get",
value: function get(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.get(key, options);
}
return undefined;
}
}, {
key: "optionalGet",
value: function optionalGet(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.optionalGet(key, options);
}
return none;
}
}, {
key: "has",
value: function has(key, options) {
var hash = options.hash;
var bucket = this.bucketFor(hash);
if (bucket) {
return bucket.has(key, options);
}
return false;
}
}, {
key: Symbol.iterator,
value: regeneratorRuntime.mark(function value() {
var _iterator4, _step4, bucket;
return regeneratorRuntime.wrap(function value$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_iterator4 = _createForOfIteratorHelper(this.buckets);
_context7.prev = 1;
_iterator4.s();
case 3:
if ((_step4 = _iterator4.n()).done) {
_context7.next = 8;
break;
}
bucket = _step4.value;
return _context7.delegateYield(bucket, "t0", 6);
case 6:
_context7.next = 3;
break;
case 8:
_context7.next = 13;
break;
case 10:
_context7.prev = 10;
_context7.t1 = _context7["catch"](1);
_iterator4.e(_context7.t1);
case 13:
_context7.prev = 13;
_iterator4.f();
return _context7.finish(13);
case 16:
case "end":
return _context7.stop();
}
}
}, value, this, [[1, 10, 13, 16]]);
})
}, {
key: "entriesRight",
value: regeneratorRuntime.mark(function entriesRight() {
var idx;
return regeneratorRuntime.wrap(function entriesRight$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context8.next = 6;
break;
}
return _context8.delegateYield(this.buckets[idx].entriesRight(), "t0", 3);
case 3:
idx--;
_context8.next = 1;
break;
case 6:
case "end":
return _context8.stop();
}
}
}, entriesRight, this);
})
}, {
key: "keys",
value: regeneratorRuntime.mark(function keys() {
var _iterator5, _step5, bucket;
return regeneratorRuntime.wrap(function keys$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
_iterator5 = _createForOfIteratorHelper(this.buckets);
_context9.prev = 1;
_iterator5.s();
case 3:
if ((_step5 = _iterator5.n()).done) {
_context9.next = 8;
break;
}
bucket = _step5.value;
return _context9.delegateYield(bucket.keys(), "t0", 6);
case 6:
_context9.next = 3;
break;
case 8:
_context9.next = 13;
break;
case 10:
_context9.prev = 10;
_context9.t1 = _context9["catch"](1);
_iterator5.e(_context9.t1);
case 13:
_context9.prev = 13;
_iterator5.f();
return _context9.finish(13);
case 16:
case "end":
return _context9.stop();
}
}
}, keys, this, [[1, 10, 13, 16]]);
})
}, {
key: "values",
value: regeneratorRuntime.mark(function values() {
var _iterator6, _step6, bucket;
return regeneratorRuntime.wrap(function values$(_context10) {
while (1) {
switch (_context10.prev = _context10.next) {
case 0:
_iterator6 = _createForOfIteratorHelper(this.buckets);
_context10.prev = 1;
_iterator6.s();
case 3:
if ((_step6 = _iterator6.n()).done) {
_context10.next = 8;
break;
}
bucket = _step6.value;
return _context10.delegateYield(bucket.values(), "t0", 6);
case 6:
_context10.next = 3;
break;
case 8:
_context10.next = 13;
break;
case 10:
_context10.prev = 10;
_context10.t1 = _context10["catch"](1);
_iterator6.e(_context10.t1);
case 13:
_context10.prev = 13;
_iterator6.f();
return _context10.finish(13);
case 16:
case "end":
return _context10.stop();
}
}
}, values, this, [[1, 10, 13, 16]]);
})
}, {
key: "keysRight",
value: regeneratorRuntime.mark(function keysRight() {
var idx;
return regeneratorRuntime.wrap(function keysRight$(_context11) {
while (1) {
switch (_context11.prev = _context11.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context11.next = 6;
break;
}
return _context11.delegateYield(this.buckets[idx].keysRight(), "t0", 3);
case 3:
idx--;
_context11.next = 1;
break;
case 6:
case "end":
return _context11.stop();
}
}
}, keysRight, this);
})
}, {
key: "valuesRight",
value: regeneratorRuntime.mark(function valuesRight() {
var idx;
return regeneratorRuntime.wrap(function valuesRight$(_context12) {
while (1) {
switch (_context12.prev = _context12.next) {
case 0:
idx = this.buckets.length - 1;
case 1:
if (!(idx >= 0)) {
_context12.next = 6;
break;
}
return _context12.delegateYield(this.buckets[idx].valuesRight(), "t0", 3);
case 3:
idx--;
_context12.next = 1;
break;
case 6:
case "end":
return _context12.stop();
}
}
}, valuesRight, this);
})
}]);
return HamtBuckets;
}();
var global$2 = global$j;
var globalIsFinite = global$2.isFinite;
var numberIsFinite$1 = Number.isFinite || function isFinite(it) {
return typeof it == 'number' && globalIsFinite(it);
};
var $$2 = _export;
var numberIsFinite = numberIsFinite$1;
$$2({ target: 'Number', stat: true }, { isFinite: numberIsFinite });
var isObject$1 = isObject$e;
var floor = Math.floor;
var isInteger$1 = function isInteger(it) {
return !isObject$1(it) && isFinite(it) && floor(it) === it;
};
var $$1 = _export;
var isInteger = isInteger$1;
var abs = Math.abs;
$$1({ target: 'Number', stat: true }, {
isSafeInteger: function isSafeInteger(number) {
return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF;
}
});
var anObject$1 = anObject$8;
var regexpFlags$1 = function () {
var that = anObject$1(this);
var result = '';
if (that.global) result += 'g';
if (that.ignoreCase) result += 'i';
if (that.multiline) result += 'm';
if (that.dotAll) result += 's';
if (that.unicode) result += 'u';
if (that.sticky) result += 'y';
return result;
};
var redefine$1 = redefine$7.exports;
var anObject = anObject$8;
var fails$2 = fails$g;
var flags = regexpFlags$1;
var TO_STRING = 'toString';
var RegExpPrototype$1 = RegExp.prototype;
var nativeToString = RegExpPrototype$1[TO_STRING];
var NOT_GENERIC = fails$2(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
var INCORRECT_NAME = nativeToString.name != TO_STRING;
if (NOT_GENERIC || INCORRECT_NAME) {
redefine$1(RegExp.prototype, TO_STRING, function toString() {
var R = anObject(this);
var p = String(R.source);
var rf = R.flags;
var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype$1) ? flags.call(R) : rf);
return '/' + p + '/' + f;
}, { unsafe: true });
}
var isObject = isObject$e;
var classof = classofRaw$1;
var wellKnownSymbol$2 = wellKnownSymbol$f;
var MATCH$1 = wellKnownSymbol$2('match');
var isRegexp = function (it) {
var isRegExp;
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
};
var regexpStickyHelpers = {};
var fails$1 = fails$g;
function RE(s, f) {
return RegExp(s, f);
}
regexpStickyHelpers.UNSUPPORTED_Y = fails$1(function () {
var re = RE('a', 'y');
re.lastIndex = 2;
return re.exec('abcd') != null;
});
regexpStickyHelpers.BROKEN_CARET = fails$1(function () {
var re = RE('^r', 'gy');
re.lastIndex = 2;
return re.exec('str') != null;
});
var getBuiltIn = getBuiltIn$5;
var definePropertyModule = objectDefineProperty;
var wellKnownSymbol$1 = wellKnownSymbol$f;
var DESCRIPTORS$1 = descriptors;
var SPECIES = wellKnownSymbol$1('species');
var setSpecies$1 = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
var defineProperty = definePropertyModule.f;
if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES]) {
defineProperty(Constructor, SPECIES, {
configurable: true,
get: function () { return this; }
});
}
};
var DESCRIPTORS = descriptors;
var global$1 = global$j;
var isForced = isForced_1;
var inheritIfRequired = inheritIfRequired$2;
var defineProperty = objectDefineProperty.f;
var getOwnPropertyNames = objectGetOwnPropertyNames.f;
var isRegExp = isRegexp;
var getFlags = regexpFlags$1;
var stickyHelpers$1 = regexpStickyHelpers;
var redefine = redefine$7.exports;
var fails = fails$g;
var enforceInternalState = internalState.enforce;
var setSpecies = setSpecies$1;
var wellKnownSymbol = wellKnownSymbol$f;
var MATCH = wellKnownSymbol('match');
var NativeRegExp = global$1.RegExp;
var RegExpPrototype = NativeRegExp.prototype;
var re1 = /a/g;
var re2 = /a/g;
var CORRECT_NEW = new NativeRegExp(re1) !== re1;
var UNSUPPORTED_Y$1 = stickyHelpers$1.UNSUPPORTED_Y;
var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y$1 || fails(function () {
re2[MATCH] = false;
return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
})));
if (FORCED) {
var RegExpWrapper = function RegExp(pattern, flags) {
var thisIsRegExp = this instanceof RegExpWrapper;
var patternIsRegExp = isRegExp(pattern);
var flagsAreUndefined = flags === undefined;
var sticky;
if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
return pattern;
}
if (CORRECT_NEW) {
if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
} else if (pattern instanceof RegExpWrapper) {
if (flagsAreUndefined) flags = getFlags.call(pattern);
pattern = pattern.source;
}
if (UNSUPPORTED_Y$1) {
sticky = !!flags && flags.indexOf('y') > -1;
if (sticky) flags = flags.replace(/y/g, '');
}
var result = inheritIfRequired(
CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
thisIsRegExp ? this : RegExpPrototype,
RegExpWrapper
);
if (UNSUPPORTED_Y$1 && sticky) {
var state = enforceInternalState(result);
state.sticky = true;
}
return result;
};
var proxy = function (key) {
key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
configurable: true,
get: function () { return NativeRegExp[key]; },
set: function (it) { NativeRegExp[key] = it; }
});
};
var keys = getOwnPropertyNames(NativeRegExp);
var index = 0;
while (keys.length > index) proxy(keys[index++]);
RegExpPrototype.constructor = RegExpWrapper;
RegExpWrapper.prototype = RegExpPrototype;
redefine(global$1, 'RegExp', RegExpWrapper);
}
setSpecies('RegExp');
var regexpFlags = regexpFlags$1;
var stickyHelpers = regexpStickyHelpers;
var shared = shared$5.exports;
var nativeExec = RegExp.prototype.exec;
var nativeReplace = shared('native-string-replace', String.prototype.replace);
var patchedExec = nativeExec;
var UPDATES_LAST_INDEX_WRONG = (function () {
var re1 = /a/;
var re2 = /b*/g;
nativeExec.call(re1, 'a');
nativeExec.call(re2, 'a');
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
})();
var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
if (PATCH) {
patchedExec = function exec(str) {
var re = this;
var lastIndex, reCopy, match, i;
var sticky = UNSUPPORTED_Y && re.sticky;
var flags = regexpFlags.call(re);
var source = re.source;
var charsAdded = 0;
var strCopy = str;
if (sticky) {
flags = flags.replace('y', '');
if (flags.indexOf('g') === -1) {
flags += 'g';
}
strCopy = String(str).slice(re.lastIndex);
if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
source = '(?: ' + source + ')';
strCopy = ' ' + strCopy;
charsAdded++;
}
reCopy = new RegExp('^(?:' + source + ')', flags);
}
if (NPCG_INCLUDED) {
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
}
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
match = nativeExec.call(sticky ? reCopy : re, strCopy);
if (sticky) {
if (match) {
match.input = match.input.slice(charsAdded);
match[0] = match[0].slice(charsAdded);
match.index = re.lastIndex;
re.lastIndex += match[0].length;
} else re.lastIndex = 0;
} else if (UPDATES_LAST_INDEX_WRONG && match) {
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
}
if (NPCG_INCLUDED && match && match.length > 1) {
nativeReplace.call(match[0], reCopy, function () {
for (i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undefined) match[i] = undefined;
}
});
}
return match;
};
}
var regexpExec = patchedExec;
var $ = _export;
var exec = regexpExec;
$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
exec: exec
});
function hash(key) {
var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var seed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
len = len > 0 ? Math.min(len, key.length) : key.length;
seed |= 0;
var remaining = len & 1;
var doubleBytes = len - remaining;
var hash = seed,
k = 0,
i = 0;
while (i < doubleBytes) {
k = key.charCodeAt(i++) & 0xffff | (key.charCodeAt(i++) & 0xffff) << 16;
k *= 0xcc9e2d51;
k = k << 15 | k >>> 17;
k *= 0x1b873593;
hash ^= k;
hash = hash << 13 | hash >>> 19;
hash *= 5;
hash += 0xe6546b64;
}
if (remaining) {
k ^= key.charCodeAt(i) & 0xffff;
k *= 0xcc9e2d51;
k = k << 15 | k >>> 17;
k *= 0x1b873593;
hash ^= k;
}
hash ^= len;
hash ^= hash >>> 16;
hash *= 0x85ebca6b;
hash ^= hash >>> 13;
hash *= 0xc2b2ae35;
hash ^= hash >>> 16;
return hash | 0;
}
function hashCodeFor(key) {
var keyType = _typeof(key);
switch (keyType) {
case 'undefined':
return 0;
case 'boolean':
return key ? 1 : 0;
case 'string':
return hash(key);
case 'number':
if (!Number.isFinite(key)) {
return 0;
}
if (Number.isSafeInteger(key)) {
return key | 0;
}
return hash(key.toString());
case 'bigint':
case 'symbol':
case 'function':
return hash(key.toString());
case 'object':
default:
{
if (key === null) {
return 0;
}
if (key.hashCode) {
if (isFunction(key.hashCode)) {
return hashCodeFor(key.hashCode(key));
}
return hashCodeFor(key.hashCode);
}
if (key instanceof Date) {
return key.getTime();
}
if (key instanceof RegExp) {
return hash(key.toString());
}
if (key instanceof Option) {
if (key.has) {
return 31 * hashCodeFor(key.value);
}
return 0;
}
if (Object.prototype.hasOwnProperty.call(key, '_mootable_hashCode')) {
return hashCodeFor(key._mootable_hashCode);
}
var hashCode = HASH_COUNTER++;
Object.defineProperty(key, '_mootable_hashCode', {
value: hashCode
});
return hashCode;
}
}
}
var HASH_COUNTER = 0;
function equalsFor(key) {
switch (_typeof(key)) {
case 'object':
if (key) {
if (key instanceof RegExp) {
return function (me, them) {
if (them instanceof RegExp) {
return me.toString() === them.toString();
}
return false;
};
} else if (key instanceof Date) {
return function (me, them) {
if (them instanceof Date) {
return me.getTime() === them.getTime();
}
return false;
};
} else if (key instanceof Option) {
if (key.has) {
var valueEquals = equalsFor(key.value);
return function (me, them) {
if (them.has) {
return valueEquals(me.value, them.value);
}
return false;
};
} else {
return function (me, them) {
return !them.has;
};
}
} else if (isFunction(key.equals)) {
return function (me, them) {
return me.equals(them, me);
};
}
}
return strictEquals;
case 'number':
case 'bigint':
return sameValueZero;
default:
return strictEquals;
}
}
function equalsAndHash(key, options) {
if (options) {
var _hash = options.hash;
var equals = options.equals;
if (isFunction(_hash)) {
_hash = _hash(key);
}
if (!Number.isSafeInteger(_hash)) {
_hash = hashCodeFor(key);
}
if (!isFunction(equals)) {
equals = equalsFor(key);
}
return {
hash: _hash,
equals: equals
};
}
var toSetOn = {};
var keyType = _typeof(key);
switch (keyType) {
case 'undefined':
toSetOn.hash = 0;
toSetOn.equals = strictEquals;
return toSetOn;
case 'boolean':
toSetOn.hash = key ? 1 : 0;
toSetOn.equals = strictEquals;
return toSetOn;
case 'string':
toSetOn.hash = hash(key);
toSetOn.equals = strictEquals;
return toSetOn;
case 'number':
if (!Number.isFinite(key)) {
toSetOn.hash = 0;
toSetOn.equals = sameValueZero;
return toSetOn;
}
if (Number.isSafeInteger(key)) {
toSetOn.hash = key | 0;
toSetOn.equals = sameValueZero;
return toSetOn;
}
toSetOn.hash = hash(key.toString());
toSetOn.equals = sameValueZero;
return toSetOn;
case 'bigint':
toSetOn.hash = hash(key.toString());
toSetOn.equals = sameValueZero;
return toSetOn;
case 'symbol':
case 'function':
toSetOn.hash = hash(key.toString());
toSetOn.equals = strictEquals;
return toSetOn;
case 'object':
default:
{
if (key === null) {
toSetOn.hash = 0;
toSetOn.equals = strictEquals;
return toSetOn;
}
toSetOn.equals = equalsFor(key);
if (key.hashCode) {
if (isFunction(key.hashCode)) {
toSetOn.hash = hashCodeFor(key.hashCode(key));
return toSetOn;
} else {
toSetOn.hash = hashCodeFor(key.hashCode);
return toSetOn;
}
}
if (key instanceof Date) {
toSetOn.hash = key.getTime();
return toSetOn;
}
if (key instanceof RegExp) {
toSetOn.hash = hash(key.toString());
return toSetOn;
}
if (key instanceof Option) {
if (key.has) {
toSetOn.hash = 31 * hashCodeFor(key.value);
return toSetOn;
}
toSetOn.hash = 0;
return toSetOn;
}
if (Object.prototype.hasOwnProperty.call(key, '_mootable_hashCode')) {
toSetOn.hash = hashCodeFor(key._mootable_hashCode);
return toSetOn;
}
var hashCode = HASH_COUNTER++;
Object.defineProperty(key, '_mootable_hashCode', {
value: hashCode
});
toSetOn.hash = hashCode;
return toSetOn;
}
}
}
var HashMap = function () {
function HashMap(copy) {
_classCallCheck(this, HashMap);
this.buckets = new HashBuckets(this);
if (copy) {
this.copy(copy);
}
}
_createClass(HashMap, [{
key: "size",
get: function get() {
return this.buckets.size;
}
}, {
key: "length",
get: function get() {
return this.buckets.size;
}
}, {
key: "has",
value: function has(key, overrides) {
var op = this.equalsAndHash(key, overrides);
return this.buckets.has(key, op);
}
}, {
key: "get",
value: function get(key, overrides) {
var op = this.equalsAndHash(key, overrides);
return this.buckets.get(key, op);
}
}, {
key: "keyOf",
value: function keyOf(value, overrides) {
var equals = overrides && isFunction(overrides.equals) ? overrides.equals : this.equalsFor(value);
var _iterator = _createForOfIteratorHelper(this.entries()),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var entry = _step.value;
if (equals(value, entry[1])) {
return entry[0];
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return undefined;
}
}, {
key: "lastKeyOf",
value: function lastKeyOf(value, overrides) {
var equals = overrides && isFunction(overrides.equals) ? overrides.equals : this.equalsFor(value);
var _iterator2 = _createForOfIteratorHelper(this.entriesRight()),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var entry = _step2.value;
if (equals(value, entry[1])) {
return entry[0];
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
return undefined;
}
}, {
key: "optionalKeyOf",
value: function optionalKeyOf(value, overrides) {
var equals = overrides && isFunction(overrides.equals) ? overrides.equals : this.equalsFor(value);
var _iterator3 = _createForOfIteratorHelper(this.entries()),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var entry = _step3.value;
if (equals(value, entry[1])) {
return _some(entry[0]);
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return none;
}
}, {
key: "optionalLastKeyOf",
value: function optionalLastKeyOf(value, overrides) {
var equals = overrides && isFunction(overrides.equals) ? overrides.equals : this.equalsFor(value);
var _iterator4 = _createForOfIteratorHelper(this.entriesRight()),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var entry = _step4.value;
if (equals(value, entry[1])) {
return _some(entry[0]);
}
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
return none;
}
}, {
key: "optionalGet",
value: function optionalGet(key, overrides) {
var op = this.equalsAndHash(key, overrides);
return this.buckets.optionalGet(key, op);
}
}, {
key: "find",
value: function find() {
var findPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator5 = _createForOfIteratorHelper(this.entries()),
_step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
var _step5$value = _slicedToArray(_step5.value, 2),
key = _step5$value[0],
value = _step5$value[1];
if (findPredicate.call(thisArg, value, key, this)) {
return value;
}
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
return undefined;
}
}, {
key: "findLast",
value: function findLast() {
var findPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator6 = _createForOfIteratorHelper(this.entriesRight()),
_step6;
try {
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
var _step6$value = _slicedToArray(_step6.value, 2),
key = _step6$value[0],
value = _step6$value[1];
if (findPredicate.call(thisArg, value, key, this)) {
return value;
}
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
}
return undefined;
}
}, {
key: "optionalFind",
value: function optionalFind() {
var findPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator7 = _createForOfIteratorHelper(this.entries()),
_step7;
try {
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
var _step7$value = _slicedToArray(_step7.value, 2),
key = _step7$value[0],
value = _step7$value[1];
if (findPredicate.call(thisArg, value, key, this)) {
return _some(value);
}
}
} catch (err) {
_iterator7.e(err);
} finally {
_iterator7.f();
}
return none;
}
}, {
key: "optionalFindLast",
value: function optionalFindLast() {
var findPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator8 = _createForOfIteratorHelper(this.entriesRight()),
_step8;
try {
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
var _step8$value = _slicedToArray(_step8.value, 2),
key = _step8$value[0],
value = _step8$value[1];
if (findPredicate.call(thisArg, value, key, this)) {
return _some(value);
}
}
} catch (err) {
_iterator8.e(err);
} finally {
_iterator8.f();
}
return none;
}
}, {
key: "findKey",
value: function findKey() {
var findKeyPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (value, key) {
return key;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator9 = _createForOfIteratorHelper(this.entries()),
_step9;
try {
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
var _step9$value = _slicedToArray(_step9.value, 2),
key = _step9$value[0],
value = _step9$value[1];
if (findKeyPredicate.call(thisArg, value, key, this)) {
return key;
}
}
} catch (err) {
_iterator9.e(err);
} finally {
_iterator9.f();
}
return undefined;
}
}, {
key: "findLastKey",
value: function findLastKey() {
var findKeyPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (value, key) {
return key;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator10 = _createForOfIteratorHelper(this.entriesRight()),
_step10;
try {
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
var _step10$value = _slicedToArray(_step10.value, 2),
key = _step10$value[0],
value = _step10$value[1];
if (findKeyPredicate.call(thisArg, value, key, this)) {
return key;
}
}
} catch (err) {
_iterator10.e(err);
} finally {
_iterator10.f();
}
return undefined;
}
}, {
key: "optionalFindKey",
value: function optionalFindKey() {
var findKeyPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (value, key) {
return key;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator11 = _createForOfIteratorHelper(this.entries()),
_step11;
try {
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
var _step11$value = _slicedToArray(_step11.value, 2),
key = _step11$value[0],
value = _step11$value[1];
if (findKeyPredicate.call(thisArg, value, key, this)) {
return _some(key);
}
}
} catch (err) {
_iterator11.e(err);
} finally {
_iterator11.f();
}
return none;
}
}, {
key: "optionalFindLastKey",
value: function optionalFindLastKey() {
var findKeyPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (value, key) {
return key;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var _iterator12 = _createForOfIteratorHelper(this.entriesRight()),
_step12;
try {
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
var _step12$value = _slicedToArray(_step12.value, 2),
key = _step12$value[0],
value = _step12$value[1];
if (findKeyPredicate.call(thisArg, value, key, this)) {
return _some(key);
}
}
} catch (err) {
_iterator12.e(err);
} finally {
_iterator12.f();
}
return none;
}
}, {
key: "set",
value: function set(key, value, overrides) {
var op = this.equalsAndHash(key, overrides);
this.buckets.set(key, value, op);
return this;
}
}, {
key: "emplace",
value: function emplace(key, handler, overrides) {
var op = this.equalsAndHash(key, overrides);
return this.buckets.emplace(key, handler, op);
}
}, {
key: "copy",
value: function copy(other) {
var map = this;
if (isIterable(other)) {
var _iterator13 = _createForOfIteratorHelper(other),
_step13;
try {
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
var _step13$value = _slicedToArray(_step13.value, 2),
key = _step13$value[0],
value = _step13$value[1];
map.set(key, value);
}
} catch (err) {
_iterator13.e(err);
} finally {
_iterator13.f();
}
return this;
} else if (isFunction(other.entries)) {
var _iterator14 = _createForOfIteratorHelper(other.entries()),
_step14;
try {
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
var _step14$value = _slicedToArray(_step14.value, 2),
_key = _step14$value[0],
_value = _step14$value[1];
map.set(_key, _value);
}
} catch (err) {
_iterator14.e(err);
} finally {
_iterator14.f();
}
return this;
} else if (isFunction(other.forEach)) {
other.forEach(function (value, key) {
map.set(key, value);
});
return this;
}
throw new TypeError('HashMap.copy expects an object which is iterable, has an entries iterable function, or has a forEach function on it');
}
}, {
key: "clone",
value: function clone() {
return new HashMap(this);
}
}, {
key: "delete",
value: function _delete(key, overrides) {
var op = this.equalsAndHash(key, overrides);
this.buckets.delete(key, op);
return this;
}
}, {
key: "clear",
value: function clear() {
this.buckets.clear();
return this;
}
}, {
key: "forEach",
value: function forEach(callback, thisArg) {
var _iterator15 = _createForOfIteratorHelper(this.entries()),
_step15;
try {
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
var entry = _step15.value;
callback.call(thisArg, entry[1], entry[0], this);
}
} catch (err) {
_iterator15.e(err);
} finally {
_iterator15.f();
}
return this;
}
}, {
key: "forEachRight",
value: function forEachRight(callback, thisArg) {
var _iterator16 = _createForOfIteratorHelper(this.entriesRight()),
_step16;
try {
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
var entry = _step16.value;
callback.call(thisArg, entry[1], entry[0], this);
}
} catch (err) {
_iterator16.e(err);
} finally {
_iterator16.f();
}
return this;
}
}, {
key: "every",
value: function every() {
var everyPredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var overrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
var iterator = overrides && overrides.reverse ? this.entriesRight() : this.entries();
var _iterator17 = _createForOfIteratorHelper(iterator),
_step17;
try {
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
var _step17$value = _slicedToArray(_step17.value, 2),
key = _step17$value[0],
value = _step17$value[1];
if (!everyPredicate.call(thisArg, value, key, this)) {
return false;
}
}
} catch (err) {
_iterator17.e(err);
} finally {
_iterator17.f();
}
return true;
}
}, {
key: "some",
value: function some() {
var somePredicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return true;
};
var thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var overrides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
var iterator = overrides && overrides.reverse ? this.entriesRight() : this.entries();
var _iterator18 = _createForOfIteratorHelper(iterator),
_step18;
try {
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
var _step18$value = _slicedToArray(_step18.value, 2),
key = _step18$value[0],
value = _step18$value[1];
if (somePredicate.call(thisArg, value, key, this)) {
return true;
}
}
} catch (err) {
_iterator18.e(err);
} finally {
_iterator18.f();
}
return false;
}
}, {
key: "reduce",
value: function reduce(reduceFunction, initialValue, thisArg) {
var accumulator = initialValue;
if (initialValue === undefined) {
var first = true;
var _iterator19 = _createForOfIteratorHelper(this.entries()),
_step19;
try {
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
var _step19$value = _slicedToArray(_step19.value, 2),
key = _step19$value[0],
value = _step19$value[1];
if (first) {
first = false;
accumulator = value;
} else {
accumulator = reduceFunction.call(thisArg, accumulator, value, key, this);
}
}
} catch (err) {
_iterator19.e(err);
} finally {
_iterator19.f();
}
} else {
var _iterator20 = _createForOfIteratorHelper(this.entries()),
_step20;
try {
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
var _step20$value = _slicedToArray(_step20.value, 2),
_key2 = _step20$value[0],
_value2 = _step20$value[1];
accumulator = reduceFunction.call(thisArg, accumulator, _value2, _key2, this);
}
} catch (err) {
_iterator20.e(err);
} finally {
_iterator20.f();
}
}
return accumulator;
}
}, {
key: "reduceRight",
value: function reduceRight(reduceFunction, initialValue, thisArg) {
var accumulator = initialValue;
if (initialValue === undefined) {
var first = true;
var _iterator21 = _createForOfIteratorHelper(this.entriesRight()),
_step21;
try {
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
var _step21$value = _slicedToArray(_step21.value, 2),
key = _step21$value[0],
value = _step21$value[1];
if (first) {
first = false;
accumulator = value;
} else {
accumulator = reduceFunction.call(thisArg, accumulator, value, key, this);
}
}
} catch (err) {
_iterator21.e(err);
} finally {
_iterator21.f();
}
} else {
var _iterator22 = _createForOfIteratorHelper(this.entriesRight()),
_step22;
try {
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
var _step22$value = _slicedToArray(_step22.value, 2),
_key3 = _step22$value[0],
_value3 = _step22$value[1];
accumulator = reduceFunction.call(thisArg, accumulator, _value3, _key3, this);
}
} catch (err) {
_iterator22.e(err);
} finally {
_iterator22.f();
}
}
return accumulator;
}
}, {
key: Symbol.iterator,
value:
regeneratorRuntime.mark(function value() {
return regeneratorRuntime.wrap(function value$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.delegateYield(this.entries(), "t0", 1);
case 1:
case "end":
return _context.stop();
}
}
}, value, this);
})
}, {
key: "entries",
value:
regeneratorRuntime.mark(function entries() {
return regeneratorRuntime.wrap(function entries$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
return _context2.delegateYield(this.buckets, "t0", 1);
case 1:
case "end":
return _context2.stop();
}
}
}, entries, this);
})
}, {
key: "entriesRight",
value:
regeneratorRuntime.mark(function entriesRight() {
return regeneratorRuntime.wrap(function entriesRight$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
return _context3.delegateYield(this.buckets.entriesRight(), "t0", 1);
case 1:
case "end":
return _context3.stop();
}
}
}, entriesRight, this);
})
}, {
key: "keys",
value:
regeneratorRuntime.mark(function keys() {
return regeneratorRuntime.wrap(function keys$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
return _context4.delegateYield(this.buckets.keys(), "t0", 1);
case 1:
case "end":
return _context4.stop();
}
}
}, keys, this);
})
}, {
key: "values",
value:
regeneratorRuntime.mark(function values() {
return regeneratorRuntime.wrap(function values$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
return _context5.delegateYield(this.buckets.values(), "t0", 1);
case 1:
case "end":
return _context5.stop();
}
}
}, values, this);
})
}, {
key: "keysRight",
value:
regeneratorRuntime.mark(function keysRight() {
return regeneratorRuntime.wrap(function keysRight$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
return _context6.delegateYield(this.buckets.keysRight(), "t0", 1);
case 1:
case "end":
return _context6.stop();
}
}
}, keysRight, this);
})
}, {
key: "valuesRight",
value:
regeneratorRuntime.mark(function valuesRight() {
return regeneratorRuntime.wrap(function valuesRight$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
return _context7.delegateYield(this.buckets.valuesRight(), "t0", 1);
case 1:
case "end":
return _context7.stop();
}
}
}, valuesRight, this);
})
}]);
return HashMap;
}();
Object.defineProperty(HashMap.prototype, 'equalsFor', {
value: equalsFor,
configurable: true
});
Object.defineProperty(HashMap.prototype, 'equalsAndHash', {
value: equalsAndHash,
configurable: true
});
Object.defineProperty(HashMap.prototype, 'createContainer', {
value: function createContainer(parent, hash) {
return new Container(this, parent, hash);
},
configurable: true
});
var LinkedHashMap = function (_HashMap) {
_inherits(LinkedHashMap, _HashMap);
var _super = _createSuper(LinkedHashMap);
function LinkedHashMap(copy) {
var _this;
_classCallCheck(this, LinkedHashMap);
_this = _super.call(this, copy);
if (_this.size === 0) {
_this.start = undefined;
_this.end = undefined;
}
return _this;
}
_createClass(LinkedHashMap, [{
key: "clear",
value: function clear() {
this.start = undefined;
this.end = undefined;
return _get(_getPrototypeOf(LinkedHashMap.prototype), "clear", this).call(this);
}
}, {
key: "setLeft",
value: function setLeft(key, value, overrides) {
var op = this.equalsAndHash(key, overrides);
op.addToStart = true;
this.buckets.set(key, value, op);
return this;
}
}, {
key: "emplaceLeft",
value: function emplaceLeft(key, handler, overrides) {
var op = this.equalsAndHash(key, overrides);
op.addToStart = true;
return this.buckets.emplace(key, handler, op);
}
}, {
key: "push",
value: function push(key, value, overrides) {
var op = this.equalsAndHash(key, overrides);
op.moveOnUpdate = true;
this.buckets.set(key, value, op);
return this;
}
}, {
key: "pushEmplace",
value: function pushEmplace(key, handler, overrides) {
var op = this.equalsAndHash(key, overrides);
op.moveOnUpdate = true;
return this.buckets.emplace(key, handler, op);
}
}, {
key: "unshift",
value: function unshift(key, value, overrides) {
var op = this.equalsAndHash(key, overrides);
op.moveOnUpdate = true;
op.addToStart = true;
this.buckets.set(key, value, op);
return this;
}
}, {
key: "unshiftEmplace",
value: function unshiftEmplace(key, handler, overrides) {
var op = this.equalsAndHash(key, overrides);
op.moveOnUpdate = true;
op.addToStart = true;
return this.buckets.emplace(key, handler, op);
}
}, {
key: "shift",
value: function shift() {
var entry = this.start;
if (entry) {
entry.parent.deleteEntry(entry);
return entry.slice();
}
return undefined;
}
}, {
key: "pop",
value: function pop() {
var entry = this.end;
if (entry) {
entry.parent.deleteEntry(entry);
return entry.slice();
}
return undefined;
}
}, {
key: "head",
value: function head() {
var entry = this.start;
if (entry) {
return entry[1];
}
return undefined;
}
}, {
key: "tail",
value: function tail() {
var entry = this.end;
if (entry) {
return entry[1];
}
return undefined;
}
}, {
key: "optionalHead",
value: function optionalHead() {
var entry = this.start;
if (entry) {
return _some(entry[1]);
}
return none;
}
}, {
key: "optionalTail",
value: function optionalTail() {
var entry = this.end;
if (entry) {
return _some(entry[1]);
}
return none;
}
}, {
key: "headKey",
value: function headKey() {
var entry = this.start;
if (entry) {
return entry[0];
}
return undefined;
}
}, {
key: "tailKey",
value: function tailKey() {
var entry = this.end;
if (entry) {
return entry[0];
}
return undefined;
}
}, {
key: "optionalHeadKey",
value: function optionalHeadKey() {
var entry = this.start;
if (entry) {
return _some(entry[0]);
}
return none;
}
}, {
key: "optionalTailKey",
value: function optionalTailKey() {
var entry = this.end;
if (entry) {
return _some(entry[0]);
}
return none;
}
}, {
key: "reverse",
value: function reverse() {
if (this.size > 1) {
var entry = this.start;
do {
var previous = entry.previous;
var next = entry.next;
entry.previous = next;
entry.next = previous;
entry = next;
} while (entry);
var start = this.start;
this.start = this.end;
this.end = start;
}
return this;
}
}, {
key: "clone",
value: function clone() {
return new LinkedHashMap(this);
}
}, {
key: Symbol.iterator,
value:
regeneratorRuntime.mark(function value() {
return regeneratorRuntime.wrap(function value$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
return _context.delegateYield(this.entries(), "t0", 1);
case 1:
case "end":
return _context.stop();
}
}
}, value, this);
})
}, {
key: "entries",
value:
regeneratorRuntime.mark(function entries() {
var entry;
return regeneratorRuntime.wrap(function entries$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
entry = this.start;
case 1:
if (!entry) {
_context2.next = 7;
break;
}
_context2.next = 4;
return entry.slice();
case 4:
entry = entry.next;
_context2.next = 1;
break;
case 7:
case "end":
return _context2.stop();
}
}
}, entries, this);
})
}, {
key: "entriesRight",
value:
regeneratorRuntime.mark(function entriesRight() {
var entry;
return regeneratorRuntime.wrap(function entriesRight$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
entry = this.end;
case 1:
if (!entry) {
_context3.next = 7;
break;
}
_context3.next = 4;
return entry.slice();
case 4:
entry = entry.previous;
_context3.next = 1;
break;
case 7:
case "end":
return _context3.stop();
}
}
}, entriesRight, this);
})
}, {
key: "keys",
value:
regeneratorRuntime.mark(function keys() {
var entry;
return regeneratorRuntime.wrap(function keys$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
entry = this.start;
case 1:
if (!entry) {
_context4.next = 7;
break;
}
_context4.next = 4;
return entry[0];
case 4:
entry = entry.next;
_context4.next = 1;
break;
case 7:
case "end":
return _context4.stop();
}
}
}, keys, this);
})
}, {
key: "values",
value:
regeneratorRuntime.mark(function values() {
var entry;
return regeneratorRuntime.wrap(function values$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
entry = this.start;
case 1:
if (!entry) {
_context5.next = 7;
break;
}
_context5.next = 4;
return entry[1];
case 4:
entry = entry.next;
_context5.next = 1;
break;
case 7:
case "end":
return _context5.stop();
}
}
}, values, this);
})
}, {
key: "keysRight",
value:
regeneratorRuntime.mark(function keysRight() {
var entry;
return regeneratorRuntime.wrap(function keysRight$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
entry = this.end;
case 1:
if (!entry) {
_context6.next = 7;
break;
}
_context6.next = 4;
return entry[0];
case 4:
entry = entry.previous;
_context6.next = 1;
break;
case 7:
case "end":
return _context6.stop();
}
}
}, keysRight, this);
})
}, {
key: "valuesRight",
value:
regeneratorRuntime.mark(function valuesRight() {
var entry;
return regeneratorRuntime.wrap(function valuesRight$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
entry = this.end;
case 1:
if (!entry) {
_context7.next = 7;
break;
}
_context7.next = 4;
return entry[1];
case 4:
entry = entry.previous;
_context7.next = 1;
break;
case 7:
case "end":
return _context7.stop();
}
}
}, valuesRight, this);
})
}]);
return LinkedHashMap;
}(HashMap);
Object.defineProperty(LinkedHashMap.prototype, 'createContainer', {
value: function createContainer(parent, hash) {
return new LinkedContainer(this, parent, hash);
},
configurable: true
});
var LinkedContainer = function (_Container) {
_inherits(LinkedContainer, _Container);
var _super2 = _createSuper(LinkedContainer);
function LinkedContainer(map, parent, hash) {
_classCallCheck(this, LinkedContainer);
return _super2.call(this, map, parent, hash);
}
_createClass(LinkedContainer, [{
key: "createEntry",
value: function createEntry(key, value, overrides) {
var entry = _get(_getPrototypeOf(LinkedContainer.prototype), "createEntry", this).call(this, key, value, overrides);
var map = this.map;
if (map.start === undefined) {
map.end = map.start = entry;
} else if (overrides.addToStart) {
map.start.previous = entry;
entry.next = map.start;
map.start = entry;
} else {
map.end.next = entry;
entry.previous = map.end;
map.end = entry;
}
return entry;
}
}, {
key: "updateEntry",
value: function updateEntry(entry, newValue, overrides) {
_get(_getPrototypeOf(LinkedContainer.prototype), "updateEntry", this).call(this, entry, newValue, overrides);
if (overrides.moveOnUpdate) {
if (overrides.addToStart) {
if (entry.previous) {
if (entry.next) {
entry.next.previous = entry.previous;
}
entry.previous.next = entry.next;
if (entry === this.map.end) {
this.map.end = entry.previous;
}
entry.previous = undefined;
this.map.start.previous = entry;
entry.next = this.map.start;
this.map.start = entry;
}
} else if (entry.next) {
if (entry.previous) {
entry.previous.next = entry.next;
}
entry.next.previous = entry.previous;
if (entry === this.map.start) {
this.map.start = entry.next;
}
entry.next = undefined;
this.map.end.next = entry;
entry.previous = this.map.end;
this.map.end = entry;
}
}
}
}, {
key: "deleteIndex",
value: function deleteIndex(idx) {
var oldEntry = _get(_getPrototypeOf(LinkedContainer.prototype), "deleteIndex", this).call(this, idx);
var map = this.map;
if (oldEntry.previous) {
oldEntry.previous.next = oldEntry.next;
} else {
map.start = oldEntry.next;
}
if (oldEntry.next) {
oldEntry.next.previous = oldEntry.previous;
} else {
map.end = oldEntry.previous;
}
}
}]);
return LinkedContainer;
}(Container);
var Mootable = {
HashMap: HashMap,
LinkedHashMap: LinkedHashMap,
hash: hash,
isFunction: isFunction,
isIterable: isIterable,
isString: isString,
equalsAndHash: equalsAndHash,
hashCodeFor: hashCodeFor,
equalsFor: equalsFor,
some: _some,
none: none,
Option: Option,
sameValueZero: sameValueZero,
strictEquals: strictEquals,
abstractEquals: abstractEquals,
sameValue: sameValue,
hammingWeight: hammingWeight
};
exports.HashMap = HashMap;
exports.LinkedHashMap = LinkedHashMap;
exports.Mootable = Mootable;
exports.default = LinkedHashMap;
})));
|
function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=e(require("deepmerge")),r=e(require("shvl"));module.exports=function(u,o,i){function c(e,t,r){try{return(r=t.getItem(e))&&"undefined"!==r?JSON.parse(r):void 0}catch(e){}}if(o=(u=u||{}).storage||window&&window.localStorage,i=u.key||"vuex",!function(e){try{return e.setItem("@@",1),e.removeItem("@@"),1}catch(e){}}(o))throw new Error("Invalid storage instance given");return function(e){var n=r.get(u,"getState",c)(i,o);"object"==typeof n&&null!==n&&e.replaceState(t(e.state,n,{arrayMerge:u.arrayMerger||function(e,t){return t},clone:!1})),(u.subscriber||function(t){return function(e){return t.subscribe(e)}})(e)(function(e,t){(u.filter||function(){return!0})(e)&&(u.setState||function(e,t,r){return r.setItem(e,JSON.stringify(t))})(i,(u.reducer||function(n,e){return 0===e.length?n:e.reduce(function(e,t){return r.set(e,t,r.get(n,t))},{})})(t,u.paths||[]),o)})}};
|
/*!
* vue-i18n v9.0.0-rc.1
* (c) 2021 kazuya kawaguchi
* Released under the MIT License.
*/
import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue';
/**
* Original Utilities
* written by kazuya kawaguchi
*/
const inBrowser = typeof window !== 'undefined';
let mark;
let measure;
{
const perf = inBrowser && window.performance;
if (perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures) {
mark = (tag) => perf.mark(tag);
measure = (name, startTag, endTag) => {
perf.measure(name, startTag, endTag);
perf.clearMarks(startTag);
perf.clearMarks(endTag);
};
}
}
const RE_ARGS = /\{([0-9a-zA-Z]+)\}/g;
/* eslint-disable */
function format(message, ...args) {
if (args.length === 1 && isObject(args[0])) {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return message.replace(RE_ARGS, (match, identifier) => {
return args.hasOwnProperty(identifier) ? args[identifier] : '';
});
}
const hasSymbol = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
const makeSymbol = (name) => hasSymbol ? Symbol(name) : name;
const generateFormatCacheKey = (locale, key, source) => friendlyJSONstringify({ l: locale, k: key, s: source });
const friendlyJSONstringify = (json) => JSON.stringify(json)
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029')
.replace(/\u0027/g, '\\u0027');
const isNumber = (val) => typeof val === 'number' && isFinite(val);
const isDate = (val) => toTypeString(val) === '[object Date]';
const isRegExp = (val) => toTypeString(val) === '[object RegExp]';
const isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0;
function warn(msg, err) {
if (typeof console !== 'undefined') {
console.warn(`[intlify] ` + msg);
/* istanbul ignore if */
if (err) {
console.warn(err.stack);
}
}
}
let _globalThis;
const getGlobalThis = () => {
// prettier-ignore
return (_globalThis ||
(_globalThis =
typeof globalThis !== 'undefined'
? globalThis
: typeof self !== 'undefined'
? self
: typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: {}));
};
function escapeHtml(rawText) {
return rawText
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
/* eslint-enable */
/**
* Useful Utilites By Evan you
* Modified by kazuya kawaguchi
* MIT License
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/index.ts
* https://github.com/vuejs/vue-next/blob/master/packages/shared/src/codeframe.ts
*/
const isArray = Array.isArray;
const isFunction = (val) => typeof val === 'function';
const isString = (val) => typeof val === 'string';
const isBoolean = (val) => typeof val === 'boolean';
const isObject = (val) => // eslint-disable-line
val !== null && typeof val === 'object';
const objectToString = Object.prototype.toString;
const toTypeString = (value) => objectToString.call(value);
const isPlainObject = (val) => toTypeString(val) === '[object Object]';
// for converting list and named values to displayed strings.
const toDisplayString = (val) => {
return val == null
? ''
: isArray(val) || (isPlainObject(val) && val.toString === objectToString)
? JSON.stringify(val, null, 2)
: String(val);
};
const RANGE = 2;
function generateCodeFrame(source, start = 0, end = source.length) {
const lines = source.split(/\r?\n/);
let count = 0;
const res = [];
for (let i = 0; i < lines.length; i++) {
count += lines[i].length + 1;
if (count >= start) {
for (let j = i - RANGE; j <= i + RANGE || end > count; j++) {
if (j < 0 || j >= lines.length)
continue;
const line = j + 1;
res.push(`${line}${' '.repeat(3 - String(line).length)}| ${lines[j]}`);
const lineLength = lines[j].length;
if (j === i) {
// push underline
const pad = start - (count - lineLength) + 1;
const length = Math.max(1, end > count ? lineLength - pad : end - start);
res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));
}
else if (j > i) {
if (end > count) {
const length = Math.max(Math.min(end - count, lineLength), 1);
res.push(` | ` + '^'.repeat(length));
}
count += lineLength + 1;
}
}
break;
}
}
return res.join('\n');
}
/**
* Vue I18n Version
*
* @remarks
* Semver format. Same format as the package.json `version` field.
*
* @VueI18nGeneral
*/
const VERSION = '9.0.0-rc.1';
/**
* This is only called development env
* istanbul-ignore-next
*/
function initDev() {
const target = getGlobalThis();
target.__INTLIFY__ = true;
{
console.info(`You are running a development build of vue-i18n.\n` +
`Make sure to use the production build (*.prod.js) when deploying for production.`);
}
}
const pathStateMachine = [];
pathStateMachine[0 /* BEFORE_PATH */] = {
["w" /* WORKSPACE */]: [0 /* BEFORE_PATH */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[1 /* IN_PATH */] = {
["w" /* WORKSPACE */]: [1 /* IN_PATH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */]
};
pathStateMachine[2 /* BEFORE_IDENT */] = {
["w" /* WORKSPACE */]: [2 /* BEFORE_IDENT */],
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */]
};
pathStateMachine[3 /* IN_IDENT */] = {
["i" /* IDENT */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["0" /* ZERO */]: [3 /* IN_IDENT */, 0 /* APPEND */],
["w" /* WORKSPACE */]: [1 /* IN_PATH */, 1 /* PUSH */],
["." /* DOT */]: [2 /* BEFORE_IDENT */, 1 /* PUSH */],
["[" /* LEFT_BRACKET */]: [4 /* IN_SUB_PATH */, 1 /* PUSH */],
["o" /* END_OF_FAIL */]: [7 /* AFTER_PATH */, 1 /* PUSH */]
};
pathStateMachine[4 /* IN_SUB_PATH */] = {
["'" /* SINGLE_QUOTE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */],
["\"" /* DOUBLE_QUOTE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */],
["[" /* LEFT_BRACKET */]: [
4 /* IN_SUB_PATH */,
2 /* INC_SUB_PATH_DEPTH */
],
["]" /* RIGHT_BRACKET */]: [1 /* IN_PATH */, 3 /* PUSH_SUB_PATH */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */]
};
pathStateMachine[5 /* IN_SINGLE_QUOTE */] = {
["'" /* SINGLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [5 /* IN_SINGLE_QUOTE */, 0 /* APPEND */]
};
pathStateMachine[6 /* IN_DOUBLE_QUOTE */] = {
["\"" /* DOUBLE_QUOTE */]: [4 /* IN_SUB_PATH */, 0 /* APPEND */],
["o" /* END_OF_FAIL */]: 8 /* ERROR */,
["l" /* ELSE */]: [6 /* IN_DOUBLE_QUOTE */, 0 /* APPEND */]
};
/**
* Check if an expression is a literal value.
*/
const literalValueRE = /^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
function isLiteral(exp) {
return literalValueRE.test(exp);
}
/**
* Strip quotes from a string
*/
function stripQuotes(str) {
const a = str.charCodeAt(0);
const b = str.charCodeAt(str.length - 1);
return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;
}
/**
* Determine the type of a character in a keypath.
*/
function getPathCharType(ch) {
if (ch === undefined || ch === null) {
return "o" /* END_OF_FAIL */;
}
const code = ch.charCodeAt(0);
switch (code) {
case 0x5b: // [
case 0x5d: // ]
case 0x2e: // .
case 0x22: // "
case 0x27: // '
return ch;
case 0x5f: // _
case 0x24: // $
case 0x2d: // -
return "i" /* IDENT */;
case 0x09: // Tab (HT)
case 0x0a: // Newline (LF)
case 0x0d: // Return (CR)
case 0xa0: // No-break space (NBSP)
case 0xfeff: // Byte Order Mark (BOM)
case 0x2028: // Line Separator (LS)
case 0x2029: // Paragraph Separator (PS)
return "w" /* WORKSPACE */;
}
return "i" /* IDENT */;
}
/**
* Format a subPath, return its plain form if it is
* a literal string or number. Otherwise prepend the
* dynamic indicator (*).
*/
function formatSubPath(path) {
const trimmed = path.trim();
// invalid leading 0
if (path.charAt(0) === '0' && isNaN(parseInt(path))) {
return false;
}
return isLiteral(trimmed)
? stripQuotes(trimmed)
: "*" /* ASTARISK */ + trimmed;
}
/**
* Parse a string path into an array of segments
*/
function parse(path) {
const keys = [];
let index = -1;
let mode = 0 /* BEFORE_PATH */;
let subPathDepth = 0;
let c;
let key; // eslint-disable-line
let newChar;
let type;
let transition;
let action;
let typeMap;
const actions = [];
actions[0 /* APPEND */] = () => {
if (key === undefined) {
key = newChar;
}
else {
key += newChar;
}
};
actions[1 /* PUSH */] = () => {
if (key !== undefined) {
keys.push(key);
key = undefined;
}
};
actions[2 /* INC_SUB_PATH_DEPTH */] = () => {
actions[0 /* APPEND */]();
subPathDepth++;
};
actions[3 /* PUSH_SUB_PATH */] = () => {
if (subPathDepth > 0) {
subPathDepth--;
mode = 4 /* IN_SUB_PATH */;
actions[0 /* APPEND */]();
}
else {
subPathDepth = 0;
if (key === undefined) {
return false;
}
key = formatSubPath(key);
if (key === false) {
return false;
}
else {
actions[1 /* PUSH */]();
}
}
};
function maybeUnescapeQuote() {
const nextChar = path[index + 1];
if ((mode === 5 /* IN_SINGLE_QUOTE */ &&
nextChar === "'" /* SINGLE_QUOTE */) ||
(mode === 6 /* IN_DOUBLE_QUOTE */ &&
nextChar === "\"" /* DOUBLE_QUOTE */)) {
index++;
newChar = '\\' + nextChar;
actions[0 /* APPEND */]();
return true;
}
}
while (mode !== null) {
index++;
c = path[index];
if (c === '\\' && maybeUnescapeQuote()) {
continue;
}
type = getPathCharType(c);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap["l" /* ELSE */] || 8 /* ERROR */;
// check parse error
if (transition === 8 /* ERROR */) {
return;
}
mode = transition[0];
if (transition[1] !== undefined) {
action = actions[transition[1]];
if (action) {
newChar = c;
if (action() === false) {
return;
}
}
}
// check parse finish
if (mode === 7 /* AFTER_PATH */) {
return keys;
}
}
}
// path token cache
const cache = new Map();
function resolveValue(obj, path) {
// check object
if (!isObject(obj)) {
return null;
}
// parse path
let hit = cache.get(path);
if (!hit) {
hit = parse(path);
if (hit) {
cache.set(path, hit);
}
}
// check hit
if (!hit) {
return null;
}
// resolve path value
const len = hit.length;
let last = obj;
let i = 0;
while (i < len) {
const val = last[hit[i]];
if (val === undefined) {
return null;
}
last = val;
i++;
}
return last;
}
const DEFAULT_MODIFIER = (str) => str;
const DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line
const DEFAULT_MESSAGE_DATA_TYPE = 'text';
const DEFAULT_NORMALIZE = (values) => values.length === 0 ? '' : values.join('');
const DEFAULT_INTERPOLATE = toDisplayString;
function pluralDefault(choice, choicesLength) {
choice = Math.abs(choice);
if (choicesLength === 2) {
// prettier-ignore
return choice
? choice > 1
? 1
: 0
: 1;
}
return choice ? Math.min(choice, 2) : 0;
}
function getPluralIndex(options) {
// prettier-ignore
const index = isNumber(options.pluralIndex)
? options.pluralIndex
: -1;
// prettier-ignore
return options.named && (isNumber(options.named.count) || isNumber(options.named.n))
? isNumber(options.named.count)
? options.named.count
: isNumber(options.named.n)
? options.named.n
: index
: index;
}
function normalizeNamed(pluralIndex, props) {
if (!props.count) {
props.count = pluralIndex;
}
if (!props.n) {
props.n = pluralIndex;
}
}
function createMessageContext(options = {}) {
const locale = options.locale;
const pluralIndex = getPluralIndex(options);
const pluralRule = isObject(options.pluralRules) &&
isString(locale) &&
isFunction(options.pluralRules[locale])
? options.pluralRules[locale]
: pluralDefault;
const orgPluralRule = isObject(options.pluralRules) &&
isString(locale) &&
isFunction(options.pluralRules[locale])
? pluralDefault
: undefined;
const plural = (messages) => messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];
const _list = options.list || [];
const list = (index) => _list[index];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _named = options.named || {};
isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);
const named = (key) => _named[key];
// TODO: need to design resolve message function?
function message(key) {
// prettier-ignore
const msg = isFunction(options.messages)
? options.messages(key)
: isObject(options.messages)
? options.messages[key]
: false;
return !msg
? options.parent
? options.parent.message(key) // resolve from parent messages
: DEFAULT_MESSAGE
: msg;
}
const _modifier = (name) => options.modifiers
? options.modifiers[name]
: DEFAULT_MODIFIER;
const normalize = isPlainObject(options.processor) && isFunction(options.processor.normalize)
? options.processor.normalize
: DEFAULT_NORMALIZE;
const interpolate = isPlainObject(options.processor) &&
isFunction(options.processor.interpolate)
? options.processor.interpolate
: DEFAULT_INTERPOLATE;
const type = isPlainObject(options.processor) && isString(options.processor.type)
? options.processor.type
: DEFAULT_MESSAGE_DATA_TYPE;
const ctx = {
["list" /* LIST */]: list,
["named" /* NAMED */]: named,
["plural" /* PLURAL */]: plural,
["linked" /* LINKED */]: (key, modifier) => {
// TODO: should check `key`
const msg = message(key)(ctx);
return isString(modifier) ? _modifier(modifier)(msg) : msg;
},
["message" /* MESSAGE */]: message,
["type" /* TYPE */]: type,
["interpolate" /* INTERPOLATE */]: interpolate,
["normalize" /* NORMALIZE */]: normalize
};
return ctx;
}
/** @internal */
const errorMessages = {
// tokenizer error messages
[0 /* EXPECTED_TOKEN */]: `Expected token: '{0}'`,
[1 /* INVALID_TOKEN_IN_PLACEHOLDER */]: `Invalid token in placeholder: '{0}'`,
[2 /* UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER */]: `Unterminated single quote in placeholder`,
[3 /* UNKNOWN_ESCAPE_SEQUENCE */]: `Unknown escape sequence: \\{0}`,
[4 /* INVALID_UNICODE_ESCAPE_SEQUENCE */]: `Invalid unicode escape sequence: {0}`,
[5 /* UNBALANCED_CLOSING_BRACE */]: `Unbalanced closing brace`,
[6 /* UNTERMINATED_CLOSING_BRACE */]: `Unterminated closing brace`,
[7 /* EMPTY_PLACEHOLDER */]: `Empty placeholder`,
[8 /* NOT_ALLOW_NEST_PLACEHOLDER */]: `Not allowed nest placeholder`,
[9 /* INVALID_LINKED_FORMAT */]: `Invalid linked format`,
// parser error messages
[10 /* MUST_HAVE_MESSAGES_IN_PLURAL */]: `Plural must have messages`,
[11 /* UNEXPECTED_EMPTY_LINKED_MODIFIER */]: `Unexpected empty linked modifier`,
[12 /* UNEXPECTED_EMPTY_LINKED_KEY */]: `Unexpected empty linked key`,
[13 /* UNEXPECTED_LEXICAL_ANALYSIS */]: `Unexpected lexical analysis in token: '{0}'`
};
function createCompileError(code, loc, optinos = {}) {
const { domain, messages, args } = optinos;
const msg = format((messages || errorMessages)[code] || '', ...(args || []))
;
const error = new SyntaxError(String(msg));
error.code = code;
if (loc) {
error.location = loc;
}
error.domain = domain;
return error;
}
/** @internal */
const warnMessages = {
[0 /* NOT_FOUND_KEY */]: `Not found '{key}' key in '{locale}' locale messages.`,
[1 /* FALLBACK_TO_TRANSLATE */]: `Fall back to translate '{key}' key with '{target}' locale.`,
[2 /* CANNOT_FORMAT_NUMBER */]: `Cannot format a number value due to not supported Intl.NumberFormat.`,
[3 /* FALLBACK_TO_NUMBER_FORMAT */]: `Fall back to number format '{key}' key with '{target}' locale.`,
[4 /* CANNOT_FORMAT_DATE */]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,
[5 /* FALLBACK_TO_DATE_FORMAT */]: `Fall back to datetime format '{key}' key with '{target}' locale.`
};
function getWarnMessage(code, ...args) {
return format(warnMessages[code], ...args);
}
const NOT_REOSLVED = -1;
const MISSING_RESOLVE_VALUE = '';
function getDefaultLinkedModifiers() {
return {
upper: (val) => (isString(val) ? val.toUpperCase() : val),
lower: (val) => (isString(val) ? val.toLowerCase() : val),
// prettier-ignore
capitalize: (val) => (isString(val)
? `${val.charAt(0).toLocaleUpperCase()}${val.substr(1)}`
: val)
};
}
let _compiler;
function createCoreContext(options = {}) {
// setup options
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
isString(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const messages = isPlainObject(options.messages)
? options.messages
: { [locale]: {} };
const datetimeFormats = isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [locale]: {} };
const numberFormats = isPlainObject(options.numberFormats)
? options.numberFormats
: { [locale]: {} };
const modifiers = Object.assign({}, options.modifiers || {}, getDefaultLinkedModifiers());
const pluralRules = options.pluralRules || {};
const missing = isFunction(options.missing) ? options.missing : null;
const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
const fallbackFormat = !!options.fallbackFormat;
const unresolving = !!options.unresolving;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
const processor = isPlainObject(options.processor) ? options.processor : null;
const warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
const escapeParameter = !!options.escapeParameter;
const messageCompiler = isFunction(options.messageCompiler)
? options.messageCompiler
: _compiler;
const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;
// setup internal options
const internalOptions = options;
const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)
? internalOptions.__datetimeFormatters
: new Map();
const __numberFormatters = isObject(internalOptions.__numberFormatters)
? internalOptions.__numberFormatters
: new Map();
const context = {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
modifiers,
pluralRules,
missing,
missingWarn,
fallbackWarn,
fallbackFormat,
unresolving,
postTranslation,
processor,
warnHtmlMessage,
escapeParameter,
messageCompiler,
onWarn,
__datetimeFormatters,
__numberFormatters
};
// for vue-devtools timeline event
{
context.__emitter =
internalOptions.__emitter != null ? internalOptions.__emitter : undefined;
}
return context;
}
/** @internal */
function isTranslateFallbackWarn(fallback, key) {
return fallback instanceof RegExp ? fallback.test(key) : fallback;
}
/** @internal */
function isTranslateMissingWarn(missing, key) {
return missing instanceof RegExp ? missing.test(key) : missing;
}
/** @internal */
function handleMissing(context, key, locale, missingWarn, type) {
const { missing, onWarn } = context;
// for vue-devtools timeline event
{
const emitter = context.__emitter;
if (emitter) {
emitter.emit("missing" /* MISSING */, {
locale,
key,
type,
groupId: `${type}:${key}`
});
}
}
if (missing !== null) {
const ret = missing(context, locale, key, type);
return isString(ret) ? ret : key;
}
else {
if ( isTranslateMissingWarn(missingWarn, key)) {
onWarn(getWarnMessage(0 /* NOT_FOUND_KEY */, { key, locale }));
}
return key;
}
}
/** @internal */
function getLocaleChain(ctx, fallback, start = '') {
const context = ctx;
if (start === '') {
return [];
}
if (!context.__localeChainCache) {
context.__localeChainCache = new Map();
}
let chain = context.__localeChainCache.get(start);
if (!chain) {
chain = [];
// first block defined by start
let block = [start];
// while any intervening block found
while (isArray(block)) {
block = appendBlockToChain(chain, block, fallback);
}
// prettier-ignore
// last block defined by default
const defaults = isArray(fallback)
? fallback
: isPlainObject(fallback)
? fallback['default']
? fallback['default']
: null
: fallback;
// convert defaults to array
block = isString(defaults) ? [defaults] : defaults;
if (isArray(block)) {
appendBlockToChain(chain, block, false);
}
context.__localeChainCache.set(start, chain);
}
return chain;
}
function appendBlockToChain(chain, block, blocks) {
let follow = true;
for (let i = 0; i < block.length && isBoolean(follow); i++) {
const locale = block[i];
if (isString(locale)) {
follow = appendLocaleToChain(chain, block[i], blocks);
}
}
return follow;
}
function appendLocaleToChain(chain, locale, blocks) {
let follow;
const tokens = locale.split('-');
do {
const target = tokens.join('-');
follow = appendItemToChain(chain, target, blocks);
tokens.splice(-1, 1);
} while (tokens.length && follow === true);
return follow;
}
function appendItemToChain(chain, target, blocks) {
let follow = false;
if (!chain.includes(target)) {
follow = true;
if (target) {
follow = target[target.length - 1] !== '!';
const locale = target.replace(/!/g, '');
chain.push(locale);
if ((isArray(blocks) || isPlainObject(blocks)) &&
blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
follow = blocks[locale];
}
}
}
return follow;
}
/** @internal */
function updateFallbackLocale(ctx, locale, fallback) {
const context = ctx;
context.__localeChainCache = new Map();
getLocaleChain(ctx, fallback, locale);
}
function createCoreError(code) {
return createCompileError(code, null, { messages: errorMessages$1 } );
}
/** @internal */
const errorMessages$1 = {
[14 /* INVALID_ARGUMENT */]: 'Invalid arguments',
[15 /* INVALID_DATE_ARGUMENT */]: 'The date provided is an invalid Date object.' +
'Make sure your Date represents a valid date.',
[16 /* INVALID_ISO_DATE_ARGUMENT */]: 'The argument provided is not a valid ISO date string'
};
const NOOP_MESSAGE_FUNCTION = () => '';
const isMessageFunction = (val) => isFunction(val);
// implementationo of `translate` function
function translate(context, ...args) {
const { fallbackFormat, postTranslation, unresolving, fallbackLocale } = context;
const [key, options] = parseTranslateArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const escapeParameter = isBoolean(options.escapeParameter)
? options.escapeParameter
: context.escapeParameter;
// prettier-ignore
const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) // default by function option
? !isBoolean(options.default)
? options.default
: key
: fallbackFormat // default by `fallbackFormat` option
? key
: '';
const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';
const locale = isString(options.locale) ? options.locale : context.locale;
// escape params
escapeParameter && escapeParams(options);
// resolve message format
// eslint-disable-next-line prefer-const
let [format, targetLocale, message] = resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn);
// if you use default message, set it as message format!
let cacheBaseKey = key;
if (!(isString(format) || isMessageFunction(format))) {
if (enableDefaultMsg) {
format = defaultMsgOrKey;
cacheBaseKey = format;
}
}
// checking message format and target locale
if (!(isString(format) || isMessageFunction(format)) ||
!isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
if ( isString(format) && context.messageCompiler == null) {
warn(`The message format compilation is not supported in this build. ` +
`Because message compiler isn't included. ` +
`You need to pre-compilation all message format. ` +
`So translate function return '${key}'.`);
return key;
}
// setup compile error detecting
let occured = false;
const errorDetector = () => {
occured = true;
};
// compile message format
const msg = compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector);
// if occured compile error, return the message format
if (occured) {
return format;
}
// evaluate message with context
const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);
const msgContext = createMessageContext(ctxOptions);
const messaged = evaluateMessage(context, msg, msgContext);
// if use post translation option, procee it with handler
return postTranslation ? postTranslation(messaged) : messaged;
}
function escapeParams(options) {
if (isArray(options.list)) {
options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);
}
else if (isObject(options.named)) {
Object.keys(options.named).forEach(key => {
if (isString(options.named[key])) {
options.named[key] = escapeHtml(options.named[key]);
}
});
}
}
function resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {
const { messages, onWarn } = context;
const locales = getLocaleChain(context, fallbackLocale, locale);
let message = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'translate';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(1 /* FALLBACK_TO_TRANSLATE */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to,
groupId: `${type}:${key}`
});
}
}
message =
messages[targetLocale] || {};
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-resolve-start';
endTag = 'intlify-message-resolve-end';
mark && mark(startTag);
}
if ((format = resolveValue(message, key)) === null) {
// if null, resolve with object key path
format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any
}
// for vue-devtools timeline event
if ( inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start && format) {
emitter.emit("message-resolve" /* MESSAGE_RESOLVE */, {
type: "message-resolve" /* MESSAGE_RESOLVE */,
key,
message: format,
time: end - start,
groupId: `${type}:${key}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message resolve', startTag, endTag);
}
}
if (isString(format) || isFunction(format))
break;
const missingRet = handleMissing(context, key, targetLocale, missingWarn, type);
if (missingRet !== key) {
format = missingRet;
}
from = to;
}
return [format, targetLocale, message];
}
function compileMessasgeFormat(context, key, targetLocale, format, cacheBaseKey, errorDetector) {
const { messageCompiler, warnHtmlMessage } = context;
if (isMessageFunction(format)) {
const msg = format;
msg.locale = msg.locale || targetLocale;
msg.key = msg.key || key;
return msg;
}
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-compilation-start';
endTag = 'intlify-message-compilation-end';
mark && mark(startTag);
}
const msg = messageCompiler(format, getCompileOptions(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, errorDetector));
// for vue-devtools timeline event
if ( inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-compilation" /* MESSAGE_COMPILATION */, {
type: "message-compilation" /* MESSAGE_COMPILATION */,
message: format,
time: end - start,
groupId: `${'translate'}:${key}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message compilation', startTag, endTag);
}
}
msg.locale = targetLocale;
msg.key = key;
msg.source = format;
return msg;
}
function evaluateMessage(context, msg, msgCtx) {
// for vue-devtools timeline event
let start = null;
let startTag;
let endTag;
if ( inBrowser) {
start = window.performance.now();
startTag = 'intlify-message-evaluation-start';
endTag = 'intlify-message-evaluation-end';
mark && mark(startTag);
}
const messaged = msg(msgCtx);
// for vue-devtools timeline event
if ( inBrowser) {
const end = window.performance.now();
const emitter = context.__emitter;
if (emitter && start) {
emitter.emit("message-evaluation" /* MESSAGE_EVALUATION */, {
type: "message-evaluation" /* MESSAGE_EVALUATION */,
value: messaged,
time: end - start,
groupId: `${'translate'}:${msg.key}`
});
}
if (startTag && endTag && mark && measure) {
mark(endTag);
measure('intlify message evaluation', startTag, endTag);
}
}
return messaged;
}
/** @internal */
function parseTranslateArgs(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
if (!isString(arg1) && !isNumber(arg1)) {
throw createCoreError(14 /* INVALID_ARGUMENT */);
}
const key = isNumber(arg1) ? String(arg1) : arg1;
if (isNumber(arg2)) {
options.plural = arg2;
}
else if (isString(arg2)) {
options.default = arg2;
}
else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {
options.named = arg2;
}
else if (isArray(arg2)) {
options.list = arg2;
}
if (isNumber(arg3)) {
options.plural = arg3;
}
else if (isString(arg3)) {
options.default = arg3;
}
else if (isPlainObject(arg3)) {
Object.assign(options, arg3);
}
return [key, options];
}
function getCompileOptions(context, locale, key, source, warnHtmlMessage, errorDetector) {
return {
warnHtmlMessage,
onError: (err) => {
errorDetector && errorDetector(err);
{
const message = `Message compilation error: ${err.message}`;
const codeFrame = err.location &&
generateCodeFrame(source, err.location.start.offset, err.location.end.offset);
const emitter = context.__emitter;
if (emitter) {
emitter.emit("compile-error" /* COMPILE_ERROR */, {
message: source,
error: err.message,
start: err.location && err.location.start.offset,
end: err.location && err.location.end.offset,
groupId: `${'translate'}:${key}`
});
}
console.error(codeFrame ? `${message}\n${codeFrame}` : message);
}
},
onCacheKey: (source) => generateFormatCacheKey(locale, key, source)
};
}
function getMessageContextOptions(context, locale, message, options) {
const { modifiers, pluralRules } = context;
const resolveMessage = (key) => {
const val = resolveValue(message, key);
if (isString(val)) {
let occured = false;
const errorDetector = () => {
occured = true;
};
const msg = compileMessasgeFormat(context, key, locale, val, key, errorDetector);
return !occured
? msg
: NOOP_MESSAGE_FUNCTION;
}
else if (isMessageFunction(val)) {
return val;
}
else {
// TODO: should be implemented warning message
return NOOP_MESSAGE_FUNCTION;
}
};
const ctxOptions = {
locale,
modifiers,
pluralRules,
messages: resolveMessage
};
if (context.processor) {
ctxOptions.processor = context.processor;
}
if (options.list) {
ctxOptions.list = options.list;
}
if (options.named) {
ctxOptions.named = options.named;
}
if (isNumber(options.plural)) {
ctxOptions.pluralIndex = options.plural;
}
return ctxOptions;
}
const intlDefined = typeof Intl !== 'undefined';
const Availabilities = {
dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',
numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'
};
// implementation of `datetime` function
function datetime(context, ...args) {
const { datetimeFormats, unresolving, fallbackLocale, onWarn } = context;
const { __datetimeFormatters } = context;
if ( !Availabilities.dateTimeFormat) {
onWarn(getWarnMessage(4 /* CANNOT_FORMAT_DATE */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseDateTimeArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.DateTimeFormat(locale).format(value);
}
// resolve format
let datetimeFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'datetime format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(5 /* FALLBACK_TO_DATE_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to,
groupId: `${type}:${key}`
});
}
}
datetimeFormat =
datetimeFormats[targetLocale] || {};
format = datetimeFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __datetimeFormatters.get(id);
if (!formatter) {
formatter = new Intl.DateTimeFormat(targetLocale, Object.assign({}, format, orverrides));
__datetimeFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseDateTimeArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
let value;
if (isString(arg1)) {
// Only allow ISO strings - other date formats are often supported,
// but may cause different results in different browsers.
if (!/\d{4}-\d{2}-\d{2}(T.*)?/.test(arg1)) {
throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
}
value = new Date(arg1);
try {
// This will fail if the date is not valid
value.toISOString();
}
catch (e) {
throw createCoreError(16 /* INVALID_ISO_DATE_ARGUMENT */);
}
}
else if (isDate(arg1)) {
if (isNaN(arg1.getTime())) {
throw createCoreError(15 /* INVALID_DATE_ARGUMENT */);
}
value = arg1;
}
else if (isNumber(arg1)) {
value = arg1;
}
else {
throw createCoreError(14 /* INVALID_ARGUMENT */);
}
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearDateTimeFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__datetimeFormatters.has(id)) {
continue;
}
context.__datetimeFormatters.delete(id);
}
}
// implementation of `number` function
function number(context, ...args) {
const { numberFormats, unresolving, fallbackLocale, onWarn } = context;
const { __numberFormatters } = context;
if ( !Availabilities.numberFormat) {
onWarn(getWarnMessage(2 /* CANNOT_FORMAT_NUMBER */));
return MISSING_RESOLVE_VALUE;
}
const [key, value, options, orverrides] = parseNumberArgs(...args);
const missingWarn = isBoolean(options.missingWarn)
? options.missingWarn
: context.missingWarn;
const fallbackWarn = isBoolean(options.fallbackWarn)
? options.fallbackWarn
: context.fallbackWarn;
const part = !!options.part;
const locale = isString(options.locale) ? options.locale : context.locale;
const locales = getLocaleChain(context, fallbackLocale, locale);
if (!isString(key) || key === '') {
return new Intl.NumberFormat(locale).format(value);
}
// resolve format
let numberFormat = {};
let targetLocale;
let format = null;
let from = locale;
let to = null;
const type = 'number format';
for (let i = 0; i < locales.length; i++) {
targetLocale = to = locales[i];
if (
locale !== targetLocale &&
isTranslateFallbackWarn(fallbackWarn, key)) {
onWarn(getWarnMessage(3 /* FALLBACK_TO_NUMBER_FORMAT */, {
key,
target: targetLocale
}));
}
// for vue-devtools timeline event
if ( locale !== targetLocale) {
const emitter = context.__emitter;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type,
key,
from,
to,
groupId: `${type}:${key}`
});
}
}
numberFormat =
numberFormats[targetLocale] || {};
format = numberFormat[key];
if (isPlainObject(format))
break;
handleMissing(context, key, targetLocale, missingWarn, type);
from = to;
}
// checking format and target locale
if (!isPlainObject(format) || !isString(targetLocale)) {
return unresolving ? NOT_REOSLVED : key;
}
let id = `${targetLocale}__${key}`;
if (!isEmptyObject(orverrides)) {
id = `${id}__${JSON.stringify(orverrides)}`;
}
let formatter = __numberFormatters.get(id);
if (!formatter) {
formatter = new Intl.NumberFormat(targetLocale, Object.assign({}, format, orverrides));
__numberFormatters.set(id, formatter);
}
return !part ? formatter.format(value) : formatter.formatToParts(value);
}
/** @internal */
function parseNumberArgs(...args) {
const [arg1, arg2, arg3, arg4] = args;
let options = {};
let orverrides = {};
if (!isNumber(arg1)) {
throw createCoreError(14 /* INVALID_ARGUMENT */);
}
const value = arg1;
if (isString(arg2)) {
options.key = arg2;
}
else if (isPlainObject(arg2)) {
options = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isPlainObject(arg3)) {
orverrides = arg3;
}
if (isPlainObject(arg4)) {
orverrides = arg4;
}
return [options.key || '', value, options, orverrides];
}
/** @internal */
function clearNumberFormat(ctx, locale, format) {
const context = ctx;
for (const key in format) {
const id = `${locale}__${key}`;
if (!context.__numberFormatters.has(id)) {
continue;
}
context.__numberFormatters.delete(id);
}
}
const DevToolsLabels = {
["vue-devtools-plugin-vue-i18n" /* PLUGIN */]: 'Vue I18n devtools',
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'I18n Resources',
["vue-i18n-timeline" /* TIMELINE */]: 'Vue I18n'
};
const DevToolsPlaceholders = {
["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]: 'Search for scopes ...'
};
const DevToolsTimelineColors = {
["vue-i18n-timeline" /* TIMELINE */]: 0xffcd19
};
/**
* Event emitter, forked from the below:
* - original repository url: https://github.com/developit/mitt
* - code url: https://github.com/developit/mitt/blob/master/src/index.ts
* - author: Jason Miller (https://github.com/developit)
* - license: MIT
*/
/**
* Create a event emitter
*
* @returns An event emitter
*/
function createEmitter() {
const events = new Map();
const emitter = {
events,
on(event, handler) {
const handlers = events.get(event);
const added = handlers && handlers.push(handler);
if (!added) {
events.set(event, [handler]);
}
},
off(event, handler) {
const handlers = events.get(event);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
emit(event, payload) {
(events.get(event) || [])
.slice()
.map(handler => handler(payload));
(events.get('*') || [])
.slice()
.map(handler => handler(event, payload));
}
};
return emitter;
}
const warnMessages$1 = {
[6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`,
[7 /* NOT_SUPPORTED_PRESERVE */]: `Not supportted 'preserve'.`,
[8 /* NOT_SUPPORTED_FORMATTER */]: `Not supportted 'formatter'.`,
[9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */]: `Not supportted 'preserveDirectiveContent'.`,
[10 /* NOT_SUPPORTED_GET_CHOICE_INDEX */]: `Not supportted 'getChoiceIndex'.`,
[11 /* COMPONENT_NAME_LEGACY_COMPATIBLE */]: `Component name legacy compatible: '{name}' -> 'i18n'`,
[12 /* NOT_FOUND_PARENT_SCOPE */]: `Not found parent scope. use the global scope.`
};
function getWarnMessage$1(code, ...args) {
return format(warnMessages$1[code], ...args);
}
function createI18nError(code, ...args) {
return createCompileError(code, null, { messages: errorMessages$2, args } );
}
const errorMessages$2 = {
[14 /* UNEXPECTED_RETURN_TYPE */]: 'Unexpected return type in composer',
[15 /* INVALID_ARGUMENT */]: 'Invalid argument',
[16 /* MUST_BE_CALL_SETUP_TOP */]: 'Must be called at the top of a `setup` function',
[17 /* NOT_INSLALLED */]: 'Need to install with `app.use` function',
[22 /* UNEXPECTED_ERROR */]: 'Unexpected error',
[18 /* NOT_AVAILABLE_IN_LEGACY_MODE */]: 'Not available in legacy mode',
[19 /* REQUIRED_VALUE */]: `Required in value: {0}`,
[20 /* INVALID_VALUE */]: `Invalid value`,
[21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin`
};
/**
* Composer
*
* Composer is offered composable API for Vue 3
* This module is offered new style vue-i18n API
*/
const TransrateVNodeSymbol = makeSymbol('__transrateVNode');
const DatetimePartsSymbol = makeSymbol('__datetimeParts');
const NumberPartsSymbol = makeSymbol('__numberParts');
const EnableEmitter = makeSymbol('__enableEmitter');
const DisableEmitter = makeSymbol('__disableEmitter');
let composerID = 0;
function defineCoreMissingHandler(missing) {
return ((ctx, locale, key, type) => {
return missing(locale, key, getCurrentInstance() || undefined, type);
});
}
function getLocaleMessages(locale, options) {
const { messages, __i18n } = options;
// prettier-ignore
const ret = isPlainObject(messages)
? messages
: isArray(__i18n)
? {}
: { [locale]: {} };
// merge locale messages of i18n custom block
if (isArray(__i18n)) {
__i18n.forEach(({ locale, resource }) => {
if (locale) {
ret[locale] = ret[locale] || {};
deepCopy(resource, ret[locale]);
}
else {
deepCopy(resource, ret);
}
});
}
return ret;
}
const hasOwnProperty = Object.prototype.hasOwnProperty;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function deepCopy(source, destination) {
for (const key in source) {
if (hasOwn(source, key)) {
if (!isObject(source[key])) {
destination[key] = destination[key] != null ? destination[key] : {};
destination[key] = source[key];
}
else {
destination[key] = destination[key] != null ? destination[key] : {};
deepCopy(source[key], destination[key]);
}
}
}
}
/**
* Create composer interface factory
*
* @internal
*/
function createComposer(options = {}) {
const { __root } = options;
const _isGlobal = __root === undefined;
let _inheritLocale = isBoolean(options.inheritLocale)
? options.inheritLocale
: true;
const _locale = ref(
// prettier-ignore
__root && _inheritLocale
? __root.locale.value
: isString(options.locale)
? options.locale
: 'en-US');
const _fallbackLocale = ref(
// prettier-ignore
__root && _inheritLocale
? __root.fallbackLocale.value
: isString(options.fallbackLocale) ||
isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: _locale.value);
const _messages = ref(getLocaleMessages(_locale.value, options));
const _datetimeFormats = ref(isPlainObject(options.datetimeFormats)
? options.datetimeFormats
: { [_locale.value]: {} });
const _numberFormats = ref(isPlainObject(options.numberFormats)
? options.numberFormats
: { [_locale.value]: {} });
// warning suppress options
// prettier-ignore
let _missingWarn = __root
? __root.missingWarn
: isBoolean(options.missingWarn) || isRegExp(options.missingWarn)
? options.missingWarn
: true;
// prettier-ignore
let _fallbackWarn = __root
? __root.fallbackWarn
: isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)
? options.fallbackWarn
: true;
let _fallbackRoot = isBoolean(options.fallbackRoot)
? options.fallbackRoot
: true;
// configure fall bakck to root
let _fallbackFormat = !!options.fallbackFormat;
// runtime missing
let _missing = isFunction(options.missing) ? options.missing : null;
let _runtimeMissing = isFunction(options.missing)
? defineCoreMissingHandler(options.missing)
: null;
// postTranslation handler
let _postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: null;
let _warnHtmlMessage = isBoolean(options.warnHtmlMessage)
? options.warnHtmlMessage
: true;
let _escapeParameter = !!options.escapeParameter;
// custom linked modifiers
// prettier-ignore
const _modifiers = __root
? __root.modifiers
: isPlainObject(options.modifiers)
? options.modifiers
: {};
// pluralRules
const _pluralRules = options.pluralRules;
// runtime context
// eslint-disable-next-line prefer-const
let _context;
function getCoreContext() {
return createCoreContext({
locale: _locale.value,
fallbackLocale: _fallbackLocale.value,
messages: _messages.value,
datetimeFormats: _datetimeFormats.value,
numberFormats: _numberFormats.value,
modifiers: _modifiers,
pluralRules: _pluralRules,
missing: _runtimeMissing === null ? undefined : _runtimeMissing,
missingWarn: _missingWarn,
fallbackWarn: _fallbackWarn,
fallbackFormat: _fallbackFormat,
unresolving: true,
postTranslation: _postTranslation === null ? undefined : _postTranslation,
warnHtmlMessage: _warnHtmlMessage,
escapeParameter: _escapeParameter,
__datetimeFormatters: isPlainObject(_context)
? _context.__datetimeFormatters
: undefined,
__numberFormatters: isPlainObject(_context)
? _context.__numberFormatters
: undefined,
__emitter: isPlainObject(_context)
? _context.__emitter
: undefined
});
}
_context = getCoreContext();
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
/*!
* define properties
*/
// locale
const locale = computed({
get: () => _locale.value,
set: val => {
_locale.value = val;
_context.locale = _locale.value;
}
});
// fallbackLocale
const fallbackLocale = computed({
get: () => _fallbackLocale.value,
set: val => {
_fallbackLocale.value = val;
_context.fallbackLocale = _fallbackLocale.value;
updateFallbackLocale(_context, _locale.value, val);
}
});
// messages
const messages = computed(() => _messages.value);
// datetimeFormats
const datetimeFormats = computed(() => _datetimeFormats.value);
// numberFormats
const numberFormats = computed(() => _numberFormats.value);
/**
* define methods
*/
// getPostTranslationHandler
function getPostTranslationHandler() {
return isFunction(_postTranslation) ? _postTranslation : null;
}
// setPostTranslationHandler
function setPostTranslationHandler(handler) {
_postTranslation = handler;
_context.postTranslation = handler;
}
// getMissingHandler
function getMissingHandler() {
return _missing;
}
// setMissingHandler
function setMissingHandler(handler) {
if (handler !== null) {
_runtimeMissing = defineCoreMissingHandler(handler);
}
_missing = handler;
_context.missing = _runtimeMissing;
}
function wrapWithDeps(fn, argumentParser, warnType, fallbackSuccess, fallbackFail, successCondition) {
const context = getCoreContext();
const ret = fn(context); // track reactive dependency, see the getRuntimeContext
if (isNumber(ret) && ret === NOT_REOSLVED) {
const key = argumentParser();
if ( _fallbackRoot && __root) {
warn(getWarnMessage$1(6 /* FALLBACK_TO_ROOT */, {
key,
type: warnType
}));
// for vue-devtools timeline event
{
const { __emitter: emitter } = context;
if (emitter) {
emitter.emit("fallback" /* FALBACK */, {
type: warnType,
key,
to: 'global',
groupId: `${warnType}:${key}`
});
}
}
}
return _fallbackRoot && __root
? fallbackSuccess(__root)
: fallbackFail(key);
}
else if (successCondition(ret)) {
return ret;
}
else {
/* istanbul ignore next */
throw createI18nError(14 /* UNEXPECTED_RETURN_TYPE */);
}
}
// t
function t(...args) {
return wrapWithDeps(context => translate(context, ...args), () => parseTranslateArgs(...args)[0], 'translate', root => root.t(...args), key => key, val => isString(val));
}
// d
function d(...args) {
return wrapWithDeps(context => datetime(context, ...args), () => parseDateTimeArgs(...args)[0], 'datetime format', root => root.d(...args), () => MISSING_RESOLVE_VALUE, val => isString(val));
}
// n
function n(...args) {
return wrapWithDeps(context => number(context, ...args), () => parseNumberArgs(...args)[0], 'number format', root => root.n(...args), () => MISSING_RESOLVE_VALUE, val => isString(val));
}
// for custom processor
function normalize(values) {
return values.map(val => isString(val) ? createVNode(Text, null, val, 0) : val);
}
const interpolate = (val) => val;
const processor = {
normalize,
interpolate,
type: 'vnode'
};
// __transrateVNode, using for `i18n-t` component
function __transrateVNode(...args) {
return wrapWithDeps(context => {
let ret;
const _context = context;
try {
_context.processor = processor;
ret = translate(_context, ...args);
}
finally {
_context.processor = null;
}
return ret;
}, () => parseTranslateArgs(...args)[0], 'translate',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
root => root[TransrateVNodeSymbol](...args), key => [createVNode(Text, null, key, 0)], val => isArray(val));
}
// __numberParts, using for `i18n-n` component
function __numberParts(...args) {
return wrapWithDeps(context => number(context, ...args), () => parseNumberArgs(...args)[0], 'number format',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
root => root[NumberPartsSymbol](...args), () => [], val => isString(val) || isArray(val));
}
// __datetimeParts, using for `i18n-d` component
function __datetimeParts(...args) {
return wrapWithDeps(context => datetime(context, ...args), () => parseDateTimeArgs(...args)[0], 'datetime format',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
root => root[DatetimePartsSymbol](...args), () => [], val => isString(val) || isArray(val));
}
// te
function te(key, locale) {
const targetLocale = isString(locale) ? locale : _locale.value;
const message = getLocaleMessage(targetLocale);
return resolveValue(message, key) !== null;
}
// tm
function tm(key) {
const messages = _messages.value[_locale.value] || {};
const target = resolveValue(messages, key);
// prettier-ignore
return target != null
? target
: __root
? __root.tm(key) || {}
: {};
}
// getLocaleMessage
function getLocaleMessage(locale) {
return (_messages.value[locale] || {});
}
// setLocaleMessage
function setLocaleMessage(locale, message) {
_messages.value[locale] = message;
_context.messages = _messages.value;
}
// mergeLocaleMessage
function mergeLocaleMessage(locale, message) {
_messages.value[locale] = Object.assign(_messages.value[locale] || {}, message);
_context.messages = _messages.value;
}
// getDateTimeFormat
function getDateTimeFormat(locale) {
return _datetimeFormats.value[locale] || {};
}
// setDateTimeFormat
function setDateTimeFormat(locale, format) {
_datetimeFormats.value[locale] = format;
_context.datetimeFormats = _datetimeFormats.value;
clearDateTimeFormat(_context, locale, format);
}
// mergeDateTimeFormat
function mergeDateTimeFormat(locale, format) {
_datetimeFormats.value[locale] = Object.assign(_datetimeFormats.value[locale] || {}, format);
_context.datetimeFormats = _datetimeFormats.value;
clearDateTimeFormat(_context, locale, format);
}
// getNumberFormat
function getNumberFormat(locale) {
return _numberFormats.value[locale] || {};
}
// setNumberFormat
function setNumberFormat(locale, format) {
_numberFormats.value[locale] = format;
_context.numberFormats = _numberFormats.value;
clearNumberFormat(_context, locale, format);
}
// mergeNumberFormat
function mergeNumberFormat(locale, format) {
_numberFormats.value[locale] = Object.assign(_numberFormats.value[locale] || {}, format);
_context.numberFormats = _numberFormats.value;
clearNumberFormat(_context, locale, format);
}
// for debug
composerID++;
// watch root locale & fallbackLocale
if (__root) {
watch(__root.locale, (val) => {
if (_inheritLocale) {
_locale.value = val;
_context.locale = val;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
});
watch(__root.fallbackLocale, (val) => {
if (_inheritLocale) {
_fallbackLocale.value = val;
_context.fallbackLocale = val;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
});
}
// export composition API!
const composer = {
// properties
id: composerID,
locale,
fallbackLocale,
get inheritLocale() {
return _inheritLocale;
},
set inheritLocale(val) {
_inheritLocale = val;
if (val && __root) {
_locale.value = __root.locale.value;
_fallbackLocale.value = __root.fallbackLocale.value;
updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);
}
},
get availableLocales() {
return Object.keys(_messages.value).sort();
},
messages,
datetimeFormats,
numberFormats,
get modifiers() {
return _modifiers;
},
get pluralRules() {
return _pluralRules || {};
},
get isGlobal() {
return _isGlobal;
},
get missingWarn() {
return _missingWarn;
},
set missingWarn(val) {
_missingWarn = val;
_context.missingWarn = _missingWarn;
},
get fallbackWarn() {
return _fallbackWarn;
},
set fallbackWarn(val) {
_fallbackWarn = val;
_context.fallbackWarn = _fallbackWarn;
},
get fallbackRoot() {
return _fallbackRoot;
},
set fallbackRoot(val) {
_fallbackRoot = val;
},
get fallbackFormat() {
return _fallbackFormat;
},
set fallbackFormat(val) {
_fallbackFormat = val;
_context.fallbackFormat = _fallbackFormat;
},
get warnHtmlMessage() {
return _warnHtmlMessage;
},
set warnHtmlMessage(val) {
_warnHtmlMessage = val;
_context.warnHtmlMessage = val;
},
get escapeParameter() {
return _escapeParameter;
},
set escapeParameter(val) {
_escapeParameter = val;
_context.escapeParameter = val;
},
// methods
t,
d,
n,
te,
tm,
getLocaleMessage,
setLocaleMessage,
mergeLocaleMessage,
getDateTimeFormat,
setDateTimeFormat,
mergeDateTimeFormat,
getNumberFormat,
setNumberFormat,
mergeNumberFormat,
getPostTranslationHandler,
setPostTranslationHandler,
getMissingHandler,
setMissingHandler,
[TransrateVNodeSymbol]: __transrateVNode,
[NumberPartsSymbol]: __numberParts,
[DatetimePartsSymbol]: __datetimeParts
};
// for vue-devtools timeline event
{
composer[EnableEmitter] = (emitter) => {
_context.__emitter = emitter;
};
composer[DisableEmitter] = () => {
_context.__emitter = undefined;
};
}
return composer;
}
/**
* Legacy
*
* This module is offered legacy vue-i18n API compatibility
*/
/**
* Convert to I18n Composer Options from VueI18n Options
*
* @internal
*/
function convertComposerOptions(options) {
const locale = isString(options.locale) ? options.locale : 'en-US';
const fallbackLocale = isString(options.fallbackLocale) ||
isArray(options.fallbackLocale) ||
isPlainObject(options.fallbackLocale) ||
options.fallbackLocale === false
? options.fallbackLocale
: locale;
const missing = isFunction(options.missing) ? options.missing : undefined;
const missingWarn = isBoolean(options.silentTranslationWarn) ||
isRegExp(options.silentTranslationWarn)
? !options.silentTranslationWarn
: true;
const fallbackWarn = isBoolean(options.silentFallbackWarn) ||
isRegExp(options.silentFallbackWarn)
? !options.silentFallbackWarn
: true;
const fallbackRoot = isBoolean(options.fallbackRoot)
? options.fallbackRoot
: true;
const fallbackFormat = !!options.formatFallbackMessages;
const modifiers = isPlainObject(options.modifiers) ? options.modifiers : {};
const pluralizationRules = options.pluralizationRules;
const postTranslation = isFunction(options.postTranslation)
? options.postTranslation
: undefined;
const warnHtmlMessage = isString(options.warnHtmlInMessage)
? options.warnHtmlInMessage !== 'off'
: true;
const escapeParameter = !!options.escapeParameterHtml;
const inheritLocale = isBoolean(options.sync) ? options.sync : true;
if ( options.formatter) {
warn(getWarnMessage$1(8 /* NOT_SUPPORTED_FORMATTER */));
}
if ( options.preserveDirectiveContent) {
warn(getWarnMessage$1(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */));
}
let messages = options.messages;
if (isPlainObject(options.sharedMessages)) {
const sharedMessages = options.sharedMessages;
const locales = Object.keys(sharedMessages);
messages = locales.reduce((messages, locale) => {
const message = messages[locale] || (messages[locale] = {});
Object.assign(message, sharedMessages[locale]);
return messages;
}, (messages || {}));
}
const { __i18n, __root } = options;
const datetimeFormats = options.datetimeFormats;
const numberFormats = options.numberFormats;
return {
locale,
fallbackLocale,
messages,
datetimeFormats,
numberFormats,
missing,
missingWarn,
fallbackWarn,
fallbackRoot,
fallbackFormat,
modifiers,
pluralRules: pluralizationRules,
postTranslation,
warnHtmlMessage,
escapeParameter,
inheritLocale,
__i18n,
__root
};
}
/**
* create VueI18n interface factory
*
* @internal
*/
function createVueI18n(options = {}) {
const composer = createComposer(convertComposerOptions(options));
// defines VueI18n
const vueI18n = {
/**
* properties
*/
// id
id: composer.id,
// locale
get locale() {
return composer.locale.value;
},
set locale(val) {
composer.locale.value = val;
},
// fallbackLocale
get fallbackLocale() {
return composer.fallbackLocale.value;
},
set fallbackLocale(val) {
composer.fallbackLocale.value = val;
},
// messages
get messages() {
return composer.messages.value;
},
// datetimeFormats
get datetimeFormats() {
return composer.datetimeFormats.value;
},
// numberFormats
get numberFormats() {
return composer.numberFormats.value;
},
// availableLocales
get availableLocales() {
return composer.availableLocales;
},
// formatter
get formatter() {
warn(getWarnMessage$1(8 /* NOT_SUPPORTED_FORMATTER */));
// dummy
return {
interpolate() {
return [];
}
};
},
set formatter(val) {
warn(getWarnMessage$1(8 /* NOT_SUPPORTED_FORMATTER */));
},
// missing
get missing() {
return composer.getMissingHandler();
},
set missing(handler) {
composer.setMissingHandler(handler);
},
// silentTranslationWarn
get silentTranslationWarn() {
return isBoolean(composer.missingWarn)
? !composer.missingWarn
: composer.missingWarn;
},
set silentTranslationWarn(val) {
composer.missingWarn = isBoolean(val) ? !val : val;
},
// silentFallbackWarn
get silentFallbackWarn() {
return isBoolean(composer.fallbackWarn)
? !composer.fallbackWarn
: composer.fallbackWarn;
},
set silentFallbackWarn(val) {
composer.fallbackWarn = isBoolean(val) ? !val : val;
},
// modifiers
get modifiers() {
return composer.modifiers;
},
// formatFallbackMessages
get formatFallbackMessages() {
return composer.fallbackFormat;
},
set formatFallbackMessages(val) {
composer.fallbackFormat = val;
},
// postTranslation
get postTranslation() {
return composer.getPostTranslationHandler();
},
set postTranslation(handler) {
composer.setPostTranslationHandler(handler);
},
// sync
get sync() {
return composer.inheritLocale;
},
set sync(val) {
composer.inheritLocale = val;
},
// warnInHtmlMessage
get warnHtmlInMessage() {
return composer.warnHtmlMessage ? 'warn' : 'off';
},
set warnHtmlInMessage(val) {
composer.warnHtmlMessage = val !== 'off';
},
// escapeParameterHtml
get escapeParameterHtml() {
return composer.escapeParameter;
},
set escapeParameterHtml(val) {
composer.escapeParameter = val;
},
// preserveDirectiveContent
get preserveDirectiveContent() {
warn(getWarnMessage$1(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */));
return true;
},
set preserveDirectiveContent(val) {
warn(getWarnMessage$1(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */));
},
// pluralizationRules
get pluralizationRules() {
return composer.pluralRules || {};
},
// for internal
__composer: composer,
/**
* methods
*/
// t
t(...args) {
const [arg1, arg2, arg3] = args;
const options = {};
let list = null;
let named = null;
if (!isString(arg1)) {
throw createI18nError(15 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (isString(arg2)) {
options.locale = arg2;
}
else if (isArray(arg2)) {
list = arg2;
}
else if (isPlainObject(arg2)) {
named = arg2;
}
if (isArray(arg3)) {
list = arg3;
}
else if (isPlainObject(arg3)) {
named = arg3;
}
return composer.t(key, list || named || {}, options);
},
// tc
tc(...args) {
const [arg1, arg2, arg3] = args;
const options = { plural: 1 };
let list = null;
let named = null;
if (!isString(arg1)) {
throw createI18nError(15 /* INVALID_ARGUMENT */);
}
const key = arg1;
if (isString(arg2)) {
options.locale = arg2;
}
else if (isNumber(arg2)) {
options.plural = arg2;
}
else if (isArray(arg2)) {
list = arg2;
}
else if (isPlainObject(arg2)) {
named = arg2;
}
if (isString(arg3)) {
options.locale = arg3;
}
else if (isArray(arg3)) {
list = arg3;
}
else if (isPlainObject(arg3)) {
named = arg3;
}
return composer.t(key, list || named || {}, options);
},
// te
te(key, locale) {
return composer.te(key, locale);
},
// tm
tm(key) {
return composer.tm(key);
},
// getLocaleMessage
getLocaleMessage(locale) {
return composer.getLocaleMessage(locale);
},
// setLocaleMessage
setLocaleMessage(locale, message) {
composer.setLocaleMessage(locale, message);
},
// mergeLocaleMessasge
mergeLocaleMessage(locale, message) {
composer.mergeLocaleMessage(locale, message);
},
// d
d(...args) {
return composer.d(...args);
},
// getDateTimeFormat
getDateTimeFormat(locale) {
return composer.getDateTimeFormat(locale);
},
// setDateTimeFormat
setDateTimeFormat(locale, format) {
composer.setDateTimeFormat(locale, format);
},
// mergeDateTimeFormat
mergeDateTimeFormat(locale, format) {
composer.mergeDateTimeFormat(locale, format);
},
// n
n(...args) {
return composer.n(...args);
},
// getNumberFormat
getNumberFormat(locale) {
return composer.getNumberFormat(locale);
},
// setNumberFormat
setNumberFormat(locale, format) {
composer.setNumberFormat(locale, format);
},
// mergeNumberFormat
mergeNumberFormat(locale, format) {
composer.mergeNumberFormat(locale, format);
},
// getChoiceIndex
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getChoiceIndex(choice, choicesLength) {
warn(getWarnMessage$1(10 /* NOT_SUPPORTED_GET_CHOICE_INDEX */));
return -1;
},
// for internal
__onComponentInstanceCreated(target) {
const { componentInstanceCreatedListener } = options;
if (componentInstanceCreatedListener) {
componentInstanceCreatedListener(target, vueI18n);
}
}
};
// for vue-devtools timeline event
{
vueI18n.__enableEmitter = (emitter) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const __composer = composer;
__composer[EnableEmitter] && __composer[EnableEmitter](emitter);
};
vueI18n.__disableEmitter = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const __composer = composer;
__composer[DisableEmitter] && __composer[DisableEmitter]();
};
}
return vueI18n;
}
const baseFormatProps = {
tag: {
type: [String, Object]
},
locale: {
type: String
},
scope: {
type: String,
validator: (val) => val === 'parent' || val === 'global',
default: 'parent'
}
};
/**
* Translation Component
*
* @remarks
* See the following items for property about details
*
* @VueI18nSee [TranslationProps](component#translationprops)
* @VueI18nSee [BaseFormatProps](component#baseformatprops)
* @VueI18nSee [Component Interpolation](../advanced/component)
*
* @example
* ```html
* <div id="app">
* <!-- ... -->
* <i18n path="term" tag="label" for="tos">
* <a :href="url" target="_blank">{{ $t('tos') }}</a>
* </i18n>
* <!-- ... -->
* </div>
* ```
* ```js
* import { createApp } from 'vue'
* import { createI18n } from 'vue-i18n'
*
* const messages = {
* en: {
* tos: 'Term of Service',
* term: 'I accept xxx {0}.'
* },
* ja: {
* tos: '利用規約',
* term: '私は xxx の{0}に同意します。'
* }
* }
*
* const i18n = createI18n({
* locale: 'en',
* messages
* })
*
* const app = createApp({
* data: {
* url: '/term'
* }
* }).use(i18n).mount('#app')
* ```
*
* @VueI18nComponent
*/
const Translation = {
/* eslint-disable */
name: 'i18n-t',
props: {
...baseFormatProps,
keypath: {
type: String,
required: true
},
plural: {
type: [Number, String],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
validator: (val) => isNumber(val) || !isNaN(val)
}
},
/* eslint-enable */
setup(props, context) {
const { slots, attrs } = context;
const i18n = useI18n({ useScope: props.scope });
const keys = Object.keys(slots).filter(key => key !== '_');
return () => {
const options = {};
if (props.locale) {
options.locale = props.locale;
}
if (props.plural !== undefined) {
options.plural = isString(props.plural) ? +props.plural : props.plural;
}
const arg = getInterpolateArg(context, keys);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const children = i18n[TransrateVNodeSymbol](props.keypath, arg, options);
// prettier-ignore
return isString(props.tag)
? h(props.tag, { ...attrs }, children)
: isObject(props.tag)
? h(props.tag, { ...attrs }, children)
: h(Fragment, { ...attrs }, children);
};
}
};
function getInterpolateArg({ slots }, keys) {
if (keys.length === 1 && keys[0] === 'default') {
// default slot only
return slots.default ? slots.default() : [];
}
else {
// named slots
return keys.reduce((arg, key) => {
const slot = slots[key];
if (slot) {
arg[key] = slot();
}
return arg;
}, {});
}
}
function renderFormatter(props, context, slotKeys, partFormatter) {
const { slots, attrs } = context;
return () => {
const options = { part: true };
let orverrides = {};
if (props.locale) {
options.locale = props.locale;
}
if (isString(props.format)) {
options.key = props.format;
}
else if (isObject(props.format)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (isString(props.format.key)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options.key = props.format.key;
}
// Filter out number format options only
orverrides = Object.keys(props.format).reduce((options, prop) => {
return slotKeys.includes(prop)
? Object.assign({}, options, { [prop]: props.format[prop] }) // eslint-disable-line @typescript-eslint/no-explicit-any
: options;
}, {});
}
const parts = partFormatter(...[props.value, options, orverrides]);
let children = [options.key];
if (isArray(parts)) {
children = parts.map((part, index) => {
const slot = slots[part.type];
return slot
? slot({ [part.type]: part.value, index, parts })
: [part.value];
});
}
else if (isString(parts)) {
children = [parts];
}
// prettier-ignore
return isString(props.tag)
? h(props.tag, { ...attrs }, children)
: isObject(props.tag)
? h(props.tag, { ...attrs }, children)
: h(Fragment, { ...attrs }, children);
};
}
const NUMBER_FORMAT_KEYS = [
'localeMatcher',
'style',
'unit',
'unitDisplay',
'currency',
'currencyDisplay',
'useGrouping',
'numberingSystem',
'minimumIntegerDigits',
'minimumFractionDigits',
'maximumFractionDigits',
'minimumSignificantDigits',
'maximumSignificantDigits',
'notation',
'formatMatcher'
];
/**
* Number Format Component
*
* @remarks
* See the following items for property about details
*
* @VueI18nSee [FormattableProps](component#formattableprops)
* @VueI18nSee [BaseFormatProps](component#baseformatprops)
* @VueI18nSee [Custom Formatting](../essentials/number#custom-formatting)
*
* @VueI18nDanger
* Not supported IE, due to no support `Intl.NumberForamt#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)
*
* If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-numberformat)
*
* @VueI18nComponent
*/
const NumberFormat = {
/* eslint-disable */
name: 'i18n-n',
props: {
...baseFormatProps,
value: {
type: Number,
required: true
},
format: {
type: [String, Object]
}
},
/* eslint-enable */
setup(props, context) {
const i18n = useI18n({ useScope: 'parent' });
return renderFormatter(props, context, NUMBER_FORMAT_KEYS, (...args) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[NumberPartsSymbol](...args));
}
};
const DATETIME_FORMAT_KEYS = [
'dateStyle',
'timeStyle',
'fractionalSecondDigits',
'calendar',
'dayPeriod',
'numberingSystem',
'localeMatcher',
'timeZone',
'hour12',
'hourCycle',
'formatMatcher',
'weekday',
'era',
'year',
'month',
'day',
'hour',
'minute',
'second',
'timeZoneName'
];
/**
* Datetime Format Component
*
* @remarks
* See the following items for property about details
*
* @VueI18nSee [FormattableProps](component#formattableprops)
* @VueI18nSee [BaseFormatProps](component#baseformatprops)
* @VueI18nSee [Custom Formatting](../essentials/datetime#custom-formatting)
*
* @VueI18nDanger
* Not supported IE, due to no support `Intl.DateTimeForamt#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)
*
* If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-datetimeformat)
*
* @VueI18nComponent
*/
const DatetimeFormat = {
/* eslint-disable */
name: 'i18n-d',
props: {
...baseFormatProps,
value: {
type: [Number, Date],
required: true
},
format: {
type: [String, Object]
}
},
/* eslint-enable */
setup(props, context) {
const i18n = useI18n({ useScope: 'parent' });
return renderFormatter(props, context, DATETIME_FORMAT_KEYS, (...args) =>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
i18n[DatetimePartsSymbol](...args));
}
};
function getComposer(i18n, instance) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
return (i18nInternal.__getInstance(instance) || i18n.global);
}
else {
const vueI18n = i18nInternal.__getInstance(instance);
return vueI18n != null
? vueI18n.__composer
: i18n.global.__composer;
}
}
function vTDirective(i18n) {
const bind = (el, { instance, value, modifiers }) => {
/* istanbul ignore if */
if (!instance || !instance.$) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
const composer = getComposer(i18n, instance.$);
if ( modifiers.preserve) {
warn(getWarnMessage$1(7 /* NOT_SUPPORTED_PRESERVE */));
}
const parsedValue = parseValue(value);
el.textContent = composer.t(...makeParams(parsedValue));
};
return {
beforeMount: bind,
beforeUpdate: bind
};
}
function parseValue(value) {
if (isString(value)) {
return { path: value };
}
else if (isPlainObject(value)) {
if (!('path' in value)) {
throw createI18nError(19 /* REQUIRED_VALUE */, 'path');
}
return value;
}
else {
throw createI18nError(20 /* INVALID_VALUE */);
}
}
function makeParams(value) {
const { path, locale, args, choice, plural } = value;
const options = {};
const named = args || {};
if (isString(locale)) {
options.locale = locale;
}
if (isNumber(choice)) {
options.plural = choice;
}
if (isNumber(plural)) {
options.plural = plural;
}
return [path, named, options];
}
function apply(app, i18n, ...options) {
const pluginOptions = isPlainObject(options[0])
? options[0]
: {};
const useI18nComponentName = !!pluginOptions.useI18nComponentName;
const globalInstall = isBoolean(pluginOptions.globalInstall)
? pluginOptions.globalInstall
: true;
if ( globalInstall && useI18nComponentName) {
warn(getWarnMessage$1(11 /* COMPONENT_NAME_LEGACY_COMPATIBLE */, {
name: Translation.name
}));
}
if (globalInstall) {
// install components
app.component(!useI18nComponentName ? Translation.name : 'i18n', Translation);
app.component(NumberFormat.name, NumberFormat);
app.component(DatetimeFormat.name, DatetimeFormat);
}
// install directive
app.directive('t', vTDirective(i18n));
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
function getDevtoolsGlobalHook() {
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
function getTarget() {
// @ts-ignore
return typeof navigator !== 'undefined'
? window
: typeof global$1 !== 'undefined'
? global$1
: {};
}
const HOOK_SETUP = 'devtools-plugin:setup';
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const hook = getDevtoolsGlobalHook();
if (hook) {
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const target = getTarget();
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor,
setupFn
});
}
}
let devtoolsApi;
async function enableDevTools(app, i18n) {
return new Promise((resolve, reject) => {
try {
setupDevtoolsPlugin({
id: "vue-devtools-plugin-vue-i18n" /* PLUGIN */,
label: DevToolsLabels["vue-devtools-plugin-vue-i18n" /* PLUGIN */],
app
}, api => {
devtoolsApi = api;
api.on.walkComponentTree((payload, ctx) => {
updateComponentTreeDataTags(ctx.currentAppRecord, payload.componentTreeData, i18n);
});
api.on.inspectComponent(payload => {
const componentInstance = payload.componentInstance;
if (componentInstance.vnode.el.__INTLIFY__ &&
payload.instanceData) {
if (i18n.mode === 'legacy') {
// ignore global scope on legacy mode
if (componentInstance.vnode.el.__INTLIFY__ !==
i18n.global.__composer) {
inspectComposer(payload.instanceData, componentInstance.vnode.el.__INTLIFY__);
}
}
else {
inspectComposer(payload.instanceData, componentInstance.vnode.el.__INTLIFY__);
}
}
});
api.addInspector({
id: "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */,
label: DevToolsLabels["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */],
icon: 'language',
treeFilterPlaceholder: DevToolsPlaceholders["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */]
});
api.on.getInspectorTree(payload => {
if (payload.app === app &&
payload.inspectorId === "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */) {
registerScope(payload, i18n);
}
});
api.on.getInspectorState(payload => {
if (payload.app === app &&
payload.inspectorId === "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */) {
inspectScope(payload, i18n);
}
});
api.addTimelineLayer({
id: "vue-i18n-timeline" /* TIMELINE */,
label: DevToolsLabels["vue-i18n-timeline" /* TIMELINE */],
color: DevToolsTimelineColors["vue-i18n-timeline" /* TIMELINE */]
});
resolve(true);
});
}
catch (e) {
console.error(e);
reject(false);
}
});
}
function updateComponentTreeDataTags(appRecord, treeData, i18n) {
const instance = appRecord.instanceMap.get(treeData.id);
if (instance && instance.vnode.el.__INTLIFY__) {
// prettier-ignore
const global = i18n.mode === 'composition'
? i18n.global
: i18n.global.__composer;
// add custom tags local scope only
if (instance.vnode.el.__INTLIFY__ !== global) {
const label = instance.type.name || instance.type.displayName || instance.type.__file;
const tag = {
label: `i18n (${label} Scope)`,
textColor: 0x000000,
backgroundColor: 0xffcd19
};
treeData.tags = [tag];
}
}
for (const node of treeData.children) {
updateComponentTreeDataTags(appRecord, node, i18n);
}
}
function inspectComposer(instanceData, composer) {
const type = 'vue-i18n: composer properties';
instanceData.state.push({
type,
key: 'locale',
editable: false,
value: composer.locale.value
});
instanceData.state.push({
type,
key: 'availableLocales',
editable: false,
value: composer.availableLocales
});
instanceData.state.push({
type,
key: 'fallbackLocale',
editable: false,
value: composer.fallbackLocale.value
});
instanceData.state.push({
type,
key: 'inheritLocale',
editable: false,
value: composer.inheritLocale
});
instanceData.state.push({
type,
key: 'messages',
editable: false,
value: getLocaleMessageValue(composer.messages.value)
});
instanceData.state.push({
type,
key: 'datetimeFormats',
editable: false,
value: composer.datetimeFormats.value
});
instanceData.state.push({
type,
key: 'numberFormats',
editable: false,
value: composer.numberFormats.value
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getLocaleMessageValue(messages) {
const value = {};
Object.keys(messages).forEach((key) => {
const v = messages[key];
if (isFunction(v) && 'source' in v) {
value[key] = getMessageFunctionDetails(v);
}
else if (isObject(v)) {
value[key] = getLocaleMessageValue(v);
}
else {
value[key] = v;
}
});
return value;
}
const ESC = {
'<': '<',
'>': '>',
'"': '"',
'&': '&'
};
function escape(s) {
return s.replace(/[<>"&]/g, escapeChar);
}
function escapeChar(a) {
return ESC[a] || a;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getMessageFunctionDetails(func) {
const argString = func.source ? `("${escape(func.source)}")` : `(?)`;
return {
_custom: {
type: 'function',
display: `<span>ƒ</span> ${argString}`
}
};
}
function registerScope(payload, i18n) {
payload.rootNodes.push({
id: 'global',
label: 'Global Scope'
});
// prettier-ignore
const global = i18n.mode === 'composition'
? i18n.global
: i18n.global.__composer;
for (const [keyInstance, instance] of i18n.__instances) {
// prettier-ignore
const composer = i18n.mode === 'composition'
? instance
: instance.__composer;
if (global === composer) {
continue;
}
const label = keyInstance.type.name ||
keyInstance.type.displayName ||
keyInstance.type.__file;
payload.rootNodes.push({
id: composer.id.toString(),
label: `${label} Scope`
});
}
}
function inspectScope(payload, i18n) {
if (payload.nodeId === 'global') {
payload.state = makeScopeInspectState(i18n.mode === 'composition'
? i18n.global
: i18n.global.__composer);
}
else {
const instance = Array.from(i18n.__instances.values()).find(item => item.id.toString() === payload.nodeId);
if (instance) {
const composer = i18n.mode === 'composition'
? instance
: instance.__composer;
payload.state = makeScopeInspectState(composer);
}
}
}
function makeScopeInspectState(composer) {
const state = {};
const localeType = 'Locale related info';
const localeStates = [
{
type: localeType,
key: 'locale',
editable: false,
value: composer.locale.value
},
{
type: localeType,
key: 'fallbackLocale',
editable: false,
value: composer.fallbackLocale.value
},
{
type: localeType,
key: 'availableLocales',
editable: false,
value: composer.availableLocales
},
{
type: localeType,
key: 'inheritLocale',
editable: false,
value: composer.inheritLocale
}
];
state[localeType] = localeStates;
const localeMessagesType = 'Locale messages info';
const localeMessagesStates = [
{
type: localeMessagesType,
key: 'messages',
editable: false,
value: getLocaleMessageValue(composer.messages.value)
}
];
state[localeMessagesType] = localeMessagesStates;
const datetimeFormatsType = 'Datetime formats info';
const datetimeFormatsStates = [
{
type: datetimeFormatsType,
key: 'datetimeFormats',
editable: false,
value: composer.datetimeFormats.value
}
];
state[datetimeFormatsType] = datetimeFormatsStates;
const numberFormatsType = 'Datetime formats info';
const numberFormatsStates = [
{
type: numberFormatsType,
key: 'numberFormats',
editable: false,
value: composer.numberFormats.value
}
];
state[numberFormatsType] = numberFormatsStates;
return state;
}
function addTimelineEvent(event, payload) {
if (devtoolsApi) {
let groupId;
if (payload && 'groupId' in payload) {
groupId = payload.groupId;
delete payload.groupId;
}
devtoolsApi.addTimelineEvent({
layerId: "vue-i18n-timeline" /* TIMELINE */,
event: {
title: event,
groupId,
time: Date.now(),
meta: {},
data: payload || {},
logType: event === "compile-error" /* COMPILE_ERROR */
? 'error'
: event === "fallback" /* FALBACK */ ||
event === "missing" /* MISSING */
? 'warning'
: 'default'
}
});
}
}
// supports compatibility for legacy vue-i18n APIs
function defineMixin(vuei18n, composer, i18n) {
return {
beforeCreate() {
const instance = getCurrentInstance();
/* istanbul ignore if */
if (!instance) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
const options = this.$options;
if (options.i18n) {
const optionsI18n = options.i18n;
if (options.__i18n) {
optionsI18n.__i18n = options.__i18n;
}
optionsI18n.__root = composer;
if (this === this.$root) {
this.$i18n = mergeToRoot(vuei18n, optionsI18n);
}
else {
this.$i18n = createVueI18n(optionsI18n);
}
}
else if (options.__i18n) {
if (this === this.$root) {
this.$i18n = mergeToRoot(vuei18n, options);
}
else {
this.$i18n = createVueI18n({
__i18n: options.__i18n,
__root: composer
});
}
}
else {
// set global
this.$i18n = vuei18n;
}
vuei18n.__onComponentInstanceCreated(this.$i18n);
i18n.__setInstance(instance, this.$i18n);
// defines vue-i18n legacy APIs
this.$t = (...args) => this.$i18n.t(...args);
this.$tc = (...args) => this.$i18n.tc(...args);
this.$te = (key, locale) => this.$i18n.te(key, locale);
this.$d = (...args) => this.$i18n.d(...args);
this.$n = (...args) => this.$i18n.n(...args);
this.$tm = (key) => this.$i18n.tm(key);
},
mounted() {
/* istanbul ignore if */
{
this.$el.__INTLIFY__ = this.$i18n.__composer;
const emitter = (this.__emitter = createEmitter());
const _vueI18n = this.$i18n;
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);
emitter.on('*', addTimelineEvent);
}
},
beforeUnmount() {
const instance = getCurrentInstance();
/* istanbul ignore if */
if (!instance) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
/* istanbul ignore if */
{
if (this.__emitter) {
this.__emitter.off('*', addTimelineEvent);
delete this.__emitter;
}
const _vueI18n = this.$i18n;
_vueI18n.__disableEmitter && _vueI18n.__disableEmitter();
delete this.$el.__INTLIFY__;
}
delete this.$t;
delete this.$tc;
delete this.$te;
delete this.$d;
delete this.$n;
delete this.$tm;
i18n.__deleteInstance(instance);
delete this.$i18n;
}
};
}
function mergeToRoot(root, optoins) {
root.locale = optoins.locale || root.locale;
root.fallbackLocale = optoins.fallbackLocale || root.fallbackLocale;
root.missing = optoins.missing || root.missing;
root.silentTranslationWarn =
optoins.silentTranslationWarn || root.silentFallbackWarn;
root.silentFallbackWarn =
optoins.silentFallbackWarn || root.silentFallbackWarn;
root.formatFallbackMessages =
optoins.formatFallbackMessages || root.formatFallbackMessages;
root.postTranslation = optoins.postTranslation || root.postTranslation;
root.warnHtmlInMessage = optoins.warnHtmlInMessage || root.warnHtmlInMessage;
root.escapeParameterHtml =
optoins.escapeParameterHtml || root.escapeParameterHtml;
root.sync = optoins.sync || root.sync;
const messages = getLocaleMessages(root.locale, {
messages: optoins.messages,
__i18n: optoins.__i18n
});
Object.keys(messages).forEach(locale => root.mergeLocaleMessage(locale, messages[locale]));
if (optoins.datetimeFormats) {
Object.keys(optoins.datetimeFormats).forEach(locale => root.mergeDateTimeFormat(locale, optoins.datetimeFormats[locale]));
}
if (optoins.numberFormats) {
Object.keys(optoins.numberFormats).forEach(locale => root.mergeNumberFormat(locale, optoins.numberFormats[locale]));
}
return root;
}
/**
* Vue I18n factory
*
* @param options - An options, see the {@link I18nOptions}
*
* @returns {@link I18n} instance
*
* @remarks
* If you use Legacy API mode, you need toto specify {@link VueI18nOptions} and `legacy: true` option.
*
* If you use composition API mode, you need to specify {@link ComposerOptions}.
*
* @VueI18nSee [Getting Started](../essentials/started)
* @VueI18nSee [Composition API](../advanced/composition)
*
* @example
* case: for Legacy API
* ```js
* import { createApp } from 'vue'
* import { createI18n } from 'vue-i18n'
*
* // call with I18n option
* const i18n = createI18n({
* locale: 'ja',
* messages: {
* en: { ... },
* ja: { ... }
* }
* })
*
* const App = {
* // ...
* }
*
* const app = createApp(App)
*
* // install!
* app.use(i18n)
* app.mount('#app')
* ```
*
* @example
* case: for composition API
* ```js
* import { createApp } from 'vue'
* import { createI18n, useI18n } from 'vue-i18n'
*
* // call with I18n option
* const i18n = createI18n({
* legacy: false, // you must specify 'lagacy: false' option
* locale: 'ja',
* messages: {
* en: { ... },
* ja: { ... }
* }
* })
*
* const App = {
* setup() {
* // ...
* const { t } = useI18n({ ... })
* return { ... , t }
* }
* }
*
* const app = createApp(App)
*
* // install!
* app.use(i18n)
* app.mount('#app')
* ```
*
* @VueI18nGeneral
*/
function createI18n(options = {}) {
// prettier-ignore
const __legacyMode = isBoolean(options.legacy)
? options.legacy
: true;
const __globalInjection = !!options.globalInjection;
const __instances = new Map();
// prettier-ignore
const __global = __legacyMode
? createVueI18n(options)
: createComposer(options);
const symbol = makeSymbol( 'vue-i18n' );
const i18n = {
// mode
get mode() {
// prettier-ignore
return __legacyMode
? 'legacy'
: 'composition'
;
},
// install plugin
async install(app, ...options) {
{
app.__VUE_I18N__ = i18n;
}
// setup global provider
app.__VUE_I18N_SYMBOL__ = symbol;
app.provide(app.__VUE_I18N_SYMBOL__, i18n);
// global method and properties injection for Composition API
if (!__legacyMode && __globalInjection) {
injectGlobalFields(app, i18n.global);
}
// install built-in components and directive
{
apply(app, i18n, ...options);
}
// setup mixin for Legacy API
if ( __legacyMode) {
app.mixin(defineMixin(__global, __global.__composer, i18n));
}
// setup vue-devtools plugin
{
const ret = await enableDevTools(app, i18n);
if (!ret) {
throw createI18nError(21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */);
}
const emitter = createEmitter();
if (__legacyMode) {
const _vueI18n = __global;
_vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);
}
else {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _composer = __global;
_composer[EnableEmitter] && _composer[EnableEmitter](emitter);
}
emitter.on('*', addTimelineEvent);
}
},
// global accsessor
get global() {
return __global;
},
// @internal
__instances,
// @internal
__getInstance(component) {
return __instances.get(component) || null;
},
// @internal
__setInstance(component, instance) {
__instances.set(component, instance);
},
// @internal
__deleteInstance(component) {
__instances.delete(component);
}
};
return i18n;
}
/**
* Use Composition API for Vue I18n
*
* @param options - An options, see {@link UseI18nOptions}
*
* @returns {@link Composer} instance
*
* @remarks
* This function is mainly used by `setup`.
*
* If options are specified, Composer instance is created for each component and you can be localized on the component.
*
* If options are not specified, you can be localized using the global Composer.
*
* @example
* case: Component resource base localization
* ```html
* <template>
* <form>
* <label>{{ t('language') }}</label>
* <select v-model="locale">
* <option value="en">en</option>
* <option value="ja">ja</option>
* </select>
* </form>
* <p>message: {{ t('hello') }}</p>
* </template>
*
* <script>
* import { useI18n } from 'vue-i18n'
*
* export default {
* setup() {
* const { t, locale } = useI18n({
* locale: 'ja',
* messages: {
* en: { ... },
* ja: { ... }
* }
* })
* // Something to do ...
*
* return { ..., t, locale }
* }
* }
* </script>
* ```
*
* @VueI18nComposition
*/
function useI18n(options = {}) {
const instance = getCurrentInstance();
if (instance == null) {
throw createI18nError(16 /* MUST_BE_CALL_SETUP_TOP */);
}
if (!instance.appContext.app.__VUE_I18N_SYMBOL__) {
throw createI18nError(17 /* NOT_INSLALLED */);
}
const i18n = inject(instance.appContext.app.__VUE_I18N_SYMBOL__);
/* istanbul ignore if */
if (!i18n) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
// prettier-ignore
const global = i18n.mode === 'composition'
? i18n.global
: i18n.global.__composer;
// prettier-ignore
const scope = isEmptyObject(options)
? ('__i18n' in instance.type)
? 'local'
: 'global'
: !options.useScope
? 'local'
: options.useScope;
if (scope === 'global') {
let messages = isObject(options.messages) ? options.messages : {};
if ('__i18nGlobal' in instance.type) {
messages = getLocaleMessages(global.locale.value, {
messages,
__i18n: instance.type.__i18nGlobal
});
}
// merge locale messages
const locales = Object.keys(messages);
if (locales.length) {
locales.forEach(locale => {
global.mergeLocaleMessage(locale, messages[locale]);
});
}
// merge datetime formats
if (isObject(options.datetimeFormats)) {
const locales = Object.keys(options.datetimeFormats);
if (locales.length) {
locales.forEach(locale => {
global.mergeDateTimeFormat(locale, options.datetimeFormats[locale]);
});
}
}
// merge number formats
if (isObject(options.numberFormats)) {
const locales = Object.keys(options.numberFormats);
if (locales.length) {
locales.forEach(locale => {
global.mergeNumberFormat(locale, options.numberFormats[locale]);
});
}
}
return global;
}
if (scope === 'parent') {
let composer = getComposer$1(i18n, instance);
if (composer == null) {
{
warn(getWarnMessage$1(12 /* NOT_FOUND_PARENT_SCOPE */));
}
composer = global;
}
return composer;
}
// scope 'local' case
if (i18n.mode === 'legacy') {
throw createI18nError(18 /* NOT_AVAILABLE_IN_LEGACY_MODE */);
}
const i18nInternal = i18n;
let composer = i18nInternal.__getInstance(instance);
if (composer == null) {
const type = instance.type;
const composerOptions = {
...options
};
if (type.__i18n) {
composerOptions.__i18n = type.__i18n;
}
if (global) {
composerOptions.__root = global;
}
composer = createComposer(composerOptions);
setupLifeCycle(i18nInternal, instance, composer);
i18nInternal.__setInstance(instance, composer);
}
return composer;
}
function getComposer$1(i18n, target) {
let composer = null;
const root = target.root;
let current = target.parent;
while (current != null) {
const i18nInternal = i18n;
if (i18n.mode === 'composition') {
composer = i18nInternal.__getInstance(current);
}
else {
const vueI18n = i18nInternal.__getInstance(current);
if (vueI18n != null) {
composer = vueI18n
.__composer;
}
}
if (composer != null) {
break;
}
if (root === current) {
break;
}
current = current.parent;
}
return composer;
}
function setupLifeCycle(i18n, target, composer) {
let emitter = null;
onMounted(() => {
// inject composer instance to DOM for intlify-devtools
if (
target.vnode.el) {
target.vnode.el.__INTLIFY__ = composer;
emitter = createEmitter();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _composer = composer;
_composer[EnableEmitter] && _composer[EnableEmitter](emitter);
emitter.on('*', addTimelineEvent);
}
}, target);
onUnmounted(() => {
// remove composer instance from DOM for intlify-devtools
if (
target.vnode.el &&
target.vnode.el.__INTLIFY__) {
emitter && emitter.off('*', addTimelineEvent);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const _composer = composer;
_composer[DisableEmitter] && _composer[DisableEmitter]();
delete target.vnode.el.__INTLIFY__;
}
i18n.__deleteInstance(target);
}, target);
}
const globalExportProps = [
'locale',
'fallbackLocale',
'availableLocales'
];
const globalExportMethods = ['t', 'd', 'n', 'tm'];
function injectGlobalFields(app, composer) {
const i18n = Object.create(null);
globalExportProps.forEach(prop => {
const desc = Object.getOwnPropertyDescriptor(composer, prop);
if (!desc) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
const wrap = isRef(desc.value) // check computed props
? {
get() {
return desc.value.value;
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
set(val) {
desc.value.value = val;
}
}
: {
get() {
return desc.get && desc.get();
}
};
Object.defineProperty(i18n, prop, wrap);
});
app.config.globalProperties.$i18n = i18n;
globalExportMethods.forEach(method => {
const desc = Object.getOwnPropertyDescriptor(composer, method);
if (!desc) {
throw createI18nError(22 /* UNEXPECTED_ERROR */);
}
Object.defineProperty(app.config.globalProperties, `$${method}`, desc);
});
}
initDev();
export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
|
var should = require('should');
var path = require('path');
var paths = require('../lib/paths');
var tmpDirPath = path.resolve(__dirname, './.tmp');
// directories
var homeDirPath = tmpDirPath + '/user_home';
var localDirPath = tmpDirPath + '/project';
var authDirPath = homeDirPath + '/auth';
var indexDirPath = homeDirPath + '/index';
// files
var globalConfigPath = homeDirPath + '/dmc_config.json';
var localConfigPath = localDirPath + '/dmc_config.json';
describe('lib/paths', function() {
it('should have the proper home dir path', function(){
paths.dir.home.should.equal(homeDirPath);
});
it('should have the proper local dir path', function(){
paths.dir.local.should.equal(localDirPath);
});
it('should have the proper auth dir path', function(){
paths.dir.auth.should.equal(authDirPath);
});
it('should have the proper index dir path', function(){
paths.dir.index.should.equal(indexDirPath);
});
it('should have the proper global dmc config file path', function(){
paths.file.globalConfig.should.equal(globalConfigPath);
});
it('should have the proper local dmc config file path', function(){
paths.file.localConfig.should.equal(localConfigPath);
});
});
|
/**
* Created by yuyangyang on 2015/5/19.
*/
var foodDao = require('../dao/food');
var Constants = require('../utils/constants');
var _ = require('underscore');
module.exports = {
addFood: function (params) {
return foodDao.createFood(params);
},
queryFoodByStore: function (params) {
return foodDao.findFoodByStore(params);
},
queryFood: function (params) {
return foodDao.findFood(params);
},
queryFoodById: function (params) {
return new Promise(function (resolve, reject) {
foodDao.findFoodById(params, function (err, data) {
err ? reject(err) : resolve(data);
});
});
},
updateFood: function (condition, params) {
_.extend(params, {updateTime: new Date()});
return foodDao.updateFood(condition, params);
},
deleteFood: function (condition) {
return foodDao.deleteFood(condition);
},
checkCreateFood: function (params) {
var self = this;
return this.queryFood({name: params.name, store: params.storeId}).then(function (food) {
if (food) {
return {name: '套餐名称已存在'};
} else {
return self.checkFood(params);
}
});
},
checkUpdateFood: function (params) {
var self = this;
return this.queryFood({name: params.name, _id: {$ne: params.id}, store: params.storeId}).then(function (food) {
if (food) {
return {name: '套餐名称已存在'};
} else {
return self.checkFood(params);
}
});
},
checkFood: function (params) {
var errors = {};
if (!params.name || params.name.length === 0) {
errors.name = '请输入套餐名称';
} else if (params.name.length > 20) {
errors.name = '套餐名称过长';
}
if (!params.price || params.price.length === 0) {
errors.price = '请输入套餐价格';
} else if (!Constants.regexp.PRICE.test(params.price)) {
errors.price = '套餐格式错误';
}
return errors;
}
};
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<31e1e5d0bce8731a52774daa27e4a2b9>>
* @flow
* @lightSyntaxTransform
* @nogrep
*/
/* eslint-disable */
'use strict';
/*::
import type { ReaderFragment } from 'relay-runtime';
import type { FragmentReference } from "relay-runtime";
declare export opaque type ReactRelayPaginationContainerTestNoConnectionUserFragment$ref: FragmentReference;
declare export opaque type ReactRelayPaginationContainerTestNoConnectionUserFragment$fragmentType: ReactRelayPaginationContainerTestNoConnectionUserFragment$ref;
export type ReactRelayPaginationContainerTestNoConnectionUserFragment = {|
+friends: ?{|
+edges: ?$ReadOnlyArray<?{|
+node: ?{|
+id: string,
|},
|}>,
+pageInfo: ?{|
+endCursor: ?string,
+hasNextPage: ?boolean,
|},
|},
+$refType: ReactRelayPaginationContainerTestNoConnectionUserFragment$ref,
|};
export type ReactRelayPaginationContainerTestNoConnectionUserFragment$data = ReactRelayPaginationContainerTestNoConnectionUserFragment;
export type ReactRelayPaginationContainerTestNoConnectionUserFragment$key = {
+$data?: ReactRelayPaginationContainerTestNoConnectionUserFragment$data,
+$fragmentRefs: ReactRelayPaginationContainerTestNoConnectionUserFragment$ref,
...
};
*/
var node/*: ReaderFragment*/ = {
"argumentDefinitions": [
{
"kind": "RootArgument",
"name": "after"
},
{
"kind": "RootArgument",
"name": "count"
},
{
"kind": "RootArgument",
"name": "orderby"
}
],
"kind": "Fragment",
"metadata": null,
"name": "ReactRelayPaginationContainerTestNoConnectionUserFragment",
"selections": [
{
"alias": null,
"args": [
{
"kind": "Variable",
"name": "after",
"variableName": "after"
},
{
"kind": "Variable",
"name": "first",
"variableName": "count"
},
{
"kind": "Variable",
"name": "orderby",
"variableName": "orderby"
}
],
"concreteType": "FriendsConnection",
"kind": "LinkedField",
"name": "friends",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "FriendsEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "User",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"type": "User",
"abstractKey": null
};
if (__DEV__) {
(node/*: any*/).hash = "eb45ef2f80d883efa532e1585f97b9f6";
}
module.exports = node;
|
import util from '../util';
const VS_SET_OPTIONS = 'VueScreens/setOptions',
VS_GET_OPTIONS = 'VueScreens/getOptions',
VS_GET_SCREENS = 'VueScreens/getScreens',
VS_RM_SCREENS = 'VueScreens/rmScreens',
VS_SET_ACTIVE_SCREEN = 'VueScreens/setActiveScreen',
VS_ADD_SCREEN = 'VueScreens/addScreen',
VS_REPLACE_SCREENS = 'VueScreens/replaceScreens',
VS_SHUFFLE = 'VueScreens/shuffleScreens';
function getWithoutNamespaces() {
let result = {};
Object.keys(this).map(key => {
let exceptions = ['getWithoutNamespaces'];
if (util.isFalse(util.inArray(exceptions, key)))
result[key] = this[key].replace(/^VueScreens\//, '')
});
return result;
}
export {
VS_SET_OPTIONS,
VS_GET_OPTIONS,
VS_GET_SCREENS,
VS_RM_SCREENS,
VS_SET_ACTIVE_SCREEN,
VS_ADD_SCREEN,
VS_REPLACE_SCREENS,
VS_SHUFFLE,
getWithoutNamespaces
};
|
'use strict';
var gulp = require('gulp');
var path = require('path');
gulp.plugin = require('gulp-load-plugins')();
gulp.plugin.browserSync = require('browser-sync').create();
gulp.cfg = require(path.join(process.cwd(),'config.json'));
var loadTasks = require('gulp-load')(gulp);
loadTasks(path.resolve(process.cwd()));
describe('Task runner', function() {
it('should have a bower task ', function() {
expect(gulp.hasTask('bower')).toBe(true);
});
it('should have a build task ', function() {
expect(gulp.hasTask('build')).toBe(true);
});
it('should have a rebuild task ', function() {
expect(gulp.hasTask('rebuild')).toBe(true);
});
it('should have a bump task ', function() {
expect(gulp.hasTask('bump')).toBe(true);
});
it('should have a clean task ', function() {
expect(gulp.hasTask('clean')).toBe(true);
});
it('should have a default task ', function() {
expect(gulp.hasTask('default')).toBe(true);
});
it('should have a init task ', function() {
expect(gulp.hasTask('init')).toBe(true);
});
it('should have a lint task ', function() {
expect(gulp.hasTask('lint')).toBe(true);
});
it('should have a scripts task ', function() {
expect(gulp.hasTask('scripts')).toBe(true);
});
it('should have a scripts-vendor task ', function() {
expect(gulp.hasTask('scripts-vendor')).toBe(true);
});
it('should have a serve task ', function() {
expect(gulp.hasTask('serve')).toBe(true);
});
it('should have a server task ', function() {
expect(gulp.hasTask('server')).toBe(true);
});
it('should have a static task ', function() {
expect(gulp.hasTask('static')).toBe(true);
});
it('should have a styles task ', function() {
expect(gulp.hasTask('styles')).toBe(true);
});
it('should have a templates task ', function() {
expect(gulp.hasTask('templates')).toBe(true);
});
it('should have a watch task ', function() {
expect(gulp.hasTask('watch')).toBe(true);
});
});
|
if(typeof cptable === 'undefined') cptable = {};
cptable[20838] = (function(){ var d = "\u0002\u0003\t\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013
\b\u0018\u0019\u001c\u001d\u001e\u001f\n\u0017\u001b\u0005\u0006\u0007\u0016\u0004\u0014\u0015\u001a กขฃคฅฆง[¢.<(+|&�จฉชซฌญฎ]!$*);¬-/ฏฐฑฒณดต^¦,%_>?฿๎ถทธนบปผ`:#@'=\"๏abcdefghiฝพฟภมย๚jklmnopqrรฤลฦวศ๛~stuvwxyzษสหฬอฮ๐๑๒๓๔๕๖๗๘๙ฯะัาำิ{ABCDEFGHI�ีึืุู}JKLMNOPQRฺเแโใไ\\�STUVWXYZๅๆ็่้๊0123456789๋์ํ��", e = {}; for(var i=0;i!=d.length;++i) if(d.charCodeAt(i) !== 0xFFFD)e[d[i]] = i; return {"enc": e, "dec": d.split("") }; })();
|
//= require ./split_view
/**
VerticalSplitView divides the current view between leftView and rightView using a vertical
dividerView.
*/
Flame.VerticalSplitView = Flame.SplitView.extend({
classNames: ['flame-vertical-split-view'],
childViews: ['leftView', 'dividerView', 'rightView'],
leftWidth: 100,
rightWidth: 100,
minLeftWidth: 0,
minRightWidth: 0,
flex: 'right',
_unCollapsedLeftWidth: undefined,
_unCollapsedRightWidth: undefined,
_resizeStartX: undefined,
_resizeStartLeftWidth: undefined,
_resizeStartRightWidth: undefined,
init: function() {
Ember.assert('Flame.VerticalSplitView needs leftView and rightView!', !!this.get('leftView') && !!this.get('rightView'));
this._super();
if (this.get('flex') === 'right') this.set('rightWidth', undefined);
else this.set('leftWidth', undefined);
},
_updateLayout: function() {
var leftView = this.get('leftView');
var dividerView = this.get('dividerView');
var rightView = this.get('rightView');
var totalWidth = this.$().innerWidth();
var dividerThickness = this.get('dividerThickness');
var leftWidth = this.get('flex') === 'right' ? this.get('leftWidth') : undefined;
var rightWidth = this.get('flex') === 'left' ? this.get('rightWidth') : undefined;
if (leftWidth === undefined && rightWidth !== undefined && totalWidth !== null && totalWidth !== 0) leftWidth = totalWidth - rightWidth - dividerThickness;
if (rightWidth === undefined && leftWidth !== undefined && totalWidth !== null && totalWidth !== 0) rightWidth = totalWidth - leftWidth - dividerThickness;
if (typeof leftWidth === 'number' && leftWidth < this.get('minLeftWidth')) {
rightWidth += leftWidth - this.get('minLeftWidth');
leftWidth = this.get('minLeftWidth');
}
if (typeof rightWidth === 'number' && rightWidth < this.get('minRightWidth')) {
leftWidth += rightWidth - this.get('minRightWidth');
rightWidth = this.get('minRightWidth');
}
this.set('leftWidth', leftWidth);
this.set('rightWidth', rightWidth);
if (this.get('flex') === 'right') {
this._setDimensions(leftView, 0, leftWidth, '');
this._setDimensions(dividerView, leftWidth, dividerThickness, '');
this._setDimensions(rightView, leftWidth + dividerThickness, '', 0);
} else {
this._setDimensions(leftView, 0, '', rightWidth + dividerThickness);
this._setDimensions(dividerView, '', dividerThickness, rightWidth);
this._setDimensions(rightView, '', rightWidth, 0);
}
}.observes('leftWidth', 'rightWidth', 'minLeftWidth', 'minRightWidth'),
_setDimensions: function(view, left, width, right) {
view.get('layout').setProperties({
left: left,
width: width,
right: right,
top: 0,
bottom: 0
});
view.updateLayout();
},
toggleCollapse: function(event) {
if (!this.get('allowResizing')) return;
if (this.get('flex') === 'right') {
if (this.get('leftWidth') === this.get('minLeftWidth') && this._unCollapsedLeftWidth !== undefined) {
this.set('leftWidth', this._unCollapsedLeftWidth);
} else {
this._unCollapsedLeftWidth = this.get('leftWidth');
this.set('leftWidth', this.get('minLeftWidth'));
}
} else {
if (this.get('rightWidth') === this.get('minRightWidth') && this._unCollapsedRightWidth !== undefined) {
this.set('rightWidth', this._unCollapsedRightWidth);
} else {
this._unCollapsedRightWidth = this.get('rightWidth');
this.set('rightWidth', this.get('minRightWidth'));
}
}
},
startResize: function(event) {
this._resizeStartX = event.pageX;
this._resizeStartLeftWidth = this.get('leftWidth');
this._resizeStartRightWidth = this.get('rightWidth');
},
resize: function(event) {
if (this.get('flex') === 'right') {
this.set('leftWidth', this._resizeStartLeftWidth + (event.pageX - this._resizeStartX));
} else {
this.set('rightWidth', this._resizeStartRightWidth - (event.pageX - this._resizeStartX));
}
}
});
|
/**
* Uniforms library for shared webgl shaders
*/
THREE.UniformsLib = {
common: {
"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
"opacity": { type: "f", value: 1.0 },
"map": { type: "t", value: null },
"offsetRepeat": { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
"specularMap": { type: "t", value: null },
"alphaMap": { type: "t", value: null },
"envMap": { type: "t", value: null },
"flipEnvMap": { type: "f", value: - 1 },
"reflectivity": { type: "f", value: 1.0 },
"refractionRatio": { type: "f", value: 0.98 }
},
aomap: {
"aoMap": { type: "t", value: null },
"aoMapIntensity": { type: "f", value: 1 }
},
lightmap: {
"lightMap": { type: "t", value: null },
"lightMapIntensity": { type: "f", value: 1 }
},
emissivemap: {
"emissiveMap": { type: "t", value: null }
},
bumpmap: {
"bumpMap": { type: "t", value: null },
"bumpScale": { type: "f", value: 1 }
},
normalmap: {
"normalMap": { type: "t", value: null },
"normalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) }
},
displacementmap: {
"displacementMap": { type: "t", value: null },
"displacementScale": { type: "f", value: 1 },
"displacementBias": { type: "f", value: 0 }
},
roughnessmap: {
"roughnessMap": { type: "t", value: null }
},
metalnessmap: {
"metalnessMap": { type: "t", value: null }
},
fog: {
"fogDensity": { type: "f", value: 0.00025 },
"fogNear": { type: "f", value: 1 },
"fogFar": { type: "f", value: 2000 },
"fogColor": { type: "c", value: new THREE.Color( 0xffffff ) }
},
ambient: {
"ambientLightColor": { type: "fv", value: [] }
},
lights: {
"directionalLights": { type: "sa", value: [], properties: {
"direction": { type: "v3" },
"color": { type: "c" },
"shadow": { type: "i" },
"shadowBias": { type: "f" },
"shadowRadius": { type: "f" },
"shadowMapSize": { type: "v2" }
} },
"directionalShadowMap": { type: "tv", value: [] },
"directionalShadowMatrix": { type: "m4v", value: [] },
"spotLights": { type: "sa", value: [], properties: {
"color": { type: "c" },
"position": { type: "v3" },
"direction": { type: "v3" },
"distance": { type: "f" },
"angleCos": { type: "f" },
"penumbra": { type: "f" },
"decay": { type: "f" },
"shadow": { type: "i" },
"shadowBias": { type: "f" },
"shadowRadius": { type: "f" },
"shadowMapSize": { type: "v2" }
} },
"spotShadowMap": { type: "tv", value: [] },
"spotShadowMatrix": { type: "m4v", value: [] },
"pointLights": { type: "sa", value: [], properties: {
"color": { type: "c" },
"position": { type: "v3" },
"decay": { type: "f" },
"distance": { type: "f" },
"shadow": { type: "i" },
"shadowBias": { type: "f" },
"shadowRadius": { type: "f" },
"shadowMapSize": { type: "v2" }
} },
"pointShadowMap": { type: "tv", value: [] },
"pointShadowMatrix": { type: "m4v", value: [] },
"hemisphereLights": { type: "sa", value: [], properties: {
"direction": { type: "v3" },
"skyColor": { type: "c" },
"groundColor": { type: "c" }
} }
},
points: {
"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
"opacity": { type: "f", value: 1.0 },
"size": { type: "f", value: 1.0 },
"scale": { type: "f", value: 1.0 },
"map": { type: "t", value: null },
"offsetRepeat": { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) }
}
};
|
'use strict';
var grunt = require('grunt');
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
exports.{%= short_name %} = {
setUp: function(done) {
// setup here if necessary
done();
},
default_options: function(test) {
test.expect(1);
var actual = grunt.file.read('tmp/default_options');
var expected = grunt.file.read('test/expected/default_options');
test.equal(actual, expected, 'should describe what the default behavior is.');
test.done();
},
custom_options: function(test) {
test.expect(1);
var actual = grunt.file.read('tmp/custom_options');
var expected = grunt.file.read('test/expected/custom_options');
test.equal(actual, expected, 'should describe what the custom option(s) behavior is.');
test.done();
},
};
|
'use strict';
require('./check-deps');
var chalk = require('chalk'),
inquirer = require('inquirer');
var CommonUtil = {};
CommonUtil.header = function(grunt, msg, color) {
msg = color ? chalk[color](msg) : msg;
var line = Array(msg.length + 1).join('-');
line = color ? chalk[color](line) : line;
grunt.log.subhead(msg);
grunt.log.writeln(line);
};
CommonUtil.createPrompt = function(input, options) {
options = options || {};
var prompt = {
name: input.key,
message: input.label,
type: 'input'
};
if(input.description) {
prompt.message += ' [' + input.description + ']';
}
// Required
if(input.required) {
prompt.message = prompt.message + '*';
if(options.validateRequired) {
prompt.validate = function(item) {
return !!item;
};
}
}
// Select type
if(input.type === 'select') {
prompt.type = 'list';
if(input.input_options) {
prompt.choices = input.input_options.map(function(choice) {
return {
name: choice.label,
value: choice.value
};
});
if(!input.required || !options.validateRequired) {
prompt.choices.unshift({
name: '(none)',
value: ''
});
}
}
} else if(input.type === 'datetime') {
prompt.message += ' ⌚ ';
} else if(input.type === 'boolean') {
prompt.message += ' ☯ ';
}
prompt.message = prompt.message += ':';
if(input.default) {
prompt.default = input.default;
}
return prompt;
};
CommonUtil.promptFields = function(inputs, options, cb) {
if(arguments.length === 2) {
cb = options;
options = {};
}
if(!('validateRequired' in options)) {
options.validateRequired = true;
}
// Loop through, keeping track of where we are
// in the input list. This is so we can modify
// the inputs in-place, if necessary.
var i = 0,
limit = inputs.length;
var results = {};
function doPrompt() {
if(i === limit) {
return cb(null, results);
}
var input = inputs[i];
var prompt = CommonUtil.createPrompt(input, options);
var progress = function(results, cb) { cb(); };
prompt.before = input.before || progress;
prompt.after = input.after || progress;
var next = function() {
i++;
doPrompt();
};
prompt.before(results, function(skip) {
if(skip) {
return next();
}
inquirer.prompt(prompt, function(res) {
results[prompt.name] = res[prompt.name];
prompt.after(results, next);
});
});
}
doPrompt();
};
module.exports = CommonUtil;
|
/**
* Preprocess and compile JavaScript file.
*
* @param {Object|String} config configuration JSON object or configuration file path.
* @param {Boolean} config.verbose determines if program should print not only errors.
* @param {String} config.entry entry file path.
* @param {String} config.intermediate intermediate file path.
* @param {String} config.output output file path.
* @param {String} config.basedir base directory path (for included files).
* @param {Object} config.defines map of definitions: {NAME: value}.
* @param {Object} config.lint determines if lint will be used.
* @param {Object} config.minify determines if minify will be used.
* @param {Function|null} callback function called when compilation is complete.
*/
exports.compile = function(config, callback){
var version = '1.2.0',
fs = require('fs-extra'),
preprocessor = require('preprocessor'),
uglify = require('uglify-js'),
// configuration data.
verbose = false,
entryFile = 'entry.js',
intermediateFile = null,
distributionFile = null,
baseDir = './',
defines = {},
minify = false;
callback = callback || function(){
};
// process config.
if (config){
if (typeof config === 'string'){
config = exports.readConfigFile(config);
}
config.verbose && (verbose = config.verbose);
config.entry && (entryFile = config.entry);
config.intermediate && (intermediateFile = config.intermediate);
config.output && (distributionFile = config.output);
config.basedir && (baseDir = config.basedir);
if (config.defines){
var defs = config.defines,
key;
for (key in defs){
if (defs.hasOwnProperty(key)){
defines[key] = defs[key];
}
}
}
config.minify && (minify = config.minify);
}
// configuration validation.
if (!entryFile){
throw 'Entry file is not specified!';
}
if (!fs.existsSync(entryFile)){
throw 'Entry file does not exists: ' + entryFile;
}
if (!distributionFile){
distributionFile = entryFile.substring(-3) === '.js'
? entryFile.substring(0, -3) + 'distribution.js'
: entryFile + '.distribution';
}
if (!baseDir){
baseDir = './';
}
// execute tasks.
verbose && console.log('Compiler.js v' + version);
verbose && console.log('>>> Configuration:');
verbose && console.log('entry: ' + entryFile);
verbose && intermediateFile && console.log('intermediate: ' + intermediateFile);
verbose && console.log('output: ' + distributionFile);
verbose && console.log('basedir: ' + baseDir);
verbose && console.log('minify: ' + minify);
verbose && console.log('defines: ' + JSON.stringify(defines, null, ' '));
verbose && console.log('>>> Performing compilation...');
var data = fs.readFileSync(entryFile);
data = new preprocessor(
data,
baseDir ? baseDir : '.'
).process(
defines ? defines : {}
);
if (intermediateFile){
fs.ensureFileSync(intermediateFile);
fs.writeFileSync(intermediateFile, data);
}
minify && (data = uglify.minify(data, {fromString: true}).code);
fs.ensureFileSync(distributionFile);
fs.writeFileSync(distributionFile, data);
verbose && console.log('>>> Done!');
callback();
};
exports.readConfigFile = function(path){
var fs = require('fs'),
content = fs.readFileSync(path);
if (content){
var data = JSON.parse(content);
if (data && data.inherits && typeof data.inherits === 'string'){
var inherits = exports.readConfigFile(data.inherits),
key;
for (key in data){
if (data.hasOwnProperty(key)){
inherits[key] = data[key];
}
}
return inherits;
}
return data;
}
return null;
};
|
import React from 'react'
import { Image, Grid } from 'stardust'
const image = <Image src='http://semantic-ui.com/images/wireframe/media-paragraph.png' />
const GridDividedExample = () => (
<Grid columns={3} divided>
<Grid.Row>
<Grid.Column>{image}</Grid.Column>
<Grid.Column>{image}</Grid.Column>
<Grid.Column>{image}</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column>{image}</Grid.Column>
<Grid.Column>{image}</Grid.Column>
<Grid.Column>{image}</Grid.Column>
</Grid.Row>
</Grid>
)
export default GridDividedExample
|
(function(DAV) {
DAV.Bucket = Bucket;
var bucketCache = [];
var when = require('when');
var fs = require('fs');
var Path = require('path');
/**
* Constructor
* @param AWS.S3 instance
*/
function Bucket(bucketObject) {
this._bucket = bucketObject;
this._objects = null;
}
/**
* Get Bucket list
* @access static
* @return deferred
*/
Bucket.getBucketList = function() {
var deferred = when.defer(),
buckets = [];
if ( bucketCache.length > 0 ) {
deferred.resolve(bucketCahce);
} else {
DAV.Server.listBuckets({}, function(err, data) {
if ( err ) {
deferred.reject('接続エラーです。\nアクセスキーを確認してください。');
} else {
data.Buckets.forEach(function(bucket) {
buckets.push(new DAV.Bucket(bucket));
});
bucketCache = buckets;
deferred.resolve(bucketCache);
}
});
}
return deferred.promise;
};
/**
* Get bucket name
* @return string
*/
Bucket.prototype.getName = function() {
return this._bucket.Name || "";
};
/**
* Get Objects in this bucket
* @param String dir
* @return Array<Item>
*/
Bucket.prototype.getItems = function(dir) {
var deferred = when.defer(),
that = this,
name = this.getName(),
contents = [],
marker = (dir || '/').replace(/^\//, '');
if ( this._objects ) {
deferred.resolve(this._objects);
} else {
DAV.Server.listObjects({"Bucket": name, "Marker": marker}, function(err, data) {
if ( err ) {
deferred.reject(name + 'のファイル一覧が\n取得できませんでした。');
} else {
that._objects = new DAV.ItemList(data.Contents);
deferred.resolve(that._objects);
}
});
}
return deferred.promise;
};
Bucket.uploadObject = function(files) {
var i = 0;
DAV.Layer.show(true, 'アップロードを開始します');
DAV.Layer.lock();
(function upload(file) {
if ( file === void 0 ) {
return;
}
DAV.Layer.notify(Path.basename(file.name) + 'をアップロード中…');
fs.readFile(file.path, function(err, buffer) {
if ( err ) {
return;
}
var params = {
Key: DAV.Breadcrumb.getCurrentDirectory() + Path.basename(file.name),
Body: buffer,
Bucket: DAV.currentBucket
};
DAV.Server.putObject(params, function(err) {
if ( err ) {
DAV.Modal.alert('ファイルのアップロードに失敗しました。');
return;
}
upload(files[i++]);
});
});
})(files[i++]);
};
})(DAV);
|
// @flow weak
import React from 'react';
import PropTypes from 'prop-types';
import Button from 'material-ui/Button';
import { withStyles } from 'material-ui/styles';
import { SnackbarContent } from 'material-ui/Snackbar';
const action = (
<Button color="accent" dense>
lorem ipsum dolorem
</Button>
);
const styles = theme => ({
root: {
marginTop: theme.spacing.unit * 3,
},
snackbar: {
margin: theme.spacing.unit,
},
});
function LongTextSnackbar(props) {
const { classes } = props;
return (
<div className={classes.root}>
<SnackbarContent className={classes.snackbar} message="I love snacks." action={action} />
<SnackbarContent
className={classes.snackbar}
message={
'I love candy. I love cookies. I love cupcakes. \
I love cheesecake. I love chocolate.'
}
/>
<SnackbarContent
className={classes.snackbar}
message="I love candy. I love cookies. I love cupcakes."
action={action}
/>
<SnackbarContent
className={classes.snackbar}
message={
'I love candy. I love cookies. I love cupcakes. \
I love cheesecake. I love chocolate.'
}
action={action}
/>
</div>
);
}
LongTextSnackbar.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(LongTextSnackbar);
|
/** @jsx h */
import h from '../../../helpers/h'
export default function (change) {
change.replaceNodeByKey('a', { kind: 'text', leaves: [{ text: 'three' }] })
}
export const input = (
<state>
<document>
<paragraph>
one
</paragraph>
<paragraph>
<text key="a">one</text>
</paragraph>
</document>
</state>
)
export const output = (
<state>
<document>
<paragraph>
one
</paragraph>
<paragraph>
three
</paragraph>
</document>
</state>
)
|
'use strict';
var isObservableSet = require('observable-set/is-observable-set')
, multiSetSymbol = require('./symbol');
module.exports = function (value) {
return isObservableSet(value) && Boolean(value[multiSetSymbol]);
};
|
/*jshint node:true */
'use strict';
var backend = require('../liveDbClient');
var getDocumentHash = require('../file/getDocumentHash');
var path = require('path');
var downloadController = {
downloadFile: function (req, res) {
var parsedUrl = req.params[0].split('/');
var projectName = parsedUrl[1];
var filePath = parsedUrl.slice(3).join('/');
return downloadController._getFileContents(projectName, filePath)
.then(function (fileContents) {
var fileName = path.basename(filePath);
res.setHeader('Content-disposition', 'attachment; filename=' + fileName);
res.send(fileContents);
})
.catch(function (err) {
console.log('Error downloading file: ', err);
});
},
_getFileContents: function (projectNameOrId, filePath) {
if (!projectNameOrId) throw new Error('No Project Specified');
if (typeof filePath !== 'string') throw new Error('No Document Path Specified');
return getDocumentHash(projectNameOrId, filePath)
.then(function (filePathHash) {
return backend.fetchAsync('documents', filePathHash)
.then(function (file) {
// If the file is empty or not found, create an empty file
if (file.data === undefined) {
return backend.submitAsync('documents', filePathHash, {
create: {
type: 'text',
data: ''
}
})
.catch(function (err) {
console.log('LiveDB (_getFileContents) Document Already Exists', err);
})
.then(function () {
return ''; // This document is empty
});
}
return file.data;
});
})
.then(function (fileContents) {
return fileContents;
})
.catch(function (err) {
console.log('Error Fetching Document', err);
});
}
};
module.exports = downloadController;
|
/* eslint-disable */
module.exports = {
dataOrgs: {
'meta': {
'total-rows': '18',
'total-pages': 1
},
'links': {
'self': '/organisations?sort=organisationName&offset=0&rows=200'
},
'data': [
{
'type': 'organisations',
'id': 1,
'attributes': {
'knownAs': 'ABC Ltd',
'name': 'ABC Ltd',
'audit': {
'insertedDate': 1382007600000,
'insertedBy': 2,
'updatedDate': 1467769019000
},
'contactDetails': {
'email': 'info@nomos.co.nz',
'contact': 'You',
'phone': '0800 696 666'
},
'address': {
'addressLine1': '1 Bath Street',
'addressLine2': 'CBD.',
'addressLine3': 'Dunedin',
'city': 'Dunedin',
'state': '9016',
'postcode': '9016',
'country': 'New Zealand'
},
'defaultReminderDays': 30,
'organisationStatus': 'Active',
'licenseType': 'LEGAL SMALL',
'defaultCurrency': 'NZD',
'website': 'www.primoproducts.co.nz',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'salesperson': '1',
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '1 Bath Street, CBD., Dunedin, 9016',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '0800 696 666',
'dueDate': '20th',
'prefixInclude': 'Yes',
'prefix': 'TEST-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxNumber': '123-456-789 Test',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2',
'accessToken': {
'xero': {
'oauthAccessToken': '4JIEWJ7KQGTXCKCXLA7WTR0XKZDNVD',
'oauthAccessTokenSecret': 'IXUBEHUBBZCFJDOZFTDGKPK2SXYOYE',
'connectedAt': 1467772592183,
'accountToInvoice': '200 - Sales'
}
}
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/1/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1'
},
{
'type': 'accounts',
'id': '3'
},
{
'type': 'accounts',
'id': '5'
},
{
'type': 'accounts',
'id': '48'
},
{
'type': 'accounts',
'id': '49'
},
{
'type': 'accounts',
'id': '50'
},
{
'type': 'accounts',
'id': '220'
},
{
'type': 'accounts',
'id': '1406'
}
],
}
}
},
{
'type': 'organisations',
'id': 655,
'attributes': {
'knownAs': 'Asdadadadadaaaa',
'name': 'Asdadadadadaaaa',
'audit': {
'insertedDate': 1447038068000,
'insertedBy': 2,
'updatedDate': 1467756811000
},
'contactDetails': {
'email': 'david.bromley@gmail.com'
},
'address': {
'addressLine1': '23 asfa',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY TEMPTER',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '23 asfa',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/655/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1639'
}
],
}
}
},
{
'type': 'organisations',
'id': 695,
'attributes': {
'knownAs': 'Castle Hill Wind Farm',
'name': 'Castle Hill Wind Farm',
'audit': {
'insertedDate': 1449094234000,
'insertedBy': 378,
'updatedDate': 1467756814000
},
'contactDetails': {
'email': 'admin@nomosone.com',
'contact': 'Admin'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY TEMPTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Admin',
'email': 'admin@nomosone.com',
'chargingCurrency': 'NZD',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/695/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/695/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1727'
},
{
'type': 'accounts',
'id': '1735'
},
{
'type': 'accounts',
'id': '1903'
},
{
'type': 'accounts',
'id': '1904'
},
{
'type': 'accounts',
'id': '1905'
},
{
'type': 'accounts',
'id': '1906'
},
{
'type': 'accounts',
'id': '1907'
},
{
'type': 'accounts',
'id': '2012'
},
{
'type': 'accounts',
'id': '2088'
}
],
}
}
},
{
'type': 'organisations',
'id': 682,
'attributes': {
'knownAs': 'DO NOT TOUCH DEMO MASTER',
'name': 'DO NOT TOUCH DEMO MASTER',
'audit': {
'insertedDate': 1448419971000,
'insertedBy': 2,
'updatedDate': 1467756812000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/682/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1697'
}
],
}
}
},
{
'type': 'organisations',
'id': 697,
'attributes': {
'knownAs': 'David\s Demo Org',
'name': 'David\'s Demo Org',
'audit': {
'insertedDate': 1449196761000,
'updatedDate': 1467756814000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/697/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1729'
}
],
}
}
},
{
'type': 'organisations',
'id': 675,
'attributes': {
'knownAs': 'David\'s Demo Org1',
'name': 'David\'s Demo Org1',
'audit': {
'insertedDate': 1448404716000,
'insertedBy': 2,
'updatedDate': 1467756812000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/675/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1690'
}
],
}
}
},
{
'type': 'organisations',
'id': 677,
'attributes': {
'knownAs': 'David\'s Demo Org2',
'name': 'David\'s Demo Org2',
'audit': {
'insertedDate': 1448413657000,
'insertedBy': 2,
'updatedDate': 1467756812000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/677/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1692'
}
],
}
}
},
{
'type': 'organisations',
'id': 681,
'attributes': {
'knownAs': 'David\'s Demo Org3',
'name': 'David\'s Demo Org3',
'audit': {
'insertedDate': 1448414682000,
'insertedBy': 2,
'updatedDate': 1467756812000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/681/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1696'
}
],
}
}
},
{
'type': 'organisations',
'id': 696,
'attributes': {
'knownAs': 'David\'s Demo Org4',
'name': 'David\'s Demo Org4',
'audit': {
'insertedDate': 1449196378000,
'insertedBy': 2,
'updatedDate': 1467756813000
},
'contactDetails': {
'email': 'dave@nomosone.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'DEMO',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/696/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1728'
}
],
}
}
},
{
'type': 'organisations',
'id': 654,
'attributes': {
'knownAs': 'FRED corp',
'name': 'FRED corp',
'audit': {
'insertedDate': 1447037536000,
'insertedBy': 2,
'updatedDate': 1467764395000
},
'contactDetails': {
'email': 'david.bromley@gmail.com'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY TEMPTER',
'defaultCurrency': 'NZD',
'billing': {
'chargingCurrency': 'NZD',
'isADummy': 'Yes'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2',
'accessToken': {
'xero': {
'oauthAccessToken': 'I88CH8IREEJTQMUIBOZWZPZ67DLTLN',
'oauthAccessTokenSecret': 'EBUSMIQLKST62HIMVAB7FZTO3OCSSU',
'connectedAt': 1467767995857
}
}
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'accounts': {
'links': {
'self': '/organisations/654/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1632'
},
{
'type': 'accounts',
'id': '1633'
},
{
'type': 'accounts',
'id': '1634'
},
{
'type': 'accounts',
'id': '1635'
},
{
'type': 'accounts',
'id': '1636'
},
{
'type': 'accounts',
'id': '1637'
},
{
'type': 'accounts',
'id': '1638'
}
],
}
}
},
{
'type': 'organisations',
'id': 676,
'attributes': {
'knownAs': 'Genesis Corporate Offices',
'name': 'Genesis Corporate Offices',
'audit': {
'insertedDate': 1448406803000,
'insertedBy': 378,
'updatedDate': 1467756809000
},
'contactDetails': {
'email': 'luke.zeilstra@genesisenergy.co.nz',
'contact': 'Admin'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY TEMPTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Admin',
'email': 'luke.zeilstra@genesisenergy.co.nz',
'chargingCurrency': 'NZD',
'isADummy': 'No',
'groupDiscount': 'N'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/676/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/676/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1691'
},
{
'type': 'accounts',
'id': '1789'
},
{
'type': 'accounts',
'id': '1908'
},
{
'type': 'accounts',
'id': '1909'
},
{
'type': 'accounts',
'id': '1910'
},
{
'type': 'accounts',
'id': '1911'
},
{
'type': 'accounts',
'id': '1912'
},
{
'type': 'accounts',
'id': '2089'
}
],
}
}
},
{
'type': 'organisations',
'id': 744,
'attributes': {
'knownAs': 'Hau Nui Wind Farm',
'name': 'Hau Nui Wind Farm',
'audit': {
'insertedDate': 1453075947000,
'insertedBy': 378,
'updatedDate': 1467756813000
},
'contactDetails': {
'email': 'Luke.Zeilstra@genesisenergy.co.nz',
'contact': 'Luke'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY STARTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Luke',
'email': 'Luke.Zeilstra@genesisenergy.co.nz',
'chargingCurrency': 'NZD',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/744/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/744/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1816'
},
{
'type': 'accounts',
'id': '1824'
},
{
'type': 'accounts',
'id': '1913'
},
{
'type': 'accounts',
'id': '1914'
},
{
'type': 'accounts',
'id': '1915'
},
{
'type': 'accounts',
'id': '1916'
},
{
'type': 'accounts',
'id': '1917'
},
{
'type': 'accounts',
'id': '2090'
}
],
}
}
},
{
'type': 'organisations',
'id': 755,
'attributes': {
'knownAs': 'Huntly Power Station',
'name': 'Huntly Power Station',
'audit': {
'insertedDate': 1453666670000,
'insertedBy': 378,
'updatedDate': 1467756813000
},
'contactDetails': {
'email': 'admin@nomosone.com',
'contact': 'Admin'
},
'address': {
'addressLine1': 'asdfsfsf',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY SMALL',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'email': 'luke.zeilstra@genesisenergy.co.nz',
'chargingCurrency': 'NZD',
'billingNotes': ' UPGRADED TO PROPERTY SMALL on 29/02/2016.',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'asdfsfsf',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/755/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/755/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1833'
},
{
'type': 'accounts',
'id': '1874'
},
{
'type': 'accounts',
'id': '1918'
},
{
'type': 'accounts',
'id': '1919'
},
{
'type': 'accounts',
'id': '1920'
},
{
'type': 'accounts',
'id': '1921'
},
{
'type': 'accounts',
'id': '1922'
},
{
'type': 'accounts',
'id': '2013'
},
{
'type': 'accounts',
'id': '2091'
}
],
}
}
},
{
'type': 'organisations',
'id': 742,
'attributes': {
'knownAs': 'Meremere',
'name': 'Meremere',
'audit': {
'insertedDate': 1452630040000,
'insertedBy': 378,
'updatedDate': 1467756813000
},
'contactDetails': {
'email': 'admin@nomosone.com',
'contact': 'Admin'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY STARTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Admin',
'email': 'admin@nomosone.com',
'chargingCurrency': 'NZD',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/742/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/742/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1813'
},
{
'type': 'accounts',
'id': '1825'
},
{
'type': 'accounts',
'id': '1923'
},
{
'type': 'accounts',
'id': '1924'
},
{
'type': 'accounts',
'id': '1925'
},
{
'type': 'accounts',
'id': '1926'
},
{
'type': 'accounts',
'id': '1927'
},
{
'type': 'accounts',
'id': '2092'
}
],
}
}
},
{
'type': 'organisations',
'id': 710,
'attributes': {
'knownAs': 'Slopedown Wind Farm',
'name': 'Slopedown Wind Farm',
'audit': {
'insertedDate': 1449525366000,
'insertedBy': 378,
'updatedDate': 1467756809000
},
'contactDetails': {
'email': 'admin@nomosone.com',
'contact': 'Admin'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY TEMPTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Admin',
'email': 'admin@nomosone.com',
'chargingCurrency': 'NZD',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/710/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/710/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1746'
},
{
'type': 'accounts',
'id': '1788'
},
{
'type': 'accounts',
'id': '1928'
},
{
'type': 'accounts',
'id': '1929'
},
{
'type': 'accounts',
'id': '1930'
},
{
'type': 'accounts',
'id': '1931'
},
{
'type': 'accounts',
'id': '1932'
},
{
'type': 'accounts',
'id': '2093'
}
],
}
}
},
{
'type': 'organisations',
'id': 620,
'attributes': {
'knownAs': 'Tekapo',
'name': 'Tekapo',
'audit': {
'insertedDate': 1442884571000,
'insertedBy': 378,
'updatedDate': 1467756811000
},
'contactDetails': {
'email': 'luke.zeilstra@genesisenergy.co.nz'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY SMALL',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'luke.zeilstra@genesisenergy.co.nz',
'chargingCurrency': 'NZD',
'billingNotes': ' UPGRADED TO PROPERTY SMALL on 01/12/2015.',
'isADummy': 'No',
'groupDiscount': 'N'
},
'salesperson': '1',
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/620/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/620/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1447'
},
{
'type': 'accounts',
'id': '1465'
},
{
'type': 'accounts',
'id': '1933'
},
{
'type': 'accounts',
'id': '1934'
},
{
'type': 'accounts',
'id': '1935'
},
{
'type': 'accounts',
'id': '1936'
},
{
'type': 'accounts',
'id': '1937'
},
{
'type': 'accounts',
'id': '2094'
}
],
}
}
},
{
'type': 'organisations',
'id': 673,
'attributes': {
'knownAs': 'Tongariro',
'name': 'Tongariro',
'audit': {
'insertedDate': 1448319803000,
'insertedBy': 378,
'updatedDate': 1467756815000
},
'contactDetails': {
'email': 'admin@nomosone.com',
'contact': 'Admin'
},
'address': {
'addressLine1': 'NZ',
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY STARTER',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'contact': 'Admin',
'email': 'admin@nomosone.com',
'chargingCurrency': 'NZD',
'billingNotes': ' UPGRADED TO PROPERTY STARTER on 29/02/2016.',
'isADummy': 'No'
},
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': 'NZ',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/673/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/673/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1688'
},
{
'type': 'accounts',
'id': '1826'
},
{
'type': 'accounts',
'id': '1938'
},
{
'type': 'accounts',
'id': '1939'
},
{
'type': 'accounts',
'id': '1940'
},
{
'type': 'accounts',
'id': '1941'
},
{
'type': 'accounts',
'id': '1942'
},
{
'type': 'accounts',
'id': '2095'
}
],
}
}
},
{
'type': 'organisations',
'id': 610,
'attributes': {
'knownAs': 'Waikaremoana',
'name': 'Waikaremoana',
'audit': {
'insertedDate': 1440636407000,
'insertedBy': 947,
'updatedDate': 1467756813000
},
'contactDetails': {
'email': 'luke.zeilstra@genesisenergy.co.nz'
},
'address': {
'country': 'New Zealand'
},
'defaultReminderDays': 90,
'organisationStatus': 'Active',
'licenseType': 'PROPERTY SMALL',
'defaultCurrency': 'NZD',
'billing': {
'organisationId': '607',
'email': 'luke.zeilstra@genesisenergy.co.nz',
'chargingCurrency': 'NZD',
'billingNotes': ' UPGRADED TO PROPERTY SMALL on 01/10/2015.',
'isADummy': 'No'
},
'salesperson': '1',
'defaultAreaUnits': 'm²',
'invoiceDetails': {
'addressInclude': 'Yes',
'address': '',
'taxNumberInclude': 'Yes',
'phoneInclude': 'Yes',
'phone': '',
'dueDate': '1st',
'prefixInclude': 'Yes',
'prefix': 'INV-',
'referenceId': 'SYSID',
'logoInclude': 'Yes',
'taxRate': '15.00',
'taxLabel': 'GST',
'taxRateSysid': '17',
'xeroTaxCode': 'OUTPUT2'
},
'onboarding': {
'doNotCall': 'No'
}
},
'relationships': {
'parent': {
'links': {
'self': '/organisations/610/relationships/parents/',
'related': '/organisations/'
},
'data': {
'type': 'organisations',
'id': '607'
}
},
'accounts': {
'links': {
'self': '/organisations/610/relationships/accounts/',
'related': '/accounts/'
},
'data': [
{
'type': 'accounts',
'id': '1403'
},
{
'type': 'accounts',
'id': '1417'
},
{
'type': 'accounts',
'id': '1943'
},
{
'type': 'accounts',
'id': '1944'
},
{
'type': 'accounts',
'id': '1945'
},
{
'type': 'accounts',
'id': '1946'
},
{
'type': 'accounts',
'id': '1947'
},
{
'type': 'accounts',
'id': '2096'
}
],
}
}
}
],
}
}
|
import React from 'react';
import TitleComponent from './TitleComponent';
import { mount } from 'enzyme';
import sinon from 'sinon';
describe('(Component) TitleComponent', () => {
let _component;
const _dispatch = sinon.spy();
const incrementFunc = sinon.spy();
const _actions = {
incrementCounter: incrementFunc
};
beforeEach(() => {
_component = mount(<TitleComponent count={0} dispatch={_dispatch} actions={_actions} />);
});
it('Can mount', () => {
expect(_component.type()).to.equal(TitleComponent);
expect(_component.html()).to.equal('<div>hi!</div>');
});
});
|
/// <reference path="~/Scripts/_references.js" />
Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer = function (list) {
/// <summary>
/// Renders an infinite scrolling list. As the user reaches the bottom of the list, new rows will be requested from the listener.
/// </summary>
/// <param name="list">The list to render.</param>
var self = this;
self.base.constructor.call(self, list, "infiniteScrollList-template");
self.rowsChangeSubscription = self.rows.subscribe(function (changes) {
// listen to the rows array changes
window.setTimeout(function (self) {
if (list.isShown()) {
// if rows were deleted for instance, we would like to ensure that the remaining space is filled with the next batch of rows
// in order to guarantee a scroll bar appearance and avoid not being able to see the next rows
self.ensureOccupancy();
}
}, 0, self);
}, self, "arrayChange");
self.onListRenderingFinished = function (elements, data) {
// self function will be called after rendering the list is done, this is need to ensure that we fill up the list real estate
// with rows to avoid the lack of scrollbar problem
if (this.foreach[this.foreach.length - 1] === data) {
// ahuh, this is the last row rendered!
if (list.isShown()) {
self.ensureOccupancy();
}
}
};
}
// inherit ListRenderer
$WebPortal.Helpers.inherit(Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer, Microsoft.WebPortal.Views.List.ListRenderer);
Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer.prototype.onListScrolled = function (self) {
/// <summary>
/// Called when the list body is scrolled.
/// </summary>
/// <param name="self">The renderer instance.</param>
var listBodySelector = self.list.elementSelector + self.list.webPortal.Settings.List.ListBodySelector;
var verticalScroll = $(listBodySelector).scrollTop();
if (self.isComplete() || self.isFetchingRows) {
return;
}
if (verticalScroll != self.verticalScroll) {
var totalHeight = $(listBodySelector)[0].scrollHeight;
var currentScroll = verticalScroll + $(listBodySelector).height();
self.verticalScroll = verticalScroll;
if (currentScroll >= totalHeight * self.list.webPortal.Configuration.List.Sensitivity) {
// get more items only if the scroll has nearly reached the end and we know that there are more
// items and we are not currently in the process of fetching more items
self.requestMoreRows(self.rows().length, self.pageSize());
}
}
}
Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer.prototype.ensureOccupancy = function () {
/// <summary>
/// Called to ensure that the list body fills it real estate with rows.
/// </summary>
if (this.isComplete() || this.isFetchingRows) {
return;
}
var listBodySelector = this.list.elementSelector + this.list.webPortal.Settings.List.ListBodySelector;
var totalRowNumberNeeded = this.pageSize();
var fullCapacityHeight = $(listBodySelector).height();
var currentCapacityHeight = $(listBodySelector + " > table").height();
if (!fullCapacityHeight) {
$WebPortal.Diagnostics.warning("Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer.ensureOccupancy: full capacity height is zero. Fetching a whole page.");
} else if (currentCapacityHeight <= fullCapacityHeight) {
// we have a problem, let's fetch more entities to cause the scrollbar to be enabled,
// if the currentCapacityHeight is zero, this means that the list is not being shown and we should not worry about paging it
var percentageOccupied = currentCapacityHeight / fullCapacityHeight;
if (percentageOccupied) {
// compute the number of total entities needed to cause a scroll
totalRowNumberNeeded = Math.ceil(this.rows().length / percentageOccupied);
// compute the number of extra entities we need to download
totalRowNumberNeeded -= this.rows().length;
}
} else {
// we are ok
return;
}
// fetch the needed number of entities
this.requestMoreRows(this.rows().length, totalRowNumberNeeded);
}
Microsoft.WebPortal.Views.List.InfiniteScrollingRenderer.prototype.destroy = function () {
/// <summary>
/// Destorys the renderer.
/// </summary>
// stop listening to row changes
if (this.rowsChangeSubscription) {
this.rowsChangeSubscription.dispose();
this.rowsChangeSubscription = null;
}
}
//@ sourceURL=InfiniteScrollingRenderer.js
|
var StreamEventController = function ($scope, EventStorageService) {
$scope.removeEvent = function () {
EventStorageService.removeEvent($scope.eventIndex);
}
};
var StreamEventLinker = function ($scope, element) {
}
app.directive('streamEvent', function(WebSocketService) {
return {
restrict: 'A',
scope: {
event: '=',
eventIndex: '='
},
templateUrl: 'templates/template-stream-event.html',
controller: StreamEventController,
link: StreamEventLinker
};
});
|
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return {
name: "Louis"
};
}
});
|
(function() {
function cookie(key, value, end, path, domain, secure) {
if (arguments.length === 1) {
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
}
if (!key || /^(?:expires|max\-age|path|domain|secure)$/i.test(key)) { return false; }
var expires = "";
if (end) {
switch (end.constructor) {
case Number:
expires = end === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + end;
break;
case String:
expires = "; expires=" + end;
break;
case Date:
expires = "; expires=" + end.toUTCString();
break;
}
}
document.cookie = encodeURIComponent(key) + "=" + encodeURIComponent(value) + expires + (domain ? "; domain=" + domain : "") + (path ? "; path=" + path : "") + (secure ? "; secure" : "");
return true;
}
$(document).ready(function() {
ThemeChooser.publishTheme(window.kendoTheme);
});
var doc = document,
extend = $.extend,
proxy = $.proxy,
kendo = window.kendo,
animation = {
show: {
effects: "fadeIn",
duration: 300
},
hide: {
effects: "fadeOut",
duration: 300
}
},
skinRegex = /kendo\.[\w\-]+(\.min)?\.css/i;
var Details = kendo.ui.Widget.extend({
init: function(element, options) {
kendo.ui.Widget.fn.init.call(this, element, options);
this._summary = this.element.find(".tc-activator")
.on("click", proxy(this.toggle, this));
this._container = kendo.wrap(this._summary.next(), true);
this._container.css("display", "none");
},
options: {
name: "Details"
},
toggle: function() {
var show = this._container.is(":visible");
var animation = kendo.fx(this._container).expand("vertical");
animation.stop()[show ? "reverse" : "play"]();
this._summary.toggleClass("tc-active", !show);
}
});
kendo.ui.plugin(Details);
var ThemeChooser = kendo.ui.ListView.extend({
init: function(element, options) {
kendo.ui.ListView.fn.init.call(this, element, options);
this.bind("change", this._updateTheme);
},
options: {
name: "ThemeChooser",
template: "",
selectable: true,
value: ""
},
dataItem: function(element) {
var uid = $(element).closest("[data-uid]").attr("data-uid");
return this.dataSource.getByUid(uid);
},
_updateTheme: function(e) {
// make the item available to event listeners
e.item = this.dataItem(this.select());
// change theme
var themeName = e.item.value;
var commonFile = ThemeChooser.getCommonUrl();
if (/material/i.test(themeName) && !/material/i.test(commonFile)) {
commonFile = "common-material";
} else if (/bootstrap/i.test(themeName) && !/bootstrap/i.test(commonFile)) {
commonFile = "common-bootstrap";
} else if (/fiori/i.test(themeName) && !/fiori/i.test(commonFile)) {
commonFile = "common-fiori";
} else if (/office365/i.test(themeName) && !/office365/i.test(commonFile)) {
commonFile = "common-office365";
} else if (/nova/i.test(themeName) && !/nova/i.test(commonFile)) {
commonFile = "common-nova";
} else if (!/material|bootstrap|fiori|nova/i.test(themeName)) {
commonFile = "common";
}
ThemeChooser.changeThemePair(themeName, commonFile, true)
.then(proxy(this.trigger, this, "transition"));
},
value: function(value) {
if (!arguments.length) {
var dataItem = this.dataItem(this.select());
return dataItem.name;
}
var data = this.dataSource.data();
for (var i = 0; i < data.length; i++) {
if (data[i].value == value) {
this.select(this.element.find("[data-uid='" + data[i].uid + "']"));
break;
}
}
}
});
var ThemeChooserViewModel = kendo.observable({
themes: [
{ value: "black", name: "Black", colors: [ "#0167cc", "#4698e9", "#272727" ] },
{ value: "blueopal", name: "Blue Opal", colors: [ "#076186", "#7ed3f6", "#94c0d2" ] },
{ value: "bootstrap", name: "Bootstrap", colors: [ "#3276b1", "#67afe9", "#fff" ] },
{ value: "default", name: "Default", colors: [ "#ef6f1c", "#e24b17", "#5a4b43" ] },
{ value: "fiori", name: "Fiori", colors: ["#007cc0", "#e6f2f9", "#f0f0f0"] },
{ value: "flat", name: "Flat", colors: [ "#363940", "#2eb3a6", "#fff" ] },
{ value: "highcontrast", name: "High Contrast", colors: [ "#b11e9c", "#880275", "#1b141a" ] },
{ value: "material", name: "Material", colors: [ "#3f51b5", "#283593", "#fff" ] },
{ value: "materialblack", name: "Material Black", colors: ["#3f51b5", "#1c1c1c", "#4d4d4d"] },
{ value: "metro", name: "Metro", colors: [ "#8ebc00", "#787878", "#fff" ] },
{ value: "metroblack", name: "Metro Black", colors: [ "#00aba9", "#0e0e0e", "#565656" ] },
{ value: "moonlight", name: "Moonlight", colors: [ "#ee9f05", "#40444f", "#212a33" ] },
{ value: "nova", name: "Nova", colors: ["#ff4350", "#00acc1", "#303553"] },
{ value: "office365", name: "Office 365", colors: ["#0072c6", "#cde6f7", "#fff"] },
{ value: "silver", name: "Silver", colors: [ "#298bc8", "#515967", "#eaeaec" ] },
{ value: "uniform", name: "Uniform", colors: [ "#666", "#ccc", "#fff" ] }
],
sizes: [
{ name: "Standard", value: "common" },
{ name: "Bootstrap", value: "common-bootstrap", relativity: "larger" },
{ name: "Material", value: "common-material", relativity: "bold" },
{ name: "Nova", value: "common-nova", relativity: "bold" },
{ name: "Fiori", value: "common-fiori", relativity: "larger" },
{ name: "Office365", value: "common-office365", relativity: "bold" }
],
selectedTheme: window.kendoTheme,
selectedSize: window.kendoCommonFile
});
kendo.ui.plugin(ThemeChooser);
window.ThemeChooserViewModel = ThemeChooserViewModel;
$(document).ready(function() {
kendo.bind($("[data-rel=themechooser]"), ThemeChooserViewModel);
});
extend(ThemeChooser, {
preloadStylesheet: function (file, callback) {
var deferred = $.Deferred();
var element = $("<link rel='stylesheet' media='print' href='" + file + "' />");
element.appendTo("head");
deferred.then(callback);
setTimeout(function () {
deferred.resolve();
element.remove();
}, 100);
return deferred.promise();
},
getCurrentCommonLink: function () {
return $("head link").filter(function () {
return (/kendo\.common/gi).test(this.href);
});
},
getCurrentThemeLink: function () {
return $("head link").filter(function () {
return (/kendo\./gi).test(this.href) && !(/common|rtl|dataviz|mobile/gi).test(this.href);
});
},
getCommonUrl: function (common) {
var currentCommonUrl = ThemeChooser.getCurrentCommonLink().attr("href");
return currentCommonUrl.replace(skinRegex, "kendo." + common + "$1.css");
},
getThemeUrl: function (themeName) {
var currentThemeUrl = ThemeChooser.getCurrentThemeLink().attr("href");
return currentThemeUrl.replace(skinRegex, "kendo." + themeName + "$1.css");
},
replaceCommon: function(commonName) {
var newCommonUrl = ThemeChooser.getCommonUrl(commonName),
themeLink = ThemeChooser.getCurrentCommonLink();
ThemeChooser.updateLink(themeLink, newCommonUrl);
cookie("commonFile", commonName, Infinity, "/");
},
updateLink: function(link, url) {
var exampleElement = $("#example");
link.eq(0).attr("href", url);
if (exampleElement.length) {
exampleElement[0].style.cssText = exampleElement[0].style.cssText;
}
},
replaceTheme: function(themeName) {
var newThemeUrl = ThemeChooser.getThemeUrl(themeName),
oldThemeName = $(doc).data("kendoSkin"),
themeLink = ThemeChooser.getCurrentThemeLink();
ThemeChooser.updateLink(themeLink, newThemeUrl);
$(doc.documentElement).removeClass("k-" + oldThemeName).addClass("k-" + themeName);
ThemeChooser.publishTheme(themeName);
cookie("theme", themeName, Infinity, "/");
},
publishTheme: function (themeName) {
var themable = ["Chart", "TreeMap", "Diagram", "StockChart", "Sparkline", "RadialGauge", "LinearGauge"];
if (kendo.dataviz && themeName) {
for (var i = 0; i < themable.length; i++) {
var widget = kendo.dataviz.ui[themable[i]];
if (widget) {
widget.fn.options.theme = themeName;
}
}
}
if (themeName) {
$(doc).data("kendoSkin", themeName);
}
$("#example").trigger("kendo:skinChange");
},
currentlyUsing: function(href) {
if (/common/.test(href)) {
return ThemeChooser.getCurrentCommonLink().attr("href") == href;
} else {
return ThemeChooser.getCurrentThemeLink().attr("href") == href;
}
},
animateCssChange: function(options) {
options = $.extend({ complete: $.noop, replace: $.noop }, options);
var prefetch = options.prefetch;
if (!$.isArray(prefetch)) {
prefetch = [prefetch];
}
prefetch = $.grep(prefetch, function(x) {
return !ThemeChooser.currentlyUsing(x);
});
if (!prefetch.length) {
return;
}
$.when.apply($, $.map(prefetch, ThemeChooser.preloadStylesheet)).then(function() {
var example = $("#example");
example.kendoStop().kendoAnimate(extend({}, animation.hide, {
complete: function (element) {
if (element[0] == example[0]) {
example.css("visibility", "hidden");
options.replace();
setTimeout(function () {
example
.css("visibility", "visible")
.kendoStop()
.kendoAnimate(animation.show);
if (prefetch.join(":").indexOf("common") > -1) {
kendo.resize(example, true);
}
options.complete();
}, 100);
}
}
}));
});
},
changeCommon: function(commonName) {
ThemeChooser.animateCssChange({
prefetch: ThemeChooser.getCommonUrl(commonName),
replace: function() {
ThemeChooser.replaceCommon(commonName);
}
});
},
changeTheme: function(themeName, animate, complete) {
// Set transparent background to the chart area.
extend(kendo.dataviz.ui.themes[themeName].chart, { chartArea: { background: "transparent"} });
if (animate) {
ThemeChooser.animateCssChange({
prefetch: ThemeChooser.getThemeUrl(themeName),
replace: function() {
ThemeChooser.replaceTheme(themeName);
},
complete: complete
});
} else {
ThemeChooser.replaceTheme(themeName);
}
},
changeThemePair: function(themeName, commonName) {
var deferred = $.Deferred();
ThemeChooser.animateCssChange({
prefetch: [
ThemeChooser.getCommonUrl(commonName),
ThemeChooser.getThemeUrl(themeName)
],
replace: function() {
window.kendoTheme = themeName;
window.kendoCommonFile = commonName;
ThemeChooser.replaceCommon(commonName);
ThemeChooser.replaceTheme(themeName);
},
complete: function() {
deferred.resolve();
}
});
return deferred.promise();
}
});
window.kendoThemeChooser = ThemeChooser;
})();
|
import { run } from '@ember/runloop';
import Application from '../../app';
import config from '../../config/environment';
export default function startApp(attrs) {
let attributes = Object.assign({}, config.APP);
attributes = Object.assign(attributes, attrs); // use defaults, but you can override;
return run(() => {
let application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
return application;
});
}
|
let pnp;
try {
pnp = require(`pnpapi`);
} catch (error) {
// not in PnP; not a problem
}
let defaultResolver;
function requireDefaultResolver() {
if (!defaultResolver) {
try {
defaultResolver = require(`jest-resolve/build/defaultResolver`).default;
} catch (error) {
defaultResolver = require(`jest-resolve/build/default_resolver`).default;
}
}
return defaultResolver;
}
module.exports = (request, options) => {
const {basedir, defaultResolver, extensions} = options;
if (pnp) {
const resolution = pnp.resolveRequest(request, `${basedir}/`, {extensions});
// When the request is a native module, Jest expects to get the string back unmodified, but pnp returns null instead.
if (resolution === null)
return request;
return resolution;
} else {
if (!defaultResolver)
defaultResolver = requireDefaultResolver();
return defaultResolver(request, options);
}
};
|
'use strict';
/**
* EventHandler
*/
var util = require('util'),
events = require('events');
var EventHandler = function(instance) {
events.EventEmitter.call(this);
this.instance = instance;
this.supportedEvents = ['on','once','removeListener','removeAllListeners','emit'];
/**
* expose EventEmitter function to WebdriverJS instance
* it's a bit hacky solution but the only way to pass functions within methods which
* will not treat as callbacks
*/
this.supportedEvents.forEach(this.registerCommands.bind(this));
};
// inherit functionality from evenst.EventEmitter
util.inherits(EventHandler, events.EventEmitter);
/**
* register sync function to an async chain
* @param {String[]} funcName list of commands which should be added to the webdriver instance
*/
EventHandler.prototype.registerCommands = function(funcName) {
var self = this;
if(typeof this[funcName] !== 'function') {
return true;
}
/**
* register EventEmitter function to WebdriverJS instance.
* The function itself basically just creates a temporary
* custom command which gets executed immediately. With
* this approach it is possible to chain synchronous logic
* within asyncronous workflow.
*/
this.instance[funcName] = function() {
var args = Array.prototype.slice.call(arguments),
eventName = args[0];
/**
* create temporary custom command. In order to keep
* the event namespace clean and to avoid overriding
* a user event by accident two underscore character
* get prepended.
*/
self.instance.addCommand('__' + funcName, function(cb) {
/**
* populate instance events to multibrowser eventhandler
*/
if(self.instance.constructor.name === 'Multibrowser') {
for(var instanceName in self.instance.instances) {
var instanceEventHandler = self.instance.instances[instanceName].eventHandler;
instanceEventHandler[funcName].apply(instanceEventHandler, args);
}
return cb();
}
self[funcName].apply(self, args);
cb();
});
/**
* execute custom command immediately
*/
self.instance['__' + funcName]();
/**
* remove custom command to avoid a possible double execution
*/
self.instance['__' + funcName] = undefined;
/**
* return "this" to make commands chainable
*/
return self.instance;
};
};
module.exports = EventHandler;
|
var assert = require("assert"),
should = require("should"),
Flavordb = require("../src/flavordb").Flavordb;
var Product = require("../src/product").Product,
Business = require("../src/business").Business,
ProductCategory=require("../src/product_category").ProductCategory;
var fdb = new Flavordb();
describe('Business', function () {
describe('##count()', function () {
it('should get the number of products in existence', function (done) {
var old_count = Business.count();
fdb.getBusinessById(16).then(
function (product_category) {
var new_count = Business.count();
(new_count - old_count).should.eql(1);
done();
}
);
});
});
describe('caching', function () {
it('should return cached objects if they\'re already in memory', function (done) {
fdb.getBusinessById(16).then(
function () {
var old_count = Business.count();
fdb.getBusinessById(16).then(
function (product_category) {
var new_count = Business.count();
(new_count - old_count).should.eql(0);
done();
}
);
}
);
});
});
describe('#getProducts', function () {
it('should return an array of products', function (done) {
fdb.getBusinessById(155).then(
function (business) {
business.getProducts().then(
function (products) {
should.exist(products);
products[0].should.be.an.instanceof(Product);
done();
}
);
}
);
});
});
})
|
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'rxjs': 'node_modules/rxjs',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'@angular': 'node_modules/@angular'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { defaultExtension: 'js' },
};
var packageNames = [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/http',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'@angular/router-deprecated',
'@angular/testing',
'@angular/upgrade',
];
// add package entries for angular packages in the form '@angular/common': { main: 'index.js', defaultExtension: 'js' }
packageNames.forEach(function(pkgName) {
packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});
var config = {
map: map,
packages: packages
}
// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }
System.config(config);
})(this);
|
{
"AD" : "AD",
"Africa/Abidjan_Z_abbreviated" : "GMT",
"Africa/Abidjan_Z_short" : "GMT",
"Africa/Accra_Z_abbreviated" : "GMT",
"Africa/Accra_Z_short" : "GMT",
"Africa/Addis_Ababa_Z_abbreviated" : "Ethiopia Time",
"Africa/Addis_Ababa_Z_short" : "EAT",
"Africa/Algiers_Z_abbreviated" : "Algeria Time",
"Africa/Algiers_Z_short" : "WET",
"Africa/Asmara_Z_abbreviated" : "Eritrea Time",
"Africa/Asmara_Z_short" : "EAT",
"Africa/Bamako_Z_abbreviated" : "GMT",
"Africa/Bamako_Z_short" : "GMT",
"Africa/Bangui_Z_abbreviated" : "Central African Republic Time",
"Africa/Bangui_Z_short" : "WAT",
"Africa/Banjul_Z_abbreviated" : "GMT",
"Africa/Banjul_Z_short" : "GMT",
"Africa/Bissau_Z_abbreviated" : "Guinea-Bissau Time",
"Africa/Bissau_Z_short" : "GMT-01:00",
"Africa/Blantyre_Z_abbreviated" : "Malawi Time",
"Africa/Blantyre_Z_short" : "CAT",
"Africa/Brazzaville_Z_abbreviated" : "Congo - Brazzaville Time",
"Africa/Brazzaville_Z_short" : "WAT",
"Africa/Bujumbura_Z_abbreviated" : "Burundi Time",
"Africa/Bujumbura_Z_short" : "CAT",
"Africa/Cairo_Z_abbreviated" : "Egypt Time",
"Africa/Cairo_Z_short" : "EET",
"Africa/Casablanca_Z_abbreviated" : "Morocco Time",
"Africa/Casablanca_Z_short" : "WET",
"Africa/Conakry_Z_abbreviated" : "GMT",
"Africa/Conakry_Z_short" : "GMT",
"Africa/Dakar_Z_abbreviated" : "GMT",
"Africa/Dakar_Z_short" : "GMT",
"Africa/Dar_es_Salaam_Z_abbreviated" : "Tanzania Time",
"Africa/Dar_es_Salaam_Z_short" : "EAT",
"Africa/Djibouti_Z_abbreviated" : "Djibouti Time",
"Africa/Djibouti_Z_short" : "EAT",
"Africa/Douala_Z_abbreviated" : "Cameroon Time",
"Africa/Douala_Z_short" : "WAT",
"Africa/El_Aaiun_Z_abbreviated" : "Western Sahara Time",
"Africa/El_Aaiun_Z_short" : "GMT-01:00",
"Africa/Freetown_Z_abbreviated" : "GMT",
"Africa/Freetown_Z_short" : "GMT",
"Africa/Gaborone_Z_abbreviated" : "Botswana Time",
"Africa/Gaborone_Z_short" : "CAT",
"Africa/Harare_Z_abbreviated" : "Zimbabwe Time",
"Africa/Harare_Z_short" : "CAT",
"Africa/Johannesburg_Z_abbreviated" : "South Africa Time",
"Africa/Johannesburg_Z_short" : "SAST",
"Africa/Juba_Z_abbreviated" : "Sudan Time",
"Africa/Juba_Z_short" : "CAT",
"Africa/Kampala_Z_abbreviated" : "Uganda Time",
"Africa/Kampala_Z_short" : "EAT",
"Africa/Khartoum_Z_abbreviated" : "Sudan Time",
"Africa/Khartoum_Z_short" : "CAT",
"Africa/Kigali_Z_abbreviated" : "Rwanda Time",
"Africa/Kigali_Z_short" : "CAT",
"Africa/Kinshasa_Z_abbreviated" : "Congo - Kinshasa (Kinshasa)",
"Africa/Kinshasa_Z_short" : "WAT",
"Africa/Lagos_Z_abbreviated" : "Nigeria Time",
"Africa/Lagos_Z_short" : "WAT",
"Africa/Libreville_Z_abbreviated" : "Gabon Time",
"Africa/Libreville_Z_short" : "WAT",
"Africa/Lome_Z_abbreviated" : "GMT",
"Africa/Lome_Z_short" : "GMT",
"Africa/Luanda_Z_abbreviated" : "Angola Time",
"Africa/Luanda_Z_short" : "WAT",
"Africa/Lusaka_Z_abbreviated" : "Zambia Time",
"Africa/Lusaka_Z_short" : "CAT",
"Africa/Malabo_Z_abbreviated" : "Equatorial Guinea Time",
"Africa/Malabo_Z_short" : "WAT",
"Africa/Maputo_Z_abbreviated" : "Mozambique Time",
"Africa/Maputo_Z_short" : "CAT",
"Africa/Maseru_Z_abbreviated" : "Lesotho Time",
"Africa/Maseru_Z_short" : "SAST",
"Africa/Mbabane_Z_abbreviated" : "Swaziland Time",
"Africa/Mbabane_Z_short" : "SAST",
"Africa/Mogadishu_Z_abbreviated" : "Somalia Time",
"Africa/Mogadishu_Z_short" : "EAT",
"Africa/Monrovia_Z_abbreviated" : "Liberia Time",
"Africa/Monrovia_Z_short" : "GMT-00:44:30",
"Africa/Nairobi_Z_abbreviated" : "Kenya Time",
"Africa/Nairobi_Z_short" : "EAT",
"Africa/Ndjamena_Z_abbreviated" : "Chad Time",
"Africa/Ndjamena_Z_short" : "WAT",
"Africa/Niamey_Z_abbreviated" : "Niger Time",
"Africa/Niamey_Z_short" : "WAT",
"Africa/Nouakchott_Z_abbreviated" : "GMT",
"Africa/Nouakchott_Z_short" : "GMT",
"Africa/Ouagadougou_Z_abbreviated" : "GMT",
"Africa/Ouagadougou_Z_short" : "GMT",
"Africa/Porto-Novo_Z_abbreviated" : "Benin Time",
"Africa/Porto-Novo_Z_short" : "WAT",
"Africa/Sao_Tome_Z_abbreviated" : "GMT",
"Africa/Sao_Tome_Z_short" : "GMT",
"Africa/Tripoli_Z_abbreviated" : "Libya Time",
"Africa/Tripoli_Z_short" : "EET",
"Africa/Tunis_Z_abbreviated" : "Tunisia Time",
"Africa/Tunis_Z_short" : "CET",
"Africa/Windhoek_Z_abbreviated" : "Namibia Time",
"Africa/Windhoek_Z_short" : "SAST",
"America/Anguilla_Z_abbreviated" : "AST",
"America/Anguilla_Z_short" : "AST",
"America/Antigua_Z_abbreviated" : "AST",
"America/Antigua_Z_short" : "AST",
"America/Araguaina_Z_abbreviated" : "Brazil (Araguaina)",
"America/Araguaina_Z_short" : "BRT",
"America/Argentina/Buenos_Aires_Z_abbreviated" : "Argentina (Buenos Aires)",
"America/Argentina/Buenos_Aires_Z_short" : "ART",
"America/Argentina/Catamarca_Z_abbreviated" : "Argentina (Catamarca)",
"America/Argentina/Catamarca_Z_short" : "ART",
"America/Argentina/Cordoba_Z_abbreviated" : "Argentina (Cordoba)",
"America/Argentina/Cordoba_Z_short" : "ART",
"America/Argentina/Jujuy_Z_abbreviated" : "Argentina (Jujuy)",
"America/Argentina/Jujuy_Z_short" : "ART",
"America/Argentina/La_Rioja_Z_abbreviated" : "Argentina (La Rioja)",
"America/Argentina/La_Rioja_Z_short" : "ART",
"America/Argentina/Mendoza_Z_abbreviated" : "Argentina (Mendoza)",
"America/Argentina/Mendoza_Z_short" : "ART",
"America/Argentina/Rio_Gallegos_Z_abbreviated" : "Argentina (Rio Gallegos)",
"America/Argentina/Rio_Gallegos_Z_short" : "ART",
"America/Argentina/Salta_Z_abbreviated" : "Argentina (Salta)",
"America/Argentina/Salta_Z_short" : "ART",
"America/Argentina/San_Juan_Z_abbreviated" : "Argentina (San Juan)",
"America/Argentina/San_Juan_Z_short" : "ART",
"America/Argentina/San_Luis_Z_abbreviated" : "Argentina (San Luis)",
"America/Argentina/San_Luis_Z_short" : "ART",
"America/Argentina/Tucuman_Z_abbreviated" : "Argentina (Tucuman)",
"America/Argentina/Tucuman_Z_short" : "ART",
"America/Argentina/Ushuaia_Z_abbreviated" : "Argentina (Ushuaia)",
"America/Argentina/Ushuaia_Z_short" : "ART",
"America/Aruba_Z_abbreviated" : "AST",
"America/Aruba_Z_short" : "AST",
"America/Asuncion_Z_abbreviated" : "Paraguay Time",
"America/Asuncion_Z_short" : "PYT",
"America/Bahia_Banderas_Z_abbreviated" : "PST",
"America/Bahia_Banderas_Z_short" : "PST",
"America/Bahia_Z_abbreviated" : "Brazil (Bahia)",
"America/Bahia_Z_short" : "BRT",
"America/Barbados_Z_abbreviated" : "AST",
"America/Barbados_Z_short" : "AST",
"America/Belem_Z_abbreviated" : "Brazil (Belem)",
"America/Belem_Z_short" : "BRT",
"America/Belize_Z_abbreviated" : "CST",
"America/Belize_Z_short" : "CST",
"America/Blanc-Sablon_Z_abbreviated" : "AST",
"America/Blanc-Sablon_Z_short" : "AST",
"America/Boa_Vista_Z_abbreviated" : "Brazil (Boa Vista)",
"America/Boa_Vista_Z_short" : "AMT",
"America/Bogota_Z_abbreviated" : "Colombia Time",
"America/Bogota_Z_short" : "COT",
"America/Boise_Z_abbreviated" : "MT",
"America/Boise_Z_short" : "MST",
"America/Cambridge_Bay_Z_abbreviated" : "MST",
"America/Cambridge_Bay_Z_short" : "MST",
"America/Campo_Grande_Z_abbreviated" : "Brazil (Campo Grande)",
"America/Campo_Grande_Z_short" : "AMT",
"America/Cancun_Z_abbreviated" : "CST",
"America/Cancun_Z_short" : "CST",
"America/Caracas_Z_abbreviated" : "Venezuela Time",
"America/Caracas_Z_short" : "VET",
"America/Cayenne_Z_abbreviated" : "French Guiana Time",
"America/Cayenne_Z_short" : "GFT",
"America/Cayman_Z_abbreviated" : "EST",
"America/Cayman_Z_short" : "EST",
"America/Chicago_Z_abbreviated" : "CT",
"America/Chicago_Z_short" : "CST",
"America/Chihuahua_Z_abbreviated" : "CST",
"America/Chihuahua_Z_short" : "CST",
"America/Costa_Rica_Z_abbreviated" : "CST",
"America/Costa_Rica_Z_short" : "CST",
"America/Cuiaba_Z_abbreviated" : "Brazil (Cuiaba)",
"America/Cuiaba_Z_short" : "AMT",
"America/Curacao_Z_abbreviated" : "AST",
"America/Curacao_Z_short" : "AST",
"America/Danmarkshavn_Z_abbreviated" : "Greenland (Danmarkshavn)",
"America/Danmarkshavn_Z_short" : "WGT",
"America/Denver_Z_abbreviated" : "MT",
"America/Denver_Z_short" : "MST",
"America/Detroit_Z_abbreviated" : "EST",
"America/Detroit_Z_short" : "EST",
"America/Dominica_Z_abbreviated" : "AST",
"America/Dominica_Z_short" : "AST",
"America/Edmonton_Z_abbreviated" : "MT",
"America/Edmonton_Z_short" : "MST",
"America/Eirunepe_Z_abbreviated" : "Brazil (Eirunepe)",
"America/Eirunepe_Z_short" : "ACT (Acre)",
"America/El_Salvador_Z_abbreviated" : "CST",
"America/El_Salvador_Z_short" : "CST",
"America/Fortaleza_Z_abbreviated" : "Brazil (Fortaleza)",
"America/Fortaleza_Z_short" : "BRT",
"America/Goose_Bay_Z_abbreviated" : "AT",
"America/Goose_Bay_Z_short" : "AST",
"America/Grand_Turk_Z_abbreviated" : "EST",
"America/Grand_Turk_Z_short" : "EST",
"America/Grenada_Z_abbreviated" : "AST",
"America/Grenada_Z_short" : "AST",
"America/Guadeloupe_Z_abbreviated" : "AST",
"America/Guadeloupe_Z_short" : "AST",
"America/Guatemala_Z_abbreviated" : "CST",
"America/Guatemala_Z_short" : "CST",
"America/Guayaquil_Z_abbreviated" : "Ecuador (Guayaquil)",
"America/Guayaquil_Z_short" : "ECT",
"America/Guyana_Z_abbreviated" : "Guyana Time",
"America/Guyana_Z_short" : "GYT",
"America/Halifax_Z_abbreviated" : "AT",
"America/Halifax_Z_short" : "AST",
"America/Havana_Z_abbreviated" : "Cuba Time",
"America/Havana_Z_short" : "CST (Cuba)",
"America/Hermosillo_Z_abbreviated" : "PST",
"America/Hermosillo_Z_short" : "PST",
"America/Indiana/Indianapolis_Z_abbreviated" : "ET",
"America/Indiana/Indianapolis_Z_short" : "EST",
"America/Indiana/Knox_Z_abbreviated" : "CT",
"America/Indiana/Knox_Z_short" : "CST",
"America/Indiana/Marengo_Z_abbreviated" : "ET",
"America/Indiana/Marengo_Z_short" : "EST",
"America/Indiana/Petersburg_Z_abbreviated" : "CT",
"America/Indiana/Petersburg_Z_short" : "CST",
"America/Indiana/Tell_City_Z_abbreviated" : "ET",
"America/Indiana/Tell_City_Z_short" : "EST",
"America/Indiana/Vevay_Z_abbreviated" : "ET",
"America/Indiana/Vevay_Z_short" : "EST",
"America/Indiana/Vincennes_Z_abbreviated" : "ET",
"America/Indiana/Vincennes_Z_short" : "EST",
"America/Indiana/Winamac_Z_abbreviated" : "ET",
"America/Indiana/Winamac_Z_short" : "EST",
"America/Iqaluit_Z_abbreviated" : "EST",
"America/Iqaluit_Z_short" : "EST",
"America/Jamaica_Z_abbreviated" : "EST",
"America/Jamaica_Z_short" : "EST",
"America/Juneau_Z_abbreviated" : "PT",
"America/Juneau_Z_short" : "PST",
"America/Kentucky/Louisville_Z_abbreviated" : "ET",
"America/Kentucky/Louisville_Z_short" : "EST",
"America/Kentucky/Monticello_Z_abbreviated" : "CT",
"America/Kentucky/Monticello_Z_short" : "CST",
"America/La_Paz_Z_abbreviated" : "Bolivia Time",
"America/La_Paz_Z_short" : "BOT",
"America/Lima_Z_abbreviated" : "Peru Time",
"America/Lima_Z_short" : "PET",
"America/Los_Angeles_Z_abbreviated" : "PT",
"America/Los_Angeles_Z_short" : "PST",
"America/Maceio_Z_abbreviated" : "Brazil (Maceio)",
"America/Maceio_Z_short" : "BRT",
"America/Managua_Z_abbreviated" : "CST",
"America/Managua_Z_short" : "CST",
"America/Manaus_Z_abbreviated" : "Brazil (Manaus)",
"America/Manaus_Z_short" : "AMT",
"America/Martinique_Z_abbreviated" : "AST",
"America/Martinique_Z_short" : "AST",
"America/Matamoros_Z_abbreviated" : "CST",
"America/Matamoros_Z_short" : "CST",
"America/Mazatlan_Z_abbreviated" : "PST",
"America/Mazatlan_Z_short" : "PST",
"America/Menominee_Z_abbreviated" : "EST",
"America/Menominee_Z_short" : "EST",
"America/Merida_Z_abbreviated" : "CST",
"America/Merida_Z_short" : "CST",
"America/Mexico_City_Z_abbreviated" : "CST",
"America/Mexico_City_Z_short" : "CST",
"America/Miquelon_Z_abbreviated" : "AST",
"America/Miquelon_Z_short" : "AST",
"America/Moncton_Z_abbreviated" : "AT",
"America/Moncton_Z_short" : "AST",
"America/Monterrey_Z_abbreviated" : "CST",
"America/Monterrey_Z_short" : "CST",
"America/Montevideo_Z_abbreviated" : "Uruguay Time",
"America/Montevideo_Z_short" : "UYT",
"America/Montserrat_Z_abbreviated" : "AST",
"America/Montserrat_Z_short" : "AST",
"America/Nassau_Z_abbreviated" : "ET",
"America/Nassau_Z_short" : "EST",
"America/New_York_Z_abbreviated" : "ET",
"America/New_York_Z_short" : "EST",
"America/Noronha_Z_abbreviated" : "Brazil (Noronha)",
"America/Noronha_Z_short" : "FNT",
"America/North_Dakota/Beulah_Z_abbreviated" : "MT",
"America/North_Dakota/Beulah_Z_short" : "MST",
"America/North_Dakota/Center_Z_abbreviated" : "MT",
"America/North_Dakota/Center_Z_short" : "MST",
"America/North_Dakota/New_Salem_Z_abbreviated" : "MT",
"America/North_Dakota/New_Salem_Z_short" : "MST",
"America/Ojinaga_Z_abbreviated" : "CST",
"America/Ojinaga_Z_short" : "CST",
"America/Panama_Z_abbreviated" : "EST",
"America/Panama_Z_short" : "EST",
"America/Pangnirtung_Z_abbreviated" : "AST",
"America/Pangnirtung_Z_short" : "AST",
"America/Paramaribo_Z_abbreviated" : "Suriname Time",
"America/Paramaribo_Z_short" : "NEGT",
"America/Phoenix_Z_abbreviated" : "MST",
"America/Phoenix_Z_short" : "MST",
"America/Port-au-Prince_Z_abbreviated" : "EST",
"America/Port-au-Prince_Z_short" : "EST",
"America/Port_of_Spain_Z_abbreviated" : "AST",
"America/Port_of_Spain_Z_short" : "AST",
"America/Porto_Velho_Z_abbreviated" : "Brazil (Porto Velho)",
"America/Porto_Velho_Z_short" : "AMT",
"America/Puerto_Rico_Z_abbreviated" : "AST",
"America/Puerto_Rico_Z_short" : "AST",
"America/Rankin_Inlet_Z_abbreviated" : "CST",
"America/Rankin_Inlet_Z_short" : "CST",
"America/Recife_Z_abbreviated" : "Brazil (Recife)",
"America/Recife_Z_short" : "BRT",
"America/Regina_Z_abbreviated" : "CST",
"America/Regina_Z_short" : "CST",
"America/Resolute_Z_abbreviated" : "CST",
"America/Resolute_Z_short" : "CST",
"America/Rio_Branco_Z_abbreviated" : "Brazil (Rio Branco)",
"America/Rio_Branco_Z_short" : "ACT (Acre)",
"America/Santa_Isabel_Z_abbreviated" : "PST",
"America/Santa_Isabel_Z_short" : "PST",
"America/Santarem_Z_abbreviated" : "Brazil (Santarem)",
"America/Santarem_Z_short" : "AMT",
"America/Santiago_Z_abbreviated" : "Chile (Santiago)",
"America/Santiago_Z_short" : "CLST",
"America/Santo_Domingo_Z_abbreviated" : "Dominican Republic Time",
"America/Santo_Domingo_Z_short" : "GMT-04:30",
"America/Sao_Paulo_Z_abbreviated" : "Brazil (Sao Paulo)",
"America/Sao_Paulo_Z_short" : "BRT",
"America/St_Johns_Z_abbreviated" : "Canada (St. John's)",
"America/St_Johns_Z_short" : "NST",
"America/St_Kitts_Z_abbreviated" : "AST",
"America/St_Kitts_Z_short" : "AST",
"America/St_Lucia_Z_abbreviated" : "AST",
"America/St_Lucia_Z_short" : "AST",
"America/St_Thomas_Z_abbreviated" : "AST",
"America/St_Thomas_Z_short" : "AST",
"America/St_Vincent_Z_abbreviated" : "AST",
"America/St_Vincent_Z_short" : "AST",
"America/Tegucigalpa_Z_abbreviated" : "CST",
"America/Tegucigalpa_Z_short" : "CST",
"America/Tijuana_Z_abbreviated" : "PST",
"America/Tijuana_Z_short" : "PST",
"America/Toronto_Z_abbreviated" : "ET",
"America/Toronto_Z_short" : "EST",
"America/Tortola_Z_abbreviated" : "AST",
"America/Tortola_Z_short" : "AST",
"America/Vancouver_Z_abbreviated" : "PT",
"America/Vancouver_Z_short" : "PST",
"America/Winnipeg_Z_abbreviated" : "CT",
"America/Winnipeg_Z_short" : "CST",
"Antarctica/Casey_Z_abbreviated" : "Antarctica (Casey)",
"Antarctica/Casey_Z_short" : "AWST",
"Antarctica/Davis_Z_abbreviated" : "Antarctica (Davis)",
"Antarctica/Davis_Z_short" : "DAVT",
"Antarctica/DumontDUrville_Z_abbreviated" : "Antarctica (Dumont d’Urville)",
"Antarctica/DumontDUrville_Z_short" : "DDUT",
"Antarctica/Macquarie_Z_abbreviated" : "Antarctica (Macquarie)",
"Antarctica/Macquarie_Z_short" : "AEDT",
"Antarctica/McMurdo_Z_abbreviated" : "Antarctica (McMurdo)",
"Antarctica/McMurdo_Z_short" : "NZST",
"Antarctica/Palmer_Z_abbreviated" : "Antarctica (Palmer)",
"Antarctica/Palmer_Z_short" : "ART",
"Antarctica/Rothera_Z_abbreviated" : "Antarctica (Rothera)",
"Antarctica/Rothera_Z_short" : "ROTT",
"Antarctica/Syowa_Z_abbreviated" : "Antarctica (Syowa)",
"Antarctica/Syowa_Z_short" : "SYOT",
"Antarctica/Vostok_Z_abbreviated" : "Antarctica (Vostok)",
"Antarctica/Vostok_Z_short" : "VOST",
"Asia/Aden_Z_abbreviated" : "Yemen Time",
"Asia/Aden_Z_short" : "AST (Arabian)",
"Asia/Almaty_Z_abbreviated" : "Kazakhstan (Almaty)",
"Asia/Almaty_Z_short" : "ALMT",
"Asia/Amman_Z_abbreviated" : "Jordan Time",
"Asia/Amman_Z_short" : "EET",
"Asia/Anadyr_Z_abbreviated" : "Russia (Anadyr)",
"Asia/Anadyr_Z_short" : "ANAT",
"Asia/Aqtau_Z_abbreviated" : "Kazakhstan (Aqtau)",
"Asia/Aqtau_Z_short" : "SHET",
"Asia/Aqtobe_Z_abbreviated" : "Kazakhstan (Aqtobe)",
"Asia/Aqtobe_Z_short" : "AKTT",
"Asia/Ashgabat_Z_abbreviated" : "Turkmenistan Time",
"Asia/Ashgabat_Z_short" : "ASHT",
"Asia/Baghdad_Z_abbreviated" : "Iraq Time",
"Asia/Baghdad_Z_short" : "AST (Arabian)",
"Asia/Bahrain_Z_abbreviated" : "Bahrain Time",
"Asia/Bahrain_Z_short" : "GST",
"Asia/Baku_Z_abbreviated" : "Azerbaijan Time",
"Asia/Baku_Z_short" : "BAKT",
"Asia/Bangkok_Z_abbreviated" : "Thailand Time",
"Asia/Bangkok_Z_short" : "ICT",
"Asia/Beirut_Z_abbreviated" : "Lebanon Time",
"Asia/Beirut_Z_short" : "EET",
"Asia/Bishkek_Z_abbreviated" : "Kyrgyzstan Time",
"Asia/Bishkek_Z_short" : "FRUT",
"Asia/Brunei_Z_abbreviated" : "Brunei Time",
"Asia/Brunei_Z_short" : "BNT",
"Asia/Choibalsan_Z_abbreviated" : "Mongolia (Choibalsan)",
"Asia/Choibalsan_Z_short" : "ULAT",
"Asia/Chongqing_Z_abbreviated" : "China (Chongqing)",
"Asia/Chongqing_Z_short" : "LONT",
"Asia/Colombo_Z_abbreviated" : "Sri Lanka Time",
"Asia/Colombo_Z_short" : "IST",
"Asia/Damascus_Z_abbreviated" : "Syria Time",
"Asia/Damascus_Z_short" : "EET",
"Asia/Dhaka_Z_abbreviated" : "Bangladesh Time",
"Asia/Dhaka_Z_short" : "DACT",
"Asia/Dili_Z_abbreviated" : "Timor-Leste Time",
"Asia/Dili_Z_short" : "TLT",
"Asia/Dubai_Z_abbreviated" : "United Arab Emirates Time",
"Asia/Dubai_Z_short" : "GST",
"Asia/Dushanbe_Z_abbreviated" : "Tajikistan Time",
"Asia/Dushanbe_Z_short" : "DUST",
"Asia/Gaza_Z_abbreviated" : "Palestinian Territories Time",
"Asia/Gaza_Z_short" : "IST (Israel)",
"Asia/Harbin_Z_abbreviated" : "China (Harbin)",
"Asia/Harbin_Z_short" : "CHAT",
"Asia/Hebron_Z_abbreviated" : "Palestinian Territories Time",
"Asia/Hebron_Z_short" : "IST (Israel)",
"Asia/Ho_Chi_Minh_Z_abbreviated" : "Vietnam Time",
"Asia/Ho_Chi_Minh_Z_short" : "ICT",
"Asia/Hong_Kong_Z_abbreviated" : "Hong Kong SAR China Time",
"Asia/Hong_Kong_Z_short" : "HKT",
"Asia/Hovd_Z_abbreviated" : "Mongolia (Hovd)",
"Asia/Hovd_Z_short" : "HOVT",
"Asia/Irkutsk_Z_abbreviated" : "Russia (Irkutsk)",
"Asia/Irkutsk_Z_short" : "IRKT",
"Asia/Jakarta_Z_abbreviated" : "Indonesia (Jakarta)",
"Asia/Jakarta_Z_short" : "WIT",
"Asia/Jerusalem_Z_abbreviated" : "Israel Time",
"Asia/Jerusalem_Z_short" : "IST (Israel)",
"Asia/Kabul_Z_abbreviated" : "Afghanistan Time",
"Asia/Kabul_Z_short" : "AFT",
"Asia/Kamchatka_Z_abbreviated" : "Russia (Kamchatka)",
"Asia/Kamchatka_Z_short" : "PETT",
"Asia/Karachi_Z_abbreviated" : "Pakistan Time",
"Asia/Karachi_Z_short" : "KART",
"Asia/Kashgar_Z_abbreviated" : "China (Kashgar)",
"Asia/Kashgar_Z_short" : "KAST",
"Asia/Kathmandu_Z_abbreviated" : "Nepal Time",
"Asia/Kathmandu_Z_short" : "NPT",
"Asia/Kolkata_Z_abbreviated" : "India Time",
"Asia/Kolkata_Z_short" : "IST",
"Asia/Krasnoyarsk_Z_abbreviated" : "Russia (Krasnoyarsk)",
"Asia/Krasnoyarsk_Z_short" : "KRAT",
"Asia/Kuala_Lumpur_Z_abbreviated" : "Malaysia (Kuala Lumpur)",
"Asia/Kuala_Lumpur_Z_short" : "MALT",
"Asia/Kuching_Z_abbreviated" : "Malaysia (Kuching)",
"Asia/Kuching_Z_short" : "BORT",
"Asia/Kuwait_Z_abbreviated" : "Kuwait Time",
"Asia/Kuwait_Z_short" : "AST (Arabian)",
"Asia/Macau_Z_abbreviated" : "Macau SAR China Time",
"Asia/Macau_Z_short" : "MOT",
"Asia/Magadan_Z_abbreviated" : "Russia (Magadan)",
"Asia/Magadan_Z_short" : "MAGT",
"Asia/Manila_Z_abbreviated" : "Philippines Time",
"Asia/Manila_Z_short" : "PHT",
"Asia/Muscat_Z_abbreviated" : "Oman Time",
"Asia/Muscat_Z_short" : "GST",
"Asia/Nicosia_Z_abbreviated" : "Cyprus Time",
"Asia/Nicosia_Z_short" : "EET",
"Asia/Novokuznetsk_Z_abbreviated" : "Russia (Novokuznetsk)",
"Asia/Novokuznetsk_Z_short" : "KRAT",
"Asia/Novosibirsk_Z_abbreviated" : "Russia (Novosibirsk)",
"Asia/Novosibirsk_Z_short" : "NOVT",
"Asia/Omsk_Z_abbreviated" : "Russia (Omsk)",
"Asia/Omsk_Z_short" : "OMST",
"Asia/Oral_Z_abbreviated" : "Kazakhstan (Oral)",
"Asia/Oral_Z_short" : "URAT",
"Asia/Phnom_Penh_Z_abbreviated" : "Cambodia Time",
"Asia/Phnom_Penh_Z_short" : "ICT",
"Asia/Pontianak_Z_abbreviated" : "Indonesia (Pontianak)",
"Asia/Pontianak_Z_short" : "CIT",
"Asia/Qatar_Z_abbreviated" : "Qatar Time",
"Asia/Qatar_Z_short" : "GST",
"Asia/Qyzylorda_Z_abbreviated" : "Kazakhstan (Qyzylorda)",
"Asia/Qyzylorda_Z_short" : "KIZT",
"Asia/Rangoon_Z_abbreviated" : "Myanmar [Burma] Time",
"Asia/Rangoon_Z_short" : "MMT",
"Asia/Riyadh87_Z_abbreviated" : "Asia/Riyadh87 Time",
"Asia/Riyadh87_Z_short" : "GMT+03:07:04",
"Asia/Riyadh88_Z_abbreviated" : "Asia/Riyadh88 Time",
"Asia/Riyadh88_Z_short" : "GMT+03:07:04",
"Asia/Riyadh89_Z_abbreviated" : "Asia/Riyadh89 Time",
"Asia/Riyadh89_Z_short" : "GMT+03:07:04",
"Asia/Riyadh_Z_abbreviated" : "Saudi Arabia Time",
"Asia/Riyadh_Z_short" : "AST (Arabian)",
"Asia/Sakhalin_Z_abbreviated" : "Russia (Sakhalin)",
"Asia/Sakhalin_Z_short" : "SAKT",
"Asia/Samarkand_Z_abbreviated" : "Uzbekistan (Samarkand)",
"Asia/Samarkand_Z_short" : "SAMT (Samarkand)",
"Asia/Seoul_Z_abbreviated" : "South Korea Time",
"Asia/Seoul_Z_short" : "KST",
"Asia/Shanghai_Z_abbreviated" : "China (Shanghai)",
"Asia/Shanghai_Z_short" : "CST (China)",
"Asia/Singapore_Z_abbreviated" : "Singapore Time",
"Asia/Singapore_Z_short" : "SGT",
"Asia/Taipei_Z_abbreviated" : "Taiwan Time",
"Asia/Taipei_Z_short" : "CST (Taipei)",
"Asia/Tbilisi_Z_abbreviated" : "Georgia Time",
"Asia/Tbilisi_Z_short" : "TBIT",
"Asia/Tehran_Z_abbreviated" : "Iran Time",
"Asia/Tehran_Z_short" : "IRST",
"Asia/Thimphu_Z_abbreviated" : "Bhutan Time",
"Asia/Thimphu_Z_short" : "IST",
"Asia/Tokyo_Z_abbreviated" : "Japan Time",
"Asia/Tokyo_Z_short" : "JST",
"Asia/Ulaanbaatar_Z_abbreviated" : "Mongolia (Ulaanbaatar)",
"Asia/Ulaanbaatar_Z_short" : "ULAT",
"Asia/Urumqi_Z_abbreviated" : "China (Urumqi)",
"Asia/Urumqi_Z_short" : "URUT",
"Asia/Vientiane_Z_abbreviated" : "Laos Time",
"Asia/Vientiane_Z_short" : "ICT",
"Asia/Vladivostok_Z_abbreviated" : "Russia (Vladivostok)",
"Asia/Vladivostok_Z_short" : "VLAT",
"Asia/Yakutsk_Z_abbreviated" : "Russia (Yakutsk)",
"Asia/Yakutsk_Z_short" : "YAKT",
"Asia/Yekaterinburg_Z_abbreviated" : "Russia (Yekaterinburg)",
"Asia/Yekaterinburg_Z_short" : "SVET",
"Asia/Yerevan_Z_abbreviated" : "Armenia Time",
"Asia/Yerevan_Z_short" : "YERT",
"Atlantic/Bermuda_Z_abbreviated" : "AST",
"Atlantic/Bermuda_Z_short" : "AST",
"Atlantic/Cape_Verde_Z_abbreviated" : "Cape Verde Time",
"Atlantic/Cape_Verde_Z_short" : "CVT",
"Atlantic/Reykjavik_Z_abbreviated" : "GMT",
"Atlantic/Reykjavik_Z_short" : "GMT",
"Atlantic/South_Georgia_Z_abbreviated" : "South Georgia and the South Sandwich Islands Time",
"Atlantic/South_Georgia_Z_short" : "GST (S. Georgia)",
"Atlantic/St_Helena_Z_abbreviated" : "GMT",
"Atlantic/St_Helena_Z_short" : "GMT",
"Atlantic/Stanley_Z_abbreviated" : "Falkland Islands Time",
"Atlantic/Stanley_Z_short" : "FKT",
"Australia/Adelaide_Z_abbreviated" : "Australia (Adelaide)",
"Australia/Adelaide_Z_short" : "ACST",
"Australia/Brisbane_Z_abbreviated" : "Australia (Brisbane)",
"Australia/Brisbane_Z_short" : "AEST",
"Australia/Darwin_Z_abbreviated" : "Australia (Darwin)",
"Australia/Darwin_Z_short" : "ACST",
"Australia/Hobart_Z_abbreviated" : "Australia (Hobart)",
"Australia/Hobart_Z_short" : "AEDT",
"Australia/Lord_Howe_Z_abbreviated" : "Australia (Lord Howe)",
"Australia/Lord_Howe_Z_short" : "AEST",
"Australia/Melbourne_Z_abbreviated" : "Australia (Melbourne)",
"Australia/Melbourne_Z_short" : "AEST",
"Australia/Perth_Z_abbreviated" : "Australia (Perth)",
"Australia/Perth_Z_short" : "AWST",
"Australia/Sydney_Z_abbreviated" : "Australia (Sydney)",
"Australia/Sydney_Z_short" : "AEST",
"BC" : "BC",
"DateTimeCombination" : "{1} {0}",
"DateTimeTimezoneCombination" : "{1} {0} {2}",
"DateTimezoneCombination" : "{1} {2}",
"EST_Z_abbreviated" : "GMT-05:00",
"EST_Z_short" : "GMT-05:00",
"Etc/GMT-14_Z_abbreviated" : "GMT+14:00",
"Etc/GMT-14_Z_short" : "GMT+14:00",
"Etc/GMT_Z_abbreviated" : "GMT+00:00",
"Etc/GMT_Z_short" : "GMT+00:00",
"Europe/Amsterdam_Z_abbreviated" : "Netherlands Time",
"Europe/Amsterdam_Z_short" : "CET",
"Europe/Andorra_Z_abbreviated" : "Andorra Time",
"Europe/Andorra_Z_short" : "CET",
"Europe/Athens_Z_abbreviated" : "Greece Time",
"Europe/Athens_Z_short" : "EET",
"Europe/Belgrade_Z_abbreviated" : "Serbia Time",
"Europe/Belgrade_Z_short" : "CET",
"Europe/Berlin_Z_abbreviated" : "Germany Time",
"Europe/Berlin_Z_short" : "CET",
"Europe/Brussels_Z_abbreviated" : "Belgium Time",
"Europe/Brussels_Z_short" : "CET",
"Europe/Bucharest_Z_abbreviated" : "Romania Time",
"Europe/Bucharest_Z_short" : "EET",
"Europe/Budapest_Z_abbreviated" : "Hungary Time",
"Europe/Budapest_Z_short" : "CET",
"Europe/Chisinau_Z_abbreviated" : "Moldova Time",
"Europe/Chisinau_Z_short" : "MSK",
"Europe/Copenhagen_Z_abbreviated" : "Denmark Time",
"Europe/Copenhagen_Z_short" : "CET",
"Europe/Gibraltar_Z_abbreviated" : "Gibraltar Time",
"Europe/Gibraltar_Z_short" : "CET",
"Europe/Helsinki_Z_abbreviated" : "Finland Time",
"Europe/Helsinki_Z_short" : "EET",
"Europe/Istanbul_Z_abbreviated" : "Turkey Time",
"Europe/Istanbul_Z_short" : "EET",
"Europe/Kaliningrad_Z_abbreviated" : "Russia (Kaliningrad)",
"Europe/Kaliningrad_Z_short" : "MSK",
"Europe/Kiev_Z_abbreviated" : "Ukraine (Kiev)",
"Europe/Kiev_Z_short" : "MSK",
"Europe/Lisbon_Z_abbreviated" : "Portugal (Lisbon)",
"Europe/Lisbon_Z_short" : "CET",
"Europe/London_Z_abbreviated" : "United Kingdom Time",
"Europe/London_Z_short" : "GMT+01:00",
"Europe/Luxembourg_Z_abbreviated" : "Luxembourg Time",
"Europe/Luxembourg_Z_short" : "CET",
"Europe/Madrid_Z_abbreviated" : "Spain (Madrid)",
"Europe/Madrid_Z_short" : "CET",
"Europe/Malta_Z_abbreviated" : "Malta Time",
"Europe/Malta_Z_short" : "CET",
"Europe/Minsk_Z_abbreviated" : "Belarus Time",
"Europe/Minsk_Z_short" : "MSK",
"Europe/Monaco_Z_abbreviated" : "Monaco Time",
"Europe/Monaco_Z_short" : "CET",
"Europe/Moscow_Z_abbreviated" : "Russia (Moscow)",
"Europe/Moscow_Z_short" : "MSK",
"Europe/Oslo_Z_abbreviated" : "Norway Time",
"Europe/Oslo_Z_short" : "CET",
"Europe/Paris_Z_abbreviated" : "France Time",
"Europe/Paris_Z_short" : "CET",
"Europe/Prague_Z_abbreviated" : "Czech Republic Time",
"Europe/Prague_Z_short" : "CET",
"Europe/Riga_Z_abbreviated" : "Latvia Time",
"Europe/Riga_Z_short" : "MSK",
"Europe/Rome_Z_abbreviated" : "Italy Time",
"Europe/Rome_Z_short" : "CET",
"Europe/Samara_Z_abbreviated" : "Russia (Samara)",
"Europe/Samara_Z_short" : "KUYT",
"Europe/Simferopol_Z_abbreviated" : "Ukraine (Simferopol)",
"Europe/Simferopol_Z_short" : "MSK",
"Europe/Sofia_Z_abbreviated" : "Bulgaria Time",
"Europe/Sofia_Z_short" : "EET",
"Europe/Stockholm_Z_abbreviated" : "Sweden Time",
"Europe/Stockholm_Z_short" : "CET",
"Europe/Tallinn_Z_abbreviated" : "Estonia Time",
"Europe/Tallinn_Z_short" : "MSK",
"Europe/Tirane_Z_abbreviated" : "Albania Time",
"Europe/Tirane_Z_short" : "CET",
"Europe/Uzhgorod_Z_abbreviated" : "Ukraine (Uzhgorod)",
"Europe/Uzhgorod_Z_short" : "MSK",
"Europe/Vaduz_Z_abbreviated" : "Liechtenstein Time",
"Europe/Vaduz_Z_short" : "CET",
"Europe/Vienna_Z_abbreviated" : "Austria Time",
"Europe/Vienna_Z_short" : "CET",
"Europe/Vilnius_Z_abbreviated" : "Lithuania Time",
"Europe/Vilnius_Z_short" : "MSK",
"Europe/Volgograd_Z_abbreviated" : "Russia (Volgograd)",
"Europe/Volgograd_Z_short" : "VOLT",
"Europe/Warsaw_Z_abbreviated" : "Poland Time",
"Europe/Warsaw_Z_short" : "CET",
"Europe/Zaporozhye_Z_abbreviated" : "Ukraine (Zaporozhye)",
"Europe/Zaporozhye_Z_short" : "MSK",
"Europe/Zurich_Z_abbreviated" : "Switzerland Time",
"Europe/Zurich_Z_short" : "CET",
"HMS_long" : "{0} {1} {2}",
"HMS_short" : "{0}:{1}:{2}",
"HM_abbreviated" : "h:mm a",
"HM_short" : "h:mm a",
"H_abbreviated" : "h a",
"Indian/Antananarivo_Z_abbreviated" : "Madagascar Time",
"Indian/Antananarivo_Z_short" : "EAT",
"Indian/Chagos_Z_abbreviated" : "British Indian Ocean Territory Time",
"Indian/Chagos_Z_short" : "IOT",
"Indian/Christmas_Z_abbreviated" : "Christmas Island Time",
"Indian/Christmas_Z_short" : "CXT",
"Indian/Cocos_Z_abbreviated" : "Cocos [Keeling] Islands Time",
"Indian/Cocos_Z_short" : "CCT",
"Indian/Comoro_Z_abbreviated" : "Comoros Time",
"Indian/Comoro_Z_short" : "EAT",
"Indian/Kerguelen_Z_abbreviated" : "French Southern Territories Time",
"Indian/Kerguelen_Z_short" : "TFT",
"Indian/Mahe_Z_abbreviated" : "Seychelles Time",
"Indian/Mahe_Z_short" : "SCT",
"Indian/Maldives_Z_abbreviated" : "Maldives Time",
"Indian/Maldives_Z_short" : "MVT",
"Indian/Mauritius_Z_abbreviated" : "Mauritius Time",
"Indian/Mauritius_Z_short" : "MUT",
"Indian/Mayotte_Z_abbreviated" : "Mayotte Time",
"Indian/Mayotte_Z_short" : "EAT",
"Indian/Reunion_Z_abbreviated" : "Réunion Time",
"Indian/Reunion_Z_short" : "RET",
"MD_abbreviated" : "MMM d",
"MD_long" : "MMMM d",
"MD_short" : "M/d",
"M_abbreviated" : "MMM",
"M_long" : "MMMM",
"Pacific/Apia_Z_abbreviated" : "Samoa Time",
"Pacific/Apia_Z_short" : "BST (Bering)",
"Pacific/Auckland_Z_abbreviated" : "New Zealand (Auckland)",
"Pacific/Auckland_Z_short" : "NZST",
"Pacific/Chuuk_Z_abbreviated" : "Micronesia (Truk)",
"Pacific/Chuuk_Z_short" : "TRUT",
"Pacific/Efate_Z_abbreviated" : "Vanuatu Time",
"Pacific/Efate_Z_short" : "VUT",
"Pacific/Fakaofo_Z_abbreviated" : "Tokelau Time",
"Pacific/Fakaofo_Z_short" : "TKT",
"Pacific/Fiji_Z_abbreviated" : "Fiji Time",
"Pacific/Fiji_Z_short" : "FJT",
"Pacific/Funafuti_Z_abbreviated" : "Tuvalu Time",
"Pacific/Funafuti_Z_short" : "TVT",
"Pacific/Gambier_Z_abbreviated" : "French Polynesia (Gambier)",
"Pacific/Gambier_Z_short" : "GAMT",
"Pacific/Guadalcanal_Z_abbreviated" : "Solomon Islands Time",
"Pacific/Guadalcanal_Z_short" : "SBT",
"Pacific/Guam_Z_abbreviated" : "Guam Time",
"Pacific/Guam_Z_short" : "GST (Guam)",
"Pacific/Honolulu_Z_abbreviated" : "United States (Honolulu)",
"Pacific/Honolulu_Z_short" : "AHST",
"Pacific/Johnston_Z_abbreviated" : "U.S. Minor Outlying Islands (Johnston)",
"Pacific/Johnston_Z_short" : "AHST",
"Pacific/Majuro_Z_abbreviated" : "Marshall Islands (Majuro)",
"Pacific/Majuro_Z_short" : "MHT",
"Pacific/Midway_Z_abbreviated" : "U.S. Minor Outlying Islands (Midway)",
"Pacific/Midway_Z_short" : "BST (Bering)",
"Pacific/Nauru_Z_abbreviated" : "Nauru Time",
"Pacific/Nauru_Z_short" : "NRT",
"Pacific/Niue_Z_abbreviated" : "Niue Time",
"Pacific/Niue_Z_short" : "NUT",
"Pacific/Norfolk_Z_abbreviated" : "Norfolk Island Time",
"Pacific/Norfolk_Z_short" : "NFT",
"Pacific/Noumea_Z_abbreviated" : "New Caledonia Time",
"Pacific/Noumea_Z_short" : "NCT",
"Pacific/Pago_Pago_Z_abbreviated" : "American Samoa Time",
"Pacific/Pago_Pago_Z_short" : "BST (Bering)",
"Pacific/Palau_Z_abbreviated" : "Palau Time",
"Pacific/Palau_Z_short" : "PWT",
"Pacific/Pitcairn_Z_abbreviated" : "Pitcairn Islands Time",
"Pacific/Pitcairn_Z_short" : "PNT",
"Pacific/Port_Moresby_Z_abbreviated" : "Papua New Guinea Time",
"Pacific/Port_Moresby_Z_short" : "PGT",
"Pacific/Rarotonga_Z_abbreviated" : "Cook Islands Time",
"Pacific/Rarotonga_Z_short" : "CKT",
"Pacific/Saipan_Z_abbreviated" : "Northern Mariana Islands Time",
"Pacific/Saipan_Z_short" : "MPT",
"Pacific/Tarawa_Z_abbreviated" : "Kiribati (Tarawa)",
"Pacific/Tarawa_Z_short" : "GILT",
"Pacific/Tongatapu_Z_abbreviated" : "Tonga Time",
"Pacific/Tongatapu_Z_short" : "TOT",
"Pacific/Wake_Z_abbreviated" : "U.S. Minor Outlying Islands (Wake)",
"Pacific/Wake_Z_short" : "WAKT",
"Pacific/Wallis_Z_abbreviated" : "Wallis and Futuna Time",
"Pacific/Wallis_Z_short" : "WFT",
"RelativeTime/oneUnit" : "{0} ago",
"RelativeTime/twoUnits" : "{0} {1} ago",
"TimeTimezoneCombination" : "{0} {2}",
"WET_Z_abbreviated" : "GMT+00:00",
"WET_Z_short" : "GMT+00:00",
"WMD_abbreviated" : "E, MMM d",
"WMD_long" : "EEEE, MMMM d",
"WMD_short" : "E, M/d",
"WYMD_abbreviated" : "EEE, MMM d, y",
"WYMD_long" : "EEEE, MMMM d, y",
"WYMD_short" : "EEE, M/d/yy",
"W_abbreviated" : "EEE",
"W_long" : "EEEE",
"YMD_abbreviated" : "MMM d, y",
"YMD_full" : "M/d/yy",
"YMD_long" : "MMMM d, y",
"YMD_short" : "M/d/yy",
"YM_long" : "MMMM y",
"currencyFormat" : "¤ #0.00",
"currencyPatternPlural" : "{0} {1}",
"currencyPatternSingular" : "{0} {1}",
"day" : "day",
"day_abbr" : "day",
"dayperiod" : "AM/PM",
"days" : "days",
"days_abbr" : "days",
"decimalFormat" : "#0.######",
"decimalSeparator" : ".",
"defaultCurrency" : "USD",
"exponentialSymbol" : "E",
"groupingSeparator" : ",",
"hour" : "hour",
"hour_abbr" : "hr",
"hours" : "hours",
"hours_abbr" : "hrs",
"infinitySign" : "INF",
"listPatternEnd" : "{0}, and {1}",
"listPatternTwo" : "{0} and {1}",
"minusSign" : "-",
"minute" : "minute",
"minute_abbr" : "min",
"minutes" : "minutes",
"minutes_abbr" : "mins",
"month" : "month",
"monthAprLong" : "April",
"monthAprMedium" : "Apr",
"monthAugLong" : "August",
"monthAugMedium" : "Aug",
"monthDecLong" : "December",
"monthDecMedium" : "Dec",
"monthFebLong" : "February",
"monthFebMedium" : "Feb",
"monthJanLong" : "January",
"monthJanMedium" : "Jan",
"monthJulLong" : "July",
"monthJulMedium" : "Jul",
"monthJunLong" : "June",
"monthJunMedium" : "Jun",
"monthMarLong" : "March",
"monthMarMedium" : "Mar",
"monthMayLong" : "May",
"monthMayMedium" : "May",
"monthNovLong" : "November",
"monthNovMedium" : "Nov",
"monthOctLong" : "October",
"monthOctMedium" : "Oct",
"monthSepLong" : "September",
"monthSepMedium" : "Sep",
"month_abbr" : "mth",
"months" : "months",
"months_abbr" : "mths",
"nanSymbol" : "NaN",
"numberZero" : "0",
"perMilleSign" : "0/00",
"percentFormat" : "#0%",
"percentSign" : "%",
"periodAm" : "AM",
"periodPm" : "PM",
"pluralRule" : "set3",
"plusSign" : "+",
"scientificFormat" : "0.000000E+000",
"second" : "second",
"second_abbr" : "sec",
"seconds" : "seconds",
"seconds_abbr" : "secs",
"today" : "Today",
"tomorrow" : "Tomorrow",
"weekdayFriLong" : "Friday",
"weekdayFriMedium" : "Fri",
"weekdayMonLong" : "Monday",
"weekdayMonMedium" : "Mon",
"weekdaySatLong" : "Saturday",
"weekdaySatMedium" : "Sat",
"weekdaySunLong" : "Sunday",
"weekdaySunMedium" : "Sun",
"weekdayThuLong" : "Thursday",
"weekdayThuMedium" : "Thu",
"weekdayTueLong" : "Tuesday",
"weekdayTueMedium" : "Tue",
"weekdayWedLong" : "Wednesday",
"weekdayWedMedium" : "Wed",
"year" : "year",
"year_abbr" : "yr",
"years" : "years",
"years_abbr" : "yrs",
"yesterday" : "Yesterday"
}
|
'use strict';
//Setting up route
angular.module('contacts').config(['$stateProvider',
function($stateProvider) {
// Contacts state routing
$stateProvider.
state('createContact', {
url: '/contacts',
templateUrl: 'modules/contacts/views/create-contact.client.view.html'
}).
state('listContact', {
url: '/contacts/list',
templateUrl: 'modules/contacts/views/list-contacts.client.view.html'
}).
state('viewContact', {
url: '/contacts/:contactId',
templateUrl: 'modules/contacts/views/view-contact.client.view.html'
});
}
]);
|
window.Physijs = (function() {
'use strict';
var SUPPORT_TRANSFERABLE,
_is_simulating = false,
_Physijs = Physijs, // used for noConflict method
Physijs = {}, // object assigned to window.Physijs
Eventable, // class to provide simple event methods
getObjectId, // returns a unique ID for a Physijs mesh object
getEulerXYZFromQuaternion, getQuatertionFromEuler,
convertWorldPositionToObject, // Converts a world-space position to object-space
addObjectChildren,
_temp1, _temp2,
_temp_vector3_1 = new THREE.Vector3,
_temp_vector3_2 = new THREE.Vector3,
_temp_matrix4_1 = new THREE.Matrix4,
_quaternion_1 = new THREE.Quaternion,
// constants
MESSAGE_TYPES = {
WORLDREPORT: 0,
COLLISIONREPORT: 1,
VEHICLEREPORT: 2,
CONSTRAINTREPORT: 3
},
REPORT_ITEMSIZE = 14,
COLLISIONREPORT_ITEMSIZE = 5,
VEHICLEREPORT_ITEMSIZE = 9,
CONSTRAINTREPORT_ITEMSIZE = 6;
Physijs.scripts = {};
Eventable = function() {
this._eventListeners = {};
};
Eventable.prototype.addEventListener = function( event_name, callback ) {
if ( !this._eventListeners.hasOwnProperty( event_name ) ) {
this._eventListeners[event_name] = [];
}
this._eventListeners[event_name].push( callback );
};
Eventable.prototype.removeEventListener = function( event_name, callback ) {
var index;
if ( !this._eventListeners.hasOwnProperty( event_name ) ) return false;
if ( (index = this._eventListeners[event_name].indexOf( callback )) >= 0 ) {
this._eventListeners[event_name].splice( index, 1 );
return true;
}
return false;
};
Eventable.prototype.dispatchEvent = function( event_name ) {
var i,
parameters = Array.prototype.splice.call( arguments, 1 );
if ( this._eventListeners.hasOwnProperty( event_name ) ) {
for ( i = 0; i < this._eventListeners[event_name].length; i++ ) {
this._eventListeners[event_name][i].apply( this, parameters );
}
}
};
Eventable.make = function( obj ) {
obj.prototype.addEventListener = Eventable.prototype.addEventListener;
obj.prototype.removeEventListener = Eventable.prototype.removeEventListener;
obj.prototype.dispatchEvent = Eventable.prototype.dispatchEvent;
};
getObjectId = (function() {
var _id = 1;
return function() {
return _id++;
};
})();
getEulerXYZFromQuaternion = function ( x, y, z, w ) {
return new THREE.Vector3(
Math.atan2( 2 * ( x * w - y * z ), ( w * w - x * x - y * y + z * z ) ),
Math.asin( 2 * ( x * z + y * w ) ),
Math.atan2( 2 * ( z * w - x * y ), ( w * w + x * x - y * y - z * z ) )
);
};
getQuatertionFromEuler = function( x, y, z ) {
var c1, s1, c2, s2, c3, s3, c1c2, s1s2;
c1 = Math.cos( y );
s1 = Math.sin( y );
c2 = Math.cos( -z );
s2 = Math.sin( -z );
c3 = Math.cos( x );
s3 = Math.sin( x );
c1c2 = c1 * c2;
s1s2 = s1 * s2;
return {
w: c1c2 * c3 - s1s2 * s3,
x: c1c2 * s3 + s1s2 * c3,
y: s1 * c2 * c3 + c1 * s2 * s3,
z: c1 * s2 * c3 - s1 * c2 * s3
};
};
convertWorldPositionToObject = function( position, object ) {
_temp_matrix4_1.identity(); // reset temp matrix
// Set the temp matrix's rotation to the object's rotation
_temp_matrix4_1.identity().makeRotationFromQuaternion( object.quaternion );
// Invert rotation matrix in order to "unrotate" a point back to object space
_temp_matrix4_1.getInverse( _temp_matrix4_1 );
// Yay! Temp vars!
_temp_vector3_1.copy( position );
_temp_vector3_2.copy( object.position );
// Apply the rotation
return _temp_vector3_1.sub( _temp_vector3_2 ).applyMatrix4( _temp_matrix4_1 );
};
// Physijs.noConflict
Physijs.noConflict = function() {
window.Physijs = _Physijs;
return Physijs;
};
// Physijs.createMaterial
Physijs.createMaterial = function( material, friction, restitution ) {
var physijs_material = function(){};
physijs_material.prototype = material;
physijs_material = new physijs_material;
physijs_material._physijs = {
id: material.id,
friction: friction === undefined ? .8 : friction,
restitution: restitution === undefined ? .2 : restitution
};
return physijs_material;
};
// Constraints
Physijs.PointConstraint = function( objecta, objectb, position ) {
if ( position === undefined ) {
position = objectb;
objectb = undefined;
}
this.type = 'point';
this.appliedImpulse = 0;
this.id = getObjectId();
this.objecta = objecta._physijs.id;
this.positiona = convertWorldPositionToObject( position, objecta ).clone();
if ( objectb ) {
this.objectb = objectb._physijs.id;
this.positionb = convertWorldPositionToObject( position, objectb ).clone();
}
};
Physijs.PointConstraint.prototype.getDefinition = function() {
return {
type: this.type,
id: this.id,
objecta: this.objecta,
objectb: this.objectb,
positiona: this.positiona,
positionb: this.positionb
};
};
Physijs.HingeConstraint = function( objecta, objectb, position, axis ) {
if ( axis === undefined ) {
axis = position;
position = objectb;
objectb = undefined;
}
this.type = 'hinge';
this.appliedImpulse = 0;
this.id = getObjectId();
this.scene = objecta.parent;
this.objecta = objecta._physijs.id;
this.positiona = convertWorldPositionToObject( position, objecta ).clone();
this.position = position.clone();
this.axis = axis;
if ( objectb ) {
this.objectb = objectb._physijs.id;
this.positionb = convertWorldPositionToObject( position, objectb ).clone();
}
};
Physijs.HingeConstraint.prototype.getDefinition = function() {
return {
type: this.type,
id: this.id,
objecta: this.objecta,
objectb: this.objectb,
positiona: this.positiona,
positionb: this.positionb,
axis: this.axis
};
};
/*
* low = minimum angle in radians
* high = maximum angle in radians
* bias_factor = applied as a factor to constraint error
* relaxation_factor = controls bounce (0.0 == no bounce)
*/
Physijs.HingeConstraint.prototype.setLimits = function( low, high, bias_factor, relaxation_factor ) {
this.scene.execute( 'hinge_setLimits', { constraint: this.id, low: low, high: high, bias_factor: bias_factor, relaxation_factor: relaxation_factor } );
};
Physijs.HingeConstraint.prototype.enableAngularMotor = function( velocity, acceleration ) {
this.scene.execute( 'hinge_enableAngularMotor', { constraint: this.id, velocity: velocity, acceleration: acceleration } );
};
Physijs.HingeConstraint.prototype.disableMotor = function( velocity, acceleration ) {
this.scene.execute( 'hinge_disableMotor', { constraint: this.id } );
};
Physijs.SliderConstraint = function( objecta, objectb, position, axis ) {
if ( axis === undefined ) {
axis = position;
position = objectb;
objectb = undefined;
}
this.type = 'slider';
this.appliedImpulse = 0;
this.id = getObjectId();
this.scene = objecta.parent;
this.objecta = objecta._physijs.id;
this.positiona = convertWorldPositionToObject( position, objecta ).clone();
this.axis = axis;
if ( objectb ) {
this.objectb = objectb._physijs.id;
this.positionb = convertWorldPositionToObject( position, objectb ).clone();
}
};
Physijs.SliderConstraint.prototype.getDefinition = function() {
return {
type: this.type,
id: this.id,
objecta: this.objecta,
objectb: this.objectb,
positiona: this.positiona,
positionb: this.positionb,
axis: this.axis
};
};
Physijs.SliderConstraint.prototype.setLimits = function( lin_lower, lin_upper, ang_lower, ang_upper ) {
this.scene.execute( 'slider_setLimits', { constraint: this.id, lin_lower: lin_lower, lin_upper: lin_upper, ang_lower: ang_lower, ang_upper: ang_upper } );
};
Physijs.SliderConstraint.prototype.setRestitution = function( linear, angular ) {
this.scene.execute(
'slider_setRestitution',
{
constraint: this.id,
linear: linear,
angular: angular
}
);
};
Physijs.SliderConstraint.prototype.enableLinearMotor = function( velocity, acceleration) {
this.scene.execute( 'slider_enableLinearMotor', { constraint: this.id, velocity: velocity, acceleration: acceleration } );
};
Physijs.SliderConstraint.prototype.disableLinearMotor = function() {
this.scene.execute( 'slider_disableLinearMotor', { constraint: this.id } );
};
Physijs.SliderConstraint.prototype.enableAngularMotor = function( velocity, acceleration ) {
this.scene.execute( 'slider_enableAngularMotor', { constraint: this.id, velocity: velocity, acceleration: acceleration } );
};
Physijs.SliderConstraint.prototype.disableAngularMotor = function() {
this.scene.execute( 'slider_disableAngularMotor', { constraint: this.id } );
};
Physijs.ConeTwistConstraint = function( objecta, objectb, position ) {
if ( position === undefined ) {
throw 'Both objects must be defined in a ConeTwistConstraint.';
}
this.type = 'conetwist';
this.appliedImpulse = 0;
this.id = getObjectId();
this.scene = objecta.parent;
this.objecta = objecta._physijs.id;
this.positiona = convertWorldPositionToObject( position, objecta ).clone();
this.objectb = objectb._physijs.id;
this.positionb = convertWorldPositionToObject( position, objectb ).clone();
this.axisa = { x: objecta.rotation.x, y: objecta.rotation.y, z: objecta.rotation.z };
this.axisb = { x: objectb.rotation.x, y: objectb.rotation.y, z: objectb.rotation.z };
};
Physijs.ConeTwistConstraint.prototype.getDefinition = function() {
return {
type: this.type,
id: this.id,
objecta: this.objecta,
objectb: this.objectb,
positiona: this.positiona,
positionb: this.positionb,
axisa: this.axisa,
axisb: this.axisb
};
};
Physijs.ConeTwistConstraint.prototype.setLimit = function( x, y, z ) {
this.scene.execute( 'conetwist_setLimit', { constraint: this.id, x: x, y: y, z: z } );
};
Physijs.ConeTwistConstraint.prototype.enableMotor = function() {
this.scene.execute( 'conetwist_enableMotor', { constraint: this.id } );
};
Physijs.ConeTwistConstraint.prototype.setMaxMotorImpulse = function( max_impulse ) {
this.scene.execute( 'conetwist_setMaxMotorImpulse', { constraint: this.id, max_impulse: max_impulse } );
};
Physijs.ConeTwistConstraint.prototype.setMotorTarget = function( target ) {
if ( target instanceof THREE.Vector3 ) {
target = new THREE.Quaternion().setFromEuler( new THREE.Euler( target.x, target.y, target.z ) );
} else if ( target instanceof THREE.Euler ) {
target = new THREE.Quaternion().setFromEuler( target );
} else if ( target instanceof THREE.Matrix4 ) {
target = new THREE.Quaternion().setFromRotationMatrix( target );
}
this.scene.execute( 'conetwist_setMotorTarget', { constraint: this.id, x: target.x, y: target.y, z: target.z, w: target.w } );
};
Physijs.ConeTwistConstraint.prototype.disableMotor = function() {
this.scene.execute( 'conetwist_disableMotor', { constraint: this.id } );
};
Physijs.DOFConstraint = function( objecta, objectb, position ) {
if ( position === undefined ) {
position = objectb;
objectb = undefined;
}
this.type = 'dof';
this.appliedImpulse = 0;
this.id = getObjectId();
this.scene = objecta.parent;
this.objecta = objecta._physijs.id;
this.positiona = convertWorldPositionToObject( position, objecta ).clone();
this.axisa = { x: objecta.rotation.x, y: objecta.rotation.y, z: objecta.rotation.z };
if ( objectb ) {
this.objectb = objectb._physijs.id;
this.positionb = convertWorldPositionToObject( position, objectb ).clone();
this.axisb = { x: objectb.rotation.x, y: objectb.rotation.y, z: objectb.rotation.z };
}
};
Physijs.DOFConstraint.prototype.getDefinition = function() {
return {
type: this.type,
id: this.id,
objecta: this.objecta,
objectb: this.objectb,
positiona: this.positiona,
positionb: this.positionb,
axisa: this.axisa,
axisb: this.axisb
};
};
Physijs.DOFConstraint.prototype.setLinearLowerLimit = function( limit ) {
this.scene.execute( 'dof_setLinearLowerLimit', { constraint: this.id, x: limit.x, y: limit.y, z: limit.z } );
};
Physijs.DOFConstraint.prototype.setLinearUpperLimit = function( limit ) {
this.scene.execute( 'dof_setLinearUpperLimit', { constraint: this.id, x: limit.x, y: limit.y, z: limit.z } );
};
Physijs.DOFConstraint.prototype.setAngularLowerLimit = function( limit ) {
this.scene.execute( 'dof_setAngularLowerLimit', { constraint: this.id, x: limit.x, y: limit.y, z: limit.z } );
};
Physijs.DOFConstraint.prototype.setAngularUpperLimit = function( limit ) {
this.scene.execute( 'dof_setAngularUpperLimit', { constraint: this.id, x: limit.x, y: limit.y, z: limit.z } );
};
Physijs.DOFConstraint.prototype.enableAngularMotor = function( which ) {
this.scene.execute( 'dof_enableAngularMotor', { constraint: this.id, which: which } );
};
Physijs.DOFConstraint.prototype.configureAngularMotor = function( which, low_angle, high_angle, velocity, max_force ) {
this.scene.execute( 'dof_configureAngularMotor', { constraint: this.id, which: which, low_angle: low_angle, high_angle: high_angle, velocity: velocity, max_force: max_force } );
};
Physijs.DOFConstraint.prototype.disableAngularMotor = function( which ) {
this.scene.execute( 'dof_disableAngularMotor', { constraint: this.id, which: which } );
};
// Physijs.Scene
Physijs.Scene = function( params ) {
var self = this;
Eventable.call( this );
THREE.Scene.call( this );
this._worker = new Worker( Physijs.scripts.worker || 'physijs_worker.js' );
this._worker.transferableMessage = this._worker.webkitPostMessage || this._worker.postMessage;
this._materials_ref_counts = {};
this._objects = {};
this._vehicles = {};
this._constraints = {};
var ab = new ArrayBuffer( 1 );
this._worker.transferableMessage( ab, [ab] );
SUPPORT_TRANSFERABLE = ( ab.byteLength === 0 );
this._worker.onmessage = function ( event ) {
var _temp,
data = event.data;
if ( data instanceof ArrayBuffer && data.byteLength !== 1 ) { // byteLength === 1 is the worker making a SUPPORT_TRANSFERABLE test
data = new Float32Array( data );
}
if ( data instanceof Float32Array ) {
// transferable object
switch ( data[0] ) {
case MESSAGE_TYPES.WORLDREPORT:
self._updateScene( data );
break;
case MESSAGE_TYPES.COLLISIONREPORT:
self._updateCollisions( data );
break;
case MESSAGE_TYPES.VEHICLEREPORT:
self._updateVehicles( data );
break;
case MESSAGE_TYPES.CONSTRAINTREPORT:
self._updateConstraints( data );
break;
}
} else {
if ( data.cmd ) {
// non-transferable object
switch ( data.cmd ) {
case 'objectReady':
_temp = data.params;
if ( self._objects[ _temp ] ) {
self._objects[ _temp ].dispatchEvent( 'ready' );
}
break;
case 'worldReady':
self.dispatchEvent( 'ready' );
break;
case 'vehicle':
window.test = data;
break;
default:
// Do nothing, just show the message
console.debug('Received: ' + data.cmd);
console.dir(data.params);
break;
}
} else {
switch ( data[0] ) {
case MESSAGE_TYPES.WORLDREPORT:
self._updateScene( data );
break;
case MESSAGE_TYPES.COLLISIONREPORT:
self._updateCollisions( data );
break;
case MESSAGE_TYPES.VEHICLEREPORT:
self._updateVehicles( data );
break;
case MESSAGE_TYPES.CONSTRAINTREPORT:
self._updateConstraints( data );
break;
}
}
}
};
params = params || {};
params.ammo = Physijs.scripts.ammo || 'ammo.js';
params.fixedTimeStep = params.fixedTimeStep || 1 / 60;
params.rateLimit = params.rateLimit || true;
this.execute( 'init', params );
};
Physijs.Scene.prototype = new THREE.Scene;
Physijs.Scene.prototype.constructor = Physijs.Scene;
Eventable.make( Physijs.Scene );
Physijs.Scene.prototype._updateScene = function( data ) {
var num_objects = data[1],
object,
i, offset;
for ( i = 0; i < num_objects; i++ ) {
offset = 2 + i * REPORT_ITEMSIZE;
object = this._objects[ data[ offset ] ];
if ( object === undefined ) {
continue;
}
if ( object.__dirtyPosition === false ) {
object.position.set(
data[ offset + 1 ],
data[ offset + 2 ],
data[ offset + 3 ]
);
}
if ( object.__dirtyRotation === false ) {
object.quaternion.set(
data[ offset + 4 ],
data[ offset + 5 ],
data[ offset + 6 ],
data[ offset + 7 ]
);
}
object._physijs.linearVelocity.set(
data[ offset + 8 ],
data[ offset + 9 ],
data[ offset + 10 ]
);
object._physijs.angularVelocity.set(
data[ offset + 11 ],
data[ offset + 12 ],
data[ offset + 13 ]
);
}
if ( SUPPORT_TRANSFERABLE ) {
// Give the typed array back to the worker
this._worker.transferableMessage( data.buffer, [data.buffer] );
}
_is_simulating = false;
this.dispatchEvent( 'update' );
};
Physijs.Scene.prototype._updateVehicles = function( data ) {
var vehicle, wheel,
i, offset,
quat = new THREE.Quaternion();
for ( i = 0; i < ( data.length - 1 ) / VEHICLEREPORT_ITEMSIZE; i++ ) {
offset = 1 + i * VEHICLEREPORT_ITEMSIZE;
vehicle = this._vehicles[ data[ offset ] ];
if ( vehicle === undefined ) {
continue;
}
wheel = vehicle.wheels[ data[ offset + 1 ] ];
wheel.position.set(
data[ offset + 2 ],
data[ offset + 3 ],
data[ offset + 4 ]
);
quat.set(data[ offset + 5 ],
data[ offset + 6 ],
data[ offset + 7 ],
data[ offset + 8 ]);
// If some model rotation has been set,
// ie to use the same wheel model on both sides,
// apply that now
if (! wheel.model_rotation.equals(new THREE.Quaternion(0, 0, 0, 0))) {
quat.multiply(wheel.model_rotation);
}
wheel.quaternion.copy(quat);
}
if ( SUPPORT_TRANSFERABLE ) {
// Give the typed array back to the worker
this._worker.transferableMessage( data.buffer, [data.buffer] );
}
};
Physijs.Scene.prototype._updateConstraints = function( data ) {
var constraint, object,
i, offset;
for ( i = 0; i < ( data.length - 1 ) / CONSTRAINTREPORT_ITEMSIZE; i++ ) {
offset = 1 + i * CONSTRAINTREPORT_ITEMSIZE;
constraint = this._constraints[ data[ offset ] ];
object = this._objects[ data[ offset + 1 ] ];
if ( constraint === undefined || object === undefined ) {
continue;
}
_temp_vector3_1.set(
data[ offset + 2 ],
data[ offset + 3 ],
data[ offset + 4 ]
);
_temp_matrix4_1.extractRotation( object.matrix );
_temp_vector3_1.applyMatrix4( _temp_matrix4_1 );
constraint.positiona.addVectors( object.position, _temp_vector3_1 );
constraint.appliedImpulse = data[ offset + 5 ] ;
}
if ( SUPPORT_TRANSFERABLE ) {
// Give the typed array back to the worker
this._worker.transferableMessage( data.buffer, [data.buffer] );
}
};
Physijs.Scene.prototype._updateCollisions = function( data ) {
/**
* #TODO
* This is probably the worst way ever to handle collisions. The inherent evilness is a residual
* effect from the previous version's evilness which mutated when switching to transferable objects.
*
* If you feel inclined to make this better, please do so.
*/
var i, j, offset, object, object2, id1, id2,
collisions = {}, normal_offsets = {};
// Build collision manifest
for ( i = 0; i < data[1]; i++ ) {
offset = 2 + i * COLLISIONREPORT_ITEMSIZE;
object = data[ offset ];
object2 = data[ offset + 1 ];
normal_offsets[ object + '-' + object2 ] = offset + 2;
normal_offsets[ object2 + '-' + object ] = -1 * ( offset + 2 );
// Register collisions for both the object colliding and the object being collided with
if ( !collisions[ object ] ) collisions[ object ] = [];
collisions[ object ].push( object2 );
if ( !collisions[ object2 ] ) collisions[ object2 ] = [];
collisions[ object2 ].push( object );
}
// Deal with collisions
for ( id1 in this._objects ) {
if ( !this._objects.hasOwnProperty( id1 ) ) continue;
object = this._objects[ id1 ];
// If object touches anything, ...
if ( collisions[ id1 ] ) {
// Clean up touches array
for ( j = 0; j < object._physijs.touches.length; j++ ) {
if ( collisions[ id1 ].indexOf( object._physijs.touches[j] ) === -1 ) {
object._physijs.touches.splice( j--, 1 );
}
}
// Handle each colliding object
for ( j = 0; j < collisions[ id1 ].length; j++ ) {
id2 = collisions[ id1 ][ j ];
object2 = this._objects[ id2 ];
if ( object2 ) {
// If object was not already touching object2, notify object
if ( object._physijs.touches.indexOf( id2 ) === -1 ) {
object._physijs.touches.push( id2 );
_temp_vector3_1.subVectors( object.getLinearVelocity(), object2.getLinearVelocity() );
_temp1 = _temp_vector3_1.clone();
_temp_vector3_1.subVectors( object.getAngularVelocity(), object2.getAngularVelocity() );
_temp2 = _temp_vector3_1.clone();
var normal_offset = normal_offsets[ object._physijs.id + '-' + object2._physijs.id ];
if ( normal_offset > 0 ) {
_temp_vector3_1.set(
-data[ normal_offset ],
-data[ normal_offset + 1 ],
-data[ normal_offset + 2 ]
);
} else {
normal_offset *= -1;
_temp_vector3_1.set(
data[ normal_offset ],
data[ normal_offset + 1 ],
data[ normal_offset + 2 ]
);
}
object.dispatchEvent( 'collision', object2, _temp1, _temp2, _temp_vector3_1 );
}
}
}
} else {
// not touching other objects
object._physijs.touches.length = 0;
}
}
this.collisions = collisions;
if ( SUPPORT_TRANSFERABLE ) {
// Give the typed array back to the worker
this._worker.transferableMessage( data.buffer, [data.buffer] );
}
};
Physijs.Scene.prototype.addConstraint = function ( constraint, show_marker ) {
this._constraints[ constraint.id ] = constraint;
this.execute( 'addConstraint', constraint.getDefinition() );
if ( show_marker ) {
var marker;
switch ( constraint.type ) {
case 'point':
marker = new THREE.Mesh(
new THREE.SphereGeometry( 1.5 ),
new THREE.MeshNormalMaterial
);
marker.position.copy( constraint.positiona );
this._objects[ constraint.objecta ].add( marker );
break;
case 'hinge':
marker = new THREE.Mesh(
new THREE.SphereGeometry( 1.5 ),
new THREE.MeshNormalMaterial
);
marker.position.copy( constraint.positiona );
this._objects[ constraint.objecta ].add( marker );
break;
case 'slider':
marker = new THREE.Mesh(
new THREE.BoxGeometry( 10, 1, 1 ),
new THREE.MeshNormalMaterial
);
marker.position.copy( constraint.positiona );
// This rotation isn't right if all three axis are non-0 values
// TODO: change marker's rotation order to ZYX
marker.rotation.set(
constraint.axis.y, // yes, y and
constraint.axis.x, // x axis are swapped
constraint.axis.z
);
this._objects[ constraint.objecta ].add( marker );
break;
case 'conetwist':
marker = new THREE.Mesh(
new THREE.SphereGeometry( 1.5 ),
new THREE.MeshNormalMaterial
);
marker.position.copy( constraint.positiona );
this._objects[ constraint.objecta ].add( marker );
break;
case 'dof':
marker = new THREE.Mesh(
new THREE.SphereGeometry( 1.5 ),
new THREE.MeshNormalMaterial
);
marker.position.copy( constraint.positiona );
this._objects[ constraint.objecta ].add( marker );
break;
}
}
return constraint;
};
Physijs.Scene.prototype.onSimulationResume = function() {
this.execute( 'onSimulationResume', { } );
};
Physijs.Scene.prototype.removeConstraint = function( constraint ) {
if ( this._constraints[constraint.id ] !== undefined ) {
this.execute( 'removeConstraint', { id: constraint.id } );
delete this._constraints[ constraint.id ];
}
};
Physijs.Scene.prototype.execute = function( cmd, params ) {
this._worker.postMessage({ cmd: cmd, params: params });
};
addObjectChildren = function( parent, object ) {
var i;
for ( i = 0; i < object.children.length; i++ ) {
if ( object.children[i]._physijs ) {
object.children[i].updateMatrix();
object.children[i].updateMatrixWorld();
_temp_vector3_1.setFromMatrixPosition( object.children[i].matrixWorld );
_quaternion_1.setFromRotationMatrix( object.children[i].matrixWorld );
object.children[i]._physijs.position_offset = {
x: _temp_vector3_1.x,
y: _temp_vector3_1.y,
z: _temp_vector3_1.z
};
object.children[i]._physijs.rotation = {
x: _quaternion_1.x,
y: _quaternion_1.y,
z: _quaternion_1.z,
w: _quaternion_1.w
};
parent._physijs.children.push( object.children[i]._physijs );
}
addObjectChildren( parent, object.children[i] );
}
};
Physijs.Scene.prototype.add = function( object ) {
THREE.Mesh.prototype.add.call( this, object );
if ( object._physijs ) {
object.world = this;
if ( object instanceof Physijs.Vehicle ) {
this.add( object.mesh );
this._vehicles[ object._physijs.id ] = object;
this.execute( 'addVehicle', object._physijs );
} else {
object.__dirtyPosition = false;
object.__dirtyRotation = false;
this._objects[object._physijs.id] = object;
if ( object.children.length ) {
object._physijs.children = [];
addObjectChildren( object, object );
}
if ( object.material._physijs ) {
if ( !this._materials_ref_counts.hasOwnProperty( object.material._physijs.id ) ) {
this.execute( 'registerMaterial', object.material._physijs );
object._physijs.materialId = object.material._physijs.id;
this._materials_ref_counts[object.material._physijs.id] = 1;
} else {
this._materials_ref_counts[object.material._physijs.id]++;
}
}
// Object starting position + rotation
object._physijs.position = { x: object.position.x, y: object.position.y, z: object.position.z };
object._physijs.rotation = { x: object.quaternion.x, y: object.quaternion.y, z: object.quaternion.z, w: object.quaternion.w };
// Check for scaling
var mass_scaling = new THREE.Vector3( 1, 1, 1 );
if ( object._physijs.width ) {
object._physijs.width *= object.scale.x;
}
if ( object._physijs.height ) {
object._physijs.height *= object.scale.y;
}
if ( object._physijs.depth ) {
object._physijs.depth *= object.scale.z;
}
this.execute( 'addObject', object._physijs );
}
}
};
Physijs.Scene.prototype.remove = function( object ) {
if ( object instanceof Physijs.Vehicle ) {
this.execute( 'removeVehicle', { id: object._physijs.id } );
while( object.wheels.length ) {
this.remove( object.wheels.pop() );
}
this.remove( object.mesh );
delete this._vehicles[ object._physijs.id ];
} else {
THREE.Mesh.prototype.remove.call( this, object );
if ( object._physijs ) {
delete this._objects[object._physijs.id];
this.execute( 'removeObject', { id: object._physijs.id } );
}
}
if ( object.material && object.material._physijs && this._materials_ref_counts.hasOwnProperty( object.material._physijs.id ) ) {
this._materials_ref_counts[object.material._physijs.id]--;
if(this._materials_ref_counts[object.material._physijs.id] == 0) {
this.execute( 'unRegisterMaterial', object.material._physijs );
delete this._materials_ref_counts[object.material._physijs.id];
}
}
};
Physijs.Scene.prototype.setFixedTimeStep = function( fixedTimeStep ) {
if ( fixedTimeStep ) {
this.execute( 'setFixedTimeStep', fixedTimeStep );
}
};
Physijs.Scene.prototype.setGravity = function( gravity ) {
if ( gravity ) {
this.execute( 'setGravity', gravity );
}
};
Physijs.Scene.prototype.simulate = function( timeStep, maxSubSteps ) {
var object_id, object, update;
if ( _is_simulating ) {
return false;
}
_is_simulating = true;
for ( object_id in this._objects ) {
if ( !this._objects.hasOwnProperty( object_id ) ) continue;
object = this._objects[object_id];
if ( object.__dirtyPosition || object.__dirtyRotation ) {
update = { id: object._physijs.id };
if ( object.__dirtyPosition ) {
update.pos = { x: object.position.x, y: object.position.y, z: object.position.z };
object.__dirtyPosition = false;
}
if ( object.__dirtyRotation ) {
update.quat = { x: object.quaternion.x, y: object.quaternion.y, z: object.quaternion.z, w: object.quaternion.w };
object.__dirtyRotation = false;
}
this.execute( 'updateTransform', update );
}
}
this.execute( 'simulate', { timeStep: timeStep, maxSubSteps: maxSubSteps } );
return true;
};
// Phsijs.Mesh
Physijs.Mesh = function ( geometry, material, mass ) {
var index;
if ( !geometry ) {
return;
}
Eventable.call( this );
THREE.Mesh.call( this, geometry, material );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
this._physijs = {
type: null,
id: getObjectId(),
mass: mass || 0,
touches: [],
linearVelocity: new THREE.Vector3,
angularVelocity: new THREE.Vector3
};
};
Physijs.Mesh.prototype = new THREE.Mesh;
Physijs.Mesh.prototype.constructor = Physijs.Mesh;
Eventable.make( Physijs.Mesh );
// Physijs.Mesh.mass
Physijs.Mesh.prototype.__defineGetter__('mass', function() {
return this._physijs.mass;
});
Physijs.Mesh.prototype.__defineSetter__('mass', function( mass ) {
this._physijs.mass = mass;
if ( this.world ) {
this.world.execute( 'updateMass', { id: this._physijs.id, mass: mass } );
}
});
// Physijs.Mesh.applyCentralImpulse
Physijs.Mesh.prototype.applyCentralImpulse = function ( force ) {
if ( this.world ) {
this.world.execute( 'applyCentralImpulse', { id: this._physijs.id, x: force.x, y: force.y, z: force.z } );
}
};
// Physijs.Mesh.applyImpulse
Physijs.Mesh.prototype.applyImpulse = function ( force, offset ) {
if ( this.world ) {
this.world.execute( 'applyImpulse', { id: this._physijs.id, impulse_x: force.x, impulse_y: force.y, impulse_z: force.z, x: offset.x, y: offset.y, z: offset.z } );
}
};
// Physijs.Mesh.applyCentralForce
Physijs.Mesh.prototype.applyCentralForce = function ( force ) {
if ( this.world ) {
this.world.execute( 'applyCentralForce', { id: this._physijs.id, x: force.x, y: force.y, z: force.z } );
}
};
// Physijs.Mesh.applyForce
Physijs.Mesh.prototype.applyForce = function ( force, offset ) {
if ( this.world ) {
this.world.execute( 'applyForce', { id: this._physijs.id, force_x: force.x, force_y : force.y, force_z : force.z, x: offset.x, y: offset.y, z: offset.z } );
}
};
// Physijs.Mesh.getAngularVelocity
Physijs.Mesh.prototype.getAngularVelocity = function () {
return this._physijs.angularVelocity;
};
// Physijs.Mesh.setAngularVelocity
Physijs.Mesh.prototype.setAngularVelocity = function ( velocity ) {
if ( this.world ) {
this.world.execute( 'setAngularVelocity', { id: this._physijs.id, x: velocity.x, y: velocity.y, z: velocity.z } );
}
};
// Physijs.Mesh.getLinearVelocity
Physijs.Mesh.prototype.getLinearVelocity = function () {
return this._physijs.linearVelocity;
};
// Physijs.Mesh.setLinearVelocity
Physijs.Mesh.prototype.setLinearVelocity = function ( velocity ) {
if ( this.world ) {
this.world.execute( 'setLinearVelocity', { id: this._physijs.id, x: velocity.x, y: velocity.y, z: velocity.z } );
}
};
// Physijs.Mesh.setAngularFactor
Physijs.Mesh.prototype.setAngularFactor = function ( factor ) {
if ( this.world ) {
this.world.execute( 'setAngularFactor', { id: this._physijs.id, x: factor.x, y: factor.y, z: factor.z } );
}
};
// Physijs.Mesh.setLinearFactor
Physijs.Mesh.prototype.setLinearFactor = function ( factor ) {
if ( this.world ) {
this.world.execute( 'setLinearFactor', { id: this._physijs.id, x: factor.x, y: factor.y, z: factor.z } );
}
};
// Physijs.Mesh.setDamping
Physijs.Mesh.prototype.setDamping = function ( linear, angular ) {
if ( this.world ) {
this.world.execute( 'setDamping', { id: this._physijs.id, linear: linear, angular: angular } );
}
};
// Physijs.Mesh.setCcdMotionThreshold
Physijs.Mesh.prototype.setCcdMotionThreshold = function ( threshold ) {
if ( this.world ) {
this.world.execute( 'setCcdMotionThreshold', { id: this._physijs.id, threshold: threshold } );
}
};
// Physijs.Mesh.setCcdSweptSphereRadius
Physijs.Mesh.prototype.setCcdSweptSphereRadius = function ( radius ) {
if ( this.world ) {
this.world.execute( 'setCcdSweptSphereRadius', { id: this._physijs.id, radius: radius } );
}
};
// Physijs.PlaneMesh
Physijs.PlaneMesh = function ( geometry, material, mass ) {
var width, height;
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
this._physijs.type = 'plane';
this._physijs.normal = geometry.faces[0].normal.clone();
this._physijs.mass = (typeof mass === 'undefined') ? width * height : mass;
};
Physijs.PlaneMesh.prototype = new Physijs.Mesh;
Physijs.PlaneMesh.prototype.constructor = Physijs.PlaneMesh;
// Physijs.HeightfieldMesh
Physijs.HeightfieldMesh = function ( geometry, material, mass, xdiv, ydiv) {
Physijs.Mesh.call( this, geometry, material, mass );
this._physijs.type = 'heightfield';
this._physijs.xsize = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
this._physijs.ysize = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
this._physijs.xpts = (typeof xdiv === 'undefined') ? Math.sqrt(geometry.vertices.length) : xdiv + 1;
this._physijs.ypts = (typeof ydiv === 'undefined') ? Math.sqrt(geometry.vertices.length) : ydiv + 1;
// note - this assumes our plane geometry is square, unless we pass in specific xdiv and ydiv
this._physijs.absMaxHeight = Math.max(geometry.boundingBox.max.z,Math.abs(geometry.boundingBox.min.z));
var points = [];
var a, b;
for ( var i = 0; i < geometry.vertices.length; i++ ) {
a = i % this._physijs.xpts;
b = Math.round( ( i / this._physijs.xpts ) - ( (i % this._physijs.xpts) / this._physijs.xpts ) );
points[i] = geometry.vertices[ a + ( ( this._physijs.ypts - b - 1 ) * this._physijs.ypts ) ].z;
//points[i] = geometry.vertices[i];
}
this._physijs.points = points;
};
Physijs.HeightfieldMesh.prototype = new Physijs.Mesh;
Physijs.HeightfieldMesh.prototype.constructor = Physijs.HeightfieldMesh;
// Physijs.BoxMesh
Physijs.BoxMesh = function( geometry, material, mass ) {
var width, height, depth;
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
depth = geometry.boundingBox.max.z - geometry.boundingBox.min.z;
this._physijs.type = 'box';
this._physijs.width = width;
this._physijs.height = height;
this._physijs.depth = depth;
this._physijs.mass = (typeof mass === 'undefined') ? width * height * depth : mass;
};
Physijs.BoxMesh.prototype = new Physijs.Mesh;
Physijs.BoxMesh.prototype.constructor = Physijs.BoxMesh;
// Physijs.SphereMesh
Physijs.SphereMesh = function( geometry, material, mass ) {
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingSphere ) {
geometry.computeBoundingSphere();
}
this._physijs.type = 'sphere';
this._physijs.radius = geometry.boundingSphere.radius;
this._physijs.mass = (typeof mass === 'undefined') ? (4/3) * Math.PI * Math.pow(this._physijs.radius, 3) : mass;
};
Physijs.SphereMesh.prototype = new Physijs.Mesh;
Physijs.SphereMesh.prototype.constructor = Physijs.SphereMesh;
// Physijs.CylinderMesh
Physijs.CylinderMesh = function( geometry, material, mass ) {
var width, height, depth;
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
depth = geometry.boundingBox.max.z - geometry.boundingBox.min.z;
this._physijs.type = 'cylinder';
this._physijs.width = width;
this._physijs.height = height;
this._physijs.depth = depth;
this._physijs.mass = (typeof mass === 'undefined') ? width * height * depth : mass;
};
Physijs.CylinderMesh.prototype = new Physijs.Mesh;
Physijs.CylinderMesh.prototype.constructor = Physijs.CylinderMesh;
// Physijs.CapsuleMesh
Physijs.CapsuleMesh = function( geometry, material, mass ) {
var width, height, depth;
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
depth = geometry.boundingBox.max.z - geometry.boundingBox.min.z;
this._physijs.type = 'capsule';
this._physijs.radius = Math.max(width / 2, depth / 2);
this._physijs.height = height;
this._physijs.mass = (typeof mass === 'undefined') ? width * height * depth : mass;
};
Physijs.CapsuleMesh.prototype = new Physijs.Mesh;
Physijs.CapsuleMesh.prototype.constructor = Physijs.CapsuleMesh;
// Physijs.ConeMesh
Physijs.ConeMesh = function( geometry, material, mass ) {
var width, height, depth;
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
this._physijs.type = 'cone';
this._physijs.radius = width / 2;
this._physijs.height = height;
this._physijs.mass = (typeof mass === 'undefined') ? width * height : mass;
};
Physijs.ConeMesh.prototype = new Physijs.Mesh;
Physijs.ConeMesh.prototype.constructor = Physijs.ConeMesh;
// Physijs.ConcaveMesh
Physijs.ConcaveMesh = function( geometry, material, mass ) {
var i,
width, height, depth,
vertices, face, triangles = [];
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
vertices = geometry.vertices;
for ( i = 0; i < geometry.faces.length; i++ ) {
face = geometry.faces[i];
if ( face instanceof THREE.Face3) {
triangles.push([
{ x: vertices[face.a].x, y: vertices[face.a].y, z: vertices[face.a].z },
{ x: vertices[face.b].x, y: vertices[face.b].y, z: vertices[face.b].z },
{ x: vertices[face.c].x, y: vertices[face.c].y, z: vertices[face.c].z }
]);
} else if ( face instanceof THREE.Face4 ) {
triangles.push([
{ x: vertices[face.a].x, y: vertices[face.a].y, z: vertices[face.a].z },
{ x: vertices[face.b].x, y: vertices[face.b].y, z: vertices[face.b].z },
{ x: vertices[face.d].x, y: vertices[face.d].y, z: vertices[face.d].z }
]);
triangles.push([
{ x: vertices[face.b].x, y: vertices[face.b].y, z: vertices[face.b].z },
{ x: vertices[face.c].x, y: vertices[face.c].y, z: vertices[face.c].z },
{ x: vertices[face.d].x, y: vertices[face.d].y, z: vertices[face.d].z }
]);
}
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
depth = geometry.boundingBox.max.z - geometry.boundingBox.min.z;
this._physijs.type = 'concave';
this._physijs.triangles = triangles;
this._physijs.mass = (typeof mass === 'undefined') ? width * height * depth : mass;
};
Physijs.ConcaveMesh.prototype = new Physijs.Mesh;
Physijs.ConcaveMesh.prototype.constructor = Physijs.ConcaveMesh;
// Physijs.ConvexMesh
Physijs.ConvexMesh = function( geometry, material, mass ) {
var i,
width, height, depth,
points = [];
Physijs.Mesh.call( this, geometry, material, mass );
if ( !geometry.boundingBox ) {
geometry.computeBoundingBox();
}
for ( i = 0; i < geometry.vertices.length; i++ ) {
points.push({
x: geometry.vertices[i].x,
y: geometry.vertices[i].y,
z: geometry.vertices[i].z
});
}
width = geometry.boundingBox.max.x - geometry.boundingBox.min.x;
height = geometry.boundingBox.max.y - geometry.boundingBox.min.y;
depth = geometry.boundingBox.max.z - geometry.boundingBox.min.z;
this._physijs.type = 'convex';
this._physijs.points = points;
this._physijs.mass = (typeof mass === 'undefined') ? width * height * depth : mass;
};
Physijs.ConvexMesh.prototype = new Physijs.Mesh;
Physijs.ConvexMesh.prototype.constructor = Physijs.ConvexMesh;
// Physijs.Vehicle
Physijs.Vehicle = function( mesh, tuning ) {
tuning = tuning || new Physijs.VehicleTuning;
this.mesh = mesh;
this.wheels = [];
this._physijs = {
id: getObjectId(),
rigidBody: mesh._physijs.id,
suspension_stiffness: tuning.suspension_stiffness,
suspension_compression: tuning.suspension_compression,
suspension_damping: tuning.suspension_damping,
max_suspension_travel: tuning.max_suspension_travel,
friction_slip: tuning.friction_slip,
max_suspension_force: tuning.max_suspension_force
};
};
Physijs.Vehicle.prototype.addWheel = function( wheel_geometry, wheel_material, connection_point, wheel_direction, wheel_axle, wheel_model_rotation, suspension_rest_length, wheel_radius, is_front_wheel, tuning ) {
var wheel = new THREE.Mesh( wheel_geometry, wheel_material );
wheel.castShadow = wheel.receiveShadow = true;
wheel.position.copy( wheel_direction ).multiplyScalar( suspension_rest_length / 100 ).add( connection_point );
wheel.model_rotation = new THREE.Quaternion().copy(wheel_model_rotation);
this.world.add( wheel );
this.wheels.push( wheel );
this.world.execute( 'addWheel', {
id: this._physijs.id,
connection_point: { x: connection_point.x, y: connection_point.y, z: connection_point.z },
wheel_direction: { x: wheel_direction.x, y: wheel_direction.y, z: wheel_direction.z },
wheel_axle: { x: wheel_axle.x, y: wheel_axle.y, z: wheel_axle.z },
suspension_rest_length: suspension_rest_length,
wheel_radius: wheel_radius,
is_front_wheel: is_front_wheel,
tuning: tuning
});
};
Physijs.Vehicle.prototype.setSteering = function( amount, wheel ) {
if ( wheel !== undefined && this.wheels[ wheel ] !== undefined ) {
this.world.execute( 'setSteering', { id: this._physijs.id, wheel: wheel, steering: amount } );
} else if ( this.wheels.length > 0 ) {
for ( var i = 0; i < this.wheels.length; i++ ) {
this.world.execute( 'setSteering', { id: this._physijs.id, wheel: i, steering: amount } );
}
}
};
Physijs.Vehicle.prototype.setBrake = function( amount, wheel ) {
if ( wheel !== undefined && this.wheels[ wheel ] !== undefined ) {
this.world.execute( 'setBrake', { id: this._physijs.id, wheel: wheel, brake: amount } );
} else if ( this.wheels.length > 0 ) {
for ( var i = 0; i < this.wheels.length; i++ ) {
this.world.execute( 'setBrake', { id: this._physijs.id, wheel: i, brake: amount } );
}
}
};
Physijs.Vehicle.prototype.applyEngineForce = function( amount, wheel ) {
if ( wheel !== undefined && this.wheels[ wheel ] !== undefined ) {
this.world.execute( 'applyEngineForce', { id: this._physijs.id, wheel: wheel, force: amount } );
} else if ( this.wheels.length > 0 ) {
for ( var i = 0; i < this.wheels.length; i++ ) {
this.world.execute( 'applyEngineForce', { id: this._physijs.id, wheel: i, force: amount } );
}
}
};
// Physijs.VehicleTuning
Physijs.VehicleTuning = function( suspension_stiffness, suspension_compression, suspension_damping, max_suspension_travel, friction_slip, max_suspension_force ) {
this.suspension_stiffness = suspension_stiffness !== undefined ? suspension_stiffness : 5.88;
this.suspension_compression = suspension_compression !== undefined ? suspension_compression : 0.83;
this.suspension_damping = suspension_damping !== undefined ? suspension_damping : 0.88;
this.max_suspension_travel = max_suspension_travel !== undefined ? max_suspension_travel : 500;
this.friction_slip = friction_slip !== undefined ? friction_slip : 10.5;
this.max_suspension_force = max_suspension_force !== undefined ? max_suspension_force : 6000;
};
return Physijs;
})();
|
var filename='http://themes.3rdwavemedia.com/demo/orbit/demo-only/demo-ads.css?' + new Date().getTime();
var fileref=document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
document.getElementsByTagName("head")[0].appendChild(fileref);
var demoad = document.createElement('div');
demoad.id = 'ads-container';
demoad.innerHTML = '<span id="ads-close"><i class="fa fa-close"></i></span>';
document.getElementsByTagName('body')[0].appendChild(demoad);
document.getElementById('ads-close').addEventListener('click',function(e){
demoad.style.display = 'none';
e.preventDefault();
});
var adscript = document.createElement('script');
adscript.type = 'text/javascript';
adscript.async = true;
adscript.id = '_carbonads_js';
adscript.src = '//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=themes3rdwavemediacom';
demoad.appendChild(adscript);
var adChecked = false;
var attempts = 5;
var cntAttempts = 0;
var adInterval;
function checkAd() {
if (adChecked || cntAttempts >= attempts) {
clearInterval(adInterval);
return;
}
cntAttempts++;
var carbonImg = document.querySelector('.carbon-img');
if (!carbonImg) return;
var adImgHeight = carbonImg.offsetHeight;
if (adImgHeight >= 30) {
_gaq.push(['_trackEvent', 'Developer Theme Demo Ad', 'Carbon Ad VISIBLE','Carbon Ad']);
adChecked = true;
}
}
if(window._gaq) {
_gaq.push(['_trackEvent', 'Developer Theme Demo Ad', 'Carbon ad included', '1']);
adInterval = setInterval(checkAd, 3000);
}
|
/* @flow */
import arrayReduce from 'fast-loops/lib/arrayReduce'
function addIsolation(style: Object, exclude: Array<string> = []): Object {
if (style.isolation === false) {
// remove the isolation prop to
// prevent false CSS properties
delete style.isolation
return style
}
const excludedDeclarations = arrayReduce(
exclude,
(exclusion, property) => {
exclusion[property] = 'inherit'
return exclusion
},
{}
)
return {
all: 'initial',
...excludedDeclarations,
...style,
}
}
export default function isolation(options: Object = {}) {
return (style: Object) => addIsolation(style, options.exclude)
}
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
crypto = require('crypto');
/**
* A Validation function for local strategy properties
*/
var validateLocalStrategyProperty = function(property) {
return ((this.provider !== 'local' && !this.updated) || property.length);
};
/**
* A Validation function for local strategy password
*/
var validateLocalStrategyPassword = function(password) {
return (this.provider !== 'local' || (password && password.length > 6));
};
/**
* User Schema
*/
var UserSchema = new Schema({
firstName: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your first name']
},
lastName: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your last name']
},
displayName: {
type: String,
trim: true,
list:true
},
email: {
type: String,
trim: true,
default: '',
validate: [validateLocalStrategyProperty, 'Please fill in your email'],
match: [/.+\@.+\..+/, 'Please fill a valid email address']
},
username: {
type: String,
unique: true,
required: 'Please fill in a username',
trim: true,
form: {hidden:true}
},
password: {
type: String,
default: '',
validate: [validateLocalStrategyPassword, 'Password should be longer'],
form: {hidden:true}
},
language: {
type: Schema.Types.Mixed,
default: ''
},
salt: {
type: String,
form: {hidden:true}
},
provider: {
type: String,
required: 'Provider is required',
form: {hidden:true}
},
roles: {
type: [{
type: String,
enum: ['user', 'admin']
}],
default: ['user']
},
updated: {
type: Date,
form: {hidden:true}
},
created: {
type: Date,
default: Date.now,
form: {hidden:true}
},
providerData: {
type: Schema.Types.Mixed,
form: {hidden:true}
},
additionalProvidersData: {
type: Schema.Types.Mixed,
form: {hidden:true}
},
});
/**
* Hook a pre save method to hash the password
*/
UserSchema.pre('save', function(next) {
if (this.password && this.password.length > 6) {
this.salt = new Buffer(crypto.randomBytes(16).toString('base64'), 'base64');
this.password = this.hashPassword(this.password);
}
next();
});
/**
* Create instance method for hashing a password
*/
UserSchema.methods.hashPassword = function(password) {
if (this.salt && password) {
return crypto.pbkdf2Sync(password, this.salt, 10000, 64).toString('base64');
} else {
return password;
}
};
/**
* Create instance method for authenticating user
*/
UserSchema.methods.authenticate = function(password) {
return this.password === this.hashPassword(password);
};
/**
* Find possible not used username
*/
UserSchema.statics.findUniqueUsername = function(username, suffix, callback) {
var _this = this;
var possibleUsername = username + (suffix || '');
_this.findOne({
username: possibleUsername
}, function(err, user) {
if (!err) {
if (!user) {
callback(possibleUsername);
} else {
return _this.findUniqueUsername(username, (suffix || 0) + 1, callback);
}
} else {
callback(null);
}
});
};
var User;
try {
User = mongoose.model('User');
} catch (e) {
User = mongoose.model('User', UserSchema);
}
|
var PositionGizmo = Fire.extend("Fire.PositionGizmo",
Editor.Gizmo,
function () {
var svg = arguments[0];
var target = arguments[1];
this.allowMultiTarget = true;
var worldposList = [];
var entities = target;
var self = this;
this._root = svg.positionTool ( {
start: function () {
worldposList.length = 0;
for ( var i = 0; i < entities.length; ++i ) {
worldposList.push(entities[i].transform.worldPosition);
}
},
update: function ( dx, dy ) {
var cameraScale = svg.view.height / svg.camera.size;
var delta = new Fire.Vec2( dx/cameraScale, -dy/cameraScale );
for ( var i = 0; i < worldposList.length; ++i ) {
entities[i].transform.worldPosition = worldposList[i].add(delta);
}
self.dirty();
},
} );
});
//
PositionGizmo.prototype.update = function () {
var activeTarget = this.entity;
var worldpos,screenpos,rotation;
if ( this.pivot === "center" ) {
worldpos = Editor.GizmosUtils.getCenter(this.target);
screenpos = this._svg.camera.worldToScreen(worldpos);
screenpos.x = Editor.GizmosUtils.snapPixel(screenpos.x);
screenpos.y = Editor.GizmosUtils.snapPixel(screenpos.y);
this._root.position = screenpos;
this._root.rotation = 0.0;
}
else {
var localToWorld = activeTarget.transform.getLocalToWorldMatrix();
worldpos = new Fire.Vec2(localToWorld.tx, localToWorld.ty);
screenpos = this._svg.camera.worldToScreen(worldpos);
rotation = -activeTarget.transform.worldRotation;
screenpos.x = Editor.GizmosUtils.snapPixel(screenpos.x);
screenpos.y = Editor.GizmosUtils.snapPixel(screenpos.y);
this._root.position = screenpos;
this._root.rotation = 0.0;
if ( this.coordinate !== "global" ) {
this._root.rotation = rotation;
}
}
this._root.translate( this._root.position.x, this._root.position.y )
.rotate( this._root.rotation, this._root.position.x, this._root.position.y )
;
};
Editor.PositionGizmo = PositionGizmo;
|
const path = require("path");
class JavaCodeResolvePlugin {
constructor(options) {
this.options = options || {};
if (!("targetRoot" in this.options)) {
throw new Error("`targetRoot` is required option.");
}
}
apply(resolver) {
const target = resolver.ensureHook("raw-file");
resolver.getHook("described-resolve").tapAsync("JavaCodeResolvePlugin", (request, resolveContext, callback) => {
if (request.request === "java-code-class") {
const javaFqdn = request.query.substring(1);
const filePath = resolver.join(this.options.targetRoot, javaFqdn.replace(/\./g, "/"));
const newRequest = Object.assign({}, request, {
path: filePath,
relativePath: "./" + path.relative(request.descriptionFileRoot, filePath),
query: "",
request: filePath
});
resolver.doResolve(target, newRequest, `Java class with mapping: ${request.request}${request.query} to ${filePath}`, resolveContext, callback);
} else {
return callback();
}
});
}
}
module.exports = JavaCodeResolvePlugin;
|
define({
"_widgetLabel": "Business Analyst",
"addPoint": "Legg til punkt ved å klikke på kartet",
"addRingsDtWt": "Legg til ringer, kjøretid eller gåtid.",
"apply": "Bruk",
"back": "Tilbake",
"colon": ":",
"creditInformation": "Creditinformasjon",
"driveTime": "Kjøretid",
"esriInfographics": "Esri-infografikk",
"esriReports": "Esri-rapporter",
"headerDescription_km": "kilometer",
"headerDescription_miles": "mile",
"headerDescription_minutes": "minutt",
"infographics": "Infografikk",
"invalidValueRing": "Verdiene må være fra 0 til 1000.",
"invalidValueDTWT": "Verdiene må være fra 0 til 300.",
"km": "km",
"miles": "miles",
"minutes": "minutter",
"myInfographics": "Min infografikk",
"myReports": "Mine rapporter",
"noPermissions": "Kontoen din kan ikke kjøre miniprogrammet Business Analyst. Hvis du vil kjøre Business Analyst, må administratoren for organisasjonen gi deg <a href=\"http://doc.arcgis.com/en/arcgis-online/reference/roles.htm\" target=\"_blank\">tillatelsene</a> Geoberikelse og Nettverksanalyse samt tildele <a href=\"https://doc.arcgis.com/en/arcgis-online/administer/configure-credits.htm?\" target=\"_blank\">credits</a>.",
"radii": "radier",
"radius": "Radius",
"radius_lowercase": "radius",
"reports": "Rapporter",
"ring": "Ring",
"rings": "Ringer",
"runInfographic": "Kjør infografikk",
"runReport": "Kjør rapport",
"selectPointOrPolygon": "Velg et punkt- eller polygongeoobjekt i kartet, søk etter en adresse eller et sted, eller plasser en nål på kartet for å vise med informasjon om områder.",
"selectReport": "Velg rapport",
"selectTemplate": "Velg mal",
"sharedInfographics": "Delt infografikk",
"sharedReports": "Delte rapporter",
"thisEntryIsNotValid": "Denne oppføringen er ikke gyldig.",
"time": "Tid",
"walkTime": "Gåtid",
"widgetDescription": "Åpne infografikk og rapporter som oppsummerer viktige indikatorer og data for et område.",
"None": "Velg..."
});
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _reactIconBase = require('react-icon-base');
var _reactIconBase2 = _interopRequireDefault(_reactIconBase);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MdSettingsPower = function MdSettingsPower(props) {
return _react2.default.createElement(
_reactIconBase2.default,
_extends({ viewBox: '0 0 40 40' }, props),
_react2.default.createElement(
'g',
null,
_react2.default.createElement('path', { d: 'm25 40v-3.4h3.4v3.4h-3.4z m2.6-32.6c3.4 2.4 5.8 6.4 5.8 11 0 7.3-6.1 13.2-13.4 13.2s-13.4-5.9-13.4-13.2c0-4.6 2.4-8.6 5.8-11l2.4 2.4c-2.9 1.8-4.8 5-4.8 8.6 0 5.5 4.5 10 10 10s10-4.5 10-10c0-3.6-2-6.8-4.8-8.6z m-6-4v16.6h-3.2v-16.6h3.2z m-3.2 36.6v-3.4h3.2v3.4h-3.2z m-6.8 0v-3.4h3.4v3.4h-3.4z' })
)
);
};
exports.default = MdSettingsPower;
module.exports = exports['default'];
|
/**
* Convert degree to gradiant
*
* @param {number} angle Angle in degree
* @return {number} Angle in radian
*/
const COEF = Math.PI / 180;
export default function degreeToRadian( angle ) {
return angle * COEF;
}
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Cursor from './Cursor';
import store from '../store';
/*** Stateful leaf nodes ***/
class Identifier extends Component {
handleClick = (e) => {
const name = this.props.node.name;
const span = this._span;
const bounds = span.getBoundingClientRect();
const width = bounds.right - bounds.left;
const charWidth = width / name.length;
const pos = Math.round((e.pageX - bounds.left) / charWidth);
store.dispatch({
type: 'SELECT',
id: this.props.id,
node: this.props.node,
pos: pos,
});
};
render() {
let content = this.props.node.name;
const { selection } = this.props;
if (selection) {
const before = content.substring(0, selection.pos);
const after = content.substring(selection.pos);
content = [
<span key='before'>{before}</span>,
<Cursor key='cursor' pos={selection.pos}/>,
<span key='after'>{after}</span>
];
}
return <span
onClick={this.handleClick}
ref={node => this._span = node}
style={{color: "#000"}}
>
{content}
</span>;
}
}
class NumberLiteral extends Component {
handleClick = (e) => {
const value = this.props.node.value;
const span = this._span;
const bounds = span.getBoundingClientRect();
const width = bounds.right - bounds.left;
const charWidth = width / value.length;
const pos = Math.round((e.pageX - bounds.left) / charWidth);
store.dispatch({
type: 'SELECT',
id: this.props.id,
node: this.props.node,
pos: pos,
});
};
render() {
let content = this.props.node.value;
const { selection } = this.props;
if (selection) {
const selection = store.getState().selection;
const before = content.substring(0, selection.pos);
const after = content.substring(selection.pos);
content = [
<span key='before'>{before}</span>,
<Cursor key='cursor' pos={selection.pos}/>,
<span key='after'>{after}</span>
];
}
return <span
onClick={this.handleClick}
ref={node => this._span = node}
style={{color: "#00B"}}
>
{content}
</span>;
}
}
class StringLiteral extends Component {
handleClick = (e) => {
const value = `"${this.props.node.value}"`;
const span = this._span;
const bounds = span.getBoundingClientRect();
const width = bounds.right - bounds.left;
const charWidth = width / value.length;
const pos = Math.round((e.pageX - bounds.left) / charWidth);
store.dispatch({
type: 'SELECT',
id: this.props.id,
node: this.props.node,
pos: pos,
});
};
render() {
let content = `"${this.props.node.value}"`;
const { selection } = this.props;
if (selection) {
const selection = store.getState().selection;
const before = content.substring(0, selection.pos);
const after = content.substring(selection.pos);
content = [
<span key='before'>{before}</span>,
<Cursor key='cursor' pos={selection.pos}/>,
<span key='after'>{after}</span>
];
}
// TODO: check whether a user types ' or " to start a string
return <span
onClick={this.handleClick}
ref={node => this._span = node}
style={{color: "#900"}}
>
{content}
</span>;
}
}
class Operator extends Component {
handleClick = (e) => {
const value = this.props.node.operator;
const span = this._span;
const bounds = span.getBoundingClientRect();
const width = bounds.right - bounds.left;
const charWidth = width / value.length;
const pos = Math.round((e.pageX - bounds.left) / charWidth);
store.dispatch({
type: 'SELECT',
node: this.props.node,
id: this.props.id,
pos: pos,
});
};
render() {
let content = this.props.node.operator;
const { selection } = this.props;
if (selection) {
const selection = store.getState().selection;
const before = content.substring(0, selection.pos);
const after = content.substring(selection.pos);
content = [
<span key='before'>{before}</span>,
<Cursor key='cursor' pos={selection.pos}/>,
<span key='after'>{after}</span>
];
}
const style = {
color: "#000",
marginLeft: '0.5em',
marginRight: '0.5em',
};
return <span
onClick={this.handleClick}
ref={node => this._span = node}
style={style}
>
{content}
</span>;
}
}
class Keyword extends Component {
handleClick = (e) => {
store.dispatch({
type: 'SELECT',
node: this.props.node,
id: this.props.id,
});
};
render() {
const node = this.props.node;
const { selection } = this.props;
const style = {
color: "#00F",
backgroundColor: selection ? "#9CF" : "",
};
return <span onClick={this.handleClick} style={style}>
{node.keyword}
</span>;
}
}
class LineComment extends Component {
render() {
const style = {
color: "rgb(76, 136, 107)"
};
return <div style={style}>// {this.props.node.content}</div>;
};
}
class BlockComment extends Component {
render() {
const style = {
color: "rgb(76, 136, 107)"
};
const lines = this.props.node.content.split("\n").map((line, index) => {
return <div key={index}>{" * " + line}</div>;
});
return <div style={style}>
<div>{"/*"}</div>
{lines}
<div>{" */"}</div>
</div>;
}
}
class Placeholder extends Component {
handleClick = (e) => {
store.dispatch({
type: 'SELECT',
node: this.props.node,
id: this.props.id,
});
};
render() {
const { selection } = this.props;
const style = {
color: "#000",
backgroundColor: selection ? "#9CF" : "",
};
return <span onClick={this.handleClick} style={style}>?</span>;
}
}
/*** Stateless nodes ***/
const VariableDeclarator = (props) => {
const { id, init } = props.node;
if (init) {
return <span>
<ConnectedNode node={id}/> = <ConnectedNode node={init}/>
</span>;
} else {
return <span>
<ConnectedNode node={id}/>
</span>;
}
};
// TODO handle 'extends' syntax
const ClassDeclaration = (props) =>{
const { node } = props;
const id = <ConnectedNode node={node.id} />;
const body = <ConnectedNode node={node.body} />;
const open = " {";
const close = "}";
// TODO handle indentation of nested classes
return <div>
<div>
{<ConnectedNode node={node['class']} />}
{' '}
<span>{id}</span>{open}
</div>
<div>{body}</div>
{close}
</div>;
};
const ClassBody = (props) => {
const state = store.getState();
const body = state.nodes.get(props.node.body);
const defs = body.map((def, index) => {
return <ConnectedNode node={def} key={`child-${index}`} />;
});
const style = {
marginLeft: 40,
};
return <div style={style}>{defs}</div>
};
const MethodDefinition = (props) => {
return <div>
<ConnectedNode node={props.node.key} />
<ConnectedNode node={props.node.value} method={true} />
</div>;
};
const FunctionExpression = (props) => {
const { node, method } = props;
const open = "{";
const close = "}";
const body = <ConnectedNode node={node.body} />;
const params = <ConnectedNode node={node.params} />;
return method
? <span>({params}) {open}<div>{body}</div>{close}</span>
: <span>not a method</span>;
};
const ReturnStatement = (props) => {
return <div>
<ConnectedNode node={props.node['return']} />
{' '}
<ConnectedNode node={props.node.argument} />
</div>;
};
const VariableDeclaration = (props) => {
const state = store.getState();
const decls = state.nodes.get(props.node.declarations);
return <span>
<ConnectedNode node={props.node.kind} />
{' '}
<ConnectedNode node={decls[0]} />
</span>;
};
const ExpressionStatement = (props) => {
return <div><ConnectedNode node={props.node.expression} />;</div>;
};
const BlockStatement = (props) => {
const state = store.getState();
const body = state.nodes.get(props.node.body);
const children = body.map((child, index) =>
<ConnectedNode node={child} key={`stmt-${index}`} />);
const style = {
marginLeft: 40
};
return <div style={style}>{children}</div>;
};
const BlankStatement = (props) => {
const contents = ["\u200b"];
if (props.selection) {
contents.push(<Cursor key='cursor' pos={0} />);
}
return <div>{contents}</div>;
};
const AssignmentExpression = (props) => {
const { left, operator, right } = props.node;
return <span>
<ConnectedNode node={left} />
<ConnectedNode node={operator} />
<ConnectedNode node={right} />
</span>;
};
const CallExpression = (props) => {
return <span>
<ConnectedNode node={props.node.callee} />
(<ConnectedNode node={props.node.arguments} />)
</span>;
};
const ForOfStatement = (props) => {
const { node } = props;
const left = <ConnectedNode node={node.left} />;
const right = <ConnectedNode node={node.right} />;
const block = <ConnectedNode node={node.body} />;
const open = "{";
const close = "}";
// TODO handle indentation
return <div>
<div>
<ConnectedNode node={node.for}/> ({left} <ConnectedNode node={node.of}/> {right}) {open}
</div>
{block}
<div>
{close}
</div>
</div>;
};
const BinaryExpression = (props) => {
const { left, operator, right } = props.node;
return <span>
<ConnectedNode node={left} />
<ConnectedNode node={operator} />
<ConnectedNode node={right} />
</span>;
};
const ArrayExpression = (props) => {
return <span>[<ConnectedNode node={props.node.elements} />]</span>;
};
const Parentheses = (props) => {
return <span>(<ConnectedNode node={props.node.expression} />)</span>;
};
const MathExpression = (props) => {
return <ConnectedNode type='MathExpression' node={props.node.children} />;
};
const Program = (props) => {
const style = {
position: 'absolute',
top: 0,
left: 45
};
const state = store.getState();
const body = state.nodes.get(props.node.body);
const children = body.map((child, index) =>
<ConnectedNode node={child} key={`stmt-${index}`} />);
return <div style={style}>{children}</div>;
};
const components = {
/* stateful nodes */
Identifier,
NumberLiteral,
LineComment,
BlockComment,
Placeholder,
StringLiteral,
Operator,
Keyword,
/* stateless nodes */
ForOfStatement,
VariableDeclaration,
VariableDeclarator,
ArrayExpression,
BlockStatement,
ExpressionStatement,
BlankStatement,
AssignmentExpression,
BinaryExpression,
CallExpression,
ClassDeclaration,
ClassBody,
MethodDefinition,
FunctionExpression,
ReturnStatement,
Parentheses,
MathExpression,
Program,
};
function mapStateToProps(state, ownProps) {
if (state.selection && state.selection.id === ownProps.node) {
return {
id: ownProps.node,
node: state.nodes.get(ownProps.node),
selection: state.selection,
};
} else {
return {
id: ownProps.node,
node: state.nodes.get(ownProps.node),
};
}
}
const Node = (props) => {
const node = props.node;
const type = props.type;
if (Array.isArray(node)) {
const contents = [];
if (type === 'MathExpression') {
node.forEach((item, index) => {
contents.push(<ConnectedNode node={item} key={`item-${index}`}/>);
});
} else {
node.forEach((item, index) => {
if (index > 0) contents.push(", ");
contents.push(<ConnectedNode node={item} key={`item-${index}`}/>);
});
}
return <span>{contents}</span>;
} else {
const Element = components[node.type];
return Element ? <Element { ...props } /> : <span>{node.type}</span>;
}
};
const ConnectedNode = connect(mapStateToProps)(Node);
export default ConnectedNode;
|
"use strict"
var fs=require("fs");
var path=require("path");
class Directory{
constructor(file){
this.files_m=file
//? this.file_path=fs.lstatSync(file);
//http://stackoverflow.com/questions/15630770/node-js-check-if-path-is-file-or-directory
}
isFileExist(){
//? return this.file_path.isFile();
}
getPath(){
return path.dirname(this.files_m);
}
}
module.exports=new Directory;
|
/*
Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.2.0
Version: 1.4.0
Author: Sean Ngu
Website: http://www.seantheme.com/color-admin-v1.4/
*/
var getMonthName = function(number) {
var month = [];
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "Jun";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
return month[number];
};
var getDate = function(date) {
var currentDate = new Date(date);
var dd = currentDate.getDate();
var mm = currentDate.getMonth() + 1;
var yyyy = currentDate.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
currentDate = yyyy+'-'+mm+'-'+dd;
return currentDate;
};
var handleVisitorsLineChart = function() {
var green = '#0D888B';
var greenLight = '#00ACAC';
var blue = '#3273B1';
var blueLight = '#348FE2';
var blackTransparent = 'rgba(0,0,0,0.6)';
var whiteTransparent = 'rgba(255,255,255,0.4)';
Morris.Line({
element: 'visitors-line-chart',
data: [
{x: '2014-02-01', y: 60, z: 30},
{x: '2014-03-01', y: 70, z: 40},
{x: '2014-04-01', y: 40, z: 10},
{x: '2014-05-01', y: 100, z: 70},
{x: '2014-06-01', y: 40, z: 10},
{x: '2014-07-01', y: 80, z: 50},
{x: '2014-08-01', y: 70, z: 40}
],
xkey: 'x',
ykeys: ['y', 'z'],
xLabelFormat: function(x) {
x = getMonthName(x.getMonth());
return x.toString();
},
labels: ['Page Views', 'Unique Visitors'],
lineColors: [green, blue],
pointFillColors: [greenLight, blueLight],
lineWidth: '2px',
pointStrokeColors: [blackTransparent, blackTransparent],
resize: true,
gridTextFamily: 'Open Sans',
gridTextColor: whiteTransparent,
gridTextWeight: 'normal',
gridTextSize: '11px',
gridLineColor: 'rgba(0,0,0,0.5)',
hideHover: 'auto',
});
};
var handleVisitorsDonutChart = function() {
var green = '#00acac';
var blue = '#348fe2';
Morris.Donut({
element: 'visitors-donut-chart',
data: [
{label: "New Visitors", value: 900},
{label: "Return Visitors", value: 1200}
],
colors: [green, blue],
labelFamily: 'Open Sans',
labelColor: 'rgba(255,255,255,0.4)',
labelTextSize: '12px',
backgroundColor: '#242a30'
});
};
var handleVisitorsVectorMap = function() {
if ($('#visitors-map').length !== 0) {
map = new jvm.WorldMap({
map: 'world_merc_en',
scaleColors: ['#e74c3c', '#0071a4'],
container: $('#visitors-map'),
normalizeFunction: 'linear',
hoverOpacity: 0.5,
hoverColor: false,
markerStyle: {
initial: {
fill: '#4cabc7',
stroke: 'transparent',
r: 3
}
},
regions: [{
attribute: 'fill'
}],
regionStyle: {
initial: {
fill: 'rgb(97,109,125)',
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0.4,
"stroke-opacity": 1
},
hover: {
"fill-opacity": 0.8
},
selected: {
fill: 'yellow'
},
selectedHover: {
}
},
series: {
regions: [{
values: {
IN:'#00acac',
US:'#00acac',
KR:'#00acac'
}
}]
},
focusOn: {
x: 0.5,
y: 0.5,
scale: 2
},
backgroundColor: '#2d353c'
});
}
};
var handleScheduleCalendar = function() {
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var dayNames = ["S", "M", "T", "W", "T", "F", "S"];
var now = new Date(),
month = now.getMonth() + 1,
year = now.getFullYear();
var events = [
[
'2/' + month + '/' + year,
'Popover Title',
'#',
'#00acac',
'Some contents here'
],
[
'5/' + month + '/' + year,
'Tooltip with link',
'http://www.seantheme.com/color-admin-v1.3',
'#2d353c'
],
[
'18/' + month + '/' + year,
'Popover with HTML Content',
'#',
'#2d353c',
'Some contents here <div class="text-right"><a href="http://www.google.com">view more >>></a></div>'
],
[
'28/' + month + '/' + year,
'Color Admin V1.3 Launched',
'http://www.seantheme.com/color-admin-v1.3',
'#2d353c',
]
];
var calendarTarget = $('#schedule-calendar');
$(calendarTarget).calendar({
months: monthNames,
days: dayNames,
events: events,
popover_options:{
placement: 'top',
html: true
}
});
$(calendarTarget).find('td.event').each(function() {
var backgroundColor = $(this).css('background-color');
$(this).removeAttr('style');
$(this).find('a').css('background-color', backgroundColor);
});
$(calendarTarget).find('.icon-arrow-left, .icon-arrow-right').parent().on('click', function() {
$(calendarTarget).find('td.event').each(function() {
var backgroundColor = $(this).css('background-color');
$(this).removeAttr('style');
$(this).find('a').css('background-color', backgroundColor);
});
});
};
var handleDashboardGritterNotification = function() {
$(window).load(function() {
setTimeout(function() {
$.gritter.add({
title: 'Welcome back, Admin!',
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus lacus ut lectus rutrum placerat.',
image: 'assets/img/user-14.jpg',
sticky: true,
time: '',
class_name: 'my-sticky-class'
});
}, 1000);
});
};
var DashboardV2 = function () {
"use strict";
return {
//main function
init: function () {
handleVisitorsLineChart();
handleVisitorsDonutChart();
handleVisitorsVectorMap();
handleScheduleCalendar();
handleDashboardGritterNotification();
}
};
}();
|
import _ from 'lodash'
const alchemicals = [
[-1, +1, -1],
[+1, -1, +1],
[+1, -1, -1],
[-1, +1, +1],
[-1, -1, +1],
[+1, +1, -1],
[-1, -1, -1],
[+1, +1, +1],
]
const ingredients = [
"Mushroom",
"Fern",
"Toad",
"Birdclaw",
"Flower",
"Mandrake",
"Scorpion",
"Feather",
]
const correctnessOpts = {
"Correct": [true, true, true],
"Off by Red": [false, true, true],
"Off by Green": [true, false, true],
"Off by Blue": [true, true, false],
"Only correct in Red": [true, false, false],
"Only correct in Green": [false, true, false],
"Only correct in Blue": [false, false, true],
"Utterly wrong": [false, false, false],
}
// These must match the potion and aspect filenames in /images
const potions = {
"Red+": [+1, 0, 0],
"Red-": [-1, 0, 0],
"Green+": [0, +1, 0],
"Green-": [0, -1, 0],
"Blue+": [0, 0, +1],
"Blue-": [0, 0, -1],
"Soup": [0, 0, 0],
}
const potionsInverted = _.invert(_.values(potions))
const certainty = {
"CERTAIN": 0,
"HEDGE": 1,
"NONE": 2,
}
export {alchemicals, ingredients, potions, potionsInverted, correctnessOpts, certainty}
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"
}), 'InsertLinkOutlined');
|
module.exports = Company = require('typedef')
// THIS CODE WAS GENERATED BY AN AUTOMATED TOOL. Editing it is not recommended.
// For more information, see http://github.com/bvalosek/grunt-infusionsoft
// Generated on Wed Jan 08 2014 12:43:55 GMT-0600 (CST)
// This table holds the Company data in the system.
.class('Company') .define({
__static__field__string__edit__delete__add__read__Address1Type:
'Address1Type',
__static__field__string__edit__delete__add__read__Address2Street1:
'Address2Street1',
__static__field__string__edit__delete__add__read__Address2Street2:
'Address2Street2',
__static__field__string__edit__delete__add__read__Address2Type:
'Address2Type',
__static__field__string__edit__delete__add__read__Address3Street1:
'Address3Street1',
__static__field__string__edit__delete__add__read__Address3Street2:
'Address3Street2',
__static__field__string__edit__delete__add__read__Address3Type:
'Address3Type',
__static__field__datetime__edit__delete__add__read__Anniversary:
'Anniversary',
__static__field__string__edit__delete__add__read__AssistantName:
'AssistantName',
__static__field__string__edit__delete__add__read__AssistantPhone:
'AssistantPhone',
__static__field__string__edit__delete__add__read__BillingInformation:
'BillingInformation',
__static__field__datetime__edit__delete__add__read__Birthday:
'Birthday',
__static__field__string__edit__delete__add__read__City:
'City',
__static__field__string__edit__delete__add__read__City2:
'City2',
__static__field__string__edit__delete__add__read__City3:
'City3',
__static__field__string__edit__delete__add__read__Company:
'Company',
__static__field__number__edit__delete__add__read__AccountId:
'AccountId',
__static__field__number__edit__delete__add__read__CompanyID:
'CompanyID',
__static__field__string__edit__delete__add__read__ContactNotes:
'ContactNotes',
__static__field__string__edit__delete__add__read__ContactType:
'ContactType',
__static__field__string__edit__delete__add__read__Country:
'Country',
__static__field__string__edit__delete__add__read__Country2:
'Country2',
__static__field__string__edit__delete__add__read__Country3:
'Country3',
__static__field__number__read__CreatedBy:
'CreatedBy',
__static__field__datetime__read__DateCreated:
'DateCreated',
__static__field__string__edit__delete__add__read__Email:
'Email',
__static__field__string__edit__delete__add__read__EmailAddress2:
'EmailAddress2',
__static__field__string__edit__delete__add__read__EmailAddress3:
'EmailAddress3',
__static__field__string__edit__delete__add__read__Fax1:
'Fax1',
__static__field__string__edit__delete__add__read__Fax1Type:
'Fax1Type',
__static__field__string__edit__delete__add__read__Fax2:
'Fax2',
__static__field__string__edit__delete__add__read__Fax2Type:
'Fax2Type',
__static__field__string__edit__delete__add__read__FirstName:
'FirstName',
__static__field__string__read__Groups:
'Groups',
__static__field__primary__number__read__Id:
'Id',
__static__field__string__edit__delete__add__read__JobTitle:
'JobTitle',
__static__field__string__edit__delete__add__read__LastName:
'LastName',
__static__field__datetime__read__LastUpdated:
'LastUpdated',
__static__field__number__read__LastUpdatedBy:
'LastUpdatedBy',
__static__field__string__edit__delete__add__read__MiddleName:
'MiddleName',
__static__field__string__edit__delete__add__read__Nickname:
'Nickname',
__static__field__number__edit__delete__add__read__OwnerID:
'OwnerID',
__static__field__string__edit__delete__add__read__Password:
'Password',
__static__field__string__edit__delete__add__read__Phone1:
'Phone1',
__static__field__string__edit__delete__add__read__Phone1Ext:
'Phone1Ext',
__static__field__string__edit__delete__add__read__Phone1Type:
'Phone1Type',
__static__field__string__edit__delete__add__read__Phone2:
'Phone2',
__static__field__string__edit__delete__add__read__Phone2Ext:
'Phone2Ext',
__static__field__string__edit__delete__add__read__Phone2Type:
'Phone2Type',
__static__field__string__edit__delete__add__read__Phone3:
'Phone3',
__static__field__string__edit__delete__add__read__Phone3Ext:
'Phone3Ext',
__static__field__string__edit__delete__add__read__Phone3Type:
'Phone3Type',
__static__field__string__edit__delete__add__read__Phone4:
'Phone4',
__static__field__string__edit__delete__add__read__Phone4Ext:
'Phone4Ext',
__static__field__string__edit__delete__add__read__Phone4Type:
'Phone4Type',
__static__field__string__edit__delete__add__read__Phone5:
'Phone5',
__static__field__string__edit__delete__add__read__Phone5Ext:
'Phone5Ext',
__static__field__string__edit__delete__add__read__Phone5Type:
'Phone5Type',
__static__field__string__edit__delete__add__read__PostalCode:
'PostalCode',
__static__field__string__edit__delete__add__read__PostalCode2:
'PostalCode2',
__static__field__string__edit__delete__add__read__PostalCode3:
'PostalCode3',
__static__field__string__edit__delete__add__read__ReferralCode:
'ReferralCode',
__static__field__string__edit__delete__add__read__SpouseName:
'SpouseName',
__static__field__string__edit__delete__add__read__State:
'State',
__static__field__string__edit__delete__add__read__State2:
'State2',
__static__field__string__edit__delete__add__read__State3:
'State3',
__static__field__string__edit__delete__add__read__StreetAddress1:
'StreetAddress1',
__static__field__string__edit__delete__add__read__StreetAddress2:
'StreetAddress2',
__static__field__string__edit__delete__add__read__Suffix:
'Suffix',
__static__field__string__edit__delete__add__read__Title:
'Title',
__static__field__string__edit__delete__add__read__Username:
'Username',
__static__field__string__read__Validated:
'Validated',
__static__field__string__edit__delete__add__read__Website:
'Website',
__static__field__string__edit__delete__add__read__ZipFour1:
'ZipFour1',
__static__field__string__edit__delete__add__read__ZipFour2:
'ZipFour2',
__static__field__string__edit__delete__add__read__ZipFour3:
'ZipFour3'
});
|
import React from 'react'
import { Row, Col } from 'react-bootstrap'
import { t } from '../i18n'
export default class Footer extends React.Component {
render () {
const footerLines =
t('footer-content')
.split('\n')
.map((x, i) => (<div key={i}>{ x }</div>))
return (
<footer className="cwc-footer">
<Row>
<Col className="cwc-centered" md={8} xs={12}>
{ footerLines }
</Col>
</Row>
</footer>
)
}
}
|
/*
* Copyright 2012 Cloud9 IDE, Inc.
*
* This product includes software developed by
* Cloud9 IDE, Inc (http://c9.io).
*
* Author: Mike de Boer <info@mikedeboer.nl>
*/
"use strict";
var Assert = require("assert");
var Client = require("./../lib/index");
var testAuth = require("./../testAuth.json");
describe("[authorization]", function() {
var client;
var token = testAuth["token"];
beforeEach(function() {
client = new Client();
client.authenticate({
type: "oauth",
token: token
});
});
it("should successfully execute POST /authorizations (create)", function(next) {
client.authorization.create(
{
scopes: "Array",
note: "String",
note_url: "String"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
it("should successfully execute DELETE /authorizations/:id (delete)", function(next) {
client.authorization.delete(
{
id: "String"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
it("should successfully execute GET /authorizations/:id (get)", function(next) {
client.authorization.get(
{
id: "String"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
it("should successfully execute GET /authorizations (getAll)", function(next) {
client.authorization.getAll(
{
page: "Number",
per_page: "Number"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
it("should successfully execute PATCH /authorizations/:id (update)", function(next) {
client.authorization.update(
{
id: "String",
scopes: "Array",
add_scopes: "Array",
remove_scopes: "Array",
note: "String",
note_url: "String"
},
function(err, res) {
Assert.equal(err, null);
// other assertions go here
next();
}
);
});
});
|
exports.connection = {
endpoint: 'https://ryancrawcour.documents.azure.com:443/',
authKey: 'wYIlzQJh2pO8ganvKsGV/GwvpYjPkwPNcqin3sn1ZGOgyU1gwfAqLc6rh84elQjTCJ9jkoBlwnpliMq5+tp0dQ=='
};
exports.names = {
database: 'NodeSamples',
collection: 'Families',
};
|
/**
* Created by guangqiang on 2017/10/10.
*/
|
(function ($) {
'use strict';
var calendarTextFr = {
days: ['S', 'L', 'M', 'M', 'J', 'V', 'S'],
months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
monthsShort: ['Janv', 'Févr', 'Mars', 'Avr.', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc'],
today: 'Aujourd\'hui',
now: 'Maintenant',
am: 'AM',
pm: 'PM'
};
$.fn.extend({
datePicker: function () {
$(this).each(function () {
var $element = $(this);
$element.calendar({
type: 'date',
firstDayOfWeek: 1,
text: calendarTextFr,
formatter: {
date: function (date, settings) {
if (!date) return '';
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
return day + '/' + month + '/' + year;
}
},
parser: {
date: function (text, settings) {
var dateAsArray = text.split('/');
return new Date(dateAsArray[2], dateAsArray[1] - 1, dateAsArray[0]);
}
},
});
});
}
});
$.fn.extend({
dateTimePicker: function () {
$(this).each(function () {
var $element = $(this);
$element.calendar({
type: 'datetime',
firstDayOfWeek: 1,
text: calendarTextFr,
disableMinute: true,
ampm: false,
formatter: {
date: function (date, settings) {
if (!date) return '';
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
return day + '/' + month + '/' + year;
},
time: function (date, settings, forCalendar) {
var hours = date.getHours();
var minutes = date.getMinutes();
if (minutes < 10) {
minutes = "0" + minutes;
}
return hours + ':' + minutes;
}
}
});
});
}
});
})(jQuery);
|
import S from './s';
import React from 'react';
import { mount } from 'enzyme';
describe('<S />', () => {
test('should underline text when specified', () => {
const context = {
styles: {
components: {
s: {
strikethrough: { color: '#ff0' },
},
},
},
};
const wrapper = mount(<S type="strikethrough">Don’t read this!</S>, {
context,
});
expect(wrapper).toMatchSnapshot();
});
test('should bold text when specified', () => {
const context = {
styles: {
components: {
s: {
bold: { color: '#ff0' },
},
},
},
};
const wrapper = mount(<S type="bold">You should read this!</S>, {
context,
});
expect(wrapper).toMatchSnapshot();
});
test('should underline text when specified', () => {
const context = {
styles: {
components: {
s: {
underline: { color: '#ff0' },
},
},
},
};
const wrapper = mount(<S type="underline">This text is underlined!</S>, {
context,
});
expect(wrapper).toMatchSnapshot();
});
test('should italicize text when specified', () => {
const context = {
styles: {
components: {
s: {
italic: { color: '#ff0' },
},
},
},
};
const wrapper = mount(<S type="italic">This text is italicized!</S>, {
context,
});
expect(wrapper).toMatchSnapshot();
});
});
|
initSidebarItems({"struct":[["ConnectFuture","Future returned by `TcpStream::connect` which will resolve to a `TcpStream` when the stream is connected."],["Incoming","Stream returned by the `TcpListener::incoming` function representing the stream of sockets received from a listener."],["TcpListener","An I/O object representing a TCP socket listening for incoming connections."],["TcpStream","An I/O object representing a TCP stream connected to a remote endpoint."]]});
|
'use strict';
require('es6-shim');
require('./');
|
BASE.require([
"BASE.util.Observable",
"LG.AjaxProvider",
"BASE.collections.Hashmap",
"LG.ServiceError",
"LG.ServiceResponse",
"BASE.async.Future",
"LG.query.ApiProvider",
"BASE.data.UnauthorizedError",
"BASE.data.ForbiddenError",
"BASE.data.ValidationError",
"BASE.data.NetworkError",
"BASE.data.EntityNotFoundError",
"BASE.data.AddedResponse",
"BASE.data.UpdatedResponse",
"BASE.data.RemovedResponse"
], function () {
BASE.namespace("LG.rest");
var ApiProvider = LG.query.ApiProvider;
LG.rest.Service = (function (Super) {
var Service = function () {
var self = this;
if (!(self instanceof arguments.callee)) {
return new Service();
}
Super.call(self);
var _serverTypeToClientType = new BASE.collections.Hashmap();
var _typeUri = new BASE.collections.Hashmap();
var _host = null;
var _ajaxProvider = new LG.AjaxProvider("", "");
var makeDto = function (entity) {
var DTO = {};
for (var x in entity) {
var objX = x.substr(0, 1).toUpperCase() + x.substring(1);
if ((typeof entity[x] === "string" ||
typeof entity[x] === "number" ||
typeof entity[x] === "boolean" ||
entity[x] === null ||
entity[x] instanceof Date) &&
x.indexOf("_") !== 0) {
if (x === "id") {
if (entity.id !== null) {
DTO[objX] = entity[x];
}
} else {
DTO[objX] = entity[x];
}
}
}
return DTO;
};
var convertToJavascriptDTO = function (dto) {
var DTO = {};
for (var x in dto) {
var objX = x;
if (x.substr(0, 2) !== x.substr(0, 2).toUpperCase()) {
objX = x.substr(0, 1).toLowerCase() + x.substring(1);
}
if (typeof dto[x] === "object" && dto[x] !== null) {
DTO[objX] = convertToJavascriptDTO(dto[x]);
} else {
DTO[objX] = dto[x];
}
}
return DTO;
}
self.convertToJavascriptDto = convertToJavascriptDTO;
self.convertToServerDto = makeDto;
self.serverTypeToClientType = _serverTypeToClientType;
self.typeUri = _typeUri;
self.setHost = function (host) {
var index = host.lastIndexOf("/");
if (index === host.length - 1) {
_host = host.substr(0, host.length - 1);
} else {
_host = host;
}
};
self.getHost = function () {
return _host;
};
var createExecuteFuture = function (queryable, provider, baseUrl, oldExecute) {
return new BASE.async.Future(function (setValue, setError) {
provider.baseUrl = baseUrl;
oldExecute.call(provider, queryable).then(function (dtos) {
var convertedDtos = [];
dtos.forEach(function (dto) {
convertedDtos.push(convertToJavascriptDTO(dto));
});
setValue(convertedDtos);
}).ifError(function (e) {
setError(self.createError(e));
});
});
};
var createCountFuture = function (queryable, provider, baseUrl, oldCount) {
return new BASE.async.Future(function (setValue, setError) {
provider.baseUrl = baseUrl;
oldCount.call(provider, queryable).then(function (count) {
setValue(count);
}).ifError(function (e) {
setError(e);
});
});
};
self.createError = function (error, entity) {
var data;
data = error.xhr.responseText ? JSON.parse(error.xhr.responseText) : {};
var err;
// I really hate this, but its comparing primitives and is only in one place.
if (error.xhr.status == 401) {
err = new BASE.data.UnauthorizedError("Unauthorized");
} else if (error.xhr.status === 403) {
err = new BASE.data.ForbiddenError(data.Message);
} else if (error.xhr.status === 404) {
err = new BASE.data.EntityNotFoundError("File Not Found", entity);
} else if (error.xhr.status == 0) {
err = new BASE.data.NetworkError("Network Error");
}
return err;
};
self.getSetProvider = function () {
var self = this;
var provider = new ApiProvider(self.ajaxProvider.defaultHeaders["X-LGAppId"], self.ajaxProvider.defaultHeaders["X-LGToken"]);
var oldExecute = provider.execute;
var oldCount = provider.count;
provider.execute = function (queryable) {
var Type = queryable.Type;
var directory = _typeUri.get(Type);
var baseUrl = self.host + directory;
if (!directory) {
throw new Error("Couldn't find a directory for specified Type. " + Type);
}
if (!self.host) {
throw new Error("Need to set the \"host\" property before invoking a load.");
}
return createExecuteFuture(queryable, provider, baseUrl, oldExecute);
};
provider.count = function (queryable) {
var Type = queryable.Type;
var directory = _typeUri.get(Type);
var baseUrl = self.host + directory;
if (!directory) {
throw new Error("Couldn't find a directory for specified Type. " + Type);
}
if (!self.host) {
throw new Error("Need to set the \"host\" property before invoking a load.");
}
return createCountFuture(queryable, provider, baseUrl, oldCount);
};
return provider;
};
self.getTargetProvider = function (entity, property) {
var self = this;
var provider = new ApiProvider(self.ajaxProvider.defaultHeaders["X-LGAppId"], self.ajaxProvider.defaultHeaders["X-LGToken"]);
var oldExecute = provider.execute;
var oldCount = provider.count;
// This is horrendous! Change this from being a hack.
provider.execute = function (queryable) {
var Type = queryable.Type;
var directory = _typeUri.get(Type);
var baseUrl = self.host + entity[property]._uri;
if (!directory) {
throw new Error("Couldn't find a directory for specified Type. " + Type);
}
if (!self.host) {
throw new Error("Need to set the \"host\" property before invoking a load.");
}
return createExecuteFuture(queryable, provider, baseUrl, oldExecute);
};
provider.count = function (queryable) {
var Type = queryable.Type;
var directory = _typeUri.get(Type);
var baseUrl = self.host + entity[property]._uri;
if (!directory) {
throw new Error("Couldn't find a directory for specified Type. " + Type);
}
if (!self.host) {
throw new Error("Need to set the \"host\" property before invoking a load.");
}
return createCountFuture(queryable, provider, baseUrl, oldCount);
};
return provider;
};
self.addEntity = function (entity) {
var Type = entity.constructor;
var url = _typeUri.get(Type);
var dto = makeDto(entity);
return new BASE.async.Future(function (setValue, setError) {
if (url) {
var settings = {
type: "POST",
data: JSON.stringify(dto)
};
self.ajaxProvider.ajax(self.host + url, settings).then(function (response) {
var data = response.data;
if (data && data.Error) {
var err = new BASE.data.ValidationError(new Error(data.Message), data.ValidationErrors);
setError(err);
} else {
var response = new BASE.data.AddedResponse(response.message, convertToJavascriptDTO(data.Data));
setValue(response);
}
}).ifError(function (error) {
setError(self.createError(error));
});
} else {
throw new Error("Could not find url for this type.");
}
});
};
self.updateEntity = function (entity, updates) {
var Type = entity.constructor;
var url = _typeUri.get(Type) + "/" + entity.id;
var updateObject = {};
updates.getKeys().forEach(function (key) {
updateObject[key] = updates.get(key);
});
return new BASE.async.Future(function (setValue, setError) {
if (url) {
var dto = makeDto(updateObject);
var settings = {
type: "PATCH",
data: JSON.stringify(dto)
};
self.ajaxProvider.ajax(self.host + url, settings).then(function (response) {
var data = response.data;
if (data && data.Error) {
var err = new BASE.data.ValidationError(data.Message, data.ValidationErrors);
setError(err);
} else {
var response = new BASE.data.UpdatedResponse(data.Message, data);
setValue(response);
}
}).ifError(function (error) {
setError(self.createError(error, entity));
});
} else {
setValue({});
}
});
};
self.removeEntity = function (entity) {
var self = this;
var Type = entity.constructor;
var url = _typeUri.get(Type) + "/" + (entity.id || "");
return new BASE.async.Future(function (setValue, setError) {
if (url) {
var dto = makeDto(entity);
var settings = {
type: "DELETE",
data: JSON.stringify(dto)
};
self.ajaxProvider.ajax(self.host + url, settings).then(function (response) {
var data = response.data;
if (data && data.Error) {
entity.id = null;
var err = new BASE.data.ErrorResponse(data.Message);
setError(err);
} else {
var response = new BASE.data.RemovedResponse(data.Message);
setValue(response);
}
}).ifError(function (error) {
setError(self.createError(error, entity));
});
} else {
setValue({});
}
});
};
self.logIn = function (username, factors) {
var self = this;
throw new Error("This method isn't implemented yet.");
return BASE.async.Future(function (setValue, setError) {
var dto = {
username: username,
Factors: factors
};
var settings = {
type: "POST",
data: JSON.stringify(dto)
};
self.ajaxProvider.ajax(_host + "/Login", settings).then(function (response) {
}).ifError(function (error) {
});
});
};
self.getTypeForDto = function (dto) {
var Type = _serverTypeToClientType.get(dto._type);
if (Type === null) {
//console.warn("Couldn't find Type for dto: " + JSON.stringify(dto));
Type = BASE.behaviors.data.Entity;
}
return Type;
};
return self;
};
BASE.extend(Service, Super);
return Service;
}(BASE.util.Observable));
});
|
"use strict";
var helpers = require("../../helpers/helpers");
exports["Atlantic/Azores"] = {
"guess:by:offset" : helpers.makeTestGuess("Atlantic/Azores", { offset: true }),
"guess:by:abbr" : helpers.makeTestGuess("Atlantic/Azores", { abbr: true }),
"1912" : helpers.makeTestYear("Atlantic/Azores", [
["1912-01-01T01:59:59+00:00", "00:05:27", "HMT", 6872 / 60],
["1912-01-01T02:00:00+00:00", "00:00:00", "-02", 120]
]),
"1916" : helpers.makeTestYear("Atlantic/Azores", [
["1916-06-18T00:59:59+00:00", "22:59:59", "-02", 120],
["1916-06-18T01:00:00+00:00", "00:00:00", "-01", 60],
["1916-11-01T01:59:59+00:00", "00:59:59", "-01", 60],
["1916-11-01T02:00:00+00:00", "00:00:00", "-02", 120]
]),
"1917" : helpers.makeTestYear("Atlantic/Azores", [
["1917-03-01T00:59:59+00:00", "22:59:59", "-02", 120],
["1917-03-01T01:00:00+00:00", "00:00:00", "-01", 60],
["1917-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1917-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1918" : helpers.makeTestYear("Atlantic/Azores", [
["1918-03-02T00:59:59+00:00", "22:59:59", "-02", 120],
["1918-03-02T01:00:00+00:00", "00:00:00", "-01", 60],
["1918-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1918-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1919" : helpers.makeTestYear("Atlantic/Azores", [
["1919-03-01T00:59:59+00:00", "22:59:59", "-02", 120],
["1919-03-01T01:00:00+00:00", "00:00:00", "-01", 60],
["1919-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1919-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1920" : helpers.makeTestYear("Atlantic/Azores", [
["1920-03-01T00:59:59+00:00", "22:59:59", "-02", 120],
["1920-03-01T01:00:00+00:00", "00:00:00", "-01", 60],
["1920-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1920-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1921" : helpers.makeTestYear("Atlantic/Azores", [
["1921-03-01T00:59:59+00:00", "22:59:59", "-02", 120],
["1921-03-01T01:00:00+00:00", "00:00:00", "-01", 60],
["1921-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1921-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1924" : helpers.makeTestYear("Atlantic/Azores", [
["1924-04-17T00:59:59+00:00", "22:59:59", "-02", 120],
["1924-04-17T01:00:00+00:00", "00:00:00", "-01", 60],
["1924-10-15T00:59:59+00:00", "23:59:59", "-01", 60],
["1924-10-15T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1926" : helpers.makeTestYear("Atlantic/Azores", [
["1926-04-18T00:59:59+00:00", "22:59:59", "-02", 120],
["1926-04-18T01:00:00+00:00", "00:00:00", "-01", 60],
["1926-10-03T00:59:59+00:00", "23:59:59", "-01", 60],
["1926-10-03T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1927" : helpers.makeTestYear("Atlantic/Azores", [
["1927-04-10T00:59:59+00:00", "22:59:59", "-02", 120],
["1927-04-10T01:00:00+00:00", "00:00:00", "-01", 60],
["1927-10-02T00:59:59+00:00", "23:59:59", "-01", 60],
["1927-10-02T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1928" : helpers.makeTestYear("Atlantic/Azores", [
["1928-04-15T00:59:59+00:00", "22:59:59", "-02", 120],
["1928-04-15T01:00:00+00:00", "00:00:00", "-01", 60],
["1928-10-07T00:59:59+00:00", "23:59:59", "-01", 60],
["1928-10-07T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1929" : helpers.makeTestYear("Atlantic/Azores", [
["1929-04-21T00:59:59+00:00", "22:59:59", "-02", 120],
["1929-04-21T01:00:00+00:00", "00:00:00", "-01", 60],
["1929-10-06T00:59:59+00:00", "23:59:59", "-01", 60],
["1929-10-06T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1931" : helpers.makeTestYear("Atlantic/Azores", [
["1931-04-19T00:59:59+00:00", "22:59:59", "-02", 120],
["1931-04-19T01:00:00+00:00", "00:00:00", "-01", 60],
["1931-10-04T00:59:59+00:00", "23:59:59", "-01", 60],
["1931-10-04T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1932" : helpers.makeTestYear("Atlantic/Azores", [
["1932-04-03T00:59:59+00:00", "22:59:59", "-02", 120],
["1932-04-03T01:00:00+00:00", "00:00:00", "-01", 60],
["1932-10-02T00:59:59+00:00", "23:59:59", "-01", 60],
["1932-10-02T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1934" : helpers.makeTestYear("Atlantic/Azores", [
["1934-04-08T00:59:59+00:00", "22:59:59", "-02", 120],
["1934-04-08T01:00:00+00:00", "00:00:00", "-01", 60],
["1934-10-07T00:59:59+00:00", "23:59:59", "-01", 60],
["1934-10-07T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1935" : helpers.makeTestYear("Atlantic/Azores", [
["1935-03-31T00:59:59+00:00", "22:59:59", "-02", 120],
["1935-03-31T01:00:00+00:00", "00:00:00", "-01", 60],
["1935-10-06T00:59:59+00:00", "23:59:59", "-01", 60],
["1935-10-06T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1936" : helpers.makeTestYear("Atlantic/Azores", [
["1936-04-19T00:59:59+00:00", "22:59:59", "-02", 120],
["1936-04-19T01:00:00+00:00", "00:00:00", "-01", 60],
["1936-10-04T00:59:59+00:00", "23:59:59", "-01", 60],
["1936-10-04T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1937" : helpers.makeTestYear("Atlantic/Azores", [
["1937-04-04T00:59:59+00:00", "22:59:59", "-02", 120],
["1937-04-04T01:00:00+00:00", "00:00:00", "-01", 60],
["1937-10-03T00:59:59+00:00", "23:59:59", "-01", 60],
["1937-10-03T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1938" : helpers.makeTestYear("Atlantic/Azores", [
["1938-03-27T00:59:59+00:00", "22:59:59", "-02", 120],
["1938-03-27T01:00:00+00:00", "00:00:00", "-01", 60],
["1938-10-02T00:59:59+00:00", "23:59:59", "-01", 60],
["1938-10-02T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1939" : helpers.makeTestYear("Atlantic/Azores", [
["1939-04-16T00:59:59+00:00", "22:59:59", "-02", 120],
["1939-04-16T01:00:00+00:00", "00:00:00", "-01", 60],
["1939-11-19T00:59:59+00:00", "23:59:59", "-01", 60],
["1939-11-19T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1940" : helpers.makeTestYear("Atlantic/Azores", [
["1940-02-25T00:59:59+00:00", "22:59:59", "-02", 120],
["1940-02-25T01:00:00+00:00", "00:00:00", "-01", 60],
["1940-10-06T00:59:59+00:00", "23:59:59", "-01", 60],
["1940-10-06T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1941" : helpers.makeTestYear("Atlantic/Azores", [
["1941-04-06T00:59:59+00:00", "22:59:59", "-02", 120],
["1941-04-06T01:00:00+00:00", "00:00:00", "-01", 60],
["1941-10-06T00:59:59+00:00", "23:59:59", "-01", 60],
["1941-10-06T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1942" : helpers.makeTestYear("Atlantic/Azores", [
["1942-03-15T00:59:59+00:00", "22:59:59", "-02", 120],
["1942-03-15T01:00:00+00:00", "00:00:00", "-01", 60],
["1942-04-25T23:59:59+00:00", "22:59:59", "-01", 60],
["1942-04-26T00:00:00+00:00", "00:00:00", "+00", 0],
["1942-08-15T23:59:59+00:00", "23:59:59", "+00", 0],
["1942-08-16T00:00:00+00:00", "23:00:00", "-01", 60],
["1942-10-25T00:59:59+00:00", "23:59:59", "-01", 60],
["1942-10-25T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1943" : helpers.makeTestYear("Atlantic/Azores", [
["1943-03-14T00:59:59+00:00", "22:59:59", "-02", 120],
["1943-03-14T01:00:00+00:00", "00:00:00", "-01", 60],
["1943-04-17T23:59:59+00:00", "22:59:59", "-01", 60],
["1943-04-18T00:00:00+00:00", "00:00:00", "+00", 0],
["1943-08-28T23:59:59+00:00", "23:59:59", "+00", 0],
["1943-08-29T00:00:00+00:00", "23:00:00", "-01", 60],
["1943-10-31T00:59:59+00:00", "23:59:59", "-01", 60],
["1943-10-31T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1944" : helpers.makeTestYear("Atlantic/Azores", [
["1944-03-12T00:59:59+00:00", "22:59:59", "-02", 120],
["1944-03-12T01:00:00+00:00", "00:00:00", "-01", 60],
["1944-04-22T23:59:59+00:00", "22:59:59", "-01", 60],
["1944-04-23T00:00:00+00:00", "00:00:00", "+00", 0],
["1944-08-26T23:59:59+00:00", "23:59:59", "+00", 0],
["1944-08-27T00:00:00+00:00", "23:00:00", "-01", 60],
["1944-10-29T00:59:59+00:00", "23:59:59", "-01", 60],
["1944-10-29T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1945" : helpers.makeTestYear("Atlantic/Azores", [
["1945-03-11T00:59:59+00:00", "22:59:59", "-02", 120],
["1945-03-11T01:00:00+00:00", "00:00:00", "-01", 60],
["1945-04-21T23:59:59+00:00", "22:59:59", "-01", 60],
["1945-04-22T00:00:00+00:00", "00:00:00", "+00", 0],
["1945-08-25T23:59:59+00:00", "23:59:59", "+00", 0],
["1945-08-26T00:00:00+00:00", "23:00:00", "-01", 60],
["1945-10-28T00:59:59+00:00", "23:59:59", "-01", 60],
["1945-10-28T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1946" : helpers.makeTestYear("Atlantic/Azores", [
["1946-04-07T00:59:59+00:00", "22:59:59", "-02", 120],
["1946-04-07T01:00:00+00:00", "00:00:00", "-01", 60],
["1946-10-06T00:59:59+00:00", "23:59:59", "-01", 60],
["1946-10-06T01:00:00+00:00", "23:00:00", "-02", 120]
]),
"1947" : helpers.makeTestYear("Atlantic/Azores", [
["1947-04-06T03:59:59+00:00", "01:59:59", "-02", 120],
["1947-04-06T04:00:00+00:00", "03:00:00", "-01", 60],
["1947-10-05T03:59:59+00:00", "02:59:59", "-01", 60],
["1947-10-05T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1948" : helpers.makeTestYear("Atlantic/Azores", [
["1948-04-04T03:59:59+00:00", "01:59:59", "-02", 120],
["1948-04-04T04:00:00+00:00", "03:00:00", "-01", 60],
["1948-10-03T03:59:59+00:00", "02:59:59", "-01", 60],
["1948-10-03T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1949" : helpers.makeTestYear("Atlantic/Azores", [
["1949-04-03T03:59:59+00:00", "01:59:59", "-02", 120],
["1949-04-03T04:00:00+00:00", "03:00:00", "-01", 60],
["1949-10-02T03:59:59+00:00", "02:59:59", "-01", 60],
["1949-10-02T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1951" : helpers.makeTestYear("Atlantic/Azores", [
["1951-04-01T03:59:59+00:00", "01:59:59", "-02", 120],
["1951-04-01T04:00:00+00:00", "03:00:00", "-01", 60],
["1951-10-07T03:59:59+00:00", "02:59:59", "-01", 60],
["1951-10-07T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1952" : helpers.makeTestYear("Atlantic/Azores", [
["1952-04-06T03:59:59+00:00", "01:59:59", "-02", 120],
["1952-04-06T04:00:00+00:00", "03:00:00", "-01", 60],
["1952-10-05T03:59:59+00:00", "02:59:59", "-01", 60],
["1952-10-05T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1953" : helpers.makeTestYear("Atlantic/Azores", [
["1953-04-05T03:59:59+00:00", "01:59:59", "-02", 120],
["1953-04-05T04:00:00+00:00", "03:00:00", "-01", 60],
["1953-10-04T03:59:59+00:00", "02:59:59", "-01", 60],
["1953-10-04T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1954" : helpers.makeTestYear("Atlantic/Azores", [
["1954-04-04T03:59:59+00:00", "01:59:59", "-02", 120],
["1954-04-04T04:00:00+00:00", "03:00:00", "-01", 60],
["1954-10-03T03:59:59+00:00", "02:59:59", "-01", 60],
["1954-10-03T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1955" : helpers.makeTestYear("Atlantic/Azores", [
["1955-04-03T03:59:59+00:00", "01:59:59", "-02", 120],
["1955-04-03T04:00:00+00:00", "03:00:00", "-01", 60],
["1955-10-02T03:59:59+00:00", "02:59:59", "-01", 60],
["1955-10-02T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1956" : helpers.makeTestYear("Atlantic/Azores", [
["1956-04-01T03:59:59+00:00", "01:59:59", "-02", 120],
["1956-04-01T04:00:00+00:00", "03:00:00", "-01", 60],
["1956-10-07T03:59:59+00:00", "02:59:59", "-01", 60],
["1956-10-07T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1957" : helpers.makeTestYear("Atlantic/Azores", [
["1957-04-07T03:59:59+00:00", "01:59:59", "-02", 120],
["1957-04-07T04:00:00+00:00", "03:00:00", "-01", 60],
["1957-10-06T03:59:59+00:00", "02:59:59", "-01", 60],
["1957-10-06T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1958" : helpers.makeTestYear("Atlantic/Azores", [
["1958-04-06T03:59:59+00:00", "01:59:59", "-02", 120],
["1958-04-06T04:00:00+00:00", "03:00:00", "-01", 60],
["1958-10-05T03:59:59+00:00", "02:59:59", "-01", 60],
["1958-10-05T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1959" : helpers.makeTestYear("Atlantic/Azores", [
["1959-04-05T03:59:59+00:00", "01:59:59", "-02", 120],
["1959-04-05T04:00:00+00:00", "03:00:00", "-01", 60],
["1959-10-04T03:59:59+00:00", "02:59:59", "-01", 60],
["1959-10-04T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1960" : helpers.makeTestYear("Atlantic/Azores", [
["1960-04-03T03:59:59+00:00", "01:59:59", "-02", 120],
["1960-04-03T04:00:00+00:00", "03:00:00", "-01", 60],
["1960-10-02T03:59:59+00:00", "02:59:59", "-01", 60],
["1960-10-02T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1961" : helpers.makeTestYear("Atlantic/Azores", [
["1961-04-02T03:59:59+00:00", "01:59:59", "-02", 120],
["1961-04-02T04:00:00+00:00", "03:00:00", "-01", 60],
["1961-10-01T03:59:59+00:00", "02:59:59", "-01", 60],
["1961-10-01T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1962" : helpers.makeTestYear("Atlantic/Azores", [
["1962-04-01T03:59:59+00:00", "01:59:59", "-02", 120],
["1962-04-01T04:00:00+00:00", "03:00:00", "-01", 60],
["1962-10-07T03:59:59+00:00", "02:59:59", "-01", 60],
["1962-10-07T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1963" : helpers.makeTestYear("Atlantic/Azores", [
["1963-04-07T03:59:59+00:00", "01:59:59", "-02", 120],
["1963-04-07T04:00:00+00:00", "03:00:00", "-01", 60],
["1963-10-06T03:59:59+00:00", "02:59:59", "-01", 60],
["1963-10-06T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1964" : helpers.makeTestYear("Atlantic/Azores", [
["1964-04-05T03:59:59+00:00", "01:59:59", "-02", 120],
["1964-04-05T04:00:00+00:00", "03:00:00", "-01", 60],
["1964-10-04T03:59:59+00:00", "02:59:59", "-01", 60],
["1964-10-04T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1965" : helpers.makeTestYear("Atlantic/Azores", [
["1965-04-04T03:59:59+00:00", "01:59:59", "-02", 120],
["1965-04-04T04:00:00+00:00", "03:00:00", "-01", 60],
["1965-10-03T03:59:59+00:00", "02:59:59", "-01", 60],
["1965-10-03T04:00:00+00:00", "02:00:00", "-02", 120]
]),
"1966" : helpers.makeTestYear("Atlantic/Azores", [
["1966-04-03T03:59:59+00:00", "01:59:59", "-02", 120],
["1966-04-03T04:00:00+00:00", "03:00:00", "-01", 60]
]),
"1977" : helpers.makeTestYear("Atlantic/Azores", [
["1977-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["1977-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["1977-09-25T00:59:59+00:00", "00:59:59", "+00", 0],
["1977-09-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1978" : helpers.makeTestYear("Atlantic/Azores", [
["1978-04-02T00:59:59+00:00", "23:59:59", "-01", 60],
["1978-04-02T01:00:00+00:00", "01:00:00", "+00", 0],
["1978-10-01T00:59:59+00:00", "00:59:59", "+00", 0],
["1978-10-01T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1979" : helpers.makeTestYear("Atlantic/Azores", [
["1979-04-01T00:59:59+00:00", "23:59:59", "-01", 60],
["1979-04-01T01:00:00+00:00", "01:00:00", "+00", 0],
["1979-09-30T01:59:59+00:00", "01:59:59", "+00", 0],
["1979-09-30T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1980" : helpers.makeTestYear("Atlantic/Azores", [
["1980-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["1980-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["1980-09-28T01:59:59+00:00", "01:59:59", "+00", 0],
["1980-09-28T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1981" : helpers.makeTestYear("Atlantic/Azores", [
["1981-03-29T01:59:59+00:00", "00:59:59", "-01", 60],
["1981-03-29T02:00:00+00:00", "02:00:00", "+00", 0],
["1981-09-27T01:59:59+00:00", "01:59:59", "+00", 0],
["1981-09-27T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1982" : helpers.makeTestYear("Atlantic/Azores", [
["1982-03-28T01:59:59+00:00", "00:59:59", "-01", 60],
["1982-03-28T02:00:00+00:00", "02:00:00", "+00", 0],
["1982-09-26T01:59:59+00:00", "01:59:59", "+00", 0],
["1982-09-26T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1983" : helpers.makeTestYear("Atlantic/Azores", [
["1983-03-27T02:59:59+00:00", "01:59:59", "-01", 60],
["1983-03-27T03:00:00+00:00", "03:00:00", "+00", 0],
["1983-09-25T01:59:59+00:00", "01:59:59", "+00", 0],
["1983-09-25T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1984" : helpers.makeTestYear("Atlantic/Azores", [
["1984-03-25T01:59:59+00:00", "00:59:59", "-01", 60],
["1984-03-25T02:00:00+00:00", "02:00:00", "+00", 0],
["1984-09-30T01:59:59+00:00", "01:59:59", "+00", 0],
["1984-09-30T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1985" : helpers.makeTestYear("Atlantic/Azores", [
["1985-03-31T01:59:59+00:00", "00:59:59", "-01", 60],
["1985-03-31T02:00:00+00:00", "02:00:00", "+00", 0],
["1985-09-29T01:59:59+00:00", "01:59:59", "+00", 0],
["1985-09-29T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1986" : helpers.makeTestYear("Atlantic/Azores", [
["1986-03-30T01:59:59+00:00", "00:59:59", "-01", 60],
["1986-03-30T02:00:00+00:00", "02:00:00", "+00", 0],
["1986-09-28T01:59:59+00:00", "01:59:59", "+00", 0],
["1986-09-28T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1987" : helpers.makeTestYear("Atlantic/Azores", [
["1987-03-29T01:59:59+00:00", "00:59:59", "-01", 60],
["1987-03-29T02:00:00+00:00", "02:00:00", "+00", 0],
["1987-09-27T01:59:59+00:00", "01:59:59", "+00", 0],
["1987-09-27T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1988" : helpers.makeTestYear("Atlantic/Azores", [
["1988-03-27T01:59:59+00:00", "00:59:59", "-01", 60],
["1988-03-27T02:00:00+00:00", "02:00:00", "+00", 0],
["1988-09-25T01:59:59+00:00", "01:59:59", "+00", 0],
["1988-09-25T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1989" : helpers.makeTestYear("Atlantic/Azores", [
["1989-03-26T01:59:59+00:00", "00:59:59", "-01", 60],
["1989-03-26T02:00:00+00:00", "02:00:00", "+00", 0],
["1989-09-24T01:59:59+00:00", "01:59:59", "+00", 0],
["1989-09-24T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1990" : helpers.makeTestYear("Atlantic/Azores", [
["1990-03-25T01:59:59+00:00", "00:59:59", "-01", 60],
["1990-03-25T02:00:00+00:00", "02:00:00", "+00", 0],
["1990-09-30T01:59:59+00:00", "01:59:59", "+00", 0],
["1990-09-30T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1991" : helpers.makeTestYear("Atlantic/Azores", [
["1991-03-31T01:59:59+00:00", "00:59:59", "-01", 60],
["1991-03-31T02:00:00+00:00", "02:00:00", "+00", 0],
["1991-09-29T01:59:59+00:00", "01:59:59", "+00", 0],
["1991-09-29T02:00:00+00:00", "01:00:00", "-01", 60]
]),
"1992" : helpers.makeTestYear("Atlantic/Azores", [
["1992-03-29T01:59:59+00:00", "00:59:59", "-01", 60],
["1992-03-29T02:00:00+00:00", "02:00:00", "+00", 0],
["1992-09-27T01:59:59+00:00", "01:59:59", "+00", 0],
["1992-09-27T02:00:00+00:00", "02:00:00", "WET", 0]
]),
"1993" : helpers.makeTestYear("Atlantic/Azores", [
["1993-03-28T00:59:59+00:00", "00:59:59", "WET", 0],
["1993-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["1993-09-26T00:59:59+00:00", "00:59:59", "+00", 0],
["1993-09-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1994" : helpers.makeTestYear("Atlantic/Azores", [
["1994-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["1994-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["1994-09-25T00:59:59+00:00", "00:59:59", "+00", 0],
["1994-09-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1995" : helpers.makeTestYear("Atlantic/Azores", [
["1995-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["1995-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["1995-09-24T00:59:59+00:00", "00:59:59", "+00", 0],
["1995-09-24T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1996" : helpers.makeTestYear("Atlantic/Azores", [
["1996-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["1996-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["1996-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["1996-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1997" : helpers.makeTestYear("Atlantic/Azores", [
["1997-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["1997-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["1997-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["1997-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1998" : helpers.makeTestYear("Atlantic/Azores", [
["1998-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["1998-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["1998-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["1998-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"1999" : helpers.makeTestYear("Atlantic/Azores", [
["1999-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["1999-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["1999-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["1999-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2000" : helpers.makeTestYear("Atlantic/Azores", [
["2000-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2000-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2000-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2000-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2001" : helpers.makeTestYear("Atlantic/Azores", [
["2001-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2001-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2001-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2001-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2002" : helpers.makeTestYear("Atlantic/Azores", [
["2002-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["2002-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["2002-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["2002-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2003" : helpers.makeTestYear("Atlantic/Azores", [
["2003-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2003-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2003-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2003-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2004" : helpers.makeTestYear("Atlantic/Azores", [
["2004-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["2004-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["2004-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["2004-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2005" : helpers.makeTestYear("Atlantic/Azores", [
["2005-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["2005-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["2005-10-30T00:59:59+00:00", "00:59:59", "+00", 0],
["2005-10-30T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2006" : helpers.makeTestYear("Atlantic/Azores", [
["2006-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2006-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2006-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2006-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2007" : helpers.makeTestYear("Atlantic/Azores", [
["2007-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2007-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2007-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2007-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2008" : helpers.makeTestYear("Atlantic/Azores", [
["2008-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2008-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2008-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2008-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2009" : helpers.makeTestYear("Atlantic/Azores", [
["2009-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["2009-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["2009-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["2009-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2010" : helpers.makeTestYear("Atlantic/Azores", [
["2010-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["2010-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["2010-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["2010-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2011" : helpers.makeTestYear("Atlantic/Azores", [
["2011-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["2011-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["2011-10-30T00:59:59+00:00", "00:59:59", "+00", 0],
["2011-10-30T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2012" : helpers.makeTestYear("Atlantic/Azores", [
["2012-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2012-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2012-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2012-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2013" : helpers.makeTestYear("Atlantic/Azores", [
["2013-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["2013-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["2013-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["2013-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2014" : helpers.makeTestYear("Atlantic/Azores", [
["2014-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2014-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2014-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2014-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2015" : helpers.makeTestYear("Atlantic/Azores", [
["2015-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["2015-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["2015-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["2015-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2016" : helpers.makeTestYear("Atlantic/Azores", [
["2016-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["2016-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["2016-10-30T00:59:59+00:00", "00:59:59", "+00", 0],
["2016-10-30T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2017" : helpers.makeTestYear("Atlantic/Azores", [
["2017-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2017-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2017-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2017-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2018" : helpers.makeTestYear("Atlantic/Azores", [
["2018-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2018-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2018-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2018-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2019" : helpers.makeTestYear("Atlantic/Azores", [
["2019-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["2019-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["2019-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["2019-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2020" : helpers.makeTestYear("Atlantic/Azores", [
["2020-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["2020-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["2020-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["2020-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2021" : helpers.makeTestYear("Atlantic/Azores", [
["2021-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["2021-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["2021-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["2021-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2022" : helpers.makeTestYear("Atlantic/Azores", [
["2022-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["2022-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["2022-10-30T00:59:59+00:00", "00:59:59", "+00", 0],
["2022-10-30T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2023" : helpers.makeTestYear("Atlantic/Azores", [
["2023-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2023-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2023-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2023-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2024" : helpers.makeTestYear("Atlantic/Azores", [
["2024-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["2024-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["2024-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["2024-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2025" : helpers.makeTestYear("Atlantic/Azores", [
["2025-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2025-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2025-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2025-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2026" : helpers.makeTestYear("Atlantic/Azores", [
["2026-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["2026-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["2026-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["2026-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2027" : helpers.makeTestYear("Atlantic/Azores", [
["2027-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["2027-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["2027-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["2027-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2028" : helpers.makeTestYear("Atlantic/Azores", [
["2028-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2028-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2028-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2028-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2029" : helpers.makeTestYear("Atlantic/Azores", [
["2029-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2029-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2029-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2029-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2030" : helpers.makeTestYear("Atlantic/Azores", [
["2030-03-31T00:59:59+00:00", "23:59:59", "-01", 60],
["2030-03-31T01:00:00+00:00", "01:00:00", "+00", 0],
["2030-10-27T00:59:59+00:00", "00:59:59", "+00", 0],
["2030-10-27T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2031" : helpers.makeTestYear("Atlantic/Azores", [
["2031-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2031-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2031-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2031-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2032" : helpers.makeTestYear("Atlantic/Azores", [
["2032-03-28T00:59:59+00:00", "23:59:59", "-01", 60],
["2032-03-28T01:00:00+00:00", "01:00:00", "+00", 0],
["2032-10-31T00:59:59+00:00", "00:59:59", "+00", 0],
["2032-10-31T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2033" : helpers.makeTestYear("Atlantic/Azores", [
["2033-03-27T00:59:59+00:00", "23:59:59", "-01", 60],
["2033-03-27T01:00:00+00:00", "01:00:00", "+00", 0],
["2033-10-30T00:59:59+00:00", "00:59:59", "+00", 0],
["2033-10-30T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2034" : helpers.makeTestYear("Atlantic/Azores", [
["2034-03-26T00:59:59+00:00", "23:59:59", "-01", 60],
["2034-03-26T01:00:00+00:00", "01:00:00", "+00", 0],
["2034-10-29T00:59:59+00:00", "00:59:59", "+00", 0],
["2034-10-29T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2035" : helpers.makeTestYear("Atlantic/Azores", [
["2035-03-25T00:59:59+00:00", "23:59:59", "-01", 60],
["2035-03-25T01:00:00+00:00", "01:00:00", "+00", 0],
["2035-10-28T00:59:59+00:00", "00:59:59", "+00", 0],
["2035-10-28T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2036" : helpers.makeTestYear("Atlantic/Azores", [
["2036-03-30T00:59:59+00:00", "23:59:59", "-01", 60],
["2036-03-30T01:00:00+00:00", "01:00:00", "+00", 0],
["2036-10-26T00:59:59+00:00", "00:59:59", "+00", 0],
["2036-10-26T01:00:00+00:00", "00:00:00", "-01", 60]
]),
"2037" : helpers.makeTestYear("Atlantic/Azores", [
["2037-03-29T00:59:59+00:00", "23:59:59", "-01", 60],
["2037-03-29T01:00:00+00:00", "01:00:00", "+00", 0],
["2037-10-25T00:59:59+00:00", "00:59:59", "+00", 0],
["2037-10-25T01:00:00+00:00", "00:00:00", "-01", 60]
])
};
|
/* jshint node: true */
'use strict';
var util = require('util');
var _ = require('underscore');
var defaults = require('../defaults');
var options = require('../options');
var descriptor = defaults.defaultDescriptor({
'name': {
name: 'App Name',
required: true
},
'apiProducts': {
name: 'API Products',
required: true
},
'email' : {
name: 'Developer Email',
required: true
},
'callback': {
name:'Callback URL'
}
});
module.exports.descriptor = descriptor;
module.exports.run = function(opts, cb) {
options.validateSync(opts, descriptor);
if (opts.debug) {
console.log('createApp: %j', opts);
}
var request = defaults.defaultRequest(opts);
createApp(opts, request, function(err, results) {
if (err) {
cb(err);
} else {
if (opts.debug) {
console.log('results: %j', results);
}
cb(undefined, results);
}
});
};
function createApp(opts,request,done){
var app = {
"name" : opts.name,
"apiProducts" : [],
"callbackUrl": opts.callback
}
if(opts.attributes){
app.attributes = opts.attributes;
};
if(opts.keyExpiresIn){
app.keyExpiresIn = opts.keyExpiresIn;
};
if(opts.scopes){
app.scopes = opts.scopes;
};
if(opts.apiProducts){
var split = opts.apiProducts.split(',')
split.forEach(function(s){
if(s && s.trim()!= '') {
app.apiProducts.push(s.trim())
}
})
}
var uri = util.format('%s/v1/o/%s/developers/%s/apps', opts.baseuri, opts.organization,opts.email);
request({
uri: uri,
method:'POST',
body: app,
json:true
},function(err,res,body){
var jsonBody = body
if(err){
if (opts.debug) {
console.log('Error occured %s', err);
}
done(err)
}else if (res.statusCode === 201) {
if (opts.verbose) {
console.log('Create successful');
}
if (opts.debug) {
console.log('%s', body);
}
done(undefined, jsonBody);
}else {
if (opts.verbose) {
console.error('Create App result: %j', body);
}
var errMsg;
if (jsonBody && (jsonBody.message)) {
errMsg = jsonBody.message;
} else {
errMsg = util.format('Create App failed with status code %d', res.statusCode);
}
done(new Error(errMsg));
}
})
}
|
import Logger, { configure, levels } from '..';
import ConsoleHandler from 'nightingale-console';
configure([
{
handlers: [new ConsoleHandler(levels.ALL)],
},
{
key: 'app',
handlers: [new ConsoleHandler(levels.DEBUG)],
},
{
pattern: /^app\.service\./,
handlers: [new ConsoleHandler(levels.INFO)],
},
]);
const smthg = new Logger('smthg');
const app = new Logger('app');
const appService = new Logger('app.service.myService.insideMyService');
smthg.trace('shoud appear 1');
app.trace('shoud notappear');
app.info('shoud appear 2');
appService.trace('shoud not appear');
appService.debug('shoud not appear');
appService.info('shoud appear 3');
|
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* @name Battery Status
* @description
* Requires Cordova plugin: cordova-plugin-batterystatus. For more info, please see the [BatteryStatus plugin docs](https://github.com/apache/cordova-plugin-battery-status).
*
* @usage
* ```typescript
* import { BatteryStatus } from 'ionic-native';
*
*
* // watch change in battery status
* let subscription = BatteryStatus.onChange().subscribe(
* (status: StatusObject) => {
* console.log(status.level, status.isPlugged);
* }
* );
*
* // stop watch
* subscription.unsubscribe();
*
* ```
*/
var BatteryStatus = (function () {
function BatteryStatus() {
}
/**
* Watch the change in battery level
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
*/
BatteryStatus.onChange = function () { return; };
/**
* Watch when the battery level goes low
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
*/
BatteryStatus.onLow = function () { return; };
/**
* Watch when the battery level goes to critial
* @returns {Observable<StatusObject>} Returns an observable that pushes a status object
*/
BatteryStatus.onCritical = function () { return; };
__decorate([
plugin_1.Cordova({
eventObservable: true,
event: 'batterystatus'
})
], BatteryStatus, "onChange", null);
__decorate([
plugin_1.Cordova({
eventObservable: true,
event: 'batterylow'
})
], BatteryStatus, "onLow", null);
__decorate([
plugin_1.Cordova({
eventObservable: true,
event: 'batterycritical'
})
], BatteryStatus, "onCritical", null);
BatteryStatus = __decorate([
plugin_1.Plugin({
pluginName: 'BatteryStatus',
plugin: 'cordova-plugin-battery-status',
repo: 'https://github.com/apache/cordova-plugin-battery-status',
platforms: ['Amazon Fire OS', 'iOS', 'Android', 'BlackBerry 10', 'Windows Phone 7', 'Windows Phone 8', 'Windows', 'Firefox OS', 'Browser']
})
], BatteryStatus);
return BatteryStatus;
}());
exports.BatteryStatus = BatteryStatus;
//# sourceMappingURL=batterystatus.js.map
|
$(function(){
$.getJSON('https://graph.facebook.com/hf.lan.esiee?fields=albums.fields(name,type,count,id,photos.limit(3).fields(picture))', function(data){
$('#photo-albums').html('');
$.each(data.albums.data, function(i, e){
if(e.type == 'normal' && e.count > 20){
var album = $('<a class="photo-album" href="'+window.location+ e.id+'"><div>'+ e.name+'</div></a>');
$('#photo-albums').append(album);
$.each(e.photos.data, function(j, photo){
var img = $('<img src="'+photo.picture+'">');
album.prepend(img);
})
}
})
})
})
|
/**
* Test for bin.
* Runs with mocha.
*/
'use strict'
const bin = require.resolve('../bin/apeman-app')
const assert = require('assert')
const cp = require('child_process')
describe('bin', () => {
it('Bin assert.', (done) => {
let cmd = `${bin} -h`
cp.exec(cmd, (err) => {
assert.ifError(err)
done()
})
})
})
/* global describe, before, after, it */
|
var searchData=
[
['visiontouchsurfacelib',['visionTouchSurfaceLib',['../md__r_e_a_d_m_e.html',1,'']]],
['visionprocessor',['VisionProcessor',['../class_vision_processor.html',1,'VisionProcessor'],['../class_vision_processor.html#a0dfc833174259e8b57fd658669b76c6b',1,'VisionProcessor::VisionProcessor()']]],
['visionprocessor_2ecpp',['visionprocessor.cpp',['../visionprocessor_8cpp.html',1,'']]],
['visionprocessor_2eh',['visionprocessor.h',['../visionprocessor_8h.html',1,'']]]
];
|
import {
_,
passport,
request,
LocalStrategy,
crypto,
FacebookStrategy,
TwitterStrategy,
GitHubStrategy,
GoogleStrategy,
OpenIDStrategy,
RedditStrategy,
config,
nodemailer
} from './modules';
import {
User
} from '../database';
import {
getGravatar
} from '../utils';
const hash = (pwd) => {
return crypto
.createHash('sha1')
.update(pwd)
.digest('hex');
};
// Serialized and deserialized methods when got from session
passport.serializeUser(function (user, done) {
done(null, user);
});
passport.deserializeUser(function (user, done) {
done(null, user);
});
/* Facebook */ {
passport.use(new FacebookStrategy({
clientID: config.FACEBOOK_ID,
clientSecret: config.FACEBOOK_SECRET,
callbackURL: config.FACEBOOK_CALLBACK_URL,
profileFields: ['name', 'email', 'link'],
passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
if (req.user) {
User.findOne(
{where: {facebook: profile.id}}).then(alreadyExists => {
if (alreadyExists) {
return done();
}
User.findOne({ where: {id: req.user.id} }).then(user => {
user.facebook = profile.id;
user.createToken({kind: 'facebook', accessToken});
user.save();
done();
});
});
} else {
User.findOne(
{where: {facebook: profile.id}}).then(existingUser => {
if (existingUser) {
return done(null, existingUser);
}
User.findOne({
where: { email: profile._json.email }}).then(emailExists => {
if (emailExists) {
console.log('email already exists');
// There is already a user that has this email in the db.
return done();
}
User.create({
facebook: profile.id,
email: profile._json.email
}).then(newUser => {
newUser.createToken({kind: 'facebook', accessToken});
done();
});
});
});
}
}));
}
/* Reddit */ {
passport.use(new RedditStrategy({
clientID: config.REDDIT_ID,
clientSecret: config.REDDIT_SECRET,
callbackURL: config.REDDIT_CALLBACK_URL,
passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
console.log('reddit', JSON.stringify(profile, null, 2));
if (req.user) {
User.findOne(
{where: {reddit: profile.id}}).then(alreadyExists => {
if (alreadyExists) {
return done();
}
User.findOne({ where: {id: req.user.id} }).then(user => {
user.reddit = profile.id;
user.createToken({kind: 'reddit', accessToken});
user.save();
done();
});
});
} else {
User.findOne(
{where: {reddit: profile.id}}).then(existingUser => {
if (existingUser) {
return done(null, existingUser);
}
User.findOne({
where: { email: profile._json.email }}).then(emailExists => {
if (emailExists) {
// There is already a user that has this email in the db.
return done();
}
User.create({
reddit: profile.id,
email: profile._json.email
}).then(newUser => {
newUser.createToken({kind: 'reddit', accessToken}).then(() => {
done();
});
});
});
});
}
}));
}
/* Github */ {
passport.use(new GitHubStrategy({
clientID: config.GITHUB_ID,
clientSecret: config.GITHUB_SECRET,
callbackURL: config.GITHUB_CALLBACK_URL,
passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
if (req.user) {
User.findOne(
{where: {github: profile.id}}).then(alreadyExists => {
if (alreadyExists) {
// Github user is already registered.
return done();
}
User.findOne({ where: {id: req.user.id} }).then(user => {
user.github = profile.id;
user.pictureUrl = user.pictureUrl || profile._json.avatar_url;
user.location = user.location || profile._json.location;
user.website = user.website || profile._json.blog;
user.createToken({kind: 'github', accessToken}).then(() => {
user.save();
done();
});
});
});
} else {
User.findOne(
{where: {github: profile.id}}).then(existingUser => {
if (existingUser) {
return done(null, existingUser);
}
User.findOne({
where: { email: profile._json.email }}).then(emailExists => {
if (emailExists) {
// There is already a user that has this email in the db.
return done();
}
User.create({
github: profile.id,
displayName: profile.displayName,
email: profile._json.email,
pictureUrl: profile._json.avatar_url,
location: profile._json.location,
website: profile._json.blog
}).then(newUser => {
newUser.createToken({kind: 'github', accessToken}).then(() => {
done();
});
});
});
});
}
}));
}
/* Twitter */ {
passport.use(new TwitterStrategy({
consumerKey: config.TWITTER_KEY,
consumerSecret: config.TWITTER_SECRET,
callbackURL: config.TWITTER_CALLBACK_URL,
passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
if (req.user) {
User.findOne(
{where: {twitter: profile.id}}).then(alreadyExists => {
if (alreadyExists) {
return done();
}
User.findOne({ where: {id: req.user.id} }).then(user => {
user.twitter = profile.id;
user.displayName = user.displayName || profile.displayName;
user.username = user.username || profile.username;
user.location = user.location || profile._json.location;
user.pictureUrl =
user.pictureUrl || profile._json.profile_image_url_https;
user.save().then((savedUser) => {
savedUser.createToken({kind: 'twitter', accessToken}).then(() => {
done();
});
});
});
});
} else {
User.findOne(
{where: {twitter: profile.id}}).then(existingUser => {
if (existingUser) {
return done(null, existingUser);
}
User.create({
twitter: profile.id,
displayName: profile.displayName,
location: profile._json.location,
username: profile.username,
pictureUrl: profile._json.profile_image_url_https,
email: profile.username + '@twitter.com'
}).then(newUser => {
newUser.createToken({kind: 'twitter', accessToken}).then(() => {
done(newUser);
});
});
});
}
}));
}
/* Google */ {
passport.use(new GoogleStrategy({
clientID: config.GOOGLE_ID,
clientSecret: config.GOOGLE_SECRET,
callbackURL: config.GOOGLE_CALLBACK_URL,
passReqToCallback: true
}, function (req, accessToken, refreshToken, profile, done) {
if (req.user) {
User.findOne(
{where: {google: profile.id}}).then(alreadyExists => {
if (alreadyExists) {
console.log('already exists');
return done();
}
User.findOne({ where: {id: req.user.id} }).then(user => {
console.log('update user');
user.set('google', profile.id);
user.set('displayName', user.displayName || profile.displayName);
user.set('pictureUrl', user.pictureUrl || profile._json.image.url);
user.save().then((savedUser) => {
console.log('user saved, creating access token');
savedUser.createToken({kind: 'google', accessToken}).then(() => {
console.log('token created');
done();
});
});
});
});
} else {
User.findOne(
{where: {google: profile.id}}).then(existingUser => {
if (existingUser) {
console.log('user already exists');
return done(null, existingUser);
}
User.findOne({
where: { email: profile.emails[0].value }}).then(emailExists => {
if (emailExists) {
console.log('user email already exists');
// There is already a user that has this email in the db.
return done();
}
User.create({
google: profile.id,
email: profile.emails[0].value,
displayName: profile.displayName,
pictureUrl: profile._json.image.url
}).then(newUser => {
console.log('new user created');
newUser.createToken({kind: 'google', accessToken}).then(() => {
done(newUser);
});
});
});
});
}
}));
}
/* Steam */ {
passport.use(new OpenIDStrategy({
apiKey: config.STEAM_KEY,
providerURL: 'http://steamcommunity.com/openid',
returnURL: config.STEAM_CALLBACK_URL,
realm: 'http://localhost:3000/',
stateless: true
}, function (identifier, done) {
var steamId = identifier.match(/\d+$/)[0];
var profileURL =
'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' +
config.STEAM_KEY + '&steamids=' + steamId;
User.findOne({ steam: steamId }, (err, existingUser) => {
if (existingUser) {
return done(err, existingUser);
}
request(profileURL, (error, response) => {
if (!error && response.statusCode === 200) {
User.create({
steam: steamId,
email: steamId + '@steam.com'
}).then(user => {
user.createToken({
kind: 'steam',
accessToken: steamId
});
user.save().then(done);
});
} else {
done(error, null);
}
});
});
}));
}
export function isAuthenticated(req, res, next) {
if (req.isAuthenticated()) {
return next();
}
}
export function isAuthorized(req, res, next) {
var provider = req.path.split('/').slice(-1)[0];
if (_.find(req.user.tokens, { kind: provider })) {
next();
} else {
res.redirect('/auth/' + provider);
}
}
passport.use('local', new LocalStrategy(
function (usernameOrEmail, password, done) {
User.find({ where: { username: usernameOrEmail } }).then(userByName => {
if (!userByName) {
User.findOne({email: usernameOrEmail.toLowerCase()})
.then(userByEmail => {
if (!userByEmail) {
return done(null, false, { message: 'Incorrect username.' });
}
if (hash(password) !== userByEmail.password) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, userByEmail);
});
} else {
if (hash(password) !== userByName.password) {
return done(null, false, { message: 'Incorrect password.' });
}
return done(null, userByName);
}
}).catch(done);
}
));
export function login() {
return function (req, res, next) {
passport.authenticate('local', function (err, user, info) {
// console.log(err, info);
if (err) {
return next(err);
}
if (!user) {
res.status(401);
res.json(info);
return next();
}
req.logIn(user, function (loginErr) {
if (loginErr) {
return next(loginErr);
}
res.json({user, message: 'success'});
});
})(req, res, next);
};
}
function createUser({username, password, email}) {
return new Promise((resolve, reject) => {
getGravatar(email).then(data => {
User.create({
username,
password: hash(password),
email: email,
pictureUrl: data.thumbnailUrl || '',
displayName: data.displayName || username
}).then((user) => resolve(user)).catch(err => reject(err));
});
});
}
export function signUp() {
return function (req, res, next) {
User.count().then(count => {
if (typeof count === 'number' && count > 0) {
User.findOne(
{ where: { username: req.body.username } }
).then(taken => {
if (taken) {
res.status(401);
return res.json({message: 'username already exists'});
}
createUser(req.body).then(user => {
req.logIn(user, err => {
if (err) {
return next(err);
}
res.json({user, message: 'success'});
});
}).catch(bad => next(bad));
}).catch(err => next(err));
} else {
createUser(req.body).then(user => {
req.logIn(user, err => {
if (err) {
return next(err);
}
res.json({user, message: 'success'});
});
}).catch(err => next(err));
}
});
};
}
export function forgot() {
return function (req, res, next) {
crypto.randomBytes(16, (err, buf) => {
if (err) {
return next(err);
}
var token = buf.toString('hex');
User.findOne({email: req.body.email.toLowerCase()}).then(user => {
if (!user) {
req.logger.log('debug', 'user not found');
res.send('ok');
}
user.resetPasswordToken = token;
user.resetPasswordExpires = Date.now() + 3600000; // 1 hour
user.save().then(() => {
var transporter = nodemailer.createTransport({
service: 'Mailgun',
auth: {
user: config.MAILGUN_USER,
pass: config.MAILGUN_PASSWORD
}
});
var mailOptions = {
to: user.email,
from: 'reactathon@starter.com',
subject: 'Reset your password on Reactathon Starter',
text: `
You are receiving this email because you (or someone else)
have requested the reset of the password for your account.\n\n
Please click on the following link, or paste this into your
browser to complete the process:\n\n
http://${req.headers.host + '/reset/' + token}\n\n
If you did not request this, please ignore this
email and your password will remain unchanged.\n`
};
transporter.sendMail(mailOptions, (e, r) => {
if (e) {
req.logger.log('error', e);
}
req.logger.log('info', r);
res.send('ok');
});
});
});
});
};
}
export function handleReset() {
return function (req, res, next) {
User.findOne({resetPasswordToken: req.params.token}, {
where: {
resetPasswordExpires: {
$gt: Date.now()
}
}
}).then(user => {
if (!user) {
res.status(400).send('Bad Request');
}
user.set('resetPasswordToken', null);
user.set('resetPasswordExpires', null);
user.set('password', hash(req.body.password));
user.save().then(() => {
res.send('ok');
}).catch(saveerr => next(saveerr));
}).catch(err => next(err));
};
}
|
/* eslint-disable no-unused-expressions */
const merge = require('lodash.merge');
const request = require('superagent');
const createApplication = require('../fixtures/server');
const chai = require('chai');
const sinon = require('sinon');
const sinonChai = require('sinon-chai');
const { expect } = chai;
chai.use(sinonChai);
describe('REST authentication', function () {
const port = 8996;
const baseURL = `http://localhost:${port}`;
const app = createApplication({ secret: 'supersecret' });
let server;
let expiredToken;
let accessToken;
before(done => {
const options = merge({}, app.get('authentication'), { jwt: { expiresIn: '1ms' } });
app.passport.createJWT({}, options)
.then(token => {
expiredToken = token;
return app.passport.createJWT({ userId: 0 }, app.get('authentication'));
})
.then(token => {
accessToken = token;
server = app.listen(port);
server.once('listening', () => done());
});
});
after(() => server.close());
describe('Authenticating against auth service', () => {
describe('Using local strategy', () => {
let data;
beforeEach(() => {
data = {
strategy: 'local',
email: 'admin@feathersjs.com',
password: 'admin'
};
});
describe('when using valid credentials', () => {
it('returns a valid access token', () => {
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response.body.accessToken).to.exist;
return app.passport.verifyJWT(response.body.accessToken, app.get('authentication'));
}).then(payload => {
expect(payload).to.exist;
expect(payload.iss).to.equal('feathers');
expect(payload.userId).to.equal(0);
});
});
});
describe('when using invalid credentials', () => {
it('returns NotAuthenticated error', () => {
data.password = 'invalid';
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when missing credentials', () => {
it('returns NotAuthenticated error', () => {
return request
.post(`${baseURL}/authentication`)
.send({})
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
});
describe('Using JWT strategy via body', () => {
let data;
beforeEach(() => {
data = { accessToken };
});
describe('when using a valid access token', () => {
it('returns a valid access token', () => {
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response.body.accessToken).to.exist;
return app.passport.verifyJWT(response.body.accessToken, app.get('authentication'));
}).then(payload => {
expect(payload).to.exist;
expect(payload.iss).to.equal('feathers');
expect(payload.userId).to.equal(0);
});
});
});
describe.skip('when using a valid refresh token', () => {
it('returns a valid access token', () => {
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response.body.accessToken).to.exist;
return app.passport.verifyJWT(response.body.accessToken, app.get('authentication'));
}).then(payload => {
expect(payload).to.exist;
expect(payload.iss).to.equal('feathers');
expect(payload.userId).to.equal(0);
});
});
});
describe('when access token is invalid', () => {
it('returns not authenticated error', () => {
data.accessToken = 'invalid';
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when access token is expired', () => {
it('returns not authenticated error', () => {
data.accessToken = expiredToken;
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when access token is missing', () => {
it('returns not authenticated error', () => {
delete data.accessToken;
return request
.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
});
});
describe('when calling a protected service method', () => {
describe('when header is invalid', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/users`)
.set('X-Authorization', accessToken)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is invalid', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/users`)
.set('Authorization', 'invalid')
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is expired', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/users`)
.set('Authorization', expiredToken)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is valid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/users`)
.set('Authorization', accessToken)
.then(response => {
expect(response.body.length).to.equal(1);
expect(response.body[0].id).to.equal(0);
});
});
});
});
describe('when calling an un-protected service method', () => {
describe('when header is invalid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/users/0`)
.set('X-Authorization', accessToken)
.then(response => {
expect(response.body.id).to.equal(0);
});
});
});
describe('when token is invalid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/users/0`)
.set('Authorization', 'invalid')
.then(response => {
expect(response.body.id).to.equal(0);
});
});
});
describe('when token is expired', () => {
it('returns data', () => {
return request
.get(`${baseURL}/users/0`)
.set('Authorization', expiredToken)
.then(response => {
expect(response.body.id).to.equal(0);
});
});
});
describe('when token is valid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/users/0`)
.set('Authorization', accessToken)
.then(response => {
expect(response.body.id).to.equal(0);
});
});
});
});
describe('when calling a protected custom route', () => {
describe('when header is invalid', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/protected`)
.set('Content-Type', 'application/json')
.set('X-Authorization', accessToken)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is invalid', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/protected`)
.set('Content-Type', 'application/json')
.set('Authorization', 'invalid')
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is expired', () => {
it('returns not authenticated error', () => {
return request
.get(`${baseURL}/protected`)
.set('Content-Type', 'application/json')
.set('Authorization', expiredToken)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
expect(error.response.body.name).to.equal('NotAuthenticated');
});
});
});
describe('when token is valid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/protected`)
.set('Content-Type', 'application/json')
.set('Authorization', accessToken)
.then(response => {
expect(response.body.success).to.equal(true);
});
});
});
});
describe('when calling an un-protected custom route', () => {
describe('when header is invalid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/unprotected`)
.set('Content-Type', 'application/json')
.set('X-Authorization', accessToken)
.then(response => {
expect(response.body.success).to.equal(true);
});
});
});
describe('when token is invalid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/unprotected`)
.set('Content-Type', 'application/json')
.set('Authorization', 'invalid')
.then(response => {
expect(response.body.success).to.equal(true);
});
});
});
describe('when token is expired', () => {
it('returns data', () => {
return request
.get(`${baseURL}/unprotected`)
.set('Content-Type', 'application/json')
.set('Authorization', expiredToken)
.then(response => {
expect(response.body.success).to.equal(true);
});
});
});
describe('when token is valid', () => {
it('returns data', () => {
return request
.get(`${baseURL}/unprotected`)
.set('Content-Type', 'application/json')
.set('Authorization', accessToken)
.then(response => {
expect(response.body.success).to.equal(true);
});
});
});
});
describe('when redirects are enabled', () => {
let data;
beforeEach(() => {
data = {
email: 'admin@feathersjs.com',
password: 'admin'
};
});
describe('authentication succeeds', () => {
it('redirects', () => {
return request
.post(`${baseURL}/login`)
.send(data)
.then(response => {
expect(response.status).to.equal(200);
expect(response.body).to.deep.equal({ success: true });
});
});
});
describe('authentication fails', () => {
it('redirects', () => {
data.password = 'invalid';
return request
.post(`${baseURL}/login`)
.send(data)
.then(response => {
expect(response.body.success).to.equal(false);
});
});
});
});
describe('events', () => {
let data;
beforeEach(() => {
data = {
strategy: 'local',
email: 'admin@feathersjs.com',
password: 'admin'
};
});
describe('when authentication succeeds', () => {
it('emits login event', done => {
app.once('login', function (auth, info) {
expect(info.provider).to.equal('rest');
expect(info.req).to.exist;
expect(info.res).to.exist;
done();
});
request.post(`${baseURL}/authentication`).send(data).end();
});
});
describe('authentication fails', () => {
it('does not emit login event', done => {
data.password = 'invalid';
const handler = sinon.spy();
app.once('login', handler);
request.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
expect(response).to.not.be.ok; // should not get here
})
.catch(error => {
expect(error.status).to.equal(401);
setTimeout(function () {
expect(handler).to.not.have.been.called;
done();
}, 100);
});
});
});
describe('when logout succeeds', () => {
it('emits logout event', done => {
app.once('logout', function (auth, info) {
expect(info.provider).to.equal('rest');
expect(info.req).to.exist;
expect(info.res).to.exist;
done();
});
request.post(`${baseURL}/authentication`)
.send(data)
.then(response => {
return request
.del(`${baseURL}/authentication`)
.set('Content-Type', 'application/json')
.set('Authorization', response.body.accessToken);
})
.then(response => {
expect(response.status).to.equal(200);
});
});
});
});
});
|
import { Meteor } from 'meteor/meteor';
import { actionLinks } from '../both/lib/actionLinks';
// Action Links Handler. This method will be called off the client.
Meteor.methods({
actionLinkHandler(name, messageId) {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'actionLinkHandler' });
}
const message = actionLinks.getMessage(name, messageId);
const actionLink = message.actionLinks[name];
actionLinks.actions[actionLink.method_id](message, actionLink.params);
},
});
|
'use strict'
var midi = require('./midi')
/**
* Get the pitch frequency in herzs with custom concert tuning
*
* This function is currified so it can be partially applied (see examples)
*
* @name note.freq
* @function
* @param {Float} tuning - the frequency of A4 (null means 440)
* @param {String|Array} note - the note name
* @return {Float} the frequency of the note
*
* @example
* note.freq(null, 'A4') // => 440
* note.freq(444, 'A4') // => 444
*
* @example
* // partially applied
* ['A4', 'A#4', 'B5'].map(note.freq(440)) // => [440, ...]
* var baroque = note.freq(415)
* baroque('A3') // => 207.5
*/
module.exports = function freq (tuning, pitch) {
tuning = tuning || 440
if (arguments.length > 1) return freq(tuning)(pitch)
return function (p) {
if (!isNaN(p)) return p
var m = midi(p)
if (!m) return null
return Math.pow(2, (m - 69) / 12) * tuning
}
}
|
var _ = require("lodash");
var Chan = require("./models/chan");
var crypto = require("crypto");
var fs = require("fs");
var identd = require("./identd");
var log = require("./log");
var net = require("net");
var Msg = require("./models/msg");
var Network = require("./models/network");
var slate = require("slate-irc");
var tls = require("tls");
var Helper = require("./helper");
module.exports = Client;
var id = 0;
var events = [
"ctcp",
"error",
"join",
"kick",
"mode",
"motd",
"message",
"link",
"names",
"nick",
"notice",
"part",
"quit",
"topic",
"welcome",
"whois"
];
var inputs = [
"action",
"connect",
"invite",
"join",
"kick",
"mode",
"msg",
"nick",
"notice",
"part",
"quit",
"raw",
"services",
"topic",
"whois"
];
function Client(sockets, name, config) {
_.merge(this, {
activeChannel: -1,
config: config,
id: id++,
name: name,
networks: [],
sockets: sockets
});
var client = this;
crypto.randomBytes(48, function(err, buf) {
client.token = buf.toString("hex");
});
if (config) {
var delay = 0;
(config.networks || []).forEach(function(n) {
setTimeout(function() {
client.connect(n);
}, delay);
delay += 1000;
});
}
}
Client.prototype.emit = function(event, data) {
if (this.sockets !== null) {
this.sockets.in(this.id).emit(event, data);
}
var config = this.config || {};
if (config.log === true) {
if (event == "msg") {
var target = this.find(data.chan);
if (target) {
var chan = target.chan.name;
if (target.chan.type == Chan.Type.LOBBY) {
chan = target.network.host;
}
log.write(
this.name,
target.network.host,
chan,
data.msg
);
}
}
}
};
Client.prototype.find = function(id) {
var network = null;
var chan = null;
for (var i in this.networks) {
var n = this.networks[i];
chan = _.find(n.channels, {id: id});
if (chan) {
network = n;
break;
}
}
if (network && chan) {
return {
network: network,
chan: chan
};
} else {
return false;
}
};
Client.prototype.connect = function(args) {
var config = Helper.getConfig();
var client = this;
var server = {
name: args.name || "",
host: args.host || "irc.freenode.org",
port: args.port || (args.tls ? 6697 : 6667),
rejectUnauthorized: false
};
if (config.bind) {
server.localAddress = config.bind;
if(args.tls) {
var socket = net.connect(server);
server.socket = socket;
}
}
var stream = args.tls ? tls.connect(server) : net.connect(server);
stream.on("error", function(e) {
console.log("Client#connect():\n" + e);
stream.end();
var msg = new Msg({
type: Msg.Type.ERROR,
text: "Connection error."
});
client.emit("msg", {
msg: msg
});
});
var nick = args.nick || "shout-user";
var username = args.username || nick.replace(/[^a-zA-Z0-9]/g, '');
var realname = args.realname || "Shout User";
var irc = slate(stream);
identd.hook(stream, username);
if (args.password) {
irc.pass(args.password);
}
irc.me = nick;
irc.nick(nick);
irc.user(username, realname);
var network = new Network({
name: server.name,
host: server.host,
port: server.port,
tls: !!args.tls,
password: args.password,
username: username,
realname: realname,
commands: args.commands
});
network.irc = irc;
client.networks.push(network);
client.emit("network", {
network: network
});
events.forEach(function(plugin) {
var path = "./plugins/irc-events/" + plugin;
require(path).apply(client, [
irc,
network
]);
});
irc.once("welcome", function() {
var delay = 1000;
var commands = args.commands;
if (Array.isArray(commands)) {
commands.forEach(function(cmd) {
setTimeout(function() {
client.input({
target: network.channels[0].id,
text: cmd
});
}, delay);
delay += 1000;
});
}
setTimeout(function() {
irc.write("PING " + network.host);
}, delay);
});
irc.once("pong", function() {
var join = (args.join || "");
if (join) {
join = join.replace(/\,/g, " ").split(/\s+/g);
irc.join(join);
}
});
};
Client.prototype.input = function(data) {
var client = this;
var text = data.text.trim();
var target = client.find(data.target);
if (text.charAt(0) !== "/") {
text = "/say " + text;
}
var args = text.split(" ");
var cmd = args.shift().replace("/", "").toLowerCase();
_.each(inputs, function(plugin) {
try {
var path = "./plugins/inputs/" + plugin;
var fn = require(path);
fn.apply(client, [
target.network,
target.chan,
cmd,
args
]);
} catch (e) {
console.log(path + ": " + e);
}
});
};
Client.prototype.more = function(data) {
var client = this;
var target = client.find(data.target);
if (!target) {
return;
}
var chan = target.chan;
var count = chan.messages.length - (data.count || 0);
var messages = chan.messages.slice(Math.max(0, count - 100), count);
client.emit("more", {
chan: chan.id,
messages: messages
});
};
Client.prototype.open = function(data) {
var target = this.find(data);
if (target) {
target.chan.unread = 0;
this.activeChannel = target.chan.id;
}
};
Client.prototype.sort = function(data) {
var self = this;
var type = data.type;
var order = data.order || [];
switch (type) {
case "networks":
var sorted = [];
_.each(order, function(i) {
var find = _.find(self.networks, {id: i});
if (find) {
sorted.push(find);
}
});
self.networks = sorted;
break;
case "channels":
var target = data.target;
var network = _.find(self.networks, {id: target});
if (!network) {
return;
}
var sorted = [];
_.each(order, function(i) {
var find = _.find(network.channels, {id: i});
if (find) {
sorted.push(find);
}
});
network.channels = sorted;
break;
}
};
Client.prototype.quit = function() {
var sockets = this.sockets.sockets;
var room = sockets.adapter.rooms[this.id] || [];
for (var user in room) {
var socket = sockets.adapter.nsp.connected[user];
if (socket) {
socket.disconnect();
}
}
this.networks.forEach(function(network) {
var irc = network.irc;
if (network.connected) {
irc.quit();
} else {
irc.stream.end();
}
});
};
var timer;
Client.prototype.save = function(force) {
var client = this;
var config = Helper.getConfig();
if(config.public) {
return;
}
if (!force) {
clearTimeout(timer);
timer = setTimeout(function() {
client.save(true);
}, 1000);
return;
}
var name = this.name;
var path = Helper.HOME + "/users/" + name + ".json";
var networks = _.map(
this.networks,
function(n) {
return n.export();
}
);
var json = {};
fs.readFile(path, "utf-8", function(err, data) {
if (err) {
console.log(err);
return;
}
try {
json = JSON.parse(data);
json.networks = networks;
} catch(e) {
console.log(e);
return;
}
fs.writeFile(
path,
JSON.stringify(json, null, " "),
{mode: "0777"},
function(err) {
if (err) {
console.log(err);
}
}
);
});
};
|
export const StorylineTransitiveChildPages = function(storyline, storylines, pages) {
var isTranstiveChildStoryline;
this.contain = function(page) {
if (!isTranstiveChildStoryline) {
search();
}
return !!isTranstiveChildStoryline[page.chapter.storyline.id];
};
function search() {
isTranstiveChildStoryline = storylines.reduce(function(memo, other) {
var current = other;
while (current) {
if (current === storyline || memo[current.id]) {
memo[other.id] = true;
return memo;
}
current = parentStoryline(current);
}
return memo;
}, {});
}
function parentStoryline(storyline) {
var parentPage = pages.getByPermaId(storyline.parentPagePermaId());
return parentPage && parentPage.chapter && parentPage.chapter.storyline;
}
};
|
Prism.languages.ini= {
'comment': /^\s*;.*$/gm,
'important': /\[.*?\]/gm,
'constant': /^\s*[^\s\=]+?(?=[ \t]*\=)/gm,
'attr-value': {
pattern: /\=.*/gm,
inside: {
'punctuation': /^[\=]/g
}
}
};
|
const util = require("util")
const ansi = {
"reset": "\x1B[0m",
"hicolor": "\x1B[1m",
"underline": "\x1B[4m",
"inverse": "\x1B[7m",
// foreground colors
"black": "\x1B[30m",
"red": "\x1B[31m",
"green": "\x1B[32m",
"yellow": "\x1B[33m",
"blue": "\x1B[34m",
"magenta": "\x1B[35m",
"cyan": "\x1B[36m",
"white": "\x1B[37m",
// background colors
"bg_black": "\x1B[40m",
"bg_red": "\x1B[41m",
"bg_green": "\x1B[42m",
"bg_yellow": "\x1B[43m",
"bg_blue": "\x1B[44m",
"bg_magenta": "\x1B[45m",
"bg_cyan": "\x1B[46m",
"bg_white": "\x1B[47m"
}
var logger = {
test: function() {
if (!console || !console.log) throw "unknown system"
},
log: function() {
console.log.apply(null, arguments)
},
emptyLine: function() {
console.log();
},
print: function(label, value, condensed) {
if (typeof label === 'string') {
if (typeof value === 'object') {
console.log([label, util.inspect(value, {depth: 3})].join(": "));
} else {
console.log([label, value].join(": "));
}
}
if (!condensed) console.log();
}
}
var Logger = function Logger(loggerName, options) {
if (!(this instanceof Logger)) {
return new Logger(loggerName, options);
}
var _logger = logger;
var i = this;
this.loggerName = loggerName
this.options = options || {}
this.time = function() {
return '[' + moment().format() + ']'
}
this.labelFormat = function(color, printTime, label) {
return color + (printTime ? this.time() + ' ': '') + (this.loggerName ? this.loggerName + " - " : '') + ansi.reset + label
}
this.print = function(label, value, condensed) {
var l = i.labelFormat(ansi.hicolor, !i.options.skipTime && i.options.printWithTime, label)
return _logger.print(l, value, condensed)
}
this.base = function(color, printTime, args) {
args[0] = this.labelFormat(color, printTime, args[0]);
return console.log.apply(null, args)
}
this.warn = function() {
return this.base(ansi.cyan, !i.options.skipTime,
Array.prototype.slice.call(arguments, 0))
}
this.error = function() {
return this.base(ansi.red, !i.options.skipTime,
Array.prototype.slice.call(arguments, 0))
}
this.info = function() {
return this.base(ansi.green, !i.options.skipTime,
Array.prototype.slice.call(arguments, 0))
}
return this;
}
logger.getLogger = Logger
module.exports = logger
|
var config = {};
config.port = process.env.PORT || 3000;
module.exports = config;
|
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
// HandlebarHelpers.js
// Helper methods for our handlebars.js templates.
define(function (require) {
"use strict";
var Underscore = require('underscore'),
Handlebars = require('handlebars'),
filterID = "",
isSpecialText = false,
i18n = require('i18n');
// Return the localized string corresponding to the specified key.
Handlebars.registerHelper('t', function (i18n_key) {
var result = i18n.t(i18n_key);
// console.log(i18n_key + ":" + result);
return new Handlebars.SafeString(result);
});
// add one to the given number -- used to print out the index+offset for
// the filtered text items
Handlebars.registerHelper("inc", function (value) {
var result = parseInt(value, 10) + 1;
return new Handlebars.SafeString(result);
});
// Return the localized string corresponding to the specified key,
// with the passed in options. Use this method if you need to pass in
// a key with an embedded variable ("You need %s more"), for example.
Handlebars.registerHelper('tr', function (context, options) {
var opts = i18n.functions.extend(options.hash, context),
key = null;
if (options.fn) {
opts.defaultValue = options.fn(context);
}
for (key in opts) {
opts[key] = Handlebars.Utils.escapeExpression(opts[key]);
}
var result = i18n.t(opts.key, opts);
return new Handlebars.SafeString(result);
});
// Return the concatenated string of marker classes for the CSS class list. Also emits the following:
// - "filter" and "moreFilter" classes if filtering is enabled and we encounter filtered markers
// - "specialtext" class if we come across a marker that should be displayed in the "special text" color.
Handlebars.registerHelper('classes', function () {
var ary = this.markers.replace("@", "at").split("\\"),
result = "",
filtered = false,
tmpString = "",
marker = "",
filterString = window.Application.filterList,
newID = Underscore.uniqueId(),
hasSpecialText = false,
SpecialTextMarkers = " _heading_base _intro_base _list_base _notes_base _peripherals_base at add bn br bt cap efm ef d di div dvrf f fe fr fk fq fqa fl fp ft fdc fv fw fm free gm gs gd gp h h1 h2 h3 hr usfm id imt imt1 imt2 imt3 imt4 imte imte1 imte2 is is1 is2 ip ipi ipq ipr iq iq1 iq2 iq3 im imi ili ili1 ili2 imq ib iot io io1 io2 io3 io4 ior iex iqt ie k1 k2 lit mr ms ms1 ms2 ms3 mt mt1 mt2 mt3 mt4 mte mte1 mte2 nc nt note p1 p2 pm pmc pmr pt ps pp pq r rem rr rq s s1 s2 s3 s4 sp sr sx sts",
i = 0;
// if no markers are present, add any special text info and exit
if (this.markers.length === 0) {
if (isSpecialText === true) {
// continuing through some special text
result += " specialtext";
}
filtered = false;
filterID = ""; // no longer filtering
return new Handlebars.SafeString(result);
}
// loop through the marker array
for (i = 0; i < ary.length; i++) {
if (i > 0) {
result += " ";
}
marker = ary[i].trim();
if (marker.length > 0) {
result += "usfm-" + ary[i].substring(0, (ary[i].indexOf(" ") === -1) ? ary[i].length : ary[i].indexOf(" "));
if (filterString.indexOf("\\" + marker + " ") >= 0) {
filtered = true;
}
// check for special text
if (SpecialTextMarkers.indexOf(" " + marker + " ") > -1) {
hasSpecialText = true;
}
// Chapter and verse numbers come in a strip just before the actual marker (here) --
// we need to remove any paragraph breaks here so that the chapter / verse # appear on the same line
if ((this.markers.indexOf("\\c") > -1) || (this.markers.indexOf("\\v") > -1)) {
tmpString = result.replace("usfm-p", " "); // remove para mark (css class only)
result = tmpString;
}
}
}
if (hasSpecialText === true) {
result += " specialtext ";
isSpecialText = true; // toggle the flag for subsequent piles
} else {
isSpecialText = false; // didn't see special text -- turn the flag off
}
if (filtered === true) {
result += " filter ";
if (filterID.length > 0) {
result += "moreFilter ";
} else {
// new filter -- create an ID
filterID = "fid-" + newID.toString();
}
result += filterID;
} else {
filterID = ""; // no longer filtering
}
return new Handlebars.SafeString(result);
});
// Return a chapter number.
Handlebars.registerHelper('chapter', function () {
// extract and return the chapter number from the markers
var result = parseInt(this.markers.substring(this.markers.indexOf('c') + 1), 10);
// console.log(this.markers.substring(this.markers.indexOf('c')));
return new Handlebars.SafeString(result);
});
// Return a verse number
Handlebars.registerHelper('verse', function () {
// extract and return the verse number from the markers
var result = parseInt(this.markers.substring(this.markers.indexOf('v') + 1), 10);
// console.log(this.markers.substring(this.markers.indexOf('v') + 1));
return new Handlebars.SafeString(result);
});
// Return a unique ID
Handlebars.registerHelper('id', function () {
// extract and return the verse number from the markers
var result = Underscore.uniqueId();
return new Handlebars.SafeString(result);
});
// Return the application's version --
// Note that this is a static var in the Application object, and not something held
// in the app metadata.
Handlebars.registerHelper('AppVersion', function () {
var result = window.Application.version;
return new Handlebars.SafeString(result);
});
// If/then processing helper:
// Handlebars doesn't directly perform conditional expression evaluation, so we
// need to roll our own.
// This block was modified from the following post:
// http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
var ary = null,
filterString = window.Application.filterList,
i = 0,
marker = "",
elts = [];
if (this.markers) {
ary = this.markers.replace("@", "at").split("\\");
}
switch (operator) {
case 'notFiltered':
// loop through the marker array -- return true if we encounter a marker that is currently being
// filtered from the UI
for (i = 0; i < ary.length; i++) {
marker = ary[i].trim();
if (marker.length > 0) {
if (filterString.indexOf("\\" + marker + " ") >= 0) {
return options.inverse(this);
}
}
}
return options.fn(this);
case 'instring':
return (v1.indexOf(v2) !== -1) ? options.fn(this) : options.inverse(this);
case 'startswith':
return (v1.indexOf(v2) === 0) ? options.fn(this) : options.inverse(this);
case 'contains':
elts = v2.split(',');
for (i = 0; i < elts.length; i++) {
if (v1.indexOf(elts[i]) !== -1) {
return options.fn(this);
}
}
return options.inverse(this);
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
case '&&':
return (v1 && v2) ? options.fn(this) : options.inverse(this);
case '!=':
return (v1 != v2) ? options.fn(this) : options.inverse(this);
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '!==':
return (v1 !== v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case 'lt':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case 'lte':
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
case 'gt':
return (v1 > v2) ? options.fn(this) : options.inverse(this);
case 'gte':
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});
});
|
var expect = require("chai").expect;
var ingredientsParser = require("../../src/day-15/ingredients-parser");
describe("Ingredients parser", () => {
it("parses 1 ingredient", () => {
var availableIngredients = [
"Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8"
];
var parsedIngredients = ingredientsParser.parse(availableIngredients);
expect(parsedIngredients).to.have.length(1);
expect(parsedIngredients[0].name).to.equal("Butterscotch");
expect(parsedIngredients[0].capacity).to.equal(-1);
expect(parsedIngredients[0].durability).to.equal(-2);
expect(parsedIngredients[0].flavor).to.equal(6);
expect(parsedIngredients[0].texture).to.equal(3);
expect(parsedIngredients[0].calories).to.equal(8);
});
it("parses 2 ingredients", () => {
var availableIngredients = [
"Butterscotch: capacity -1, durability -2, flavor 6, texture 3, calories 8",
"Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3"
];
var parsedIngredients = ingredientsParser.parse(availableIngredients);
expect(parsedIngredients).to.have.length(2);
expect(parsedIngredients[0].name).to.equal("Butterscotch");
expect(parsedIngredients[1].name).to.equal("Cinnamon");
});
});
|
import Helper, { states } from './_helper';
import { module, test } from 'qunit';
module('Integration | ORM | Belongs To | One To One | delete', {
beforeEach() {
this.helper = new Helper();
}
});
states.forEach((state) => {
test(`deleting the parent updates the child's foreign key for a ${state}`, function(assert) {
let [ user, profile ] = this.helper[state]();
if (profile) {
profile.destroy();
user.reload();
}
assert.equal(user.profileId, null);
assert.deepEqual(user.profile, null);
});
});
|
import addNotEnumProps from "../helper/addNotEnumProps";
import { Multicast } from "./Multicast";
import { Observable as Observ } from "./Observable";
addNotEnumProps( Observ.prototype, {
multicast: function( options ) {
return new Multicast( this, options );
}
} );
export default Observ;
|
1 |> f(#) |> g(#);
|
import React, { PropTypes } from 'react';
import styles from './index.module.scss';
import cssModules from 'react-css-modules';
import Heading from 'grommet-udacity/components/Heading';
import Box from 'grommet-udacity/components/Box';
import Button from 'grommet-udacity/components/Button';
import Menu from 'grommet-udacity/components/Menu';
import EditIcon from 'grommet-udacity/components/icons/base/Edit';
import DashboardIcon from 'grommet-udacity/components/icons/base/Dashboard';
import ImageIcon from 'grommet-udacity/components/icons/base/Image';
import { Thumbnail } from 'components';
const MainAside = ({
user,
}) => (
<Box
basis="1/4"
pad={{ vertical: 'large', horizontal: 'small' }}
align="center"
className={styles.aside}
>
{user &&
<div>
<div className={styles.avatarWrapper}>
<Thumbnail
size="medium"
src={user.avatar}
/>
</div>
<Box
className={styles.careerResourcesBlurb}
align="center"
pad={{ horizontal: 'small', vertical: 'small' }}
>
<Heading tag="h3" align="center">
{`Hello, ${user.name}!`}
</Heading>
</Box>
<Box
className={styles.careerResourcesBlurb}
basis="2/3"
align="center"
pad={{ horizontal: 'small', vertical: 'small' }}
>
<Button
className={styles.button}
label="Post an Article"
onClick={e => e}
plain
href={user.role === 'admin' ? '/admin/cms?action=new' : 'author/cms?action=new'}
icon={<EditIcon />}
/>
<Button
className={styles.button}
label="Dashboard"
onClick={e => e}
plain
href={user.role === 'admin' ? '/admin/dashboard' : '/author/dashboard'}
icon={<DashboardIcon />}
/>
</Box>
{user.role === 'admin' &&
<Box className={styles.widgetBox}>
<Heading align="center" tag="h3">
Widgets
</Heading>
<Box
pad={{ horizontal: 'small' }}
className={styles.innerWidgetBox}
>
<Menu inline>
<Button
className={styles.button}
label="Carousel"
onClick={e => e}
plain
href="/admin/carousel"
icon={<ImageIcon />}
/>
</Menu>
</Box>
</Box>
}
</div>
}
</Box>
);
MainAside.propTypes = {
user: PropTypes.object.isRequired,
};
export default cssModules(MainAside, styles);
|
ace.define("ace/snippets/sql",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="snippet tbl\n create table ${1:table} (\n ${2:columns}\n );\nsnippet col\n ${1:name} ${2:type} ${3:default ''} ${4:not null}\nsnippet ccol\n ${1:name} varchar2(${2:size}) ${3:default ''} ${4:not null}\nsnippet ncol\n ${1:name} number ${3:default 0} ${4:not null}\nsnippet dcol\n ${1:name} date ${3:default sysdate} ${4:not null}\nsnippet ind\n create index ${3:$1_$2} on ${1:table}(${2:column});\nsnippet uind\n create unique index ${1:name} on ${2:table}(${3:column});\nsnippet tblcom\n comment on table ${1:table} is '${2:comment}';\nsnippet colcom\n comment on column ${1:table}.${2:column} is '${3:comment}';\nsnippet addcol\n alter table ${1:table} add (${2:column} ${3:type});\nsnippet seq\n create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1};\nsnippet s*\n select * from ${1:table}\n",t.scope="sql"})
|
/*
* Copyright (c) 2017. MIT-license for Jari Van Melckebeke
* Note that there was a lot of educational work in this project,
* this project was (or is) used for an assignment from Realdolmen in Belgium.
* Please just don't abuse my work
*/
define([
"../core"
], function( jQuery ) {
// Support: Android 2.3
// Workaround failure to string-cast null input
jQuery.parseJSON = function( data ) {
return JSON.parse( data + "" );
};
return jQuery.parseJSON;
});
|
export default {
color: {
link: '#F50',
},
};
|
(function() {
'use strict';
angular
.module('app.statistics_report')
.controller('StatisticsMemberConsumptionCtrl', StatisticsMemberConsumptionCtrl);
StatisticsMemberConsumptionCtrl.$inject = ['UtilityService'];
function StatisticsMemberConsumptionCtrl(UtilityService) {
var vm = this;
/*---------- 界面层资源 ----------*/
/*---------- 内部变量 ----------*/
var utilityService = UtilityService;
/*---------- 内部逻辑函数 ----------*/
/*---------- 内部辅助函数 ----------*/
function init() {
}
init();
}
})();
|
'use strict';
const getChannelURL = require('ember-source-channel-url');
module.exports = async function() {
return {
scenarios: [
{
name: 'ember-lts-3.12',
npm: {
devDependencies: {
'ember-source': '~3.12.0'
}
}
},
{
name: 'ember-lts-3.16',
npm: {
devDependencies: {
'ember-source': '~3.16.0'
}
}
},
{
name: 'ember-release',
npm: {
devDependencies: {
'ember-source': await getChannelURL('release')
}
}
},
{
name: 'ember-beta',
npm: {
devDependencies: {
'ember-source': await getChannelURL('beta')
}
}
},
{
name: 'ember-canary',
npm: {
devDependencies: {
'ember-source': await getChannelURL('canary')
}
}
},
// The default `.travis.yml` runs this scenario via `npm test`,
// not via `ember try`. It's still included here so that running
// `ember try:each` manually or from a customized CI config will run it
// along with all the other scenarios.
{
name: 'ember-default',
npm: {
devDependencies: {}
}
},
{
name: 'ember-default-with-jquery',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'jquery-integration': true
})
},
npm: {
devDependencies: {
'@ember/jquery': '^0.5.1'
}
}
},
{
name: 'ember-classic',
env: {
EMBER_OPTIONAL_FEATURES: JSON.stringify({
'application-template-wrapper': true,
'default-async-observers': false,
'template-only-glimmer-components': false
})
},
npm: {
ember: {
edition: 'classic'
}
}
}
]
};
};
|
import isNumber from './isNumber';
import isObject from './isObject';
import isString from './isString';
const convertCamelCase = (key) => {
return key.replace(/([a-z](?=[A-Z]))/g, '$1-').toLowerCase();
};
const fromKeyOrValue = (key, value) => {
return isNumber(value) || isString(value) ? value.toString() : convertCamelCase(key.toString());
};
const isValidArrayItem = (value) => {
return isNumber(value) || isString(value);
};
const isValidObjectPropertyValue = (value) => {
return isNumber(value) || isString(value) || value === true;
};
const parseArrayItem = (obj) => {
if (Array.isArray(obj)) {
return obj
.filter(isValidArrayItem)
.map((item) => item.toString());
}
if (isObject(obj)) {
return Object.keys(obj)
.filter((key) => isValidObjectPropertyValue(obj[key]))
.map((key) => fromKeyOrValue(key, obj[key]));
}
return [];
};
const reduceArray = (prev, curr) => {
const modifiers = parseArrayItem(curr);
return [...prev, ...modifiers];
};
export default (array) => {
return array.reduce(reduceArray, []);
};
|
"use strict";
var _ = require('underscore');
var EventEmitter = require('events').EventEmitter;
var EJSON = require("ejson");
class DDPClient extends EventEmitter{
constructor(opts) {
super();
var self = this;
opts = opts || {};
// backwards compatibility
if ("use_ssl" in opts)
opts.ssl = opts.use_ssl;
if ("auto_reconnect" in opts)
opts.autoReconnect = opts.auto_reconnect;
if ("auto_reconnect_timer" in opts)
opts.autoReconnectTimer = opts.auto_reconnect_timer;
if ("maintain_collections" in opts)
opts.maintainCollections = opts.maintain_collections;
if ("ddp_version" in opts)
opts.ddpVersion = opts.ddp_version;
// default arguments
self.host = opts.host || "localhost";
self.port = opts.port || 3000;
self.path = opts.path;
self.ssl = opts.ssl || self.port === 443;
self.tlsOpts = opts.tlsOpts || {};
self.autoReconnect = ("autoReconnect" in opts) ? opts.autoReconnect : true;
self.autoReconnectTimer = ("autoReconnectTimer" in opts) ? opts.autoReconnectTimer : 500;
self.maintainCollections = ("maintainCollections" in opts) ? opts.maintainCollections : true;
self.url = opts.url;
self.socketConstructor = opts.socketContructor || WebSocket;
// support multiple ddp versions
self.ddpVersion = ("ddpVersion" in opts) ? opts.ddpVersion : "1";
self.supportedDdpVersions = ["1", "pre2", "pre1"];
// Expose EJSON object, so client can use EJSON.addType(...)
self.EJSON = EJSON;
// very very simple collections (name -> [{id -> document}])
if (self.maintainCollections) {
self.collections = {};
}
// internal stuff to track callbacks
self._isConnecting = false;
self._isReconnecting = false;
self._nextId = 0;
self._callbacks = {};
self._updatedCallbacks = {};
self._pendingMethods = {};
self._observers = {};
}
_prepareHandlers() {
var self = this;
self.socket.onopen = function() {
// just go ahead and open the connection on connect
self._send({
msg : "connect",
version : self.ddpVersion,
support : self.supportedDdpVersions
});
};
self.socket.onerror = function(error) {
// error received before connection was established
if (self._isConnecting) {
self.emit("failed", error.message);
}
self.emit("socket-error", error);
};
self.socket.onclose = function(event) {
self.emit("socket-close", event.code, event.reason);
self._endPendingMethodCalls();
self._recoverNetworkError();
};
self.socket.onmessage = function(event) {
self._message(event.data);
self.emit("message", event.data);
};
}
_clearReconnectTimeout() {
var self = this;
if (self.reconnectTimeout) {
clearTimeout(self.reconnectTimeout);
self.reconnectTimeout = null;
}
}
_recoverNetworkError() {
var self = this;
if (self.autoReconnect && ! self._connectionFailed && ! self._isClosing) {
self._clearReconnectTimeout();
self.reconnectTimeout = setTimeout(function() { self.connect(); }, self.autoReconnectTimer);
self._isReconnecting = true;
}
}
///////////////////////////////////////////////////////////////////////////
// RAW, low level functions
_send(data) {
var self = this;
self.socket.send(
EJSON.stringify(data)
);
}
// handle a message from the server
_message(data) {
var self = this;
data = EJSON.parse(data);
// TODO: 'addedBefore' -- not yet implemented in Meteor
// TODO: 'movedBefore' -- not yet implemented in Meteor
if (!data.msg) {
return;
} else if (data.msg === "failed") {
if (self.supportedDdpVersions.indexOf(data.version) !== -1) {
self.ddpVersion = data.version;
self.connect();
} else {
self.autoReconnect = false;
self.emit("failed", "Cannot negotiate DDP version");
}
} else if (data.msg === "connected") {
self.session = data.session;
self.emit("connected");
// method result
} else if (data.msg === "result") {
var cb = self._callbacks[data.id];
if (cb) {
cb(data.error, data.result);
delete self._callbacks[data.id];
}
// method updated
} else if (data.msg === "updated") {
_.each(data.methods, function (method) {
var cb = self._updatedCallbacks[method];
if (cb) {
cb();
delete self._updatedCallbacks[method];
}
});
// missing subscription
} else if (data.msg === "nosub") {
var cb = self._callbacks[data.id];
if (cb) {
cb(data.error);
delete self._callbacks[data.id];
}
// add document to collection
} else if (data.msg === "added") {
if (self.maintainCollections && data.collection) {
var name = data.collection, id = data.id;
if (! self.collections[name]) { self.collections[name] = {}; }
if (! self.collections[name][id]) { self.collections[name][id] = {}; }
self.collections[name][id]._id = id;
if (data.fields) {
_.each(data.fields, function(value, key) {
self.collections[name][id][key] = value;
});
}
if (self._observers[name]) {
_.each(self._observers[name], function(observer) {
observer.added(id);
});
}
}
// remove document from collection
} else if (data.msg === "removed") {
if (self.maintainCollections && data.collection) {
var name = data.collection, id = data.id;
if (! self.collections[name][id]) {
return;
}
var oldValue = self.collections[name][id];
delete self.collections[name][id];
if (self._observers[name]) {
_.each(self._observers[name], function(observer) {
observer.removed(id, oldValue);
});
}
}
// change document in collection
} else if (data.msg === "changed") {
if (self.maintainCollections && data.collection) {
var name = data.collection, id = data.id;
if (! self.collections[name]) { return; }
if (! self.collections[name][id]) { return; }
var oldFields = {},
clearedFields = data.cleared || [],
newFields = {};
if (data.fields) {
_.each(data.fields, function(value, key) {
oldFields[key] = self.collections[name][id][key];
newFields[key] = value;
self.collections[name][id][key] = value;
});
}
if (data.cleared) {
_.each(data.cleared, function(value) {
delete self.collections[name][id][value];
});
}
if (self._observers[name]) {
_.each(self._observers[name], function(observer) {
observer.changed(id, oldFields, clearedFields, newFields);
});
}
}
// subscriptions ready
} else if (data.msg === "ready") {
_.each(data.subs, function(id) {
var cb = self._callbacks[id];
if (cb) {
cb();
delete self._callbacks[id];
}
});
// minimal heartbeat response for ddp pre2
} else if (data.msg === "ping") {
self._send(
_.has(data, "id") ? { msg : "pong", id : data.id } : { msg : "pong" }
);
}
}
_getNextId() {
var self = this;
return (self._nextId += 1).toString();
}
_addObserver(observer) {
var self = this;
if (! self._observers[observer.name]) {
self._observers[observer.name] = {};
}
self._observers[observer.name][observer._id] = observer;
}
_removeObserver(observer) {
var self = this;
if (! self._observers[observer.name]) { return; }
delete self._observers[observer.name][observer._id];
}
//////////////////////////////////////////////////////////////////////////
// USER functions -- use these to control the client
/* open the connection to the server
*
* connected(): Called when the 'connected' message is received
* If autoReconnect is true (default), the callback will be
* called each time the connection is opened.
*/
connect(connected) {
var self = this;
self._isConnecting = true;
self._connectionFailed = false;
self._isClosing = false;
if (connected) {
self.addListener("connected", function() {
self._clearReconnectTimeout();
connected(undefined, self._isReconnecting);
self._isConnecting = false;
self._isReconnecting = false;
});
self.addListener("failed", function(error) {
self._isConnecting = false;
self._connectionFailed = true;
connected(error, self._isReconnecting);
});
}
var url = self._buildWsUrl();
self._makeWebSocketConnection(url);
}
_endPendingMethodCalls() {
var self = this;
var ids = _.keys(self._pendingMethods);
self._pendingMethods = {};
ids.forEach(function (id) {
if (self._callbacks[id]) {
self._callbacks[id](new Error("DDPClient: Disconnected from DDP server"));
delete self._callbacks[id];
}
if (self._updatedCallbacks[id]) {
self._updatedCallbacks[id]();
delete self._updatedCallbacks[id];
}
});
}
_buildWsUrl(path) {
var self = this;
var url;
path = path || self.path || "websocket";
var protocol = self.ssl ? "wss://" : "ws://";
if (self.url) {
url = self.url;
} else {
url = protocol + self.host + ":" + self.port;
url += (path.indexOf("/") === 0)? path : "/" + path;
}
return url;
}
_makeWebSocketConnection(url) {
var self = this;
self.socket = new self.socketConstructor(url);
self._prepareHandlers();
}
close() {
var self = this;
self._isClosing = true;
self.socket.close();
self.removeAllListeners("connected");
self.removeAllListeners("failed");
}
// call a method on the server,
//
// callback = function(err, result)
call(name, params, callback, updatedCallback) {
var self = this;
var id = self._getNextId();
self._callbacks[id] = function () {
delete self._pendingMethods[id];
if (callback) {
callback.apply(this, arguments);
}
};
self._updatedCallbacks[id] = function () {
delete self._pendingMethods[id];
if (updatedCallback) {
updatedCallback.apply(this, arguments);
}
};
self._pendingMethods[id] = true;
self._send({
msg : "method",
id : id,
method : name,
params : params
});
}
callWithRandomSeed(name, params, randomSeed, callback, updatedCallback) {
var self = this;
var id = self._getNextId();
if (callback) {
self._callbacks[id] = callback;
}
if (updatedCallback) {
self._updatedCallbacks[id] = updatedCallback;
}
self._send({
msg : "method",
id : id,
method : name,
randomSeed : randomSeed,
params : params
});
}
// open a subscription on the server, callback should handle on ready and nosub
subscribe(name, params, callback) {
var self = this;
var id = self._getNextId();
if (callback) {
self._callbacks[id] = callback;
}
self._send({
msg : "sub",
id : id,
name : name,
params : params
});
return id;
}
unsubscribe(id) {
var self = this;
self._send({
msg : "unsub",
id : id
});
}
/**
* Adds an observer to a collection and returns the observer.
* Observation can be stopped by calling the stop() method on the observer.
* Functions for added, updated and removed can be added to the observer
* afterward.
*/
observe(name, added, updated, removed) {
var self = this;
var observer = {};
var id = self._getNextId();
// name, _id are immutable
Object.defineProperty(observer, "name", {
get: function() { return name; },
enumerable: true
});
Object.defineProperty(observer, "_id", { get: function() { return id; }});
observer.added = added || function(){};
observer.updated = updated || function(){};
observer.removed = removed || function(){};
observer.stop = function() {
self._removeObserver(observer);
};
self._addObserver(observer);
return observer;
}
}
module.exports = DDPClient;
|
"use strict";
var TestApplyEntryOptionPlugin = require("./TestApplyEntryOptionPlugin");
/** @type {import("../../../").Configuration} */
module.exports = {
entry: {
parent: "./parent"
},
output: {
filename: "[name].js"
},
plugins: [
new TestApplyEntryOptionPlugin({
entry: {
child: "./child"
}
})
],
stats: {
children: true,
entrypoints: true
}
};
|
var baseProperty = require('./baseProperty');
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
* in Safari on iOS 8.1 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
module.exports = getLength;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.