From 9db0db83b14bbadeba8d74d6e2eba8cb71182f90 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 17 Aug 2015 12:44:53 +0200 Subject: [PATCH 1/4] There's no need to encode json in the Router. --- lib/Router/Router.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Router/Router.php b/lib/Router/Router.php index 9e01381a84..76100c7bf3 100644 --- a/lib/Router/Router.php +++ b/lib/Router/Router.php @@ -25,7 +25,7 @@ class Router { $method = $_POST['method']; $args = $_POST['args']; $endpoint = new $endpoint(); - $endpoint->$method(json_encode($args)); + $endpoint->$method($args); } function setToken() { From 6ed4ce0de27d46a03e7a2ebb65a6590e6d9922ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tautvidas=20Sipavi=C4=8Dius?= Date: Mon, 17 Aug 2015 14:31:32 +0300 Subject: [PATCH 2/4] Swap app code with bundles in `assets/js/src` folder --- assets/js/admin.js | 32 +- assets/js/mailpoet.js | 919 ++++- assets/js/src/admin.js | 32 +- assets/js/{ => src}/ajax.js | 0 assets/js/{ => src}/form_editor.js | 0 assets/js/{ => src}/handlebars_helpers.js | 0 assets/js/src/mailpoet.js | 926 +---- assets/js/{ => src}/modal.js | 0 assets/js/{ => src}/notice.js | 0 assets/js/{ => src}/public.js | 0 assets/js/src/vendor.js | 1072 ----- assets/js/vendor.js | 4381 +++++++++++++++++++++ views/layout.html | 6 +- webpack.config.js | 11 +- 14 files changed, 5341 insertions(+), 2038 deletions(-) rename assets/js/{ => src}/ajax.js (100%) rename assets/js/{ => src}/form_editor.js (100%) rename assets/js/{ => src}/handlebars_helpers.js (100%) rename assets/js/{ => src}/modal.js (100%) rename assets/js/{ => src}/notice.js (100%) rename assets/js/{ => src}/public.js (100%) delete mode 100644 assets/js/src/vendor.js create mode 100644 assets/js/vendor.js diff --git a/assets/js/admin.js b/assets/js/admin.js index 688b76cba3..b9c893b086 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -1,13 +1,21 @@ -define('admin', [ - 'mailpoet', - 'jquery', - 'handlebars', - ], function(MailPoet, jQuery, Handlebars) { - console.log('OVER HERE', MailPoet, jQuery, Handlebars); - jQuery(function($) { - // dom ready - $(function() { +webpackJsonp([0],[ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { - }); - }); -}); + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ + __webpack_require__(1), + __webpack_require__(2), + __webpack_require__(3), + ], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) { + console.log('OVER HERE', MailPoet, jQuery, Handlebars); + jQuery(function($) { + // dom ready + $(function() { + + }); + }); + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ } +]); \ No newline at end of file diff --git a/assets/js/mailpoet.js b/assets/js/mailpoet.js index 5b88379272..b308e8a13c 100644 --- a/assets/js/mailpoet.js +++ b/assets/js/mailpoet.js @@ -1,9 +1,914 @@ -define('mailpoet', [], function() { - // A placeholder for MailPoet object - var MailPoet = {}; +webpackJsonp([1],[ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { - // Expose MailPoet globally - window.MailPoet = MailPoet; + __webpack_require__(1); + __webpack_require__(4); + __webpack_require__(5); + module.exports = __webpack_require__(6); - return MailPoet; -}); + +/***/ }, +/* 1 */, +/* 2 */, +/* 3 */, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { + "use strict"; + /** + * MailPoet Ajax + **/ + + MailPoet.Ajax = { + version: 0.1, + options: {}, + defaults: { + url: null, + controller: 'dummy', + action: 'test', + data: {}, + onSuccess: function(data, textStatus, xhr) {}, + onError: function(xhr, textStatus, errorThrown) {} + }, + get: function(options) { + this.request('get', options); + }, + post: function(options) { + this.request('post', options); + }, + delete: function(options) { + this.request('delete', options); + }, + init: function(options) { + // merge options + this.options = jQuery.extend({}, this.defaults, options); + + if(this.options.url === null) { + this.options.url = ajaxurl+'?action=mailpoet_ajax'; + } + + // routing + this.options.url += '&mailpoet_controller='+this.options.controller; + this.options.url += '&mailpoet_action='+this.options.action; + }, + request: function(method, options) { + // set options + this.init(options); + + // make ajax request depending on method + if(method === 'get') { + jQuery.get( + this.options.url, + this.options.data, + this.options.onSuccess, + 'json' + ); + } else { + jQuery.ajax( + this.options.url, + { + data: JSON.stringify(this.options.data), + processData: false, + contentType: "application/json; charset=utf-8", + type : method, + dataType: 'json', + success : this.options.onSuccess, + error : this.options.onError + } + ); + } + } + }; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { + "use strict"; + /*================================================================================================== + + MailPoet Modal: + + version: 0.8 + author: Jonathan Labreuille + company: Wysija + dependencies: jQuery + + + Options: + + Mandatory: + // Modal window's title + (string) title: 'Modal title' + + // template + (string) template: jQuery('#handlebars_template').html() or + literal html + + Optional: + // jQuery cached element object node to be displayed, + // instead of creating a new one + (object) element: jQuery(selector) + + // - data object that will be passed to the template when rendering + (object) data: {}, + + // - data will be loaded via this url and passed to the template + // when rendering + // - if a "data" option was specified, it will be merged with the + // ajax's response data + (string) url: '/url.json' + + // ajax method + (string) method: 'post' (default: 'get') + + // ajax post params + (object) params: {} + + // - integers are expressed in pixels + (mixed) width: '50%' | 100 | '100px' + + // - integers are expressed in pixels + // - will be ignored when in "panel" mode + (mixed) height: '50%' | 100 | '100px' + + // - only used for "panel" mode + // - will be ignored in "popup" mode + (string) position: 'left' | 'right' + + // display overlay or not + (boolean) overlay: true | false + + // element(s) to be highlighted when the overlay is "on" + (object) highlight: jQuery element + + // callbacks + (function) onInit: called when the modal is displayed + (function) onSuccess: called by calling MailPoet_Guide.success() + (function) onCancel: called when closing the popup + or by calling MailPoet_Guide.cancel() + + Usage: + + // popup mode + MailPoet.Modal.popup(options); + + // panel mode + MailPoet.Modal.panel(options); + + // loading states + MailPoet.Modal.loading(true); // displays loading indicator + MailPoet.Modal.loading(false); // hides loading indicator + + ==================================================================================================*/ + + MailPoet.Modal = { + version: 0.8, + + // flags + initialized: false, + opened: false, + locked: false, + + // sub panels + subpanels: [], + + // default values + defaults: { + // title + title: null, + + // type + type: null, + + // positionning + position: 'right', + + // data sources + data: {}, + url: null, + method: 'get', + params: {}, + + // template + template: null, + body_template: null, + + // dimensions + width: 'auto', + height: 'auto', + + // display overlay + overlay: false, + + // highlighted elements + highlight: null, + + // callbacks + onInit: null, + onSuccess: null, + onCancel: null + }, + renderer: 'html', + options: {}, + templates: { + overlay: '', + popup: '
'+ + '
'+ + ''+ + '

'+ + '
'+ + '
'+ + '
', + loading: '', + panel: '
'+ + ''+ + '
'+ + '
'+ + '
'+ + '
', + subpanel: '
'+ + '
'+ + '
' + }, + setRenderer: function() { + this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars'; + }, + compileTemplate: function(template) { + if(this.renderer === 'html') { + return function() { return template; }; + } else { + return Handlebars.compile(template); + } + }, + init: function(options) { + if(this.initialized === true) { + this.close(); + } + + // merge options + this.options = jQuery.extend({}, this.defaults, options); + + // set renderer + this.setRenderer(); + + // init overlay + this.initOverlay(); + + // toggle overlay + this.toggleOverlay(this.options.overlay); + + if(this.options.type !== null) { + // insert modal depending on its type + if(this.options.type === 'popup') { + var modal = this.compileTemplate(this.templates[this.options.type]); + // create modal + jQuery('#mailpoet_modal_overlay').append(modal(this.options)); + // set title + jQuery('#mailpoet_popup_title h2').html(this.options.title); + } else if(this.options.type === 'panel') { + // create panel + jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]); + } + + // add proper overlay class + jQuery('#mailpoet_modal_overlay') + .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay') + .addClass('mailpoet_'+this.options.type+'_overlay'); + } + + // render template if specified + if(this.options.template !== null) { + // set "success" callback if specified + if(options.onSuccess !== undefined) { + this.options.onSuccess = options.onSuccess; + } + + // set "cancel" callback if specified + if(options.onCancel !== undefined) { + this.options.onCancel = options.onCancel; + } + + // compile template + this.options.body_template = this.compileTemplate(this.options.template); + + // setup events + this.setupEvents(); + } + + // set popup as initialized + this.initialized = true; + + return this; + }, + initOverlay: function(toggle) { + if(jQuery('#mailpoet_modal_overlay').length === 0) { + // insert overlay into the DOM + jQuery('body').append(this.templates.overlay); + // insert loading indicator into overlay + jQuery('#mailpoet_modal_overlay').append(this.templates.loading); + } + return this; + }, + toggleOverlay: function(toggle) { + if(toggle === true) { + jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden'); + } else { + jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden'); + } + + return this; + }, + setupEvents: function() { + // close popup when user clicks on close button + jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this)); + + // close popup when user clicks on overlay + jQuery('#mailpoet_modal_overlay').on('click', function(e) { + // we need to make sure that we are actually clicking on the overlay + // because when clicking on the popup content, it will trigger the click + // event on the overlay + if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); } + }.bind(this)); + + // close popup when user presses ESC key + jQuery(document).on('keyup.mailpoet_modal', function(e) { + if(this.opened === false) { return false; } + if(e.keyCode === 27) { this.cancel(); } + }.bind(this)); + + // make sure the popup is repositioned when the window is resized + jQuery(window).on('resize.mailpoet_modal', function() { + this.setPosition(); + }.bind(this)); + + return this; + }, + removeEvents: function() { + jQuery(document).unbind('keyup.mailpoet_modal'); + jQuery(window).unbind('resize.mailpoet_modal'); + jQuery('#mailpoet_modal_close').off('click'); + if(this.options.overlay === true) { + jQuery('#mailpoet_modal_overlay').off('click'); + } + + return this; + }, + lock: function() { + this.locked = true; + + return this; + }, + unlock: function() { + this.locked = false; + + return this; + }, + isLocked: function() { + return this.locked; + }, + loadTemplate: function() { + if(this.subpanels.length > 0) { + // hide panel + jQuery('.mailpoet_'+this.options.type+'_wrapper').hide(); + + // add sub panel wrapper + jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']); + + // add sub panel content + jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element); + } else if (this.options.element) { + jQuery('.mailpoet_'+this.options.type+'_body').empty(); + jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element); + } else { + jQuery('.mailpoet_'+this.options.type+'_body').html( + this.options.body_template( + this.options.data + ) + ); + } + + return this; + }, + loadUrl: function() { + if(this.options.method === 'get') { + // make ajax request + jQuery.getJSON(this.options.url, function(data) { + // merge returned data with existing data passed when calling the "open" method + this.options.data = jQuery.extend({}, this.options.data, data); + // load template using fetched data + this.loadTemplate(); + // show modal window + this.showModal(); + }.bind(this)); + } else if(this.options.method === 'post') { + // make ajax request + jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) { + // merge returned data with existing data passed when calling the "open" method + this.options.data = jQuery.extend({}, this.options.data, data); + // load template using fetched data + this.loadTemplate(); + // show modal window + this.showModal(); + }.bind(this), 'json'); + } + + return this; + }, + setDimensions: function() { + switch(this.options.type) { + case 'popup': + // set popup dimensions + jQuery('#mailpoet_popup').css({ + width: this.options.width, + minHeight: this.options.height + }); + // set popup wrapper height + jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height}); + break; + case 'panel': + // set dimensions + if(this.options.position === 'right') { + jQuery('#mailpoet_panel').css({ + width: this.options.width, + right: 0, + marginRight: '-' + this.options.width, + left: 'auto' + }); + } else if(this.options.position === 'left') { + jQuery('#mailpoet_panel').css({ + width: this.options.width, + left: 0, + marginLeft: '-' + this.options.width, + right: 'auto' + }); + } + jQuery('#mailpoet_panel').css({ minHeight: 'auto' }); + break; + } + + return this; + }, + setPosition: function() { + switch(this.options.type) { + case 'popup': + var screenWidth = jQuery(window).width(), + screenHeight = jQuery(window).height(), + modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(), + modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height(); + + var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))), + left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2))); + + // set position of popup depending on screen dimensions. + jQuery('#mailpoet_popup').css({ + top: top, + left: left + }); + break; + case 'panel': + setTimeout(function() { + // set position of popup depending on screen dimensions. + if(this.options.position === 'right') { + jQuery('#mailpoet_panel').css( + { marginRight: 0 } + ); + } else if(this.options.position === 'left') { + jQuery('#mailpoet_panel').css( + { marginLeft: 0 } + ); + } + }.bind(this), 0); + break; + } + + return this; + }, + showModal: function() { + // set modal dimensions + this.setDimensions(); + + // add a flag on the body so that we can prevent scrolling (setting overflow hidden) + jQuery('body').addClass('mailpoet_modal_opened'); + + // show popup + jQuery('#mailpoet_'+this.options.type).show(); + + // display overlay + this.showOverlay(); + + // set modal position + this.setPosition(); + + // add class on highlighted elements + if(this.options.highlight !== null) { + if(this.options.highlight.length > 0) { + this.highlightOn(this.options.highlight); + } + } + + // set popup as opened + this.opened = true; + + // trigger init event if specified + if(this.options.onInit !== null) { + this.options.onInit(); + } + + return this; + }, + highlightOn: function(element) { + jQuery(element).addClass('mailpoet_modal_highlight'); + return this; + }, + highlightOff: function() { + jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight'); + return this; + }, + hideModal: function(callback) { + // set modal as closed + this.opened = false; + + // hide modal + jQuery('#mailpoet_'+this.options.type).hide(); + + // remove class on highlighted elements + this.highlightOff(); + + // remove class from body to let it be scrollable + jQuery('body').removeClass('mailpoet_modal_opened'); + + return this; + }, + showOverlay: function(force) { + jQuery('#mailpoet_modal_overlay').show(); + return this; + }, + hideOverlay: function() { + jQuery('#mailpoet_modal_overlay').hide(); + return this; + }, + popup: function(options) { + // get options + options = options || {}; + // set modal type + options.type = 'popup'; + // set overlay state + options.overlay = options.overlay || true; + // initialize modal + this.init(options); + // open modal + this.open(); + + return this; + }, + panel: function(options) { + // get options + options = options || {}; + // reset subpanels + this.subpanels = []; + // set modal type + options.type = 'panel'; + // set overlay state + options.overlay = options.overlay || false; + // set highlighted element + options.highlight = options.highlight || null; + // set modal dimensions + options.width = options.width || '40%'; + options.height = options.height || 'auto'; + // initialize modal + this.init(options); + // open modal + this.open(); + + return this; + }, + subpanel: function(options) { + if(this.opened === false) { + // if no panel is already opened, let's create one instead + this.panel(options); + } else { + // if a panel is already opened, add a sub panel to it + this.subpanels.push(options); + this.loadTemplate(); + } + + return this; + }, + loading: function(toggle) { + // make sure the overlay is initialized and that it's visible + this.initOverlay(true); + + if(toggle === true) { + this.showLoading(); + } else { + this.hideLoading(); + } + + return this; + }, + showLoading: function() { + jQuery('#mailpoet_loading').show(); + + // add loading class to overlay + jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading'); + + return this; + }, + hideLoading: function() { + jQuery('#mailpoet_loading').hide(); + + // remove loading class from overlay + jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading'); + + return this; + }, + open: function() { + // load template if specified + if(this.options.template !== null) { + // check if a url was specified to get extra data + if(this.options.url !== null) { + this.loadUrl(); + } else { + // load template + this.loadTemplate(); + + // show modal window + this.showModal(); + } + } else { + this.cancel(); + } + + return this; + }, + success: function() { + if(this.subpanels.length > 0) { + if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) { + this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data); + } + } else { + if(this.options.onSuccess !== null) { + this.options.onSuccess(this.options.data); + } + } + this.close(); + + return this; + }, + cancel: function() { + if(this.subpanels.length > 0) { + if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) { + this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data); + } + } else { + if(this.options.onCancel !== null) { + this.options.onCancel(this.options.data); + } + } + this.close(); + + return this; + }, + destroy: function() { + this.hideOverlay(); + + // remove extra modal + if(jQuery('#mailpoet_'+this.options.type).length > 0) { + jQuery('#mailpoet_'+this.options.type).remove(); + } + + this.initialized = false; + + return this; + }, + close: function() { + if(this.isLocked() === true) return this; + + if(this.subpanels.length > 0) { + + // close subpanel + jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove(); + + // show previous panel + jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show(); + + // remove last subpanels + this.subpanels.pop(); + + return this; + } + + // remove event handlers + this.removeEvents(); + + // hide modal window + this.hideModal(); + + // destroy modal element + this.destroy(); + + // reset options + this.options = { + onSuccess: null, + onCancel: null + }; + + return this; + } + }; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { + "use strict"; + /*================================================================================================== + + MailPoet Notice: + + description: Handles notices + version: 0.2 + author: Jonathan Labreuille + company: Wysija + dependencies: jQuery + + Usage: + + // success message (static: false) + MailPoet.Notice.success('Yatta!'); + + // error message (static: false) + MailPoet.Notice.error('Boo!'); + + // system message (static: true) + MailPoet.Notice.system('You need to updated ASAP!'); + + Examples: + + MailPoet.Notice.success('- success #1 -'); + setTimeout(function() { + MailPoet.Notice.success('- success #2 -'); + setTimeout(function() { + MailPoet.Notice.error('- error -'); + setTimeout(function() { + MailPoet.Notice.system('- system -'); + + setTimeout(function() { + MailPoet.Notice.hide(); + }, 2500); + }, 300); + }, 400); + }, 500); + + ==================================================================================================*/ + + MailPoet.Notice = { + version: 0.2, + // default options + defaults: { + type: 'success', + message: '', + static: false, + scroll: false, + timeout: 2000, + onOpen: null, + onClose: null + }, + options: {}, + init: function(options) { + // set options + this.options = jQuery.extend({}, this.defaults, options); + + // clone element + this.element = jQuery('#mailpoet_notice_'+this.options.type).clone(); + + // remove id from clone + this.element.removeAttr('id'); + + // insert notice after its parent + jQuery('#mailpoet_notice_'+this.options.type).after(this.element); + + // setup onClose callback + var onClose = null; + if(this.options.onClose !== null) { + onClose = this.options.onClose; + } + + // listen to remove event + var element = this.element; + jQuery(this.element).on('close', function() { + jQuery(this).fadeOut(200, function() { + // on close callback + if(onClose !== null) { + onClose(); + } + // remove notice + jQuery(this).remove(); + }); + }.bind(this.element)); + + // listen to message event + jQuery(this.element).on('message', function(e, message) { + MailPoet.Notice.setMessage(message); + }.bind(this.element)); + + return this; + }, + isHTML: function(str) { + var a = document.createElement('div'); + a.innerHTML = str; + for(var c = a.childNodes, i = c.length; i--;) { + if(c[i].nodeType == 1) return true; + } + return false; + }, + setMessage: function(message) { + // if it's not an html message, let's sugar coat the message with a fancy

+ if(this.isHTML(message) === false) { + message = '

'+message+'

'; + } + // set message + return this.element.html(message); + }, + show: function(options) { + // initialize + this.init(options); + + // show notice + this.showNotice(); + + // return this; + }, + showNotice: function() { + // set message + this.setMessage(this.options.message); + + // make the notice appear + this.element.fadeIn(200); + + // if scroll option is enabled, scroll to the notice + if(this.options.scroll === true) { + this.element.get(0).scrollIntoView(false); + } + + // if the notice is not static, it has to disappear after a timeout + if(this.options.static === false) { + this.element.delay(this.options.timeout).trigger('close'); + } else { + this.element.append(''); + this.element.find('.mailpoet_notice_close').on('click', function() { + jQuery(this).trigger('close'); + }); + } + + // call onOpen callback + if(this.options.onOpen !== null) { + this.options.onOpen(this.element); + } + }, + hide: function(all) { + if(all !== undefined && all === true) { + jQuery('.mailpoet_notice:not([id])').trigger('close'); + } else { + jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])') + .trigger('close'); + } + }, + error: function(message, options) { + this.show(jQuery.extend({}, { + type: 'error', + message: '

'+message+'

' + }, options)); + }, + success: function(message, options) { + this.show(jQuery.extend({}, { + type: 'success', + message: '

'+message+'

' + }, options)); + }, + system: function(message, options) { + this.show(jQuery.extend({}, { + type: 'system', + static: true, + message: message + }, options)); + } + }; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ } +]); \ No newline at end of file diff --git a/assets/js/src/admin.js b/assets/js/src/admin.js index b9c893b086..6e22b30d08 100644 --- a/assets/js/src/admin.js +++ b/assets/js/src/admin.js @@ -1,21 +1,13 @@ -webpackJsonp([0],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +define('admin', [ + 'mailpoet', + 'jquery', + 'handlebars', + ], function(MailPoet, jQuery, Handlebars) { + console.log('admin.js', MailPoet, jQuery, Handlebars); + jQuery(function($) { + // dom ready + $(function() { - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ - __webpack_require__(1), - __webpack_require__(2), - __webpack_require__(3), - ], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) { - console.log('OVER HERE', MailPoet, jQuery, Handlebars); - jQuery(function($) { - // dom ready - $(function() { - - }); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file + }); + }); +}); diff --git a/assets/js/ajax.js b/assets/js/src/ajax.js similarity index 100% rename from assets/js/ajax.js rename to assets/js/src/ajax.js diff --git a/assets/js/form_editor.js b/assets/js/src/form_editor.js similarity index 100% rename from assets/js/form_editor.js rename to assets/js/src/form_editor.js diff --git a/assets/js/handlebars_helpers.js b/assets/js/src/handlebars_helpers.js similarity index 100% rename from assets/js/handlebars_helpers.js rename to assets/js/src/handlebars_helpers.js diff --git a/assets/js/src/mailpoet.js b/assets/js/src/mailpoet.js index fe25d3165a..5b88379272 100644 --- a/assets/js/src/mailpoet.js +++ b/assets/js/src/mailpoet.js @@ -1,921 +1,9 @@ -webpackJsonp([1],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { +define('mailpoet', [], function() { + // A placeholder for MailPoet object + var MailPoet = {}; - __webpack_require__(1); - __webpack_require__(11); - __webpack_require__(12); - module.exports = __webpack_require__(13); + // Expose MailPoet globally + window.MailPoet = MailPoet; - -/***/ }, -/* 1 */, -/* 2 */, -/* 3 */, -/* 4 */, -/* 5 */, -/* 6 */, -/* 7 */, -/* 8 */, -/* 9 */, -/* 10 */, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /** - * MailPoet Ajax - **/ - - MailPoet.Ajax = { - version: 0.1, - options: {}, - defaults: { - url: null, - controller: 'dummy', - action: 'test', - data: {}, - onSuccess: function(data, textStatus, xhr) {}, - onError: function(xhr, textStatus, errorThrown) {} - }, - get: function(options) { - this.request('get', options); - }, - post: function(options) { - this.request('post', options); - }, - delete: function(options) { - this.request('delete', options); - }, - init: function(options) { - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - if(this.options.url === null) { - this.options.url = ajaxurl+'?action=mailpoet_ajax'; - } - - // routing - this.options.url += '&mailpoet_controller='+this.options.controller; - this.options.url += '&mailpoet_action='+this.options.action; - }, - request: function(method, options) { - // set options - this.init(options); - - // make ajax request depending on method - if(method === 'get') { - jQuery.get( - this.options.url, - this.options.data, - this.options.onSuccess, - 'json' - ); - } else { - jQuery.ajax( - this.options.url, - { - data: JSON.stringify(this.options.data), - processData: false, - contentType: "application/json; charset=utf-8", - type : method, - dataType: 'json', - success : this.options.onSuccess, - error : this.options.onError - } - ); - } - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Modal: - - version: 0.8 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - - Options: - - Mandatory: - // Modal window's title - (string) title: 'Modal title' - - // template - (string) template: jQuery('#handlebars_template').html() or - literal html - - Optional: - // jQuery cached element object node to be displayed, - // instead of creating a new one - (object) element: jQuery(selector) - - // - data object that will be passed to the template when rendering - (object) data: {}, - - // - data will be loaded via this url and passed to the template - // when rendering - // - if a "data" option was specified, it will be merged with the - // ajax's response data - (string) url: '/url.json' - - // ajax method - (string) method: 'post' (default: 'get') - - // ajax post params - (object) params: {} - - // - integers are expressed in pixels - (mixed) width: '50%' | 100 | '100px' - - // - integers are expressed in pixels - // - will be ignored when in "panel" mode - (mixed) height: '50%' | 100 | '100px' - - // - only used for "panel" mode - // - will be ignored in "popup" mode - (string) position: 'left' | 'right' - - // display overlay or not - (boolean) overlay: true | false - - // element(s) to be highlighted when the overlay is "on" - (object) highlight: jQuery element - - // callbacks - (function) onInit: called when the modal is displayed - (function) onSuccess: called by calling MailPoet_Guide.success() - (function) onCancel: called when closing the popup - or by calling MailPoet_Guide.cancel() - - Usage: - - // popup mode - MailPoet.Modal.popup(options); - - // panel mode - MailPoet.Modal.panel(options); - - // loading states - MailPoet.Modal.loading(true); // displays loading indicator - MailPoet.Modal.loading(false); // hides loading indicator - - ==================================================================================================*/ - - MailPoet.Modal = { - version: 0.8, - - // flags - initialized: false, - opened: false, - locked: false, - - // sub panels - subpanels: [], - - // default values - defaults: { - // title - title: null, - - // type - type: null, - - // positionning - position: 'right', - - // data sources - data: {}, - url: null, - method: 'get', - params: {}, - - // template - template: null, - body_template: null, - - // dimensions - width: 'auto', - height: 'auto', - - // display overlay - overlay: false, - - // highlighted elements - highlight: null, - - // callbacks - onInit: null, - onSuccess: null, - onCancel: null - }, - renderer: 'html', - options: {}, - templates: { - overlay: '', - popup: '
'+ - '
'+ - ''+ - '

'+ - '
'+ - '
'+ - '
', - loading: '', - panel: '
'+ - ''+ - '
'+ - '
'+ - '
'+ - '
', - subpanel: '
'+ - '
'+ - '
' - }, - setRenderer: function() { - this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars'; - }, - compileTemplate: function(template) { - if(this.renderer === 'html') { - return function() { return template; }; - } else { - return Handlebars.compile(template); - } - }, - init: function(options) { - if(this.initialized === true) { - this.close(); - } - - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - // set renderer - this.setRenderer(); - - // init overlay - this.initOverlay(); - - // toggle overlay - this.toggleOverlay(this.options.overlay); - - if(this.options.type !== null) { - // insert modal depending on its type - if(this.options.type === 'popup') { - var modal = this.compileTemplate(this.templates[this.options.type]); - // create modal - jQuery('#mailpoet_modal_overlay').append(modal(this.options)); - // set title - jQuery('#mailpoet_popup_title h2').html(this.options.title); - } else if(this.options.type === 'panel') { - // create panel - jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]); - } - - // add proper overlay class - jQuery('#mailpoet_modal_overlay') - .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay') - .addClass('mailpoet_'+this.options.type+'_overlay'); - } - - // render template if specified - if(this.options.template !== null) { - // set "success" callback if specified - if(options.onSuccess !== undefined) { - this.options.onSuccess = options.onSuccess; - } - - // set "cancel" callback if specified - if(options.onCancel !== undefined) { - this.options.onCancel = options.onCancel; - } - - // compile template - this.options.body_template = this.compileTemplate(this.options.template); - - // setup events - this.setupEvents(); - } - - // set popup as initialized - this.initialized = true; - - return this; - }, - initOverlay: function(toggle) { - if(jQuery('#mailpoet_modal_overlay').length === 0) { - // insert overlay into the DOM - jQuery('body').append(this.templates.overlay); - // insert loading indicator into overlay - jQuery('#mailpoet_modal_overlay').append(this.templates.loading); - } - return this; - }, - toggleOverlay: function(toggle) { - if(toggle === true) { - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden'); - } else { - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden'); - } - - return this; - }, - setupEvents: function() { - // close popup when user clicks on close button - jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this)); - - // close popup when user clicks on overlay - jQuery('#mailpoet_modal_overlay').on('click', function(e) { - // we need to make sure that we are actually clicking on the overlay - // because when clicking on the popup content, it will trigger the click - // event on the overlay - if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); } - }.bind(this)); - - // close popup when user presses ESC key - jQuery(document).on('keyup.mailpoet_modal', function(e) { - if(this.opened === false) { return false; } - if(e.keyCode === 27) { this.cancel(); } - }.bind(this)); - - // make sure the popup is repositioned when the window is resized - jQuery(window).on('resize.mailpoet_modal', function() { - this.setPosition(); - }.bind(this)); - - return this; - }, - removeEvents: function() { - jQuery(document).unbind('keyup.mailpoet_modal'); - jQuery(window).unbind('resize.mailpoet_modal'); - jQuery('#mailpoet_modal_close').off('click'); - if(this.options.overlay === true) { - jQuery('#mailpoet_modal_overlay').off('click'); - } - - return this; - }, - lock: function() { - this.locked = true; - - return this; - }, - unlock: function() { - this.locked = false; - - return this; - }, - isLocked: function() { - return this.locked; - }, - loadTemplate: function() { - if(this.subpanels.length > 0) { - // hide panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').hide(); - - // add sub panel wrapper - jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']); - - // add sub panel content - jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element); - } else if (this.options.element) { - jQuery('.mailpoet_'+this.options.type+'_body').empty(); - jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element); - } else { - jQuery('.mailpoet_'+this.options.type+'_body').html( - this.options.body_template( - this.options.data - ) - ); - } - - return this; - }, - loadUrl: function() { - if(this.options.method === 'get') { - // make ajax request - jQuery.getJSON(this.options.url, function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this)); - } else if(this.options.method === 'post') { - // make ajax request - jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this), 'json'); - } - - return this; - }, - setDimensions: function() { - switch(this.options.type) { - case 'popup': - // set popup dimensions - jQuery('#mailpoet_popup').css({ - width: this.options.width, - minHeight: this.options.height - }); - // set popup wrapper height - jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height}); - break; - case 'panel': - // set dimensions - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - right: 0, - marginRight: '-' + this.options.width, - left: 'auto' - }); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - left: 0, - marginLeft: '-' + this.options.width, - right: 'auto' - }); - } - jQuery('#mailpoet_panel').css({ minHeight: 'auto' }); - break; - } - - return this; - }, - setPosition: function() { - switch(this.options.type) { - case 'popup': - var screenWidth = jQuery(window).width(), - screenHeight = jQuery(window).height(), - modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(), - modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height(); - - var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))), - left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2))); - - // set position of popup depending on screen dimensions. - jQuery('#mailpoet_popup').css({ - top: top, - left: left - }); - break; - case 'panel': - setTimeout(function() { - // set position of popup depending on screen dimensions. - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css( - { marginRight: 0 } - ); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css( - { marginLeft: 0 } - ); - } - }.bind(this), 0); - break; - } - - return this; - }, - showModal: function() { - // set modal dimensions - this.setDimensions(); - - // add a flag on the body so that we can prevent scrolling (setting overflow hidden) - jQuery('body').addClass('mailpoet_modal_opened'); - - // show popup - jQuery('#mailpoet_'+this.options.type).show(); - - // display overlay - this.showOverlay(); - - // set modal position - this.setPosition(); - - // add class on highlighted elements - if(this.options.highlight !== null) { - if(this.options.highlight.length > 0) { - this.highlightOn(this.options.highlight); - } - } - - // set popup as opened - this.opened = true; - - // trigger init event if specified - if(this.options.onInit !== null) { - this.options.onInit(); - } - - return this; - }, - highlightOn: function(element) { - jQuery(element).addClass('mailpoet_modal_highlight'); - return this; - }, - highlightOff: function() { - jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight'); - return this; - }, - hideModal: function(callback) { - // set modal as closed - this.opened = false; - - // hide modal - jQuery('#mailpoet_'+this.options.type).hide(); - - // remove class on highlighted elements - this.highlightOff(); - - // remove class from body to let it be scrollable - jQuery('body').removeClass('mailpoet_modal_opened'); - - return this; - }, - showOverlay: function(force) { - jQuery('#mailpoet_modal_overlay').show(); - return this; - }, - hideOverlay: function() { - jQuery('#mailpoet_modal_overlay').hide(); - return this; - }, - popup: function(options) { - // get options - options = options || {}; - // set modal type - options.type = 'popup'; - // set overlay state - options.overlay = options.overlay || true; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - panel: function(options) { - // get options - options = options || {}; - // reset subpanels - this.subpanels = []; - // set modal type - options.type = 'panel'; - // set overlay state - options.overlay = options.overlay || false; - // set highlighted element - options.highlight = options.highlight || null; - // set modal dimensions - options.width = options.width || '40%'; - options.height = options.height || 'auto'; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - subpanel: function(options) { - if(this.opened === false) { - // if no panel is already opened, let's create one instead - this.panel(options); - } else { - // if a panel is already opened, add a sub panel to it - this.subpanels.push(options); - this.loadTemplate(); - } - - return this; - }, - loading: function(toggle) { - // make sure the overlay is initialized and that it's visible - this.initOverlay(true); - - if(toggle === true) { - this.showLoading(); - } else { - this.hideLoading(); - } - - return this; - }, - showLoading: function() { - jQuery('#mailpoet_loading').show(); - - // add loading class to overlay - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading'); - - return this; - }, - hideLoading: function() { - jQuery('#mailpoet_loading').hide(); - - // remove loading class from overlay - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading'); - - return this; - }, - open: function() { - // load template if specified - if(this.options.template !== null) { - // check if a url was specified to get extra data - if(this.options.url !== null) { - this.loadUrl(); - } else { - // load template - this.loadTemplate(); - - // show modal window - this.showModal(); - } - } else { - this.cancel(); - } - - return this; - }, - success: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onSuccess !== null) { - this.options.onSuccess(this.options.data); - } - } - this.close(); - - return this; - }, - cancel: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onCancel !== null) { - this.options.onCancel(this.options.data); - } - } - this.close(); - - return this; - }, - destroy: function() { - this.hideOverlay(); - - // remove extra modal - if(jQuery('#mailpoet_'+this.options.type).length > 0) { - jQuery('#mailpoet_'+this.options.type).remove(); - } - - this.initialized = false; - - return this; - }, - close: function() { - if(this.isLocked() === true) return this; - - if(this.subpanels.length > 0) { - - // close subpanel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove(); - - // show previous panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show(); - - // remove last subpanels - this.subpanels.pop(); - - return this; - } - - // remove event handlers - this.removeEvents(); - - // hide modal window - this.hideModal(); - - // destroy modal element - this.destroy(); - - // reset options - this.options = { - onSuccess: null, - onCancel: null - }; - - return this; - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 13 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Notice: - - description: Handles notices - version: 0.2 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - Usage: - - // success message (static: false) - MailPoet.Notice.success('Yatta!'); - - // error message (static: false) - MailPoet.Notice.error('Boo!'); - - // system message (static: true) - MailPoet.Notice.system('You need to updated ASAP!'); - - Examples: - - MailPoet.Notice.success('- success #1 -'); - setTimeout(function() { - MailPoet.Notice.success('- success #2 -'); - setTimeout(function() { - MailPoet.Notice.error('- error -'); - setTimeout(function() { - MailPoet.Notice.system('- system -'); - - setTimeout(function() { - MailPoet.Notice.hide(); - }, 2500); - }, 300); - }, 400); - }, 500); - - ==================================================================================================*/ - - MailPoet.Notice = { - version: 0.2, - // default options - defaults: { - type: 'success', - message: '', - static: false, - scroll: false, - timeout: 2000, - onOpen: null, - onClose: null - }, - options: {}, - init: function(options) { - // set options - this.options = jQuery.extend({}, this.defaults, options); - - // clone element - this.element = jQuery('#mailpoet_notice_'+this.options.type).clone(); - - // remove id from clone - this.element.removeAttr('id'); - - // insert notice after its parent - jQuery('#mailpoet_notice_'+this.options.type).after(this.element); - - // setup onClose callback - var onClose = null; - if(this.options.onClose !== null) { - onClose = this.options.onClose; - } - - // listen to remove event - var element = this.element; - jQuery(this.element).on('close', function() { - jQuery(this).fadeOut(200, function() { - // on close callback - if(onClose !== null) { - onClose(); - } - // remove notice - jQuery(this).remove(); - }); - }.bind(this.element)); - - // listen to message event - jQuery(this.element).on('message', function(e, message) { - MailPoet.Notice.setMessage(message); - }.bind(this.element)); - - return this; - }, - isHTML: function(str) { - var a = document.createElement('div'); - a.innerHTML = str; - for(var c = a.childNodes, i = c.length; i--;) { - if(c[i].nodeType == 1) return true; - } - return false; - }, - setMessage: function(message) { - // if it's not an html message, let's sugar coat the message with a fancy

- if(this.isHTML(message) === false) { - message = '

'+message+'

'; - } - // set message - return this.element.html(message); - }, - show: function(options) { - // initialize - this.init(options); - - // show notice - this.showNotice(); - - // return this; - }, - showNotice: function() { - // set message - this.setMessage(this.options.message); - - // make the notice appear - this.element.fadeIn(200); - - // if scroll option is enabled, scroll to the notice - if(this.options.scroll === true) { - this.element.get(0).scrollIntoView(false); - } - - // if the notice is not static, it has to disappear after a timeout - if(this.options.static === false) { - this.element.delay(this.options.timeout).trigger('close'); - } else { - this.element.append(''); - this.element.find('.mailpoet_notice_close').on('click', function() { - jQuery(this).trigger('close'); - }); - } - - // call onOpen callback - if(this.options.onOpen !== null) { - this.options.onOpen(this.element); - } - }, - hide: function(all) { - if(all !== undefined && all === true) { - jQuery('.mailpoet_notice:not([id])').trigger('close'); - } else { - jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])') - .trigger('close'); - } - }, - error: function(message, options) { - this.show(jQuery.extend({}, { - type: 'error', - message: '

'+message+'

' - }, options)); - }, - success: function(message, options) { - this.show(jQuery.extend({}, { - type: 'success', - message: '

'+message+'

' - }, options)); - }, - system: function(message, options) { - this.show(jQuery.extend({}, { - type: 'system', - static: true, - message: message - }, options)); - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file + return MailPoet; +}); diff --git a/assets/js/modal.js b/assets/js/src/modal.js similarity index 100% rename from assets/js/modal.js rename to assets/js/src/modal.js diff --git a/assets/js/notice.js b/assets/js/src/notice.js similarity index 100% rename from assets/js/notice.js rename to assets/js/src/notice.js diff --git a/assets/js/public.js b/assets/js/src/public.js similarity index 100% rename from assets/js/public.js rename to assets/js/src/public.js diff --git a/assets/js/src/vendor.js b/assets/js/src/vendor.js deleted file mode 100644 index 6aba369dce..0000000000 --- a/assets/js/src/vendor.js +++ /dev/null @@ -1,1072 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ if(moreModules[0]) { -/******/ installedModules[0] = 0; -/******/ return __webpack_require__(0); -/******/ } -/******/ }; - -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 2:0 -/******/ }; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); - -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; - -/******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"admin","1":"mailpoet"}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(3); - module.exports = __webpack_require__(14); - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { - // A placeholder for MailPoet object - var MailPoet = {}; - - // Expose MailPoet globally - window.MailPoet = MailPoet; - - return MailPoet; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - module.exports = jQuery; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - // Create a simple path alias to allow browserify to resolve - // the runtime on a supported path. - module.exports = __webpack_require__(4)['default']; - - -/***/ }, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - - var _import = __webpack_require__(5); - - var base = _interopRequireWildcard(_import); - - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) - - var _SafeString = __webpack_require__(8); - - var _SafeString2 = _interopRequireWildcard(_SafeString); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _import2 = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import2); - - var _import3 = __webpack_require__(9); - - var runtime = _interopRequireWildcard(_import3); - - var _noConflict = __webpack_require__(10); - - var _noConflict2 = _interopRequireWildcard(_noConflict); - - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { - var hb = new base.HandlebarsEnvironment(); - - Utils.extend(hb, base); - hb.SafeString = _SafeString2['default']; - hb.Exception = _Exception2['default']; - hb.Utils = Utils; - hb.escapeExpression = Utils.escapeExpression; - - hb.VM = runtime; - hb.template = function (spec) { - return runtime.template(spec, hb); - }; - - return hb; - } - - var inst = create(); - inst.create = create; - - _noConflict2['default'](inst); - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; - exports.createFrame = createFrame; - - var _import = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var VERSION = '3.0.1'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 6; - - exports.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function registerHelper(name, fn) { - if (toString.call(name) === objectType) { - if (fn) { - throw new _Exception2['default']('Arg not supported with multiple helpers'); - } - Utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _Exception2['default']('Attempting to register a partial as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function () { - if (arguments.length === 1) { - // A missing field in a {{foo}} constuct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _Exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: Utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (isArray(context)) { - for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - - instance.registerHelper('if', function (conditional, options) { - if (isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); - - instance.registerHelper('with', function (context, options) { - if (isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!Utils.isEmpty(context)) { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); - options = { data: data }; - } - - return fn(context, options); - } else { - return options.inverse(this); - } - }); - - instance.registerHelper('log', function (message, options) { - var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; - instance.log(level, message); - }); - - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); - } - - var logger = { - methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, - - // State enum - DEBUG: 0, - INFO: 1, - WARN: 2, - ERROR: 3, - level: 1, - - // Can be overridden in the host environment - log: function log(level, message) { - if (typeof console !== 'undefined' && logger.level <= level) { - var method = logger.methodMap[level]; - (console[method] || console.log).call(console, message); // eslint-disable-line no-console - } - } - }; - - exports.logger = logger; - var log = logger.log; - - exports.log = log; - - function createFrame(object) { - var frame = Utils.extend({}, object); - frame._parent = object; - return frame; - } - - /* [args, ]options */ - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '`': '`' - }; - - var badChars = /[&<>"'`]/g, - possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /*eslint-disable func-style, no-var */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - exports.isFunction = isFunction; - /*eslint-enable func-style, no-var */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - };exports.isArray = isArray; - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - -/***/ }, -/* 7 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - 'use strict'; - - exports.__esModule = true; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - -/***/ }, -/* 9 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - - // TODO: Remove this line and break up compilePartial - - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _import = __webpack_require__(6); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(7); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(5); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision], - compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision]; - throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _Exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _Exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - return templateSpec[i]; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - depths = options.depths ? [context].concat(options.depths) : [context]; - } - - return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _Exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _Exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths)); - } - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - function resolvePartial(partial, context, options) { - if (!partial) { - partial = options.partials[options.name]; - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - options.partial = true; - - if (partial === undefined) { - throw new _Exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {}; - data.root = context; - } - return data; - } - -/***/ }, -/* 10 */ -/***/ function(module, exports) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - exports.__esModule = true; - /*global window */ - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }, -/* 11 */, -/* 12 */, -/* 13 */, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) { - // Handlebars helpers - Handlebars.registerHelper('concat', function() { - var size = (arguments.length - 1), - output = ''; - for(var i = 0; i < size; i++) { - output += arguments[i]; - }; - return output; - }); - - Handlebars.registerHelper('number_format', function(value, block) { - return Number(value).toLocaleString(); - }); - Handlebars.registerHelper('date_format', function(timestamp, block) { - if(window.moment) { - if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) { - return; - } - - // set date format - var f = block.hash.format || "MMM Do, YYYY"; - // check if we passed a timestamp - if(parseInt(timestamp, 10) == timestamp) { - return moment.unix(timestamp).format(f); - } else { - return moment.utc(timestamp).format(f); - } - } else { - return timestamp; - }; - }); - - Handlebars.registerHelper('cycle', function(value, block) { - var values = value.split(' '); - return values[block.data.index % (values.length + 1)]; - }); - - Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { - switch (operator) { - case '==': - return (v1 == v2) ? options.fn(this) : options.inverse(this); - case '===': - return (v1 === v2) ? options.fn(this) : options.inverse(this); - case '!=': - return (v1 != v2) ? options.fn(this) : options.inverse(this); - case '!==': - return (v1 !== v2) ? options.fn(this) : options.inverse(this); - case '<': - return (v1 < v2) ? options.fn(this) : options.inverse(this); - case '<=': - return (v1 <= v2) ? options.fn(this) : options.inverse(this); - case '>': - return (v1 > v2) ? options.fn(this) : options.inverse(this); - case '>=': - return (v1 >= v2) ? options.fn(this) : options.inverse(this); - case '&&': - return (v1 && v2) ? options.fn(this) : options.inverse(this); - case '||': - return (v1 || v2) ? options.fn(this) : options.inverse(this); - case 'in': - var values = v2.split(','); - return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this); - default: - return options.inverse(this); - } - }); - - Handlebars.registerHelper('nl2br', function(value, block) { - return value.gsub("\n", "
"); - }); - - Handlebars.registerHelper('json_encode', function(value, block) { - return JSON.stringify(value); - }); - - Handlebars.registerHelper('json_decode', function(value, block) { - return JSON.parse(value); - }); - Handlebars.registerHelper('url', function(value, block) { - var url = window.location.protocol + "//" + window.location.host + window.location.pathname; - - return url + value; - }); - Handlebars.registerHelper('emailFromMailto', function(value) { - var mailtoMatchingRegex = /^mailto\:/i; - if (typeof value === 'string' && value.match(mailtoMatchingRegex)) { - return value.replace(mailtoMatchingRegex, ''); - } else { - return value; - } - }); - Handlebars.registerHelper('lookup', function(obj, field, options) { - return obj && obj[field]; - }); - - - Handlebars.registerHelper('rsa_key', function(value, block) { - // extract all lines into an array - if(value === undefined) return ''; - - var lines = value.trim().split("\n"); - - // remove header & footer - lines.shift(); - lines.pop(); - - // return concatenated lines - return lines.join(''); - }); - - Handlebars.registerHelper('trim', function(value, block) { - if(value === null || value === undefined) return ''; - return value.trim(); - }); - - /** - * {{ellipsis}} - * From: https://github.com/assemble/handlebars-helpers - * @author: Jon Schlinkert - * Truncate the input string and removes all HTML tags - * @param {String} str The input string. - * @param {Number} limit The number of characters to limit the string. - * @param {String} append The string to append if charaters are omitted. - * @return {String} The truncated string. - */ - Handlebars.registerHelper('ellipsis', function (str, limit, append) { - if (append === undefined) { - append = ''; - } - var sanitized = str.replace(/(<([^>]+)>)/g, ''); - if (sanitized.length > limit) { - return sanitized.substr(0, limit - append.length) + append; - } else { - return sanitized; - } - }); - - Handlebars.registerHelper('getNumber', function (string) { - return parseInt(string, 10); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -/******/ ]); \ No newline at end of file diff --git a/assets/js/vendor.js b/assets/js/vendor.js new file mode 100644 index 0000000000..7fdad85f55 --- /dev/null +++ b/assets/js/vendor.js @@ -0,0 +1,4381 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // install a JSONP callback for chunk loading +/******/ var parentJsonpFunction = window["webpackJsonp"]; +/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { +/******/ // add "moreModules" to the modules object, +/******/ // then flag all "chunkIds" as loaded and fire callback +/******/ var moduleId, chunkId, i = 0, callbacks = []; +/******/ for(;i < chunkIds.length; i++) { +/******/ chunkId = chunkIds[i]; +/******/ if(installedChunks[chunkId]) +/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); +/******/ installedChunks[chunkId] = 0; +/******/ } +/******/ for(moduleId in moreModules) { +/******/ modules[moduleId] = moreModules[moduleId]; +/******/ } +/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); +/******/ while(callbacks.length) +/******/ callbacks.shift().call(null, __webpack_require__); +/******/ if(moreModules[0]) { +/******/ installedModules[0] = 0; +/******/ return __webpack_require__(0); +/******/ } +/******/ }; + +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // object to store loaded and loading chunks +/******/ // "0" means "already loaded" +/******/ // Array means "loading", array contains callbacks +/******/ var installedChunks = { +/******/ 2:0 +/******/ }; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + +/******/ // This file contains only the entry chunk. +/******/ // The chunk loading function for additional chunks +/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { +/******/ // "0" is the signal for "already loaded" +/******/ if(installedChunks[chunkId] === 0) +/******/ return callback.call(null, __webpack_require__); + +/******/ // an array means "currently loading". +/******/ if(installedChunks[chunkId] !== undefined) { +/******/ installedChunks[chunkId].push(callback); +/******/ } else { +/******/ // start chunk loading +/******/ installedChunks[chunkId] = [callback]; +/******/ var head = document.getElementsByTagName('head')[0]; +/******/ var script = document.createElement('script'); +/******/ script.type = 'text/javascript'; +/******/ script.charset = 'utf-8'; +/******/ script.async = true; + +/******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"admin","1":"mailpoet"}[chunkId]||chunkId) + ".js"; +/******/ head.appendChild(script); +/******/ } +/******/ }; + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + __webpack_require__(3); + module.exports = __webpack_require__(7); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { + // A placeholder for MailPoet object + var MailPoet = {}; + + // Expose MailPoet globally + window.MailPoet = MailPoet; + + return MailPoet; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + module.exports = jQuery; + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + /*! + + handlebars v3.0.3 + + Copyright (C) 2011-2014 by Yehuda Katz + + 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. + + @license + */ + (function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define(factory); + else if(typeof exports === 'object') + exports["Handlebars"] = factory(); + else + root["Handlebars"] = factory(); + })(this, function() { + return /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; + + /******/ // The require function + /******/ function __webpack_require__(moduleId) { + + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) + /******/ return installedModules[moduleId].exports; + + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ exports: {}, + /******/ id: moduleId, + /******/ loaded: false + /******/ }; + + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + + /******/ // Flag the module as loaded + /******/ module.loaded = true; + + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + + + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; + + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; + + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ""; + + /******/ // Load entry module and return exports + /******/ return __webpack_require__(0); + /******/ }) + /************************************************************************/ + /******/ ([ + /* 0 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + + var _runtime = __webpack_require__(1); + + var _runtime2 = _interopRequireWildcard(_runtime); + + // Compiler imports + + var _AST = __webpack_require__(2); + + var _AST2 = _interopRequireWildcard(_AST); + + var _Parser$parse = __webpack_require__(3); + + var _Compiler$compile$precompile = __webpack_require__(4); + + var _JavaScriptCompiler = __webpack_require__(5); + + var _JavaScriptCompiler2 = _interopRequireWildcard(_JavaScriptCompiler); + + var _Visitor = __webpack_require__(6); + + var _Visitor2 = _interopRequireWildcard(_Visitor); + + var _noConflict = __webpack_require__(7); + + var _noConflict2 = _interopRequireWildcard(_noConflict); + + var _create = _runtime2['default'].create; + function create() { + var hb = _create(); + + hb.compile = function (input, options) { + return _Compiler$compile$precompile.compile(input, options, hb); + }; + hb.precompile = function (input, options) { + return _Compiler$compile$precompile.precompile(input, options, hb); + }; + + hb.AST = _AST2['default']; + hb.Compiler = _Compiler$compile$precompile.Compiler; + hb.JavaScriptCompiler = _JavaScriptCompiler2['default']; + hb.Parser = _Parser$parse.parser; + hb.parse = _Parser$parse.parse; + + return hb; + } + + var inst = create(); + inst.create = create; + + _noConflict2['default'](inst); + + inst.Visitor = _Visitor2['default']; + + inst['default'] = inst; + + exports['default'] = inst; + module.exports = exports['default']; + + /***/ }, + /* 1 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + + var _import = __webpack_require__(9); + + var base = _interopRequireWildcard(_import); + + // Each of these augment the Handlebars object. No need to setup here. + // (This is done to easily share code between commonjs and browse envs) + + var _SafeString = __webpack_require__(10); + + var _SafeString2 = _interopRequireWildcard(_SafeString); + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var _import2 = __webpack_require__(12); + + var Utils = _interopRequireWildcard(_import2); + + var _import3 = __webpack_require__(13); + + var runtime = _interopRequireWildcard(_import3); + + var _noConflict = __webpack_require__(7); + + var _noConflict2 = _interopRequireWildcard(_noConflict); + + // For compatibility and usage outside of module systems, make the Handlebars object a namespace + function create() { + var hb = new base.HandlebarsEnvironment(); + + Utils.extend(hb, base); + hb.SafeString = _SafeString2['default']; + hb.Exception = _Exception2['default']; + hb.Utils = Utils; + hb.escapeExpression = Utils.escapeExpression; + + hb.VM = runtime; + hb.template = function (spec) { + return runtime.template(spec, hb); + }; + + return hb; + } + + var inst = create(); + inst.create = create; + + _noConflict2['default'](inst); + + inst['default'] = inst; + + exports['default'] = inst; + module.exports = exports['default']; + + /***/ }, + /* 2 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + var AST = { + Program: function Program(statements, blockParams, strip, locInfo) { + this.loc = locInfo; + this.type = 'Program'; + this.body = statements; + + this.blockParams = blockParams; + this.strip = strip; + }, + + MustacheStatement: function MustacheStatement(path, params, hash, escaped, strip, locInfo) { + this.loc = locInfo; + this.type = 'MustacheStatement'; + + this.path = path; + this.params = params || []; + this.hash = hash; + this.escaped = escaped; + + this.strip = strip; + }, + + BlockStatement: function BlockStatement(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) { + this.loc = locInfo; + this.type = 'BlockStatement'; + + this.path = path; + this.params = params || []; + this.hash = hash; + this.program = program; + this.inverse = inverse; + + this.openStrip = openStrip; + this.inverseStrip = inverseStrip; + this.closeStrip = closeStrip; + }, + + PartialStatement: function PartialStatement(name, params, hash, strip, locInfo) { + this.loc = locInfo; + this.type = 'PartialStatement'; + + this.name = name; + this.params = params || []; + this.hash = hash; + + this.indent = ''; + this.strip = strip; + }, + + ContentStatement: function ContentStatement(string, locInfo) { + this.loc = locInfo; + this.type = 'ContentStatement'; + this.original = this.value = string; + }, + + CommentStatement: function CommentStatement(comment, strip, locInfo) { + this.loc = locInfo; + this.type = 'CommentStatement'; + this.value = comment; + + this.strip = strip; + }, + + SubExpression: function SubExpression(path, params, hash, locInfo) { + this.loc = locInfo; + + this.type = 'SubExpression'; + this.path = path; + this.params = params || []; + this.hash = hash; + }, + + PathExpression: function PathExpression(data, depth, parts, original, locInfo) { + this.loc = locInfo; + this.type = 'PathExpression'; + + this.data = data; + this.original = original; + this.parts = parts; + this.depth = depth; + }, + + StringLiteral: function StringLiteral(string, locInfo) { + this.loc = locInfo; + this.type = 'StringLiteral'; + this.original = this.value = string; + }, + + NumberLiteral: function NumberLiteral(number, locInfo) { + this.loc = locInfo; + this.type = 'NumberLiteral'; + this.original = this.value = Number(number); + }, + + BooleanLiteral: function BooleanLiteral(bool, locInfo) { + this.loc = locInfo; + this.type = 'BooleanLiteral'; + this.original = this.value = bool === 'true'; + }, + + UndefinedLiteral: function UndefinedLiteral(locInfo) { + this.loc = locInfo; + this.type = 'UndefinedLiteral'; + this.original = this.value = undefined; + }, + + NullLiteral: function NullLiteral(locInfo) { + this.loc = locInfo; + this.type = 'NullLiteral'; + this.original = this.value = null; + }, + + Hash: function Hash(pairs, locInfo) { + this.loc = locInfo; + this.type = 'Hash'; + this.pairs = pairs; + }, + HashPair: function HashPair(key, value, locInfo) { + this.loc = locInfo; + this.type = 'HashPair'; + this.key = key; + this.value = value; + }, + + // Public API used to evaluate derived attributes regarding AST nodes + helpers: { + // a mustache is definitely a helper if: + // * it is an eligible helper, and + // * it has at least one parameter or hash segment + helperExpression: function helperExpression(node) { + return !!(node.type === 'SubExpression' || node.params.length || node.hash); + }, + + scopedId: function scopedId(path) { + return /^\.|this\b/.test(path.original); + }, + + // an ID is simple if it only has one part, and that part is not + // `..` or `this`. + simpleId: function simpleId(path) { + return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; + } + } + }; + + // Must be exported as an object rather than the root of the module as the jison lexer + // must modify the object to operate properly. + exports['default'] = AST; + module.exports = exports['default']; + + /***/ }, + /* 3 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + exports.parse = parse; + + var _parser = __webpack_require__(14); + + var _parser2 = _interopRequireWildcard(_parser); + + var _AST = __webpack_require__(2); + + var _AST2 = _interopRequireWildcard(_AST); + + var _WhitespaceControl = __webpack_require__(15); + + var _WhitespaceControl2 = _interopRequireWildcard(_WhitespaceControl); + + var _import = __webpack_require__(16); + + var Helpers = _interopRequireWildcard(_import); + + var _extend = __webpack_require__(12); + + exports.parser = _parser2['default']; + + var yy = {}; + _extend.extend(yy, Helpers, _AST2['default']); + + function parse(input, options) { + // Just return if an already-compiled AST was passed in. + if (input.type === 'Program') { + return input; + } + + _parser2['default'].yy = yy; + + // Altering the shared object here, but this is ok as parser is a sync operation + yy.locInfo = function (locInfo) { + return new yy.SourceLocation(options && options.srcName, locInfo); + }; + + var strip = new _WhitespaceControl2['default'](); + return strip.accept(_parser2['default'].parse(input)); + } + + /***/ }, + /* 4 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + exports.Compiler = Compiler; + exports.precompile = precompile; + exports.compile = compile; + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var _isArray$indexOf = __webpack_require__(12); + + var _AST = __webpack_require__(2); + + var _AST2 = _interopRequireWildcard(_AST); + + var slice = [].slice; + + function Compiler() {} + + // the foundHelper register will disambiguate helper lookup from finding a + // function in a context. This is necessary for mustache compatibility, which + // requires that context functions in blocks are evaluated by blockHelperMissing, + // and then proceed as if the resulting value was provided to blockHelperMissing. + + Compiler.prototype = { + compiler: Compiler, + + equals: function equals(other) { + var len = this.opcodes.length; + if (other.opcodes.length !== len) { + return false; + } + + for (var i = 0; i < len; i++) { + var opcode = this.opcodes[i], + otherOpcode = other.opcodes[i]; + if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { + return false; + } + } + + // We know that length is the same between the two arrays because they are directly tied + // to the opcode behavior above. + len = this.children.length; + for (var i = 0; i < len; i++) { + if (!this.children[i].equals(other.children[i])) { + return false; + } + } + + return true; + }, + + guid: 0, + + compile: function compile(program, options) { + this.sourceNode = []; + this.opcodes = []; + this.children = []; + this.options = options; + this.stringParams = options.stringParams; + this.trackIds = options.trackIds; + + options.blockParams = options.blockParams || []; + + // These changes will propagate to the other compiler components + var knownHelpers = options.knownHelpers; + options.knownHelpers = { + helperMissing: true, + blockHelperMissing: true, + each: true, + 'if': true, + unless: true, + 'with': true, + log: true, + lookup: true + }; + if (knownHelpers) { + for (var _name in knownHelpers) { + if (_name in knownHelpers) { + options.knownHelpers[_name] = knownHelpers[_name]; + } + } + } + + return this.accept(program); + }, + + compileProgram: function compileProgram(program) { + var childCompiler = new this.compiler(), + // eslint-disable-line new-cap + result = childCompiler.compile(program, this.options), + guid = this.guid++; + + this.usePartial = this.usePartial || result.usePartial; + + this.children[guid] = result; + this.useDepths = this.useDepths || result.useDepths; + + return guid; + }, + + accept: function accept(node) { + this.sourceNode.unshift(node); + var ret = this[node.type](node); + this.sourceNode.shift(); + return ret; + }, + + Program: function Program(program) { + this.options.blockParams.unshift(program.blockParams); + + var body = program.body, + bodyLength = body.length; + for (var i = 0; i < bodyLength; i++) { + this.accept(body[i]); + } + + this.options.blockParams.shift(); + + this.isSimple = bodyLength === 1; + this.blockParams = program.blockParams ? program.blockParams.length : 0; + + return this; + }, + + BlockStatement: function BlockStatement(block) { + transformLiteralToPath(block); + + var program = block.program, + inverse = block.inverse; + + program = program && this.compileProgram(program); + inverse = inverse && this.compileProgram(inverse); + + var type = this.classifySexpr(block); + + if (type === 'helper') { + this.helperSexpr(block, program, inverse); + } else if (type === 'simple') { + this.simpleSexpr(block); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('blockValue', block.path.original); + } else { + this.ambiguousSexpr(block, program, inverse); + + // now that the simple mustache is resolved, we need to + // evaluate it by executing `blockHelperMissing` + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + this.opcode('emptyHash'); + this.opcode('ambiguousBlockValue'); + } + + this.opcode('append'); + }, + + PartialStatement: function PartialStatement(partial) { + this.usePartial = true; + + var params = partial.params; + if (params.length > 1) { + throw new _Exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); + } else if (!params.length) { + params.push({ type: 'PathExpression', parts: [], depth: 0 }); + } + + var partialName = partial.name.original, + isDynamic = partial.name.type === 'SubExpression'; + if (isDynamic) { + this.accept(partial.name); + } + + this.setupFullMustacheParams(partial, undefined, undefined, true); + + var indent = partial.indent || ''; + if (this.options.preventIndent && indent) { + this.opcode('appendContent', indent); + indent = ''; + } + + this.opcode('invokePartial', isDynamic, partialName, indent); + this.opcode('append'); + }, + + MustacheStatement: function MustacheStatement(mustache) { + this.SubExpression(mustache); // eslint-disable-line new-cap + + if (mustache.escaped && !this.options.noEscape) { + this.opcode('appendEscaped'); + } else { + this.opcode('append'); + } + }, + + ContentStatement: function ContentStatement(content) { + if (content.value) { + this.opcode('appendContent', content.value); + } + }, + + CommentStatement: function CommentStatement() {}, + + SubExpression: function SubExpression(sexpr) { + transformLiteralToPath(sexpr); + var type = this.classifySexpr(sexpr); + + if (type === 'simple') { + this.simpleSexpr(sexpr); + } else if (type === 'helper') { + this.helperSexpr(sexpr); + } else { + this.ambiguousSexpr(sexpr); + } + }, + ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { + var path = sexpr.path, + name = path.parts[0], + isBlock = program != null || inverse != null; + + this.opcode('getContext', path.depth); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + this.accept(path); + + this.opcode('invokeAmbiguous', name, isBlock); + }, + + simpleSexpr: function simpleSexpr(sexpr) { + this.accept(sexpr.path); + this.opcode('resolvePossibleLambda'); + }, + + helperSexpr: function helperSexpr(sexpr, program, inverse) { + var params = this.setupFullMustacheParams(sexpr, program, inverse), + path = sexpr.path, + name = path.parts[0]; + + if (this.options.knownHelpers[name]) { + this.opcode('invokeKnownHelper', params.length, name); + } else if (this.options.knownHelpersOnly) { + throw new _Exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); + } else { + path.falsy = true; + + this.accept(path); + this.opcode('invokeHelper', params.length, path.original, _AST2['default'].helpers.simpleId(path)); + } + }, + + PathExpression: function PathExpression(path) { + this.addDepth(path.depth); + this.opcode('getContext', path.depth); + + var name = path.parts[0], + scoped = _AST2['default'].helpers.scopedId(path), + blockParamId = !path.depth && !scoped && this.blockParamIndex(name); + + if (blockParamId) { + this.opcode('lookupBlockParam', blockParamId, path.parts); + } else if (!name) { + // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` + this.opcode('pushContext'); + } else if (path.data) { + this.options.data = true; + this.opcode('lookupData', path.depth, path.parts); + } else { + this.opcode('lookupOnContext', path.parts, path.falsy, scoped); + } + }, + + StringLiteral: function StringLiteral(string) { + this.opcode('pushString', string.value); + }, + + NumberLiteral: function NumberLiteral(number) { + this.opcode('pushLiteral', number.value); + }, + + BooleanLiteral: function BooleanLiteral(bool) { + this.opcode('pushLiteral', bool.value); + }, + + UndefinedLiteral: function UndefinedLiteral() { + this.opcode('pushLiteral', 'undefined'); + }, + + NullLiteral: function NullLiteral() { + this.opcode('pushLiteral', 'null'); + }, + + Hash: function Hash(hash) { + var pairs = hash.pairs, + i = 0, + l = pairs.length; + + this.opcode('pushHash'); + + for (; i < l; i++) { + this.pushParam(pairs[i].value); + } + while (i--) { + this.opcode('assignToHash', pairs[i].key); + } + this.opcode('popHash'); + }, + + // HELPERS + opcode: function opcode(name) { + this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); + }, + + addDepth: function addDepth(depth) { + if (!depth) { + return; + } + + this.useDepths = true; + }, + + classifySexpr: function classifySexpr(sexpr) { + var isSimple = _AST2['default'].helpers.simpleId(sexpr.path); + + var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); + + // a mustache is an eligible helper if: + // * its id is simple (a single part, not `this` or `..`) + var isHelper = !isBlockParam && _AST2['default'].helpers.helperExpression(sexpr); + + // if a mustache is an eligible helper but not a definite + // helper, it is ambiguous, and will be resolved in a later + // pass or at runtime. + var isEligible = !isBlockParam && (isHelper || isSimple); + + // if ambiguous, we can possibly resolve the ambiguity now + // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. + if (isEligible && !isHelper) { + var _name2 = sexpr.path.parts[0], + options = this.options; + + if (options.knownHelpers[_name2]) { + isHelper = true; + } else if (options.knownHelpersOnly) { + isEligible = false; + } + } + + if (isHelper) { + return 'helper'; + } else if (isEligible) { + return 'ambiguous'; + } else { + return 'simple'; + } + }, + + pushParams: function pushParams(params) { + for (var i = 0, l = params.length; i < l; i++) { + this.pushParam(params[i]); + } + }, + + pushParam: function pushParam(val) { + var value = val.value != null ? val.value : val.original || ''; + + if (this.stringParams) { + if (value.replace) { + value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); + } + + if (val.depth) { + this.addDepth(val.depth); + } + this.opcode('getContext', val.depth || 0); + this.opcode('pushStringParam', value, val.type); + + if (val.type === 'SubExpression') { + // SubExpressions get evaluated and passed in + // in string params mode. + this.accept(val); + } + } else { + if (this.trackIds) { + var blockParamIndex = undefined; + if (val.parts && !_AST2['default'].helpers.scopedId(val) && !val.depth) { + blockParamIndex = this.blockParamIndex(val.parts[0]); + } + if (blockParamIndex) { + var blockParamChild = val.parts.slice(1).join('.'); + this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); + } else { + value = val.original || value; + if (value.replace) { + value = value.replace(/^\.\//g, '').replace(/^\.$/g, ''); + } + + this.opcode('pushId', val.type, value); + } + } + this.accept(val); + } + }, + + setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { + var params = sexpr.params; + this.pushParams(params); + + this.opcode('pushProgram', program); + this.opcode('pushProgram', inverse); + + if (sexpr.hash) { + this.accept(sexpr.hash); + } else { + this.opcode('emptyHash', omitEmpty); + } + + return params; + }, + + blockParamIndex: function blockParamIndex(name) { + for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { + var blockParams = this.options.blockParams[depth], + param = blockParams && _isArray$indexOf.indexOf(blockParams, name); + if (blockParams && param >= 0) { + return [depth, param]; + } + } + } + }; + + function precompile(input, options, env) { + if (input == null || typeof input !== 'string' && input.type !== 'Program') { + throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); + } + + options = options || {}; + if (!('data' in options)) { + options.data = true; + } + if (options.compat) { + options.useDepths = true; + } + + var ast = env.parse(input, options), + environment = new env.Compiler().compile(ast, options); + return new env.JavaScriptCompiler().compile(environment, options); + } + + function compile(input, _x, env) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + if (input == null || typeof input !== 'string' && input.type !== 'Program') { + throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); + } + + if (!('data' in options)) { + options.data = true; + } + if (options.compat) { + options.useDepths = true; + } + + var compiled = undefined; + + function compileInput() { + var ast = env.parse(input, options), + environment = new env.Compiler().compile(ast, options), + templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); + return env.template(templateSpec); + } + + // Template is only compiled on first use and cached after that point. + function ret(context, execOptions) { + if (!compiled) { + compiled = compileInput(); + } + return compiled.call(this, context, execOptions); + } + ret._setup = function (setupOptions) { + if (!compiled) { + compiled = compileInput(); + } + return compiled._setup(setupOptions); + }; + ret._child = function (i, data, blockParams, depths) { + if (!compiled) { + compiled = compileInput(); + } + return compiled._child(i, data, blockParams, depths); + }; + return ret; + } + + function argEquals(a, b) { + if (a === b) { + return true; + } + + if (_isArray$indexOf.isArray(a) && _isArray$indexOf.isArray(b) && a.length === b.length) { + for (var i = 0; i < a.length; i++) { + if (!argEquals(a[i], b[i])) { + return false; + } + } + return true; + } + } + + function transformLiteralToPath(sexpr) { + if (!sexpr.path.parts) { + var literal = sexpr.path; + // Casting to string here to make false and 0 literal values play nicely with the rest + // of the system. + sexpr.path = new _AST2['default'].PathExpression(false, 0, [literal.original + ''], literal.original + '', literal.loc); + } + } + + /***/ }, + /* 5 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + + var _COMPILER_REVISION$REVISION_CHANGES = __webpack_require__(9); + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var _isArray = __webpack_require__(12); + + var _CodeGen = __webpack_require__(17); + + var _CodeGen2 = _interopRequireWildcard(_CodeGen); + + function Literal(value) { + this.value = value; + } + + function JavaScriptCompiler() {} + + JavaScriptCompiler.prototype = { + // PUBLIC API: You can override these methods in a subclass to provide + // alternative compiled forms for name lookup and buffering semantics + nameLookup: function nameLookup(parent, name /* , type*/) { + if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { + return [parent, '.', name]; + } else { + return [parent, '[\'', name, '\']']; + } + }, + depthedLookup: function depthedLookup(name) { + return [this.aliasable('this.lookup'), '(depths, "', name, '")']; + }, + + compilerInfo: function compilerInfo() { + var revision = _COMPILER_REVISION$REVISION_CHANGES.COMPILER_REVISION, + versions = _COMPILER_REVISION$REVISION_CHANGES.REVISION_CHANGES[revision]; + return [revision, versions]; + }, + + appendToBuffer: function appendToBuffer(source, location, explicit) { + // Force a source as this simplifies the merge logic. + if (!_isArray.isArray(source)) { + source = [source]; + } + source = this.source.wrap(source, location); + + if (this.environment.isSimple) { + return ['return ', source, ';']; + } else if (explicit) { + // This is a case where the buffer operation occurs as a child of another + // construct, generally braces. We have to explicitly output these buffer + // operations to ensure that the emitted code goes in the correct location. + return ['buffer += ', source, ';']; + } else { + source.appendToBuffer = true; + return source; + } + }, + + initializeBuffer: function initializeBuffer() { + return this.quotedString(''); + }, + // END PUBLIC API + + compile: function compile(environment, options, context, asObject) { + this.environment = environment; + this.options = options; + this.stringParams = this.options.stringParams; + this.trackIds = this.options.trackIds; + this.precompile = !asObject; + + this.name = this.environment.name; + this.isChild = !!context; + this.context = context || { + programs: [], + environments: [] + }; + + this.preamble(); + + this.stackSlot = 0; + this.stackVars = []; + this.aliases = {}; + this.registers = { list: [] }; + this.hashes = []; + this.compileStack = []; + this.inlineStack = []; + this.blockParams = []; + + this.compileChildren(environment, options); + + this.useDepths = this.useDepths || environment.useDepths || this.options.compat; + this.useBlockParams = this.useBlockParams || environment.useBlockParams; + + var opcodes = environment.opcodes, + opcode = undefined, + firstLoc = undefined, + i = undefined, + l = undefined; + + for (i = 0, l = opcodes.length; i < l; i++) { + opcode = opcodes[i]; + + this.source.currentLocation = opcode.loc; + firstLoc = firstLoc || opcode.loc; + this[opcode.opcode].apply(this, opcode.args); + } + + // Flush any trailing content that might be pending. + this.source.currentLocation = firstLoc; + this.pushSource(''); + + /* istanbul ignore next */ + if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { + throw new _Exception2['default']('Compile completed with content left on stack'); + } + + var fn = this.createFunctionContext(asObject); + if (!this.isChild) { + var ret = { + compiler: this.compilerInfo(), + main: fn + }; + var programs = this.context.programs; + for (i = 0, l = programs.length; i < l; i++) { + if (programs[i]) { + ret[i] = programs[i]; + } + } + + if (this.environment.usePartial) { + ret.usePartial = true; + } + if (this.options.data) { + ret.useData = true; + } + if (this.useDepths) { + ret.useDepths = true; + } + if (this.useBlockParams) { + ret.useBlockParams = true; + } + if (this.options.compat) { + ret.compat = true; + } + + if (!asObject) { + ret.compiler = JSON.stringify(ret.compiler); + + this.source.currentLocation = { start: { line: 1, column: 0 } }; + ret = this.objectLiteral(ret); + + if (options.srcName) { + ret = ret.toStringWithSourceMap({ file: options.destName }); + ret.map = ret.map && ret.map.toString(); + } else { + ret = ret.toString(); + } + } else { + ret.compilerOptions = this.options; + } + + return ret; + } else { + return fn; + } + }, + + preamble: function preamble() { + // track the last context pushed into place to allow skipping the + // getContext opcode when it would be a noop + this.lastContext = 0; + this.source = new _CodeGen2['default'](this.options.srcName); + }, + + createFunctionContext: function createFunctionContext(asObject) { + var varDeclarations = ''; + + var locals = this.stackVars.concat(this.registers.list); + if (locals.length > 0) { + varDeclarations += ', ' + locals.join(', '); + } + + // Generate minimizer alias mappings + // + // When using true SourceNodes, this will update all references to the given alias + // as the source nodes are reused in situ. For the non-source node compilation mode, + // aliases will not be used, but this case is already being run on the client and + // we aren't concern about minimizing the template size. + var aliasCount = 0; + for (var alias in this.aliases) { + // eslint-disable-line guard-for-in + var node = this.aliases[alias]; + + if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { + varDeclarations += ', alias' + ++aliasCount + '=' + alias; + node.children[0] = 'alias' + aliasCount; + } + } + + var params = ['depth0', 'helpers', 'partials', 'data']; + + if (this.useBlockParams || this.useDepths) { + params.push('blockParams'); + } + if (this.useDepths) { + params.push('depths'); + } + + // Perform a second pass over the output to merge content when possible + var source = this.mergeSource(varDeclarations); + + if (asObject) { + params.push(source); + + return Function.apply(this, params); + } else { + return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); + } + }, + mergeSource: function mergeSource(varDeclarations) { + var isSimple = this.environment.isSimple, + appendOnly = !this.forceBuffer, + appendFirst = undefined, + sourceSeen = undefined, + bufferStart = undefined, + bufferEnd = undefined; + this.source.each(function (line) { + if (line.appendToBuffer) { + if (bufferStart) { + line.prepend(' + '); + } else { + bufferStart = line; + } + bufferEnd = line; + } else { + if (bufferStart) { + if (!sourceSeen) { + appendFirst = true; + } else { + bufferStart.prepend('buffer += '); + } + bufferEnd.add(';'); + bufferStart = bufferEnd = undefined; + } + + sourceSeen = true; + if (!isSimple) { + appendOnly = false; + } + } + }); + + if (appendOnly) { + if (bufferStart) { + bufferStart.prepend('return '); + bufferEnd.add(';'); + } else if (!sourceSeen) { + this.source.push('return "";'); + } + } else { + varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); + + if (bufferStart) { + bufferStart.prepend('return buffer + '); + bufferEnd.add(';'); + } else { + this.source.push('return buffer;'); + } + } + + if (varDeclarations) { + this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); + } + + return this.source.merge(); + }, + + // [blockValue] + // + // On stack, before: hash, inverse, program, value + // On stack, after: return value of blockHelperMissing + // + // The purpose of this opcode is to take a block of the form + // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and + // replace it on the stack with the result of properly + // invoking blockHelperMissing. + blockValue: function blockValue(name) { + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs(name, 0, params); + + var blockName = this.popStack(); + params.splice(1, 0, blockName); + + this.push(this.source.functionCall(blockHelperMissing, 'call', params)); + }, + + // [ambiguousBlockValue] + // + // On stack, before: hash, inverse, program, value + // Compiler value, before: lastHelper=value of last found helper, if any + // On stack, after, if no lastHelper: same as [blockValue] + // On stack, after, if lastHelper: value + ambiguousBlockValue: function ambiguousBlockValue() { + // We're being a bit cheeky and reusing the options value from the prior exec + var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), + params = [this.contextName(0)]; + this.setupHelperArgs('', 0, params, true); + + this.flushInline(); + + var current = this.topStack(); + params.splice(1, 0, current); + + this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); + }, + + // [appendContent] + // + // On stack, before: ... + // On stack, after: ... + // + // Appends the string value of `content` to the current buffer + appendContent: function appendContent(content) { + if (this.pendingContent) { + content = this.pendingContent + content; + } else { + this.pendingLocation = this.source.currentLocation; + } + + this.pendingContent = content; + }, + + // [append] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Coerces `value` to a String and appends it to the current buffer. + // + // If `value` is truthy, or 0, it is coerced into a string and appended + // Otherwise, the empty string is appended + append: function append() { + if (this.isInline()) { + this.replaceStack(function (current) { + return [' != null ? ', current, ' : ""']; + }); + + this.pushSource(this.appendToBuffer(this.popStack())); + } else { + var local = this.popStack(); + this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); + if (this.environment.isSimple) { + this.pushSource(['else { ', this.appendToBuffer('\'\'', undefined, true), ' }']); + } + } + }, + + // [appendEscaped] + // + // On stack, before: value, ... + // On stack, after: ... + // + // Escape `value` and append it to the buffer + appendEscaped: function appendEscaped() { + this.pushSource(this.appendToBuffer([this.aliasable('this.escapeExpression'), '(', this.popStack(), ')'])); + }, + + // [getContext] + // + // On stack, before: ... + // On stack, after: ... + // Compiler value, after: lastContext=depth + // + // Set the value of the `lastContext` compiler value to the depth + getContext: function getContext(depth) { + this.lastContext = depth; + }, + + // [pushContext] + // + // On stack, before: ... + // On stack, after: currentContext, ... + // + // Pushes the value of the current context onto the stack. + pushContext: function pushContext() { + this.pushStackLiteral(this.contextName(this.lastContext)); + }, + + // [lookupOnContext] + // + // On stack, before: ... + // On stack, after: currentContext[name], ... + // + // Looks up the value of `name` on the current context and pushes + // it onto the stack. + lookupOnContext: function lookupOnContext(parts, falsy, scoped) { + var i = 0; + + if (!scoped && this.options.compat && !this.lastContext) { + // The depthed query is expected to handle the undefined logic for the root level that + // is implemented below, so we evaluate that directly in compat mode + this.push(this.depthedLookup(parts[i++])); + } else { + this.pushContext(); + } + + this.resolvePath('context', parts, i, falsy); + }, + + // [lookupBlockParam] + // + // On stack, before: ... + // On stack, after: blockParam[name], ... + // + // Looks up the value of `parts` on the given block param and pushes + // it onto the stack. + lookupBlockParam: function lookupBlockParam(blockParamId, parts) { + this.useBlockParams = true; + + this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); + this.resolvePath('context', parts, 1); + }, + + // [lookupData] + // + // On stack, before: ... + // On stack, after: data, ... + // + // Push the data lookup operator + lookupData: function lookupData(depth, parts) { + if (!depth) { + this.pushStackLiteral('data'); + } else { + this.pushStackLiteral('this.data(data, ' + depth + ')'); + } + + this.resolvePath('data', parts, 0, true); + }, + + resolvePath: function resolvePath(type, parts, i, falsy) { + var _this = this; + + if (this.options.strict || this.options.assumeObjects) { + this.push(strictLookup(this.options.strict, this, parts, type)); + return; + } + + var len = parts.length; + for (; i < len; i++) { + /*eslint-disable no-loop-func */ + this.replaceStack(function (current) { + var lookup = _this.nameLookup(current, parts[i], type); + // We want to ensure that zero and false are handled properly if the context (falsy flag) + // needs to have the special handling for these values. + if (!falsy) { + return [' != null ? ', lookup, ' : ', current]; + } else { + // Otherwise we can use generic falsy handling + return [' && ', lookup]; + } + }); + /*eslint-enable no-loop-func */ + } + }, + + // [resolvePossibleLambda] + // + // On stack, before: value, ... + // On stack, after: resolved value, ... + // + // If the `value` is a lambda, replace it on the stack by + // the return value of the lambda + resolvePossibleLambda: function resolvePossibleLambda() { + this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); + }, + + // [pushStringParam] + // + // On stack, before: ... + // On stack, after: string, currentContext, ... + // + // This opcode is designed for use in string mode, which + // provides the string value of a parameter along with its + // depth rather than resolving it immediately. + pushStringParam: function pushStringParam(string, type) { + this.pushContext(); + this.pushString(type); + + // If it's a subexpression, the string result + // will be pushed after this opcode. + if (type !== 'SubExpression') { + if (typeof string === 'string') { + this.pushString(string); + } else { + this.pushStackLiteral(string); + } + } + }, + + emptyHash: function emptyHash(omitEmpty) { + if (this.trackIds) { + this.push('{}'); // hashIds + } + if (this.stringParams) { + this.push('{}'); // hashContexts + this.push('{}'); // hashTypes + } + this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); + }, + pushHash: function pushHash() { + if (this.hash) { + this.hashes.push(this.hash); + } + this.hash = { values: [], types: [], contexts: [], ids: [] }; + }, + popHash: function popHash() { + var hash = this.hash; + this.hash = this.hashes.pop(); + + if (this.trackIds) { + this.push(this.objectLiteral(hash.ids)); + } + if (this.stringParams) { + this.push(this.objectLiteral(hash.contexts)); + this.push(this.objectLiteral(hash.types)); + } + + this.push(this.objectLiteral(hash.values)); + }, + + // [pushString] + // + // On stack, before: ... + // On stack, after: quotedString(string), ... + // + // Push a quoted version of `string` onto the stack + pushString: function pushString(string) { + this.pushStackLiteral(this.quotedString(string)); + }, + + // [pushLiteral] + // + // On stack, before: ... + // On stack, after: value, ... + // + // Pushes a value onto the stack. This operation prevents + // the compiler from creating a temporary variable to hold + // it. + pushLiteral: function pushLiteral(value) { + this.pushStackLiteral(value); + }, + + // [pushProgram] + // + // On stack, before: ... + // On stack, after: program(guid), ... + // + // Push a program expression onto the stack. This takes + // a compile-time guid and converts it into a runtime-accessible + // expression. + pushProgram: function pushProgram(guid) { + if (guid != null) { + this.pushStackLiteral(this.programExpression(guid)); + } else { + this.pushStackLiteral(null); + } + }, + + // [invokeHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // Pops off the helper's parameters, invokes the helper, + // and pushes the helper's return value onto the stack. + // + // If the helper is not found, `helperMissing` is called. + invokeHelper: function invokeHelper(paramSize, name, isSimple) { + var nonHelper = this.popStack(), + helper = this.setupHelper(paramSize, name), + simple = isSimple ? [helper.name, ' || '] : ''; + + var lookup = ['('].concat(simple, nonHelper); + if (!this.options.strict) { + lookup.push(' || ', this.aliasable('helpers.helperMissing')); + } + lookup.push(')'); + + this.push(this.source.functionCall(lookup, 'call', helper.callParams)); + }, + + // [invokeKnownHelper] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of helper invocation + // + // This operation is used when the helper is known to exist, + // so a `helperMissing` fallback is not required. + invokeKnownHelper: function invokeKnownHelper(paramSize, name) { + var helper = this.setupHelper(paramSize, name); + this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); + }, + + // [invokeAmbiguous] + // + // On stack, before: hash, inverse, program, params..., ... + // On stack, after: result of disambiguation + // + // This operation is used when an expression like `{{foo}}` + // is provided, but we don't know at compile-time whether it + // is a helper or a path. + // + // This operation emits more code than the other options, + // and can be avoided by passing the `knownHelpers` and + // `knownHelpersOnly` flags at compile-time. + invokeAmbiguous: function invokeAmbiguous(name, helperCall) { + this.useRegister('helper'); + + var nonHelper = this.popStack(); + + this.emptyHash(); + var helper = this.setupHelper(0, name, helperCall); + + var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); + + var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; + if (!this.options.strict) { + lookup[0] = '(helper = '; + lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); + } + + this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); + }, + + // [invokePartial] + // + // On stack, before: context, ... + // On stack after: result of partial invocation + // + // This operation pops off a context, invokes a partial with that context, + // and pushes the result of the invocation back. + invokePartial: function invokePartial(isDynamic, name, indent) { + var params = [], + options = this.setupParams(name, 1, params, false); + + if (isDynamic) { + name = this.popStack(); + delete options.name; + } + + if (indent) { + options.indent = JSON.stringify(indent); + } + options.helpers = 'helpers'; + options.partials = 'partials'; + + if (!isDynamic) { + params.unshift(this.nameLookup('partials', name, 'partial')); + } else { + params.unshift(name); + } + + if (this.options.compat) { + options.depths = 'depths'; + } + options = this.objectLiteral(options); + params.push(options); + + this.push(this.source.functionCall('this.invokePartial', '', params)); + }, + + // [assignToHash] + // + // On stack, before: value, ..., hash, ... + // On stack, after: ..., hash, ... + // + // Pops a value off the stack and assigns it to the current hash + assignToHash: function assignToHash(key) { + var value = this.popStack(), + context = undefined, + type = undefined, + id = undefined; + + if (this.trackIds) { + id = this.popStack(); + } + if (this.stringParams) { + type = this.popStack(); + context = this.popStack(); + } + + var hash = this.hash; + if (context) { + hash.contexts[key] = context; + } + if (type) { + hash.types[key] = type; + } + if (id) { + hash.ids[key] = id; + } + hash.values[key] = value; + }, + + pushId: function pushId(type, name, child) { + if (type === 'BlockParam') { + this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); + } else if (type === 'PathExpression') { + this.pushString(name); + } else if (type === 'SubExpression') { + this.pushStackLiteral('true'); + } else { + this.pushStackLiteral('null'); + } + }, + + // HELPERS + + compiler: JavaScriptCompiler, + + compileChildren: function compileChildren(environment, options) { + var children = environment.children, + child = undefined, + compiler = undefined; + + for (var i = 0, l = children.length; i < l; i++) { + child = children[i]; + compiler = new this.compiler(); // eslint-disable-line new-cap + + var index = this.matchExistingProgram(child); + + if (index == null) { + this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children + index = this.context.programs.length; + child.index = index; + child.name = 'program' + index; + this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); + this.context.environments[index] = child; + + this.useDepths = this.useDepths || compiler.useDepths; + this.useBlockParams = this.useBlockParams || compiler.useBlockParams; + } else { + child.index = index; + child.name = 'program' + index; + + this.useDepths = this.useDepths || child.useDepths; + this.useBlockParams = this.useBlockParams || child.useBlockParams; + } + } + }, + matchExistingProgram: function matchExistingProgram(child) { + for (var i = 0, len = this.context.environments.length; i < len; i++) { + var environment = this.context.environments[i]; + if (environment && environment.equals(child)) { + return i; + } + } + }, + + programExpression: function programExpression(guid) { + var child = this.environment.children[guid], + programParams = [child.index, 'data', child.blockParams]; + + if (this.useBlockParams || this.useDepths) { + programParams.push('blockParams'); + } + if (this.useDepths) { + programParams.push('depths'); + } + + return 'this.program(' + programParams.join(', ') + ')'; + }, + + useRegister: function useRegister(name) { + if (!this.registers[name]) { + this.registers[name] = true; + this.registers.list.push(name); + } + }, + + push: function push(expr) { + if (!(expr instanceof Literal)) { + expr = this.source.wrap(expr); + } + + this.inlineStack.push(expr); + return expr; + }, + + pushStackLiteral: function pushStackLiteral(item) { + this.push(new Literal(item)); + }, + + pushSource: function pushSource(source) { + if (this.pendingContent) { + this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); + this.pendingContent = undefined; + } + + if (source) { + this.source.push(source); + } + }, + + replaceStack: function replaceStack(callback) { + var prefix = ['('], + stack = undefined, + createdStack = undefined, + usedLiteral = undefined; + + /* istanbul ignore next */ + if (!this.isInline()) { + throw new _Exception2['default']('replaceStack on non-inline'); + } + + // We want to merge the inline statement into the replacement statement via ',' + var top = this.popStack(true); + + if (top instanceof Literal) { + // Literals do not need to be inlined + stack = [top.value]; + prefix = ['(', stack]; + usedLiteral = true; + } else { + // Get or create the current stack name for use by the inline + createdStack = true; + var _name = this.incrStack(); + + prefix = ['((', this.push(_name), ' = ', top, ')']; + stack = this.topStack(); + } + + var item = callback.call(this, stack); + + if (!usedLiteral) { + this.popStack(); + } + if (createdStack) { + this.stackSlot--; + } + this.push(prefix.concat(item, ')')); + }, + + incrStack: function incrStack() { + this.stackSlot++; + if (this.stackSlot > this.stackVars.length) { + this.stackVars.push('stack' + this.stackSlot); + } + return this.topStackName(); + }, + topStackName: function topStackName() { + return 'stack' + this.stackSlot; + }, + flushInline: function flushInline() { + var inlineStack = this.inlineStack; + this.inlineStack = []; + for (var i = 0, len = inlineStack.length; i < len; i++) { + var entry = inlineStack[i]; + /* istanbul ignore if */ + if (entry instanceof Literal) { + this.compileStack.push(entry); + } else { + var stack = this.incrStack(); + this.pushSource([stack, ' = ', entry, ';']); + this.compileStack.push(stack); + } + } + }, + isInline: function isInline() { + return this.inlineStack.length; + }, + + popStack: function popStack(wrapped) { + var inline = this.isInline(), + item = (inline ? this.inlineStack : this.compileStack).pop(); + + if (!wrapped && item instanceof Literal) { + return item.value; + } else { + if (!inline) { + /* istanbul ignore next */ + if (!this.stackSlot) { + throw new _Exception2['default']('Invalid stack pop'); + } + this.stackSlot--; + } + return item; + } + }, + + topStack: function topStack() { + var stack = this.isInline() ? this.inlineStack : this.compileStack, + item = stack[stack.length - 1]; + + /* istanbul ignore if */ + if (item instanceof Literal) { + return item.value; + } else { + return item; + } + }, + + contextName: function contextName(context) { + if (this.useDepths && context) { + return 'depths[' + context + ']'; + } else { + return 'depth' + context; + } + }, + + quotedString: function quotedString(str) { + return this.source.quotedString(str); + }, + + objectLiteral: function objectLiteral(obj) { + return this.source.objectLiteral(obj); + }, + + aliasable: function aliasable(name) { + var ret = this.aliases[name]; + if (ret) { + ret.referenceCount++; + return ret; + } + + ret = this.aliases[name] = this.source.wrap(name); + ret.aliasable = true; + ret.referenceCount = 1; + + return ret; + }, + + setupHelper: function setupHelper(paramSize, name, blockHelper) { + var params = [], + paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); + var foundHelper = this.nameLookup('helpers', name, 'helper'); + + return { + params: params, + paramsInit: paramsInit, + name: foundHelper, + callParams: [this.contextName(0)].concat(params) + }; + }, + + setupParams: function setupParams(helper, paramSize, params) { + var options = {}, + contexts = [], + types = [], + ids = [], + param = undefined; + + options.name = this.quotedString(helper); + options.hash = this.popStack(); + + if (this.trackIds) { + options.hashIds = this.popStack(); + } + if (this.stringParams) { + options.hashTypes = this.popStack(); + options.hashContexts = this.popStack(); + } + + var inverse = this.popStack(), + program = this.popStack(); + + // Avoid setting fn and inverse if neither are set. This allows + // helpers to do a check for `if (options.fn)` + if (program || inverse) { + options.fn = program || 'this.noop'; + options.inverse = inverse || 'this.noop'; + } + + // The parameters go on to the stack in order (making sure that they are evaluated in order) + // so we need to pop them off the stack in reverse order + var i = paramSize; + while (i--) { + param = this.popStack(); + params[i] = param; + + if (this.trackIds) { + ids[i] = this.popStack(); + } + if (this.stringParams) { + types[i] = this.popStack(); + contexts[i] = this.popStack(); + } + } + + if (this.trackIds) { + options.ids = this.source.generateArray(ids); + } + if (this.stringParams) { + options.types = this.source.generateArray(types); + options.contexts = this.source.generateArray(contexts); + } + + if (this.options.data) { + options.data = 'data'; + } + if (this.useBlockParams) { + options.blockParams = 'blockParams'; + } + return options; + }, + + setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { + var options = this.setupParams(helper, paramSize, params, true); + options = this.objectLiteral(options); + if (useRegister) { + this.useRegister('options'); + params.push('options'); + return ['options=', options]; + } else { + params.push(options); + return ''; + } + } + }; + + (function () { + var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); + + var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; + + for (var i = 0, l = reservedWords.length; i < l; i++) { + compilerWords[reservedWords[i]] = true; + } + })(); + + JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { + return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); + }; + + function strictLookup(requireTerminal, compiler, parts, type) { + var stack = compiler.popStack(), + i = 0, + len = parts.length; + if (requireTerminal) { + len--; + } + + for (; i < len; i++) { + stack = compiler.nameLookup(stack, parts[i], type); + } + + if (requireTerminal) { + return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; + } else { + return stack; + } + } + + exports['default'] = JavaScriptCompiler; + module.exports = exports['default']; + + /***/ }, + /* 6 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var _AST = __webpack_require__(2); + + var _AST2 = _interopRequireWildcard(_AST); + + function Visitor() { + this.parents = []; + } + + Visitor.prototype = { + constructor: Visitor, + mutating: false, + + // Visits a given value. If mutating, will replace the value if necessary. + acceptKey: function acceptKey(node, name) { + var value = this.accept(node[name]); + if (this.mutating) { + // Hacky sanity check: + if (value && (!value.type || !_AST2['default'][value.type])) { + throw new _Exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); + } + node[name] = value; + } + }, + + // Performs an accept operation with added sanity check to ensure + // required keys are not removed. + acceptRequired: function acceptRequired(node, name) { + this.acceptKey(node, name); + + if (!node[name]) { + throw new _Exception2['default'](node.type + ' requires ' + name); + } + }, + + // Traverses a given array. If mutating, empty respnses will be removed + // for child elements. + acceptArray: function acceptArray(array) { + for (var i = 0, l = array.length; i < l; i++) { + this.acceptKey(array, i); + + if (!array[i]) { + array.splice(i, 1); + i--; + l--; + } + } + }, + + accept: function accept(object) { + if (!object) { + return; + } + + if (this.current) { + this.parents.unshift(this.current); + } + this.current = object; + + var ret = this[object.type](object); + + this.current = this.parents.shift(); + + if (!this.mutating || ret) { + return ret; + } else if (ret !== false) { + return object; + } + }, + + Program: function Program(program) { + this.acceptArray(program.body); + }, + + MustacheStatement: function MustacheStatement(mustache) { + this.acceptRequired(mustache, 'path'); + this.acceptArray(mustache.params); + this.acceptKey(mustache, 'hash'); + }, + + BlockStatement: function BlockStatement(block) { + this.acceptRequired(block, 'path'); + this.acceptArray(block.params); + this.acceptKey(block, 'hash'); + + this.acceptKey(block, 'program'); + this.acceptKey(block, 'inverse'); + }, + + PartialStatement: function PartialStatement(partial) { + this.acceptRequired(partial, 'name'); + this.acceptArray(partial.params); + this.acceptKey(partial, 'hash'); + }, + + ContentStatement: function ContentStatement() {}, + CommentStatement: function CommentStatement() {}, + + SubExpression: function SubExpression(sexpr) { + this.acceptRequired(sexpr, 'path'); + this.acceptArray(sexpr.params); + this.acceptKey(sexpr, 'hash'); + }, + + PathExpression: function PathExpression() {}, + + StringLiteral: function StringLiteral() {}, + NumberLiteral: function NumberLiteral() {}, + BooleanLiteral: function BooleanLiteral() {}, + UndefinedLiteral: function UndefinedLiteral() {}, + NullLiteral: function NullLiteral() {}, + + Hash: function Hash(hash) { + this.acceptArray(hash.pairs); + }, + HashPair: function HashPair(pair) { + this.acceptRequired(pair, 'value'); + } + }; + + exports['default'] = Visitor; + module.exports = exports['default']; + /* content */ /* comment */ /* path */ /* string */ /* number */ /* bool */ /* literal */ /* literal */ + + /***/ }, + /* 7 */ + /***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + exports.__esModule = true; + /*global window */ + + exports['default'] = function (Handlebars) { + /* istanbul ignore next */ + var root = typeof global !== 'undefined' ? global : window, + $Handlebars = root.Handlebars; + /* istanbul ignore next */ + Handlebars.noConflict = function () { + if (root.Handlebars === Handlebars) { + root.Handlebars = $Handlebars; + } + }; + }; + + module.exports = exports['default']; + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + + /***/ }, + /* 8 */ + /***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports["default"] = function (obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; + }; + + exports.__esModule = true; + + /***/ }, + /* 9 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + exports.HandlebarsEnvironment = HandlebarsEnvironment; + exports.createFrame = createFrame; + + var _import = __webpack_require__(12); + + var Utils = _interopRequireWildcard(_import); + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var VERSION = '3.0.1'; + exports.VERSION = VERSION; + var COMPILER_REVISION = 6; + + exports.COMPILER_REVISION = COMPILER_REVISION; + var REVISION_CHANGES = { + 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it + 2: '== 1.0.0-rc.3', + 3: '== 1.0.0-rc.4', + 4: '== 1.x.x', + 5: '== 2.0.0-alpha.x', + 6: '>= 2.0.0-beta.1' + }; + + exports.REVISION_CHANGES = REVISION_CHANGES; + var isArray = Utils.isArray, + isFunction = Utils.isFunction, + toString = Utils.toString, + objectType = '[object Object]'; + + function HandlebarsEnvironment(helpers, partials) { + this.helpers = helpers || {}; + this.partials = partials || {}; + + registerDefaultHelpers(this); + } + + HandlebarsEnvironment.prototype = { + constructor: HandlebarsEnvironment, + + logger: logger, + log: log, + + registerHelper: function registerHelper(name, fn) { + if (toString.call(name) === objectType) { + if (fn) { + throw new _Exception2['default']('Arg not supported with multiple helpers'); + } + Utils.extend(this.helpers, name); + } else { + this.helpers[name] = fn; + } + }, + unregisterHelper: function unregisterHelper(name) { + delete this.helpers[name]; + }, + + registerPartial: function registerPartial(name, partial) { + if (toString.call(name) === objectType) { + Utils.extend(this.partials, name); + } else { + if (typeof partial === 'undefined') { + throw new _Exception2['default']('Attempting to register a partial as undefined'); + } + this.partials[name] = partial; + } + }, + unregisterPartial: function unregisterPartial(name) { + delete this.partials[name]; + } + }; + + function registerDefaultHelpers(instance) { + instance.registerHelper('helperMissing', function () { + if (arguments.length === 1) { + // A missing field in a {{foo}} constuct. + return undefined; + } else { + // Someone is actually trying to call something, blow up. + throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); + } + }); + + instance.registerHelper('blockHelperMissing', function (context, options) { + var inverse = options.inverse, + fn = options.fn; + + if (context === true) { + return fn(this); + } else if (context === false || context == null) { + return inverse(this); + } else if (isArray(context)) { + if (context.length > 0) { + if (options.ids) { + options.ids = [options.name]; + } + + return instance.helpers.each(context, options); + } else { + return inverse(this); + } + } else { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); + options = { data: data }; + } + + return fn(context, options); + } + }); + + instance.registerHelper('each', function (context, options) { + if (!options) { + throw new _Exception2['default']('Must pass iterator to #each'); + } + + var fn = options.fn, + inverse = options.inverse, + i = 0, + ret = '', + data = undefined, + contextPath = undefined; + + if (options.data && options.ids) { + contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; + } + + if (isFunction(context)) { + context = context.call(this); + } + + if (options.data) { + data = createFrame(options.data); + } + + function execIteration(field, index, last) { + if (data) { + data.key = field; + data.index = index; + data.first = index === 0; + data.last = !!last; + + if (contextPath) { + data.contextPath = contextPath + field; + } + } + + ret = ret + fn(context[field], { + data: data, + blockParams: Utils.blockParams([context[field], field], [contextPath + field, null]) + }); + } + + if (context && typeof context === 'object') { + if (isArray(context)) { + for (var j = context.length; i < j; i++) { + execIteration(i, i, i === context.length - 1); + } + } else { + var priorKey = undefined; + + for (var key in context) { + if (context.hasOwnProperty(key)) { + // We're running the iterations one step out of sync so we can detect + // the last iteration without have to scan the object twice and create + // an itermediate keys array. + if (priorKey) { + execIteration(priorKey, i - 1); + } + priorKey = key; + i++; + } + } + if (priorKey) { + execIteration(priorKey, i - 1, true); + } + } + } + + if (i === 0) { + ret = inverse(this); + } + + return ret; + }); + + instance.registerHelper('if', function (conditional, options) { + if (isFunction(conditional)) { + conditional = conditional.call(this); + } + + // Default behavior is to render the positive path if the value is truthy and not empty. + // The `includeZero` option may be set to treat the condtional as purely not empty based on the + // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. + if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) { + return options.inverse(this); + } else { + return options.fn(this); + } + }); + + instance.registerHelper('unless', function (conditional, options) { + return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); + }); + + instance.registerHelper('with', function (context, options) { + if (isFunction(context)) { + context = context.call(this); + } + + var fn = options.fn; + + if (!Utils.isEmpty(context)) { + if (options.data && options.ids) { + var data = createFrame(options.data); + data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); + options = { data: data }; + } + + return fn(context, options); + } else { + return options.inverse(this); + } + }); + + instance.registerHelper('log', function (message, options) { + var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; + instance.log(level, message); + }); + + instance.registerHelper('lookup', function (obj, field) { + return obj && obj[field]; + }); + } + + var logger = { + methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, + + // State enum + DEBUG: 0, + INFO: 1, + WARN: 2, + ERROR: 3, + level: 1, + + // Can be overridden in the host environment + log: function log(level, message) { + if (typeof console !== 'undefined' && logger.level <= level) { + var method = logger.methodMap[level]; + (console[method] || console.log).call(console, message); // eslint-disable-line no-console + } + } + }; + + exports.logger = logger; + var log = logger.log; + + exports.log = log; + + function createFrame(object) { + var frame = Utils.extend({}, object); + frame._parent = object; + return frame; + } + + /* [args, ]options */ + + /***/ }, + /* 10 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + // Build out our basic SafeString type + function SafeString(string) { + this.string = string; + } + + SafeString.prototype.toString = SafeString.prototype.toHTML = function () { + return '' + this.string; + }; + + exports['default'] = SafeString; + module.exports = exports['default']; + + /***/ }, + /* 11 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; + + function Exception(message, node) { + var loc = node && node.loc, + line = undefined, + column = undefined; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; + } + + var tmp = Error.prototype.constructor.call(this, message); + + // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. + for (var idx = 0; idx < errorProps.length; idx++) { + this[errorProps[idx]] = tmp[errorProps[idx]]; + } + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, Exception); + } + + if (loc) { + this.lineNumber = line; + this.column = column; + } + } + + Exception.prototype = new Error(); + + exports['default'] = Exception; + module.exports = exports['default']; + + /***/ }, + /* 12 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.extend = extend; + + // Older IE versions do not directly support indexOf so we must implement our own, sadly. + exports.indexOf = indexOf; + exports.escapeExpression = escapeExpression; + exports.isEmpty = isEmpty; + exports.blockParams = blockParams; + exports.appendContextPath = appendContextPath; + var escape = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''', + '`': '`' + }; + + var badChars = /[&<>"'`]/g, + possible = /[&<>"'`]/; + + function escapeChar(chr) { + return escape[chr]; + } + + function extend(obj /* , ...source */) { + for (var i = 1; i < arguments.length; i++) { + for (var key in arguments[i]) { + if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { + obj[key] = arguments[i][key]; + } + } + } + + return obj; + } + + var toString = Object.prototype.toString; + + exports.toString = toString; + // Sourced from lodash + // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt + /*eslint-disable func-style, no-var */ + var isFunction = function isFunction(value) { + return typeof value === 'function'; + }; + // fallback for older versions of Chrome and Safari + /* istanbul ignore next */ + if (isFunction(/x/)) { + exports.isFunction = isFunction = function (value) { + return typeof value === 'function' && toString.call(value) === '[object Function]'; + }; + } + var isFunction; + exports.isFunction = isFunction; + /*eslint-enable func-style, no-var */ + + /* istanbul ignore next */ + var isArray = Array.isArray || function (value) { + return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; + };exports.isArray = isArray; + + function indexOf(array, value) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + return -1; + } + + function escapeExpression(string) { + if (typeof string !== 'string') { + // don't escape SafeStrings, since they're already safe + if (string && string.toHTML) { + return string.toHTML(); + } else if (string == null) { + return ''; + } else if (!string) { + return string + ''; + } + + // Force a string conversion as this will be done by the append regardless and + // the regex test will do this transparently behind the scenes, causing issues if + // an object's to string has escaped characters in it. + string = '' + string; + } + + if (!possible.test(string)) { + return string; + } + return string.replace(badChars, escapeChar); + } + + function isEmpty(value) { + if (!value && value !== 0) { + return true; + } else if (isArray(value) && value.length === 0) { + return true; + } else { + return false; + } + } + + function blockParams(params, ids) { + params.path = ids; + return params; + } + + function appendContextPath(contextPath, id) { + return (contextPath ? contextPath + '.' : '') + id; + } + + /***/ }, + /* 13 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + exports.checkRevision = checkRevision; + + // TODO: Remove this line and break up compilePartial + + exports.template = template; + exports.wrapProgram = wrapProgram; + exports.resolvePartial = resolvePartial; + exports.invokePartial = invokePartial; + exports.noop = noop; + + var _import = __webpack_require__(12); + + var Utils = _interopRequireWildcard(_import); + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(9); + + function checkRevision(compilerInfo) { + var compilerRevision = compilerInfo && compilerInfo[0] || 1, + currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION; + + if (compilerRevision !== currentRevision) { + if (compilerRevision < currentRevision) { + var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision], + compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision]; + throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); + } else { + // Use the embedded version info since the runtime doesn't know about this revision yet + throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); + } + } + } + + function template(templateSpec, env) { + /* istanbul ignore next */ + if (!env) { + throw new _Exception2['default']('No environment passed to template'); + } + if (!templateSpec || !templateSpec.main) { + throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec); + } + + // Note: Using env.VM references rather than local var references throughout this section to allow + // for external users to override these as psuedo-supported APIs. + env.VM.checkRevision(templateSpec.compiler); + + function invokePartialWrapper(partial, context, options) { + if (options.hash) { + context = Utils.extend({}, context, options.hash); + } + + partial = env.VM.resolvePartial.call(this, partial, context, options); + var result = env.VM.invokePartial.call(this, partial, context, options); + + if (result == null && env.compile) { + options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); + result = options.partials[options.name](context, options); + } + if (result != null) { + if (options.indent) { + var lines = result.split('\n'); + for (var i = 0, l = lines.length; i < l; i++) { + if (!lines[i] && i + 1 === l) { + break; + } + + lines[i] = options.indent + lines[i]; + } + result = lines.join('\n'); + } + return result; + } else { + throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); + } + } + + // Just add water + var container = { + strict: function strict(obj, name) { + if (!(name in obj)) { + throw new _Exception2['default']('"' + name + '" not defined in ' + obj); + } + return obj[name]; + }, + lookup: function lookup(depths, name) { + var len = depths.length; + for (var i = 0; i < len; i++) { + if (depths[i] && depths[i][name] != null) { + return depths[i][name]; + } + } + }, + lambda: function lambda(current, context) { + return typeof current === 'function' ? current.call(context) : current; + }, + + escapeExpression: Utils.escapeExpression, + invokePartial: invokePartialWrapper, + + fn: function fn(i) { + return templateSpec[i]; + }, + + programs: [], + program: function program(i, data, declaredBlockParams, blockParams, depths) { + var programWrapper = this.programs[i], + fn = this.fn(i); + if (data || depths || blockParams || declaredBlockParams) { + programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); + } else if (!programWrapper) { + programWrapper = this.programs[i] = wrapProgram(this, i, fn); + } + return programWrapper; + }, + + data: function data(value, depth) { + while (value && depth--) { + value = value._parent; + } + return value; + }, + merge: function merge(param, common) { + var obj = param || common; + + if (param && common && param !== common) { + obj = Utils.extend({}, common, param); + } + + return obj; + }, + + noop: env.VM.noop, + compilerInfo: templateSpec.compiler + }; + + function ret(context) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + var data = options.data; + + ret._setup(options); + if (!options.partial && templateSpec.useData) { + data = initData(context, data); + } + var depths = undefined, + blockParams = templateSpec.useBlockParams ? [] : undefined; + if (templateSpec.useDepths) { + depths = options.depths ? [context].concat(options.depths) : [context]; + } + + return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); + } + ret.isTop = true; + + ret._setup = function (options) { + if (!options.partial) { + container.helpers = container.merge(options.helpers, env.helpers); + + if (templateSpec.usePartial) { + container.partials = container.merge(options.partials, env.partials); + } + } else { + container.helpers = options.helpers; + container.partials = options.partials; + } + }; + + ret._child = function (i, data, blockParams, depths) { + if (templateSpec.useBlockParams && !blockParams) { + throw new _Exception2['default']('must pass block params'); + } + if (templateSpec.useDepths && !depths) { + throw new _Exception2['default']('must pass parent depths'); + } + + return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); + }; + return ret; + } + + function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { + function prog(context) { + var options = arguments[1] === undefined ? {} : arguments[1]; + + return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths)); + } + prog.program = i; + prog.depth = depths ? depths.length : 0; + prog.blockParams = declaredBlockParams || 0; + return prog; + } + + function resolvePartial(partial, context, options) { + if (!partial) { + partial = options.partials[options.name]; + } else if (!partial.call && !options.name) { + // This is a dynamic partial that returned a string + options.name = partial; + partial = options.partials[partial]; + } + return partial; + } + + function invokePartial(partial, context, options) { + options.partial = true; + + if (partial === undefined) { + throw new _Exception2['default']('The partial ' + options.name + ' could not be found'); + } else if (partial instanceof Function) { + return partial(context, options); + } + } + + function noop() { + return ''; + } + + function initData(context, data) { + if (!data || !('root' in data)) { + data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {}; + data.root = context; + } + return data; + } + + /***/ }, + /* 14 */ + /***/ function(module, exports, __webpack_require__) { + + "use strict"; + + exports.__esModule = true; + /* istanbul ignore next */ + /* Jison generated parser */ + var handlebars = (function () { + var parser = { trace: function trace() {}, + yy: {}, + symbols_: { error: 2, root: 3, program: 4, EOF: 5, program_repetition0: 6, statement: 7, mustache: 8, block: 9, rawBlock: 10, partial: 11, content: 12, COMMENT: 13, CONTENT: 14, openRawBlock: 15, END_RAW_BLOCK: 16, OPEN_RAW_BLOCK: 17, helperName: 18, openRawBlock_repetition0: 19, openRawBlock_option0: 20, CLOSE_RAW_BLOCK: 21, openBlock: 22, block_option0: 23, closeBlock: 24, openInverse: 25, block_option1: 26, OPEN_BLOCK: 27, openBlock_repetition0: 28, openBlock_option0: 29, openBlock_option1: 30, CLOSE: 31, OPEN_INVERSE: 32, openInverse_repetition0: 33, openInverse_option0: 34, openInverse_option1: 35, openInverseChain: 36, OPEN_INVERSE_CHAIN: 37, openInverseChain_repetition0: 38, openInverseChain_option0: 39, openInverseChain_option1: 40, inverseAndProgram: 41, INVERSE: 42, inverseChain: 43, inverseChain_option0: 44, OPEN_ENDBLOCK: 45, OPEN: 46, mustache_repetition0: 47, mustache_option0: 48, OPEN_UNESCAPED: 49, mustache_repetition1: 50, mustache_option1: 51, CLOSE_UNESCAPED: 52, OPEN_PARTIAL: 53, partialName: 54, partial_repetition0: 55, partial_option0: 56, param: 57, sexpr: 58, OPEN_SEXPR: 59, sexpr_repetition0: 60, sexpr_option0: 61, CLOSE_SEXPR: 62, hash: 63, hash_repetition_plus0: 64, hashSegment: 65, ID: 66, EQUALS: 67, blockParams: 68, OPEN_BLOCK_PARAMS: 69, blockParams_repetition_plus0: 70, CLOSE_BLOCK_PARAMS: 71, path: 72, dataName: 73, STRING: 74, NUMBER: 75, BOOLEAN: 76, UNDEFINED: 77, NULL: 78, DATA: 79, pathSegments: 80, SEP: 81, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 5: "EOF", 13: "COMMENT", 14: "CONTENT", 16: "END_RAW_BLOCK", 17: "OPEN_RAW_BLOCK", 21: "CLOSE_RAW_BLOCK", 27: "OPEN_BLOCK", 31: "CLOSE", 32: "OPEN_INVERSE", 37: "OPEN_INVERSE_CHAIN", 42: "INVERSE", 45: "OPEN_ENDBLOCK", 46: "OPEN", 49: "OPEN_UNESCAPED", 52: "CLOSE_UNESCAPED", 53: "OPEN_PARTIAL", 59: "OPEN_SEXPR", 62: "CLOSE_SEXPR", 66: "ID", 67: "EQUALS", 69: "OPEN_BLOCK_PARAMS", 71: "CLOSE_BLOCK_PARAMS", 74: "STRING", 75: "NUMBER", 76: "BOOLEAN", 77: "UNDEFINED", 78: "NULL", 79: "DATA", 81: "SEP" }, + productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [12, 1], [10, 3], [15, 5], [9, 4], [9, 4], [22, 6], [25, 6], [36, 6], [41, 2], [43, 3], [43, 1], [24, 3], [8, 5], [8, 5], [11, 5], [57, 1], [57, 1], [58, 5], [63, 1], [65, 3], [68, 3], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [54, 1], [54, 1], [73, 2], [72, 1], [80, 3], [80, 1], [6, 0], [6, 2], [19, 0], [19, 2], [20, 0], [20, 1], [23, 0], [23, 1], [26, 0], [26, 1], [28, 0], [28, 2], [29, 0], [29, 1], [30, 0], [30, 1], [33, 0], [33, 2], [34, 0], [34, 1], [35, 0], [35, 1], [38, 0], [38, 2], [39, 0], [39, 1], [40, 0], [40, 1], [44, 0], [44, 1], [47, 0], [47, 2], [48, 0], [48, 1], [50, 0], [50, 2], [51, 0], [51, 1], [55, 0], [55, 2], [56, 0], [56, 1], [60, 0], [60, 2], [61, 0], [61, 1], [64, 1], [64, 2], [70, 1], [70, 2]], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { + + var $0 = $$.length - 1; + switch (yystate) { + case 1: + return $$[$0 - 1]; + break; + case 2: + this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$)); + break; + case 3: + this.$ = $$[$0]; + break; + case 4: + this.$ = $$[$0]; + break; + case 5: + this.$ = $$[$0]; + break; + case 6: + this.$ = $$[$0]; + break; + case 7: + this.$ = $$[$0]; + break; + case 8: + this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$)); + break; + case 9: + this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$)); + break; + case 10: + this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); + break; + case 11: + this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; + break; + case 12: + this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); + break; + case 13: + this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); + break; + case 14: + this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 15: + this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 16: + this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; + break; + case 17: + this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; + break; + case 18: + var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), + program = new yy.Program([inverse], null, {}, yy.locInfo(this._$)); + program.chained = true; + + this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; + + break; + case 19: + this.$ = $$[$0]; + break; + case 20: + this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; + break; + case 21: + this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); + break; + case 22: + this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); + break; + case 23: + this.$ = new yy.PartialStatement($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.stripFlags($$[$0 - 4], $$[$0]), yy.locInfo(this._$)); + break; + case 24: + this.$ = $$[$0]; + break; + case 25: + this.$ = $$[$0]; + break; + case 26: + this.$ = new yy.SubExpression($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.locInfo(this._$)); + break; + case 27: + this.$ = new yy.Hash($$[$0], yy.locInfo(this._$)); + break; + case 28: + this.$ = new yy.HashPair(yy.id($$[$0 - 2]), $$[$0], yy.locInfo(this._$)); + break; + case 29: + this.$ = yy.id($$[$0 - 1]); + break; + case 30: + this.$ = $$[$0]; + break; + case 31: + this.$ = $$[$0]; + break; + case 32: + this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$)); + break; + case 33: + this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$)); + break; + case 34: + this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$)); + break; + case 35: + this.$ = new yy.UndefinedLiteral(yy.locInfo(this._$)); + break; + case 36: + this.$ = new yy.NullLiteral(yy.locInfo(this._$)); + break; + case 37: + this.$ = $$[$0]; + break; + case 38: + this.$ = $$[$0]; + break; + case 39: + this.$ = yy.preparePath(true, $$[$0], this._$); + break; + case 40: + this.$ = yy.preparePath(false, $$[$0], this._$); + break; + case 41: + $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; + break; + case 42: + this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; + break; + case 43: + this.$ = []; + break; + case 44: + $$[$0 - 1].push($$[$0]); + break; + case 45: + this.$ = []; + break; + case 46: + $$[$0 - 1].push($$[$0]); + break; + case 53: + this.$ = []; + break; + case 54: + $$[$0 - 1].push($$[$0]); + break; + case 59: + this.$ = []; + break; + case 60: + $$[$0 - 1].push($$[$0]); + break; + case 65: + this.$ = []; + break; + case 66: + $$[$0 - 1].push($$[$0]); + break; + case 73: + this.$ = []; + break; + case 74: + $$[$0 - 1].push($$[$0]); + break; + case 77: + this.$ = []; + break; + case 78: + $$[$0 - 1].push($$[$0]); + break; + case 81: + this.$ = []; + break; + case 82: + $$[$0 - 1].push($$[$0]); + break; + case 85: + this.$ = []; + break; + case 86: + $$[$0 - 1].push($$[$0]); + break; + case 89: + this.$ = [$$[$0]]; + break; + case 90: + $$[$0 - 1].push($$[$0]); + break; + case 91: + this.$ = [$$[$0]]; + break; + case 92: + $$[$0 - 1].push($$[$0]); + break; + } + }, + table: [{ 3: 1, 4: 2, 5: [2, 43], 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: [1, 11], 14: [1, 18], 15: 16, 17: [1, 21], 22: 14, 25: 15, 27: [1, 19], 32: [1, 20], 37: [2, 2], 42: [2, 2], 45: [2, 2], 46: [1, 12], 49: [1, 13], 53: [1, 17] }, { 1: [2, 1] }, { 5: [2, 44], 13: [2, 44], 14: [2, 44], 17: [2, 44], 27: [2, 44], 32: [2, 44], 37: [2, 44], 42: [2, 44], 45: [2, 44], 46: [2, 44], 49: [2, 44], 53: [2, 44] }, { 5: [2, 3], 13: [2, 3], 14: [2, 3], 17: [2, 3], 27: [2, 3], 32: [2, 3], 37: [2, 3], 42: [2, 3], 45: [2, 3], 46: [2, 3], 49: [2, 3], 53: [2, 3] }, { 5: [2, 4], 13: [2, 4], 14: [2, 4], 17: [2, 4], 27: [2, 4], 32: [2, 4], 37: [2, 4], 42: [2, 4], 45: [2, 4], 46: [2, 4], 49: [2, 4], 53: [2, 4] }, { 5: [2, 5], 13: [2, 5], 14: [2, 5], 17: [2, 5], 27: [2, 5], 32: [2, 5], 37: [2, 5], 42: [2, 5], 45: [2, 5], 46: [2, 5], 49: [2, 5], 53: [2, 5] }, { 5: [2, 6], 13: [2, 6], 14: [2, 6], 17: [2, 6], 27: [2, 6], 32: [2, 6], 37: [2, 6], 42: [2, 6], 45: [2, 6], 46: [2, 6], 49: [2, 6], 53: [2, 6] }, { 5: [2, 7], 13: [2, 7], 14: [2, 7], 17: [2, 7], 27: [2, 7], 32: [2, 7], 37: [2, 7], 42: [2, 7], 45: [2, 7], 46: [2, 7], 49: [2, 7], 53: [2, 7] }, { 5: [2, 8], 13: [2, 8], 14: [2, 8], 17: [2, 8], 27: [2, 8], 32: [2, 8], 37: [2, 8], 42: [2, 8], 45: [2, 8], 46: [2, 8], 49: [2, 8], 53: [2, 8] }, { 18: 22, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 33, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 34, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 4: 35, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 12: 36, 14: [1, 18] }, { 18: 38, 54: 37, 58: 39, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 9], 13: [2, 9], 14: [2, 9], 16: [2, 9], 17: [2, 9], 27: [2, 9], 32: [2, 9], 37: [2, 9], 42: [2, 9], 45: [2, 9], 46: [2, 9], 49: [2, 9], 53: [2, 9] }, { 18: 41, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 42, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 43, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [2, 73], 47: 44, 59: [2, 73], 66: [2, 73], 74: [2, 73], 75: [2, 73], 76: [2, 73], 77: [2, 73], 78: [2, 73], 79: [2, 73] }, { 21: [2, 30], 31: [2, 30], 52: [2, 30], 59: [2, 30], 62: [2, 30], 66: [2, 30], 69: [2, 30], 74: [2, 30], 75: [2, 30], 76: [2, 30], 77: [2, 30], 78: [2, 30], 79: [2, 30] }, { 21: [2, 31], 31: [2, 31], 52: [2, 31], 59: [2, 31], 62: [2, 31], 66: [2, 31], 69: [2, 31], 74: [2, 31], 75: [2, 31], 76: [2, 31], 77: [2, 31], 78: [2, 31], 79: [2, 31] }, { 21: [2, 32], 31: [2, 32], 52: [2, 32], 59: [2, 32], 62: [2, 32], 66: [2, 32], 69: [2, 32], 74: [2, 32], 75: [2, 32], 76: [2, 32], 77: [2, 32], 78: [2, 32], 79: [2, 32] }, { 21: [2, 33], 31: [2, 33], 52: [2, 33], 59: [2, 33], 62: [2, 33], 66: [2, 33], 69: [2, 33], 74: [2, 33], 75: [2, 33], 76: [2, 33], 77: [2, 33], 78: [2, 33], 79: [2, 33] }, { 21: [2, 34], 31: [2, 34], 52: [2, 34], 59: [2, 34], 62: [2, 34], 66: [2, 34], 69: [2, 34], 74: [2, 34], 75: [2, 34], 76: [2, 34], 77: [2, 34], 78: [2, 34], 79: [2, 34] }, { 21: [2, 35], 31: [2, 35], 52: [2, 35], 59: [2, 35], 62: [2, 35], 66: [2, 35], 69: [2, 35], 74: [2, 35], 75: [2, 35], 76: [2, 35], 77: [2, 35], 78: [2, 35], 79: [2, 35] }, { 21: [2, 36], 31: [2, 36], 52: [2, 36], 59: [2, 36], 62: [2, 36], 66: [2, 36], 69: [2, 36], 74: [2, 36], 75: [2, 36], 76: [2, 36], 77: [2, 36], 78: [2, 36], 79: [2, 36] }, { 21: [2, 40], 31: [2, 40], 52: [2, 40], 59: [2, 40], 62: [2, 40], 66: [2, 40], 69: [2, 40], 74: [2, 40], 75: [2, 40], 76: [2, 40], 77: [2, 40], 78: [2, 40], 79: [2, 40], 81: [1, 45] }, { 66: [1, 32], 80: 46 }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 50: 47, 52: [2, 77], 59: [2, 77], 66: [2, 77], 74: [2, 77], 75: [2, 77], 76: [2, 77], 77: [2, 77], 78: [2, 77], 79: [2, 77] }, { 23: 48, 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 49, 45: [2, 49] }, { 26: 54, 41: 55, 42: [1, 53], 45: [2, 51] }, { 16: [1, 56] }, { 31: [2, 81], 55: 57, 59: [2, 81], 66: [2, 81], 74: [2, 81], 75: [2, 81], 76: [2, 81], 77: [2, 81], 78: [2, 81], 79: [2, 81] }, { 31: [2, 37], 59: [2, 37], 66: [2, 37], 74: [2, 37], 75: [2, 37], 76: [2, 37], 77: [2, 37], 78: [2, 37], 79: [2, 37] }, { 31: [2, 38], 59: [2, 38], 66: [2, 38], 74: [2, 38], 75: [2, 38], 76: [2, 38], 77: [2, 38], 78: [2, 38], 79: [2, 38] }, { 18: 58, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 28: 59, 31: [2, 53], 59: [2, 53], 66: [2, 53], 69: [2, 53], 74: [2, 53], 75: [2, 53], 76: [2, 53], 77: [2, 53], 78: [2, 53], 79: [2, 53] }, { 31: [2, 59], 33: 60, 59: [2, 59], 66: [2, 59], 69: [2, 59], 74: [2, 59], 75: [2, 59], 76: [2, 59], 77: [2, 59], 78: [2, 59], 79: [2, 59] }, { 19: 61, 21: [2, 45], 59: [2, 45], 66: [2, 45], 74: [2, 45], 75: [2, 45], 76: [2, 45], 77: [2, 45], 78: [2, 45], 79: [2, 45] }, { 18: 65, 31: [2, 75], 48: 62, 57: 63, 58: 66, 59: [1, 40], 63: 64, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 66: [1, 70] }, { 21: [2, 39], 31: [2, 39], 52: [2, 39], 59: [2, 39], 62: [2, 39], 66: [2, 39], 69: [2, 39], 74: [2, 39], 75: [2, 39], 76: [2, 39], 77: [2, 39], 78: [2, 39], 79: [2, 39], 81: [1, 45] }, { 18: 65, 51: 71, 52: [2, 79], 57: 72, 58: 66, 59: [1, 40], 63: 73, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 24: 74, 45: [1, 75] }, { 45: [2, 50] }, { 4: 76, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 45: [2, 19] }, { 18: 77, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 78, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 24: 79, 45: [1, 75] }, { 45: [2, 52] }, { 5: [2, 10], 13: [2, 10], 14: [2, 10], 17: [2, 10], 27: [2, 10], 32: [2, 10], 37: [2, 10], 42: [2, 10], 45: [2, 10], 46: [2, 10], 49: [2, 10], 53: [2, 10] }, { 18: 65, 31: [2, 83], 56: 80, 57: 81, 58: 66, 59: [1, 40], 63: 82, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 59: [2, 85], 60: 83, 62: [2, 85], 66: [2, 85], 74: [2, 85], 75: [2, 85], 76: [2, 85], 77: [2, 85], 78: [2, 85], 79: [2, 85] }, { 18: 65, 29: 84, 31: [2, 55], 57: 85, 58: 66, 59: [1, 40], 63: 86, 64: 67, 65: 68, 66: [1, 69], 69: [2, 55], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 31: [2, 61], 34: 87, 57: 88, 58: 66, 59: [1, 40], 63: 89, 64: 67, 65: 68, 66: [1, 69], 69: [2, 61], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 20: 90, 21: [2, 47], 57: 91, 58: 66, 59: [1, 40], 63: 92, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [1, 93] }, { 31: [2, 74], 59: [2, 74], 66: [2, 74], 74: [2, 74], 75: [2, 74], 76: [2, 74], 77: [2, 74], 78: [2, 74], 79: [2, 74] }, { 31: [2, 76] }, { 21: [2, 24], 31: [2, 24], 52: [2, 24], 59: [2, 24], 62: [2, 24], 66: [2, 24], 69: [2, 24], 74: [2, 24], 75: [2, 24], 76: [2, 24], 77: [2, 24], 78: [2, 24], 79: [2, 24] }, { 21: [2, 25], 31: [2, 25], 52: [2, 25], 59: [2, 25], 62: [2, 25], 66: [2, 25], 69: [2, 25], 74: [2, 25], 75: [2, 25], 76: [2, 25], 77: [2, 25], 78: [2, 25], 79: [2, 25] }, { 21: [2, 27], 31: [2, 27], 52: [2, 27], 62: [2, 27], 65: 94, 66: [1, 95], 69: [2, 27] }, { 21: [2, 89], 31: [2, 89], 52: [2, 89], 62: [2, 89], 66: [2, 89], 69: [2, 89] }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 67: [1, 96], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 21: [2, 41], 31: [2, 41], 52: [2, 41], 59: [2, 41], 62: [2, 41], 66: [2, 41], 69: [2, 41], 74: [2, 41], 75: [2, 41], 76: [2, 41], 77: [2, 41], 78: [2, 41], 79: [2, 41], 81: [2, 41] }, { 52: [1, 97] }, { 52: [2, 78], 59: [2, 78], 66: [2, 78], 74: [2, 78], 75: [2, 78], 76: [2, 78], 77: [2, 78], 78: [2, 78], 79: [2, 78] }, { 52: [2, 80] }, { 5: [2, 12], 13: [2, 12], 14: [2, 12], 17: [2, 12], 27: [2, 12], 32: [2, 12], 37: [2, 12], 42: [2, 12], 45: [2, 12], 46: [2, 12], 49: [2, 12], 53: [2, 12] }, { 18: 98, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 100, 44: 99, 45: [2, 71] }, { 31: [2, 65], 38: 101, 59: [2, 65], 66: [2, 65], 69: [2, 65], 74: [2, 65], 75: [2, 65], 76: [2, 65], 77: [2, 65], 78: [2, 65], 79: [2, 65] }, { 45: [2, 17] }, { 5: [2, 13], 13: [2, 13], 14: [2, 13], 17: [2, 13], 27: [2, 13], 32: [2, 13], 37: [2, 13], 42: [2, 13], 45: [2, 13], 46: [2, 13], 49: [2, 13], 53: [2, 13] }, { 31: [1, 102] }, { 31: [2, 82], 59: [2, 82], 66: [2, 82], 74: [2, 82], 75: [2, 82], 76: [2, 82], 77: [2, 82], 78: [2, 82], 79: [2, 82] }, { 31: [2, 84] }, { 18: 65, 57: 104, 58: 66, 59: [1, 40], 61: 103, 62: [2, 87], 63: 105, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 30: 106, 31: [2, 57], 68: 107, 69: [1, 108] }, { 31: [2, 54], 59: [2, 54], 66: [2, 54], 69: [2, 54], 74: [2, 54], 75: [2, 54], 76: [2, 54], 77: [2, 54], 78: [2, 54], 79: [2, 54] }, { 31: [2, 56], 69: [2, 56] }, { 31: [2, 63], 35: 109, 68: 110, 69: [1, 108] }, { 31: [2, 60], 59: [2, 60], 66: [2, 60], 69: [2, 60], 74: [2, 60], 75: [2, 60], 76: [2, 60], 77: [2, 60], 78: [2, 60], 79: [2, 60] }, { 31: [2, 62], 69: [2, 62] }, { 21: [1, 111] }, { 21: [2, 46], 59: [2, 46], 66: [2, 46], 74: [2, 46], 75: [2, 46], 76: [2, 46], 77: [2, 46], 78: [2, 46], 79: [2, 46] }, { 21: [2, 48] }, { 5: [2, 21], 13: [2, 21], 14: [2, 21], 17: [2, 21], 27: [2, 21], 32: [2, 21], 37: [2, 21], 42: [2, 21], 45: [2, 21], 46: [2, 21], 49: [2, 21], 53: [2, 21] }, { 21: [2, 90], 31: [2, 90], 52: [2, 90], 62: [2, 90], 66: [2, 90], 69: [2, 90] }, { 67: [1, 96] }, { 18: 65, 57: 112, 58: 66, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 22], 13: [2, 22], 14: [2, 22], 17: [2, 22], 27: [2, 22], 32: [2, 22], 37: [2, 22], 42: [2, 22], 45: [2, 22], 46: [2, 22], 49: [2, 22], 53: [2, 22] }, { 31: [1, 113] }, { 45: [2, 18] }, { 45: [2, 72] }, { 18: 65, 31: [2, 67], 39: 114, 57: 115, 58: 66, 59: [1, 40], 63: 116, 64: 67, 65: 68, 66: [1, 69], 69: [2, 67], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 23], 13: [2, 23], 14: [2, 23], 17: [2, 23], 27: [2, 23], 32: [2, 23], 37: [2, 23], 42: [2, 23], 45: [2, 23], 46: [2, 23], 49: [2, 23], 53: [2, 23] }, { 62: [1, 117] }, { 59: [2, 86], 62: [2, 86], 66: [2, 86], 74: [2, 86], 75: [2, 86], 76: [2, 86], 77: [2, 86], 78: [2, 86], 79: [2, 86] }, { 62: [2, 88] }, { 31: [1, 118] }, { 31: [2, 58] }, { 66: [1, 120], 70: 119 }, { 31: [1, 121] }, { 31: [2, 64] }, { 14: [2, 11] }, { 21: [2, 28], 31: [2, 28], 52: [2, 28], 62: [2, 28], 66: [2, 28], 69: [2, 28] }, { 5: [2, 20], 13: [2, 20], 14: [2, 20], 17: [2, 20], 27: [2, 20], 32: [2, 20], 37: [2, 20], 42: [2, 20], 45: [2, 20], 46: [2, 20], 49: [2, 20], 53: [2, 20] }, { 31: [2, 69], 40: 122, 68: 123, 69: [1, 108] }, { 31: [2, 66], 59: [2, 66], 66: [2, 66], 69: [2, 66], 74: [2, 66], 75: [2, 66], 76: [2, 66], 77: [2, 66], 78: [2, 66], 79: [2, 66] }, { 31: [2, 68], 69: [2, 68] }, { 21: [2, 26], 31: [2, 26], 52: [2, 26], 59: [2, 26], 62: [2, 26], 66: [2, 26], 69: [2, 26], 74: [2, 26], 75: [2, 26], 76: [2, 26], 77: [2, 26], 78: [2, 26], 79: [2, 26] }, { 13: [2, 14], 14: [2, 14], 17: [2, 14], 27: [2, 14], 32: [2, 14], 37: [2, 14], 42: [2, 14], 45: [2, 14], 46: [2, 14], 49: [2, 14], 53: [2, 14] }, { 66: [1, 125], 71: [1, 124] }, { 66: [2, 91], 71: [2, 91] }, { 13: [2, 15], 14: [2, 15], 17: [2, 15], 27: [2, 15], 32: [2, 15], 42: [2, 15], 45: [2, 15], 46: [2, 15], 49: [2, 15], 53: [2, 15] }, { 31: [1, 126] }, { 31: [2, 70] }, { 31: [2, 29] }, { 66: [2, 92], 71: [2, 92] }, { 13: [2, 16], 14: [2, 16], 17: [2, 16], 27: [2, 16], 32: [2, 16], 37: [2, 16], 42: [2, 16], 45: [2, 16], 46: [2, 16], 49: [2, 16], 53: [2, 16] }], + defaultActions: { 4: [2, 1], 49: [2, 50], 51: [2, 19], 55: [2, 52], 64: [2, 76], 73: [2, 80], 78: [2, 17], 82: [2, 84], 92: [2, 48], 99: [2, 18], 100: [2, 72], 105: [2, 88], 107: [2, 58], 110: [2, 64], 111: [2, 11], 123: [2, 70], 124: [2, 29] }, + parseError: function parseError(str, hash) { + throw new Error(str); + }, + parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], + lstack = [], + table = this.table, + yytext = "", + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || 1; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, + preErrorSymbol, + state, + action, + a, + r, + yyval = {}, + p, + len, + newState, + expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + if (!recovering) { + expected = []; + for (p in table[state]) if (this.terminals_[p] && p > 2) { + expected.push("'" + this.terminals_[p] + "'"); + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); + } + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) recovering--; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; + } + }; + /* Jison generated lexer */ + var lexer = (function () { + var lexer = { EOF: 1, + parseError: function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + setInput: function setInput(input) { + this._input = input; + this._more = this._less = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ""; + this.conditionStack = ["INITIAL"]; + this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; + if (this.options.ranges) this.yylloc.range = [0, 0]; + this.offset = 0; + return this; + }, + input: function input() { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) this.yylloc.range[1]++; + + this._input = this._input.slice(1); + return ch; + }, + unput: function unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) this.yylineno -= lines.length - 1; + var r = this.yylloc.range; + + this.yylloc = { first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + return this; + }, + more: function more() { + this._more = true; + return this; + }, + less: function less(n) { + this.unput(this.match.slice(n)); + }, + pastInput: function pastInput() { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); + }, + upcomingInput: function upcomingInput() { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20 - next.length); + } + return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, + showPosition: function showPosition() { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + next: function next() { + if (this.done) { + return this.EOF; + } + if (!this._input) this.done = true; + + var token, match, tempMatch, index, col, lines; + if (!this._more) { + this.yytext = ""; + this.match = ""; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (!this.options.flex) break; + } + } + if (match) { + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) this.yylineno += lines.length; + this.yylloc = { first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) this.done = false; + if (token) { + return token; + } else { + return; + } + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); + } + }, + lex: function lex() { + var r = this.next(); + if (typeof r !== "undefined") { + return r; + } else { + return this.lex(); + } + }, + begin: function begin(condition) { + this.conditionStack.push(condition); + }, + popState: function popState() { + return this.conditionStack.pop(); + }, + _currentRules: function _currentRules() { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + }, + topState: function topState() { + return this.conditionStack[this.conditionStack.length - 2]; + }, + pushState: function begin(condition) { + this.begin(condition); + } }; + lexer.options = {}; + lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + + function strip(start, end) { + return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); + } + + var YYSTATE = YY_START; + switch ($avoiding_name_collisions) { + case 0: + if (yy_.yytext.slice(-2) === "\\\\") { + strip(0, 1); + this.begin("mu"); + } else if (yy_.yytext.slice(-1) === "\\") { + strip(0, 1); + this.begin("emu"); + } else { + this.begin("mu"); + } + if (yy_.yytext) { + return 14; + }break; + case 1: + return 14; + break; + case 2: + this.popState(); + return 14; + + break; + case 3: + yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); + this.popState(); + return 16; + + break; + case 4: + return 14; + break; + case 5: + this.popState(); + return 13; + + break; + case 6: + return 59; + break; + case 7: + return 62; + break; + case 8: + return 17; + break; + case 9: + this.popState(); + this.begin("raw"); + return 21; + + break; + case 10: + return 53; + break; + case 11: + return 27; + break; + case 12: + return 45; + break; + case 13: + this.popState();return 42; + break; + case 14: + this.popState();return 42; + break; + case 15: + return 32; + break; + case 16: + return 37; + break; + case 17: + return 49; + break; + case 18: + return 46; + break; + case 19: + this.unput(yy_.yytext); + this.popState(); + this.begin("com"); + + break; + case 20: + this.popState(); + return 13; + + break; + case 21: + return 46; + break; + case 22: + return 67; + break; + case 23: + return 66; + break; + case 24: + return 66; + break; + case 25: + return 81; + break; + case 26: + // ignore whitespace + break; + case 27: + this.popState();return 52; + break; + case 28: + this.popState();return 31; + break; + case 29: + yy_.yytext = strip(1, 2).replace(/\\"/g, "\"");return 74; + break; + case 30: + yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 74; + break; + case 31: + return 79; + break; + case 32: + return 76; + break; + case 33: + return 76; + break; + case 34: + return 77; + break; + case 35: + return 78; + break; + case 36: + return 75; + break; + case 37: + return 69; + break; + case 38: + return 71; + break; + case 39: + return 66; + break; + case 40: + return 66; + break; + case 41: + return "INVALID"; + break; + case 42: + return 5; + break; + } + }; + lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{\/)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; + lexer.conditions = { mu: { rules: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], inclusive: false }, emu: { rules: [2], inclusive: false }, com: { rules: [5], inclusive: false }, raw: { rules: [3, 4], inclusive: false }, INITIAL: { rules: [0, 1, 42], inclusive: true } }; + return lexer; + })(); + parser.lexer = lexer; + function Parser() { + this.yy = {}; + }Parser.prototype = parser;parser.Parser = Parser; + return new Parser(); + })();exports["default"] = handlebars; + module.exports = exports["default"]; + + /***/ }, + /* 15 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + + var _Visitor = __webpack_require__(6); + + var _Visitor2 = _interopRequireWildcard(_Visitor); + + function WhitespaceControl() {} + WhitespaceControl.prototype = new _Visitor2['default'](); + + WhitespaceControl.prototype.Program = function (program) { + var isRoot = !this.isRootSeen; + this.isRootSeen = true; + + var body = program.body; + for (var i = 0, l = body.length; i < l; i++) { + var current = body[i], + strip = this.accept(current); + + if (!strip) { + continue; + } + + var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), + _isNextWhitespace = isNextWhitespace(body, i, isRoot), + openStandalone = strip.openStandalone && _isPrevWhitespace, + closeStandalone = strip.closeStandalone && _isNextWhitespace, + inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; + + if (strip.close) { + omitRight(body, i, true); + } + if (strip.open) { + omitLeft(body, i, true); + } + + if (inlineStandalone) { + omitRight(body, i); + + if (omitLeft(body, i)) { + // If we are on a standalone node, save the indent info for partials + if (current.type === 'PartialStatement') { + // Pull out the whitespace from the final line + current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; + } + } + } + if (openStandalone) { + omitRight((current.program || current.inverse).body); + + // Strip out the previous content node if it's whitespace only + omitLeft(body, i); + } + if (closeStandalone) { + // Always strip the next node + omitRight(body, i); + + omitLeft((current.inverse || current.program).body); + } + } + + return program; + }; + WhitespaceControl.prototype.BlockStatement = function (block) { + this.accept(block.program); + this.accept(block.inverse); + + // Find the inverse program that is involed with whitespace stripping. + var program = block.program || block.inverse, + inverse = block.program && block.inverse, + firstInverse = inverse, + lastInverse = inverse; + + if (inverse && inverse.chained) { + firstInverse = inverse.body[0].program; + + // Walk the inverse chain to find the last inverse that is actually in the chain. + while (lastInverse.chained) { + lastInverse = lastInverse.body[lastInverse.body.length - 1].program; + } + } + + var strip = { + open: block.openStrip.open, + close: block.closeStrip.close, + + // Determine the standalone candiacy. Basically flag our content as being possibly standalone + // so our parent can determine if we actually are standalone + openStandalone: isNextWhitespace(program.body), + closeStandalone: isPrevWhitespace((firstInverse || program).body) + }; + + if (block.openStrip.close) { + omitRight(program.body, null, true); + } + + if (inverse) { + var inverseStrip = block.inverseStrip; + + if (inverseStrip.open) { + omitLeft(program.body, null, true); + } + + if (inverseStrip.close) { + omitRight(firstInverse.body, null, true); + } + if (block.closeStrip.open) { + omitLeft(lastInverse.body, null, true); + } + + // Find standalone else statments + if (isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { + omitLeft(program.body); + omitRight(firstInverse.body); + } + } else if (block.closeStrip.open) { + omitLeft(program.body, null, true); + } + + return strip; + }; + + WhitespaceControl.prototype.MustacheStatement = function (mustache) { + return mustache.strip; + }; + + WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { + /* istanbul ignore next */ + var strip = node.strip || {}; + return { + inlineStandalone: true, + open: strip.open, + close: strip.close + }; + }; + + function isPrevWhitespace(body, i, isRoot) { + if (i === undefined) { + i = body.length; + } + + // Nodes that end with newlines are considered whitespace (but are special + // cased for strip operations) + var prev = body[i - 1], + sibling = body[i - 2]; + if (!prev) { + return isRoot; + } + + if (prev.type === 'ContentStatement') { + return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); + } + } + function isNextWhitespace(body, i, isRoot) { + if (i === undefined) { + i = -1; + } + + var next = body[i + 1], + sibling = body[i + 2]; + if (!next) { + return isRoot; + } + + if (next.type === 'ContentStatement') { + return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); + } + } + + // Marks the node to the right of the position as omitted. + // I.e. {{foo}}' ' will mark the ' ' node as omitted. + // + // If i is undefined, then the first child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitRight(body, i, multiple) { + var current = body[i == null ? 0 : i + 1]; + if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { + return; + } + + var original = current.value; + current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); + current.rightStripped = current.value !== original; + } + + // Marks the node to the left of the position as omitted. + // I.e. ' '{{foo}} will mark the ' ' node as omitted. + // + // If i is undefined then the last child will be marked as such. + // + // If mulitple is truthy then all whitespace will be stripped out until non-whitespace + // content is met. + function omitLeft(body, i, multiple) { + var current = body[i == null ? body.length - 1 : i - 1]; + if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { + return; + } + + // We omit the last node if it's whitespace only and not preceeded by a non-content node. + var original = current.value; + current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); + current.leftStripped = current.value !== original; + return current.leftStripped; + } + + exports['default'] = WhitespaceControl; + module.exports = exports['default']; + + /***/ }, + /* 16 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _interopRequireWildcard = __webpack_require__(8)['default']; + + exports.__esModule = true; + exports.SourceLocation = SourceLocation; + exports.id = id; + exports.stripFlags = stripFlags; + exports.stripComment = stripComment; + exports.preparePath = preparePath; + exports.prepareMustache = prepareMustache; + exports.prepareRawBlock = prepareRawBlock; + exports.prepareBlock = prepareBlock; + + var _Exception = __webpack_require__(11); + + var _Exception2 = _interopRequireWildcard(_Exception); + + function SourceLocation(source, locInfo) { + this.source = source; + this.start = { + line: locInfo.first_line, + column: locInfo.first_column + }; + this.end = { + line: locInfo.last_line, + column: locInfo.last_column + }; + } + + function id(token) { + if (/^\[.*\]$/.test(token)) { + return token.substr(1, token.length - 2); + } else { + return token; + } + } + + function stripFlags(open, close) { + return { + open: open.charAt(2) === '~', + close: close.charAt(close.length - 3) === '~' + }; + } + + function stripComment(comment) { + return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); + } + + function preparePath(data, parts, locInfo) { + locInfo = this.locInfo(locInfo); + + var original = data ? '@' : '', + dig = [], + depth = 0, + depthString = ''; + + for (var i = 0, l = parts.length; i < l; i++) { + var part = parts[i].part, + + // If we have [] syntax then we do not treat path references as operators, + // i.e. foo.[this] resolves to approximately context.foo['this'] + isLiteral = parts[i].original !== part; + original += (parts[i].separator || '') + part; + + if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { + if (dig.length > 0) { + throw new _Exception2['default']('Invalid path: ' + original, { loc: locInfo }); + } else if (part === '..') { + depth++; + depthString += '../'; + } + } else { + dig.push(part); + } + } + + return new this.PathExpression(data, depth, dig, original, locInfo); + } + + function prepareMustache(path, params, hash, open, strip, locInfo) { + // Must use charAt to support IE pre-10 + var escapeFlag = open.charAt(3) || open.charAt(2), + escaped = escapeFlag !== '{' && escapeFlag !== '&'; + + return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo)); + } + + function prepareRawBlock(openRawBlock, content, close, locInfo) { + if (openRawBlock.path.original !== close) { + var errorNode = { loc: openRawBlock.path.loc }; + + throw new _Exception2['default'](openRawBlock.path.original + ' doesn\'t match ' + close, errorNode); + } + + locInfo = this.locInfo(locInfo); + var program = new this.Program([content], null, {}, locInfo); + + return new this.BlockStatement(openRawBlock.path, openRawBlock.params, openRawBlock.hash, program, undefined, {}, {}, {}, locInfo); + } + + function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { + // When we are chaining inverse calls, we will not have a close path + if (close && close.path && openBlock.path.original !== close.path.original) { + var errorNode = { loc: openBlock.path.loc }; + + throw new _Exception2['default'](openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode); + } + + program.blockParams = openBlock.blockParams; + + var inverse = undefined, + inverseStrip = undefined; + + if (inverseAndProgram) { + if (inverseAndProgram.chain) { + inverseAndProgram.program.body[0].closeStrip = close.strip; + } + + inverseStrip = inverseAndProgram.strip; + inverse = inverseAndProgram.program; + } + + if (inverted) { + inverted = inverse; + inverse = program; + program = inverted; + } + + return new this.BlockStatement(openBlock.path, openBlock.params, openBlock.hash, program, inverse, openBlock.strip, inverseStrip, close && close.strip, this.locInfo(locInfo)); + } + + /***/ }, + /* 17 */ + /***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + /*global define */ + + var _isArray = __webpack_require__(12); + + var SourceNode = undefined; + + try { + /* istanbul ignore next */ + if (false) { + // We don't support this in AMD environments. For these environments, we asusme that + // they are running on the browser and thus have no need for the source-map library. + var SourceMap = require('source-map'); + SourceNode = SourceMap.SourceNode; + } + } catch (err) {} + + /* istanbul ignore if: tested but not covered in istanbul due to dist build */ + if (!SourceNode) { + SourceNode = function (line, column, srcFile, chunks) { + this.src = ''; + if (chunks) { + this.add(chunks); + } + }; + /* istanbul ignore next */ + SourceNode.prototype = { + add: function add(chunks) { + if (_isArray.isArray(chunks)) { + chunks = chunks.join(''); + } + this.src += chunks; + }, + prepend: function prepend(chunks) { + if (_isArray.isArray(chunks)) { + chunks = chunks.join(''); + } + this.src = chunks + this.src; + }, + toStringWithSourceMap: function toStringWithSourceMap() { + return { code: this.toString() }; + }, + toString: function toString() { + return this.src; + } + }; + } + + function castChunk(chunk, codeGen, loc) { + if (_isArray.isArray(chunk)) { + var ret = []; + + for (var i = 0, len = chunk.length; i < len; i++) { + ret.push(codeGen.wrap(chunk[i], loc)); + } + return ret; + } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { + // Handle primitives that the SourceNode will throw up on + return chunk + ''; + } + return chunk; + } + + function CodeGen(srcFile) { + this.srcFile = srcFile; + this.source = []; + } + + CodeGen.prototype = { + prepend: function prepend(source, loc) { + this.source.unshift(this.wrap(source, loc)); + }, + push: function push(source, loc) { + this.source.push(this.wrap(source, loc)); + }, + + merge: function merge() { + var source = this.empty(); + this.each(function (line) { + source.add([' ', line, '\n']); + }); + return source; + }, + + each: function each(iter) { + for (var i = 0, len = this.source.length; i < len; i++) { + iter(this.source[i]); + } + }, + + empty: function empty() { + var loc = arguments[0] === undefined ? this.currentLocation || { start: {} } : arguments[0]; + + return new SourceNode(loc.start.line, loc.start.column, this.srcFile); + }, + wrap: function wrap(chunk) { + var loc = arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; + + if (chunk instanceof SourceNode) { + return chunk; + } + + chunk = castChunk(chunk, this, loc); + + return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); + }, + + functionCall: function functionCall(fn, type, params) { + params = this.generateList(params); + return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); + }, + + quotedString: function quotedString(str) { + return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 + .replace(/\u2029/g, '\\u2029') + '"'; + }, + + objectLiteral: function objectLiteral(obj) { + var pairs = []; + + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + var value = castChunk(obj[key], this); + if (value !== 'undefined') { + pairs.push([this.quotedString(key), ':', value]); + } + } + } + + var ret = this.generateList(pairs); + ret.prepend('{'); + ret.add('}'); + return ret; + }, + + generateList: function generateList(entries, loc) { + var ret = this.empty(loc); + + for (var i = 0, len = entries.length; i < len; i++) { + if (i) { + ret.add(','); + } + + ret.add(castChunk(entries[i], this, loc)); + } + + return ret; + }, + + generateArray: function generateArray(entries, loc) { + var ret = this.generateList(entries, loc); + ret.prepend('['); + ret.add(']'); + + return ret; + } + }; + + exports['default'] = CodeGen; + module.exports = exports['default']; + + /* NOP */ + + /***/ } + /******/ ]) + }); + ; + +/***/ }, +/* 4 */, +/* 5 */, +/* 6 */, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) { + // Handlebars helpers + Handlebars.registerHelper('concat', function() { + var size = (arguments.length - 1), + output = ''; + for(var i = 0; i < size; i++) { + output += arguments[i]; + }; + return output; + }); + + Handlebars.registerHelper('number_format', function(value, block) { + return Number(value).toLocaleString(); + }); + Handlebars.registerHelper('date_format', function(timestamp, block) { + if(window.moment) { + if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) { + return; + } + + // set date format + var f = block.hash.format || "MMM Do, YYYY"; + // check if we passed a timestamp + if(parseInt(timestamp, 10) == timestamp) { + return moment.unix(timestamp).format(f); + } else { + return moment.utc(timestamp).format(f); + } + } else { + return timestamp; + }; + }); + + Handlebars.registerHelper('cycle', function(value, block) { + var values = value.split(' '); + return values[block.data.index % (values.length + 1)]; + }); + + Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { + switch (operator) { + case '==': + return (v1 == v2) ? options.fn(this) : options.inverse(this); + case '===': + return (v1 === v2) ? options.fn(this) : options.inverse(this); + case '!=': + return (v1 != v2) ? options.fn(this) : options.inverse(this); + case '!==': + return (v1 !== v2) ? options.fn(this) : options.inverse(this); + case '<': + return (v1 < v2) ? options.fn(this) : options.inverse(this); + case '<=': + return (v1 <= v2) ? options.fn(this) : options.inverse(this); + case '>': + return (v1 > v2) ? options.fn(this) : options.inverse(this); + case '>=': + return (v1 >= v2) ? options.fn(this) : options.inverse(this); + case '&&': + return (v1 && v2) ? options.fn(this) : options.inverse(this); + case '||': + return (v1 || v2) ? options.fn(this) : options.inverse(this); + case 'in': + var values = v2.split(','); + return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this); + default: + return options.inverse(this); + } + }); + + Handlebars.registerHelper('nl2br', function(value, block) { + return value.gsub("\n", "
"); + }); + + Handlebars.registerHelper('json_encode', function(value, block) { + return JSON.stringify(value); + }); + + Handlebars.registerHelper('json_decode', function(value, block) { + return JSON.parse(value); + }); + Handlebars.registerHelper('url', function(value, block) { + var url = window.location.protocol + "//" + window.location.host + window.location.pathname; + + return url + value; + }); + Handlebars.registerHelper('emailFromMailto', function(value) { + var mailtoMatchingRegex = /^mailto\:/i; + if (typeof value === 'string' && value.match(mailtoMatchingRegex)) { + return value.replace(mailtoMatchingRegex, ''); + } else { + return value; + } + }); + Handlebars.registerHelper('lookup', function(obj, field, options) { + return obj && obj[field]; + }); + + + Handlebars.registerHelper('rsa_key', function(value, block) { + // extract all lines into an array + if(value === undefined) return ''; + + var lines = value.trim().split("\n"); + + // remove header & footer + lines.shift(); + lines.pop(); + + // return concatenated lines + return lines.join(''); + }); + + Handlebars.registerHelper('trim', function(value, block) { + if(value === null || value === undefined) return ''; + return value.trim(); + }); + + /** + * {{ellipsis}} + * From: https://github.com/assemble/handlebars-helpers + * @author: Jon Schlinkert + * Truncate the input string and removes all HTML tags + * @param {String} str The input string. + * @param {Number} limit The number of characters to limit the string. + * @param {String} append The string to append if charaters are omitted. + * @return {String} The truncated string. + */ + Handlebars.registerHelper('ellipsis', function (str, limit, append) { + if (append === undefined) { + append = ''; + } + var sanitized = str.replace(/(<([^>]+)>)/g, ''); + if (sanitized.length > limit) { + return sanitized.substr(0, limit - append.length) + append; + } else { + return sanitized; + } + }); + + Handlebars.registerHelper('getNumber', function (string) { + return parseInt(string, 10); + }); + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/views/layout.html b/views/layout.html index 02f8327829..224af6401d 100644 --- a/views/layout.html +++ b/views/layout.html @@ -23,9 +23,9 @@ <%= javascript( - 'src/vendor.js', - 'src/mailpoet.js', - 'src/admin.js' + 'vendor.js', + 'mailpoet.js', + 'admin.js' )%> diff --git a/webpack.config.js b/webpack.config.js index 9ac69e96dd..17bd98326b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -13,7 +13,7 @@ baseConfig = { admin: 'admin.js', }, output: { - path: './assets/js/src', + path: './assets/js', filename: '[name].js', }, plugins: [ @@ -36,12 +36,12 @@ baseConfig = { resolve: { modulesDirectories: [ 'node_modules', - 'assets/js', + 'assets/js/src', 'assets/css/lib' ], fallback: path.join(__dirname, 'node_modules'), alias: { - 'handlebars': 'handlebars/runtime.js' + 'handlebars': 'handlebars/dist/handlebars.js' } }, resolveLoader: { @@ -71,13 +71,14 @@ module.exports = [ resolve: { modulesDirectories: [ 'node_modules', - 'assets/js', + 'assets/js/src', 'tests/javascript/newsletter_editor' ], fallback: path.join(__dirname, 'node_modules'), alias: { - 'handlebars': 'handlebars/runtime.js' + 'handlebars': 'handlebars/dist/handlebars.js' } }, + plugins: [], }) ]; From cf3695157a677a15fe4cf076a709e0f48ba454ea Mon Sep 17 00:00:00 2001 From: Jonathan Labreuille Date: Mon, 17 Aug 2015 15:04:30 +0200 Subject: [PATCH 3/4] Update Robo task to compile assets - renamed compile:javascript to compile:js - renamed compile:styles to compile:css - added compile:all to compile all of our assets - added compiled js & css to gitignore - removed console.log from src/admin.js --- .gitignore | 3 + RoboFile.php | 39 +-- assets/css/form_editor.css | 629 ------------------------------------- assets/js/admin.js | 1 - assets/js/src/admin.js | 1 - 5 files changed, 24 insertions(+), 649 deletions(-) delete mode 100644 assets/css/form_editor.css diff --git a/.gitignore b/.gitignore index 084ddd26a0..32acab88b0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ npm-debug.log temp .idea wysija-newsletters.zip +tests/javascript/testBundles +assets/css/*.css +assets/js/*.js \ No newline at end of file diff --git a/RoboFile.php b/RoboFile.php index 54936dcfdb..49e1a7af46 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -1,6 +1,14 @@ _exec('./composer.phar install'); $this->_exec('npm install'); @@ -13,35 +21,30 @@ class RoboFile extends \Robo\Tasks { } function watch() { - $css_files = array( - 'assets/css/src/admin.styl', - 'assets/css/src/rtl.styl' - ); - - $js_files = glob('assets/js/src/*.js'); - $this->taskWatch() - ->monitor($js_files, function() { - $this->compileJavascript(); + ->monitor(glob($this->js_files), function() { + $this->compileJs(); }) - ->monitor($css_files, function() use($css_files) { - $this->compileStyles($css_files); + ->monitor($this->css_files, function() { + $this->compileCss(); }) ->run(); } - function compileJavascript() { + function compileAll() { + $this->compileJs(); + $this->compileCss(); + } + + function compileJs() { $this->_exec('./node_modules/webpack/bin/webpack.js'); } - protected function compileStyles($files = array()) { - if(empty($files)) { return; } - + function compileCss() { $this->_exec(join(' ', array( './node_modules/stylus/bin/stylus', '-u nib', - '-w', - join(' ', $files), + join(' ', $this->css_files), '-o assets/css/' ))); } @@ -78,7 +81,7 @@ class RoboFile extends \Robo\Tasks { } function testJavascript() { - $this->compileJavascript(); + $this->compileJs(); $this->_exec(join(' ', array( './node_modules/mocha/bin/mocha', diff --git a/assets/css/form_editor.css b/assets/css/form_editor.css deleted file mode 100644 index bda49f4f9d..0000000000 --- a/assets/css/form_editor.css +++ /dev/null @@ -1,629 +0,0 @@ -a:focus { - outline: 0 none !important; -} -#mailpoet_form_history { - display:none; -} -#mailpoet_form_editor { - padding:20px; - width:300px; - border:1px solid #ccc; - position: relative; - background-color: #fff; - -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); - -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); - box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0, 0, 0, 0.1); -} - -#mailpoet_form_editor:before, #mailpoet_form_editor:after { - position: absolute; - width: 40%; - height: 10px; - content: ' '; - left: 12px; - bottom: 12px; - background: transparent; - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - transform: skew(-5deg) rotate(-5deg); - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); - z-index: -1; -} -#mailpoet_form_editor:after -{ - left: auto; - right: 12px; - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - transform: skew(5deg) rotate(5deg); -} - - -/* Warnings in blocks*/ -.mailpoet_warning { - font-weight:bold; - color:#900; -} - -.block_placeholder { - font-weight: bold; - height: 0; - overflow: hidden; - line-height: 30px; - text-align: center; - border: 0 none; - width:298px; - z-index: 9500; - margin:0 auto; - text-indent: -9999px; - -} -.block_placeholder.active { - text-indent: 0; - /*border:1px dashed #dfdfdf;*/ - /*background-color:#f5f5f5;*/ - background-color: #4cb7e1; - display:block; - overflow: auto; - height: 30px; -} -.block_placeholder.hover { - background-color: #0074a2; - border-color:#0074a2; - color: #fff; -} - -.mailpoet_form_block { - background-color:#fff; - height:20px; - border:0 none; -} -.mailpoet_form_block.highlighted { - border:1px solid #5897FB; - padding:9px 17px; -} - -.mailpoet_form_block img { - max-width: 100%; -} - -/* Widget styles */ -.mailpoet_form_block p { - margin:5px 0; - word-wrap: break-word; -} - -/* Widget: checkbox, radio */ -.mailpoet_radio, -.mailpoet_checkbox { - margin:-2px 5px 0 0; -} - -/* MailPoet Form wrapper */ -#mailpoet_form_wrapper { - position: relative; -} - -/* MailPoet Form container */ -#mailpoet_form_container { - width:340px; - margin:0; -} -#mailpoet_form_editor.loading, -#mailpoet_form_toolbar.loading { - background: url(loading.gif) no-repeat center center #fcfcfc; -} -#mailpoet_form_toolbar.loading { - border:1px solid #dfdfdf; -} -#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields { - visibility: hidden; - z-index:1; -} - -/* Tabs : content/images/styles/themes */ -#wysija-add-field { - float: none; -} - -#mailpoet_form_toolbar { - position: absolute; - width: 400px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs { - border-bottom:1px solid #dfdfdf; - line-height:0; -} -#mailpoet_form_toolbar .add_custom_field { - text-align:center; - padding:15px 0 5px 0; -} - -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li, -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - margin:0; - height:30px; - line-height:30px; - padding:0; - display:-moz-inline-box; - display:inline-block; - *display:inline; - *float:left; - outline:0 none; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - outline:0 none; text-decoration:none; color:#a6a6a6; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li { - margin:0 0 1px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif; - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #F9F9F9, #F5F5F5); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#F5F5F5', endColorstr='#F9F9F9'); - background: -webkit-gradient(linear, left top,left bottom, from(#F9F9F9), to(#F5F5F5)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px 3px 0 0; - -webkit-border-radius: 3px 3px 0 0; - -khtml-border-radius: 3px 3px 0 0; - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 #FFFFFF inset; - padding:0 7px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover { - background-color:#eee; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected { - color:#000; - border-bottom:0 none; - background:#fcfcfc; - filter:none; - padding-bottom:1px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a { } - -.wysija_params { - display:none !important; -} - -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs, -#mailpoet_form_toolbar #mailpoet_toolbar_fields { - position:relative; - z-index:9998; - margin:0; -} - -/* edit form name */ -h2.title { - margin:0 0 15px 0; -} - -#mailpoet_form_name_input { - vertical-align: bottom; -} - -/* wysija widgets */ -.mailpoet_form_widget { - width:298px; - height:25px; - line-height:25px; - z-index:9999 !important; -} - -.mailpoet_toolbar_section { - margin-bottom: 0; - - background: none repeat scroll 0 0 #fff; - border: 1px solid #e5e5e5; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); - min-width: 255px; - position: relative; - - cursor: pointer; - max-height: auto; -} - -.mailpoet_toolbar_section > div { - padding:10px 20px 20px 20px; -} - -.mailpoet_toolbar_section h3 { - margin: 10px; - position: relative; -} - -.mailpoet_toolbar_section.closed { - max-height:38px; - overflow: hidden; -} - -.mailpoet_toolbar_section .mailpoet_toggle { - position: absolute; - top:0; - right: 0; - height: 38px; - width: 27px; -} -.mailpoet_toolbar_section .mailpoet_toggle:focus { - outline: 0 none !important; - box-shadow: none !important; -} - -.mailpoet_toolbar_section .mailpoet_toggle:before { - right: 12px; - font: 400 20px/1 dashicons; - speak: none; - display: inline-block; - padding: 8px 10px; - top: 0; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none!important; - content: '\f142'; -} -.mailpoet_toolbar_section.closed .mailpoet_toggle:before { - content: '\f140'; -} - -#mailpoet_form_styles { - margin:10px; - max-width: 318px; - width: 318px; - min-height: 300px; - resize:vertical; -} - -#mailpoet_form_toolbar a.mailpoet_form_field, -.mailpoet_form_widget { - height:25px; - line-height:25px; - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec'); - background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - -khtml-border-radius: 3px; - border-radius: 3px; - box-shadow: 0 1px 0 #FFFFFF inset; - display:block; - font-size: 12px; - font-weight: bold; - padding:0 7px; - cursor:move; - color:#222; - text-shadow: 0 1px 0 #FFFFFF; -} -#mailpoet_form_toolbar a.mailpoet_form_field.disabled { - cursor:pointer; - color:#cccccc; - pointer-events:none; -} -.mailpoet_form_field_edit { - position:absolute; - right:27px; - bottom:13px; -} -.mailpoet_form_field_delete { - position: absolute; - right:7px; - bottom:13px; -} - -/* toolbar: fields */ -#mailpoet_toolbar_fields li { - padding:0 0 10px 0; - position:relative; -} - -#mailpoet_toolbar_fields li.notice { - font-style:italic; - font-size:11px; - margin: 0 !important; - border: 0 none !important; - background: none !important; -} - -/* blocks */ -.mailpoet_form_block { - position:relative; - margin:0; - padding:10px 18px 10px 18px; - display: inline-table; - display: block; - height: 1%; - margin:0; - z-index:98; -} - -.mailpoet_form_block.dragging { - z-index:99000; - pointer-events:none; -} - -.mailpoet_form_block:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -.mailpoet_form_block.hover { - border:1px dashed #bbb; - margin:0 0 0 0; - padding:9px 17px 9px 17px; -} -.mailpoet_form_block.static { - /*padding:0; - margin:0;*/ - background-color:#999; -} - -/* controls*/ -.mailpoet_form_block .wysija_controls { - background-color:#dfdfdf; - background-image: -moz-linear-gradient(center bottom , #bbb, #eee); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#bbbbbb'); - background: -webkit-gradient(linear, left bottom,left top, from(#bbb), to(#eee)); - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - -khtml-border-radius: 2px; - border-radius: 2px; - border:1px solid #ccc; - position:absolute; - margin:0; - padding:0; - width:298px; - height:20px; - left:-1px; - right:0; - top:-22px; -} -.mailpoet_form_block .wysija_controls li { - float:left; - width:20px; - height:20px; -} -.mailpoet_form_block .wysija_controls a { - cursor: pointer; - float: left; - font-size: 120%; - font-weight: bold; - height: 20px; - line-height: 20px; - text-align: center; - width: 20px; - color:#000; -} - -.mailpoet_form_block .wysija_controls a.remove { - margin:0 0 0 1px; -} -.mailpoet_form_block .handle_container, -.mailpoet_form_block .handle_container a { - float:none; - width:40px !important; -} - -.mailpoet_form_block .handle_container { - left: 140px; - top: 0; - position: absolute; -} - -/* controls & icons */ -.wysija_controls a span, -.wysija_gallery .wysija_tools a span, -.wysija_image .wysija_tools a span, -.wysija_text .wysija_tools a span, -#mailpoet_toolbar_fields a span { - display: block; - height:20px; - width:20px; -} - -/* toolbar: full width button */ - -/* color picker in control bars */ -.wysija_controls span input { - margin:2px 0 0 0; - padding: 0; - color: transparent; -} - -/* left alignment button */ -.alignment-left span { - background:url(form_editor_icons.png) no-repeat 0 0; -} -.alignment-left.active span, .alignment-left:hover span { - background:url(form_editor_icons.png) no-repeat 0 -20px; -} - -/* center alignment button */ -.alignment-center span { - background:url(form_editor_icons.png) no-repeat -20px 0; -} -.alignment-center.active span, .alignment-center:hover span { - background:url(form_editor_icons.png) no-repeat -20px -20px; -} - -/* right alignment button */ -.alignment-right span { - background:url(form_editor_icons.png) no-repeat -40px 0; -} -.alignment-right.active span, .alignment-right:hover span { - background:url(form_editor_icons.png) no-repeat -40px -20px; -} - -/* linking */ -.add-link span { - background:url(form_editor_icons.png) no-repeat -60px 0; -} -.add-link.active span, .add-link:hover span { - background:url(form_editor_icons.png) no-repeat -60px -20px; -} - -.remove-link span { - background:url(form_editor_icons.png) no-repeat -80px 0; -} - -.remove-link.active span, .remove-link:hover span { - background:url(form_editor_icons.png) no-repeat -80px -20px; -} - -/* block controls */ -.remove span, .delete span { - background:url(form_editor_icons.png) no-repeat -100px 0; -} -.remove.active span, .remove:hover span, -.delete.active span, .delete:hover span { - background:url(form_editor_icons.png) no-repeat -100px -20px; -} - -.handle span { - background: url(handle.png) no-repeat; - cursor:move; - width: 40px !important; -} - -.duplicate span { - background:url(form_editor_icons.png) no-repeat -140px 0; -} - -.duplicate.active span, .duplicate:hover span { - background:url(form_editor_icons.png) no-repeat -140px -20px; -} - -.settings span { - background:url(form_editor_icons.png) no-repeat -160px 0; -} -.settings.active span, .settings:hover span { - background:url(form_editor_icons.png) no-repeat -160px -20px; -} - -.icon-plus span { - background:url(form_editor_icons.png) no-repeat -200px 0; -} - -.icon-plus.active span, .icon-plus:hover span { - background:url(form_editor_icons.png) no-repeat -200px -20px; -} - -.icon-minus span { - background:url(form_editor_icons.png) no-repeat -220px 0; -} - -.icon-minus.active span, .icon-minus:hover span { - background:url(form_editor_icons.png) no-repeat -220px -20px; -} - -/* wysija options */ -.wysija_options { - display:none; -} - -/* wysija block settings */ -.wysija_settings { - position: absolute; - z-index:1000; -} -.wysija_settings a { - background-color: #F5F5F5; - background-image: -moz-linear-gradient(center top , #f9f9f9, #ececec); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec'); - background: -webkit-gradient(linear, left top,left bottom, from(#f9f9f9), to(#ececec)); - border:1px solid #DFDFDF; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - -khtml-border-radius: 3px; - border-radius: 3px; - box-shadow: 0 1px 0 #FFFFFF inset; - font-size: 12px; - font-weight: normal; - cursor:pointer; - color:#222; - text-shadow: 0 1px 0 #FFFFFF; - text-decoration: none; - display:block; - padding:5px 5px 3px 27px; -} - -.wysija_settings a span { - width: 20px; - height: 20px; - position: absolute; - top: 3px; - left: 5px; -} - -/* labels */ -.mailpoet_form_block label { - margin:0 5px 0 0; - display:block; -} - -/* form settings: success message */ -#mailpoet_on_success textarea, -#mailpoet_on_success select { - width:100%; -} - -#mailpoet_on_success textarea { - height:50px; - min-height: 50px; - resize:vertical; -} - -/* make sure textareas within the form editor are not resizeable */ -.mailpoet_form_block textarea { - resize:none; -} -/* remove click events from inputs within form editor */ -.mailpoet_form_block input, -.mailpoet_form_block textarea { - pointer-events:none; -} - -/* form export */ -#mailpoet_form_export textarea { - width:340px; - height:150px; - min-height: 150px; - resize:vertical; - font-size:85%; - display:none; -} - -/** Styling for WP 3.8 and higher */ -.mailpoet_form_field_edit, -.mailpoet_form_field_delete { - text-decoration: none; -} -.mailpoet_form_field_edit:hover .dashicons-admin-generic:before, -.mailpoet_form_field_delete:hover .dashicons-dismiss:before, -.settings:hover .dashicons-admin-generic:before { - color: #2ea2cc; -} -.mailpoet_form_field_edit span, -.mailpoet_form_field_delete span { - background: none !important; - color: #999; -} -.mailpoet_form_field_delete span:before { - font-size: 21px; -} - - -/* Code Mirror */ -.CodeMirror { - border: 1px solid #eee; -} \ No newline at end of file diff --git a/assets/js/admin.js b/assets/js/admin.js index b9c893b086..f45bcb7f8c 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -7,7 +7,6 @@ webpackJsonp([0],[ __webpack_require__(2), __webpack_require__(3), ], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) { - console.log('OVER HERE', MailPoet, jQuery, Handlebars); jQuery(function($) { // dom ready $(function() { diff --git a/assets/js/src/admin.js b/assets/js/src/admin.js index 6e22b30d08..5aaadb5822 100644 --- a/assets/js/src/admin.js +++ b/assets/js/src/admin.js @@ -3,7 +3,6 @@ define('admin', [ 'jquery', 'handlebars', ], function(MailPoet, jQuery, Handlebars) { - console.log('admin.js', MailPoet, jQuery, Handlebars); jQuery(function($) { // dom ready $(function() { From a6d4b6ee00ac7868642ceffc0eb9198b59133886 Mon Sep 17 00:00:00 2001 From: Jonathan Labreuille Date: Mon, 17 Aug 2015 15:42:59 +0200 Subject: [PATCH 4/4] Updated robo task + removed bundled assets --- RoboFile.php | 12 +- assets/css/admin.css | 1026 ---------- assets/css/rtl.css | 0 assets/js/admin.js | 20 - assets/js/mailpoet.js | 914 --------- assets/js/vendor.js | 4381 ----------------------------------------- 6 files changed, 10 insertions(+), 6343 deletions(-) delete mode 100644 assets/css/admin.css delete mode 100644 assets/css/rtl.css delete mode 100644 assets/js/admin.js delete mode 100644 assets/js/mailpoet.js delete mode 100644 assets/js/vendor.js diff --git a/RoboFile.php b/RoboFile.php index 49e1a7af46..a03443d96a 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -7,7 +7,10 @@ class RoboFile extends \Robo\Tasks { 'assets/css/src/rtl.styl' ); - private $js_files = 'assets/js/src/*.js'; + private $js_files = array( + 'assets/js/src/*.js', + 'assets/js/src/**/*.js' + ); function install() { $this->_exec('./composer.phar install'); @@ -21,8 +24,13 @@ class RoboFile extends \Robo\Tasks { } function watch() { + $js_files = array(); + array_map(function($path) use(&$js_files) { + $js_files = array_merge($js_files, glob($path)); + }, $this->js_files); + $this->taskWatch() - ->monitor(glob($this->js_files), function() { + ->monitor($js_files, function() { $this->compileJs(); }) ->monitor($this->css_files, function() { diff --git a/assets/css/admin.css b/assets/css/admin.css deleted file mode 100644 index 606fb73e68..0000000000 --- a/assets/css/admin.css +++ /dev/null @@ -1,1026 +0,0 @@ -.clearfix { - zoom: 1; -} -.clearfix:before, -.clearfix:after { - content: ""; - display: table; -} -.clearfix:after { - clear: both; -} -a:focus { - outline: 0 none !important; -} -body.mailpoet_modal_opened { - overflow: hidden; -} -#mailpoet_modal_overlay { - height: 100%; - left: 0; - overflow-y: auto; - overflow-x: hidden; - position: fixed; - top: 0; - width: 100%; - z-index: 100000; - background-color: rgba(0,0,0,0.6); -} -.mailpoet_modal_highlight { - pointer-events: none; - background-color: #f1f1f1; - position: relative; - z-index: 100001 !important; - -webkit-box-shadow: 0px 0px 20px 2px rgba(255,255,255,0.75); - box-shadow: 0px 0px 20px 2px rgba(255,255,255,0.75); -} -#mailpoet_modal_overlay.mailpoet_overlay_hidden { - background-color: transparent; -} -#mailpoet_modal_overlay.mailpoet_overlay_loading { - background-color: rgba(0,0,0,0.6) !important; - display: block !important; -} -.mailpoet_modal_opened #mailpoet_modal_overlay { - display: block; -} -#mailpoet_popup { - display: none; - position: absolute; - z-index: 25; - top: 48px; - padding-bottom: 48px; - margin: 0; -} -.mailpoet_popup_wrapper { - background-color: #f0f0f0; - overflow: hidden; - position: relative; - width: 100%; - z-index: 0; -} -.mailpoet_overlay_hidden .mailpoet_popup_wrapper { - border: 1px solid #333; -} -#mailpoet_popup_title { - background-color: #222; - border: 1px solid #333; - height: 27px; - margin: 0; - padding: 0 30px 0 0; -} -#mailpoet_popup_title h2 { - color: #cfcfcf; - font-size: 12px; - font-weight: normal; - margin: 6px 0 0 10px; - padding: 0; - font-family: "Lucida Grande", Verdana, Arial, sans-serif; -} -.mailpoet_popup_body { - padding: 10px 10px 10px 10px; -} -#mailpoet_modal_overlay.mailpoet_panel_overlay { - top: 32px; - overflow: hidden; -} -#mailpoet_panel { - display: none; - position: fixed; - z-index: 100002; - top: 0; - bottom: 0; - padding: 0; - margin: 0; - width: 100%; - -webkit-transition: margin 0.3s ease-out; - -moz-transition: margin 0.3s ease-out; - -o-transition: margin 0.3s ease-out; - -ms-transition: margin 0.3s ease-out; - transition: margin 0.3s ease-out; -} -.mailpoet_panel_wrapper { - background-color: #f1f1f1; - border: 1px solid #e1e1e1; - border-top: 0 none; - height: 100%; - overflow-y: auto; - overflow-x: hidden; - width: 100%; - top: 0; - z-index: 0; -} -#mailpoet_panel_title { - margin: 0; - padding: 0; - position: relative; - height: 0; -} -#mailpoet_panel_title h2 { - color: #cfcfcf; - background-color: #222; - border-left: 1px solid #444; - border-right: 1px solid #444; - font-size: 1em; - font-weight: normal; - margin: 0; - padding: 0 30px 0 10px; - font-family: "Lucida Grande", Verdana, Arial, sans-serif; - line-height: 32px; -} -.mailpoet_panel_body { - padding: 10px 10px 36px 10px; -} -#mailpoet_modal_close { - background: url("../img/modal_close_button.png") 7px 7px no-repeat; - height: 30px; - overflow: hidden; - padding: 0; - position: absolute; - width: 30px; - z-index: 2; - outline: 0 none; -} -#mailpoet_popup #mailpoet_modal_close { - right: 0; - top: 0; -} -#mailpoet_panel #mailpoet_modal_close { - right: 10px; - top: 7px; -} -#mailpoet_modal_close:focus { - outline: 0 none; -} -.mailpoet_align_left { - margin: 0; - text-align: left; -} -.mailpoet_align_center { - margin: 0; - text-align: center; -} -.mailpoet_align_right { - margin: 0; - text-align: right; -} -.mailpoet_button { - padding: 3px 15px; - border: 1px solid #444; - font-weight: normal; - cursor: pointer; - background-color: #222; - color: #cfcfcf; - font-size: 1em; -} -.mailpoet_button:hover { - background-color: #0ac; - color: #fff; -} -.mailpoet_button:active { - background-color: #0cf; - color: #fff; -} -.mailpoet_success, -.mailpoet_error { - display: none; -} -.mailpoet_success { - color: #090; -} -.mailpoet_error { - color: #900; -} -@media screen and (max-width: 782px) { - #mailpoet_modal_overlay.mailpoet_panel_overlay { - top: 46px; - } - .mailpoet_panel_body { - padding-bottom: 52px; - } -} -#mailpoet_loading { - width: 150px; - height: 32px; - position: relative; - left: 50%; - top: 50%; - margin-left: -75px; - margin-top: -16px; -} -.mailpoet_modal_loading { - -webkit-animation-direction: linear; - -moz-animation-direction: linear; - -o-animation-direction: linear; - -ms-animation-direction: linear; - animation-direction: linear; - -webkit-animation-duration: 1.95s; - -moz-animation-duration: 1.95s; - -o-animation-duration: 1.95s; - -ms-animation-duration: 1.95s; - animation-duration: 1.95s; - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -o-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - animation-iteration-count: infinite; - -webkit-animation-name: bounce_mailpoet_modal_loading; - -moz-animation-name: bounce_mailpoet_modal_loading; - -o-animation-name: bounce_mailpoet_modal_loading; - -ms-animation-name: bounce_mailpoet_modal_loading; - animation-name: bounce_mailpoet_modal_loading; - -webkit-border-radius: 21px; - border-radius: 21px; - background-color: #e01d4e; - float: left; - height: 32px; - margin-left: 17px; - width: 32px; -} -#mailpoet_modal_loading_1 { - -webkit-animation-delay: 0.39s; - -moz-animation-delay: 0.39s; - -o-animation-delay: 0.39s; - -ms-animation-delay: 0.39s; - animation-delay: 0.39s; -} -#mailpoet_modal_loading_2 { - -webkit-animation-delay: 0.91s; - -moz-animation-delay: 0.91s; - -o-animation-delay: 0.91s; - -ms-animation-delay: 0.91s; - animation-delay: 0.91s; -} -#mailpoet_modal_loading_3 { - -webkit-animation-delay: 1.17s; - -moz-animation-delay: 1.17s; - -o-animation-delay: 1.17s; - -ms-animation-delay: 1.17s; - animation-delay: 1.17s; -} -@-moz-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@-webkit-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@-o-keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -@keyframes bounce_mailpoet_modal_loading { - 0%, 50% { - background-color: #064e6d; - } -} -.mailpoet_notice { - position: relative; -} -.mailpoet_notice_close { - position: absolute; - right: 0.5em; - top: 0.5em; - color: #999; - text-decoration: none; -} -.formError { - z-index: 990; -} -.formError .formErrorContent { - z-index: 991; -} -.formError .formErrorArrow { - z-index: 996; -} -.ui-dialog .formError { - z-index: 5000; -} -.ui-dialog .formError .formErrorContent { - z-index: 5001; -} -.ui-dialog .formError .formErrorArrow { - z-index: 5006; -} -.inputContainer { - position: relative; - float: left; -} -.formError { - position: absolute; - top: 300px; - left: 300px; - display: block; - cursor: pointer; - text-align: left; -} -.formError.inline { - position: relative; - top: 0; - left: 0; - display: inline-block; -} -.ajaxSubmit { - padding: 20px; - background: #55ea55; - border: 1px solid #999; - display: none; -} -.formError .formErrorContent { - width: 100%; - background: #00579a; - position: relative; - color: #fff; - min-width: 120px; - font-size: 12px; - border: 1px solid #fff; - -webkit-box-shadow: 0 0 2px #333; - box-shadow: 0 0 2px #333; - -moz-box-shadow: 0 0 2px #333; - -webkit-box-shadow: 0 0 2px #333; - -o-box-shadow: 0 0 2px #333; - padding: 4px 10px 4px 10px; - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - -o-border-radius: 0; -} -.formError.inline .formErrorContent { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; - border: none; - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - -o-border-radius: 0; -} -.greenPopup .formErrorContent { - background: #33be40; -} -.blackPopup .formErrorContent { - background: #393939; - color: #fff; -} -.formError .formErrorArrow { - width: 15px; - margin: -2px 0 0 13px; - position: relative; -} -body[dir='rtl'] .formError .formErrorArrow, -body.rtl .formError .formErrorArrow { - margin: -2px 13px 0 0; -} -.formError .formErrorArrowBottom { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; - margin: 0px 0 0 12px; - top: 2px; -} -.formError .formErrorArrow div { - border-left: 1px solid #fff; - border-right: 1px solid #fff; - -webkit-box-shadow: 0 1px 1px #474747; - box-shadow: 0 1px 1px #474747; - -moz-box-shadow: 0 1px 1px #474747; - -webkit-box-shadow: 0 1px 1px #474747; - -o-box-shadow: 0 1px 1px #474747; - font-size: 0px; - height: 1px; - background: #00579a; - margin: 0 auto; - line-height: 0; - font-size: 0; - display: block; -} -.formError .formErrorArrowBottom div { - -webkit-box-shadow: none; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - -o-box-shadow: none; -} -.greenPopup .formErrorArrow div { - background: #33be40; -} -.blackPopup .formErrorArrow div { - background: #393939; - color: #fff; -} -.formError .formErrorArrow .line10 { - width: 13px; - border: none; -} -.formError .formErrorArrow .line9 { - width: 11px; - border: none; -} -.formError .formErrorArrow .line8 { - width: 11px; -} -.formError .formErrorArrow .line7 { - width: 9px; -} -.formError .formErrorArrow .line6 { - width: 7px; -} -.formError .formErrorArrow .line5 { - width: 5px; -} -.formError .formErrorArrow .line4 { - width: 3px; -} -.formError .formErrorArrow .line3 { - width: 1px; - border-left: 1px solid #fff; - border-right: 1px solid #fff; - border-bottom: 0 solid #fff; -} -.formError .formErrorArrow .line2 { - width: 3px; - border: none; - background: #fff; -} -.formError .formErrorArrow .line1 { - width: 1px; - border: none; - background: #fff; -} -#mailpoet_form_history { - display: none; -} -#mailpoet_form_editor { - padding: 20px; - width: 300px; - border: 1px solid #ccc; - position: relative; - background-color: #fff; - -webkit-box-shadow: 0 0 5px rgba(0,0,0,0.2) inset 0 0 20px rgba(0,0,0,0.1); - box-shadow: 0 0 5px rgba(0,0,0,0.2) inset 0 0 20px rgba(0,0,0,0.1); -} -#mailpoet_form_editor:before, -#mailpoet_form_editor:after { - position: absolute; - width: 40%; - height: 10px; - content: ' '; - left: 12px; - bottom: 12px; - background: transparent; - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - -webkit-transform: skew(-5deg) rotate(-5deg); - -moz-transform: skew(-5deg) rotate(-5deg); - -o-transform: skew(-5deg) rotate(-5deg); - -ms-transform: skew(-5deg) rotate(-5deg); - transform: skew(-5deg) rotate(-5deg); -rgba(0,0,0,0.3) -rgba(0,0,0,0.3) - -webkit-box-shadow: 0 6px 12px rgba(0,0,0,0.3); - box-shadow: 0 6px 12px rgba(0,0,0,0.3); - z-index: -1; -} -#mailpoet_form_editor:after { - left: auto; - right: 12px; - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - -webkit-transform: skew(5deg) rotate(5deg); - -moz-transform: skew(5deg) rotate(5deg); - -o-transform: skew(5deg) rotate(5deg); - -ms-transform: skew(5deg) rotate(5deg); - transform: skew(5deg) rotate(5deg); -} -.mailpoet_warning { - font-weight: bold; - color: #900; -} -.block_placeholder { - font-weight: bold; - height: 0; - overflow: hidden; - line-height: 30px; - text-align: center; - border: 0 none; - width: 298px; - z-index: 9500; - margin: 0 auto; - text-indent: -9999px; -} -.block_placeholder.active { - text-indent: 0; -/*border:1px dashed #dfdfdf;*/ -/*background-color:#f5f5f5;*/ - background-color: #4cb7e1; - display: block; - overflow: auto; - height: 30px; -} -.block_placeholder.hover { - background-color: #0074a2; - border-color: #0074a2; - color: #fff; -} -.mailpoet_form_block { - background-color: #fff; - height: 20px; - border: 0 none; -} -.mailpoet_form_block.highlighted { - border: 1px solid #5897fb; - padding: 9px 17px; -} -.mailpoet_form_block img { - max-width: 100%; -} -.mailpoet_form_block p { - margin: 5px 0; - word-wrap: break-word; -} -.mailpoet_radio, -.mailpoet_checkbox { - margin: -2px 5px 0 0; -} -#mailpoet_form_wrapper { - position: relative; -} -#mailpoet_form_container { - width: 340px; - margin: 0; -} -#mailpoet_form_editor.loading, -#mailpoet_form_toolbar.loading { - background: url("loading.gif") no-repeat center center #fcfcfc; -} -#mailpoet_form_toolbar.loading { - border: 1px solid #dfdfdf; -} -#mailpoet_form_toolbar.loading #mailpoet_toolbar_fields { - visibility: hidden; - z-index: 1; -} -#wysija-add-field { - float: none; -} -#mailpoet_form_toolbar { - position: absolute; - width: 400px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs { - border-bottom: 1px solid #dfdfdf; - line-height: 0; -} -#mailpoet_form_toolbar .add_custom_field { - text-align: center; - padding: 15px 0 5px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li, -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - margin: 0; - height: 30px; - line-height: 30px; - padding: 0; - display: -moz-inline-box; - display: inline-block; - *display: inline; - *float: left; - outline: 0 none; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - outline: 0 none; - text-decoration: none; - color: #a6a6a6; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs li { - margin: 0 0 1px 0; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a { - font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif; - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -moz-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -o-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: -ms-linear-gradient(center top, #f9f9f9, #f5f5f5); - background: linear-gradient(center top, #f9f9f9, #f5f5f5); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px 3px 0 0; - border-radius: 3px 3px 0 0; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - padding: 0 7px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a:hover { - background-color: #eee; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs a.selected { - color: #000; - border-bottom: 0 none; - background: #fcfcfc; - filter: none; - padding-bottom: 1px; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs .last a, -.wysija_params { - display: none !important; -} -#mailpoet_form_toolbar .mailpoet_form_toolbar_tabs, -#mailpoet_form_toolbar #mailpoet_toolbar_fields { - position: relative; - z-index: 9998; - margin: 0; -} -h2.title { - margin: 0 0 15px 0; -} -#mailpoet_form_name_input { - vertical-align: bottom; -} -.mailpoet_form_widget { - width: 298px; - height: 25px; - line-height: 25px; - z-index: 9999 !important; -} -.mailpoet_toolbar_section { - margin-bottom: 0; - background: none repeat scroll 0 0 #fff; - border: 1px solid #e5e5e5; - -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04); - box-shadow: 0 1px 1px rgba(0,0,0,0.04); - min-width: 255px; - position: relative; - cursor: pointer; - overflow: hidden; - max-height: 1000px; - -webkit-transition: max-height 0.5s ease-in-out; - -moz-transition: max-height 0.5s ease-in-out; - -o-transition: max-height 0.5s ease-in-out; - -ms-transition: max-height 0.5s ease-in-out; - transition: max-height 0.5s ease-in-out; -} -.mailpoet_toolbar_section > div { - padding: 10px 20px 20px 20px; - overflow: auto; - height: 100%; - min-width: 255px; -} -.mailpoet_toolbar_section h3 { - margin: 10px; - position: relative; -} -.mailpoet_toolbar_section.closed { - max-height: 38px; -} -.mailpoet_toolbar_section .mailpoet_toggle { - position: absolute; - top: 0; - right: 0; - height: 38px; - width: 27px; -} -.mailpoet_toolbar_section .mailpoet_toggle:focus { - outline: 0 none !important; - -webkit-box-shadow: none !important; - box-shadow: none !important; -} -.mailpoet_toolbar_section .mailpoet_toggle:before { - right: 12px; - font: 400 20px/1 dashicons; - speak: none; - display: inline-block; - padding: 8px 10px; - top: 0; - position: relative; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - text-decoration: none !important; - content: '\f142'; -} -.mailpoet_toolbar_section.closed .mailpoet_toggle:before { - content: '\f140'; -} -#mailpoet_form_styles { - margin: 10px; - max-width: 318px; - width: 318px; - min-height: 300px; - resize: vertical; -} -#mailpoet_form_toolbar a.mailpoet_form_field, -.mailpoet_form_widget { - height: 25px; - line-height: 25px; - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #ececec); - background: -moz-linear-gradient(center top, #f9f9f9, #ececec); - background: -o-linear-gradient(center top, #f9f9f9, #ececec); - background: -ms-linear-gradient(center top, #f9f9f9, #ececec); - background: linear-gradient(center top, #f9f9f9, #ececec); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px; - border-radius: 3px; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - display: block; - font-size: 12px; - font-weight: bold; - padding: 0 7px; - cursor: move; - color: #222; - text-shadow: 0 1px 0 #fff; -} -#mailpoet_form_toolbar a.mailpoet_form_field.disabled { - cursor: pointer; - color: #ccc; - pointer-events: none; -} -.mailpoet_form_field_edit { - position: absolute; - right: 27px; - bottom: 13px; -} -.mailpoet_form_field_delete { - position: absolute; - right: 7px; - bottom: 13px; -} -#mailpoet_toolbar_fields li { - padding: 0 0 10px 0; - position: relative; -} -#mailpoet_toolbar_fields li.notice { - font-style: italic; - font-size: 11px; - margin: 0 !important; - border: 0 none !important; - background: none !important; -} -.mailpoet_form_block { - position: relative; - margin: 0; - padding: 10px 18px 10px 18px; - display: inline-table; - display: block; - height: 1%; - margin: 0; - z-index: 98; -} -.mailpoet_form_block.dragging { - z-index: 99000; - pointer-events: none; -} -.mailpoet_form_block:after { - content: "."; - display: block; - height: 0; - clear: both; - visibility: hidden; -} -.mailpoet_form_block.hover { - border: 1px dashed #bbb; - margin: 0 0 0 0; - padding: 9px 17px 9px 17px; -} -.mailpoet_form_block.static { -/*padding:0; - margin:0;*/ - background-color: #999; -} -.mailpoet_form_block .wysija_controls { - background-color: #dfdfdf; - background: -webkit-linear-gradient(center top, #eee, #bbb); - background: -moz-linear-gradient(center top, #eee, #bbb); - background: -o-linear-gradient(center top, #eee, #bbb); - background: -ms-linear-gradient(center top, #eee, #bbb); - background: linear-gradient(center top, #eee, #bbb); - -webkit-border-radius: 2px; - border-radius: 2px; - border: 1px solid #ccc; - position: absolute; - margin: 0; - padding: 0; - width: 298px; - height: 20px; - left: -1px; - right: 0; - top: -22px; -} -.mailpoet_form_block .wysija_controls li { - float: left; - width: 20px; - height: 20px; -} -.mailpoet_form_block .wysija_controls a { - cursor: pointer; - float: left; - font-size: 120%; - font-weight: bold; - height: 20px; - line-height: 20px; - text-align: center; - width: 20px; - color: #000; -} -.mailpoet_form_block .wysija_controls a.remove { - margin: 0 0 0 1px; -} -.mailpoet_form_block .handle_container, -.mailpoet_form_block .handle_container a { - float: none; - width: 40px !important; -} -.mailpoet_form_block .handle_container { - left: 140px; - top: 0; - position: absolute; -} -.wysija_controls a span, -.wysija_gallery .wysija_tools a span, -.wysija_image .wysija_tools a span, -.wysija_text .wysija_tools a span, -#mailpoet_toolbar_fields a span { - display: block; - height: 20px; - width: 20px; -} -.wysija_controls span input { - margin: 2px 0 0 0; - padding: 0; - color: transparent; -} -.alignment-left span { - background: url("../img/form_editor_icons.png") no-repeat 0 0; -} -.alignment-left.active span, -.alignment-left:hover span { - background: url("../img/form_editor_icons.png") no-repeat 0 -20px; -} -.alignment-center span { - background: url("../img/form_editor_icons.png") no-repeat -20px 0; -} -.alignment-center.active span, -.alignment-center:hover span { - background: url("../img/form_editor_icons.png") no-repeat -20px -20px; -} -.alignment-right span { - background: url("../img/form_editor_icons.png") no-repeat -40px 0; -} -.alignment-right.active span, -.alignment-right:hover span { - background: url("../img/form_editor_icons.png") no-repeat -40px -20px; -} -.add-link span { - background: url("../img/form_editor_icons.png") no-repeat -60px 0; -} -.add-link.active span, -.add-link:hover span { - background: url("../img/form_editor_icons.png") no-repeat -60px -20px; -} -.remove-link span { - background: url("../img/form_editor_icons.png") no-repeat -80px 0; -} -.remove-link.active span, -.remove-link:hover span { - background: url("../img/form_editor_icons.png") no-repeat -80px -20px; -} -.remove span, -.delete span { - background: url("../img/form_editor_icons.png") no-repeat -100px 0; -} -.remove.active span, -.remove:hover span, -.delete.active span, -.delete:hover span { - background: url("../img/form_editor_icons.png") no-repeat -100px -20px; -} -.handle span { - background: url("../img/handle.png") no-repeat; - cursor: move; - width: 40px !important; -} -.duplicate span { - background: url("../img/form_editor_icons.png") no-repeat -140px 0; -} -.duplicate.active span, -.duplicate:hover span { - background: url("../img/form_editor_icons.png") no-repeat -140px -20px; -} -.settings span { - background: url("../img/form_editor_icons.png") no-repeat -160px 0; -} -.settings.active span, -.settings:hover span { - background: url("../img/form_editor_icons.png") no-repeat -160px -20px; -} -.icon-plus span { - background: url("../img/form_editor_icons.png") no-repeat -200px 0; -} -.icon-plus.active span, -.icon-plus:hover span { - background: url("../img/form_editor_icons.png") no-repeat -200px -20px; -} -.icon-minus span { - background: url("../img/form_editor_icons.png") no-repeat -220px 0; -} -.icon-minus.active span, -.icon-minus:hover span { - background: url("../img/form_editor_icons.png") no-repeat -220px -20px; -} -.wysija_options { - display: none; -} -.wysija_settings { - position: absolute; - z-index: 1000; -} -.wysija_settings a { - background-color: #f5f5f5; - background: -webkit-linear-gradient(center top, #f9f9f9, #ececec); - background: -moz-linear-gradient(center top, #f9f9f9, #ececec); - background: -o-linear-gradient(center top, #f9f9f9, #ececec); - background: -ms-linear-gradient(center top, #f9f9f9, #ececec); - background: linear-gradient(center top, #f9f9f9, #ececec); - border: 1px solid #dfdfdf; - -webkit-border-radius: 3px; - border-radius: 3px; - -webkit-box-shadow: 0 1px 0 #fff inset; - box-shadow: 0 1px 0 #fff inset; - font-size: 12px; - font-weight: normal; - cursor: pointer; - color: #222; - text-shadow: 0 1px 0 #fff; - text-decoration: none; - display: block; - padding: 5px 5px 3px 27px; -} -.wysija_settings a span { - width: 20px; - height: 20px; - position: absolute; - top: 3px; - left: 5px; -} -.mailpoet_form_block label { - margin: 0 5px 0 0; - display: block; -} -#mailpoet_on_success textarea, -#mailpoet_on_success select { - width: 100%; -} -#mailpoet_on_success textarea { - height: 50px; - min-height: 50px; - resize: vertical; -} -.mailpoet_form_block textarea { - resize: none; -} -.mailpoet_form_block input, -.mailpoet_form_block textarea { - pointer-events: none; -} -#mailpoet_form_export textarea { - width: 340px; - height: 150px; - min-height: 150px; - resize: vertical; - font-size: 85%; - display: none; -} -.mailpoet_form_field_edit, -.mailpoet_form_field_delete { - text-decoration: none; -} -.mailpoet_form_field_edit:hover .dashicons-admin-generic:before, -.mailpoet_form_field_delete:hover .dashicons-dismiss:before, -.settings:hover .dashicons-admin-generic:before { - color: #2ea2cc; -} -.mailpoet_form_field_edit span, -.mailpoet_form_field_delete span { - background: none !important; - color: #999; -} -.mailpoet_form_field_delete span:before { - font-size: 21px; -} -.CodeMirror { - border: 1px solid #eee; -} diff --git a/assets/css/rtl.css b/assets/css/rtl.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/assets/js/admin.js b/assets/js/admin.js deleted file mode 100644 index f45bcb7f8c..0000000000 --- a/assets/js/admin.js +++ /dev/null @@ -1,20 +0,0 @@ -webpackJsonp([0],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ - __webpack_require__(1), - __webpack_require__(2), - __webpack_require__(3), - ], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery, Handlebars) { - jQuery(function($) { - // dom ready - $(function() { - - }); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file diff --git a/assets/js/mailpoet.js b/assets/js/mailpoet.js deleted file mode 100644 index b308e8a13c..0000000000 --- a/assets/js/mailpoet.js +++ /dev/null @@ -1,914 +0,0 @@ -webpackJsonp([1],[ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(1); - __webpack_require__(4); - __webpack_require__(5); - module.exports = __webpack_require__(6); - - -/***/ }, -/* 1 */, -/* 2 */, -/* 3 */, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /** - * MailPoet Ajax - **/ - - MailPoet.Ajax = { - version: 0.1, - options: {}, - defaults: { - url: null, - controller: 'dummy', - action: 'test', - data: {}, - onSuccess: function(data, textStatus, xhr) {}, - onError: function(xhr, textStatus, errorThrown) {} - }, - get: function(options) { - this.request('get', options); - }, - post: function(options) { - this.request('post', options); - }, - delete: function(options) { - this.request('delete', options); - }, - init: function(options) { - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - if(this.options.url === null) { - this.options.url = ajaxurl+'?action=mailpoet_ajax'; - } - - // routing - this.options.url += '&mailpoet_controller='+this.options.controller; - this.options.url += '&mailpoet_action='+this.options.action; - }, - request: function(method, options) { - // set options - this.init(options); - - // make ajax request depending on method - if(method === 'get') { - jQuery.get( - this.options.url, - this.options.data, - this.options.onSuccess, - 'json' - ); - } else { - jQuery.ajax( - this.options.url, - { - data: JSON.stringify(this.options.data), - processData: false, - contentType: "application/json; charset=utf-8", - type : method, - dataType: 'json', - success : this.options.onSuccess, - error : this.options.onError - } - ); - } - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Modal: - - version: 0.8 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - - Options: - - Mandatory: - // Modal window's title - (string) title: 'Modal title' - - // template - (string) template: jQuery('#handlebars_template').html() or - literal html - - Optional: - // jQuery cached element object node to be displayed, - // instead of creating a new one - (object) element: jQuery(selector) - - // - data object that will be passed to the template when rendering - (object) data: {}, - - // - data will be loaded via this url and passed to the template - // when rendering - // - if a "data" option was specified, it will be merged with the - // ajax's response data - (string) url: '/url.json' - - // ajax method - (string) method: 'post' (default: 'get') - - // ajax post params - (object) params: {} - - // - integers are expressed in pixels - (mixed) width: '50%' | 100 | '100px' - - // - integers are expressed in pixels - // - will be ignored when in "panel" mode - (mixed) height: '50%' | 100 | '100px' - - // - only used for "panel" mode - // - will be ignored in "popup" mode - (string) position: 'left' | 'right' - - // display overlay or not - (boolean) overlay: true | false - - // element(s) to be highlighted when the overlay is "on" - (object) highlight: jQuery element - - // callbacks - (function) onInit: called when the modal is displayed - (function) onSuccess: called by calling MailPoet_Guide.success() - (function) onCancel: called when closing the popup - or by calling MailPoet_Guide.cancel() - - Usage: - - // popup mode - MailPoet.Modal.popup(options); - - // panel mode - MailPoet.Modal.panel(options); - - // loading states - MailPoet.Modal.loading(true); // displays loading indicator - MailPoet.Modal.loading(false); // hides loading indicator - - ==================================================================================================*/ - - MailPoet.Modal = { - version: 0.8, - - // flags - initialized: false, - opened: false, - locked: false, - - // sub panels - subpanels: [], - - // default values - defaults: { - // title - title: null, - - // type - type: null, - - // positionning - position: 'right', - - // data sources - data: {}, - url: null, - method: 'get', - params: {}, - - // template - template: null, - body_template: null, - - // dimensions - width: 'auto', - height: 'auto', - - // display overlay - overlay: false, - - // highlighted elements - highlight: null, - - // callbacks - onInit: null, - onSuccess: null, - onCancel: null - }, - renderer: 'html', - options: {}, - templates: { - overlay: '', - popup: '
'+ - '
'+ - ''+ - '

'+ - '
'+ - '
'+ - '
', - loading: '', - panel: '
'+ - ''+ - '
'+ - '
'+ - '
'+ - '
', - subpanel: '
'+ - '
'+ - '
' - }, - setRenderer: function() { - this.renderer = (typeof(Handlebars) === "undefined") ? 'html' : 'handlebars'; - }, - compileTemplate: function(template) { - if(this.renderer === 'html') { - return function() { return template; }; - } else { - return Handlebars.compile(template); - } - }, - init: function(options) { - if(this.initialized === true) { - this.close(); - } - - // merge options - this.options = jQuery.extend({}, this.defaults, options); - - // set renderer - this.setRenderer(); - - // init overlay - this.initOverlay(); - - // toggle overlay - this.toggleOverlay(this.options.overlay); - - if(this.options.type !== null) { - // insert modal depending on its type - if(this.options.type === 'popup') { - var modal = this.compileTemplate(this.templates[this.options.type]); - // create modal - jQuery('#mailpoet_modal_overlay').append(modal(this.options)); - // set title - jQuery('#mailpoet_popup_title h2').html(this.options.title); - } else if(this.options.type === 'panel') { - // create panel - jQuery('#mailpoet_modal_overlay').after(this.templates[this.options.type]); - } - - // add proper overlay class - jQuery('#mailpoet_modal_overlay') - .removeClass('mailpoet_popup_overlay mailpoet_panel_overlay') - .addClass('mailpoet_'+this.options.type+'_overlay'); - } - - // render template if specified - if(this.options.template !== null) { - // set "success" callback if specified - if(options.onSuccess !== undefined) { - this.options.onSuccess = options.onSuccess; - } - - // set "cancel" callback if specified - if(options.onCancel !== undefined) { - this.options.onCancel = options.onCancel; - } - - // compile template - this.options.body_template = this.compileTemplate(this.options.template); - - // setup events - this.setupEvents(); - } - - // set popup as initialized - this.initialized = true; - - return this; - }, - initOverlay: function(toggle) { - if(jQuery('#mailpoet_modal_overlay').length === 0) { - // insert overlay into the DOM - jQuery('body').append(this.templates.overlay); - // insert loading indicator into overlay - jQuery('#mailpoet_modal_overlay').append(this.templates.loading); - } - return this; - }, - toggleOverlay: function(toggle) { - if(toggle === true) { - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_hidden'); - } else { - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_hidden'); - } - - return this; - }, - setupEvents: function() { - // close popup when user clicks on close button - jQuery('#mailpoet_modal_close').on('click', this.cancel.bind(this)); - - // close popup when user clicks on overlay - jQuery('#mailpoet_modal_overlay').on('click', function(e) { - // we need to make sure that we are actually clicking on the overlay - // because when clicking on the popup content, it will trigger the click - // event on the overlay - if(e.target.id === 'mailpoet_modal_overlay') { this.cancel(); } - }.bind(this)); - - // close popup when user presses ESC key - jQuery(document).on('keyup.mailpoet_modal', function(e) { - if(this.opened === false) { return false; } - if(e.keyCode === 27) { this.cancel(); } - }.bind(this)); - - // make sure the popup is repositioned when the window is resized - jQuery(window).on('resize.mailpoet_modal', function() { - this.setPosition(); - }.bind(this)); - - return this; - }, - removeEvents: function() { - jQuery(document).unbind('keyup.mailpoet_modal'); - jQuery(window).unbind('resize.mailpoet_modal'); - jQuery('#mailpoet_modal_close').off('click'); - if(this.options.overlay === true) { - jQuery('#mailpoet_modal_overlay').off('click'); - } - - return this; - }, - lock: function() { - this.locked = true; - - return this; - }, - unlock: function() { - this.locked = false; - - return this; - }, - isLocked: function() { - return this.locked; - }, - loadTemplate: function() { - if(this.subpanels.length > 0) { - // hide panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').hide(); - - // add sub panel wrapper - jQuery('#mailpoet_'+this.options.type).append(this.templates['subpanel']); - - // add sub panel content - jQuery('.mailpoet_'+this.options.type+'_body').last().html(this.subpanels[(this.subpanels.length - 1)].element); - } else if (this.options.element) { - jQuery('.mailpoet_'+this.options.type+'_body').empty(); - jQuery('.mailpoet_'+this.options.type+'_body').append(this.options.element); - } else { - jQuery('.mailpoet_'+this.options.type+'_body').html( - this.options.body_template( - this.options.data - ) - ); - } - - return this; - }, - loadUrl: function() { - if(this.options.method === 'get') { - // make ajax request - jQuery.getJSON(this.options.url, function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this)); - } else if(this.options.method === 'post') { - // make ajax request - jQuery.post(this.options.url, JSON.stringify(this.options.params), function(data) { - // merge returned data with existing data passed when calling the "open" method - this.options.data = jQuery.extend({}, this.options.data, data); - // load template using fetched data - this.loadTemplate(); - // show modal window - this.showModal(); - }.bind(this), 'json'); - } - - return this; - }, - setDimensions: function() { - switch(this.options.type) { - case 'popup': - // set popup dimensions - jQuery('#mailpoet_popup').css({ - width: this.options.width, - minHeight: this.options.height - }); - // set popup wrapper height - jQuery('#mailpoet_popup_wrapper').css({ height: this.options.height}); - break; - case 'panel': - // set dimensions - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - right: 0, - marginRight: '-' + this.options.width, - left: 'auto' - }); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css({ - width: this.options.width, - left: 0, - marginLeft: '-' + this.options.width, - right: 'auto' - }); - } - jQuery('#mailpoet_panel').css({ minHeight: 'auto' }); - break; - } - - return this; - }, - setPosition: function() { - switch(this.options.type) { - case 'popup': - var screenWidth = jQuery(window).width(), - screenHeight = jQuery(window).height(), - modalWidth = jQuery('.mailpoet_'+ this.options.type +'_wrapper').width(), - modalHeight = jQuery('.mailpoet_'+ this.options.type +'_wrapper').height(); - - var top = Math.max(48, parseInt((screenHeight / 2) - (modalHeight / 2))), - left = Math.max(0, parseInt((screenWidth / 2) - (modalWidth / 2))); - - // set position of popup depending on screen dimensions. - jQuery('#mailpoet_popup').css({ - top: top, - left: left - }); - break; - case 'panel': - setTimeout(function() { - // set position of popup depending on screen dimensions. - if(this.options.position === 'right') { - jQuery('#mailpoet_panel').css( - { marginRight: 0 } - ); - } else if(this.options.position === 'left') { - jQuery('#mailpoet_panel').css( - { marginLeft: 0 } - ); - } - }.bind(this), 0); - break; - } - - return this; - }, - showModal: function() { - // set modal dimensions - this.setDimensions(); - - // add a flag on the body so that we can prevent scrolling (setting overflow hidden) - jQuery('body').addClass('mailpoet_modal_opened'); - - // show popup - jQuery('#mailpoet_'+this.options.type).show(); - - // display overlay - this.showOverlay(); - - // set modal position - this.setPosition(); - - // add class on highlighted elements - if(this.options.highlight !== null) { - if(this.options.highlight.length > 0) { - this.highlightOn(this.options.highlight); - } - } - - // set popup as opened - this.opened = true; - - // trigger init event if specified - if(this.options.onInit !== null) { - this.options.onInit(); - } - - return this; - }, - highlightOn: function(element) { - jQuery(element).addClass('mailpoet_modal_highlight'); - return this; - }, - highlightOff: function() { - jQuery('.mailpoet_modal_highlight').removeClass('mailpoet_modal_highlight'); - return this; - }, - hideModal: function(callback) { - // set modal as closed - this.opened = false; - - // hide modal - jQuery('#mailpoet_'+this.options.type).hide(); - - // remove class on highlighted elements - this.highlightOff(); - - // remove class from body to let it be scrollable - jQuery('body').removeClass('mailpoet_modal_opened'); - - return this; - }, - showOverlay: function(force) { - jQuery('#mailpoet_modal_overlay').show(); - return this; - }, - hideOverlay: function() { - jQuery('#mailpoet_modal_overlay').hide(); - return this; - }, - popup: function(options) { - // get options - options = options || {}; - // set modal type - options.type = 'popup'; - // set overlay state - options.overlay = options.overlay || true; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - panel: function(options) { - // get options - options = options || {}; - // reset subpanels - this.subpanels = []; - // set modal type - options.type = 'panel'; - // set overlay state - options.overlay = options.overlay || false; - // set highlighted element - options.highlight = options.highlight || null; - // set modal dimensions - options.width = options.width || '40%'; - options.height = options.height || 'auto'; - // initialize modal - this.init(options); - // open modal - this.open(); - - return this; - }, - subpanel: function(options) { - if(this.opened === false) { - // if no panel is already opened, let's create one instead - this.panel(options); - } else { - // if a panel is already opened, add a sub panel to it - this.subpanels.push(options); - this.loadTemplate(); - } - - return this; - }, - loading: function(toggle) { - // make sure the overlay is initialized and that it's visible - this.initOverlay(true); - - if(toggle === true) { - this.showLoading(); - } else { - this.hideLoading(); - } - - return this; - }, - showLoading: function() { - jQuery('#mailpoet_loading').show(); - - // add loading class to overlay - jQuery('#mailpoet_modal_overlay').addClass('mailpoet_overlay_loading'); - - return this; - }, - hideLoading: function() { - jQuery('#mailpoet_loading').hide(); - - // remove loading class from overlay - jQuery('#mailpoet_modal_overlay').removeClass('mailpoet_overlay_loading'); - - return this; - }, - open: function() { - // load template if specified - if(this.options.template !== null) { - // check if a url was specified to get extra data - if(this.options.url !== null) { - this.loadUrl(); - } else { - // load template - this.loadTemplate(); - - // show modal window - this.showModal(); - } - } else { - this.cancel(); - } - - return this; - }, - success: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onSuccess !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onSuccess(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onSuccess !== null) { - this.options.onSuccess(this.options.data); - } - } - this.close(); - - return this; - }, - cancel: function() { - if(this.subpanels.length > 0) { - if(this.subpanels[(this.subpanels.length - 1)].onCancel !== undefined) { - this.subpanels[(this.subpanels.length - 1)].onCancel(this.subpanels[(this.subpanels.length - 1)].data); - } - } else { - if(this.options.onCancel !== null) { - this.options.onCancel(this.options.data); - } - } - this.close(); - - return this; - }, - destroy: function() { - this.hideOverlay(); - - // remove extra modal - if(jQuery('#mailpoet_'+this.options.type).length > 0) { - jQuery('#mailpoet_'+this.options.type).remove(); - } - - this.initialized = false; - - return this; - }, - close: function() { - if(this.isLocked() === true) return this; - - if(this.subpanels.length > 0) { - - // close subpanel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().remove(); - - // show previous panel - jQuery('.mailpoet_'+this.options.type+'_wrapper').last().show(); - - // remove last subpanels - this.subpanels.pop(); - - return this; - } - - // remove event handlers - this.removeEvents(); - - // hide modal window - this.hideModal(); - - // destroy modal element - this.destroy(); - - // reset options - this.options = { - onSuccess: null, - onCancel: null - }; - - return this; - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 6 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_RESULT__ = function(MailPoet, jQuery) { - "use strict"; - /*================================================================================================== - - MailPoet Notice: - - description: Handles notices - version: 0.2 - author: Jonathan Labreuille - company: Wysija - dependencies: jQuery - - Usage: - - // success message (static: false) - MailPoet.Notice.success('Yatta!'); - - // error message (static: false) - MailPoet.Notice.error('Boo!'); - - // system message (static: true) - MailPoet.Notice.system('You need to updated ASAP!'); - - Examples: - - MailPoet.Notice.success('- success #1 -'); - setTimeout(function() { - MailPoet.Notice.success('- success #2 -'); - setTimeout(function() { - MailPoet.Notice.error('- error -'); - setTimeout(function() { - MailPoet.Notice.system('- system -'); - - setTimeout(function() { - MailPoet.Notice.hide(); - }, 2500); - }, 300); - }, 400); - }, 500); - - ==================================================================================================*/ - - MailPoet.Notice = { - version: 0.2, - // default options - defaults: { - type: 'success', - message: '', - static: false, - scroll: false, - timeout: 2000, - onOpen: null, - onClose: null - }, - options: {}, - init: function(options) { - // set options - this.options = jQuery.extend({}, this.defaults, options); - - // clone element - this.element = jQuery('#mailpoet_notice_'+this.options.type).clone(); - - // remove id from clone - this.element.removeAttr('id'); - - // insert notice after its parent - jQuery('#mailpoet_notice_'+this.options.type).after(this.element); - - // setup onClose callback - var onClose = null; - if(this.options.onClose !== null) { - onClose = this.options.onClose; - } - - // listen to remove event - var element = this.element; - jQuery(this.element).on('close', function() { - jQuery(this).fadeOut(200, function() { - // on close callback - if(onClose !== null) { - onClose(); - } - // remove notice - jQuery(this).remove(); - }); - }.bind(this.element)); - - // listen to message event - jQuery(this.element).on('message', function(e, message) { - MailPoet.Notice.setMessage(message); - }.bind(this.element)); - - return this; - }, - isHTML: function(str) { - var a = document.createElement('div'); - a.innerHTML = str; - for(var c = a.childNodes, i = c.length; i--;) { - if(c[i].nodeType == 1) return true; - } - return false; - }, - setMessage: function(message) { - // if it's not an html message, let's sugar coat the message with a fancy

- if(this.isHTML(message) === false) { - message = '

'+message+'

'; - } - // set message - return this.element.html(message); - }, - show: function(options) { - // initialize - this.init(options); - - // show notice - this.showNotice(); - - // return this; - }, - showNotice: function() { - // set message - this.setMessage(this.options.message); - - // make the notice appear - this.element.fadeIn(200); - - // if scroll option is enabled, scroll to the notice - if(this.options.scroll === true) { - this.element.get(0).scrollIntoView(false); - } - - // if the notice is not static, it has to disappear after a timeout - if(this.options.static === false) { - this.element.delay(this.options.timeout).trigger('close'); - } else { - this.element.append(''); - this.element.find('.mailpoet_notice_close').on('click', function() { - jQuery(this).trigger('close'); - }); - } - - // call onOpen callback - if(this.options.onOpen !== null) { - this.options.onOpen(this.element); - } - }, - hide: function(all) { - if(all !== undefined && all === true) { - jQuery('.mailpoet_notice:not([id])').trigger('close'); - } else { - jQuery('.mailpoet_notice.updated:not([id]), .mailpoet_notice.error:not([id])') - .trigger('close'); - } - }, - error: function(message, options) { - this.show(jQuery.extend({}, { - type: 'error', - message: '

'+message+'

' - }, options)); - }, - success: function(message, options) { - this.show(jQuery.extend({}, { - type: 'success', - message: '

'+message+'

' - }, options)); - }, - system: function(message, options) { - this.show(jQuery.extend({}, { - type: 'system', - static: true, - message: message - }, options)); - } - }; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -]); \ No newline at end of file diff --git a/assets/js/vendor.js b/assets/js/vendor.js deleted file mode 100644 index 7fdad85f55..0000000000 --- a/assets/js/vendor.js +++ /dev/null @@ -1,4381 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ var parentJsonpFunction = window["webpackJsonp"]; -/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules) { -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, callbacks = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) -/******/ callbacks.push.apply(callbacks, installedChunks[chunkId]); -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules); -/******/ while(callbacks.length) -/******/ callbacks.shift().call(null, __webpack_require__); -/******/ if(moreModules[0]) { -/******/ installedModules[0] = 0; -/******/ return __webpack_require__(0); -/******/ } -/******/ }; - -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // object to store loaded and loading chunks -/******/ // "0" means "already loaded" -/******/ // Array means "loading", array contains callbacks -/******/ var installedChunks = { -/******/ 2:0 -/******/ }; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - -/******/ // This file contains only the entry chunk. -/******/ // The chunk loading function for additional chunks -/******/ __webpack_require__.e = function requireEnsure(chunkId, callback) { -/******/ // "0" is the signal for "already loaded" -/******/ if(installedChunks[chunkId] === 0) -/******/ return callback.call(null, __webpack_require__); - -/******/ // an array means "currently loading". -/******/ if(installedChunks[chunkId] !== undefined) { -/******/ installedChunks[chunkId].push(callback); -/******/ } else { -/******/ // start chunk loading -/******/ installedChunks[chunkId] = [callback]; -/******/ var head = document.getElementsByTagName('head')[0]; -/******/ var script = document.createElement('script'); -/******/ script.type = 'text/javascript'; -/******/ script.charset = 'utf-8'; -/******/ script.async = true; - -/******/ script.src = __webpack_require__.p + "" + chunkId + "." + ({"0":"admin","1":"mailpoet"}[chunkId]||chunkId) + ".js"; -/******/ head.appendChild(script); -/******/ } -/******/ }; - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - __webpack_require__(3); - module.exports = __webpack_require__(7); - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { - // A placeholder for MailPoet object - var MailPoet = {}; - - // Expose MailPoet globally - window.MailPoet = MailPoet; - - return MailPoet; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - module.exports = jQuery; - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - /*! - - handlebars v3.0.3 - - Copyright (C) 2011-2014 by Yehuda Katz - - 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. - - @license - */ - (function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define(factory); - else if(typeof exports === 'object') - exports["Handlebars"] = factory(); - else - root["Handlebars"] = factory(); - })(this, function() { - return /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; - - /******/ // The require function - /******/ function __webpack_require__(moduleId) { - - /******/ // Check if module is in cache - /******/ if(installedModules[moduleId]) - /******/ return installedModules[moduleId].exports; - - /******/ // Create a new module (and put it into the cache) - /******/ var module = installedModules[moduleId] = { - /******/ exports: {}, - /******/ id: moduleId, - /******/ loaded: false - /******/ }; - - /******/ // Execute the module function - /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - - /******/ // Flag the module as loaded - /******/ module.loaded = true; - - /******/ // Return the exports of the module - /******/ return module.exports; - /******/ } - - - /******/ // expose the modules object (__webpack_modules__) - /******/ __webpack_require__.m = modules; - - /******/ // expose the module cache - /******/ __webpack_require__.c = installedModules; - - /******/ // __webpack_public_path__ - /******/ __webpack_require__.p = ""; - - /******/ // Load entry module and return exports - /******/ return __webpack_require__(0); - /******/ }) - /************************************************************************/ - /******/ ([ - /* 0 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - - var _runtime = __webpack_require__(1); - - var _runtime2 = _interopRequireWildcard(_runtime); - - // Compiler imports - - var _AST = __webpack_require__(2); - - var _AST2 = _interopRequireWildcard(_AST); - - var _Parser$parse = __webpack_require__(3); - - var _Compiler$compile$precompile = __webpack_require__(4); - - var _JavaScriptCompiler = __webpack_require__(5); - - var _JavaScriptCompiler2 = _interopRequireWildcard(_JavaScriptCompiler); - - var _Visitor = __webpack_require__(6); - - var _Visitor2 = _interopRequireWildcard(_Visitor); - - var _noConflict = __webpack_require__(7); - - var _noConflict2 = _interopRequireWildcard(_noConflict); - - var _create = _runtime2['default'].create; - function create() { - var hb = _create(); - - hb.compile = function (input, options) { - return _Compiler$compile$precompile.compile(input, options, hb); - }; - hb.precompile = function (input, options) { - return _Compiler$compile$precompile.precompile(input, options, hb); - }; - - hb.AST = _AST2['default']; - hb.Compiler = _Compiler$compile$precompile.Compiler; - hb.JavaScriptCompiler = _JavaScriptCompiler2['default']; - hb.Parser = _Parser$parse.parser; - hb.parse = _Parser$parse.parse; - - return hb; - } - - var inst = create(); - inst.create = create; - - _noConflict2['default'](inst); - - inst.Visitor = _Visitor2['default']; - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - - /***/ }, - /* 1 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - - var _import = __webpack_require__(9); - - var base = _interopRequireWildcard(_import); - - // Each of these augment the Handlebars object. No need to setup here. - // (This is done to easily share code between commonjs and browse envs) - - var _SafeString = __webpack_require__(10); - - var _SafeString2 = _interopRequireWildcard(_SafeString); - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _import2 = __webpack_require__(12); - - var Utils = _interopRequireWildcard(_import2); - - var _import3 = __webpack_require__(13); - - var runtime = _interopRequireWildcard(_import3); - - var _noConflict = __webpack_require__(7); - - var _noConflict2 = _interopRequireWildcard(_noConflict); - - // For compatibility and usage outside of module systems, make the Handlebars object a namespace - function create() { - var hb = new base.HandlebarsEnvironment(); - - Utils.extend(hb, base); - hb.SafeString = _SafeString2['default']; - hb.Exception = _Exception2['default']; - hb.Utils = Utils; - hb.escapeExpression = Utils.escapeExpression; - - hb.VM = runtime; - hb.template = function (spec) { - return runtime.template(spec, hb); - }; - - return hb; - } - - var inst = create(); - inst.create = create; - - _noConflict2['default'](inst); - - inst['default'] = inst; - - exports['default'] = inst; - module.exports = exports['default']; - - /***/ }, - /* 2 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - var AST = { - Program: function Program(statements, blockParams, strip, locInfo) { - this.loc = locInfo; - this.type = 'Program'; - this.body = statements; - - this.blockParams = blockParams; - this.strip = strip; - }, - - MustacheStatement: function MustacheStatement(path, params, hash, escaped, strip, locInfo) { - this.loc = locInfo; - this.type = 'MustacheStatement'; - - this.path = path; - this.params = params || []; - this.hash = hash; - this.escaped = escaped; - - this.strip = strip; - }, - - BlockStatement: function BlockStatement(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) { - this.loc = locInfo; - this.type = 'BlockStatement'; - - this.path = path; - this.params = params || []; - this.hash = hash; - this.program = program; - this.inverse = inverse; - - this.openStrip = openStrip; - this.inverseStrip = inverseStrip; - this.closeStrip = closeStrip; - }, - - PartialStatement: function PartialStatement(name, params, hash, strip, locInfo) { - this.loc = locInfo; - this.type = 'PartialStatement'; - - this.name = name; - this.params = params || []; - this.hash = hash; - - this.indent = ''; - this.strip = strip; - }, - - ContentStatement: function ContentStatement(string, locInfo) { - this.loc = locInfo; - this.type = 'ContentStatement'; - this.original = this.value = string; - }, - - CommentStatement: function CommentStatement(comment, strip, locInfo) { - this.loc = locInfo; - this.type = 'CommentStatement'; - this.value = comment; - - this.strip = strip; - }, - - SubExpression: function SubExpression(path, params, hash, locInfo) { - this.loc = locInfo; - - this.type = 'SubExpression'; - this.path = path; - this.params = params || []; - this.hash = hash; - }, - - PathExpression: function PathExpression(data, depth, parts, original, locInfo) { - this.loc = locInfo; - this.type = 'PathExpression'; - - this.data = data; - this.original = original; - this.parts = parts; - this.depth = depth; - }, - - StringLiteral: function StringLiteral(string, locInfo) { - this.loc = locInfo; - this.type = 'StringLiteral'; - this.original = this.value = string; - }, - - NumberLiteral: function NumberLiteral(number, locInfo) { - this.loc = locInfo; - this.type = 'NumberLiteral'; - this.original = this.value = Number(number); - }, - - BooleanLiteral: function BooleanLiteral(bool, locInfo) { - this.loc = locInfo; - this.type = 'BooleanLiteral'; - this.original = this.value = bool === 'true'; - }, - - UndefinedLiteral: function UndefinedLiteral(locInfo) { - this.loc = locInfo; - this.type = 'UndefinedLiteral'; - this.original = this.value = undefined; - }, - - NullLiteral: function NullLiteral(locInfo) { - this.loc = locInfo; - this.type = 'NullLiteral'; - this.original = this.value = null; - }, - - Hash: function Hash(pairs, locInfo) { - this.loc = locInfo; - this.type = 'Hash'; - this.pairs = pairs; - }, - HashPair: function HashPair(key, value, locInfo) { - this.loc = locInfo; - this.type = 'HashPair'; - this.key = key; - this.value = value; - }, - - // Public API used to evaluate derived attributes regarding AST nodes - helpers: { - // a mustache is definitely a helper if: - // * it is an eligible helper, and - // * it has at least one parameter or hash segment - helperExpression: function helperExpression(node) { - return !!(node.type === 'SubExpression' || node.params.length || node.hash); - }, - - scopedId: function scopedId(path) { - return /^\.|this\b/.test(path.original); - }, - - // an ID is simple if it only has one part, and that part is not - // `..` or `this`. - simpleId: function simpleId(path) { - return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth; - } - } - }; - - // Must be exported as an object rather than the root of the module as the jison lexer - // must modify the object to operate properly. - exports['default'] = AST; - module.exports = exports['default']; - - /***/ }, - /* 3 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - exports.parse = parse; - - var _parser = __webpack_require__(14); - - var _parser2 = _interopRequireWildcard(_parser); - - var _AST = __webpack_require__(2); - - var _AST2 = _interopRequireWildcard(_AST); - - var _WhitespaceControl = __webpack_require__(15); - - var _WhitespaceControl2 = _interopRequireWildcard(_WhitespaceControl); - - var _import = __webpack_require__(16); - - var Helpers = _interopRequireWildcard(_import); - - var _extend = __webpack_require__(12); - - exports.parser = _parser2['default']; - - var yy = {}; - _extend.extend(yy, Helpers, _AST2['default']); - - function parse(input, options) { - // Just return if an already-compiled AST was passed in. - if (input.type === 'Program') { - return input; - } - - _parser2['default'].yy = yy; - - // Altering the shared object here, but this is ok as parser is a sync operation - yy.locInfo = function (locInfo) { - return new yy.SourceLocation(options && options.srcName, locInfo); - }; - - var strip = new _WhitespaceControl2['default'](); - return strip.accept(_parser2['default'].parse(input)); - } - - /***/ }, - /* 4 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - exports.Compiler = Compiler; - exports.precompile = precompile; - exports.compile = compile; - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _isArray$indexOf = __webpack_require__(12); - - var _AST = __webpack_require__(2); - - var _AST2 = _interopRequireWildcard(_AST); - - var slice = [].slice; - - function Compiler() {} - - // the foundHelper register will disambiguate helper lookup from finding a - // function in a context. This is necessary for mustache compatibility, which - // requires that context functions in blocks are evaluated by blockHelperMissing, - // and then proceed as if the resulting value was provided to blockHelperMissing. - - Compiler.prototype = { - compiler: Compiler, - - equals: function equals(other) { - var len = this.opcodes.length; - if (other.opcodes.length !== len) { - return false; - } - - for (var i = 0; i < len; i++) { - var opcode = this.opcodes[i], - otherOpcode = other.opcodes[i]; - if (opcode.opcode !== otherOpcode.opcode || !argEquals(opcode.args, otherOpcode.args)) { - return false; - } - } - - // We know that length is the same between the two arrays because they are directly tied - // to the opcode behavior above. - len = this.children.length; - for (var i = 0; i < len; i++) { - if (!this.children[i].equals(other.children[i])) { - return false; - } - } - - return true; - }, - - guid: 0, - - compile: function compile(program, options) { - this.sourceNode = []; - this.opcodes = []; - this.children = []; - this.options = options; - this.stringParams = options.stringParams; - this.trackIds = options.trackIds; - - options.blockParams = options.blockParams || []; - - // These changes will propagate to the other compiler components - var knownHelpers = options.knownHelpers; - options.knownHelpers = { - helperMissing: true, - blockHelperMissing: true, - each: true, - 'if': true, - unless: true, - 'with': true, - log: true, - lookup: true - }; - if (knownHelpers) { - for (var _name in knownHelpers) { - if (_name in knownHelpers) { - options.knownHelpers[_name] = knownHelpers[_name]; - } - } - } - - return this.accept(program); - }, - - compileProgram: function compileProgram(program) { - var childCompiler = new this.compiler(), - // eslint-disable-line new-cap - result = childCompiler.compile(program, this.options), - guid = this.guid++; - - this.usePartial = this.usePartial || result.usePartial; - - this.children[guid] = result; - this.useDepths = this.useDepths || result.useDepths; - - return guid; - }, - - accept: function accept(node) { - this.sourceNode.unshift(node); - var ret = this[node.type](node); - this.sourceNode.shift(); - return ret; - }, - - Program: function Program(program) { - this.options.blockParams.unshift(program.blockParams); - - var body = program.body, - bodyLength = body.length; - for (var i = 0; i < bodyLength; i++) { - this.accept(body[i]); - } - - this.options.blockParams.shift(); - - this.isSimple = bodyLength === 1; - this.blockParams = program.blockParams ? program.blockParams.length : 0; - - return this; - }, - - BlockStatement: function BlockStatement(block) { - transformLiteralToPath(block); - - var program = block.program, - inverse = block.inverse; - - program = program && this.compileProgram(program); - inverse = inverse && this.compileProgram(inverse); - - var type = this.classifySexpr(block); - - if (type === 'helper') { - this.helperSexpr(block, program, inverse); - } else if (type === 'simple') { - this.simpleSexpr(block); - - // now that the simple mustache is resolved, we need to - // evaluate it by executing `blockHelperMissing` - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - this.opcode('emptyHash'); - this.opcode('blockValue', block.path.original); - } else { - this.ambiguousSexpr(block, program, inverse); - - // now that the simple mustache is resolved, we need to - // evaluate it by executing `blockHelperMissing` - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - this.opcode('emptyHash'); - this.opcode('ambiguousBlockValue'); - } - - this.opcode('append'); - }, - - PartialStatement: function PartialStatement(partial) { - this.usePartial = true; - - var params = partial.params; - if (params.length > 1) { - throw new _Exception2['default']('Unsupported number of partial arguments: ' + params.length, partial); - } else if (!params.length) { - params.push({ type: 'PathExpression', parts: [], depth: 0 }); - } - - var partialName = partial.name.original, - isDynamic = partial.name.type === 'SubExpression'; - if (isDynamic) { - this.accept(partial.name); - } - - this.setupFullMustacheParams(partial, undefined, undefined, true); - - var indent = partial.indent || ''; - if (this.options.preventIndent && indent) { - this.opcode('appendContent', indent); - indent = ''; - } - - this.opcode('invokePartial', isDynamic, partialName, indent); - this.opcode('append'); - }, - - MustacheStatement: function MustacheStatement(mustache) { - this.SubExpression(mustache); // eslint-disable-line new-cap - - if (mustache.escaped && !this.options.noEscape) { - this.opcode('appendEscaped'); - } else { - this.opcode('append'); - } - }, - - ContentStatement: function ContentStatement(content) { - if (content.value) { - this.opcode('appendContent', content.value); - } - }, - - CommentStatement: function CommentStatement() {}, - - SubExpression: function SubExpression(sexpr) { - transformLiteralToPath(sexpr); - var type = this.classifySexpr(sexpr); - - if (type === 'simple') { - this.simpleSexpr(sexpr); - } else if (type === 'helper') { - this.helperSexpr(sexpr); - } else { - this.ambiguousSexpr(sexpr); - } - }, - ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) { - var path = sexpr.path, - name = path.parts[0], - isBlock = program != null || inverse != null; - - this.opcode('getContext', path.depth); - - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - - this.accept(path); - - this.opcode('invokeAmbiguous', name, isBlock); - }, - - simpleSexpr: function simpleSexpr(sexpr) { - this.accept(sexpr.path); - this.opcode('resolvePossibleLambda'); - }, - - helperSexpr: function helperSexpr(sexpr, program, inverse) { - var params = this.setupFullMustacheParams(sexpr, program, inverse), - path = sexpr.path, - name = path.parts[0]; - - if (this.options.knownHelpers[name]) { - this.opcode('invokeKnownHelper', params.length, name); - } else if (this.options.knownHelpersOnly) { - throw new _Exception2['default']('You specified knownHelpersOnly, but used the unknown helper ' + name, sexpr); - } else { - path.falsy = true; - - this.accept(path); - this.opcode('invokeHelper', params.length, path.original, _AST2['default'].helpers.simpleId(path)); - } - }, - - PathExpression: function PathExpression(path) { - this.addDepth(path.depth); - this.opcode('getContext', path.depth); - - var name = path.parts[0], - scoped = _AST2['default'].helpers.scopedId(path), - blockParamId = !path.depth && !scoped && this.blockParamIndex(name); - - if (blockParamId) { - this.opcode('lookupBlockParam', blockParamId, path.parts); - } else if (!name) { - // Context reference, i.e. `{{foo .}}` or `{{foo ..}}` - this.opcode('pushContext'); - } else if (path.data) { - this.options.data = true; - this.opcode('lookupData', path.depth, path.parts); - } else { - this.opcode('lookupOnContext', path.parts, path.falsy, scoped); - } - }, - - StringLiteral: function StringLiteral(string) { - this.opcode('pushString', string.value); - }, - - NumberLiteral: function NumberLiteral(number) { - this.opcode('pushLiteral', number.value); - }, - - BooleanLiteral: function BooleanLiteral(bool) { - this.opcode('pushLiteral', bool.value); - }, - - UndefinedLiteral: function UndefinedLiteral() { - this.opcode('pushLiteral', 'undefined'); - }, - - NullLiteral: function NullLiteral() { - this.opcode('pushLiteral', 'null'); - }, - - Hash: function Hash(hash) { - var pairs = hash.pairs, - i = 0, - l = pairs.length; - - this.opcode('pushHash'); - - for (; i < l; i++) { - this.pushParam(pairs[i].value); - } - while (i--) { - this.opcode('assignToHash', pairs[i].key); - } - this.opcode('popHash'); - }, - - // HELPERS - opcode: function opcode(name) { - this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc }); - }, - - addDepth: function addDepth(depth) { - if (!depth) { - return; - } - - this.useDepths = true; - }, - - classifySexpr: function classifySexpr(sexpr) { - var isSimple = _AST2['default'].helpers.simpleId(sexpr.path); - - var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]); - - // a mustache is an eligible helper if: - // * its id is simple (a single part, not `this` or `..`) - var isHelper = !isBlockParam && _AST2['default'].helpers.helperExpression(sexpr); - - // if a mustache is an eligible helper but not a definite - // helper, it is ambiguous, and will be resolved in a later - // pass or at runtime. - var isEligible = !isBlockParam && (isHelper || isSimple); - - // if ambiguous, we can possibly resolve the ambiguity now - // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc. - if (isEligible && !isHelper) { - var _name2 = sexpr.path.parts[0], - options = this.options; - - if (options.knownHelpers[_name2]) { - isHelper = true; - } else if (options.knownHelpersOnly) { - isEligible = false; - } - } - - if (isHelper) { - return 'helper'; - } else if (isEligible) { - return 'ambiguous'; - } else { - return 'simple'; - } - }, - - pushParams: function pushParams(params) { - for (var i = 0, l = params.length; i < l; i++) { - this.pushParam(params[i]); - } - }, - - pushParam: function pushParam(val) { - var value = val.value != null ? val.value : val.original || ''; - - if (this.stringParams) { - if (value.replace) { - value = value.replace(/^(\.?\.\/)*/g, '').replace(/\//g, '.'); - } - - if (val.depth) { - this.addDepth(val.depth); - } - this.opcode('getContext', val.depth || 0); - this.opcode('pushStringParam', value, val.type); - - if (val.type === 'SubExpression') { - // SubExpressions get evaluated and passed in - // in string params mode. - this.accept(val); - } - } else { - if (this.trackIds) { - var blockParamIndex = undefined; - if (val.parts && !_AST2['default'].helpers.scopedId(val) && !val.depth) { - blockParamIndex = this.blockParamIndex(val.parts[0]); - } - if (blockParamIndex) { - var blockParamChild = val.parts.slice(1).join('.'); - this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild); - } else { - value = val.original || value; - if (value.replace) { - value = value.replace(/^\.\//g, '').replace(/^\.$/g, ''); - } - - this.opcode('pushId', val.type, value); - } - } - this.accept(val); - } - }, - - setupFullMustacheParams: function setupFullMustacheParams(sexpr, program, inverse, omitEmpty) { - var params = sexpr.params; - this.pushParams(params); - - this.opcode('pushProgram', program); - this.opcode('pushProgram', inverse); - - if (sexpr.hash) { - this.accept(sexpr.hash); - } else { - this.opcode('emptyHash', omitEmpty); - } - - return params; - }, - - blockParamIndex: function blockParamIndex(name) { - for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) { - var blockParams = this.options.blockParams[depth], - param = blockParams && _isArray$indexOf.indexOf(blockParams, name); - if (blockParams && param >= 0) { - return [depth, param]; - } - } - } - }; - - function precompile(input, options, env) { - if (input == null || typeof input !== 'string' && input.type !== 'Program') { - throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.precompile. You passed ' + input); - } - - options = options || {}; - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var ast = env.parse(input, options), - environment = new env.Compiler().compile(ast, options); - return new env.JavaScriptCompiler().compile(environment, options); - } - - function compile(input, _x, env) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - if (input == null || typeof input !== 'string' && input.type !== 'Program') { - throw new _Exception2['default']('You must pass a string or Handlebars AST to Handlebars.compile. You passed ' + input); - } - - if (!('data' in options)) { - options.data = true; - } - if (options.compat) { - options.useDepths = true; - } - - var compiled = undefined; - - function compileInput() { - var ast = env.parse(input, options), - environment = new env.Compiler().compile(ast, options), - templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); - return env.template(templateSpec); - } - - // Template is only compiled on first use and cached after that point. - function ret(context, execOptions) { - if (!compiled) { - compiled = compileInput(); - } - return compiled.call(this, context, execOptions); - } - ret._setup = function (setupOptions) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._setup(setupOptions); - }; - ret._child = function (i, data, blockParams, depths) { - if (!compiled) { - compiled = compileInput(); - } - return compiled._child(i, data, blockParams, depths); - }; - return ret; - } - - function argEquals(a, b) { - if (a === b) { - return true; - } - - if (_isArray$indexOf.isArray(a) && _isArray$indexOf.isArray(b) && a.length === b.length) { - for (var i = 0; i < a.length; i++) { - if (!argEquals(a[i], b[i])) { - return false; - } - } - return true; - } - } - - function transformLiteralToPath(sexpr) { - if (!sexpr.path.parts) { - var literal = sexpr.path; - // Casting to string here to make false and 0 literal values play nicely with the rest - // of the system. - sexpr.path = new _AST2['default'].PathExpression(false, 0, [literal.original + ''], literal.original + '', literal.loc); - } - } - - /***/ }, - /* 5 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - - var _COMPILER_REVISION$REVISION_CHANGES = __webpack_require__(9); - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _isArray = __webpack_require__(12); - - var _CodeGen = __webpack_require__(17); - - var _CodeGen2 = _interopRequireWildcard(_CodeGen); - - function Literal(value) { - this.value = value; - } - - function JavaScriptCompiler() {} - - JavaScriptCompiler.prototype = { - // PUBLIC API: You can override these methods in a subclass to provide - // alternative compiled forms for name lookup and buffering semantics - nameLookup: function nameLookup(parent, name /* , type*/) { - if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { - return [parent, '.', name]; - } else { - return [parent, '[\'', name, '\']']; - } - }, - depthedLookup: function depthedLookup(name) { - return [this.aliasable('this.lookup'), '(depths, "', name, '")']; - }, - - compilerInfo: function compilerInfo() { - var revision = _COMPILER_REVISION$REVISION_CHANGES.COMPILER_REVISION, - versions = _COMPILER_REVISION$REVISION_CHANGES.REVISION_CHANGES[revision]; - return [revision, versions]; - }, - - appendToBuffer: function appendToBuffer(source, location, explicit) { - // Force a source as this simplifies the merge logic. - if (!_isArray.isArray(source)) { - source = [source]; - } - source = this.source.wrap(source, location); - - if (this.environment.isSimple) { - return ['return ', source, ';']; - } else if (explicit) { - // This is a case where the buffer operation occurs as a child of another - // construct, generally braces. We have to explicitly output these buffer - // operations to ensure that the emitted code goes in the correct location. - return ['buffer += ', source, ';']; - } else { - source.appendToBuffer = true; - return source; - } - }, - - initializeBuffer: function initializeBuffer() { - return this.quotedString(''); - }, - // END PUBLIC API - - compile: function compile(environment, options, context, asObject) { - this.environment = environment; - this.options = options; - this.stringParams = this.options.stringParams; - this.trackIds = this.options.trackIds; - this.precompile = !asObject; - - this.name = this.environment.name; - this.isChild = !!context; - this.context = context || { - programs: [], - environments: [] - }; - - this.preamble(); - - this.stackSlot = 0; - this.stackVars = []; - this.aliases = {}; - this.registers = { list: [] }; - this.hashes = []; - this.compileStack = []; - this.inlineStack = []; - this.blockParams = []; - - this.compileChildren(environment, options); - - this.useDepths = this.useDepths || environment.useDepths || this.options.compat; - this.useBlockParams = this.useBlockParams || environment.useBlockParams; - - var opcodes = environment.opcodes, - opcode = undefined, - firstLoc = undefined, - i = undefined, - l = undefined; - - for (i = 0, l = opcodes.length; i < l; i++) { - opcode = opcodes[i]; - - this.source.currentLocation = opcode.loc; - firstLoc = firstLoc || opcode.loc; - this[opcode.opcode].apply(this, opcode.args); - } - - // Flush any trailing content that might be pending. - this.source.currentLocation = firstLoc; - this.pushSource(''); - - /* istanbul ignore next */ - if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { - throw new _Exception2['default']('Compile completed with content left on stack'); - } - - var fn = this.createFunctionContext(asObject); - if (!this.isChild) { - var ret = { - compiler: this.compilerInfo(), - main: fn - }; - var programs = this.context.programs; - for (i = 0, l = programs.length; i < l; i++) { - if (programs[i]) { - ret[i] = programs[i]; - } - } - - if (this.environment.usePartial) { - ret.usePartial = true; - } - if (this.options.data) { - ret.useData = true; - } - if (this.useDepths) { - ret.useDepths = true; - } - if (this.useBlockParams) { - ret.useBlockParams = true; - } - if (this.options.compat) { - ret.compat = true; - } - - if (!asObject) { - ret.compiler = JSON.stringify(ret.compiler); - - this.source.currentLocation = { start: { line: 1, column: 0 } }; - ret = this.objectLiteral(ret); - - if (options.srcName) { - ret = ret.toStringWithSourceMap({ file: options.destName }); - ret.map = ret.map && ret.map.toString(); - } else { - ret = ret.toString(); - } - } else { - ret.compilerOptions = this.options; - } - - return ret; - } else { - return fn; - } - }, - - preamble: function preamble() { - // track the last context pushed into place to allow skipping the - // getContext opcode when it would be a noop - this.lastContext = 0; - this.source = new _CodeGen2['default'](this.options.srcName); - }, - - createFunctionContext: function createFunctionContext(asObject) { - var varDeclarations = ''; - - var locals = this.stackVars.concat(this.registers.list); - if (locals.length > 0) { - varDeclarations += ', ' + locals.join(', '); - } - - // Generate minimizer alias mappings - // - // When using true SourceNodes, this will update all references to the given alias - // as the source nodes are reused in situ. For the non-source node compilation mode, - // aliases will not be used, but this case is already being run on the client and - // we aren't concern about minimizing the template size. - var aliasCount = 0; - for (var alias in this.aliases) { - // eslint-disable-line guard-for-in - var node = this.aliases[alias]; - - if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) { - varDeclarations += ', alias' + ++aliasCount + '=' + alias; - node.children[0] = 'alias' + aliasCount; - } - } - - var params = ['depth0', 'helpers', 'partials', 'data']; - - if (this.useBlockParams || this.useDepths) { - params.push('blockParams'); - } - if (this.useDepths) { - params.push('depths'); - } - - // Perform a second pass over the output to merge content when possible - var source = this.mergeSource(varDeclarations); - - if (asObject) { - params.push(source); - - return Function.apply(this, params); - } else { - return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']); - } - }, - mergeSource: function mergeSource(varDeclarations) { - var isSimple = this.environment.isSimple, - appendOnly = !this.forceBuffer, - appendFirst = undefined, - sourceSeen = undefined, - bufferStart = undefined, - bufferEnd = undefined; - this.source.each(function (line) { - if (line.appendToBuffer) { - if (bufferStart) { - line.prepend(' + '); - } else { - bufferStart = line; - } - bufferEnd = line; - } else { - if (bufferStart) { - if (!sourceSeen) { - appendFirst = true; - } else { - bufferStart.prepend('buffer += '); - } - bufferEnd.add(';'); - bufferStart = bufferEnd = undefined; - } - - sourceSeen = true; - if (!isSimple) { - appendOnly = false; - } - } - }); - - if (appendOnly) { - if (bufferStart) { - bufferStart.prepend('return '); - bufferEnd.add(';'); - } else if (!sourceSeen) { - this.source.push('return "";'); - } - } else { - varDeclarations += ', buffer = ' + (appendFirst ? '' : this.initializeBuffer()); - - if (bufferStart) { - bufferStart.prepend('return buffer + '); - bufferEnd.add(';'); - } else { - this.source.push('return buffer;'); - } - } - - if (varDeclarations) { - this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n')); - } - - return this.source.merge(); - }, - - // [blockValue] - // - // On stack, before: hash, inverse, program, value - // On stack, after: return value of blockHelperMissing - // - // The purpose of this opcode is to take a block of the form - // `{{#this.foo}}...{{/this.foo}}`, resolve the value of `foo`, and - // replace it on the stack with the result of properly - // invoking blockHelperMissing. - blockValue: function blockValue(name) { - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs(name, 0, params); - - var blockName = this.popStack(); - params.splice(1, 0, blockName); - - this.push(this.source.functionCall(blockHelperMissing, 'call', params)); - }, - - // [ambiguousBlockValue] - // - // On stack, before: hash, inverse, program, value - // Compiler value, before: lastHelper=value of last found helper, if any - // On stack, after, if no lastHelper: same as [blockValue] - // On stack, after, if lastHelper: value - ambiguousBlockValue: function ambiguousBlockValue() { - // We're being a bit cheeky and reusing the options value from the prior exec - var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'), - params = [this.contextName(0)]; - this.setupHelperArgs('', 0, params, true); - - this.flushInline(); - - var current = this.topStack(); - params.splice(1, 0, current); - - this.pushSource(['if (!', this.lastHelper, ') { ', current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params), '}']); - }, - - // [appendContent] - // - // On stack, before: ... - // On stack, after: ... - // - // Appends the string value of `content` to the current buffer - appendContent: function appendContent(content) { - if (this.pendingContent) { - content = this.pendingContent + content; - } else { - this.pendingLocation = this.source.currentLocation; - } - - this.pendingContent = content; - }, - - // [append] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Coerces `value` to a String and appends it to the current buffer. - // - // If `value` is truthy, or 0, it is coerced into a string and appended - // Otherwise, the empty string is appended - append: function append() { - if (this.isInline()) { - this.replaceStack(function (current) { - return [' != null ? ', current, ' : ""']; - }); - - this.pushSource(this.appendToBuffer(this.popStack())); - } else { - var local = this.popStack(); - this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']); - if (this.environment.isSimple) { - this.pushSource(['else { ', this.appendToBuffer('\'\'', undefined, true), ' }']); - } - } - }, - - // [appendEscaped] - // - // On stack, before: value, ... - // On stack, after: ... - // - // Escape `value` and append it to the buffer - appendEscaped: function appendEscaped() { - this.pushSource(this.appendToBuffer([this.aliasable('this.escapeExpression'), '(', this.popStack(), ')'])); - }, - - // [getContext] - // - // On stack, before: ... - // On stack, after: ... - // Compiler value, after: lastContext=depth - // - // Set the value of the `lastContext` compiler value to the depth - getContext: function getContext(depth) { - this.lastContext = depth; - }, - - // [pushContext] - // - // On stack, before: ... - // On stack, after: currentContext, ... - // - // Pushes the value of the current context onto the stack. - pushContext: function pushContext() { - this.pushStackLiteral(this.contextName(this.lastContext)); - }, - - // [lookupOnContext] - // - // On stack, before: ... - // On stack, after: currentContext[name], ... - // - // Looks up the value of `name` on the current context and pushes - // it onto the stack. - lookupOnContext: function lookupOnContext(parts, falsy, scoped) { - var i = 0; - - if (!scoped && this.options.compat && !this.lastContext) { - // The depthed query is expected to handle the undefined logic for the root level that - // is implemented below, so we evaluate that directly in compat mode - this.push(this.depthedLookup(parts[i++])); - } else { - this.pushContext(); - } - - this.resolvePath('context', parts, i, falsy); - }, - - // [lookupBlockParam] - // - // On stack, before: ... - // On stack, after: blockParam[name], ... - // - // Looks up the value of `parts` on the given block param and pushes - // it onto the stack. - lookupBlockParam: function lookupBlockParam(blockParamId, parts) { - this.useBlockParams = true; - - this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']); - this.resolvePath('context', parts, 1); - }, - - // [lookupData] - // - // On stack, before: ... - // On stack, after: data, ... - // - // Push the data lookup operator - lookupData: function lookupData(depth, parts) { - if (!depth) { - this.pushStackLiteral('data'); - } else { - this.pushStackLiteral('this.data(data, ' + depth + ')'); - } - - this.resolvePath('data', parts, 0, true); - }, - - resolvePath: function resolvePath(type, parts, i, falsy) { - var _this = this; - - if (this.options.strict || this.options.assumeObjects) { - this.push(strictLookup(this.options.strict, this, parts, type)); - return; - } - - var len = parts.length; - for (; i < len; i++) { - /*eslint-disable no-loop-func */ - this.replaceStack(function (current) { - var lookup = _this.nameLookup(current, parts[i], type); - // We want to ensure that zero and false are handled properly if the context (falsy flag) - // needs to have the special handling for these values. - if (!falsy) { - return [' != null ? ', lookup, ' : ', current]; - } else { - // Otherwise we can use generic falsy handling - return [' && ', lookup]; - } - }); - /*eslint-enable no-loop-func */ - } - }, - - // [resolvePossibleLambda] - // - // On stack, before: value, ... - // On stack, after: resolved value, ... - // - // If the `value` is a lambda, replace it on the stack by - // the return value of the lambda - resolvePossibleLambda: function resolvePossibleLambda() { - this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']); - }, - - // [pushStringParam] - // - // On stack, before: ... - // On stack, after: string, currentContext, ... - // - // This opcode is designed for use in string mode, which - // provides the string value of a parameter along with its - // depth rather than resolving it immediately. - pushStringParam: function pushStringParam(string, type) { - this.pushContext(); - this.pushString(type); - - // If it's a subexpression, the string result - // will be pushed after this opcode. - if (type !== 'SubExpression') { - if (typeof string === 'string') { - this.pushString(string); - } else { - this.pushStackLiteral(string); - } - } - }, - - emptyHash: function emptyHash(omitEmpty) { - if (this.trackIds) { - this.push('{}'); // hashIds - } - if (this.stringParams) { - this.push('{}'); // hashContexts - this.push('{}'); // hashTypes - } - this.pushStackLiteral(omitEmpty ? 'undefined' : '{}'); - }, - pushHash: function pushHash() { - if (this.hash) { - this.hashes.push(this.hash); - } - this.hash = { values: [], types: [], contexts: [], ids: [] }; - }, - popHash: function popHash() { - var hash = this.hash; - this.hash = this.hashes.pop(); - - if (this.trackIds) { - this.push(this.objectLiteral(hash.ids)); - } - if (this.stringParams) { - this.push(this.objectLiteral(hash.contexts)); - this.push(this.objectLiteral(hash.types)); - } - - this.push(this.objectLiteral(hash.values)); - }, - - // [pushString] - // - // On stack, before: ... - // On stack, after: quotedString(string), ... - // - // Push a quoted version of `string` onto the stack - pushString: function pushString(string) { - this.pushStackLiteral(this.quotedString(string)); - }, - - // [pushLiteral] - // - // On stack, before: ... - // On stack, after: value, ... - // - // Pushes a value onto the stack. This operation prevents - // the compiler from creating a temporary variable to hold - // it. - pushLiteral: function pushLiteral(value) { - this.pushStackLiteral(value); - }, - - // [pushProgram] - // - // On stack, before: ... - // On stack, after: program(guid), ... - // - // Push a program expression onto the stack. This takes - // a compile-time guid and converts it into a runtime-accessible - // expression. - pushProgram: function pushProgram(guid) { - if (guid != null) { - this.pushStackLiteral(this.programExpression(guid)); - } else { - this.pushStackLiteral(null); - } - }, - - // [invokeHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // Pops off the helper's parameters, invokes the helper, - // and pushes the helper's return value onto the stack. - // - // If the helper is not found, `helperMissing` is called. - invokeHelper: function invokeHelper(paramSize, name, isSimple) { - var nonHelper = this.popStack(), - helper = this.setupHelper(paramSize, name), - simple = isSimple ? [helper.name, ' || '] : ''; - - var lookup = ['('].concat(simple, nonHelper); - if (!this.options.strict) { - lookup.push(' || ', this.aliasable('helpers.helperMissing')); - } - lookup.push(')'); - - this.push(this.source.functionCall(lookup, 'call', helper.callParams)); - }, - - // [invokeKnownHelper] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of helper invocation - // - // This operation is used when the helper is known to exist, - // so a `helperMissing` fallback is not required. - invokeKnownHelper: function invokeKnownHelper(paramSize, name) { - var helper = this.setupHelper(paramSize, name); - this.push(this.source.functionCall(helper.name, 'call', helper.callParams)); - }, - - // [invokeAmbiguous] - // - // On stack, before: hash, inverse, program, params..., ... - // On stack, after: result of disambiguation - // - // This operation is used when an expression like `{{foo}}` - // is provided, but we don't know at compile-time whether it - // is a helper or a path. - // - // This operation emits more code than the other options, - // and can be avoided by passing the `knownHelpers` and - // `knownHelpersOnly` flags at compile-time. - invokeAmbiguous: function invokeAmbiguous(name, helperCall) { - this.useRegister('helper'); - - var nonHelper = this.popStack(); - - this.emptyHash(); - var helper = this.setupHelper(0, name, helperCall); - - var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); - - var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')']; - if (!this.options.strict) { - lookup[0] = '(helper = '; - lookup.push(' != null ? helper : ', this.aliasable('helpers.helperMissing')); - } - - this.push(['(', lookup, helper.paramsInit ? ['),(', helper.paramsInit] : [], '),', '(typeof helper === ', this.aliasable('"function"'), ' ? ', this.source.functionCall('helper', 'call', helper.callParams), ' : helper))']); - }, - - // [invokePartial] - // - // On stack, before: context, ... - // On stack after: result of partial invocation - // - // This operation pops off a context, invokes a partial with that context, - // and pushes the result of the invocation back. - invokePartial: function invokePartial(isDynamic, name, indent) { - var params = [], - options = this.setupParams(name, 1, params, false); - - if (isDynamic) { - name = this.popStack(); - delete options.name; - } - - if (indent) { - options.indent = JSON.stringify(indent); - } - options.helpers = 'helpers'; - options.partials = 'partials'; - - if (!isDynamic) { - params.unshift(this.nameLookup('partials', name, 'partial')); - } else { - params.unshift(name); - } - - if (this.options.compat) { - options.depths = 'depths'; - } - options = this.objectLiteral(options); - params.push(options); - - this.push(this.source.functionCall('this.invokePartial', '', params)); - }, - - // [assignToHash] - // - // On stack, before: value, ..., hash, ... - // On stack, after: ..., hash, ... - // - // Pops a value off the stack and assigns it to the current hash - assignToHash: function assignToHash(key) { - var value = this.popStack(), - context = undefined, - type = undefined, - id = undefined; - - if (this.trackIds) { - id = this.popStack(); - } - if (this.stringParams) { - type = this.popStack(); - context = this.popStack(); - } - - var hash = this.hash; - if (context) { - hash.contexts[key] = context; - } - if (type) { - hash.types[key] = type; - } - if (id) { - hash.ids[key] = id; - } - hash.values[key] = value; - }, - - pushId: function pushId(type, name, child) { - if (type === 'BlockParam') { - this.pushStackLiteral('blockParams[' + name[0] + '].path[' + name[1] + ']' + (child ? ' + ' + JSON.stringify('.' + child) : '')); - } else if (type === 'PathExpression') { - this.pushString(name); - } else if (type === 'SubExpression') { - this.pushStackLiteral('true'); - } else { - this.pushStackLiteral('null'); - } - }, - - // HELPERS - - compiler: JavaScriptCompiler, - - compileChildren: function compileChildren(environment, options) { - var children = environment.children, - child = undefined, - compiler = undefined; - - for (var i = 0, l = children.length; i < l; i++) { - child = children[i]; - compiler = new this.compiler(); // eslint-disable-line new-cap - - var index = this.matchExistingProgram(child); - - if (index == null) { - this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children - index = this.context.programs.length; - child.index = index; - child.name = 'program' + index; - this.context.programs[index] = compiler.compile(child, options, this.context, !this.precompile); - this.context.environments[index] = child; - - this.useDepths = this.useDepths || compiler.useDepths; - this.useBlockParams = this.useBlockParams || compiler.useBlockParams; - } else { - child.index = index; - child.name = 'program' + index; - - this.useDepths = this.useDepths || child.useDepths; - this.useBlockParams = this.useBlockParams || child.useBlockParams; - } - } - }, - matchExistingProgram: function matchExistingProgram(child) { - for (var i = 0, len = this.context.environments.length; i < len; i++) { - var environment = this.context.environments[i]; - if (environment && environment.equals(child)) { - return i; - } - } - }, - - programExpression: function programExpression(guid) { - var child = this.environment.children[guid], - programParams = [child.index, 'data', child.blockParams]; - - if (this.useBlockParams || this.useDepths) { - programParams.push('blockParams'); - } - if (this.useDepths) { - programParams.push('depths'); - } - - return 'this.program(' + programParams.join(', ') + ')'; - }, - - useRegister: function useRegister(name) { - if (!this.registers[name]) { - this.registers[name] = true; - this.registers.list.push(name); - } - }, - - push: function push(expr) { - if (!(expr instanceof Literal)) { - expr = this.source.wrap(expr); - } - - this.inlineStack.push(expr); - return expr; - }, - - pushStackLiteral: function pushStackLiteral(item) { - this.push(new Literal(item)); - }, - - pushSource: function pushSource(source) { - if (this.pendingContent) { - this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation)); - this.pendingContent = undefined; - } - - if (source) { - this.source.push(source); - } - }, - - replaceStack: function replaceStack(callback) { - var prefix = ['('], - stack = undefined, - createdStack = undefined, - usedLiteral = undefined; - - /* istanbul ignore next */ - if (!this.isInline()) { - throw new _Exception2['default']('replaceStack on non-inline'); - } - - // We want to merge the inline statement into the replacement statement via ',' - var top = this.popStack(true); - - if (top instanceof Literal) { - // Literals do not need to be inlined - stack = [top.value]; - prefix = ['(', stack]; - usedLiteral = true; - } else { - // Get or create the current stack name for use by the inline - createdStack = true; - var _name = this.incrStack(); - - prefix = ['((', this.push(_name), ' = ', top, ')']; - stack = this.topStack(); - } - - var item = callback.call(this, stack); - - if (!usedLiteral) { - this.popStack(); - } - if (createdStack) { - this.stackSlot--; - } - this.push(prefix.concat(item, ')')); - }, - - incrStack: function incrStack() { - this.stackSlot++; - if (this.stackSlot > this.stackVars.length) { - this.stackVars.push('stack' + this.stackSlot); - } - return this.topStackName(); - }, - topStackName: function topStackName() { - return 'stack' + this.stackSlot; - }, - flushInline: function flushInline() { - var inlineStack = this.inlineStack; - this.inlineStack = []; - for (var i = 0, len = inlineStack.length; i < len; i++) { - var entry = inlineStack[i]; - /* istanbul ignore if */ - if (entry instanceof Literal) { - this.compileStack.push(entry); - } else { - var stack = this.incrStack(); - this.pushSource([stack, ' = ', entry, ';']); - this.compileStack.push(stack); - } - } - }, - isInline: function isInline() { - return this.inlineStack.length; - }, - - popStack: function popStack(wrapped) { - var inline = this.isInline(), - item = (inline ? this.inlineStack : this.compileStack).pop(); - - if (!wrapped && item instanceof Literal) { - return item.value; - } else { - if (!inline) { - /* istanbul ignore next */ - if (!this.stackSlot) { - throw new _Exception2['default']('Invalid stack pop'); - } - this.stackSlot--; - } - return item; - } - }, - - topStack: function topStack() { - var stack = this.isInline() ? this.inlineStack : this.compileStack, - item = stack[stack.length - 1]; - - /* istanbul ignore if */ - if (item instanceof Literal) { - return item.value; - } else { - return item; - } - }, - - contextName: function contextName(context) { - if (this.useDepths && context) { - return 'depths[' + context + ']'; - } else { - return 'depth' + context; - } - }, - - quotedString: function quotedString(str) { - return this.source.quotedString(str); - }, - - objectLiteral: function objectLiteral(obj) { - return this.source.objectLiteral(obj); - }, - - aliasable: function aliasable(name) { - var ret = this.aliases[name]; - if (ret) { - ret.referenceCount++; - return ret; - } - - ret = this.aliases[name] = this.source.wrap(name); - ret.aliasable = true; - ret.referenceCount = 1; - - return ret; - }, - - setupHelper: function setupHelper(paramSize, name, blockHelper) { - var params = [], - paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper); - var foundHelper = this.nameLookup('helpers', name, 'helper'); - - return { - params: params, - paramsInit: paramsInit, - name: foundHelper, - callParams: [this.contextName(0)].concat(params) - }; - }, - - setupParams: function setupParams(helper, paramSize, params) { - var options = {}, - contexts = [], - types = [], - ids = [], - param = undefined; - - options.name = this.quotedString(helper); - options.hash = this.popStack(); - - if (this.trackIds) { - options.hashIds = this.popStack(); - } - if (this.stringParams) { - options.hashTypes = this.popStack(); - options.hashContexts = this.popStack(); - } - - var inverse = this.popStack(), - program = this.popStack(); - - // Avoid setting fn and inverse if neither are set. This allows - // helpers to do a check for `if (options.fn)` - if (program || inverse) { - options.fn = program || 'this.noop'; - options.inverse = inverse || 'this.noop'; - } - - // The parameters go on to the stack in order (making sure that they are evaluated in order) - // so we need to pop them off the stack in reverse order - var i = paramSize; - while (i--) { - param = this.popStack(); - params[i] = param; - - if (this.trackIds) { - ids[i] = this.popStack(); - } - if (this.stringParams) { - types[i] = this.popStack(); - contexts[i] = this.popStack(); - } - } - - if (this.trackIds) { - options.ids = this.source.generateArray(ids); - } - if (this.stringParams) { - options.types = this.source.generateArray(types); - options.contexts = this.source.generateArray(contexts); - } - - if (this.options.data) { - options.data = 'data'; - } - if (this.useBlockParams) { - options.blockParams = 'blockParams'; - } - return options; - }, - - setupHelperArgs: function setupHelperArgs(helper, paramSize, params, useRegister) { - var options = this.setupParams(helper, paramSize, params, true); - options = this.objectLiteral(options); - if (useRegister) { - this.useRegister('options'); - params.push('options'); - return ['options=', options]; - } else { - params.push(options); - return ''; - } - } - }; - - (function () { - var reservedWords = ('break else new var' + ' case finally return void' + ' catch for switch while' + ' continue function this with' + ' default if throw' + ' delete in try' + ' do instanceof typeof' + ' abstract enum int short' + ' boolean export interface static' + ' byte extends long super' + ' char final native synchronized' + ' class float package throws' + ' const goto private transient' + ' debugger implements protected volatile' + ' double import public let yield await' + ' null true false').split(' '); - - var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; - - for (var i = 0, l = reservedWords.length; i < l; i++) { - compilerWords[reservedWords[i]] = true; - } - })(); - - JavaScriptCompiler.isValidJavaScriptVariableName = function (name) { - return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name); - }; - - function strictLookup(requireTerminal, compiler, parts, type) { - var stack = compiler.popStack(), - i = 0, - len = parts.length; - if (requireTerminal) { - len--; - } - - for (; i < len; i++) { - stack = compiler.nameLookup(stack, parts[i], type); - } - - if (requireTerminal) { - return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')']; - } else { - return stack; - } - } - - exports['default'] = JavaScriptCompiler; - module.exports = exports['default']; - - /***/ }, - /* 6 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _AST = __webpack_require__(2); - - var _AST2 = _interopRequireWildcard(_AST); - - function Visitor() { - this.parents = []; - } - - Visitor.prototype = { - constructor: Visitor, - mutating: false, - - // Visits a given value. If mutating, will replace the value if necessary. - acceptKey: function acceptKey(node, name) { - var value = this.accept(node[name]); - if (this.mutating) { - // Hacky sanity check: - if (value && (!value.type || !_AST2['default'][value.type])) { - throw new _Exception2['default']('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type); - } - node[name] = value; - } - }, - - // Performs an accept operation with added sanity check to ensure - // required keys are not removed. - acceptRequired: function acceptRequired(node, name) { - this.acceptKey(node, name); - - if (!node[name]) { - throw new _Exception2['default'](node.type + ' requires ' + name); - } - }, - - // Traverses a given array. If mutating, empty respnses will be removed - // for child elements. - acceptArray: function acceptArray(array) { - for (var i = 0, l = array.length; i < l; i++) { - this.acceptKey(array, i); - - if (!array[i]) { - array.splice(i, 1); - i--; - l--; - } - } - }, - - accept: function accept(object) { - if (!object) { - return; - } - - if (this.current) { - this.parents.unshift(this.current); - } - this.current = object; - - var ret = this[object.type](object); - - this.current = this.parents.shift(); - - if (!this.mutating || ret) { - return ret; - } else if (ret !== false) { - return object; - } - }, - - Program: function Program(program) { - this.acceptArray(program.body); - }, - - MustacheStatement: function MustacheStatement(mustache) { - this.acceptRequired(mustache, 'path'); - this.acceptArray(mustache.params); - this.acceptKey(mustache, 'hash'); - }, - - BlockStatement: function BlockStatement(block) { - this.acceptRequired(block, 'path'); - this.acceptArray(block.params); - this.acceptKey(block, 'hash'); - - this.acceptKey(block, 'program'); - this.acceptKey(block, 'inverse'); - }, - - PartialStatement: function PartialStatement(partial) { - this.acceptRequired(partial, 'name'); - this.acceptArray(partial.params); - this.acceptKey(partial, 'hash'); - }, - - ContentStatement: function ContentStatement() {}, - CommentStatement: function CommentStatement() {}, - - SubExpression: function SubExpression(sexpr) { - this.acceptRequired(sexpr, 'path'); - this.acceptArray(sexpr.params); - this.acceptKey(sexpr, 'hash'); - }, - - PathExpression: function PathExpression() {}, - - StringLiteral: function StringLiteral() {}, - NumberLiteral: function NumberLiteral() {}, - BooleanLiteral: function BooleanLiteral() {}, - UndefinedLiteral: function UndefinedLiteral() {}, - NullLiteral: function NullLiteral() {}, - - Hash: function Hash(hash) { - this.acceptArray(hash.pairs); - }, - HashPair: function HashPair(pair) { - this.acceptRequired(pair, 'value'); - } - }; - - exports['default'] = Visitor; - module.exports = exports['default']; - /* content */ /* comment */ /* path */ /* string */ /* number */ /* bool */ /* literal */ /* literal */ - - /***/ }, - /* 7 */ - /***/ function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - exports.__esModule = true; - /*global window */ - - exports['default'] = function (Handlebars) { - /* istanbul ignore next */ - var root = typeof global !== 'undefined' ? global : window, - $Handlebars = root.Handlebars; - /* istanbul ignore next */ - Handlebars.noConflict = function () { - if (root.Handlebars === Handlebars) { - root.Handlebars = $Handlebars; - } - }; - }; - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - - /***/ }, - /* 8 */ - /***/ function(module, exports, __webpack_require__) { - - "use strict"; - - exports["default"] = function (obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; - }; - - exports.__esModule = true; - - /***/ }, - /* 9 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - exports.HandlebarsEnvironment = HandlebarsEnvironment; - exports.createFrame = createFrame; - - var _import = __webpack_require__(12); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var VERSION = '3.0.1'; - exports.VERSION = VERSION; - var COMPILER_REVISION = 6; - - exports.COMPILER_REVISION = COMPILER_REVISION; - var REVISION_CHANGES = { - 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it - 2: '== 1.0.0-rc.3', - 3: '== 1.0.0-rc.4', - 4: '== 1.x.x', - 5: '== 2.0.0-alpha.x', - 6: '>= 2.0.0-beta.1' - }; - - exports.REVISION_CHANGES = REVISION_CHANGES; - var isArray = Utils.isArray, - isFunction = Utils.isFunction, - toString = Utils.toString, - objectType = '[object Object]'; - - function HandlebarsEnvironment(helpers, partials) { - this.helpers = helpers || {}; - this.partials = partials || {}; - - registerDefaultHelpers(this); - } - - HandlebarsEnvironment.prototype = { - constructor: HandlebarsEnvironment, - - logger: logger, - log: log, - - registerHelper: function registerHelper(name, fn) { - if (toString.call(name) === objectType) { - if (fn) { - throw new _Exception2['default']('Arg not supported with multiple helpers'); - } - Utils.extend(this.helpers, name); - } else { - this.helpers[name] = fn; - } - }, - unregisterHelper: function unregisterHelper(name) { - delete this.helpers[name]; - }, - - registerPartial: function registerPartial(name, partial) { - if (toString.call(name) === objectType) { - Utils.extend(this.partials, name); - } else { - if (typeof partial === 'undefined') { - throw new _Exception2['default']('Attempting to register a partial as undefined'); - } - this.partials[name] = partial; - } - }, - unregisterPartial: function unregisterPartial(name) { - delete this.partials[name]; - } - }; - - function registerDefaultHelpers(instance) { - instance.registerHelper('helperMissing', function () { - if (arguments.length === 1) { - // A missing field in a {{foo}} constuct. - return undefined; - } else { - // Someone is actually trying to call something, blow up. - throw new _Exception2['default']('Missing helper: "' + arguments[arguments.length - 1].name + '"'); - } - }); - - instance.registerHelper('blockHelperMissing', function (context, options) { - var inverse = options.inverse, - fn = options.fn; - - if (context === true) { - return fn(this); - } else if (context === false || context == null) { - return inverse(this); - } else if (isArray(context)) { - if (context.length > 0) { - if (options.ids) { - options.ids = [options.name]; - } - - return instance.helpers.each(context, options); - } else { - return inverse(this); - } - } else { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name); - options = { data: data }; - } - - return fn(context, options); - } - }); - - instance.registerHelper('each', function (context, options) { - if (!options) { - throw new _Exception2['default']('Must pass iterator to #each'); - } - - var fn = options.fn, - inverse = options.inverse, - i = 0, - ret = '', - data = undefined, - contextPath = undefined; - - if (options.data && options.ids) { - contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.'; - } - - if (isFunction(context)) { - context = context.call(this); - } - - if (options.data) { - data = createFrame(options.data); - } - - function execIteration(field, index, last) { - if (data) { - data.key = field; - data.index = index; - data.first = index === 0; - data.last = !!last; - - if (contextPath) { - data.contextPath = contextPath + field; - } - } - - ret = ret + fn(context[field], { - data: data, - blockParams: Utils.blockParams([context[field], field], [contextPath + field, null]) - }); - } - - if (context && typeof context === 'object') { - if (isArray(context)) { - for (var j = context.length; i < j; i++) { - execIteration(i, i, i === context.length - 1); - } - } else { - var priorKey = undefined; - - for (var key in context) { - if (context.hasOwnProperty(key)) { - // We're running the iterations one step out of sync so we can detect - // the last iteration without have to scan the object twice and create - // an itermediate keys array. - if (priorKey) { - execIteration(priorKey, i - 1); - } - priorKey = key; - i++; - } - } - if (priorKey) { - execIteration(priorKey, i - 1, true); - } - } - } - - if (i === 0) { - ret = inverse(this); - } - - return ret; - }); - - instance.registerHelper('if', function (conditional, options) { - if (isFunction(conditional)) { - conditional = conditional.call(this); - } - - // Default behavior is to render the positive path if the value is truthy and not empty. - // The `includeZero` option may be set to treat the condtional as purely not empty based on the - // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. - if (!options.hash.includeZero && !conditional || Utils.isEmpty(conditional)) { - return options.inverse(this); - } else { - return options.fn(this); - } - }); - - instance.registerHelper('unless', function (conditional, options) { - return instance.helpers['if'].call(this, conditional, { fn: options.inverse, inverse: options.fn, hash: options.hash }); - }); - - instance.registerHelper('with', function (context, options) { - if (isFunction(context)) { - context = context.call(this); - } - - var fn = options.fn; - - if (!Utils.isEmpty(context)) { - if (options.data && options.ids) { - var data = createFrame(options.data); - data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]); - options = { data: data }; - } - - return fn(context, options); - } else { - return options.inverse(this); - } - }); - - instance.registerHelper('log', function (message, options) { - var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; - instance.log(level, message); - }); - - instance.registerHelper('lookup', function (obj, field) { - return obj && obj[field]; - }); - } - - var logger = { - methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, - - // State enum - DEBUG: 0, - INFO: 1, - WARN: 2, - ERROR: 3, - level: 1, - - // Can be overridden in the host environment - log: function log(level, message) { - if (typeof console !== 'undefined' && logger.level <= level) { - var method = logger.methodMap[level]; - (console[method] || console.log).call(console, message); // eslint-disable-line no-console - } - } - }; - - exports.logger = logger; - var log = logger.log; - - exports.log = log; - - function createFrame(object) { - var frame = Utils.extend({}, object); - frame._parent = object; - return frame; - } - - /* [args, ]options */ - - /***/ }, - /* 10 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - // Build out our basic SafeString type - function SafeString(string) { - this.string = string; - } - - SafeString.prototype.toString = SafeString.prototype.toHTML = function () { - return '' + this.string; - }; - - exports['default'] = SafeString; - module.exports = exports['default']; - - /***/ }, - /* 11 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; - - function Exception(message, node) { - var loc = node && node.loc, - line = undefined, - column = undefined; - if (loc) { - line = loc.start.line; - column = loc.start.column; - - message += ' - ' + line + ':' + column; - } - - var tmp = Error.prototype.constructor.call(this, message); - - // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. - for (var idx = 0; idx < errorProps.length; idx++) { - this[errorProps[idx]] = tmp[errorProps[idx]]; - } - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, Exception); - } - - if (loc) { - this.lineNumber = line; - this.column = column; - } - } - - Exception.prototype = new Error(); - - exports['default'] = Exception; - module.exports = exports['default']; - - /***/ }, - /* 12 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - exports.extend = extend; - - // Older IE versions do not directly support indexOf so we must implement our own, sadly. - exports.indexOf = indexOf; - exports.escapeExpression = escapeExpression; - exports.isEmpty = isEmpty; - exports.blockParams = blockParams; - exports.appendContextPath = appendContextPath; - var escape = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''', - '`': '`' - }; - - var badChars = /[&<>"'`]/g, - possible = /[&<>"'`]/; - - function escapeChar(chr) { - return escape[chr]; - } - - function extend(obj /* , ...source */) { - for (var i = 1; i < arguments.length; i++) { - for (var key in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], key)) { - obj[key] = arguments[i][key]; - } - } - } - - return obj; - } - - var toString = Object.prototype.toString; - - exports.toString = toString; - // Sourced from lodash - // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt - /*eslint-disable func-style, no-var */ - var isFunction = function isFunction(value) { - return typeof value === 'function'; - }; - // fallback for older versions of Chrome and Safari - /* istanbul ignore next */ - if (isFunction(/x/)) { - exports.isFunction = isFunction = function (value) { - return typeof value === 'function' && toString.call(value) === '[object Function]'; - }; - } - var isFunction; - exports.isFunction = isFunction; - /*eslint-enable func-style, no-var */ - - /* istanbul ignore next */ - var isArray = Array.isArray || function (value) { - return value && typeof value === 'object' ? toString.call(value) === '[object Array]' : false; - };exports.isArray = isArray; - - function indexOf(array, value) { - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - return -1; - } - - function escapeExpression(string) { - if (typeof string !== 'string') { - // don't escape SafeStrings, since they're already safe - if (string && string.toHTML) { - return string.toHTML(); - } else if (string == null) { - return ''; - } else if (!string) { - return string + ''; - } - - // Force a string conversion as this will be done by the append regardless and - // the regex test will do this transparently behind the scenes, causing issues if - // an object's to string has escaped characters in it. - string = '' + string; - } - - if (!possible.test(string)) { - return string; - } - return string.replace(badChars, escapeChar); - } - - function isEmpty(value) { - if (!value && value !== 0) { - return true; - } else if (isArray(value) && value.length === 0) { - return true; - } else { - return false; - } - } - - function blockParams(params, ids) { - params.path = ids; - return params; - } - - function appendContextPath(contextPath, id) { - return (contextPath ? contextPath + '.' : '') + id; - } - - /***/ }, - /* 13 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - exports.checkRevision = checkRevision; - - // TODO: Remove this line and break up compilePartial - - exports.template = template; - exports.wrapProgram = wrapProgram; - exports.resolvePartial = resolvePartial; - exports.invokePartial = invokePartial; - exports.noop = noop; - - var _import = __webpack_require__(12); - - var Utils = _interopRequireWildcard(_import); - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - var _COMPILER_REVISION$REVISION_CHANGES$createFrame = __webpack_require__(9); - - function checkRevision(compilerInfo) { - var compilerRevision = compilerInfo && compilerInfo[0] || 1, - currentRevision = _COMPILER_REVISION$REVISION_CHANGES$createFrame.COMPILER_REVISION; - - if (compilerRevision !== currentRevision) { - if (compilerRevision < currentRevision) { - var runtimeVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[currentRevision], - compilerVersions = _COMPILER_REVISION$REVISION_CHANGES$createFrame.REVISION_CHANGES[compilerRevision]; - throw new _Exception2['default']('Template was precompiled with an older version of Handlebars than the current runtime. ' + 'Please update your precompiler to a newer version (' + runtimeVersions + ') or downgrade your runtime to an older version (' + compilerVersions + ').'); - } else { - // Use the embedded version info since the runtime doesn't know about this revision yet - throw new _Exception2['default']('Template was precompiled with a newer version of Handlebars than the current runtime. ' + 'Please update your runtime to a newer version (' + compilerInfo[1] + ').'); - } - } - } - - function template(templateSpec, env) { - /* istanbul ignore next */ - if (!env) { - throw new _Exception2['default']('No environment passed to template'); - } - if (!templateSpec || !templateSpec.main) { - throw new _Exception2['default']('Unknown template object: ' + typeof templateSpec); - } - - // Note: Using env.VM references rather than local var references throughout this section to allow - // for external users to override these as psuedo-supported APIs. - env.VM.checkRevision(templateSpec.compiler); - - function invokePartialWrapper(partial, context, options) { - if (options.hash) { - context = Utils.extend({}, context, options.hash); - } - - partial = env.VM.resolvePartial.call(this, partial, context, options); - var result = env.VM.invokePartial.call(this, partial, context, options); - - if (result == null && env.compile) { - options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); - result = options.partials[options.name](context, options); - } - if (result != null) { - if (options.indent) { - var lines = result.split('\n'); - for (var i = 0, l = lines.length; i < l; i++) { - if (!lines[i] && i + 1 === l) { - break; - } - - lines[i] = options.indent + lines[i]; - } - result = lines.join('\n'); - } - return result; - } else { - throw new _Exception2['default']('The partial ' + options.name + ' could not be compiled when running in runtime-only mode'); - } - } - - // Just add water - var container = { - strict: function strict(obj, name) { - if (!(name in obj)) { - throw new _Exception2['default']('"' + name + '" not defined in ' + obj); - } - return obj[name]; - }, - lookup: function lookup(depths, name) { - var len = depths.length; - for (var i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { - return depths[i][name]; - } - } - }, - lambda: function lambda(current, context) { - return typeof current === 'function' ? current.call(context) : current; - }, - - escapeExpression: Utils.escapeExpression, - invokePartial: invokePartialWrapper, - - fn: function fn(i) { - return templateSpec[i]; - }, - - programs: [], - program: function program(i, data, declaredBlockParams, blockParams, depths) { - var programWrapper = this.programs[i], - fn = this.fn(i); - if (data || depths || blockParams || declaredBlockParams) { - programWrapper = wrapProgram(this, i, fn, data, declaredBlockParams, blockParams, depths); - } else if (!programWrapper) { - programWrapper = this.programs[i] = wrapProgram(this, i, fn); - } - return programWrapper; - }, - - data: function data(value, depth) { - while (value && depth--) { - value = value._parent; - } - return value; - }, - merge: function merge(param, common) { - var obj = param || common; - - if (param && common && param !== common) { - obj = Utils.extend({}, common, param); - } - - return obj; - }, - - noop: env.VM.noop, - compilerInfo: templateSpec.compiler - }; - - function ret(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - var data = options.data; - - ret._setup(options); - if (!options.partial && templateSpec.useData) { - data = initData(context, data); - } - var depths = undefined, - blockParams = templateSpec.useBlockParams ? [] : undefined; - if (templateSpec.useDepths) { - depths = options.depths ? [context].concat(options.depths) : [context]; - } - - return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths); - } - ret.isTop = true; - - ret._setup = function (options) { - if (!options.partial) { - container.helpers = container.merge(options.helpers, env.helpers); - - if (templateSpec.usePartial) { - container.partials = container.merge(options.partials, env.partials); - } - } else { - container.helpers = options.helpers; - container.partials = options.partials; - } - }; - - ret._child = function (i, data, blockParams, depths) { - if (templateSpec.useBlockParams && !blockParams) { - throw new _Exception2['default']('must pass block params'); - } - if (templateSpec.useDepths && !depths) { - throw new _Exception2['default']('must pass parent depths'); - } - - return wrapProgram(container, i, templateSpec[i], data, 0, blockParams, depths); - }; - return ret; - } - - function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { - function prog(context) { - var options = arguments[1] === undefined ? {} : arguments[1]; - - return fn.call(container, context, container.helpers, container.partials, options.data || data, blockParams && [options.blockParams].concat(blockParams), depths && [context].concat(depths)); - } - prog.program = i; - prog.depth = depths ? depths.length : 0; - prog.blockParams = declaredBlockParams || 0; - return prog; - } - - function resolvePartial(partial, context, options) { - if (!partial) { - partial = options.partials[options.name]; - } else if (!partial.call && !options.name) { - // This is a dynamic partial that returned a string - options.name = partial; - partial = options.partials[partial]; - } - return partial; - } - - function invokePartial(partial, context, options) { - options.partial = true; - - if (partial === undefined) { - throw new _Exception2['default']('The partial ' + options.name + ' could not be found'); - } else if (partial instanceof Function) { - return partial(context, options); - } - } - - function noop() { - return ''; - } - - function initData(context, data) { - if (!data || !('root' in data)) { - data = data ? _COMPILER_REVISION$REVISION_CHANGES$createFrame.createFrame(data) : {}; - data.root = context; - } - return data; - } - - /***/ }, - /* 14 */ - /***/ function(module, exports, __webpack_require__) { - - "use strict"; - - exports.__esModule = true; - /* istanbul ignore next */ - /* Jison generated parser */ - var handlebars = (function () { - var parser = { trace: function trace() {}, - yy: {}, - symbols_: { error: 2, root: 3, program: 4, EOF: 5, program_repetition0: 6, statement: 7, mustache: 8, block: 9, rawBlock: 10, partial: 11, content: 12, COMMENT: 13, CONTENT: 14, openRawBlock: 15, END_RAW_BLOCK: 16, OPEN_RAW_BLOCK: 17, helperName: 18, openRawBlock_repetition0: 19, openRawBlock_option0: 20, CLOSE_RAW_BLOCK: 21, openBlock: 22, block_option0: 23, closeBlock: 24, openInverse: 25, block_option1: 26, OPEN_BLOCK: 27, openBlock_repetition0: 28, openBlock_option0: 29, openBlock_option1: 30, CLOSE: 31, OPEN_INVERSE: 32, openInverse_repetition0: 33, openInverse_option0: 34, openInverse_option1: 35, openInverseChain: 36, OPEN_INVERSE_CHAIN: 37, openInverseChain_repetition0: 38, openInverseChain_option0: 39, openInverseChain_option1: 40, inverseAndProgram: 41, INVERSE: 42, inverseChain: 43, inverseChain_option0: 44, OPEN_ENDBLOCK: 45, OPEN: 46, mustache_repetition0: 47, mustache_option0: 48, OPEN_UNESCAPED: 49, mustache_repetition1: 50, mustache_option1: 51, CLOSE_UNESCAPED: 52, OPEN_PARTIAL: 53, partialName: 54, partial_repetition0: 55, partial_option0: 56, param: 57, sexpr: 58, OPEN_SEXPR: 59, sexpr_repetition0: 60, sexpr_option0: 61, CLOSE_SEXPR: 62, hash: 63, hash_repetition_plus0: 64, hashSegment: 65, ID: 66, EQUALS: 67, blockParams: 68, OPEN_BLOCK_PARAMS: 69, blockParams_repetition_plus0: 70, CLOSE_BLOCK_PARAMS: 71, path: 72, dataName: 73, STRING: 74, NUMBER: 75, BOOLEAN: 76, UNDEFINED: 77, NULL: 78, DATA: 79, pathSegments: 80, SEP: 81, $accept: 0, $end: 1 }, - terminals_: { 2: "error", 5: "EOF", 13: "COMMENT", 14: "CONTENT", 16: "END_RAW_BLOCK", 17: "OPEN_RAW_BLOCK", 21: "CLOSE_RAW_BLOCK", 27: "OPEN_BLOCK", 31: "CLOSE", 32: "OPEN_INVERSE", 37: "OPEN_INVERSE_CHAIN", 42: "INVERSE", 45: "OPEN_ENDBLOCK", 46: "OPEN", 49: "OPEN_UNESCAPED", 52: "CLOSE_UNESCAPED", 53: "OPEN_PARTIAL", 59: "OPEN_SEXPR", 62: "CLOSE_SEXPR", 66: "ID", 67: "EQUALS", 69: "OPEN_BLOCK_PARAMS", 71: "CLOSE_BLOCK_PARAMS", 74: "STRING", 75: "NUMBER", 76: "BOOLEAN", 77: "UNDEFINED", 78: "NULL", 79: "DATA", 81: "SEP" }, - productions_: [0, [3, 2], [4, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [7, 1], [12, 1], [10, 3], [15, 5], [9, 4], [9, 4], [22, 6], [25, 6], [36, 6], [41, 2], [43, 3], [43, 1], [24, 3], [8, 5], [8, 5], [11, 5], [57, 1], [57, 1], [58, 5], [63, 1], [65, 3], [68, 3], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [18, 1], [54, 1], [54, 1], [73, 2], [72, 1], [80, 3], [80, 1], [6, 0], [6, 2], [19, 0], [19, 2], [20, 0], [20, 1], [23, 0], [23, 1], [26, 0], [26, 1], [28, 0], [28, 2], [29, 0], [29, 1], [30, 0], [30, 1], [33, 0], [33, 2], [34, 0], [34, 1], [35, 0], [35, 1], [38, 0], [38, 2], [39, 0], [39, 1], [40, 0], [40, 1], [44, 0], [44, 1], [47, 0], [47, 2], [48, 0], [48, 1], [50, 0], [50, 2], [51, 0], [51, 1], [55, 0], [55, 2], [56, 0], [56, 1], [60, 0], [60, 2], [61, 0], [61, 1], [64, 1], [64, 2], [70, 1], [70, 2]], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) { - - var $0 = $$.length - 1; - switch (yystate) { - case 1: - return $$[$0 - 1]; - break; - case 2: - this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$)); - break; - case 3: - this.$ = $$[$0]; - break; - case 4: - this.$ = $$[$0]; - break; - case 5: - this.$ = $$[$0]; - break; - case 6: - this.$ = $$[$0]; - break; - case 7: - this.$ = $$[$0]; - break; - case 8: - this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$)); - break; - case 9: - this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$)); - break; - case 10: - this.$ = yy.prepareRawBlock($$[$0 - 2], $$[$0 - 1], $$[$0], this._$); - break; - case 11: - this.$ = { path: $$[$0 - 3], params: $$[$0 - 2], hash: $$[$0 - 1] }; - break; - case 12: - this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], false, this._$); - break; - case 13: - this.$ = yy.prepareBlock($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0], true, this._$); - break; - case 14: - this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 15: - this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 16: - this.$ = { path: $$[$0 - 4], params: $$[$0 - 3], hash: $$[$0 - 2], blockParams: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 5], $$[$0]) }; - break; - case 17: - this.$ = { strip: yy.stripFlags($$[$0 - 1], $$[$0 - 1]), program: $$[$0] }; - break; - case 18: - var inverse = yy.prepareBlock($$[$0 - 2], $$[$0 - 1], $$[$0], $$[$0], false, this._$), - program = new yy.Program([inverse], null, {}, yy.locInfo(this._$)); - program.chained = true; - - this.$ = { strip: $$[$0 - 2].strip, program: program, chain: true }; - - break; - case 19: - this.$ = $$[$0]; - break; - case 20: - this.$ = { path: $$[$0 - 1], strip: yy.stripFlags($$[$0 - 2], $$[$0]) }; - break; - case 21: - this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); - break; - case 22: - this.$ = yy.prepareMustache($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], $$[$0 - 4], yy.stripFlags($$[$0 - 4], $$[$0]), this._$); - break; - case 23: - this.$ = new yy.PartialStatement($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.stripFlags($$[$0 - 4], $$[$0]), yy.locInfo(this._$)); - break; - case 24: - this.$ = $$[$0]; - break; - case 25: - this.$ = $$[$0]; - break; - case 26: - this.$ = new yy.SubExpression($$[$0 - 3], $$[$0 - 2], $$[$0 - 1], yy.locInfo(this._$)); - break; - case 27: - this.$ = new yy.Hash($$[$0], yy.locInfo(this._$)); - break; - case 28: - this.$ = new yy.HashPair(yy.id($$[$0 - 2]), $$[$0], yy.locInfo(this._$)); - break; - case 29: - this.$ = yy.id($$[$0 - 1]); - break; - case 30: - this.$ = $$[$0]; - break; - case 31: - this.$ = $$[$0]; - break; - case 32: - this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$)); - break; - case 33: - this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$)); - break; - case 34: - this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$)); - break; - case 35: - this.$ = new yy.UndefinedLiteral(yy.locInfo(this._$)); - break; - case 36: - this.$ = new yy.NullLiteral(yy.locInfo(this._$)); - break; - case 37: - this.$ = $$[$0]; - break; - case 38: - this.$ = $$[$0]; - break; - case 39: - this.$ = yy.preparePath(true, $$[$0], this._$); - break; - case 40: - this.$ = yy.preparePath(false, $$[$0], this._$); - break; - case 41: - $$[$0 - 2].push({ part: yy.id($$[$0]), original: $$[$0], separator: $$[$0 - 1] });this.$ = $$[$0 - 2]; - break; - case 42: - this.$ = [{ part: yy.id($$[$0]), original: $$[$0] }]; - break; - case 43: - this.$ = []; - break; - case 44: - $$[$0 - 1].push($$[$0]); - break; - case 45: - this.$ = []; - break; - case 46: - $$[$0 - 1].push($$[$0]); - break; - case 53: - this.$ = []; - break; - case 54: - $$[$0 - 1].push($$[$0]); - break; - case 59: - this.$ = []; - break; - case 60: - $$[$0 - 1].push($$[$0]); - break; - case 65: - this.$ = []; - break; - case 66: - $$[$0 - 1].push($$[$0]); - break; - case 73: - this.$ = []; - break; - case 74: - $$[$0 - 1].push($$[$0]); - break; - case 77: - this.$ = []; - break; - case 78: - $$[$0 - 1].push($$[$0]); - break; - case 81: - this.$ = []; - break; - case 82: - $$[$0 - 1].push($$[$0]); - break; - case 85: - this.$ = []; - break; - case 86: - $$[$0 - 1].push($$[$0]); - break; - case 89: - this.$ = [$$[$0]]; - break; - case 90: - $$[$0 - 1].push($$[$0]); - break; - case 91: - this.$ = [$$[$0]]; - break; - case 92: - $$[$0 - 1].push($$[$0]); - break; - } - }, - table: [{ 3: 1, 4: 2, 5: [2, 43], 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 1: [3] }, { 5: [1, 4] }, { 5: [2, 2], 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: [1, 11], 14: [1, 18], 15: 16, 17: [1, 21], 22: 14, 25: 15, 27: [1, 19], 32: [1, 20], 37: [2, 2], 42: [2, 2], 45: [2, 2], 46: [1, 12], 49: [1, 13], 53: [1, 17] }, { 1: [2, 1] }, { 5: [2, 44], 13: [2, 44], 14: [2, 44], 17: [2, 44], 27: [2, 44], 32: [2, 44], 37: [2, 44], 42: [2, 44], 45: [2, 44], 46: [2, 44], 49: [2, 44], 53: [2, 44] }, { 5: [2, 3], 13: [2, 3], 14: [2, 3], 17: [2, 3], 27: [2, 3], 32: [2, 3], 37: [2, 3], 42: [2, 3], 45: [2, 3], 46: [2, 3], 49: [2, 3], 53: [2, 3] }, { 5: [2, 4], 13: [2, 4], 14: [2, 4], 17: [2, 4], 27: [2, 4], 32: [2, 4], 37: [2, 4], 42: [2, 4], 45: [2, 4], 46: [2, 4], 49: [2, 4], 53: [2, 4] }, { 5: [2, 5], 13: [2, 5], 14: [2, 5], 17: [2, 5], 27: [2, 5], 32: [2, 5], 37: [2, 5], 42: [2, 5], 45: [2, 5], 46: [2, 5], 49: [2, 5], 53: [2, 5] }, { 5: [2, 6], 13: [2, 6], 14: [2, 6], 17: [2, 6], 27: [2, 6], 32: [2, 6], 37: [2, 6], 42: [2, 6], 45: [2, 6], 46: [2, 6], 49: [2, 6], 53: [2, 6] }, { 5: [2, 7], 13: [2, 7], 14: [2, 7], 17: [2, 7], 27: [2, 7], 32: [2, 7], 37: [2, 7], 42: [2, 7], 45: [2, 7], 46: [2, 7], 49: [2, 7], 53: [2, 7] }, { 5: [2, 8], 13: [2, 8], 14: [2, 8], 17: [2, 8], 27: [2, 8], 32: [2, 8], 37: [2, 8], 42: [2, 8], 45: [2, 8], 46: [2, 8], 49: [2, 8], 53: [2, 8] }, { 18: 22, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 33, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 34, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 4: 35, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 12: 36, 14: [1, 18] }, { 18: 38, 54: 37, 58: 39, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 9], 13: [2, 9], 14: [2, 9], 16: [2, 9], 17: [2, 9], 27: [2, 9], 32: [2, 9], 37: [2, 9], 42: [2, 9], 45: [2, 9], 46: [2, 9], 49: [2, 9], 53: [2, 9] }, { 18: 41, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 42, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 43, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [2, 73], 47: 44, 59: [2, 73], 66: [2, 73], 74: [2, 73], 75: [2, 73], 76: [2, 73], 77: [2, 73], 78: [2, 73], 79: [2, 73] }, { 21: [2, 30], 31: [2, 30], 52: [2, 30], 59: [2, 30], 62: [2, 30], 66: [2, 30], 69: [2, 30], 74: [2, 30], 75: [2, 30], 76: [2, 30], 77: [2, 30], 78: [2, 30], 79: [2, 30] }, { 21: [2, 31], 31: [2, 31], 52: [2, 31], 59: [2, 31], 62: [2, 31], 66: [2, 31], 69: [2, 31], 74: [2, 31], 75: [2, 31], 76: [2, 31], 77: [2, 31], 78: [2, 31], 79: [2, 31] }, { 21: [2, 32], 31: [2, 32], 52: [2, 32], 59: [2, 32], 62: [2, 32], 66: [2, 32], 69: [2, 32], 74: [2, 32], 75: [2, 32], 76: [2, 32], 77: [2, 32], 78: [2, 32], 79: [2, 32] }, { 21: [2, 33], 31: [2, 33], 52: [2, 33], 59: [2, 33], 62: [2, 33], 66: [2, 33], 69: [2, 33], 74: [2, 33], 75: [2, 33], 76: [2, 33], 77: [2, 33], 78: [2, 33], 79: [2, 33] }, { 21: [2, 34], 31: [2, 34], 52: [2, 34], 59: [2, 34], 62: [2, 34], 66: [2, 34], 69: [2, 34], 74: [2, 34], 75: [2, 34], 76: [2, 34], 77: [2, 34], 78: [2, 34], 79: [2, 34] }, { 21: [2, 35], 31: [2, 35], 52: [2, 35], 59: [2, 35], 62: [2, 35], 66: [2, 35], 69: [2, 35], 74: [2, 35], 75: [2, 35], 76: [2, 35], 77: [2, 35], 78: [2, 35], 79: [2, 35] }, { 21: [2, 36], 31: [2, 36], 52: [2, 36], 59: [2, 36], 62: [2, 36], 66: [2, 36], 69: [2, 36], 74: [2, 36], 75: [2, 36], 76: [2, 36], 77: [2, 36], 78: [2, 36], 79: [2, 36] }, { 21: [2, 40], 31: [2, 40], 52: [2, 40], 59: [2, 40], 62: [2, 40], 66: [2, 40], 69: [2, 40], 74: [2, 40], 75: [2, 40], 76: [2, 40], 77: [2, 40], 78: [2, 40], 79: [2, 40], 81: [1, 45] }, { 66: [1, 32], 80: 46 }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 50: 47, 52: [2, 77], 59: [2, 77], 66: [2, 77], 74: [2, 77], 75: [2, 77], 76: [2, 77], 77: [2, 77], 78: [2, 77], 79: [2, 77] }, { 23: 48, 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 49, 45: [2, 49] }, { 26: 54, 41: 55, 42: [1, 53], 45: [2, 51] }, { 16: [1, 56] }, { 31: [2, 81], 55: 57, 59: [2, 81], 66: [2, 81], 74: [2, 81], 75: [2, 81], 76: [2, 81], 77: [2, 81], 78: [2, 81], 79: [2, 81] }, { 31: [2, 37], 59: [2, 37], 66: [2, 37], 74: [2, 37], 75: [2, 37], 76: [2, 37], 77: [2, 37], 78: [2, 37], 79: [2, 37] }, { 31: [2, 38], 59: [2, 38], 66: [2, 38], 74: [2, 38], 75: [2, 38], 76: [2, 38], 77: [2, 38], 78: [2, 38], 79: [2, 38] }, { 18: 58, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 28: 59, 31: [2, 53], 59: [2, 53], 66: [2, 53], 69: [2, 53], 74: [2, 53], 75: [2, 53], 76: [2, 53], 77: [2, 53], 78: [2, 53], 79: [2, 53] }, { 31: [2, 59], 33: 60, 59: [2, 59], 66: [2, 59], 69: [2, 59], 74: [2, 59], 75: [2, 59], 76: [2, 59], 77: [2, 59], 78: [2, 59], 79: [2, 59] }, { 19: 61, 21: [2, 45], 59: [2, 45], 66: [2, 45], 74: [2, 45], 75: [2, 45], 76: [2, 45], 77: [2, 45], 78: [2, 45], 79: [2, 45] }, { 18: 65, 31: [2, 75], 48: 62, 57: 63, 58: 66, 59: [1, 40], 63: 64, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 66: [1, 70] }, { 21: [2, 39], 31: [2, 39], 52: [2, 39], 59: [2, 39], 62: [2, 39], 66: [2, 39], 69: [2, 39], 74: [2, 39], 75: [2, 39], 76: [2, 39], 77: [2, 39], 78: [2, 39], 79: [2, 39], 81: [1, 45] }, { 18: 65, 51: 71, 52: [2, 79], 57: 72, 58: 66, 59: [1, 40], 63: 73, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 24: 74, 45: [1, 75] }, { 45: [2, 50] }, { 4: 76, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 37: [2, 43], 42: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 45: [2, 19] }, { 18: 77, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 4: 78, 6: 3, 13: [2, 43], 14: [2, 43], 17: [2, 43], 27: [2, 43], 32: [2, 43], 45: [2, 43], 46: [2, 43], 49: [2, 43], 53: [2, 43] }, { 24: 79, 45: [1, 75] }, { 45: [2, 52] }, { 5: [2, 10], 13: [2, 10], 14: [2, 10], 17: [2, 10], 27: [2, 10], 32: [2, 10], 37: [2, 10], 42: [2, 10], 45: [2, 10], 46: [2, 10], 49: [2, 10], 53: [2, 10] }, { 18: 65, 31: [2, 83], 56: 80, 57: 81, 58: 66, 59: [1, 40], 63: 82, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 59: [2, 85], 60: 83, 62: [2, 85], 66: [2, 85], 74: [2, 85], 75: [2, 85], 76: [2, 85], 77: [2, 85], 78: [2, 85], 79: [2, 85] }, { 18: 65, 29: 84, 31: [2, 55], 57: 85, 58: 66, 59: [1, 40], 63: 86, 64: 67, 65: 68, 66: [1, 69], 69: [2, 55], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 31: [2, 61], 34: 87, 57: 88, 58: 66, 59: [1, 40], 63: 89, 64: 67, 65: 68, 66: [1, 69], 69: [2, 61], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 18: 65, 20: 90, 21: [2, 47], 57: 91, 58: 66, 59: [1, 40], 63: 92, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 31: [1, 93] }, { 31: [2, 74], 59: [2, 74], 66: [2, 74], 74: [2, 74], 75: [2, 74], 76: [2, 74], 77: [2, 74], 78: [2, 74], 79: [2, 74] }, { 31: [2, 76] }, { 21: [2, 24], 31: [2, 24], 52: [2, 24], 59: [2, 24], 62: [2, 24], 66: [2, 24], 69: [2, 24], 74: [2, 24], 75: [2, 24], 76: [2, 24], 77: [2, 24], 78: [2, 24], 79: [2, 24] }, { 21: [2, 25], 31: [2, 25], 52: [2, 25], 59: [2, 25], 62: [2, 25], 66: [2, 25], 69: [2, 25], 74: [2, 25], 75: [2, 25], 76: [2, 25], 77: [2, 25], 78: [2, 25], 79: [2, 25] }, { 21: [2, 27], 31: [2, 27], 52: [2, 27], 62: [2, 27], 65: 94, 66: [1, 95], 69: [2, 27] }, { 21: [2, 89], 31: [2, 89], 52: [2, 89], 62: [2, 89], 66: [2, 89], 69: [2, 89] }, { 21: [2, 42], 31: [2, 42], 52: [2, 42], 59: [2, 42], 62: [2, 42], 66: [2, 42], 67: [1, 96], 69: [2, 42], 74: [2, 42], 75: [2, 42], 76: [2, 42], 77: [2, 42], 78: [2, 42], 79: [2, 42], 81: [2, 42] }, { 21: [2, 41], 31: [2, 41], 52: [2, 41], 59: [2, 41], 62: [2, 41], 66: [2, 41], 69: [2, 41], 74: [2, 41], 75: [2, 41], 76: [2, 41], 77: [2, 41], 78: [2, 41], 79: [2, 41], 81: [2, 41] }, { 52: [1, 97] }, { 52: [2, 78], 59: [2, 78], 66: [2, 78], 74: [2, 78], 75: [2, 78], 76: [2, 78], 77: [2, 78], 78: [2, 78], 79: [2, 78] }, { 52: [2, 80] }, { 5: [2, 12], 13: [2, 12], 14: [2, 12], 17: [2, 12], 27: [2, 12], 32: [2, 12], 37: [2, 12], 42: [2, 12], 45: [2, 12], 46: [2, 12], 49: [2, 12], 53: [2, 12] }, { 18: 98, 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 36: 50, 37: [1, 52], 41: 51, 42: [1, 53], 43: 100, 44: 99, 45: [2, 71] }, { 31: [2, 65], 38: 101, 59: [2, 65], 66: [2, 65], 69: [2, 65], 74: [2, 65], 75: [2, 65], 76: [2, 65], 77: [2, 65], 78: [2, 65], 79: [2, 65] }, { 45: [2, 17] }, { 5: [2, 13], 13: [2, 13], 14: [2, 13], 17: [2, 13], 27: [2, 13], 32: [2, 13], 37: [2, 13], 42: [2, 13], 45: [2, 13], 46: [2, 13], 49: [2, 13], 53: [2, 13] }, { 31: [1, 102] }, { 31: [2, 82], 59: [2, 82], 66: [2, 82], 74: [2, 82], 75: [2, 82], 76: [2, 82], 77: [2, 82], 78: [2, 82], 79: [2, 82] }, { 31: [2, 84] }, { 18: 65, 57: 104, 58: 66, 59: [1, 40], 61: 103, 62: [2, 87], 63: 105, 64: 67, 65: 68, 66: [1, 69], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 30: 106, 31: [2, 57], 68: 107, 69: [1, 108] }, { 31: [2, 54], 59: [2, 54], 66: [2, 54], 69: [2, 54], 74: [2, 54], 75: [2, 54], 76: [2, 54], 77: [2, 54], 78: [2, 54], 79: [2, 54] }, { 31: [2, 56], 69: [2, 56] }, { 31: [2, 63], 35: 109, 68: 110, 69: [1, 108] }, { 31: [2, 60], 59: [2, 60], 66: [2, 60], 69: [2, 60], 74: [2, 60], 75: [2, 60], 76: [2, 60], 77: [2, 60], 78: [2, 60], 79: [2, 60] }, { 31: [2, 62], 69: [2, 62] }, { 21: [1, 111] }, { 21: [2, 46], 59: [2, 46], 66: [2, 46], 74: [2, 46], 75: [2, 46], 76: [2, 46], 77: [2, 46], 78: [2, 46], 79: [2, 46] }, { 21: [2, 48] }, { 5: [2, 21], 13: [2, 21], 14: [2, 21], 17: [2, 21], 27: [2, 21], 32: [2, 21], 37: [2, 21], 42: [2, 21], 45: [2, 21], 46: [2, 21], 49: [2, 21], 53: [2, 21] }, { 21: [2, 90], 31: [2, 90], 52: [2, 90], 62: [2, 90], 66: [2, 90], 69: [2, 90] }, { 67: [1, 96] }, { 18: 65, 57: 112, 58: 66, 59: [1, 40], 66: [1, 32], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 22], 13: [2, 22], 14: [2, 22], 17: [2, 22], 27: [2, 22], 32: [2, 22], 37: [2, 22], 42: [2, 22], 45: [2, 22], 46: [2, 22], 49: [2, 22], 53: [2, 22] }, { 31: [1, 113] }, { 45: [2, 18] }, { 45: [2, 72] }, { 18: 65, 31: [2, 67], 39: 114, 57: 115, 58: 66, 59: [1, 40], 63: 116, 64: 67, 65: 68, 66: [1, 69], 69: [2, 67], 72: 23, 73: 24, 74: [1, 25], 75: [1, 26], 76: [1, 27], 77: [1, 28], 78: [1, 29], 79: [1, 31], 80: 30 }, { 5: [2, 23], 13: [2, 23], 14: [2, 23], 17: [2, 23], 27: [2, 23], 32: [2, 23], 37: [2, 23], 42: [2, 23], 45: [2, 23], 46: [2, 23], 49: [2, 23], 53: [2, 23] }, { 62: [1, 117] }, { 59: [2, 86], 62: [2, 86], 66: [2, 86], 74: [2, 86], 75: [2, 86], 76: [2, 86], 77: [2, 86], 78: [2, 86], 79: [2, 86] }, { 62: [2, 88] }, { 31: [1, 118] }, { 31: [2, 58] }, { 66: [1, 120], 70: 119 }, { 31: [1, 121] }, { 31: [2, 64] }, { 14: [2, 11] }, { 21: [2, 28], 31: [2, 28], 52: [2, 28], 62: [2, 28], 66: [2, 28], 69: [2, 28] }, { 5: [2, 20], 13: [2, 20], 14: [2, 20], 17: [2, 20], 27: [2, 20], 32: [2, 20], 37: [2, 20], 42: [2, 20], 45: [2, 20], 46: [2, 20], 49: [2, 20], 53: [2, 20] }, { 31: [2, 69], 40: 122, 68: 123, 69: [1, 108] }, { 31: [2, 66], 59: [2, 66], 66: [2, 66], 69: [2, 66], 74: [2, 66], 75: [2, 66], 76: [2, 66], 77: [2, 66], 78: [2, 66], 79: [2, 66] }, { 31: [2, 68], 69: [2, 68] }, { 21: [2, 26], 31: [2, 26], 52: [2, 26], 59: [2, 26], 62: [2, 26], 66: [2, 26], 69: [2, 26], 74: [2, 26], 75: [2, 26], 76: [2, 26], 77: [2, 26], 78: [2, 26], 79: [2, 26] }, { 13: [2, 14], 14: [2, 14], 17: [2, 14], 27: [2, 14], 32: [2, 14], 37: [2, 14], 42: [2, 14], 45: [2, 14], 46: [2, 14], 49: [2, 14], 53: [2, 14] }, { 66: [1, 125], 71: [1, 124] }, { 66: [2, 91], 71: [2, 91] }, { 13: [2, 15], 14: [2, 15], 17: [2, 15], 27: [2, 15], 32: [2, 15], 42: [2, 15], 45: [2, 15], 46: [2, 15], 49: [2, 15], 53: [2, 15] }, { 31: [1, 126] }, { 31: [2, 70] }, { 31: [2, 29] }, { 66: [2, 92], 71: [2, 92] }, { 13: [2, 16], 14: [2, 16], 17: [2, 16], 27: [2, 16], 32: [2, 16], 37: [2, 16], 42: [2, 16], 45: [2, 16], 46: [2, 16], 49: [2, 16], 53: [2, 16] }], - defaultActions: { 4: [2, 1], 49: [2, 50], 51: [2, 19], 55: [2, 52], 64: [2, 76], 73: [2, 80], 78: [2, 17], 82: [2, 84], 92: [2, 48], 99: [2, 18], 100: [2, 72], 105: [2, 88], 107: [2, 58], 110: [2, 64], 111: [2, 11], 123: [2, 70], 124: [2, 29] }, - parseError: function parseError(str, hash) { - throw new Error(str); - }, - parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], - lstack = [], - table = this.table, - yytext = "", - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; - function popStack(n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - function lex() { - var token; - token = self.lexer.lex() || 1; - if (typeof token !== "number") { - token = self.symbols_[token] || token; - } - return token; - } - var symbol, - preErrorSymbol, - state, - action, - a, - r, - yyval = {}, - p, - len, - newState, - expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == "undefined") { - symbol = lex(); - } - action = table[state] && table[state][symbol]; - } - if (typeof action === "undefined" || !action.length || !action[0]) { - var errStr = ""; - if (!recovering) { - expected = []; - for (p in table[state]) if (this.terminals_[p] && p > 2) { - expected.push("'" + this.terminals_[p] + "'"); - } - if (this.lexer.showPosition) { - errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1 ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'"); - } - this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected }); - } - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) recovering--; - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column }; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - if (typeof r !== "undefined") { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; - } - } - return true; - } - }; - /* Jison generated lexer */ - var lexer = (function () { - var lexer = { EOF: 1, - parseError: function parseError(str, hash) { - if (this.yy.parser) { - this.yy.parser.parseError(str, hash); - } else { - throw new Error(str); - } - }, - setInput: function setInput(input) { - this._input = input; - this._more = this._less = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ""; - this.conditionStack = ["INITIAL"]; - this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0 }; - if (this.options.ranges) this.yylloc.range = [0, 0]; - this.offset = 0; - return this; - }, - input: function input() { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) this.yylloc.range[1]++; - - this._input = this._input.slice(1); - return ch; - }, - unput: function unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) this.yylineno -= lines.length - 1; - var r = this.yylloc.range; - - this.yylloc = { first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - return this; - }, - more: function more() { - this._more = true; - return this; - }, - less: function less(n) { - this.unput(this.match.slice(n)); - }, - pastInput: function pastInput() { - var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, ""); - }, - upcomingInput: function upcomingInput() { - var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20 - next.length); - } - return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, ""); - }, - showPosition: function showPosition() { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; - }, - next: function next() { - if (this.done) { - return this.EOF; - } - if (!this._input) this.done = true; - - var token, match, tempMatch, index, col, lines; - if (!this._more) { - this.yytext = ""; - this.match = ""; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (!this.options.flex) break; - } - } - if (match) { - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) this.yylineno += lines.length; - this.yylloc = { first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, rules[index], this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) this.done = false; - if (token) { - return token; - } else { - return; - } - } - if (this._input === "") { - return this.EOF; - } else { - return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), { text: "", token: null, line: this.yylineno }); - } - }, - lex: function lex() { - var r = this.next(); - if (typeof r !== "undefined") { - return r; - } else { - return this.lex(); - } - }, - begin: function begin(condition) { - this.conditionStack.push(condition); - }, - popState: function popState() { - return this.conditionStack.pop(); - }, - _currentRules: function _currentRules() { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - }, - topState: function topState() { - return this.conditionStack[this.conditionStack.length - 2]; - }, - pushState: function begin(condition) { - this.begin(condition); - } }; - lexer.options = {}; - lexer.performAction = function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { - - function strip(start, end) { - return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng - end); - } - - var YYSTATE = YY_START; - switch ($avoiding_name_collisions) { - case 0: - if (yy_.yytext.slice(-2) === "\\\\") { - strip(0, 1); - this.begin("mu"); - } else if (yy_.yytext.slice(-1) === "\\") { - strip(0, 1); - this.begin("emu"); - } else { - this.begin("mu"); - } - if (yy_.yytext) { - return 14; - }break; - case 1: - return 14; - break; - case 2: - this.popState(); - return 14; - - break; - case 3: - yy_.yytext = yy_.yytext.substr(5, yy_.yyleng - 9); - this.popState(); - return 16; - - break; - case 4: - return 14; - break; - case 5: - this.popState(); - return 13; - - break; - case 6: - return 59; - break; - case 7: - return 62; - break; - case 8: - return 17; - break; - case 9: - this.popState(); - this.begin("raw"); - return 21; - - break; - case 10: - return 53; - break; - case 11: - return 27; - break; - case 12: - return 45; - break; - case 13: - this.popState();return 42; - break; - case 14: - this.popState();return 42; - break; - case 15: - return 32; - break; - case 16: - return 37; - break; - case 17: - return 49; - break; - case 18: - return 46; - break; - case 19: - this.unput(yy_.yytext); - this.popState(); - this.begin("com"); - - break; - case 20: - this.popState(); - return 13; - - break; - case 21: - return 46; - break; - case 22: - return 67; - break; - case 23: - return 66; - break; - case 24: - return 66; - break; - case 25: - return 81; - break; - case 26: - // ignore whitespace - break; - case 27: - this.popState();return 52; - break; - case 28: - this.popState();return 31; - break; - case 29: - yy_.yytext = strip(1, 2).replace(/\\"/g, "\"");return 74; - break; - case 30: - yy_.yytext = strip(1, 2).replace(/\\'/g, "'");return 74; - break; - case 31: - return 79; - break; - case 32: - return 76; - break; - case 33: - return 76; - break; - case 34: - return 77; - break; - case 35: - return 78; - break; - case 36: - return 75; - break; - case 37: - return 69; - break; - case 38: - return 71; - break; - case 39: - return 66; - break; - case 40: - return 66; - break; - case 41: - return "INVALID"; - break; - case 42: - return 5; - break; - } - }; - lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/, /^(?:[^\x00]+)/, /^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/, /^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/, /^(?:[^\x00]*?(?=(\{\{\{\{\/)))/, /^(?:[\s\S]*?--(~)?\}\})/, /^(?:\()/, /^(?:\))/, /^(?:\{\{\{\{)/, /^(?:\}\}\}\})/, /^(?:\{\{(~)?>)/, /^(?:\{\{(~)?#)/, /^(?:\{\{(~)?\/)/, /^(?:\{\{(~)?\^\s*(~)?\}\})/, /^(?:\{\{(~)?\s*else\s*(~)?\}\})/, /^(?:\{\{(~)?\^)/, /^(?:\{\{(~)?\s*else\b)/, /^(?:\{\{(~)?\{)/, /^(?:\{\{(~)?&)/, /^(?:\{\{(~)?!--)/, /^(?:\{\{(~)?![\s\S]*?\}\})/, /^(?:\{\{(~)?)/, /^(?:=)/, /^(?:\.\.)/, /^(?:\.(?=([=~}\s\/.)|])))/, /^(?:[\/.])/, /^(?:\s+)/, /^(?:\}(~)?\}\})/, /^(?:(~)?\}\})/, /^(?:"(\\["]|[^"])*")/, /^(?:'(\\[']|[^'])*')/, /^(?:@)/, /^(?:true(?=([~}\s)])))/, /^(?:false(?=([~}\s)])))/, /^(?:undefined(?=([~}\s)])))/, /^(?:null(?=([~}\s)])))/, /^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/, /^(?:as\s+\|)/, /^(?:\|)/, /^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/, /^(?:\[[^\]]*\])/, /^(?:.)/, /^(?:$)/]; - lexer.conditions = { mu: { rules: [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42], inclusive: false }, emu: { rules: [2], inclusive: false }, com: { rules: [5], inclusive: false }, raw: { rules: [3, 4], inclusive: false }, INITIAL: { rules: [0, 1, 42], inclusive: true } }; - return lexer; - })(); - parser.lexer = lexer; - function Parser() { - this.yy = {}; - }Parser.prototype = parser;parser.Parser = Parser; - return new Parser(); - })();exports["default"] = handlebars; - module.exports = exports["default"]; - - /***/ }, - /* 15 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - - var _Visitor = __webpack_require__(6); - - var _Visitor2 = _interopRequireWildcard(_Visitor); - - function WhitespaceControl() {} - WhitespaceControl.prototype = new _Visitor2['default'](); - - WhitespaceControl.prototype.Program = function (program) { - var isRoot = !this.isRootSeen; - this.isRootSeen = true; - - var body = program.body; - for (var i = 0, l = body.length; i < l; i++) { - var current = body[i], - strip = this.accept(current); - - if (!strip) { - continue; - } - - var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot), - _isNextWhitespace = isNextWhitespace(body, i, isRoot), - openStandalone = strip.openStandalone && _isPrevWhitespace, - closeStandalone = strip.closeStandalone && _isNextWhitespace, - inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace; - - if (strip.close) { - omitRight(body, i, true); - } - if (strip.open) { - omitLeft(body, i, true); - } - - if (inlineStandalone) { - omitRight(body, i); - - if (omitLeft(body, i)) { - // If we are on a standalone node, save the indent info for partials - if (current.type === 'PartialStatement') { - // Pull out the whitespace from the final line - current.indent = /([ \t]+$)/.exec(body[i - 1].original)[1]; - } - } - } - if (openStandalone) { - omitRight((current.program || current.inverse).body); - - // Strip out the previous content node if it's whitespace only - omitLeft(body, i); - } - if (closeStandalone) { - // Always strip the next node - omitRight(body, i); - - omitLeft((current.inverse || current.program).body); - } - } - - return program; - }; - WhitespaceControl.prototype.BlockStatement = function (block) { - this.accept(block.program); - this.accept(block.inverse); - - // Find the inverse program that is involed with whitespace stripping. - var program = block.program || block.inverse, - inverse = block.program && block.inverse, - firstInverse = inverse, - lastInverse = inverse; - - if (inverse && inverse.chained) { - firstInverse = inverse.body[0].program; - - // Walk the inverse chain to find the last inverse that is actually in the chain. - while (lastInverse.chained) { - lastInverse = lastInverse.body[lastInverse.body.length - 1].program; - } - } - - var strip = { - open: block.openStrip.open, - close: block.closeStrip.close, - - // Determine the standalone candiacy. Basically flag our content as being possibly standalone - // so our parent can determine if we actually are standalone - openStandalone: isNextWhitespace(program.body), - closeStandalone: isPrevWhitespace((firstInverse || program).body) - }; - - if (block.openStrip.close) { - omitRight(program.body, null, true); - } - - if (inverse) { - var inverseStrip = block.inverseStrip; - - if (inverseStrip.open) { - omitLeft(program.body, null, true); - } - - if (inverseStrip.close) { - omitRight(firstInverse.body, null, true); - } - if (block.closeStrip.open) { - omitLeft(lastInverse.body, null, true); - } - - // Find standalone else statments - if (isPrevWhitespace(program.body) && isNextWhitespace(firstInverse.body)) { - omitLeft(program.body); - omitRight(firstInverse.body); - } - } else if (block.closeStrip.open) { - omitLeft(program.body, null, true); - } - - return strip; - }; - - WhitespaceControl.prototype.MustacheStatement = function (mustache) { - return mustache.strip; - }; - - WhitespaceControl.prototype.PartialStatement = WhitespaceControl.prototype.CommentStatement = function (node) { - /* istanbul ignore next */ - var strip = node.strip || {}; - return { - inlineStandalone: true, - open: strip.open, - close: strip.close - }; - }; - - function isPrevWhitespace(body, i, isRoot) { - if (i === undefined) { - i = body.length; - } - - // Nodes that end with newlines are considered whitespace (but are special - // cased for strip operations) - var prev = body[i - 1], - sibling = body[i - 2]; - if (!prev) { - return isRoot; - } - - if (prev.type === 'ContentStatement') { - return (sibling || !isRoot ? /\r?\n\s*?$/ : /(^|\r?\n)\s*?$/).test(prev.original); - } - } - function isNextWhitespace(body, i, isRoot) { - if (i === undefined) { - i = -1; - } - - var next = body[i + 1], - sibling = body[i + 2]; - if (!next) { - return isRoot; - } - - if (next.type === 'ContentStatement') { - return (sibling || !isRoot ? /^\s*?\r?\n/ : /^\s*?(\r?\n|$)/).test(next.original); - } - } - - // Marks the node to the right of the position as omitted. - // I.e. {{foo}}' ' will mark the ' ' node as omitted. - // - // If i is undefined, then the first child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitRight(body, i, multiple) { - var current = body[i == null ? 0 : i + 1]; - if (!current || current.type !== 'ContentStatement' || !multiple && current.rightStripped) { - return; - } - - var original = current.value; - current.value = current.value.replace(multiple ? /^\s+/ : /^[ \t]*\r?\n?/, ''); - current.rightStripped = current.value !== original; - } - - // Marks the node to the left of the position as omitted. - // I.e. ' '{{foo}} will mark the ' ' node as omitted. - // - // If i is undefined then the last child will be marked as such. - // - // If mulitple is truthy then all whitespace will be stripped out until non-whitespace - // content is met. - function omitLeft(body, i, multiple) { - var current = body[i == null ? body.length - 1 : i - 1]; - if (!current || current.type !== 'ContentStatement' || !multiple && current.leftStripped) { - return; - } - - // We omit the last node if it's whitespace only and not preceeded by a non-content node. - var original = current.value; - current.value = current.value.replace(multiple ? /\s+$/ : /[ \t]+$/, ''); - current.leftStripped = current.value !== original; - return current.leftStripped; - } - - exports['default'] = WhitespaceControl; - module.exports = exports['default']; - - /***/ }, - /* 16 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var _interopRequireWildcard = __webpack_require__(8)['default']; - - exports.__esModule = true; - exports.SourceLocation = SourceLocation; - exports.id = id; - exports.stripFlags = stripFlags; - exports.stripComment = stripComment; - exports.preparePath = preparePath; - exports.prepareMustache = prepareMustache; - exports.prepareRawBlock = prepareRawBlock; - exports.prepareBlock = prepareBlock; - - var _Exception = __webpack_require__(11); - - var _Exception2 = _interopRequireWildcard(_Exception); - - function SourceLocation(source, locInfo) { - this.source = source; - this.start = { - line: locInfo.first_line, - column: locInfo.first_column - }; - this.end = { - line: locInfo.last_line, - column: locInfo.last_column - }; - } - - function id(token) { - if (/^\[.*\]$/.test(token)) { - return token.substr(1, token.length - 2); - } else { - return token; - } - } - - function stripFlags(open, close) { - return { - open: open.charAt(2) === '~', - close: close.charAt(close.length - 3) === '~' - }; - } - - function stripComment(comment) { - return comment.replace(/^\{\{~?\!-?-?/, '').replace(/-?-?~?\}\}$/, ''); - } - - function preparePath(data, parts, locInfo) { - locInfo = this.locInfo(locInfo); - - var original = data ? '@' : '', - dig = [], - depth = 0, - depthString = ''; - - for (var i = 0, l = parts.length; i < l; i++) { - var part = parts[i].part, - - // If we have [] syntax then we do not treat path references as operators, - // i.e. foo.[this] resolves to approximately context.foo['this'] - isLiteral = parts[i].original !== part; - original += (parts[i].separator || '') + part; - - if (!isLiteral && (part === '..' || part === '.' || part === 'this')) { - if (dig.length > 0) { - throw new _Exception2['default']('Invalid path: ' + original, { loc: locInfo }); - } else if (part === '..') { - depth++; - depthString += '../'; - } - } else { - dig.push(part); - } - } - - return new this.PathExpression(data, depth, dig, original, locInfo); - } - - function prepareMustache(path, params, hash, open, strip, locInfo) { - // Must use charAt to support IE pre-10 - var escapeFlag = open.charAt(3) || open.charAt(2), - escaped = escapeFlag !== '{' && escapeFlag !== '&'; - - return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo)); - } - - function prepareRawBlock(openRawBlock, content, close, locInfo) { - if (openRawBlock.path.original !== close) { - var errorNode = { loc: openRawBlock.path.loc }; - - throw new _Exception2['default'](openRawBlock.path.original + ' doesn\'t match ' + close, errorNode); - } - - locInfo = this.locInfo(locInfo); - var program = new this.Program([content], null, {}, locInfo); - - return new this.BlockStatement(openRawBlock.path, openRawBlock.params, openRawBlock.hash, program, undefined, {}, {}, {}, locInfo); - } - - function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) { - // When we are chaining inverse calls, we will not have a close path - if (close && close.path && openBlock.path.original !== close.path.original) { - var errorNode = { loc: openBlock.path.loc }; - - throw new _Exception2['default'](openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode); - } - - program.blockParams = openBlock.blockParams; - - var inverse = undefined, - inverseStrip = undefined; - - if (inverseAndProgram) { - if (inverseAndProgram.chain) { - inverseAndProgram.program.body[0].closeStrip = close.strip; - } - - inverseStrip = inverseAndProgram.strip; - inverse = inverseAndProgram.program; - } - - if (inverted) { - inverted = inverse; - inverse = program; - program = inverted; - } - - return new this.BlockStatement(openBlock.path, openBlock.params, openBlock.hash, program, inverse, openBlock.strip, inverseStrip, close && close.strip, this.locInfo(locInfo)); - } - - /***/ }, - /* 17 */ - /***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - /*global define */ - - var _isArray = __webpack_require__(12); - - var SourceNode = undefined; - - try { - /* istanbul ignore next */ - if (false) { - // We don't support this in AMD environments. For these environments, we asusme that - // they are running on the browser and thus have no need for the source-map library. - var SourceMap = require('source-map'); - SourceNode = SourceMap.SourceNode; - } - } catch (err) {} - - /* istanbul ignore if: tested but not covered in istanbul due to dist build */ - if (!SourceNode) { - SourceNode = function (line, column, srcFile, chunks) { - this.src = ''; - if (chunks) { - this.add(chunks); - } - }; - /* istanbul ignore next */ - SourceNode.prototype = { - add: function add(chunks) { - if (_isArray.isArray(chunks)) { - chunks = chunks.join(''); - } - this.src += chunks; - }, - prepend: function prepend(chunks) { - if (_isArray.isArray(chunks)) { - chunks = chunks.join(''); - } - this.src = chunks + this.src; - }, - toStringWithSourceMap: function toStringWithSourceMap() { - return { code: this.toString() }; - }, - toString: function toString() { - return this.src; - } - }; - } - - function castChunk(chunk, codeGen, loc) { - if (_isArray.isArray(chunk)) { - var ret = []; - - for (var i = 0, len = chunk.length; i < len; i++) { - ret.push(codeGen.wrap(chunk[i], loc)); - } - return ret; - } else if (typeof chunk === 'boolean' || typeof chunk === 'number') { - // Handle primitives that the SourceNode will throw up on - return chunk + ''; - } - return chunk; - } - - function CodeGen(srcFile) { - this.srcFile = srcFile; - this.source = []; - } - - CodeGen.prototype = { - prepend: function prepend(source, loc) { - this.source.unshift(this.wrap(source, loc)); - }, - push: function push(source, loc) { - this.source.push(this.wrap(source, loc)); - }, - - merge: function merge() { - var source = this.empty(); - this.each(function (line) { - source.add([' ', line, '\n']); - }); - return source; - }, - - each: function each(iter) { - for (var i = 0, len = this.source.length; i < len; i++) { - iter(this.source[i]); - } - }, - - empty: function empty() { - var loc = arguments[0] === undefined ? this.currentLocation || { start: {} } : arguments[0]; - - return new SourceNode(loc.start.line, loc.start.column, this.srcFile); - }, - wrap: function wrap(chunk) { - var loc = arguments[1] === undefined ? this.currentLocation || { start: {} } : arguments[1]; - - if (chunk instanceof SourceNode) { - return chunk; - } - - chunk = castChunk(chunk, this, loc); - - return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk); - }, - - functionCall: function functionCall(fn, type, params) { - params = this.generateList(params); - return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']); - }, - - quotedString: function quotedString(str) { - return '"' + (str + '').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 - .replace(/\u2029/g, '\\u2029') + '"'; - }, - - objectLiteral: function objectLiteral(obj) { - var pairs = []; - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - var value = castChunk(obj[key], this); - if (value !== 'undefined') { - pairs.push([this.quotedString(key), ':', value]); - } - } - } - - var ret = this.generateList(pairs); - ret.prepend('{'); - ret.add('}'); - return ret; - }, - - generateList: function generateList(entries, loc) { - var ret = this.empty(loc); - - for (var i = 0, len = entries.length; i < len; i++) { - if (i) { - ret.add(','); - } - - ret.add(castChunk(entries[i], this, loc)); - } - - return ret; - }, - - generateArray: function generateArray(entries, loc) { - var ret = this.generateList(entries, loc); - ret.prepend('['); - ret.add(']'); - - return ret; - } - }; - - exports['default'] = CodeGen; - module.exports = exports['default']; - - /* NOP */ - - /***/ } - /******/ ]) - }); - ; - -/***/ }, -/* 4 */, -/* 5 */, -/* 6 */, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function(Handlebars) { - // Handlebars helpers - Handlebars.registerHelper('concat', function() { - var size = (arguments.length - 1), - output = ''; - for(var i = 0; i < size; i++) { - output += arguments[i]; - }; - return output; - }); - - Handlebars.registerHelper('number_format', function(value, block) { - return Number(value).toLocaleString(); - }); - Handlebars.registerHelper('date_format', function(timestamp, block) { - if(window.moment) { - if(timestamp === undefined || isNaN(timestamp) || timestamp <= 0) { - return; - } - - // set date format - var f = block.hash.format || "MMM Do, YYYY"; - // check if we passed a timestamp - if(parseInt(timestamp, 10) == timestamp) { - return moment.unix(timestamp).format(f); - } else { - return moment.utc(timestamp).format(f); - } - } else { - return timestamp; - }; - }); - - Handlebars.registerHelper('cycle', function(value, block) { - var values = value.split(' '); - return values[block.data.index % (values.length + 1)]; - }); - - Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) { - switch (operator) { - case '==': - return (v1 == v2) ? options.fn(this) : options.inverse(this); - case '===': - return (v1 === v2) ? options.fn(this) : options.inverse(this); - case '!=': - return (v1 != v2) ? options.fn(this) : options.inverse(this); - case '!==': - return (v1 !== v2) ? options.fn(this) : options.inverse(this); - case '<': - return (v1 < v2) ? options.fn(this) : options.inverse(this); - case '<=': - return (v1 <= v2) ? options.fn(this) : options.inverse(this); - case '>': - return (v1 > v2) ? options.fn(this) : options.inverse(this); - case '>=': - return (v1 >= v2) ? options.fn(this) : options.inverse(this); - case '&&': - return (v1 && v2) ? options.fn(this) : options.inverse(this); - case '||': - return (v1 || v2) ? options.fn(this) : options.inverse(this); - case 'in': - var values = v2.split(','); - return (v2.indexOf(v1) !== -1) ? options.fn(this) : options.inverse(this); - default: - return options.inverse(this); - } - }); - - Handlebars.registerHelper('nl2br', function(value, block) { - return value.gsub("\n", "
"); - }); - - Handlebars.registerHelper('json_encode', function(value, block) { - return JSON.stringify(value); - }); - - Handlebars.registerHelper('json_decode', function(value, block) { - return JSON.parse(value); - }); - Handlebars.registerHelper('url', function(value, block) { - var url = window.location.protocol + "//" + window.location.host + window.location.pathname; - - return url + value; - }); - Handlebars.registerHelper('emailFromMailto', function(value) { - var mailtoMatchingRegex = /^mailto\:/i; - if (typeof value === 'string' && value.match(mailtoMatchingRegex)) { - return value.replace(mailtoMatchingRegex, ''); - } else { - return value; - } - }); - Handlebars.registerHelper('lookup', function(obj, field, options) { - return obj && obj[field]; - }); - - - Handlebars.registerHelper('rsa_key', function(value, block) { - // extract all lines into an array - if(value === undefined) return ''; - - var lines = value.trim().split("\n"); - - // remove header & footer - lines.shift(); - lines.pop(); - - // return concatenated lines - return lines.join(''); - }); - - Handlebars.registerHelper('trim', function(value, block) { - if(value === null || value === undefined) return ''; - return value.trim(); - }); - - /** - * {{ellipsis}} - * From: https://github.com/assemble/handlebars-helpers - * @author: Jon Schlinkert - * Truncate the input string and removes all HTML tags - * @param {String} str The input string. - * @param {Number} limit The number of characters to limit the string. - * @param {String} append The string to append if charaters are omitted. - * @return {String} The truncated string. - */ - Handlebars.registerHelper('ellipsis', function (str, limit, append) { - if (append === undefined) { - append = ''; - } - var sanitized = str.replace(/(<([^>]+)>)/g, ''); - if (sanitized.length > limit) { - return sanitized.substr(0, limit - append.length) + append; - } else { - return sanitized; - } - }); - - Handlebars.registerHelper('getNumber', function (string) { - return parseInt(string, 10); - }); - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - - -/***/ } -/******/ ]); \ No newline at end of file