hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
687e27d7c9c80090088453698c26c62963bbeb63
6,499
js
JavaScript
platform-web-ui/src/main/web/ua/com/fielden/platform/web/components/tg-tooltip-behavior.js
fieldenms/
4efd3b2475877d434a57cbba638b711df95748e7
[ "MIT" ]
16
2017-03-22T05:42:26.000Z
2022-01-17T22:38:38.000Z
platform-web-ui/src/main/web/ua/com/fielden/platform/web/components/tg-tooltip-behavior.js
fieldenms/
4efd3b2475877d434a57cbba638b711df95748e7
[ "MIT" ]
647
2017-03-21T07:47:44.000Z
2022-03-31T13:03:47.000Z
platform-web-ui/src/main/web/ua/com/fielden/platform/web/components/tg-tooltip-behavior.js
fieldenms/
4efd3b2475877d434a57cbba638b711df95748e7
[ "MIT" ]
8
2017-03-21T08:26:56.000Z
2020-06-27T01:55:09.000Z
import '/resources/polymer/@polymer/polymer/polymer-legacy.js'; import '/resources/components/tg-tooltip.js'; /** * Provides tooltip support for component that uses this behaviour. In order to set tooltip for specific element in the component, one should * mark element with tooltip-text attribute. */ const toolTipElement = document.createElement("tg-tooltip"); /** * Returns the element in hierarchy that has tooltip-id attribute set otherwise returns null. */ const extractActiveElement = function (path, thisElement) { const elementPath = path.filter(node => node.nodeType === Node.ELEMENT_NODE); let elemIdx = 0; while (elemIdx < elementPath.length && !elementPath[elemIdx].hasAttribute("tooltip-text") && elementPath[elemIdx] !== thisElement) { elemIdx++; } return elementPath[elemIdx].hasAttribute("tooltip-text") ? elementPath[elemIdx] : null; }; //Adds tooltip element to document's body so that it only one for all tooltips. document.body.appendChild(toolTipElement); export const TgTooltipBehavior = { properties: { triggerManual: { type: String, observer: "_triggerManualChanged" }, /** * The element that will be observed for mouse move events. This element or it's children should have tooltip-text attribute set in order the tooltip to be shown. */ triggerElement: { type: Object, observer: "_triggerElementChanged" }, /** * Saved mouse positions. */ _mousePosX: Number, _mousePosY: Number, /** * Element under mouse pointer, for which tooltip should be shown. Also this element should be marked with tooltip-id attribute. */ _activeComponent: { type: Object } }, ready: function () { //Bind mouse events this._handleMouseMove = this._handleMouseMove.bind(this); this._handleTooltipAtMousePos = this._handleTooltipAtMousePos.bind(this); this._hideTooltip = this._hideTooltip.bind(this); //Bind touch events this._handleTouchStart = this._handleTouchStart.bind(this); this._handleTouchEnd = this._handleTouchEnd.bind(this); this.triggerElement = this; //Set the default values for properties. this.triggerManual = false; }, /** * Displayes the tooltip with specified text at current mouse position. */ showTooltip: function (tooltipText) { toolTipElement.show(tooltipText, this._mousePosX, this._mousePosY); }, /** * Observer for trigger element changes. */ _triggerElementChanged: function (newElement, oldElement) { this._setMouseEvents(newElement, oldElement, this.triggerManual); }, /** * Observer for _triggerManual property. */ _triggerManualChanged: function (newValue, oldValue) { this._setMouseEvents(this.triggerElement, this.triggerElement, newValue); }, /** * Set the appropriate mouse event handlers for trigger element according to trigger policy. */ _setMouseEvents: function (newTrigger, oldTrigger, manual) { if (oldTrigger) { //Unregister mouse move listener for old trigger element. oldTrigger.removeEventListener('mousemove', this._handleMouseMove); if (!manual) { //If tooltips were triggerd manually then don't remove anything. this._unregisterTooltipRelatedEvents(oldTrigger); } } if (newTrigger) { //Register mouse listeners for new trigger element. newTrigger.addEventListener('mousemove', this._handleMouseMove); if (!manual) { this._registerTooltipRelatedEvents(newTrigger); } else { this._unregisterTooltipRelatedEvents(newTrigger); } } }, _registerTooltipRelatedEvents: function (trigger) { //Register mouse listener for new trigger element in order to trigger tooltips automatically trigger.addEventListener('mousemove', this._handleTooltipAtMousePos); trigger.addEventListener('mouseleave', this._hideTooltip); //Register touch listener for new trigger element in order to trigger tooltips automatically trigger.addEventListener('touchstart', this._handleTouchStart); trigger.addEventListener('touchend', this._handleTouchEnd); }, _unregisterTooltipRelatedEvents: function (trigger) { //Unregister mouse listener for new trigger element in order to trigger tooltips automatically trigger.removeEventListener('mousemove', this._handleTooltipAtMousePos); trigger.removeEventListener('mouseleave', this._hideTooltip); //Unregister touch listener for new trigger element in order to trigger tooltips automatically trigger.removeEventListener('touchstart', this._handleTouchStart); trigger.removeEventListener('touchend', this._handleTouchEnd); }, _handleTouchStart: function (event) { this.touchEventTriggered = true; this._startTooltip(event); }, _handleTouchEnd: function (event) { this._hideTooltip(); }, /** * Saves the mouse position in _mousePosX and _mousePosY properties. */ _handleMouseMove: function (event) { this._mousePosX = event.pageX; this._mousePosY = event.pageY; }, /** * Handler that determines when to show tooltip on mouse move event amd when to hide it. */ _handleTooltipAtMousePos: function (event) { if (!this.touchEventTriggered) { this._startTooltip(event); } else { this.touchEventTriggered = false; } }, _startTooltip: function (event) { const currentActiveElement = extractActiveElement(event.composedPath(), this.triggerElement); if (currentActiveElement !== this._activeComponent) { this._hideTooltip(); this._activeComponent = currentActiveElement; } const tooltipText = this._activeComponent && this._activeComponent.getAttribute("tooltip-text"); if (tooltipText !== null && tooltipText.length > 0) { this.showTooltip(tooltipText); } }, /** * Hides the tooltip. Used as a mouse handler for mouse leave event. */ _hideTooltip: function () { toolTipElement.hide(); } };
37.350575
170
0.657332
687effb08e29c874f739a6fdeb051c3e11e67701
22,788
js
JavaScript
SiteBackup11172018/Files/wp-content/themes/traveler/js/filter-ajax-flights.js
unalbatuhan/LuxaidaProject
2f5c17068d2ee4b21d4182424474b311877b7162
[ "MIT" ]
2
2021-03-04T10:13:15.000Z
2022-02-22T22:53:53.000Z
wp-content/themes/traveler/js/filter-ajax-flights.js
aniskchaou/TOURPHORIA-CMS
1a3b7ba0e488d08411deeed37417838e4e3c730a
[ "MIT" ]
null
null
null
wp-content/themes/traveler/js/filter-ajax-flights.js
aniskchaou/TOURPHORIA-CMS
1a3b7ba0e488d08411deeed37417838e4e3c730a
[ "MIT" ]
null
null
null
(function ($) { var requestRunning = false; var xhr; $(document).on('click', '.checkbox-filter-ajax, a.pagination', function (e) { if ($('#ajax-filter-content').length > 0) { e.preventDefault(); if (requestRunning) { xhr.abort(); } var pageNum = 1; if ($(this).hasClass('pagination')) { $('a.pagination').removeClass('current'); $(this).addClass('current'); var url = $(this).attr('href'); if (typeof url !== typeof undefined && url !== false) { var arr = url.split('/'); var pageNum = arr[arr.indexOf('page') + 1]; if (isNaN(pageNum)) { pageNum = 1; } } else { return false; } } else { $(this).toggleClass('active'); if ($('ul.pagination').length > 0) { $('ul.pagination').find('li').each(function () { if ($(this).children().hasClass('current')) { pageNum = $(this).children().text(); } }); } if ($(this).data('type') != 'layout' && $(this).data('type') != 'order') { pageNum = 1; } } var active_stop = []; var active_air = []; var active_time = []; var active_price = ''; var start = $('form[post_type="st_flight"] .irs-from').text(); var end = $('form[post_type="st_flight"] .irs-to').text(); var price_unique = start.replace(/\D/g, '') + ';' + end.replace(/\D/g, ''); active_price = price_unique; var arr_tax = []; var checkValue = $('.ajax-filter-wrapper').find('.active'); if (checkValue.length) { checkValue.each(function (index, term) { var data_filter = $(this).data('value'); if ($(this).data('type') == 'stops') { active_stop.push(data_filter); } if ($(this).data('type') == 'airline') { active_air.push(data_filter); } if ($(this).data('type') == 'dp_time') { active_time.push(data_filter); } }) } var tax_stop_string = active_stop.toString(); var tax_air_string = active_air.toString(); var tax_time_string = active_time.toString(); var data = URLToArrayNew(); data['action'] = 'st_filter_flights_ajax'; if(active_price != '0;0') data['price_range'] = active_price; if(tax_stop_string != '') data['stops'] = tax_stop_string; if(tax_air_string != '') data['airline'] = tax_air_string; if(tax_time_string != '') data['dp_time'] = tax_time_string; data['page'] = pageNum; $('.ajax-filter-loading').fadeIn(); xhr = $.ajax({ url: st_params.ajax_url, dataType: 'json', type: 'get', data: data, success: function (doc) { $('#ajax-filter-content').empty(); $('h3.booking-title span#count-filter').html(doc.count); $('.sum-result-filter').css({'visibility': 'visible'}); $('#ajax-filter-content').append(doc.content); $('#ajax-filter-pag').html(doc.pag); ajaxActionLoad(); $('.ajax-filter-loading').fadeOut(); }, complete: function () { requestRunning = false; }, }); requestRunning = true; } }); function get_all_tax() { var arr_tax = []; $('.ajax-filter-wrapper .checkbox-filter-ajax[data-tax="taxonomy"]').each(function (index, term) { if (jQuery.inArray($(this).data('type'), arr_tax) == -1) { arr_tax.push($(this).data('type')); } }); return arr_tax; } if ($('#ajax-filter-content').length > 0) { var data = URLToArrayNew(); data['action'] = 'st_filter_flights_ajax'; data['page'] = '1'; $('.ajax-filter-loading').fadeIn(); $('h3.booking-title span#count-filter-tour').html(''); xhr = $.ajax({ url: st_params.ajax_url, dataType: 'json', type: 'get', data: data, success: function (doc) { $('#ajax-filter-content').empty(); $('#count-filter').html(doc.count); $('.sum-result-filter').css({'visibility': 'visible'}); $('#ajax-filter-content').append(doc.content); $('#ajax-filter-pag').html(doc.pag); ajaxActionLoad(); }, complete: function () { $('.ajax-filter-loading').fadeOut(); requestRunning = false; }, }); requestRunning = true; } function ajaxActionLoad() { $(document).ready(function () { if ($('.popup-text').length) { $('.popup-text').magnificPopup({ removalDelay: 500, closeBtnInside: true, callbacks: { beforeOpen: function () { this.st.mainClass = this.st.el.attr('data-effect'); }, }, midClick: true }); } ; $('.i-check, .i-radio').iCheck({ checkboxClass: 'i-check', radioClass: 'i-radio' }); }); var flight_data = { price_depart: 0, price_depart_html: '', total_price_depart: 0, total_price_depart_html: '', tax_price_depart: '', enable_tax_depart: 'no', price_return: 0, price_return_html: '', total_price_return: 0, total_price_return_html: '', tax_price_return: '', enable_tax_return: 'no', total_price: 0, total_price_html: '', flight_type: $('.st-booking-list-flight').data('flight_type') }; $('input[name="flight1"]').iCheck('uncheck'); $('input[name="flight2"]').iCheck('uncheck'); $('.st-cal-flight-depart').each(function () { var t = $(this); $(document).on('ifChecked', 'input[name="flight1"]', function (event) { $('.st-cal-flight-depart').removeClass('active'); t.addClass('active'); var elink = $(this).closest('li').data('external-link'); var emode = $(this).closest('li').data('external'); if(emode == 'on'){ $('.flight-book-now').hide(); var emessage = $('.flight-message'); if($('.e-external-alter').length == 0) { $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').hide(); emessage.after('<p class="e-external-alter"><b>'+$(this).closest('li').data('external-text')+'</b></p>'); $('.e-external-alter').after('<a href="'+ elink +'" class="btn btn-primary btn-external-link">'+$('.flight-book-now').text()+'</a>'); }else{ $('.btn-external-link').attr('href', elink); } }else{ eftype = 'on_way'; var eftype = $('.st-booking-list-flight').data('flight_type'); if(eftype == 'on_way') { $('.flight-book-now').show(); $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').show(); if ($('.e-external-alter').length > 0) { $('.e-external-alter, .btn-external-link').remove(); } }else{ var echeck = 0; var eelink = '#'; $('input[name="flight2"]:checked').each(function (el) { if($(this).data('external') == 'on'){ echeck = 1; eelink = $(this).closest('li').data('external-link'); }else{ echeck = 2; } }); if(echeck == 0 || echeck == 2){ $('.flight-book-now').show(); $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').show(); if ($('.e-external-alter').length > 0) { $('.e-external-alter, .btn-external-link').remove(); } }else{ $('.flight-book-now').hide(); var emessage = $('.flight-message'); if($('.e-external-alter').length == 0) { $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').hide(); emessage.after('<p class="e-external-alter"><b>'+$(this).closest('li').data('external-text')+'</b></p>'); $('.e-external-alter').after('<a href="'+ eelink +'" class="btn btn-primary btn-external-link">'+$('.flight-book-now').text()+'</a>'); }else{ $('.btn-external-link').attr('href', eelink); } echeck = 0; } } } var price_depart = $(this).data('price'); if (price_depart) { flight_data.price_depart = price_depart; flight_data.total_price_depart = flight_data.price_depart; $('.st-booking-select-depart').removeClass('hidden'); $('.st-booking-select-depart').find('.fare .price').html(format_money(flight_data.price_depart)); var tax_enable = $(this).data('tax'); var tax_amount = $(this).data('tax_amount'); if (tax_enable != 'no') { tax_price = (parseFloat(tax_amount) * parseFloat(flight_data.price_depart)) / 100; if (tax_price > 0) { flight_data.total_price_depart = flight_data.price_depart + tax_price; $('.st-booking-select-depart').find('.tax').removeClass('hidden'); $('.st-booking-select-depart').find('.tax .price').html(format_money(tax_price)) } else { $('.st-booking-select-depart').find('.tax').addClass('hidden'); } } else { $('.st-booking-select-depart').find('.tax').addClass('hidden'); } $('.st-booking-select-depart').find('.total .price').html(format_money(flight_data.total_price_depart)); $('.booking-flight-form input[name="depart_id"]').val($(this).data('post_id')); if ($(this).data('business') == 1) { $('.booking-flight-form input[name="price_class_depart"]').val('business_price'); } else { $('.booking-flight-form input[name="price_class_depart"]').val('eco_price'); } } calculate_total_price(); }); }); $('.st-cal-flight-return').each(function () { var t = $(this); t.find('input[name="flight2"]').on('ifChecked', function (event) { $('.st-select-item-flight-return').removeClass('active'); t.addClass('active'); var elink = $(this).closest('li').data('external-link'); var emode = $(this).closest('li').data('external'); if(emode == 'on'){ $('.flight-book-now').hide(); var emessage = $('.flight-message'); if($('.e-external-alter').length == 0) { $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').hide(); emessage.after('<p class="e-external-alter"><b>'+$(this).closest('li').data('external-text')+'</b></p>'); $('.e-external-alter').after('<a href="'+ elink +'" class="btn btn-primary btn-external-link">'+$('.flight-book-now').text()+'</a>'); } }else{ var echeck = 0; var eelink = '#'; $('input[name="flight1"]:checked').each(function (el) { if($(this).data('external') == 'on'){ echeck = 1; eelink = $(this).closest('li').data('external-link'); }else{ echeck = 2; } }); if(echeck == 0 || echeck == 2){ $('.flight-book-now').show(); $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').show(); if ($('.e-external-alter').length > 0) { $('.e-external-alter, .btn-external-link').remove(); } }else{ $('.flight-book-now').hide(); var emessage = $('.flight-message'); if($('.e-external-alter').length == 0) { $('.st-booking-select-depart, .st-booking-select-return, .st-flight-total-price').hide(); emessage.after('<p class="e-external-alter"><b>'+$(this).closest('li').data('external-text')+'</b></p>'); $('.e-external-alter').after('<a href="'+ eelink +'" class="btn btn-primary btn-external-link">'+$('.flight-book-now').text()+'</a>'); }else{ $('.btn-external-link').attr('href', eelink); } echeck = 0; } } var price_return = $(this).data('price'); if (price_return) { flight_data.price_return = price_return; flight_data.total_price_return = price_return; $('.st-booking-select-return').removeClass('hidden'); $('.st-booking-select-return').find('.fare .price').html(format_money(flight_data.price_return)); var tax_enable = $(this).data('tax'); var tax_amount = $(this).data('tax_amount'); if (tax_enable != 'no') { tax_price = (parseFloat(tax_amount) * flight_data.price_return) / 100; if (tax_price > 0) { flight_data.total_price_return = flight_data.price_return + tax_price; $('.st-booking-select-return').find('.tax').removeClass('hidden'); $('.st-booking-select-return').find('.tax .price').html(format_money(tax_price)) } else { $('.st-booking-select-return').find('.tax').addClass('hidden'); } } else { $('.st-booking-select-return').find('.tax').addClass('hidden'); } $('.st-booking-select-return').find('.total .price').html(format_money(flight_data.total_price_return)); $('.booking-flight-form input[name="return_id"]').val($(this).data('post_id')); if ($(this).data('business') == 1) { $('.booking-flight-form input[name="price_class_return"]').val('business_price'); } else { $('.booking-flight-form input[name="price_class_return"]').val('eco_price'); } } calculate_total_price(); }); }); function calculate_total_price() { var passenger = $('input[name="passenger"]').val(); if (parseInt(passenger) < 1) { passenger = 1; } if (flight_data.flight_type == 'on_way') { flight_data.total_price = flight_data.total_price_depart * parseInt(passenger); flight_data.total_price_html = format_money(flight_data.total_price); } else { if (parseFloat(flight_data.total_price_depart) > 0 && parseFloat(flight_data.total_price_return) > 0) { flight_data.total_price = (parseFloat(flight_data.total_price_depart) + parseFloat(flight_data.total_price_return)) * parseInt(passenger); flight_data.total_price_html = format_money(flight_data.total_price); } } if (parseFloat(flight_data.total_price) > 0) { $('.st-flight-booking .st-flight-total-price .price').html(flight_data.total_price_html); } } function format_money($money) { if (!$money) { return st_params.free_text; } $money = st_number_format($money, st_params.booking_currency_precision, st_params.decimal_separator, st_params.thousand_separator); var $symbol = st_params.currency_symbol; var $money_string = ''; switch (st_params.currency_position) { case "right": $money_string = $money + $symbol; break; case "left_space": $money_string = $symbol + " " + $money; break; case "right_space": $money_string = $money + " " + $symbol; break; case "left": default: $money_string = $symbol + $money; break; } return $money_string; } function st_number_format(number, decimals, dec_point, thousands_sep) { number = (number + '') .replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) { var k = Math.pow(10, prec); return '' + (Math.round(n * k) / k) .toFixed(prec); }; // Fix for IE parseFloat(0.55).toFixed(0) = 0; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) .split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '') .length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1) .join('0'); } return s.join(dec); } $(document).on('click', '.flight-book-now', function (e) { //$('.flight-book-now').on( 'click', function(e){ var t = $(this); var form = $(this).closest('.booking-flight-form'); var data = form.serialize(); t.addClass('loading'); form.find('.flight-message').empty(); $.ajax({ dataType: 'json', type: 'post', data: data, url: st_params.ajax_url, success: function (res) { t.removeClass('loading'); if (typeof res.message != 'undefined') { form.find('.flight-message').append(res.message); } if (typeof res.redirect != 'undefined') { window.location = res.redirect; } }, error: function (e) { t.removeClass('loading'); } }); return false; }); } //Get param form url passing to flight param function findGetParameter(parameterName) { var result = null, tmp = []; location.search .substr(1) .split("&") .forEach(function (item) { tmp = item.split("="); if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); }); return result; } function URLToArray(url) { var request = {}; var pairs = url.substring(url.indexOf('?') + 1).split('&'); for (var i = 0; i < pairs.length; i++) { if (!pairs[i]) continue; var pair = pairs[i].split('='); request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); } return request; } function URLToArrayNew() { var res = {}; var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); if(sURLVariables.length){ for (var i = 0; i < sURLVariables.length; i++){ var sParameterName = sURLVariables[i].split('='); if(sParameterName.length) res[decodeURIComponent(sParameterName[0])] = decodeURIComponent(sParameterName[1]); } } return res; } $(document).ready(function(){ $('.search_rating_star, .ajax-tax-name').click(function(){ $(this).prev().trigger('click'); }); }); })(jQuery)
42.834586
166
0.433474
687f9fc07d70fa00074129009265b260bb987583
1,059
js
JavaScript
examples/safeguards-example-service/policies/limit-ddb-capacity/index.js
Kamahl19/enterprise-plugin
5c56e2d266d726abd5897739fe3f2825dde3cfb5
[ "MIT" ]
null
null
null
examples/safeguards-example-service/policies/limit-ddb-capacity/index.js
Kamahl19/enterprise-plugin
5c56e2d266d726abd5897739fe3f2825dde3cfb5
[ "MIT" ]
null
null
null
examples/safeguards-example-service/policies/limit-ddb-capacity/index.js
Kamahl19/enterprise-plugin
5c56e2d266d726abd5897739fe3f2825dde3cfb5
[ "MIT" ]
null
null
null
'use strict'; module.exports = function capacityPolicy(policy, service, options) { const limits = { readCapacityMax: 1, writeCapacityMax: 1, ...options, }; const template = service.compiled['cloudformation-template-update-stack.json']; if (template.Resources) { Object.entries(template.Resources).forEach(([name, resource]) => { if (resource.Type === 'AWS::DynamoDB::Table') { if (resource.Properties.ProvisionedThroughput.ReadCapacityUnits > limits.readCapacityMax) { throw new policy.Failure( `Table "${name}" has excess read capacity. Lower the value of ReadCapacityUnits to at most ${limits.readCapacityMax}.` ); } if ( resource.Properties.ProvisionedThroughput.WriteCapacityUnits > limits.writeCapacityMax ) { throw new policy.Failure( `Table "${name}" has excess write capacity. Lower the value of WriteCapacityUnits to at most ${limits.writeCapacityMax}.` ); } } }); } policy.approve(); };
32.090909
133
0.640227
6880306fee000364ab3bae0c726164596946c3d0
1,736
js
JavaScript
__tests__/selector/selector.test.js
hectorlopezv/yarn-monorepo-first-approach
b045ccfa62e34cf660cbe8452f4fb257a633f16a
[ "MIT" ]
null
null
null
__tests__/selector/selector.test.js
hectorlopezv/yarn-monorepo-first-approach
b045ccfa62e34cf660cbe8452f4fb257a633f16a
[ "MIT" ]
null
null
null
__tests__/selector/selector.test.js
hectorlopezv/yarn-monorepo-first-approach
b045ccfa62e34cf660cbe8452f4fb257a633f16a
[ "MIT" ]
null
null
null
import React from 'react' import {render, screen, waitFor} from '@testing-library/react' import user from '@testing-library/user-event' import {Selector} from '@libprov/selector/lib/selector' import selectEvent from 'react-select-event' describe('testing suite', () => { it('testing unit Selector', async () => { const setValue = jest.fn(() => (value = 'Pizza')) let value = null const selectHandler = jest.fn(() => { setValue() }) const {rerender} = render( <form> <label htmlFor="food">Food</label> <Selector disabled={false} label={'hector'} placeholder={'placeholder'} Options={[{label: 'Pizza', value: '1'}]} onClick={selectHandler} value={value ? value : 'placeholder'} inputId="food" /> </form>, ) expect(screen.getByText(/hector/i)).toBeInTheDocument() expect(screen.getByText(/placeholder/i)).toBeInTheDocument() expect(screen.queryByText(/Pizza/i)).toBeNull() selectEvent.openMenu(screen.getByText('placeholder')) expect(screen.getByText(/pizza/i)).toBeInTheDocument() user.click(screen.getByText(/pizza/i)) expect(selectHandler).toHaveBeenCalledTimes(1) expect(setValue).toHaveBeenCalledTimes(1) rerender( <form> <label htmlFor="food">Food</label> <Selector disabled={false} label={'hector'} placeholder={'placeholder'} Options={[{label: 'Pizza', value: '1'}]} onClick={selectHandler} value={value ? value : 'placeholder'} inputId="food" /> </form>, ) await waitFor(() => expect(screen.queryByText(/placeholder/i)).toBeNull()) }) })
32.148148
78
0.604263
688030d01deddf18fe1f157e57141b4ce21447eb
1,949
js
JavaScript
brainfuck-interpreter/test/instruction.js
umut-sahin/javascript-examples
b47b947ae963ec2ae096676d93d4dbaafbbce99e
[ "MIT" ]
11
2018-11-04T20:32:45.000Z
2019-09-11T11:11:39.000Z
brainfuck-interpreter/test/instruction.js
umut-sahin/javascript-examples
b47b947ae963ec2ae096676d93d4dbaafbbce99e
[ "MIT" ]
2
2019-08-15T22:20:33.000Z
2019-08-15T22:50:53.000Z
brainfuck-interpreter/test/instruction.js
umut-sahin/javascript-examples
b47b947ae963ec2ae096676d93d4dbaafbbce99e
[ "MIT" ]
2
2018-12-18T07:54:01.000Z
2019-03-09T19:05:26.000Z
import test from "ava"; import Instruction from "../src/instruction"; // region static get Instruction.type test("static get Instruction.type", (t) => { t.deepEqual( Object.keys(Instruction.type), [ "MOVE_LEFT", "MOVE_RIGHT", "INCREMENT", "DECREMENT", "READ", "WRITE", "START_LOOP", "END_LOOP", ], ); }); // endregion // region Instruction.toString(...) function toString(t, inputs, output) { t.is(new Instruction(inputs[0], inputs[1] || 0).toString(), output); } toString.title = (subtitle = "", inputs) => { const instructionName = Object.keys(Instruction.type).find(key => Instruction.type[key] === inputs[0]); const maybeData = inputs[1] ? `, data: ${inputs[1]}` : ""; return `${subtitle} Instruction.toString() @ { type: ${instructionName}${maybeData} }`.trim(); }; test(toString, [Instruction.type.MOVE_LEFT, 0], ""); test(toString, [Instruction.type.MOVE_LEFT, 1], "<"); test(toString, [Instruction.type.MOVE_LEFT, 3], "<<<"); test(toString, [Instruction.type.MOVE_RIGHT, 0], ""); test(toString, [Instruction.type.MOVE_RIGHT, 1], ">"); test(toString, [Instruction.type.MOVE_RIGHT, 3], ">>>"); test(toString, [Instruction.type.INCREMENT, 0], ""); test(toString, [Instruction.type.INCREMENT, 1], "+"); test(toString, [Instruction.type.INCREMENT, 3], "+++"); test(toString, [Instruction.type.DECREMENT, 0], ""); test(toString, [Instruction.type.DECREMENT, 1], "-"); test(toString, [Instruction.type.DECREMENT, 3], "---"); test(toString, [Instruction.type.READ], ","); test(toString, [Instruction.type.WRITE], "."); test(toString, [Instruction.type.START_LOOP, 0], "["); test(toString, [Instruction.type.START_LOOP, 1], "["); test(toString, [Instruction.type.START_LOOP, 3], "["); test(toString, [Instruction.type.END_LOOP, 0], "]"); test(toString, [Instruction.type.END_LOOP, 1], "]"); test(toString, [Instruction.type.END_LOOP, 3], "]"); // endregion
28.661765
96
0.646998
6881bee8acd23730fce65a4250767eb8aa1f1cdb
5,574
js
JavaScript
data/split-book-data/B00551W570.1646878806591.js
bksnetwork/audible
c9fcc611fb92578e1ecc4dfd3d33bf5aa60a3987
[ "0BSD" ]
null
null
null
data/split-book-data/B00551W570.1646878806591.js
bksnetwork/audible
c9fcc611fb92578e1ecc4dfd3d33bf5aa60a3987
[ "0BSD" ]
null
null
null
data/split-book-data/B00551W570.1646878806591.js
bksnetwork/audible
c9fcc611fb92578e1ecc4dfd3d33bf5aa60a3987
[ "0BSD" ]
null
null
null
window.peopleAlsoBoughtJSON = [{"asin":"B00P9JHMDK","authors":"Adam Mansbach","cover":"61D5Z1bB2QL","length":"3 mins","narrators":"Bryan Cranston","title":"You Have to F--king Eat"},{"asin":"1974976807","authors":"Adam Mansbach","cover":"519Eyt-Qc1L","length":"5 mins","narrators":"Larry David","title":"F--k, Now There Are Two of You"},{"asin":"B00UNMKTWO","authors":"Margery Williams","cover":"516nBW9Me6L","length":"26 mins","narrators":"Jilly Bond","title":"The Velveteen Rabbit"},{"asin":"B0752ZQR33","authors":"Matthew Walker","cover":"51-zooqOoeL","length":"13 hrs and 52 mins","narrators":"Steve West","subHeading":"Unlocking the Power of Sleep and Dreams","title":"Why We Sleep"},{"asin":"B01C4P5M7O","authors":"Jasmine Harris","cover":"618WNyw320L","length":"8 hrs and 11 mins","narrators":"Allison Mason","title":"Deep Sleep Hypnosis: Fall Asleep Instantly and Sleep Well with Beach Hypnosis and Meditation"},{"asin":"B097H3PDXB","authors":"Calm Theraphy Centre","cover":"51vntQ0ISrS","length":"32 hrs and 51 mins","narrators":"Tippy Robinson","subHeading":"83 Relaxing Bedtime Stories for Stressed Out Adults to Reduce Anxiety, Stress, Overcome Insomnia and Help Fall Asleep Fast by Deep Sleep Hypnosis Guided Relaxing Meditations","title":"Sleep Stories for Adults"},{"asin":"B09KYKT2FC","authors":"Soothing Soul","cover":"51tm7r5f7iL","length":"10 hrs and 3 mins","narrators":"Soothing Soul","subHeading":"High Quality Relaxing Sleep Music Ideal for Sleep, Relaxation or Meditation. Achieve Ultimate Tranquility, Calming Stress Relief Music to Sooth Body, Mind & Soul","title":"Sleeping Music for Deep Sleeping"},{"asin":"B09P1X16Q9","authors":"Creative Sounds Academy","cover":"51RjTqdO47L","length":"20 hrs and 2 mins","narrators":"Creative Sounds Studios","subHeading":"Top 20 Quality Nature Sounds Music Ideal for Deep Sleep, Hypnosis and Relaxation. Achieve the Ultimate Tranquility and Focus for Stress Relief","title":"Guided Sleep Meditation with Calming Nature Sounds"},{"asin":"0593146239","authors":"Will Smith, Mark Manson","cover":"61gS6EWmWwL","length":"16 hrs and 16 mins","narrators":"Will Smith","title":"Will"},{"asin":"1524779261","authors":"James Clear","cover":"513Y5o-DYtL","length":"5 hrs and 35 mins","narrators":"James Clear","subHeading":"An Easy & Proven Way to Build Good Habits & Break Bad Ones","title":"Atomic Habits"},{"asin":"B01J4BK4MY","authors":"Shawn Stevenson, Sara Gottfried MD - foreword","cover":"51fOXXTNY4L","length":"6 hrs and 36 mins","narrators":"Sara Gottfried, Shawn Stevenson","subHeading":"21 Essential Strategies to Sleep Your Way to a Better Body, Better Health, and Bigger Success","title":"Sleep Smarter"},{"asin":"B01I28NFEE","authors":"Mark Manson","cover":"51MT0MbpD7L","length":"5 hrs and 17 mins","narrators":"Roger Wayne","subHeading":"A Counterintuitive Approach to Living a Good Life","title":"The Subtle Art of Not Giving a F*ck"},{"asin":"B07BFHRVGB","authors":"Marlon Bundo, Jill Twiss","cover":"51VLgumfV4L","length":"7 mins","narrators":"Jim Parsons, Jesse Tyler Ferguson, Jeff Garlin, and others","title":"Last Week Tonight with John Oliver Presents a Day in the Life of Marlon Bundo"},{"asin":"B007BR5KB4","authors":"Chester Himes","cover":"51ab2cW3RSL","length":"5 hrs and 26 mins","narrators":"Samuel L. Jackson","subHeading":"A Grave Digger & Coffin Ed Novel","title":"A Rage in Harlem"},{"asin":"B002V5CUIC","authors":"Glenn Harrold","cover":"51iM3cXTleL","length":"1 hr and 4 mins","narrators":"Glenn Harrold","title":"Deep Sleep Every Night"},{"asin":"B002V19RO6","authors":"George Orwell","cover":"612oBD9OSjL","length":"11 hrs and 22 mins","narrators":"Simon Prebble","subHeading":"New Classic Edition","title":"1984"},{"asin":"B08PZF888N","authors":"Mindfulness & Affirmation Centre","cover":"51WymrAdaWL","length":"11 hrs and 11 mins","narrators":"Krystal Wascher","subHeading":"47 Relaxing Stories to Fall Asleep Fast & 3 Daily Guided Meditations to Overcome Insomnia and Anxiety. Deep Sleep Hypnosis for a Peaceful Awakening of Stressed Out Adults.","title":"Bedtime Stories for Adults"},{"asin":"B09GX8B6LC","authors":"White Noise Academy","cover":"41EuG6KZPIL","length":"10 hrs and 19 mins","narrators":"Dezaray Azura","subHeading":"10 Amazing Non-Looping Soothing Tracks for Deep Sleep, Heal Insomnia and Overcome Anxiety | Calm Your Body With Ocean Sounds, Light Wind, Rainstorms and Ambient Noise (10+ Hours)","title":"Sleep Sounds"}]; window.bookSummaryJSON = "<p>Academy Award nominee <b>Samuel L. Jackson</b> (<i>Pulp Fiction</i>) rocks this mock bedtime story, capturing a hilarious range of emotions as the voice of a father struggling to get his child to sleep. </p> <p><i>Go the F--k to Sleep</i> is a bedtime book for parents who live in the real world, where a few snoozing kitties and cutesy rhymes don’t always send a toddler sailing blissfully off to dreamland. California Book Award-winning author Adam Mansbach’s profane, affectionate, and radically honest verses perfectly capture the familiar - and unspoken - tribulations of putting your little angel down for the night. In the process, he opens up a conversation about parenting, granting us permission to admit our frustrations and laugh at their absurdity. </p> <p>Beautiful, subversive, and pants-wettingly funny, <i>Go the F**k to Sleep</i> is a book for parents new, old, and expectant. Due to its explicit language, you probably should not play it for your children. </p> <p>Feel free to share the link to this page with tired parents and other people who could use a good swear and a laugh.</p>";
1,858
4,436
0.74399
688246279b0cf148c53a847c456000952b895619
76,855
js
JavaScript
js/viewModels/people.js
loredra/oraclejet
03eb63b4ca8eafd64ca5b77da5c585ff95e54403
[ "UPL-1.0" ]
null
null
null
js/viewModels/people.js
loredra/oraclejet
03eb63b4ca8eafd64ca5b77da5c585ff95e54403
[ "UPL-1.0" ]
null
null
null
js/viewModels/people.js
loredra/oraclejet
03eb63b4ca8eafd64ca5b77da5c585ff95e54403
[ "UPL-1.0" ]
null
null
null
/* global interact, german, english */ /** * Copyright (c) 2014, 2016, Oracle and/or its affiliates. * The Universal Permissive License (UPL), Version 1.0 */ define(['jsreport','ojs/ojcore', 'knockout', 'utils', 'jquery', 'jstree', 'lang/lang.ge', 'lang/lang.en', 'lang/lang.fr', 'ojs/ojrouter', 'ojs/ojknockout', 'promise', 'ojs/ojlistview', 'ojs/ojmodel', 'ojs/ojpagingcontrol', 'ojs/ojpagingcontrol-model', 'ojs/ojbutton', 'ojs/ojtreemap', 'ojs/ojtree', 'libs/jsTree/jstree', 'ojs/ojselectcombobox', 'ojs/ojjsontreedatasource', 'ojs/ojdialog', 'ojs/ojinputnumber', 'jquery-ui', 'knockout-postbox'], function (jsreport,oj, ko, utils, $) { function PeopleViewModel() { //temporary global variable for printing var self = this; /**/ self.peopleLayoutType = ko.observable('peopleCardLayout'); self.allPeople = ko.observableArray([]); self.ready = ko.observable(false); self.selectPrintOption=ko.observable(""); /**/ var AJAXurl; /**/ self.nameSearch = ko.observable(''); self.url = ko.observable('/solr/EntityCore/select?indent=on&wt=json'); self.start = ko.observable(0); self.rows = ko.observable(20); self.highlightField = ko.observable('&hl.fl=nam_comp_name&hl.simple.pre=<span class="highlight">&hl.simple.post=</span>&hl=on'); self.groupField = ko.observable('&group.cache.percent=100&group.field=ent_id&group.ngroups=true&group.truncate=true&group=true'); self.facetField = ko.observable('&facet.field=add_country&facet.field=program_number&facet.field=ent_typeTree&facet=on'); self.scoreField = ko.observable('&fl=*,score'); //self.wordPercentage = ko.observable('') self.queryField = ko.observable('&q={!percentage t=QUERY_SIDE f=nam_comp_name}'); self.fqField = ko.observable('&fq='); /**/ //Observable array for the HIGHLIGHTING data group self.allHighlighting = ko.observableArray([]); self.nameHighlight = ko.observableArray([]); //Observable array for Facets self.facetsCountries = ko.observableArray([]); self.facetsLists = ko.observableArray([]); self.facetsTypes = ko.observableArray([]); //variables to control data requests var nameBeforeUpdate = ''; //Observable array for the filter tree self.filterTreeCountry = ko.observableArray([]); self.fq = ko.observable(""); self.filterTreeList = ko.observableArray([]); self.fqList = ko.observable(""); self.filterTreeType = ko.observableArray([]); self.fqType = ko.observable(""); //Observable for the comunication from the selection function "filteredAllPeople" to tree change events self.filterTreeObs = ko.observable(""); //data tree observable array self.dataTree = ko.observableArray([]); //control access to tree method self.treeInit = ko.observable(""); //nodes for OJ Tree self.nodeTreeCountry = ko.observableArray([]); self.nodeTreeList = ko.observableArray([]); //trees filter variables for remembering size self.treeHeight = ko.observable(); self.treeListHeight = ko.observable(); //Observable array for the filter to apear on the combobox when it is selcted self.comboboxSelectValue = ko.observable([]); self.comboObservable = ko.observable(""); //Observable array to transport filter information from the tree change event to valueChangeHandleCombobox function self.arrSelCheckbox = ko.observableArray([]); //workers self.worker = new Worker('js/viewModels/worker.js'); self.workerList = new Worker('js/viewModels/workerList.js'); self.workerType = new Worker('js/viewModels/workerType.js'); //store the worker result self.workerResult = ko.observableArray([]); self.workerListResult = ko.observableArray([]); self.workerTypeResult = ko.observableArray([]); //something temporary for the expand feature of the tree var treeExpanded = false; self.searched = ko.observableArray([]); self.keepFilter = false; //a ko observable to display the number of hits self.hitsText = ko.observable("results") self.hitsValue = ko.observable(); self.numberMatches = ko.observable(""); //a ko observable to display when there are no results self.noResults = ko.observable(""); self.noResults.extend({rateLimit: {timeout: 100, method: "notifyWhenChangesStop"}}); //For the number of entities found in one group self.found = ko.observable("Found"); self.entities = ko.observable("Entities"); // //For the Advanced Menu // //Default definition for Advanced Search Observables self.advancedSearchTitle = ko.observable("Advanced Search"); self.defaultButton = ko.observable("Default"); //For the Word Percentage Text self.wordPercentageText = ko.observable("Word Percentage"); //self.wordPercentageDefinition = ko.observable('The minimum percentage value of an word to accept a match');//this is for the help def //For the Word Percentage Value self.wordPercentage = ko.observable(80); self.step = ko.observable(10); self.setInputWordPerNumberValueTo80 = function () { self.wordPercentage(80); }; //For the Phrase Percentage Text self.phrasePercentageText = ko.observable("Phrase Percentage"); //self.phrasePercentageDefinition = ko.observable('The minimum total percentage to accept a string (multiple words) as a match. Score must be higher than this value.');//this is for the help def //For the Phrase Percentage Value self.phrasePercentage = ko.observable(80); self.step = ko.observable(10); self.setInputPhrasePerNumberValueTo80 = function () { self.phrasePercentage(80); }; self.fqTotalPercentage = ko.observable(""); //For the Score Algorithm Text self.scoreAlgorithmText = ko.observable("Score Algorithm"); //self.scoreAlgorithmDefinition = ko.observable('Algorithms for the score.');//this is for the help def //For the Score Algorithm Value self.scoreAlgorithm = ko.observable("QUERY_SIDE"); //For the Words Distance Algorithm Text self.wordsDistanceAlgorithmText = ko.observable("Words Distance Algorithm"); //self.wordsDistanceAlgorithmDefinition = ko.observable("Defines which algorithm must be used to calculate the distance between words");//this is for the help def //For the Words Distance Algorithm Value self.wordsDistanceAlgorithm = ko.observable("DA_LV"); // //Bindings for the Languages // var countryFilterPanelTitle = "Country"; var listFilterPanelTitle = "List"; var typeFilterPanelTitle = "Type"; self.percentageText = ko.observable("Percentage"); self.countryText = ko.observable("Country"); self.addressStatus = ko.observable("without address"); self.countryStatus = ko.observable("worldwide"); //Variable in order to specify to not translate the search page when the user is inside details page var translate = true; self.languageSel = ko.observable(""); self.languageSel.subscribeTo('languagesSearchPage'); self.languageSel.subscribe(function (selectedLanguage) { if (translate) { if (selectedLanguage === "german") { //Translate search input placeholder $('#searchText').attr("placeholder", german.searchPage.basic.search); //Translate tree panels $("#tree").children().children().children().children(".oj-tree-title").text(german.searchPage.basic.country); $("#treeList").children().children().children().children(".oj-tree-title").text(german.searchPage.basic.list); self.workerResult()[0].title = german.searchPage.basic.country; self.workerListResult()[0].title = german.searchPage.basic.list; countryFilterPanelTitle = german.searchPage.basic.country; listFilterPanelTitle = german.searchPage.basic.list; //Translate Advanced Search self.advancedSearchTitle(german.searchPage.advancedSearch.title); self.defaultButton(german.searchPage.advancedSearch.defaultButton); self.wordPercentageText(german.searchPage.advancedSearch.wordPercentage.text); self.phrasePercentageText(german.searchPage.advancedSearch.phrasePercentage.text); self.scoreAlgorithmText(german.searchPage.advancedSearch.scoreAlgorithm.text); self.wordsDistanceAlgorithmText(german.searchPage.advancedSearch.wordsDistanceAlgorithm.text); //Translate Number Of Hits self.hitsText(german.searchPage.hits); self.numberMatches(self.hitsValue() + " " + self.hitsText()); //Translate Searched Entities Properties self.percentageText(german.searchPage.searchedEntityProperty.percentage); self.countryText(german.searchPage.searchedEntityProperty.country); self.addressStatus(german.searchPage.searchedEntityProperty.addressStatus); self.countryStatus(german.searchPage.searchedEntityProperty.countryStatus); self.found(german.searchPage.searchedEntityProperty.found); self.entities(german.searchPage.searchedEntityProperty.entities); } else if (selectedLanguage === "english") { //Translate search input placeholder $('#searchText').attr("placeholder", english.searchPage.basic.search); //Translate tree panels $("#tree").children().children().children().children(".oj-tree-title").text(english.searchPage.basic.country); $("#treeList").children().children().children().children(".oj-tree-title").text(english.searchPage.basic.list); self.workerResult()[0].title = english.searchPage.basic.country; self.workerListResult()[0].title = english.searchPage.basic.list; countryFilterPanelTitle = english.searchPage.basic.country; listFilterPanelTitle = english.searchPage.basic.list; //Translate Advanced Search self.advancedSearchTitle(english.searchPage.advancedSearch.title); self.defaultButton(english.searchPage.advancedSearch.defaultButton); self.wordPercentageText(english.searchPage.advancedSearch.wordPercentage.text); self.phrasePercentageText(english.searchPage.advancedSearch.phrasePercentage.text); self.scoreAlgorithmText(english.searchPage.advancedSearch.scoreAlgorithm.text); self.wordsDistanceAlgorithmText(english.searchPage.advancedSearch.wordsDistanceAlgorithm.text); //Translate Number Of Hits self.hitsText(english.searchPage.hits); self.numberMatches(self.hitsValue() + " " + self.hitsText()); //Translate Searched Entities Properties self.percentageText(english.searchPage.searchedEntityProperty.percentage); self.countryText(english.searchPage.searchedEntityProperty.country); self.addressStatus(english.searchPage.searchedEntityProperty.addressStatus); self.countryStatus(english.searchPage.searchedEntityProperty.countryStatus); self.found(english.searchPage.searchedEntityProperty.found); self.entities(english.searchPage.searchedEntityProperty.entities); } else if (selectedLanguage === "french") { //Translate search input placeholder $('#searchText').attr("placeholder", french.searchPage.basic.search); //Translate tree panels $("#tree").children().children().children().children(".oj-tree-title").text(french.searchPage.basic.country); $("#treeList").children().children().children().children(".oj-tree-title").text(french.searchPage.basic.list); self.workerResult()[0].title = french.searchPage.basic.country; self.workerListResult()[0].title = french.searchPage.basic.list; countryFilterPanelTitle = french.searchPage.basic.country; listFilterPanelTitle = french.searchPage.basic.list; //Translate Advanced Search self.advancedSearchTitle(french.searchPage.advancedSearch.title); self.defaultButton(french.searchPage.advancedSearch.defaultButton); self.wordPercentageText(french.searchPage.advancedSearch.wordPercentage.text); self.phrasePercentageText(french.searchPage.advancedSearch.phrasePercentage.text); self.scoreAlgorithmText(french.searchPage.advancedSearch.scoreAlgorithm.text); self.wordsDistanceAlgorithmText(french.searchPage.advancedSearch.wordsDistanceAlgorithm.text); //Translate Number Of Hits self.hitsText(french.searchPage.hits); self.numberMatches(self.hitsValue() + " " + self.hitsText()); //Translate Searched Entities Properties self.percentageText(french.searchPage.searchedEntityProperty.percentage); self.countryText(french.searchPage.searchedEntityProperty.country); self.addressStatus(french.searchPage.searchedEntityProperty.addressStatus); self.countryStatus(french.searchPage.searchedEntityProperty.countryStatus); self.found(french.searchPage.searchedEntityProperty.found); self.entities(french.searchPage.searchedEntityProperty.entities); } } }); //self.filterTreeObs.extend({rateLimit: {timeout: 300, method: "notifyWhenChangesStop"}}); /************************************** FILTER FUNCTION ***********************************************************/ //limit the retrieve data for every search input self.nameSearch.extend({rateLimit: {timeout: 300, method: "notifyWhenChangesStop"}}); //Temporary solution to start the Advance Search Dialog self.nameSearch(" "); var starting = true; //for counting the number of the page self.numberPage = ko.observable(); // Retrieve data from SOLR for the tree filter self.nameQ = ko.observable(""); self.oneTimeRetrieveSolrTree = true; self.getSolrDataTree = function () { $.getJSON( self.url().toString() + "&rows=0" + self.groupField().toString() + self.facetField().toString() + self.fqTotalPercentage() + self.queryField().toString() + self.nameQ()).then(function (people) { self.facetsCountries(people.facet_counts.facet_fields.add_country); self.facetsLists(people.facet_counts.facet_fields.program_number); self.facetsTypes(people.facet_counts.facet_fields.ent_typeTree); }).fail(function (error) { console.log('Error in getting People data: ' + error.message); }); }; //Live scroll variables var stopScroll = false; var firstPage = true; self.nameSearch.subscribe(function (newValue) { $("#searchedItemsContainer").scrollTop(0); self.start(0); self.rows(40); if (self.nameSearch().search(/\w/) !== -1) { firstPage = true; self.numberPage(""); } // if(self.nameSearch().search(/\w/) !== -1 && self.filteredAllPeople().length > 12) // self.numberPage(1); // else self.numberPage(""); }); self.filteredAllPeople = ko.pureComputed(function () { var peopleFilter = new Array(); //set the position of the filter tree panels after returning from the details page if (oj.Router.rootInstance.tx === "back") { $("#treeCountryLibContainer").css({ "width": utils.resetTreesPos()[0].width, "height": utils.resetTreesPos()[0].height, "top": utils.resetTreesPos()[1].top, "left": utils.resetTreesPos()[1].left }); $("#treeListLibContainer").css({ "width": utils.resetTreesPos()[2].width, "height": utils.resetTreesPos()[2].height, "top": utils.resetTreesPos()[3].top, "left": utils.resetTreesPos()[3].left }); $("#treeTypeLibContainer").css({ "width": utils.resetTreesPos()[4].width, "height": utils.resetTreesPos()[4].height, "top": utils.resetTreesPos()[5].top, "left": utils.resetTreesPos()[5].left }); } //Reseting search input if (self.nameSearch() === " " && !starting) { self.nameSearch(""); } if (self.nameSearch().search(/\w/) === -1) { peopleFilter = []; self.facetsCountries([""]); self.facetsLists([""]); self.numberMatches(""); self.noResults(""); self.nameQ(""); nameBeforeUpdate = ""; self.fqTotalPercentage(""); self.keepFilter = false; } else { if (self.nameSearch() !== nameBeforeUpdate || self.filterTreeObs() === "ready" || stopScroll === true) { //For Live Scrolling it is needed the stopScroll to perform only one request if (stopScroll) { stopScroll = false; } if (self.filterTreeObs() === "done") self.keepFilter = false; if (self.filterTreeObs() === "ready") self.keepFilter = true; if (self.comboObservable() === "combobox") if (self.comboboxSelectValue().length === 0) self.keepFilter = false; //Facets Filter var fqCountries = self.fq(); var fqLists = self.fqList(); var fqType = self.fqType(); var name = ""; /*** To replace the whitespaces with "~" *********/ name = self.nameSearch().replace(/$\s+/g, '~ '); /*** To delete the whitespaces from the end of the words ***/ name = name.replace(/\s*$/, ""); /*** Add "~" for more than 3 chars ***/ if (name.length >= 3) name = name + "~"; /*** Add "~" between words at spliting ***/ if (name.search(/\w\s/) !== -1) name = name.replace(/\s+/g, "~ "); /*** Remove multiple "~" ***/ name = name.replace(/\~+/g, '~'); /*** Remove from beginning of the string ***/ name = name.replace(/^~+/, ""); console.log("name Query: " + name); if (fqCountries.search("undefined") !== -1) fqCountries = ""; //Integrate the percentage values into the self.queryField() var wordPercentage = "pw=" + "0." + self.wordPercentage().toString().substring(0, 2); var phrasePercentage = "0." + self.phrasePercentage().toString().substring(0, 2); self.queryField("&q={!percentage f=nam_comp_name" + " " + "t=" + self.scoreAlgorithm() + " " + wordPercentage + " " + "alg=" + self.wordsDistanceAlgorithm() + "}"); self.fqTotalPercentage("&fq={!frange l=" + phrasePercentage + " " + "}query($q)"); if (name === "" || name === " ") self.fqTotalPercentage(""); self.nameQ(name); AJAXurl=self.url().toString() + '&start=' + self.start() + '&rows=10000' + self.highlightField().toString() + self.groupField().toString() + self.scoreField().toString() + fqCountries + fqLists + self.fqTotalPercentage() + self.queryField().toString() + name; $.getJSON( self.url().toString() + '&start=' + self.start() + '&rows=' + self.rows() + self.highlightField().toString() + self.groupField().toString() + self.scoreField().toString() + fqCountries + fqLists + fqType + self.fqTotalPercentage() + self.queryField().toString() + name).then(function (people) { //Save the query to an global variable self.allPeople(people); self.allHighlighting(people.highlighting); //self.facetsCountries(people.facet_counts.facet_fields.add_country); //self.facetsLists(people.facet_counts.facet_fields.lis_name); self.hitsValue(people.grouped.ent_id.ngroups); self.numberMatches(self.hitsValue() + " " + self.hitsText()); //self.oneTimeRetrieveSolrTree = true; if (self.hitsValue() === 0) { self.noResults("No Results"); self.numberPage(""); } else if (self.hitsValue() !== 0) { self.noResults(""); } }).fail(function (error) { console.log('Error in getting People data: ' + error.message); }); self.filterTreeObs("done"); self.comboObservable("done"); nameBeforeUpdate = self.nameSearch(); self.getSolrDataTree(); //self.oneTimeRetrieveSolrTree = false; } if (self.allPeople().grouped !== undefined) peopleFilter = self.allPeople().grouped.ent_id.groups; } //console.log(self.comboboxSelectValue()); //if (self.allPeople().grouped !== undefined) //self.numberMatches(self.allPeople().grouped.ent_id.ngroups); starting = false; self.ready(true); return peopleFilter; }); //self.filteredAllPeople.extend({rateLimit: {timeout: 200, method: "notifyWhenChangesStop"}}); self.getNodeDataCountry = function (node, fn) { fn(self.workerResult()); }; self.getNodeDataList = function (node, fn) { //Something to shorten the list title // if(self.workerListResult().length !== 0) // if(self.workerListResult()[0].children !== undefined) // for (var i = 0; i < self.workerListResult()[0].children.length; ++i){ // var title = self.workerListResult()[0].children[i].title; // var trim = title.substring(0, 10) + "..." + title.substring(title.indexOf(","), title.length); // self.workerListResult()[0].children[i].title = trim; // } fn(self.workerListResult()); }; self.getNodeDataType = function (node, fn) { fn(self.workerTypeResult()); }; /*/ self.listViewDataSource = ko.computed(function () { return new oj.ArrayTableDataSource(self.filteredAllPeople(), {idAttribute: 'empId'}); }); /**/ /**/ self.cardViewPagingDataSource = ko.pureComputed(function () { var earlyFilteredPeoplee; var lastScrollTop = 0; var scrollTimer, lastScrollFireTime = 0; //For the Live Scroll $("#searchedItemsContainer").scroll(function (event) { var minScrollTime = 600; var now = new Date().getTime(); function processScroll() { if ($("#searchedItemsContainer").scrollTop() > lastScrollTop) { //Scroll Downward if (self.allPeople().grouped.ent_id.ngroups > self.start() + 40) { if (firstPage) { self.numberPage(1); firstPage = false; } if ($("#searchedItemsContainer").scrollTop() + $("#searchedItemsContainer").innerHeight() >= $("#searchedItemsContainer")[0].scrollHeight) { stopScroll = true; self.start(self.start() + 24); event.preventDefault(); event.stopPropagation(); self.filterTreeObs("scrolling"); $("#searchedItemsContainer").scrollTop(($("#searchedItemsContainer")[0].scrollHeight / 1.6) - $("#searchedItemsContainer").innerHeight()); scrollPointDown = 0; self.numberPage(self.numberPage() + 1); } } // if($("#searchedItemsContainer").scrollTop()>scrollPointDown){ // if(scrollPointDown !== 0){ // scrollPointDown = scrollPointDown*2; // self.numberPage(self.numberPage()+1); // } // } } else { //Scroll Upward if ($("#searchedItemsContainer").scrollTop() <= 0 && self.start() >= 24) { stopScroll = true; if (self.start() > 24) { self.start(self.start() - 24); $("#searchedItemsContainer").scrollTop(($("#searchedItemsContainer")[0].scrollHeight / 1.6) - $("#searchedItemsContainer").innerHeight()); self.numberPage(self.numberPage() - 1); } else if (self.start() === 24) { self.start(0); $("#searchedItemsContainer").scrollTop(($("#searchedItemsContainer")[0].scrollHeight / 1.6) - $("#searchedItemsContainer").innerHeight()); self.numberPage(1); } event.preventDefault(); event.stopPropagation(); self.filterTreeObs("scrolling downwards"); } // if($("#searchedItemsContainer").scrollTop() < ($("#searchedItemsContainer")[0].scrollHeight - scrollPointUp)){ // scrollPointUp = scrollPointUp*2; // self.numberPage(self.numberPage()-1); // } } lastScrollTop = $("#searchedItemsContainer").scrollTop(); } if (!scrollTimer) { if (now - lastScrollFireTime > (3 * minScrollTime)) { processScroll(); // fire immediately on first scroll lastScrollFireTime = now; } scrollTimer = setTimeout(function () { scrollTimer = null; lastScrollFireTime = new Date().getTime(); processScroll(); }, minScrollTime); } }); //start the Advanced Search Dialog self.handleOpen = $("#buttonOpener").click(function () { $("#modalDialog1").ojDialog("open"); event.stopImmediatePropagation(); }); self.handleOKClose = $("#okButton").click(function (event) { $("#modalDialog1").ojDialog("close"); self.filterTreeObs("ready"); event.stopImmediatePropagation(); self.keepFilter = false; }); if (earlyFilteredPeoplee !== undefined) //allFiltered.push(self.filteredAllPeople()); //self.filteredAllPeople().push(earlyFilteredPeople); console.log("return oj.ArrayPagingDataSource"); return new oj.ArrayPagingDataSource((self.filteredAllPeople())); }); //Used for the live scrolling, among other uses. It is needed some time to process the data in order to visualize it. self.cardViewPagingDataSource.extend({rateLimit: {timeout: 10, method: "notifyWhenChangesStop"}}); self.cardViewPagingDataSource.subscribe(function (newValue) { $('#treeCountryLib').jstree({ "core": { "themes": { "variant": "large" } }, "plugins": ["wholerow", "checkbox"] }); $('#treeListLib').jstree({ "core": { "themes": { "variant": "large" } }, "plugins": ["wholerow", "checkbox"] }); $('#treeTypeLib').jstree({ "core": { "themes": { "variant": "large" } }, "plugins": ["wholerow", "checkbox"] }); if (self.keepFilter === false) { self.worker.postMessage(self.facetsCountries()); self.worker.onmessage = function (m) { m.data[0].title = countryFilterPanelTitle; self.workerResult(m.data); $('#tree').ojTree("refresh"); $('#tree').ojTree("expandAll"); $('#treeCountryLib').jstree(true).settings.core.data = self.workerResult(); $('#treeCountryLib').jstree(true).refresh(); }; self.workerList.postMessage(self.facetsLists()); self.workerList.onmessage = function (m) { m.data[0].title = listFilterPanelTitle; self.workerListResult(m.data); $('#treeList').ojTree("refresh"); $('#treeList').ojTree("expandAll"); $('#treeListLib').jstree(true).settings.core.data = self.workerListResult(); $('#treeListLib').jstree(true).refresh(); }; self.workerType.postMessage(self.facetsTypes()); self.workerType.onmessage = function (m) { //m.data[0].title = typeFilterPanelTitle; self.workerTypeResult(m.data); $('#treeType').ojTree("refresh"); $('#treeType').ojTree("expandAll"); $('#treeTypeLib').jstree(true).settings.core.data = self.workerTypeResult(); $('#treeTypeLib').jstree(true).refresh(); }; } if (!self.keepFilter && self.nameSearch().length === 0) { self.workerResult(""); $('#tree').ojTree("refresh"); } $("#combobox").on("ojoptionchange", function (event, data) { //for the delete of an element from combobox //$("#combobox").ojCombobox( { "disabled": true } ); if (data.previousValue.length > data.value.length) { //To see which value is removed from the combobox, a value from the country or from list or from type var selected = new Array(); $.grep(data.previousValue, function (el) { if ($.inArray(el, data.value) === -1) selected.push(el); }); var isCountry = self.filterTreeCountry().find(function (el) { return el === selected[0]; }); var isList = self.filterTreeList().find(function (el) { return el === selected[0]; }); var isType = self.filterTreeType().find(function (el) { return el === selected[0]; }); if (isCountry !== undefined) { var oldTreeCountry = self.filterTreeCountry(); var newTreeCountry = new Array(); $.grep(oldTreeCountry, function (el) { if ($.inArray(el, selected) === -1) newTreeCountry.push(el); }); self.filterTreeCountry(newTreeCountry); self.processFilterCountries(); $("#treeCountryLib").jstree("deselect_node", selected); } if (isList !== undefined) { var oldTreeList = self.filterTreeList(); var newTreeList = new Array(); $.grep(oldTreeList, function (el) { if ($.inArray(el, selected) === -1) newTreeList.push(el); }); self.filterTreeList(newTreeList); self.processFilterLists(); $("#treeListLib").jstree("deselect_node", selected); } if (isType !== undefined) { var oldTreeType = self.filterTreeType(); var newTreeType = new Array(); $.grep(oldTreeType, function (el) { if ($.inArray(el, selected) === -1) newTreeType.push(el); }); self.filterTreeType(newTreeType); self.processFilterTypes(); $("#treeTypeLib").jstree("deselect_node", selected); } } event.stopImmediatePropagation(); }); // // Filter Tree Panels interaction // //In order to restore the values of the trees when returning from the details page $('#treeCountryLib').on('refresh.jstree', function (e, data) { if (oj.Router.rootInstance.tx === "back") { for (var c = 0; c < utils.resetState()[1].length; ++c) { $("#treeCountryLib").jstree("select_node", utils.resetState()[1][c]); } } e.stopImmediatePropagation(); }); $('#treeListLib').on('refresh.jstree', function (e, data) { if (oj.Router.rootInstance.tx === "back") { for (var c = 0; c < utils.resetState()[2].length; ++c) { $("#treeListLib").jstree("select_node", utils.resetState()[2][c]); } } e.stopImmediatePropagation(); }); $('#treeTypeLib').on('refresh.jstree', function (e, data) { if (oj.Router.rootInstance.tx === "back") { for (var c = 0; c < utils.resetState()[3].length; ++c) { $("#treeTypeLib").jstree("select_node", utils.resetState()[3][c]); } } e.stopImmediatePropagation(); }); $(function () { $("#tree").draggable().resizable({ }); $("#treeList").draggable().resizable({ }); $("#treeType").draggable().resizable({ }); $("#treeCountryLibContainer").draggable().resizable(); $("#treeListLibContainer").draggable().resizable(); $("#treeTypeLibContainer").draggable().resizable(); }); $('#treeCountryLib').on('close_node.jstree', function (e, data) { if (data.node.id === "country") { self.treeHeight($("#treeCountryLibContainer").css("height")); $("#treeCountryLibContainer").css({"height": 50}); } e.stopImmediatePropagation(); }); $('#treeCountryLib').on('open_node.jstree', function (e, data) { if (data.node.id === "country") { $("#treeCountryLibContainer").css({"height": self.treeHeight()}); } e.stopImmediatePropagation(); }); $('#treeListLib').on('close_node.jstree', function (e, data) { if (data.node.id === "list") { self.treeHeight($("#treeListLibContainer").css("height")); $("#treeListLibContainer").css({"height": 50}); } e.stopImmediatePropagation(); }); $('#treeListLib').on('open_node.jstree', function (e, data) { if (data.node.id === "list") { $("#treeListLibContainer").css({"height": self.treeHeight()}); } e.stopImmediatePropagation(); }); $('#treeTypeLib').on('close_node.jstree', function (e, data) { if (data.node.id === "ENTITY_GENERAL") { self.treeHeight($("#treeTypeLibContainer").css("height")); $("#treeTypeLibContainer").css({"height": 50}); } e.stopImmediatePropagation(); }); $('#treeTypeLib').on('open_node.jstree', function (e, data) { if (data.node.id === "ENTITY_GENERAL") { $("#treeTypeLibContainer").css({"height": self.treeHeight()}); } e.stopImmediatePropagation(); }); // // End of interaction // $("#tree").on("ojoptionchange", function (e, ui) { if (ui.option === "selection") { var filterValue = $(ui.value).attr("id"); if (filterValue !== "country" && filterValue !== undefined) { var foundDuplicate = self.filterTreeCountry().find(function (el) { return filterValue === el; }); if (foundDuplicate === undefined) { self.filterTreeCountry().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterCountries(); $("#tree").ojTree("deselectAll"); } } e.stopImmediatePropagation(); } }); $("#treeList").on("ojoptionchange", function (e, ui) { if (ui.option === "selection") { var pos = $(ui.value).text().indexOf(","); var text = $(ui.value).text(); if (text !== "") { //Regex to find the position of the last coma var match = (/,(?=[^,]*$)/).exec(text); var pos = match.index; var filterValue = $(ui.value).children("a").children("span").text().substring(0, pos - 2); if (filterValue !== "List" && filterValue !== undefined && filterValue !== "") { var foundDuplicate = self.filterTreeList().find(function (el) { return filterValue === el; }); if (foundDuplicate === undefined) { self.filterTreeList().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterLists(); $("#treeList").ojTree("deselectAll"); } } e.stopImmediatePropagation(); } } }); $("#treeType").on("ojoptionchange", function (e, ui) { if (ui.option === "selection") { var filterValue = $(ui.value).attr("id"); if (filterValue !== "type" && filterValue !== undefined) { var foundDuplicate = self.filterTreeCountry().find(function (el) { return filterValue === el; }); if (foundDuplicate === undefined) { self.filterTreeCountry().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterCountries(); $("#tree").ojTree("deselectAll"); } } e.stopImmediatePropagation(); } }); $('#treeCountryLib').on('changed.jstree', function (e, data) { if (data.action === "select_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var foundDuplicate = self.filterTreeCountry().find(function (el) { var found = false; if (filterValue === el) { found = true; } return found; }); if (foundDuplicate === undefined) { if (filterValue !== "country") self.filterTreeCountry().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterCountries(); } } } if (data.action === "deselect_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var isType = self.filterTreeCountry().find(function (el) { return el === filterValue; }); if (isType !== undefined) { var oldArray = self.filterTreeCountry(); for (var i = 0; i < self.filterTreeCountry().length; i++) { if (filterValue === self.filterTreeCountry()[i]) oldArray.splice(i, 1); } self.filterTreeCountry(oldArray); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterCountries(); } } } e.stopImmediatePropagation(); }); $('#treeListLib').on('changed.jstree', function (e, data) { if (data.action === "select_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var foundDuplicate = self.filterTreeList().find(function (el) { var found = false; if (filterValue === el) { found = true; } return found; }); if (foundDuplicate === undefined) { if (filterValue !== "country") self.filterTreeList().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterLists(); } } } if (data.action === "deselect_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var isType = self.filterTreeList().find(function (el) { return el === filterValue; }); if (isType !== undefined) { var oldArray = self.filterTreeList(); for (var i = 0; i < self.filterTreeList().length; i++) { if (filterValue === self.filterTreeList()[i]) oldArray.splice(i, 1); } self.filterTreeList(oldArray); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterLists(); } } } e.stopImmediatePropagation(); }); $('#treeTypeLib').on('changed.jstree', function (e, data) { if (data.action === "select_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var foundDuplicate = self.filterTreeType().find(function (el) { var found = false; if (filterValue === el) { found = true; } return found; }); if (foundDuplicate === undefined) { self.filterTreeType().push(filterValue); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterTypes(); } } } if (data.action === "deselect_node") { for (var c = 0; c < data.node.children_d.length + 1; ++c) { if (c === data.node.children_d.length) var filterValue = data.node.id; else var filterValue = data.node.children_d[c]; var isType = self.filterTreeType().find(function (el) { return el === filterValue; }); if (isType !== undefined) { var oldArray = self.filterTreeType(); for (var i = 0; i < self.filterTreeType().length; i++) { if (filterValue === self.filterTreeType()[i]) oldArray.splice(i, 1); } self.filterTreeType(oldArray); self.keepFilter = true; self.filterTreeObs("load"); self.processFilterTypes(); } } } e.stopImmediatePropagation(); }); self.comboboxSelectValue(self.filterTreeCountry().concat(self.filterTreeList().concat(self.filterTreeType()))); } ); /**/ //Process filter for countries self.processFilterCountries = function () { var fq = ""; if (oj.Router.rootInstance.tx === "back") { for (var c = 0; c < utils.resetState()[1].length; ++c) { $("#treeCountryLib").jstree("select_node", utils.resetState()[1][c]); } } if (self.filterTreeCountry().length > 0) { fq = "add_country:" + "\"" + self.filterTreeCountry()[0] + "\""; for (var i = 1; i < self.filterTreeCountry().length; ++i) { if (self.filterTreeCountry()[i] !== undefined) fq = fq + " OR " + "add_country:" + "\"" + self.filterTreeCountry()[i] + "\""; } fq = "&fq=" + fq; } if (self.filterTreeCountry().length === 0) fq = ""; self.fq(fq); self.filterTreeObs("ready"); }; //Process filter for Lists self.processFilterLists = function () { var fqList = ""; if (self.filterTreeList().length > 0) { fqList = "program_number:" + "\"" + self.filterTreeList()[0] + "\""; for (var i = 1; i < self.filterTreeList().length; ++i) { if (self.filterTreeList()[i] !== undefined) fqList = fqList + " OR " + "program_number:" + "\"" + self.filterTreeList()[i] + "\""; } fqList = "&fq=" + fqList; } if (self.filterTreeList().length === 0) fqList = ""; self.fqList(fqList); self.filterTreeObs("ready"); }; //Process filter for Types self.processFilterTypes = function () { var fqType = ""; if (self.filterTreeType().length > 0) { fqType = "ent_type:" + "\"" + self.filterTreeType()[0] + "\""; for (var i = 1; i < self.filterTreeType().length; ++i) { if (self.filterTreeType()[i] !== undefined) fqType = fqType + " OR " + "ent_type:" + "\"" + self.filterTreeType()[i] + "\""; } fqType = "&fq=" + fqType; } if (self.filterTreeType().length === 0) fqType = ""; self.fqType(fqType); self.filterTreeObs("ready"); }; /**/ self.cardViewDataSource = ko.pureComputed(function () { return self.cardViewPagingDataSource().getWindowObservable(); }); /**/ //Mainly used for the Live Scroll. It is needed to wait time before visualizing the information self.cardViewDataSource.extend({rateLimit: {timeout: 200, method: "notifyWhenChangesStop"}}); self.cardViewDataSource.subscribe(function (newValue) { if (oj.Router.rootInstance.tx === "back") { var language = utils.getLanguage().toString(); self.languageSel(language); } }); self.getPhoto = function (company) { var src = 'js/views/resources/company.svg'; if (company.doclist.docs[0].ent_type === "ENTITY_INDIVIDUAL") src = 'js/views/resources/human.svg'; else if (company.doclist.docs[0].ent_type === "ENTITY_COMPANY") src = 'js/views/resources/company.svg'; else if (company.doclist.docs[0].ent_type === "ENTITY_BANK") src = 'js/views/resources/bank.svg'; else if (company.doclist.docs[0].ent_type === "ENTITY_VESSEL") src = 'js/views/resources/boat.svg'; return src; }; self.getList = function (company) { var listName; if (company.doclist.docs[0].program_number === "null") listName = "NO LIST"; else listName = company.doclist.docs[0].program_number; return listName; }; self.getName = function (company) { //var name = company.doclist.docs[0].nam_comp_name; //var name = self.allHighlighting()[company.doclist.docs[0].sse_id].nam_comp_name[0]; if (self.allPeople().grouped.ent_id.groups.length !== 0) { var sse_id = company.doclist.docs[0].sse_id; if (self.allPeople().highlighting[sse_id] !== undefined) var name = self.allPeople().highlighting[sse_id].nam_comp_name; } else var name = ""; return name; }; /*/ self.getNumberEntity = function (company) { var number = self.allPeople().grouped.ent_id.groups.indexOf(company)+1; return number; }; /**/ self.getPercentage = function (company) { var value = company.doclist.docs[0].score * 100 + ""; var percentage = value.substring(0, 5) + "%"; return percentage; }; self.getPercentageColor = function (company) { var percentage = company.doclist.docs[0].score * 100; return percentage; }; self.getHits = function (company) { var matches; if (self.allPeople().grouped.ent_id.groups.length !== 0) matches = "Hits: " + company.doclist.numFound; else matches = ""; return matches; }; self.getCountry = function (company) { var country; if (company.doclist.docs[0].add_country !== "null") country = "'" + company.doclist.docs[0].add_country + "'"; else country = this.countryStatus(); return country; }; self.getAddress = function (company) { var address = ""; //For the full address Solr field if (company.doclist.docs[0].add_whole !== "null") address = company.doclist.docs[0].add_whole; else { //For the streetaddress Solr field(up to city level) if (company.doclist.docs[0].add_streetAddress !== "null") address = company.doclist.docs[0].add_streetAddress; else { //room var room = ""; if (company.doclist.docs[0].add_room !== "null") room = company.doclist.docs[0].add_room; //appartment var appartment = ""; if (company.doclist.docs[0].add_appartment !== "null") appartment = ", " + company.doclist.docs[0].add_appartment; //floor var floor = ""; if (company.doclist.docs[0].add_floor !== "null") floor = ", " + company.doclist.docs[0].add_floor; //building var building = ""; if (company.doclist.docs[0].add_building !== "null") building = ", " + company.doclist.docs[0].add_building; //house var house = ""; if (company.doclist.docs[0].add_house !== "null") house = ", " + company.doclist.docs[0].add_house; //street var street = ""; if (company.doclist.docs[0].add_street !== "null") street = ", " + company.doclist.docs[0].add_street; // //Address Result // address = room + appartment + building + house + street; } //district var district = ""; if (company.doclist.docs[0].add_district !== "null") district = ", " + company.doclist.docs[0].add_district; //city var city = ""; if (company.doclist.docs[0].add_city !== "null") city = ", " + company.doclist.docs[0].add_city; //zipcode var zipCode = ""; if (company.doclist.docs[0].add_zipCode !== "null") zipCode = ", " + company.doclist.docs[0].add_zipCode; //state var state = ""; if (company.doclist.docs[0].add_state !== "null") state = ", " + company.doclist.docs[0].add_state; //country var country = ""; if (company.doclist.docs[0].add_country !== "null") country = ", " + company.doclist.docs[0].add_country; // //Address Result // address = address + district + city + zipCode + state + country; } //delete if there is a comma at the begining of the address address = address.replace(/^,/, ''); //delete if there is a comma at the end of the address address = address.replace(/\,$/, ""); //show message for no found address if (address === "") address = this.addressStatus(); return address; }; self.getNumberMatches = function (company) { var matches; if (self.allPeople().grouped.ent_id.groups.length !== 0) matches = self.allPeople().grouped.ngroups; else matches = 0; return matches; }; self.getNumFound = function (company) { var numFound = company.doclist.numFound; var str = self.found() + " " + numFound + " " + self.entities(); return str; }; //To load the details page when click on an entity self.loadPersonPage = function (comp) { if (comp.doclist.docs[0].ent_id) { id = comp.doclist.docs[0].ent_id; var lang; if (self.languageSel() !== "") lang = self.languageSel().toString().substring(0, 2); else lang = "en"; translate = false; history.pushState(null, '', 'index.html?root=details&ent_id=' + id + '&lang=' + lang); oj.Router.sync(); utils.rememberState(self.nameSearch(), self.filterTreeCountry(), self.filterTreeList(), self.filterTreeType()); //Store the position of the Filter Tree Panels var sizeTreeCountry = $("#treeCountryLibContainer").css(["width", "height"]); var posTreeCountry = $("#treeCountryLibContainer").position(); var sizeTreeList = $("#treeListLibContainer").css(["width", "height"]); var posTreeList = $("#treeListLibContainer").position(); var sizeTreeType = $("#treeTypeLibContainer").css(["width", "height"]); var posTreeType = $("#treeTypeLibContainer").position(); utils.rememberPositionTrees(sizeTreeCountry, posTreeCountry, sizeTreeList, posTreeList, sizeTreeType, posTreeType); } }; //print button self.print = function () { /* $.ajax({ type : "POST", url:'http://localhost:5488/api/report', headers: { 'Content-Type' : 'application/json' }, data: JSON.stringify({ "template": { "shortid" : "HkzkEpVd" }, "data": { "aProperty": ["value2"], "options": { "Content-Disposition": "attachment; filename=myreport.pdf", } } }) }) var http = require('http'); http.createServer(function (req, res) { require("jsreport").render("<h1>Hello world</h1>").then(function(out) { out.result.pipe(res); }).fail(function(e) { console.log(e); }); }).listen(1337, '127.0.0.1'); */ $.getJSON( // self.url().toString() + '&start=' + self.start() + '&rows=' + self.rows() + // self.highlightField().toString() + // self.groupField().toString() + // self.scoreField().toString() + self.fqCountries + self.fqLists + self.fqTotalPercentage() + //self.queryField().toString() + //self.name) AJAXurl) .done(function (people) { var data=people; jsreport.serverUrl = 'http://localhost:5488'; var request = { template: { shortid:"rJPUhdmv" } , "Content-Disposition": "attachment; filename=myreport.pdf" , //contentDisposition: "inline; filename=MyFile.pdf", data: data, "options": { "reports": { "save": false } } }; // jsreport.render('reportPlaceholder', request); //jsreport.render(request); jsreport.renderAsync(request).then(function(response) { var uInt8Array = new Uint8Array(response); var i = uInt8Array.length; var binaryString = new Array(i); while (i--) { binaryString[i] = String.fromCharCode(uInt8Array[i]); } var data = binaryString.join(''); var base64 = window.btoa(data); window.open("data:application/pdf;base64, " + base64,"_blank"); }) // jsreport.renderAsync(request).then(function(arrayBuffer) { // console.log(arrayBuffer); // window.open("data:application/pdf;base64," + arrayBuffer); // }); //jsreport.renderAsync(request).then(function(arrayBuffer) { // var pdfWin= window.open("data:application/pdf;base64, " + escape(arrayBuffer), '', 'height=650,width=840'); // jsreport.download(arrayBuffer); // }); // }) }); } //To establish the previous state after returning from details page if (oj.Router.rootInstance.tx === "back") { //self.filterTreeCountry(utils.resetState()[1]); self.filterTreeList(utils.resetState()[2]); self.filterTreeType(utils.resetState()[3]); //self.processFilterCountries(); self.processFilterLists(); self.processFilterTypes(); self.filterTreeObs("done"); self.nameSearch(utils.resetState()[0]); } } return PeopleViewModel; });
55.053725
211
0.410748
6882ae376af43d730d4ec1de2c93c1acf5660e36
2,490
js
JavaScript
src/App.js
ionware/fintech-react
edde9fd98eff03e209c56670a0723a27a528b1c0
[ "MIT" ]
null
null
null
src/App.js
ionware/fintech-react
edde9fd98eff03e209c56670a0723a27a528b1c0
[ "MIT" ]
null
null
null
src/App.js
ionware/fintech-react
edde9fd98eff03e209c56670a0723a27a528b1c0
[ "MIT" ]
null
null
null
import React from 'react'; import { QueryClient, QueryClientProvider } from 'react-query'; import { PageLayout } from '@components/layouts'; import { StockChart } from '@components/Charts'; import { StockTable, OptionTable } from '@components/Tables'; import TipsWidget from '@components/TipsWidget'; import 'react-loading-skeleton/dist/skeleton.css'; import './styles/app.css'; const App = () => { const queryClient = new QueryClient(); const tips = [ { title: 'Gold is up by 20%', description: `The biggest factor behind successful financial technology companies' growth year by year is undoubtedly the customer-oriented services they provide. Startups should satisfy customers with fast and agile solutions suitable for the digital age.`, }, { title: 'Buy with lowest price', description: `New technologies such as artificial intelligence, blockchain, and complex algorithms are areas where financial technology companies are starting to adapt. New technologies provide companies with a variety of possibilities.`, }, { title: 'Do what is affordable', description: `Regulations, one of the most challenging issues of financial service providers, change over time. Financial technology startups should be prepared for regulations in advance and quickly adapt to these regulations.`, }, { title: 'Zoom is up by 20%', description: `The price advantage and trust of companies in the financial sector are very important. Customers act according to the feeling of trust when deciding on the company from which they will perform their financial transactions. `, }, ]; return ( <QueryClientProvider client={queryClient}> <PageLayout title='Buy and invest in stock holdings'> <main> <div> <StockChart /> </div> <div className='flex flex-wrap lg:flex-nowrap my-5 justify-between px-2 sm:px-2 md:px-10 lg:px-14'> <div className='w-full md:w-5/12 md:flex-grow lg:w-3/12 mt-4 mr-3 lg:mr-16 py-6'> <StockTable /> </div> <div className='w-full md:w-5/12 md:flex-grow lg:w-3/12 mt-4 mr-3 lg:mr-16 py-6'> <OptionTable /> </div> <div className='w-full md:w-6/12 lg:w-3/12 mt-4 mr-3 lg:mr-16 py-6'> <TipsWidget tips={tips} /> </div> </div> </main> </PageLayout> </QueryClientProvider> ); }; export default App;
44.464286
264
0.663052
6882d58ab03712edcae1ea7709b3a96dc3029bc2
290
js
JavaScript
index.js
ryanburnette/hashcash
a1c82829b785d29e30f6eb73fed18c814b9b957e
[ "0BSD" ]
1
2022-02-11T20:15:00.000Z
2022-02-11T20:15:00.000Z
index.js
ryanburnette/hashcash
a1c82829b785d29e30f6eb73fed18c814b9b957e
[ "0BSD" ]
1
2020-04-07T22:55:15.000Z
2020-04-07T22:55:15.000Z
index.js
ryanburnette/hashcash
a1c82829b785d29e30f6eb73fed18c814b9b957e
[ "0BSD" ]
null
null
null
'use strict'; module.exports = function(opts) { var obj = {}; obj.rules = require('./lib/rules')(opts); obj.check = function(v) { return require('./lib/check')(obj.rules, v); }; obj.solve = function() { return require('./lib/solve')(obj.check); }; return obj; };
16.111111
48
0.57931
68844f5cc83d3bd7445ef692853ba409794cb5de
462
js
JavaScript
lib/timeout.js
alistairstead/breaker-breaker
405675f4ea833e557002a8c920a006dc8ba4a457
[ "Apache-2.0" ]
1
2015-11-11T17:25:00.000Z
2015-11-11T17:25:00.000Z
lib/timeout.js
alistairstead/breaker-breaker
405675f4ea833e557002a8c920a006dc8ba4a457
[ "Apache-2.0" ]
null
null
null
lib/timeout.js
alistairstead/breaker-breaker
405675f4ea833e557002a8c920a006dc8ba4a457
[ "Apache-2.0" ]
null
null
null
'use strict'; export class Timeout { /** * Construct a delayed promise for n `milliseconds`. The promise * will reject after the appropriate delay. * * @param {Number} milliseconds - milliseconds wait time * @return {Promise} * @api private */ constructor (milliseconds = 1000) { return new Promise(function (resolve, reject) { setTimeout(function () { reject('Command timeout'); }, milliseconds); }); } }
23.1
66
0.62987
68849c63619352d47860cad5726fa64c72912648
3,681
js
JavaScript
src/index.js
nicolasdelfino/rn_device
29cad94f1fe8267bf97e041021b1fb61682a3eb4
[ "MIT" ]
null
null
null
src/index.js
nicolasdelfino/rn_device
29cad94f1fe8267bf97e041021b1fb61682a3eb4
[ "MIT" ]
null
null
null
src/index.js
nicolasdelfino/rn_device
29cad94f1fe8267bf97e041021b1fb61682a3eb4
[ "MIT" ]
null
null
null
/* react-native-devices */ import { Dimensions, PixelRatio } from 'react-native' const r = PixelRatio.get() const w = Dimensions.get('window').width * r const h = Dimensions.get('window').height * r /* PHONES */ const DEVICE_IS_X = () => RES(1125, 2436) const DEVICE_IS_PLUS_6_6S_7_8 = () => RES(1242, 2208) const DEVICE_IS_6_6S_7_8 = () => RES(750, 1334) const DEVICE_IS_5_5S_5C_SE = () => RES(640, 1136) const DEVICE_IS_4_4S = () => RES(640, 960) const DEVICE_IS_2G_3G_3GS = () => RES(320, 480) const DEVICE_IF_X = (a, b) => (DEVICE_IS_X() ? a : b) const DEVICE_IF_PLUS_6_6S_7_8 = (a, b) => (DEVICE_IS_PLUS_6_6S_7_8() ? a : b) const DEVICE_IF_6_6S_7_8 = (a, b) => (DEVICE_IS_6_6S_7_8() ? a : b) const DEVICE_IF_5_5S_5C_SE = (a, b) => (DEVICE_IS_5_5S_5C_SE() ? a : b) const DEVICE_IF_4_4S = (a, b) => (DEVICE_IS_4_4S() ? a : b) const DEVICE_IF_2G_3G_3GS = (a, b) => (DEVICE_IS_2G_3G_3GS() ? a : b) /* TABLETS */ const DEVICE_IS_TABLET = () => (r < 2 && (w >= 1000 || h >= 1000)) || (r === 2 && (w >= 1920 || h >= 1920)) const DEVICE_IS_IPAD_MINI = () => RES(1536, 2048) const DEVICE_IS_IPAD = () => RES(768, 1024) const DEVICE_IS_IPAD_PRO = () => RES(1536, 2048) || RES(2224, 1668) || RES(2732, 2048) const DEVICE_IS_IPAD_PRO_9_INCH = () => RES(1536, 2048) const DEVICE_IS_IPAD_PRO_10_INCH = () => RES(2224, 1668) const DEVICE_IS_IPAD_PRO_12_INCH = () => RES(2732, 2048) const DEVICE_IS_IPAD_AIR = () => RES(1536, 2048) const DEVICE_IS_IPAD_RETINA = () => RES(1536, 2048) const DEVICE_IF_TABLET = (a, b) => (DEVICE_IS_TABLET() ? a : b) const DEVICE_IF_IPAD_MINI = (a, b) => (DEVICE_IS_IPAD_MINI() ? a : b) const DEVICE_IF_IPAD = (a, b) => (DEVICE_IS_IPAD() ? a : b) const DEVICE_IF_IPAD_PRO = (a, b) => (DEVICE_IS_IPAD_PRO() ? a : b) const DEVICE_IF_IPAD_PRO_9_INCH = (a, b) => DEVICE_IS_IPAD_PRO_9_INCH() ? a : b const DEVICE_IF_IPAD_PRO_10_INCH = (a, b) => DEVICE_IS_IPAD_PRO_10_INCH() ? a : b const DEVICE_IF_IPAD_PRO_12_INCH = (a, b) => DEVICE_IS_IPAD_PRO_12_INCH() ? a : b const DEVICE_IF_IPAD_AIR = (a, b) => (DEVICE_IS_IPAD_AIR() ? a : b) const DEVICE_IF_IPAD_RETINA = (a, b) => (DEVICE_IS_IPAD_RETINA() ? a : b) /* VERIFY PIXEL PROFILE (portrait / landscape) */ const RES = (a, b) => (w === a && h === b) || (h === a && w === b) export const devices = { IF_X: (a, b) => DEVICE_IF_X(a, b), IF_PLUS_6_6S_7_8: (a, b) => DEVICE_IF_PLUS_6_6S_7_8(a, b), IF_6_6S_7_8: (a, b) => DEVICE_IF_6_6S_7_8(a, b), IF_5_5S_5C_SE: (a, b) => DEVICE_IF_5_5S_5C_SE(a, b), IF_4_4S: (a, b) => DEVICE_IF_4_4S(a, b), IF_2G_3G_3GS: (a, b) => DEVICE_IF_2G_3G_3GS(a, b), IF_TABLET: (a, b) => DEVICE_IF_TABLET(a, b), IF_IPAD_MINI: (a, b) => DEVICE_IF_IPAD_MINI(a, b), IF_IPAD: (a, b) => DEVICE_IF_IPAD(a, b), IF_IPAD_PRO: (a, b) => DEVICE_IF_IPAD_PRO(a, b), IF_IPAD_PRO_9_INCH: (a, b) => DEVICE_IF_IPAD_PRO_9_INCH(a, b), IF_IPAD_PRO_10_INCH: (a, b) => DEVICE_IF_IPAD_PRO_10_INCH(a, b), IF_IPAD_PRO_12_INCH: (a, b) => DEVICE_IF_IPAD_PRO_12_INCH(a, b), IF_IPAD_AIR: (a, b) => DEVICE_IF_IPAD_AIR(a, b), IF_IPAD_RETINA: (a, b) => DEVICE_IF_IPAD_RETINA(a, b), IS_X: DEVICE_IS_X(), IS_PLUS_6_6S_7_8: DEVICE_IS_PLUS_6_6S_7_8(), IS_6_6S_7_8: DEVICE_IS_6_6S_7_8(), IS_5_5S_5C_SE: DEVICE_IS_5_5S_5C_SE(), IS_4_4S: DEVICE_IS_4_4S(), IS_2G_3G_3GS: DEVICE_IS_2G_3G_3GS(), IS_TABLET: DEVICE_IS_TABLET(), IS_IPAD_MINI: DEVICE_IS_IPAD_MINI(), IS_IPAD: DEVICE_IS_IPAD(), IS_IPAD_PRO: DEVICE_IS_IPAD_PRO(), IS_IPAD_PRO_9_INCH: DEVICE_IS_IPAD_PRO_9_INCH(), IS_IPAD_PRO_10_INCH: DEVICE_IS_IPAD_PRO_10_INCH(), IS_IPAD_PRO_12_INCH: DEVICE_IS_IPAD_PRO_12_INCH(), IS_IPAD_AIR: DEVICE_IS_IPAD_AIR(), IS_IPAD_RETINA: DEVICE_IS_IPAD_RETINA() }
40.01087
78
0.677533
68854f3569f841855d2083c49e53efdf4ef25cb9
685
js
JavaScript
docs/components/AddButton.js
mugi-uno/closure-tools-devtools
e21298aa996844e301a77292cef82fbac141228a
[ "MIT" ]
13
2021-07-14T04:47:48.000Z
2021-10-09T00:24:39.000Z
docs/components/AddButton.js
mugi-uno/closure-tools-devtools
e21298aa996844e301a77292cef82fbac141228a
[ "MIT" ]
null
null
null
docs/components/AddButton.js
mugi-uno/closure-tools-devtools
e21298aa996844e301a77292cef82fbac141228a
[ "MIT" ]
null
null
null
goog.provide("demo.components.AddButton"); goog.require("goog.ui.Component"); demo.components.AddButton = function () { goog.ui.Component.call(this); }; goog.inherits(demo.components.AddButton, goog.ui.Component); demo.components.AddButton.prototype.createDom = function () { const button = this.getDomHelper().createDom(goog.dom.TagName.BUTTON); button.innerText = "Add new task"; this.setElementInternal(button); }; demo.components.AddButton.prototype.enterDocument = function () { demo.components.Cell.base(this, "enterDocument"); this.getHandler().listen(this.getElement(), goog.events.EventType.CLICK, () => { this.dispatchEvent({ type: "AddTask" }); }); };
31.136364
82
0.729927
688777b33d5f03c2fbf776d7dcc1a0d6b8950727
197
js
JavaScript
src/components/Forms/FormsMetadata/NewTravelStipendFormMetadata/inputLabels.js
mikenthiwa/travela_front
2e5dd8dc03bc114eb8f111d174eafbd37bcb5f85
[ "MIT" ]
null
null
null
src/components/Forms/FormsMetadata/NewTravelStipendFormMetadata/inputLabels.js
mikenthiwa/travela_front
2e5dd8dc03bc114eb8f111d174eafbd37bcb5f85
[ "MIT" ]
null
null
null
src/components/Forms/FormsMetadata/NewTravelStipendFormMetadata/inputLabels.js
mikenthiwa/travela_front
2e5dd8dc03bc114eb8f111d174eafbd37bcb5f85
[ "MIT" ]
null
null
null
const inputLabels = (editing) => ({ stipend: { label: 'Enter Amount in Dollars ($)' }, center: { label: editing ? 'Location' : 'Type the country' } }); export default inputLabels;
17.909091
52
0.604061
68883137a50558a4fc4596421cf2a94b4c4709e1
594
js
JavaScript
src/Roam.js
deiwin/roam-spotify
26eb01537fdfdbf571b3c89c518a34c2b3eeab58
[ "MIT" ]
null
null
null
src/Roam.js
deiwin/roam-spotify
26eb01537fdfdbf571b3c89c518a34c2b3eeab58
[ "MIT" ]
null
null
null
src/Roam.js
deiwin/roam-spotify
26eb01537fdfdbf571b3c89c518a34c2b3eeab58
[ "MIT" ]
null
null
null
"use strict"; exports._getFocusedBlockMetadata = just => nothing => () => { const focusedBlockMetadata = window.roamAlphaAPI.ui.getFocusedBlock(); if (focusedBlockMetadata) { return just(focusedBlockMetadata); } else { return nothing; } }; exports._findBlock = uid => () => window.roamAlphaAPI .data .q(`[:find (pull ?e [*]) :in $ ?uid :where [?e :block/uid ?uid] ]`, uid); exports.setBlockString = string => uid => () => { window.roamAlphaAPI .data .block .update({block: { uid: uid, string: string, }}); };
20.482759
72
0.577441
6889112d303787d377f68fde3a59d35cf40d9fb5
2,151
js
JavaScript
src/components/BookingTypes/BookingTypes.js
Ruslan310/ftw-deily
ba477072a2df7fe6a08050e916b1b69fa598ab8a
[ "Apache-2.0" ]
null
null
null
src/components/BookingTypes/BookingTypes.js
Ruslan310/ftw-deily
ba477072a2df7fe6a08050e916b1b69fa598ab8a
[ "Apache-2.0" ]
null
null
null
src/components/BookingTypes/BookingTypes.js
Ruslan310/ftw-deily
ba477072a2df7fe6a08050e916b1b69fa598ab8a
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react'; import { Form as FinalForm, FormSpy } from 'react-final-form'; import { formatMoney } from '../../util/currency'; import { types as sdkTypes } from '../../util/sdkLoader'; import { Form, FieldRadioButton } from '../../components'; import { getAvailablePrices, getLowestPrice } from '../../util/data'; // import { // HOURLY_PRICE, // } from '../../util/types'; import css from './BookingTypes.module.css'; const { Money } = sdkTypes; export default class BookingTypes extends Component { handleOnChange(values){ this.props.onChange(values.bookingType) } render() { const {listing, intl} = this.props; const prices = getAvailablePrices(listing); const { key } = getLowestPrice(listing); const initialValues = {bookingType: key || null}; return ( <div> <FinalForm // {...rest} onSubmit={() => {}} initialValues={initialValues} render={fieldRenderProps => { const { handleSubmit, } = fieldRenderProps; return ( <Form onSubmit={handleSubmit}> <FormSpy subscription={{ values: true }} onChange={({values}) => { this.handleOnChange(values); }} /> <div className={css.types}> {prices.map(({key, value}) => { const {currency, amount} = value; const price = formatMoney(intl, new Money(amount, currency)); return ( <div className={css.sessionCheckboxItem}> <FieldRadioButton id={`bookingType${key}`} name="bookingType" label={intl.formatMessage({id: `BookingTypes.${key}Label`}, {price})} value={key} // labelClassName={labelClassName} /> </div> ) })} </div> </Form> )}} /> </div> ) } }
30.295775
93
0.489075
6889336fc52c05b7949dac7e8b5adb46fc51d114
1,436
js
JavaScript
gulpfile.js
PettiSan/sass-mediaquery-singleline
e00671b6d48d8a5e5a40fc25fc799aa3de396bf0
[ "MIT" ]
2
2020-05-06T00:36:18.000Z
2020-08-13T22:03:06.000Z
gulpfile.js
PettiSan/sass-mediaquery-singleline
e00671b6d48d8a5e5a40fc25fc799aa3de396bf0
[ "MIT" ]
null
null
null
gulpfile.js
PettiSan/sass-mediaquery-singleline
e00671b6d48d8a5e5a40fc25fc799aa3de396bf0
[ "MIT" ]
1
2020-03-20T06:35:58.000Z
2020-03-20T06:35:58.000Z
const gulp = require('gulp'); const sass = require('gulp-sass'); const cleanCss = require('gulp-clean-css'); const notifier = require('node-notifier'); const browserSync = require('browser-sync').create(); sass.compiler = require('node-sass'); const src_folder = 'tests/'; gulp.task('serve', () => { return browserSync.init({ server: { baseDir: [ 'tests' ] }, port: 3000, open: false }); }); gulp.task('watch', () => { gulp.watch([`tests/**/*.html`], gulp.series('html')).on('change', () => { notifier.notify({ title: 'HTML changed', message: 'HTML changed successfully!', }); browserSync.reload; }); gulp.watch([`tests/**/*.scss`], gulp.series('scss')).on('change', () => { notifier.notify({ title: 'SCSS changed', message: 'SCSS changed successfully!', }); browserSync.reload; }); }); gulp.task('html', () => { return gulp.src([ `${src_folder}**/*.html` ], { base: src_folder, since: gulp.lastRun('html') }) .pipe(browserSync.stream()); }); gulp.task('scss', () => { return gulp .src([`${src_folder}**/*.scss`]) .pipe(sass().on('error', sass.logError)) .pipe(cleanCss({ level: { 2: { all: true, } } })) .pipe(gulp.dest(src_folder)) .pipe(browserSync.stream()); }); gulp.task('tests', gulp.series('scss', gulp.parallel('serve', 'watch'))); return;
22.793651
75
0.552925
68894aa935e326f03b03b52efed48456dbd01dab
4,487
js
JavaScript
lib/math.js
gabriel-pinheiro/mocko-helpers
f7d2ebdb90bff3d5d42a69bc2a251816ebf55a1f
[ "MIT" ]
1
2019-11-21T12:06:57.000Z
2019-11-21T12:06:57.000Z
lib/math.js
gabriel-pinheiro/mocko-helpers
f7d2ebdb90bff3d5d42a69bc2a251816ebf55a1f
[ "MIT" ]
21
2020-12-30T08:49:53.000Z
2022-02-14T01:04:12.000Z
lib/math.js
gabriel-pinheiro/mocko-helpers
f7d2ebdb90bff3d5d42a69bc2a251816ebf55a1f
[ "MIT" ]
2
2021-01-05T11:16:24.000Z
2021-01-31T17:47:44.000Z
const utils = require('./utils'); /** * @exports math */ const helpers = module.exports; function coerceAndTransform(a, b, fn) { const aa = +a; const bb = +b; if (!isFinite(aa)) { throw new TypeError('expected the first argument to be a number'); } if (!isFinite(bb)) { throw new TypeError('expected the second argument to be a number'); } return fn(aa, bb); } /** * Return the magnitude of `a`. * * @param {Number} `a` * @return {Number} * @api public */ helpers.abs = function(num) { if (!utils.isNumber(num)) { throw new TypeError('expected a number'); } return Math.abs(num); }; /** * Return the sum of `a` plus `b`. * * @param {Number} `a` augend * @param {Number} `b` addend * @return {Number} * @api public */ helpers.add = function(a, b) { return coerceAndTransform(a, b, (na, nb) => na + nb); }; /** * Returns the average of all numbers in the given array. * * ```handlebars * {{avg "[1, 2, 3, 4, 5]"}} * <!-- results in: '3' --> * ``` * * @param {Array} `array` Array of numbers to add up. * @return {Number} * @api public */ helpers.avg = function() { const args = [].concat.apply([], arguments); // remove handlebars options object args.pop(); return helpers.sum(args) / args.length; }; /** * Get the `Math.ceil()` of the given value. * * @param {Number} `value` * @return {Number} * @api public */ helpers.ceil = function(num) { const val = +num; if (!isFinite(val)) { throw new TypeError('expected a number'); } return Math.ceil(val); }; /** * Divide `a` by `b` * * @param {Number} `a` numerator * @param {Number} `b` denominator * @api public */ helpers.divide = function(a, b) { return coerceAndTransform(a, b, (na, nb) => na / nb); }; /** * Get the `Math.floor()` of the given value. * * @param {Number} `value` * @return {Number} * @api public */ helpers.floor = function(value) { const num = +value; if (!isFinite(num)) { throw new TypeError('expected a number'); } return Math.floor(num); }; /** * Return the difference of `a` minus `b`. * * @param {Number} `a` minuend * @param {Number} `b` subtrahend * @alias subtract * @api public */ helpers.minus = function(a, b) { return coerceAndTransform(a, b, (na, nb) => na - nb); }; /** * Get the remainder of a division operation. * * @param {Number} `a` * @param {Number} `b` * @return {Number} * @api public */ helpers.modulo = function(a, b) { return coerceAndTransform(a, b, (na, nb) => na % nb); }; /** * Return the product of `a` times `b`. * * @param {Number} `a` factor * @param {Number} `b` multiplier * @return {Number} * @alias times * @api public */ helpers.multiply = function(a, b) { return coerceAndTransform(a, b, (na, nb) => na * nb); }; /** * Add `a` by `b`. * * @param {Number} `a` factor * @param {Number} `b` multiplier * @api public */ helpers.plus = helpers.add; /** * Generate a random number between two values * * @param {Number} `min` * @param {Number} `max` * @return {String} * @api public */ helpers.random = function(min, max) { return coerceAndTransform(min, max, (nmin, nmax) => nmin + Math.floor(Math.random() * (nmax - nmin + 1))); }; /** * Get the remainder when `a` is divided by `b`. * * @param {Number} `a` a * @param {Number} `b` b * @api public */ helpers.remainder = helpers.modulo; /** * Round the given number. * * @param {Number} `number` * @return {Number} * @api public */ helpers.round = function(num) { const nn = +num; if (!isFinite(nn)) { throw new TypeError('expected a number'); } return Math.round(nn); }; /** * Return the product of `a` minus `b`. * * @param {Number} `a` * @param {Number} `b` * @return {Number} * @alias minus * @api public */ helpers.subtract = helpers.minus; /** * Returns the sum of all numbers in the given array. * * ```handlebars * {{sum "[1, 2, 3, 4, 5]"}} * <!-- results in: '15' --> * ``` * @param {Array} `array` Array of numbers to add up. * @return {Number} * @api public */ helpers.sum = function() { const args = [].concat.apply([], arguments); let len = args.length; let sum = 0; while (len--) { if (utils.isNumber(args[len])) { sum += Number(args[len]); } } return sum; }; /** * Multiply number `a` by number `b`. * * @param {Number} `a` factor * @param {Number} `b` multiplier * @return {Number} * @alias multiply * @api public */ helpers.times = helpers.multiply;
18.02008
108
0.587698
6889625178f47575b8c4fb8bf78d405f6b73c3cc
24,396
js
JavaScript
src/routes/Shop/Grounding/task.js
wuzhenhao12313/Fx.OA
9c64dba9999d73d7c9273d5adbd3f88822f65886
[ "MIT" ]
null
null
null
src/routes/Shop/Grounding/task.js
wuzhenhao12313/Fx.OA
9c64dba9999d73d7c9273d5adbd3f88822f65886
[ "MIT" ]
null
null
null
src/routes/Shop/Grounding/task.js
wuzhenhao12313/Fx.OA
9c64dba9999d73d7c9273d5adbd3f88822f65886
[ "MIT" ]
null
null
null
import React, {PureComponent} from 'react'; import {connect} from 'dva'; import moment from 'moment'; import { message, Progress, Button, Input, Badge, Modal, Drawer, InputNumber, Icon, Divider, Row, Col, Card, Collapse, Menu, Dropdown, Tabs, } from 'antd'; import Component from '../../../utils/rs/Component'; import FxLayout from '../../../myComponents/Layout/'; import Format from '../../../utils/rs/Format'; import StandardTable from '../../../myComponents/Table/Standard'; import {fetchApiSync, fetchDictSync} from "../../../utils/rs/Fetch"; import {formatDate, formatNumber} from '../../../utils/utils'; import TableActionBar from '../../../myComponents/Table/TableActionBar'; import EditModal from '../../../myComponents/Fx/EditModal'; import Config from "../../../utils/rs/Config"; import {String} from '../../../utils/rs/Util'; import ShopSelect from '../../../myComponents/Select/Shop'; import Asin from './asin'; import style from './index.less'; import Uri from "../../../utils/rs/Uri"; const modelNameSpace = "grounding-task"; const Fragment = React.Fragment; const ButtonGroup = Button.Group; const TabPane = Tabs.TabPane; const departmentData = fetchApiSync({url: '/Department/Get',}); const departmentList = departmentData.data.toObject().list.toObject(); const formatter = { department: {}, }; departmentList.forEach(department => { formatter.department[`${department['depID']}`] = department['depName']; }); @connect(state => ({ [modelNameSpace]: state[modelNameSpace], loading: state.loading, }))//注入state @Component.Model(modelNameSpace)//注入model @Component.Pagination({model: modelNameSpace}) @Component.Role('erp_shop_grounding_task') export default class extends PureComponent { state = { asinDrawerProps: { visible: false, currentPlanItemID: 0, currentPlanID: 0, currentPlan: {}, currentShopType: null, }, editModal: { isAdd: false, visible: false, currentAsin: {}, index: -1, currentAddAsinCode: null, }, addAsinVisible: false, currentAddAsinValue: null, currentAddAsinCode: null, asinModel: 'table', tag: null, }; ref = { editPlanCountForm: null, editForm: null, } componentDidMount() { const tag = Uri.Query('tag'); this.setState({ tag, }); this.getList(1); } getCodeList = (shopType) => { let list = []; switch (shopType) { case 'amazon': list = [ { name: '北美站(简码:US/CA/MX)', code: 'US', url: 'www.amazon.com/dp/', }, { name: '英国站(简码:UK)', code: 'UK', url: 'www.amazon.co.uk/dp/', }, { name: '法国站(简码:FR)', code: 'FR', url: 'www.amazon.fr/dp/', }, { name: '德国站(简码:DE)', code: 'DE', url: 'www.amazon.de/dp/', }, { name: '意大利(简码:IT)', code: 'IT', url: 'www.amazon.it/dp/', }, { name: '西班牙(简码:ES)', code: 'ES', url: 'www.amazon.es/dp/', }, { name: '日本站(简码:JP)', code: 'JP', url: 'www.amazon.co.jp/dp/', }, { name: '澳洲站(简码:AU)', code: 'AU', url: 'www.amazon.com.au/dp/' }, { name: '其它', code: null, url: 'www.amazon.com/dp/' } ]; break; case 'ebay': list = [ { name: 'Ebay-US', code: 'us', url: 'www.ebay.com/itm/', }, { name: 'Ebay-UK', code: 'uk', url: 'www.ebay.co.uk/itm/', }, { name: 'Ebay-AU', code: 'au', url: 'www.ebay.au/itm/', }, { name: 'Ebay-DE', code: 'de', url: 'www.ebay.de/itm/', }, { name: 'Ebay-FR', code: 'fr', url: 'www.ebay.fr/itm/', }, { name: '其他', code: null, url: 'www.ebay.com/itm/', } ]; break; case "cdiscount": list = [ { name: '其他', code: null, url: 'www.cdiscount.com/dp.aspx?sku=', } ]; break; case "wish": list = [ { name: '其他', code: null, url: 'www.wish.com/c/' } ]; break; case "shopee": list = [ { name: 'Shopee-TW', code: 'tw', url: 'shopee.tw/product/74663392/', }, { name: 'Shopee-MY', code: 'my', url: 'shopee.com.my/product/62637884/', }, { name: 'Shopee-SG', code: 'sg', url: 'shopee.com.sg/product/69429374/', }, { name: 'Shopee-ID', code: 'id', url: 'shopee.co.id/product/74663392/', }, { name: 'Shopee-TH', code: 'th', url: 'shopee.co.th/product/74663392/', }, { name: 'Shopee-VN', code: 'vn', url: 'shopee.vn/product/74663392/', }, { name: '其他', code: null, url: '', } ]; break; } return list; } getList = (page) => { const {model} = this.props; const {pageIndex, pageSize, data: {total}} = this.props[modelNameSpace]; model.setState({ data: { list: [], total, } }).then(() => { model.call('getMyPlanDetail', { pageIndex, pageSize, }); }); } getAsinList = (planItemID) => { const {model} = this.props; model.call('getPlanItemAsin', { planItemID, }); } getBadgeInfo = (type) => { const info = {}; switch (type) { case 'working': info.status = "success"; info.text = '已转正'; break; case 'trial': info.status = "processing"; info.text = '试用期'; break; case 'waiting-quit': info.status = "waring"; info.text = '待离职'; break; case 'quit': info.status = "error"; info.text = '已离职'; break; default: info.status = "error"; info.text = '已离职'; break; } return info; } openAsinDrawer = (planItemID, planID, currentPlan) => { this.setState({ asinDrawerProps: { visible: true, currentPlanItemID: planItemID, currentPlanID: planID, currentPlan, currentShopType: currentPlan.shopType, }, }); this.getAsinList(planItemID); } addAsin = () => { const {model} = this.props; const {getFieldsValue} = this.ref.editForm.props.form; const {currentPlanItemID, currentPlanID,currentShopType,currentPlan} = this.state.asinDrawerProps; const {pAsin, asin, shopID} = getFieldsValue(); const {currentAddAsinCode, isAdd, currentAsin} = this.state.editModal; if (String.IsNullOrEmpty(asin)) { message.warning("ASIN不能为空"); return; } model.call(isAdd ? "addAsin" : "editAsin", isAdd ? { planID: currentPlanID, planItemID: currentPlanItemID, asin: asin.trim(), shopID, pAsin: pAsin.trim(), imgUrl: "", code: currentAddAsinCode, shopType:currentShopType, } : { asinID: currentAsin.id, asin: asin.trim(), shopID, pAsin: pAsin.trim(), imgUrl: '', code: currentAddAsinCode, }).then(success => { if (success) { this.setState({ editModal: { visible: false, } }); if(isAdd){ currentPlan.endCount+=1; this.setState({ ...this.state.asinDrawerProps, currentPlan, }); } this.getAsinList(currentPlanItemID); } }); } editAsin = (asinID, value) => { const {model} = this.props; const {asinList} = this.props[modelNameSpace]; const index = asinList.findIndex(x => x.id === asinID); asinList[index]['ASIN'] = value; model.setState({ asinList, }); } saveEditAsin = (asinID) => { const {currentPlanItemID} = this.state.asinDrawerProps; Modal.confirm({ title: '更改ASIN', content: '确定要更改ASIN吗?', onOk: () => { const {model} = this.props; const {asinList} = this.props[modelNameSpace]; const index = asinList.findIndex(x => x.id === asinID); const asin = asinList[index]['ASIN']; const code = asinList[index]['code']; model.call("editAsin", { asinID, asin: asin.trim(), imgUrl: '', code, }).then(success => { if (success) { this.getAsinList(currentPlanItemID); } }); } }); } removeAsin = (asinID) => { const {currentPlanItemID,currentPlan} = this.state.asinDrawerProps; Modal.confirm({ title: '删除ASIN', content: '确定要删除ASIN吗?删除后将无法恢复', onOk: () => { const {model} = this.props; model.call("removeAsin", { asinID, }).then(success => { if (success) { this.getAsinList(currentPlanItemID); currentPlan.endCount-=1; this.setState({ ...this.state.asinDrawerProps, currentPlan, }); } }); } }); } openAsinEdit = (asinID) => { const {model} = this.props; const {asinList} = this.props[modelNameSpace]; const index = asinList.findIndex(x => x.id === asinID); asinList[index]['edit'] = true; asinList[index]['old-asin'] = asinList[index]['ASIN']; model.setState({ asinList, }); } cancelAsinEdit = (asinID) => { const {model} = this.props; const {asinList} = this.props[modelNameSpace]; const index = asinList.findIndex(x => x.id === asinID); asinList[index]['edit'] = false; asinList[index]['ASIN'] = asinList[index]['old-asin']; model.setState({ asinList, }); } moveAsin = (asinID, code) => { const {currentPlanItemID} = this.state.asinDrawerProps; const {model} = this.props; const asinIDList = []; asinIDList.push(asinID); model.call("moveAsin", { asinIDList, code, }).then(success => { if (success) { this.getAsinList(currentPlanItemID); } }); } getShopTypeAsinCount=(shopType)=>{ const {asinList} = this.props[modelNameSpace]; return asinList.filter(x=>x.shopType===shopType).length; } renderEditModal() { const {visible, isAdd, currentAsin} = this.state.editModal; const item = [ { key: 'pAsin', label: '父ASIN', initialValue: isAdd ? undefined : currentAsin.P_ASIN, render: () => { return ( <Input/> ) } }, { key: 'asin', label: '子ASIN', initialValue: isAdd ? undefined : currentAsin.ASIN, render: () => { return ( <Input/> ) } }, { key: 'shopID', label: '所属店铺', initialValue: isAdd ? undefined : currentAsin.shopID, render: () => { return ( <ShopSelect isAllOpen={true}/> ) } }, ]; return ( <EditModal title={isAdd ? '添加ASIN' : '编辑ASIN'} visible={visible} item={item} refForm={node => this.ref.editForm = node} onCancel={e => this.setState({editModal: {visible: false}})} zIndex={1001} footer={true} onOk={this.addAsin} /> ) } renderAsinHeader() { const {currentPlan} = this.state.asinDrawerProps; let planCount = currentPlan.count; let endCount = currentPlan.endCount; return ( <Card style={{marginBottom: 24, marginTop: 4}}> <Row> <Col span={6}> <div className='headerInfo'> <span>计划数量</span> <p>{planCount}</p> <em/> </div> </Col> <Col span={6}> <div className='headerInfo'> <span>实际上传数量</span> <p>{endCount}</p> <em/> </div> </Col> <Col span={6}> <div className='headerInfo'> <span>完成进度</span> <p style={{padding: '0 20px'}}><Progress percent={(endCount / planCount) * 100} showInfo={false}/></p> <em/> </div> </Col> <Col span={6}> <div className='headerInfo'> <span>完成率</span> <p>{`${formatNumber((endCount / planCount) * 100, 2)}%`}</p> </div> </Col> </Row> </Card> ) } renderAsin() { const {visible, currentPlanItemID, currentPlan, currentShopType} = this.state.asinDrawerProps; const {asinList} = this.props[modelNameSpace]; const codeList = this.getCodeList(currentShopType); const gridStyle = { width: '33.33%', textAlign: 'center', height: 80, lineHeight: '36px', }; return ( <Drawer title='ASIN列表' width={1100} style={{width: 1100}} placement="right" closable={false} onClose={e => this.setState({asinDrawerProps: {visible: false}})} visible={visible} > <div style={{marginBottom: 16}}> <Button type='primary' icon='retweet' onClick={e => this.getAsinList(currentPlanItemID)}>刷新</Button> </div> {this.renderAsinHeader()} <Tabs type='card' activeKey={currentShopType} onChange={currentShopType => this.setState({ asinDrawerProps: { ...this.state.asinDrawerProps, currentShopType } })} > <TabPane key='amazon' tab={<div>amazon <Badge count={this.getShopTypeAsinCount('amazon')}/></div>}/> <TabPane key='ebay' tab={<div>ebay <Badge count={this.getShopTypeAsinCount('ebay')}/></div>}/> <TabPane key='cdiscount' tab={<div>cdiscount <Badge count={this.getShopTypeAsinCount('cdiscount')}/></div>}/> <TabPane key='wish' tab={<div>wish <Badge count={this.getShopTypeAsinCount('wish')}/></div>}/> <TabPane key='shopee' tab={<div>shopee <Badge count={this.getShopTypeAsinCount('shopee')}/></div>}/> </Tabs> <Collapse accordion> {codeList.map(code => { return ( <Collapse.Panel header={<div>{code.name} <Badge count={asinList.filter(_ => _.code === code.code).length}/></div>} key={code.code}> <div> { currentPlan.isEnd === 0 ? <Card.Grid style={gridStyle} className={style.asinItem}> {this.state.addAsinVisible && this.state.currentAddAsinCode === code.code ? <div> <Input value={this.state.currentAddAsinValue} style={{width: 160}} onChange={e => this.setState({currentAddAsinValue: e.target.value})}/> <Button icon='save' type='primary' style={{marginLeft: 5}} onClick={e => this.addAsin(code.code)}/> <Button icon='reload' type='danger' ghost style={{marginLeft: 5}} onClick={e => this.setState({addAsinVisible: false, currentAddAsinValue: null})}/> </div> : <div className={style.addAsin} onClick={e => this.setState({ editModal: { isAdd: true, visible: true, currentAsin: {}, currentAddAsinCode: code.code } })} style={{cursor: 'pointer'}}> <Icon type='plus'/>点击添加新的ASIN </div>} </Card.Grid> : null } {asinList.filter(_ => _.code === code.code).map((x, index) => { if (currentPlan.isEnd === 1) { return ( <Card.Grid style={gridStyle} className={style.asinItem}> <div className={style.asinDiv}> {x.P_ASIN ? <Icon type='check-circle'/> : null} <a className={style.asinHref} href={`https://${code.url}${x.ASIN}`} target='_blank'>{x.P_ASIN ? x.P_ASIN : x.ASIN}</a> </div> </Card.Grid> ) } return ( <Card.Grid style={gridStyle} className={style.asinItem}> <div className={style.asinDiv}> {x.edit ? <div> <Input value={x.ASIN} style={{width: 160}} onChange={e => this.editAsin(x.id, e.target.value)}/> <Button icon='save' type='primary' style={{marginLeft: 5}} onClick={e => this.saveEditAsin(x.id)}/> <Button icon='reload' type='danger' ghost style={{marginLeft: 5}} onClick={e => this.cancelAsinEdit(x.id)}/> </div> : <div> {x.P_ASIN ? <Icon type='check-circle'/> : null} <a className={style.asinHref} href={`https://${code.url}${x.ASIN}`} target='_blank'>{x.P_ASIN ? x.P_ASIN : x.ASIN}</a> <Button className={style.btn} icon='edit' type='primary' style={{marginLeft: 5}} onClick={e => this.setState({ editModal: { isAdd: false, visible: true, currentAsin: x, currentAddAsinCode: code.code } })}/> <Button className={style.btn} icon='delete' type='danger' ghost style={{marginLeft: 5}} onClick={e => this.removeAsin(x.id)}/> <Dropdown overlay={ <Menu onClick={e => this.moveAsin(x.id, e.key)}> {codeList.map(i => { if (x.code === i.code) { return null; } return ( <Menu.Item key={i.code}>{i.name}</Menu.Item> ) })} </Menu> } trigger={['click']}> <a href="#" style={{marginLeft: 5}}> 移动至<Icon type="down"/> </a> </Dropdown> </div>} </div> </Card.Grid> ) })} <div style={{clear: 'both'}}></div> </div> </Collapse.Panel> ) })} </Collapse> </Drawer> ) } renderList() { const {loading, model} = this.props; const {data: {list}} = this.props[modelNameSpace]; const columns = [ { title: '部门', dataIndex: 'depID', render: (text) => { return formatter.department[text]; } }, { title: '任务周期', dataIndex: 'cycle', render: (text, row) => { return ( <div> <span>{Format.Date.Format(row.startDate, 'YYYY-MM-DD')}</span> <span style={{width: 40, display: 'inline-block', textAlign: 'center'}}>-</span> <span>{Format.Date.Format(row.endDate, 'YYYY-MM-DD')}</span> </div> ) } }, { title: '任务数量', dataIndex: 'count', }, { title: '完成数量', dataIndex: 'endCount', }, { title: '完成进度', dataIndex: 'progress', width: 300, render: (text, row) => { const percent = (row.endCount / row.count) * 100; return (<Progress percent={percent} showInfo={false}/>) } }, { title: '完成比率', dataIndex: 'percent', width: 150, render: (text, row) => { const percent = formatNumber((row.endCount / row.count) * 100, 2); return `${percent}%`; } }, { title: '任务状态', dataIndex: 'status', render: (text, row) => { const obj = {}; if (moment(row.endDate).isBefore(moment().startOf('week'))) { obj.text = '已结束'; obj.status = 'default'; } else { obj.text = "进行中"; obj.status = "processing"; } return (<Badge text={obj.text} status={obj.status}/>); } }, { title: '操作', dataIndex: 'op', render: (text, row, index) => { const action = [ { label: 'ASIN列表', submit: () => { this.openAsinDrawer(row.id, row.planID, row); } } ]; return (<TableActionBar action={action}/>) } }, ]; return ( <StandardTable rowKey={record => record.id} columns={columns} dataSource={list} loading={loading.effects[`${modelNameSpace}/get`]} bordered /> ) } render() { const {pagination, loading, model} = this.props; const {data: {total}, pageIndex} = this.props[modelNameSpace]; const actions = [ { button: { icon: "right", type: 'primary', text: '铺货ASIN管理', onClick: () => { model.push('/shop/grounding/task?tag=asin&key=download'); } }, }, { button: { icon: "retweet", type: 'primary', text: '刷新', ghost: true, onClick: () => { this.getList(); } }, }, ]; const startDay = moment().startOf('week'); const endDay = moment().endOf('week'); const fxLayoutProps = { header: { title: `我的铺货任务----当前周期(${startDay.format('YYYY-MM-DD')} - ${endDay.format('YYYY-MM-DD')})`, actions, titleStyle: {padding: '24px 0px'}, }, footer: { pagination: pagination({pageIndex, total}, this.getList), }, body: { center: this.renderList(), }, }; return ( <div> {this.state.tag === 'asin' ? <Asin role='employee'/> : <div> <FxLayout {...fxLayoutProps} /> {this.state.asinDrawerProps.visible ? this.renderAsin() : null} {this.state.editModal.visible ? this.renderEditModal() : null} </div> } </div> ) } }
29.146953
119
0.446098
688a32f70f4ab0f8901f70b0fd9c1a996beff778
54,728
js
JavaScript
step3/backend/static/main.js
JunilHwang/black-coffee-study-lv3
8797240dc4c10bed4230520deac6da1e7fb8e3ef
[ "MIT" ]
2
2021-08-03T13:16:59.000Z
2021-09-23T17:21:09.000Z
step3/backend/static/main.js
JunilHwang/black-coffee-study-lv3
8797240dc4c10bed4230520deac6da1e7fb8e3ef
[ "MIT" ]
null
null
null
step3/backend/static/main.js
JunilHwang/black-coffee-study-lv3
8797240dc4c10bed4230520deac6da1e7fb8e3ef
[ "MIT" ]
null
null
null
/*! For license information please see main.js.LICENSE.txt */ (()=>{"use strict";var e={7459:(e,t,n)=>{e.exports=n.p+"3677884233af83d1fea3.png"},5860:(e,t,n)=>{n.r(t)},3922:(e,t,n)=>{n.r(t)},5284:(e,t,n)=>{n.r(t)},9287:(e,t,n)=>{n.r(t)},5859:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.HttpMethod=void 0,(n=t.HttpMethod||(t.HttpMethod={})).GET="GET",n.POST="POST",n.PUT="PUT",n.PATCH="PATCH",n.DELETE="DELETE"},2544:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.HttpStatus=void 0,(n=t.HttpStatus||(t.HttpStatus={}))[n.OK=200]="OK",n[n.CREATED=201]="CREATED",n[n.NO_CONTENT=204]="NO_CONTENT",n[n.BAD_REQUEST=400]="BAD_REQUEST",n[n.UNAUTHORIZED=401]="UNAUTHORIZED",n[n.FORBIDDEN=403]="FORBIDDEN",n[n.NOT_FOUND=404]="NOT_FOUND",n[n.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR"},3374:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(5859),t),a.__exportStar(n(2544),t)},4342:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.App=void 0;const a=n(9312),i=n(9915),o=n(1881),s=a.__importDefault(n(7459)),r=n(3198),l=n(4466);class c extends i.Component{get NoAuth(){return`\n <main class="mt-10 d-flex justify-center">\n <div class="d-flex flex-col">\n <div class="d-flex justify-center">\n <img src="${s.default}" alt="로그인이 필요합니다." width="200" />\n </div>\n <p class="mt-0 text-center">\n 지하철 노선도 앱을 사용하기 위해서는 로그인이 필요합니다.\n </p>\n </div>\n </main>\n `}setup(){r.authStore.dispatch(r.LOAD_AUTHENTICATION)}template(){return'\n <div class="d-flex justify-center mt-5 w-100">\n <div class="w-100">\n <header class="my-4" data-component="Header"></header>\n <div data-component="RouterView"></div>\n </div>\n </div>\n '}initChildComponent(e,t){return"Header"===t?new o.Header(e):"RouterView"===t?new l.RouterView(e):void 0}}t.App=c},4159:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Inject=t.Injectable=t.instanceOf=t.container=void 0;const n=new WeakMap,a=new WeakMap;t.container=new WeakMap,t.instanceOf=function e(n){const i=t.container.get(n);if(i)return i;const o=new n(...(a.get(n)||[]).map(e));return t.container.set(n,o),o},t.Injectable=function(e){n.set(e,a.get(e))},t.Inject=function(e){return function(t,n,i){const o=a.get(t)||[];o&&(o[i]=e),a.set(t,o)}}},1453:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Component=void 0;const a=n(9915),i=n(1782);class o{$target;$props;static eventMap=[];$state={};$components={};constructor(e,t={}){this.$target=e,this.$props=t,this.lifeCycle()}async lifeCycle(){await this.setup(),this.$state=a.observable(this.$state),a.observe((()=>this.render())),this.mounted()}setup(){}mounted(){}updated(){}initChildComponent(e,t){}setEvent(){}addEvent(e,t,n){const{constructor:a}=Object.getPrototypeOf(this);i.selectAll(t,this.$target).forEach((t=>{const i=o.eventMap.find((i=>i.el===t&&i.eventType===e&&i.callback.toString()===n.toString()&&i.constructor===a));i&&(t.removeEventListener(e,i.callback),o.eventMap.splice(o.eventMap.indexOf(i),1)),t.addEventListener(e,n),o.eventMap.push({el:t,eventType:e,constructor:a,callback:n})}))}render(){this.$components={};const e=this.$target.cloneNode(!0);e.innerHTML=this.template().trim(),a.applyDomDiff(this.$target,e),this.$target.querySelectorAll("[data-component]").forEach((e=>this.setupChildComponent(e))),this.setEvent(),this.updated()}setupChildComponent(e){if(!(e instanceof HTMLElement))return;if(!this.initChildComponent)return;const t=e.dataset.component,n=this.initChildComponent(e,t);if(!n)return;const{$components:a}=this;a[t]?a[t]instanceof o?a[t]=[a[t],n]:Array.isArray(a[t])&&a[t].push(n):a[t]=n}}t.Component=o},73:(e,t)=>{function n(e,t,a){if(t instanceof Text&&a instanceof Text&&t.nodeValue!==a.nodeValue)return void(t.nodeValue=a.nodeValue);if(t&&!a)return t.remove();if(!t&&a)return void e.appendChild(a);if(typeof t!=typeof a||t.nodeName!==a.nodeName)return e.removeChild(t),void e.appendChild(a);t instanceof Text||a instanceof Text||function(e,t){for(const{name:n,value:a}of[...e.attributes]){const i=t.getAttribute(n);a!==i&&(i?e.setAttribute(n,i):e.removeAttribute(n))}for(const{name:n,value:a}of[...t.attributes])e.getAttribute(n)||e.setAttribute(n,a)}(t,a);const i=[...t.childNodes],o=[...a.childNodes];Array(Math.max(i.length,o.length)).fill(0).forEach(((e,a)=>n(t,i[a],o[a])))}Object.defineProperty(t,"__esModule",{value:!0}),t.applyDomDiff=void 0,t.applyDomDiff=function(e,t){const a=[...e.childNodes],i=[...t.childNodes];Array(Math.max(a.length,i.length)).fill(0).forEach(((t,o)=>n(e,a[o],i[o])))}},6967:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observable=t.observe=void 0;const a=n(1782);let i=null;t.observe=function(e){i=a.debounce(e),e(),i=null},t.observable=function(e){return e instanceof Object?(Object.entries(e).forEach((([t,n])=>{const a=new Set;let o=n;Object.defineProperty(e,t,{get:()=>(a.add(i),o),set(e){JSON.stringify(o)!==JSON.stringify(e)&&(o=e,a.forEach((e=>e?.())))}})})),e):e}},5054:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0,t.Repository=class{key;storage;constructor(e,t=localStorage){this.key=e,this.storage=t}get(){return JSON.parse(this.storage.getItem(this.key)||"null")}set(e){this.storage.setItem(this.key,JSON.stringify(e))}clear(){this.storage.removeItem(this.key)}}},4770:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RestClient=void 0;const a=n(3374);t.RestClient=class{baseUrl;responseInterceptors=new Set;requestInterceptors=new Set;constructor(e){this.baseUrl=e}getResponse=e=>{if(![a.HttpStatus.CREATED,a.HttpStatus.NO_CONTENT].includes(e.status))return e.json().then((t=>{if(e.status>=400)throw new Error(t.message);let n=t;for(const e of this.responseInterceptors)n=e(n);return n}))};getRequest(e){let t=e;for(const e of this.requestInterceptors)t=e(t);return t}request(e,t){const n=new URL(`.${t}`,this.baseUrl);return fetch(n.href,this.getRequest({method:e})).then(this.getResponse)}requestWithBody(e,t,n){const a=new URL(`.${t}`,this.baseUrl);return fetch(a.href,this.getRequest({method:e,body:JSON.stringify(n),headers:{"content-type":"application/json"}})).then(this.getResponse)}get(e){return this.request(a.HttpMethod.GET,e)}post(e,t){return this.requestWithBody(a.HttpMethod.POST,e,t)}patch(e,t){return this.requestWithBody(a.HttpMethod.PATCH,e,t)}put(e,t){return this.requestWithBody(a.HttpMethod.PUT,e,t)}delete(e){return this.request(a.HttpMethod.DELETE,e)}addRequestInterceptor(e){this.requestInterceptors.add(e)}addResponseInterceptor(e){this.responseInterceptors.add(e)}}},1130:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Router=void 0;const a=n(9915);t.Router=class{baseUrl;routes;hash;selectedRoute=a.observable({value:"/"});beforeUpdate=new Set;constructor({baseUrl:e="/",routes:t={},hash:n=!0}){this.baseUrl=e,this.routes=t,this.hash=n}setup(){this.updateRoute(),window.addEventListener("popstate",(()=>this.updateRoute()))}updateRoute(){requestAnimationFrame((()=>{const{routes:e,selectedRoute:t,path:n}=this;this.beforeUpdate.forEach((e=>e()));const a=Object.keys(e).find((e=>new RegExp(`^${e.replace(/:\w+/gi,"\\w+").replace(/\//,"\\/")}$`,"g").test(n)));a&&(t.value=a)}))}get route(){return this.routes[this.selectedRoute.value]||"NotFound"}get path(){const e=(this.hash?location.hash.replace("#!",""):location.pathname)||"/",t=new RegExp(`^${this.baseUrl}/?`);return e.replace(t,"/")}get params(){const{selectedRoute:e,path:t}=this;if(!e)return{};const n=[...e.value.matchAll(/:(\w+)/g)].map((e=>e[1])),a=t.split("/"),i=e.value.split("/");return n.reduce(((e,t)=>{const n=i.findIndex((e=>t===`/:${e}`));return e[t]=a[n],e}),{})}push(e){const{hash:t,baseUrl:n}=this,a=`${n.replace(/^\/?/,"/").replace(/\/$/,"")}/${e.replace(location.origin,"").replace(/^\/?/,"")}`;t?location.hash=`#!${a}`:(history.pushState(null,document.title,a),this.updateRoute())}beforeRouterUpdate(e){this.beforeUpdate.add(e)}}},2181:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Store=void 0;const a=n(9915);t.Store=class{$state;getters;mutations;actions;constructor({state:e,getters:t={},mutations:n={},actions:i={}}){this.$state=a.observable(e),this.mutations=n,this.actions=i,this.getters=Object.keys(t).reduce(((e,n)=>(Object.defineProperty(e,n,{get:()=>t[n](this.$state)}),e)),{})}commit(e,t){this.mutations[e](this.$state,t)}dispatch(e,...t){return this.actions[e]({state:Object.freeze(this.$state),commit:this.commit.bind(this),dispatch:this.dispatch.bind(this)},...t)}}},9915:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(4159),t),a.__exportStar(n(1453),t),a.__exportStar(n(2181),t),a.__exportStar(n(6967),t),a.__exportStar(n(5054),t),a.__exportStar(n(4770),t),a.__exportStar(n(1130),t),a.__exportStar(n(73),t)},8205:(e,t,n)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.SubwayClient=void 0;const i=n(9312),o=n(9915),s=n(2714);let r=class extends o.RestClient{authRepository;constructor(e){super(`${location.origin}/api/`),this.authRepository=e,this.addRequestInterceptor((t=>{const n=e.get();return n?{...t,headers:{...t.headers||{},Authorization:`Bearer ${n.token}`}}:t}))}};r=i.__decorate([o.Injectable,i.__param(0,o.Inject(s.AuthRepository)),i.__metadata("design:paramtypes",["function"==typeof(a=void 0!==s.AuthRepository&&s.AuthRepository)?a:Object])],r),t.SubwayClient=r},9867:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(9312).__exportStar(n(8205),t)},1881:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Header=void 0;const a=n(9915),i=n(3198),o=n(4466);class s extends a.Component{template(){return` \n <a href="/" class="text-black" data-component="RouterLink">\n <h1 class="text-center font-bold">🚇 지하철 노선도</h1>\n </a>\n <nav class="d-flex justify-center flex-wrap">\n ${i.authStore.$state.authentication ? '\n <a href="/stations" class="my-1" data-component="RouterLink">\n <button class="btn bg-white shadow mx-1">🚉 역 관리</button>\n </a>\n <a href="/lines" class="my-1" data-component="RouterLink">\n <span class="btn bg-white shadow mx-1">🛤️ 노선 관리</span>\n </a>\n <a href="/sections" class="my-1" data-component="RouterLink">\n <span class="btn bg-white shadow mx-1">🔁 구간 관리</span>\n </a>\n <a href="#" class="my-1 logout">\n <span class="btn bg-white shadow mx-1">🔗 로그아웃</span>\n </a>\n ' : '\n <a href="/login" class="my-1" data-component="RouterLink">\n <span class="btn bg-white shadow mx-1">👤 로그인</span>\n </a>\n '}\n </nav>\n `}initChildComponent(e, t){if("RouterLink"===t)return new o.RouterLink(e)}setEvent(){this.addEvent("click",".logout",(e=>{e.preventDefault(),alert("로그아웃 되었습니다."),o.router.push("/login"),i.authStore.dispatch(i.SIGN_OUT)}))}}t.Header=s},6215:(e, t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.colorOptions=void 0,t.colorOptions=["gray-300","gray-400","gray-500","gray-600","gray-700","gray-800","gray-900","red-300","red-400","red-500","red-600","red-700","red-800","red-900","orange-300","orange-400","orange-500","orange-600","orange-700","orange-800","orange-900","yellow-300","yellow-400","yellow-500","yellow-600","yellow-700","yellow-800","yellow-900","green-300","green-400","green-500","green-600","green-700","green-800","green-900","teal-300","teal-400","teal-500","teal-600","teal-700","teal-800","teal-900","blue-300","blue-400","blue-500","blue-600","blue-700","blue-800","blue-900","indigo-300","indigo-400","indigo-500","indigo-600","indigo-700","indigo-800","indigo-900","purple-300","purple-400","purple-500","purple-600","purple-700","purple-800","purple-900","pink-300","pink-400","pink-500","pink-600","pink-700","pink-800","pink-900"]},9130:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinesPage=void 0,n(5284);const a=n(9915),i=n(3198),o=n(2121);class s extends a.Component{setup(){i.lineStore.dispatch(i.GET_LINES),i.stationStore.dispatch(i.GET_STATIONS)}template(){const{lines:e}=i.lineStore.$state;return`\n <div class="wrapper bg-white p-10">\n <div class="heading d-flex">\n <h2 class="mt-1 w-100">🛤️ 노선 관리</h2>\n <button type="button" class="create-line-btn modal-trigger-btn bg-cyan-300 ml-2 edit-line">\n 노선 추가\n </button>\n </div>\n ${e.length>0?`\n <ul class="mt-3 pl-0">\n ${e.map((({idx:e,name:t}, n)=>`\n <li style="list-style: none" data-idx="${e}" data-key="${n}" data-component="LineItem"></li>\n `)).join("")}\n </ul>\n `:"\n <div>등록된 노선이 없습니다. 노선을 추가해주세요.</div>\n "}\n </div>\n <div data-component="LineEditModal"></div>\n `}initChildComponent(e, t){if("LineItem"===t){const t=i.lineStore.$state.lines[Number(e.dataset.key)];return new o.LineItem(e,{name:t.name,color:t.color,editLine:()=>this.$modal.open(t),removeLine:()=>this.removeLine(t)})}if("LineEditModal"===t)return new o.LineEditModal(e,{stations:i.stationStore.$state.stations,addLine:this.addLine.bind(this),updateLine:this.updateLine.bind(this)})}get $modal(){return this.$components.LineEditModal}async addLine(e){try{this.validateLineName(e.name)}catch(e){return alert(e)}try{await i.lineStore.dispatch(i.ADD_LINE,e),alert("노선이 추가되었습니다.")}catch(e){alert(e.message)}}async updateLine(e){try{this.validateLineName(e.name)}catch(e){return alert(e)}try{await i.lineStore.dispatch(i.UPDATE_LINE,e),alert("노선이 수정되었습니다.")}catch(e){alert(e.message)}}async removeLine(e){try{await i.lineStore.dispatch(i.REMOVE_LINE,e),alert("노선이 삭제되었습니다.")}catch(e){alert(e.message)}}validateLineName(e){if(e.length<2)throw"노선의 이름은 2글자 이상으로 입력해주세요.";if(e.length>=10)throw"노선의 이름은 10글자 이하로 입력해주세요."}setEvent(){this.addEvent("click",".edit-line",(e=>{this.$modal.open()}))}}t.LinesPage=s},49:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LoginPage=void 0;const a=n(9915),i=n(1782),o=n(3198),s=n(4466);n(3922);class r extends a.Component{template(){return'\n <div class="wrapper p-10 bg-white auth">\n <div class="heading">\n <h2>👋🏼 로그인</h2>\n </div>\n <form name="login" class="form">\n <div class="input-control">\n <label for="email" class="input-label" hidden>이메일</label>\n <input\n type="email"\n id="email"\n name="email"\n class="input-field"\n placeholder="이메일"\n required\n />\n </div>\n <div class="input-control">\n <label for="password" class="input-label" hidden\n >비밀번호</label\n >\n <input\n type="password"\n id="password"\n name="password"\n class="input-field"\n placeholder="비밀번호"\n />\n </div>\n <div class="input-control w-100">\n <button\n type="submit"\n class="input-submit w-100 bg-cyan-300"\n >\n 확인\n </button>\n </div>\n <p class="text-gray-700 pl-2">\n 아직 회원이 아니신가요?\n <a href="/signup" data-component="RouterLink">회원가입</a>\n </p>\n </form>\n </div>\n '}initChildComponent(e, t){if("RouterLink"===t)return new s.RouterLink(e)}setEvent(){this.addEvent("submit","form",(async e=>{e.preventDefault();const t=i.parseFormData(e.target);try{await o.authStore.dispatch(o.SIGN_IN,t),alert("로그인이 완료되었습니다."),s.router.push("/stations")}catch(e){console.log(e),alert(e.message)}}))}}t.LoginPage=r},3956:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MyPage=void 0;const a=n(9915),i=n(1782),o=n(3198);class s extends a.Component{template(){const{authentication:e}=o.authStore.$state;return null===e?"":`\n <div class="wrapper p-10 bg-white auth">\n <div class="heading">\n <h2 class="text">📝 마이페이지</h2>\n </div>\n <form name="login" class="form">\n \n <div class="input-control">\n <label for="email" class="input-label" hidden>이메일</label>\n <input\n type="email"\n id="email"\n name="email"\n class="input-field"\n placeholder="이메일"\n value="${e.email}"\n required\n />\n </div>\n \n <div class="input-control">\n <label for="name" class="input-label" hidden>이름</label>\n <input\n type="text"\n id="name"\n name="name"\n class="input-field"\n placeholder="이름"\n value="${e.name}"\n required\n />\n </div>\n \n <div class="input-control">\n <button type="submit" name="submit" class="input-submit w-100 bg-cyan-300">\n 확인\n </button>\n </div>\n </form>\n </div>\n `}setEvent(){this.addEvent("submit","form",(e=>{e.preventDefault();const t=e.target,n=i.parseFormData(t);try{o.authStore.dispatch(o.UPDATE_USER,{...n,idx:o.authStore.$state.authentication.idx}),alert("회원정보가 수정되었습니다.")}catch(e){console.error(e),alert(e.message)}}))}}t.MyPage=s},5845:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SectionsPage=void 0,n(9287);const a=n(9915),i=n(7065),o=n(2510),s=n(3198),r=n(367);class l extends a.Component{setup(){this.$state={selectedLineIdx:-1,line:null},s.lineStore.dispatch(s.GET_LINES),s.stationStore.dispatch(s.GET_STATIONS)}get selectedLine(){const{selectedLineIdx:e}=this.$state,{lines:t}=s.lineStore.$state;return t.find((t=>t.idx===e))||null}get selectedColor(){const{selectedLine:e}=this;return e?.color||"bg-400"}get stations(){return this.$state.line?.stations||[]}get lineIdx(){return this.$state.line?.idx}template(){const{selectedColor:e,selectedLine:t,stations:n}=this,{selectedLineIdx:a}=this.$state,{lines:i}=s.lineStore.$state;return`\n <div class="wrapper bg-white p-10">\n <div class="heading d-flex">\n <h2 class="mt-1 w-100">🔁 구간 관리</h2>\n <button type="button" class="create-section-btn modal-trigger-btn bg-cyan-300 ml-2">\n 구간 추가\n </button>\n </div>\n <form class="d-flex items-center pl-1">\n <label for="subway-line" class="input-label" hidden>노선</label>\n <select id="subway-line" class="bg-${e} lineSelector">\n ${0===i.length?"\n <option hidden disabled selected>노선을 추가해주세요</option>\n ":`\n <option value="-1" ${null===t?"selected":""} hidden disabled>노선 선택</option>\n ${i.map((({idx:e,name:t})=>`\n <option value="${e}" ${a===e?"selected":""}>${t}</option>\n `)).join("")}\n `}\n </select>\n </form>\n ${0===n.length?'\n <div style="text-align: center; padding: 20px 0; background: #f5f5f5; border-radius: 5px; margin-top: 10px;">\n 구간을 추가해주세요\n </div>\n ':`\n <ul class="mt-3 pl-0">\n ${n.map(((e, t)=>`\n <li style="list-style: none;" data-component="SectionItem" data-key="${t}" data-idx="${e.idx}"></li> \n `)).join("")}\n </ul>\n `}\n </div>\n <div data-component="SectionEditorModal"></div>\n `}get $modal(){return this.$components.SectionEditorModal}initChildComponent(e, t){if("SectionEditorModal"===t)return new i.SectionEditorModal(e,{lines:s.lineStore.$state.lines,stations:s.stationStore.$state.stations,addSection:this.addSection.bind(this)});if("SectionItem"===t){const t=this.stations[Number(e.dataset.key)];return new o.SectionItem(e,{name:t.name,removeSection:()=>this.removeSection(t.idx)})}}async getLine(e=this.lineIdx){this.$state.line=await r.lineService.getLine(e)}async addSection(e){try{await r.lineService.addLineSection(this.lineIdx,e),alert("구간이 추가되었습니다."),this.$modal.close(),await this.getLine()}catch(e){alert(e.message)}}async removeSection(e){try{await r.lineService.removeSection(this.lineIdx,e),alert("구간이 삭제되었습니다."),await this.getLine()}catch(e){alert(e.message)}}setEvent(){this.addEvent("click",".modal-trigger-btn",(()=>{this.$modal.open()})),this.addEvent("change",".lineSelector",(e=>{const t=e.target,n=Number(t.value);this.$state.selectedLineIdx=n,this.getLine(n)}))}}t.SectionsPage=l},5675:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SignUpPage=void 0;const a=n(9915),i=n(367),o=n(1782),s=n(4466);class r extends a.Component{template(){return'\n <div class="wrapper p-10 bg-white auth">\n <div class="heading">\n <h2 class="text">📝 회원가입</h2>\n </div>\n <form name="login" class="form">\n <div class="input-control">\n <label for="email" class="input-label" hidden>이메일</label>\n <input\n type="email"\n id="email"\n name="email"\n class="input-field"\n placeholder="이메일"\n required\n />\n </div>\n <div class="input-control">\n <label for="name" class="input-label" hidden>이름</label>\n <input\n type="text"\n id="name"\n name="name"\n class="input-field"\n placeholder="이름"\n required\n />\n </div>\n <div class="input-control">\n <label for="password" class="input-label" hidden\n >비밀번호</label\n >\n <input\n type="password"\n id="password"\n name="password"\n class="input-field"\n placeholder="비밀번호"\n />\n </div>\n <div class="input-control">\n <label for="password-confirm" class="input-label" hidden\n >비밀번호 확인</label\n >\n <input\n type="password"\n id="password-confirm"\n name="repeatPassword"\n class="input-field"\n placeholder="비밀번호 확인"\n />\n </div>\n <div class="input-control">\n <button\n type="submit"\n name="submit"\n class="input-submit w-100 bg-cyan-300"\n >\n 확인\n </button>\n </div>\n </form>\n </div>\n '}setEvent(){this.addEvent("submit","form",(async e=>{e.preventDefault();const t=e.target,n=o.parseFormData(t);if(n.password!==n.repeatPassword)return alert("비밀번호 확인이 일치하지 않습니다.");try{await i.authService.signup(n),alert("회원가입이 완료되었습니다."),s.router.push("/login")}catch(e){alert(e.message)}}))}}t.SignUpPage=r},4026:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StationsPage=void 0;const a=n(9915),i=n(5428),o=n(3198);class s extends a.Component{setup(){o.stationStore.dispatch(o.GET_STATIONS)}template(){const{stations:e}=o.stationStore.$state;return`\n <div class="wrapper bg-white p-10">\n <div class="heading">\n <h2 class="mt-1">🚉 역 관리</h2>\n </div>\n <div data-component="StationAppender"></div>\n ${e.length>0?`\n <ul class="mt-3 pl-0" data-component="StationItems">\n ${e.map((({idx:e,name:t}, n)=>`\n <li style="list-style: none" data-idx="${e}" data-key="${n}" data-component="StationItem"></li>\n `)).join("")}\n </ul>\n `:'\n <div style="padding: 20px 0; text-align: center;">등록된 역이 없습니다. 역을 추가해주세요.</div> \n '}\n </div>\n <div data-component="StationUpdateModal"></div>\n `}initChildComponent(e, t){if("StationAppender"===t)return new i.StationAppender(e,{addStation:this.addStation.bind(this)});if("StationUpdateModal"===t)return new i.StationUpdateModal(e,{update:this.updateStation.bind(this)});if("StationItem"===t){const t=o.stationStore.$state.stations[Number(e.dataset.key)];return new i.StationItem(e,{name:t.name,editStation:()=>this.$modal.open(t),removeStation:()=>this.removeStation(t)})}}get $modal(){return this.$components.StationUpdateModal}async addStation(e){try{this.validateStationName(e)}catch(e){return alert(e)}try{await o.stationStore.dispatch(o.ADD_STATION,e),alert("역이 추가되었습니다.")}catch(e){alert(e.message)}}async updateStation(e){try{this.validateStationName(e.name)}catch(e){return alert(e)}try{await o.stationStore.dispatch(o.UPDATE_STATION,e),alert("역이 수정되었습니다."),this.$modal.close()}catch(e){alert(e.message)}}async removeStation(e){try{await o.stationStore.dispatch(o.REMOVE_STATION,e),alert("역이 삭제되었습니다.")}catch(e){alert(e.message)}}validateStationName(e){if(e.length<2)throw"역의 이름은 2글자 이상으로 입력해주세요.";if(e.length>=20)throw"역의 이름은 20글자 이하로 입력해주세요."}}t.StationsPage=s},1938:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(4026),t),a.__exportStar(n(5845),t),a.__exportStar(n(9130),t),a.__exportStar(n(49),t),a.__exportStar(n(5675),t),a.__exportStar(n(3956),t)},8931:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LineEditModal=void 0;const a=n(9915),i=n(6215),o=n(1782),s={name:"",color:"",upStation:0,downStation:0,distance:0,duration:0};class r extends a.Component{setup(){this.$state={visible:!1,formData:{...s}}}get lineColors(){return i.colorOptions.map(((e, t)=>`\n <button type="button" class="color-option bg-${e}" data-color="${e}"></button>\n ${(t+1)%7==0?"<br/>":""}\n `)).join("")}template(){const{visible:e,formData:t}=this.$state,{stations:n}=this.$props;return e?`\n <div class="modal open">\n <div class="modal-inner p-8">\n \n <button class="modal-close">\n <svg viewbox="0 0 40 40">\n <path class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30" />\n </svg>\n </button>\n \n <header>\n <h2 class="text-center">🛤️ 노선 추가</h2>\n </header>\n \n <form class="lineAppender">\n \n <div class="input-control">\n <label for="subway-line-name" class="input-label" hidden>노선 이름</label>\n <input\n type="text"\n id="subway-line-name"\n name="name"\n class="input-field"\n placeholder="노선 이름"\n value="${t.name||""}"\n required\n />\n </div>\n \n ${void 0===t.idx?`\n <div class="d-flex items-center input-control">\n <label for="up-station" class="input-label" hidden>상행역</label>\n <select id="up-station" name="upStation" class="mr-2" required>\n <option value="" disabled hidden selected>상행역</option>\n ${n.map((({name:e,idx:n})=>`\n <option value="${n}" ${t?.upStation===n?" selected":""}>${e}</option>\n `))}\n </select>\n <label for="down-station" class="input-label" hidden>하행역</label>\n <select id="down-station" name="downStation" required>\n <option value="" disabled hidden selected>하행역</option>\n ${n.map((({name:e,idx:n})=>`\n <option value="${n}" ${t?.downStation===n?" selected":""}>${e}</option>\n `))}\n </select>\n </div>\n \n <div class="input-control">\n <label for="distance" class="input-label" hidden>상행 하행역 거리</label>\n <input\n type="number"\n id="distance"\n name="distance"\n class="input-field mr-2"\n placeholder="상행 하행역 거리"\n value="${t.distance}"\n required\n />\n <label for="duration" class="input-label" hidden>상행 하행역 시간</label>\n <input\n type="number"\n id="duration"\n name="duration"\n class="input-field"\n placeholder="상행 하행역 시간"\n value="${t.duration}"\n required\n />\n </div>\n `:""}\n \n <div class="input-control">\n <div>\n <label for="subway-line-color" class="input-label" hidden>색상</label>\n <input\n type="text"\n id="subway-line-color"\n name="color"\n class="input-field"\n placeholder="색상을 아래에서 선택해주세요."\n value="${t.color}"\n disabled\n required\n />\n </div>\n </div>\n \n <div class="subway-line-color-selector px-2">\n ${this.lineColors}\n </div>\n \n <div class="d-flex justify-end mt-3">\n <button type="submit" name="submit" class="input-submit bg-cyan-300">\n 확인\n </button>\n </div>\n \n </form>\n \n </div>\n </div>\n `:'<div class="modal"></div>'}open(e){this.$state.visible=!0,this.$state.formData=e?{idx:e.idx,name:e.name,color:e.color}:{...s}}close(){this.$state.visible=!1}setEvent(){this.addEvent("click",".modal-close",(()=>this.close())),this.addEvent("click",".color-option",(({target:e})=>{o.selectOne("form",this.$target).color.value=e.dataset.color})),this.addEvent("submit",".lineAppender",(e=>{e.preventDefault();const t=e.target;if(0===t.color.value.trim().length)return alert("색상을 선택해주세요");t.color.disabled=!1;const n=Object.entries(o.parseFormData(t)).reduce(((e, [t,n])=>(e[t]=Number(n)||n,e)),{});n.idx=this.$state.formData.idx,void 0===n.idx?this.$props.addLine(n):this.$props.updateLine(n),t.color.disabled=!0}))}}t.LineEditModal=r},9839:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LineItem=void 0;const a=n(9915);class i extends a.Component{template(){const{name:e,color:t}=this.$props;return`\n <div class="d-flex items-center py-2 relative">\n <span class="subway-line-color-dot bg-${t}"></span>\n <span class="w-100 pl-6 subway-line-list-item-name">${e}</span>\n <button type="button" class="bg-gray-50 text-gray-500 text-sm mr-1 edit">\n 수정\n </button>\n <button type="button" class="bg-gray-50 text-gray-500 text-sm remove">\n 삭제\n </button>\n </div>\n <hr class="my-0" />\n `}setEvent(){this.addEvent("click",".edit",(()=>{this.$props.editLine()})),this.addEvent("click",".remove",(()=>{confirm("정말로 삭제하시겠습니까?")&&this.$props.removeLine()}))}}t.LineItem=i},2121:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(9839),t),a.__exportStar(n(8931),t)},8519:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SectionEditorModal=void 0;const a=n(9915),i=n(1782);class o extends a.Component{setup(){this.$state={visible:!1,selectedLineIdx:-1}}get selectedLine(){const{selectedLineIdx:e}=this.$state,{lines:t}=this.$props;return t.find((t=>t.idx===e))||null}template(){const{selectedLine:e}=this,{visible:t,selectedLineIdx:n}=this.$state,{lines:a,stations:i}=this.$props;return`\n <div class="modal ${t?"open":""}">\n <div class="modal-inner p-8">\n \n <button class="modal-close">\n <svg viewbox="0 0 40 40">\n <path class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30" />\n </svg>\n </button>\n \n <header>\n <h2 class="text-center">🔁 구간 추가</h2>\n </header>\n \n <form class="sectionAppender">\n \n <div class="input-control">\n <label for="subway-line-for-section" class="input-label" hidden>노선</label>\n <select id="subway-line-for-section" name="line" class="sectionAppenderLineSelector" required>\n <option value="" ${null===e?"selected":""} disabled hidden>노선 선택</option>\n ${a.map((({idx:e,name:t})=>`\n <option value="${e}" ${n===e?"selected":""}>${t}</option>\n `)).join("")}\n </select>\n </div>\n \n ${null===e?'\n <div style="text-align: center; margin: 10px 0;">\n 노선을 선택해주세요\n </div>\n ':`\n \n <div class="d-flex items-center input-control">\n \n <label for="up-station" class="input-label" hidden>상행역</label>\n <select id="up-station" name="upStation" required>\n <option value="" selected disabled hidden>상행역</option>\n ${i.map((({idx:e,name:t})=>`\n <option value="${e}">${t}</option>\n `)).join("")}\n </select>\n \n <div class="d-inline-block mx-3 text-2xl">➡️</div>\n \n <label for="down-station" class="input-label" hidden>하행역</label>\n <select id="down-station" name="downStation" required>\n <option value="" selected disabled hidden>하행역</option>\n ${i.map((({idx:e,name:t})=>`\n <option value="${e}">${t}</option>\n `)).join("")}\n </select>\n \n </div>\n `}\n \n <div class="d-flex justify-end mt-3">\n <button type="submit" name="submit" class="input-submit bg-cyan-300">\n 확인\n </button>\n </div>\n \n </form>\n \n </div>\n </div>\n `}open(){this.$state.visible=!0}close(){this.$state.visible=!1}setEvent(){this.addEvent("click",".modal-close",(()=>this.close())),this.addEvent("change",".sectionAppenderLineSelector",(e=>{const t=e.target;this.$state.selectedLineIdx=Number(t.value)})),this.addEvent("submit",".sectionAppender",(e=>{e.preventDefault();const t=e.target,n=Object.entries(i.parseFormData(t)).reduce(((e, [t,n])=>(e[t]=Number(n),e)),{});this.$props.addSection(n)}))}}t.SectionEditorModal=o},2510:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SectionItem=void 0;const a=n(9915);class i extends a.Component{template(){const{name:e}=this.$props;return`\n <div class="d-flex items-center py-2 relative">\n <span class="w-100 pl-6">${e}</span>\n <button type="button" class="bg-gray-50 text-gray-500 text-sm remove">\n 삭제\n </button>\n </div>\n <hr class="my-0" />\n `}setEvent(){this.addEvent("click",".remove",(()=>{confirm("정말로 삭제하시겠습니까?")&&this.$props.removeSection()}))}}t.SectionItem=i},7065:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(9312).__exportStar(n(8519),t)},1045:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StationAppender=void 0;const a=n(9915);class i extends a.Component{template(){return'\n <form class="addForm">\n <div class="d-flex w-100">\n <label for="station-name" class="input-label" hidden>\n 역 이름\n </label>\n <input\n type="text"\n id="station-name"\n name="stationName"\n class="input-field"\n placeholder="역 이름"\n required\n />\n <button type="submit" class="input-submit bg-cyan-300 ml-2">\n 확인\n </button>\n </div>\n </form>\n '}setEvent(){this.addEvent("submit",".addForm",(e=>{e.preventDefault();const t=e.target;this.$props.addStation(t.stationName.value)}))}}t.StationAppender=i},8375:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StationItem=void 0;const a=n(9915);class i extends a.Component{template(){return`\n <div class="station-list-item d-flex items-center py-2">\n <span class="w-100 pl-2">${this.$props.name}</span>\n <button type="button" class="bg-gray-50 text-gray-500 text-sm mr-1 update">\n 수정\n </button>\n <button type="button" class="bg-gray-50 text-gray-500 delete">\n 삭제\n </button> \n </div>\n <hr class="my-0" />\n `}setEvent(){this.addEvent("click",".update",(e=>{e.preventDefault(),this.$props.editStation()})),this.addEvent("click",".delete",(e=>{e.preventDefault(),confirm("정말로 삭제하시겠습니까?")&&this.$props.removeStation()}))}}t.StationItem=i},4385:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StationUpdateModal=void 0;const a=n(9915);class i extends a.Component{setup(){this.$state={visible:!1,formData:null}}template(){const{visible:e,formData:t}=this.$state;return`\n <div class="modal ${e?"open":""}">\n <div class="modal-inner p-8">\n <button class="modal-close">\n <svg viewbox="0 0 40 40">\n <path class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30" />\n </svg>\n </button>\n <header>\n <h2 class="text-center">🖋 역 이름 수정</h2>\n </header>\n <form class="updateForm">\n <div class="input-control">\n <label for="stationName" class="input-label" hidden>역 이름</label>\n <input\n type="text"\n id="updateStationName"\n name="stationName"\n class="input-field"\n placeholder="역 이름"\n value="${t?.name||""}"\n required\n />\n </div>\n <div class="d-flex justify-end mt-3">\n <button type="submit" name="submit" class="input-submit bg-cyan-300">\n 확인\n </button>\n </div>\n </form>\n </div>\n </div>\n `}open(e){this.$state.visible=!0,this.$state.formData=e}close(){this.$state.visible=!1}setEvent(){this.addEvent("click",".modal-close",(()=>this.close())),this.addEvent("submit",".updateForm",(e=>{e.preventDefault();const t=e.target;this.$props.update({...this.$state.formData,name:t.stationName.value})}))}}t.StationUpdateModal=i},5428:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(1045),t),a.__exportStar(n(4385),t),a.__exportStar(n(8375),t)},8396:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AuthRepository=void 0;const a=n(9312),i=n(9915);let o=class extends i.Repository{constructor(){super("AUTH_REPOSITORY")}};o=a.__decorate([i.Injectable,a.__metadata("design:paramtypes",[])],o),t.AuthRepository=o},2714:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),n(9312).__exportStar(n(8396),t)},9729:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RouterLink=void 0;const a=n(9915),i=n(4466);class o extends a.Component{setup(){this.checkSelect()}updated(){this.checkSelect()}template(){return i.router.route,this.$target.innerHTML}setEvent(){const e=this.$target;e.addEventListener("click",(t=>{t.preventDefault(),i.router.push(e.href)}))}checkSelect(){const e=this.$target,t=e.href.replace(location.origin,"");new RegExp(`^${t.replace(/:\w+/gi,"\\w+").replace(/\//,"\\/")}$`,"g").test(i.router.path)?e.classList.add("is-active-link"):e.classList.remove("is-active-link")}}t.RouterLink=o},9622:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RouterView=void 0;const a=n(9312),i=n(9915),o=n(4466),s=n(3198),r=a.__importStar(n(1938));class l extends i.Component{template(){const{route:e}=o.router;return"NotFound"===e?'\n <main class="mt-10 d-flex justify-center">\n 페이지를 찾을 수 없습니다. \n </main>\n ':`<main class="mt-10 d-flex justify-center" data-component="${o.router.route}"></main>`}mounted(){o.router.beforeRouterUpdate((()=>{["/login","/signup"].includes(o.router.path)||s.authStore.$state.authentication||(alert("지하철 노선도 앱을 사용하기 위해서는 로그인이 필요합니다."),o.router.push("/login"))})),o.router.setup()}initChildComponent(e, t){return new r[t](e)}}t.RouterView=l},4466:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.router=void 0;const a=n(9312),i=n(9915);t.router=new i.Router({routes:{"/stations":"StationsPage","/lines":"LinesPage","/sections":"SectionsPage","/login":"LoginPage","/signup":"SignUpPage","/mypage":"MyPage"},hash:!1}),a.__exportStar(n(9729),t),a.__exportStar(n(9622),t)},4013:(e, t, n)=>{var a,i;Object.defineProperty(t,"__esModule",{value:!0}),t.AuthService=void 0;const o=n(9312),s=n(9915),r=n(9867),l=n(2714);let c=class{restClient;authRepository;constructor(e, t){this.restClient=e,this.authRepository=t}async login(e){const t=await this.restClient.post("/auth/login",e);return this.authRepository.set(t),t}logout(){this.authRepository.clear()}getAuth(){return this.authRepository.get()}signup(e){return this.restClient.post("/auth/signup",e)}};c=o.__decorate([s.Injectable,o.__param(0,s.Inject(r.SubwayClient)),o.__param(1,s.Inject(l.AuthRepository)),o.__metadata("design:paramtypes",["function"==typeof(a=void 0!==r.SubwayClient&&r.SubwayClient)?a:Object,"function"==typeof(i=void 0!==l.AuthRepository&&l.AuthRepository)?i:Object])],c),t.AuthService=c},8012:(e, t, n)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.LineService=void 0;const i=n(9312),o=n(9915),s=n(9867);let r=class{subwayClient;constructor(e){this.subwayClient=e}getLines(){return this.subwayClient.get("/lines")}getLine(e){return this.subwayClient.get(`/lines/${e}`)}addLine(e){return this.subwayClient.post("/lines",e)}addLineSection(e, t){return this.subwayClient.post(`/lines/${e}/sections`,t)}updateLine(e, t){return this.subwayClient.put(`/lines/${e}`,t)}removeLine(e){return this.subwayClient.delete(`/lines/${e}`)}removeSection(e, t){return this.subwayClient.delete(`/lines/${e}/sections?stationId=${t}`)}};r=i.__decorate([o.Injectable,i.__param(0,o.Inject(s.SubwayClient)),i.__metadata("design:paramtypes",["function"==typeof(a=void 0!==s.SubwayClient&&s.SubwayClient)?a:Object])],r),t.LineService=r},2240:(e, t, n)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.StationService=void 0;const i=n(9312),o=n(9915),s=n(9867);let r=class{subwayClient;constructor(e){this.subwayClient=e}getStations(){return this.subwayClient.get("/stations")}addStation(e){return this.subwayClient.post("/stations",e)}updateStation(e, t){return this.subwayClient.put(`/stations/${e}`,t)}removeStation(e){return this.subwayClient.delete(`/stations/${e}`)}};r=i.__decorate([o.Injectable,i.__param(0,o.Inject(s.SubwayClient)),i.__metadata("design:paramtypes",["function"==typeof(a=void 0!==s.SubwayClient&&s.SubwayClient)?a:Object])],r),t.StationService=r},367:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.authService=t.stationService=t.lineService=void 0;const a=n(9915),i=n(8012),o=n(2240),s=n(4013);t.lineService=a.instanceOf(i.LineService),t.stationService=a.instanceOf(o.StationService),t.authService=a.instanceOf(s.AuthService)},5717:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.authStore=t.UPDATE_USER=t.LOAD_AUTHENTICATION=t.SIGN_OUT=t.SIGN_IN=t.SET_AUTHENTICATION=void 0;const a=n(9915),i=n(367);t.SET_AUTHENTICATION="SET_AUTHENTICATION",t.SIGN_IN="SIGN_IN",t.SIGN_OUT="SIGN_OUT",t.LOAD_AUTHENTICATION="LOAD_AUTHENTICATION",t.UPDATE_USER="UPDATE_USER",t.authStore=new a.Store({state:{authentication:null},mutations:{[t.SET_AUTHENTICATION](e, t){e.authentication=t}},actions:{async[t.SIGN_IN]({commit:e}, n){const a=await i.authService.login(n);e(t.SET_AUTHENTICATION,a)},[t.SIGN_OUT]({commit:e}){i.authService.logout(),e(t.SET_AUTHENTICATION,null)},[t.LOAD_AUTHENTICATION]({commit:e}){e(t.SET_AUTHENTICATION,i.authService.getAuth())},[t.UPDATE_USER]({dispatch:e}, t){}}})},3198:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0});const a=n(9312);a.__exportStar(n(5717),t),a.__exportStar(n(5391),t),a.__exportStar(n(1325),t)},1325:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.lineStore=t.REMOVE_LINE=t.UPDATE_LINE=t.ADD_LINE=t.GET_LINES=t.SET_LINES=void 0;const a=n(9915),i=n(367);t.SET_LINES="SET_LINES",t.GET_LINES="GET_LINES",t.ADD_LINE="ADD_LINE",t.UPDATE_LINE="UPDATE_LINE",t.REMOVE_LINE="REMOVE_LINE",t.lineStore=new a.Store({state:{lines:[]},mutations:{[t.SET_LINES](e, t){e.lines=t}},actions:{async[t.GET_LINES]({commit:e}){e(t.SET_LINES,await i.lineService.getLines())},async[t.ADD_LINE]({dispatch:e}, n){await i.lineService.addLine(n),await e(t.GET_LINES)},async[t.UPDATE_LINE]({dispatch:e}, {idx:n,name:a,color:o}){await i.lineService.updateLine(n,{name:a,color:o}),await e(t.GET_LINES)},async[t.REMOVE_LINE]({dispatch:e}, {idx:n}){await i.lineService.removeLine(n),await e(t.GET_LINES)}}})},5391:(e, t, n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stationStore=t.REMOVE_STATION=t.UPDATE_STATION=t.ADD_STATION=t.GET_STATIONS=t.SET_STATIONS=void 0;const a=n(9915),i=n(367);t.SET_STATIONS="SET_STATIONS",t.GET_STATIONS="GET_STATIONS",t.ADD_STATION="ADD_STATION",t.UPDATE_STATION="UPDATE_STATION",t.REMOVE_STATION="REMOVE_STATION",t.stationStore=new a.Store({state:{stations:[]},mutations:{[t.SET_STATIONS](e, t){e.stations=t}},actions:{async[t.GET_STATIONS]({commit:e}){e(t.SET_STATIONS,await i.stationService.getStations())},async[t.ADD_STATION]({dispatch:e}, n){await i.stationService.addStation({name:n}),await e(t.GET_STATIONS)},async[t.UPDATE_STATION]({dispatch:e}, {idx:n,name:a}){await i.stationService.updateStation(n,{name:a}),await e(t.GET_STATIONS)},async[t.REMOVE_STATION]({dispatch:e}, {idx:n}){await i.stationService.removeStation(n),await e(t.GET_STATIONS)}}})},1782:(e, t)=>{function n(e, t){return t.closest(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=t.getNextIdx=t.parseFormData=t.selectParentIdx=t.selectParent=t.selectAll=t.selectOne=void 0,t.selectOne=function(e, t=document.body){return t.querySelector(e)},t.selectAll=function(e, t=document.body){return[...t.querySelectorAll(e)]},t.selectParent=n,t.selectParentIdx=function(e){const t=n("[data-idx]",e);return Number(t.dataset.idx)},t.parseFormData=function(e){return[...new FormData(e)].reduce(((e, [t,n])=>(e[t]=n,e)),{})},t.getNextIdx=function(){let e=Date.now();return e+=1,e},t.debounce=function(e){let t=0;return(...n)=>{cancelAnimationFrame(t),t=requestAnimationFrame((()=>e(...n)))}}},9312:(e, t, n)=>{n.r(t),n.d(t,{__extends:()=>i,__assign:()=>o,__rest:()=>s,__decorate:()=>r,__param:()=>l,__metadata:()=>c,__awaiter:()=>d,__generator:()=>u,__createBinding:()=>p,__exportStar:()=>h,__values:()=>m,__read:()=>v,__spread:()=>f,__spreadArrays:()=>b,__spreadArray:()=>y,__await:()=>S,__asyncGenerator:()=>_,__asyncDelegator:()=>g,__asyncValues:()=>w,__makeTemplateObject:()=>E,__importStar:()=>O,__importDefault:()=>x,__classPrivateFieldGet:()=>$,__classPrivateFieldSet:()=>I});var a=function(e, t){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e, t){e.__proto__=t}||function(e, t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e, t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,a=arguments.length; n<a; n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e, t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e); i<a.length; i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(n[a[i]]=e[a[i]])}return n}function r(e, t, n, a){var i,o=arguments.length,s=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,a);else for(var r=e.length-1; r>=0; r--)(i=e[r])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function l(e, t){return function(n, a){t(n,a,e)}}function c(e, t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e, t, n, a){return new(n||(n=Promise))((function(i, o){function s(e){try{l(a.next(e))}catch(e){o(e)}}function r(e){try{l(a.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,r)}l((a=a.apply(e,t||[])).next())}))}function u(e, t){var n,a,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function r(o){return function(r){return function(o){if(n)throw new TypeError("Generator is already executing.");for(; s;)try{if(n=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,a=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],a=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,r])}}}var p=Object.create?function(e, t, n, a){void 0===a&&(a=n),Object.defineProperty(e,a,{enumerable:!0,get:function(){return t[n]}})}:function(e, t, n, a){void 0===a&&(a=n),e[a]=t[n]};function h(e, t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||p(t,e,n)}function m(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],a=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e, t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,o=n.call(e),s=[];try{for(; (void 0===t||t-- >0)&&!(a=o.next()).done;)s.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function f(){for(var e=[],t=0; t<arguments.length; t++)e=e.concat(v(arguments[t]));return e}function b(){for(var e=0,t=0,n=arguments.length; t<n; t++)e+=arguments[t].length;var a=Array(e),i=0;for(t=0; t<n; t++)for(var o=arguments[t],s=0,r=o.length; s<r; s++,i++)a[i]=o[s];return a}function y(e, t, n){if(n||2===arguments.length)for(var a,i=0,o=t.length; i<o; i++)!a&&i in t||(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return e.concat(a||t)}function S(e){return this instanceof S?(this.v=e,this):new S(e)}function _(e, t, n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a,i=n.apply(e,t||[]),o=[];return a={},s("next"),s("throw"),s("return"),a[Symbol.asyncIterator]=function(){return this},a;function s(e){i[e]&&(a[e]=function(t){return new Promise((function(n, a){o.push([e,t,n,a])>1||r(e,t)}))})}function r(e, t){try{(n=i[e](t)).value instanceof S?Promise.resolve(n.value.v).then(l,c):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function l(e){r("next",e)}function c(e){r("throw",e)}function d(e, t){e(t),o.shift(),o.length&&r(o[0][0],o[0][1])}}function g(e){var t,n;return t={},a("next"),a("throw",(function(e){throw e})),a("return"),t[Symbol.iterator]=function(){return this},t;function a(a, i){t[a]=e[a]?function(t){return(n=!n)?{value:S(e[a](t)),done:"return"===a}:i?i(t):t}:i}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=m(e),t={},a("next"),a("throw"),a("return"),t[Symbol.asyncIterator]=function(){return this},t);function a(n){t[n]=e[n]&&function(t){return new Promise((function(a, i){!function(e, t, n, a){Promise.resolve(a).then((function(t){e({value:t,done:n})}),t)}(a,i,(t=e[n](t)).done,t.value)}))}}}function E(e, t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e, t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e, t){e.default=t};function O(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&p(t,e,n);return T(t,e),t}function x(e){return e&&e.__esModule?e:{default:e}}function $(e, t, n, a){if("a"===n&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?a:"a"===n?a.call(e):a?a.value:t.get(e)}function I(e, t, n, a, i){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?i.call(e,n):i?i.value=n:t.set(e,n),n}}},t={};function n(a){var i=t[a];if(void 0!==i)return i.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,n),o.exports}n.d=(e, t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e, t)=>Object.prototype.hasOwnProperty.call(e,t),n.r= e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");a.length&&(e=a[a.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{n(5860);const e=n(4342),t=n(1782);new e.App(t.selectOne("#app"))})()})();
27,364
54,666
0.623812
688b1abb31415de5da6e3fe6b25557e862de121f
4,653
js
JavaScript
copper-server/service_images/groupoffice-6.3.66/groupoffice-6.3.66-php-70/modules/leavedays/views/Extjs3/MonthWindow.js
LSFLK/copper
90c5bc5be4a1df95e528f8f79a593a50f05a24a0
[ "Apache-2.0" ]
7
2019-01-29T04:51:06.000Z
2021-09-25T09:08:00.000Z
copper-server/service_images/groupoffice-6.3.66/groupoffice-6.3.66-php-70/modules/leavedays/views/Extjs3/MonthWindow.js
LSFLK/copper
90c5bc5be4a1df95e528f8f79a593a50f05a24a0
[ "Apache-2.0" ]
123
2019-01-04T03:00:58.000Z
2019-08-02T10:12:48.000Z
copper-server/service_images/groupoffice-6.3.66/groupoffice-6.3.66-php-70/modules/leavedays/views/Extjs3/MonthWindow.js
LSFLK/copper
90c5bc5be4a1df95e528f8f79a593a50f05a24a0
[ "Apache-2.0" ]
1
2020-03-13T02:00:34.000Z
2020-03-13T02:00:34.000Z
/** * Copyright Intermesh * * This file is part of Group-Office. You should have received a copy of the * Group-Office license along with Group-Office. See the file /LICENSE.TXT * * If you have questions write an e-mail to info@intermesh.nl * * @version $Id: MonthWindow.js 22911 2018-01-12 08:00:53Z mschering $ * @copyright Copyright Intermesh * @author Michael de Hart <mdhart@intermesh.nl> */ GO.leavedays.MonthWindow = Ext.extend(GO.Window,{ tpl: null, initComponent : function(){ var now = new Date(); var fields = ['name']; for(var d = 0; d <= 30; d++){ fields.push(d.toString()); } var store = this.store = new GO.data.JsonStore({ url: GO.url('leavedays/report/month'), id: 'id', baseParams: { month: now.getMonth(), year: now.getFullYear() }, scope:this, fields: fields, remoteSort: true }); this.tpl = new Ext.XTemplate( '<table cellspacing="0" class="monthReport x-grid3">', '<thead class="x-grid3-header">', '{[this.renderHeader()]}', '</thead>', '<tbody class="x-grid3-body">', '{[this.renderRows(values)]}', '</tbody>', '</table>', { month: now.getMonth(), year: now.getFullYear(), renderHeader : function() { var today = new Date(this.year,this.month,1), firstDay = new Date(today.getFullYear(), today.getMonth(), 1), lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0); var h2 = '<tr><th></th>', h3 = '<tr><th>'+t("Name")+'</th>', day = new Date(firstDay.getTime()), firstWeekDay = day.getDay(); for(; day <= lastDay; day.setDate(day.getDate() + 1)) { if(day.getDay() == 0) { //sunday h2 += '<th colspan="'+(7-(day.getDate()<7?firstWeekDay-1:0))+'">Week '+day.getWeekOfYear()+'</th>'; } h3 += '<th style="text-align:center">'+day.getDate()+'</th>'; } return h2+'</tr>'+h3+'</tr>'; }, renderRows : function(data) { var today = new Date(this.year,this.month,1), firstDay = new Date(today.getFullYear(), today.getMonth(), 1), lastDay = new Date(today.getFullYear(), today.getMonth() + 1, 0); var row = '', day, style = ''; Ext.each(data, function(r) { row += '<tr class="x-grid3-row"><th>'+r['name']+'</th>'; for(day = new Date(firstDay.getTime()); day <= lastDay; day.setDate(day.getDate() + 1)) { if(r[day.getDate()-1].id) { row += '<td style="background-color:#8bc34a;">'; } else if(day.getDay() == 0 || day.getDay() == 6) //saturday or sunday row += '<td style="background-color:#eee;">'; else row += '<td>'; row += '&nbsp;</td>'; } row +='</tr>'; }); return row; } } ); Ext.apply(this,{ frame:true, width:960, height:700, //autoHeight:true, collapsible:false, resizable: true, maximizable: true, layout:'fit', title:t("Month report", "leavedays")+ ' '+now.getFullYear(), tbar: [ t("Month", "leavedays")+': ', { xtype: 'combo', displayField:'month', valueField:'id', hiddenValue:this.month, editable:false, readOnly:false, mode: 'local', triggerAction: 'all', store: new Ext.data.SimpleStore({ fields : ['id', 'month'], data : [ [0, t("Jan", "leavedays")], [1, t("Feb", "leavedays")], [2, t("Mar", "leavedays")], [3, t("Apr", "leavedays")], [4, t("May", "leavedays")], [5, t("Jun", "leavedays")], [6, t("Jul", "leavedays")], [7, t("Aug", "leavedays")], [8, t("Sep", "leavedays")], [9, t("Oct", "leavedays")], [10, t("Nov", "leavedays")], [11, t("Dec", "leavedays")] ] }), listeners: { select: function(me, value) { this.tpl.month = value.data.id; store.baseParams['month'] = value.data.id; store.reload(); }, scope:this } },{ text: t("Reload", "leavedays"), handler: function() { store.reload(); } } ], items: new Ext.DataView({ store: this.store, tpl: this.tpl, autoHeight:true, multiSelect: true, emptyText: t("There are no holidays taken this month", "leavedays") }) }); GO.leavedays.MonthWindow.superclass.initComponent.call(this); }, show : function(year) { this.store.baseParams['year'] = year; this.tpl.year = year; if(this.year != year || !this.store.loaded) { this.store.load(); } this.setTitle(t("Month report", "leavedays")+ ' '+this.year); GO.leavedays.MonthWindow.superclass.show.call(this); } });
26.288136
106
0.545884
688b7a850ca6387a2d71a211e53c38722ca5b3a2
8,672
js
JavaScript
static/assets/js/common.js
jineshpaloor/github-card-wall
9e847aeebb9bc78acc701f9e6044ad0e18924ccb
[ "Apache-2.0" ]
null
null
null
static/assets/js/common.js
jineshpaloor/github-card-wall
9e847aeebb9bc78acc701f9e6044ad0e18924ccb
[ "Apache-2.0" ]
21
2015-08-14T20:47:22.000Z
2015-09-24T12:47:40.000Z
static/assets/js/common.js
jineshpaloor/github-card-wall
9e847aeebb9bc78acc701f9e6044ad0e18924ccb
[ "Apache-2.0" ]
null
null
null
/** this will be our global, top-level namespace */ var GithubCardWall = GithubCardWall || { }; /** some IE related stuff */ GithubCardWall.ie = function() { return navigator.userAgent.indexOf('MSIE') != -1; }; /** this is the skeleton of a module, copy this to start a new module */ GithubCardWall.cardwallModule = (function(){ // define some configuration settings var config = { autoInvokeInit: false }; // define the init function var dragNdrop1 = function () { $(".draggable").draggable(); $(".droppable").droppable({ drop: function(e, ui) { $("#loader_image").removeClass("hidden"); var issue_id = ui.draggable.attr("id") var issue_no = ui.draggable.attr("data-number"); var repo = ui.draggable.attr("data-repo"); var from_label = ui.draggable.attr("data-label"); var to_label = $(this).attr('id'); console.log("label: ", from_label, to_label, issue_no, repo); if (from_label == to_label){return false} // send ajax request to change label $.getJSON( $SCRIPT_ROOT + '/change_label', {'issue_id' : issue_id, 'from_label': from_label, 'to_label': to_label, 'issue_no': issue_no, 'repo': repo}, function(data) { $("#loader_image").addClass("hidden"); if(data.success) { alert("label changed"); $("#" + data.issue_id).attr("data-label", to_label); } else alert("operation failed. Please reload the page"); } ); } }); }; /** using Sortable library */ var dragNdrop2 = function() { var wall = document.getElementById('card-wall'); Sortable.create(wall, { draggable: '.swim-lane', handle: '.swim-lane-title', onUpdate: function(evt) { } }); var elements = wall.getElementsByClassName('my-list-group') for (var i in elements) { //[].forEach.call(wall.getElementsByClassName('my-list-group'), function(el){ if ((' ' + elements[i].className + ' ').indexOf(' my-list-group ') > -1) { Sortable.create(elements[i], { group: 'wall', animation: 100, sort : false, draggable : '.card', onAdd: function(evt){ var element = evt.item; // console.log('label :', $(element).parents('div.my-list-group').attr('id')); var issue_id = element.getAttribute('id'); var from_label = element.getAttribute('data-label'); var to_label = $(element).parents('div.my-list-group').attr('id'); var issue_no = element.getAttribute('data-number'); var repo = element.getAttribute('data-repo'); console.log("label: ", from_label, to_label, issue_no, repo); if (from_label == to_label){return false} $.getJSON( $SCRIPT_ROOT + '/change_label', {'issue_id' : issue_id, 'from_label': from_label, 'to_label': to_label, 'issue_no': issue_no, 'repo': repo}, function(data) { $("#loader_image").addClass("hidden"); if(data.success) { alert("label changed"); if (to_label == "DONE") { $("#" + data.issue_id).addClass("hidden"); } else { $("#" + data.issue_id).attr("data-label", to_label); } } else alert("operation failed. Please reload the page"); } ); } }); } } }; var createIssue = function(){ $(".create_issue").on('click', function(e) { e.preventDefault(); var that = $(this); var issue_form = $('#form_create_issue'); var label_name = $(this).data('labelname'); $("#label").val(label_name); $('#modal_new_issue').removeClass('hide'); $("#issue-creation-ok").addClass("hidden"); $('#modal_new_issue').modal('show').one('click', '#submit', function (e) { var url = $(issue_form).attr("action"); var data = $(issue_form).serialize(); $.getJSON( $SCRIPT_ROOT + url, data, function(data) { $("#loader_image").addClass("hidden"); if(data.success) { console.log("issue created"); $(that).parents('div.swim-lane').find('div.my-list-group').append(data.html); $("#issue-creation-ok").removeClass("hidden"); } else console.log("operation failed. Please reload the page"); } ); }); }); }; var init = function(){ dragNdrop2(); createIssue(); }; // return an object (this is available globally) return { config: config, init: init }; })(); /** for ordering the labels */ GithubCardWall.labelorderModule = (function(){ // define some configuration settings var config = { autoInvokeInit: false }; // define a function var init = function() { var element = document.getElementById('label_order_list'); var mylist = Sortable.create(element, { sort: true, group: "localStorage-persistent", animation: 100, store: { get: function (sortable) { console.log("inside get func"); var order = localStorage.getItem(sortable.options.group); return order ? order.split('|') : []; }, set: function (sortable) { console.log("inside set func"); var order = sortable.toArray(); localStorage.setItem(sortable.options.group, order.join('|')); } }, onUpdate: function(evt){ var label_id = evt.item.getAttribute('id'); console.log("on update func :: ", label_id, evt.oldIndex, evt.newIndex); } }); var update_label_order = function(project_id, label_dict){ $.getJSON( $SCRIPT_ROOT + '/project/'+project_id+'/update-labels' , label_dict, function(data) { $("#loader_image").addClass("hidden"); $("#id_message_label p").text(data.message); $("#id_message_label").removeClass("hidden"); } ); }; $("#save_label_order").click(function(){ var label_dict = {}; $("#label_order_list li").each( function(i,v){ var index = i+1; var label = $(v).text(); label_dict[label] = index; }); var project_id = $("#project_id").val(); update_label_order(project_id, label_dict); }); }; return { config: config, init: init }; })(); GithubCardWall.projectModule = (function(){ // define some configuration settings var config = { autoInvokeInit: false }; var deleteProject = function(){ $('button[name="delete_project"]').on('click', function(e){ var $form=$(this).closest('form'); console.log("form is ", $form); e.preventDefault(); $('#confirm').removeClass("hide"); $('#confirm').modal('show').one('click', '#delete', function (e) { $form.trigger('submit'); }); }); }; var init = function(){ deleteProject(); }; return { config: config, init: init }; })();
37.541126
136
0.455604
688c94e20c2680b802d7592205c739f32d5f7d06
854
js
JavaScript
front/layouts/front/BodyOrderSuccessLayout.js
wgpol098/UMK-Shop
526de72ee310a14580b52c47f6577f621bb34c89
[ "MIT" ]
null
null
null
front/layouts/front/BodyOrderSuccessLayout.js
wgpol098/UMK-Shop
526de72ee310a14580b52c47f6577f621bb34c89
[ "MIT" ]
null
null
null
front/layouts/front/BodyOrderSuccessLayout.js
wgpol098/UMK-Shop
526de72ee310a14580b52c47f6577f621bb34c89
[ "MIT" ]
null
null
null
import { useEffect, useState } from "react"; import { Navbar, NavDropdown, Form, FormControl, Button, Nav, Container, Col, Row, } from "react-bootstrap"; import { useCookies } from "react-cookie"; import { useRouter } from "next/router"; export default function BodyOrderSuccessLayout(props) { const [cookie, setCookie] = useCookies(["user"]); const router = useRouter(); return ( <div style={{ width: "100%", display: "flex", alignItems: "center", flexDirection: "column", }} > <div className="login-title">Zamówinie zostało złożone</div> <div className="login-title" style={{ borderBottom: "none", fontSize: "28px" }} > Dziękujemy! <br /> Skontaktujemy się z Tobą w najbliższym czasie </div> </div> ); }
20.829268
66
0.587822
688d3c556e0db763be33a54879c926cec05d67e6
6,259
js
JavaScript
source/model/modelutils.js
himanshuvashisht878/Online3DViewer
3a71028b1373cb05f299ee78f7d578d6ff89a414
[ "MIT" ]
1
2019-05-31T14:01:36.000Z
2019-05-31T14:01:36.000Z
source/model/modelutils.js
Pandinosaurus/Online3DViewer
c3ed8280d523bbd63485ad9bd884eb24edded81a
[ "MIT" ]
null
null
null
source/model/modelutils.js
Pandinosaurus/Online3DViewer
c3ed8280d523bbd63485ad9bd884eb24edded81a
[ "MIT" ]
null
null
null
OV.CalculateTriangleNormal = function (v0, v1, v2) { let v = OV.SubCoord3D (v1, v0); let w = OV.SubCoord3D (v2, v0); let normal = OV.CrossVector3D (v, w); normal.Normalize (); return normal; }; OV.TransformMesh = function (mesh, transformation) { if (transformation.IsIdentity ()) { return; } for (let i = 0; i < mesh.VertexCount (); i++) { let vertex = mesh.GetVertex (i); let transformed = transformation.TransformCoord3D (vertex); vertex.x = transformed.x; vertex.y = transformed.y; vertex.z = transformed.z; } if (mesh.NormalCount () > 0) { let trs = transformation.GetMatrix ().DecomposeTRS (); let normalMatrix = new OV.Matrix ().ComposeTRS (new OV.Coord3D (0.0, 0.0, 0.0), trs.rotation, new OV.Coord3D (1.0, 1.0, 1.0)); let normalTransformation = new OV.Transformation (normalMatrix); for (let i = 0; i < mesh.NormalCount (); i++) { let normal = mesh.GetNormal (i); let transformed = normalTransformation.TransformCoord3D (normal); normal.x = transformed.x; normal.y = transformed.y; normal.z = transformed.z; } } }; OV.FlipMeshTrianglesOrientation = function (mesh) { for (let i = 0; i < mesh.TriangleCount (); i++) { let triangle = mesh.GetTriangle (i); let tmp = triangle.v1; triangle.v1 = triangle.v2; triangle.v2 = tmp; } }; OV.IsModelEmpty = function (model) { let isEmpty = true; model.EnumerateMeshInstances ((meshInstance) => { if (meshInstance.TriangleCount () > 0) { isEmpty = false; } }); return isEmpty; }; OV.CloneMesh = function (mesh) { let cloned = new OV.Mesh (); cloned.SetName (mesh.GetName ()); for (let i = 0; i < mesh.VertexCount (); i++) { let vertex = mesh.GetVertex (i); cloned.AddVertex (vertex.Clone ()); } for (let i = 0; i < mesh.NormalCount (); i++) { let normal = mesh.GetNormal (i); cloned.AddNormal (normal.Clone ()); } for (let i = 0; i < mesh.TextureUVCount (); i++) { let uv = mesh.GetTextureUV (i); cloned.AddTextureUV (uv.Clone ()); } for (let i = 0; i < mesh.TriangleCount (); i++) { let triangle = mesh.GetTriangle (i); cloned.AddTriangle (triangle.Clone ()); } return cloned; }; OV.EnumerateModelVerticesAndTriangles = function (model, callbacks) { model.EnumerateMeshInstances ((meshInstance) => { meshInstance.EnumerateVertices ((vertex) => { callbacks.onVertex (vertex.x, vertex.y, vertex.z); }); }); let vertexOffset = 0; model.EnumerateMeshInstances ((meshInstance) => { meshInstance.EnumerateTriangleVertexIndices ((v0, v1, v2) => { callbacks.onTriangle (v0 + vertexOffset, v1 + vertexOffset, v2 + vertexOffset); }); vertexOffset += meshInstance.VertexCount (); }); }; OV.EnumerateTrianglesWithNormals = function (object3D, onTriangle) { object3D.EnumerateTriangleVertices ((v0, v1, v2) => { let normal = OV.CalculateTriangleNormal (v0, v1, v2); onTriangle (v0, v1, v2, normal); }); }; OV.GetBoundingBox = function (object3D) { let calculator = new OV.BoundingBoxCalculator3D (); object3D.EnumerateVertices ((vertex) => { calculator.AddPoint (vertex); }); return calculator.GetBox (); }; OV.GetTopology = function (object3D) { function GetVertexIndex (vertex, octree, topology) { let index = octree.FindPoint (vertex); if (index === null) { index = topology.AddVertex (); octree.AddPoint (vertex, index); } return index; } let boundingBox = OV.GetBoundingBox (object3D); let octree = new OV.Octree (boundingBox); let topology = new OV.Topology (); object3D.EnumerateTriangleVertices ((v0, v1, v2) => { let v0Index = GetVertexIndex (v0, octree, topology); let v1Index = GetVertexIndex (v1, octree, topology); let v2Index = GetVertexIndex (v2, octree, topology); topology.AddTriangle (v0Index, v1Index, v2Index); }); return topology; }; OV.IsSolid = function (object3D) { function GetEdgeOrientationInTriangle (topology, triangleIndex, edgeIndex) { const triangle = topology.triangles[triangleIndex]; const triEdge1 = topology.triangleEdges[triangle.triEdge1]; const triEdge2 = topology.triangleEdges[triangle.triEdge2]; const triEdge3 = topology.triangleEdges[triangle.triEdge3]; if (triEdge1.edge === edgeIndex) { return triEdge1.reversed; } if (triEdge2.edge === edgeIndex) { return triEdge2.reversed; } if (triEdge3.edge === edgeIndex) { return triEdge3.reversed; } return null; } const topology = OV.GetTopology (object3D); for (let edgeIndex = 0; edgeIndex < topology.edges.length; edgeIndex++) { const edge = topology.edges[edgeIndex]; let triCount = edge.triangles.length; if (triCount === 0 || triCount % 2 !== 0) { return false; } let edgesDirection = 0; for (let triIndex = 0; triIndex < edge.triangles.length; triIndex++) { const triangleIndex = edge.triangles[triIndex]; const edgeOrientation = GetEdgeOrientationInTriangle (topology, triangleIndex, edgeIndex); if (edgeOrientation) { edgesDirection += 1; } else { edgesDirection -= 1; } } if (edgesDirection !== 0) { return false; } } return true; }; OV.HasDefaultMaterial = function (model) { for (let i = 0; i < model.MaterialCount (); i++) { let material = model.GetMaterial (i); if (material.isDefault) { return true; } } return false; }; OV.ReplaceDefaultMaterialColor = function (model, color) { for (let i = 0; i < model.MaterialCount (); i++) { let material = model.GetMaterial (i); if (material.isDefault) { material.color = color; } } };
29.804762
134
0.588433
688f09c7b77d869041e509e1b1fbe9e5286f189d
2,498
js
JavaScript
frontend/src/service/requests.js
devhyun637/prolog
006e6eb3b40a8374afa8caf66ec97811b23d5422
[ "MIT" ]
null
null
null
frontend/src/service/requests.js
devhyun637/prolog
006e6eb3b40a8374afa8caf66ec97811b23d5422
[ "MIT" ]
null
null
null
frontend/src/service/requests.js
devhyun637/prolog
006e6eb3b40a8374afa8caf66ec97811b23d5422
[ "MIT" ]
null
null
null
const BASE_URL = process.env.REACT_APP_API_URL; const requestGetPost = (postId) => fetch(`${BASE_URL}/posts/${postId}`); const requestGetFilters = () => fetch(`${BASE_URL}/filters`); const requestGetMissions = () => fetch(`${BASE_URL}/missions`); const requestGetTags = () => fetch(`${BASE_URL}/tags`); const requestGetPosts = (query) => { if (query.type === 'searchParams') { return fetch(`${BASE_URL}/posts?${query.data.toString()}`); } else if (query.type === 'filter') { const searchParams = Object.entries(query?.data?.postQueryParams).map( ([key, value]) => `${key}=${value}` ); const filterQuery = query.data.filterQuery.length ? query.data.filterQuery.map( ({ filterType, filterDetailId }) => `${filterType}=${filterDetailId}` ) : ''; console.log(searchParams, filterQuery); return fetch(`${BASE_URL}/posts?${[...filterQuery, ...searchParams].join('&')}`); } }; const requestEditPost = (postId, data, accessToken) => fetch(`${BASE_URL}/posts/${postId}`, { method: 'PUT', headers: { 'Content-Type': 'application/json; charset=UTF-8', Authorization: `Bearer ${accessToken}`, }, body: JSON.stringify(data), }); const requestDeletePost = (postId, accessToken) => fetch(`${BASE_URL}/posts/${postId}`, { method: 'DELETE', headers: { 'Content-Type': 'application/json; charset=UTF-8', Authorization: `Bearer ${accessToken}`, }, }); const requestGetProfile = (username) => fetch(`${BASE_URL}/members/${username}/profile`); const requestGetUserPosts = (username, postSearchParams, filteringOption) => { const searchParams = Object.entries(postSearchParams).map(([key, value]) => `${key}=${value}`); const filterQuery = filteringOption.length ? filteringOption.map(({ filterType, filterDetailId }) => `${filterType}=${filterDetailId}`) : ''; return fetch( `${BASE_URL}/members/${username}/posts?${[...filterQuery, ...searchParams].join('&')}` ); }; const requestGetUserTags = (username) => fetch(`${BASE_URL}/members/${username}/tags`); const requestGetCalendar = (year, month, username) => fetch(`${BASE_URL}/members/${username}/calendar-posts?year=${year}&month=${month}`, { method: 'GET', }); export { requestGetPosts, requestGetPost, requestGetFilters, requestGetMissions, requestGetTags, requestEditPost, requestGetUserPosts, requestDeletePost, requestGetProfile, requestGetUserTags, requestGetCalendar, };
31.620253
97
0.652522
688fcbaf31aef896d7748877dfb71966cce9ff8d
536
js
JavaScript
front/collections/collection.js
akileh/fermpi
4a20fde09a940f6674e6c1e2d11971f9996396e7
[ "BSD-3-Clause" ]
6
2015-02-25T21:36:39.000Z
2019-04-14T14:10:29.000Z
front/collections/collection.js
akileh/fermpi
4a20fde09a940f6674e6c1e2d11971f9996396e7
[ "BSD-3-Clause" ]
1
2016-03-08T13:16:49.000Z
2016-03-11T14:36:04.000Z
front/collections/collection.js
akileh/fermpi
4a20fde09a940f6674e6c1e2d11971f9996396e7
[ "BSD-3-Clause" ]
null
null
null
var Backbone = require('backbone'), _ = require('underscore') module.exports = Backbone.Collection.extend({ initialize: function (models, options) { this.options = options }, setOptions: function (options) { this.options = options }, url: function () { var url = this.baseUrl if(this.options) { url += '?' _.each(this.options, function (value, key) { url += (key + '=' + value + '&') }) } return url } })
22.333333
56
0.501866
688ff2244df158ca85cc69e8fa0d2dc9ace2c27b
992
js
JavaScript
nova-components/ButtonGroup/node_modules/@fortawesome/free-solid-svg-icons/faShop.js
sanvisimo/machines
272df47d1e57cfe598dcb7404a01658915a5afe1
[ "MIT" ]
null
null
null
nova-components/ButtonGroup/node_modules/@fortawesome/free-solid-svg-icons/faShop.js
sanvisimo/machines
272df47d1e57cfe598dcb7404a01658915a5afe1
[ "MIT" ]
null
null
null
nova-components/ButtonGroup/node_modules/@fortawesome/free-solid-svg-icons/faShop.js
sanvisimo/machines
272df47d1e57cfe598dcb7404a01658915a5afe1
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var prefix = 'fas'; var iconName = 'shop'; var width = 640; var height = 512; var aliases = ["store-alt"]; var unicode = 'f54f'; var svgPathData = 'M319.1 384H127.1V224H63.98L63.97 480c0 17.75 14.25 32 32 32h256c17.75 0 32-14.25 32-32l.0114-256H319.1V384zM634.6 142.2l-85.38-128c-6-9-16-14.25-26.63-14.25H117.3c-10.63 0-20.63 5.25-26.63 14.25l-85.25 128C-8.78 163.5 6.47 192 32.1 192h575.9C633.5 192 648.7 163.5 634.6 142.2zM511.1 496c0 8.75 7.25 16 16 16h32.01c8.75 0 16-7.25 16-16L575.1 224h-64.01L511.1 496z'; exports.definition = { prefix: prefix, iconName: iconName, icon: [ width, height, aliases, unicode, svgPathData ]}; exports.faShop = exports.definition; exports.prefix = prefix; exports.iconName = iconName; exports.width = width; exports.height = height; exports.ligatures = aliases; exports.unicode = unicode; exports.svgPathData = svgPathData; exports.aliases = aliases;
33.066667
383
0.708669
68901d27d8e099996db96a9ec96ed63983027715
6,167
js
JavaScript
test/unit/shared/schemaValidation/propertyTests/stringLength.js
wmlloyd/f5-telemetry-streaming
0721972ac6b768b5e8bfbd807a64039bdbce2d3d
[ "Apache-2.0" ]
43
2019-03-12T10:20:26.000Z
2022-03-27T01:39:58.000Z
test/unit/shared/schemaValidation/propertyTests/stringLength.js
wmlloyd/f5-telemetry-streaming
0721972ac6b768b5e8bfbd807a64039bdbce2d3d
[ "Apache-2.0" ]
193
2019-03-05T17:47:25.000Z
2022-03-31T17:19:58.000Z
test/unit/shared/schemaValidation/propertyTests/stringLength.js
wmlloyd/f5-telemetry-streaming
0721972ac6b768b5e8bfbd807a64039bdbce2d3d
[ "Apache-2.0" ]
24
2019-03-21T17:37:46.000Z
2021-11-22T19:47:04.000Z
/* * Copyright 2021. F5 Networks, Inc. See End User License Agreement ("EULA") for * license terms. Notwithstanding anything to the contrary in the EULA, Licensee * may copy and modify this software product for its internal business purposes. * Further, Licensee may upload, publish and distribute the modified version of * the software product on devcentral.f5.com. */ 'use strict'; const chai = require('chai'); const chaiAsPromised = require('chai-as-promised'); const lodash = require('lodash'); const utils = require('../utils'); chai.use(chaiAsPromised); const assert = chai.assert; module.exports = { /** * @returns {string} name to use to configure tests */ name() { return 'stringLengthTests'; }, /** * Generate 'minLength' and 'maxLength' tests for strings * * @param {PropertyTestCtx} ctx - context * @param {StringLengthTestConf} testConf - test config * * @returns {void} once tests were generated */ tests(ctx, testConf) { const subTitle = utils.testControls.fmtSubTitle(testConf); if (!lodash.isUndefined(testConf.minLength)) { utils.testControls.getSubTestDescribe(testConf)(`"minLength" keyword tests (minLength === ${testConf.minLength})${subTitle}`, () => { if (testConf.minLength > 0) { // no sense to test it when minLength is 0 it('should not allow to set string with length less than minLength', () => { const testDecl = lodash.cloneDeep(ctx.declaration); lodash.set(testDecl, ctx.property, testConf.valueCb( testDecl, ctx.property, testConf.minLength - 1 )); return assert.isRejected( ctx.validator(testDecl), new RegExp(`"keyword":"minLength".*"dataPath":.*${ctx.propFullName}.*"message":"should NOT be shorter than ${testConf.minLength} characters"`), `should not allow to set string with length shorter than ${testConf.minLength} characters` ); }); } it('should allow to set string with length equal to minLength', () => { const testDecl = lodash.cloneDeep(ctx.declaration); lodash.set(testDecl, ctx.property, testConf.valueCb( testDecl, ctx.property, testConf.minLength )); return assert.isFulfilled( ctx.validator(testDecl), `should allow to set string with length equal to ${testConf.minLength} characters` ); }); }); } if (!lodash.isUndefined(testConf.maxLength)) { utils.testControls.getSubTestDescribe(testConf)(`"maxLength" keyword tests (maxLength === ${testConf.maxLength})${subTitle}`, () => { it('should not allow to set string with length more than maxLength', () => { const testDecl = lodash.cloneDeep(ctx.declaration); lodash.set(testDecl, ctx.property, testConf.valueCb( testDecl, ctx.property, testConf.maxLength + 1 )); return assert.isRejected( ctx.validator(testDecl), new RegExp(`"keyword":"maxLength".*"dataPath":.*${ctx.propFullName}.*"message":"should NOT be longer than ${testConf.maxLength} characters"`), `should not allow to set string with length more than ${testConf.maxLength} characters` ); }); it('should allow to set string with length equal to maxLength', () => { const testDecl = lodash.cloneDeep(ctx.declaration); lodash.set(testDecl, ctx.property, testConf.valueCb( testDecl, ctx.property, testConf.maxLength )); return assert.isFulfilled( ctx.validator(testDecl), `should allow to set string with length equal to ${testConf.maxLength} characters` ); }); }); } }, /** * Process and normalize test options * * @param {StringLengthTestConf} options * * @returns {StringLengthTestConf} processed and normalized options */ options(options) { if (!lodash.isUndefined(options)) { if (options === true) { options = { minLength: 1 }; } else if (options === false) { options = { enable: false }; } else if (lodash.isNumber(options)) { options = { minLength: options }; } else if (!lodash.isObject(options)) { assert.fail(`stringLengthTests expected to be "true", number or object, got "${typeof options}" instead`); } if (!options.valueCb) { options.valueCb = (decl, prop, len) => utils.randomString(len); } } return options; } }; /** * @typedef StringLengthTestConf * @type {BaseTestConf} * @property {number} [minLength] - lower bound for string length * @property {number} [maxLength] - upper bound for string length * @property {StringLengthTestValueCb} valueCb - callback to generate specific string * * Config to test 'minLength' keyword (string) */ /** * @callback StringLengthTestValueCb * @param {any} decl - declaration * @param {PropertyNamePath} property - property * @param {number} len - string length to generate * @returns {string} value to set */
41.668919
171
0.527161
6892a8d34f3f8f8bbdc6659a1ec254e21c7a5522
2,171
js
JavaScript
svelte-presentation/src/content-day1.js
simmoe/Digitalteknik2020
d3a31b07761d36e585462793f64822cee47e1c16
[ "MIT" ]
null
null
null
svelte-presentation/src/content-day1.js
simmoe/Digitalteknik2020
d3a31b07761d36e585462793f64822cee47e1c16
[ "MIT" ]
null
null
null
svelte-presentation/src/content-day1.js
simmoe/Digitalteknik2020
d3a31b07761d36e585462793f64822cee47e1c16
[ "MIT" ]
null
null
null
//json template for content - useful tags are title, text, img, link (from image), code export const words = [ {title: 'Digital teknik og design', vid: 'https://vod-progressive.akamaized.net/exp=1614168939~acl=%2Fvimeo-prod-skyfire-std-us%2F01%2F1%2F19%2F475007022%2F2198631196.mp4~hmac=582f8e42585766cda9df8f006f5cdf2234c6f62bc506071db60027c003760eb7/vimeo-prod-skyfire-std-us/01/1/19/475007022/2198631196.mp4?filename=Alba%3A+a+Wild+Trailer.mp4'}, {title:'for eksempel <b>apps, spil</b> eller andre <b>digitale rum</b>', img:'./assets/ustwo.png'}, {title:'interaktive <b>historier og film</b>', img:'./assets/drage.png'}, {title:'digitale <b>platforme, design og visuel identitet</b>', img:'./assets/netflix.jpg'}, {title:'platform til<b> streaming</b>', img:'./assets/streaming.png'}, {title: 'Design', img:`./assets/xd3.webp`}, {title: 'UX og UI - farver, typografi, logoer osv', img:`./assets/design.png`}, {title:'virtuelle & fysiske <b>produkter</b>', text:'Faget er <b>produktorienteret</b>. Det vil sige at vi i løbet af året skal producere en række prototyper og produkter. Ikke nødvendigvis færdige (det er der aldrig noget der bliver), men i stigende grad idéer der faktisk kunne blive til noget.'}, {title:'Human computer Interaction - <b><br>interaktionsdesign</b>', img:'./assets/hci.png'}, {title:'3D <b>modellering </b>', img:'./assets/random.jpg'}, {title:'fysiske - <b>devices, dimser og eksperimenter</b>', img:'./assets/fys.jpg'}, {title:'Undervisningsplan'}, {img:'./assets/progs.svg'}, {title:'<b>Metode</b>fag', img:'./assets/faser.svg'}, {title:'<b>Rapport</b>fag', img:'./assets/rapport.png'}, {title:'<b>Eksamens</b>fag', img:'./assets/hero.webp'}, {title:'Redskaber og <b>software</b>', text:'Adobe XD + inDesign + Photoshop | <b>Blender 3D</b> | Wordpress | <b>Unity</b> |  VS Code'}, {title:'jer', text:` I løbet af året handler det om at få <b>jeres idéer, viden og redskaber</b> mere og mere frem. `}, {title:'slut'} ]
72.366667
314
0.636573
6892de3839cfd7ceceef8dde79223c7c7aa44809
618
js
JavaScript
src/App.js
aimeeb6/git-illuminate
0778580a6d04c8a175d34d9447ca1de196d39c61
[ "MIT" ]
null
null
null
src/App.js
aimeeb6/git-illuminate
0778580a6d04c8a175d34d9447ca1de196d39c61
[ "MIT" ]
null
null
null
src/App.js
aimeeb6/git-illuminate
0778580a6d04c8a175d34d9447ca1de196d39c61
[ "MIT" ]
null
null
null
/* eslint-disable react/jsx-filename-extension */ import React from 'react'; import ReactDOM from 'react-dom'; import ScrollableTabsButtonAuto from './react-componets/NavigationTabs' import AppTheme from './react-componets/AppTheme'; import {ThemeProvider} from '@material-ui/core/styles'; import CssBaseline from "@material-ui/core/CssBaseline"; const { Gitgraph } = require('@gitgraph/react'); function App() { return ( <div style={{overflow: "none"}}> <ThemeProvider theme={AppTheme}> <CssBaseline /> <ScrollableTabsButtonAuto /> </ThemeProvider> </div> ); } export default App;
25.75
71
0.708738
689301a928d8dd254ac2c2909a1a88a6143e912c
1,219
js
JavaScript
ES6/output/funcionesFlechas.js
gastonrd7/TestGit
bb1aa96338e7de61ffbc28020532c724ef17f190
[ "MIT" ]
null
null
null
ES6/output/funcionesFlechas.js
gastonrd7/TestGit
bb1aa96338e7de61ffbc28020532c724ef17f190
[ "MIT" ]
null
null
null
ES6/output/funcionesFlechas.js
gastonrd7/TestGit
bb1aa96338e7de61ffbc28020532c724ef17f190
[ "MIT" ]
null
null
null
"use strict"; //Funciones javascript var nombres = ['Martin', 'Eduardo']; //La funcion map nos permite iterar por cada uno de los elementos de un array y ejecutar una funcion por cada uno de ellos //const nombresCaracteres = nombres.map(function (nombre) { // console.log(nombre.length); //}); var nombresCaracteres = nombres.map(function (nombre) { console.log("".concat(nombre, ", tiene ").concat(nombre.length, " letras")); }); //Funciones flechas como se declaran //(parametro)=> { // codigo a ejecutar //} var nombres_Caracteres = nombres.map(function (nombre) { console.log("".concat(nombre, ", tiene ").concat(nombre.length, " letras")); }); //Cuando tengo las llaves tengo que poner la palabra reservada return var nombresCantidadCaracteres = nombres.map(function (nombre) { return "".concat(nombre, ", tiene ").concat(nombre.length, " letras"); }); console.log(nombresCantidadCaracteres); //Para dejarlo en una sola linea hay que sacar las llaves, la palabra reservada return y el punto y coma del final de texto var nombres_Cantidad_Caracteres = nombres.map(function (nombre) { return "".concat(nombre, ", tiene ").concat(nombre.length, " letras"); }); console.log(nombres_Cantidad_Caracteres);
43.535714
163
0.727646
68944e5eaf1981dae05239171944f81368585119
148
js
JavaScript
test/fixture/javascript.js
RedHatter/postcss-custom-property-maps
4d61d51a336af584bc11a5bdebbc5022935af9ae
[ "MIT" ]
null
null
null
test/fixture/javascript.js
RedHatter/postcss-custom-property-maps
4d61d51a336af584bc11a5bdebbc5022935af9ae
[ "MIT" ]
null
null
null
test/fixture/javascript.js
RedHatter/postcss-custom-property-maps
4d61d51a336af584bc11a5bdebbc5022935af9ae
[ "MIT" ]
null
null
null
module.exports = { foo: 'foo value', bar: 'bar value', baz: ['one', 'two', 'three'], one: { two: { three: 'yeah!', }, }, };
13.454545
31
0.432432
6895492b892a25093ed413290fc1217cb84fed98
1,372
js
JavaScript
addon/components/dynamic-render.js
taras/ember-dynamic-render
71d217c677dc755feb90ab0315aea161a07c539c
[ "MIT" ]
3
2016-03-17T19:21:35.000Z
2016-03-19T22:38:42.000Z
addon/components/dynamic-render.js
taras/ember-dynamic-render
71d217c677dc755feb90ab0315aea161a07c539c
[ "MIT" ]
null
null
null
addon/components/dynamic-render.js
taras/ember-dynamic-render
71d217c677dc755feb90ab0315aea161a07c539c
[ "MIT" ]
null
null
null
import Ember from 'ember'; import layout from '../templates/components/dynamic-render'; const { HTMLBars, Logger, computed } = Ember; const DynamicRenderComponent = Ember.Component.extend({ layout, classNames: ['dynamic-render'], didInsertElement() { try { HTMLBars.compile(''); } catch (e) { Logger.error(`HTMLBars compiler was not loaded. Load //builds.emberjs.com/release/ember-template-compiler.js before rendering this component`); } }, didReceiveAttrs() { this._super(...arguments); if (this.get('_value') !== this.get('value')) { this.scheduleRerender(); } }, scheduleRerender() { this.set('isReady', false); Ember.run.scheduleOnce('afterRender', this, this.causeRerender); }, causeRerender() { this.setProperties({ _value: this.get('value'), isReady: true }); }, compiled: computed('_value', function(){ let value = this.get('_value') || ''; let compiled; try { compiled = HTMLBars.compile(value); } catch (e) { compiled = e; } return compiled; }), isBadTemplate: computed('compiled', function(){ let compiled = this.get('compiled'); return compiled instanceof Error; }) }); DynamicRenderComponent.reopenClass({ positionalParams: ['value', 'model'] }); export default DynamicRenderComponent;
21.777778
149
0.632653
6896896c014ea6d1bcdca66c91d16c9d0c125da1
2,204
js
JavaScript
resources/js/src/routes/Apps/TaskList/CommentView/AddComment.js
AssassinKO/Laravel-React-Demo
cd762459c6609fe7ca7692214e9fb7f289711987
[ "MIT" ]
2
2021-11-13T22:46:31.000Z
2021-12-16T06:15:21.000Z
resources/js/src/routes/Apps/TaskList/CommentView/AddComment.js
ProDeveloper0412/Laravel-React-Demo
cd762459c6609fe7ca7692214e9fb7f289711987
[ "MIT" ]
null
null
null
resources/js/src/routes/Apps/TaskList/CommentView/AddComment.js
ProDeveloper0412/Laravel-React-Demo
cd762459c6609fe7ca7692214e9fb7f289711987
[ "MIT" ]
null
null
null
import React, { useState } from 'react'; import { Box } from '@material-ui/core'; import CmtAvatar from '../../../../@coremat/CmtAvatar'; import AppTextInput from '../../../../@jumbo/components/Common/formElements/AppTextInput'; import SendIcon from '@material-ui/icons/Send'; import AttachFileIcon from '@material-ui/icons/AttachFile'; import { alpha, makeStyles } from '@material-ui/core/styles'; import { sendMessage } from '../../../../redux/actions/TaskList'; import { useDispatch, useSelector } from 'react-redux'; const useStyles = makeStyles(theme => ({ commentField: { backgroundColor: alpha(theme.palette.common.dark, 0.05), padding: '16px 24px 16px 16px', display: 'flex', alignItems: 'center', }, textFieldArea: { display: 'flex', alignItems: 'center', position: 'relative', width: '100%', '& .MuiInputBase-input': { backgroundColor: theme.palette.background.paper, color: theme.palette.text.primary, paddingRight: 40, borderRadius: 4, }, }, imgRoot: { marginRight: 16, }, attachIconRoot: { position: 'absolute', top: '50%', right: 10, zIndex: 1, transform: 'translateY(-50%)', cursor: 'pointer', }, })); const AddComment = ({ setShowingComments, showingComments }) => { const classes = useStyles(); const { currentUser } = useSelector(({ taskList }) => taskList); const [commentText, setCommentText] = useState(''); const dispatch = useDispatch(); const onSendMessage = () => { setShowingComments(showingComments + 1); dispatch(sendMessage(commentText)); setCommentText(''); }; return ( <Box className={classes.commentField}> <CmtAvatar className={classes.imgRoot} src={currentUser.profilePic} size={40} alt={currentUser.name} /> <Box className={classes.textFieldArea}> <AppTextInput value={commentText} variant="outlined" onChange={e => setCommentText(e.target.value)} /> {commentText ? ( <SendIcon className={classes.attachIconRoot} onClick={onSendMessage} /> ) : ( <AttachFileIcon className={classes.attachIconRoot} /> )} </Box> </Box> ); }; export default AddComment;
31.042254
110
0.647459
6896b3ee2b115c7fae3f138a574a56b8a3539156
1,496
js
JavaScript
src/components/Blog/LatestNews.js
john-rice/slatwall-storefront-react
bd049a679c1738c28ac8022fab9a688a0fc01dda
[ "MIT" ]
4
2021-09-29T14:31:31.000Z
2022-03-31T15:12:58.000Z
src/components/Blog/LatestNews.js
john-rice/slatwall-storefront-react
bd049a679c1738c28ac8022fab9a688a0fc01dda
[ "MIT" ]
null
null
null
src/components/Blog/LatestNews.js
john-rice/slatwall-storefront-react
bd049a679c1738c28ac8022fab9a688a0fc01dda
[ "MIT" ]
null
null
null
import React from 'react' import { useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' import { useFormatDate } from '../../hooks/useFormatDate' function LatestNews({ list }) { const { t } = useTranslation() const [formateDate] = useFormatDate() if (!list || !list.items || list.items.length === 0) { return null } return ( <div className="container"> <header className="section-title"> <h2>{t('frontend.home.latest_news')}</h2> </header> <div className="row"> {list.items.map(data => { return ( <div key={data.postTitle} className="col-md-4"> <article className="card border-0 shadow m-3"> {data.postImage ? <img src={data.postImage} className="img-fluid blog-image" alt={data.postTitle} /> : <div className="img-fluid blog-image" />} <div className="card-body"> <h3 className="text-truncate"> <Link className="link" to="/blog"> {data.postTitle} </Link> </h3> <p className="text-secondary line-height">{data.postSummary}</p> <p className="card-text text-uppercase text-end"> <small>{formateDate(data.publicationDate)}</small> </p> </div> </article> </div> ) })} </div> </div> ) } export { LatestNews }
33.244444
160
0.522727
68977421cb3521a2b6a533ed1586bf3e3970de50
253
js
JavaScript
client/app/common/skillAvatar/skillAvatar.js
redhead-web/foodnet.nz-no-meteor
aedce829fefbe1419e38f5ac8c1a82421074b434
[ "Apache-2.0" ]
null
null
null
client/app/common/skillAvatar/skillAvatar.js
redhead-web/foodnet.nz-no-meteor
aedce829fefbe1419e38f5ac8c1a82421074b434
[ "Apache-2.0" ]
null
null
null
client/app/common/skillAvatar/skillAvatar.js
redhead-web/foodnet.nz-no-meteor
aedce829fefbe1419e38f5ac8c1a82421074b434
[ "Apache-2.0" ]
null
null
null
import angular from 'angular'; import uiRouter from 'angular-ui-router'; import skillAvatarComponent from './skillAvatar.component'; export default angular.module('skillAvatar', [ uiRouter, ]) .component('skillAvatar', skillAvatarComponent) .name;
21.083333
59
0.774704
6897a07824e16f5cb4033066871433fe55f92a02
838
js
JavaScript
public/i18n/select2/tk-js.7ec1db24952095d48676.js
wutongwan/laravel-lego
8ee5801fe4582628b3f7502bf11bcb0cd03abaf2
[ "MIT" ]
130
2016-06-30T08:32:22.000Z
2021-01-04T09:27:28.000Z
public/i18n/select2/tk-js.7ec1db24952095d48676.js
wutongwan/laravel-lego
8ee5801fe4582628b3f7502bf11bcb0cd03abaf2
[ "MIT" ]
96
2016-01-27T04:43:38.000Z
2022-03-21T20:01:08.000Z
public/i18n/select2/tk-js.7ec1db24952095d48676.js
wutongwan/laravel-lego
8ee5801fe4582628b3f7502bf11bcb0cd03abaf2
[ "MIT" ]
38
2016-01-27T04:57:24.000Z
2019-12-09T08:33:10.000Z
(window.webpackJsonp=window.webpackJsonp||[]).push([[99],{118:function(n,e,t){(function(n){/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ !function(){if(n&&n.fn&&n.fn.select2&&n.fn.select2.amd)var e=n.fn.select2.amd;e.define("select2/i18n/tk",[],(function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(n){return n.input.length-n.maximum+" harp bozuň."},inputTooShort:function(n){return"Ýene-de iň az "+(n.minimum-n.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(n){return"Diňe "+n.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}})),e.define,e.require}()}).call(this,t(1))}}]);
419
665
0.736277
6897da8ef5d13106dca5f9c1eb4861cacc255871
1,098
js
JavaScript
src/auth/passport.js
jnware7/phase-4-challenge-
7cc518f9b59c5ae7c9299acded3972d33ce558be
[ "MIT" ]
null
null
null
src/auth/passport.js
jnware7/phase-4-challenge-
7cc518f9b59c5ae7c9299acded3972d33ce558be
[ "MIT" ]
null
null
null
src/auth/passport.js
jnware7/phase-4-challenge-
7cc518f9b59c5ae7c9299acded3972d33ce558be
[ "MIT" ]
null
null
null
const passport = require('passport'); const LocalStrategy = require('passport-local').Strategy const bcrypt = require('bcrypt'); const User = require('../models/users'); passport.use('local', new LocalStrategy({ usernameField:'email' }, (email, password, done)=> { User.findByEmail(email) .then(user => { if(!user) {done(null, false)} bcrypt.compare(password, user.password,(error, result) => { if (error) { return done(error) } if (!result) { return done(null, false) } return done(null, user) }) }) .catch(error => { return done(null, false, { message: 'Incorrect useremail.' }) }) }) ) // .then(result => { // (result) ? done(null, user) : done(null, false) // }) // .catch(error => done(error)) // }) // .catch(error => done(error)) // })) passport.serializeUser((user,done) => { done(null, user.id) }) passport.deserializeUser((id, done) => { User.findById(id) .then(user => done(null, user)) .catch(error => done(error)) }) module.exports = passport
23.361702
67
0.57286
68982aced0100c90ea152885ed5707fa3c69e339
305
js
JavaScript
app/client/js/data/index.js
craigharvi3/snappyshare
624334b1e0529c4b9d1ff4e4336b3da2f0f66827
[ "MIT" ]
null
null
null
app/client/js/data/index.js
craigharvi3/snappyshare
624334b1e0529c4b9d1ff4e4336b3da2f0f66827
[ "MIT" ]
null
null
null
app/client/js/data/index.js
craigharvi3/snappyshare
624334b1e0529c4b9d1ff4e4336b3da2f0f66827
[ "MIT" ]
null
null
null
const AjaxPromise = require('ajax-promise'); const Links = { all: (boardId) => { return new Promise((resolve, reject) => { AjaxPromise .get(`/api/board/${boardId}`) .then((links) => { resolve({links: links}); }); }); } }; export default { Links };
16.052632
45
0.511475
689ad5574c75c2932b936b7013d06209d468261f
632
js
JavaScript
src/container/menu/menu.component.js
nbusuttil/electron-with-create-react-app
742cbbc8fdca2a1c1c66fab53aed386364ccf541
[ "MIT" ]
null
null
null
src/container/menu/menu.component.js
nbusuttil/electron-with-create-react-app
742cbbc8fdca2a1c1c66fab53aed386364ccf541
[ "MIT" ]
null
null
null
src/container/menu/menu.component.js
nbusuttil/electron-with-create-react-app
742cbbc8fdca2a1c1c66fab53aed386364ccf541
[ "MIT" ]
1
2017-12-17T18:56:00.000Z
2017-12-17T18:56:00.000Z
import React from 'react'; import FilterTable from '../../component/filterTable/filterTable.connector'; import GeneratePdf from '../../component/generatePdf/generatePdf.connector'; import Firebase from '../../component/firebase/firebase.connector'; import Search from '../../component/search/search.connector'; import './menu.css'; const Menu = () => ( <div className="menu"> <FilterTable /> <div className="menu__search"> <Search /> </div> <div className="menu__export-pdf"> <GeneratePdf /> </div> <div className="menu__save"> <Firebase /> </div> </div> ); export default Menu;
25.28
76
0.658228
689af112b3f53cdf870f92e42a8e77386140b449
13,369
js
JavaScript
wp-content/plugins/embedpress/Gutenberg/src/common/icons.js
Enjoysheepskin/cdn
c0ef1eeb2278025d0a490a62eca6272258bac0d1
[ "MIT" ]
null
null
null
wp-content/plugins/embedpress/Gutenberg/src/common/icons.js
Enjoysheepskin/cdn
c0ef1eeb2278025d0a490a62eca6272258bac0d1
[ "MIT" ]
null
null
null
wp-content/plugins/embedpress/Gutenberg/src/common/icons.js
Enjoysheepskin/cdn
c0ef1eeb2278025d0a490a62eca6272258bac0d1
[ "MIT" ]
null
null
null
/** * WordPress dependencies */ const { G, Path, Polygon, SVG, } = wp.components; export const googleDocsIcon = <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" > <G> <Path style= {{ fill: '#2196F3' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/> <Path style= {{ fill: '#BBDEFB' }} d="M 40 13 L 30 13 L 30 3 Z "/> <Path style= {{ fill: '#1565C0' }} d="M 30 13 L 40 23 L 40 13 Z "/> <Path style= {{ fill: '#E3F2FD' }} d="M 15 23 L 33 23 L 33 25 L 15 25 Z "/> <Path style= {{ fill: '#E3F2FD' }} d="M 15 27 L 33 27 L 33 29 L 15 29 Z "/> <Path style= {{ fill: '#E3F2FD' }} d="M 15 31 L 33 31 L 33 33 L 15 33 Z "/> <Path style= {{ fill: '#E3F2FD' }} d="M 15 35 L 25 35 L 25 37 L 15 37 Z "/> </G> </SVG> export const googleSlidesIcon = <SVG xmlns="http://www.w3.org/1999/xlink" enable-background="new 0 0 24 24" id="Layer_2" version="1.1" viewBox="0 0 24 24"> <G> <Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z" style={{ fill: "#FFC720" }}/> <Path d="M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z" style={{ fill: "url(#SVGID_1_)" }} /> <Path d="M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z" style={{ opacity: "0.1" }} /> <Path d="M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z" style= {{ fill: "#FFE083" }} /> <Path d="M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z" style={{ opacity:"0.1" }} /> <Path d="M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10" style={{ fill: "#FFFFFF", opacity: "0.2" }} /> <Path d="M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z" style={{ fill: "#FFFFFF" }} /> <Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z" style={{ fill: "url(#SVGID_2_)" }} /> </G> <G/><G/><G/><G/><G/><G/><G/><G/><G/><G/><G/><G/><G/><G/><G/> </SVG> export const googleSheetsIcon = <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1"> <G> <Path style={{ fill: '#43A047' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/> <Path style={{ fill: '#C8E6C9' }} d="M 40 13 L 30 13 L 30 3 Z "/> <Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "/> </G> </SVG> export const googleFormsIcon = <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" > <G> <Path style={{ fill: '#7850C1' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/> <Path style={{ fill: '#C2ABE1' }} d="M 40 13 L 30 13 L 30 3 Z "/> <Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 19 23 L 33 23 L 33 25 L 19 25 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 19 28 L 33 28 L 33 30 L 19 30 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 19 33 L 33 33 L 33 35 L 19 35 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 15 23 L 17 23 L 17 25 L 15 25 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 15 28 L 17 28 L 17 30 L 15 30 Z "/> <Path style={{ fill: '#E8F5E9' }} d="M 15 33 L 17 33 L 17 35 L 15 35 Z "/> </G> </SVG> export const googleDrawingsIcon= <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" > <G> <Path style={{ fill: '#DE5245' }} d="M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"/> <Path style={{ fill: '#EEA6A0' }} d="M40,13H30V3L40,13z"/> <Path style={{ fill: '#B3433A' }} d="M30,13l10,10V13H30z"/> <Path style={{ fill: '#FFFFFF' }} d="M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"/> <Path style={{ fill: '#FFFFFF' }} d="M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"/> </G> </SVG> export const googleMapsIcon= <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" > <G> <Path style={{ fill: '#1C9957' }} d="M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "/> <Path style={{ fill: '#3E7BF1' }} d="M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "/> <Path style={{ fill: '#CBCCC9' }} d="M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "/> <Path style={{ fill: '#EFEFEF' }} d="M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "/> <Path style={{ fill: '#FFD73D' }} d="M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "/> <Path style={{ fill: '#D73F35' }} d="M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "/> <Path style={{ fill: '#752622' }} d="M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "/> <Path style={{ fill: '#FFFFFF' }} d="M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "/> </G> </SVG> export const twitchIcon = <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" version="1.1" > <G> <Path style={{ fill: '#FFFFFF' }} d="M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "/> <Path style={{ fill: '#8E24AA' }} d="M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "/> <Path style={{ fill: '#8E24AA' }} d="M 32 25 L 27 25 L 27 15 L 32 15 Z "/> <Path style={{ fill: '#8E24AA' }} d="M 24 25 L 19 25 L 19 15 L 24 15 Z "/> </G> </SVG> export const wistiaIcon = <SVG xmlns="http://www.w3.org/1999/xlink" viewBox="0 0 769 598" version="1.1" > <G> <Path style={{ fill: '#148ee0' }} d="M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z" /> <Path style={{ fill: '#54bbff' }} d="M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z" /> </G> </SVG> export const youtubeIcon = <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" role="img" aria-hidden="true" focusable="false" > <Path d="M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z" /> </SVG> export const youtubeNewIcon = <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 23" > <g> <g> <path style={{ fill: '#DA2B28' }} className="st0" d="M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4 c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8 c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1 c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8 c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2 c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2 c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1 c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"/> <path className="st0" d="M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7 C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"/> <path className="st0" d="M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"/> </g> <g> <path d="M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8" /> <path d="M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1 c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11 c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"/> <path d="M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2 v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"/> </g> </g> </svg>; export const DocumentIcon = <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 276 340" ><path d="M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z" fill="#e94848"/><path d="M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z" fill="#f19191"/><linearGradient id="A" gradientUnits="userSpaceOnUse" x1="44.744" y1="77.111" x2="116.568" y2="77.111"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><path d="M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z" fill="url(#A)"/><linearGradient id="B" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.016" x2="233.927" y2="136.016"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><use href="#H" opacity=".8" fill="url(#B)"/><linearGradient id="C" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.993" x2="233.927" y2="135.993"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><use href="#H" y="33.6" opacity=".7" fill="url(#C)"/><linearGradient id="D" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.969" x2="233.927" y2="135.969"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><use href="#H" y="67.2" opacity=".6" fill="url(#D)"/><linearGradient id="E" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.045" x2="233.927" y2="136.045"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><use href="#H" y="100.7" opacity=".4" fill="url(#E)"/><linearGradient id="F" gradientUnits="userSpaceOnUse" x1="44.744" y1="270.322" x2="174.778" y2="270.322"><stop offset="0" stop-color="#fff"/><stop offset="1" stop-color="#fff0f0"/></linearGradient><path d="M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z" opacity=".3" fill="url(#F)"/><defs ><path id="H" d="M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"/></defs></svg>;
71.111702
2,147
0.59795
689b4244e61ae99b7869ea1b5a1676d2cbb7e486
4,169
js
JavaScript
examples/gatsbygram/src/components/modal.js
JoelBesada/gatsby-plugin-modal-routing
9a6b0dbb79bd9071287728f341c373ec783aff2f
[ "MIT" ]
null
null
null
examples/gatsbygram/src/components/modal.js
JoelBesada/gatsby-plugin-modal-routing
9a6b0dbb79bd9071287728f341c373ec783aff2f
[ "MIT" ]
null
null
null
examples/gatsbygram/src/components/modal.js
JoelBesada/gatsby-plugin-modal-routing
9a6b0dbb79bd9071287728f341c373ec783aff2f
[ "MIT" ]
null
null
null
import React from "react" import CaretRight from "react-icons/lib/fa/caret-right" import CaretLeft from "react-icons/lib/fa/caret-left" import Close from "react-icons/lib/md/close" import findIndex from "lodash/findIndex" import mousetrap from "mousetrap" import * as PropTypes from "prop-types" import { navigate, StaticQuery, graphql } from "gatsby" import { rhythm } from "../utils/typography" let posts class GatsbyGramModal extends React.Component { static propTypes = { isOpen: PropTypes.bool, location: PropTypes.object.isRequired, } componentDidMount() { mousetrap.bind(`left`, () => this.previous()) mousetrap.bind(`right`, () => this.next()) mousetrap.bind(`spacebar`, () => this.next()) } componentWillUnmount() { mousetrap.unbind(`left`) mousetrap.unbind(`right`) mousetrap.unbind(`spacebar`) } findCurrentIndex() { let index index = findIndex( posts, post => post.id === this.props.location.pathname.split(`/`)[1] ) return index } next(e) { if (e) { e.stopPropagation() } const currentIndex = this.findCurrentIndex() if (currentIndex || currentIndex === 0) { let nextPost // Wrap around if at end. if (currentIndex + 1 === posts.length) { nextPost = posts[0] } else { nextPost = posts[currentIndex + 1] } navigate(`/${nextPost.id}/`, { state: { modal: true }}) } } previous(e) { if (e) { e.stopPropagation() } const currentIndex = this.findCurrentIndex() if (currentIndex || currentIndex === 0) { let previousPost // Wrap around if at start. if (currentIndex === 0) { previousPost = posts.slice(-1)[0] } else { previousPost = posts[currentIndex - 1] } navigate(`/${previousPost.id}/`, { state: { modal: true }}) } } render() { return ( <StaticQuery query={graphql` query { allPostsJson { edges { node { id } } } } `} render={data => { if (!posts) { posts = data.allPostsJson.edges.map(e => e.node) } return ( <div onClick={() => navigate(`/`, { state: { noScroll: true }})} css={{ display: `flex`, position: `relative`, height: `100vh`, }} > <div css={{ display: `flex`, alignItems: `center`, justifyItems: `center`, maxWidth: rhythm(40.25), // Gets it right around Instagram's maxWidth. margin: `auto`, width: `100%`, }} > <CaretLeft data-testid="previous-post" css={{ cursor: `pointer`, fontSize: `50px`, color: `rgba(255,255,255,0.7)`, userSelect: `none`, }} onClick={e => this.previous(e)} /> {this.props.children} <CaretRight data-testid="next-post" css={{ cursor: `pointer`, fontSize: `50px`, color: `rgba(255,255,255,0.7)`, userSelect: `none`, }} onClick={e => this.next(e)} /> </div> <Close data-testid="modal-close" onClick={() => navigate(`/`, { state: { noScroll: true }})} css={{ cursor: `pointer`, color: `rgba(255,255,255,0.8)`, fontSize: `30px`, position: `absolute`, top: rhythm(1 / 4), right: rhythm(1 / 4), }} /> </div> ) }} /> ) } } export default GatsbyGramModal
26.724359
88
0.453586
689b835931676cd37d967a2e9e1cc28fee0f1f20
5,541
js
JavaScript
dist/ui-highcharts.min.js
jsdelivrbot/ui-highcharts
b1355d82dff40fb1065971289daecb04f2034ab2
[ "MIT" ]
6
2015-01-04T00:29:05.000Z
2021-12-31T15:27:48.000Z
dist/ui-highcharts.min.js
jsdelivrbot/ui-highcharts
b1355d82dff40fb1065971289daecb04f2034ab2
[ "MIT" ]
5
2015-05-05T22:39:51.000Z
2016-11-29T14:52:02.000Z
dist/ui-highcharts.min.js
jsdelivrbot/ui-highcharts
b1355d82dff40fb1065971289daecb04f2034ab2
[ "MIT" ]
5
2015-01-23T01:21:58.000Z
2018-12-06T22:22:43.000Z
angular.module("ui-highcharts",[]),angular.module("ui-highcharts").factory("$uiHighchartsAddWatchers",["$uiHighchartsUtilsService","$window",function(a,b){function c(a){var b=_.find(a.series,{name:"Navigator"});if(b){var c=_.find(a.series,function(a){return"Navigator"!==a.name&&a.visible});c&&b.setData(c.options.data,!0)}}var d=function(b,d){var e=a.difference(d,b.series,function(a){return a.name});e.forEach(function(a){b.addSeries(a,!1)});var f=b.series.filter(function(a){return"Navigator"!==a.name});f.forEach(function(a,b){var c=_.find(d,"name",a.name);c?(a.visible!==c.visible&&a.setVisible(c.visible,!1),angular.equals(a.options.data,c.data)||a.setData(c.data,!1),a.type!==c.type&&a.update({type:c.type},!1)):a.remove()}),c(b),b.redraw()},e=function(b,d){var e=b.series.filter(function(a){return"Navigator"!==a.name}),f=a.difference(e,d,function(a){return a.name});f.forEach(function(a){a.remove(!1)}),c(b),b.redraw()},f=a.debounce(function(a,b){var d=a.series.filter(function(a){return"Navigator"!==a.name});d.forEach(function(a,c){b[c]&&a.setData(b[c].data,!1)}),c(a),a.redraw()},200),g=function(a,b){b.$watch("series",function(c,f){void 0!==c&&(f||(f={length:0}),(c.length||0)>=(f.length||0)?d(a,b.series):(c.length||0)<(f.length||0)&&e(a,b.series))},!0)},h=function(a,b){b.$watch(function(){return(b.series||[]).map(function(a){return a.disabled})},function(c){c.length&&c.some(function(a){return void 0!==a})&&(c.forEach(function(c,d){var e,f;void 0!==c&&(e=b.series[d].name,f=a.series.filter(function(a){return a.name===e})[0],f&&f.setVisible(!c,!1))}),a.redraw())},!0)},i=function(a,b,c){c.redraw&&b.$watch("redraw",function(c){void 0!==c&&f(a,b.series)},!0)},j=function(a,b){b.$watch("loading",function(b){b?a.showLoading():a.hideLoading()})},k=function(a){angular.element(b).on("resize",function(){console.log("chart will reflow due to window resize event");var c=b.innerWidth-100+"px";angular.element(a.container).css("width",c)})},l=function(a,b,c){var d;b.$watch("options."+c,function(e,f){e&&e!==f&&(d=Array.isArray(b.options[c])?b.options[c]:[b.options[c]],a[c].forEach(function(a,b){a.update(d[b])}))},!0)};return function(a,b,c){g(a,b),i(a,b,c),h(a,b),j(a,b),l(a,b,"xAxis"),l(a,b,"yAxis"),k(a)}}]),angular.module("ui-highcharts").factory("$uiHighchartsHandleAttrs",["$timeout",function(a){var b=function(a,b,c){var d={};d[c]={},$.extend(!0,a.options,d),b[c]&&(a.options[c].text=b[c]),void 0===a.options[c].text&&(a.options[c].text="")},c=function(a,b){b.type&&$.extend(!0,a.options,{chart:{type:b.type}})},d=function(b,c,d,e){var f;c[d]&&(f={series:{point:{events:{}}}},("select"===e||"unselect"===e)&&(f.series.allowPointSelect=!0),f.series.point.events[e]=function(){b[d]({point:this}),a(function(){b.$apply()})},$.extend(!0,b.options.plotOptions,f))},e=function(a,b){b.legendItemClick&&$.extend(!0,a.options.plotOptions,{series:{events:{legendItemClick:function(){return a.legendItemClick({series:this}),!1}}}})};return function(a,f){a.options.plotOptions=a.options.plotOptions||{},b(a,f,"title"),b(a,f,"subtitle"),c(a,f),e(a,f),d(a,f,"pointClick","click"),d(a,f,"pointSelect","select"),d(a,f,"pointUnselect","unselect"),d(a,f,"pointMouseout","mouseOut"),d(a,f,"pointMousemove","mouseMove")}}]),angular.module("ui-highcharts").factory("$uiHighchartsTransclude",["$compile","$rootScope",function(a,b){var c=function(c,d){var e=a(c),f=d.$parent.$new();return function(){var a=$.extend(f,this),c=$(e(a));return b.$$phase=null,a.$apply(),$("<div></div>").append(c).html()}},d=function(a,b){$.extend(!0,b.options,{tooltip:{useHTML:!0,formatter:c(a,b)}})},e=function(a,b,d){var e={};e[d]=a.toArray().map(function(a){var d={title:{},labels:{}},e=$(a),f=$(a).find("labels");return e.attr("title")&&(d.title.text=e.attr("title")),void 0!==e.attr("opposite")&&"false"!==e.attr("opposite")&&(d.opposite=!0),f&&(d.labels.formatter=c(f.html(),b)),d}),b.options[d]&&(b.options[d]=Array.isArray(b.options[d])?b.options[d]:[b.options[d]]),$.extend(!0,b.options,e)};return function(a,b){var c=b.filter("tooltip").html(),f=b.filter("x-axis"),g=b.filter("y-axis");c&&d(c,a),f.length&&e(f,a,"xAxis"),g.length&&e(g,a,"yAxis")}}]),angular.module("ui-highcharts").service("$uiHighchartsUtilsService",function(){this.debounce=function(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}},this.difference=function(a,b,c){return a.filter(function(a){return b.every(function(b){return c(a)!==c(b)})})}}),!function(){var a=function(a){return["$uiHighChartsManager",function(b){return{restrict:"EAC",transclude:!0,replace:!0,template:"<div></div>",scope:{options:"=?",series:"=",redraw:"=",loading:"=",start:"=",end:"=",pointClick:"&",pointSelect:"&",pointUnselect:"&",pointMouseout:"&",pointMousemove:"&",legendItemClick:"&"},link:function(c,d,e,f,g){b.createInstance(a,d,c,e,g)}}}]};angular.module("ui-highcharts").directive("uiChart",a("Chart")).directive("uiStockChart",a("StockChart")).directive("uiMap",a("Map"))}(),function(){"use strict";function a(a,b,c){function d(d,e,f,g,h){f.options=$.extend(!0,f.options,{chart:{renderTo:e[0]}}),b(f,h()),c(f,g);var i=new Highcharts[d](f.options);if(a(i,f,g),g.id&&f.$parent){if(f.$parent[g.id])throw new Error("A HighChart object with reference "+g.chart+" has already been initialized.");f.$parent[g.id]=i}}var e={createInstance:d};return e}angular.module("ui-highcharts").factory("$uiHighChartsManager",a),a.$inject=["$uiHighchartsAddWatchers","$uiHighchartsTransclude","$uiHighchartsHandleAttrs"]}();
5,541
5,541
0.672983
689c9a6b279874ffc92aba0f94b766e2cff2ca4f
924
js
JavaScript
likes/likes-model.js
How-To-3-Lambda-School-Build-Week-20-04/how-to-3-backend
9d616ae9ad0c417bcf7a86f5ead7f7ecf66339d1
[ "MIT" ]
null
null
null
likes/likes-model.js
How-To-3-Lambda-School-Build-Week-20-04/how-to-3-backend
9d616ae9ad0c417bcf7a86f5ead7f7ecf66339d1
[ "MIT" ]
1
2021-09-02T10:26:51.000Z
2021-09-02T10:26:51.000Z
likes/likes-model.js
How-To-3-Lambda-School-Build-Week-20-04/how-to-3-backend
9d616ae9ad0c417bcf7a86f5ead7f7ecf66339d1
[ "MIT" ]
1
2020-04-25T22:05:53.000Z
2020-04-25T22:05:53.000Z
const db = require("../data/dbConfig.js"); const { findByID } = require("../howto/howto-model"); // return user's like on a post function getUserLikes(userId) { console.log(userId); return db("likes") .join("user", "user.id", "likes.user_id") .where({ user_id: userId }) .select("likes.id", "likes.user_id", "likes.howto_id"); } // return all likes on a post function getHowtoLikes(howtoId) { return db("likes") .join("howto", "howto.id", "likes.howto_id") .where({ howto_id: howtoId }) .select("likes.id", "likes.user_id", "likes.howto_id"); } // add a like to a post function addLike(like) { return db("likes") .insert(like, "id") .then(([id]) => { return db("likes").where({ id }); }); } // remove a like from a post function deleteLike(id) { return db("likes").where({ user_id: id }).del(); } module.exports = { addLike, getHowtoLikes, getUserLikes, deleteLike };
26.4
70
0.628788
689cd5b6235df400e1a296acbe46cba541d03878
1,378
js
JavaScript
cqrs-event-sourcing/Bar.Web/wwwroot/app/services/tabService.js
sharmasourabh/ddd
9aadf8ed0d4eab92b96312d86aba9545d7867cf0
[ "Apache-2.0" ]
12
2018-12-14T17:45:31.000Z
2021-03-11T17:32:02.000Z
cqrs-event-sourcing/Bar.Web/wwwroot/app/services/tabService.js
sharmasourabh/ddd
9aadf8ed0d4eab92b96312d86aba9545d7867cf0
[ "Apache-2.0" ]
null
null
null
cqrs-event-sourcing/Bar.Web/wwwroot/app/services/tabService.js
sharmasourabh/ddd
9aadf8ed0d4eab92b96312d86aba9545d7867cf0
[ "Apache-2.0" ]
4
2019-05-23T05:57:19.000Z
2021-03-13T18:45:19.000Z
(app => { app.factory("TabService", ["$http", "toastr", function ($http, toastr) { const baseUrl = "api/tab"; return { openTab: openTab, closeTab: closeTab, orderBeverages: orderBeverages, serveBeverages: serveBeverages, getTabDetails: getTabDetails }; function openTab(tabId, clientName, success) { return $http.post(`${baseUrl}/open/${tabId}`, `"${clientName}"`) .then(success, showResponseErrors); } function closeTab(tabId, amountPaid, success) { return $http.post(`${baseUrl}/close/${tabId}`, amountPaid) .then(success, showResponseErrors); } function orderBeverages(tabId, beverageNumbers, success) { return $http.post(`${baseUrl}/order/${tabId}`, beverageNumbers) .then(success, showResponseErrors); } function serveBeverages(tabId, beverageNumbers, success) { return $http.post(`${baseUrl}/serve/${tabId}`, beverageNumbers) .then(success, showResponseErrors); } function getTabDetails(tabId, success) { return $http.get(`${baseUrl}/${tabId}`) .then(response => success(response.data), showResponseErrors); } function showResponseErrors(response) { const errors = response.data.messages; if (errors) { toastr.error(errors.join("; ", "Error")); } } }]); })(app);
29.319149
74
0.622642
689d0e6a8c44b26c19cb8bbedda9bf804687aeaa
1,944
js
JavaScript
src/StopWatch.js
Brattin11/ticker
4ac0e889787ac5e92e82551a393c28f944523a12
[ "MIT" ]
null
null
null
src/StopWatch.js
Brattin11/ticker
4ac0e889787ac5e92e82551a393c28f944523a12
[ "MIT" ]
null
null
null
src/StopWatch.js
Brattin11/ticker
4ac0e889787ac5e92e82551a393c28f944523a12
[ "MIT" ]
null
null
null
import React, { useState, useEffect } from "react"; const wait = async (millis) => new Promise((resolve) => setTimeout(resolve, millis)); const formatTime = (millis) => { const seconds = millis / 1000; return `${Math.floor(seconds / 60) > 0 ? Math.floor(seconds / 60) : ""}${ Math.floor(seconds / 60) > 0 ? ":" : "" }${(seconds % 60).toFixed(2)}`; }; const StopWatch = ({ style = {}, ...rest }) => { const [timing, setTiming] = useState(false); const [elapsedTime, setElapsedTime] = useState(0); const [lap, setLap] = useState(0); useEffect(() => { if (timing) { const update = async () => { await wait(200); setElapsedTime(elapsedTime + 200); }; update(); } }, [elapsedTime, timing]); useEffect(() => { setElapsedTime(0); }, [lap]); return ( <div style={{ display: "flex", justifyContent: "space-between", flexFlow: "column", ...style, }} {...rest} > <div style={{ display: "flex", flexFlow: "column", margin: "0.1em", justifyContent: "center", }} > <div style={{ display: "flex", justifyContent: "center", }} > <div>{formatTime(elapsedTime)}</div> <button onClick={() => { setTiming(!timing); }} > {timing ? "stop" : "start"} </button> <button onClick={() => { setElapsedTime(0); setTiming(false); }} > reset </button> <button onClick={() => { setLap(elapsedTime); }} > lap </button> {lap > 0 && <div>{formatTime(lap)}</div>} </div> </div> </div> ); }; export default StopWatch;
21.842697
75
0.441358
689d785d2fe2d498325c3644e7efefc4ae5126f7
2,081
js
JavaScript
model/MonetaryAmount.js
UHCToken/uhx-api
9afb62ccf307666a862f488c91855e48386b120f
[ "MIT" ]
2
2018-08-18T18:37:36.000Z
2018-09-28T16:52:28.000Z
model/MonetaryAmount.js
UHCToken/uhx-api
9afb62ccf307666a862f488c91855e48386b120f
[ "MIT" ]
null
null
null
model/MonetaryAmount.js
UHCToken/uhx-api
9afb62ccf307666a862f488c91855e48386b120f
[ "MIT" ]
null
null
null
'use strict'; /** * Copyright 2018 Universal Health Coin * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. * * Developed on behalf of Universal Health Coin by the Mohawk mHealth & eHealth Development & Innovation Centre (MEDIC) */ const ModelBase = require('./ModelBase'); /** * @class * @summary Represents a wallet balance * @swagger * definitions: * MonetaryAmount: * properties: * value: * type: string * description: Indicates the value of the monetary amount * code: * type: string * description: The currency or digital asset code for the monetary amount */ module.exports = class MonetaryAmount extends ModelBase { /** * @constructor * @summary Instantiates the monetary amount object * @param {string} code The code of the monetary amount (example: USD) * @param {number} amount The amount */ constructor(value, code) { super(); this.code = code == "native" ? "XLM" : code; this.value = value; } }
40.803922
152
0.695819
689f5d1d0d3d469524bed2ab18434194405f726f
994
js
JavaScript
studio/node_modules/hashlru/bench.js
sajustsmile/twitter-blockchain
3b79a54024ccb499fd128e693e2c3dd363a0572c
[ "Apache-2.0" ]
243
2016-12-23T23:17:44.000Z
2022-03-23T15:39:48.000Z
studio/node_modules/hashlru/bench.js
sajustsmile/twitter-blockchain
3b79a54024ccb499fd128e693e2c3dd363a0572c
[ "Apache-2.0" ]
38
2018-03-30T19:12:20.000Z
2022-03-28T07:25:07.000Z
studio/node_modules/hashlru/bench.js
sajustsmile/twitter-blockchain
3b79a54024ccb499fd128e693e2c3dd363a0572c
[ "Apache-2.0" ]
41
2016-12-24T12:51:55.000Z
2021-06-01T07:46:18.000Z
var Stats = require('statistics/mutate') var LRU = require('./') //simple benchmarks, and measure standard deviation function run (N, op, init) { var stats = null, value for(var j = 0; j < 100; j++) { if(init) value = init(j) var start = Date.now() for(var i = 0; i < N; i++) op(value, i) stats = Stats(stats, N/((Date.now() - start))) } return stats } //set 1000 random items, then read 10000 items. //since they are random, there will be misses as well as hits console.log('GET', run(100000, function (lru, n) { lru.get(~~(Math.random()*1000)) // lru.set(n, Math.random()) }, function () { var lru = LRU(1000) for(var i = 0; i ++ ; i < 1000) lru.set(~~(Math.random()*1000), Math.random()) return lru })) //set 100000 random values into LRU for 1000 values. //this means 99/100 should be evictions console.log('SET', run(100000, function (lru, n) { lru.set(~~(Math.random()*100000), Math.random()) }, function () { return LRU(1000) }))
20.708333
61
0.614688
689fa3fd6b952d76b6549219c5c6470a4575ada8
478
js
JavaScript
web/src/utils/optimize.js
aereeeee/2019-02
d5894a9a21a90f465be553cc9b43562b4f88d1ec
[ "MIT" ]
37
2019-11-04T03:06:31.000Z
2021-03-13T11:32:32.000Z
web/src/utils/optimize.js
aereeeee/2019-02
d5894a9a21a90f465be553cc9b43562b4f88d1ec
[ "MIT" ]
119
2019-11-07T08:15:59.000Z
2020-06-26T17:08:13.000Z
web/src/utils/optimize.js
aereeeee/2019-02
d5894a9a21a90f465be553cc9b43562b4f88d1ec
[ "MIT" ]
9
2019-11-16T14:07:30.000Z
2020-12-12T08:47:43.000Z
const throttle = (func, delay) => { let timeout = null; return (...args) => { if (timeout) return; timeout = setTimeout(() => { func.call(this, ...args); clearTimeout(timeout); timeout = null; }, delay); }; }; const debounce = (func, delay) => { let timeout = null; return (...args) => { clearTimeout(timeout); timeout = setTimeout(() => { func.call(this, ...args); }, delay); }; }; export { throttle, debounce };
18.384615
35
0.531381
689ff1f54dcc784fb774bf6d456046dbf88bd8ea
8,091
js
JavaScript
app/splitter.js
richard-boeve/Splitter
08e102439b2c771898b13d78dcee39a020794cfa
[ "MIT" ]
null
null
null
app/splitter.js
richard-boeve/Splitter
08e102439b2c771898b13d78dcee39a020794cfa
[ "MIT" ]
null
null
null
app/splitter.js
richard-boeve/Splitter
08e102439b2c771898b13d78dcee39a020794cfa
[ "MIT" ]
null
null
null
const Web3 = require("web3"); const Promise = require("bluebird"); const $ = require("jquery"); const contract = require("truffle-contract"); const splitterJson = require("../build/contracts/Splitter.json"); require("file-loader?name=./index.html!./index.html"); // Use a web3 browser if availble if (typeof web3 !== 'undefined') { console.log('Web3 browser detected! ' + web3.currentProvider.constructor.name) window.web3 = new Web3(web3.currentProvider); // Otherwise, use a own provider with port 8545 } else { console.log('Web3 browser not detected, setting own provider!') window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); } Promise.promisifyAll(web3.eth, { suffix: "Promise" }); Promise.promisifyAll(web3.version, { suffix: "Promise" }); const Splitter = contract(splitterJson); Splitter.setProvider(web3.currentProvider); // Upon loading of the site check the balance of the contract and return to populate window.addEventListener('load', function () { return Splitter.deployed() .then(_split => { split = _split; depositEvent(); withdrawEvents(); depositEventConsole(); return web3.eth.getBalancePromise(split.address); }).then(balance => $("#balanceContract").html(web3.fromWei(balance.toString(10)) )) .then(() => $("#send").click(deposit)) .then(() => $("#withdraw").click(withdrawFunds)) .catch(console.error); }); //Function that allows a deposit (for two receivers) to be made to the contract const deposit = function () { let split; window.account = $("input[name='sender']").val(); return Splitter.deployed() //deposit the entered amount of Ether to the contract, where the contract will split this between the entered recipient1 and recipient2 .then(_split => { split = _split; console.log("Splitter address: ", split.address); return split.deposit.sendTransaction($("input[name='recipient1']").val(), $("input[name='recipient2']").val(), { from: window.account, value: web3.toWei($("input[name='amount']").val(), "ether"), gas: '210000' }); }) //return the transaction hash .then(txHash => { $("#status").html("Transaction on the way " + txHash); const tryAgain = () => web3.eth.getTransactionReceiptPromise(txHash) .then(receipt => receipt !== null ? receipt : Promise.delay(1000).then(tryAgain)); return tryAgain(); }) //return a success or failure of the transaction .then(receipt => { if (parseInt(receipt.status) != 1) { console.error("Wrong status"); console.error(receipt); $("#status").html("There was an error in the tx execution, status not 1"); } else if (receipt.logs.length == 0) { console.error("Empty logs"); console.error(receipt); $("#status").html("There was an error in the tx execution"); } else { let logDeposit = split.LogDeposit().formatter(receipt.logs[0]); console.log("Sender's address: " + logDeposit.args.sender); console.log("Amount deposited: " + web3.fromWei(logDeposit.args.depositAmount)); console.log("Receiver 1: " + logDeposit.args.receiver1); console.log("Receiver 2: " + logDeposit.args.receiver2); $("#status").html("Transfer executed"); } return web3.eth.getBalancePromise(split.address);; }) //show the updated balance of the contract .then(balance => { $("#balanceContract").html(web3.fromWei(balance.valueOf())); }) //.then(() => depositEvent); .catch(e => { $("#status").html(e.toString()); console.error(e); }); } function depositEvent(){ eventVar = split.LogDeposit({},{ fromBlock: 0, toBlock: 'latest' }); eventVar.watch(function(error, event){ if(error){ console.error(error); } else{ $("#history-deposit").find('tbody').append("<tr>") .append("<td>Deposit</td>") .append("<td>"+event.args.sender+"</td>") .append("<td>"+event.args.receiver1+"</td>") .append("<td>"+event.args.receiver2+"</td>") .append("<td>"+event.args.depositAmount.toString(10)+"</td>") .append("</tr>"); } }); } function depositEventConsole(){ eventVar = split.LogDeposit({},{ fromBlock: 0, toBlock: 'latest' }); eventVar.watch(function(error, event){ if(error){ console.error(error); } else{ console.log("Deposit Event:"); console.log(event.args.sender); console.log(event.args.receiver1); console.log(event.args.receiver2); console.log(event.args.depositAmount.toString(10)); } }); } function withdrawEvents(){ eventVar = split.LogWithdrawFunds({},{ fromBlock: 0, toBlock: 'latest' }); eventVar.watch(function(error, event){ if(error){ console.error(error); } else{ $("#history-withdraw").find('tbody').append("<tr>") .append("<td>Withdraw</td>") .append("<td>"+event.args.sender+"</td>") .append("<td>"+event.args.amount.toString(10)+"</td>") .append("</tr>"); } }); } // function that allows the inputted address to withdraw its funds from the contract const withdrawFunds = function () { let split; accountToWithdraw = $("input[name='withdrawalAddress']").val(); return Splitter.deployed() //Run the withdrawFunds function in the contract for one of the recipients .then(_split => { split = _split; return split.withdrawFunds.sendTransaction({ from: accountToWithdraw }); }) //return the transaction hash .then(txHash => { $("#status").html("Transaction on the way " + txHash); const tryAgain = () => web3.eth.getTransactionReceiptPromise(txHash) .then(receipt => receipt !== null ? receipt : Promise.delay(1000).then(tryAgain)); return tryAgain(); }) //return a success of failure message .then(receipt => { if (parseInt(receipt.status) != 1) { console.error("Wrong status"); console.error(receipt); $("#status").html("There was an error in the tx execution, status not 1"); } else if (receipt.logs.length == 0) { console.error("Empty logs"); console.error(receipt); $("#status").html("There was an error in the tx execution"); } else { let logWithdraw = split.LogWithdrawFunds().formatter(receipt.logs[0]); console.log("Sender's address: " + logWithdraw.args.sender); console.log("Amount withdrawn: " + web3.fromWei(logWithdraw.args.amount)); $("#status").html("Transfer executed"); } return web3.eth.getBalancePromise(split.address); }) //show the updated balance of the contract .then(balance => { $("#balanceContract").html(web3.fromWei(balance.valueOf())); }) .catch(e => { $("#status").html(e.toString()); console.error(e); });; };
41.92228
225
0.534915
68a0b777dfffef4919aa8f1b044e088208e5da5b
60
js
JavaScript
node_modules/@carbon/icons-react/es/location/16.js
GregDevProjects/carbon-header-fix
9c7986a0eb0ecfa797d14d4b57ec01b6af7d72d8
[ "Apache-2.0" ]
1
2020-09-18T05:33:29.000Z
2020-09-18T05:33:29.000Z
node_modules/@carbon/icons-react/es/location/16.js
GregDevProjects/carbon-header-fix
9c7986a0eb0ecfa797d14d4b57ec01b6af7d72d8
[ "Apache-2.0" ]
10
2021-03-01T20:53:14.000Z
2022-02-26T17:48:08.000Z
node_modules/@carbon/icons-react/es/location/16.js
GregDevProjects/carbon-header-fix
9c7986a0eb0ecfa797d14d4b57ec01b6af7d72d8
[ "Apache-2.0" ]
1
2020-10-03T03:38:59.000Z
2020-10-03T03:38:59.000Z
import { Location16 } from '..'; export default Location16;
20
32
0.716667
68a153e4c571ab73a6f0f0906f326fc8b775848a
461
js
JavaScript
cppapi/html/struct_bond_1_1_allocator_1_1_aligned_object_deallocator.js
bondscripting/bondscripting.github.io
089f52f8fb2cd08a7c7b35dc5ce2f860ef1e04e5
[ "MIT" ]
null
null
null
cppapi/html/struct_bond_1_1_allocator_1_1_aligned_object_deallocator.js
bondscripting/bondscripting.github.io
089f52f8fb2cd08a7c7b35dc5ce2f860ef1e04e5
[ "MIT" ]
null
null
null
cppapi/html/struct_bond_1_1_allocator_1_1_aligned_object_deallocator.js
bondscripting/bondscripting.github.io
089f52f8fb2cd08a7c7b35dc5ce2f860ef1e04e5
[ "MIT" ]
null
null
null
var struct_bond_1_1_allocator_1_1_aligned_object_deallocator = [ [ "AlignedObjectDeallocator", "struct_bond_1_1_allocator_1_1_aligned_object_deallocator.html#ade1f7f53aa017870b32cc36aed815fb1", null ], [ "operator()", "struct_bond_1_1_allocator_1_1_aligned_object_deallocator.html#aa024e045f42471cbd94d8f352254ee6f", null ], [ "mAllocator", "struct_bond_1_1_allocator_1_1_aligned_object_deallocator.html#a0d36248418e19d99419c4453d9a1ef90", null ] ];
76.833333
140
0.850325
68a16cf393957f41283c32de5c91a5e61ff6f1f0
401
js
JavaScript
admin/src/main.js
lh-jiezhou/daoyun
fa20cd0ce96acfc80ca22e8ec2573431a6c37025
[ "MIT" ]
null
null
null
admin/src/main.js
lh-jiezhou/daoyun
fa20cd0ce96acfc80ca22e8ec2573431a6c37025
[ "MIT" ]
7
2020-08-26T08:11:21.000Z
2022-02-27T09:51:17.000Z
admin/src/main.js
lh-jiezhou/daoyun
fa20cd0ce96acfc80ca22e8ec2573431a6c37025
[ "MIT" ]
null
null
null
import Vue from 'vue' import App from './App.vue' import './plugins/element.js' import router from './router' Vue.config.productionTip = false // 从http.js中导入axios 数据请求接口 import http from './http' import http_egg from './http_egg' // 并将其加入的Vue的实例(原型)属性当中,以后在任意页面可以this.http访问 Vue.prototype.$http = http Vue.prototype.$http_egg = http_egg new Vue({ router, render: h => h(App) }).$mount('#app')
21.105263
44
0.715711
68a23c27d35ea7399ab1b5c2d72b4834e775d0c9
281
js
JavaScript
src/app/app.js
DBuckley0126/javascript-project-gyro-frontend
50b68384bc78a763cb5781ae093dbe93d063b6c2
[ "MIT" ]
null
null
null
src/app/app.js
DBuckley0126/javascript-project-gyro-frontend
50b68384bc78a763cb5781ae093dbe93d063b6c2
[ "MIT" ]
2
2021-03-10T04:43:35.000Z
2021-05-11T01:28:22.000Z
src/app/app.js
DBuckley0126/javascript-project-gyro-frontend
50b68384bc78a763cb5781ae093dbe93d063b6c2
[ "MIT" ]
null
null
null
import {AppManager, MobileGameManager, DesktopGameManager} from './modules' import '../stylesheets/app.css' document.addEventListener('DOMContentLoaded', () => { const container = document.querySelector('#app-container') window.AppManager = new AppManager(container) })
20.071429
75
0.747331
68a28c76497efc75bf45590e864d0a24ece1f569
1,304
js
JavaScript
docs/html/search/enumvalues_0.js
inertialsense/InertialSenseSDK
6b3ba4de1246c1cabe49bae7e16e8322fdbdb359
[ "MIT" ]
15
2017-05-22T17:51:39.000Z
2020-06-18T04:14:55.000Z
docs/html/search/enumvalues_0.js
inertialsense/InertialSenseSDK
6b3ba4de1246c1cabe49bae7e16e8322fdbdb359
[ "MIT" ]
28
2017-05-21T02:30:28.000Z
2020-07-20T15:38:27.000Z
docs/html/search/enumvalues_0.js
inertialsense/InertialSenseSDK
6b3ba4de1246c1cabe49bae7e16e8322fdbdb359
[ "MIT" ]
11
2018-07-03T03:22:11.000Z
2020-08-04T08:01:12.000Z
var searchData= [ ['_5fptype_5fascii_5fnmea',['_PTYPE_ASCII_NMEA',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92aadc2747a94a51184d91a12b0cec74590',1,'ISComm.h']]], ['_5fptype_5finertial_5fsense_5fack',['_PTYPE_INERTIAL_SENSE_ACK',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a322b1d505a690cb6277db78cbeeda393',1,'ISComm.h']]], ['_5fptype_5finertial_5fsense_5fcmd',['_PTYPE_INERTIAL_SENSE_CMD',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a9a0e8c7b3cb0a61f2101c5b1a9540167',1,'ISComm.h']]], ['_5fptype_5finertial_5fsense_5fdata',['_PTYPE_INERTIAL_SENSE_DATA',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a7a2019d0fee2fc6678a16f736488b4ca',1,'ISComm.h']]], ['_5fptype_5fnone',['_PTYPE_NONE',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92ae69f248f76f2905c0fabf5b94f8ca99e',1,'ISComm.h']]], ['_5fptype_5fparse_5ferror',['_PTYPE_PARSE_ERROR',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a47030cef4455d88b0d81f625fd34f3fc',1,'ISComm.h']]], ['_5fptype_5frtcm3',['_PTYPE_RTCM3',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a0cb31e2b793b68365c81093c80c66d8f',1,'ISComm.h']]], ['_5fptype_5fublox',['_PTYPE_UBLOX',['../_i_s_comm_8h.html#a932bee6e7c2e702a8cce14cfd728ba92a500b3fb138df17ec2dbdcbe35ee8aa7c',1,'ISComm.h']]] ];
108.666667
177
0.822853
68a2e087a20346e6e711c0450479cd23ed1a5f83
814
js
JavaScript
app/lib/models.js
nstojiljkovic/tppoker
6c7051b80d19fdf42b94d7e2cbf5f4f888373813
[ "0BSD" ]
1
2016-08-11T12:01:24.000Z
2016-08-11T12:01:24.000Z
app/lib/models.js
nstojiljkovic/tppoker
6c7051b80d19fdf42b94d7e2cbf5f4f888373813
[ "0BSD" ]
null
null
null
app/lib/models.js
nstojiljkovic/tppoker
6c7051b80d19fdf42b94d7e2cbf5f4f888373813
[ "0BSD" ]
null
null
null
require('ember-tppoker/core'); require('ember-tppoker/models/application'); require('ember-tppoker/models/project'); require('ember-tppoker/models/release'); require('ember-tppoker/models/iteration'); require('ember-tppoker/models/user_story'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game'); require('ember-tppoker/models/game');
38.761905
44
0.77027
68a4d32645346fc95491fcbb2490a82c36a52819
29,391
js
JavaScript
assets/js/global/charts/classic-metrics-charts.js
gaxon-lab/jumbo-jquery-bootstrap
deeb2f12f171e96ba61cb078ef244282a2d14c3d
[ "MIT" ]
null
null
null
assets/js/global/charts/classic-metrics-charts.js
gaxon-lab/jumbo-jquery-bootstrap
deeb2f12f171e96ba61cb078ef244282a2d14c3d
[ "MIT" ]
null
null
null
assets/js/global/charts/classic-metrics-charts.js
gaxon-lab/jumbo-jquery-bootstrap
deeb2f12f171e96ba61cb078ef244282a2d14c3d
[ "MIT" ]
null
null
null
(function ($) { "use strict"; var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; var today = new Date(); var currentMont = today.getMonth(); var lastMonthName = months[currentMont - 1]; var color = Chart.helpers.color; var chartColors = { red: '#8B061E', white: '#ffffff', pink: '#ff445d', orange: '#ff8f3a', yellow: '#ffde16', lightGreen: '#24cf91', green: '#4ecc48', blue: '#5797fc', skyBlue: '#33d4ff', gray: '#cfcfcf', cyan: '#03DAC5', }; // creating chart shadow var draw = Chart.controllers.line.prototype.draw; Chart.controllers.line = Chart.controllers.line.extend({ draw: function () { draw.apply(this, arguments); var ctx = this.chart.chart.ctx; var showShadow = ($(ctx.canvas).data('shadow')) ? $(ctx.canvas).data('shadow') : 'no'; var chartType = ($(ctx.canvas).data('type')) ? $(ctx.canvas).data('type') : 'area'; if (showShadow === 'yes' && chartType === 'area') { var _fill = ctx.fill; ctx.fill = function () { ctx.save(); ctx.shadowColor = color('#5c5c5c').alpha(0.5).rgbString(); ctx.shadowBlur = 16; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 0; _fill.apply(this, arguments); ctx.restore(); } } else if (showShadow === 'yes' && chartType === 'line') { var _stroke = ctx.stroke; ctx.stroke = function () { ctx.save(); ctx.shadowColor = '#07C'; ctx.shadowBlur = 10; ctx.shadowOffsetX = 0; ctx.shadowOffsetY = 4; _stroke.apply(this, arguments); ctx.restore(); } } } }); // creating center text Chart.pluginService.register({ beforeDraw: function (chart) { var width = chart.chart.width, height = chart.chart.height, ctx = chart.chart.ctx; var center_text = $(ctx.canvas).data('fill'); if (center_text) { ctx.restore(); var fontSize = (height / 114).toFixed(2); ctx.font = 2 + "rem Source Sans Pro"; ctx.textBaseline = "middle"; ctx.fillStyle = "#fff"; var textX = Math.round((width - ctx.measureText(center_text).width) / 2), textY = height / 2; ctx.fillText(center_text, textX, textY); ctx.save(); } } }); // default chart js options var defaultOptions = { responsive: true, legend: { display: false }, layout: { padding: 0 }, scales: { xAxes: [{ display: false }], yAxes: [{ display: false }] } }; // Online Signups if ($('#chart-online-signups').length) { var optsOnlineSignups = $.extend({}, defaultOptions, { tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#0062FF', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function () { return false; }, label: function (tooltipItem) { return tooltipItem.label + ': ' + tooltipItem.value + ' Signups'; } } }, hover: { mode: 'index', intersect: false, } }); var ctxOnlineSignups = document.getElementById('chart-online-signups').getContext('2d'); new Chart(ctxOnlineSignups, { type: 'line', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October'], datasets: [{ label: 'Online Signups', data: [2000, 1450, 1100, 1400, 900, 1600, 1300, 1800, 1200, 1600], fill: false, borderColor: '#0062FF', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#0062FF', pointHoverBorderColor: '#fff' }] }, options: optsOnlineSignups }); } // Last month sale if ($('#chart-last-month-sale').length) { var optsLastMonthSale = $.extend({}, defaultOptions, { tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#4200FF', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function () { return false; }, label: function (tooltipItem) { return lastMonthName + ' ' + tooltipItem.label + ': $' + tooltipItem.value; } } }, hover: { mode: 'index', intersect: false, } }); var ctxLastMonthSale = document.getElementById('chart-last-month-sale').getContext('2d'); new Chart(ctxLastMonthSale, { type: 'line', data: { labels: [3, 6, 9, 12, 15, 18, 21, 24, 27, 30], datasets: [{ label: 'Sale', data: [2000, 1450, 1650, 1200, 1800, 1300, 1550, 1850, 1400, 950], fill: false, borderColor: '#4200FF', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#4200FF', pointHoverBorderColor: '#fff' }] }, options: optsLastMonthSale }); } // Total Revenue if ($('#chart-total-revenue').length) { var optsTotalRevenue = $.extend({}, defaultOptions, { tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#29CF6B', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function () { return false; }, label: function (tooltipItem) { return tooltipItem.label + ': $' + tooltipItem.value; } } }, hover: { mode: 'index', intersect: false, } }); var ctxTotalRevenue = document.getElementById('chart-total-revenue').getContext('2d'); new Chart(ctxTotalRevenue, { type: 'line', data: { labels: months, datasets: [{ label: '', data: [1000, 850, 1400, 700, 1100, 900, 1600, 900, 1250, 1000, 1400, 1800], fill: false, borderColor: '#29CF6B', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#29CF6B', pointHoverBorderColor: '#fff' }] }, options: optsTotalRevenue }); } // Total Email Sent if ($('#chart-total-mail-sent').length) { var optsTotalEmailSent = $.extend({}, defaultOptions, { tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#FFA601', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function (tooltipItems) { var tooltipItem = tooltipItems[0]; return 'Month ' + tooltipItem.label; }, label: function (tooltipItem, data) { var label = data.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ' - '; } label += tooltipItem.yLabel; return label; } } }, hover: { mode: 'index', intersect: false, } }); var ctxTotalEmailSent = document.getElementById('chart-total-mail-sent').getContext('2d'); new Chart(ctxTotalEmailSent, { type: 'line', data: { labels: ['Jan', 'Fab', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], datasets: [ { label: 'Sent', data: [1600, 1000, 1100, 1200, 1300, 1450, 1800, 2000, 1700, 1400, 1600, 1800], fill: false, borderColor: '#FFA601', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#F3E5CF', pointHoverBorderColor: '#fff' }, { label: 'Bounced', data: [1600, 1400, 1100, 800, 1300, 1900, 1800, 1700, 1400, 1100, 1500, 1800], fill: false, borderColor: '#F3E5CF', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#FFA601', pointHoverBorderColor: '#fff' } ] }, options: optsTotalEmailSent }); } // New Subscribers if ($('#chart-new-subscribers').length) { var optsNewSubscribers = $.extend({}, defaultOptions, { aspectRatio: 1.4, tooltips: { displayColors: false, backgroundColor: '#fff', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function (tooltipItems) { return false; }, label: function (tooltipItem, data) { var label = tooltipItem.label || ''; if (label) { label += ': '; } label += tooltipItem.yLabel + ' ' + data.datasets[tooltipItem.datasetIndex].label; return label; }, labelTextColor: function (tooltipItem, chart) { return '#6200EE'; } } }, }); var ctxNewSubscribers = document.getElementById('chart-new-subscribers').getContext('2d'); new Chart(ctxNewSubscribers, { type: 'bar', data: { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], datasets: [{ label: 'Users', data: [1000, 500, 1300, 300, 750, 850, 150], backgroundColor: '#fff', hoverBackgroundColor: '#fff', barPercentage: 0.5, barThickness: 6, }] }, options: optsNewSubscribers }); } // News Articles if ($('#chart-news-articles').length) { var optsNewsArticles = $.extend({}, defaultOptions, { scales: { xAxes: [{ display: false }], yAxes: [{ display: false, ticks: { beginAtZero: true, padding: 30, } }] }, tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#00C4B4', borderWidth: 1, borderColor: '#fff', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function (tooltipItems) { return false; }, label: function (tooltipItem, data) { var label = tooltipItem.label || ''; if (label) { label += ': '; } label += tooltipItem.yLabel; return label; }, } }, hover: { mode: 'index', intersect: false, } }); var ctxNewsArticles = document.getElementById('chart-news-articles').getContext('2d'); new Chart(ctxNewsArticles, { type: 'line', data: { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'], datasets: [{ label: 'Users', data: [1500, 1600, 1900, 2200, 2000, 1650, 1600, 1900, 2400], fill: false, borderColor: '#fff', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#00C4B4', pointHoverBorderColor: '#fff' }] }, options: optsNewsArticles }); } // New Authors if ($('#chart-new-authors').length) { var proposal_data = { labels: [ "Active", "Pending" ], datasets: [ { data: [270, 90], backgroundColor: [ color(chartColors.white).alpha(1).rgbString(), color(chartColors.red).alpha(1).rgbString() ], hoverBackgroundColor: [ color(chartColors.yellow).alpha(0.8).rgbString(), color(chartColors.blue).alpha(0.6).rgbString() ] } ] }; new Chart(document.getElementById('chart-new-authors'), { type: 'doughnut', data: proposal_data, options: { tooltips: { displayColors: false, backgroundColor: '#8B061E', yPadding: 10, xPadding: 8, cornerRadius: 4, }, rotation: 1.5, borderWidth: 1, cutoutPercentage: 80, responsive: false, legend: { display: false } } }); } // Avg Daily Traffic if ($('#chart-avg-daily-traffic').length) { var optsAvgDailyTraffic = $.extend({}, defaultOptions, { elements: { line: { tension: 0, // disables bezier curves } }, scales: { xAxes: [{ display: false }], yAxes: [{ display: false, ticks: { beginAtZero: true, padding: 30, } }] }, tooltips: { mode: 'index', intersect: false, displayColors: false, backgroundColor: '#0795F4', borderWidth: 1, borderColor: '#fff', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function (tooltipItems) { return false; }, label: function (tooltipItem, data) { var label = tooltipItem.label || ''; if (label) { label += ': '; } label += tooltipItem.yLabel; return label; }, } }, hover: { mode: 'index', intersect: false, } }); var ctxAvgDailyTraffic = document.getElementById('chart-avg-daily-traffic').getContext('2d'); new Chart(ctxAvgDailyTraffic, { type: 'line', data: { labels: ['Mon', 'Tues', 'Wed', 'Thru', 'Fri', 'Sat', 'Sun'], datasets: [{ label: 'Users', data: [500, 1500, 1200, 1750, 1000, 1400, 1800], backgroundColor: '#41AEF7', borderColor: '#fff', pointRadius: 1.5, pointBorderWidth: 0, pointHoverRadius: 5, pointHoverBorderWidth: 2, pointHoverBackgroundColor: '#00C4B4', pointHoverBorderColor: '#fff' }] }, options: optsAvgDailyTraffic }); } // Year Sale Report if ($('#chart-year-sale-report').length) { var optsYearSaleReport = $.extend({}, defaultOptions, { scales: { xAxes: [{ display: true, gridLines: { display: false, }, ticks: { fontColor: "#6200EE", // this here }, }], yAxes: [{ display: false, ticks: { beginAtZero: true, } }] }, tooltips: { displayColors: false, backgroundColor: '#fff', titleFontColor: '#000', yPadding: 10, xPadding: 8, cornerRadius: 4, callbacks: { title: function (tooltipItems) { var tooltipItem = tooltipItems[0]; return 'Month: ' + months[tooltipItem.index]; }, labelTextColor: function (tooltipItem, chart) { return '#6200EE'; } } }, }); var ctxYearSaleReport = document.getElementById('chart-year-sale-report').getContext('2d'); new Chart(ctxYearSaleReport, { type: 'bar', data: { labels: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], datasets: [{ label: 'Amount', data: [2700, 3700, 3000, 2600, 2700, 4200, 4300, 2600, 4300, 3900, 2600, 2600], backgroundColor: '#6200EE', hoverBackgroundColor: '#6200EE', borderWidth: 0, categoryPercentage: 1.0, barPercentage: 0.4 }] }, options: optsYearSaleReport }); } // Google insight score if ($.isFunction($.fn.circleProgress) && $('#circle-google-insight-score').length) { $('#circle-google-insight-score').circleProgress({ value: 1, size: 120, thickness: 15, lineCap: "round", startAngle: -Math.PI / 4 * 2, fill: {color: '#03DAC5'} }); } // Application if ($('#chart-application').length) { var ctxApplication = document.getElementById('chart-application').getContext('2d'); var optsApplication = $.extend({}, defaultOptions, { tooltips: { displayColors: false, backgroundColor: '#fff', yPadding: 10, xPadding: 8, cornerRadius: 4, bodyFontSize: 16, callbacks: { label: function (tooltipItem, data) { var dataset = data.datasets[0]; var label = data.labels[tooltipItem.index] || ''; if (label) { label += ': '; } label += dataset.data[tooltipItem.index] + '%'; return label; }, labelTextColor: function (tooltipItem, chart) { return '#000'; } } }, }); new Chart(ctxApplication, { type: 'pie', data: { labels: ['Windows', 'Android', 'Apple'], datasets: [ { data: [25.85, 25.91, 50.85], backgroundColor: ['#0795F4', '#23036A', '#8DCD03'] } ] }, options: optsApplication }); } // Orders if ($('#chart-radar-orders').length) { var ctxRadarOrders = document.getElementById('chart-radar-orders').getContext('2d'); var optsRadarOrders = $.extend({}, defaultOptions, { chartType: 'customRadar', borderColor: 'red', legend: { display: false, labels: { fontColor: '#AAAEB3', }, }, scale: { gridLines: { color: ['#AAAEB3', '#AAAEB3', '#AAAEB3', '#AAAEB3', '#AAAEB3', '#AAAEB3', '#AAAEB3'], }, }, }); var gradientBlue = ctxRadarOrders.createLinearGradient(0, 0, 0, 150); gradientBlue.addColorStop(0, 'rgba(127, 57, 251, 0.9)'); gradientBlue.addColorStop(1, 'rgba(151, 135, 255, 0.8)'); var gradientHoverBlue = ctxRadarOrders.createLinearGradient(0, 0, 0, 150); gradientHoverBlue.addColorStop(0, 'rgba(65, 65, 255, 1)'); gradientHoverBlue.addColorStop(1, 'rgba(131, 125, 255, 1)'); var gradientRed = ctxRadarOrders.createLinearGradient(0, 0, 0, 150); gradientRed.addColorStop(0, 'rgba(3, 218, 197, 0.9)'); gradientRed.addColorStop(1, 'rgba(3, 218, 197, 0.8)'); var gradientHoverRed = ctxRadarOrders.createLinearGradient(0, 0, 0, 150); gradientHoverRed.addColorStop(0, 'rgba(255, 65, 164, 1)'); gradientHoverRed.addColorStop(1, 'rgba(255, 115, 115, 1)'); Chart.plugins.register({ afterEvent: function (chart, e) { const datasets = chart.config.data.datasets; const canvas = chart.canvas; if (chart.options.chartType === 'customRadar') { chart.ctx.beginPath(); chart.ctx.moveTo(91, 69); chart.ctx.lineTo(152, 80); chart.ctx.lineTo(192, 75); chart.ctx.lineTo(213, 138); chart.ctx.lineTo(148, 168); chart.ctx.lineTo(105, 126); chart.ctx.fill(); chart.ctx.closePath(); if (chart.ctx.isPointInPath(e.x, e.y)) { let dataset = datasets[0]; dataset.backgroundColor = gradientHoverBlue; chart.update(); canvas.style.cursor = 'pointer'; } else { let dataset = datasets[0]; dataset.backgroundColor = gradientBlue; chart.update(); canvas.style.cursor = 'default'; } // Blue chart chart.ctx.beginPath(); chart.ctx.moveTo(85, 61); chart.ctx.lineTo(149, 66); chart.ctx.lineTo(224, 63); chart.ctx.lineTo(179, 112); chart.ctx.lineTo(152, 177); chart.ctx.lineTo(121, 117); chart.ctx.fill(); chart.ctx.closePath(); if (chart.ctx.isPointInPath(e.x, e.y)) { let dataset = datasets[1]; dataset.backgroundColor = gradientHoverRed; chart.ctx.shadowColor = 'rgba(0, 0, 0, 0.10)'; chart.ctx.shadowBlur = 10; chart.update(); canvas.style.cursor = 'pointer'; } else { let dataset = datasets[1]; dataset.backgroundColor = gradientRed; chart.ctx.shadowColor = 'rgba(0, 0, 0, 0)'; chart.ctx.shadowBlur = 0; chart.update(); canvas.style.cursor = 'default'; } } }, }); new Chart(ctxRadarOrders, { type: 'radar', data: { labels: ['', '', '', '', '', ''], datasets: [ { label: 'Donté Panlin', data: [70, 85, 65, 65, 85, 82], fill: true, backgroundColor: gradientBlue, borderColor: 'transparent', pointBackgroundColor: 'transparent', pointBorderColor: 'transparent', pointHoverBackgroundColor: 'transparent', pointHoverBorderColor: 'transparent', pointHitRadius: 50, }, { label: 'Mireska Sunbreeze', data: [80, 70, 80, 80, 75, 40], fill: true, backgroundColor: gradientRed, borderColor: 'transparent', pointBackgroundColor: 'transparent', pointBorderColor: 'transparent', pointHoverBackgroundColor: 'transparent', pointHoverBorderColor: 'transparent', pointHitRadius: 50, } ] }, options: optsRadarOrders }); } // Traffic Gauge if ($('#canvas-gauge-traffic').length) { var opts = { angle: 0, lineWidth: 0.25, pointer: { length: 0.35, strokeWidth: 0.09, color: 'rgba(0, 0, 0, 0.8)' }, staticZones: [ {strokeStyle: "#E00930", min: 0, max: 250}, {strokeStyle: "#FF8C00", min: 250, max: 500}, {strokeStyle: "#FFCA41", min: 500, max: 750}, {strokeStyle: "#8DCD03", min: 750, max: 1000} ], limitMax: false, limitMin: false, strokeColor: '#E0E0E0', highDpiSupport: true, fontSize: 16, }; var target = document.getElementById('canvas-gauge-traffic'); // your canvas element var gauge = new Gauge(target); // create sexy gauge! gauge.setTextField(document.getElementById("preview-gauge-traffic")); gauge.maxValue = 1000; // set max gauge value gauge.setMinValue(0); // Prefer setter over gauge.minValue = 0 gauge.animationSpeed = 20; // set animation speed (32 is default value) gauge.setOptions(opts); gauge.set(500); // set actual value } // =================================================================================================== // // Active users var optsActiveUsers = $.extend({}, defaultOptions); optsActiveUsers.elements = { line: { tension: 0, // disables bezier curves } }; var ctxActiveUsers = document.getElementById('chart-active-users').getContext('2d'); var gradientActiveUsers = ctxActiveUsers.createLinearGradient(0, 0, 230, 0); gradientActiveUsers.addColorStop(0, color('#4f35ac').alpha(0.9).rgbString()); gradientActiveUsers.addColorStop(1, color('#a140c1').alpha(0.9).rgbString()); new Chart(ctxActiveUsers, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G"], datasets: [{ label: 'Active users', data: [170, 525, 363, 720, 390, 860, 230], pointRadius: 0, backgroundColor: gradientActiveUsers, borderColor: 'transparent', hoverBorderColor: 'transparent', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsActiveUsers }); // Extra revenue var optsExtraRevenue = $.extend({}, defaultOptions); var ctxExtraRevenue = document.getElementById('chart-extra-revenue').getContext('2d'); var gradientExtraRevenue = ctxExtraRevenue.createLinearGradient(0, 0, 230, 0); gradientExtraRevenue.addColorStop(0, color('#46cafb').alpha(0.9).rgbString()); gradientExtraRevenue.addColorStop(1, color('#1b92fc').alpha(0.9).rgbString()); new Chart(ctxExtraRevenue, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G"], datasets: [{ label: 'Active users', data: [170, 525, 363, 720, 390, 860, 230], pointRadius: 0, backgroundColor: gradientExtraRevenue, borderColor: 'transparent', hoverBorderColor: 'transparent', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsExtraRevenue }); // Orders var optsOrders = $.extend({}, defaultOptions); optsOrders.elements = { line: { tension: 0, // disables bezier curves } }; var ctxOrders = document.getElementById('chart-orders').getContext('2d'); var gradientOrders = ctxOrders.createLinearGradient(0, 20, 0, 110); gradientOrders.addColorStop(0, color('#e81a24').alpha(0.9).rgbString()); gradientOrders.addColorStop(1, color('#fc8505').alpha(0.4).rgbString()); new Chart(ctxOrders, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G"], datasets: [{ label: 'Active users', data: [100, 525, 363, 720, 390, 860, 230], pointRadius: 0, backgroundColor: color('#FEA931').alpha(0.3).rgbString(), borderColor: '#FEA931', borderWidth: 2, hoverBorderColor: '#FEA931', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsOrders }); // Traffic raise var optsTrafficRaise = $.extend({}, defaultOptions); optsTrafficRaise.elements = { line: { tension: 0, // disables bezier curves } }; var ctxTrafficRaise = document.getElementById('chart-traffic-raise').getContext('2d'); var gradientTrafficRaise = ctxTrafficRaise.createLinearGradient(0, 0, 230, 0); gradientTrafficRaise.addColorStop(0, color('#6757de').alpha(0.9).rgbString()); gradientTrafficRaise.addColorStop(1, color('#ed8faa').alpha(0.4).rgbString()); new Chart(ctxTrafficRaise, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G"], datasets: [{ label: 'Active users', data: [100, 525, 363, 720, 390, 860, 230], fill: false, backgroundColor: '#fff', borderColor: '#0d93df', hoverBorderColor: '#0d93df', pointBackgroundColor: '#fff', pointBorderColor: '#fe9e15', pointBorderWidth: 2, pointHoverBorderWidth: 2, }] }, options: optsTrafficRaise }); // Growth revenue var optsGrowthRevenue = $.extend({}, defaultOptions); var ctxGrowthRevenue = document.getElementById('chart-growth-revenue').getContext('2d'); var gradientGrowthRevenue = ctxGrowthRevenue.createLinearGradient(0, 60, 230, 70); gradientGrowthRevenue.addColorStop(0, color('#4f35ac').alpha(0.9).rgbString()); gradientGrowthRevenue.addColorStop(1, color('#a140c1').alpha(0.9).rgbString()); new Chart(ctxGrowthRevenue, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D"], datasets: [{ label: 'Active users', data: [1450, 450, 1800, 800], pointRadius: 0, backgroundColor: gradientGrowthRevenue, borderColor: 'transparent', hoverBorderColor: 'transparent', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsGrowthRevenue }); // Growth traffic var optsGrowthTraffic = $.extend({}, defaultOptions); optsGrowthTraffic.elements = { line: { tension: 0, // disables bezier curves } }; var ctxGrowthTraffic = document.getElementById('chart-growth-traffic').getContext('2d'); var gradientGrowthTraffic = ctxGrowthTraffic.createLinearGradient(0, 80, 180, 70); gradientGrowthTraffic.addColorStop(0, color('#1b92fc').alpha(0.9).rgbString()); gradientGrowthTraffic.addColorStop(1, color('#46cafb').alpha(0.9).rgbString()); new Chart(ctxGrowthTraffic, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page G", "Page K", "Page M", "Page R"], datasets: [{ label: 'Active users', data: [200, 900, 750, 600, 1100, 1600, 1250, 900], pointRadius: 0, backgroundColor: gradientGrowthTraffic, borderColor: 'transparent', hoverBorderColor: 'transparent', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsGrowthTraffic }); // Less revenue var optsLessRevenue = $.extend({}, defaultOptions); var ctxLessRevenue = document.getElementById('chart-less-revenue').getContext('2d'); var gradientLessRevenue = ctxGrowthTraffic.createLinearGradient(0, 80, 180, 70); gradientLessRevenue.addColorStop(0, color('#1b92fc').alpha(0.9).rgbString()); gradientLessRevenue.addColorStop(1, color('#46cafb').alpha(0.9).rgbString()); new Chart(ctxLessRevenue, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E"], datasets: [{ label: 'Active users', data: [1330, 750, 1160, 760, 1000], pointRadius: 0, backgroundColor: gradientLessRevenue, borderColor: 'transparent', hoverBorderColor: 'transparent', pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsLessRevenue }); // Line Traffic raise var optsLineTrafficRaise = $.extend({}, defaultOptions); optsLineTrafficRaise.elements = { line: { tension: 0, // disables bezier curves } }; var ctxLineTrafficRaise = document.getElementById('line-traffic-raise').getContext('2d'); new Chart(ctxLineTrafficRaise, { type: 'line', data: { labels: ["Page C", "Page D", "Page E", "Page F", "Page G"], datasets: [{ label: 'Active users', data: [163, 620, 390, 860, 230], fill: false, backgroundColor: '#fff', borderColor: '#f14631', hoverBorderColor: '#fff', pointBackgroundColor: '#f14631', pointBorderColor: '#fff', pointBorderWidth: 2, pointHoverBorderWidth: 2, }] }, options: optsLineTrafficRaise }); // Total Income var ctxTotalIncome = document.getElementById('chart-total-income').getContext('2d'); var gradientTotalIncome = ctxTotalIncome.createLinearGradient(0, 0, 180, 230); gradientTotalIncome.addColorStop(0.4, color('#b8345f').alpha(0.9).rgbString()); gradientTotalIncome.addColorStop(1, color('#b8345f').alpha(0.7).rgbString()); var optsTotalIncome = $.extend({}, defaultOptions); optsTotalIncome.elements = { line: { tension: 0, // disables bezier curves } }; new Chart(ctxTotalIncome, { type: 'line', data: { labels: ["Page A", "Page B", "Page C", "Page D", "Page E", "Page F", "Page G", "Page M"], datasets: [{ label: 'Active Users', data: [50, 520, 420, 320, 590, 860, 545, 230], pointRadius: 0, backgroundColor: gradientTotalIncome, hoverBackgroundColor: gradientTotalIncome, borderWidth: 0, borderColor: 'transparent', hoverBorderColor: 'transparent', hoverBorderWidth: 0, pointBorderWidth: 0, pointHoverBorderWidth: 0, }] }, options: optsTotalIncome }); // Support queries var ctxSupportQueries = document.getElementById('chart-support-queries').getContext('2d'); var optsSupportQueries = $.extend({}, defaultOptions); optsSupportQueries.scales = { xAxes: [ { display: false, stacked: true, } ], yAxes: [ { display: false, stacked: true } ] }; new Chart(ctxSupportQueries, { type: 'bar', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], datasets: [{ label: 'Active Users', data: [400, 600, 800, 200, 1300, 1000, 1600, 600, 400, 700, 800, 1700], backgroundColor: '#52c41a', hoverBackgroundColor: '#52c41a', categoryPercentage: 1.0, barPercentage: 0.6 }] }, options: optsSupportQueries }); })(jQuery);
25.872359
137
0.607227
68a50fae3ffcd1524b0cacb05b0d5e329ae50e87
150
js
JavaScript
src/pages/index/profile/actionTypes.js
mulin95/joint-project
598afec4e32a4da621c87b360f03ec698622a6ab
[ "MIT" ]
4
2019-09-28T03:50:19.000Z
2019-12-30T11:55:57.000Z
src/pages/profile/actionTypes.js
mulin95/joint-project
598afec4e32a4da621c87b360f03ec698622a6ab
[ "MIT" ]
5
2021-05-08T07:37:34.000Z
2022-02-26T18:28:26.000Z
src/pages/index/profile/actionTypes.js
mulin95/joint-project
598afec4e32a4da621c87b360f03ec698622a6ab
[ "MIT" ]
null
null
null
const CHANGE_USERNAME = 'profile/change_username'; const SAGA_LOAD_DATA = 'profile/saga_load_data' export{ CHANGE_USERNAME, SAGA_LOAD_DATA }
21.428571
50
0.78
68a54c4bf91a8a1084a359e37803d9b4c189b2e1
1,270
js
JavaScript
src/components/SelectBox/index.js
hunterofit/react-querions
554b5baedb369e41a1f266a08ae2c0e78d14c20f
[ "MIT" ]
null
null
null
src/components/SelectBox/index.js
hunterofit/react-querions
554b5baedb369e41a1f266a08ae2c0e78d14c20f
[ "MIT" ]
null
null
null
src/components/SelectBox/index.js
hunterofit/react-querions
554b5baedb369e41a1f266a08ae2c0e78d14c20f
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; class SelectBox extends React.Component { handleClick = (val) => { if (this.props.is_15 === false && val === 1) { return; } this.props.result(val); }; render() { let active_30 = ''; let active_15 = ''; if (this.props.selected) { active_30 = ''; active_15 = 'wpcpfq-active-box'; } else { active_30 = 'wpcpfq-active-box'; active_15 = ''; } if (this.props.is_15 === false) { active_15 = active_15 + ' wpcpfq-15-disabled'; } return ( <div className="wpcpfq-select-box"> <ul> <li> <a className={active_30} onClick={() => this.handleClick(0)} style={{paddingTop: '25px'}}> {this.props.firstItem} </a> </li> <li> <a className={active_15} onClick={() => this.handleClick(1)} style={{paddingTop: '25px'}}> {this.props.secondItem} </a> </li> </ul> </div> ); } } SelectBox.propTypes = { result: PropTypes.func, selected: PropTypes.number, }; export default SelectBox;
23.518519
74
0.481102
68a70c20d660ff66aa7d073680cef3f4266ebbfe
960
js
JavaScript
app/assets/javascripts/controlled_terms/form.js
erebuseternal/inaturalist
fc8218f329abbb5462015e723a2756031d8834b1
[ "MIT" ]
466
2015-01-22T07:03:18.000Z
2022-03-28T12:02:45.000Z
app/assets/javascripts/controlled_terms/form.js
todtb/inaturalist
76ebf20f9429296fec4184937f7c4c6c196e5ef9
[ "MIT" ]
2,181
2015-01-01T03:21:02.000Z
2022-03-31T20:40:40.000Z
app/assets/javascripts/controlled_terms/form.js
todtb/inaturalist
76ebf20f9429296fec4184937f7c4c6c196e5ef9
[ "MIT" ]
164
2015-01-04T01:36:53.000Z
2022-03-14T19:37:45.000Z
$( function( ) { $( "input[name='valid_within_clade_q']" ).each( function( ) { var id = $( this ).parent( ).parent( ).find( "[data-ac-taxon-id]" ); $( this ).taxonAutocomplete({ searchExternal: false, bootstrapClear: false, thumbnail: false, idEl: id, initialSelection: $( this ).data( "initial-taxon" ) }); }); function autocompleteForControlledTermTaxon( input ) { var id = $( input ).parents( ".nested-fields:first" ).find( "[name*=taxon_id]" ); $( input ).taxonAutocomplete({ searchExternal: false, bootstrapClear: false, idEl: id, initialSelection: $( input ).data( "initial-taxon" ) }); } $( "input.taxon-autocomplete" ).each( function ( ) { autocompleteForControlledTermTaxon( this ); } ); $( ".controlled_term_taxa" ).bind( "cocoon:after-insert", function( e, item ) { autocompleteForControlledTermTaxon( $( ":input:visible:first", item ) ); }) });
33.103448
85
0.607292
68a95577ac3d7581a28e3e69e484c70c48a61fbb
2,643
js
JavaScript
dist/.gatsby/gatsby-config.js
Phil-Barber/phil-barber
997d3886c28236814e6abe70df4905a7b9815b19
[ "MIT" ]
null
null
null
dist/.gatsby/gatsby-config.js
Phil-Barber/phil-barber
997d3886c28236814e6abe70df4905a7b9815b19
[ "MIT" ]
null
null
null
dist/.gatsby/gatsby-config.js
Phil-Barber/phil-barber
997d3886c28236814e6abe70df4905a7b9815b19
[ "MIT" ]
null
null
null
module.exports = { siteMetadata: { title: 'Phil Barber', description: 'A blog about me and maybe other things', author: 'phil.barber93@gmail.com', siteUrl: 'https://phil-barber.uk/', }, plugins: [ `gatsby-plugin-sharp`, 'gatsby-transformer-sharp', 'gatsby-transformer-remark', 'gatsby-plugin-styled-components', 'gatsby-plugin-codegen', { resolve: `gatsby-plugin-typescript`, options: { isTSX: true, allExtensions: true, }, }, { resolve: 'gatsby-source-filesystem', options: { name: 'pages', path: `${__dirname}/../src/`, }, }, { resolve: 'gatsby-source-filesystem', options: { name: 'blogs', path: `${__dirname}/../blog/`, }, }, { resolve: 'gatsby-plugin-typography', options: { pathToConfigModule: `${__dirname}/../src/utils/typography`, }, }, { resolve: 'gatsby-plugin-manifest', options: { name: 'GatsbyJS', short_name: 'GatsbyJS', start_url: '/', background_color: '#6b37bf', theme_color: '#6b37bf', display: 'standalone', icon: `${__dirname}/../src/images/icon.jpeg`, }, }, 'gatsby-plugin-react-helmet', { resolve: `gatsby-plugin-manifest`, options: { name: `GatsbyJS`, short_name: `GatsbyJS`, start_url: `/`, background_color: `#f7f0eb`, theme_color: `#a2466c`, display: `standalone`, }, }, 'gatsby-plugin-offline', { resolve: 'gatsby-plugin-advanced-sitemap', options: { query: ` { allMarkdownRemark { edges { node { fields { slug } id } } } } `, mapping: { allMarkdownRemark: { sitemap: 'posts', }, }, createLinkInHead: true, addUncaughtPages: true, }, }, 'gatsby-plugin-netlify-cms', ], }; //# sourceMappingURL=gatsby-config.js.map
27.821053
75
0.400681
68a9804ef278bcaff3a14cbaefd1eb79392d7270
725
js
JavaScript
src/main.js
zwnsyw/Background_management
4d71e604a1fbd425c21f504e0c5d9ebb67695ff1
[ "MIT" ]
null
null
null
src/main.js
zwnsyw/Background_management
4d71e604a1fbd425c21f504e0c5d9ebb67695ff1
[ "MIT" ]
null
null
null
src/main.js
zwnsyw/Background_management
4d71e604a1fbd425c21f504e0c5d9ebb67695ff1
[ "MIT" ]
null
null
null
import Vue from 'vue' import App from './App.vue' import router from './router' import './plugins/element.js' // 导入全局样式表 import "./assets/css/gloab.css" // 导入字体图标 import "./assets/fonts/iconfont.css" // 导入表格 import tableTree from "vue-table-with-tree-grid" // 导入网络请求axios import axios from 'axios' // 配置请求根路径 axios.defaults.baseURL="https://www.liulongbin.top:8888/api/private/v1/" // 请求拦截器(添加toke) axios.interceptors.request.use(config=>{ // console.log(config); config.headers.Authorization = window.sessionStorage.getItem('token') return config }) Vue.component("table-tree", tableTree) Vue.prototype.$http = axios Vue.config.productionTip = false new Vue({ router, render: h => h(App) }).$mount('#app')
21.323529
72
0.717241
68aad7657bef4d19b6c1f991df894fb958968499
608
js
JavaScript
src/components/images/Histoire/Hist1.js
AuxaneN/chateaudessalles
0362b06bb05e38622a66b5eae908ed3ed359e09b
[ "RSA-MD" ]
null
null
null
src/components/images/Histoire/Hist1.js
AuxaneN/chateaudessalles
0362b06bb05e38622a66b5eae908ed3ed359e09b
[ "RSA-MD" ]
null
null
null
src/components/images/Histoire/Hist1.js
AuxaneN/chateaudessalles
0362b06bb05e38622a66b5eae908ed3ed359e09b
[ "RSA-MD" ]
null
null
null
import React from "react" import { useStaticQuery, graphql } from "gatsby" import Img from "gatsby-image" const Hist1 = () => { const data = useStaticQuery(graphql` query { placeholderImage: file(relativePath: { eq: "Histoire/histoire_1.jpg" }) { childImageSharp { fluid(quality: 90, maxWidth:1000) { ...GatsbyImageSharpFluid_withWebp } } } } `) return <Img fluid={data.placeholderImage.childImageSharp.fluid} alt="Une vue plongeante sur le château des Salles : bâtisses, champs et chemins sont visibles."/> } export default Hist1
27.636364
163
0.65625
68b076a4464fe77ace01dc7df056ff33423f853e
5,753
js
JavaScript
preload.js
karino2/TeFWiki-Electron
46ec6e450bbc7c6bc33b37dae1686eb81a594808
[ "MIT" ]
1
2021-07-03T01:07:05.000Z
2021-07-03T01:07:05.000Z
preload.js
karino2/TeFWiki-Electron
46ec6e450bbc7c6bc33b37dae1686eb81a594808
[ "MIT" ]
2
2022-02-21T05:41:22.000Z
2022-02-21T05:42:17.000Z
preload.js
karino2/TeFWiki-Electron
46ec6e450bbc7c6bc33b37dae1686eb81a594808
[ "MIT" ]
null
null
null
const {ipcRenderer} = require('electron') window.addEventListener('DOMContentLoaded', () => { const viewRoot = document.getElementById('content-root') let mdname = "" // 辿ったらtrueを返す const followLink = (e)=> { if (e.target.tagName == 'A' && e.target.classList.contains('wikilink')) { e.preventDefault() const href = e.target.href; /// tefwiki:///HelloLink.md, etc. toViewMode() ipcRenderer.send('follow-link', href.substring(11)) return true } if (e.target.tagName == 'A' && e.target.classList.contains('wikidir')) { e.preventDefault() const href = e.target.href; /// tefwiki:///root/RandomThoughts, etc. toViewMode() ipcRenderer.send('move-dir', href.substring(15)) return true } return false } viewRoot.addEventListener('click', (e)=> { if (followLink(e)) return; }) document.getElementById("linkbar").addEventListener('click', (e)=> { if (followLink(e)) return; }) const navroot = document.getElementById('navroot') const navholderDiv = document.getElementById('navholder') navholderDiv.addEventListener('click', (e)=> { if (followLink(e)) return; }) /* <a class="navbar-item" href="#">Root</a> <a class="navbar-item" href="#">RandomThoughts</a> <a class="navbar-item" href="#">Dir1</a> <span class="navbar-item">Dir2</span> */ // root -> dirArr = [] // root/RandomThoughts -> dirArr = ["RandomThoughts"] // root/RandomThoughts/Test -> dirArr = ["RandomThoughts", "Test"] const updateBread = (dirArr, sibWikis) => { if(dirArr.length == 0 || (dirArr.length == 1 && dirArr[0] == '')) { navholderDiv.innerHTML = "" navroot.style.display = 'none' return } navroot.style.display = 'block' let htmls = [] htmls.push(`<a class="navbar-item wikidir" href="tefwiki:///root">Root</a>`) htmls.push(`<span class="navbar-item">/</span>`) let dirs = ["root"] for(const cur of dirArr.slice(0, dirArr.length-1)) { dirs.push(cur) const absDir = dirs.join("/") htmls.push(`<a class="navbar-item wikidir" href="tefwiki:///${absDir}">${cur}</a>`) htmls.push(`<span class="navbar-item">/</span>`) } const cur = dirArr[dirArr.length-1] if (sibWikis.length == 0) { htmls.push(`<span class="navbar-item">${cur}</span>`) } else { htmls.push(`<div class="navbar-item has-dropdown is-hoverable">`) htmls.push(`<a class="navbar-link">${cur}</a>`) htmls.push(`<div class="navbar-dropdown">`) for (const sib of sibWikis) { const absDir = [...dirs, sib].join("/") htmls.push(`<a class="navbar-item wikidir" href="tefwiki:///${absDir}">${sib}</a>`) } htmls.push(`</div>`) // navbar-dropdown htmls.push(`</div>`) // navbar-item } navholderDiv.innerHTML = htmls.join('\n') } const title = document.getElementById('title') const dateElem = document.getElementById('date') ipcRenderer.on('update-md', (event, fname, mtime, html, relativeDir, sibWikis) => { mdname = fname title.innerText = fname.substring(0, fname.length-3) dateElem.innerText = mtime viewRoot.innerHTML = html updateBread(relativeDir.split("/"), sibWikis) }) let prevFname = "" ipcRenderer.on('create-new', (event, fname) => { prevFname = mdname mdname = fname prevTitle = title.innerText title.innerText = fname.substring(0, fname.length-3) dateElem.innerText = "(new)" toCreateNewMode() }) document.getElementById('edit').addEventListener('click', ()=> { ipcRenderer.send('click-edit', mdname) }) const viewButtons = document.getElementById('view-buttons') const editButtons = document.getElementById('edit-buttons') const editTextArea = document.getElementById('edit-textarea') const toEditMode = (text) => { viewButtons.style.display = 'none' viewRoot.style.display = 'none' editButtons.style.display = 'block' editTextArea.style.display = 'block' editTextArea.value = text } ipcRenderer.on('start-edit', (event, text)=> { toEditMode(text) }) const toViewMode = () => { viewButtons.style.display = 'block' viewRoot.style.display = 'block' editButtons.style.display = 'none' editTextArea.style.display = 'none' } let isNewMode = false const toCreateNewMode = () => { isNewMode = true toEditMode("") } document.getElementById('edit-cancel').addEventListener('click', ()=> { toViewMode() if (isNewMode) { isNewMode = false ipcRenderer.send('cancel-back', prevFname) } }) document.getElementById('edit-submit').addEventListener('click', ()=> { isNewMode = false ipcRenderer.send('submit', mdname, editTextArea.value) toViewMode() }) // recents const recentsUL = document.getElementById('recents') ipcRenderer.on('update-recents', (event, recents) => { let htmls = [] for (const recent of recents) { htmls.push( `<li class="menu-item"><a class="wikilink" href="tefwiki://${recent.abs}">${recent.label}</a></a></li>`) } recentsUL.innerHTML = htmls.join('\n') }) })
33.063218
128
0.560229
68b1e994981627b09dd8a6ec42853f9046d40a6e
3,177
js
JavaScript
define-messages.macro.test.js
ttypic/define-messages.macro
5de14c86089e2965846e6ddbf0c7695289d1bcd2
[ "MIT" ]
1
2021-05-18T11:54:19.000Z
2021-05-18T11:54:19.000Z
define-messages.macro.test.js
ttypic/define-messages.macro
5de14c86089e2965846e6ddbf0c7695289d1bcd2
[ "MIT" ]
6
2020-07-20T18:02:56.000Z
2022-03-26T17:27:34.000Z
define-messages.macro.test.js
ttypic/define-messages.macro
5de14c86089e2965846e6ddbf0c7695289d1bcd2
[ "MIT" ]
null
null
null
const path = require('path'); const pluginTester = require('babel-plugin-tester').default; const Macros = require('babel-plugin-macros'); pluginTester({ plugin: Macros, snapshot: false, tests: { 'it replaces import in development': { fixture: path.join(__dirname, 'fixtures/replace-import/code.js'), outputFixture: path.join(__dirname, 'fixtures/replace-import/output.js'), setup: () => { process.env.NODE_ENV = 'development'; } }, 'it removes import in production': { fixture: path.join(__dirname, 'fixtures/remove-import/code.js'), outputFixture: path.join(__dirname, 'fixtures/remove-import/output.js'), setup: () => { process.env.NODE_ENV = 'production'; } }, "it doesn't add id prop if it already exists": { fixture: path.join(__dirname, 'fixtures/do-not-replace-id-if-exists/code.js'), outputFixture: path.join(__dirname, 'fixtures/do-not-replace-id-if-exists/output.js'), setup: () => { process.env.NODE_ENV = 'development'; } }, 'it adds id prop for object messages': { fixture: path.join(__dirname, 'fixtures/add-id-to-object/code.js'), outputFixture: path.join(__dirname, 'fixtures/add-id-to-object/output.js'), setup: () => { process.env.NODE_ENV = 'production'; } }, 'it works without setup method': { fixture: path.join(__dirname, 'fixtures/no-setup-method/code.js'), outputFixture: path.join(__dirname, 'fixtures/no-setup-method/output.js'), setup: () => { process.env.NODE_ENV = 'development'; } }, 'it takes relative path from config': { fixture: path.join(__dirname, 'fixtures/with-config/code.js'), outputFixture: path.join(__dirname, 'fixtures/with-config/output.js'), setup: () => { process.env.NODE_ENV = 'development'; } }, 'it throws MacroError if more than one `setupPrefix` method calls': { fixture: path.join(__dirname, 'fixtures/gt-one-setup-method/code.js'), error: Macros.MacroError }, 'it throws MacroError if `setupPrefix` method spelled wrong': { fixture: path.join(__dirname, 'fixtures/setup-method-spelled-wrong/code.js'), error: Macros.MacroError }, 'it throws MacroError if no arguments for `defineMessages`': { fixture: path.join(__dirname, 'fixtures/define-messages-no-args/code.js'), error: Macros.MacroError }, 'it throws MacroError if arguments has wrong type': { fixture: path.join(__dirname, 'fixtures/define-messages-wrong-type/code.js'), error: Macros.MacroError }, 'it throws MacroError if arguments has wrong object': { fixture: path.join(__dirname, 'fixtures/define-messages-wrong-object/code.js'), error: Macros.MacroError } } });
43.520548
98
0.574756
68b2c582bf5349857b5f70a3483bb8356a15313f
664
js
JavaScript
health/src/components/vital.js
simse/simse.io
5f2f2c2ead6cbec7ae27a56aee181c33f12d7ee1
[ "0BSD" ]
null
null
null
health/src/components/vital.js
simse/simse.io
5f2f2c2ead6cbec7ae27a56aee181c33f12d7ee1
[ "0BSD" ]
2
2022-02-14T18:11:49.000Z
2022-02-14T18:11:51.000Z
health/src/components/vital.js
simse/simse.io
5f2f2c2ead6cbec7ae27a56aee181c33f12d7ee1
[ "0BSD" ]
null
null
null
import * as React from "react" import * as styles from "../styles/components/vital.module.scss" // markup const Vital = (props) => { return ( <div className={`${styles.vital} ${props.noPadding ? styles.noPadding : ''}`}> <strong className={styles.label}>{props.label}</strong> <div className={styles.valueContainer}> <h2 className={styles.value}>{props.value}</h2> <span className={styles.unit}>{props.unit}</span> </div> {(props.trend && props.trend.amount) && <p className={styles.trend}>{props.trend.amount > 0 && '+'}{props.trend.amount}{props.unit}</p>} </div> ) } export default Vital
30.181818
144
0.614458
68b3ff9da51053edf420ef2411d3e2bb01344c21
4,219
js
JavaScript
src/components/stage-colors.js
vvcdoesdev/moonrider
af9079485897c033f4a7a65c6230f486b5e118d7
[ "MIT" ]
1
2021-12-13T05:10:03.000Z
2021-12-13T05:10:03.000Z
src/components/stage-colors.js
vvcdoesdev/moonrider
af9079485897c033f4a7a65c6230f486b5e118d7
[ "MIT" ]
null
null
null
src/components/stage-colors.js
vvcdoesdev/moonrider
af9079485897c033f4a7a65c6230f486b5e118d7
[ "MIT" ]
null
null
null
function $ (id) { return document.getElementById(id); }; import COLORS from '../constants/colors'; // Stage animations have a consistent pattern so animations generated via loop. const animatables = [ {name: 'bgcolor', property: 'backglow.color'}, {name: 'leftglow', property: 'leftsideglow.color'}, {name: 'rightglow', property: 'rightsideglow.color'} ]; // {id: 'gameover', dur: 500, to: 'off'}, const animations = [ {id: 'off', dur: 500, to: 'off'}, {id: 'primary', dur: 5, to: 'primary'}, {id: 'primarybright', dur: 500, from: 'tertiary', to: 'primarybright'}, {id: 'secondary', dur: 5, to: 'secondary'}, {id: 'secondarybright', dur: 500, from: 'tertiary', to: 'secondarybright'} ]; // Mapping of index to our stage event IDs. const colorCodes = [ 'off', 'secondary', 'secondary', 'secondarybright', '', 'primary', 'primary', 'primarybright', 'primarybright' ]; AFRAME.registerComponent('stage-colors', { schema: { colorScheme: {default: 'default'} }, init: function () { this.el.addEventListener('cleargame', this.resetColors.bind(this)); this.el.sceneEl.addEventListener('playbuttonclick', this.resetColors.bind(this)); setAnimations(this.el.sceneEl, this.data.colorScheme); }, update: function (oldData) { if (oldData.colorScheme && this.data.colorScheme !== oldData.colorScheme) { updateAnimations(this.el.sceneEl, this.data.colorScheme); } }, play: function () { this.el.emit('bgcolorsecondary', null, false); }, setColor: function (target, code) { if (target.startsWith('curve')) { // New event style. this.el.emit(`${target}stageeventcolor`, colorCodes[code].replace('bright', ''), false); } else { this.el.emit(`${target}color${colorCodes[code]}`, null, false); } }, /** * Set synchronously, no animation for performance. */ setColorInstant: function (target, code) { const materials = this.el.sceneEl.systems.materials; if (target === 'stars') { let color; if (code === 0) { color = COLORS.schemes[this.data.colorScheme].secondarybright; } else { color = COLORS.schemes[this.data.colorScheme].secondary; } set(materials.stars, 'color', color); return; } const color = COLORS.schemes[this.data.colorScheme][colorCodes[code]]; if (target === 'moon') { set(materials.moon, 'tint', color); } }, resetColors: function () { this.el.emit('bgcolorsecondary', null, false); this.el.emit('curveevenstageeventcolor', 'off', false); this.el.emit('curveoddstageeventcolor', 'off', false); } }); /** * Set stage animations defined in the objects at top. */ function setAnimations (scene, scheme) { for (let i = 0; i < animatables.length; i++) { const animatable = animatables[i]; for (let j = 0; j < animations.length; j++) { const animation = animations[j]; scene.setAttribute(`animation__${animatable.name}${animation.id}`, { property: `systems.materials.${animatable.property}`, type: 'color', isRawProperty: true, easing: 'linear', dur: animation.dur, from: animation.from ? COLORS.schemes[scheme][animation.from] : '', startEvents: `${animatable.name}${animation.id}`, to: COLORS.schemes[scheme][animation.to], }); } } } /** * Update `to` and `from ` of stage animations. */ function updateAnimations (scene, scheme) { for (let i = 0; i < animatables.length; i++) { const animatable = animatables[i]; for (let j = 0; j < animations.length; j++) { const animation = animations[j]; const attr = `animation__${animatable.name}${animation.id}`; if (animation.from) { scene.setAttribute(attr, 'from', COLORS.schemes[scheme][animation.from]); } scene.setAttribute(attr, 'to', COLORS.schemes[scheme][animation.to]); } } } const auxColor = new THREE.Color(); function set (mat, name, color) { auxColor.set(color); if (mat.uniforms) { mat.uniforms[name].value.x = auxColor.r; mat.uniforms[name].value.y = auxColor.g; mat.uniforms[name].value.z = auxColor.b; } else { mat[name].set(color); } }
29.298611
94
0.629296
68b4425bb77f3f0ba65ae807864161e3dd0edcb9
103
js
JavaScript
test/config/app.js
KieronWiltshire/node-respondent
22268b839a3fb328be75c7dfc3b4be7501876bdb
[ "MIT" ]
null
null
null
test/config/app.js
KieronWiltshire/node-respondent
22268b839a3fb328be75c7dfc3b4be7501876bdb
[ "MIT" ]
null
null
null
test/config/app.js
KieronWiltshire/node-respondent
22268b839a3fb328be75c7dfc3b4be7501876bdb
[ "MIT" ]
null
null
null
'use strict'; export default { planet: 'Earth', booleanTest: 'true', booleanTestUpper: 'TRUE' }
12.875
26
0.660194
68b522d6e50e94620cedba958523913551e288fe
1,963
js
JavaScript
ex_client_server/client/vendor/scripts/knockout-bootstrap.js
kmalakoff/examples-kmalakoff
7de39d4276cbe9fb13122a36797833e20a8b6663
[ "MIT" ]
null
null
null
ex_client_server/client/vendor/scripts/knockout-bootstrap.js
kmalakoff/examples-kmalakoff
7de39d4276cbe9fb13122a36797833e20a8b6663
[ "MIT" ]
1
2018-01-05T05:10:42.000Z
2018-01-05T05:10:42.000Z
ex_client_server/client/vendor/scripts/knockout-bootstrap.js
kmalakoff/examples-kmalakoff
7de39d4276cbe9fb13122a36797833e20a8b6663
[ "MIT" ]
null
null
null
(function() { var bindingFactory = new ko.uibindings.plugin.BindingFactory(); //utility to set the dataSource will a clean copy of data. Could be overriden at run-time. var setDataSource = function(widget, data) { widget.dataSource.data(ko.mapping ? ko.mapping.toJS(data || {}) : ko.toJS(data)); }; //library is in a closure, use this private variable to reduce size of minified file var createBinding = bindingFactory.createBinding.bind(bindingFactory); //use constants to ensure consistency and to help reduce minified file size var SHOW = "show", HIDE = "hide"; createBinding({ bindingName: "bootstrapModal", name: "modal", events: { show: { writeTo: SHOW, value: true }, shown: { writeTo: SHOW, value: true }, hide: { writeTo: SHOW, value: false }, hidden: { writeTo: SHOW, value: false } }, watch: { show: [SHOW, HIDE] } }); createBinding({ bindingName: "bootstrapTab", name: "tab", events: { show: { writeTo: SHOW, value: true }, shown: { writeTo: SHOW, value: true } }, watch: { value: [SHOW, HIDE] } }); createBinding({ bindingName: "bootstrapToolTip", name: "tooltip", events: { show: { writeTo: SHOW, value: true }, shown: { writeTo: SHOW, value: true }, hide: { writeTo: SHOW, value: false }, hidden: { writeTo: SHOW, value: false } }, watch: { show: [SHOW, HIDE] } }); })(this);
22.825581
92
0.455935
68b57fb51cdde18c47d9c2c9fed102e1bac072b9
1,386
js
JavaScript
addon/affinity-engine/stage/directions/layer.js
affinity-engine/affinity-engine-stage
beed8abb3f3516dd0cc83511dd982c01ce207bd9
[ "MIT" ]
null
null
null
addon/affinity-engine/stage/directions/layer.js
affinity-engine/affinity-engine-stage
beed8abb3f3516dd0cc83511dd982c01ce207bd9
[ "MIT" ]
3
2016-08-10T02:15:14.000Z
2016-10-27T18:34:41.000Z
addon/affinity-engine/stage/directions/layer.js
ember-theater/ember-theater-director
beed8abb3f3516dd0cc83511dd982c01ce207bd9
[ "MIT" ]
null
null
null
import Ember from 'ember'; import { Direction, cmd } from 'affinity-engine-stage'; import multiton from 'ember-multiton-service'; const { assign, get, set } = Ember; export default Direction.extend({ esBus: multiton('message-bus', 'engineId', 'stageId'), layerManager: multiton('affinity-engine/stage/layer-manager', 'engineId', 'stageId'), render() { const layer = this.getConfiguration('layer'); get(this, 'esBus').publish('shouldAddLayerDirection', layer, this); }, _configurationTiers: [ 'component.stage.direction.layer', 'layer', 'component.stage.direction.all', 'component.stage.all', 'all' ], _setup: cmd(function(layer, options) { const activeLayers = get(this, 'script._activeLayers') || set(this, 'script._activeLayers', {}); const activeLayer = get(activeLayers, `${layer}._instance`); if (activeLayer) { if (options) activeLayer.configure(options); return activeLayer; } this.configure(assign({ layer, transitions: Ember.A() }, options)); layer.split('.').reduce((previousLayer, pathName) => { return get(previousLayer, pathName) || set(previousLayer, pathName, {}); }, activeLayers)._instance = this; }), transition: cmd({ async: true, render: true }, function(options = {}) { this.getConfiguration('transitions').pushObject(options); }) });
26.653846
100
0.657287
68b609ba6484cf3ee9262d2d6c088aac4fbb6690
406
js
JavaScript
app/base_components/TextInput.js
tstariqul/Restaurant-App
a3799872a8cfe50cd76af29acce2c2504be03502
[ "MIT" ]
null
null
null
app/base_components/TextInput.js
tstariqul/Restaurant-App
a3799872a8cfe50cd76af29acce2c2504be03502
[ "MIT" ]
null
null
null
app/base_components/TextInput.js
tstariqul/Restaurant-App
a3799872a8cfe50cd76af29acce2c2504be03502
[ "MIT" ]
null
null
null
import { Platform } from 'react-native'; import styled from 'styled-components'; const TextInput = styled.TextInput` font-family: 'Roboto Slab'; padding: 15px; width: 100%; min-height: 42px; font-size: 18px; color: #989898; text-align: left; border: 0 solid #ddd; border-bottom-width: ${Platform.OS === 'ios' ? '1px' : '0px'}; border-bottom-color: #ddd; `; export default TextInput;
23.882353
64
0.667488
68b60e7b09ba7884b2eeaaefb8727e82364e682a
1,600
js
JavaScript
src/plugins/element.js
xxcfun/crm-pc
acbb06a2794d100ecc6abb3e5252e01e33da0748
[ "Apache-2.0" ]
1
2021-06-18T03:03:36.000Z
2021-06-18T03:03:36.000Z
src/plugins/element.js
xxcfun/crm-pc
acbb06a2794d100ecc6abb3e5252e01e33da0748
[ "Apache-2.0" ]
null
null
null
src/plugins/element.js
xxcfun/crm-pc
acbb06a2794d100ecc6abb3e5252e01e33da0748
[ "Apache-2.0" ]
null
null
null
import Vue from 'vue' import 'element-ui/lib/theme-chalk/base.css' import CollapseTransition from 'element-ui/lib/transitions/collapse-transition' import { Aside, Autocomplete, Breadcrumb, BreadcrumbItem, Button, Card, Cascader, CheckboxButton, CheckboxGroup, Col, Collapse, CollapseItem, Container, DatePicker, Dialog, Divider, Drawer, Footer, Form, FormItem, Header, Input, InputNumber, Link, Loading, Main, Menu, MenuItem, Message, MessageBox, Option, PageHeader, Pagination, Radio, RadioGroup, Row, Select, Submenu, Switch, Table, TableColumn, TabPane, Tabs, Tag, Tooltip, Upload } from 'element-ui' Vue.use(CollapseItem) Vue.use(Collapse) Vue.use(Loading.directive) Vue.use(Upload) Vue.use(Drawer) Vue.use(InputNumber) Vue.use(Radio) Vue.use(RadioGroup) Vue.use(Autocomplete) Vue.use(Button) Vue.use(Form) Vue.use(FormItem) Vue.use(Input) Vue.use(Container) Vue.use(Header) Vue.use(Aside) Vue.use(Main) Vue.use(Footer) Vue.use(Menu) Vue.use(Submenu) Vue.use(MenuItem) Vue.use(Breadcrumb) Vue.use(BreadcrumbItem) Vue.use(Card) Vue.use(Row) Vue.use(Col) Vue.use(Table) Vue.use(TableColumn) Vue.use(Switch) Vue.use(Tooltip) Vue.use(Pagination) Vue.use(Dialog) Vue.use(Link) Vue.use(Divider) Vue.use(Select) Vue.use(Option) Vue.use(DatePicker) Vue.use(Cascader) Vue.use(Tabs) Vue.use(TabPane) Vue.use(CheckboxGroup) Vue.use(CheckboxButton) Vue.use(Tag) Vue.use(PageHeader) Vue.component(CollapseTransition.name, CollapseTransition) Vue.prototype.$message = Message Vue.prototype.$confirm = MessageBox.confirm
24.242424
97
0.739375
68b8c55118c6523638bac3f11f0fff61d4a2d812
56
js
JavaScript
node_modules/png-js/test/patch-canvas.js
DABOZE/Queen-Alexa
d24743fd7b48e6e68d08b74c56f00eb73035d1c0
[ "MIT" ]
175
2015-01-04T07:33:55.000Z
2019-08-03T17:27:01.000Z
node_modules/png-js/test/patch-canvas.js
DABOZE/Queen-Alexa
d24743fd7b48e6e68d08b74c56f00eb73035d1c0
[ "MIT" ]
25
2015-02-05T03:59:27.000Z
2022-02-11T16:54:04.000Z
node_modules/png-js/test/patch-canvas.js
DABOZE/Queen-Alexa
d24743fd7b48e6e68d08b74c56f00eb73035d1c0
[ "MIT" ]
65
2015-01-27T20:05:10.000Z
2019-06-11T13:05:29.000Z
HTMLCanvasElement.prototype.getContext = function() {};
28
55
0.785714
68b8e9de73c2d3aff7ab4a06945defe453454ca4
1,385
js
JavaScript
source/analyse.js
scriptabuild/eventstore-demo
756cce6c87ad901dfec450149dcdc2c67d19e1b8
[ "MIT" ]
null
null
null
source/analyse.js
scriptabuild/eventstore-demo
756cce6c87ad901dfec450149dcdc2c67d19e1b8
[ "MIT" ]
null
null
null
source/analyse.js
scriptabuild/eventstore-demo
756cce6c87ad901dfec450149dcdc2c67d19e1b8
[ "MIT" ]
null
null
null
const path = require("path"); const {defineStore} = require("@scriptabuild/eventStore"); const logSchemaToolModelDefinition = require("@scriptabuild/eventstore-tools").logSchemaTool; // const logSchemaToolModelDefinition = require("./logSchemaTool"); const Stopwatch = require("../source/stopwatch"); const folder = path.resolve(__dirname, "../temp"); (async function () { let store = await defineStore(folder); let logSchemaTool = store.defineModel(logSchemaToolModelDefinition); let stopwatch = Stopwatch.start(); console.log("Analyzing Log") // await logSchemaTool.snapshot(); await logSchemaTool.withReadInstance((model) => { console.log(`Log Schema built in ${stopwatch.elapsed()} milliseconds`); model.getLogSchema().forEach(eventTypeInformation => { console.log(eventTypeInformation.eventname); eventTypeInformation.versions.forEach(version => { let firstOccurrenceDescription = version.first.schemaVersion || version.first.version || version.first.time || JSON.stringify(version.first); let lastOccurrenceDescription = version.last.schemaVersion || version.last.version || version.last.time || JSON.stringify(version.last); console.log(` ${version.count} ${version.count == 1 ? "instance" : "instances"} of ${JSON.stringify(version.description)} (from ${firstOccurrenceDescription} to ${lastOccurrenceDescription})`); }); }) }); })();
46.166667
199
0.74296
68b9abec706e6a39b087721776760d23c322ac49
530
js
JavaScript
glyphs/folder-open-o.js
kavanpancholi/vue-rate-it
b12aabbc7f9baa2e43342611b6515e030c60d280
[ "MIT" ]
100
2017-04-26T15:04:54.000Z
2022-03-12T15:02:58.000Z
glyphs/folder-open-o.js
kavanpancholi/vue-rate-it
b12aabbc7f9baa2e43342611b6515e030c60d280
[ "MIT" ]
18
2017-05-05T07:38:25.000Z
2021-08-12T21:25:49.000Z
glyphs/folder-open-o.js
kavanpancholi/vue-rate-it
b12aabbc7f9baa2e43342611b6515e030c60d280
[ "MIT" ]
11
2017-05-29T05:23:23.000Z
2021-08-03T00:38:17.000Z
const fa_folder_open_o = 'M1717 931q0-35-53-35h-1088q-40 0-85.5 21.5t-71.5 52.5l-294 363q-18 24-18 40 0 35 53 35h1088q40 0 86-22t71-53l294-363q18-22 18-39zm-1141-163h768v-160q0-40-28-68t-68-28h-576q-40 0-68-28t-28-68v-64q0-40-28-68t-68-28h-320q-40 0-68 28t-28 68v853l256-315q44-53 116-87.5t140-34.5zm1269 163q0 62-46 120l-295 363q-43 53-116 87.5t-140 34.5h-1088q-92 0-158-66t-66-158v-960q0-92 66-158t158-66h320q92 0 158 66t66 158v32h544q92 0 158 66t66 158v160h192q54 0 99 24.5t67 70.5q15 32 15 68z' export default fa_folder_open_o
265
498
0.773585
68bb330ca35a4b6d458412e49411257f0a9ca550
232
js
JavaScript
master-node-nodejs/src/models/payments.js
ramesh-kr/sentinel
ff65bc9200f6c940aa184c0ec0872fdcfef25363
[ "MIT" ]
342
2017-08-21T20:12:56.000Z
2022-03-19T17:58:25.000Z
master-node-nodejs/src/models/payments.js
ramesh-kr/sentinel
ff65bc9200f6c940aa184c0ec0872fdcfef25363
[ "MIT" ]
57
2017-11-13T11:16:47.000Z
2022-03-01T13:54:31.000Z
master-node-nodejs/src/models/payments.js
smtcrms/sentinel
ff65bc9200f6c940aa184c0ec0872fdcfef25363
[ "MIT" ]
72
2017-11-23T05:13:24.000Z
2022-02-25T14:18:33.000Z
import mongoose from "mongoose"; let Schema = mongoose.Schema let paymentSchema = new Schema({ timestamp: Number, paid_count: Number, unpaid_count: Number }); export const Payment = mongoose.model('Payment', paymentSchema);
21.090909
64
0.75
68bb713e7060a53ad951a496bc3d2d6cb351a51f
1,040
js
JavaScript
src/config/constant.js
mutolee/vel-admin-web
92e6734fdf0eff07fa27dfd8d61e728dfb39d14e
[ "Apache-2.0" ]
3
2021-05-10T01:31:03.000Z
2022-03-02T01:20:02.000Z
src/config/constant.js
mutolee/vel-admin-web
92e6734fdf0eff07fa27dfd8d61e728dfb39d14e
[ "Apache-2.0" ]
null
null
null
src/config/constant.js
mutolee/vel-admin-web
92e6734fdf0eff07fa27dfd8d61e728dfb39d14e
[ "Apache-2.0" ]
null
null
null
export const BASE_URL = 'http://localhost:8080/' export const USER_NAME = 'userName' export const TOKEN = 'token' export const LOGIN_API = "static/res/login.json" export const LEFT_MENU = 'leftmenu' export const IS_ROUTER_LOADED = 'isRouterLoaded' export const MENUS = 'menus' export const ARR = 'arr' export const LEFT_MENU_IS_ROUTER_LOADED = LEFT_MENU + "/" + IS_ROUTER_LOADED; export const LEFT_MENU_MENUS = LEFT_MENU + "/" + MENUS; export const LEFT_MENU_ARR = LEFT_MENU + "/" + ARR; export const GEN_ROUTER = '/' export const GEN_ROUTER_NAME = 'gen' export const LOGIN_ROUTER = '/login' export const NOT_FOUND_ROUTER = '/404' export const NOT_FOUND_TIT = "404"; export const WELCOME_ROUTER = '/welcome' export const WELCOME_TIT = "欢迎页" export const STATIC_ROUTER = [NOT_FOUND_ROUTER, WELCOME_ROUTER] export const MY_USERINFO_ROUTER = "/user/myUserInfo" export const MY_MSG_ROUTER = "/user/msg" export const STATUS_CODE = { SUCCESS: 200, WARNING: 201, NO_MORE: 205, ERROR: 300, NO_LOGIN: 301, NO_PERM: 302 }
30.588235
77
0.739423
68bbd8e83abd5918caa293f278fca9af35d1939c
2,210
js
JavaScript
public/js/profile.js
zacharyjg00/Railway-Express
94ad46a8b846cc66b8a747eaf1b5cb632eb21fa2
[ "MIT" ]
1
2021-07-25T06:38:47.000Z
2021-07-25T06:38:47.000Z
public/js/profile.js
zacharyjg00/Railway-Express
94ad46a8b846cc66b8a747eaf1b5cb632eb21fa2
[ "MIT" ]
null
null
null
public/js/profile.js
zacharyjg00/Railway-Express
94ad46a8b846cc66b8a747eaf1b5cb632eb21fa2
[ "MIT" ]
2
2021-07-30T20:32:55.000Z
2021-10-06T18:50:23.000Z
const updateButtonHandler = async (event) => { const first_name = document.querySelector('#first-name').value.trim(); const last_name = document.querySelector('#last-name').value.trim(); const email = document.querySelector('#email').value.trim(); if (first_name && last_name && email) { if (event.target.hasAttribute('data-id')) { const id = event.target.getAttribute('data-id'); const response = await fetch(`/api/profile/${id}`, { method: 'PUT', body: JSON.stringify({ first_name, last_name, email }), headers: { 'Content-Type': 'application/json', }, }); if (response.ok) { alert('Successfully updated user details!'); document.location.replace('/profile'); } else { alert('Failed to update user details'); } } } }; const delReservationButtonHandler = async (event) => { if (event.target.hasAttribute('data-id')) { const id = event.target.getAttribute('data-id'); const response = await fetch(`/api/reservation/${id}`, { method: 'DELETE', }); if (response.ok) { document.location.replace('/profile'); } else { alert('Failed to delete reservation'); } } }; const delProfileButtonHandler = async (event) => { if (event.target.hasAttribute('data-id')) { const id = event.target.getAttribute('data-id'); const response = await fetch(`/api/profile/${id}`, { method: 'DELETE', }); if (response.ok) { document.location.replace('/'); } else { alert('Failed to delete user'); } } }; if(document.querySelector("#delete-reservation-button")) { document .querySelector('#delete-reservation-button') .addEventListener('click', delReservationButtonHandler); } document .querySelector('#update-button') .addEventListener('click', updateButtonHandler); document .querySelector('#delete-profile-button') .addEventListener('click', delProfileButtonHandler);
29.466667
74
0.566516
68bce9c42f032b9e49e976bf0b6d989cf82b68d8
9,872
js
JavaScript
src/auth.js
balaji-b-v/firebase-mock-v3
3ad3191bb55e42e2a198d95dcbf16a16e0cf3e9d
[ "MIT" ]
null
null
null
src/auth.js
balaji-b-v/firebase-mock-v3
3ad3191bb55e42e2a198d95dcbf16a16e0cf3e9d
[ "MIT" ]
null
null
null
src/auth.js
balaji-b-v/firebase-mock-v3
3ad3191bb55e42e2a198d95dcbf16a16e0cf3e9d
[ "MIT" ]
null
null
null
'use strict'; var _ = require('lodash'); var format = require('util').format; var rsvp = require('rsvp'); function FirebaseAuth () { this.currentUser = null; this._auth = { listeners: [], completionListeners: [], users: [], uidCounter: 1 }; } FirebaseAuth.prototype.changeAuthState = function (userData) { this._defer('changeAuthState', _.toArray(arguments), function() { if (!_.isEqual(this.currentUser, userData)) { this.currentUser = _.isObject(userData) ? userData : null; this._triggerAuthEvent(); } }); }; FirebaseAuth.prototype.onAuthStateChanged = function (callback) { var self = this; var currentUser = this.currentUser; this._auth.listeners.push({fn: callback}); defer(); return destroy; function destroy() { self.offAuth(callback); } function defer() { self._defer('onAuthStateChanged', _.toArray(arguments), function() { if (!_.isEqual(self.currentUser, currentUser)) { self._triggerAuthEvent(); } }); } }; FirebaseAuth.prototype.getEmailUser = function (email) { var users = this._auth.users; return users.hasOwnProperty(email) ? _.clone(users[email]) : null; }; // number of arguments var authMethods = { authWithCustomToken: 2, authAnonymously: 1, authWithPassword: 2, authWithOAuthPopup: 2, authWithOAuthRedirect: 2, authWithOAuthToken: 3 }; Object.keys(authMethods) .forEach(function (method) { var length = authMethods[method]; var callbackIndex = length - 1; FirebaseAuth.prototype[method] = function () { this._authEvent(method, arguments[callbackIndex]); }; }); var signinMethods = { signInWithCustomToken: function(authToken) { return { isAnonymous: false }; }, signInAnonymously: function() { return { isAnonymous: true }; }, signInWithEmailAndPassword: function(email, password) { return { isAnonymous: false, email: email }; }, signInWithPopup: function(provider) { return { isAnonymous: false, providerData: [provider] }; }, signInWithRedirect: function(provider) { return { isAnonymous: false, providerData: [provider] }; }, signInWithCredential: function(credential) { return { isAnonymous: false }; } }; Object.keys(signinMethods) .forEach(function (method) { var getUser = signinMethods[method]; FirebaseAuth.prototype[method] = function () { var self = this; var user = getUser.apply(this, arguments); var promise = new rsvp.Promise(function(resolve, reject) { self._authEvent(method, function(err) { if (err) reject(err); self.currentUser = user; resolve(user); self._triggerAuthEvent(); }, true); }); return promise; }; }); FirebaseAuth.prototype.auth = function (token, callback) { console.warn('FIREBASE WARNING: FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead.'); this._authEvent('auth', callback); }; FirebaseAuth.prototype._authEvent = function (method, callback, defercallback) { var err = this._nextErr(method); if (!callback) return; if (err) { // if an error occurs, we defer the error report until the next flush() // event is triggered this._defer('_authEvent', _.toArray(arguments), function() { callback(err, null); }); } else { if (defercallback) { this._defer(method, _.toArray(arguments), function() { callback(); }); } else { // if there is no error, then we just add our callback to the listener // stack and wait for the next changeAuthState() call. this._auth.completionListeners.push({fn: callback}); } } }; FirebaseAuth.prototype._triggerAuthEvent = function () { var completionListeners = this._auth.completionListeners; this._auth.completionListeners = []; var user = this.currentUser; completionListeners.forEach(function (parts) { parts.fn.call(parts.context, null, _.cloneDeep(user)); }); var listeners = _.cloneDeep(this._auth.listeners); listeners.forEach(function (parts) { parts.fn.call(parts.context, _.cloneDeep(user)); }); }; FirebaseAuth.prototype.getAuth = function () { return this.currentUser; }; FirebaseAuth.prototype.onAuth = function (onComplete, context) { this._auth.listeners.push({ fn: onComplete, context: context }); onComplete.call(context, this.getAuth()); }; FirebaseAuth.prototype.offAuth = function (onComplete, context) { var index = _.findIndex(this._auth.listeners, function (listener) { return listener.fn === onComplete && listener.context === context; }); if (index > -1) { this._auth.listeners.splice(index, 1); } }; FirebaseAuth.prototype.unauth = function () { if (this.currentUser !== null) { this.currentUser = null; this._triggerAuthEvent(); } }; FirebaseAuth.prototype.signOut = function () { var self = this, updateuser = this.currentUser !== null; var promise = new rsvp.Promise(function(resolve, reject) { self._authEvent('signOut', function(err) { if (err) reject(err); self.currentUser = null; resolve(); if (updateuser) { self._triggerAuthEvent(); } }, true); }); return promise; }; FirebaseAuth.prototype.createUser = function (credentials, onComplete) { validateCredentials('createUser', credentials, [ 'email', 'password' ]); var err = this._nextErr('createUser'); var users = this._auth.users; this._defer('createUser', _.toArray(arguments), function () { var user = null; err = err || this._validateNewEmail(credentials); if (!err) { var key = credentials.email; users[key] = { uid: this._nextUid(), email: key, password: credentials.password }; user = { uid: users[key].uid }; } onComplete(err, user); }); }; FirebaseAuth.prototype.changeEmail = function (credentials, onComplete) { validateCredentials('changeEmail', credentials, [ 'oldEmail', 'newEmail', 'password' ]); var err = this._nextErr('changeEmail'); this._defer('changeEmail', _.toArray(arguments), function () { err = err || this._validateExistingEmail({ email: credentials.oldEmail }) || this._validPass({ password: credentials.password, email: credentials.oldEmail }, 'password'); if (!err) { var users = this._auth.users; var user = users[credentials.oldEmail]; delete users[credentials.oldEmail]; user.email = credentials.newEmail; users[user.email] = user; } onComplete(err); }); }; FirebaseAuth.prototype.changePassword = function (credentials, onComplete) { validateCredentials('changePassword', credentials, [ 'email', 'oldPassword', 'newPassword' ]); var err = this._nextErr('changePassword'); this._defer('changePassword', _.toArray(arguments), function () { err = err || this._validateExistingEmail(credentials) || this._validPass(credentials, 'oldPassword'); if (!err) { var key = credentials.email; var user = this._auth.users[key]; user.password = credentials.newPassword; } onComplete(err); }); }; FirebaseAuth.prototype.removeUser = function (credentials, onComplete) { validateCredentials('removeUser', credentials, [ 'email', 'password' ]); var err = this._nextErr('removeUser'); this._defer('removeUser', _.toArray(arguments), function () { err = err || this._validateExistingEmail(credentials) || this._validPass(credentials, 'password'); if (!err) { delete this._auth.users[credentials.email]; } onComplete(err); }); }; FirebaseAuth.prototype.resetPassword = function (credentials, onComplete) { validateCredentials('resetPassword', credentials, [ 'email' ]); var err = this._nextErr('resetPassword'); this._defer('resetPassword', _.toArray(arguments), function() { err = err || this._validateExistingEmail(credentials); onComplete(err); }); }; FirebaseAuth.prototype._nextUid = function () { return 'simplelogin:' + (this._auth.uidCounter++); }; FirebaseAuth.prototype._validateNewEmail = function (credentials) { if (this._auth.users.hasOwnProperty(credentials.email)) { var err = new Error('The specified email address is already in use.'); err.code = 'EMAIL_TAKEN'; return err; } return null; }; FirebaseAuth.prototype._validateExistingEmail = function (credentials) { if (!this._auth.users.hasOwnProperty(credentials.email)) { var err = new Error('The specified user does not exist.'); err.code = 'INVALID_USER'; return err; } return null; }; FirebaseAuth.prototype._validPass = function (object, name) { var err = null; var key = object.email; if (object[name] !== this._auth.users[key].password) { err = new Error('The specified password is incorrect.'); err.code = 'INVALID_PASSWORD'; } return err; }; function validateCredentials (method, credentials, fields) { validateObject(credentials, method, 'First'); fields.forEach(function (field) { validateArgument(method, credentials, 'First', field, 'string'); }); } function validateObject (object, method, position) { if (!_.isObject(object)) { throw new Error(format( 'Firebase.%s failed: %s argument must be a valid object.', method, position )); } } function validateArgument (method, object, position, name, type) { if (!object.hasOwnProperty(name) || typeof object[name] !== type) { throw new Error(format( 'Firebase.%s failed: %s argument must contain the key "%s" with type "%s"', method, position, name, type )); } } module.exports = FirebaseAuth;
26.466488
127
0.652857
68bd3cca6245ed0d04df5d1806cbc4be9dd95806
2,312
js
JavaScript
backend/tests/unit/video.spec.js
jabardigitalservice/sapawarga-webadmin
e66327b8b37db544a6af82b92ff7998ffb6f52ae
[ "MIT" ]
1
2021-07-07T02:45:40.000Z
2021-07-07T02:45:40.000Z
backend/tests/unit/video.spec.js
jabardigitalservice/sapawarga-webadmin
e66327b8b37db544a6af82b92ff7998ffb6f52ae
[ "MIT" ]
null
null
null
backend/tests/unit/video.spec.js
jabardigitalservice/sapawarga-webadmin
e66327b8b37db544a6af82b92ff7998ffb6f52ae
[ "MIT" ]
2
2020-03-11T08:41:59.000Z
2021-07-07T02:45:44.000Z
import Router from 'vue-router' import ElementUI from 'element-ui' import flushPromises from 'flush-promises' import * as api from '@/api/video' import ListFilter from '@/views/video/_listfilter' import VideoList from '@/views/video/list' import VideoEdit from '@/views/video/edit' import VideoDetail from '@/views/video/detail' import VideoCreate from '@/views/video/create' import { shallowMount, createLocalVue } from '@vue/test-utils' import videoListFixture from './fixtures/videoList' const localVue = createLocalVue() const router = new Router() localVue.use(ElementUI) localVue.use(Router) beforeEach(() => { jest.resetModules() jest.clearAllMocks() }) jest.mock('@/api/video') api.fetchList = () => Promise.resolve(videoListFixture) const listQuery = { search: null, title: null, category_id: null } describe('Video', () => { const expectedVideoList = videoListFixture.data.items it('list video', async() => { const wrapper = shallowMount(VideoList, { localVue, mocks: { $t: () => {} }, propsData: { listQuery } }) await flushPromises() wrapper.vm.resetFilter() wrapper.vm.changeSort('title') wrapper.vm.getTableRowNumbering() wrapper.vm.getStatistic() wrapper.vm.deleteVideo() wrapper.vm.deactivateRecord(20) wrapper.vm.activateRecord(20) wrapper.vm.text_truncate('str') expect(wrapper.contains(VideoList)).toBe(true) expect(wrapper.vm.list).toBe(expectedVideoList) }) it('filter', () => { const wrapper = shallowMount(ListFilter, { localVue, mocks: { $t: () => {} }, propsData: { listQuery } }) wrapper.vm.submitSearch() wrapper.vm.resetFilter() expect(wrapper.props('listQuery')).toBe(listQuery) expect(wrapper.emitted()['reset-search']).toBeTruthy() expect(wrapper.emitted()['submit-search']).toBeTruthy() }) it('detail', () => { const wrapper = shallowMount(VideoDetail, { localVue, router, mocks: { $t: () => {} } }) wrapper.vm.getDetail() wrapper.vm.record expect(wrapper.contains(VideoDetail)).toBe(true) }) it('create', () => { const isEdit = false const wrapper = shallowMount(VideoCreate, { localVue, router, mocks: { $t: () => {} }, propsData: { isEdit } }) expect(wrapper.contains(VideoCreate)).toBe(true) }) })
21.211009
62
0.671713
68bd75ad09c1a04b1669c67d2483dc62063f10a5
424
js
JavaScript
public/js/reportForm.js
denaunglin2/-EasyDonate
001d59fdb458e0db033bc4ebfd4ed3365654b3c3
[ "MIT" ]
1
2021-04-28T02:55:12.000Z
2021-04-28T02:55:12.000Z
public/js/reportForm.js
denaunglin2/-EasyDonate
001d59fdb458e0db033bc4ebfd4ed3365654b3c3
[ "MIT" ]
2
2021-06-22T15:40:06.000Z
2022-03-02T07:29:30.000Z
public/js/reportForm.js
denaunglin2/-EasyDonate
001d59fdb458e0db033bc4ebfd4ed3365654b3c3
[ "MIT" ]
1
2021-04-28T02:58:39.000Z
2021-04-28T02:58:39.000Z
$(document).ready(function() { $("#reportingOptions1").click(function() { $("#toggleTextarea").css("display", "none"); }); $("#reportingOptions2").click(function() { $("#toggleTextarea").css("display", "none"); }); $("#reportingOptions3").click(function() { $("#toggleTextarea").css("display", "none"); }); $("#reportingOptions4").click(function() { $("#toggleTextarea").css("display", "block"); }) });
20.190476
47
0.599057
68c02525d0aea4b746982c2e11edede299070deb
1,010
js
JavaScript
lib/keyboard.js
george28cs/spawn_rfid_module
883d6b2140a965ecf759c20b0f03e1557145a737
[ "Unlicense" ]
null
null
null
lib/keyboard.js
george28cs/spawn_rfid_module
883d6b2140a965ecf759c20b0f03e1557145a737
[ "Unlicense" ]
null
null
null
lib/keyboard.js
george28cs/spawn_rfid_module
883d6b2140a965ecf759c20b0f03e1557145a737
[ "Unlicense" ]
null
null
null
const util = require('util'); const InputEvent = require('./'); const KEY_STATUS = { KEY_UP : 0x00, KEY_PRESS : 0x01, KEY_DOWN : 0x02 }; /** * [Keyboard description] * @param {[type]} device [description] */ function Keyboard(device){ var self = this; InputEvent.apply(this, arguments); this.on('data', function(ev){ // filting key event if(InputEvent.EVENT_TYPES.EV_KEY == ev.type){ switch(ev.value){ case KEY_STATUS.KEY_UP: self.emit('keyup', ev); break; case KEY_STATUS.KEY_DOWN: self.emit('keydown', ev); break; case KEY_STATUS.KEY_PRESS: self.emit('keypress', ev); break; } } }); }; /** * [inherits description] * @param {[type]} Keyboard [description] * @param {[type]} InputEvent [description] * @return {[type]} [description] */ util.inherits(Keyboard, InputEvent); /** * [exports description] * @type {[type]} */ module.exports = Keyboard;
22.444444
49
0.580198
68c0866c1e47d0e72b2d94545d58ce75127b1924
269
js
JavaScript
webpack.config.js
jesusantguerrero/atmosthere
de9012f62c804f7e407000c8d3ad03bd4b3b5e42
[ "MIT" ]
null
null
null
webpack.config.js
jesusantguerrero/atmosthere
de9012f62c804f7e407000c8d3ad03bd4b3b5e42
[ "MIT" ]
null
null
null
webpack.config.js
jesusantguerrero/atmosthere
de9012f62c804f7e407000c8d3ad03bd4b3b5e42
[ "MIT" ]
null
null
null
const path = require('path'); const webpack = require('webpack'); module.exports = { plugins: [new webpack.DefinePlugin({ // Definitions... }) ], resolve: { alias: { '@': path.resolve('resources/js'), }, }, };
17.933333
46
0.494424
68c1f68f9c0c5999866ac3e81684901c34fee1f9
432
js
JavaScript
migrations/2_deploy_contracts.js
Syed-Fahad-Hussain/ICO-ERC223
8b57c13d8bf41bd1fef7af5fd138ffe1cc3a0edd
[ "MIT" ]
1
2019-02-16T11:30:40.000Z
2019-02-16T11:30:40.000Z
migrations/2_deploy_contracts.js
Syed-Fahad-Hussain/ICO-ERC223
8b57c13d8bf41bd1fef7af5fd138ffe1cc3a0edd
[ "MIT" ]
null
null
null
migrations/2_deploy_contracts.js
Syed-Fahad-Hussain/ICO-ERC223
8b57c13d8bf41bd1fef7af5fd138ffe1cc3a0edd
[ "MIT" ]
null
null
null
var ICO = artifacts.require("./ICO.sol"); var Token = artifacts.require("./Token.sol"); module.exports = async function (deployer) { await deployer.deploy(Token, "FahadToken", "FTK", 6, 100); await deployer.deploy(ICO, Token.address); // deployer.deploy(Token, 'FahadToken', 'FTK', 6, 100).then(() => { // deployer.deploy(ICO, Token.address); // }); // await deployer.deploy(TOKEN, 'FahadToken', 'FTK', 6, 100); };
30.857143
69
0.645833
68c42489c47fb8f4248b49061cf444458610978d
462
js
JavaScript
src/components/Table/index.js
CDCgov/phlip
a793556c781b675ee5bb6d37addeb8dbc26bd698
[ "Apache-2.0" ]
null
null
null
src/components/Table/index.js
CDCgov/phlip
a793556c781b675ee5bb6d37addeb8dbc26bd698
[ "Apache-2.0" ]
5
2020-05-11T20:36:25.000Z
2021-11-02T15:49:04.000Z
src/components/Table/index.js
LaudateCorpus1/phlip
a793556c781b675ee5bb6d37addeb8dbc26bd698
[ "Apache-2.0" ]
2
2020-12-21T21:23:00.000Z
2022-02-27T23:12:56.000Z
import React from 'react' import PropTypes from 'prop-types' import { default as MuiTable } from '@material-ui/core/Table' /** * Wrapper for @material-ui/core's Table component */ export const Table = ({ children, ...otherProps }) => { return ( <MuiTable {...otherProps}> {children} </MuiTable> ) } Table.propTypes = { /** * Contents of table, will be TableHead, TableBody, etc. */ children: PropTypes.node } export default Table
20.086957
61
0.65368
68c4a0ed0b2114aebd9eec0c8ba27ea22a811bd9
17,467
js
JavaScript
SousChef.js
ibm-cds-labs/watson-recipe-bot-nodejs-graph
213f2d62f8aaa07cb22f060cd37fb83dcdbf01f5
[ "Apache-1.1" ]
7
2017-02-11T03:01:26.000Z
2017-06-08T20:12:08.000Z
SousChef.js
ibm-cds-labs/watson-recipe-bot-nodejs
213f2d62f8aaa07cb22f060cd37fb83dcdbf01f5
[ "Apache-1.1" ]
null
null
null
SousChef.js
ibm-cds-labs/watson-recipe-bot-nodejs
213f2d62f8aaa07cb22f060cd37fb83dcdbf01f5
[ "Apache-1.1" ]
2
2017-11-20T09:50:33.000Z
2018-03-07T10:10:18.000Z
'use strict'; const ConversationV1 = require('watson-developer-cloud/conversation/v1'); const RecipeClient = require('./RecipeClient'); const SlackBot = require('slackbots'); const MAX_RECIPES = 5; class SousChef { constructor(recipeStore, slackToken, recipeClientApiKey, conversationUsername, conversationPassword, conversationWorkspaceId, snsClient) { this.userStateMap = {}; this.recipeStore = recipeStore; this.recipeClient = new RecipeClient(recipeClientApiKey); this.slackToken = slackToken; this.conversationService = new ConversationV1({ username: conversationUsername, password: conversationPassword, version_date: '2016-07-01' }); this.conversationWorkspaceId = conversationWorkspaceId; this.snsClient = snsClient; } run() { this.recipeStore.init() .then(() => { this.slackBot = new SlackBot({ token: this.slackToken, name: 'souschef' }); this.slackBot.on('start', () => { console.log('sous-chef is connected and running!'); }); this.slackBot.on('message', (data) => { if (data.type == 'message' && data.channel.startsWith('D')) { if (!data.bot_id) { this.processMessage(data); } else { // ignore messages from the bot (messages we sent) } } }); }) .catch((error) => { console.log(`Error: ${error}`); process.exit(); }); } processMessage(data) { // get or create state for the user let message = data.text; let messageSender = data.user; let state = this.userStateMap[messageSender]; if (!state) { state = { userId: messageSender }; this.userStateMap[messageSender] = state; } // make call to conversation service let request = { input: {text: data.text}, context: state.conversationContext, workspace_id: this.conversationWorkspaceId, }; this.sendRequestToConversation(request) .then((response) => { state.conversationContext = response.context; if (state.conversationContext['is_favorites']) { return this.handleFavoritesMessage(state); } else if (state.conversationContext['is_ingredients']) { return this.handleIngredientsMessage(state, message); } else if (response.entities && response.entities.length > 0 && response.entities[0].entity == 'cuisine') { return this.handleCuisineMessage(state, response.entities[0].value); } else if (state.conversationContext['is_selection']) { return this.handleSelectionMessage(state); } else { return this.handleStartMessage(state, response); } }) .then((reply) => { this.slackBot.postMessage(data.channel, reply, {}); }) .catch((err) => { console.log(`Error: ${err}`); this.clearUserState(state); const reply = "Sorry, something went wrong! Say anything to me to start over..."; this.slackBot.postMessage(data.channel, reply, {}); }); } sendRequestToConversation(request) { return new Promise((resolve, reject) => { this.conversationService.message(request, (error, response) => { if (error) { reject(error); } else { resolve(response); } }); }); } handleStartMessage(state, response) { let reply = ''; for (let i = 0; i < response.output['text'].length; i++) { reply += response.output['text'][i] + '\n'; } if (state.user) { this.sendStartMessageToSns(state); return Promise.resolve(reply); } else { return this.recipeStore.addUser(state.userId) .then((user) => { state.user = user; this.sendStartMessageToSns(state); return Promise.resolve(reply); }); } } sendStartMessageToSns(state) { if (! state.conversationStarted) { state.conversationStarted = true; this.snsClient.postStartMessage(state); } } handleFavoritesMessage(state) { return this.recipeStore.findFavoriteRecipesForUser(state.user, MAX_RECIPES) .then((recipes) => { // update state state.conversationContext['recipes'] = recipes; state.ingredientCuisine = null; // post to sns and return response this.snsClient.postFavoritesMessage(state); const response = this.getRecipeListResponse(recipes); return Promise.resolve(response); }); } handleIngredientsMessage(state, message) { // we want to get a list of recipes based on the ingredients (message) // first we see if we already have the ingredients in our datastore let ingredientsStr = message; return this.recipeStore.findIngredient(ingredientsStr) .then((ingredient) => { if (ingredient) { console.log(`Ingredient exists for ${ingredientsStr}. Returning recipes from datastore.`); // get recipes from datastore let matchingRecipes = []; // get recommended recipes first return this.recipeStore.findRecommendedRecipesForIngredient(ingredientsStr, state.user, MAX_RECIPES) .then((recommendedRecipes) => { let recipeIds = []; for (let recipe of recommendedRecipes) { recipe.recommended = true; recipeIds.push(recipe.id); matchingRecipes.push(recipe); } if (matchingRecipes.length < MAX_RECIPES) { let recipes = JSON.parse(ingredient.properties.detail[0].value); for (let recipe of recipes) { let recipe_id = recipe.id + ''; if (recipeIds.indexOf(recipe_id) < 0) { recipeIds.push(recipe_id); matchingRecipes.push(recipe); if (matchingRecipes.length >= MAX_RECIPES) { break; } } } } return this.recipeStore.recordIngredientRequestForUser(ingredient, state.user) }) .then(() => { return Promise.resolve({ingredient: ingredient, recipes: matchingRecipes}); }); } else { // we don't have the ingredients in our datastore yet, so get list of recipes from Spoonacular console.log(`Ingredient does not exist for ${ingredientsStr}. Querying Spoonacular for recipes.`); return this.recipeClient.findByIngredients(ingredientsStr) .then((matchingRecipes) => { // add ingredient to datastore return this.recipeStore.addIngredient(ingredientsStr, matchingRecipes, state.user) }) .then((ingredient) => { return Promise.resolve({ingredient: ingredient, recipes: JSON.parse(ingredient.properties.detail[0].value)}); }); } }) .then((result) => { let ingredient = result.ingredient; let matchingRecipes = result.recipes; // update state state.conversationContext['recipes'] = matchingRecipes; state.ingredientCuisine = ingredient; // post to sns and return response this.snsClient.postIngredientMessage(state, ingredientsStr); const response = this.getRecipeListResponse(matchingRecipes); return Promise.resolve(response); }); } handleCuisineMessage(state, message) { // we want to get a list of recipes based on the cuisine (message) // first we see if we already have the cuisines in our datastore let cuisineStr = message; return this.recipeStore.findCuisine(cuisineStr) .then((cuisine) => { if (cuisine) { console.log(`Cuisine exists for ${cuisineStr}. Returning recipes from datastore.`); // get recipes from datastore let matchingRecipes = []; // get recommended recipes first return this.recipeStore.findRecommendedRecipesForCuisine(cuisineStr, state.user, MAX_RECIPES) .then((recommendedRecipes) => { let recipeIds = []; for (let recipe of recommendedRecipes) { recipe.recommended = true; recipeIds.push(recipe.id); matchingRecipes.push(recipe); } if (matchingRecipes.length < MAX_RECIPES) { let recipes = JSON.parse(cuisine.properties.detail[0].value); for (let recipe of recipes) { let recipe_id = recipe.id + ''; if (recipeIds.indexOf(recipe_id) < 0) { recipeIds.push(recipe_id); matchingRecipes.push(recipe); if (matchingRecipes.length >= MAX_RECIPES) { break; } } } } return this.recipeStore.recordCuisineRequestForUser(cuisine, state.user) }) .then(() => { return Promise.resolve({cuisine: cuisine, recipes: matchingRecipes}); }); } else { // we don't have the cuisine in our datastore yet, so get list of recipes from Spoonacular console.log(`Cuisine does not exist for ${cuisineStr}. Querying Spoonacular for recipes.`); return this.recipeClient.findByCuisine(cuisineStr) .then((matchingRecipes) => { // add cuisine to datastore return this.recipeStore.addCuisine(cuisineStr, matchingRecipes, state.user) }) .then((cuisine) => { return Promise.resolve({cuisine: cuisine, recipes: JSON.parse(cuisine.properties.detail[0].value)}); }); } }) .then((result) => { let cuisine = result.cuisine; let matchingRecipes = result.recipes; // update state state.conversationContext['recipes'] = matchingRecipes; state.ingredientCuisine = cuisine; // post to sns and return response this.snsClient.postCuisineMessage(state, cuisineStr); const response = this.getRecipeListResponse(matchingRecipes); return Promise.resolve(response); }); } handleSelectionMessage(state) { let selection = -1; if (state.conversationContext['selection']) { selection = parseInt(state.conversationContext['selection']); } if (selection >= 1 && selection <= MAX_RECIPES) { // we want to get a the recipe based on the selection // first we see if we already have the recipe in our datastore let recipes = state.conversationContext['recipes']; let recipeId = `${recipes[selection - 1]["id"]}`; return this.recipeStore.findRecipe(recipeId) .then((recipe) => { if (recipe) { console.log(`Recipe exists for ${recipeId}. Returning recipe steps from datastore.`); // increment the count on the ingredient/cuisine-recipe and the user-recipe return this.recipeStore.recordRecipeRequestForUser(recipe, state.ingredientCuisine, state.user) .then(() => { return Promise.resolve(recipe); }); } else { console.log(`Recipe does not exist for ${recipeId}. Querying Spoonacular for details.`); let recipeInfo; let recipeSteps; return this.recipeClient.getInfoById(recipeId) .then((response) => { recipeInfo = response; return this.recipeClient.getStepsById(recipeId); }) .then((response) => { recipeSteps = response; let recipeDetail = this.getRecipeInstructionsResponse(recipeInfo, recipeSteps); // add recipe to datastore return this.recipeStore.addRecipe(recipeId, recipeInfo['title'], recipeDetail, state.ingredientCuisine, state.user); }); } }) .then((recipe) => { let recipeDetail = recipe.properties.detail[0].value.replace(/\\n/g, '\n'); this.snsClient.postRecipeMessage(state, recipeId, recipe.properties['title'][0].value); this.clearUserState(state); return Promise.resolve(recipeDetail); }); } else { this.clearUserState(state); return Promise.resolve('Invalid selection! Say anything to start over...'); } } clearUserState(state) { state.ingredientCuisine = null; state.conversationContext = null; state.conversationStarted = false; } getRecipeListResponse(matchingRecipes) { let response = 'Let\'s see here...\nI\'ve found these recipes: \n'; for (let i = 0; i < matchingRecipes.length; i++) { let recipe = matchingRecipes[i]; response += `${(i + 1)}.${recipe.title}`; if (recipe.recommended) { let users = recipe.recommendedUserCount; let s1 = (users==1?"":"s"); let s2 = (users==1?"s":""); response += ` *(${users} other user${s1} like${s2} this)`; } response += '\n'; } response += '\nPlease enter the corresponding number of your choice.'; return response; } getRecipeInstructionsResponse(recipeInfo, recipeSteps) { let response = 'Ok, it takes *'; response += `${recipeInfo['readyInMinutes']}* minutes to make *`; response += `${recipeInfo['servings']}* servings of *`; response += `${recipeInfo['title']}*. Here are the steps:\n\n`; if (recipeSteps != null && recipeSteps.length > 0) { for (let i = 0; i < recipeSteps.length; i++) { let equipStr = ''; for (let e of recipeSteps[i]['equipment']) { equipStr += `${e['name']},`; } if (equipStr.length == 0) { equipStr = 'None'; } else { equipStr = equipStr.substring(0, equipStr.length - 1); } response += `*Step ${i + 1}*:\n`; response += `_Equipment_: ${equipStr}\n`; response += `_Action_: ${recipeSteps[i]['step']}\n\n`; } } else { response += '_No instructions available for this recipe._\n\n'; } response += '*Say anything to me to start over...*'; return response; } } module.exports = SousChef;
45.725131
148
0.484456
68c6859c76c2b7ba31aea0803903db51c198b88c
1,299
js
JavaScript
client/src/component/LikeButton.js
Shahzayb/pistagram
498e80afdb1e8084c5a56e98ec0af2bd68d1288b
[ "MIT" ]
4
2020-05-26T22:21:16.000Z
2021-08-09T15:58:30.000Z
client/src/component/LikeButton.js
Shahzayb/pistagram
498e80afdb1e8084c5a56e98ec0af2bd68d1288b
[ "MIT" ]
5
2021-05-11T02:55:57.000Z
2021-05-11T06:05:09.000Z
client/src/component/LikeButton.js
Shahzayb/pistagram
498e80afdb1e8084c5a56e98ec0af2bd68d1288b
[ "MIT" ]
null
null
null
import React from 'react'; import { makeStyles, ButtonBase } from '@material-ui/core'; import HeartIcon from '@material-ui/icons/Favorite'; import Snackbar from './Snackbar'; import { useToggleLike } from '../react-query/photo'; const useStyles = makeStyles((theme) => ({ unliked: { fill: 'transparent', stroke: 'currentColor', }, liked: { fill: theme.palette.error.light, }, icon: { fontSize: '30px', }, })); function LikeButton({ photoId, liked }) { const classes = useStyles(); const [mutate, { status, data, error, reset }] = useToggleLike(); return ( <> <Snackbar open={!!error} onClose={() => reset()} severity="error" message={error?.message} /> <Snackbar open={!!data} onClose={() => reset()} severity="success" message={data} /> <ButtonBase onClick={() => { mutate({ photoId, liked }).then(console.log).catch(console.error); }} disableRipple disableTouchRipple disabled={status === 'loading'} > <HeartIcon className={`${liked ? classes.liked : classes.unliked} ${ classes.icon }`} /> </ButtonBase> </> ); } export default LikeButton;
21.295082
76
0.548884
68c6927c56082609dab566240e46960343224e95
748
js
JavaScript
config/config.js
grup-gelap/rentnesia-backend
9c8f5c09c8873de6508df35efe492359ead48c4f
[ "MIT" ]
2
2019-02-04T03:36:00.000Z
2021-04-09T16:43:08.000Z
config/config.js
grup-gelap/rentnesia-backend
9c8f5c09c8873de6508df35efe492359ead48c4f
[ "MIT" ]
null
null
null
config/config.js
grup-gelap/rentnesia-backend
9c8f5c09c8873de6508df35efe492359ead48c4f
[ "MIT" ]
2
2019-02-04T03:06:25.000Z
2019-02-10T07:09:16.000Z
require("dotenv").config(); module.exports = { development: { username: process.env.DB_DEV_USERNAME, password: process.env.DB_DEV_PASSWORD, database: process.env.DB_DEV_NAME, host: process.env.DB_DEV_HOST, dialect: process.env.DB_DEV_DIALECT }, test: { username: process.env.DB_TEST_USERNAME, password: process.env.DB_TEST_PASSWORD, database: process.env.DB_TEST_NAME, host: process.env.DB_TEST_HOST, dialect: process.env.DB_TEST_DIALECT }, production: { username: process.env.DB_PRODUCTION_USERNAME, password: process.env.DB_PRODUCTION_PASSWORD, database: process.env.DB_PRODUCTION_NAME, host: process.env.DB_PRODUCTION_HOST, dialect: process.env.DB_PRODUCTION_DIALECT } };
28.769231
49
0.735294
68c6969bab00c4173621b5e9eb557c332fda5862
376
js
JavaScript
components/Text.js
deamme/styled-collection
90358d1092fd2b6b93376ce2018ae5c00e540c53
[ "MIT" ]
1
2018-09-28T17:42:45.000Z
2018-09-28T17:42:45.000Z
components/Text.js
deamme/styled-collection
90358d1092fd2b6b93376ce2018ae5c00e540c53
[ "MIT" ]
null
null
null
components/Text.js
deamme/styled-collection
90358d1092fd2b6b93376ce2018ae5c00e540c53
[ "MIT" ]
null
null
null
import styled from 'styled-components'; import { space, color, fontSize, fontWeight, textAlign } from 'styled-system'; export default styled.p` ${color} ${space} ${fontSize} ${fontWeight} ${textAlign} margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",Helvetica, Arial, sans-serif,"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; `;
28.923077
147
0.702128
68c6e251f5eeb4e6d8d52148a8ffdb1691fa2cfd
107
js
JavaScript
src/config/formats.js
nagai-takayuki/graasp-app-code
273fe8b47a48c9d69fd93c79df41cbd8342f7f56
[ "MIT" ]
null
null
null
src/config/formats.js
nagai-takayuki/graasp-app-code
273fe8b47a48c9d69fd93c79df41cbd8342f7f56
[ "MIT" ]
null
null
null
src/config/formats.js
nagai-takayuki/graasp-app-code
273fe8b47a48c9d69fd93c79df41cbd8342f7f56
[ "MIT" ]
null
null
null
// eslint-disable-next-line import/prefer-default-export export const APP_INSTANCE_RESOURCE_FORMAT = 'v1';
35.666667
56
0.813084
68c84314c7b3c17a1c2bf888558d589e295a6291
397
js
JavaScript
src/scripts/components/box/Box.js
atsolberg/lwcc.org
af7a9f4d99fdcc0a259305e92e937ebf5b47febf
[ "MIT" ]
null
null
null
src/scripts/components/box/Box.js
atsolberg/lwcc.org
af7a9f4d99fdcc0a259305e92e937ebf5b47febf
[ "MIT" ]
17
2020-04-06T08:04:04.000Z
2022-02-12T11:33:17.000Z
src/scripts/components/box/Box.js
atsolberg/lwcc.org
af7a9f4d99fdcc0a259305e92e937ebf5b47febf
[ "MIT" ]
null
null
null
import React from 'react'; import { node } from 'prop-types'; import styles from './styles'; function Box({ children, ...rest }) { return ( <div className="container-xl" {...rest}> <div css={styles} className="row box"> <div className="col-12 box-content">{children}</div> </div> </div> ); } Box.propTypes = { children: node.isRequired, }; export default Box;
19.85
60
0.609572
68ca60dc32dff09f0dfe47b24b0974f758ac7846
59,971
js
JavaScript
node_modules/@fivethree/core/esm5/lib/popover/popover.component.js
expert-work/gobizgrow-ionic
81507c71946649b1d208154654368036a71f9f42
[ "BSD-3-Clause-Attribution" ]
null
null
null
node_modules/@fivethree/core/esm5/lib/popover/popover.component.js
expert-work/gobizgrow-ionic
81507c71946649b1d208154654368036a71f9f42
[ "BSD-3-Clause-Attribution" ]
null
null
null
node_modules/@fivethree/core/esm5/lib/popover/popover.component.js
expert-work/gobizgrow-ionic
81507c71946649b1d208154654368036a71f9f42
[ "BSD-3-Clause-Attribution" ]
null
null
null
/** * @fileoverview added by tsickle * Generated from: lib/popover/popover.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ import * as tslib_1 from "tslib"; import { animIn, animOut } from './popover.animations'; import { DomSanitizer } from '@angular/platform-browser'; import { Component, ViewChild, Input, ViewEncapsulation, Host, Optional, ElementRef } from '@angular/core'; import { FivOverlay } from '../overlay/overlay.component'; import { Platform, IonContent } from '@ionic/angular'; import { fromEvent, Subject, merge, from } from 'rxjs'; import { tap, takeUntil, map, throttleTime, filter, flatMap } from 'rxjs/operators'; import { NavigationStart, Router } from '@angular/router'; import { after } from '@fivethree/ngx-rxjs-animations'; var FivPopover = /** @class */ (function () { function FivPopover(platform, content, dom, router) { var _this = this; this.platform = platform; this.content = content; this.dom = dom; this.router = router; this.arrow = false; this.arrowWidth = 24; this.arrowHeight = this.arrowWidth / 1.6; this.arrowPosition = 'auto'; this.backdrop = true; this.overlaysTarget = true; this.closeOnNavigation = true; this.scrollToTarget = false; this.scrollSpeed = 100; this.position = 'auto'; this.classes = []; this.viewportOnly = true; this.hidden = false; this.onDestroy$ = new Subject(); this.onClose$ = new Subject(); this.inDuration = 200; this.outDuration = 80; this.animationIn = (/** * @param {?} element * @return {?} */ function (element) { return animIn(element, _this._position, _this.inDuration); }); this.animationOut = (/** * @param {?} element * @return {?} */ function (element) { return animOut(element, _this.outDuration); }); } Object.defineProperty(FivPopover.prototype, "styles", { get: /** * @return {?} */ function () { if (!this._position) { return; } return this.dom.bypassSecurityTrustStyle(" width: " + (this.width ? this.width + 'px' : 'auto') + "; \n height: " + (this.height ? this.height + 'px' : 'auto') + "; \n left: " + this.getContainerLeft() + "px; \n top: " + this.getContainerTop() + "px;"); }, enumerable: true, configurable: true }); Object.defineProperty(FivPopover.prototype, "triangle", { get: /** * @return {?} */ function () { var _this = this; /** @type {?} */ var isHorizontal = ['left', 'right'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); if (isHorizontal) { return this.arrowHeight + ",0 0," + this.arrowWidth / 2 + " " + this.arrowHeight + "," + this.arrowWidth; } return "0," + this.arrowHeight + " " + this.arrowWidth / 2 + ",0 " + this.arrowWidth + "," + this.arrowHeight; }, enumerable: true, configurable: true }); Object.defineProperty(FivPopover.prototype, "svgStyles", { get: /** * @return {?} */ function () { var _this = this; if (!this._position) { return; } /** @type {?} */ var isHorizontal = ['left', 'right'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); /** @type {?} */ var rotate = (this.position === 'auto' && this._position.vertical === 'bottom') || this.position === 'left'; return this.dom.bypassSecurityTrustStyle("height: " + (isHorizontal ? this.arrowWidth : this.arrowHeight) + "px; \n width: " + (isHorizontal ? this.arrowHeight : this.arrowWidth) + "px; \n top: " + this.getArrowTop() + "px; \n left: " + this.getArrowLeft() + "px;\n transform: rotateZ(" + (rotate ? 180 : 0) + "deg);"); }, enumerable: true, configurable: true }); Object.defineProperty(FivPopover.prototype, "animationStyles", { get: /** * @return {?} */ function () { if (!this._position) { return; } return this.dom.bypassSecurityTrustStyle("height: " + this.arrowHeight + "px; \n width: " + this.arrowWidth + "px; \n top: " + this.getArrowTop() + "px; \n left: " + this.getArrowLeft() + "px;\n transform: rotateZ(" + (this._position.vertical === 'bottom' ? 180 : 0) + "deg);"); }, enumerable: true, configurable: true }); /** * @return {?} */ FivPopover.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.router.events .pipe(filter((/** * @param {?} event * @return {?} */ function (event) { return event instanceof NavigationStart; })), filter((/** * @return {?} */ function () { return _this.closeOnNavigation && _this.overlay.open; })), tap((/** * @return {?} */ function () { return _this.close(); })), takeUntil(this.onDestroy$)) .subscribe(); }; /** * @return {?} */ FivPopover.prototype.ngAfterViewInit = /** * @return {?} */ function () { }; /** * @return {?} */ FivPopover.prototype.ngOnDestroy = /** * @return {?} */ function () { this.onDestroy$.next(); }; /** * @return {?} */ FivPopover.prototype.close = /** * @return {?} */ function () { var _this = this; this.animationOut(this.animationContainer) .pipe(after((/** * @return {?} */ function () { _this.overlay.hide(); _this.onClose$.next(); }))) .subscribe(); }; /** * @private * @param {?} target * @return {?} */ FivPopover.prototype.getPositionOfTarget = /** * @private * @param {?} target * @return {?} */ function (target) { /** @type {?} */ var rect = target.getBoundingClientRect(); return this.calculcatePositioning(rect.top, rect.left, rect.bottom, rect.right, rect.height, rect.width); }; /** * @param {?} target * @return {?} */ FivPopover.prototype.open = /** * @param {?} target * @return {?} */ function (target) { /** @type {?} */ var element; if (target instanceof MouseEvent) { element = (/** @type {?} */ (target.target)); } else if (target instanceof ElementRef) { element = (/** @type {?} */ (target.nativeElement)); } else { return; } this.openTarget(element); }; /** * @param {?} target * @return {?} */ FivPopover.prototype.openTarget = /** * @param {?} target * @return {?} */ function (target) { /** @type {?} */ var position = this.getPositionOfTarget(target); this.openAtPosition(target, position); this.watchResize(target); this.watchScroll(target); }; /** * @private * @param {?} target * @return {?} */ FivPopover.prototype.watchResize = /** * @private * @param {?} target * @return {?} */ function (target) { var _this = this; if (!this.viewportOnly) { return; } fromEvent(window, 'resize') .pipe(flatMap((/** * @return {?} */ function () { return _this.filterInViewport(target); })), throttleTime(50), map((/** * @return {?} */ function () { return _this.getPositionOfTarget(target); })), tap((/** * @param {?} pos * @return {?} */ function (pos) { return (_this._position = pos); })), takeUntil(this.onDestroy$)) .subscribe(); }; /** * @private * @param {?} target * @return {?} */ FivPopover.prototype.watchScroll = /** * @private * @param {?} target * @return {?} */ function (target) { var _this = this; if (!this.viewportOnly) { return; } if (this.content && !this.backdrop) { this.content.scrollEvents = true; merge(fromEvent(window, 'mousewheel'), fromEvent(window, 'touchmove'), this.content.ionScroll) .pipe(flatMap((/** * @return {?} */ function () { return _this.filterInViewport(target); })), map((/** * @return {?} */ function () { return _this.getPositionOfTarget(target); })), tap((/** * @param {?} pos * @return {?} */ function (pos) { return (_this._position = pos); })), takeUntil(this.onDestroy$)) .subscribe(); } }; /** * @private * @param {?} target * @return {?} */ FivPopover.prototype.filterInViewport = /** * @private * @param {?} target * @return {?} */ function (target) { var _this = this; return from(this.inViewport(target.getBoundingClientRect())).pipe(tap((/** * @param {?} inViewport * @return {?} */ function (inViewport) { return !inViewport ? (_this.hidden = true) : (_this.hidden = false); })), filter((/** * @param {?} inViewPort * @return {?} */ function (inViewPort) { return _this.overlay.open && inViewPort; }))); }; /** * @private * @param {?} target * @param {?} position * @return {?} */ FivPopover.prototype.openAtPosition = /** * @private * @param {?} target * @param {?} position * @return {?} */ function (target, position) { return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.scrollToPosition(target, position)]; case 1: _a.sent(); this._position = position; this.overlay.show(); return [2 /*return*/]; } }); }); }; /** * @private * @param {?} target * @param {?} position * @return {?} */ FivPopover.prototype.scrollToPosition = /** * @private * @param {?} target * @param {?} position * @return {?} */ function (target, position) { return tslib_1.__awaiter(this, void 0, void 0, function () { var isInViewport; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!(this.content && this.scrollToTarget)) return [3 /*break*/, 3]; return [4 /*yield*/, this.inViewport(target.getBoundingClientRect())]; case 1: isInViewport = _a.sent(); if (isInViewport) { return [2 /*return*/]; } return [4 /*yield*/, this.content.scrollToPoint(position.left, position.top, this.scrollSpeed)]; case 2: _a.sent(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * @param {?} position * @return {?} */ FivPopover.prototype.inViewport = /** * @param {?} position * @return {?} */ function (position) { return tslib_1.__awaiter(this, void 0, void 0, function () { var height, width; return tslib_1.__generator(this, function (_a) { height = this.platform.height(); width = this.platform.width(); return [2 /*return*/, (position.top <= height && position.bottom >= 0 && position.left < width && position.right > 0)]; }); }); }; /** * @private * @param {?} top * @param {?} left * @param {?} bottom * @param {?} right * @param {?} targetHeight * @param {?} targetWidth * @return {?} */ FivPopover.prototype.calculcatePositioning = /** * @private * @param {?} top * @param {?} left * @param {?} bottom * @param {?} right * @param {?} targetHeight * @param {?} targetWidth * @return {?} */ function (top, left, bottom, right, targetHeight, targetWidth) { // calculates the position of the popover without considering arrow and overlay offset /** @type {?} */ var width = this.platform.width(); /** @type {?} */ var height = this.platform.height(); /** @type {?} */ var _left = this.position === 'right' || (width / 2 > left && this.position !== 'left'); /** @type {?} */ var _right = this.position === 'left' || (width / 2 <= left && this.position !== 'right'); /** @type {?} */ var _top = this.position === 'below' || (height / 2 > top && this.position !== 'above'); /** @type {?} */ var _bottom = this.position === 'above' || (height / 2 <= top && this.position !== 'below'); // transform origin /** @type {?} */ var horizontal = 'left'; /** @type {?} */ var vertical = 'top'; if (_left && _top) { // top left horizontal = 'left'; vertical = 'top'; } else if (_right && _bottom) { // bottom right left = right - this.width; top = bottom - this.height; horizontal = 'right'; vertical = 'bottom'; } else if (_right && _top) { // top right left = right - this.width; horizontal = 'right'; vertical = 'top'; } else if (_left && _bottom) { // bottom left top = bottom - this.height; horizontal = 'left'; vertical = 'bottom'; } return { top: top, left: left, bottom: bottom, right: right, targetHeight: targetHeight, targetWidth: targetWidth, horizontal: horizontal, vertical: vertical }; }; /** * @private * @return {?} */ FivPopover.prototype.getArrowTop = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var isVert = ['auto', 'below', 'above'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); if (isVert) { return this._position.vertical === 'top' ? -1 * this.arrowHeight : this.height; } if (this.arrowPosition === 'center') { return this.height / 2 - this.arrowWidth / 2; } return this._position.vertical === 'top' ? this._position.targetHeight / 2 - this.arrowHeight / 2 : this.height - this.arrowHeight / 2 - this._position.targetHeight / 2; }; /** * @private * @return {?} */ FivPopover.prototype.getArrowLeft = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var isHorizontal = ['left', 'right'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); if (isHorizontal) { return this._position.horizontal === 'left' ? -1 * this.arrowHeight : this.width; } if (this.arrowPosition === 'center') { return this.width / 2 - this.arrowHeight / 2; } return this._position.horizontal === 'left' ? this._position.targetWidth / 2 - this.arrowWidth / 2 : this.width - this.arrowWidth / 2 - this._position.targetWidth / 2; }; /** * @private * @return {?} */ FivPopover.prototype.getContainerTop = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var isVert = ['auto', 'below', 'above'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); /** @type {?} */ var isTop = this._position.vertical === 'top'; /** @type {?} */ var offset = 0; if (this.arrow && isTop) { offset -= this.getVerticalArrowOffset(); } else if (this.arrow && !isTop) { offset += this.getVerticalArrowOffset(); } if (!isVert) { return this._position.top + offset; } if (!this.overlaysTarget && isTop) { offset += this._position.targetHeight; } else if (!this.overlaysTarget && !isTop) { offset -= this._position.targetHeight; } if (this.arrow && isTop) { offset += this.arrowHeight; } else if (this.arrow && !isTop) { offset -= this.arrowHeight; } return this._position.top + offset; }; /** * @private * @return {?} */ FivPopover.prototype.getVerticalArrowOffset = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var offset = 0; /** @type {?} */ var isHorizontal = ['left', 'right'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); if (this.arrowPosition === 'center' && isHorizontal) { offset += this.height / 2 - this._position.targetHeight / 2; } return offset; }; /** * @private * @return {?} */ FivPopover.prototype.getHorizontalArrowOffset = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var offset = 0; /** @type {?} */ var isVertical = ['above', 'auto', 'below'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); if (this.arrowPosition === 'center' && isVertical) { offset += this.width / 2 - this._position.targetWidth / 2; } return offset; }; /** * @private * @return {?} */ FivPopover.prototype.getContainerLeft = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var isHorizontal = ['left', 'right'].some((/** * @param {?} s * @return {?} */ function (s) { return s === _this.position; })); /** @type {?} */ var isLeft = this._position.horizontal === 'left'; /** @type {?} */ var offset = 0; if (this.arrow && isLeft) { offset -= this.getHorizontalArrowOffset(); } else if (this.arrow && !isLeft) { offset += this.getHorizontalArrowOffset(); } if (!isHorizontal) { return this._position.left + offset; } if (!this.overlaysTarget && isLeft) { offset += this._position.targetWidth; } else if (!this.overlaysTarget && !isLeft) { offset -= this._position.targetWidth; } if (this.arrow && isLeft) { offset += this.arrowHeight; } else if (this.arrow && !isLeft) { offset -= this.arrowHeight; } return this._position.left + offset; }; FivPopover.decorators = [ { type: Component, args: [{ selector: 'fiv-popover', template: "<fiv-overlay>\n <div *ngIf=\"backdrop && !hidden\" [ngClass]=\"classes\" class=\"fiv-popover-backdrop\" (click)=\"close()\">\n </div>\n <div *ngIf=\"!hidden\" [ngClass]=\"classes\" class=\"popover-container\" [style]=\"styles\">\n <div #animation *ngIf=\"overlay?.open\" class=\"animation-container\" anim [anim.in]=\"animationIn\">\n <ng-content>\n </ng-content>\n <svg *ngIf=\"arrow && !overlaysTarget\" class=\"arrow\" [style]=\"svgStyles\">\n <polygon [attr.points]=\"triangle\" />\n </svg>\n </div>\n\n </div>\n\n</fiv-overlay>", encapsulation: ViewEncapsulation.None, styles: [":host{--fiv-popover-backdrop-color:rgba(0, 0, 0, 0.2)}.popover-container{position:absolute;display:block}.animation-container{height:100%;position:relative}svg.arrow{position:absolute;fill:var(--ion-item-background)}.fiv-popover-backdrop{position:absolute;display:block;width:100vw;height:100vh;background:var(--fiv-popover-backdrop-color)}"] }] } ]; /** @nocollapse */ FivPopover.ctorParameters = function () { return [ { type: Platform }, { type: IonContent, decorators: [{ type: Host }, { type: Optional }] }, { type: DomSanitizer }, { type: Router } ]; }; FivPopover.propDecorators = { overlay: [{ type: ViewChild, args: [FivOverlay, { static: true },] }], animationContainer: [{ type: ViewChild, args: ['animation', { static: false },] }], width: [{ type: Input }], height: [{ type: Input }], arrow: [{ type: Input }], arrowWidth: [{ type: Input }], arrowHeight: [{ type: Input }], arrowPosition: [{ type: Input }], backdrop: [{ type: Input }], overlaysTarget: [{ type: Input }], closeOnNavigation: [{ type: Input }], scrollToTarget: [{ type: Input }], scrollSpeed: [{ type: Input }], position: [{ type: Input }], classes: [{ type: Input }], viewportOnly: [{ type: Input }], inDuration: [{ type: Input }], outDuration: [{ type: Input }], animationIn: [{ type: Input }], animationOut: [{ type: Input }] }; return FivPopover; }()); export { FivPopover }; if (false) { /** @type {?} */ FivPopover.prototype.overlay; /** @type {?} */ FivPopover.prototype.animationContainer; /** @type {?} */ FivPopover.prototype.width; /** @type {?} */ FivPopover.prototype.height; /** @type {?} */ FivPopover.prototype.arrow; /** @type {?} */ FivPopover.prototype.arrowWidth; /** @type {?} */ FivPopover.prototype.arrowHeight; /** @type {?} */ FivPopover.prototype.arrowPosition; /** @type {?} */ FivPopover.prototype.backdrop; /** @type {?} */ FivPopover.prototype.overlaysTarget; /** @type {?} */ FivPopover.prototype.closeOnNavigation; /** @type {?} */ FivPopover.prototype.scrollToTarget; /** @type {?} */ FivPopover.prototype.scrollSpeed; /** @type {?} */ FivPopover.prototype.position; /** @type {?} */ FivPopover.prototype.classes; /** @type {?} */ FivPopover.prototype.viewportOnly; /** @type {?} */ FivPopover.prototype._position; /** @type {?} */ FivPopover.prototype.hidden; /** @type {?} */ FivPopover.prototype.onDestroy$; /** @type {?} */ FivPopover.prototype.onClose$; /** @type {?} */ FivPopover.prototype.inDuration; /** @type {?} */ FivPopover.prototype.outDuration; /** @type {?} */ FivPopover.prototype.animationIn; /** @type {?} */ FivPopover.prototype.animationOut; /** * @type {?} * @private */ FivPopover.prototype.platform; /** * @type {?} * @private */ FivPopover.prototype.content; /** * @type {?} * @private */ FivPopover.prototype.dom; /** * @type {?} * @private */ FivPopover.prototype.router; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9wb3Zlci5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AZml2ZXRocmVlL2NvcmUvIiwic291cmNlcyI6WyJsaWIvcG9wb3Zlci9wb3BvdmVyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3ZELE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUN6RCxPQUFPLEVBQ0wsU0FBUyxFQUVULFNBQVMsRUFDVCxLQUFLLEVBQ0wsaUJBQWlCLEVBQ2pCLElBQUksRUFDSixRQUFRLEVBRVIsVUFBVSxFQUVYLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUMxRCxPQUFPLEVBQUUsUUFBUSxFQUFFLFVBQVUsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDdkQsT0FBTyxFQUNMLEdBQUcsRUFDSCxTQUFTLEVBQ1QsR0FBRyxFQUNILFlBQVksRUFDWixNQUFNLEVBQ04sT0FBTyxFQUNSLE1BQU0sZ0JBQWdCLENBQUM7QUFDeEIsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQVExRCxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFFdkQ7SUEyRkUsb0JBQ1UsUUFBa0IsRUFDRSxPQUFtQixFQUN2QyxHQUFpQixFQUNqQixNQUFjO1FBSnhCLGlCQUtJO1FBSk0sYUFBUSxHQUFSLFFBQVEsQ0FBVTtRQUNFLFlBQU8sR0FBUCxPQUFPLENBQVk7UUFDdkMsUUFBRyxHQUFILEdBQUcsQ0FBYztRQUNqQixXQUFNLEdBQU4sTUFBTSxDQUFRO1FBbkZmLFVBQUssR0FBRyxLQUFLLENBQUM7UUFDZCxlQUFVLEdBQUcsRUFBRSxDQUFDO1FBQ2hCLGdCQUFXLEdBQVcsSUFBSSxDQUFDLFVBQVUsR0FBRyxHQUFHLENBQUM7UUFDNUMsa0JBQWEsR0FBNEIsTUFBTSxDQUFDO1FBQ2hELGFBQVEsR0FBRyxJQUFJLENBQUM7UUFDaEIsbUJBQWMsR0FBRyxJQUFJLENBQUM7UUFDdEIsc0JBQWlCLEdBQUcsSUFBSSxDQUFDO1FBQ3pCLG1CQUFjLEdBQUcsS0FBSyxDQUFDO1FBQ3ZCLGdCQUFXLEdBQUcsR0FBRyxDQUFDO1FBQ2xCLGFBQVEsR0FBdUIsTUFBTSxDQUFDO1FBQ3RDLFlBQU8sR0FBYSxFQUFFLENBQUM7UUFDdkIsaUJBQVksR0FBRyxJQUFJLENBQUM7UUFHN0IsV0FBTSxHQUFHLEtBQUssQ0FBQztRQUNmLGVBQVUsR0FBRyxJQUFJLE9BQU8sRUFBRSxDQUFDO1FBQzNCLGFBQVEsR0FBRyxJQUFJLE9BQU8sRUFBRSxDQUFDO1FBRWhCLGVBQVUsR0FBRyxHQUFHLENBQUM7UUFDakIsZ0JBQVcsR0FBRyxFQUFFLENBQUM7UUFDakIsZ0JBQVc7Ozs7UUFBRyxVQUFDLE9BQW1CO1lBQ3pDLE9BQUEsTUFBTSxDQUFDLE9BQU8sRUFBRSxLQUFJLENBQUMsU0FBUyxFQUFFLEtBQUksQ0FBQyxVQUFVLENBQUM7UUFBaEQsQ0FBZ0QsRUFBQztRQUMxQyxpQkFBWTs7OztRQUFHLFVBQUMsT0FBbUI7WUFDMUMsT0FBQSxPQUFPLENBQUMsT0FBTyxFQUFFLEtBQUksQ0FBQyxXQUFXLENBQUM7UUFBbEMsQ0FBa0MsRUFBQztJQTZEbEMsQ0FBQztJQTNESixzQkFBSSw4QkFBTTs7OztRQUFWO1lBQ0UsSUFBSSxDQUFDLElBQUksQ0FBQyxTQUFTLEVBQUU7Z0JBQ25CLE9BQU87YUFDUjtZQUNELE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyx3QkFBd0IsQ0FDdEMsY0FBVyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxHQUFHLElBQUksQ0FBQyxDQUFDLENBQUMsTUFBTSw4QkFDdEMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFJLENBQUMsQ0FBQyxDQUFDLE1BQU0sMkJBQzNDLElBQUksQ0FBQyxnQkFBZ0IsRUFBRSwyQkFDeEIsSUFBSSxDQUFDLGVBQWUsRUFBRSxRQUFLLENBQ3JDLENBQUM7UUFDSixDQUFDOzs7T0FBQTtJQUVELHNCQUFJLGdDQUFROzs7O1FBQVo7WUFBQSxpQkFVQzs7Z0JBVE8sWUFBWSxHQUFHLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxDQUFDLElBQUk7Ozs7WUFBQyxVQUFBLENBQUMsSUFBSSxPQUFBLENBQUMsS0FBSyxLQUFJLENBQUMsUUFBUSxFQUFuQixDQUFtQixFQUFDO1lBQ3JFLElBQUksWUFBWSxFQUFFO2dCQUNoQixPQUFVLElBQUksQ0FBQyxXQUFXLGFBQVEsSUFBSSxDQUFDLFVBQVUsR0FBRyxDQUFDLFNBQ25ELElBQUksQ0FBQyxXQUFXLFNBQ2QsSUFBSSxDQUFDLFVBQVksQ0FBQzthQUN2QjtZQUNELE9BQU8sT0FBSyxJQUFJLENBQUMsV0FBVyxTQUFJLElBQUksQ0FBQyxVQUFVLEdBQUcsQ0FBQyxXQUFNLElBQUksQ0FBQyxVQUFVLFNBQ3RFLElBQUksQ0FBQyxXQUNMLENBQUM7UUFDTCxDQUFDOzs7T0FBQTtJQUVELHNCQUFJLGlDQUFTOzs7O1FBQWI7WUFBQSxpQkFlQztZQWRDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFO2dCQUNuQixPQUFPO2FBQ1I7O2dCQUNLLFlBQVksR0FBRyxDQUFDLE1BQU0sRUFBRSxPQUFPLENBQUMsQ0FBQyxJQUFJOzs7O1lBQUMsVUFBQSxDQUFDLElBQUksT0FBQSxDQUFDLEtBQUssS0FBSSxDQUFDLFFBQVEsRUFBbkIsQ0FBbUIsRUFBQzs7Z0JBQy9ELE1BQU0sR0FDVixDQUFDLElBQUksQ0FBQyxRQUFRLEtBQUssTUFBTSxJQUFJLElBQUksQ0FBQyxTQUFTLENBQUMsUUFBUSxLQUFLLFFBQVEsQ0FBQztnQkFDbEUsSUFBSSxDQUFDLFFBQVEsS0FBSyxNQUFNO1lBQzFCLE9BQU8sSUFBSSxDQUFDLEdBQUcsQ0FBQyx3QkFBd0IsQ0FDdEMsY0FBVyxZQUFZLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxXQUFXLDZCQUNuRCxZQUFZLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxVQUFVLDBCQUNuRCxJQUFJLENBQUMsV0FBVyxFQUFFLDBCQUNqQixJQUFJLENBQUMsWUFBWSxFQUFFLHVDQUNOLE1BQU0sQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQU8sQ0FDN0MsQ0FBQztRQUNKLENBQUM7OztPQUFBO0lBRUQsc0JBQUksdUNBQWU7Ozs7UUFBbkI7WUFDRSxJQUFJLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRTtnQkFDbkIsT0FBTzthQUNSO1lBQ0QsT0FBTyxJQUFJLENBQUMsR0FBRyxDQUFDLHdCQUF3QixDQUN0QyxhQUFXLElBQUksQ0FBQyxXQUFXLDJCQUNsQixJQUFJLENBQUMsVUFBVSx5QkFDakIsSUFBSSxDQUFDLFdBQVcsRUFBRSwwQkFDakIsSUFBSSxDQUFDLFlBQVksRUFBRSx1Q0FDTixJQUFJLENBQUMsU0FBUyxDQUFDLFFBQVEsS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxXQUFPLENBQzNFLENBQUM7UUFDSixDQUFDOzs7T0FBQTs7OztJQVNELDZCQUFROzs7SUFBUjtRQUFBLGlCQVNDO1FBUkMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxNQUFNO2FBQ2YsSUFBSSxDQUNILE1BQU07Ozs7UUFBa0IsVUFBQSxLQUFLLElBQUksT0FBQSxLQUFLLFlBQVksZUFBZSxFQUFoQyxDQUFnQyxFQUFDLEVBQ2xFLE1BQU07OztRQUFDLGNBQU0sT0FBQSxLQUFJLENBQUMsaUJBQWlCLElBQUksS0FBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQTNDLENBQTJDLEVBQUMsRUFDekQsR0FBRzs7O1FBQUMsY0FBTSxPQUFBLEtBQUksQ0FBQyxLQUFLLEVBQUUsRUFBWixDQUFZLEVBQUMsRUFDdkIsU0FBUyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsQ0FDM0I7YUFDQSxTQUFTLEVBQUUsQ0FBQztJQUNqQixDQUFDOzs7O0lBRUQsb0NBQWU7OztJQUFmLGNBQXlCLENBQUM7Ozs7SUFFMUIsZ0NBQVc7OztJQUFYO1FBQ0UsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUN6QixDQUFDOzs7O0lBRUQsMEJBQUs7OztJQUFMO1FBQUEsaUJBU0M7UUFSQyxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxrQkFBa0IsQ0FBQzthQUN2QyxJQUFJLENBQ0gsS0FBSzs7O1FBQUM7WUFDSixLQUFJLENBQUMsT0FBTyxDQUFDLElBQUksRUFBRSxDQUFDO1lBQ3BCLEtBQUksQ0FBQyxRQUFRLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDdkIsQ0FBQyxFQUFDLENBQ0g7YUFDQSxTQUFTLEVBQUUsQ0FBQztJQUNqQixDQUFDOzs7Ozs7SUFFTyx3Q0FBbUI7Ozs7O0lBQTNCLFVBQTRCLE1BQW1COztZQUN2QyxJQUFJLEdBQUcsTUFBTSxDQUFDLHFCQUFxQixFQUFFO1FBQzNDLE9BQU8sSUFBSSxDQUFDLHFCQUFxQixDQUMvQixJQUFJLENBQUMsR0FBRyxFQUNSLElBQUksQ0FBQyxJQUFJLEVBQ1QsSUFBSSxDQUFDLE1BQU0sRUFDWCxJQUFJLENBQUMsS0FBSyxFQUNWLElBQUksQ0FBQyxNQUFNLEVBQ1gsSUFBSSxDQUFDLEtBQUssQ0FDWCxDQUFDO0lBQ0osQ0FBQzs7Ozs7SUFFRCx5QkFBSTs7OztJQUFKLFVBQUssTUFBK0I7O1lBQzlCLE9BQU87UUFDWCxJQUFJLE1BQU0sWUFBWSxVQUFVLEVBQUU7WUFDaEMsT0FBTyxHQUFHLG1CQUFBLE1BQU0sQ0FBQyxNQUFNLEVBQWUsQ0FBQztTQUN4QzthQUFNLElBQUksTUFBTSxZQUFZLFVBQVUsRUFBRTtZQUN2QyxPQUFPLEdBQUcsbUJBQUEsTUFBTSxDQUFDLGFBQWEsRUFBZSxDQUFDO1NBQy9DO2FBQU07WUFDTCxPQUFPO1NBQ1I7UUFDRCxJQUFJLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQzNCLENBQUM7Ozs7O0lBRUQsK0JBQVU7Ozs7SUFBVixVQUFXLE1BQW1COztZQUN0QixRQUFRLEdBQUcsSUFBSSxDQUFDLG1CQUFtQixDQUFDLE1BQU0sQ0FBQztRQUNqRCxJQUFJLENBQUMsY0FBYyxDQUFDLE1BQU0sRUFBRSxRQUFRLENBQUMsQ0FBQztRQUN0QyxJQUFJLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ3pCLElBQUksQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDM0IsQ0FBQzs7Ozs7O0lBRU8sZ0NBQVc7Ozs7O0lBQW5CLFVBQW9CLE1BQW1CO1FBQXZDLGlCQWFDO1FBWkMsSUFBSSxDQUFDLElBQUksQ0FBQyxZQUFZLEVBQUU7WUFDdEIsT0FBTztTQUNSO1FBQ0QsU0FBUyxDQUFDLE1BQU0sRUFBRSxRQUFRLENBQUM7YUFDeEIsSUFBSSxDQUNILE9BQU87OztRQUFDLGNBQU0sT0FBQSxLQUFJLENBQUMsZ0JBQWdCLENBQUMsTUFBTSxDQUFDLEVBQTdCLENBQTZCLEVBQUMsRUFDNUMsWUFBWSxDQUFDLEVBQUUsQ0FBQyxFQUNoQixHQUFHOzs7UUFBQyxjQUFNLE9BQUEsS0FBSSxDQUFDLG1CQUFtQixDQUFDLE1BQU0sQ0FBQyxFQUFoQyxDQUFnQyxFQUFDLEVBQzNDLEdBQUc7Ozs7UUFBQyxVQUFBLEdBQUcsSUFBSSxPQUFBLENBQUMsS0FBSSxDQUFDLFNBQVMsR0FBRyxHQUFHLENBQUMsRUFBdEIsQ0FBc0IsRUFBQyxFQUNsQyxTQUFTLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUMzQjthQUNBLFNBQVMsRUFBRSxDQUFDO0lBQ2pCLENBQUM7Ozs7OztJQUVPLGdDQUFXOzs7OztJQUFuQixVQUFvQixNQUFtQjtRQUF2QyxpQkFtQkM7UUFsQkMsSUFBSSxDQUFDLElBQUksQ0FBQyxZQUFZLEVBQUU7WUFDdEIsT0FBTztTQUNSO1FBQ0QsSUFBSSxJQUFJLENBQUMsT0FBTyxJQUFJLENBQUMsSUFBSSxDQUFDLFFBQVEsRUFBRTtZQUNsQyxJQUFJLENBQUMsT0FBTyxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUM7WUFDakMsS0FBSyxDQUNILFNBQVMsQ0FBQyxNQUFNLEVBQUUsWUFBWSxDQUFDLEVBQy9CLFNBQVMsQ0FBQyxNQUFNLEVBQUUsV0FBVyxDQUFDLEVBQzlCLElBQUksQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUN2QjtpQkFDRSxJQUFJLENBQ0gsT0FBTzs7O1lBQUMsY0FBTSxPQUFBLEtBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxNQUFNLENBQUMsRUFBN0IsQ0FBNkIsRUFBQyxFQUM1QyxHQUFHOzs7WUFBQyxjQUFNLE9BQUEsS0FBSSxDQUFDLG1CQUFtQixDQUFDLE1BQU0sQ0FBQyxFQUFoQyxDQUFnQyxFQUFDLEVBQzNDLEdBQUc7Ozs7WUFBQyxVQUFBLEdBQUcsSUFBSSxPQUFBLENBQUMsS0FBSSxDQUFDLFNBQVMsR0FBRyxHQUFHLENBQUMsRUFBdEIsQ0FBc0IsRUFBQyxFQUNsQyxTQUFTLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxDQUMzQjtpQkFDQSxTQUFTLEVBQUUsQ0FBQztTQUNoQjtJQUNILENBQUM7Ozs7OztJQUVPLHFDQUFnQjs7Ozs7SUFBeEIsVUFBeUIsTUFBbUI7UUFBNUMsaUJBT0M7UUFOQyxPQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLE1BQU0sQ0FBQyxxQkFBcUIsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQy9ELEdBQUc7Ozs7UUFBQyxVQUFBLFVBQVU7WUFDWixPQUFBLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSSxDQUFDLE1BQU0sR0FBRyxLQUFLLENBQUM7UUFBMUQsQ0FBMEQsRUFDM0QsRUFDRCxNQUFNOzs7O1FBQUMsVUFBQSxVQUFVLElBQUksT0FBQSxLQUFJLENBQUMsT0FBTyxDQUFDLElBQUksSUFBSSxVQUFVLEVBQS9CLENBQStCLEVBQUMsQ0FDdEQsQ0FBQztJQUNKLENBQUM7Ozs7Ozs7SUFFYSxtQ0FBYzs7Ozs7O0lBQTVCLFVBQTZCLE1BQW1CLEVBQUUsUUFBeUI7Ozs7NEJBQ3pFLHFCQUFNLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsUUFBUSxDQUFDLEVBQUE7O3dCQUE3QyxTQUE2QyxDQUFDO3dCQUM5QyxJQUFJLENBQUMsU0FBUyxHQUFHLFFBQVEsQ0FBQzt3QkFDMUIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLEVBQUUsQ0FBQzs7Ozs7S0FDckI7Ozs7Ozs7SUFFYSxxQ0FBZ0I7Ozs7OztJQUE5QixVQUNFLE1BQW1CLEVBQ25CLFFBQXlCOzs7Ozs7NkJBRXJCLENBQUEsSUFBSSxDQUFDLE9BQU8sSUFBSSxJQUFJLENBQUMsY0FBYyxDQUFBLEVBQW5DLHdCQUFtQzt3QkFDaEIscUJBQU0sSUFBSSxDQUFDLFVBQVUsQ0FDeEMsTUFBTSxDQUFDLHFCQUFxQixFQUFFLENBQy9CLEVBQUE7O3dCQUZLLFlBQVksR0FBRyxTQUVwQjt3QkFDRCxJQUFJLFlBQVksRUFBRTs0QkFDaEIsc0JBQU87eUJBQ1I7d0JBQ0QscUJBQU0sSUFBSSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQzlCLFFBQVEsQ0FBQyxJQUFJLEVBQ2IsUUFBUSxDQUFDLEdBQUcsRUFDWixJQUFJLENBQUMsV0FBVyxDQUNqQixFQUFBOzt3QkFKRCxTQUlDLENBQUM7Ozs7OztLQUVMOzs7OztJQUNLLCtCQUFVOzs7O0lBQWhCLFVBQWlCLFFBQThCOzs7O2dCQUN2QyxNQUFNLEdBQUcsSUFBSSxDQUFDLFFBQVEsQ0FBQyxNQUFNLEVBQUU7Z0JBQy9CLEtBQUssR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLEtBQUssRUFBRTtnQkFFbkMsc0JBQU8sQ0FDTCxRQUFRLENBQUMsR0FBRyxJQUFJLE1BQU07d0JBQ3RCLFFBQVEsQ0FBQyxNQUFNLElBQUksQ0FBQzt3QkFDcEIsUUFBUSxDQUFDLElBQUksR0FBRyxLQUFLO3dCQUNyQixRQUFRLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FDbkIsRUFBQzs7O0tBQ0g7Ozs7Ozs7Ozs7O0lBRU8sMENBQXFCOzs7Ozs7Ozs7O0lBQTdCLFVBQ0UsR0FBVyxFQUNYLElBQVksRUFDWixNQUFjLEVBQ2QsS0FBYSxFQUNiLFlBQW9CLEVBQ3BCLFdBQW1COzs7WUFHYixLQUFLLEdBQUcsSUFBSSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUU7O1lBQzdCLE1BQU0sR0FBRyxJQUFJLENBQUMsUUFBUSxDQUFDLE1BQU0sRUFBRTs7WUFFL0IsS0FBSyxHQUNULElBQUksQ0FBQyxRQUFRLEtBQUssT0FBTztZQUN6QixDQUFDLEtBQUssR0FBRyxDQUFDLEdBQUcsSUFBSSxJQUFJLElBQUksQ0FBQyxRQUFRLEtBQUssTUFBTSxDQUFDOztZQUMxQyxNQUFNLEdBQ1YsSUFBSSxDQUFDLFFBQVEsS0FBSyxNQUFNO1lBQ3hCLENBQUMsS0FBSyxHQUFHLENBQUMsSUFBSSxJQUFJLElBQUksSUFBSSxDQUFDLFFBQVEsS0FBSyxPQUFPLENBQUM7O1lBQzVDLElBQUksR0FDUixJQUFJLENBQUMsUUFBUSxLQUFLLE9BQU87WUFDekIsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxHQUFHLEdBQUcsSUFBSSxJQUFJLENBQUMsUUFBUSxLQUFLLE9BQU8sQ0FBQzs7WUFDM0MsT0FBTyxHQUNYLElBQUksQ0FBQyxRQUFRLEtBQUssT0FBTztZQUN6QixDQUFDLE1BQU0sR0FBRyxDQUFDLElBQUksR0FBRyxJQUFJLElBQUksQ0FBQyxRQUFRLEtBQUssT0FBTyxDQUFDOzs7WUFHOUMsVUFBVSxHQUEyQixNQUFNOztZQUMzQyxRQUFRLEdBQXlCLEtBQUs7UUFFMUMsSUFBSSxLQUFLLElBQUksSUFBSSxFQUFFO1lBQ2pCLFdBQVc7WUFDWCxVQUFVLEdBQUcsTUFBTSxDQUFDO1lBQ3BCLFFBQVEsR0FBRyxLQUFLLENBQUM7U0FDbEI7YUFBTSxJQUFJLE1BQU0sSUFBSSxPQUFPLEVBQUU7WUFDNUIsZUFBZTtZQUNmLElBQUksR0FBRyxLQUFLLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQztZQUMxQixHQUFHLEdBQUcsTUFBTSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7WUFDM0IsVUFBVSxHQUFHLE9BQU8sQ0FBQztZQUNyQixRQUFRLEdBQUcsUUFBUSxDQUFDO1NBQ3JCO2FBQU0sSUFBSSxNQUFNLElBQUksSUFBSSxFQUFFO1lBQ3pCLFlBQVk7WUFDWixJQUFJLEdBQUcsS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUM7WUFDMUIsVUFBVSxHQUFHLE9BQU8sQ0FBQztZQUNyQixRQUFRLEdBQUcsS0FBSyxDQUFDO1NBQ2xCO2FBQU0sSUFBSSxLQUFLLElBQUksT0FBTyxFQUFFO1lBQzNCLGNBQWM7WUFDZCxHQUFHLEdBQUcsTUFBTSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7WUFDM0IsVUFBVSxHQUFHLE1BQU0sQ0FBQztZQUNwQixRQUFRLEdBQUcsUUFBUSxDQUFDO1NBQ3JCO1FBRUQsT0FBTztZQUNMLEdBQUcsS0FBQTtZQUNILElBQUksTUFBQTtZQUNKLE1BQU0sUUFBQTtZQUNOLEtBQUssT0FBQTtZQUNMLFlBQVksY0FBQTtZQUNaLFdBQVcsYUFBQTtZQUNYLFVBQVUsWUFBQTtZQUNWLFFBQVEsVUFBQTtTQUNULENBQUM7SUFDSixDQUFDOzs7OztJQUVPLGdDQUFXOzs7O0lBQW5CO1FBQUEsaUJBYUM7O1lBWk8sTUFBTSxHQUFHLENBQUMsTUFBTSxFQUFFLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQyxJQUFJOzs7O1FBQUMsVUFBQSxDQUFDLElBQUksT0FBQSxDQUFDLEtBQUssS0FBSSxDQUFDLFFBQVEsRUFBbkIsQ0FBbUIsRUFBQztRQUN4RSxJQUFJLE1BQU0sRUFBRTtZQUNWLE9BQU8sSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLEtBQUssS0FBSztnQkFDdEMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxHQUFHLElBQUksQ0FBQyxXQUFXO2dCQUN2QixDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sQ0FBQztTQUNqQjtRQUNELElBQUksSUFBSSxDQUFDLGFBQWEsS0FBSyxRQUFRLEVBQUU7WUFDbkMsT0FBTyxJQUFJLENBQUMsTUFBTSxHQUFHLENBQUMsR0FBRyxJQUFJLENBQUMsVUFBVSxHQUFHLENBQUMsQ0FBQztTQUM5QztRQUNELE9BQU8sSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLEtBQUssS0FBSztZQUN0QyxDQUFDLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxZQUFZLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxXQUFXLEdBQUcsQ0FBQztZQUN4RCxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFJLENBQUMsV0FBVyxHQUFHLENBQUMsR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLFlBQVksR0FBRyxDQUFDLENBQUM7SUFDM0UsQ0FBQzs7Ozs7SUFFTyxpQ0FBWTs7OztJQUFwQjtRQUFBLGlCQWFDOztZQVpPLFlBQVksR0FBRyxDQUFDLE1BQU0sRUFBRSxPQUFPLENBQUMsQ0FBQyxJQUFJOzs7O1FBQUMsVUFBQSxDQUFDLElBQUksT0FBQSxDQUFDLEtBQUssS0FBSSxDQUFDLFFBQVEsRUFBbkIsQ0FBbUIsRUFBQztRQUNyRSxJQUFJLFlBQVksRUFBRTtZQUNoQixPQUFPLElBQUksQ0FBQyxTQUFTLENBQUMsVUFBVSxLQUFLLE1BQU07Z0JBQ3pDLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxJQUFJLENBQUMsV0FBVztnQkFDdkIsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUM7U0FDaEI7UUFDRCxJQUFJLElBQUksQ0FBQyxhQUFhLEtBQUssUUFBUSxFQUFFO1lBQ25DLE9BQU8sSUFBSSxDQUFDLEtBQUssR0FBRyxDQUFDLEdBQUcsSUFBSSxDQUFDLFdBQVcsR0FBRyxDQUFDLENBQUM7U0FDOUM7UUFDRCxPQUFPLElBQUksQ0FBQyxTQUFTLENBQUMsVUFBVSxLQUFLLE1BQU07WUFDekMsQ0FBQyxDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsV0FBVyxHQUFHLENBQUMsR0FBRyxJQUFJLENBQUMsVUFBVSxHQUFHLENBQUM7WUFDdEQsQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLEdBQUcsSUFBSSxDQUFDLFVBQVUsR0FBRyxDQUFDLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFDO0lBQ3hFLENBQUM7Ozs7O0lBRU8sb0NBQWU7Ozs7SUFBdkI7UUFBQSxpQkF5QkM7O1lBeEJPLE1BQU0sR0FBRyxDQUFDLE1BQU0sRUFBRSxPQUFPLEVBQUUsT0FBTyxDQUFDLENBQUMsSUFBSTs7OztRQUFDLFVBQUEsQ0FBQyxJQUFJLE9BQUEsQ0FBQyxLQUFLLEtBQUksQ0FBQyxRQUFRLEVBQW5CLENBQW1CLEVBQUM7O1lBQ2xFLEtBQUssR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLFFBQVEsS0FBSyxLQUFLOztZQUUzQyxNQUFNLEdBQUcsQ0FBQztRQUNkLElBQUksSUFBSSxDQUFDLEtBQUssSUFBSSxLQUFLLEVBQUU7WUFDdkIsTUFBTSxJQUFJLElBQUksQ0FBQyxzQkFBc0IsRUFBRSxDQUFDO1NBQ3pDO2FBQU0sSUFBSSxJQUFJLENBQUMsS0FBSyxJQUFJLENBQUMsS0FBSyxFQUFFO1lBQy9CLE1BQU0sSUFBSSxJQUFJLENBQUMsc0JBQXNCLEVBQUUsQ0FBQztTQUN6QztRQUNELElBQUksQ0FBQyxNQUFNLEVBQUU7WUFDWCxPQUFPLElBQUksQ0FBQyxTQUFTLENBQUMsR0FBRyxHQUFHLE1BQU0sQ0FBQztTQUNwQztRQUNELElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxJQUFJLEtBQUssRUFBRTtZQUNqQyxNQUFNLElBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxZQUFZLENBQUM7U0FDdkM7YUFBTSxJQUFJLENBQUMsSUFBSSxDQUFDLGNBQWMsSUFBSSxDQUFDLEtBQUssRUFBRTtZQUN6QyxNQUFNLElBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxZQUFZLENBQUM7U0FDdkM7UUFFRCxJQUFJLElBQUksQ0FBQyxLQUFLLElBQUksS0FBSyxFQUFFO1lBQ3ZCLE1BQU0sSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDO1NBQzVCO2FBQU0sSUFBSSxJQUFJLENBQUMsS0FBSyxJQUFJLENBQUMsS0FBSyxFQUFFO1lBQy9CLE1BQU0sSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDO1NBQzVCO1FBQ0QsT0FBTyxJQUFJLENBQUMsU0FBUyxDQUFDLEdBQUcsR0FBRyxNQUFNLENBQUM7SUFDckMsQ0FBQzs7Ozs7SUFFTywyQ0FBc0I7Ozs7SUFBOUI7UUFBQSxpQkFPQzs7WUFOSyxNQUFNLEdBQUcsQ0FBQzs7WUFDUixZQUFZLEdBQUcsQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLENBQUMsSUFBSTs7OztRQUFDLFVBQUEsQ0FBQyxJQUFJLE9BQUEsQ0FBQyxLQUFLLEtBQUksQ0FBQyxRQUFRLEVBQW5CLENBQW1CLEVBQUM7UUFDckUsSUFBSSxJQUFJLENBQUMsYUFBYSxLQUFLLFFBQVEsSUFBSSxZQUFZLEVBQUU7WUFDbkQsTUFBTSxJQUFJLElBQUksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsWUFBWSxHQUFHLENBQUMsQ0FBQztTQUM3RDtRQUNELE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUM7Ozs7O0lBQ08sNkNBQXdCOzs7O0lBQWhDO1FBQUEsaUJBU0M7O1lBUkssTUFBTSxHQUFHLENBQUM7O1lBQ1IsVUFBVSxHQUFHLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxPQUFPLENBQUMsQ0FBQyxJQUFJOzs7O1FBQ2hELFVBQUEsQ0FBQyxJQUFJLE9BQUEsQ0FBQyxLQUFLLEtBQUksQ0FBQyxRQUFRLEVBQW5CLENBQW1CLEVBQ3pCO1FBQ0QsSUFBSSxJQUFJLENBQUMsYUFBYSxLQUFLLFFBQVEsSUFBSSxVQUFVLEVBQUU7WUFDakQsTUFBTSxJQUFJLElBQUksQ0FBQyxLQUFLLEdBQUcsQ0FBQyxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztTQUMzRDtRQUNELE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUM7Ozs7O0lBRU8scUNBQWdCOzs7O0lBQXhCO1FBQUEsaUJBMEJDOztZQXpCTyxZQUFZLEdBQUcsQ0FBQyxNQUFNLEVBQUUsT0FBTyxDQUFDLENBQUMsSUFBSTs7OztRQUFDLFVBQUEsQ0FBQyxJQUFJLE9BQUEsQ0FBQyxLQUFLLEtBQUksQ0FBQyxRQUFRLEVBQW5CLENBQW1CLEVBQUM7O1lBQy9ELE1BQU0sR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLFVBQVUsS0FBSyxNQUFNOztZQUUvQyxNQUFNLEdBQUcsQ0FBQztRQUNkLElBQUksSUFBSSxDQUFDLEtBQUssSUFBSSxNQUFNLEVBQUU7WUFDeEIsTUFBTSxJQUFJLElBQUksQ0FBQyx3QkFBd0IsRUFBRSxDQUFDO1NBQzNDO2FBQU0sSUFBSSxJQUFJLENBQUMsS0FBSyxJQUFJLENBQUMsTUFBTSxFQUFFO1lBQ2hDLE1BQU0sSUFBSSxJQUFJLENBQUMsd0JBQXdCLEVBQUUsQ0FBQztTQUMzQztRQUVELElBQUksQ0FBQyxZQUFZLEVBQUU7WUFDakIsT0FBTyxJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksR0FBRyxNQUFNLENBQUM7U0FDckM7UUFDRCxJQUFJLENBQUMsSUFBSSxDQUFDLGNBQWMsSUFBSSxNQUFNLEVBQUU7WUFDbEMsTUFBTSxJQUFJLElBQUksQ0FBQyxTQUFTLENBQUMsV0FBVyxDQUFDO1NBQ3RDO2FBQU0sSUFBSSxDQUFDLElBQUksQ0FBQyxjQUFjLElBQUksQ0FBQyxNQUFNLEVBQUU7WUFDMUMsTUFBTSxJQUFJLElBQUksQ0FBQyxTQUFTLENBQUMsV0FBVyxDQUFDO1NBQ3RDO1FBRUQsSUFBSSxJQUFJLENBQUMsS0FBSyxJQUFJLE1BQU0sRUFBRTtZQUN4QixNQUFNLElBQUksSUFBSSxDQUFDLFdBQVcsQ0FBQztTQUM1QjthQUFNLElBQUksSUFBSSxDQUFDLEtBQUssSUFBSSxDQUFDLE1BQU0sRUFBRTtZQUNoQyxNQUFNLElBQUksSUFBSSxDQUFDLFdBQVcsQ0FBQztTQUM1QjtRQUNELE9BQU8sSUFBSSxDQUFDLFNBQVMsQ0FBQyxJQUFJLEdBQUcsTUFBTSxDQUFDO0lBQ3RDLENBQUM7O2dCQW5aRixTQUFTLFNBQUM7b0JBQ1QsUUFBUSxFQUFFLGFBQWE7b0JBQ3ZCLHFrQkFBdUM7b0JBRXZDLGFBQWEsRUFBRSxpQkFBaUIsQ0FBQyxJQUFJOztpQkFDdEM7Ozs7Z0JBekJRLFFBQVE7Z0JBQUUsVUFBVSx1QkFpSHhCLElBQUksWUFBSSxRQUFRO2dCQS9IWixZQUFZO2dCQXdCSyxNQUFNOzs7MEJBaUI3QixTQUFTLFNBQUMsVUFBVSxFQUFFLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRTtxQ0FDdEMsU0FBUyxTQUFDLFdBQVcsRUFBRSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUU7d0JBRXhDLEtBQUs7eUJBQ0wsS0FBSzt3QkFDTCxLQUFLOzZCQUNMLEtBQUs7OEJBQ0wsS0FBSztnQ0FDTCxLQUFLOzJCQUNMLEtBQUs7aUNBQ0wsS0FBSztvQ0FDTCxLQUFLO2lDQUNMLEtBQUs7OEJBQ0wsS0FBSzsyQkFDTCxLQUFLOzBCQUNMLEtBQUs7K0JBQ0wsS0FBSzs2QkFPTCxLQUFLOzhCQUNMLEtBQUs7OEJBQ0wsS0FBSzsrQkFFTCxLQUFLOztJQWtYUixpQkFBQztDQUFBLEFBcFpELElBb1pDO1NBOVlZLFVBQVU7OztJQUNyQiw2QkFBNkQ7O0lBQzdELHdDQUEwRTs7SUFFMUUsMkJBQXVCOztJQUN2Qiw0QkFBd0I7O0lBQ3hCLDJCQUF1Qjs7SUFDdkIsZ0NBQXlCOztJQUN6QixpQ0FBcUQ7O0lBQ3JELG1DQUF5RDs7SUFDekQsOEJBQXlCOztJQUN6QixvQ0FBK0I7O0lBQy9CLHVDQUFrQzs7SUFDbEMsb0NBQWdDOztJQUNoQyxpQ0FBMkI7O0lBQzNCLDhCQUErQzs7SUFDL0MsNkJBQWdDOztJQUNoQyxrQ0FBNkI7O0lBRTdCLCtCQUEyQjs7SUFDM0IsNEJBQWU7O0lBQ2YsZ0NBQTJCOztJQUMzQiw4QkFBeUI7O0lBRXpCLGdDQUEwQjs7SUFDMUIsaUNBQTBCOztJQUMxQixpQ0FDbUQ7O0lBQ25ELGtDQUNxQzs7Ozs7SUF5RG5DLDhCQUEwQjs7Ozs7SUFDMUIsNkJBQStDOzs7OztJQUMvQyx5QkFBeUI7Ozs7O0lBQ3pCLDRCQUFzQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGFuaW1JbiwgYW5pbU91dCB9IGZyb20gJy4vcG9wb3Zlci5hbmltYXRpb25zJztcbmltcG9ydCB7IERvbVNhbml0aXplciB9IGZyb20gJ0Bhbmd1bGFyL3BsYXRmb3JtLWJyb3dzZXInO1xuaW1wb3J0IHtcbiAgQ29tcG9uZW50LFxuICBPbkluaXQsXG4gIFZpZXdDaGlsZCxcbiAgSW5wdXQsXG4gIFZpZXdFbmNhcHN1bGF0aW9uLFxuICBIb3N0LFxuICBPcHRpb25hbCxcbiAgQWZ0ZXJWaWV3SW5pdCxcbiAgRWxlbWVudFJlZixcbiAgT25EZXN0cm95XG59IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgRml2T3ZlcmxheSB9IGZyb20gJy4uL292ZXJsYXkvb3ZlcmxheS5jb21wb25lbnQnO1xuaW1wb3J0IHsgUGxhdGZvcm0sIElvbkNvbnRlbnQgfSBmcm9tICdAaW9uaWMvYW5ndWxhcic7XG5pbXBvcnQgeyBmcm9tRXZlbnQsIFN1YmplY3QsIG1lcmdlLCBmcm9tIH0gZnJvbSAncnhqcyc7XG5pbXBvcnQge1xuICB0YXAsXG4gIHRha2VVbnRpbCxcbiAgbWFwLFxuICB0aHJvdHRsZVRpbWUsXG4gIGZpbHRlcixcbiAgZmxhdE1hcFxufSBmcm9tICdyeGpzL29wZXJhdG9ycyc7XG5pbXBvcnQgeyBOYXZpZ2F0aW9uU3RhcnQsIFJvdXRlciB9IGZyb20gJ0Bhbmd1bGFyL3JvdXRlcic7XG5pbXBvcnQge1xuICBQb3BvdmVyUG9zaXRpb25pbmcsXG4gIFBvcG92ZXJQb3NpdGlvbixcbiAgUG9wb3Zlckhvcml6b250YWxBbGlnbixcbiAgUG9wb3ZlclZlcnRpY2FsQWxpZ24sXG4gIFBvcG92ZXJBcnJvd1Bvc2l0aW9uaW5nXG59IGZyb20gJy4vcG9wb3Zlci50eXBlcyc7XG5pbXBvcnQgeyBhZnRlciB9IGZyb20gJ0BmaXZldGhyZWUvbmd4LXJ4anMtYW5pbWF0aW9ucyc7XG5cbkBDb21wb25lbnQoe1xuICBzZWxlY3RvcjogJ2Zpdi1wb3BvdmVyJyxcbiAgdGVtcGxhdGVVcmw6ICcuL3BvcG92ZXIuY29tcG9uZW50Lmh0bWwnLFxuICBzdHlsZVVybHM6IFsnLi9wb3BvdmVyLmNvbXBvbmVudC5zY3NzJ10sXG4gIGVuY2Fwc3VsYXRpb246IFZpZXdFbmNhcHN1bGF0aW9uLk5vbmVcbn0pXG5leHBvcnQgY2xhc3MgRml2UG9wb3ZlciBpbXBsZW1lbnRzIE9uSW5pdCwgQWZ0ZXJWaWV3SW5pdCwgT25EZXN0cm95IHtcbiAgQFZpZXdDaGlsZChGaXZPdmVybGF5LCB7IHN0YXRpYzogdHJ1ZSB9KSBvdmVybGF5OiBGaXZPdmVybGF5O1xuICBAVmlld0NoaWxkKCdhbmltYXRpb24nLCB7IHN0YXRpYzogZmFsc2UgfSkgYW5pbWF0aW9uQ29udGFpbmVyOiBFbGVtZW50UmVmO1xuXG4gIEBJbnB1dCgpIHdpZHRoOiBudW1iZXI7XG4gIEBJbnB1dCgpIGhlaWdodDogbnVtYmVyO1xuICBASW5wdXQoKSBhcnJvdyA9IGZhbHNlO1xuICBASW5wdXQoKSBhcnJvd1dpZHRoID0gMjQ7XG4gIEBJbnB1dCgpIGFycm93SGVpZ2h0OiBudW1iZXIgPSB0aGlzLmFycm93V2lkdGggLyAxLjY7XG4gIEBJbnB1dCgpIGFycm93UG9zaXRpb246IFBvcG92ZXJBcnJvd1Bvc2l0aW9uaW5nID0gJ2F1dG8nO1xuICBASW5wdXQoKSBiYWNrZHJvcCA9IHRydWU7XG4gIEBJbnB1dCgpIG92ZXJsYXlzVGFyZ2V0ID0gdHJ1ZTtcbiAgQElucHV0KCkgY2xvc2VPbk5hdmlnYXRpb24gPSB0cnVlO1xuICBASW5wdXQoKSBzY3JvbGxUb1RhcmdldCA9IGZhbHNlO1xuICBASW5wdXQoKSBzY3JvbGxTcGVlZCA9IDEwMDtcbiAgQElucHV0KCkgcG9zaXRpb246IFBvcG92ZXJQb3NpdGlvbmluZyA9ICdhdXRvJztcbiAgQElucHV0KCkgY2xhc3Nlczogc3RyaW5nW10gPSBbXTtcbiAgQElucHV0KCkgdmlld3BvcnRPbmx5ID0gdHJ1ZTtcblxuICBfcG9zaXRpb246IFBvcG92ZXJQb3NpdGlvbjtcbiAgaGlkZGVuID0gZmFsc2U7XG4gIG9uRGVzdHJveSQgPSBuZXcgU3ViamVjdCgpO1xuICBvbkNsb3NlJCA9IG5ldyBTdWJqZWN0KCk7XG5cbiAgQElucHV0KCkgaW5EdXJhdGlvbiA9IDIwMDtcbiAgQElucHV0KCkgb3V0RHVyYXRpb24gPSA4MDtcbiAgQElucHV0KCkgYW5pbWF0aW9uSW4gPSAoZWxlbWVudDogRWxlbWVudFJlZikgPT5cbiAgICBhbmltSW4oZWxlbWVudCwgdGhpcy5fcG9zaXRpb24sIHRoaXMuaW5EdXJhdGlvbik7XG4gIEBJbnB1dCgpIGFuaW1hdGlvbk91dCA9IChlbGVtZW50OiBFbGVtZW50UmVmKSA9PlxuICAgIGFuaW1PdXQoZWxlbWVudCwgdGhpcy5vdXREdXJhdGlvbik7XG5cbiAgZ2V0IHN0eWxlcygpIHtcbiAgICBpZiAoIXRoaXMuX3Bvc2l0aW9uKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIHJldHVybiB0aGlzLmRvbS5ieXBhc3NTZWN1cml0eVRydXN0U3R5bGUoXG4gICAgICBgIHdpZHRoOiAke3RoaXMud2lkdGggPyB0aGlzLndpZHRoICsgJ3B4JyA6ICdhdXRvJ307IFxuICAgICAgICBoZWlnaHQ6ICR7dGhpcy5oZWlnaHQgPyB0aGlzLmhlaWdodCArICdweCcgOiAnYXV0byd9OyBcbiAgICAgICAgbGVmdDogJHt0aGlzLmdldENvbnRhaW5lckxlZnQoKX1weDsgXG4gICAgICAgIHRvcDogJHt0aGlzLmdldENvbnRhaW5lclRvcCgpfXB4O2BcbiAgICApO1xuICB9XG5cbiAgZ2V0IHRyaWFuZ2xlKCkge1xuICAgIGNvbnN0IGlzSG9yaXpvbnRhbCA9IFsnbGVmdCcsICdyaWdodCddLnNvbWUocyA9PiBzID09PSB0aGlzLnBvc2l0aW9uKTtcbiAgICBpZiAoaXNIb3Jpem9udGFsKSB7XG4gICAgICByZXR1cm4gYCR7dGhpcy5hcnJvd0hlaWdodH0sMCAwLCR7dGhpcy5hcnJvd1dpZHRoIC8gMn0gJHtcbiAgICAgICAgdGhpcy5hcnJvd0hlaWdodFxuICAgICAgfSwke3RoaXMuYXJyb3dXaWR0aH1gO1xuICAgIH1cbiAgICByZXR1cm4gYDAsJHt0aGlzLmFycm93SGVpZ2h0fSAke3RoaXMuYXJyb3dXaWR0aCAvIDJ9LDAgJHt0aGlzLmFycm93V2lkdGh9LCR7XG4gICAgICB0aGlzLmFycm93SGVpZ2h0XG4gICAgfWA7XG4gIH1cblxuICBnZXQgc3ZnU3R5bGVzKCkge1xuICAgIGlmICghdGhpcy5fcG9zaXRpb24pIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgY29uc3QgaXNIb3Jpem9udGFsID0gWydsZWZ0JywgJ3JpZ2h0J10uc29tZShzID0+IHMgPT09IHRoaXMucG9zaXRpb24pO1xuICAgIGNvbnN0IHJvdGF0ZSA9XG4gICAgICAodGhpcy5wb3NpdGlvbiA9PT0gJ2F1dG8nICYmIHRoaXMuX3Bvc2l0aW9uLnZlcnRpY2FsID09PSAnYm90dG9tJykgfHxcbiAgICAgIHRoaXMucG9zaXRpb24gPT09ICdsZWZ0JztcbiAgICByZXR1cm4gdGhpcy5kb20uYnlwYXNzU2VjdXJpdHlUcnVzdFN0eWxlKFxuICAgICAgYGhlaWdodDogJHtpc0hvcml6b250YWwgPyB0aGlzLmFycm93V2lkdGggOiB0aGlzLmFycm93SGVpZ2h0fXB4OyBcbiAgICAgIHdpZHRoOiAke2lzSG9yaXpvbnRhbCA/IHRoaXMuYXJyb3dIZWlnaHQgOiB0aGlzLmFycm93V2lkdGh9cHg7IFxuICAgICAgdG9wOiAke3RoaXMuZ2V0QXJyb3dUb3AoKX1weDsgXG4gICAgICBsZWZ0OiAke3RoaXMuZ2V0QXJyb3dMZWZ0KCl9cHg7XG4gICAgICB0cmFuc2Zvcm06IHJvdGF0ZVooJHtyb3RhdGUgPyAxODAgOiAwfWRlZyk7YFxuICAgICk7XG4gIH1cblxuICBnZXQgYW5pbWF0aW9uU3R5bGVzKCkge1xuICAgIGlmICghdGhpcy5fcG9zaXRpb24pIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgcmV0dXJuIHRoaXMuZG9tLmJ5cGFzc1NlY3VyaXR5VHJ1c3RTdHlsZShcbiAgICAgIGBoZWlnaHQ6ICR7dGhpcy5hcnJvd0hlaWdodH1weDsgXG4gICAgICB3aWR0aDogJHt0aGlzLmFycm93V2lkdGh9cHg7IFxuICAgICAgdG9wOiAke3RoaXMuZ2V0QXJyb3dUb3AoKX1weDsgXG4gICAgICBsZWZ0OiAke3RoaXMuZ2V0QXJyb3dMZWZ0KCl9cHg7XG4gICAgICB0cmFuc2Zvcm06IHJvdGF0ZVooJHt0aGlzLl9wb3NpdGlvbi52ZXJ0aWNhbCA9PT0gJ2JvdHRvbScgPyAxODAgOiAwfWRlZyk7YFxuICAgICk7XG4gIH1cblxuICBjb25zdHJ1Y3RvcihcbiAgICBwcml2YXRlIHBsYXRmb3JtOiBQbGF0Zm9ybSxcbiAgICBASG9zdCgpIEBPcHRpb25hbCgpIHByaXZhdGUgY29udGVudDogSW9uQ29udGVudCxcbiAgICBwcml2YXRlIGRvbTogRG9tU2FuaXRpemVyLFxuICAgIHByaXZhdGUgcm91dGVyOiBSb3V0ZXJcbiAgKSB7fVxuXG4gIG5nT25Jbml0KCkge1xuICAgIHRoaXMucm91dGVyLmV2ZW50c1xuICAgICAgLnBpcGUoXG4gICAgICAgIGZpbHRlcjxOYXZpZ2F0aW9uU3RhcnQ+KGV2ZW50ID0+IGV2ZW50IGluc3RhbmNlb2YgTmF2aWdhdGlvblN0YXJ0KSxcbiAgICAgICAgZmlsdGVyKCgpID0+IHRoaXMuY2xvc2VPbk5hdmlnYXRpb24gJiYgdGhpcy5vdmVybGF5Lm9wZW4pLFxuICAgICAgICB0YXAoKCkgPT4gdGhpcy5jbG9zZSgpKSxcbiAgICAgICAgdGFrZVVudGlsKHRoaXMub25EZXN0cm95JClcbiAgICAgIClcbiAgICAgIC5zdWJzY3JpYmUoKTtcbiAgfVxuXG4gIG5nQWZ0ZXJWaWV3SW5pdCgpOiB2b2lkIHt9XG5cbiAgbmdPbkRlc3Ryb3koKSB7XG4gICAgdGhpcy5vbkRlc3Ryb3kkLm5leHQoKTtcbiAgfVxuXG4gIGNsb3NlKCkge1xuICAgIHRoaXMuYW5pbWF0aW9uT3V0KHRoaXMuYW5pbWF0aW9uQ29udGFpbmVyKVxuICAgICAgLnBpcGUoXG4gICAgICAgIGFmdGVyKCgpID0+IHtcbiAgICAgICAgICB0aGlzLm92ZXJsYXkuaGlkZSgpO1xuICAgICAgICAgIHRoaXMub25DbG9zZSQubmV4dCgpO1xuICAgICAgICB9KVxuICAgICAgKVxuICAgICAgLnN1YnNjcmliZSgpO1xuICB9XG5cbiAgcHJpdmF0ZSBnZXRQb3NpdGlvbk9mVGFyZ2V0KHRhcmdldDogSFRNTEVsZW1lbnQpIHtcbiAgICBjb25zdCByZWN0ID0gdGFyZ2V0LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpO1xuICAgIHJldHVybiB0aGlzLmNhbGN1bGNhdGVQb3NpdGlvbmluZyhcbiAgICAgIHJlY3QudG9wLFxuICAgICAgcmVjdC5sZWZ0LFxuICAgICAgcmVjdC5ib3R0b20sXG4gICAgICByZWN0LnJpZ2h0LFxuICAgICAgcmVjdC5oZWlnaHQsXG4gICAgICByZWN0LndpZHRoXG4gICAgKTtcbiAgfVxuXG4gIG9wZW4odGFyZ2V0OiBNb3VzZUV2ZW50IHwgRWxlbWVudFJlZikge1xuICAgIGxldCBlbGVtZW50O1xuICAgIGlmICh0YXJnZXQgaW5zdGFuY2VvZiBNb3VzZUV2ZW50KSB7XG4gICAgICBlbGVtZW50ID0gdGFyZ2V0LnRhcmdldCBhcyBIVE1MRWxlbWVudDtcbiAgICB9IGVsc2UgaWYgKHRhcmdldCBpbnN0YW5jZW9mIEVsZW1lbnRSZWYpIHtcbiAgICAgIGVsZW1lbnQgPSB0YXJnZXQubmF0aXZlRWxlbWVudCBhcyBIVE1MRWxlbWVudDtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuO1xuICAgIH1cbiAgICB0aGlzLm9wZW5UYXJnZXQoZWxlbWVudCk7XG4gIH1cblxuICBvcGVuVGFyZ2V0KHRhcmdldDogSFRNTEVsZW1lbnQpIHtcbiAgICBjb25zdCBwb3NpdGlvbiA9IHRoaXMuZ2V0UG9zaXRpb25PZlRhcmdldCh0YXJnZXQpO1xuICAgIHRoaXMub3BlbkF0UG9zaXRpb24odGFyZ2V0LCBwb3NpdGlvbik7XG4gICAgdGhpcy53YXRjaFJlc2l6ZSh0YXJnZXQpO1xuICAgIHRoaXMud2F0Y2hTY3JvbGwodGFyZ2V0KTtcbiAgfVxuXG4gIHByaXZhdGUgd2F0Y2hSZXNpemUodGFyZ2V0OiBIVE1MRWxlbWVudCkge1xuICAgIGlmICghdGhpcy52aWV3cG9ydE9ubHkpIHtcbiAgICAgIHJldHVybjtcbiAgICB9XG4gICAgZnJvbUV2ZW50KHdpbmRvdywgJ3Jlc2l6ZScpXG4gICAgICAucGlwZShcbiAgICAgICAgZmxhdE1hcCgoKSA9PiB0aGlzLmZpbHRlckluVmlld3BvcnQodGFyZ2V0KSksXG4gICAgICAgIHRocm90dGxlVGltZSg1MCksXG4gICAgICAgIG1hcCgoKSA9PiB0aGlzLmdldFBvc2l0aW9uT2ZUYXJnZXQodGFyZ2V0KSksXG4gICAgICAgIHRhcChwb3MgPT4gKHRoaXMuX3Bvc2l0aW9uID0gcG9zKSksXG4gICAgICAgIHRha2VVbnRpbCh0aGlzLm9uRGVzdHJveSQpXG4gICAgICApXG4gICAgICAuc3Vic2NyaWJlKCk7XG4gIH1cblxuICBwcml2YXRlIHdhdGNoU2Nyb2xsKHRhcmdldDogSFRNTEVsZW1lbnQpIHtcbiAgICBpZiAoIXRoaXMudmlld3BvcnRPbmx5KSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGlmICh0aGlzLmNvbnRlbnQgJiYgIXRoaXMuYmFja2Ryb3ApIHtcbiAgICAgIHRoaXMuY29udGVudC5zY3JvbGxFdmVudHMgPSB0cnVlO1xuICAgICAgbWVyZ2UoXG4gICAgICAgIGZyb21FdmVudCh3aW5kb3csICdtb3VzZXdoZWVsJyksXG4gICAgICAgIGZyb21FdmVudCh3aW5kb3csICd0b3VjaG1vdmUnKSxcbiAgICAgICAgdGhpcy5jb250ZW50LmlvblNjcm9sbFxuICAgICAgKVxuICAgICAgICAucGlwZShcbiAgICAgICAgICBmbGF0TWFwKCgpID0+IHRoaXMuZmlsdGVySW5WaWV3cG9ydCh0YXJnZXQpKSxcbiAgICAgICAgICBtYXAoKCkgPT4gdGhpcy5nZXRQb3NpdGlvbk9mVGFyZ2V0KHRhcmdldCkpLFxuICAgICAgICAgIHRhcChwb3MgPT4gKHRoaXMuX3Bvc2l0aW9uID0gcG9zKSksXG4gICAgICAgICAgdGFrZVVudGlsKHRoaXMub25EZXN0cm95JClcbiAgICAgICAgKVxuICAgICAgICAuc3Vic2NyaWJlKCk7XG4gICAgfVxuICB9XG5cbiAgcHJpdmF0ZSBmaWx0ZXJJblZpZXdwb3J0KHRhcmdldDogSFRNTEVsZW1lbnQpIHtcbiAgICByZXR1cm4gZnJvbSh0aGlzLmluVmlld3BvcnQodGFyZ2V0LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpKSkucGlwZShcbiAgICAgIHRhcChpblZpZXdwb3J0ID0+XG4gICAgICAgICFpblZpZXdwb3J0ID8gKHRoaXMuaGlkZGVuID0gdHJ1ZSkgOiAodGhpcy5oaWRkZW4gPSBmYWxzZSlcbiAgICAgICksXG4gICAgICBmaWx0ZXIoaW5WaWV3UG9ydCA9PiB0aGlzLm92ZXJsYXkub3BlbiAmJiBpblZpZXdQb3J0KVxuICAgICk7XG4gIH1cblxuICBwcml2YXRlIGFzeW5jIG9wZW5BdFBvc2l0aW9uKHRhcmdldDogSFRNTEVsZW1lbnQsIHBvc2l0aW9uOiBQb3BvdmVyUG9zaXRpb24pIHtcbiAgICBhd2FpdCB0aGlzLnNjcm9sbFRvUG9zaXRpb24odGFyZ2V0LCBwb3NpdGlvbik7XG4gICAgdGhpcy5fcG9zaXRpb24gPSBwb3NpdGlvbjtcbiAgICB0aGlzLm92ZXJsYXkuc2hvdygpO1xuICB9XG5cbiAgcHJpdmF0ZSBhc3luYyBzY3JvbGxUb1Bvc2l0aW9uKFxuICAgIHRhcmdldDogSFRNTEVsZW1lbnQsXG4gICAgcG9zaXRpb246IFBvcG92ZXJQb3NpdGlvblxuICApIHtcbiAgICBpZiAodGhpcy5jb250ZW50ICYmIHRoaXMuc2Nyb2xsVG9UYXJnZXQpIHtcbiAgICAgIGNvbnN0IGlzSW5WaWV3cG9ydCA9IGF3YWl0IHRoaXMuaW5WaWV3cG9ydChcbiAgICAgICAgdGFyZ2V0LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpXG4gICAgICApO1xuICAgICAgaWYgKGlzSW5WaWV3cG9ydCkge1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgICBhd2FpdCB0aGlzLmNvbnRlbnQuc2Nyb2xsVG9Qb2ludChcbiAgICAgICAgcG9zaXRpb24ubGVmdCxcbiAgICAgICAgcG9zaXRpb24udG9wLFxuICAgICAgICB0aGlzLnNjcm9sbFNwZWVkXG4gICAgICApO1xuICAgIH1cbiAgfVxuICBhc3luYyBpblZpZXdwb3J0KHBvc2l0aW9uOiBET01SZWN0IHwgQ2xpZW50UmVjdCkge1xuICAgIGNvbnN0IGhlaWdodCA9IHRoaXMucGxhdGZvcm0uaGVpZ2h0KCk7XG4gICAgY29uc3Qgd2lkdGggPSB0aGlzLnBsYXRmb3JtLndpZHRoKCk7XG5cbiAgICByZXR1cm4gKFxuICAgICAgcG9zaXRpb24udG9wIDw9IGhlaWdodCAmJlxuICAgICAgcG9zaXRpb24uYm90dG9tID49IDAgJiZcbiAgICAgIHBvc2l0aW9uLmxlZnQgPCB3aWR0aCAmJlxuICAgICAgcG9zaXRpb24ucmlnaHQgPiAwXG4gICAgKTtcbiAgfVxuXG4gIHByaXZhdGUgY2FsY3VsY2F0ZVBvc2l0aW9uaW5nKFxuICAgIHRvcDogbnVtYmVyLFxuICAgIGxlZnQ6IG51bWJlcixcbiAgICBib3R0b206IG51bWJlcixcbiAgICByaWdodDogbnVtYmVyLFxuICAgIHRhcmdldEhlaWdodDogbnVtYmVyLFxuICAgIHRhcmdldFdpZHRoOiBudW1iZXJcbiAgKTogUG9wb3ZlclBvc2l0aW9uIHtcbiAgICAvLyBjYWxjdWxhdGVzIHRoZSBwb3NpdGlvbiBvZiB0aGUgcG9wb3ZlciB3aXRob3V0IGNvbnNpZGVyaW5nIGFycm93IGFuZCBvdmVybGF5IG9mZnNldFxuICAgIGNvbnN0IHdpZHRoID0gdGhpcy5wbGF0Zm9ybS53aWR0aCgpO1xuICAgIGNvbnN0IGhlaWdodCA9IHRoaXMucGxhdGZvcm0uaGVpZ2h0KCk7XG5cbiAgICBjb25zdCBfbGVmdCA9XG4gICAgICB0aGlzLnBvc2l0aW9uID09PSAncmlnaHQnIHx8XG4gICAgICAod2lkdGggLyAyID4gbGVmdCAmJiB0aGlzLnBvc2l0aW9uICE9PSAnbGVmdCcpO1xuICAgIGNvbnN0IF9yaWdodCA9XG4gICAgICB0aGlzLnBvc2l0aW9uID09PSAnbGVmdCcgfHxcbiAgICAgICh3aWR0aCAvIDIgPD0gbGVmdCAmJiB0aGlzLnBvc2l0aW9uICE9PSAncmlnaHQnKTtcbiAgICBjb25zdCBfdG9wID1cbiAgICAgIHRoaXMucG9zaXRpb24gPT09ICdiZWxvdycgfHxcbiAgICAgIChoZWlnaHQgLyAyID4gdG9wICYmIHRoaXMucG9zaXRpb24gIT09ICdhYm92ZScpO1xuICAgIGNvbnN0IF9ib3R0b20gPVxuICAgICAgdGhpcy5wb3NpdGlvbiA9PT0gJ2Fib3ZlJyB8fFxuICAgICAgKGhlaWdodCAvIDIgPD0gdG9wICYmIHRoaXMucG9zaXRpb24gIT09ICdiZWxvdycpO1xuXG4gICAgLy8gdHJhbnNmb3JtIG9yaWdpblxuICAgIGxldCBob3Jpem9udGFsOiBQb3BvdmVySG9yaXpvbnRhbEFsaWduID0gJ2xlZnQnO1xuICAgIGxldCB2ZXJ0aWNhbDogUG9wb3ZlclZlcnRpY2FsQWxpZ24gPSAndG9wJztcblxuICAgIGlmIChfbGVmdCAmJiBfdG9wKSB7XG4gICAgICAvLyB0b3AgbGVmdFxuICAgICAgaG9yaXpvbnRhbCA9ICdsZWZ0JztcbiAgICAgIHZlcnRpY2FsID0gJ3RvcCc7XG4gICAgfSBlbHNlIGlmIChfcmlnaHQgJiYgX2JvdHRvbSkge1xuICAgICAgLy8gYm90dG9tIHJpZ2h0XG4gICAgICBsZWZ0ID0gcmlnaHQgLSB0aGlzLndpZHRoO1xuICAgICAgdG9wID0gYm90dG9tIC0gdGhpcy5oZWlnaHQ7XG4gICAgICBob3Jpem9udGFsID0gJ3JpZ2h0JztcbiAgICAgIHZlcnRpY2FsID0gJ2JvdHRvbSc7XG4gICAgfSBlbHNlIGlmIChfcmlnaHQgJiYgX3RvcCkge1xuICAgICAgLy8gdG9wIHJpZ2h0XG4gICAgICBsZWZ0ID0gcmlnaHQgLSB0aGlzLndpZHRoO1xuICAgICAgaG9yaXpvbnRhbCA9ICdyaWdodCc7XG4gICAgICB2ZXJ0aWNhbCA9ICd0b3AnO1xuICAgIH0gZWxzZSBpZiAoX2xlZnQgJiYgX2JvdHRvbSkge1xuICAgICAgLy8gYm90dG9tIGxlZnRcbiAgICAgIHRvcCA9IGJvdHRvbSAtIHRoaXMuaGVpZ2h0O1xuICAgICAgaG9yaXpvbnRhbCA9ICdsZWZ0JztcbiAgICAgIHZlcnRpY2FsID0gJ2JvdHRvbSc7XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgIHRvcCxcbiAgICAgIGxlZnQsXG4gICAgICBib3R0b20sXG4gICAgICByaWdodCxcbiAgICAgIHRhcmdldEhlaWdodCxcbiAgICAgIHRhcmdldFdpZHRoLFxuICAgICAgaG9yaXpvbnRhbCxcbiAgICAgIHZlcnRpY2FsXG4gICAgfTtcbiAgfVxuXG4gIHByaXZhdGUgZ2V0QXJyb3dUb3AoKSB7XG4gICAgY29uc3QgaXNWZXJ0ID0gWydhdXRvJywgJ2JlbG93JywgJ2Fib3ZlJ10uc29tZShzID0+IHMgPT09IHRoaXMucG9zaXRpb24pO1xuICAgIGlmIChpc1ZlcnQpIHtcbiAgICAgIHJldHVybiB0aGlzLl9wb3NpdGlvbi52ZXJ0aWNhbCA9PT0gJ3RvcCdcbiAgICAgICAgPyAtMSAqIHRoaXMuYXJyb3dIZWlnaHRcbiAgICAgICAgOiB0aGlzLmhlaWdodDtcbiAgICB9XG4gICAgaWYgKHRoaXMuYXJyb3dQb3NpdGlvbiA9PT0gJ2NlbnRlcicpIHtcbiAgICAgIHJldHVybiB0aGlzLmhlaWdodCAvIDIgLSB0aGlzLmFycm93V2lkdGggLyAyO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5fcG9zaXRpb24udmVydGljYWwgPT09ICd0b3AnXG4gICAgICA/IHRoaXMuX3Bvc2l0aW9uLnRhcmdldEhlaWdodCAvIDIgLSB0aGlzLmFycm93SGVpZ2h0IC8gMlxuICAgICAgOiB0aGlzLmhlaWdodCAtIHRoaXMuYXJyb3dIZWlnaHQgLyAyIC0gdGhpcy5fcG9zaXRpb24udGFyZ2V0SGVpZ2h0IC8gMjtcbiAgfVxuXG4gIHByaXZhdGUgZ2V0QXJyb3dMZWZ0KCkge1xuICAgIGNvbnN0IGlzSG9yaXpvbnRhbCA9IFsnbGVmdCcsICdyaWdodCddLnNvbWUocyA9PiBzID09PSB0aGlzLnBvc2l0aW9uKTtcbiAgICBpZiAoaXNIb3Jpem9udGFsKSB7XG4gICAgICByZXR1cm4gdGhpcy5fcG9zaXRpb24uaG9yaXpvbnRhbCA9PT0gJ2xlZnQnXG4gICAgICAgID8gLTEgKiB0aGlzLmFycm93SGVpZ2h0XG4gICAgICAgIDogdGhpcy53aWR0aDtcbiAgICB9XG4gICAgaWYgKHRoaXMuYXJyb3dQb3NpdGlvbiA9PT0gJ2NlbnRlcicpIHtcbiAgICAgIHJldHVybiB0aGlzLndpZHRoIC8gMiAtIHRoaXMuYXJyb3dIZWlnaHQgLyAyO1xuICAgIH1cbiAgICByZXR1cm4gdGhpcy5fcG9zaXRpb24uaG9yaXpvbnRhbCA9PT0gJ2xlZnQnXG4gICAgICA/IHRoaXMuX3Bvc2l0aW9uLnRhcmdldFdpZHRoIC8gMiAtIHRoaXMuYXJyb3dXaWR0aCAvIDJcbiAgICAgIDogdGhpcy53aWR0aCAtIHRoaXMuYXJyb3dXaWR0aCAvIDIgLSB0aGlzLl9wb3NpdGlvbi50YXJnZXRXaWR0aCAvIDI7XG4gIH1cblxuICBwcml2YXRlIGdldENvbnRhaW5lclRvcCgpIHtcbiAgICBjb25zdCBpc1ZlcnQgPSBbJ2F1dG8nLCAnYmVsb3cnLCAnYWJvdmUnXS5zb21lKHMgPT4gcyA9PT0gdGhpcy5wb3NpdGlvbik7XG4gICAgY29uc3QgaXNUb3AgPSB0aGlzLl9wb3NpdGlvbi52ZXJ0aWNhbCA9PT0gJ3RvcCc7XG5cbiAgICBsZXQgb2Zmc2V0ID0gMDtcbiAgICBpZiAodGhpcy5hcnJvdyAmJiBpc1RvcCkge1xuICAgICAgb2Zmc2V0IC09IHRoaXMuZ2V0VmVydGljYWxBcnJvd09mZnNldCgpO1xuICAgIH0gZWxzZSBpZiAodGhpcy5hcnJvdyAmJiAhaXNUb3ApIHtcbiAgICAgIG9mZnNldCArPSB0aGlzLmdldFZlcnRpY2FsQXJyb3dPZmZzZXQoKTtcbiAgICB9XG4gICAgaWYgKCFpc1ZlcnQpIHtcbiAgICAgIHJldHVybiB0aGlzLl9wb3NpdGlvbi50b3AgKyBvZmZzZXQ7XG4gICAgfVxuICAgIGlmICghdGhpcy5vdmVybGF5c1RhcmdldCAmJiBpc1RvcCkge1xuICAgICAgb2Zmc2V0ICs9IHRoaXMuX3Bvc2l0aW9uLnRhcmdldEhlaWdodDtcbiAgICB9IGVsc2UgaWYgKCF0aGlzLm92ZXJsYXlzVGFyZ2V0ICYmICFpc1RvcCkge1xuICAgICAgb2Zmc2V0IC09IHRoaXMuX3Bvc2l0aW9uLnRhcmdldEhlaWdodDtcbiAgICB9XG5cbiAgICBpZiAodGhpcy5hcnJvdyAmJiBpc1RvcCkge1xuICAgICAgb2Zmc2V0ICs9IHRoaXMuYXJyb3dIZWlnaHQ7XG4gICAgfSBlbHNlIGlmICh0aGlzLmFycm93ICYmICFpc1RvcCkge1xuICAgICAgb2Zmc2V0IC09IHRoaXMuYXJyb3dIZWlnaHQ7XG4gICAgfVxuICAgIHJldHVybiB0aGlzLl9wb3NpdGlvbi50b3AgKyBvZmZzZXQ7XG4gIH1cblxuICBwcml2YXRlIGdldFZlcnRpY2FsQXJyb3dPZmZzZXQoKSB7XG4gICAgbGV0IG9mZnNldCA9IDA7XG4gICAgY29uc3QgaXNIb3Jpem9udGFsID0gWydsZWZ0JywgJ3JpZ2h0J10uc29tZShzID0+IHMgPT09IHRoaXMucG9zaXRpb24pO1xuICAgIGlmICh0aGlzLmFycm93UG9zaXRpb24gPT09ICdjZW50ZXInICYmIGlzSG9yaXpvbnRhbCkge1xuICAgICAgb2Zmc2V0ICs9IHRoaXMuaGVpZ2h0IC8gMiAtIHRoaXMuX3Bvc2l0aW9uLnRhcmdldEhlaWdodCAvIDI7XG4gICAgfVxuICAgIHJldHVybiBvZmZzZXQ7XG4gIH1cbiAgcHJpdmF0ZSBnZXRIb3Jpem9udGFsQXJyb3dPZmZzZXQoKSB7XG4gICAgbGV0IG9mZnNldCA9IDA7XG4gICAgY29uc3QgaXNWZXJ0aWNhbCA9IFsnYWJvdmUnLCAnYXV0bycsICdiZWxvdyddLnNvbWUoXG4gICAgICBzID0+IHMgPT09IHRoaXMucG9zaXRpb25cbiAgICApO1xuICAgIGlmICh0aGlzLmFycm93UG9zaXRpb24gPT09ICdjZW50ZXInICYmIGlzVmVydGljYWwpIHtcbiAgICAgIG9mZnNldCArPSB0aGlzLndpZHRoIC8gMiAtIHRoaXMuX3Bvc2l0aW9uLnRhcmdldFdpZHRoIC8gMjtcbiAgICB9XG4gICAgcmV0dXJuIG9mZnNldDtcbiAgfVxuXG4gIHByaXZhdGUgZ2V0Q29udGFpbmVyTGVmdCgpIHtcbiAgICBjb25zdCBpc0hvcml6b250YWwgPSBbJ2xlZnQnLCAncmlnaHQnXS5zb21lKHMgPT4gcyA9PT0gdGhpcy5wb3NpdGlvbik7XG4gICAgY29uc3QgaXNMZWZ0ID0gdGhpcy5fcG9zaXRpb24uaG9yaXpvbnRhbCA9PT0gJ2xlZnQnO1xuXG4gICAgbGV0IG9mZnNldCA9IDA7XG4gICAgaWYgKHRoaXMuYXJyb3cgJiYgaXNMZWZ0KSB7XG4gICAgICBvZmZzZXQgLT0gdGhpcy5nZXRIb3Jpem9udGFsQXJyb3dPZmZzZXQoKTtcbiAgICB9IGVsc2UgaWYgKHRoaXMuYXJyb3cgJiYgIWlzTGVmdCkge1xuICAgICAgb2Zmc2V0ICs9IHRoaXMuZ2V0SG9yaXpvbnRhbEFycm93T2Zmc2V0KCk7XG4gICAgfVxuXG4gICAgaWYgKCFpc0hvcml6b250YWwpIHtcbiAgICAgIHJldHVybiB0aGlzLl9wb3NpdGlvbi5sZWZ0ICsgb2Zmc2V0O1xuICAgIH1cbiAgICBpZiAoIXRoaXMub3ZlcmxheXNUYXJnZXQgJiYgaXNMZWZ0KSB7XG4gICAgICBvZmZzZXQgKz0gdGhpcy5fcG9zaXRpb24udGFyZ2V0V2lkdGg7XG4gICAgfSBlbHNlIGlmICghdGhpcy5vdmVybGF5c1RhcmdldCAmJiAhaXNMZWZ0KSB7XG4gICAgICBvZmZzZXQgLT0gdGhpcy5fcG9zaXRpb24udGFyZ2V0V2lkdGg7XG4gICAgfVxuXG4gICAgaWYgKHRoaXMuYXJyb3cgJiYgaXNMZWZ0KSB7XG4gICAgICBvZmZzZXQgKz0gdGhpcy5hcnJvd0hlaWdodDtcbiAgICB9IGVsc2UgaWYgKHRoaXMuYXJyb3cgJiYgIWlzTGVmdCkge1xuICAgICAgb2Zmc2V0IC09IHRoaXMuYXJyb3dIZWlnaHQ7XG4gICAgfVxuICAgIHJldHVybiB0aGlzLl9wb3NpdGlvbi5sZWZ0ICsgb2Zmc2V0O1xuICB9XG59XG4iXX0=
77.481912
35,082
0.784296
68ca90331bb84d75af4169903d8de70ea149844f
3,500
js
JavaScript
src/parade/ParadeMapPage.js
PrideInLondon/pride-london-web
60a913eaca5aaf905d32512da6a5f7b94eed1289
[ "Apache-2.0" ]
10
2019-04-09T18:26:19.000Z
2020-03-02T11:09:00.000Z
src/parade/ParadeMapPage.js
PrideInLondon/pride-london-web
60a913eaca5aaf905d32512da6a5f7b94eed1289
[ "Apache-2.0" ]
2,015
2019-01-21T11:02:44.000Z
2022-03-18T18:28:59.000Z
src/parade/ParadeMapPage.js
PrideInLondon/pride-london-web
60a913eaca5aaf905d32512da6a5f7b94eed1289
[ "Apache-2.0" ]
7
2019-05-05T13:24:54.000Z
2020-12-30T18:55:39.000Z
import querystring from 'querystring' import React from 'react' import appStoreBadge from '../assets/appStore.svg' import googlePlayBadge from '../assets/googlePlayStore.svg' import { Column } from '../components/grid' import { Button } from '../components/button' import { ParadeMapContainer, ParadeMapContent, Title, SubTitle, Map, DownloadPDFLinkMobile, DownloadAppLabel, AppDownloadButtons, AppDownloadButton, } from './ParadeMapPage.styles' const googlePlayUrl = 'https://play.google.com/store/apps/details?id=org.prideinlondon.festival&hl=en' const appStoreUrl = 'https://itunes.apple.com/gb/app/pride-in-london/id1250496471' const mapPdfLink = 'https://assets.ctfassets.net/0ho16wyr4i9n/73s6Ny4Ota2DFEt4AjbfQm/20ac5456111dbc0d177a7c0688bef835/Pride_in_London_Parade_Map_2019.pdf' const ParadeMapPage = () => ( <> <ParadeMapContainer mx={0}> <Column width={[1, 1, 0.5, 0.45, 0.4]} pt={[40, 40, 0]} pb={0} pl={[20, 20, 20, 30, 90]} pr={20} > <ParadeMapContent> <Title>Parade map</Title> <SubTitle> We've created an interactive map to help you find your way around on Parade day. Use it to find the best place to watch the Parade, find your way to our different stages/areas and find important amenities like water refill stations and toilets. </SubTitle> {mapPdfLink && ( <Button to={mapPdfLink} marginBottom="30px" display={{ default: 'none', md: 'inline-block' }} > Download map as a PDF </Button> )} <DownloadAppLabel> There's always poor internet connection on the day, so it's a good idea to download our app to carry the map with you offline. </DownloadAppLabel> <AppDownloadButtons> <AppDownloadButton href={appStoreUrl} aria-label="Download from App Store" target="_blank" rel="noopener noreferrer" > <img alt="Pride in London on the App Store" src={appStoreBadge} /> </AppDownloadButton> <AppDownloadButton href={googlePlayUrl} aria-label="Download from Google Play" target="_blank" rel="noopener noreferrer" > <img alt="Pride in London in the Google Play" src={googlePlayBadge} /> </AppDownloadButton> </AppDownloadButtons> {mapPdfLink && ( <DownloadPDFLinkMobile href={mapPdfLink} rel="noopener noreferrer" target="_blank" > Download map as a PDF </DownloadPDFLinkMobile> )} </ParadeMapContent> </Column> <Column width={[1, 1, 0.5, 0.55, 0.6]} pt={[0]} px={0} pb={0}> <Map frameBorder="0" src={`https://www.google.com/maps/d/embed?${querystring.encode({ mid: process.env.GATSBY_PARADE_MAP_ID, z: 16, ll: `51.51004, -0.13501`, hl: `en`, output: `embed`, t: 'm', style: 'feature:poi|visibility:off', })}`} allowFullScreen ></Map> </Column> </ParadeMapContainer> </> ) export default ParadeMapPage
32.110092
137
0.558857
68cb84894b5dcf53ce327d3d498b97b56b4729eb
11,128
js
JavaScript
services/api/test/instance.test.js
developmentseed/pearl-backend
38b7c9197855c135e522bf8b5a315a10006ef510
[ "MIT" ]
28
2022-03-28T18:32:47.000Z
2022-03-31T15:00:29.000Z
services/api/test/instance.test.js
developmentseed/pearl-backend
38b7c9197855c135e522bf8b5a315a10006ef510
[ "MIT" ]
1
2022-03-17T08:38:01.000Z
2022-03-17T08:38:01.000Z
services/api/test/instance.test.js
developmentseed/pearl-backend
38b7c9197855c135e522bf8b5a315a10006ef510
[ "MIT" ]
null
null
null
'use strict'; const test = require('tape'); const Flight = require('./flight'); const flight = new Flight(); flight.init(test); flight.takeoff(test); flight.user(test, 'ingalls', true); flight.fixture(test, 'model.json', 'ingalls'); flight.fixture(test, 'project.json', 'ingalls'); test('GET /api/project/1/instance (empty)', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.deepEquals(res.body, { total: 0, instances: [] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('POST /api/project/1/instance', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance', method: 'POST', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <str>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, project_id: 1, batch: null, aoi_id: null, checkpoint_id: null, active: false, pod: {}, type: 'cpu' }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance?status=all', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance?status=all', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.instances[0].created, '.instances[0].created: <date>'); delete res.body.instances[0].created; t.deepEquals(res.body, { total: 1, instances: [{ id: 1, active: false, batch: null, type: 'cpu' }] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance?status=inactive', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance?status=inactive', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.instances[0].created, '.instances[0].created: <date>'); delete res.body.instances[0].created; t.deepEquals(res.body, { total: 1, instances: [{ id: 1, active: false, batch: null, type: 'cpu' }] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance?status=active', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance?status=active', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.deepEquals(res.body, { total: 0, instances: [] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('PATCH /api/project/1/instance/1', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance/1', method: 'PATCH', headers: { Authorization: `Bearer ${flight.token.ingalls}` }, body: { active: true } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <string>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, project_id: 1, batch: null, aoi_id: null, checkpoint_id: null, status: {}, pod: {}, active: true, type: 'cpu' }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('PATCH /api/project/1/instance/1', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance/1', method: 'PATCH', headers: { Authorization: `Bearer ${flight.token.ingalls}` }, body: { active: false } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <string>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, status: {}, pod: {}, project_id: 1, batch: null, aoi_id: null, checkpoint_id: null, active: false, type: 'cpu' }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('PATCH /api/project/1/instance/1', async (t) => { try { await flight.request({ json: true, url: '/api/project/1/instance/1', method: 'PATCH', headers: { Authorization: `Bearer ${flight.token.ingalls}` }, body: { active: true } }, t); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance?status=active', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance?status=active', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.instances[0].created, '.instances[0].created: <date>'); delete res.body.instances[0].created; t.deepEquals(res.body, { total: 1, instances: [{ id: 1, batch: null, active: true, type: 'cpu' }] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.instances[0].created, '.instances[0].created: <date>'); delete res.body.instances[0].created; t.deepEquals(res.body, { total: 1, instances: [{ id: 1, active: true, batch: null, type: 'cpu' }] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance?type=gpu', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance?type=gpu', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.deepEquals(res.body, { total: 0, instances: [] }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/project/1/instance/1', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance/1', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <str>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, type: 'cpu', project_id: 1, batch: null, aoi_id: null, checkpoint_id: null, active: true, status: {}, pod: {} }); } catch (err) { t.error(err, 'no error'); } t.end(); }); test('GET /api/instance/1', async (t) => { try { const res = await flight.request({ json: true, url: '/api/instance/1', method: 'GET', headers: { Authorization: `Bearer ${flight.token.ingalls}` } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <str>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, type: 'cpu', project_id: 1, batch: null, aoi_id: null, checkpoint_id: null, active: true, status: {}, pod: {} }); } catch (err) { t.error(err, 'no error'); } t.end(); }); flight.fixture(test, 'checkpoint.json', 'ingalls'); test('PATCH /api/project/1/instance/1', async (t) => { try { const res = await flight.request({ json: true, url: '/api/project/1/instance/1', method: 'PATCH', headers: { Authorization: `Bearer ${flight.token.ingalls}` }, body: { checkpoint_id: 1 } }, t); t.ok(res.body.created, '.created: <date>'); t.ok(res.body.last_update, '.last_update: <date>'); t.ok(res.body.token, '.token: <string>'); delete res.body.created; delete res.body.last_update; delete res.body.token; t.deepEquals(res.body, { id: 1, project_id: 1, status: {}, pod: {}, batch: null, aoi_id: null, checkpoint_id: 1, active: true, type: 'cpu' }, t); } catch (err) { t.error(err, 'no error'); } t.end(); }); flight.landing(test);
24.619469
77
0.44716
68cbecad6d7f0f8e6398320716b218f7a7d14826
1,193
js
JavaScript
components/layouts/Header.js
12dkaskar/Injiri-Ecom
b12dbc56c8e4dfdb25bd0471a440bae14c998e5a
[ "MIT" ]
null
null
null
components/layouts/Header.js
12dkaskar/Injiri-Ecom
b12dbc56c8e4dfdb25bd0471a440bae14c998e5a
[ "MIT" ]
4
2021-03-10T03:47:40.000Z
2021-12-09T01:21:30.000Z
components/layouts/Header.js
JatinKukreja18/Injiri-Ecom
b12dbc56c8e4dfdb25bd0471a440bae14c998e5a
[ "MIT" ]
null
null
null
import React from 'react'; import Router from "next/router"; import NProgress from "nprogress"; import Nav from "./Nav"; Router.onRouteChangeStart = () => { NProgress.start(); }; Router.onRouteChangeComplete = () => { NProgress.done(); }; Router.onRouteChangeError = () => { NProgress.done(); }; let lastScroll = 0; class Header extends React.Component { state={ scrolled: false, scrollDirection:false } componentDidMount () { window.addEventListener('scroll', this.handleScroll); } componentWillUnmount() { window.removeEventListener('scroll', this.handleScroll); } handleScroll = (event) => { let scrollTop = event.target.scrollingElement.scrollTop; let direction = 'down'; if(scrollTop > lastScroll && scrollTop > 490){ direction = 'down'; }else{ direction = 'up'; } if(scrollTop> 100){ this.setState({ scrolled: true, scrollDirection: direction }); }else{ this.setState({ scrolled: false, scrollDirection: direction }); } lastScroll = scrollTop } render(){ const {scrollDirection,scrolled}= this.state return( <Nav scrolled={scrolled} scrollDirection={scrollDirection}/> ) } }; export default Header;
19.883333
63
0.678961
68cd49c29c2c078e6d58242885fa8a6d4a3c9f8a
1,576
js
JavaScript
resources/assets/parser/components/editors/CriminalDefenseEditor/SplashEditor.js
chompchompbalboa/rockyeastman
ca88529eb4c3d272c9e379ddcb93263cae8222c4
[ "MIT" ]
null
null
null
resources/assets/parser/components/editors/CriminalDefenseEditor/SplashEditor.js
chompchompbalboa/rockyeastman
ca88529eb4c3d272c9e379ddcb93263cae8222c4
[ "MIT" ]
null
null
null
resources/assets/parser/components/editors/CriminalDefenseEditor/SplashEditor.js
chompchompbalboa/rockyeastman
ca88529eb4c3d272c9e379ddcb93263cae8222c4
[ "MIT" ]
null
null
null
//----------------------------------------------------------------------------- // Imports //----------------------------------------------------------------------------- import React from 'react' import styled from 'styled-components' import EditorImage from '../../lib/EditorImage' import EditorInput from '../../lib/EditorInput' import EditorListActions from '../../lib/EditorListActions' import EditorSegment from '../../lib/EditorSegment' import HorizontalContainer from '../../lib/EditorHorizontalContainer' //----------------------------------------------------------------------------- // Component //----------------------------------------------------------------------------- const SplashEditor = ({splash, update, ...props}) => { return ( <EditorSegment {...props} header="Splash"> <EditorImage label="Image" name="seed.pages.home.splash.img" src={splash.img} onChange={update}/> {splash.text.map((text, index) => { return ( <HorizontalContainer key={index}> <EditorInput label={"Text"} name={"seed.pages.home.splash.text." + index} value={text} width="79%" onChange={update}/> <EditorListActions index={index} itemTemplate="" list={splash.text} name="seed.pages.home.splash.text" onChange={update}/> </HorizontalContainer> ) })} </EditorSegment> ) } export default SplashEditor
32.833333
79
0.451777
68cf97eec5fcc3f4f0960d540c9c0bf13b1da74d
3,311
js
JavaScript
lib/client.js
mhdawson/micro-app-notify-client
527f3754d7d48a05e822ab97a75211c6dd6a3ad0
[ "MIT" ]
null
null
null
lib/client.js
mhdawson/micro-app-notify-client
527f3754d7d48a05e822ab97a75211c6dd6a3ad0
[ "MIT" ]
null
null
null
lib/client.js
mhdawson/micro-app-notify-client
527f3754d7d48a05e822ab97a75211c6dd6a3ad0
[ "MIT" ]
null
null
null
// Copyright 2016-2017 the project authors as listed in the AUTHORS file. // All rights reserved. Use of this source code is governed by the // license that can be found in the LICENSE file. "use strict"; const fs = require('fs'); const https = require('https'); const mqtt = require('mqtt'); const path = require('path'); const twilio = require('twilio'); const sendSmsMessageVoipms = function(config, info) { if ((config.notify !== undefined) && (config.notify.voipms !== undefined) && (config.notify.voipms.enabled)) { var options = { host: 'voip.ms', port: 443, method: 'GET', path: '/api/v1/rest.php?' + 'api_username=' + config.notify.voipms.user + '&' + 'api_password=' + config.notify.voipms.password + '&' + 'method=sendSMS' + '&' + 'did=' + config.notify.voipms.did + '&' + 'dst=' + config.notify.voipms.dst + '&' + 'message=' + encodeURIComponent(info) }; var request = https.request(options, function(res) { if (res.statusCode !== 200) { console.log('Failed to send voipms sms, status:' + res.statusCode); } }); request.end(); } } const sendSmsMessageTwilio = function(config, info) { if ((config.notify !== undefined) && (config.notify.twilio !== undefined) && (config.notify.twilio.enabled)) { var twilioClient = new twilio.RestClient(config.notify.twilio.accountSID, config.notify.twilio.accountAuthToken); twilioClient.sendMessage({ to: config.notify.twilio.toNumber, from: config.notify.twilio.fromNumber, body: info }, function(err, message) { if (err) { console.log('Failed to send twilio sms:' + err.message); } }); } }; var mqttClient; const sendSmsMessageMqttBridge = function(config, info) { if ((config.notify !== undefined) && (config.notify.mqttSmsBridge !== undefined) && (config.notify.mqttSmsBridge.enabled)) { if (mqttClient === undefined) { let mqttOptions; if (config.notify.mqttSmsBridge.serverUrl.indexOf('mqtts') > -1) { const certsPath = config.notify.mqttSmsBridge.certs; mqttOptions = { key: fs.readFileSync(path.join(__dirname, certsPath, '/client.key')), cert: fs.readFileSync(path.join(__dirname, certsPath, '/client.cert')), ca: fs.readFileSync(path.join(__dirname, certsPath, '/ca.cert')), checkServerIdentity: function() { return undefined } } } mqttClient = mqtt.connect(config.notify.mqttSmsBridge.serverUrl, mqttOptions); } mqttClient.publish(config.notify.mqttSmsBridge.topic, info); } } const sendNotification = function(config, info) { sendSmsMessageMqttBridge(config, info); sendSmsMessageTwilio(config, info); sendSmsMessageVoipms(config, info); } const end = function() { if (mqttClient !== undefined) { mqttClient.end(); } } module.exports.sendNotification = sendNotification; module.exports.end = end;
37.625
103
0.581093
68d0dc7fd090088aa0792c95ac9aebfcd48a23cd
242,183
js
JavaScript
dist/planck-with-testbed.min.js
Sayan-dev/planck.js
01dce1c8f440519337f1621552731aab37cf12e5
[ "MIT" ]
4,622
2016-04-03T02:07:29.000Z
2022-03-30T06:09:37.000Z
dist/planck-with-testbed.min.js
Sayan-dev/planck.js
01dce1c8f440519337f1621552731aab37cf12e5
[ "MIT" ]
163
2017-02-23T14:36:32.000Z
2022-03-26T15:02:29.000Z
dist/planck-with-testbed.min.js
Sayan-dev/planck.js
01dce1c8f440519337f1621552731aab37cf12e5
[ "MIT" ]
328
2016-04-05T07:59:53.000Z
2022-03-26T20:54:37.000Z
/** * Planck.js v1.0.0-alpha.2 * @license The MIT license * @copyright Copyright (c) 2021 Erin Catto, Ali Shakiba * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).planck={})}(this,(function(t){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function o(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(o.prototype=i.prototype,new o)}var o=function(){return(o=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function s(t,e){null==t&&(t={});var i=o({},t);for(var s in e)e.hasOwnProperty(s)&&void 0===t[s]&&(i[s]=e[s]);if("function"==typeof Object.getOwnPropertySymbols)for(var n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++){var a=n[r];e.propertyIsEnumerable(a)&&void 0===t[a]&&(i[a]=e[a])}return i}var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},r=Object.create(Math);r.EPSILON=1e-9,r.isFinite=function(t){return"number"==typeof t&&isFinite(t)&&!isNaN(t)},r.assert=function(t){},r.invSqrt=function(t){return 1/Math.sqrt(t)},r.nextPowerOfTwo=function(t){return t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,(t|=t>>16)+1},r.isPowerOfTwo=function(t){return t>0&&0==(t&t-1)},r.mod=function(t,e,i){return void 0===e?(i=1,e=0):void 0===i&&(i=e,e=0),i>e?(t=(t-e)%(i-e))+(t<0?i:e):(t=(t-i)%(e-i))+(t<=0?e:i)},r.clamp=function(t,e,i){return t<e?e:t>i?i:t},r.random=function(t,e){return void 0===t?(e=1,t=0):void 0===e&&(e=t,t=0),t===e?t:Math.random()*(e-t)+t};var a,h,m=function(){function t(e,i){if(!(this instanceof t))return new t(e,i);void 0===e?(this.x=0,this.y=0):"object"==typeof e?(this.x=e.x,this.y=e.y):(this.x=e,this.y=i)}return t.prototype._serialize=function(){return{x:this.x,y:this.y}},t._deserialize=function(e){var i=Object.create(t.prototype);return i.x=e.x,i.y=e.y,i},t.zero=function(){var e=Object.create(t.prototype);return e.x=0,e.y=0,e},t.neo=function(e,i){var o=Object.create(t.prototype);return o.x=e,o.y=i,o},t.clone=function(e){return t.neo(e.x,e.y)},t.prototype.toString=function(){return JSON.stringify(this)},t.isValid=function(t){return t&&r.isFinite(t.x)&&r.isFinite(t.y)},t.assert=function(t){},t.prototype.clone=function(){return t.clone(this)},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.set=function(t,e){return"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t,this.y=e),this},t.prototype.wSet=function(t,e,i,o){return void 0!==i||void 0!==o?this.setCombine(t,e,i,o):this.setMul(t,e)},t.prototype.setCombine=function(t,e,i,o){var s=t*e.x+i*o.x,n=t*e.y+i*o.y;return this.x=s,this.y=n,this},t.prototype.setMul=function(t,e){var i=t*e.x,o=t*e.y;return this.x=i,this.y=o,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.wAdd=function(t,e,i,o){return void 0!==i||void 0!==o?this.addCombine(t,e,i,o):this.addMul(t,e)},t.prototype.addCombine=function(t,e,i,o){var s=t*e.x+i*o.x,n=t*e.y+i*o.y;return this.x+=s,this.y+=n,this},t.prototype.addMul=function(t,e){var i=t*e.x,o=t*e.y;return this.x+=i,this.y+=o,this},t.prototype.wSub=function(t,e,i,o){return void 0!==i||void 0!==o?this.subCombine(t,e,i,o):this.subMul(t,e)},t.prototype.subCombine=function(t,e,i,o){var s=t*e.x+i*o.x,n=t*e.y+i*o.y;return this.x-=s,this.y-=n,this},t.prototype.subMul=function(t,e){var i=t*e.x,o=t*e.y;return this.x-=i,this.y-=o,this},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.mul=function(t){return this.x*=t,this.y*=t,this},t.prototype.length=function(){return t.lengthOf(this)},t.prototype.lengthSquared=function(){return t.lengthSquared(this)},t.prototype.normalize=function(){var t=this.length();if(t<r.EPSILON)return 0;var e=1/t;return this.x*=e,this.y*=e,t},t.lengthOf=function(t){return r.sqrt(t.x*t.x+t.y*t.y)},t.lengthSquared=function(t){return t.x*t.x+t.y*t.y},t.distance=function(t,e){var i=t.x-e.x,o=t.y-e.y;return r.sqrt(i*i+o*o)},t.distanceSquared=function(t,e){var i=t.x-e.x,o=t.y-e.y;return i*i+o*o},t.areEqual=function(t,e){return t===e||"object"==typeof e&&null!==e&&t.x===e.x&&t.y===e.y},t.skew=function(e){return t.neo(-e.y,e.x)},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.cross=function(e,i){return"number"==typeof i?t.neo(i*e.y,-i*e.x):"number"==typeof e?t.neo(-e*i.y,e*i.x):e.x*i.y-e.y*i.x},t.addCross=function(e,i,o){return"number"==typeof o?t.neo(o*i.y+e.x,-o*i.x+e.y):"number"==typeof i?t.neo(-i*o.y+e.x,i*o.x+e.y):void 0},t.add=function(e,i){return t.neo(e.x+i.x,e.y+i.y)},t.wAdd=function(e,i,o,s){return void 0!==o||void 0!==s?t.combine(e,i,o,s):t.mul(e,i)},t.combine=function(e,i,o,s){return t.zero().setCombine(e,i,o,s)},t.sub=function(e,i){return t.neo(e.x-i.x,e.y-i.y)},t.mul=function(e,i){return"object"==typeof e?t.neo(e.x*i,e.y*i):"object"==typeof i?t.neo(e*i.x,e*i.y):void 0},t.prototype.neg=function(){return this.x=-this.x,this.y=-this.y,this},t.neg=function(e){return t.neo(-e.x,-e.y)},t.abs=function(e){return t.neo(r.abs(e.x),r.abs(e.y))},t.mid=function(e,i){return t.neo(.5*(e.x+i.x),.5*(e.y+i.y))},t.upper=function(e,i){return t.neo(r.max(e.x,i.x),r.max(e.y,i.y))},t.lower=function(e,i){return t.neo(r.min(e.x,i.x),r.min(e.y,i.y))},t.prototype.clamp=function(t){var e=this.x*this.x+this.y*this.y;if(e>t*t){var i=r.invSqrt(e);this.x*=i*t,this.y*=i*t}return this},t.clamp=function(e,i){return(e=t.neo(e.x,e.y)).clamp(i),e},t.scaleFn=function(e,i){return function(o){return t.neo(o.x*e,o.y*i)}},t.translateFn=function(e,i){return function(o){return t.neo(o.x+e,o.y+i)}},t}(),_=function(){function t(e,i){if(!(this instanceof t))return new t(e,i);this.lowerBound=m.zero(),this.upperBound=m.zero(),"object"==typeof e&&this.lowerBound.set(e),"object"==typeof i?this.upperBound.set(i):"object"==typeof e&&this.upperBound.set(e)}return t.prototype.isValid=function(){return t.isValid(this)},t.isValid=function(t){var e=m.sub(t.upperBound,t.lowerBound);return e.x>=0&&e.y>=0&&m.isValid(t.lowerBound)&&m.isValid(t.upperBound)},t.assert=function(t){},t.prototype.getCenter=function(){return m.neo(.5*(this.lowerBound.x+this.upperBound.x),.5*(this.lowerBound.y+this.upperBound.y))},t.prototype.getExtents=function(){return m.neo(.5*(this.upperBound.x-this.lowerBound.x),.5*(this.upperBound.y-this.lowerBound.y))},t.prototype.getPerimeter=function(){return 2*(this.upperBound.x-this.lowerBound.x+this.upperBound.y-this.lowerBound.y)},t.prototype.combine=function(t,e){e=e||this;var i=t.lowerBound,o=t.upperBound,s=e.lowerBound,n=e.upperBound,a=r.min(i.x,s.x),h=r.min(i.y,s.y),m=r.max(n.x,o.x),_=r.max(n.y,o.y);this.lowerBound.set(a,h),this.upperBound.set(m,_)},t.prototype.combinePoints=function(t,e){this.lowerBound.set(r.min(t.x,e.x),r.min(t.y,e.y)),this.upperBound.set(r.max(t.x,e.x),r.max(t.y,e.y))},t.prototype.set=function(t){this.lowerBound.set(t.lowerBound.x,t.lowerBound.y),this.upperBound.set(t.upperBound.x,t.upperBound.y)},t.prototype.contains=function(t){var e=!0;return e=(e=(e=(e=e&&this.lowerBound.x<=t.lowerBound.x)&&this.lowerBound.y<=t.lowerBound.y)&&t.upperBound.x<=this.upperBound.x)&&t.upperBound.y<=this.upperBound.y},t.prototype.extend=function(e){return t.extend(this,e),this},t.extend=function(t,e){t.lowerBound.x-=e,t.lowerBound.y-=e,t.upperBound.x+=e,t.upperBound.y+=e},t.testOverlap=function(t,e){var i=e.lowerBound.x-t.upperBound.x,o=t.lowerBound.x-e.upperBound.x,s=e.lowerBound.y-t.upperBound.y,n=t.lowerBound.y-e.upperBound.y;return!(i>0||s>0||o>0||n>0)},t.areEqual=function(t,e){return m.areEqual(t.lowerBound,e.lowerBound)&&m.areEqual(t.upperBound,e.upperBound)},t.diff=function(t,e){var i=r.max(0,r.min(t.upperBound.x,e.upperBound.x)-r.max(e.lowerBound.x,t.lowerBound.x)),o=r.max(0,r.min(t.upperBound.y,e.upperBound.y)-r.max(e.lowerBound.y,t.lowerBound.y));return(t.upperBound.x-t.lowerBound.x)*(t.upperBound.y-t.lowerBound.y)+(e.upperBound.x-e.lowerBound.x)*(e.upperBound.y-e.lowerBound.y)-i*o},t.prototype.rayCast=function(t,e){for(var i=-1/0,o=1/0,s=e.p1,n=m.sub(e.p2,e.p1),a=m.abs(n),h=m.zero(),_="x";null!==_;_="x"===_?"y":null)if(a.x<r.EPSILON){if(s[_]<this.lowerBound[_]||this.upperBound[_]<s[_])return!1}else{var c=1/n[_],l=(this.lowerBound[_]-s[_])*c,u=(this.upperBound[_]-s[_])*c,p=-1;if(l>u){var d=l;l=u,u=d,p=1}if(l>i&&(h.setZero(),h[_]=p,i=l),i>(o=r.min(o,u)))return!1}return!(i<0||e.maxFraction<i)&&(t.fraction=i,t.normal=h,!0)},t.prototype.toString=function(){return JSON.stringify(this)},t}(),c=function(){function t(){}return Object.defineProperty(t,"linearSlopSquared",{get:function(){return t.linearSlop*t.linearSlop},enumerable:!1,configurable:!0}),Object.defineProperty(t,"polygonRadius",{get:function(){return 2*t.linearSlop},enumerable:!1,configurable:!0}),Object.defineProperty(t,"maxTranslationSquared",{get:function(){return t.maxTranslation*t.maxTranslation},enumerable:!1,configurable:!0}),Object.defineProperty(t,"maxRotationSquared",{get:function(){return t.maxRotation*t.maxRotation},enumerable:!1,configurable:!0}),Object.defineProperty(t,"linearSleepToleranceSqr",{get:function(){return Math.pow(t.linearSleepTolerance,2)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"angularSleepToleranceSqr",{get:function(){return Math.pow(t.angularSleepTolerance,2)},enumerable:!1,configurable:!0}),t.maxManifoldPoints=2,t.maxPolygonVertices=12,t.aabbExtension=.1,t.aabbMultiplier=2,t.linearSlop=.005,t.angularSlop=2/180*Math.PI,t.maxSubSteps=8,t.maxTOIContacts=32,t.maxTOIIterations=20,t.maxDistnceIterations=20,t.velocityThreshold=1,t.maxLinearCorrection=.2,t.maxAngularCorrection=8/180*Math.PI,t.maxTranslation=2,t.maxRotation=.5*Math.PI,t.baumgarte=.2,t.toiBaugarte=.75,t.timeToSleep=.5,t.linearSleepTolerance=.01,t.angularSleepTolerance=2/180*Math.PI,t}(),l=function(){function t(t){this._list=[],this._max=1/0,this._createCount=0,this._outCount=0,this._inCount=0,this._discardCount=0,this._list=[],this._max=t.max||this._max,this._createFn=t.create,this._outFn=t.allocate,this._inFn=t.release,this._discardFn=t.discard}return t.prototype.max=function(t){return"number"==typeof t?(this._max=t,this):this._max},t.prototype.size=function(){return this._list.length},t.prototype.allocate=function(){var t;return this._list.length>0?t=this._list.shift():(this._createCount++,t="function"==typeof this._createFn?this._createFn():{}),this._outCount++,"function"==typeof this._outFn&&this._outFn(t),t},t.prototype.release=function(t){this._list.length<this._max?(this._inCount++,"function"==typeof this._inFn&&this._inFn(t),this._list.push(t)):(this._discardCount++,"function"==typeof this._discardFn&&(t=this._discardFn(t)))},t.prototype.toString=function(){return" +"+this._createCount+" >"+this._outCount+" <"+this._inCount+" -"+this._discardCount+" ="+this._list.length+"/"+this._max},t}(),u=function(){function t(t){this.aabb=new _,this.userData=null,this.parent=null,this.child1=null,this.child2=null,this.height=-1,this.id=t}return t.prototype.toString=function(){return this.id+": "+this.userData},t.prototype.isLeaf=function(){return null==this.child1},t}(),p=function(){function t(){this.inputPool=new l({create:function(){return{}},release:function(t){}}),this.stackPool=new l({create:function(){return[]},release:function(t){t.length=0}}),this.iteratorPool=new l({create:function(){return new d},release:function(t){t.close()}}),this.m_root=null,this.m_nodes={},this.m_lastProxyId=0,this.m_pool=new l({create:function(){return new u}})}return t.prototype.getUserData=function(t){return this.m_nodes[t].userData},t.prototype.getFatAABB=function(t){return this.m_nodes[t].aabb},t.prototype.allocateNode=function(){var t=this.m_pool.allocate();return t.id=++this.m_lastProxyId,t.userData=null,t.parent=null,t.child1=null,t.child2=null,t.height=-1,this.m_nodes[t.id]=t,t},t.prototype.freeNode=function(t){this.m_pool.release(t),t.height=-1,delete this.m_nodes[t.id]},t.prototype.createProxy=function(t,e){var i=this.allocateNode();return i.aabb.set(t),_.extend(i.aabb,c.aabbExtension),i.userData=e,i.height=0,this.insertLeaf(i),i.id},t.prototype.destroyProxy=function(t){var e=this.m_nodes[t];this.removeLeaf(e),this.freeNode(e)},t.prototype.moveProxy=function(t,e,i){var o=this.m_nodes[t];return!o.aabb.contains(e)&&(this.removeLeaf(o),o.aabb.set(e),e=o.aabb,_.extend(e,c.aabbExtension),i.x<0?e.lowerBound.x+=i.x*c.aabbMultiplier:e.upperBound.x+=i.x*c.aabbMultiplier,i.y<0?e.lowerBound.y+=i.y*c.aabbMultiplier:e.upperBound.y+=i.y*c.aabbMultiplier,this.insertLeaf(o),!0)},t.prototype.insertLeaf=function(t){if(null==this.m_root)return this.m_root=t,void(this.m_root.parent=null);for(var e=t.aabb,i=this.m_root;!i.isLeaf();){var o=i.child1,s=i.child2,n=i.aabb.getPerimeter(),a=new _;a.combine(i.aabb,e);var h=a.getPerimeter(),m=2*h,c=2*(h-n),l=void 0;if(o.isLeaf()){(d=new _).combine(e,o.aabb),l=d.getPerimeter()+c}else{(d=new _).combine(e,o.aabb);var u=o.aabb.getPerimeter();l=d.getPerimeter()-u+c}var p=void 0;if(s.isLeaf()){(d=new _).combine(e,s.aabb),p=d.getPerimeter()+c}else{var d;(d=new _).combine(e,s.aabb);u=s.aabb.getPerimeter();p=d.getPerimeter()-u+c}if(m<l&&m<p)break;i=l<p?o:s}var y=i,f=y.parent,v=this.allocateNode();for(v.parent=f,v.userData=null,v.aabb.combine(e,y.aabb),v.height=y.height+1,null!=f?(f.child1===y?f.child1=v:f.child2=v,v.child1=y,v.child2=t,y.parent=v,t.parent=v):(v.child1=y,v.child2=t,y.parent=v,t.parent=v,this.m_root=v),i=t.parent;null!=i;){o=(i=this.balance(i)).child1,s=i.child2;i.height=1+r.max(o.height,s.height),i.aabb.combine(o.aabb,s.aabb),i=i.parent}},t.prototype.removeLeaf=function(t){if(t!==this.m_root){var e,i=t.parent,o=i.parent;if(e=i.child1===t?i.child2:i.child1,null!=o){o.child1===i?o.child1=e:o.child2=e,e.parent=o,this.freeNode(i);for(var s=o;null!=s;){var n=(s=this.balance(s)).child1,a=s.child2;s.aabb.combine(n.aabb,a.aabb),s.height=1+r.max(n.height,a.height),s=s.parent}}else this.m_root=e,e.parent=null,this.freeNode(i)}else this.m_root=null},t.prototype.balance=function(t){var e=t;if(e.isLeaf()||e.height<2)return t;var i=e.child1,o=e.child2,s=o.height-i.height;if(s>1){var n=o.child1,a=o.child2;return o.child1=e,o.parent=e.parent,e.parent=o,null!=o.parent?o.parent.child1===t?o.parent.child1=o:o.parent.child2=o:this.m_root=o,n.height>a.height?(o.child2=n,e.child2=a,a.parent=e,e.aabb.combine(i.aabb,a.aabb),o.aabb.combine(e.aabb,n.aabb),e.height=1+r.max(i.height,a.height),o.height=1+r.max(e.height,n.height)):(o.child2=a,e.child2=n,n.parent=e,e.aabb.combine(i.aabb,n.aabb),o.aabb.combine(e.aabb,a.aabb),e.height=1+r.max(i.height,n.height),o.height=1+r.max(e.height,a.height)),o}if(s<-1){var h=i.child1,m=i.child2;return i.child1=e,i.parent=e.parent,e.parent=i,null!=i.parent?i.parent.child1===e?i.parent.child1=i:i.parent.child2=i:this.m_root=i,h.height>m.height?(i.child2=h,e.child1=m,m.parent=e,e.aabb.combine(o.aabb,m.aabb),i.aabb.combine(e.aabb,h.aabb),e.height=1+r.max(o.height,m.height),i.height=1+r.max(e.height,h.height)):(i.child2=m,e.child1=h,h.parent=e,e.aabb.combine(o.aabb,h.aabb),i.aabb.combine(e.aabb,m.aabb),e.height=1+r.max(o.height,h.height),i.height=1+r.max(e.height,m.height)),i}return e},t.prototype.getHeight=function(){return null==this.m_root?0:this.m_root.height},t.prototype.getAreaRatio=function(){if(null==this.m_root)return 0;for(var t,e=this.m_root.aabb.getPerimeter(),i=0,o=this.iteratorPool.allocate().preorder(this.m_root);t=o.next();)t.height<0||(i+=t.aabb.getPerimeter());return this.iteratorPool.release(o),i/e},t.prototype.computeHeight=function(t){var e;if((e=void 0!==t?this.m_nodes[t]:this.m_root).isLeaf())return 0;var i=this.computeHeight(e.child1.id),o=this.computeHeight(e.child2.id);return 1+r.max(i,o)},t.prototype.validateStructure=function(t){if(null!=t){this.m_root;var e=t.child1,i=t.child2;t.isLeaf()||(this.validateStructure(e),this.validateStructure(i))}},t.prototype.validateMetrics=function(t){if(null!=t){var e=t.child1,i=t.child2;if(!t.isLeaf()){var o=e.height,s=i.height;r.max(o,s),(new _).combine(e.aabb,i.aabb),this.validateMetrics(e),this.validateMetrics(i)}}},t.prototype.validate=function(){this.validateStructure(this.m_root),this.validateMetrics(this.m_root)},t.prototype.getMaxBalance=function(){for(var t,e=0,i=this.iteratorPool.allocate().preorder(this.m_root);t=i.next();)if(!(t.height<=1)){var o=r.abs(t.child2.height-t.child1.height);e=r.max(e,o)}return this.iteratorPool.release(i),e},t.prototype.rebuildBottomUp=function(){for(var t,e=[],i=0,o=this.iteratorPool.allocate().preorder(this.m_root);t=o.next();)t.height<0||(t.isLeaf()?(t.parent=null,e[i]=t,++i):this.freeNode(t));for(this.iteratorPool.release(o);i>1;){for(var s=1/0,n=-1,a=-1,h=0;h<i;++h)for(var m=e[h].aabb,c=h+1;c<i;++c){var l=e[c].aabb,u=new _;u.combine(m,l);var p=u.getPerimeter();p<s&&(n=h,a=c,s=p)}var d=e[n],y=e[a],f=this.allocateNode();f.child1=d,f.child2=y,f.height=1+r.max(d.height,y.height),f.aabb.combine(d.aabb,y.aabb),f.parent=null,d.parent=f,y.parent=f,e[a]=e[i-1],e[n]=f,--i}this.m_root=e[0],this.validate()},t.prototype.shiftOrigin=function(t){for(var e,i=this.iteratorPool.allocate().preorder(this.m_root);e=i.next();){var o=e.aabb;o.lowerBound.x-=t.x,o.lowerBound.y-=t.y,o.upperBound.x-=t.x,o.upperBound.y-=t.y}this.iteratorPool.release(i)},t.prototype.query=function(t,e){var i=this.stackPool.allocate();for(i.push(this.m_root);i.length>0;){var o=i.pop();if(null!=o)if(_.testOverlap(o.aabb,t))if(o.isLeaf()){if(!1===e(o.id))return}else i.push(o.child1),i.push(o.child2)}this.stackPool.release(i)},t.prototype.rayCast=function(t,e){var i=t.p1,o=t.p2,s=m.sub(o,i);s.normalize();var n=m.cross(1,s),a=m.abs(n),h=t.maxFraction,c=new _,l=m.combine(1-h,i,h,o);c.combinePoints(i,l);var u=this.stackPool.allocate(),p=this.inputPool.allocate();for(u.push(this.m_root);u.length>0;){var d=u.pop();if(null!=d&&!1!==_.testOverlap(d.aabb,c)){var y=d.aabb.getCenter(),f=d.aabb.getExtents();if(!(r.abs(m.dot(n,m.sub(i,y)))-m.dot(a,f)>0))if(d.isLeaf()){p.p1=m.clone(t.p1),p.p2=m.clone(t.p2),p.maxFraction=h;var v=e(p,d.id);if(0===v)return;v>0&&(h=v,l=m.combine(1-h,i,h,o),c.combinePoints(i,l))}else u.push(d.child1),u.push(d.child2)}}this.stackPool.release(u),this.inputPool.release(p)},t}(),d=function(){function t(){this.parents=[],this.states=[]}return t.prototype.preorder=function(t){return this.parents.length=0,this.parents.push(t),this.states.length=0,this.states.push(0),this},t.prototype.next=function(){for(;this.parents.length>0;){var t=this.parents.length-1,e=this.parents[t];if(0===this.states[t])return this.states[t]=1,e;if(1===this.states[t]&&(this.states[t]=2,e.child1))return this.parents.push(e.child1),this.states.push(1),e.child1;if(2===this.states[t]&&(this.states[t]=3,e.child2))return this.parents.push(e.child2),this.states.push(1),e.child2;this.parents.pop(),this.states.pop()}},t.prototype.close=function(){this.parents.length=0},t}(),y=function(){function t(){var t=this;this.m_tree=new p,this.m_proxyCount=0,this.m_moveBuffer=[],this.query=function(e,i){t.m_tree.query(e,i)},this.queryCallback=function(e){if(e===t.m_queryProxyId)return!0;var i=r.min(e,t.m_queryProxyId),o=r.max(e,t.m_queryProxyId),s=t.m_tree.getUserData(i),n=t.m_tree.getUserData(o);return t.m_callback(s,n),!0}}return t.prototype.getUserData=function(t){return this.m_tree.getUserData(t)},t.prototype.testOverlap=function(t,e){var i=this.m_tree.getFatAABB(t),o=this.m_tree.getFatAABB(e);return _.testOverlap(i,o)},t.prototype.getFatAABB=function(t){return this.m_tree.getFatAABB(t)},t.prototype.getProxyCount=function(){return this.m_proxyCount},t.prototype.getTreeHeight=function(){return this.m_tree.getHeight()},t.prototype.getTreeBalance=function(){return this.m_tree.getMaxBalance()},t.prototype.getTreeQuality=function(){return this.m_tree.getAreaRatio()},t.prototype.rayCast=function(t,e){this.m_tree.rayCast(t,e)},t.prototype.shiftOrigin=function(t){this.m_tree.shiftOrigin(t)},t.prototype.createProxy=function(t,e){var i=this.m_tree.createProxy(t,e);return this.m_proxyCount++,this.bufferMove(i),i},t.prototype.destroyProxy=function(t){this.unbufferMove(t),this.m_proxyCount--,this.m_tree.destroyProxy(t)},t.prototype.moveProxy=function(t,e,i){this.m_tree.moveProxy(t,e,i)&&this.bufferMove(t)},t.prototype.touchProxy=function(t){this.bufferMove(t)},t.prototype.bufferMove=function(t){this.m_moveBuffer.push(t)},t.prototype.unbufferMove=function(t){for(var e=0;e<this.m_moveBuffer.length;++e)this.m_moveBuffer[e]===t&&(this.m_moveBuffer[e]=null)},t.prototype.updatePairs=function(t){for(this.m_callback=t;this.m_moveBuffer.length>0;)if(this.m_queryProxyId=this.m_moveBuffer.pop(),null!==this.m_queryProxyId){var e=this.m_tree.getFatAABB(this.m_queryProxyId);this.m_tree.query(e,this.queryCallback)}},t}(),f=function(){function t(e){if(!(this instanceof t))return new t(e);"number"==typeof e?this.setAngle(e):"object"==typeof e?this.set(e):this.setIdentity()}return t.neo=function(e){var i=Object.create(t.prototype);return i.setAngle(e),i},t.clone=function(e){var i=Object.create(t.prototype);return i.s=e.s,i.c=e.c,i},t.identity=function(){var e=Object.create(t.prototype);return e.s=0,e.c=1,e},t.isValid=function(t){return t&&r.isFinite(t.s)&&r.isFinite(t.c)},t.assert=function(t){},t.prototype.setIdentity=function(){this.s=0,this.c=1},t.prototype.set=function(t){"object"==typeof t?(this.s=t.s,this.c=t.c):(this.s=r.sin(t),this.c=r.cos(t))},t.prototype.setAngle=function(t){this.s=r.sin(t),this.c=r.cos(t)},t.prototype.getAngle=function(){return r.atan2(this.s,this.c)},t.prototype.getXAxis=function(){return m.neo(this.c,this.s)},t.prototype.getYAxis=function(){return m.neo(-this.s,this.c)},t.mul=function(e,i){if("c"in i&&"s"in i){var o=t.identity();return o.s=e.s*i.c+e.c*i.s,o.c=e.c*i.c-e.s*i.s,o}if("x"in i&&"y"in i)return m.neo(e.c*i.x-e.s*i.y,e.s*i.x+e.c*i.y)},t.mulRot=function(e,i){var o=t.identity();return o.s=e.s*i.c+e.c*i.s,o.c=e.c*i.c-e.s*i.s,o},t.mulVec2=function(t,e){return m.neo(t.c*e.x-t.s*e.y,t.s*e.x+t.c*e.y)},t.mulSub=function(t,e,i){var o=t.c*(e.x-i.x)-t.s*(e.y-i.y),s=t.s*(e.x-i.x)+t.c*(e.y-i.y);return m.neo(o,s)},t.mulT=function(e,i){if("c"in i&&"s"in i){var o=t.identity();return o.s=e.c*i.s-e.s*i.c,o.c=e.c*i.c+e.s*i.s,o}if("x"in i&&"y"in i)return m.neo(e.c*i.x+e.s*i.y,-e.s*i.x+e.c*i.y)},t.mulTRot=function(e,i){var o=t.identity();return o.s=e.c*i.s-e.s*i.c,o.c=e.c*i.c+e.s*i.s,o},t.mulTVec2=function(t,e){return m.neo(t.c*e.x+t.s*e.y,-t.s*e.x+t.c*e.y)},t}(),v=function(){function t(e,i){if(!(this instanceof t))return new t(e,i);this.p=m.zero(),this.q=f.identity(),void 0!==e&&this.p.set(e),void 0!==i&&this.q.set(i)}return t.clone=function(e){var i=Object.create(t.prototype);return i.p=m.clone(e.p),i.q=f.clone(e.q),i},t.neo=function(e,i){var o=Object.create(t.prototype);return o.p=m.clone(e),o.q=f.clone(i),o},t.identity=function(){var e=Object.create(t.prototype);return e.p=m.zero(),e.q=f.identity(),e},t.prototype.setIdentity=function(){this.p.setZero(),this.q.setIdentity()},t.prototype.set=function(t,e){void 0===e?(this.p.set(t.p),this.q.set(t.q)):(this.p.set(t),this.q.set(e))},t.isValid=function(t){return t&&m.isValid(t.p)&&f.isValid(t.q)},t.assert=function(t){},t.mul=function(e,i){if(Array.isArray(i)){for(var o=[],s=0;s<i.length;s++)o[s]=t.mul(e,i[s]);return o}return"x"in i&&"y"in i?t.mulVec2(e,i):"p"in i&&"q"in i?t.mulXf(e,i):void 0},t.mulAll=function(e,i){for(var o=[],s=0;s<i.length;s++)o[s]=t.mul(e,i[s]);return o},t.mulFn=function(e){return function(i){return t.mul(e,i)}},t.mulVec2=function(t,e){var i=t.q.c*e.x-t.q.s*e.y+t.p.x,o=t.q.s*e.x+t.q.c*e.y+t.p.y;return m.neo(i,o)},t.mulXf=function(e,i){var o=t.identity();return o.q=f.mulRot(e.q,i.q),o.p=m.add(f.mulVec2(e.q,i.p),e.p),o},t.mulT=function(e,i){return"x"in i&&"y"in i?t.mulTVec2(e,i):"p"in i&&"q"in i?t.mulTXf(e,i):void 0},t.mulTVec2=function(t,e){var i=e.x-t.p.x,o=e.y-t.p.y,s=t.q.c*i+t.q.s*o,n=-t.q.s*i+t.q.c*o;return m.neo(s,n)},t.mulTXf=function(e,i){var o=t.identity();return o.q.set(f.mulTRot(e.q,i.q)),o.p.set(f.mulTVec2(e.q,m.sub(i.p,e.p))),o},t}(),x=function(){function t(t,e){this.localCenter=m.zero(),this.c=m.zero(),this.a=0,this.alpha0=0,this.c0=m.zero(),this.a0=0}return t.prototype.setTransform=function(t){var e=v.mulVec2(t,this.localCenter);this.c.set(e),this.c0.set(e),this.a=t.q.getAngle(),this.a0=t.q.getAngle()},t.prototype.setLocalCenter=function(t,e){this.localCenter.set(t);var i=v.mulVec2(e,this.localCenter);this.c.set(i),this.c0.set(i)},t.prototype.getTransform=function(t,e){e=void 0===e?0:e,t.q.setAngle((1-e)*this.a0+e*this.a),t.p.setCombine(1-e,this.c0,e,this.c),t.p.sub(f.mulVec2(t.q,this.localCenter))},t.prototype.advance=function(t){var e=(t-this.alpha0)/(1-this.alpha0);this.c0.setCombine(e,this.c,1-e,this.c0),this.a0=e*this.a+(1-e)*this.a0,this.alpha0=t},t.prototype.forward=function(){this.a0=this.a,this.c0.set(this.c)},t.prototype.normalize=function(){var t=r.mod(this.a0,-r.PI,+r.PI);this.a-=this.a0-t,this.a0=t},t.prototype.clone=function(){var e=new t;return e.localCenter.set(this.localCenter),e.alpha0=this.alpha0,e.a0=this.a0,e.a=this.a,e.c0.set(this.c0),e.c.set(this.c),e},t.prototype.set=function(t){this.localCenter.set(t.localCenter),this.alpha0=t.alpha0,this.a0=t.a0,this.a=t.a,this.c0.set(t.c0),this.c.set(t.c)},t}(),g=function(){this.v=m.zero(),this.w=0},b=function(){function t(){this.c=m.zero(),this.a=0}return t.prototype.getTransform=function(t,e){return t.q.set(this.a),t.p.set(m.sub(this.c,f.mulVec2(t.q,e))),t},t}(),A=function(){function t(){}return t.prototype._reset=function(){},t._deserialize=function(e,i,o){var s=t.TYPES[e.type];return s&&o(s,e)},t.isValid=function(t){return!!t},t.prototype.getRadius=function(){return this.m_radius},t.prototype.getType=function(){return this.m_type},t.TYPES={},t}(),B={userData:null,friction:.2,restitution:0,density:0,isSensor:!1,filterGroupIndex:0,filterCategoryBits:1,filterMaskBits:65535},w=function(t,e){this.aabb=new _,this.fixture=t,this.childIndex=e,this.proxyId},C=function(){function t(t,e,i){e.shape?(i=e,e=e.shape):"number"==typeof i&&(i={density:i}),i=s(i,B),this.m_body=t,this.m_friction=i.friction,this.m_restitution=i.restitution,this.m_density=i.density,this.m_isSensor=i.isSensor,this.m_filterGroupIndex=i.filterGroupIndex,this.m_filterCategoryBits=i.filterCategoryBits,this.m_filterMaskBits=i.filterMaskBits,this.m_shape=e,this.m_next=null,this.m_proxies=[],this.m_proxyCount=0;for(var o=this.m_shape.getChildCount(),n=0;n<o;++n)this.m_proxies[n]=new w(this,n);this.m_userData=i.userData}return t.prototype._reset=function(){var t=this.getBody(),e=t.m_world.m_broadPhase;this.destroyProxies(e),this.m_shape._reset&&this.m_shape._reset();for(var i=this.m_shape.getChildCount(),o=0;o<i;++o)this.m_proxies[o]=new w(this,o);this.createProxies(e,t.m_xf),t.resetMassData()},t.prototype._serialize=function(){return{friction:this.m_friction,restitution:this.m_restitution,density:this.m_density,isSensor:this.m_isSensor,filterGroupIndex:this.m_filterGroupIndex,filterCategoryBits:this.m_filterCategoryBits,filterMaskBits:this.m_filterMaskBits,shape:this.m_shape}},t._deserialize=function(e,i,o){var s=o(A,e.shape);return s&&new t(i,s,e)},t.prototype.getType=function(){return this.m_shape.getType()},t.prototype.getShape=function(){return this.m_shape},t.prototype.isSensor=function(){return this.m_isSensor},t.prototype.setSensor=function(t){t!=this.m_isSensor&&(this.m_body.setAwake(!0),this.m_isSensor=t)},t.prototype.getUserData=function(){return this.m_userData},t.prototype.setUserData=function(t){this.m_userData=t},t.prototype.getBody=function(){return this.m_body},t.prototype.getNext=function(){return this.m_next},t.prototype.getDensity=function(){return this.m_density},t.prototype.setDensity=function(t){this.m_density=t},t.prototype.getFriction=function(){return this.m_friction},t.prototype.setFriction=function(t){this.m_friction=t},t.prototype.getRestitution=function(){return this.m_restitution},t.prototype.setRestitution=function(t){this.m_restitution=t},t.prototype.testPoint=function(t){return this.m_shape.testPoint(this.m_body.getTransform(),t)},t.prototype.rayCast=function(t,e,i){return this.m_shape.rayCast(t,e,this.m_body.getTransform(),i)},t.prototype.getMassData=function(t){this.m_shape.computeMass(t,this.m_density)},t.prototype.getAABB=function(t){return this.m_proxies[t].aabb},t.prototype.createProxies=function(t,e){this.m_proxyCount=this.m_shape.getChildCount();for(var i=0;i<this.m_proxyCount;++i){var o=this.m_proxies[i];this.m_shape.computeAABB(o.aabb,e,i),o.proxyId=t.createProxy(o.aabb,o)}},t.prototype.destroyProxies=function(t){for(var e=0;e<this.m_proxyCount;++e){var i=this.m_proxies[e];t.destroyProxy(i.proxyId),i.proxyId=null}this.m_proxyCount=0},t.prototype.synchronize=function(t,e,i){for(var o=0;o<this.m_proxyCount;++o){var s=this.m_proxies[o],n=new _,r=new _;this.m_shape.computeAABB(n,e,s.childIndex),this.m_shape.computeAABB(r,i,s.childIndex),s.aabb.combine(n,r);var a=m.sub(i.p,e.p);t.moveProxy(s.proxyId,s.aabb,a)}},t.prototype.setFilterData=function(t){this.m_filterGroupIndex=t.groupIndex,this.m_filterCategoryBits=t.categoryBits,this.m_filterMaskBits=t.maskBits,this.refilter()},t.prototype.getFilterGroupIndex=function(){return this.m_filterGroupIndex},t.prototype.setFilterGroupIndex=function(t){return this.m_filterGroupIndex=t},t.prototype.getFilterCategoryBits=function(){return this.m_filterCategoryBits},t.prototype.setFilterCategoryBits=function(t){this.m_filterCategoryBits=t},t.prototype.getFilterMaskBits=function(){return this.m_filterMaskBits},t.prototype.setFilterMaskBits=function(t){this.m_filterMaskBits=t},t.prototype.refilter=function(){if(null!=this.m_body){for(var t=this.m_body.getContactList();t;){var e=t.contact,i=e.getFixtureA(),o=e.getFixtureB();i!=this&&o!=this||e.flagForFiltering(),t=t.next}var s=this.m_body.getWorld();if(null!=s)for(var n=s.m_broadPhase,r=0;r<this.m_proxyCount;++r)n.touchProxy(this.m_proxies[r].proxyId)}},t.prototype.shouldCollide=function(t){if(t.m_filterGroupIndex===this.m_filterGroupIndex&&0!==t.m_filterGroupIndex)return t.m_filterGroupIndex>0;var e=0!=(t.m_filterMaskBits&this.m_filterCategoryBits),i=0!=(t.m_filterCategoryBits&this.m_filterMaskBits);return e&&i},t}(),M="static",I="kinematic",S="dynamic",P={type:M,position:m.zero(),angle:0,linearVelocity:m.zero(),angularVelocity:0,linearDamping:0,angularDamping:0,fixedRotation:!1,bullet:!1,gravityScale:1,allowSleep:!0,awake:!0,active:!0,userData:null},z=function(){this.mass=0,this.center=m.zero(),this.I=0},T=function(){function t(t,e){e=s(e,P),this.m_world=t,this.m_awakeFlag=e.awake,this.m_autoSleepFlag=e.allowSleep,this.m_bulletFlag=e.bullet,this.m_fixedRotationFlag=e.fixedRotation,this.m_activeFlag=e.active,this.m_islandFlag=!1,this.m_toiFlag=!1,this.m_userData=e.userData,this.m_type=e.type,this.m_type==S?(this.m_mass=1,this.m_invMass=1):(this.m_mass=0,this.m_invMass=0),this.m_I=0,this.m_invI=0,this.m_xf=v.identity(),this.m_xf.p=m.clone(e.position),this.m_xf.q.setAngle(e.angle),this.m_sweep=new x,this.m_sweep.setTransform(this.m_xf),this.c_velocity=new g,this.c_position=new b,this.m_force=m.zero(),this.m_torque=0,this.m_linearVelocity=m.clone(e.linearVelocity),this.m_angularVelocity=e.angularVelocity,this.m_linearDamping=e.linearDamping,this.m_angularDamping=e.angularDamping,this.m_gravityScale=e.gravityScale,this.m_sleepTime=0,this.m_jointList=null,this.m_contactList=null,this.m_fixtureList=null,this.m_prev=null,this.m_next=null,this.m_destroyed=!1}return t.prototype._serialize=function(){for(var t=[],e=this.m_fixtureList;e;e=e.m_next)t.push(e);return{type:this.m_type,bullet:this.m_bulletFlag,position:this.m_xf.p,angle:this.m_xf.q.getAngle(),linearVelocity:this.m_linearVelocity,angularVelocity:this.m_angularVelocity,fixtures:t}},t._deserialize=function(e,i,o){var s=new t(i,e);if(e.fixtures)for(var n=e.fixtures.length-1;n>=0;n--){var r=o(C,e.fixtures[n],s);s._addFixture(r)}return s},t.prototype.isWorldLocked=function(){return!(!this.m_world||!this.m_world.isLocked())},t.prototype.getWorld=function(){return this.m_world},t.prototype.getNext=function(){return this.m_next},t.prototype.setUserData=function(t){this.m_userData=t},t.prototype.getUserData=function(){return this.m_userData},t.prototype.getFixtureList=function(){return this.m_fixtureList},t.prototype.getJointList=function(){return this.m_jointList},t.prototype.getContactList=function(){return this.m_contactList},t.prototype.isStatic=function(){return this.m_type==M},t.prototype.isDynamic=function(){return this.m_type==S},t.prototype.isKinematic=function(){return this.m_type==I},t.prototype.setStatic=function(){return this.setType(M),this},t.prototype.setDynamic=function(){return this.setType(S),this},t.prototype.setKinematic=function(){return this.setType(I),this},t.prototype.getType=function(){return this.m_type},t.prototype.setType=function(t){if(1!=this.isWorldLocked()&&this.m_type!=t){this.m_type=t,this.resetMassData(),this.m_type==M&&(this.m_linearVelocity.setZero(),this.m_angularVelocity=0,this.m_sweep.forward(),this.synchronizeFixtures()),this.setAwake(!0),this.m_force.setZero(),this.m_torque=0;for(var e=this.m_contactList;e;){var i=e;e=e.next,this.m_world.destroyContact(i.contact)}this.m_contactList=null;for(var o=this.m_world.m_broadPhase,s=this.m_fixtureList;s;s=s.m_next)for(var n=s.m_proxyCount,r=0;r<n;++r)o.touchProxy(s.m_proxies[r].proxyId)}},t.prototype.isBullet=function(){return this.m_bulletFlag},t.prototype.setBullet=function(t){this.m_bulletFlag=!!t},t.prototype.isSleepingAllowed=function(){return this.m_autoSleepFlag},t.prototype.setSleepingAllowed=function(t){this.m_autoSleepFlag=!!t,0==this.m_autoSleepFlag&&this.setAwake(!0)},t.prototype.isAwake=function(){return this.m_awakeFlag},t.prototype.setAwake=function(t){t?0==this.m_awakeFlag&&(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.setZero(),this.m_angularVelocity=0,this.m_force.setZero(),this.m_torque=0)},t.prototype.isActive=function(){return this.m_activeFlag},t.prototype.setActive=function(t){if(t!=this.m_activeFlag)if(this.m_activeFlag=!!t,this.m_activeFlag)for(var e=this.m_world.m_broadPhase,i=this.m_fixtureList;i;i=i.m_next)i.createProxies(e,this.m_xf);else{for(e=this.m_world.m_broadPhase,i=this.m_fixtureList;i;i=i.m_next)i.destroyProxies(e);for(var o=this.m_contactList;o;){var s=o;o=o.next,this.m_world.destroyContact(s.contact)}this.m_contactList=null}},t.prototype.isFixedRotation=function(){return this.m_fixedRotationFlag},t.prototype.setFixedRotation=function(t){this.m_fixedRotationFlag!=t&&(this.m_fixedRotationFlag=!!t,this.m_angularVelocity=0,this.resetMassData())},t.prototype.getTransform=function(){return this.m_xf},t.prototype.setTransform=function(t,e){if(1!=this.isWorldLocked()){this.m_xf.set(t,e),this.m_sweep.setTransform(this.m_xf);for(var i=this.m_world.m_broadPhase,o=this.m_fixtureList;o;o=o.m_next)o.synchronize(i,this.m_xf,this.m_xf)}},t.prototype.synchronizeTransform=function(){this.m_sweep.getTransform(this.m_xf,1)},t.prototype.synchronizeFixtures=function(){var t=v.identity();this.m_sweep.getTransform(t,0);for(var e=this.m_world.m_broadPhase,i=this.m_fixtureList;i;i=i.m_next)i.synchronize(e,t,this.m_xf)},t.prototype.advance=function(t){this.m_sweep.advance(t),this.m_sweep.c.set(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_sweep.getTransform(this.m_xf,1)},t.prototype.getPosition=function(){return this.m_xf.p},t.prototype.setPosition=function(t){this.setTransform(t,this.m_sweep.a)},t.prototype.getAngle=function(){return this.m_sweep.a},t.prototype.setAngle=function(t){this.setTransform(this.m_xf.p,t)},t.prototype.getWorldCenter=function(){return this.m_sweep.c},t.prototype.getLocalCenter=function(){return this.m_sweep.localCenter},t.prototype.getLinearVelocity=function(){return this.m_linearVelocity},t.prototype.getLinearVelocityFromWorldPoint=function(t){var e=m.sub(t,this.m_sweep.c);return m.add(this.m_linearVelocity,m.cross(this.m_angularVelocity,e))},t.prototype.getLinearVelocityFromLocalPoint=function(t){return this.getLinearVelocityFromWorldPoint(this.getWorldPoint(t))},t.prototype.setLinearVelocity=function(t){this.m_type!=M&&(m.dot(t,t)>0&&this.setAwake(!0),this.m_linearVelocity.set(t))},t.prototype.getAngularVelocity=function(){return this.m_angularVelocity},t.prototype.setAngularVelocity=function(t){this.m_type!=M&&(t*t>0&&this.setAwake(!0),this.m_angularVelocity=t)},t.prototype.getLinearDamping=function(){return this.m_linearDamping},t.prototype.setLinearDamping=function(t){this.m_linearDamping=t},t.prototype.getAngularDamping=function(){return this.m_angularDamping},t.prototype.setAngularDamping=function(t){this.m_angularDamping=t},t.prototype.getGravityScale=function(){return this.m_gravityScale},t.prototype.setGravityScale=function(t){this.m_gravityScale=t},t.prototype.getMass=function(){return this.m_mass},t.prototype.getInertia=function(){return this.m_I+this.m_mass*m.dot(this.m_sweep.localCenter,this.m_sweep.localCenter)},t.prototype.getMassData=function(t){t.mass=this.m_mass,t.I=this.getInertia(),t.center.set(this.m_sweep.localCenter)},t.prototype.resetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.setZero(),this.isStatic()||this.isKinematic())return this.m_sweep.c0.set(this.m_xf.p),this.m_sweep.c.set(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var t=m.zero(),e=this.m_fixtureList;e;e=e.m_next)if(0!=e.m_density){var i=new z;e.getMassData(i),this.m_mass+=i.mass,t.addMul(i.mass,i.center),this.m_I+=i.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,t.mul(this.m_invMass)):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&0==this.m_fixedRotationFlag?(this.m_I-=this.m_mass*m.dot(t,t),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var o=m.clone(this.m_sweep.c);this.m_sweep.setLocalCenter(t,this.m_xf),this.m_linearVelocity.add(m.cross(this.m_angularVelocity,m.sub(this.m_sweep.c,o)))},t.prototype.setMassData=function(t){if(1!=this.isWorldLocked()&&this.m_type==S){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=t.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,t.I>0&&0==this.m_fixedRotationFlag&&(this.m_I=t.I-this.m_mass*m.dot(t.center,t.center),this.m_invI=1/this.m_I);var e=m.clone(this.m_sweep.c);this.m_sweep.setLocalCenter(t.center,this.m_xf),this.m_linearVelocity.add(m.cross(this.m_angularVelocity,m.sub(this.m_sweep.c,e)))}},t.prototype.applyForce=function(t,e,i){this.m_type==S&&(i&&0==this.m_awakeFlag&&this.setAwake(!0),this.m_awakeFlag&&(this.m_force.add(t),this.m_torque+=m.cross(m.sub(e,this.m_sweep.c),t)))},t.prototype.applyForceToCenter=function(t,e){this.m_type==S&&(e&&0==this.m_awakeFlag&&this.setAwake(!0),this.m_awakeFlag&&this.m_force.add(t))},t.prototype.applyTorque=function(t,e){this.m_type==S&&(e&&0==this.m_awakeFlag&&this.setAwake(!0),this.m_awakeFlag&&(this.m_torque+=t))},t.prototype.applyLinearImpulse=function(t,e,i){this.m_type==S&&(i&&0==this.m_awakeFlag&&this.setAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.addMul(this.m_invMass,t),this.m_angularVelocity+=this.m_invI*m.cross(m.sub(e,this.m_sweep.c),t)))},t.prototype.applyAngularImpulse=function(t,e){this.m_type==S&&(e&&0==this.m_awakeFlag&&this.setAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*t))},t.prototype.shouldCollide=function(t){if(this.m_type!=S&&t.m_type!=S)return!1;for(var e=this.m_jointList;e;e=e.next)if(e.other==t&&0==e.joint.m_collideConnected)return!1;return!0},t.prototype._addFixture=function(t){if(1==this.isWorldLocked())return null;if(this.m_activeFlag){var e=this.m_world.m_broadPhase;t.createProxies(e,this.m_xf)}return t.m_next=this.m_fixtureList,this.m_fixtureList=t,t.m_density>0&&this.resetMassData(),this.m_world.m_newFixture=!0,t},t.prototype.createFixture=function(t,e){if(1==this.isWorldLocked())return null;var i=new C(this,t,e);return this._addFixture(i),i},t.prototype.destroyFixture=function(t){if(1!=this.isWorldLocked()){if(this.m_fixtureList===t)this.m_fixtureList=t.m_next;else for(var e=this.m_fixtureList;null!=e;){if(e.m_next===t){e.m_next=t.m_next;break}e=e.m_next}for(var i=this.m_contactList;i;){var o=i.contact;i=i.next;var s=o.getFixtureA(),n=o.getFixtureB();t!=s&&t!=n||this.m_world.destroyContact(o)}if(this.m_activeFlag){var r=this.m_world.m_broadPhase;t.destroyProxies(r)}t.m_body=null,t.m_next=null,this.m_world.publish("remove-fixture",t),this.resetMassData()}},t.prototype.getWorldPoint=function(t){return v.mulVec2(this.m_xf,t)},t.prototype.getWorldVector=function(t){return f.mulVec2(this.m_xf.q,t)},t.prototype.getLocalPoint=function(t){return v.mulTVec2(this.m_xf,t)},t.prototype.getLocalVector=function(t){return f.mulTVec2(this.m_xf.q,t)},t.STATIC=M,t.KINEMATIC=I,t.DYNAMIC=S,t}(),V=function(){function t(t,e,i,o){"object"==typeof t&&null!==t?(this.ex=m.clone(t),this.ey=m.clone(e)):"number"==typeof t?(this.ex=m.neo(t,i),this.ey=m.neo(e,o)):(this.ex=m.zero(),this.ey=m.zero())}return t.prototype.toString=function(){return JSON.stringify(this)},t.isValid=function(t){return t&&m.isValid(t.ex)&&m.isValid(t.ey)},t.assert=function(t){},t.prototype.set=function(t,e,i,o){"number"==typeof t&&"number"==typeof e&&"number"==typeof i&&"number"==typeof o?(this.ex.set(t,i),this.ey.set(e,o)):"object"==typeof t&&"object"==typeof e?(this.ex.set(t),this.ey.set(e)):"object"==typeof t&&(this.ex.set(t.ex),this.ey.set(t.ey))},t.prototype.setIdentity=function(){this.ex.x=1,this.ey.x=0,this.ex.y=0,this.ey.y=1},t.prototype.setZero=function(){this.ex.x=0,this.ey.x=0,this.ex.y=0,this.ey.y=0},t.prototype.getInverse=function(){var e=this.ex.x,i=this.ey.x,o=this.ex.y,s=this.ey.y,n=e*s-i*o;0!==n&&(n=1/n);var r=new t;return r.ex.x=n*s,r.ey.x=-n*i,r.ex.y=-n*o,r.ey.y=n*e,r},t.prototype.solve=function(t){var e=this.ex.x,i=this.ey.x,o=this.ex.y,s=this.ey.y,n=e*s-i*o;0!==n&&(n=1/n);var r=m.zero();return r.x=n*(s*t.x-i*t.y),r.y=n*(e*t.y-o*t.x),r},t.mul=function(e,i){if(i&&"x"in i&&"y"in i){var o=e.ex.x*i.x+e.ey.x*i.y,s=e.ex.y*i.x+e.ey.y*i.y;return m.neo(o,s)}if(i&&"ex"in i&&"ey"in i)return new t(e.ex.x*i.ex.x+e.ey.x*i.ex.y,e.ex.x*i.ey.x+e.ey.x*i.ey.y,e.ex.y*i.ex.x+e.ey.y*i.ex.y,e.ex.y*i.ey.x+e.ey.y*i.ey.y)},t.mulVec2=function(t,e){var i=t.ex.x*e.x+t.ey.x*e.y,o=t.ex.y*e.x+t.ey.y*e.y;return m.neo(i,o)},t.mulMat22=function(e,i){return new t(e.ex.x*i.ex.x+e.ey.x*i.ex.y,e.ex.x*i.ey.x+e.ey.x*i.ey.y,e.ex.y*i.ex.x+e.ey.y*i.ex.y,e.ex.y*i.ey.x+e.ey.y*i.ey.y)},t.mulT=function(e,i){return i&&"x"in i&&"y"in i?m.neo(m.dot(i,e.ex),m.dot(i,e.ey)):i&&"ex"in i&&"ey"in i?new t(m.neo(m.dot(e.ex,i.ex),m.dot(e.ey,i.ex)),m.neo(m.dot(e.ex,i.ey),m.dot(e.ey,i.ey))):void 0},t.mulTVec2=function(t,e){return m.neo(m.dot(e,t.ex),m.dot(e,t.ey))},t.mulTMat22=function(e,i){return new t(m.neo(m.dot(e.ex,i.ex),m.dot(e.ey,i.ex)),m.neo(m.dot(e.ex,i.ey),m.dot(e.ey,i.ey)))},t.abs=function(e){return new t(m.abs(e.ex),m.abs(e.ey))},t.add=function(e,i){return new t(m.add(e.ex,i.ex),m.add(e.ey,i.ey))},t}();!function(t){t[t.e_circles=0]="e_circles",t[t.e_faceA=1]="e_faceA",t[t.e_faceB=2]="e_faceB"}(a||(a={})),function(t){t[t.e_vertex=0]="e_vertex",t[t.e_face=1]="e_face"}(h||(h={}));var k,L=function(){function t(){this.localNormal=m.zero(),this.localPoint=m.zero(),this.points=[new F,new F],this.pointCount=0}return t.prototype.getWorldManifold=function(t,e,i,o,s){if(0!=this.pointCount){var n=(t=t||new E).normal,h=t.points,_=t.separations;switch(this.type){case a.e_circles:n=m.neo(1,0);var c=v.mulVec2(e,this.localPoint),l=v.mulVec2(o,this.points[0].localPoint),u=m.sub(l,c);m.lengthSquared(u)>r.EPSILON*r.EPSILON&&(n.set(u),n.normalize());var p=c.clone().addMul(i,n),d=l.clone().addMul(-s,n);h[0]=m.mid(p,d),_[0]=m.dot(m.sub(d,p),n),h.length=1,_.length=1;break;case a.e_faceA:n=f.mulVec2(e.q,this.localNormal);for(var y=v.mulVec2(e,this.localPoint),x=0;x<this.pointCount;++x){var g=v.mulVec2(o,this.points[x].localPoint);p=m.clone(g).addMul(i-m.dot(m.sub(g,y),n),n),d=m.clone(g).subMul(s,n);h[x]=m.mid(p,d),_[x]=m.dot(m.sub(d,p),n)}h.length=this.pointCount,_.length=this.pointCount;break;case a.e_faceB:n=f.mulVec2(o.q,this.localNormal);for(y=v.mulVec2(o,this.localPoint),x=0;x<this.pointCount;++x){g=v.mulVec2(e,this.points[x].localPoint),d=m.combine(1,g,s-m.dot(m.sub(g,y),n),n),p=m.combine(1,g,-i,n);h[x]=m.mid(p,d),_[x]=m.dot(m.sub(p,d),n)}h.length=this.pointCount,_.length=this.pointCount,n.mul(-1)}return t.normal=n,t.points=h,t.separations=_,t}},t}(),F=function(){this.localPoint=m.zero(),this.normalImpulse=0,this.tangentImpulse=0,this.id=new q},q=function(){function t(){this.cf=new j}return Object.defineProperty(t.prototype,"key",{get:function(){return this.cf.indexA+4*this.cf.indexB+16*this.cf.typeA+64*this.cf.typeB},enumerable:!1,configurable:!0}),t.prototype.set=function(t){this.cf.set(t.cf)},t}(),j=function(){function t(){}return t.prototype.set=function(t){this.indexA=t.indexA,this.indexB=t.indexB,this.typeA=t.typeA,this.typeB=t.typeB},t}(),E=function(){this.points=[],this.separations=[]};function Y(t,e,i,o){for(var s=0;s<i.pointCount;++s){var n=i.points[s].id;t[s]=k.removeState;for(var r=0;r<o.pointCount;++r)if(o.points[r].id.key==n.key){t[s]=k.persistState;break}}for(s=0;s<o.pointCount;++s){n=o.points[s].id;e[s]=k.addState;for(r=0;r<i.pointCount;++r)if(i.points[r].id.key==n.key){e[s]=k.persistState;break}}}!function(t){t[t.nullState=0]="nullState",t[t.addState=1]="addState",t[t.persistState=2]="persistState",t[t.removeState=3]="removeState"}(k||(k={}));var D=function(){function t(){this.v=m.zero(),this.id=new q}return t.prototype.set=function(t){this.v.set(t.v),this.id.set(t.id)},t}();function R(t,e,i,o,s){var n=0,r=m.dot(i,e[0].v)-o,a=m.dot(i,e[1].v)-o;if(r<=0&&t[n++].set(e[0]),a<=0&&t[n++].set(e[1]),r*a<0){var _=r/(r-a);t[n].v.setCombine(1-_,e[0].v,_,e[1].v),t[n].id.cf.indexA=s,t[n].id.cf.indexB=e[0].id.cf.indexB,t[n].id.cf.typeA=h.e_vertex,t[n].id.cf.typeB=h.e_face,++n}return n}var O={gjkCalls:0,gjkIters:0,gjkMaxIters:0,toiTime:0,toiMaxTime:0,toiCalls:0,toiIters:0,toiMaxIters:0,toiRootIters:0,toiMaxRootIters:0,toString:function(t){t="string"==typeof t?t:"\n";var e="";for(var i in this)"function"!=typeof this[i]&&"object"!=typeof this[i]&&(e+=i+": "+this[i]+t);return e}};O.gjkCalls=0,O.gjkIters=0,O.gjkMaxIters=0;var X=function(){this.proxyA=new H,this.proxyB=new H,this.transformA=null,this.transformB=null,this.useRadii=!1},J=function(){this.pointA=m.zero(),this.pointB=m.zero()},N=function(){this.metric=0,this.indexA=[],this.indexB=[],this.count=0};function W(t,e,i){++O.gjkCalls;var o=i.proxyA,s=i.proxyB,n=i.transformA,a=i.transformB,h=new K;h.readCache(e,o,n,s,a);for(var _=h.m_v,l=c.maxDistnceIterations,u=[],p=[],d=0,y=0;y<l;){d=h.m_count;for(var x=0;x<d;++x)u[x]=_[x].indexA,p[x]=_[x].indexB;if(h.solve(),3===h.m_count)break;(M=h.getClosestPoint()).lengthSquared();var g=h.getSearchDirection();if(g.lengthSquared()<r.EPSILON*r.EPSILON)break;var b=_[h.m_count];b.indexA=o.getSupport(f.mulTVec2(n.q,m.neg(g))),b.wA=v.mulVec2(n,o.getVertex(b.indexA)),b.indexB=s.getSupport(f.mulTVec2(a.q,g)),b.wB=v.mulVec2(a,s.getVertex(b.indexB)),b.w=m.sub(b.wB,b.wA),++y,++O.gjkIters;var A=!1;for(x=0;x<d;++x)if(b.indexA===u[x]&&b.indexB===p[x]){A=!0;break}if(A)break;++h.m_count}if(O.gjkMaxIters=r.max(O.gjkMaxIters,y),h.getWitnessPoints(t.pointA,t.pointB),t.distance=m.distance(t.pointA,t.pointB),t.iterations=y,h.writeCache(e),i.useRadii){var B=o.m_radius,w=s.m_radius;if(t.distance>B+w&&t.distance>r.EPSILON){t.distance-=B+w;var C=m.sub(t.pointB,t.pointA);C.normalize(),t.pointA.addMul(B,C),t.pointB.subMul(w,C)}else{var M=m.mid(t.pointA,t.pointB);t.pointA.set(M),t.pointB.set(M),t.distance=0}}}var H=function(){function t(){this.m_buffer=[],this.m_vertices=[],this.m_count=0,this.m_radius=0}return t.prototype.getVertexCount=function(){return this.m_count},t.prototype.getVertex=function(t){return this.m_vertices[t]},t.prototype.getSupport=function(t){for(var e=0,i=m.dot(this.m_vertices[0],t),o=0;o<this.m_count;++o){var s=m.dot(this.m_vertices[o],t);s>i&&(e=o,i=s)}return e},t.prototype.getSupportVertex=function(t){return this.m_vertices[this.getSupport(t)]},t.prototype.set=function(t,e){t.computeDistanceProxy(this,e)},t}(),Z=function(){function t(){this.wA=m.zero(),this.wB=m.zero(),this.w=m.zero()}return t.prototype.set=function(t){this.indexA=t.indexA,this.indexB=t.indexB,this.wA=m.clone(t.wA),this.wB=m.clone(t.wB),this.w=m.clone(t.w),this.a=t.a},t}(),K=function(){function t(){this.m_v1=new Z,this.m_v2=new Z,this.m_v3=new Z,this.m_v=[this.m_v1,this.m_v2,this.m_v3],this.m_count}return t.prototype.print=function(){return 3===this.m_count?["+"+this.m_count,this.m_v1.a,this.m_v1.wA.x,this.m_v1.wA.y,this.m_v1.wB.x,this.m_v1.wB.y,this.m_v2.a,this.m_v2.wA.x,this.m_v2.wA.y,this.m_v2.wB.x,this.m_v2.wB.y,this.m_v3.a,this.m_v3.wA.x,this.m_v3.wA.y,this.m_v3.wB.x,this.m_v3.wB.y].toString():2===this.m_count?["+"+this.m_count,this.m_v1.a,this.m_v1.wA.x,this.m_v1.wA.y,this.m_v1.wB.x,this.m_v1.wB.y,this.m_v2.a,this.m_v2.wA.x,this.m_v2.wA.y,this.m_v2.wB.x,this.m_v2.wB.y].toString():1===this.m_count?["+"+this.m_count,this.m_v1.a,this.m_v1.wA.x,this.m_v1.wA.y,this.m_v1.wB.x,this.m_v1.wB.y].toString():"+"+this.m_count},t.prototype.readCache=function(t,e,i,o,s){this.m_count=t.count;for(var n=0;n<this.m_count;++n){(l=this.m_v[n]).indexA=t.indexA[n],l.indexB=t.indexB[n];var a=e.getVertex(l.indexA),h=o.getVertex(l.indexB);l.wA=v.mulVec2(i,a),l.wB=v.mulVec2(s,h),l.w=m.sub(l.wB,l.wA),l.a=0}if(this.m_count>1){var _=t.metric,c=this.getMetric();(c<.5*_||2*_<c||c<r.EPSILON)&&(this.m_count=0)}if(0===this.m_count){var l;(l=this.m_v[0]).indexA=0,l.indexB=0;a=e.getVertex(0),h=o.getVertex(0);l.wA=v.mulVec2(i,a),l.wB=v.mulVec2(s,h),l.w=m.sub(l.wB,l.wA),l.a=1,this.m_count=1}},t.prototype.writeCache=function(t){t.metric=this.getMetric(),t.count=this.m_count;for(var e=0;e<this.m_count;++e)t.indexA[e]=this.m_v[e].indexA,t.indexB[e]=this.m_v[e].indexB},t.prototype.getSearchDirection=function(){switch(this.m_count){case 1:return m.neg(this.m_v1.w);case 2:var t=m.sub(this.m_v2.w,this.m_v1.w);return m.cross(t,m.neg(this.m_v1.w))>0?m.cross(1,t):m.cross(t,1);default:return m.zero()}},t.prototype.getClosestPoint=function(){switch(this.m_count){case 0:return m.zero();case 1:return m.clone(this.m_v1.w);case 2:return m.combine(this.m_v1.a,this.m_v1.w,this.m_v2.a,this.m_v2.w);case 3:default:return m.zero()}},t.prototype.getWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.set(this.m_v1.wA),e.set(this.m_v1.wB);break;case 2:t.setCombine(this.m_v1.a,this.m_v1.wA,this.m_v2.a,this.m_v2.wA),e.setCombine(this.m_v1.a,this.m_v1.wB,this.m_v2.a,this.m_v2.wB);break;case 3:t.setCombine(this.m_v1.a,this.m_v1.wA,this.m_v2.a,this.m_v2.wA),t.addMul(this.m_v3.a,this.m_v3.wA),e.set(t)}},t.prototype.getMetric=function(){switch(this.m_count){case 0:case 1:return 0;case 2:return m.distance(this.m_v1.w,this.m_v2.w);case 3:return m.cross(m.sub(this.m_v2.w,this.m_v1.w),m.sub(this.m_v3.w,this.m_v1.w));default:return 0}},t.prototype.solve=function(){switch(this.m_count){case 1:break;case 2:this.solve2();break;case 3:this.solve3()}},t.prototype.solve2=function(){var t=this.m_v1.w,e=this.m_v2.w,i=m.sub(e,t),o=-m.dot(t,i);if(o<=0)return this.m_v1.a=1,void(this.m_count=1);var s=m.dot(e,i);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.set(this.m_v2);var n=1/(s+o);this.m_v1.a=s*n,this.m_v2.a=o*n,this.m_count=2},t.prototype.solve3=function(){var t=this.m_v1.w,e=this.m_v2.w,i=this.m_v3.w,o=m.sub(e,t),s=m.dot(t,o),n=m.dot(e,o),r=-s,a=m.sub(i,t),h=m.dot(t,a),_=m.dot(i,a),c=-h,l=m.sub(i,e),u=m.dot(e,l),p=m.dot(i,l),d=-u,y=m.cross(o,a),f=y*m.cross(e,i),v=y*m.cross(i,t),x=y*m.cross(t,e);if(r<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(n>0&&r>0&&x<=0){var g=1/(n+r);return this.m_v1.a=n*g,this.m_v2.a=r*g,void(this.m_count=2)}if(_>0&&c>0&&v<=0){var b=1/(_+c);return this.m_v1.a=_*b,this.m_v3.a=c*b,this.m_count=2,void this.m_v2.set(this.m_v3)}if(n<=0&&d<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.set(this.m_v2);if(_<=0&&p<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.set(this.m_v3);if(p>0&&d>0&&f<=0){var A=1/(p+d);return this.m_v2.a=p*A,this.m_v3.a=d*A,this.m_count=2,void this.m_v1.set(this.m_v3)}var B=1/(f+v+x);this.m_v1.a=f*B,this.m_v2.a=v*B,this.m_v3.a=x*B,this.m_count=3},t}();function G(t,e,i,o,s,n){var a=new X;a.proxyA.set(t,e),a.proxyB.set(i,o),a.transformA=s,a.transformB=n,a.useRadii=!0;var h=new N,m=new J;return W(m,h,a),m.distance<10*r.EPSILON}var U=function(t){this.contact=t};function $(t,e){return r.sqrt(t*e)}function Q(t,e){return t>e?t:e}var tt,et=[],it=function(){this.rA=m.zero(),this.rB=m.zero(),this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0},ot=function(){function t(t,e,i,o,s){this.m_manifold=new L,this.m_prev=null,this.m_next=null,this.m_toi=1,this.m_toiCount=0,this.m_toiFlag=!1,this.m_tangentSpeed=0,this.m_enabledFlag=!0,this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_impulse=new dt(this),this.v_points=[],this.v_normal=m.zero(),this.v_normalMass=new V,this.v_K=new V,this.p_localPoints=[],this.p_localNormal=m.zero(),this.p_localPoint=m.zero(),this.p_localCenterA=m.zero(),this.p_localCenterB=m.zero(),this.m_nodeA=new U(this),this.m_nodeB=new U(this),this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=o,this.m_evaluateFcn=s,this.m_friction=$(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=Q(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)}return t.prototype.initConstraint=function(t){var e=this.m_fixtureA,i=this.m_fixtureB,o=e.getShape(),s=i.getShape(),n=e.getBody(),r=i.getBody(),a=this.getManifold(),h=a.pointCount;this.v_invMassA=n.m_invMass,this.v_invMassB=r.m_invMass,this.v_invIA=n.m_invI,this.v_invIB=r.m_invI,this.v_friction=this.m_friction,this.v_restitution=this.m_restitution,this.v_tangentSpeed=this.m_tangentSpeed,this.v_pointCount=h,this.v_K.setZero(),this.v_normalMass.setZero(),this.p_invMassA=n.m_invMass,this.p_invMassB=r.m_invMass,this.p_invIA=n.m_invI,this.p_invIB=r.m_invI,this.p_localCenterA=m.clone(n.m_sweep.localCenter),this.p_localCenterB=m.clone(r.m_sweep.localCenter),this.p_radiusA=o.m_radius,this.p_radiusB=s.m_radius,this.p_type=a.type,this.p_localNormal=m.clone(a.localNormal),this.p_localPoint=m.clone(a.localPoint),this.p_pointCount=h;for(var _=0;_<h;++_){var c=a.points[_],l=this.v_points[_]=new it;t.warmStarting?(l.normalImpulse=t.dtRatio*c.normalImpulse,l.tangentImpulse=t.dtRatio*c.tangentImpulse):(l.normalImpulse=0,l.tangentImpulse=0),l.rA.setZero(),l.rB.setZero(),l.normalMass=0,l.tangentMass=0,l.velocityBias=0,this.p_localPoints[_]=m.clone(c.localPoint)}},t.prototype.getManifold=function(){return this.m_manifold},t.prototype.getWorldManifold=function(t){var e=this.m_fixtureA.getBody(),i=this.m_fixtureB.getBody(),o=this.m_fixtureA.getShape(),s=this.m_fixtureB.getShape();return this.m_manifold.getWorldManifold(t,e.getTransform(),o.m_radius,i.getTransform(),s.m_radius)},t.prototype.setEnabled=function(t){this.m_enabledFlag=!!t},t.prototype.isEnabled=function(){return this.m_enabledFlag},t.prototype.isTouching=function(){return this.m_touchingFlag},t.prototype.getNext=function(){return this.m_next},t.prototype.getFixtureA=function(){return this.m_fixtureA},t.prototype.getFixtureB=function(){return this.m_fixtureB},t.prototype.getChildIndexA=function(){return this.m_indexA},t.prototype.getChildIndexB=function(){return this.m_indexB},t.prototype.flagForFiltering=function(){this.m_filterFlag=!0},t.prototype.setFriction=function(t){this.m_friction=t},t.prototype.getFriction=function(){return this.m_friction},t.prototype.resetFriction=function(){this.m_friction=$(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},t.prototype.setRestitution=function(t){this.m_restitution=t},t.prototype.getRestitution=function(){return this.m_restitution},t.prototype.resetRestitution=function(){this.m_restitution=Q(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},t.prototype.setTangentSpeed=function(t){this.m_tangentSpeed=t},t.prototype.getTangentSpeed=function(){return this.m_tangentSpeed},t.prototype.evaluate=function(t,e,i){this.m_evaluateFcn(t,e,this.m_fixtureA,this.m_indexA,i,this.m_fixtureB,this.m_indexB)},t.prototype.update=function(t){this.m_enabledFlag=!0;var e,i=!1,o=this.m_touchingFlag,s=this.m_fixtureA.isSensor(),n=this.m_fixtureB.isSensor(),r=s||n,a=this.m_fixtureA.getBody(),h=this.m_fixtureB.getBody(),m=a.getTransform(),_=h.getTransform();if(r){var c=this.m_fixtureA.getShape(),l=this.m_fixtureB.getShape();i=G(c,this.m_indexA,l,this.m_indexB,m,_),this.m_manifold.pointCount=0}else{e=this.m_manifold,this.m_manifold=new L,this.evaluate(this.m_manifold,m,_),i=this.m_manifold.pointCount>0;for(var u=0;u<this.m_manifold.pointCount;++u){var p=this.m_manifold.points[u];p.normalImpulse=0,p.tangentImpulse=0;for(var d=0;d<e.pointCount;++d){var y=e.points[d];if(y.id.key==p.id.key){p.normalImpulse=y.normalImpulse,p.tangentImpulse=y.tangentImpulse;break}}}i!=o&&(a.setAwake(!0),h.setAwake(!0))}this.m_touchingFlag=i,!o&&i&&t&&t.beginContact(this),o&&!i&&t&&t.endContact(this),!r&&i&&t&&t.preSolve(this,e)},t.prototype.solvePositionConstraint=function(t){return this._solvePositionConstraint(t)},t.prototype.solvePositionConstraintTOI=function(t,e,i){return this._solvePositionConstraint(t,e,i)},t.prototype._solvePositionConstraint=function(t,e,i){var o=!!e&&!!i,s=this.m_fixtureA,n=this.m_fixtureB,h=s.getBody(),_=n.getBody();h.c_velocity,_.c_velocity;var l=h.c_position,u=_.c_position,p=m.clone(this.p_localCenterA),d=m.clone(this.p_localCenterB),y=0,x=0;o&&h!=e&&h!=i||(y=this.p_invMassA,x=this.p_invIA);var g=0,b=0;o&&_!=e&&_!=i||(g=this.p_invMassB,b=this.p_invIB);for(var A=m.clone(l.c),B=l.a,w=m.clone(u.c),C=u.a,M=0,I=0;I<this.p_pointCount;++I){var S=v.identity(),P=v.identity();S.q.set(B),P.q.set(C),S.p=m.sub(A,f.mulVec2(S.q,p)),P.p=m.sub(w,f.mulVec2(P.q,d));var z=void 0,T=void 0,V=void 0;switch(this.p_type){case a.e_circles:var k=v.mulVec2(S,this.p_localPoint),L=v.mulVec2(P,this.p_localPoints[0]);(z=m.sub(L,k)).normalize(),T=m.combine(.5,k,.5,L),V=m.dot(m.sub(L,k),z)-this.p_radiusA-this.p_radiusB;break;case a.e_faceA:z=f.mulVec2(S.q,this.p_localNormal);var F=v.mulVec2(S,this.p_localPoint),q=v.mulVec2(P,this.p_localPoints[I]);V=m.dot(m.sub(q,F),z)-this.p_radiusA-this.p_radiusB,T=q;break;case a.e_faceB:z=f.mulVec2(P.q,this.p_localNormal);F=v.mulVec2(P,this.p_localPoint),q=v.mulVec2(S,this.p_localPoints[I]);V=m.dot(m.sub(q,F),z)-this.p_radiusA-this.p_radiusB,T=q,z.mul(-1)}var j=m.sub(T,A),E=m.sub(T,w);M=r.min(M,V);var Y=o?c.toiBaugarte:c.baumgarte,D=c.linearSlop,R=c.maxLinearCorrection,O=r.clamp(Y*(V+D),-R,0),X=m.cross(j,z),J=m.cross(E,z),N=y+g+x*X*X+b*J*J,W=N>0?-O/N:0,H=m.mul(W,z);A.subMul(y,H),B-=x*m.cross(j,H),w.addMul(g,H),C+=b*m.cross(E,H)}return l.c.set(A),l.a=B,u.c.set(w),u.a=C,M},t.prototype.initVelocityConstraint=function(t){var e=this.m_fixtureA,i=this.m_fixtureB,o=e.getBody(),s=i.getBody(),n=o.c_velocity,r=s.c_velocity,a=o.c_position,h=s.c_position,_=this.p_radiusA,l=this.p_radiusB,u=this.getManifold(),p=this.v_invMassA,d=this.v_invMassB,y=this.v_invIA,x=this.v_invIB,g=m.clone(this.p_localCenterA),b=m.clone(this.p_localCenterB),A=m.clone(a.c),B=a.a,w=m.clone(n.v),C=n.w,M=m.clone(h.c),I=h.a,S=m.clone(r.v),P=r.w,z=v.identity(),T=v.identity();z.q.set(B),T.q.set(I),z.p.setCombine(1,A,-1,f.mulVec2(z.q,g)),T.p.setCombine(1,M,-1,f.mulVec2(T.q,b));var V=u.getWorldManifold(null,z,_,T,l);this.v_normal.set(V.normal);for(var k=0;k<this.v_pointCount;++k){var L=this.v_points[k];L.rA.set(m.sub(V.points[k],A)),L.rB.set(m.sub(V.points[k],M));var F=m.cross(L.rA,this.v_normal),q=m.cross(L.rB,this.v_normal),j=p+d+y*F*F+x*q*q;L.normalMass=j>0?1/j:0;var E=m.cross(this.v_normal,1),Y=m.cross(L.rA,E),D=m.cross(L.rB,E),R=p+d+y*Y*Y+x*D*D;L.tangentMass=R>0?1/R:0,L.velocityBias=0;var O=m.dot(this.v_normal,S)+m.dot(this.v_normal,m.cross(P,L.rB))-m.dot(this.v_normal,w)-m.dot(this.v_normal,m.cross(C,L.rA));O<-c.velocityThreshold&&(L.velocityBias=-this.v_restitution*O)}if(2==this.v_pointCount&&t.blockSolve){var X=this.v_points[0],J=this.v_points[1],N=m.cross(X.rA,this.v_normal),W=m.cross(X.rB,this.v_normal),H=m.cross(J.rA,this.v_normal),Z=m.cross(J.rB,this.v_normal),K=p+d+y*N*N+x*W*W,G=p+d+y*H*H+x*Z*Z,U=p+d+y*N*H+x*W*Z;K*K<1e3*(K*G-U*U)?(this.v_K.ex.set(K,U),this.v_K.ey.set(U,G),this.v_normalMass.set(this.v_K.getInverse())):this.v_pointCount=1}a.c.set(A),a.a=B,n.v.set(w),n.w=C,h.c.set(M),h.a=I,r.v.set(S),r.w=P},t.prototype.warmStartConstraint=function(t){var e=this.m_fixtureA,i=this.m_fixtureB,o=e.getBody(),s=i.getBody(),n=o.c_velocity,r=s.c_velocity;o.c_position,s.c_position;for(var a=this.v_invMassA,h=this.v_invIA,_=this.v_invMassB,c=this.v_invIB,l=m.clone(n.v),u=n.w,p=m.clone(r.v),d=r.w,y=this.v_normal,f=m.cross(y,1),v=0;v<this.v_pointCount;++v){var x=this.v_points[v],g=m.combine(x.normalImpulse,y,x.tangentImpulse,f);u-=h*m.cross(x.rA,g),l.subMul(a,g),d+=c*m.cross(x.rB,g),p.addMul(_,g)}n.v.set(l),n.w=u,r.v.set(p),r.w=d},t.prototype.storeConstraintImpulses=function(t){for(var e=this.m_manifold,i=0;i<this.v_pointCount;++i)e.points[i].normalImpulse=this.v_points[i].normalImpulse,e.points[i].tangentImpulse=this.v_points[i].tangentImpulse},t.prototype.solveVelocityConstraint=function(t){var e=this.m_fixtureA.m_body,i=this.m_fixtureB.m_body,o=e.c_velocity;e.c_position;var s=i.c_velocity;i.c_position;for(var n=this.v_invMassA,a=this.v_invIA,h=this.v_invMassB,_=this.v_invIB,c=m.clone(o.v),l=o.w,u=m.clone(s.v),p=s.w,d=this.v_normal,y=m.cross(d,1),f=this.v_friction,v=0;v<this.v_pointCount;++v){var x=this.v_points[v];(C=m.zero()).addCombine(1,u,1,m.cross(p,x.rB)),C.subCombine(1,c,1,m.cross(l,x.rA));var g=m.dot(C,y)-this.v_tangentSpeed,b=x.tangentMass*-g,A=f*x.normalImpulse;b=(M=r.clamp(x.tangentImpulse+b,-A,A))-x.tangentImpulse,x.tangentImpulse=M;var B=m.mul(b,y);c.subMul(n,B),l-=a*m.cross(x.rA,B),u.addMul(h,B),p+=_*m.cross(x.rB,B)}if(1==this.v_pointCount||0==t.blockSolve)for(var w=0;w<this.v_pointCount;++w){var C;x=this.v_points[w];(C=m.zero()).addCombine(1,u,1,m.cross(p,x.rB)),C.subCombine(1,c,1,m.cross(l,x.rA));var M,I=m.dot(C,d);b=-x.normalMass*(I-x.velocityBias);b=(M=r.max(x.normalImpulse+b,0))-x.normalImpulse,x.normalImpulse=M;B=m.mul(b,d);c.subMul(n,B),l-=a*m.cross(x.rA,B),u.addMul(h,B),p+=_*m.cross(x.rB,B)}else{var S=this.v_points[0],P=this.v_points[1],z=m.neo(S.normalImpulse,P.normalImpulse),T=m.zero().add(u).add(m.cross(p,S.rB)).sub(c).sub(m.cross(l,S.rA)),k=m.zero().add(u).add(m.cross(p,P.rB)).sub(c).sub(m.cross(l,P.rA)),L=m.dot(T,d),F=m.dot(k,d),q=m.neo(L-S.velocityBias,F-P.velocityBias);for(q.sub(V.mulVec2(this.v_K,z));;){var j=V.mulVec2(this.v_normalMass,q).neg();if(j.x>=0&&j.y>=0){var E=m.sub(j,z),Y=m.mul(E.x,d),D=m.mul(E.y,d);c.subCombine(n,Y,n,D),l-=a*(m.cross(S.rA,Y)+m.cross(P.rA,D)),u.addCombine(h,Y,h,D),p+=_*(m.cross(S.rB,Y)+m.cross(P.rB,D)),S.normalImpulse=j.x,P.normalImpulse=j.y;break}if(j.x=-S.normalMass*q.x,j.y=0,L=0,F=this.v_K.ex.y*j.x+q.y,j.x>=0&&F>=0){E=m.sub(j,z),Y=m.mul(E.x,d),D=m.mul(E.y,d);c.subCombine(n,Y,n,D),l-=a*(m.cross(S.rA,Y)+m.cross(P.rA,D)),u.addCombine(h,Y,h,D),p+=_*(m.cross(S.rB,Y)+m.cross(P.rB,D)),S.normalImpulse=j.x,P.normalImpulse=j.y;break}if(j.x=0,j.y=-P.normalMass*q.y,L=this.v_K.ey.x*j.y+q.x,F=0,j.y>=0&&L>=0){E=m.sub(j,z),Y=m.mul(E.x,d),D=m.mul(E.y,d);c.subCombine(n,Y,n,D),l-=a*(m.cross(S.rA,Y)+m.cross(P.rA,D)),u.addCombine(h,Y,h,D),p+=_*(m.cross(S.rB,Y)+m.cross(P.rB,D)),S.normalImpulse=j.x,P.normalImpulse=j.y;break}if(j.x=0,j.y=0,L=q.x,F=q.y,L>=0&&F>=0){E=m.sub(j,z),Y=m.mul(E.x,d),D=m.mul(E.y,d);c.subCombine(n,Y,n,D),l-=a*(m.cross(S.rA,Y)+m.cross(P.rA,D)),u.addCombine(h,Y,h,D),p+=_*(m.cross(S.rB,Y)+m.cross(P.rB,D)),S.normalImpulse=j.x,P.normalImpulse=j.y;break}break}}o.v.set(c),o.w=l,s.v.set(u),s.w=p},t.addType=function(t,e,i){et[t]=et[t]||{},et[t][e]=i},t.create=function(e,i,o,s){var n,r,a=e.getType(),h=o.getType();if(r=et[a]&&et[a][h])n=new t(e,i,o,s,r);else{if(!(r=et[h]&&et[h][a]))return null;n=new t(o,s,e,i,r)}e=n.getFixtureA(),o=n.getFixtureB(),i=n.getChildIndexA(),s=n.getChildIndexB();var m=e.getBody(),_=o.getBody();return n.m_nodeA.contact=n,n.m_nodeA.other=_,n.m_nodeA.prev=null,n.m_nodeA.next=m.m_contactList,null!=m.m_contactList&&(m.m_contactList.prev=n.m_nodeA),m.m_contactList=n.m_nodeA,n.m_nodeB.contact=n,n.m_nodeB.other=m,n.m_nodeB.prev=null,n.m_nodeB.next=_.m_contactList,null!=_.m_contactList&&(_.m_contactList.prev=n.m_nodeB),_.m_contactList=n.m_nodeB,0==e.isSensor()&&0==o.isSensor()&&(m.setAwake(!0),_.setAwake(!0)),n},t.destroy=function(t,e){var i=t.m_fixtureA,o=t.m_fixtureB,s=i.getBody(),n=o.getBody();t.isTouching()&&e.endContact(t),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA==s.m_contactList&&(s.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB==n.m_contactList&&(n.m_contactList=t.m_nodeB.next),t.m_manifold.pointCount>0&&0==i.isSensor()&&0==o.isSensor()&&(s.setAwake(!0),n.setAwake(!0)),i.getType(),o.getType()},t}(),st=function(){this.other=null,this.joint=null,this.prev=null,this.next=null},nt=function(){function t(t,e,i){this.m_type="unknown-joint",this.m_prev=null,this.m_next=null,this.m_edgeA=new st,this.m_edgeB=new st,this.m_islandFlag=!1,e="bodyA"in t?t.bodyA:e,i="bodyB"in t?t.bodyB:i,this.m_bodyA=e,this.m_bodyB=i,this.m_collideConnected=!!t.collideConnected,this.m_userData=t.userData}return t.prototype.isActive=function(){return this.m_bodyA.isActive()&&this.m_bodyB.isActive()},t.prototype.getType=function(){return this.m_type},t.prototype.getBodyA=function(){return this.m_bodyA},t.prototype.getBodyB=function(){return this.m_bodyB},t.prototype.getNext=function(){return this.m_next},t.prototype.getUserData=function(){return this.m_userData},t.prototype.setUserData=function(t){this.m_userData=t},t.prototype.getCollideConnected=function(){return this.m_collideConnected},t.prototype.shiftOrigin=function(t){},t.TYPES={},t._deserialize=function(e,i,o){var s=t.TYPES[e.type];return s&&o(s,e)},t}(),rt=function(){return Date.now()},at=function(t){return Date.now()-t},ht=function(){this.proxyA=new H,this.proxyB=new H,this.sweepA=new x,this.sweepB=new x};!function(t){t[t.e_unknown=0]="e_unknown",t[t.e_failed=1]="e_failed",t[t.e_overlapped=2]="e_overlapped",t[t.e_touching=3]="e_touching",t[t.e_separated=4]="e_separated"}(tt||(tt={}));var mt,_t=function(){};function ct(t,e){var i=rt();++O.toiCalls,t.state=tt.e_unknown,t.t=e.tMax;var o=e.proxyA,s=e.proxyB,n=e.sweepA,a=e.sweepB;n.normalize(),a.normalize();var h=e.tMax,m=o.m_radius+s.m_radius,_=r.max(c.linearSlop,m-3*c.linearSlop),l=.25*c.linearSlop,u=0,p=c.maxTOIIterations,d=0,y=new N,f=new X;for(f.proxyA=e.proxyA,f.proxyB=e.proxyB,f.useRadii=!1;;){var x=v.identity(),g=v.identity();n.getTransform(x,u),a.getTransform(g,u),f.transformA=x,f.transformB=g;var b=new J;if(W(b,y,f),b.distance<=0){t.state=tt.e_overlapped,t.t=0;break}if(b.distance<_+l){t.state=tt.e_touching,t.t=u;break}var A=new lt;A.initialize(y,o,n,s,a,u);for(var B=!1,w=h,C=0;;){var M=A.findMinSeparation(w);if(M>_+l){t.state=tt.e_separated,t.t=h,B=!0;break}if(M>_-l){u=w;break}var I=A.evaluate(u);if(I<_-l){t.state=tt.e_failed,t.t=u,B=!0;break}if(I<=_+l){t.state=tt.e_touching,t.t=u,B=!0;break}for(var S=0,P=u,z=w;;){var T=void 0;T=1&S?P+(_-I)*(z-P)/(M-I):.5*(P+z),++S,++O.toiRootIters;var V=A.evaluate(T);if(A.indexA,A.indexB,r.abs(V-_)<l){w=T;break}if(V>_?(P=T,I=V):(z=T,M=V),50===S)break}if(O.toiMaxRootIters=r.max(O.toiMaxRootIters,S),++C===c.maxPolygonVertices)break}if(++d,++O.toiIters,B)break;if(d===p){t.state=tt.e_failed,t.t=u;break}}O.toiMaxIters=r.max(O.toiMaxIters,d);var k=at(i);O.toiMaxTime=r.max(O.toiMaxTime,k),O.toiTime+=k}O.toiTime=0,O.toiMaxTime=0,O.toiCalls=0,O.toiIters=0,O.toiMaxIters=0,O.toiRootIters=0,O.toiMaxRootIters=0,function(t){t[t.e_points=1]="e_points",t[t.e_faceA=2]="e_faceA",t[t.e_faceB=3]="e_faceB"}(mt||(mt={}));var lt=function(){function t(){this.m_proxyA=new H,this.m_proxyB=new H,this.m_localPoint=m.zero(),this.m_axis=m.zero()}return t.prototype.initialize=function(t,e,i,o,s,n){this.m_proxyA=e,this.m_proxyB=o;var r=t.count;this.m_sweepA=i,this.m_sweepB=s;var a=v.identity(),h=v.identity();if(this.m_sweepA.getTransform(a,n),this.m_sweepB.getTransform(h,n),1===r){this.m_type=mt.e_points;var _=this.m_proxyA.getVertex(t.indexA[0]),c=this.m_proxyB.getVertex(t.indexB[0]),l=v.mulVec2(a,_),u=v.mulVec2(h,c);return this.m_axis.setCombine(1,u,-1,l),b=this.m_axis.normalize()}if(t.indexA[0]===t.indexA[1]){this.m_type=mt.e_faceB;var p=o.getVertex(t.indexB[0]),d=o.getVertex(t.indexB[1]);this.m_axis=m.cross(m.sub(d,p),1),this.m_axis.normalize();var y=f.mulVec2(h.q,this.m_axis);this.m_localPoint=m.mid(p,d);u=v.mulVec2(h,this.m_localPoint),_=e.getVertex(t.indexA[0]),l=v.mulVec2(a,_);return(b=m.dot(l,y)-m.dot(u,y))<0&&(this.m_axis=m.neg(this.m_axis),b=-b),b}this.m_type=mt.e_faceA;var x=this.m_proxyA.getVertex(t.indexA[0]),g=this.m_proxyA.getVertex(t.indexA[1]);this.m_axis=m.cross(m.sub(g,x),1),this.m_axis.normalize();y=f.mulVec2(a.q,this.m_axis);this.m_localPoint=m.mid(x,g);var b;l=v.mulVec2(a,this.m_localPoint),c=this.m_proxyB.getVertex(t.indexB[0]),u=v.mulVec2(h,c);return(b=m.dot(u,y)-m.dot(l,y))<0&&(this.m_axis=m.neg(this.m_axis),b=-b),b},t.prototype.compute=function(t,e){var i=v.identity(),o=v.identity();switch(this.m_sweepA.getTransform(i,e),this.m_sweepB.getTransform(o,e),this.m_type){case mt.e_points:if(t){var s=f.mulTVec2(i.q,this.m_axis),n=f.mulTVec2(o.q,m.neg(this.m_axis));this.indexA=this.m_proxyA.getSupport(s),this.indexB=this.m_proxyB.getSupport(n)}var r=this.m_proxyA.getVertex(this.indexA),a=this.m_proxyB.getVertex(this.indexB),h=v.mulVec2(i,r),_=v.mulVec2(o,a);return m.dot(_,this.m_axis)-m.dot(h,this.m_axis);case mt.e_faceA:var c=f.mulVec2(i.q,this.m_axis);h=v.mulVec2(i,this.m_localPoint);if(t){n=f.mulTVec2(o.q,m.neg(c));this.indexA=-1,this.indexB=this.m_proxyB.getSupport(n)}a=this.m_proxyB.getVertex(this.indexB),_=v.mulVec2(o,a);return m.dot(_,c)-m.dot(h,c);case mt.e_faceB:c=f.mulVec2(o.q,this.m_axis),_=v.mulVec2(o,this.m_localPoint);if(t){s=f.mulTVec2(i.q,m.neg(c));this.indexB=-1,this.indexA=this.m_proxyA.getSupport(s)}r=this.m_proxyA.getVertex(this.indexA),h=v.mulVec2(i,r);return m.dot(h,c)-m.dot(_,c);default:return t&&(this.indexA=-1,this.indexB=-1),0}},t.prototype.findMinSeparation=function(t){return this.compute(!0,t)},t.prototype.evaluate=function(t){return this.compute(!1,t)},t}(),ut=function(){function t(){this.dt=0,this.inv_dt=0,this.velocityIterations=0,this.positionIterations=0,this.warmStarting=!1,this.blockSolve=!0,this.inv_dt0=0,this.dtRatio=1}return t.prototype.reset=function(t){this.dt>0&&(this.inv_dt0=this.inv_dt),this.dt=t,this.inv_dt=0==t?0:1/t,this.dtRatio=t*this.inv_dt0},t}(),pt=new ut,dt=function(){function t(t){this.contact=t,this.normals=[],this.tangents=[]}return Object.defineProperty(t.prototype,"normalImpulses",{get:function(){var t=this.contact,e=this.normals;e.length=0;for(var i=0;i<t.v_points.length;++i)e.push(t.v_points[i].normalImpulse);return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tangentImpulses",{get:function(){var t=this.contact,e=this.tangents;e.length=0;for(var i=0;i<t.v_points.length;++i)e.push(t.v_points[i].tangentImpulse);return e},enumerable:!1,configurable:!0}),t}(),yt=function(){function t(t){this.m_world=t,this.m_stack=[],this.m_bodies=[],this.m_contacts=[],this.m_joints=[]}return t.prototype.clear=function(){this.m_stack.length=0,this.m_bodies.length=0,this.m_contacts.length=0,this.m_joints.length=0},t.prototype.addBody=function(t){this.m_bodies.push(t)},t.prototype.addContact=function(t){this.m_contacts.push(t)},t.prototype.addJoint=function(t){this.m_joints.push(t)},t.prototype.solveWorld=function(t){for(var e=this.m_world,i=e.m_bodyList;i;i=i.m_next)i.m_islandFlag=!1;for(var o=e.m_contactList;o;o=o.m_next)o.m_islandFlag=!1;for(var s=e.m_jointList;s;s=s.m_next)s.m_islandFlag=!1;for(var n=this.m_stack,r=e.m_bodyList;r;r=r.m_next)if(!r.m_islandFlag&&0!=r.isAwake()&&0!=r.isActive()&&!r.isStatic()){for(this.clear(),n.push(r),r.m_islandFlag=!0;n.length>0;){i=n.pop();if(this.addBody(i),i.setAwake(!0),!i.isStatic()){for(var a=i.m_contactList;a;a=a.next){var h=a.contact;if(!h.m_islandFlag&&(0!=h.isEnabled()&&0!=h.isTouching())){var m=h.m_fixtureA.m_isSensor,_=h.m_fixtureB.m_isSensor;if(!m&&!_)this.addContact(h),h.m_islandFlag=!0,(l=a.other).m_islandFlag||(n.push(l),l.m_islandFlag=!0)}}for(var c=i.m_jointList;c;c=c.next){var l;if(1!=c.joint.m_islandFlag)0!=(l=c.other).isActive()&&(this.addJoint(c.joint),c.joint.m_islandFlag=!0,l.m_islandFlag||(n.push(l),l.m_islandFlag=!0))}}}this.solveIsland(t);for(var u=0;u<this.m_bodies.length;++u){(i=this.m_bodies[u]).isStatic()&&(i.m_islandFlag=!1)}}},t.prototype.solveIsland=function(t){for(var e=this.m_world,i=e.m_gravity,o=e.m_allowSleep,s=t.dt,n=0;n<this.m_bodies.length;++n){var a=this.m_bodies[n],h=m.clone(a.m_sweep.c),_=a.m_sweep.a,l=m.clone(a.m_linearVelocity),u=a.m_angularVelocity;a.m_sweep.c0.set(a.m_sweep.c),a.m_sweep.a0=a.m_sweep.a,a.isDynamic()&&(l.addMul(s*a.m_gravityScale,i),l.addMul(s*a.m_invMass,a.m_force),u+=s*a.m_invI*a.m_torque,l.mul(1/(1+s*a.m_linearDamping)),u*=1/(1+s*a.m_angularDamping)),a.c_position.c=h,a.c_position.a=_,a.c_velocity.v=l,a.c_velocity.w=u}for(n=0;n<this.m_contacts.length;++n){this.m_contacts[n].initConstraint(t)}for(n=0;n<this.m_contacts.length;++n){this.m_contacts[n].initVelocityConstraint(t)}if(t.warmStarting)for(n=0;n<this.m_contacts.length;++n){this.m_contacts[n].warmStartConstraint(t)}for(n=0;n<this.m_joints.length;++n){this.m_joints[n].initVelocityConstraints(t)}for(n=0;n<t.velocityIterations;++n){for(var p=0;p<this.m_joints.length;++p){this.m_joints[p].solveVelocityConstraints(t)}for(p=0;p<this.m_contacts.length;++p){this.m_contacts[p].solveVelocityConstraint(t)}}for(n=0;n<this.m_contacts.length;++n){this.m_contacts[n].storeConstraintImpulses(t)}for(n=0;n<this.m_bodies.length;++n){a=this.m_bodies[n],h=m.clone(a.c_position.c),_=a.c_position.a,l=m.clone(a.c_velocity.v),u=a.c_velocity.w;var d=m.mul(s,l);if(m.lengthSquared(d)>c.maxTranslationSquared){var y=c.maxTranslation/d.length();l.mul(y)}var f=s*u;if(f*f>c.maxRotationSquared)u*=y=c.maxRotation/r.abs(f);h.addMul(s,l),_+=s*u,a.c_position.c.set(h),a.c_position.a=_,a.c_velocity.v.set(l),a.c_velocity.w=u}var v=!1;for(n=0;n<t.positionIterations;++n){var x=0;for(p=0;p<this.m_contacts.length;++p){var g=this.m_contacts[p].solvePositionConstraint(t);x=r.min(x,g)}var b=x>=-3*c.linearSlop,A=!0;for(p=0;p<this.m_joints.length;++p){var B=this.m_joints[p].solvePositionConstraints(t);A=A&&B}if(b&&A){v=!0;break}}for(n=0;n<this.m_bodies.length;++n){(a=this.m_bodies[n]).m_sweep.c.set(a.c_position.c),a.m_sweep.a=a.c_position.a,a.m_linearVelocity.set(a.c_velocity.v),a.m_angularVelocity=a.c_velocity.w,a.synchronizeTransform()}if(this.postSolveIsland(),o){var w=1/0,C=c.linearSleepToleranceSqr,M=c.angularSleepToleranceSqr;for(n=0;n<this.m_bodies.length;++n){(a=this.m_bodies[n]).isStatic()||(0==a.m_autoSleepFlag||a.m_angularVelocity*a.m_angularVelocity>M||m.lengthSquared(a.m_linearVelocity)>C?(a.m_sleepTime=0,w=0):(a.m_sleepTime+=s,w=r.min(w,a.m_sleepTime)))}if(w>=c.timeToSleep&&v)for(n=0;n<this.m_bodies.length;++n){(a=this.m_bodies[n]).setAwake(!1)}}},t.prototype.printBodies=function(t){for(var e=0;e<this.m_bodies.length;++e){var i=this.m_bodies[e];n(t,i.c_position.a,i.c_position.c.x,i.c_position.c.y,i.c_velocity.w,i.c_velocity.v.x,i.c_velocity.v.y)}},t.prototype.solveWorldTOI=function(t){var e=this.m_world;if(e.m_stepComplete){for(var i=e.m_bodyList;i;i=i.m_next)i.m_islandFlag=!1,i.m_sweep.alpha0=0;for(var o=e.m_contactList;o;o=o.m_next)o.m_toiFlag=!1,o.m_islandFlag=!1,o.m_toiCount=0,o.m_toi=1}for(;;){for(var s=null,n=1,o=e.m_contactList;o;o=o.m_next)if(0!=o.isEnabled()&&!(o.m_toiCount>c.maxSubSteps)){var a=1;if(o.m_toiFlag)a=o.m_toi;else{var h=o.getFixtureA(),m=o.getFixtureB();if(h.isSensor()||m.isSensor())continue;var _=h.getBody(),l=m.getBody(),u=_.isAwake()&&!_.isStatic(),p=l.isAwake()&&!l.isStatic();if(0==u&&0==p)continue;var d=_.isBullet()||!_.isDynamic(),y=l.isBullet()||!l.isDynamic();if(0==d&&0==y)continue;var f=_.m_sweep.alpha0;_.m_sweep.alpha0<l.m_sweep.alpha0?(f=l.m_sweep.alpha0,_.m_sweep.advance(f)):l.m_sweep.alpha0<_.m_sweep.alpha0&&(f=_.m_sweep.alpha0,l.m_sweep.advance(f));var v=o.getChildIndexA(),x=o.getChildIndexB();_.m_sweep,l.m_sweep;var g=new ht;g.proxyA.set(h.getShape(),v),g.proxyB.set(m.getShape(),x),g.sweepA.set(_.m_sweep),g.sweepB.set(l.m_sweep),g.tMax=1;var b=new _t;ct(b,g);var A=b.t;a=b.state==tt.e_touching?r.min(f+(1-f)*A,1):1,o.m_toi=a,o.m_toiFlag=!0}a<n&&(s=o,n=a)}if(null==s||1-10*r.EPSILON<n){e.m_stepComplete=!0;break}var B=s.getFixtureA(),w=s.getFixtureB(),C=B.getBody(),M=w.getBody(),I=C.m_sweep.clone(),S=M.m_sweep.clone();if(C.advance(n),M.advance(n),s.update(e),s.m_toiFlag=!1,++s.m_toiCount,0!=s.isEnabled()&&0!=s.isTouching()){C.setAwake(!0),M.setAwake(!0),this.clear(),this.addBody(C),this.addBody(M),this.addContact(s),C.m_islandFlag=!0,M.m_islandFlag=!0,s.m_islandFlag=!0;for(var P=[C,M],z=0;z<P.length;++z){if((j=P[z]).isDynamic())for(var T=j.m_contactList;T;T=T.next){var V=T.contact;if(!V.m_islandFlag){var k=T.other;if(!k.isDynamic()||j.isBullet()||k.isBullet()){var L=V.m_fixtureA.m_isSensor,F=V.m_fixtureB.m_isSensor;if(!L&&!F){var q=k.m_sweep.clone();0==k.m_islandFlag&&k.advance(n),V.update(e),0!=V.isEnabled()&&0!=V.isTouching()?(V.m_islandFlag=!0,this.addContact(V),k.m_islandFlag||(k.m_islandFlag=!0,k.isStatic()||k.setAwake(!0),this.addBody(k))):(k.m_sweep.set(q),k.synchronizeTransform())}}}}}pt.reset((1-n)*t.dt),pt.dtRatio=1,pt.positionIterations=20,pt.velocityIterations=t.velocityIterations,pt.warmStarting=!1,this.solveIslandTOI(pt,C,M);for(z=0;z<this.m_bodies.length;++z){var j;if((j=this.m_bodies[z]).m_islandFlag=!1,j.isDynamic()){j.synchronizeFixtures();for(T=j.m_contactList;T;T=T.next)T.contact.m_toiFlag=!1,T.contact.m_islandFlag=!1}}if(e.findNewContacts(),e.m_subStepping){e.m_stepComplete=!1;break}}else s.setEnabled(!1),C.m_sweep.set(I),M.m_sweep.set(S),C.synchronizeTransform(),M.synchronizeTransform()}},t.prototype.solveIslandTOI=function(t,e,i){this.m_world;for(var o=0;o<this.m_bodies.length;++o){(_=this.m_bodies[o]).c_position.c.set(_.m_sweep.c),_.c_position.a=_.m_sweep.a,_.c_velocity.v.set(_.m_linearVelocity),_.c_velocity.w=_.m_angularVelocity}for(o=0;o<this.m_contacts.length;++o){this.m_contacts[o].initConstraint(t)}for(o=0;o<t.positionIterations;++o){for(var s=0,n=0;n<this.m_contacts.length;++n){var a=this.m_contacts[n].solvePositionConstraintTOI(t,e,i);s=r.min(s,a)}if(s>=-1.5*c.linearSlop)break}e.m_sweep.c0.set(e.c_position.c),e.m_sweep.a0=e.c_position.a,i.m_sweep.c0.set(i.c_position.c),i.m_sweep.a0=i.c_position.a;for(o=0;o<this.m_contacts.length;++o){this.m_contacts[o].initVelocityConstraint(t)}for(o=0;o<t.velocityIterations;++o)for(n=0;n<this.m_contacts.length;++n){this.m_contacts[n].solveVelocityConstraint(t)}var h=t.dt;for(o=0;o<this.m_bodies.length;++o){var _=this.m_bodies[o],l=m.clone(_.c_position.c),u=_.c_position.a,p=m.clone(_.c_velocity.v),d=_.c_velocity.w,y=m.mul(h,p);if(m.dot(y,y)>c.maxTranslationSquared){var f=c.maxTranslation/y.length();p.mul(f)}var v=h*d;if(v*v>c.maxRotationSquared)d*=f=c.maxRotation/r.abs(v);l.addMul(h,p),u+=h*d,_.c_position.c=l,_.c_position.a=u,_.c_velocity.v=p,_.c_velocity.w=d,_.m_sweep.c=l,_.m_sweep.a=u,_.m_linearVelocity=p,_.m_angularVelocity=d,_.synchronizeTransform()}this.postSolveIsland()},t.prototype.postSolveIsland=function(){for(var t=0;t<this.m_contacts.length;++t){var e=this.m_contacts[t];this.m_world.postSolve(e,e.m_impulse)}},t}(),ft={gravity:m.zero(),allowSleep:!0,warmStarting:!0,continuousPhysics:!0,subStepping:!1,blockSolve:!0,velocityIterations:8,positionIterations:3},vt=function(){function t(e){var i=this;if(this.s_step=new ut,this.createContact=function(t,e){var o=t.fixture,s=e.fixture,n=t.childIndex,r=e.childIndex,a=o.getBody(),h=s.getBody();if(a!=h){for(var m=h.getContactList();m;){if(m.other==a){var _=m.contact.getFixtureA(),c=m.contact.getFixtureB(),l=m.contact.getChildIndexA(),u=m.contact.getChildIndexB();if(_==o&&c==s&&l==n&&u==r)return;if(_==s&&c==o&&l==r&&u==n)return}m=m.next}if(0!=h.shouldCollide(a)&&0!=s.shouldCollide(o)){var p=ot.create(o,n,s,r);null!=p&&(p.m_prev=null,null!=i.m_contactList&&(p.m_next=i.m_contactList,i.m_contactList.m_prev=p),i.m_contactList=p,++i.m_contactCount)}}},!(this instanceof t))return new t(e);e&&m.isValid(e)&&(e={gravity:e}),e=s(e,ft),this.m_solver=new yt(this),this.m_broadPhase=new y,this.m_contactList=null,this.m_contactCount=0,this.m_bodyList=null,this.m_bodyCount=0,this.m_jointList=null,this.m_jointCount=0,this.m_stepComplete=!0,this.m_allowSleep=e.allowSleep,this.m_gravity=m.clone(e.gravity),this.m_clearForces=!0,this.m_newFixture=!1,this.m_locked=!1,this.m_warmStarting=e.warmStarting,this.m_continuousPhysics=e.continuousPhysics,this.m_subStepping=e.subStepping,this.m_blockSolve=e.blockSolve,this.m_velocityIterations=e.velocityIterations,this.m_positionIterations=e.positionIterations,this.m_t=0}return t.prototype._serialize=function(){for(var t=[],e=[],i=this.getBodyList();i;i=i.getNext())t.push(i);for(var o=this.getJointList();o;o=o.getNext())"function"==typeof o._serialize&&e.push(o);return{gravity:this.m_gravity,bodies:t,joints:e}},t._deserialize=function(e,i,o){if(!e)return new t;var s=new t(e.gravity);if(e.bodies)for(var n=e.bodies.length-1;n>=0;n-=1)s._addBody(o(T,e.bodies[n],s));if(e.joints)for(n=e.joints.length-1;n>=0;n--)s.createJoint(o(nt,e.joints[n],s));return s},t.prototype.getBodyList=function(){return this.m_bodyList},t.prototype.getJointList=function(){return this.m_jointList},t.prototype.getContactList=function(){return this.m_contactList},t.prototype.getBodyCount=function(){return this.m_bodyCount},t.prototype.getJointCount=function(){return this.m_jointCount},t.prototype.getContactCount=function(){return this.m_contactCount},t.prototype.setGravity=function(t){this.m_gravity=t},t.prototype.getGravity=function(){return this.m_gravity},t.prototype.isLocked=function(){return this.m_locked},t.prototype.setAllowSleeping=function(t){if(t!=this.m_allowSleep&&(this.m_allowSleep=t,0==this.m_allowSleep))for(var e=this.m_bodyList;e;e=e.m_next)e.setAwake(!0)},t.prototype.getAllowSleeping=function(){return this.m_allowSleep},t.prototype.setWarmStarting=function(t){this.m_warmStarting=t},t.prototype.getWarmStarting=function(){return this.m_warmStarting},t.prototype.setContinuousPhysics=function(t){this.m_continuousPhysics=t},t.prototype.getContinuousPhysics=function(){return this.m_continuousPhysics},t.prototype.setSubStepping=function(t){this.m_subStepping=t},t.prototype.getSubStepping=function(){return this.m_subStepping},t.prototype.setAutoClearForces=function(t){this.m_clearForces=t},t.prototype.getAutoClearForces=function(){return this.m_clearForces},t.prototype.clearForces=function(){for(var t=this.m_bodyList;t;t=t.getNext())t.m_force.setZero(),t.m_torque=0},t.prototype.queryAABB=function(t,e){var i=this.m_broadPhase;this.m_broadPhase.query(t,(function(t){var o=i.getUserData(t);return e(o.fixture)}))},t.prototype.rayCast=function(t,e,i){var o=this.m_broadPhase;this.m_broadPhase.rayCast({maxFraction:1,p1:t,p2:e},(function(t,e){var s=o.getUserData(e),n=s.fixture,r=s.childIndex,a={};if(n.rayCast(a,t,r)){var h=a.fraction,_=m.add(m.mul(1-h,t.p1),m.mul(h,t.p2));return i(n,_,a.normal,h)}return t.maxFraction}))},t.prototype.getProxyCount=function(){return this.m_broadPhase.getProxyCount()},t.prototype.getTreeHeight=function(){return this.m_broadPhase.getTreeHeight()},t.prototype.getTreeBalance=function(){return this.m_broadPhase.getTreeBalance()},t.prototype.getTreeQuality=function(){return this.m_broadPhase.getTreeQuality()},t.prototype.shiftOrigin=function(t){if(!this.m_locked){for(var e=this.m_bodyList;e;e=e.m_next)e.m_xf.p.sub(t),e.m_sweep.c0.sub(t),e.m_sweep.c.sub(t);for(var i=this.m_jointList;i;i=i.m_next)i.shiftOrigin(t);this.m_broadPhase.shiftOrigin(t)}},t.prototype._addBody=function(t){this.isLocked()||(t.m_prev=null,t.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=t),this.m_bodyList=t,++this.m_bodyCount)},t.prototype.createBody=function(t,e){if(this.isLocked())return null;var i={};t&&(m.isValid(t)?i={position:t,angle:e}:"object"==typeof t&&(i=t));var o=new T(this,i);return this._addBody(o),o},t.prototype.createDynamicBody=function(t,e){var i={};return t&&(m.isValid(t)?i={position:t,angle:e}:"object"==typeof t&&(i=t)),i.type="dynamic",this.createBody(i)},t.prototype.createKinematicBody=function(t,e){var i={};return t&&(m.isValid(t)?i={position:t,angle:e}:"object"==typeof t&&(i=t)),i.type="kinematic",this.createBody(i)},t.prototype.destroyBody=function(t){if(!this.isLocked()){if(t.m_destroyed)return!1;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.publish("remove-joint",i.joint),this.destroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var o=t.m_contactList;o;){var s=o;o=o.next,this.destroyContact(s.contact),t.m_contactList=o}t.m_contactList=null;for(var n=t.m_fixtureList;n;){var r=n;n=n.m_next,this.publish("remove-fixture",r),r.destroyProxies(this.m_broadPhase),t.m_fixtureList=n}return t.m_fixtureList=null,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_bodyList&&(this.m_bodyList=t.m_next),t.m_destroyed=!0,--this.m_bodyCount,this.publish("remove-body",t),!0}},t.prototype.createJoint=function(t){if(this.isLocked())return null;if(t.m_prev=null,t.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=t),this.m_jointList=t,++this.m_jointCount,t.m_edgeA.joint=t,t.m_edgeA.other=t.m_bodyB,t.m_edgeA.prev=null,t.m_edgeA.next=t.m_bodyA.m_jointList,t.m_bodyA.m_jointList&&(t.m_bodyA.m_jointList.prev=t.m_edgeA),t.m_bodyA.m_jointList=t.m_edgeA,t.m_edgeB.joint=t,t.m_edgeB.other=t.m_bodyA,t.m_edgeB.prev=null,t.m_edgeB.next=t.m_bodyB.m_jointList,t.m_bodyB.m_jointList&&(t.m_bodyB.m_jointList.prev=t.m_edgeB),t.m_bodyB.m_jointList=t.m_edgeB,0==t.m_collideConnected)for(var e=t.m_bodyB.getContactList();e;e=e.next)e.other==t.m_bodyA&&e.contact.flagForFiltering();return t},t.prototype.destroyJoint=function(t){if(!this.isLocked()){t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_jointList&&(this.m_jointList=t.m_next);var e=t.m_bodyA,i=t.m_bodyB;if(e.setAwake(!0),i.setAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA==e.m_jointList&&(e.m_jointList=t.m_edgeA.next),t.m_edgeA.prev=null,t.m_edgeA.next=null,t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB==i.m_jointList&&(i.m_jointList=t.m_edgeB.next),t.m_edgeB.prev=null,t.m_edgeB.next=null,--this.m_jointCount,0==t.m_collideConnected)for(var o=i.getContactList();o;)o.other==e&&o.contact.flagForFiltering(),o=o.next;this.publish("remove-joint",t)}},t.prototype.step=function(t,e,i){if(this.publish("pre-step",t),(0|e)!==e&&(e=0),e=e||this.m_velocityIterations,i=i||this.m_positionIterations,this.m_newFixture&&(this.findNewContacts(),this.m_newFixture=!1),this.m_locked=!0,this.s_step.reset(t),this.s_step.velocityIterations=e,this.s_step.positionIterations=i,this.s_step.warmStarting=this.m_warmStarting,this.s_step.blockSolve=this.m_blockSolve,this.updateContacts(),this.m_stepComplete&&t>0){this.m_solver.solveWorld(this.s_step);for(var o=this.m_bodyList;o;o=o.getNext())0!=o.m_islandFlag&&(o.isStatic()||o.synchronizeFixtures());this.findNewContacts()}this.m_continuousPhysics&&t>0&&this.m_solver.solveWorldTOI(this.s_step),this.m_clearForces&&this.clearForces(),this.m_locked=!1,this.publish("post-step",t)},t.prototype.findNewContacts=function(){this.m_broadPhase.updatePairs(this.createContact)},t.prototype.updateContacts=function(){for(var t,e=this.m_contactList;t=e;){e=t.getNext();var i=t.getFixtureA(),o=t.getFixtureB(),s=t.getChildIndexA(),n=t.getChildIndexB(),r=i.getBody(),a=o.getBody();if(t.m_filterFlag){if(0==a.shouldCollide(r)){this.destroyContact(t);continue}if(0==o.shouldCollide(i)){this.destroyContact(t);continue}t.m_filterFlag=!1}var h=r.isAwake()&&!r.isStatic(),m=a.isAwake()&&!a.isStatic();if(0!=h||0!=m){var _=i.m_proxies[s].proxyId,c=o.m_proxies[n].proxyId;0!=this.m_broadPhase.testOverlap(_,c)?t.update(this):this.destroyContact(t)}}},t.prototype.destroyContact=function(t){ot.destroy(t,this),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_contactList&&(this.m_contactList=t.m_next),--this.m_contactCount},t.prototype.on=function(t,e){return"string"!=typeof t||"function"!=typeof e||(this._listeners||(this._listeners={}),this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)),this},t.prototype.off=function(t,e){if("string"!=typeof t||"function"!=typeof e)return this;var i=this._listeners&&this._listeners[t];if(!i||!i.length)return this;var o=i.indexOf(e);return o>=0&&i.splice(o,1),this},t.prototype.publish=function(t,e,i,o){var s=this._listeners&&this._listeners[t];if(!s||!s.length)return 0;for(var n=0;n<s.length;n++)s[n].call(this,e,i,o);return s.length},t.prototype.beginContact=function(t){this.publish("begin-contact",t)},t.prototype.endContact=function(t){this.publish("end-contact",t)},t.prototype.preSolve=function(t,e){this.publish("pre-solve",t,e)},t.prototype.postSolve=function(t,e){this.publish("post-solve",t,e)},t}(),xt=function(){function t(e,i,o){if(!(this instanceof t))return new t(e,i,o);void 0===e?(this.x=0,this.y=0,this.z=0):"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z):(this.x=e,this.y=i,this.z=o)}return t.prototype._serialize=function(){return{x:this.x,y:this.y,z:this.z}},t._deserialize=function(e){var i=Object.create(t.prototype);return i.x=e.x,i.y=e.y,i.z=e.z,i},t.neo=function(e,i,o){var s=Object.create(t.prototype);return s.x=e,s.y=i,s.z=o,s},t.zero=function(){var e=Object.create(t.prototype);return e.x=0,e.y=0,e.z=0,e},t.clone=function(e){return t.neo(e.x,e.y,e.z)},t.prototype.toString=function(){return JSON.stringify(this)},t.isValid=function(t){return t&&r.isFinite(t.x)&&r.isFinite(t.y)&&r.isFinite(t.z)},t.assert=function(t){},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},t.prototype.mul=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.areEqual=function(t,e){return t===e||"object"==typeof t&&null!==t&&"object"==typeof e&&null!==e&&t.x===e.x&&t.y===e.y&&t.z===e.z},t.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},t.cross=function(e,i){return new t(e.y*i.z-e.z*i.y,e.z*i.x-e.x*i.z,e.x*i.y-e.y*i.x)},t.add=function(e,i){return new t(e.x+i.x,e.y+i.y,e.z+i.z)},t.sub=function(e,i){return new t(e.x-i.x,e.y-i.y,e.z-i.z)},t.mul=function(e,i){return new t(i*e.x,i*e.y,i*e.z)},t.prototype.neg=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.neg=function(e){return new t(-e.x,-e.y,-e.z)},t}(),gt=0;function bt(t){var e=(t=t||{}).rootClass||vt,i=t.preSerialize||function(t){return t},s=t.postSerialize||function(t,e){return t},n=t.preDeserialize||function(t){return t},r=t.postDeserialize||function(t,e){return t},a={World:vt,Body:T,Joint:nt,Fixture:C,Shape:A},h=o({Vec2:m,Vec3:xt},a);this.toJson=function(t){var e=[],o=[t],n={};function r(t,i){if(t.__sid=t.__sid||++gt,!n[t.__sid]){o.push(t);var s={refIndex:e.length+o.length,refType:i};n[t.__sid]=s}return n[t.__sid]}function h(t,e){if("object"!=typeof t||null===t)return t;if("function"==typeof t._serialize){if(t!==e)for(var o in a)if(t instanceof a[o])return r(t,o);t=function(t){var e=(t=i(t))._serialize();return s(e,t)}(t)}if(Array.isArray(t)){for(var n=[],m=0;m<t.length;m++)n[m]=h(t[m]);t=n}else{n={};for(var m in t)t.hasOwnProperty(m)&&(n[m]=h(t[m]));t=n}return t}for(;o.length;){var m=o.shift(),_=h(m,m);e.push(_)}return e},this.fromJson=function(t){var i={};function o(t,e,i){e=n(e);var o=t._deserialize(e,i,s);return o=r(o,e)}function s(e,s,n){if(!s.refIndex)return e&&e._deserialize&&o(e,s,n);e=h[s.refType]||e;var r=s.refIndex;if(!i[r]){var a=o(e,t[r],n);i[r]=a}return i[r]}return e._deserialize(t[0],null,s)}}var At=new bt;bt.toJson=At.toJson,bt.fromJson=At.fromJson;var Bt=function(){function t(t,e,i){"object"==typeof t&&null!==t?(this.ex=xt.clone(t),this.ey=xt.clone(e),this.ez=xt.clone(i)):(this.ex=xt.zero(),this.ey=xt.zero(),this.ez=xt.zero())}return t.prototype.toString=function(){return JSON.stringify(this)},t.isValid=function(t){return t&&xt.isValid(t.ex)&&xt.isValid(t.ey)&&xt.isValid(t.ez)},t.assert=function(t){},t.prototype.setZero=function(){return this.ex.setZero(),this.ey.setZero(),this.ez.setZero(),this},t.prototype.solve33=function(t){var e=xt.dot(this.ex,xt.cross(this.ey,this.ez));0!==e&&(e=1/e);var i=new xt;return i.x=e*xt.dot(t,xt.cross(this.ey,this.ez)),i.y=e*xt.dot(this.ex,xt.cross(t,this.ez)),i.z=e*xt.dot(this.ex,xt.cross(this.ey,t)),i},t.prototype.solve22=function(t){var e=this.ex.x,i=this.ey.x,o=this.ex.y,s=this.ey.y,n=e*s-i*o;0!==n&&(n=1/n);var r=m.zero();return r.x=n*(s*t.x-i*t.y),r.y=n*(e*t.y-o*t.x),r},t.prototype.getInverse22=function(t){var e=this.ex.x,i=this.ey.x,o=this.ex.y,s=this.ey.y,n=e*s-i*o;0!==n&&(n=1/n),t.ex.x=n*s,t.ey.x=-n*i,t.ex.z=0,t.ex.y=-n*o,t.ey.y=n*e,t.ey.z=0,t.ez.x=0,t.ez.y=0,t.ez.z=0},t.prototype.getSymInverse33=function(t){var e=xt.dot(this.ex,xt.cross(this.ey,this.ez));0!==e&&(e=1/e);var i=this.ex.x,o=this.ey.x,s=this.ez.x,n=this.ey.y,r=this.ez.y,a=this.ez.z;t.ex.x=e*(n*a-r*r),t.ex.y=e*(s*r-o*a),t.ex.z=e*(o*r-s*n),t.ey.x=t.ex.y,t.ey.y=e*(i*a-s*s),t.ey.z=e*(s*o-i*r),t.ez.x=t.ex.z,t.ez.y=t.ey.z,t.ez.z=e*(i*n-o*o)},t.mul=function(t,e){if(e&&"z"in e&&"y"in e&&"x"in e){var i=t.ex.x*e.x+t.ey.x*e.y+t.ez.x*e.z,o=t.ex.y*e.x+t.ey.y*e.y+t.ez.y*e.z,s=t.ex.z*e.x+t.ey.z*e.y+t.ez.z*e.z;return new xt(i,o,s)}if(e&&"y"in e&&"x"in e){i=t.ex.x*e.x+t.ey.x*e.y,o=t.ex.y*e.x+t.ey.y*e.y;return m.neo(i,o)}},t.mulVec3=function(t,e){var i=t.ex.x*e.x+t.ey.x*e.y+t.ez.x*e.z,o=t.ex.y*e.x+t.ey.y*e.y+t.ez.y*e.z,s=t.ex.z*e.x+t.ey.z*e.y+t.ez.z*e.z;return new xt(i,o,s)},t.mulVec2=function(t,e){var i=t.ex.x*e.x+t.ey.x*e.y,o=t.ex.y*e.x+t.ey.y*e.y;return m.neo(i,o)},t.add=function(e,i){return new t(xt.add(e.ex,i.ex),xt.add(e.ey,i.ey),xt.add(e.ez,i.ez))},t}(),wt=function(t){function e(i,o){var s=this;return s instanceof e?((s=t.call(this)||this).m_type=e.TYPE,s.m_p=m.zero(),s.m_radius=1,"object"==typeof i&&m.isValid(i)?(s.m_p.set(i),"number"==typeof o&&(s.m_radius=o)):"number"==typeof i&&(s.m_radius=i),s):new e(i,o)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,p:this.m_p,radius:this.m_radius}},e._deserialize=function(t){return new e(t.p,t.radius)},e.prototype.getRadius=function(){return this.m_radius},e.prototype.getCenter=function(){return this.m_p},e.prototype.getVertex=function(t){return this.m_p},e.prototype._clone=function(){var t=new e;return t.m_type=this.m_type,t.m_radius=this.m_radius,t.m_p=this.m_p.clone(),t},e.prototype.getChildCount=function(){return 1},e.prototype.testPoint=function(t,e){var i=m.add(t.p,f.mulVec2(t.q,this.m_p)),o=m.sub(e,i);return m.dot(o,o)<=this.m_radius*this.m_radius},e.prototype.rayCast=function(t,e,i,o){var s=m.add(i.p,f.mulVec2(i.q,this.m_p)),n=m.sub(e.p1,s),a=m.dot(n,n)-this.m_radius*this.m_radius,h=m.sub(e.p2,e.p1),_=m.dot(n,h),c=m.dot(h,h),l=_*_-c*a;if(l<0||c<r.EPSILON)return!1;var u=-(_+r.sqrt(l));return 0<=u&&u<=e.maxFraction*c&&(u/=c,t.fraction=u,t.normal=m.add(n,m.mul(u,h)),t.normal.normalize(),!0)},e.prototype.computeAABB=function(t,e,i){var o=m.add(e.p,f.mulVec2(e.q,this.m_p));t.lowerBound.set(o.x-this.m_radius,o.y-this.m_radius),t.upperBound.set(o.x+this.m_radius,o.y+this.m_radius)},e.prototype.computeMass=function(t,e){t.mass=e*r.PI*this.m_radius*this.m_radius,t.center=this.m_p,t.I=t.mass*(.5*this.m_radius*this.m_radius+m.dot(this.m_p,this.m_p))},e.prototype.computeDistanceProxy=function(t){t.m_vertices.push(this.m_p),t.m_count=1,t.m_radius=this.m_radius},e.TYPE="circle",e}(A);A.TYPES[wt.TYPE]=wt;var Ct=function(t){function e(i,o){var s=this;return s instanceof e?((s=t.call(this)||this).m_type=e.TYPE,s.m_radius=c.polygonRadius,s.m_vertex1=i?m.clone(i):m.zero(),s.m_vertex2=o?m.clone(o):m.zero(),s.m_vertex0=m.zero(),s.m_vertex3=m.zero(),s.m_hasVertex0=!1,s.m_hasVertex3=!1,s):new e(i,o)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,vertex1:this.m_vertex1,vertex2:this.m_vertex2,vertex0:this.m_vertex0,vertex3:this.m_vertex3,hasVertex0:this.m_hasVertex0,hasVertex3:this.m_hasVertex3}},e._deserialize=function(t){var i=new e(t.vertex1,t.vertex2);return i.m_hasVertex0&&i.setPrev(t.vertex0),i.m_hasVertex3&&i.setNext(t.vertex3),i},e.prototype.setNext=function(t){return t?(this.m_vertex3.set(t),this.m_hasVertex3=!0):(this.m_vertex3.setZero(),this.m_hasVertex3=!1),this},e.prototype.setPrev=function(t){return t?(this.m_vertex0.set(t),this.m_hasVertex0=!0):(this.m_vertex0.setZero(),this.m_hasVertex0=!1),this},e.prototype._set=function(t,e){return this.m_vertex1.set(t),this.m_vertex2.set(e),this.m_hasVertex0=!1,this.m_hasVertex3=!1,this},e.prototype._clone=function(){var t=new e;return t.m_type=this.m_type,t.m_radius=this.m_radius,t.m_vertex1.set(this.m_vertex1),t.m_vertex2.set(this.m_vertex2),t.m_vertex0.set(this.m_vertex0),t.m_vertex3.set(this.m_vertex3),t.m_hasVertex0=this.m_hasVertex0,t.m_hasVertex3=this.m_hasVertex3,t},e.prototype.getChildCount=function(){return 1},e.prototype.testPoint=function(t,e){return!1},e.prototype.rayCast=function(t,e,i,o){var s=f.mulTVec2(i.q,m.sub(e.p1,i.p)),n=f.mulTVec2(i.q,m.sub(e.p2,i.p)),r=m.sub(n,s),a=this.m_vertex1,h=this.m_vertex2,_=m.sub(h,a),c=m.neo(_.y,-_.x);c.normalize();var l=m.dot(c,m.sub(a,s)),u=m.dot(c,r);if(0==u)return!1;var p=l/u;if(p<0||e.maxFraction<p)return!1;var d=m.add(s,m.mul(p,r)),y=m.sub(h,a),v=m.dot(y,y);if(0==v)return!1;var x=m.dot(m.sub(d,a),y)/v;return!(x<0||1<x)&&(t.fraction=p,t.normal=l>0?f.mulVec2(i.q,c).neg():f.mulVec2(i.q,c),!0)},e.prototype.computeAABB=function(t,e,i){var o=v.mulVec2(e,this.m_vertex1),s=v.mulVec2(e,this.m_vertex2);t.combinePoints(o,s),t.extend(this.m_radius)},e.prototype.computeMass=function(t,e){t.mass=0,t.center.setCombine(.5,this.m_vertex1,.5,this.m_vertex2),t.I=0},e.prototype.computeDistanceProxy=function(t){t.m_vertices.push(this.m_vertex1),t.m_vertices.push(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},e.TYPE="edge",e}(A);A.TYPES[Ct.TYPE]=Ct;var Mt=function(t){function e(i){var o=this;return o instanceof e?((o=t.call(this)||this).m_type=e.TYPE,o.m_radius=c.polygonRadius,o.m_centroid=m.zero(),o.m_vertices=[],o.m_normals=[],o.m_count=0,i&&i.length&&o._set(i),o):new e(i)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,vertices:this.m_vertices}},e._deserialize=function(t,i,o){var s=[];if(t.vertices)for(var n=0;n<t.vertices.length;n++)s.push(o(m,t.vertices[n]));return new e(s)},e.prototype.getVertex=function(t){return this.m_vertices[t]},e.prototype._clone=function(){var t=new e;t.m_type=this.m_type,t.m_radius=this.m_radius,t.m_count=this.m_count,t.m_centroid.set(this.m_centroid);for(var i=0;i<this.m_count;i++)t.m_vertices.push(this.m_vertices[i].clone());for(i=0;i<this.m_normals.length;i++)t.m_normals.push(this.m_normals[i].clone());return t},e.prototype.getChildCount=function(){return 1},e.prototype._reset=function(){this._set(this.m_vertices)},e.prototype._set=function(t){if(t.length<3)this._setAsBox(1,1);else{for(var e=r.min(t.length,c.maxPolygonVertices),i=[],o=0;o<e;++o){for(var s=t[o],n=!0,a=0;a<i.length;++a)if(m.distanceSquared(s,i[a])<.25*c.linearSlopSquared){n=!1;break}n&&i.push(s)}if((e=i.length)<3)this._setAsBox(1,1);else{var h=0,_=i[0].x;for(o=1;o<e;++o){var l=i[o].x;(l>_||l===_&&i[o].y<i[h].y)&&(h=o,_=l)}for(var u=[],p=0,d=h;;){u[p]=d;var y=0;for(a=1;a<e;++a)if(y!==d){var f=m.sub(i[y],i[u[p]]),v=(s=m.sub(i[a],i[u[p]]),m.cross(f,s));v<0&&(y=a),0===v&&s.lengthSquared()>f.lengthSquared()&&(y=a)}else y=a;if(++p,d=y,y===h)break}if(p<3)this._setAsBox(1,1);else{this.m_count=p,this.m_vertices=[];for(o=0;o<p;++o)this.m_vertices[o]=i[u[o]];for(o=0;o<p;++o){var x=o,g=o+1<p?o+1:0,b=m.sub(this.m_vertices[g],this.m_vertices[x]);this.m_normals[o]=m.cross(b,1),this.m_normals[o].normalize()}this.m_centroid=function(t,e){for(var i=m.zero(),o=0,s=m.zero(),n=1/3,r=0;r<e;++r){var a=s,h=t[r],_=r+1<e?t[r+1]:t[0],c=m.sub(h,a),l=m.sub(_,a),u=.5*m.cross(c,l);o+=u,i.addMul(u*n,a),i.addMul(u*n,h),i.addMul(u*n,_)}return i.mul(1/o),i}(this.m_vertices,p)}}}},e.prototype._setAsBox=function(t,e,i,o){if(this.m_vertices[0]=m.neo(t,-e),this.m_vertices[1]=m.neo(t,e),this.m_vertices[2]=m.neo(-t,e),this.m_vertices[3]=m.neo(-t,-e),this.m_normals[0]=m.neo(1,0),this.m_normals[1]=m.neo(0,1),this.m_normals[2]=m.neo(-1,0),this.m_normals[3]=m.neo(0,-1),this.m_count=4,m.isValid(i)){o=o||0,this.m_centroid.set(i);var s=v.identity();s.p.set(i),s.q.set(o);for(var n=0;n<this.m_count;++n)this.m_vertices[n]=v.mulVec2(s,this.m_vertices[n]),this.m_normals[n]=f.mulVec2(s.q,this.m_normals[n])}},e.prototype.testPoint=function(t,e){for(var i=f.mulTVec2(t.q,m.sub(e,t.p)),o=0;o<this.m_count;++o){if(m.dot(this.m_normals[o],m.sub(i,this.m_vertices[o]))>0)return!1}return!0},e.prototype.rayCast=function(t,e,i,o){for(var s=f.mulTVec2(i.q,m.sub(e.p1,i.p)),n=f.mulTVec2(i.q,m.sub(e.p2,i.p)),r=m.sub(n,s),a=0,h=e.maxFraction,_=-1,c=0;c<this.m_count;++c){var l=m.dot(this.m_normals[c],m.sub(this.m_vertices[c],s)),u=m.dot(this.m_normals[c],r);if(0==u){if(l<0)return!1}else u<0&&l<a*u?(a=l/u,_=c):u>0&&l<h*u&&(h=l/u);if(h<a)return!1}return _>=0&&(t.fraction=a,t.normal=f.mulVec2(i.q,this.m_normals[_]),!0)},e.prototype.computeAABB=function(t,e,i){for(var o=1/0,s=1/0,n=-1/0,a=-1/0,h=0;h<this.m_count;++h){var m=v.mulVec2(e,this.m_vertices[h]);o=r.min(o,m.x),n=r.max(n,m.x),s=r.min(s,m.y),a=r.max(a,m.y)}t.lowerBound.set(o,s),t.upperBound.set(n,a),t.extend(this.m_radius)},e.prototype.computeMass=function(t,e){for(var i=m.zero(),o=0,s=0,n=m.zero(),r=0;r<this.m_count;++r)n.add(this.m_vertices[r]);n.mul(1/this.m_count);var a=1/3;for(r=0;r<this.m_count;++r){var h=m.sub(this.m_vertices[r],n),_=r+1<this.m_count?m.sub(this.m_vertices[r+1],n):m.sub(this.m_vertices[0],n),c=m.cross(h,_),l=.5*c;o+=l,i.addCombine(l*a,h,l*a,_);var u=h.x,p=h.y,d=_.x,y=_.y;s+=.25*a*c*(u*u+d*u+d*d+(p*p+y*p+y*y))}t.mass=e*o,i.mul(1/o),t.center.setCombine(1,i,1,n),t.I=e*s,t.I+=t.mass*(m.dot(t.center,t.center)-m.dot(i,i))},e.prototype.validate=function(){for(var t=0;t<this.m_count;++t)for(var e=t,i=t<this.m_count-1?e+1:0,o=this.m_vertices[e],s=m.sub(this.m_vertices[i],o),n=0;n<this.m_count;++n)if(n!=e&&n!=i){var r=m.sub(this.m_vertices[n],o);if(m.cross(s,r)<0)return!1}return!0},e.prototype.computeDistanceProxy=function(t){t.m_vertices=this.m_vertices,t.m_count=this.m_count,t.m_radius=this.m_radius},e.TYPE="polygon",e}(A);A.TYPES[Mt.TYPE]=Mt;var It=function(t){function e(i,o){var s=this;return s instanceof e?((s=t.call(this)||this).m_type=e.TYPE,s.m_radius=c.polygonRadius,s.m_vertices=[],s.m_count=0,s.m_prevVertex=null,s.m_nextVertex=null,s.m_hasPrevVertex=!1,s.m_hasNextVertex=!1,s.m_isLoop=!!o,i&&i.length&&(o?s._createLoop(i):s._createChain(i)),s):new e(i,o)}return i(e,t),e.prototype._serialize=function(){var t={type:this.m_type,vertices:this.m_vertices,isLoop:this.m_isLoop,hasPrevVertex:this.m_hasPrevVertex,hasNextVertex:this.m_hasNextVertex,prevVertex:null,nextVertex:null};return this.m_prevVertex&&(t.prevVertex=this.m_prevVertex),this.m_nextVertex&&(t.nextVertex=this.m_nextVertex),t},e._deserialize=function(t,i,o){var s=[];if(t.vertices)for(var n=0;n<t.vertices.length;n++)s.push(o(m,t.vertices[n]));var r=new e(s,t.isLoop);return t.prevVertex&&r.setPrevVertex(t.prevVertex),t.nextVertex&&r.setNextVertex(t.nextVertex),r},e.prototype._createLoop=function(t){for(var e=1;e<t.length;++e)t[e-1],t[e];this.m_vertices=[],this.m_count=t.length+1;for(e=0;e<t.length;++e)this.m_vertices[e]=m.clone(t[e]);return this.m_vertices[t.length]=m.clone(t[0]),this.m_prevVertex=this.m_vertices[this.m_count-2],this.m_nextVertex=this.m_vertices[1],this.m_hasPrevVertex=!0,this.m_hasNextVertex=!0,this},e.prototype._createChain=function(t){for(var e=1;e<t.length;++e)t[e-1],t[e];this.m_count=t.length;for(e=0;e<t.length;++e)this.m_vertices[e]=m.clone(t[e]);return this.m_hasPrevVertex=!1,this.m_hasNextVertex=!1,this.m_prevVertex=null,this.m_nextVertex=null,this},e.prototype._reset=function(){this.m_isLoop?this._createLoop(this.m_vertices):this._createChain(this.m_vertices)},e.prototype.setPrevVertex=function(t){this.m_prevVertex=t,this.m_hasPrevVertex=!0},e.prototype.setNextVertex=function(t){this.m_nextVertex=t,this.m_hasNextVertex=!0},e.prototype._clone=function(){var t=new e;return t._createChain(this.m_vertices),t.m_type=this.m_type,t.m_radius=this.m_radius,t.m_prevVertex=this.m_prevVertex,t.m_nextVertex=this.m_nextVertex,t.m_hasPrevVertex=this.m_hasPrevVertex,t.m_hasNextVertex=this.m_hasNextVertex,t},e.prototype.getChildCount=function(){return this.m_count-1},e.prototype.getChildEdge=function(t,e){t.m_type=Ct.TYPE,t.m_radius=this.m_radius,t.m_vertex1=this.m_vertices[e],t.m_vertex2=this.m_vertices[e+1],e>0?(t.m_vertex0=this.m_vertices[e-1],t.m_hasVertex0=!0):(t.m_vertex0=this.m_prevVertex,t.m_hasVertex0=this.m_hasPrevVertex),e<this.m_count-2?(t.m_vertex3=this.m_vertices[e+2],t.m_hasVertex3=!0):(t.m_vertex3=this.m_nextVertex,t.m_hasVertex3=this.m_hasNextVertex)},e.prototype.getVertex=function(t){return t<this.m_count?this.m_vertices[t]:this.m_vertices[0]},e.prototype.testPoint=function(t,e){return!1},e.prototype.rayCast=function(t,e,i,o){return new Ct(this.getVertex(o),this.getVertex(o+1)).rayCast(t,e,i,0)},e.prototype.computeAABB=function(t,e,i){var o=v.mulVec2(e,this.getVertex(i)),s=v.mulVec2(e,this.getVertex(i+1));t.combinePoints(o,s)},e.prototype.computeMass=function(t,e){t.mass=0,t.center=m.zero(),t.I=0},e.prototype.computeDistanceProxy=function(t,e){t.m_buffer[0]=this.getVertex(e),t.m_buffer[1]=this.getVertex(e+1),t.m_vertices=t.m_buffer,t.m_count=2,t.m_radius=this.m_radius},e.TYPE="chain",e}(A);A.TYPES[It.TYPE]=It;var St=function(t){function e(i,o,s,n){var r=this;return r instanceof e?((r=t.call(this)||this)._setAsBox(i,o,s,n),r):new e(i,o,s,n)}return i(e,t),e.TYPE="polygon",e}(Mt);function Pt(t,e,i,o,s){t.pointCount=0;var n=v.mulVec2(i,e.m_p),r=v.mulVec2(s,o.m_p),_=m.distanceSquared(r,n),c=e.m_radius+o.m_radius;_>c*c||(t.type=a.e_circles,t.localPoint.set(e.m_p),t.localNormal.setZero(),t.pointCount=1,t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,t.points[0].id.cf.typeB=h.e_vertex)}function zt(t,e,i,o,s){t.pointCount=0;var n=v.mulTVec2(i,v.mulVec2(s,o.m_p)),r=e.m_vertex1,_=e.m_vertex2,c=m.sub(_,r),l=m.dot(c,m.sub(_,n)),u=m.dot(c,m.sub(n,r)),p=e.m_radius+o.m_radius;if(u<=0){var d=m.clone(r),y=m.sub(n,d);if(m.dot(y,y)>p*p)return;if(e.m_hasVertex0){var f=e.m_vertex0,x=r,g=m.sub(x,f);if(m.dot(g,m.sub(x,n))>0)return}return t.type=a.e_circles,t.localNormal.setZero(),t.localPoint.set(d),t.pointCount=1,t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,void(t.points[0].id.cf.typeB=h.e_vertex)}if(l<=0){var b=m.clone(_),A=m.sub(n,b);if(m.dot(A,A)>p*p)return;if(e.m_hasVertex3){var B=e.m_vertex3,w=_,C=m.sub(B,w);if(m.dot(C,m.sub(n,w))>0)return}return t.type=a.e_circles,t.localNormal.setZero(),t.localPoint.set(b),t.pointCount=1,t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=1,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,void(t.points[0].id.cf.typeB=h.e_vertex)}var M=m.dot(c,c),I=m.combine(l/M,r,u/M,_),S=m.sub(n,I);if(!(m.dot(S,S)>p*p)){var P=m.neo(-c.y,c.x);m.dot(P,m.sub(n,r))<0&&P.set(-P.x,-P.y),P.normalize(),t.type=a.e_faceA,t.localNormal=P,t.localPoint.set(r),t.pointCount=1,t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_face,t.points[0].id.cf.indexB=0,t.points[0].id.cf.typeB=h.e_vertex}}function Tt(t,e,i,o,s){for(var n=t.m_count,r=i.m_count,a=t.m_normals,h=t.m_vertices,_=i.m_vertices,c=v.mulTXf(o,e),l=0,u=-1/0,p=0;p<n;++p){for(var d=f.mulVec2(c.q,a[p]),y=v.mulVec2(c,h[p]),x=1/0,g=0;g<r;++g){var b=m.dot(d,_[g])-m.dot(d,y);b<x&&(x=b)}x>u&&(u=x,l=p)}s.maxSeparation=u,s.bestIndex=l}ot.addType(wt.TYPE,wt.TYPE,(function(t,e,i,o,s,n,r){Pt(t,i.getShape(),e,n.getShape(),s)})),ot.addType(Ct.TYPE,wt.TYPE,(function(t,e,i,o,s,n,r){var a=i.getShape(),h=n.getShape();zt(t,a,e,h,s)})),ot.addType(It.TYPE,wt.TYPE,(function(t,e,i,o,s,n,r){var a=i.getShape(),h=new Ct;a.getChildEdge(h,o);var m=h,_=n.getShape();zt(t,m,e,_,s)})),ot.addType(Mt.TYPE,Mt.TYPE,(function(t,e,i,o,s,n,r){Ft(t,i.getShape(),e,n.getShape(),s)}));var Vt,kt,Lt={maxSeparation:0,bestIndex:0};function Ft(t,e,i,o,s){t.pointCount=0;var n=e.m_radius+o.m_radius;Tt(e,i,o,s,Lt);var r=Lt.bestIndex,_=Lt.maxSeparation;if(!(_>n)){Tt(o,s,e,i,Lt);var l=Lt.bestIndex,u=Lt.maxSeparation;if(!(u>n)){var p,d,y,x,g,b;u>_+.1*c.linearSlop?(p=o,d=e,y=s,x=i,g=l,t.type=a.e_faceB,b=1):(p=e,d=o,y=i,x=s,g=r,t.type=a.e_faceA,b=0);var A=[new D,new D];!function(t,e,i,o,s,n){for(var r=e.m_normals,a=s.m_count,_=s.m_vertices,c=s.m_normals,l=f.mulT(n.q,f.mulVec2(i.q,r[o])),u=0,p=1/0,d=0;d<a;++d){var y=m.dot(l,c[d]);y<p&&(p=y,u=d)}var x=u,g=x+1<a?x+1:0;t[0].v=v.mulVec2(n,_[x]),t[0].id.cf.indexA=o,t[0].id.cf.indexB=x,t[0].id.cf.typeA=h.e_face,t[0].id.cf.typeB=h.e_vertex,t[1].v=v.mulVec2(n,_[g]),t[1].id.cf.indexA=o,t[1].id.cf.indexB=g,t[1].id.cf.typeA=h.e_face,t[1].id.cf.typeB=h.e_vertex}(A,p,y,g,d,x);var B=p.m_count,w=p.m_vertices,C=g,M=g+1<B?g+1:0,I=w[C],S=w[M],P=m.sub(S,I);P.normalize();var z=m.cross(P,1),T=m.combine(.5,I,.5,S),V=f.mulVec2(y.q,P),k=m.cross(V,1);I=v.mulVec2(y,I),S=v.mulVec2(y,S);var L=m.dot(k,I),F=-m.dot(V,I)+n,q=m.dot(V,S)+n,j=[new D,new D],E=[new D,new D];if(!(R(j,A,m.neg(V),F,C)<2||R(E,j,V,q,M)<2)){t.localNormal=z,t.localPoint=T;for(var Y=0,O=0;O<E.length;++O){if(m.dot(k,E[O].v)-L<=n){var X=t.points[Y];if(X.localPoint.set(v.mulTVec2(x,E[O].v)),X.id=E[O].id,b){var J=X.id.cf,N=J.indexA,W=J.indexB,H=J.typeA,Z=J.typeB;J.indexA=W,J.indexB=N,J.typeA=Z,J.typeB=H}++Y}}t.pointCount=Y}}}}function qt(t,e,i,o,s){t.pointCount=0;for(var n=v.mulVec2(s,o.m_p),_=v.mulTVec2(i,n),c=0,l=-1/0,u=e.m_radius+o.m_radius,p=e.m_count,d=e.m_vertices,y=e.m_normals,f=0;f<p;++f){var x=m.dot(y[f],m.sub(_,d[f]));if(x>u)return;x>l&&(l=x,c=f)}var g=c,b=g+1<p?g+1:0,A=d[g],B=d[b];if(l<r.EPSILON)return t.pointCount=1,t.type=a.e_faceA,t.localNormal.set(y[c]),t.localPoint.setCombine(.5,A,.5,B),t.points[0].localPoint=o.m_p,t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,void(t.points[0].id.cf.typeB=h.e_vertex);var w=m.dot(m.sub(_,A),m.sub(B,A)),C=m.dot(m.sub(_,B),m.sub(A,B));if(w<=0){if(m.distanceSquared(_,A)>u*u)return;t.pointCount=1,t.type=a.e_faceA,t.localNormal.setCombine(1,_,-1,A),t.localNormal.normalize(),t.localPoint=A,t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,t.points[0].id.cf.typeB=h.e_vertex}else if(C<=0){if(m.distanceSquared(_,B)>u*u)return;t.pointCount=1,t.type=a.e_faceA,t.localNormal.setCombine(1,_,-1,B),t.localNormal.normalize(),t.localPoint.set(B),t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,t.points[0].id.cf.typeB=h.e_vertex}else{var M=m.mid(A,B);if(m.dot(_,y[g])-m.dot(M,y[g])>u)return;t.pointCount=1,t.type=a.e_faceA,t.localNormal.set(y[g]),t.localPoint.set(M),t.points[0].localPoint.set(o.m_p),t.points[0].id.cf.indexA=0,t.points[0].id.cf.typeA=h.e_vertex,t.points[0].id.cf.indexB=0,t.points[0].id.cf.typeB=h.e_vertex}}ot.addType(Mt.TYPE,wt.TYPE,(function(t,e,i,o,s,n,r){qt(t,i.getShape(),e,n.getShape(),s)})),ot.addType(Ct.TYPE,Mt.TYPE,(function(t,e,i,o,s,n,r){Jt(t,i.getShape(),e,n.getShape(),s)})),ot.addType(It.TYPE,Mt.TYPE,(function(t,e,i,o,s,n,r){var a=i.getShape(),h=new Ct;a.getChildEdge(h,o),Jt(t,h,e,n.getShape(),s)})),function(t){t[t.e_unknown=-1]="e_unknown",t[t.e_edgeA=1]="e_edgeA",t[t.e_edgeB=2]="e_edgeB"}(Vt||(Vt={})),function(t){t[t.e_isolated=0]="e_isolated",t[t.e_concave=1]="e_concave",t[t.e_convex=2]="e_convex"}(kt||(kt={}));var jt=function(){},Et=function(){this.vertices=[],this.normals=[],this.count=0},Yt=function(){this.normal=m.zero(),this.sideNormal1=m.zero(),this.sideNormal2=m.zero()},Dt=new jt,Rt=new jt,Ot=new Et,Xt=new Yt;function Jt(t,e,i,o,s){var n=v.mulTXf(i,s),_=v.mulVec2(n,o.m_centroid),l=e.m_vertex0,u=e.m_vertex1,p=e.m_vertex2,d=e.m_vertex3,y=e.m_hasVertex0,x=e.m_hasVertex3,g=m.sub(p,u);g.normalize();var b,A,B,w=m.neo(g.y,-g.x),C=m.dot(w,m.sub(_,u)),M=0,I=0,S=!1,P=!1;if(y){var z=m.sub(u,l);z.normalize(),b=m.neo(z.y,-z.x),S=m.cross(z,g)>=0,M=m.dot(b,_)-m.dot(b,l)}if(x){var T=m.sub(d,p);T.normalize(),A=m.neo(T.y,-T.x),P=m.cross(g,T)>0,I=m.dot(A,_)-m.dot(A,p)}var V=m.zero(),k=m.zero(),L=m.zero();y&&x?S&&P?(B=M>=0||C>=0||I>=0)?(V.set(w),k.set(b),L.set(A)):(V.setMul(-1,w),k.setMul(-1,w),L.setMul(-1,w)):S?(B=M>=0||C>=0&&I>=0)?(V.set(w),k.set(b),L.set(w)):(V.setMul(-1,w),k.setMul(-1,A),L.setMul(-1,w)):P?(B=I>=0||M>=0&&C>=0)?(V.set(w),k.set(w),L.set(A)):(V.setMul(-1,w),k.setMul(-1,w),L.setMul(-1,b)):(B=M>=0&&C>=0&&I>=0)?(V.set(w),k.set(w),L.set(w)):(V.setMul(-1,w),k.setMul(-1,A),L.setMul(-1,b)):y?S?(B=M>=0||C>=0)?(V.set(w),k.set(b),L.setMul(-1,w)):(V.setMul(-1,w),k.set(w),L.setMul(-1,w)):(B=M>=0&&C>=0)?(V.set(w),k.set(w),L.setMul(-1,w)):(V.setMul(-1,w),k.set(w),L.setMul(-1,b)):x?P?(B=C>=0||I>=0)?(V.set(w),k.setMul(-1,w),L.set(A)):(V.setMul(-1,w),k.setMul(-1,w),L.set(w)):(B=C>=0&&I>=0)?(V.set(w),k.setMul(-1,w),L.set(w)):(V.setMul(-1,w),k.setMul(-1,A),L.set(w)):(B=C>=0)?(V.set(w),k.setMul(-1,w),L.setMul(-1,w)):(V.setMul(-1,w),k.set(w),L.set(w)),Ot.count=o.m_count;for(var F=0;F<o.m_count;++F)Ot.vertices[F]=v.mulVec2(n,o.m_vertices[F]),Ot.normals[F]=f.mulVec2(n.q,o.m_normals[F]);var q=2*c.polygonRadius;t.pointCount=0,Dt.type=Vt.e_edgeA,Dt.index=B?0:1,Dt.separation=1/0;for(F=0;F<Ot.count;++F){(E=m.dot(V,m.sub(Ot.vertices[F],u)))<Dt.separation&&(Dt.separation=E)}if(Dt.type!=Vt.e_unknown&&!(Dt.separation>q)){Rt.type=Vt.e_unknown,Rt.index=-1,Rt.separation=-1/0;var j=m.neo(-V.y,V.x);for(F=0;F<Ot.count;++F){var E,Y=m.neg(Ot.normals[F]),O=m.dot(Y,m.sub(Ot.vertices[F],u)),X=m.dot(Y,m.sub(Ot.vertices[F],p));if((E=r.min(O,X))>q){Rt.type=Vt.e_edgeB,Rt.index=F,Rt.separation=E;break}if(m.dot(Y,j)>=0){if(m.dot(m.sub(Y,L),V)<-c.angularSlop)continue}else if(m.dot(m.sub(Y,k),V)<-c.angularSlop)continue;E>Rt.separation&&(Rt.type=Vt.e_edgeB,Rt.index=F,Rt.separation=E)}if(!(Rt.type!=Vt.e_unknown&&Rt.separation>q)){var J;J=Rt.type==Vt.e_unknown?Dt:Rt.separation>.98*Dt.separation+.001?Rt:Dt;var N=[new D,new D];if(J.type==Vt.e_edgeA){t.type=a.e_faceA;var W=0,H=m.dot(V,Ot.normals[0]);for(F=1;F<Ot.count;++F){var Z=m.dot(V,Ot.normals[F]);Z<H&&(H=Z,W=F)}var K=W,G=K+1<Ot.count?K+1:0;N[0].v=Ot.vertices[K],N[0].id.cf.indexA=0,N[0].id.cf.indexB=K,N[0].id.cf.typeA=h.e_face,N[0].id.cf.typeB=h.e_vertex,N[1].v=Ot.vertices[G],N[1].id.cf.indexA=0,N[1].id.cf.indexB=G,N[1].id.cf.typeA=h.e_face,N[1].id.cf.typeB=h.e_vertex,B?(Xt.i1=0,Xt.i2=1,Xt.v1=u,Xt.v2=p,Xt.normal.set(w)):(Xt.i1=1,Xt.i2=0,Xt.v1=p,Xt.v2=u,Xt.normal.setMul(-1,w))}else t.type=a.e_faceB,N[0].v=u,N[0].id.cf.indexA=0,N[0].id.cf.indexB=J.index,N[0].id.cf.typeA=h.e_vertex,N[0].id.cf.typeB=h.e_face,N[1].v=p,N[1].id.cf.indexA=0,N[1].id.cf.indexB=J.index,N[1].id.cf.typeA=h.e_vertex,N[1].id.cf.typeB=h.e_face,Xt.i1=J.index,Xt.i2=Xt.i1+1<Ot.count?Xt.i1+1:0,Xt.v1=Ot.vertices[Xt.i1],Xt.v2=Ot.vertices[Xt.i2],Xt.normal.set(Ot.normals[Xt.i1]);Xt.sideNormal1.set(Xt.normal.y,-Xt.normal.x),Xt.sideNormal2.setMul(-1,Xt.sideNormal1),Xt.sideOffset1=m.dot(Xt.sideNormal1,Xt.v1),Xt.sideOffset2=m.dot(Xt.sideNormal2,Xt.v2);var U=[new D,new D],$=[new D,new D];if(!(R(U,N,Xt.sideNormal1,Xt.sideOffset1,Xt.i1)<c.maxManifoldPoints||R($,U,Xt.sideNormal2,Xt.sideOffset2,Xt.i2)<c.maxManifoldPoints)){J.type==Vt.e_edgeA?(t.localNormal=m.clone(Xt.normal),t.localPoint=m.clone(Xt.v1)):(t.localNormal=m.clone(o.m_normals[Xt.i1]),t.localPoint=m.clone(o.m_vertices[Xt.i1]));var Q=0;for(F=0;F<c.maxManifoldPoints;++F){if(m.dot(Xt.normal,m.sub($[F].v,Xt.v1))<=q){var tt=t.points[Q];J.type==Vt.e_edgeA?(tt.localPoint=v.mulT(n,$[F].v),tt.id=$[F].id):(tt.localPoint=$[F].v,tt.id.cf.typeA=$[F].id.cf.typeB,tt.id.cf.typeB=$[F].id.cf.typeA,tt.id.cf.indexA=$[F].id.cf.indexB,tt.id.cf.indexB=$[F].id.cf.indexA),++Q}}t.pointCount=Q}}}}var Nt={frequencyHz:0,dampingRatio:0},Wt=function(t){function e(i,o,n,a,h){var _=this;if(!(_ instanceof e))return new e(i,o,n,a,h);if(n&&a&&"m_type"in a&&"x"in n&&"y"in n){var c=n;n=a,a=c}return i=s(i,Nt),o=(_=t.call(this,i,o,n)||this).m_bodyA,n=_.m_bodyB,_.m_type=e.TYPE,_.m_localAnchorA=m.clone(a?o.getLocalPoint(a):i.localAnchorA||m.zero()),_.m_localAnchorB=m.clone(h?n.getLocalPoint(h):i.localAnchorB||m.zero()),_.m_length=r.isFinite(i.length)?i.length:m.distance(o.getWorldPoint(_.m_localAnchorA),n.getWorldPoint(_.m_localAnchorB)),_.m_frequencyHz=i.frequencyHz,_.m_dampingRatio=i.dampingRatio,_.m_impulse=0,_.m_gamma=0,_.m_bias=0,_.m_u,_.m_rA,_.m_rB,_.m_localCenterA,_.m_localCenterB,_.m_invMassA,_.m_invMassB,_.m_invIA,_.m_invIB,_.m_mass,_}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,frequencyHz:this.m_frequencyHz,dampingRatio:this.m_dampingRatio,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,length:this.m_length,impulse:this.m_impulse,gamma:this.m_gamma,bias:this.m_bias}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB),t.length>0?this.m_length=+t.length:t.length<0||(t.anchorA||t.anchorA||t.anchorA||t.anchorA)&&(this.m_length=m.distance(this.m_bodyA.getWorldPoint(this.m_localAnchorA),this.m_bodyB.getWorldPoint(this.m_localAnchorB)))},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.setLength=function(t){this.m_length=t},e.prototype.getLength=function(){return this.m_length},e.prototype.setFrequency=function(t){this.m_frequencyHz=t},e.prototype.getFrequency=function(){return this.m_frequencyHz},e.prototype.setDampingRatio=function(t){this.m_dampingRatio=t},e.prototype.getDampingRatio=function(){return this.m_dampingRatio},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(this.m_impulse,this.m_u).mul(t)},e.prototype.getReactionTorque=function(t){return 0},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyA.c_velocity.v,s=this.m_bodyA.c_velocity.w,n=this.m_bodyB.c_position.c,a=this.m_bodyB.c_position.a,h=this.m_bodyB.c_velocity.v,_=this.m_bodyB.c_velocity.w,l=f.neo(i),u=f.neo(a);this.m_rA=f.mulVec2(l,m.sub(this.m_localAnchorA,this.m_localCenterA)),this.m_rB=f.mulVec2(u,m.sub(this.m_localAnchorB,this.m_localCenterB)),this.m_u=m.sub(m.add(n,this.m_rB),m.add(e,this.m_rA));var p=this.m_u.length();p>c.linearSlop?this.m_u.mul(1/p):this.m_u.set(0,0);var d=m.cross(this.m_rA,this.m_u),y=m.cross(this.m_rB,this.m_u),v=this.m_invMassA+this.m_invIA*d*d+this.m_invMassB+this.m_invIB*y*y;if(this.m_mass=0!=v?1/v:0,this.m_frequencyHz>0){var x=p-this.m_length,g=2*r.PI*this.m_frequencyHz,b=2*this.m_mass*this.m_dampingRatio*g,A=this.m_mass*g*g,B=t.dt;this.m_gamma=B*(b+B*A),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_bias=x*B*A*this.m_gamma,v+=this.m_gamma,this.m_mass=0!=v?1/v:0}else this.m_gamma=0,this.m_bias=0;if(t.warmStarting){this.m_impulse*=t.dtRatio;var w=m.mul(this.m_impulse,this.m_u);o.subMul(this.m_invMassA,w),s-=this.m_invIA*m.cross(this.m_rA,w),h.addMul(this.m_invMassB,w),_+=this.m_invIB*m.cross(this.m_rB,w)}else this.m_impulse=0;this.m_bodyA.c_velocity.v.set(o),this.m_bodyA.c_velocity.w=s,this.m_bodyB.c_velocity.v.set(h),this.m_bodyB.c_velocity.w=_},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=m.add(e,m.cross(i,this.m_rA)),r=m.add(o,m.cross(s,this.m_rB)),a=m.dot(this.m_u,r)-m.dot(this.m_u,n),h=-this.m_mass*(a+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=h;var _=m.mul(h,this.m_u);e.subMul(this.m_invMassA,_),i-=this.m_invIA*m.cross(this.m_rA,_),o.addMul(this.m_invMassB,_),s+=this.m_invIB*m.cross(this.m_rB,_),this.m_bodyA.c_velocity.v.set(e),this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v.set(o),this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyB.c_position.c,s=this.m_bodyB.c_position.a,n=f.neo(i),a=f.neo(s),h=f.mulSub(n,this.m_localAnchorA,this.m_localCenterA),_=f.mulSub(a,this.m_localAnchorB,this.m_localCenterB),l=m.sub(m.add(o,_),m.add(e,h)),u=l.normalize()-this.m_length;u=r.clamp(u,-c.maxLinearCorrection,c.maxLinearCorrection);var p=-this.m_mass*u,d=m.mul(p,l);return e.subMul(this.m_invMassA,d),i-=this.m_invIA*m.cross(h,d),o.addMul(this.m_invMassB,d),s+=this.m_invIB*m.cross(_,d),this.m_bodyA.c_position.c.set(e),this.m_bodyA.c_position.a=i,this.m_bodyB.c_position.c.set(o),this.m_bodyB.c_position.a=s,r.abs(u)<c.linearSlop},e.TYPE="distance-joint",e}(nt);nt.TYPES[Wt.TYPE]=Wt;var Ht={maxForce:0,maxTorque:0},Zt=function(t){function e(i,o,n,r){var a=this;return a instanceof e?(i=s(i,Ht),o=(a=t.call(this,i,o,n)||this).m_bodyA,n=a.m_bodyB,a.m_type=e.TYPE,a.m_localAnchorA=m.clone(r?o.getLocalPoint(r):i.localAnchorA||m.zero()),a.m_localAnchorB=m.clone(r?n.getLocalPoint(r):i.localAnchorB||m.zero()),a.m_linearImpulse=m.zero(),a.m_angularImpulse=0,a.m_maxForce=i.maxForce,a.m_maxTorque=i.maxTorque,a.m_rA,a.m_rB,a.m_localCenterA,a.m_localCenterB,a.m_invMassA,a.m_invMassB,a.m_invIA,a.m_invIB,a.m_linearMass,a.m_angularMass,a):new e(i,o,n,r)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,maxForce:this.m_maxForce,maxTorque:this.m_maxTorque,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB)},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.setMaxForce=function(t){this.m_maxForce=t},e.prototype.getMaxForce=function(){return this.m_maxForce},e.prototype.setMaxTorque=function(t){this.m_maxTorque=t},e.prototype.getMaxTorque=function(){return this.m_maxTorque},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(t,this.m_linearImpulse)},e.prototype.getReactionTorque=function(t){return t*this.m_angularImpulse},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.a,i=this.m_bodyA.c_velocity.v,o=this.m_bodyA.c_velocity.w,s=this.m_bodyB.c_position.a,n=this.m_bodyB.c_velocity.v,r=this.m_bodyB.c_velocity.w,a=f.neo(e),h=f.neo(s);this.m_rA=f.mulVec2(a,m.sub(this.m_localAnchorA,this.m_localCenterA)),this.m_rB=f.mulVec2(h,m.sub(this.m_localAnchorB,this.m_localCenterB));var _=this.m_invMassA,c=this.m_invMassB,l=this.m_invIA,u=this.m_invIB,p=new V;if(p.ex.x=_+c+l*this.m_rA.y*this.m_rA.y+u*this.m_rB.y*this.m_rB.y,p.ex.y=-l*this.m_rA.x*this.m_rA.y-u*this.m_rB.x*this.m_rB.y,p.ey.x=p.ex.y,p.ey.y=_+c+l*this.m_rA.x*this.m_rA.x+u*this.m_rB.x*this.m_rB.x,this.m_linearMass=p.getInverse(),this.m_angularMass=l+u,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.warmStarting){this.m_linearImpulse.mul(t.dtRatio),this.m_angularImpulse*=t.dtRatio;var d=m.neo(this.m_linearImpulse.x,this.m_linearImpulse.y);i.subMul(_,d),o-=l*(m.cross(this.m_rA,d)+this.m_angularImpulse),n.addMul(c,d),r+=u*(m.cross(this.m_rB,d)+this.m_angularImpulse)}else this.m_linearImpulse.setZero(),this.m_angularImpulse=0;this.m_bodyA.c_velocity.v=i,this.m_bodyA.c_velocity.w=o,this.m_bodyB.c_velocity.v=n,this.m_bodyB.c_velocity.w=r},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,_=this.m_invIB,c=t.dt,l=s-i,u=-this.m_angularMass*l,p=this.m_angularImpulse,d=c*this.m_maxTorque;this.m_angularImpulse=r.clamp(this.m_angularImpulse+u,-d,d),i-=h*(u=this.m_angularImpulse-p),s+=_*u;l=m.sub(m.add(o,m.cross(s,this.m_rB)),m.add(e,m.cross(i,this.m_rA))),u=m.neg(V.mulVec2(this.m_linearMass,l)),p=this.m_linearImpulse;this.m_linearImpulse.add(u);d=c*this.m_maxForce;this.m_linearImpulse.lengthSquared()>d*d&&(this.m_linearImpulse.normalize(),this.m_linearImpulse.mul(d)),u=m.sub(this.m_linearImpulse,p),e.subMul(n,u),i-=h*m.cross(this.m_rA,u),o.addMul(a,u),s+=_*m.cross(this.m_rB,u),this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){return!0},e.TYPE="friction-joint",e}(nt);nt.TYPES[Zt.TYPE]=Zt;var Kt={lowerAngle:0,upperAngle:0,maxMotorTorque:0,motorSpeed:0,enableLimit:!1,enableMotor:!1},Gt=function(t){function e(i,o,n,a){var h=this;return h instanceof e?(i=s(i,Kt),o=(h=t.call(this,i,o,n)||this).m_bodyA,n=h.m_bodyB,h.m_type=e.TYPE,h.m_localAnchorA=m.clone(a?o.getLocalPoint(a):i.localAnchorA||m.zero()),h.m_localAnchorB=m.clone(a?n.getLocalPoint(a):i.localAnchorB||m.zero()),h.m_referenceAngle=r.isFinite(i.referenceAngle)?i.referenceAngle:n.getAngle()-o.getAngle(),h.m_impulse=new xt,h.m_motorImpulse=0,h.m_lowerAngle=i.lowerAngle,h.m_upperAngle=i.upperAngle,h.m_maxMotorTorque=i.maxMotorTorque,h.m_motorSpeed=i.motorSpeed,h.m_enableLimit=i.enableLimit,h.m_enableMotor=i.enableMotor,h.m_rA,h.m_rB,h.m_localCenterA,h.m_localCenterB,h.m_invMassA,h.m_invMassB,h.m_invIA,h.m_invIB,h.m_mass=new Bt,h.m_motorMass,h.m_limitState=0,h):new e(i,o,n,a)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,lowerAngle:this.m_lowerAngle,upperAngle:this.m_upperAngle,maxMotorTorque:this.m_maxMotorTorque,motorSpeed:this.m_motorSpeed,enableLimit:this.m_enableLimit,enableMotor:this.m_enableMotor,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,referenceAngle:this.m_referenceAngle}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB)},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.getReferenceAngle=function(){return this.m_referenceAngle},e.prototype.getJointAngle=function(){var t=this.m_bodyA;return this.m_bodyB.m_sweep.a-t.m_sweep.a-this.m_referenceAngle},e.prototype.getJointSpeed=function(){var t=this.m_bodyA;return this.m_bodyB.m_angularVelocity-t.m_angularVelocity},e.prototype.isMotorEnabled=function(){return this.m_enableMotor},e.prototype.enableMotor=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_enableMotor=t},e.prototype.getMotorTorque=function(t){return t*this.m_motorImpulse},e.prototype.setMotorSpeed=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_motorSpeed=t},e.prototype.getMotorSpeed=function(){return this.m_motorSpeed},e.prototype.setMaxMotorTorque=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_maxMotorTorque=t},e.prototype.getMaxMotorTorque=function(){return this.m_maxMotorTorque},e.prototype.isLimitEnabled=function(){return this.m_enableLimit},e.prototype.enableLimit=function(t){t!=this.m_enableLimit&&(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},e.prototype.getLowerLimit=function(){return this.m_lowerAngle},e.prototype.getUpperLimit=function(){return this.m_upperAngle},e.prototype.setLimits=function(t,e){t==this.m_lowerAngle&&e==this.m_upperAngle||(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.neo(this.m_impulse.x,this.m_impulse.y).mul(t)},e.prototype.getReactionTorque=function(t){return t*this.m_impulse.z},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.a,i=this.m_bodyA.c_velocity.v,o=this.m_bodyA.c_velocity.w,s=this.m_bodyB.c_position.a,n=this.m_bodyB.c_velocity.v,a=this.m_bodyB.c_velocity.w,h=f.neo(e),_=f.neo(s);this.m_rA=f.mulVec2(h,m.sub(this.m_localAnchorA,this.m_localCenterA)),this.m_rB=f.mulVec2(_,m.sub(this.m_localAnchorB,this.m_localCenterB));var l=this.m_invMassA,u=this.m_invMassB,p=this.m_invIA,d=this.m_invIB,y=p+d===0;if(this.m_mass.ex.x=l+u+this.m_rA.y*this.m_rA.y*p+this.m_rB.y*this.m_rB.y*d,this.m_mass.ey.x=-this.m_rA.y*this.m_rA.x*p-this.m_rB.y*this.m_rB.x*d,this.m_mass.ez.x=-this.m_rA.y*p-this.m_rB.y*d,this.m_mass.ex.y=this.m_mass.ey.x,this.m_mass.ey.y=l+u+this.m_rA.x*this.m_rA.x*p+this.m_rB.x*this.m_rB.x*d,this.m_mass.ez.y=this.m_rA.x*p+this.m_rB.x*d,this.m_mass.ex.z=this.m_mass.ez.x,this.m_mass.ey.z=this.m_mass.ez.y,this.m_mass.ez.z=p+d,this.m_motorMass=p+d,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),(0==this.m_enableMotor||y)&&(this.m_motorImpulse=0),this.m_enableLimit&&0==y){var v=s-e-this.m_referenceAngle;r.abs(this.m_upperAngle-this.m_lowerAngle)<2*c.angularSlop?this.m_limitState=3:v<=this.m_lowerAngle?(1!=this.m_limitState&&(this.m_impulse.z=0),this.m_limitState=1):v>=this.m_upperAngle?(2!=this.m_limitState&&(this.m_impulse.z=0),this.m_limitState=2):(this.m_limitState=0,this.m_impulse.z=0)}else this.m_limitState=0;if(t.warmStarting){this.m_impulse.mul(t.dtRatio),this.m_motorImpulse*=t.dtRatio;var x=m.neo(this.m_impulse.x,this.m_impulse.y);i.subMul(l,x),o-=p*(m.cross(this.m_rA,x)+this.m_motorImpulse+this.m_impulse.z),n.addMul(u,x),a+=d*(m.cross(this.m_rB,x)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.setZero(),this.m_motorImpulse=0;this.m_bodyA.c_velocity.v=i,this.m_bodyA.c_velocity.w=o,this.m_bodyB.c_velocity.v=n,this.m_bodyB.c_velocity.w=a},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,_=this.m_invIB,c=h+_===0;if(this.m_enableMotor&&3!=this.m_limitState&&0==c){var l=s-i-this.m_motorSpeed,u=-this.m_motorMass*l,p=this.m_motorImpulse,d=t.dt*this.m_maxMotorTorque;this.m_motorImpulse=r.clamp(this.m_motorImpulse+u,-d,d),i-=h*(u=this.m_motorImpulse-p),s+=_*u}if(this.m_enableLimit&&0!=this.m_limitState&&0==c){var y=m.zero();y.addCombine(1,o,1,m.cross(s,this.m_rB)),y.subCombine(1,e,1,m.cross(i,this.m_rA));var f=s-i;l=new xt(y.x,y.y,f),u=xt.neg(this.m_mass.solve33(l));if(3==this.m_limitState)this.m_impulse.add(u);else if(1==this.m_limitState){if(this.m_impulse.z+u.z<0){var v=m.combine(-1,y,this.m_impulse.z,m.neo(this.m_mass.ez.x,this.m_mass.ez.y)),x=this.m_mass.solve22(v);u.x=x.x,u.y=x.y,u.z=-this.m_impulse.z,this.m_impulse.x+=x.x,this.m_impulse.y+=x.y,this.m_impulse.z=0}else this.m_impulse.add(u)}else if(2==this.m_limitState){if(this.m_impulse.z+u.z>0){v=m.combine(-1,y,this.m_impulse.z,m.neo(this.m_mass.ez.x,this.m_mass.ez.y)),x=this.m_mass.solve22(v);u.x=x.x,u.y=x.y,u.z=-this.m_impulse.z,this.m_impulse.x+=x.x,this.m_impulse.y+=x.y,this.m_impulse.z=0}else this.m_impulse.add(u)}var g=m.neo(u.x,u.y);e.subMul(n,g),i-=h*(m.cross(this.m_rA,g)+u.z),o.addMul(a,g),s+=_*(m.cross(this.m_rB,g)+u.z)}else{(l=m.zero()).addCombine(1,o,1,m.cross(s,this.m_rB)),l.subCombine(1,e,1,m.cross(i,this.m_rA));u=this.m_mass.solve22(m.neg(l));this.m_impulse.x+=u.x,this.m_impulse.y+=u.y,e.subMul(n,u),i-=h*m.cross(this.m_rA,u),o.addMul(a,u),s+=_*m.cross(this.m_rB,u)}this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){var e,i=this.m_bodyA.c_position.c,o=this.m_bodyA.c_position.a,s=this.m_bodyB.c_position.c,n=this.m_bodyB.c_position.a,a=f.neo(o),h=f.neo(n),_=0,l=this.m_invIA+this.m_invIB==0;if(this.m_enableLimit&&0!=this.m_limitState&&0==l){var u=n-o-this.m_referenceAngle,p=0;if(3==this.m_limitState){var d=r.clamp(u-this.m_lowerAngle,-c.maxAngularCorrection,c.maxAngularCorrection);p=-this.m_motorMass*d,_=r.abs(d)}else if(1==this.m_limitState){_=-(d=u-this.m_lowerAngle),d=r.clamp(d+c.angularSlop,-c.maxAngularCorrection,0),p=-this.m_motorMass*d}else if(2==this.m_limitState){_=d=u-this.m_upperAngle,d=r.clamp(d-c.angularSlop,0,c.maxAngularCorrection),p=-this.m_motorMass*d}o-=this.m_invIA*p,n+=this.m_invIB*p}a.set(o),h.set(n);var y=f.mulVec2(a,m.sub(this.m_localAnchorA,this.m_localCenterA)),v=f.mulVec2(h,m.sub(this.m_localAnchorB,this.m_localCenterB));(d=m.zero()).addCombine(1,s,1,v),d.subCombine(1,i,1,y),e=d.length();var x=this.m_invMassA,g=this.m_invMassB,b=this.m_invIA,A=this.m_invIB,B=new V;B.ex.x=x+g+b*y.y*y.y+A*v.y*v.y,B.ex.y=-b*y.x*y.y-A*v.x*v.y,B.ey.x=B.ex.y,B.ey.y=x+g+b*y.x*y.x+A*v.x*v.x;var w=m.neg(B.solve(d));return i.subMul(x,w),o-=b*m.cross(y,w),s.addMul(g,w),n+=A*m.cross(v,w),this.m_bodyA.c_position.c.set(i),this.m_bodyA.c_position.a=o,this.m_bodyB.c_position.c.set(s),this.m_bodyB.c_position.a=n,e<=c.linearSlop&&_<=c.angularSlop},e.TYPE="revolute-joint",e}(nt);nt.TYPES[Gt.TYPE]=Gt;var Ut={enableLimit:!1,lowerTranslation:0,upperTranslation:0,enableMotor:!1,maxMotorForce:0,motorSpeed:0},$t=function(t){function e(i,o,n,a,h){var _=this;return _ instanceof e?(i=s(i,Ut),o=(_=t.call(this,i,o,n)||this).m_bodyA,n=_.m_bodyB,_.m_type=e.TYPE,_.m_localAnchorA=m.clone(a?o.getLocalPoint(a):i.localAnchorA||m.zero()),_.m_localAnchorB=m.clone(a?n.getLocalPoint(a):i.localAnchorB||m.zero()),_.m_localXAxisA=m.clone(h?o.getLocalVector(h):i.localAxisA||m.neo(1,0)),_.m_localXAxisA.normalize(),_.m_localYAxisA=m.cross(1,_.m_localXAxisA),_.m_referenceAngle=r.isFinite(i.referenceAngle)?i.referenceAngle:n.getAngle()-o.getAngle(),_.m_impulse=new xt,_.m_motorMass=0,_.m_motorImpulse=0,_.m_lowerTranslation=i.lowerTranslation,_.m_upperTranslation=i.upperTranslation,_.m_maxMotorForce=i.maxMotorForce,_.m_motorSpeed=i.motorSpeed,_.m_enableLimit=i.enableLimit,_.m_enableMotor=i.enableMotor,_.m_limitState=0,_.m_axis=m.zero(),_.m_perp=m.zero(),_.m_localCenterA,_.m_localCenterB,_.m_invMassA,_.m_invMassB,_.m_invIA,_.m_invIB,_.m_axis,_.m_perp,_.m_s1,_.m_s2,_.m_a1,_.m_a2,_.m_K=new Bt,_.m_motorMass,_):new e(i,o,n,a,h)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,lowerTranslation:this.m_lowerTranslation,upperTranslation:this.m_upperTranslation,maxMotorForce:this.m_maxMotorForce,motorSpeed:this.m_motorSpeed,enableLimit:this.m_enableLimit,enableMotor:this.m_enableMotor,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,localAxisA:this.m_localXAxisA,referenceAngle:this.m_referenceAngle}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),t.localAxisA=new m(t.localAxisA),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB),t.localAxisA&&(this.m_localXAxisA.set(t.localAxisA),this.m_localYAxisA.set(m.cross(1,t.localAxisA)))},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.getLocalAxisA=function(){return this.m_localXAxisA},e.prototype.getReferenceAngle=function(){return this.m_referenceAngle},e.prototype.getJointTranslation=function(){var t=this.m_bodyA.getWorldPoint(this.m_localAnchorA),e=this.m_bodyB.getWorldPoint(this.m_localAnchorB),i=m.sub(e,t),o=this.m_bodyA.getWorldVector(this.m_localXAxisA);return m.dot(i,o)},e.prototype.getJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB,i=f.mulVec2(t.m_xf.q,m.sub(this.m_localAnchorA,t.m_sweep.localCenter)),o=f.mulVec2(e.m_xf.q,m.sub(this.m_localAnchorB,e.m_sweep.localCenter)),s=m.add(t.m_sweep.c,i),n=m.add(e.m_sweep.c,o),r=m.sub(n,s),a=f.mulVec2(t.m_xf.q,this.m_localXAxisA),h=t.m_linearVelocity,_=e.m_linearVelocity,c=t.m_angularVelocity,l=e.m_angularVelocity;return m.dot(r,m.cross(c,a))+m.dot(a,m.sub(m.addCross(_,l,o),m.addCross(h,c,i)))},e.prototype.isLimitEnabled=function(){return this.m_enableLimit},e.prototype.enableLimit=function(t){t!=this.m_enableLimit&&(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},e.prototype.getLowerLimit=function(){return this.m_lowerTranslation},e.prototype.getUpperLimit=function(){return this.m_upperTranslation},e.prototype.setLimits=function(t,e){t==this.m_lowerTranslation&&e==this.m_upperTranslation||(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},e.prototype.isMotorEnabled=function(){return this.m_enableMotor},e.prototype.enableMotor=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_enableMotor=t},e.prototype.setMotorSpeed=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_motorSpeed=t},e.prototype.setMaxMotorForce=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_maxMotorForce=t},e.prototype.getMaxMotorForce=function(){return this.m_maxMotorForce},e.prototype.getMotorSpeed=function(){return this.m_motorSpeed},e.prototype.getMotorForce=function(t){return t*this.m_motorImpulse},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.combine(this.m_impulse.x,this.m_perp,this.m_motorImpulse+this.m_impulse.z,this.m_axis).mul(t)},e.prototype.getReactionTorque=function(t){return t*this.m_impulse.y},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyA.c_velocity.v,s=this.m_bodyA.c_velocity.w,n=this.m_bodyB.c_position.c,a=this.m_bodyB.c_position.a,h=this.m_bodyB.c_velocity.v,_=this.m_bodyB.c_velocity.w,l=f.neo(i),u=f.neo(a),p=f.mulVec2(l,m.sub(this.m_localAnchorA,this.m_localCenterA)),d=f.mulVec2(u,m.sub(this.m_localAnchorB,this.m_localCenterB)),y=m.zero();y.addCombine(1,n,1,d),y.subCombine(1,e,1,p);var v=this.m_invMassA,x=this.m_invMassB,g=this.m_invIA,b=this.m_invIB;this.m_axis=f.mulVec2(l,this.m_localXAxisA),this.m_a1=m.cross(m.add(y,p),this.m_axis),this.m_a2=m.cross(d,this.m_axis),this.m_motorMass=v+x+g*this.m_a1*this.m_a1+b*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),this.m_perp=f.mulVec2(l,this.m_localYAxisA),this.m_s1=m.cross(m.add(y,p),this.m_perp),this.m_s2=m.cross(d,this.m_perp),m.cross(p,this.m_perp);var A=v+x+g*this.m_s1*this.m_s1+b*this.m_s2*this.m_s2,B=g*this.m_s1+b*this.m_s2,w=g*this.m_s1*this.m_a1+b*this.m_s2*this.m_a2,C=g+b;0==C&&(C=1);var M=g*this.m_a1+b*this.m_a2,I=v+x+g*this.m_a1*this.m_a1+b*this.m_a2*this.m_a2;if(this.m_K.ex.set(A,B,w),this.m_K.ey.set(B,C,M),this.m_K.ez.set(w,M,I),this.m_enableLimit){var S=m.dot(this.m_axis,y);r.abs(this.m_upperTranslation-this.m_lowerTranslation)<2*c.linearSlop?this.m_limitState=3:S<=this.m_lowerTranslation?1!=this.m_limitState&&(this.m_limitState=1,this.m_impulse.z=0):S>=this.m_upperTranslation?2!=this.m_limitState&&(this.m_limitState=2,this.m_impulse.z=0):(this.m_limitState=0,this.m_impulse.z=0)}else this.m_limitState=0,this.m_impulse.z=0;if(0==this.m_enableMotor&&(this.m_motorImpulse=0),t.warmStarting){this.m_impulse.mul(t.dtRatio),this.m_motorImpulse*=t.dtRatio;var P=m.combine(this.m_impulse.x,this.m_perp,this.m_motorImpulse+this.m_impulse.z,this.m_axis),z=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,T=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;o.subMul(v,P),s-=g*z,h.addMul(x,P),_+=b*T}else this.m_impulse.setZero(),this.m_motorImpulse=0;this.m_bodyA.c_velocity.v.set(o),this.m_bodyA.c_velocity.w=s,this.m_bodyB.c_velocity.v.set(h),this.m_bodyB.c_velocity.w=_},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,_=this.m_invIB;if(this.m_enableMotor&&3!=this.m_limitState){var c=m.dot(this.m_axis,m.sub(o,e))+this.m_a2*s-this.m_a1*i,l=this.m_motorMass*(this.m_motorSpeed-c),u=this.m_motorImpulse,p=t.dt*this.m_maxMotorForce;this.m_motorImpulse=r.clamp(this.m_motorImpulse+l,-p,p),l=this.m_motorImpulse-u;var d=m.mul(l,this.m_axis),y=l*this.m_a1,f=l*this.m_a2;e.subMul(n,d),i-=h*y,o.addMul(a,d),s+=_*f}var v=m.zero();if(v.x+=m.dot(this.m_perp,o)+this.m_s2*s,v.x-=m.dot(this.m_perp,e)+this.m_s1*i,v.y=s-i,this.m_enableLimit&&0!=this.m_limitState){var x=0;x+=m.dot(this.m_axis,o)+this.m_a2*s,x-=m.dot(this.m_axis,e)+this.m_a1*i;c=new xt(v.x,v.y,x);var g=new xt(this.m_impulse),b=this.m_K.solve33(xt.neg(c));this.m_impulse.add(b),1==this.m_limitState?this.m_impulse.z=r.max(this.m_impulse.z,0):2==this.m_limitState&&(this.m_impulse.z=r.min(this.m_impulse.z,0));var A=m.combine(-1,v,-(this.m_impulse.z-g.z),m.neo(this.m_K.ez.x,this.m_K.ez.y)),B=m.add(this.m_K.solve22(A),m.neo(g.x,g.y));this.m_impulse.x=B.x,this.m_impulse.y=B.y,b=xt.sub(this.m_impulse,g);d=m.combine(b.x,this.m_perp,b.z,this.m_axis),y=b.x*this.m_s1+b.y+b.z*this.m_a1,f=b.x*this.m_s2+b.y+b.z*this.m_a2;e.subMul(n,d),i-=h*y,o.addMul(a,d),s+=_*f}else{b=this.m_K.solve22(m.neg(v));this.m_impulse.x+=b.x,this.m_impulse.y+=b.y;d=m.mul(b.x,this.m_perp),y=b.x*this.m_s1+b.y,f=b.x*this.m_s2+b.y;e.subMul(n,d),i-=h*y,o.addMul(a,d),s+=_*f}this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyB.c_position.c,s=this.m_bodyB.c_position.a,n=f.neo(i),a=f.neo(s),h=this.m_invMassA,_=this.m_invMassB,l=this.m_invIA,u=this.m_invIB,p=f.mulVec2(n,m.sub(this.m_localAnchorA,this.m_localCenterA)),d=f.mulVec2(a,m.sub(this.m_localAnchorB,this.m_localCenterB)),y=m.sub(m.add(o,d),m.add(e,p)),v=f.mulVec2(n,this.m_localXAxisA),x=m.cross(m.add(y,p),v),g=m.cross(d,v),b=f.mulVec2(n,this.m_localYAxisA),A=m.cross(m.add(y,p),b),B=m.cross(d,b),w=new xt,C=m.zero();C.x=m.dot(b,y),C.y=s-i-this.m_referenceAngle;var M=r.abs(C.x),I=r.abs(C.y),S=c.linearSlop,P=c.maxLinearCorrection,z=!1,T=0;if(this.m_enableLimit){var k=m.dot(v,y);r.abs(this.m_upperTranslation-this.m_lowerTranslation)<2*S?(T=r.clamp(k,-P,P),M=r.max(M,r.abs(k)),z=!0):k<=this.m_lowerTranslation?(T=r.clamp(k-this.m_lowerTranslation+S,-P,0),M=r.max(M,this.m_lowerTranslation-k),z=!0):k>=this.m_upperTranslation&&(T=r.clamp(k-this.m_upperTranslation-S,0,P),M=r.max(M,k-this.m_upperTranslation),z=!0)}if(z){var L=h+_+l*A*A+u*B*B,F=l*A+u*B,q=l*A*x+u*B*g;0==(D=l+u)&&(D=1);var j=l*x+u*g,E=h+_+l*x*x+u*g*g;(R=new Bt).ex.set(L,F,q),R.ey.set(F,D,j),R.ez.set(q,j,E);var Y=new xt;Y.x=C.x,Y.y=C.y,Y.z=T,w=R.solve33(xt.neg(Y))}else{var D,R;L=h+_+l*A*A+u*B*B,F=l*A+u*B;0==(D=l+u)&&(D=1),(R=new V).ex.set(L,F),R.ey.set(F,D);var O=R.solve(m.neg(C));w.x=O.x,w.y=O.y,w.z=0}var X=m.combine(w.x,b,w.z,v),J=w.x*A+w.y+w.z*x,N=w.x*B+w.y+w.z*g;return e.subMul(h,X),i-=l*J,o.addMul(_,X),s+=u*N,this.m_bodyA.c_position.c=e,this.m_bodyA.c_position.a=i,this.m_bodyB.c_position.c=o,this.m_bodyB.c_position.a=s,M<=c.linearSlop&&I<=c.angularSlop},e.TYPE="prismatic-joint",e}(nt);nt.TYPES[$t.TYPE]=$t;var Qt={ratio:1},te=function(t){function e(i,o,n,a,h,_){var c,l,u=this;if(!(u instanceof e))return new e(i,o,n,a,h,_);i=s(i,Qt),o=(u=t.call(this,i,o,n)||this).m_bodyA,n=u.m_bodyB,u.m_type=e.TYPE,u.m_joint1=a||i.joint1,u.m_joint2=h||i.joint2,u.m_ratio=r.isFinite(_)?_:i.ratio,u.m_type1=u.m_joint1.getType(),u.m_type2=u.m_joint2.getType(),u.m_bodyC=u.m_joint1.getBodyA(),u.m_bodyA=u.m_joint1.getBodyB();var p=u.m_bodyA.m_xf,d=u.m_bodyA.m_sweep.a,y=u.m_bodyC.m_xf,v=u.m_bodyC.m_sweep.a;if(u.m_type1===Gt.TYPE){var x=u.m_joint1;u.m_localAnchorC=x.m_localAnchorA,u.m_localAnchorA=x.m_localAnchorB,u.m_referenceAngleA=x.m_referenceAngle,u.m_localAxisC=m.zero(),c=d-v-u.m_referenceAngleA}else{var g=u.m_joint1;u.m_localAnchorC=g.m_localAnchorA,u.m_localAnchorA=g.m_localAnchorB,u.m_referenceAngleA=g.m_referenceAngle,u.m_localAxisC=g.m_localXAxisA;var b=u.m_localAnchorC,A=f.mulTVec2(y.q,m.add(f.mul(p.q,u.m_localAnchorA),m.sub(p.p,y.p)));c=m.dot(A,u.m_localAxisC)-m.dot(b,u.m_localAxisC)}u.m_bodyD=u.m_joint2.getBodyA(),u.m_bodyB=u.m_joint2.getBodyB();var B=u.m_bodyB.m_xf,w=u.m_bodyB.m_sweep.a,C=u.m_bodyD.m_xf,M=u.m_bodyD.m_sweep.a;if(u.m_type2===Gt.TYPE){x=u.m_joint2;u.m_localAnchorD=x.m_localAnchorA,u.m_localAnchorB=x.m_localAnchorB,u.m_referenceAngleB=x.m_referenceAngle,u.m_localAxisD=m.zero(),l=w-M-u.m_referenceAngleB}else{g=u.m_joint2;u.m_localAnchorD=g.m_localAnchorA,u.m_localAnchorB=g.m_localAnchorB,u.m_referenceAngleB=g.m_referenceAngle,u.m_localAxisD=g.m_localXAxisA;var I=u.m_localAnchorD,S=f.mulTVec2(C.q,m.add(f.mul(B.q,u.m_localAnchorB),m.sub(B.p,C.p)));l=m.dot(S,u.m_localAxisD)-m.dot(I,u.m_localAxisD)}return u.m_constant=c+u.m_ratio*l,u.m_impulse=0,u.m_lcA,u.m_lcB,u.m_lcC,u.m_lcD,u.m_mA,u.m_mB,u.m_mC,u.m_mD,u.m_iA,u.m_iB,u.m_iC,u.m_iD,u.m_JvAC,u.m_JvBD,u.m_JwA,u.m_JwB,u.m_JwC,u.m_JwD,u.m_mass,u}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,joint1:this.m_joint1,joint2:this.m_joint2,ratio:this.m_ratio}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),t.joint1=s(nt,t.joint1,i),t.joint2=s(nt,t.joint2,i),new e(t)},e.prototype.getJoint1=function(){return this.m_joint1},e.prototype.getJoint2=function(){return this.m_joint2},e.prototype.setRatio=function(t){this.m_ratio=t},e.prototype.getRatio=function(){return this.m_ratio},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(this.m_impulse,this.m_JvAC).mul(t)},e.prototype.getReactionTorque=function(t){return t*(this.m_impulse*this.m_JwA)},e.prototype.initVelocityConstraints=function(t){this.m_lcA=this.m_bodyA.m_sweep.localCenter,this.m_lcB=this.m_bodyB.m_sweep.localCenter,this.m_lcC=this.m_bodyC.m_sweep.localCenter,this.m_lcD=this.m_bodyD.m_sweep.localCenter,this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var e=this.m_bodyA.c_position.a,i=this.m_bodyA.c_velocity.v,o=this.m_bodyA.c_velocity.w,s=this.m_bodyB.c_position.a,n=this.m_bodyB.c_velocity.v,r=this.m_bodyB.c_velocity.w,a=this.m_bodyC.c_position.a,h=this.m_bodyC.c_velocity.v,_=this.m_bodyC.c_velocity.w,c=this.m_bodyD.c_position.a,l=this.m_bodyD.c_velocity.v,u=this.m_bodyD.c_velocity.w,p=f.neo(e),d=f.neo(s),y=f.neo(a),v=f.neo(c);if(this.m_mass=0,this.m_type1==Gt.TYPE)this.m_JvAC=m.zero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var x=f.mulVec2(y,this.m_localAxisC),g=f.mulSub(y,this.m_localAnchorC,this.m_lcC),b=f.mulSub(p,this.m_localAnchorA,this.m_lcA);this.m_JvAC=x,this.m_JwC=m.cross(g,x),this.m_JwA=m.cross(b,x),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_type2==Gt.TYPE)this.m_JvBD=m.zero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{x=f.mulVec2(v,this.m_localAxisD);var A=f.mulSub(v,this.m_localAnchorD,this.m_lcD),B=f.mulSub(d,this.m_localAnchorB,this.m_lcB);this.m_JvBD=m.mul(this.m_ratio,x),this.m_JwD=this.m_ratio*m.cross(A,x),this.m_JwB=this.m_ratio*m.cross(B,x),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,t.warmStarting?(i.addMul(this.m_mA*this.m_impulse,this.m_JvAC),o+=this.m_iA*this.m_impulse*this.m_JwA,n.addMul(this.m_mB*this.m_impulse,this.m_JvBD),r+=this.m_iB*this.m_impulse*this.m_JwB,h.subMul(this.m_mC*this.m_impulse,this.m_JvAC),_-=this.m_iC*this.m_impulse*this.m_JwC,l.subMul(this.m_mD*this.m_impulse,this.m_JvBD),u-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,this.m_bodyA.c_velocity.v.set(i),this.m_bodyA.c_velocity.w=o,this.m_bodyB.c_velocity.v.set(n),this.m_bodyB.c_velocity.w=r,this.m_bodyC.c_velocity.v.set(h),this.m_bodyC.c_velocity.w=_,this.m_bodyD.c_velocity.v.set(l),this.m_bodyD.c_velocity.w=u},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_bodyC.c_velocity.v,r=this.m_bodyC.c_velocity.w,a=this.m_bodyD.c_velocity.v,h=this.m_bodyD.c_velocity.w,_=m.dot(this.m_JvAC,e)-m.dot(this.m_JvAC,n)+m.dot(this.m_JvBD,o)-m.dot(this.m_JvBD,a);_+=this.m_JwA*i-this.m_JwC*r+(this.m_JwB*s-this.m_JwD*h);var c=-this.m_mass*_;this.m_impulse+=c,e.addMul(this.m_mA*c,this.m_JvAC),i+=this.m_iA*c*this.m_JwA,o.addMul(this.m_mB*c,this.m_JvBD),s+=this.m_iB*c*this.m_JwB,n.subMul(this.m_mC*c,this.m_JvAC),r-=this.m_iC*c*this.m_JwC,a.subMul(this.m_mD*c,this.m_JvBD),h-=this.m_iD*c*this.m_JwD,this.m_bodyA.c_velocity.v.set(e),this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v.set(o),this.m_bodyB.c_velocity.w=s,this.m_bodyC.c_velocity.v.set(n),this.m_bodyC.c_velocity.w=r,this.m_bodyD.c_velocity.v.set(a),this.m_bodyD.c_velocity.w=h},e.prototype.solvePositionConstraints=function(t){var e,i,o,s,n,r,a,h,_=this.m_bodyA.c_position.c,l=this.m_bodyA.c_position.a,u=this.m_bodyB.c_position.c,p=this.m_bodyB.c_position.a,d=this.m_bodyC.c_position.c,y=this.m_bodyC.c_position.a,v=this.m_bodyD.c_position.c,x=this.m_bodyD.c_position.a,g=f.neo(l),b=f.neo(p),A=f.neo(y),B=f.neo(x),w=0;if(this.m_type1==Gt.TYPE)o=m.zero(),n=1,a=1,w+=this.m_iA+this.m_iC,e=l-y-this.m_referenceAngleA;else{var C=f.mulVec2(A,this.m_localAxisC),M=f.mulSub(A,this.m_localAnchorC,this.m_lcC),I=f.mulSub(g,this.m_localAnchorA,this.m_lcA);o=C,a=m.cross(M,C),n=m.cross(I,C),w+=this.m_mC+this.m_mA+this.m_iC*a*a+this.m_iA*n*n;var S=m.sub(this.m_localAnchorC,this.m_lcC),P=f.mulTVec2(A,m.add(I,m.sub(_,d)));e=m.dot(m.sub(P,S),this.m_localAxisC)}if(this.m_type2==Gt.TYPE)s=m.zero(),r=this.m_ratio,h=this.m_ratio,w+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),i=p-x-this.m_referenceAngleB;else{C=f.mulVec2(B,this.m_localAxisD);var z=f.mulSub(B,this.m_localAnchorD,this.m_lcD),T=f.mulSub(b,this.m_localAnchorB,this.m_lcB);s=m.mul(this.m_ratio,C),h=this.m_ratio*m.cross(z,C),r=this.m_ratio*m.cross(T,C),w+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*r*r;var V=m.sub(this.m_localAnchorD,this.m_lcD),k=f.mulTVec2(B,m.add(T,m.sub(u,v)));i=m.dot(k,this.m_localAxisD)-m.dot(V,this.m_localAxisD)}var L=e+this.m_ratio*i-this.m_constant,F=0;return w>0&&(F=-L/w),_.addMul(this.m_mA*F,o),l+=this.m_iA*F*n,u.addMul(this.m_mB*F,s),p+=this.m_iB*F*r,d.subMul(this.m_mC*F,o),y-=this.m_iC*F*a,v.subMul(this.m_mD*F,s),x-=this.m_iD*F*h,this.m_bodyA.c_position.c.set(_),this.m_bodyA.c_position.a=l,this.m_bodyB.c_position.c.set(u),this.m_bodyB.c_position.a=p,this.m_bodyC.c_position.c.set(d),this.m_bodyC.c_position.a=y,this.m_bodyD.c_position.c.set(v),this.m_bodyD.c_position.a=x,0<c.linearSlop},e.TYPE="gear-joint",e}(nt);nt.TYPES[te.TYPE]=te;var ee={maxForce:1,maxTorque:1,correctionFactor:.3},ie=function(t){function e(i,o,n){var a=this;return a instanceof e?(i=s(i,ee),o=(a=t.call(this,i,o,n)||this).m_bodyA,n=a.m_bodyB,a.m_type=e.TYPE,a.m_linearOffset=r.isFinite(i.linearOffset)?i.linearOffset:o.getLocalPoint(n.getPosition()),a.m_angularOffset=r.isFinite(i.angularOffset)?i.angularOffset:n.getAngle()-o.getAngle(),a.m_linearImpulse=m.zero(),a.m_angularImpulse=0,a.m_maxForce=i.maxForce,a.m_maxTorque=i.maxTorque,a.m_correctionFactor=i.correctionFactor,a.m_rA,a.m_rB,a.m_localCenterA,a.m_localCenterB,a.m_linearError,a.m_angularError,a.m_invMassA,a.m_invMassB,a.m_invIA,a.m_invIB,a.m_linearMass,a.m_angularMass,a):new e(i,o,n)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,maxForce:this.m_maxForce,maxTorque:this.m_maxTorque,correctionFactor:this.m_correctionFactor,linearOffset:this.m_linearOffset,angularOffset:this.m_angularOffset}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){},e.prototype.setMaxForce=function(t){this.m_maxForce=t},e.prototype.getMaxForce=function(){return this.m_maxForce},e.prototype.setMaxTorque=function(t){this.m_maxTorque=t},e.prototype.getMaxTorque=function(){return this.m_maxTorque},e.prototype.setCorrectionFactor=function(t){this.m_correctionFactor=t},e.prototype.getCorrectionFactor=function(){return this.m_correctionFactor},e.prototype.setLinearOffset=function(t){t.x==this.m_linearOffset.x&&t.y==this.m_linearOffset.y||(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_linearOffset=t)},e.prototype.getLinearOffset=function(){return this.m_linearOffset},e.prototype.setAngularOffset=function(t){t!=this.m_angularOffset&&(this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_angularOffset=t)},e.prototype.getAngularOffset=function(){return this.m_angularOffset},e.prototype.getAnchorA=function(){return this.m_bodyA.getPosition()},e.prototype.getAnchorB=function(){return this.m_bodyB.getPosition()},e.prototype.getReactionForce=function(t){return m.mul(t,this.m_linearImpulse)},e.prototype.getReactionTorque=function(t){return t*this.m_angularImpulse},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyA.c_velocity.v,s=this.m_bodyA.c_velocity.w,n=this.m_bodyB.c_position.c,r=this.m_bodyB.c_position.a,a=this.m_bodyB.c_velocity.v,h=this.m_bodyB.c_velocity.w,_=f.neo(i),c=f.neo(r);this.m_rA=f.mulVec2(_,m.neg(this.m_localCenterA)),this.m_rB=f.mulVec2(c,m.neg(this.m_localCenterB));var l=this.m_invMassA,u=this.m_invMassB,p=this.m_invIA,d=this.m_invIB,y=new V;if(y.ex.x=l+u+p*this.m_rA.y*this.m_rA.y+d*this.m_rB.y*this.m_rB.y,y.ex.y=-p*this.m_rA.x*this.m_rA.y-d*this.m_rB.x*this.m_rB.y,y.ey.x=y.ex.y,y.ey.y=l+u+p*this.m_rA.x*this.m_rA.x+d*this.m_rB.x*this.m_rB.x,this.m_linearMass=y.getInverse(),this.m_angularMass=p+d,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),this.m_linearError=m.zero(),this.m_linearError.addCombine(1,n,1,this.m_rB),this.m_linearError.subCombine(1,e,1,this.m_rA),this.m_linearError.sub(f.mulVec2(_,this.m_linearOffset)),this.m_angularError=r-i-this.m_angularOffset,t.warmStarting){this.m_linearImpulse.mul(t.dtRatio),this.m_angularImpulse*=t.dtRatio;var v=m.neo(this.m_linearImpulse.x,this.m_linearImpulse.y);o.subMul(l,v),s-=p*(m.cross(this.m_rA,v)+this.m_angularImpulse),a.addMul(u,v),h+=d*(m.cross(this.m_rB,v)+this.m_angularImpulse)}else this.m_linearImpulse.setZero(),this.m_angularImpulse=0;this.m_bodyA.c_velocity.v=o,this.m_bodyA.c_velocity.w=s,this.m_bodyB.c_velocity.v=a,this.m_bodyB.c_velocity.w=h},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_invMassA,a=this.m_invMassB,h=this.m_invIA,_=this.m_invIB,c=t.dt,l=t.inv_dt,u=s-i+l*this.m_correctionFactor*this.m_angularError,p=-this.m_angularMass*u,d=this.m_angularImpulse,y=c*this.m_maxTorque;this.m_angularImpulse=r.clamp(this.m_angularImpulse+p,-y,y),i-=h*(p=this.m_angularImpulse-d),s+=_*p,(u=m.zero()).addCombine(1,o,1,m.cross(s,this.m_rB)),u.subCombine(1,e,1,m.cross(i,this.m_rA)),u.addMul(l*this.m_correctionFactor,this.m_linearError);p=m.neg(V.mulVec2(this.m_linearMass,u)),d=m.clone(this.m_linearImpulse);this.m_linearImpulse.add(p);y=c*this.m_maxForce;this.m_linearImpulse.clamp(y),p=m.sub(this.m_linearImpulse,d),e.subMul(n,p),i-=h*m.cross(this.m_rA,p),o.addMul(a,p),s+=_*m.cross(this.m_rB,p),this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){return!0},e.TYPE="motor-joint",e}(nt);nt.TYPES[ie.TYPE]=ie;var oe={maxForce:0,frequencyHz:5,dampingRatio:.7},se=function(t){function e(i,o,n,r){var a=this;return a instanceof e?(i=s(i,oe),o=(a=t.call(this,i,o,n)||this).m_bodyA,n=a.m_bodyB,a.m_type=e.TYPE,a.m_targetA=r?m.clone(r):i.target||m.zero(),a.m_localAnchorB=v.mulTVec2(n.getTransform(),a.m_targetA),a.m_maxForce=i.maxForce,a.m_impulse=m.zero(),a.m_frequencyHz=i.frequencyHz,a.m_dampingRatio=i.dampingRatio,a.m_beta=0,a.m_gamma=0,a.m_rB=m.zero(),a.m_localCenterB=m.zero(),a.m_invMassB=0,a.m_invIB=0,a.m_mass=new V,a.m_C=m.zero(),a):new e(i,o,n,r)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,target:this.m_targetA,maxForce:this.m_maxForce,frequencyHz:this.m_frequencyHz,dampingRatio:this.m_dampingRatio,_localAnchorB:this.m_localAnchorB}},e._deserialize=function(t,i,s){(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),t.target=new m(t.target);var n=new e(t);return t._localAnchorB&&(n.m_localAnchorB=t._localAnchorB),n},e.prototype.setTarget=function(t){0==this.m_bodyB.isAwake()&&this.m_bodyB.setAwake(!0),this.m_targetA=m.clone(t)},e.prototype.getTarget=function(){return this.m_targetA},e.prototype.setMaxForce=function(t){this.m_maxForce=t},e.prototype.getMaxForce=function(){return this.m_maxForce},e.prototype.setFrequency=function(t){this.m_frequencyHz=t},e.prototype.getFrequency=function(){return this.m_frequencyHz},e.prototype.setDampingRatio=function(t){this.m_dampingRatio=t},e.prototype.getDampingRatio=function(){return this.m_dampingRatio},e.prototype.getAnchorA=function(){return m.clone(this.m_targetA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(t,this.m_impulse)},e.prototype.getReactionTorque=function(t){return 0*t},e.prototype.shiftOrigin=function(t){this.m_targetA.sub(t)},e.prototype.initVelocityConstraints=function(t){this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyB.c_position,i=this.m_bodyB.c_velocity,o=e.c,s=e.a,n=i.v,a=i.w,h=f.neo(s),_=this.m_bodyB.getMass(),c=2*r.PI*this.m_frequencyHz,l=2*_*this.m_dampingRatio*c,u=_*(c*c),p=t.dt;this.m_gamma=p*(l+p*u),0!=this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=p*u*this.m_gamma,this.m_rB=f.mulVec2(h,m.sub(this.m_localAnchorB,this.m_localCenterB));var d=new V;d.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,d.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,d.ey.x=d.ex.y,d.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,this.m_mass=d.getInverse(),this.m_C.set(o),this.m_C.addCombine(1,this.m_rB,-1,this.m_targetA),this.m_C.mul(this.m_beta),a*=.98,t.warmStarting?(this.m_impulse.mul(t.dtRatio),n.addMul(this.m_invMassB,this.m_impulse),a+=this.m_invIB*m.cross(this.m_rB,this.m_impulse)):this.m_impulse.setZero(),i.v.set(n),i.w=a},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyB.c_velocity,i=m.clone(e.v),o=e.w,s=m.cross(o,this.m_rB);s.add(i),s.addCombine(1,this.m_C,this.m_gamma,this.m_impulse),s.neg();var n=V.mulVec2(this.m_mass,s),r=m.clone(this.m_impulse);this.m_impulse.add(n);var a=t.dt*this.m_maxForce;this.m_impulse.clamp(a),n=m.sub(this.m_impulse,r),i.addMul(this.m_invMassB,n),o+=this.m_invIB*m.cross(this.m_rB,n),e.v.set(i),e.w=o},e.prototype.solvePositionConstraints=function(t){return!0},e.TYPE="mouse-joint",e}(nt);nt.TYPES[se.TYPE]=se;var ne={collideConnected:!0},re=function(t){function e(i,o,n,a,h,_,c,l){var u=this;return u instanceof e?(i=s(i,ne),o=(u=t.call(this,i,o,n)||this).m_bodyA,n=u.m_bodyB,u.m_type=e.TYPE,u.m_groundAnchorA=a||(i.groundAnchorA||m.neo(-1,1)),u.m_groundAnchorB=h||(i.groundAnchorB||m.neo(1,1)),u.m_localAnchorA=_?o.getLocalPoint(_):i.localAnchorA||m.neo(-1,0),u.m_localAnchorB=c?n.getLocalPoint(c):i.localAnchorB||m.neo(1,0),u.m_lengthA=r.isFinite(i.lengthA)?i.lengthA:m.distance(_,a),u.m_lengthB=r.isFinite(i.lengthB)?i.lengthB:m.distance(c,h),u.m_ratio=r.isFinite(l)?l:i.ratio,u.m_constant=u.m_lengthA+u.m_ratio*u.m_lengthB,u.m_impulse=0,u.m_uA,u.m_uB,u.m_rA,u.m_rB,u.m_localCenterA,u.m_localCenterB,u.m_invMassA,u.m_invMassB,u.m_invIA,u.m_invIB,u.m_mass,u):new e(i,o,n,a,h,_,c,l)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,groundAnchorA:this.m_groundAnchorA,groundAnchorB:this.m_groundAnchorB,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,lengthA:this.m_lengthA,lengthB:this.m_lengthB,ratio:this.m_ratio}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype.getGroundAnchorA=function(){return this.m_groundAnchorA},e.prototype.getGroundAnchorB=function(){return this.m_groundAnchorB},e.prototype.getLengthA=function(){return this.m_lengthA},e.prototype.getLengthB=function(){return this.m_lengthB},e.prototype.getRatio=function(){return this.m_ratio},e.prototype.getCurrentLengthA=function(){var t=this.m_bodyA.getWorldPoint(this.m_localAnchorA),e=this.m_groundAnchorA;return m.distance(t,e)},e.prototype.getCurrentLengthB=function(){var t=this.m_bodyB.getWorldPoint(this.m_localAnchorB),e=this.m_groundAnchorB;return m.distance(t,e)},e.prototype.shiftOrigin=function(t){this.m_groundAnchorA.sub(t),this.m_groundAnchorB.sub(t)},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(this.m_impulse,this.m_uB).mul(t)},e.prototype.getReactionTorque=function(t){return 0},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyA.c_velocity.v,s=this.m_bodyA.c_velocity.w,n=this.m_bodyB.c_position.c,r=this.m_bodyB.c_position.a,a=this.m_bodyB.c_velocity.v,h=this.m_bodyB.c_velocity.w,_=f.neo(i),l=f.neo(r);this.m_rA=f.mulVec2(_,m.sub(this.m_localAnchorA,this.m_localCenterA)),this.m_rB=f.mulVec2(l,m.sub(this.m_localAnchorB,this.m_localCenterB)),this.m_uA=m.sub(m.add(e,this.m_rA),this.m_groundAnchorA),this.m_uB=m.sub(m.add(n,this.m_rB),this.m_groundAnchorB);var u=this.m_uA.length(),p=this.m_uB.length();u>10*c.linearSlop?this.m_uA.mul(1/u):this.m_uA.setZero(),p>10*c.linearSlop?this.m_uB.mul(1/p):this.m_uB.setZero();var d=m.cross(this.m_rA,this.m_uA),y=m.cross(this.m_rB,this.m_uB),v=this.m_invMassA+this.m_invIA*d*d,x=this.m_invMassB+this.m_invIB*y*y;if(this.m_mass=v+this.m_ratio*this.m_ratio*x,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.warmStarting){this.m_impulse*=t.dtRatio;var g=m.mul(-this.m_impulse,this.m_uA),b=m.mul(-this.m_ratio*this.m_impulse,this.m_uB);o.addMul(this.m_invMassA,g),s+=this.m_invIA*m.cross(this.m_rA,g),a.addMul(this.m_invMassB,b),h+=this.m_invIB*m.cross(this.m_rB,b)}else this.m_impulse=0;this.m_bodyA.c_velocity.v=o,this.m_bodyA.c_velocity.w=s,this.m_bodyB.c_velocity.v=a,this.m_bodyB.c_velocity.w=h},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=m.add(e,m.cross(i,this.m_rA)),r=m.add(o,m.cross(s,this.m_rB)),a=-m.dot(this.m_uA,n)-this.m_ratio*m.dot(this.m_uB,r),h=-this.m_mass*a;this.m_impulse+=h;var _=m.mul(-h,this.m_uA),c=m.mul(-this.m_ratio*h,this.m_uB);e.addMul(this.m_invMassA,_),i+=this.m_invIA*m.cross(this.m_rA,_),o.addMul(this.m_invMassB,c),s+=this.m_invIB*m.cross(this.m_rB,c),this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyB.c_position.c,s=this.m_bodyB.c_position.a,n=f.neo(i),a=f.neo(s),h=f.mulVec2(n,m.sub(this.m_localAnchorA,this.m_localCenterA)),_=f.mulVec2(a,m.sub(this.m_localAnchorB,this.m_localCenterB)),l=m.sub(m.add(e,this.m_rA),this.m_groundAnchorA),u=m.sub(m.add(o,this.m_rB),this.m_groundAnchorB),p=l.length(),d=u.length();p>10*c.linearSlop?l.mul(1/p):l.setZero(),d>10*c.linearSlop?u.mul(1/d):u.setZero();var y=m.cross(h,l),v=m.cross(_,u),x=this.m_invMassA+this.m_invIA*y*y,g=this.m_invMassB+this.m_invIB*v*v,b=x+this.m_ratio*this.m_ratio*g;b>0&&(b=1/b);var A=this.m_constant-p-this.m_ratio*d,B=r.abs(A),w=-b*A,C=m.mul(-w,l),M=m.mul(-this.m_ratio*w,u);return e.addMul(this.m_invMassA,C),i+=this.m_invIA*m.cross(h,C),o.addMul(this.m_invMassB,M),s+=this.m_invIB*m.cross(_,M),this.m_bodyA.c_position.c=e,this.m_bodyA.c_position.a=i,this.m_bodyB.c_position.c=o,this.m_bodyB.c_position.a=s,B<c.linearSlop},e.TYPE="pulley-joint",e.MIN_PULLEY_LENGTH=2,e}(nt);nt.TYPES[re.TYPE]=re;var ae={maxLength:0},he=function(t){function e(i,o,n,r){var a=this;return a instanceof e?(i=s(i,ae),o=(a=t.call(this,i,o,n)||this).m_bodyA,n=a.m_bodyB,a.m_type=e.TYPE,a.m_localAnchorA=r?o.getLocalPoint(r):i.localAnchorA||m.neo(-1,0),a.m_localAnchorB=r?n.getLocalPoint(r):i.localAnchorB||m.neo(1,0),a.m_maxLength=i.maxLength,a.m_mass=0,a.m_impulse=0,a.m_length=0,a.m_state=0,a.m_u,a.m_rA,a.m_rB,a.m_localCenterA,a.m_localCenterB,a.m_invMassA,a.m_invMassB,a.m_invIA,a.m_invIB,a.m_mass,a):new e(i,o,n,r)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,maxLength:this.m_maxLength}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.setMaxLength=function(t){this.m_maxLength=t},e.prototype.getMaxLength=function(){return this.m_maxLength},e.prototype.getLimitState=function(){return this.m_state},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.mul(this.m_impulse,this.m_u).mul(t)},e.prototype.getReactionTorque=function(t){return 0},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyA.c_velocity.v,s=this.m_bodyA.c_velocity.w,n=this.m_bodyB.c_position.c,r=this.m_bodyB.c_position.a,a=this.m_bodyB.c_velocity.v,h=this.m_bodyB.c_velocity.w,_=f.neo(i),l=f.neo(r);this.m_rA=f.mulSub(_,this.m_localAnchorA,this.m_localCenterA),this.m_rB=f.mulSub(l,this.m_localAnchorB,this.m_localCenterB),this.m_u=m.zero(),this.m_u.addCombine(1,n,1,this.m_rB),this.m_u.subCombine(1,e,1,this.m_rA),this.m_length=this.m_u.length();var u=this.m_length-this.m_maxLength;if(this.m_state=u>0?2:0,!(this.m_length>c.linearSlop))return this.m_u.setZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.mul(1/this.m_length);var p=m.cross(this.m_rA,this.m_u),d=m.cross(this.m_rB,this.m_u),y=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*d*d;if(this.m_mass=0!=y?1/y:0,t.warmStarting){this.m_impulse*=t.dtRatio;var v=m.mul(this.m_impulse,this.m_u);o.subMul(this.m_invMassA,v),s-=this.m_invIA*m.cross(this.m_rA,v),a.addMul(this.m_invMassB,v),h+=this.m_invIB*m.cross(this.m_rB,v)}else this.m_impulse=0;this.m_bodyA.c_velocity.v.set(o),this.m_bodyA.c_velocity.w=s,this.m_bodyB.c_velocity.v.set(a),this.m_bodyB.c_velocity.w=h},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=m.addCross(e,i,this.m_rA),a=m.addCross(o,s,this.m_rB),h=this.m_length-this.m_maxLength,_=m.dot(this.m_u,m.sub(a,n));h<0&&(_+=t.inv_dt*h);var c=-this.m_mass*_,l=this.m_impulse;this.m_impulse=r.min(0,this.m_impulse+c),c=this.m_impulse-l;var u=m.mul(c,this.m_u);e.subMul(this.m_invMassA,u),i-=this.m_invIA*m.cross(this.m_rA,u),o.addMul(this.m_invMassB,u),s+=this.m_invIB*m.cross(this.m_rB,u),this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyB.c_position.c,s=this.m_bodyB.c_position.a,n=f.neo(i),a=f.neo(s),h=f.mulSub(n,this.m_localAnchorA,this.m_localCenterA),_=f.mulSub(a,this.m_localAnchorB,this.m_localCenterB),l=m.zero();l.addCombine(1,o,1,_),l.subCombine(1,e,1,h);var u=l.normalize(),p=u-this.m_maxLength;p=r.clamp(p,0,c.maxLinearCorrection);var d=-this.m_mass*p,y=m.mul(d,l);return e.subMul(this.m_invMassA,y),i-=this.m_invIA*m.cross(h,y),o.addMul(this.m_invMassB,y),s+=this.m_invIB*m.cross(_,y),this.m_bodyA.c_position.c.set(e),this.m_bodyA.c_position.a=i,this.m_bodyB.c_position.c.set(o),this.m_bodyB.c_position.a=s,u-this.m_maxLength<c.linearSlop},e.TYPE="rope-joint",e}(nt);nt.TYPES[he.TYPE]=he;var me={frequencyHz:0,dampingRatio:0},_e=function(t){function e(i,o,n,a){var h=this;return h instanceof e?(i=s(i,me),o=(h=t.call(this,i,o,n)||this).m_bodyA,n=h.m_bodyB,h.m_type=e.TYPE,h.m_localAnchorA=m.clone(a?o.getLocalPoint(a):i.localAnchorA||m.zero()),h.m_localAnchorB=m.clone(a?n.getLocalPoint(a):i.localAnchorB||m.zero()),h.m_referenceAngle=r.isFinite(i.referenceAngle)?i.referenceAngle:n.getAngle()-o.getAngle(),h.m_frequencyHz=i.frequencyHz,h.m_dampingRatio=i.dampingRatio,h.m_impulse=new xt,h.m_bias=0,h.m_gamma=0,h.m_rA,h.m_rB,h.m_localCenterA,h.m_localCenterB,h.m_invMassA,h.m_invMassB,h.m_invIA,h.m_invIB,h.m_mass=new Bt,h):new e(i,o,n,a)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,frequencyHz:this.m_frequencyHz,dampingRatio:this.m_dampingRatio,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,referenceAngle:this.m_referenceAngle}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB)},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.getReferenceAngle=function(){return this.m_referenceAngle},e.prototype.setFrequency=function(t){this.m_frequencyHz=t},e.prototype.getFrequency=function(){return this.m_frequencyHz},e.prototype.setDampingRatio=function(t){this.m_dampingRatio=t},e.prototype.getDampingRatio=function(){return this.m_dampingRatio},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.neo(this.m_impulse.x,this.m_impulse.y).mul(t)},e.prototype.getReactionTorque=function(t){return t*this.m_impulse.z},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_bodyA.c_position.a,i=this.m_bodyA.c_velocity.v,o=this.m_bodyA.c_velocity.w,s=this.m_bodyB.c_position.a,n=this.m_bodyB.c_velocity.v,a=this.m_bodyB.c_velocity.w,h=f.neo(e),_=f.neo(s);this.m_rA=f.mulVec2(h,m.sub(this.m_localAnchorA,this.m_localCenterA)),this.m_rB=f.mulVec2(_,m.sub(this.m_localAnchorB,this.m_localCenterB));var c=this.m_invMassA,l=this.m_invMassB,u=this.m_invIA,p=this.m_invIB,d=new Bt;if(d.ex.x=c+l+this.m_rA.y*this.m_rA.y*u+this.m_rB.y*this.m_rB.y*p,d.ey.x=-this.m_rA.y*this.m_rA.x*u-this.m_rB.y*this.m_rB.x*p,d.ez.x=-this.m_rA.y*u-this.m_rB.y*p,d.ex.y=d.ey.x,d.ey.y=c+l+this.m_rA.x*this.m_rA.x*u+this.m_rB.x*this.m_rB.x*p,d.ez.y=this.m_rA.x*u+this.m_rB.x*p,d.ex.z=d.ez.x,d.ey.z=d.ez.y,d.ez.z=u+p,this.m_frequencyHz>0){d.getInverse22(this.m_mass);var y=u+p,v=y>0?1/y:0,x=s-e-this.m_referenceAngle,g=2*r.PI*this.m_frequencyHz,b=2*v*this.m_dampingRatio*g,A=v*g*g,B=t.dt;this.m_gamma=B*(b+B*A),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_bias=x*B*A*this.m_gamma,y+=this.m_gamma,this.m_mass.ez.z=0!=y?1/y:0}else 0==d.ez.z?(d.getInverse22(this.m_mass),this.m_gamma=0,this.m_bias=0):(d.getSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0);if(t.warmStarting){this.m_impulse.mul(t.dtRatio);var w=m.neo(this.m_impulse.x,this.m_impulse.y);i.subMul(c,w),o-=u*(m.cross(this.m_rA,w)+this.m_impulse.z),n.addMul(l,w),a+=p*(m.cross(this.m_rB,w)+this.m_impulse.z)}else this.m_impulse.setZero();this.m_bodyA.c_velocity.v=i,this.m_bodyA.c_velocity.w=o,this.m_bodyB.c_velocity.v=n,this.m_bodyB.c_velocity.w=a},e.prototype.solveVelocityConstraints=function(t){var e=this.m_bodyA.c_velocity.v,i=this.m_bodyA.c_velocity.w,o=this.m_bodyB.c_velocity.v,s=this.m_bodyB.c_velocity.w,n=this.m_invMassA,r=this.m_invMassB,a=this.m_invIA,h=this.m_invIB;if(this.m_frequencyHz>0){var _=s-i,c=-this.m_mass.ez.z*(_+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=c,i-=a*c,s+=h*c,(p=m.zero()).addCombine(1,o,1,m.cross(s,this.m_rB)),p.subCombine(1,e,1,m.cross(i,this.m_rA));var l=m.neg(Bt.mulVec2(this.m_mass,p));this.m_impulse.x+=l.x,this.m_impulse.y+=l.y;var u=m.clone(l);e.subMul(n,u),i-=a*m.cross(this.m_rA,u),o.addMul(r,u),s+=h*m.cross(this.m_rB,u)}else{var p;(p=m.zero()).addCombine(1,o,1,m.cross(s,this.m_rB)),p.subCombine(1,e,1,m.cross(i,this.m_rA));_=s-i;var d=new xt(p.x,p.y,_),y=xt.neg(Bt.mulVec3(this.m_mass,d));this.m_impulse.add(y);u=m.neo(y.x,y.y);e.subMul(n,u),i-=a*(m.cross(this.m_rA,u)+y.z),o.addMul(r,u),s+=h*(m.cross(this.m_rB,u)+y.z)}this.m_bodyA.c_velocity.v=e,this.m_bodyA.c_velocity.w=i,this.m_bodyB.c_velocity.v=o,this.m_bodyB.c_velocity.w=s},e.prototype.solvePositionConstraints=function(t){var e,i,o=this.m_bodyA.c_position.c,s=this.m_bodyA.c_position.a,n=this.m_bodyB.c_position.c,a=this.m_bodyB.c_position.a,h=f.neo(s),_=f.neo(a),l=this.m_invMassA,u=this.m_invMassB,p=this.m_invIA,d=this.m_invIB,y=f.mulVec2(h,m.sub(this.m_localAnchorA,this.m_localCenterA)),v=f.mulVec2(_,m.sub(this.m_localAnchorB,this.m_localCenterB)),x=new Bt;if(x.ex.x=l+u+y.y*y.y*p+v.y*v.y*d,x.ey.x=-y.y*y.x*p-v.y*v.x*d,x.ez.x=-y.y*p-v.y*d,x.ex.y=x.ey.x,x.ey.y=l+u+y.x*y.x*p+v.x*v.x*d,x.ez.y=y.x*p+v.x*d,x.ex.z=x.ez.x,x.ey.z=x.ez.y,x.ez.z=p+d,this.m_frequencyHz>0){(b=m.zero()).addCombine(1,n,1,v),b.subCombine(1,o,1,y),e=b.length(),i=0;var g=m.neg(x.solve22(b));o.subMul(l,g),s-=p*m.cross(y,g),n.addMul(u,g),a+=d*m.cross(v,g)}else{var b;(b=m.zero()).addCombine(1,n,1,v),b.subCombine(1,o,1,y);var A=a-s-this.m_referenceAngle;e=b.length(),i=r.abs(A);var B=new xt(b.x,b.y,A),w=new xt;if(x.ez.z>0)w=xt.neg(x.solve33(B));else{var C=m.neg(x.solve22(b));w.set(C.x,C.y,0)}g=m.neo(w.x,w.y);o.subMul(l,g),s-=p*(m.cross(y,g)+w.z),n.addMul(u,g),a+=d*(m.cross(v,g)+w.z)}return this.m_bodyA.c_position.c=o,this.m_bodyA.c_position.a=s,this.m_bodyB.c_position.c=n,this.m_bodyB.c_position.a=a,e<=c.linearSlop&&i<=c.angularSlop},e.TYPE="weld-joint",e}(nt);nt.TYPES[_e.TYPE]=_e;var ce={enableMotor:!1,maxMotorTorque:0,motorSpeed:0,frequencyHz:2,dampingRatio:.7},le=function(t){function e(i,o,n,r,a){var h=this;return h instanceof e?(i=s(i,ce),o=(h=t.call(this,i,o,n)||this).m_bodyA,n=h.m_bodyB,h.m_type=e.TYPE,h.m_localAnchorA=m.clone(r?o.getLocalPoint(r):i.localAnchorA||m.zero()),h.m_localAnchorB=m.clone(r?n.getLocalPoint(r):i.localAnchorB||m.zero()),h.m_localXAxisA=m.clone(a?o.getLocalVector(a):i.localAxisA||i.localAxis||m.neo(1,0)),h.m_localYAxisA=m.cross(1,h.m_localXAxisA),h.m_mass=0,h.m_impulse=0,h.m_motorMass=0,h.m_motorImpulse=0,h.m_springMass=0,h.m_springImpulse=0,h.m_maxMotorTorque=i.maxMotorTorque,h.m_motorSpeed=i.motorSpeed,h.m_enableMotor=i.enableMotor,h.m_frequencyHz=i.frequencyHz,h.m_dampingRatio=i.dampingRatio,h.m_bias=0,h.m_gamma=0,h.m_localCenterA,h.m_localCenterB,h.m_invMassA,h.m_invMassB,h.m_invIA,h.m_invIB,h.m_ax=m.zero(),h.m_ay=m.zero(),h.m_sAx,h.m_sBx,h.m_sAy,h.m_sBy,h):new e(i,o,n,r,a)}return i(e,t),e.prototype._serialize=function(){return{type:this.m_type,bodyA:this.m_bodyA,bodyB:this.m_bodyB,collideConnected:this.m_collideConnected,enableMotor:this.m_enableMotor,maxMotorTorque:this.m_maxMotorTorque,motorSpeed:this.m_motorSpeed,frequencyHz:this.m_frequencyHz,dampingRatio:this.m_dampingRatio,localAnchorA:this.m_localAnchorA,localAnchorB:this.m_localAnchorB,localAxisA:this.m_localXAxisA}},e._deserialize=function(t,i,s){return(t=o({},t)).bodyA=s(T,t.bodyA,i),t.bodyB=s(T,t.bodyB,i),new e(t)},e.prototype._setAnchors=function(t){t.anchorA?this.m_localAnchorA.set(this.m_bodyA.getLocalPoint(t.anchorA)):t.localAnchorA&&this.m_localAnchorA.set(t.localAnchorA),t.anchorB?this.m_localAnchorB.set(this.m_bodyB.getLocalPoint(t.anchorB)):t.localAnchorB&&this.m_localAnchorB.set(t.localAnchorB),t.localAxisA&&(this.m_localXAxisA.set(t.localAxisA),this.m_localYAxisA.set(m.cross(1,t.localAxisA)))},e.prototype.getLocalAnchorA=function(){return this.m_localAnchorA},e.prototype.getLocalAnchorB=function(){return this.m_localAnchorB},e.prototype.getLocalAxisA=function(){return this.m_localXAxisA},e.prototype.getJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.getWorldPoint(this.m_localAnchorA),o=e.getWorldPoint(this.m_localAnchorB),s=m.sub(o,i),n=t.getWorldVector(this.m_localXAxisA);return m.dot(s,n)},e.prototype.getJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},e.prototype.isMotorEnabled=function(){return this.m_enableMotor},e.prototype.enableMotor=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_enableMotor=t},e.prototype.setMotorSpeed=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_motorSpeed=t},e.prototype.getMotorSpeed=function(){return this.m_motorSpeed},e.prototype.setMaxMotorTorque=function(t){this.m_bodyA.setAwake(!0),this.m_bodyB.setAwake(!0),this.m_maxMotorTorque=t},e.prototype.getMaxMotorTorque=function(){return this.m_maxMotorTorque},e.prototype.getMotorTorque=function(t){return t*this.m_motorImpulse},e.prototype.setSpringFrequencyHz=function(t){this.m_frequencyHz=t},e.prototype.getSpringFrequencyHz=function(){return this.m_frequencyHz},e.prototype.setSpringDampingRatio=function(t){this.m_dampingRatio=t},e.prototype.getSpringDampingRatio=function(){return this.m_dampingRatio},e.prototype.getAnchorA=function(){return this.m_bodyA.getWorldPoint(this.m_localAnchorA)},e.prototype.getAnchorB=function(){return this.m_bodyB.getWorldPoint(this.m_localAnchorB)},e.prototype.getReactionForce=function(t){return m.combine(this.m_impulse,this.m_ay,this.m_springImpulse,this.m_ax).mul(t)},e.prototype.getReactionTorque=function(t){return t*this.m_motorImpulse},e.prototype.initVelocityConstraints=function(t){this.m_localCenterA=this.m_bodyA.m_sweep.localCenter,this.m_localCenterB=this.m_bodyB.m_sweep.localCenter,this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=this.m_invMassA,i=this.m_invMassB,o=this.m_invIA,s=this.m_invIB,n=this.m_bodyA.c_position.c,a=this.m_bodyA.c_position.a,h=this.m_bodyA.c_velocity.v,_=this.m_bodyA.c_velocity.w,c=this.m_bodyB.c_position.c,l=this.m_bodyB.c_position.a,u=this.m_bodyB.c_velocity.v,p=this.m_bodyB.c_velocity.w,d=f.neo(a),y=f.neo(l),v=f.mulVec2(d,m.sub(this.m_localAnchorA,this.m_localCenterA)),x=f.mulVec2(y,m.sub(this.m_localAnchorB,this.m_localCenterB)),g=m.zero();if(g.addCombine(1,c,1,x),g.subCombine(1,n,1,v),this.m_ay=f.mulVec2(d,this.m_localYAxisA),this.m_sAy=m.cross(m.add(g,v),this.m_ay),this.m_sBy=m.cross(x,this.m_ay),this.m_mass=e+i+o*this.m_sAy*this.m_sAy+s*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){this.m_ax=f.mulVec2(d,this.m_localXAxisA),this.m_sAx=m.cross(m.add(g,v),this.m_ax),this.m_sBx=m.cross(x,this.m_ax);var b=e+i+o*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(b>0){this.m_springMass=1/b;var A=m.dot(g,this.m_ax),B=2*r.PI*this.m_frequencyHz,w=2*this.m_springMass*this.m_dampingRatio*B,C=this.m_springMass*B*B,M=t.dt;this.m_gamma=M*(w+M*C),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=A*M*C*this.m_gamma,this.m_springMass=b+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=o+s,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.warmStarting){this.m_impulse*=t.dtRatio,this.m_springImpulse*=t.dtRatio,this.m_motorImpulse*=t.dtRatio;var I=m.combine(this.m_impulse,this.m_ay,this.m_springImpulse,this.m_ax),S=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,P=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;h.subMul(this.m_invMassA,I),_-=this.m_invIA*S,u.addMul(this.m_invMassB,I),p+=this.m_invIB*P}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;this.m_bodyA.c_velocity.v.set(h),this.m_bodyA.c_velocity.w=_,this.m_bodyB.c_velocity.v.set(u),this.m_bodyB.c_velocity.w=p},e.prototype.solveVelocityConstraints=function(t){var e=this.m_invMassA,i=this.m_invMassB,o=this.m_invIA,s=this.m_invIB,n=this.m_bodyA.c_velocity.v,a=this.m_bodyA.c_velocity.w,h=this.m_bodyB.c_velocity.v,_=this.m_bodyB.c_velocity.w,c=m.dot(this.m_ax,h)-m.dot(this.m_ax,n)+this.m_sBx*_-this.m_sAx*a,l=-this.m_springMass*(c+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=l;var u=m.mul(l,this.m_ax),p=l*this.m_sAx,d=l*this.m_sBx;n.subMul(e,u),a-=o*p,h.addMul(i,u);c=(_+=s*d)-a-this.m_motorSpeed,l=-this.m_motorMass*c;var y=this.m_motorImpulse,f=t.dt*this.m_maxMotorTorque;this.m_motorImpulse=r.clamp(this.m_motorImpulse+l,-f,f),a-=o*(l=this.m_motorImpulse-y),_+=s*l;c=m.dot(this.m_ay,h)-m.dot(this.m_ay,n)+this.m_sBy*_-this.m_sAy*a,l=-this.m_mass*c;this.m_impulse+=l;u=m.mul(l,this.m_ay),p=l*this.m_sAy,d=l*this.m_sBy;n.subMul(e,u),a-=o*p,h.addMul(i,u),_+=s*d,this.m_bodyA.c_velocity.v.set(n),this.m_bodyA.c_velocity.w=a,this.m_bodyB.c_velocity.v.set(h),this.m_bodyB.c_velocity.w=_},e.prototype.solvePositionConstraints=function(t){var e=this.m_bodyA.c_position.c,i=this.m_bodyA.c_position.a,o=this.m_bodyB.c_position.c,s=this.m_bodyB.c_position.a,n=f.neo(i),a=f.neo(s),h=f.mulVec2(n,m.sub(this.m_localAnchorA,this.m_localCenterA)),_=f.mulVec2(a,m.sub(this.m_localAnchorB,this.m_localCenterB)),l=m.zero();l.addCombine(1,o,1,_),l.subCombine(1,e,1,h);var u,p=f.mulVec2(n,this.m_localYAxisA),d=m.cross(m.add(l,h),p),y=m.cross(_,p),v=m.dot(l,p),x=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;u=0!=x?-v/x:0;var g=m.mul(u,p),b=u*d,A=u*y;return e.subMul(this.m_invMassA,g),i-=this.m_invIA*b,o.addMul(this.m_invMassB,g),s+=this.m_invIB*A,this.m_bodyA.c_position.c.set(e),this.m_bodyA.c_position.a=i,this.m_bodyB.c_position.c.set(o),this.m_bodyB.c_position.a=s,r.abs(v)<=c.linearSlop},e.TYPE="wheel-joint",e}(nt);function ue(t){var e={exports:{}};return t(e,e.exports),e.exports}nt.TYPES[le.TYPE]=le,L.clipSegmentToLine=R,L.ClipVertex=D,L.getPointStates=Y,L.PointState=k,yt.TimeStep=ut,W.testOverlap=G,W.Input=X,W.Output=J,W.Proxy=H,W.Cache=N,ct.Input=ht,ct.Output=_t;var pe={},de=function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])}return t},ye=ue((function(t){var e=Object.prototype,i=e.hasOwnProperty,o=e.toString,s=/^[A-Fa-f0-9]+$/,n=t.exports={};n.a=n.an=n.type=function(t,e){return typeof t===e},n.defined=function(t){return void 0!==t},n.empty=function(t){var e,s=o.call(t);if("[object Array]"===s||"[object Arguments]"===s||"[object String]"===s)return 0===t.length;if("[object Object]"===s){for(e in t)if(i.call(t,e))return!1;return!0}return!t},n.equal=function(t,e){if(t===e)return!0;var i,s=o.call(t);if(s!==o.call(e))return!1;if("[object Object]"===s){for(i in t)if(!n.equal(t[i],e[i])||!(i in e))return!1;for(i in e)if(!n.equal(t[i],e[i])||!(i in t))return!1;return!0}if("[object Array]"===s){if((i=t.length)!==e.length)return!1;for(;--i;)if(!n.equal(t[i],e[i]))return!1;return!0}return"[object Function]"===s?t.prototype===e.prototype:"[object Date]"===s&&t.getTime()===e.getTime()},n.instance=function(t,e){return t instanceof e},n.nil=function(t){return null===t},n.undef=function(t){return void 0===t},n.array=function(t){return"[object Array]"===o.call(t)},n.emptyarray=function(t){return n.array(t)&&0===t.length},n.arraylike=function(t){return!!t&&!n.boolean(t)&&i.call(t,"length")&&isFinite(t.length)&&n.number(t.length)&&t.length>=0},n.boolean=function(t){return"[object Boolean]"===o.call(t)},n.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},n.fn=function(t){return"[object Function]"===o.call(t)},n.number=function(t){return"[object Number]"===o.call(t)},n.nan=function(t){return!n.number(t)||t!=t},n.object=function(t){return"[object Object]"===o.call(t)},n.hash=function(t){return n.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},n.regexp=function(t){return"[object RegExp]"===o.call(t)},n.string=function(t){return"[object String]"===o.call(t)},n.hex=function(t){return n.string(t)&&(!t.length||s.test(t))}}));function fe(t){if(!(this instanceof fe))return ye.fn(t)?fe.app.apply(fe,arguments):ye.object(t)?fe.atlas.apply(fe,arguments):t;pe.create++;for(var e=0;e<ve.length;e++)ve[e].call(this)}pe.create=0;var ve=[];fe._init=function(t){ve.push(t)};var xe=[];fe._load=function(t){xe.push(t)};var ge={};fe.config=function(){if(1===arguments.length&&ye.string(arguments[0]))return ge[arguments[0]];1===arguments.length&&ye.object(arguments[0])&&de(ge,arguments[0]),2===arguments.length&&ye.string(arguments[0])};var be=[],Ae=[],Be=!1,we=!1;fe.app=function(t,e){if(Be){var i=fe.config("app-loader");i((function(e,i){for(var o=0;o<xe.length;o++)xe[o].call(this,e,i);t(e,i),Ae.push(e),e.start()}),e)}else be.push(arguments)};var Ce=function(){var t=0;function e(e,i){return t+=i="number"==typeof i&&i>=1?i:1,function(){e&&e.apply(this,arguments),i>0&&(i--,t--,o())}}var i=[];function o(){if(0===t)for(;i.length;)setTimeout(i.shift(),0)}return e.then=function(e){0===t?setTimeout(e,0):i.push(e)},e}();fe.preload=function(t){if("string"==typeof t){var e=fe.resolve(t);/\.js($|\?|\#)/.test(e)&&(t=function(t){!function(t,e){var i=document.createElement("script");i.addEventListener("load",(function(){e()})),i.addEventListener("error",(function(i){e(i||"Error loading script: "+t)})),i.src=t,i.id="preload-"+Date.now(),document.body.appendChild(i)}(e,t)})}"function"==typeof t&&t(Ce())},fe.start=function(t){fe.config(t),Ce.then((function(){for(Be=!0;be.length;){var t=be.shift();fe.app.apply(fe,t)}}))},fe.pause=function(){if(!we){we=!0;for(var t=Ae.length-1;t>=0;t--)Ae[t].pause()}},fe.resume=function(){if(we){we=!1;for(var t=Ae.length-1;t>=0;t--)Ae[t].resume()}},fe.create=function(){return new fe},fe.resolve=function(){if("undefined"==typeof window||"undefined"==typeof document)return function(t){return t};var t=document.getElementsByTagName("script");return function(e){if(/^\.\//.test(e)){var i=function(){if(document.currentScript)return document.currentScript.src;var e;try{var i=new Error;if(!i.stack)throw i;e=i.stack}catch(i){e=i.stack}if("string"==typeof e)for(var o=(e=e.split("\n")).length;o--;){var s=e[o].match(/(\w+\:\/\/[^/]*?\/.+?)(:\d+)(:\d+)?/);if(s)return s[1]}if(t.length&&"readyState"in t[0])for(o=t.length;o--;)if("interactive"===t[o].readyState)return t[o].src;return location.href}();e=i.substring(0,i.lastIndexOf("/")+1)+e.substring(2)}return e}}();var Me=fe;function Ie(t,e,i,o,s,n){this.reset(t,e,i,o,s,n)}Ie.prototype.toString=function(){return"["+this.a+", "+this.b+", "+this.c+", "+this.d+", "+this.e+", "+this.f+"]"},Ie.prototype.clone=function(){return new Ie(this.a,this.b,this.c,this.d,this.e,this.f)},Ie.prototype.reset=function(t,e,i,o,s,n){return this._dirty=!0,"object"==typeof t?(this.a=t.a,this.d=t.d,this.b=t.b,this.c=t.c,this.e=t.e,this.f=t.f):(this.a=t||1,this.d=o||1,this.b=e||0,this.c=i||0,this.e=s||0,this.f=n||0),this},Ie.prototype.identity=function(){return this._dirty=!0,this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this},Ie.prototype.rotate=function(t){if(!t)return this;this._dirty=!0;var e=t?Math.cos(t):1,i=t?Math.sin(t):0,o=e*this.a-i*this.b,s=e*this.b+i*this.a,n=e*this.c-i*this.d,r=e*this.d+i*this.c,a=e*this.e-i*this.f,h=e*this.f+i*this.e;return this.a=o,this.b=s,this.c=n,this.d=r,this.e=a,this.f=h,this},Ie.prototype.translate=function(t,e){return t||e?(this._dirty=!0,this.e+=t,this.f+=e,this):this},Ie.prototype.scale=function(t,e){return t-1||e-1?(this._dirty=!0,this.a*=t,this.b*=e,this.c*=t,this.d*=e,this.e*=t,this.f*=e,this):this},Ie.prototype.skew=function(t,e){if(!t&&!e)return this;this._dirty=!0;var i=this.a+this.b*t,o=this.b+this.a*e,s=this.c+this.d*t,n=this.d+this.c*e,r=this.e+this.f*t,a=this.f+this.e*e;return this.a=i,this.b=o,this.c=s,this.d=n,this.e=r,this.f=a,this},Ie.prototype.concat=function(t){this._dirty=!0;var e=this,i=e.a*t.a+e.b*t.c,o=e.b*t.d+e.a*t.b,s=e.c*t.a+e.d*t.c,n=e.d*t.d+e.c*t.b,r=e.e*t.a+t.e+e.f*t.c,a=e.f*t.d+t.f+e.e*t.b;return this.a=i,this.b=o,this.c=s,this.d=n,this.e=r,this.f=a,this},Ie.prototype.inverse=Ie.prototype.reverse=function(){if(this._dirty){this._dirty=!1,this.inversed=this.inversed||new Ie;var t=this.a*this.d-this.b*this.c;this.inversed.a=this.d/t,this.inversed.b=-this.b/t,this.inversed.c=-this.c/t,this.inversed.d=this.a/t,this.inversed.e=(this.c*this.f-this.e*this.d)/t,this.inversed.f=(this.e*this.b-this.a*this.f)/t}return this.inversed},Ie.prototype.map=function(t,e){return(e=e||{}).x=this.a*t.x+this.c*t.y+this.e,e.y=this.b*t.x+this.d*t.y+this.f,e},Ie.prototype.mapX=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.a*t+this.c*e+this.e},Ie.prototype.mapY=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.b*t+this.d*e+this.f};var Se=Ie,Pe=ue((function(t){if("function"==typeof Object.create)t.exports=function(t,e){return Object.create.call(Object,t,e)};else{function e(){}t.exports=function(t,i){if(i)throw Error("Second argument is not supported!");if("object"!=typeof t||null===t)throw Error("Invalid prototype!");return e.prototype=t,new e}}})),ze=Math,Te=Pe(Math);function Ve(t,e){"object"==typeof t&&this.src(t,e)}Te.random=function(t,e){return void 0===t?(e=1,t=0):void 0===e&&(e=t,t=0),t==e?t:ze.random()*(e-t)+t},Te.rotate=function(t,e,i){return void 0===e?(i=1,e=0):void 0===i&&(i=e,e=0),i>e?(t=(t-e)%(i-e))+(t<0?i:e):(t=(t-i)%(e-i))+(t<=0?e:i)},Te.limit=function(t,e,i){return t<e?e:t>i?i:t},Te.length=function(t,e){return ze.sqrt(t*t+e*e)},Ve.prototype.pipe=function(){return new Ve(this)},Ve.prototype.src=function(t,e,i,o){if("object"==typeof t){var s=t,n=e||1;this._image=s,this._sx=this._dx=0,this._sy=this._dy=0,this._sw=this._dw=s.width/n,this._sh=this._dh=s.height/n,this.width=s.width/n,this.height=s.height/n,this.ratio=n}else void 0===i?(i=t,o=e):(this._sx=t,this._sy=e),this._sw=this._dw=i,this._sh=this._dh=o,this.width=i,this.height=o;return this},Ve.prototype.dest=function(t,e,i,o){return this._dx=t,this._dy=e,this._dx=t,this._dy=e,void 0!==i&&(this._dw=i,this._dh=o,this.width=i,this.height=o),this},Ve.prototype.draw=function(t,e,i,o,s,n,r,a,h){var m=this._image;if(null!==m&&"object"==typeof m){var _=this._sx,c=this._sy,l=this._sw,u=this._sh,p=this._dx,d=this._dy,y=this._dw,f=this._dh;void 0!==n?(e=Te.limit(e,0,this._sw),o=Te.limit(o,0,this._sw-e),_+=e,c+=i=Te.limit(i,0,this._sh),l=o,u=s=Te.limit(s,0,this._sh-i),p=n,d=r,y=a,f=h):void 0!==o?(p=e,d=i,y=o,f=s):void 0!==e&&(y=e,f=i);var v=this.ratio||1;_*=v,c*=v,l*=v,u*=v;try{"function"==typeof m.draw?m.draw(t,_,c,l,u,p,d,y,f):(pe.draw++,t.drawImage(m,_,c,l,u,p,d,y,f))}catch(t){m._draw_failed||(console.log("Unable to draw: ",m),console.log(t),m._draw_failed=!0)}}};var ke=Ve,Le=function(t,e){return"string"==typeof t&&"string"==typeof e&&t.substring(0,e.length)==e},Fe={},qe=[];function je(t){je._super.call(this);var e=this;Re(t,"filter"),Re(t,"cutouts"),Re(t,"sprites"),Re(t,"factory");var i=t.map||t.filter,o=t.ppu||t.ratio||1,s=t.trim||0,n=t.textures,r=t.factory,a=t.cutouts||t.sprites;function h(t){if(!t||ye.fn(t.draw))return t;t=de({},t),ye.fn(i)&&(t=i(t)),1!=o&&(t.x*=o,t.y*=o,t.width*=o,t.height*=o,t.top*=o,t.bottom*=o,t.left*=o,t.right*=o),0!=s&&(t.x+=s,t.y+=s,t.width-=2*s,t.height-=2*s,t.top-=s,t.bottom-=s,t.left-=s,t.right-=s);var n=e.pipe();return n.top=t.top,n.bottom=t.bottom,n.left=t.left,n.right=t.right,n.src(t.x,t.y,t.width,t.height),n}function m(t){if(n){if(ye.fn(n))return n(t);if(ye.hash(n))return n[t]}if(a){for(var e=null,i=0,o=0;o<a.length;o++)Le(a[o].name,t)&&(0===i?e=a[o]:1===i?e=[e,a[o]]:e.push(a[o]),i++);return 0===i&&ye.fn(r)&&(e=function(e){return r(t+(e||""))}),e}}this.select=function(t){if(!t)return new De(this.pipe());var e=m(t);return e?new De(e,m,h):void 0}}Me.atlas=function(t){var e=ye.fn(t.draw)?t:new je(t);t.name&&(Fe[t.name]=e),qe.push(e),Re(t,"imagePath"),Re(t,"imageRatio");var i=t.imagePath,o=t.imageRatio||1;return ye.string(t.image)?i=t.image:ye.hash(t.image)&&(i=t.image.src||t.image.url,o=t.image.ratio||o),i&&Me.preload((function(t){i=Me.resolve(i),Me.config("image-loader")(i,(function(i){e.src(i,o),t()}),(function(e){t()}))})),e},je._super=ke,je.prototype=Pe(je._super.prototype);var Ee=new ke;Ee.x=Ee.y=Ee.width=Ee.height=0,Ee.pipe=Ee.src=Ee.dest=function(){return this},Ee.draw=function(){};var Ye=new De(Ee);function De(t,e,i){function o(t,s){return t?ye.fn(t.draw)?t:ye.hash(t)&&ye.number(t.width)&&ye.number(t.height)&&ye.fn(i)?i(t):ye.hash(t)&&ye.defined(s)?o(t[s]):ye.fn(t)?o(t(s)):ye.array(t)?o(t[0]):ye.string(t)&&ye.fn(e)?o(e(t)):void 0:Ee}this.one=function(e){return o(t,e)},this.array=function(e){var i=ye.array(e)?e:[];if(ye.array(t))for(var s=0;s<t.length;s++)i[s]=o(t[s]);else i[0]=o(t);return i}}function Re(t,e,i){e in t&&console.log(i?i.replace("%name",e):"'"+e+"' field of texture atlas is deprecated.")}Me.texture=function(t){if(!ye.string(t))return new De(t);var e,i,o=null;for((i=t.indexOf(":"))>0&&t.length>i+1&&(o=(e=Fe[t.slice(0,i)])&&e.select(t.slice(i+1))),!o&&(e=Fe[t])&&(o=e.select()),i=0;!o&&i<qe.length;i++)o=qe[i].select(t);return o||(console.error("Texture not found: "+t),o=Ye),o};var Oe=0;function Xe(t,e){He(e),He(t),e.remove(),t._last&&(t._last._next=e,e._prev=t._last),e._parent=t,t._last=e,t._first||(t._first=e),e._parent._flag(e,!0),e._ts_parent=++Oe,t._ts_children=++Oe,t.touch()}function Je(t,e){He(e),He(t),e.remove(),t._first&&(t._first._prev=e,e._next=t._first),e._parent=t,t._first=e,t._last||(t._last=e),e._parent._flag(e,!0),e._ts_parent=++Oe,t._ts_children=++Oe,t.touch()}function Ne(t,e){He(t),He(e),t.remove();var i=e._parent,o=e._prev;e._prev=t,o&&(o._next=t)||i&&(i._first=t),t._parent=i,t._prev=o,t._next=e,t._parent._flag(t,!0),t._ts_parent=++Oe,t.touch()}function We(t,e){He(t),He(e),t.remove();var i=e._parent,o=e._next;e._next=t,o&&(o._prev=t)||i&&(i._last=t),t._parent=i,t._prev=e,t._next=o,t._parent._flag(t,!0),t._ts_parent=++Oe,t.touch()}function He(t){if(t&&t instanceof Me)return t;throw"Invalid node: "+t}Me.prototype._label="",Me.prototype._visible=!0,Me.prototype._parent=null,Me.prototype._next=null,Me.prototype._prev=null,Me.prototype._first=null,Me.prototype._last=null,Me.prototype._attrs=null,Me.prototype._flags=null,Me.prototype.toString=function(){return"["+this._label+"]"},Me.prototype.id=function(t){return this.label(t)},Me.prototype.label=function(t){return void 0===t?this._label:(this._label=t,this)},Me.prototype.attr=function(t,e){return void 0===e?null!==this._attrs?this._attrs[t]:void 0:((null!==this._attrs?this._attrs:this._attrs={})[t]=e,this)},Me.prototype.visible=function(t){return void 0===t?this._visible:(this._visible=t,this._parent&&(this._parent._ts_children=++Oe),this._ts_pin=++Oe,this.touch(),this)},Me.prototype.hide=function(){return this.visible(!1)},Me.prototype.show=function(){return this.visible(!0)},Me.prototype.parent=function(){return this._parent},Me.prototype.next=function(t){for(var e=this._next;e&&t&&!e._visible;)e=e._next;return e},Me.prototype.prev=function(t){for(var e=this._prev;e&&t&&!e._visible;)e=e._prev;return e},Me.prototype.first=function(t){for(var e=this._first;e&&t&&!e._visible;)e=e._next;return e},Me.prototype.last=function(t){for(var e=this._last;e&&t&&!e._visible;)e=e._prev;return e},Me.prototype.visit=function(t,e){var i=t.reverse,o=t.visible;if(!t.start||!t.start(this,e)){for(var s,n=i?this.last(o):this.first(o);s=n;)if(n=i?s.prev(o):s.next(o),s.visit(t,e))return!0;return t.end&&t.end(this,e)}},Me.prototype.append=function(t,e){if(ye.array(t))for(var i=0;i<t.length;i++)Xe(this,t[i]);else if(void 0!==e)for(i=0;i<arguments.length;i++)Xe(this,arguments[i]);else void 0!==t&&Xe(this,t);return this},Me.prototype.prepend=function(t,e){if(ye.array(t))for(var i=t.length-1;i>=0;i--)Je(this,t[i]);else if(void 0!==e)for(i=arguments.length-1;i>=0;i--)Je(this,arguments[i]);else void 0!==t&&Je(this,t);return this},Me.prototype.appendTo=function(t){return Xe(t,this),this},Me.prototype.prependTo=function(t){return Je(t,this),this},Me.prototype.insertNext=function(t,e){if(ye.array(t))for(var i=0;i<t.length;i++)We(t[i],this);else if(void 0!==e)for(i=0;i<arguments.length;i++)We(arguments[i],this);else void 0!==t&&We(t,this);return this},Me.prototype.insertPrev=function(t,e){if(ye.array(t))for(var i=t.length-1;i>=0;i--)Ne(t[i],this);else if(void 0!==e)for(i=arguments.length-1;i>=0;i--)Ne(arguments[i],this);else void 0!==t&&Ne(t,this);return this},Me.prototype.insertAfter=function(t){return We(this,t),this},Me.prototype.insertBefore=function(t){return Ne(this,t),this},Me.prototype.remove=function(t,e){if(void 0!==t){if(ye.array(t))for(var i=0;i<t.length;i++)He(t[i]).remove();else if(void 0!==e)for(i=0;i<arguments.length;i++)He(arguments[i]).remove();else He(t).remove();return this}return this._prev&&(this._prev._next=this._next),this._next&&(this._next._prev=this._prev),this._parent&&(this._parent._first===this&&(this._parent._first=this._next),this._parent._last===this&&(this._parent._last=this._prev),this._parent._flag(this,!1),this._parent._ts_children=++Oe,this._parent.touch()),this._prev=this._next=this._parent=null,this._ts_parent=++Oe,this},Me.prototype.empty=function(){for(var t,e=this._first;t=e;)e=t._next,t._prev=t._next=t._parent=null,this._flag(t,!1);return this._first=this._last=null,this._ts_children=++Oe,this.touch(),this},Me.prototype.touch=function(){return this._ts_touch=++Oe,this._parent&&this._parent.touch(),this},Me.prototype._flag=function(t,e){if(void 0===e)return null!==this._flags&&this._flags[t]||0;if("string"==typeof t&&(e?(this._flags=this._flags||{},!this._flags[t]&&this._parent&&this._parent._flag(t,!0),this._flags[t]=(this._flags[t]||0)+1):this._flags&&this._flags[t]>0&&(1==this._flags[t]&&this._parent&&this._parent._flag(t,!1),this._flags[t]=this._flags[t]-1)),"object"==typeof t&&t._flags)for(var i in t._flags)t._flags[i]>0&&this._flag(i,e);return this},Me.prototype.hitTest=function(t){return!!this.attr("spy")||t.x>=0&&t.x<=this._pin._width&&t.y>=0&&t.y<=this._pin._height};var Ze,Ke;Ze=Me.prototype,Ke=function(t,e,i){t._flag(e,i)},Ze._listeners=null,Ze.on=Ze.listen=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners&&(this._listeners={}),t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var i=0;i<t.length;i++){var o=t[i];this._listeners[o]=this._listeners[o]||[],this._listeners[o].push(e),"function"==typeof Ke&&Ke(this,o,!0)}return this},Ze.off=function(t,e){if(!t||!t.length||"function"!=typeof e)return this;if(null===this._listeners)return this;if(t=("string"!=typeof t&&"function"==typeof t.join?t.join(" "):t).match(/\S+/g))for(var i=0;i<t.length;i++){var o,s=t[i],n=this._listeners[s];n&&(o=n.indexOf(e))>=0&&(n.splice(o,1),n.length||delete this._listeners[s],"function"==typeof Ke&&Ke(this,s,!1))}return this},Ze.listeners=function(t){return this._listeners&&this._listeners[t]},Ze.publish=function(t,e){var i=this.listeners(t);if(!i||!i.length)return 0;for(var o=0;o<i.length;o++)i[o].apply(this,e);return i.length},Ze.trigger=function(t,e){return this.publish(t,e),this};var Ge=0;function Ue(t){this._owner=t,this._parent=null,this._relativeMatrix=new Se,this._absoluteMatrix=new Se,this.reset()}Me._init((function(){this._pin=new Ue(this)})),Me.prototype.matrix=function(t){return!0===t?this._pin.relativeMatrix():this._pin.absoluteMatrix()},Me.prototype.pin=function(t,e){return"object"==typeof t?(this._pin.set(t),this):"string"==typeof t?void 0===e?this._pin.get(t):(this._pin.set(t,e),this):void 0===t?this._pin:void 0},Ue.prototype.reset=function(){this._textureAlpha=1,this._alpha=1,this._width=0,this._height=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._rotation=0,this._pivoted=!1,this._pivotX=null,this._pivotY=null,this._handled=!1,this._handleX=0,this._handleY=0,this._aligned=!1,this._alignX=0,this._alignY=0,this._offsetX=0,this._offsetY=0,this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height,this._ts_translate=++Ge,this._ts_transform=++Ge,this._ts_matrix=++Ge},Ue.prototype._update=function(){return this._parent=this._owner._parent&&this._owner._parent._pin,this._handled&&this._mo_handle!=this._ts_transform&&(this._mo_handle=this._ts_transform,this._ts_translate=++Ge),this._aligned&&this._parent&&this._mo_align!=this._parent._ts_transform&&(this._mo_align=this._parent._ts_transform,this._ts_translate=++Ge),this},Ue.prototype.toString=function(){return this._owner+" ("+(this._parent?this._parent._owner:null)+")"},Ue.prototype.absoluteMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_matrix:0);if(this._mo_abs==t)return this._absoluteMatrix;this._mo_abs=t;var e=this._absoluteMatrix;return e.reset(this.relativeMatrix()),this._parent&&e.concat(this._parent._absoluteMatrix),this._ts_matrix=++Ge,e},Ue.prototype.relativeMatrix=function(){this._update();var t=Math.max(this._ts_transform,this._ts_translate,this._parent?this._parent._ts_transform:0);if(this._mo_rel==t)return this._relativeMatrix;this._mo_rel=t;var e,i,o=this._relativeMatrix;(o.identity(),this._pivoted&&o.translate(-this._pivotX*this._width,-this._pivotY*this._height),o.scale(this._scaleX,this._scaleY),o.skew(this._skewX,this._skewY),o.rotate(this._rotation),this._pivoted&&o.translate(this._pivotX*this._width,this._pivotY*this._height),this._pivoted)?(this._boxX=0,this._boxY=0,this._boxWidth=this._width,this._boxHeight=this._height):(o.a>0&&o.c>0||o.a<0&&o.c<0?(e=0,i=o.a*this._width+o.c*this._height):(e=o.a*this._width,i=o.c*this._height),e>i?(this._boxX=i,this._boxWidth=e-i):(this._boxX=e,this._boxWidth=i-e),o.b>0&&o.d>0||o.b<0&&o.d<0?(e=0,i=o.b*this._width+o.d*this._height):(e=o.b*this._width,i=o.d*this._height),e>i?(this._boxY=i,this._boxHeight=e-i):(this._boxY=e,this._boxHeight=i-e));return this._x=this._offsetX,this._y=this._offsetY,this._x-=this._boxX+this._handleX*this._boxWidth,this._y-=this._boxY+this._handleY*this._boxHeight,this._aligned&&this._parent&&(this._parent.relativeMatrix(),this._x+=this._alignX*this._parent._width,this._y+=this._alignY*this._parent._height),o.translate(this._x,this._y),this._relativeMatrix},Ue.prototype.get=function(t){if("function"==typeof $e[t])return $e[t](this)},Ue.prototype.set=function(t,e){if("string"==typeof t)"function"==typeof Qe[t]&&void 0!==e&&Qe[t](this,e);else if("object"==typeof t)for(e in t)"function"==typeof Qe[e]&&void 0!==t[e]&&Qe[e](this,t[e],t);return this._owner&&(this._owner._ts_pin=++Ge,this._owner.touch()),this};var $e={alpha:function(t){return t._alpha},textureAlpha:function(t){return t._textureAlpha},width:function(t){return t._width},height:function(t){return t._height},boxWidth:function(t){return t._boxWidth},boxHeight:function(t){return t._boxHeight},scaleX:function(t){return t._scaleX},scaleY:function(t){return t._scaleY},skewX:function(t){return t._skewX},skewY:function(t){return t._skewY},rotation:function(t){return t._rotation},pivotX:function(t){return t._pivotX},pivotY:function(t){return t._pivotY},offsetX:function(t){return t._offsetX},offsetY:function(t){return t._offsetY},alignX:function(t){return t._alignX},alignY:function(t){return t._alignY},handleX:function(t){return t._handleX},handleY:function(t){return t._handleY}},Qe={alpha:function(t,e){t._alpha=e},textureAlpha:function(t,e){t._textureAlpha=e},width:function(t,e){t._width_=e,t._width=e,t._ts_transform=++Ge},height:function(t,e){t._height_=e,t._height=e,t._ts_transform=++Ge},scale:function(t,e){t._scaleX=e,t._scaleY=e,t._ts_transform=++Ge},scaleX:function(t,e){t._scaleX=e,t._ts_transform=++Ge},scaleY:function(t,e){t._scaleY=e,t._ts_transform=++Ge},skew:function(t,e){t._skewX=e,t._skewY=e,t._ts_transform=++Ge},skewX:function(t,e){t._skewX=e,t._ts_transform=++Ge},skewY:function(t,e){t._skewY=e,t._ts_transform=++Ge},rotation:function(t,e){t._rotation=e,t._ts_transform=++Ge},pivot:function(t,e){t._pivotX=e,t._pivotY=e,t._pivoted=!0,t._ts_transform=++Ge},pivotX:function(t,e){t._pivotX=e,t._pivoted=!0,t._ts_transform=++Ge},pivotY:function(t,e){t._pivotY=e,t._pivoted=!0,t._ts_transform=++Ge},offset:function(t,e){t._offsetX=e,t._offsetY=e,t._ts_translate=++Ge},offsetX:function(t,e){t._offsetX=e,t._ts_translate=++Ge},offsetY:function(t,e){t._offsetY=e,t._ts_translate=++Ge},align:function(t,e){this.alignX(t,e),this.alignY(t,e)},alignX:function(t,e){t._alignX=e,t._aligned=!0,t._ts_translate=++Ge,this.handleX(t,e)},alignY:function(t,e){t._alignY=e,t._aligned=!0,t._ts_translate=++Ge,this.handleY(t,e)},handle:function(t,e){this.handleX(t,e),this.handleY(t,e)},handleX:function(t,e){t._handleX=e,t._handled=!0,t._ts_translate=++Ge},handleY:function(t,e){t._handleY=e,t._handled=!0,t._ts_translate=++Ge},resizeMode:function(t,e,i){i&&("in"==e?e="in-pad":"out"==e&&(e="out-crop"),ti(t,i.resizeWidth,i.resizeHeight,e))},resizeWidth:function(t,e,i){i&&i.resizeMode||ti(t,e,null)},resizeHeight:function(t,e,i){i&&i.resizeMode||ti(t,null,e)},scaleMode:function(t,e,i){i&&ti(t,i.scaleWidth,i.scaleHeight,e)},scaleWidth:function(t,e,i){i&&i.scaleMode||ti(t,e,null)},scaleHeight:function(t,e,i){i&&i.scaleMode||ti(t,null,e)},matrix:function(t,e){this.scaleX(t,e.a),this.skewX(t,e.c/e.d),this.skewY(t,e.b/e.a),this.scaleY(t,e.d),this.offsetX(t,e.e),this.offsetY(t,e.f),this.rotation(t,0)}};function ti(t,e,i,o){var s="number"==typeof e,n="number"==typeof i,r="string"==typeof o;t._ts_transform=++Ge,s&&(t._scaleX=e/t._width_,t._width=t._width_),n&&(t._scaleY=i/t._height_,t._height=t._height_),s&&n&&r&&("out"==o||"out-crop"==o?t._scaleX=t._scaleY=Math.max(t._scaleX,t._scaleY):"in"!=o&&"in-pad"!=o||(t._scaleX=t._scaleY=Math.min(t._scaleX,t._scaleY)),"out-crop"!=o&&"in-pad"!=o||(t._width=e/t._scaleX,t._height=i/t._scaleY))}Me.prototype.scaleTo=function(t,e,i){return"object"==typeof t&&(i=e,e=t.y,t=t.x),ti(this._pin,t,e,i),this},Ue._add_shortcuts=function(t){t.prototype.size=function(t,e){return this.pin("width",t),this.pin("height",e),this},t.prototype.width=function(t){return void 0===t?this.pin("width"):(this.pin("width",t),this)},t.prototype.height=function(t){return void 0===t?this.pin("height"):(this.pin("height",t),this)},t.prototype.offset=function(t,e){return"object"==typeof t&&(e=t.y,t=t.x),this.pin("offsetX",t),this.pin("offsetY",e),this},t.prototype.rotate=function(t){return this.pin("rotation",t),this},t.prototype.skew=function(t,e){return"object"==typeof t?(e=t.y,t=t.x):void 0===e&&(e=t),this.pin("skewX",t),this.pin("skewY",e),this},t.prototype.scale=function(t,e){return"object"==typeof t?(e=t.y,t=t.x):void 0===e&&(e=t),this.pin("scaleX",t),this.pin("scaleY",e),this},t.prototype.alpha=function(t,e){return this.pin("alpha",t),void 0!==e&&this.pin("textureAlpha",e),this}},Ue._add_shortcuts(Me);var ei=Ue;function ii(t,e){ii._super.call(this),this.label("Root");var i=!0,o=this,s=0,n=function(r){if(!0!==i){pe.tick=pe.node=pe.draw=0;var a=s||r,h=r-a;s=r;var m=o._tick(h,r,a);o._mo_touch!=o._ts_touch?(o._mo_touch=o._ts_touch,e(o),t(n)):m?t(n):i=!0,pe.fps=h?1e3/h:0}};this.start=function(){return this.resume()},this.resume=function(){return i&&(this.publish("resume"),i=!1,t(n)),this},this.pause=function(){return i||this.publish("pause"),i=!0,this},this.touch_root=this.touch,this.touch=function(){return this.resume(),this.touch_root()}}Me.prototype._textures=null,Me.prototype._alpha=1,Me.prototype.render=function(t){if(this._visible){pe.node++;var e=this.matrix();t.setTransform(e.a,e.b,e.c,e.d,e.e,e.f),this._alpha=this._pin._alpha*(this._parent?this._parent._alpha:1);var i=this._pin._textureAlpha*this._alpha;if(t.globalAlpha!=i&&(t.globalAlpha=i),null!==this._textures)for(var o=0,s=this._textures.length;o<s;o++)this._textures[o].draw(t);t.globalAlpha!=this._alpha&&(t.globalAlpha=this._alpha);for(var n,r=this._first;n=r;)r=n._next,n.render(t)}},Me.prototype._tickBefore=null,Me.prototype._tickAfter=null,Me.prototype.MAX_ELAPSE=1/0,Me.prototype._tick=function(t,e,i){if(this._visible){t>this.MAX_ELAPSE&&(t=this.MAX_ELAPSE);var o=!1;if(null!==this._tickBefore)for(var s=0;s<this._tickBefore.length;s++){pe.tick++,o=!0===this._tickBefore[s].call(this,t,e,i)||o}for(var n,r=this._first;n=r;)r=n._next,n._flag("_tick")&&(o=!0===n._tick(t,e,i)||o);if(null!==this._tickAfter)for(s=0;s<this._tickAfter.length;s++){pe.tick++,o=!0===this._tickAfter[s].call(this,t,e,i)||o}return o}},Me.prototype.tick=function(t,e){"function"==typeof t&&(e?(null===this._tickBefore&&(this._tickBefore=[]),this._tickBefore.push(t)):(null===this._tickAfter&&(this._tickAfter=[]),this._tickAfter.push(t)),this._flag("_tick",null!==this._tickAfter&&this._tickAfter.length>0||null!==this._tickBefore&&this._tickBefore.length>0))},Me.prototype.untick=function(t){var e;"function"==typeof t&&(null!==this._tickBefore&&(e=this._tickBefore.indexOf(t))>=0&&this._tickBefore.splice(e,1),null!==this._tickAfter&&(e=this._tickAfter.indexOf(t))>=0&&this._tickAfter.splice(e,1))},Me.prototype.timeout=function(t,e){this.setTimeout(t,e)},Me.prototype.setTimeout=function(t,e){function i(o){if(!((e-=o)<0))return!0;this.untick(i),t.call(this)}return this.tick(i),i},Me.prototype.clearTimeout=function(t){this.untick(t)},ii._super=Me,ii.prototype=Pe(ii._super.prototype),Me.root=function(t,e){return new ii(t,e)},ii.prototype.background=function(t){return this},ii.prototype.viewport=function(t,e,i){if(void 0===t)return de({},this._viewport);this._viewport={width:t,height:e,ratio:i||1},this.viewbox();var o=de({},this._viewport);return this.visit({start:function(t){if(!t._flag("viewport"))return!0;t.publish("viewport",[o])}}),this},ii.prototype.viewbox=function(t,e,i){"number"==typeof t&&"number"==typeof e&&(this._viewbox={width:t,height:e,mode:/^(in|out|in-pad|out-crop)$/.test(i)?i:"in-pad"});var o=this._viewbox,s=this._viewport;return s&&o?(this.pin({width:o.width,height:o.height}),this.scaleTo(s.width,s.height,o.mode)):s&&this.pin({width:s.width,height:s.height}),this};var oi=Me,si=Se,ni=ke;oi.Matrix=si,oi.Texture=ni,Me.canvas=function(t,e,i){"string"==typeof t?"object"==typeof e||("function"==typeof e&&(i=e),e={}):("function"==typeof t&&(i=t),e={},t="2d");var o=document.createElement("canvas"),s=o.getContext(t,e),n=new ke(o);return n.context=function(){return s},n.size=function(t,e,i){return i=i||1,o.width=t*i,o.height=e*i,this.src(o,i),this},n.canvas=function(t){return"function"==typeof t?t.call(this,s):void 0===t&&"function"==typeof i&&i.call(this,s),this},"function"==typeof i&&i.call(n,s),n};var ri=ai;function ai(){ai._super.call(this),this.label("Image"),this._textures=[],this._image=null}function hi(){hi._super.call(this),this.label("Anim"),this._textures=[],this._fps=Me.Anim.FPS,this._ft=1e3/this._fps,this._time=-1,this._repeat=0,this._index=0,this._frames=[];var t=0;this.tick((function(e,i,o){if(!(this._time<0||this._frames.length<=1)){var s=t!=o;if(t=i,s)return!0;if(this._time+=e,this._time<this._ft)return!0;var n=this._time/this._ft|0;return this._time-=n*this._ft,this.moveFrame(n),!(this._repeat>0&&(this._repeat-=n)<=0)||(this.stop(),this._callback&&this._callback(),!1)}}),!1)}function mi(){mi._super.call(this),this.label("String"),this._textures=[]}function _i(t){return t}Me.image=function(t){var e=new ai;return t&&e.image(t),e},ai._super=Me,ai.prototype=Pe(ai._super.prototype),ai.prototype.setImage=function(t,e,i){return this.image(t,e,i)},ai.prototype.image=function(t){return this._image=Me.texture(t).one(),this.pin("width",this._image?this._image.width:0),this.pin("height",this._image?this._image.height:0),this._textures[0]=this._image.pipe(),this._textures.length=1,this},ai.prototype.tile=function(t){return this._repeat(!1,t),this},ai.prototype.stretch=function(t){return this._repeat(!0,t),this},ai.prototype._repeat=function(t,e){var i=this;function o(t,e,o,s,n,r,a,h,m){var _=i._textures.length>t?i._textures[t]:i._textures[t]=i._image.pipe();_.src(e,o,s,n),_.dest(r,a,h,m)}this.untick(this._repeatTicker),this.tick(this._repeatTicker=function(){if(this._mo_stretch!=this._pin._ts_transform){this._mo_stretch=this._pin._ts_transform;var i=this.pin("width"),s=this.pin("height");this._textures.length=function(t,e,i,o,s,n){var r=t.width,a=t.height,h=t.left,m=t.right,_=t.top,c=t.bottom;r=r-(h="number"==typeof h&&h==h?h:0)-(m="number"==typeof m&&m==m?m:0),a=a-(_="number"==typeof _&&_==_?_:0)-(c="number"==typeof c&&c==c?c:0),s||(e=Math.max(e-h-m,0),i=Math.max(i-_-c,0));var l=0;if(_>0&&h>0&&n(l++,0,0,h,_,0,0,h,_),c>0&&h>0&&n(l++,0,a+_,h,c,0,i+_,h,c),_>0&&m>0&&n(l++,r+h,0,m,_,e+h,0,m,_),c>0&&m>0&&n(l++,r+h,a+_,m,c,e+h,i+_,m,c),o)_>0&&n(l++,h,0,r,_,h,0,e,_),c>0&&n(l++,h,a+_,r,c,h,i+_,e,c),h>0&&n(l++,0,_,h,a,0,_,h,i),m>0&&n(l++,r+h,_,m,a,e+h,_,m,i),n(l++,h,_,r,a,h,_,e,i);else for(var u,p=h,d=e;d>0;){u=Math.min(r,d),d-=r;for(var y,f=_,v=i;v>0;)y=Math.min(a,v),v-=a,n(l++,h,_,u,y,p,f,u,y),d<=0&&(h&&n(l++,0,_,h,y,0,f,h,y),m&&n(l++,r+h,_,m,y,p+u,f,m,y)),f+=y;_&&n(l++,h,0,u,_,p,0,u,_),c&&n(l++,h,a+_,u,c,p,f,u,c),p+=u}return l}(this._image,i,s,t,e,o)}})},Me.anim=function(t,e){var i=new hi;return i.frames(t).gotoFrame(0),e&&i.fps(e),i},hi._super=Me,hi.prototype=Pe(hi._super.prototype),Me.Anim={FPS:15},hi.prototype.fps=function(t){return void 0===t?this._fps:(this._fps=t>0?t:Me.Anim.FPS,this._ft=1e3/this._fps,this)},hi.prototype.setFrames=function(t,e,i){return this.frames(t,e,i)},hi.prototype.frames=function(t){return this._index=0,this._frames=Me.texture(t).array(),this.touch(),this},hi.prototype.length=function(){return this._frames?this._frames.length:0},hi.prototype.gotoFrame=function(t,e){return this._index=0|Te.rotate(t,this._frames.length),e=e||!this._textures[0],this._textures[0]=this._frames[this._index],e&&(this.pin("width",this._textures[0].width),this.pin("height",this._textures[0].height)),this.touch(),this},hi.prototype.moveFrame=function(t){return this.gotoFrame(this._index+t)},hi.prototype.repeat=function(t,e){return this._repeat=t*this._frames.length-1,this._callback=e,this.play(),this},hi.prototype.play=function(t){return void 0!==t?(this.gotoFrame(t),this._time=0):this._time<0&&(this._time=0),this.touch(),this},hi.prototype.stop=function(t){return this._time=-1,void 0!==t&&this.gotoFrame(t),this},Me.string=function(t){return(new mi).frames(t)},mi._super=Me,mi.prototype=Pe(mi._super.prototype),mi.prototype.setFont=function(t,e,i){return this.frames(t,e,i)},mi.prototype.frames=function(t){return this._textures=[],"string"==typeof t?(t=Me.texture(t),this._item=function(e){return t.one(e)}):"object"==typeof t?this._item=function(e){return t[e]}:"function"==typeof t&&(this._item=t),this},mi.prototype.setValue=function(t,e,i){return this.value(t,e,i)},mi.prototype.value=function(t){if(void 0===t)return this._value;if(this._value===t)return this;this._value=t,null===t?t="":"string"==typeof t||ye.array(t)||(t=t.toString()),this._spacing=this._spacing||0;for(var e=0,i=0,o=0;o<t.length;o++){var s=this._textures[o]=this._item(t[o]);e+=o>0?this._spacing:0,s.dest(e,0),e+=s.width,i=Math.max(i,s.height)}return this.pin("width",e),this.pin("height",i),this._textures.length=t.length,this},Me.row=function(t){return Me.create().row(t).label("Row")},Me.prototype.row=function(t){return this.sequence("row",t),this},Me.column=function(t){return Me.create().column(t).label("Row")},Me.prototype.column=function(t){return this.sequence("column",t),this},Me.sequence=function(t,e){return Me.create().sequence(t,e).label("Sequence")},Me.prototype.sequence=function(t,e){return this._padding=this._padding||0,this._spacing=this._spacing||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_seq!=this._ts_touch){this._mo_seq=this._ts_touch;var i=this._mo_seqAlign!=this._ts_children;this._mo_seqAlign=this._ts_children;for(var o,s=0,n=0,r=this.first(!0),a=!0;o=r;){r=o.next(!0),o.matrix(!0);var h=o.pin("boxWidth"),m=o.pin("boxHeight");"column"==t?(!a&&(n+=this._spacing),o.pin("offsetY")!=n&&o.pin("offsetY",n),s=Math.max(s,h),n+=m,i&&o.pin("alignX",e)):"row"==t&&(!a&&(s+=this._spacing),o.pin("offsetX")!=s&&o.pin("offsetX",s),s+=h,n=Math.max(n,m),i&&o.pin("alignY",e)),a=!1}s+=2*this._padding,n+=2*this._padding,this.pin("width")!=s&&this.pin("width",s),this.pin("height")!=n&&this.pin("height",n)}}),this},Me.box=function(){return Me.create().box().label("Box")},Me.prototype.box=function(){return this._padding=this._padding||0,this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){if(this._mo_box!=this._ts_touch){this._mo_box=this._ts_touch;for(var t,e=0,i=0,o=this.first(!0);t=o;){o=t.next(!0),t.matrix(!0);var s=t.pin("boxWidth"),n=t.pin("boxHeight");e=Math.max(e,s),i=Math.max(i,n)}e+=2*this._padding,i+=2*this._padding,this.pin("width")!=e&&this.pin("width",e),this.pin("height")!=i&&this.pin("height",i)}}),this},Me.layer=function(){return Me.create().layer().label("Layer")},Me.prototype.layer=function(){return this.untick(this._layoutTiker),this.tick(this._layoutTiker=function(){var t=this.parent();if(t){var e=t.pin("width");this.pin("width")!=e&&this.pin("width",e);var i=t.pin("height");this.pin("height")!=i&&this.pin("height",i)}},!0),this},Me.prototype.padding=function(t){return this._padding=t,this},Me.prototype.spacing=function(t){return this._spacing=t,this};var ci={},li={},ui={};function pi(t){if("function"==typeof t)return t;if("string"!=typeof t)return _i;var e=ci[t];if(e)return e;var i=/^(\w+)(-(in|out|in-out|out-in))?(\((.*)\))?$/i.exec(t);if(!i||!i.length)return _i;var o=ui[i[1]],s=li[i[3]],n=i[5];return e=o&&o.fn?o.fn:o&&o.fc?o.fc.apply(o.fc,n&&n.replace(/\s+/,"").split(",")):_i,s&&(e=s.fn(e)),ci[t]=e,e}pi.add=function(t){for(var e=(t.name||t.mode).split(/\s+/),i=0;i<e.length;i++){var o=e[i];o&&((t.name?ui:li)[o]=t)}},pi.add({mode:"in",fn:function(t){return t}}),pi.add({mode:"out",fn:function(t){return function(e){return 1-t(1-e)}}}),pi.add({mode:"in-out",fn:function(t){return function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}}}),pi.add({mode:"out-in",fn:function(t){return function(e){return e<.5?1-t(2*(1-e))/2:t(2*e)/2}}}),pi.add({name:"linear",fn:function(t){return t}}),pi.add({name:"quad",fn:function(t){return t*t}}),pi.add({name:"cubic",fn:function(t){return t*t*t}}),pi.add({name:"quart",fn:function(t){return t*t*t*t}}),pi.add({name:"quint",fn:function(t){return t*t*t*t*t}}),pi.add({name:"sin sine",fn:function(t){return 1-Math.cos(t*Math.PI/2)}}),pi.add({name:"exp expo",fn:function(t){return 0==t?0:Math.pow(2,10*(t-1))}}),pi.add({name:"circle circ",fn:function(t){return 1-Math.sqrt(1-t*t)}}),pi.add({name:"bounce",fn:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}}),pi.add({name:"poly",fc:function(t){return function(e){return Math.pow(e,t)}}}),pi.add({name:"elastic",fc:function(t,e){t=t||1;var i=(e=e||.45)/(2*Math.PI)*Math.asin(1/t);return function(o){return 1+t*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/e)}}}),pi.add({name:"back",fc:function(t){return t=void 0!==t?t:1.70158,function(e){return e*e*((t+1)*e-t)}}});var di=pi;function yi(t,e,i){this._end={},this._duration=e||400,this._delay=i||0,this._owner=t,this._time=0}function fi(t,e,i,o){"number"==typeof t.pin(i)?e[i]=o:"number"==typeof t.pin(i+"X")&&"number"==typeof t.pin(i+"Y")&&(e[i+"X"]=o,e[i+"Y"]=o)}function vi(t,e){if(this instanceof vi){var i=t.viewport().ratio||1;t.on("viewport",(function(t){i=t.ratio||i})),this.x=0,this.y=0,this.toString=function(){return(0|this.x)+"x"+(0|this.y)},this.locate=function(t){!function(t,e,i){e.touches&&e.touches.length?(i.x=e.touches[0].clientX,i.y=e.touches[0].clientY):(i.x=e.clientX,i.y=e.clientY);var o=t.getBoundingClientRect();i.x-=o.left,i.y-=o.top,i.x-=0|t.clientLeft,i.y-=0|t.clientTop}(e,t,this),this.x*=i,this.y*=i},this.lookup=function(e,i){this.type=e,this.root=t,this.event=null,i.length=0,this.collect=i,this.root.visit(this.visitor,this)},this.publish=function(e,i,o){if(this.type=e,this.root=t,this.event=i,this.collect=!1,this.timeStamp=Date.now(),o){for(;o.length&&!this.visitor.end(o.shift(),this););o.length=0}else this.root.visit(this.visitor,this)},this.visitor={reverse:!0,visible:!0,start:function(t,e){return!t._flag(e.type)},end:function(t,e){xi.raw=e.event,xi.type=e.type,xi.timeStamp=e.timeStamp,xi.abs.x=e.x,xi.abs.y=e.y;var i=t.listeners(e.type);if(i&&(t.matrix().inverse().map(e,xi),(t===e.root||t.hitTest(xi))&&(e.collect&&e.collect.push(t),e.event))){for(var o=!1,s=0;s<i.length;s++)o=!!i[s].call(t,xi)||o;return o}}}}}Me.prototype.tween=function(t,e,i){if("number"!=typeof t?(i=t,e=0,t=0):"number"!=typeof e&&(i=e,e=0),!this._tweens){this._tweens=[];var o=0;this.tick((function(t,e,i){if(this._tweens.length){var s=o!=i;if(o=e,s)return!0;var n=this._tweens[0],r=n.tick(this,t,e,i);if(r&&n===this._tweens[0]&&this._tweens.shift(),"function"==typeof r)try{r.call(this)}catch(t){console.log(t)}return"object"==typeof r&&this._tweens.unshift(r),!0}}),!0)}this.touch(),i||(this._tweens.length=0);var s=new yi(this,t,e);return this._tweens.push(s),s},yi.prototype.tick=function(t,e,i,o){if(this._time+=e,!(this._time<this._delay)){var s,n,r=this._time-this._delay;if(!this._start)for(var a in this._start={},this._end)this._start[a]=this._owner.pin(a);r<this._duration?(s=r/this._duration,n=!1):(s=1,n=!0),"function"==typeof this._easing&&(s=this._easing(s));var h=1-s;for(var a in this._end)this._owner.pin(a,this._start[a]*h+this._end[a]*s);return n?this._next||this._done||!0:void 0}},yi.prototype.tween=function(t,e){return this._next=new yi(this._owner,t,e)},yi.prototype.duration=function(t){return this._duration=t,this},yi.prototype.delay=function(t){return this._delay=t,this},yi.prototype.ease=function(t){return this._easing=di(t),this},yi.prototype.done=function(t){return this._done=t,this},yi.prototype.hide=function(){return this.done((function(){this.hide()})),this},yi.prototype.remove=function(){return this.done((function(){this.remove()})),this},yi.prototype.pin=function(t,e){if("object"==typeof t)for(var i in t)fi(this._owner,this._end,i,t[i]);else void 0!==e&&fi(this._owner,this._end,t,e);return this},ei._add_shortcuts(yi),yi.prototype.then=function(t){return this.done(t),this},yi.prototype.clear=function(t){return this},Me._load((function(t,e){vi.subscribe(t,e)})),vi.CLICK="click",vi.START="touchstart mousedown",vi.MOVE="touchmove mousemove",vi.END="touchend mouseup",vi.CANCEL="touchcancel mousecancel",vi.subscribe=function(t,e){if(!t.mouse){t.mouse=new vi(t,e),e.addEventListener("touchstart",s),e.addEventListener("touchend",r),e.addEventListener("touchmove",n),e.addEventListener("touchcancel",a),e.addEventListener("mousedown",s),e.addEventListener("mouseup",r),e.addEventListener("mousemove",n),document.addEventListener("mouseup",a),window.addEventListener("blur",a);var i=[],o=[]}function s(e){e.preventDefault(),t.mouse.locate(e),t.mouse.publish(e.type,e),t.mouse.lookup("click",i),t.mouse.lookup("mousecancel",o)}function n(e){e.preventDefault(),t.mouse.locate(e),t.mouse.publish(e.type,e)}function r(e){e.preventDefault(),t.mouse.publish(e.type,e),i.length&&t.mouse.publish("click",e,i),o.length=0}function a(e){o.length&&t.mouse.publish("mousecancel",e,o),i.length=0}};var xi={},gi={};function bi(t,e,i){Object.defineProperty(t,e,{value:i})}bi(xi,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),bi(xi,"toString",(function(){return(0|this.x)+"x"+(0|this.y)+" ("+this.abs+")"})),bi(xi,"abs",gi),bi(gi,"clone",(function(t){return(t=t||{}).x=this.x,t.y=this.y,t})),bi(gi,"toString",(function(){return(0|this.x)+"x"+(0|this.y)}));var Ai,Bi=vi;Me._supported=!(!(Ai=document.createElement("canvas")).getContext||!Ai.getContext("2d")),window.addEventListener("load",(function(){Me._supported&&Me.start()}),!1),Me.config({"app-loader":function(t,e){var i,o=(e=e||{}).canvas,s=null,n=!1,r=0,a=0;"string"==typeof o&&(o=document.getElementById(o));o||(o=document.getElementById("cutjs")||document.getElementById("stage"));if(!o){n=!0,(o=document.createElement("canvas")).style.position="absolute",o.style.top="0",o.style.left="0";var h=document.body;h.insertBefore(o,h.firstChild)}s=o.getContext("2d");var m=window.devicePixelRatio||1,_=s.webkitBackingStorePixelRatio||s.mozBackingStorePixelRatio||s.msBackingStorePixelRatio||s.oBackingStorePixelRatio||s.backingStorePixelRatio||1;i=m/_;var c=window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},l=Me.root(c,u);function u(){s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,r,a),l.render(s)}function p(){n?(r=window.innerWidth>0?window.innerWidth:screen.width,a=window.innerHeight>0?window.innerHeight:screen.height,o.style.width=r+"px",o.style.height=a+"px"):(r=o.clientWidth,a=o.clientHeight),r*=i,a*=i,o.width===r&&o.height===a||(o.width=r,o.height=a,l.viewport(r,a,i),u())}l.background=function(t){return o.style.backgroundColor=t,this},t(l,o),p(),window.addEventListener("resize",p,!1),window.addEventListener("orientationchange",p,!1)},"image-loader":function(t,e,i){var o=new Image;o.onload=function(){e(o)},o.onerror=i,o.src=t}});var wi=ue((function(t){t.exports=oi,t.exports.internal={},t.exports.internal.Image=ri,t.exports.Mouse=Bi,t.exports.Math=Te,t.exports._extend=de,t.exports._create=Pe}));function Ci(t,e){var i=this;Ci._super.call(this),this.label("Planck"),e=e||{},this._options={},this._options.speed=e.speed||1,this._options.hz=e.hz||60,Math.abs(this._options.hz)<1&&(this._options.hz=1/this._options.hz),this._options.scaleY=e.scaleY||-1,this._options.ratio=e.ratio||16,this._options.lineWidth=2/this._options.ratio,this._world=t;var o=1/this._options.hz,s=0;this.tick((function(e){for(e=.001*e*i._options.speed,s+=e;s>o;)t.step(o),s-=o;return i.renderWorld(),!0}),!0),t.on("remove-fixture",(function(t){t.ui&&t.ui.remove()})),t.on("remove-joint",(function(t){t.ui&&t.ui.remove()}))}Ci._super=wi,Ci.prototype=wi._create(Ci._super.prototype),Ci.prototype.renderWorld=function(){for(var t=this._world,e=this._options,i=this,o=t.getBodyList();o;o=o.getNext())for(var s=o.getFixtureList();s;s=s.getNext()){if(!s.ui){s.render&&s.render.stroke?e.strokeStyle=s.render.stroke:o.render&&o.render.stroke?e.strokeStyle=o.render.stroke:o.isDynamic()?e.strokeStyle="rgba(255,255,255,0.9)":o.isKinematic()?e.strokeStyle="rgba(255,255,255,0.7)":o.isStatic()&&(e.strokeStyle="rgba(255,255,255,0.5)"),s.render&&s.render.fill?e.fillStyle=s.render.fill:o.render&&o.render.fill?e.fillStyle=o.render.fill:e.fillStyle="";var n=s.getType(),r=s.getShape();"circle"==n&&(s.ui=i.drawCircle(r,e)),"edge"==n&&(s.ui=i.drawEdge(r,e)),"polygon"==n&&(s.ui=i.drawPolygon(r,e)),"chain"==n&&(s.ui=i.drawChain(r,e)),s.ui&&s.ui.appendTo(i)}if(s.ui){var a=o.getPosition(),h=o.getAngle();s.ui.__lastX===a.x&&s.ui.__lastY===a.y&&s.ui.__lastR===h||(s.ui.__lastX=a.x,s.ui.__lastY=a.y,s.ui.__lastR=h,s.ui.offset(a.x,e.scaleY*a.y),s.ui.rotate(e.scaleY*h))}}for(var m=t.getJointList();m;m=m.getNext()){n=m.getType();var _=m.getAnchorA();o=m.getAnchorB();if(m.ui||(e.strokeStyle="rgba(255,255,255,0.2)",m.ui=i.drawJoint(m,e),m.ui.pin("handle",.5),m.ui&&m.ui.appendTo(i)),m.ui){var c=.5*(_.x+o.x),l=e.scaleY*(_.y+o.y)*.5,u=_.x-o.x,p=e.scaleY*(_.y-o.y),d=Math.sqrt(u*u+p*p);m.ui.width(d),m.ui.rotate(Math.atan2(p,u)),m.ui.offset(c,l)}}},Ci.prototype.drawJoint=function(t,e){var i=e.lineWidth,o=e.ratio,s=wi.canvas((function(t){this.size(10+2*i,2*i,o),t.scale(o,o),t.beginPath(),t.moveTo(i,i),t.lineTo(i+10,i),t.lineCap="round",t.lineWidth=e.lineWidth,t.strokeStyle=e.strokeStyle,t.stroke()}));return wi.image(s).stretch()},Ci.prototype.drawCircle=function(t,e){var i=e.lineWidth,o=e.ratio,s=t.m_radius,n=s+i,r=s+i,a=2*s+2*i,h=2*s+2*i,m=wi.canvas((function(t){this.size(a,h,o),t.scale(o,o),t.arc(n,r,s,0,2*Math.PI),e.fillStyle&&(t.fillStyle=e.fillStyle,t.fill()),t.lineTo(n,r),t.lineWidth=e.lineWidth,t.strokeStyle=e.strokeStyle,t.stroke()})),_=wi.image(m).offset(t.m_p.x-n,e.scaleY*t.m_p.y-r);return wi.create().append(_)},Ci.prototype.drawEdge=function(t,e){var i=e.lineWidth,o=e.ratio,s=t.m_vertex1,n=t.m_vertex2,r=n.x-s.x,a=n.y-s.y,h=Math.sqrt(r*r+a*a),m=wi.canvas((function(t){this.size(h+2*i,2*i,o),t.scale(o,o),t.beginPath(),t.moveTo(i,i),t.lineTo(i+h,i),t.lineCap="round",t.lineWidth=e.lineWidth,t.strokeStyle=e.strokeStyle,t.stroke()})),_=Math.min(s.x,n.x),c=Math.min(e.scaleY*s.y,e.scaleY*n.y),l=wi.image(m);return l.rotate(e.scaleY*Math.atan2(a,r)),l.offset(_-i,c-i),wi.create().append(l)},Ci.prototype.drawPolygon=function(t,e){var i=e.lineWidth,o=e.ratio,s=t.m_vertices;if(s.length){for(var n=1/0,r=1/0,a=-1/0,h=-1/0,m=0;m<s.length;++m){var _=s[m];n=Math.min(n,_.x),a=Math.max(a,_.x),r=Math.min(r,e.scaleY*_.y),h=Math.max(h,e.scaleY*_.y)}var c=a-n,l=h-r,u=wi.canvas((function(t){this.size(c+2*i,l+2*i,o),t.scale(o,o),t.beginPath();for(var a=0;a<s.length;++a){var h=s[a],m=h.x-n+i,_=e.scaleY*h.y-r+i;0==a?t.moveTo(m,_):t.lineTo(m,_)}s.length>2&&t.closePath(),e.fillStyle&&(t.fillStyle=e.fillStyle,t.fill(),t.closePath()),t.lineCap="round",t.lineWidth=e.lineWidth,t.strokeStyle=e.strokeStyle,t.stroke()})),p=wi.image(u);return p.offset(n-i,r-i),wi.create().append(p)}},Ci.prototype.drawChain=function(t,e){var i=e.lineWidth,o=e.ratio,s=t.m_vertices;if(s.length){for(var n=1/0,r=1/0,a=-1/0,h=-1/0,m=0;m<s.length;++m){var _=s[m];n=Math.min(n,_.x),a=Math.max(a,_.x),r=Math.min(r,e.scaleY*_.y),h=Math.max(h,e.scaleY*_.y)}var c=a-n,l=h-r,u=wi.canvas((function(t){this.size(c+2*i,l+2*i,o),t.scale(o,o),t.beginPath();for(var a=0;a<s.length;++a){var h=s[a],m=h.x-n+i,_=e.scaleY*h.y-r+i;0==a?t.moveTo(m,_):t.lineTo(m,_)}s.length,e.fillStyle&&(t.fillStyle=e.fillStyle,t.fill(),t.closePath()),t.lineCap="round",t.lineWidth=e.lineWidth,t.strokeStyle=e.strokeStyle,t.stroke()})),p=wi.image(u);return p.offset(n-i,r-i),wi.create().append(p)}};var Mi={};Mi.CollidePolygons=Ft,Mi.Settings=c,Mi.Sweep=x,Mi.Manifold=L,Mi.Distance=W,Mi.TimeOfImpact=ct,Mi.DynamicTree=p,Mi.stats=O,L.clipSegmentToLine=R,L.ClipVertex=D,L.getPointStates=Y,L.PointState=k,yt.TimeStep=ut,W.testOverlap=G,W.Input=X,W.Output=J,W.Proxy=H,W.Cache=N,ct.Input=ht,ct.Output=_t,t.AABB=_,t.Body=T,t.Box=St,t.Chain=It,t.Circle=wt,t.CollideCircles=Pt,t.CollideEdgeCircle=zt,t.CollideEdgePolygon=Jt,t.CollidePolygonCircle=qt,t.CollidePolygons=Ft,t.Contact=ot,t.Distance=W,t.DistanceJoint=Wt,t.DynamicTree=p,t.Edge=Ct,t.Fixture=C,t.FrictionJoint=Zt,t.GearJoint=te,t.Joint=nt,t.Manifold=L,t.Mat22=V,t.Mat33=Bt,t.Math=r,t.MotorJoint=ie,t.MouseJoint=se,t.Polygon=Mt,t.PrismaticJoint=$t,t.PulleyJoint=re,t.RevoluteJoint=Gt,t.RopeJoint=he,t.Rot=f,t.Serializer=bt,t.Settings=c,t.Shape=A,t.Sweep=x,t.TimeOfImpact=ct,t.Transform=v,t.Vec2=m,t.Vec3=xt,t.WeldJoint=_e,t.WheelJoint=le,t.World=vt,t.internal=Mi,t.testbed=function(t,e){"function"==typeof t&&(e=t,t=null),wi((function(t,i){t.on(wi.Mouse.START,(function(){window.focus(),document.activeElement&&document.activeElement.blur(),i.focus()})),t.MAX_ELAPSE=1e3/30;var o={};o.canvas=i;var s=!1;t.on("resume",(function(){s=!1,o._resume&&o._resume()})),t.on("pause",(function(){s=!0,o._pause&&o._pause()})),o.isPaused=function(){return s},o.togglePause=function(){s?o.resume():o.pause()},o.pause=function(){t.pause()},o.resume=function(){t.resume(),o.focus()},o.focus=function(){document.activeElement&&document.activeElement.blur(),i.focus()},o.width=80,o.height=60,o.x=0,o.y=-10,o.scaleY=-1,o.ratio=16,o.hz=60,o.speed=1,o.activeKeys={},o.background="#222222",o.findOne=function(){return null},o.findAll=function(){return[]};var n="",r={};function a(t,e){"function"!=typeof e&&"object"!=typeof e&&(r[t]=e)}o.status=function(t,e){void 0!==e?a(t,e):t&&"object"==typeof t?function(t){for(var e in t)a(e,t[e])}(t):"string"==typeof t&&(n=t),o._status&&o._status(n,r)},o.info=function(t){o._info&&o._info(t)};var h="",c="";!function(){var e=new wi.Texture;t.append(wi.image(e));var i=[];t.tick((function(){i.length=0}),!0),e.draw=function(t){t.save(),t.transform(1,0,0,o.scaleY,-o.x,-o.y),t.lineWidth=2/o.ratio,t.lineCap="round";for(var e=i.shift();e;e=i.shift())e(t,o.ratio);t.restore()},o.drawPoint=function(t,e,o){i.push((function(e,i){e.beginPath(),e.arc(t.x,t.y,5/i,0,2*Math.PI),e.strokeStyle=o,e.stroke()})),c+="point"+t.x+","+t.y+","+e+","+o},o.drawCircle=function(t,e,o){i.push((function(i){i.beginPath(),i.arc(t.x,t.y,e,0,2*Math.PI),i.strokeStyle=o,i.stroke()})),c+="circle"+t.x+","+t.y+","+e+","+o},o.drawSegment=function(t,e,o){i.push((function(i){i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.strokeStyle=o,i.stroke()})),c+="segment"+t.x+","+t.y+","+e.x+","+e.y+","+o},o.drawPolygon=function(t,e){if(t&&t.length){i.push((function(i){i.beginPath(),i.moveTo(t[0].x,t[0].y);for(var o=1;o<t.length;o++)i.lineTo(t[o].x,t[o].y);i.strokeStyle=e,i.closePath(),i.stroke()})),c+="segment";for(var o=1;o<t.length;o++)c+=t[o].x+","+t[o].y+",";c+=e}},o.drawAABB=function(t,e){i.push((function(i){i.beginPath(),i.moveTo(t.lowerBound.x,t.lowerBound.y),i.lineTo(t.upperBound.x,t.lowerBound.y),i.lineTo(t.upperBound.x,t.upperBound.y),i.lineTo(t.lowerBound.x,t.upperBound.y),i.strokeStyle=e,i.closePath(),i.stroke()})),c+="aabb",c+=t.lowerBound.x+","+t.lowerBound.y+",",c+=t.upperBound.x+","+t.upperBound.y+",",c+=e},o.color=function(t,e,i){return"rgb("+(t=256*t|0)+", "+(e=256*e|0)+", "+(i=256*i|0)+")"}}();var l=e(o),u=new Ci(l,o),p=0,d=0;t.tick((function(t,e){p===o.x&&d===o.y||(u.offset(-o.x,-o.y),p=o.x,d=o.y)})),u.tick((function(e,i){return"function"==typeof o.step&&o.step(e,i),f&&o.drawSegment(f.getPosition(),x,"rgba(255,255,255,0.2)"),h!==c&&(h=c,t.touch()),c="",!0})),t.background(o.background),t.viewbox(o.width,o.height),t.pin("alignX",-.5),t.pin("alignY",-.5),t.prepend(u);var y,f,v=l.createBody(),x={x:0,y:0};u.attr("spy",!0).on(wi.Mouse.START,(function(t){if(t={x:t.x,y:o.scaleY*t.y},!f){var e=function(t){var e,i=new _(t,t);return l.queryAABB(i,(function(i){if(!e&&i.getBody().isDynamic()&&i.testPoint(t))return e=i.getBody(),!0})),e}(t);e&&(o.mouseForce?f=e:(y=new se({maxForce:1e3},v,e,new m(t)),l.createJoint(y)))}})).on(wi.Mouse.MOVE,(function(t){t={x:t.x,y:o.scaleY*t.y},y&&y.setTarget(t),x.x=t.x,x.y=t.y})).on(wi.Mouse.END,(function(t){if(t={x:t.x,y:o.scaleY*t.y},y&&(l.destroyJoint(y),y=null),f){var e=m.sub(t,f.getPosition());f.applyForceToCenter(e.mul(o.mouseForce),!0),f=null}})).on(wi.Mouse.CANCEL,(function(t){t={x:t.x,y:o.scaleY*t.y},y&&(l.destroyJoint(y),y=null),f&&(f=null)})),window.addEventListener("keydown",(function(t){switch(t.keyCode){case"P".charCodeAt(0):o.togglePause()}}),!1);var g={};window.addEventListener("keydown",(function(t){var e=t.keyCode;g[e]=!0,A(e,!0),o.keydown&&o.keydown(e,String.fromCharCode(e))})),window.addEventListener("keyup",(function(t){var e=t.keyCode;g[e]=!1,A(e,!1),o.keyup&&o.keyup(e,String.fromCharCode(e))}));var b=o.activeKeys;function A(t,e){var i=String.fromCharCode(t);/\w/.test(i)&&(b[i]=e),b.right=g[39]||b.D,b.left=g[37]||b.A,b.up=g[38]||b.W,b.down=g[40]||b.S,b.fire=g[32]||g[13]}}))},Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=planck-with-testbed.min.js.map
6,054.575
239,928
0.736984
68d180da268d9bd81dcdc2d4d4d066509cdf83a9
15,767
js
JavaScript
public/16.js
AlexeyTcapaev/shark
21af4a5829143d3fe95927a3436ee8ca2f5af0a5
[ "MIT" ]
null
null
null
public/16.js
AlexeyTcapaev/shark
21af4a5829143d3fe95927a3436ee8ca2f5af0a5
[ "MIT" ]
null
null
null
public/16.js
AlexeyTcapaev/shark
21af4a5829143d3fe95927a3436ee8ca2f5af0a5
[ "MIT" ]
null
null
null
webpackJsonp([16],{ /***/ 114: /***/ (function(module, exports, __webpack_require__) { var disposed = false var normalizeComponent = __webpack_require__(115) /* script */ var __vue_script__ = __webpack_require__(180) /* template */ var __vue_template__ = __webpack_require__(181) /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = null /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __vue_script__, __vue_template__, __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) Component.options.__file = "resources/assets/js/views/AddChat.vue" /* hot reload */ if (false) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return module.hot.accept() if (!module.hot.data) { hotAPI.createRecord("data-v-08a8d7d4", Component.options) } else { hotAPI.reload("data-v-08a8d7d4", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} module.exports = Component.exports /***/ }), /***/ 115: /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file. // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */ ) { var esModule var scriptExports = rawScriptExports = rawScriptExports || {} // ES6 modules interop var type = typeof rawScriptExports.default if (type === 'object' || type === 'function') { esModule = rawScriptExports scriptExports = rawScriptExports.default } // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (compiledTemplate) { options.render = compiledTemplate.render options.staticRenderFns = compiledTemplate.staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = scopeId } var hook if (moduleIdentifier) { // server build hook = function (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 (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence 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 (injectStyles) { hook = injectStyles } if (hook) { var functional = options.functional var existing = functional ? options.render : options.beforeCreate if (!functional) { // inject component registration as beforeCreate hook options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } else { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functioal component in vue file options.render = function renderWithStyleInjection (h, context) { hook.call(context) return existing(h, context) } } } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /***/ 180: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuex__ = __webpack_require__(13); 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; }; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["default"] = ({ data: function data() { return { alert: { enable: false, type: "success" }, newChat: { users: [] }, users: [], loading: false }; }, methods: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["b" /* mapActions */])({ AddChat: "chat/AddChat" }), { submit: function submit() { var init = this; this.newChat.users.push(this.user); this.newChat.users = JSON.stringify(this.newChat.users); axios.post("/api/auth/chats", this.newChat).then(function (resp) { init.alert.message = "Диалог успешно создан."; init.alert.enable = true; init.AddChat(resp.data); }).catch(function (error) { init.alert.message = "Ошибка при создании диалога."; init.alert.enable = true; init.alert.type = "error"; }); }, remove: function remove(item) { var index = this.newChat.users.indexOf(item); if (index >= 0) this.newChat.users.splice(index, 1); } }), computed: _extends({}, Object(__WEBPACK_IMPORTED_MODULE_0_vuex__["c" /* mapGetters */])({ user: "user/GetUser" }), { valid: function valid() { return true; } }), mounted: function mounted() { var init = this; axios.get("/api/auth/users/" + this.user.id).then(function (resp) { init.users = resp.data; }).catch(function (error) {}); } }); /***/ }), /***/ 181: /***/ (function(module, exports, __webpack_require__) { var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "v-container", { attrs: { fluid: "", "fill-height": "" } }, [ _c( "v-layout", { attrs: { "align-center": "", "justify-center": "" } }, [ _c( "v-flex", { attrs: { xs12: "", sm8: "", md4: "" } }, [ _c( "v-card", { staticClass: "elevation-12" }, [ _c( "v-toolbar", { attrs: { dark: "", color: "primary" } }, [ _c("v-toolbar-title", [_vm._v("Cоздание чата")]), _vm._v(" "), _c("v-spacer") ], 1 ), _vm._v(" "), _c( "v-card-text", [ _c( "v-alert", { attrs: { type: _vm.alert.type, dismissible: "" }, model: { value: _vm.alert.enable, callback: function($$v) { _vm.$set(_vm.alert, "enable", $$v) }, expression: "alert.enable" } }, [_vm._v(_vm._s(_vm.alert.message))] ), _vm._v(" "), _c( "v-form", [ _c("v-autocomplete", { attrs: { items: _vm.users, outline: "", chips: "", label: "Добавить участников", "item-text": "name", "item-value": "name", "return-object": "", multiple: "" }, scopedSlots: _vm._u([ { key: "selection", fn: function(data) { return [ _c( "v-chip", { staticClass: "chip--select-multi", attrs: { selected: data.selected, close: "" }, on: { input: function($event) { _vm.remove(data.item) } } }, [ _c( "v-avatar", [ data.item.avatar ? _c("img", { attrs: { src: "/storage/uploads/" + data.item.avatar } }) : _c("v-icon", [ _vm._v("account_circle") ]) ], 1 ), _vm._v( "\n " + _vm._s(data.item.name) + "\n " ) ], 1 ) ] } }, { key: "item", fn: function(data) { return [ typeof data.item !== "object" ? [ _c("v-list-tile-content", { domProps: { textContent: _vm._s(data.item) } }) ] : [ _c( "v-list-tile-avatar", [ data.item.avatar ? _c("img", { attrs: { src: "/storage/uploads/" + data.item.avatar } }) : _c("v-icon", [ _vm._v("account_circle") ]) ], 1 ), _vm._v(" "), _c( "v-list-tile-content", [ _c("v-list-tile-title", { domProps: { innerHTML: _vm._s( data.item.name ) } }), _vm._v(" "), _c("v-list-tile-sub-title", { domProps: { innerHTML: _vm._s( data.item.group ) } }) ], 1 ) ] ] } } ]), model: { value: _vm.newChat.users, callback: function($$v) { _vm.$set(_vm.newChat, "users", $$v) }, expression: "newChat.users" } }) ], 1 ) ], 1 ), _vm._v(" "), _c( "v-card-actions", [ _c("v-spacer"), _vm._v(" "), _c( "v-btn", { attrs: { disabled: !_vm.valid, color: "primary", loading: _vm.loading }, on: { click: _vm.submit } }, [_vm._v("Создать")] ) ], 1 ) ], 1 ) ], 1 ) ], 1 ) ], 1 ) } var staticRenderFns = [] render._withStripped = true module.exports = { render: render, staticRenderFns: staticRenderFns } if (false) { module.hot.accept() if (module.hot.data) { require("vue-hot-reload-api") .rerender("data-v-08a8d7d4", module.exports) } } /***/ }) });
31.408367
257
0.357011
68d1a5cbbd406c4f8db3749036437b9574802691
336
js
JavaScript
frontend-native/App.js
havardp/NTNU-IT2810-moviedb
b64299eb52e66664ff6c73232910d50e3a079013
[ "MIT" ]
null
null
null
frontend-native/App.js
havardp/NTNU-IT2810-moviedb
b64299eb52e66664ff6c73232910d50e3a079013
[ "MIT" ]
8
2021-05-08T23:18:27.000Z
2022-02-27T04:56:53.000Z
frontend-native/App.js
havardp/NTNU-IT2810-moviedb
b64299eb52e66664ff6c73232910d50e3a079013
[ "MIT" ]
null
null
null
import React from 'react'; import client from './apollo' import { ApolloProvider } from '@apollo/react-hooks' import StackNavigator from './src/StackNavigation.js' import { View } from 'react-native'; export default function App() { return ( <ApolloProvider client={client}> <StackNavigator /> </ApolloProvider> ); }
24
53
0.699405
68d229ab70c90c1cda1637608226bbae350666ec
4,422
js
JavaScript
src/.vuepress/.temp/pages/extras/index.html.js
stata2r/stata2r.github.io
9f6801e016c1e7ba7a136d430b45fde73937c503
[ "MIT" ]
45
2021-12-15T10:07:45.000Z
2022-02-20T12:16:03.000Z
src/.vuepress/.temp/pages/extras/index.html.js
NathalieNF/stata2r.github.io
8a416b0c0cfab45203bae47b611a4c45922a014b
[ "MIT" ]
30
2021-11-23T06:10:26.000Z
2022-02-28T21:21:04.000Z
src/.vuepress/.temp/pages/extras/index.html.js
NathalieNF/stata2r.github.io
8a416b0c0cfab45203bae47b611a4c45922a014b
[ "MIT" ]
7
2022-01-18T20:31:18.000Z
2022-02-27T16:25:50.000Z
export const data = { "key": "v-1c385113", "path": "/extras/", "title": "extras", "lang": "en-US", "frontmatter": { "title": "extras" }, "excerpt": "", "headers": [ { "level": 2, "title": "ggplot2: Beautiful and customizable plots", "slug": "ggplot2-beautiful-and-customizable-plots", "children": [ { "level": 3, "title": "Basic scatterplot", "slug": "basic-scatterplot", "children": [] } ] }, { "level": 2, "title": "tidyverse", "slug": "tidyverse", "children": [ { "level": 3, "title": "Data wrangling with dplyr", "slug": "data-wrangling-with-dplyr", "children": [] }, { "level": 3, "title": "Manipulating dates with lubridate", "slug": "manipulating-dates-with-lubridate", "children": [] }, { "level": 3, "title": "Iterating with purrr", "slug": "iterating-with-purrr", "children": [] }, { "level": 3, "title": "String operations with stringr", "slug": "string-operations-with-stringr", "children": [] } ] }, { "level": 2, "title": "collapse: Extra convenience functions and super fast aggregations", "slug": "collapse-extra-convenience-functions-and-super-fast-aggregations", "children": [ { "level": 3, "title": "Quick Summaries", "slug": "quick-summaries", "children": [] }, { "level": 3, "title": "Multiple grouped aggregations", "slug": "multiple-grouped-aggregations", "children": [] } ] }, { "level": 2, "title": "sandwich: More Standard Error Adjustments", "slug": "sandwich-more-standard-error-adjustments", "children": [ { "level": 3, "title": "Linear Model Adjustments", "slug": "linear-model-adjustments", "children": [] } ] }, { "level": 2, "title": "modelsummary: Summary tables, regression tables, and more", "slug": "modelsummary-summary-tables-regression-tables-and-more", "children": [ { "level": 3, "title": "Summary Table", "slug": "summary-table", "children": [] }, { "level": 3, "title": "Regression Table", "slug": "regression-table", "children": [] } ] }, { "level": 2, "title": "lme4: Random effects and mixed models", "slug": "lme4-random-effects-and-mixed-models", "children": [ { "level": 3, "title": "Random Effects and Mixed Models", "slug": "random-effects-and-mixed-models", "children": [] } ] }, { "level": 2, "title": "marginaleffects: Marginal effects, constrasts, etc.", "slug": "marginaleffects-marginal-effects-constrasts-etc", "children": [ { "level": 3, "title": "Basic Logit Marginal Effects", "slug": "basic-logit-marginal-effects", "children": [] } ] }, { "level": 2, "title": "multcomp and nlWaldTest: Joint coefficient tests", "slug": "multcomp-and-nlwaldtest-joint-coefficient-tests", "children": [ { "level": 3, "title": "Test other null hypotheses and coefficient combinations", "slug": "test-other-null-hypotheses-and-coefficient-combinations", "children": [] } ] }, { "level": 2, "title": "sf: Geospatial operations", "slug": "sf-geospatial-operations", "children": [ { "level": 3, "title": "Simple Map", "slug": "simple-map", "children": [] } ] } ], "git": { "updatedTime": 1642438884000 }, "filePathRelative": "extras/README.md" } if (import.meta.webpackHot) { import.meta.webpackHot.accept() if (__VUE_HMR_RUNTIME__.updatePageData) { __VUE_HMR_RUNTIME__.updatePageData(data) } } if (import.meta.hot) { import.meta.hot.accept(({ data }) => { __VUE_HMR_RUNTIME__.updatePageData(data) }) }
24.983051
83
0.485527