6688 lines
		
	
	
	
		
			358 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			6688 lines
		
	
	
	
		
			358 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Mosaico = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
 | 
						|
var templateSystem=require("../src/js/bindings/choose-template.js");document.addEventListener("DOMContentLoaded",function(e){templateSystem.addTemplate("array","\x3c!-- ko foreach: $data --\x3e\x3c!-- ko block: $data --\x3e\x3c!-- /ko --\x3e\x3c!-- /ko --\x3e"),templateSystem.addTemplate("block-show","\x3c!-- ko block: $data, scrollIntoView: $root.selectedBlock() === $data --\x3e\x3c!-- /ko --\x3e"),templateSystem.addTemplate("block-wysiwyg",'<div class="editable block" data-drop-content="Drop here" data-bind="attr: { \'data-drop-content\': $root.t(\'Drop here\') }, click: function(obj, evt) { $root.selectBlock(obj); return true }, clickBubble: false, css: { selected: $root.selectedBlock() === $data }, scrollIntoView: $root.selectedBlock() === $data">  <div class="mo-blockselectionhelper"></div>  <div class="tools" data-bind="tooltips: {}">    \x3c!-- ko if: typeof $index != \'undefined\' --\x3e    <div title="Drag this handle to move the block" data-bind="attr: { title: $root.t(\'Drag this handle to move the block\') }" class="tool handle"><i class="fa fa-fw fa-sort"></i></div>    \x3c!-- ko if: $index() > 0 --\x3e    <div title="Move this block upside" data-bind="attr: { title: $root.t(\'Move this block upside\') }" class="tool moveup"><i class="fa fa-fw fa-sort-asc" data-bind=\'click: $root.moveBlock.bind($element, $index, $parent, true)\'></i></div>    \x3c!-- /ko --\x3e    \x3c!-- ko if: $index() < $parent.blocks().length -1 --\x3e    <div title="Move this block downside" data-bind="attr: { title: $root.t(\'Move this block downside\') }" class="tool movedown"><i class="fa fa-fw fa-sort-desc" data-bind=\'click: $root.moveBlock.bind($element, $index, $parent, false)\'></i></div>    \x3c!-- /ko --\x3e    <div title="Delete block" class="tool delete" data-bind="attr: { title: $root.t(\'Delete block\') }, click: $root.removeBlock.bind($element, $rawData, $parent)"><i class="fa fa-fw fa-trash-o"></i></div>    <div title="Duplicate block" class="tool clone" data-bind="attr: { title: $root.t(\'Duplicate block\') }, click: $root.duplicateBlock.bind($element, $index, $parent)"><i class="fa fa-fw fa-files-o"></i></div>    \x3c!-- /ko --\x3e    \x3c!-- ko if: typeof $data._nextVariant != \'undefined\' --\x3e<div title="Switch block variant" class="tool variant" data-bind="attr: { title: $root.t(\'Switch block variant\') }, click: $data._nextVariant"><i class="fa fa-fw fa-magic"></i></div>\x3c!-- /ko --\x3e  </div>  \x3c!-- ko block: $data --\x3e\x3c!-- /ko --\x3e</div>'),templateSystem.addTemplate("blocks-show","\x3c!-- ko template: { name: 'block-show', foreach: blocks } --\x3e\x3c!-- /ko --\x3e"),templateSystem.addTemplate("blocks-wysiwyg","<div class=\"sortable-blocks-edit\" data-drop-content=\"Drop here\" data-empty-content=\"Drop here blocks from the Blocks tab\" data-bind=\"attr: { 'data-drop-content': $root.t('Drop here'), 'data-empty-content': $root.t('Drop here blocks from the "Blocks" tab') }, css: { 'empty': ko.utils.unwrapObservable(blocks).length == 0 }, extsortable: { connectClass: 'sortable-blocks-edit', template: 'block-wysiwyg', data: blocks, dragging: $root.dragging, beforeMove: $root.startMultiple, afterMove: $root.stopMultiple, options: { handle: '.handle', placeholder: $root.placeholderHelper } }\"></div>"),templateSystem.addTemplate("customstyle",'<div class="customStyleHelp" data-bind="html: $root.t(\'Customized block.<ul><li>In this status changes to properties will be specific to the current block (instead of being global to all blocks in the same section)</li><li>A <span class="customStyled"><span>"small cube" </span></span> icon beside the property will mark the customization. By clicking this icon the property value will be reverted to the value defined for the section.</li></ul>\')">Customized block.<ul><li>In this status changes to properties will be specific to the current block (instead of being global to all blocks in the same section)</li><li>A <span class="customStyled"><span>"small cube" </span></span> icon beside the property will mark the customization. By clicking this icon the property value will be reverted to the value defined for the section.</li></ul></div>'),templateSystem.addTemplate("empty",""),templateSystem.addTemplate("error",'[<div style="background-color: #fff0f0" data-bind="text: ko.toJS($data)"></div>]'),templateSystem.addTemplate("gallery-images",'<div data-bind="foreach: items.currentPageData">  <div class="draggable-item" data-bind="if: typeof thumbnailUrl != \'undefined\'">    <div class="draggable image" data-bind="click: $root.addImage, extdraggable: { data: $data, dropContainer: \'#main-wysiwyg-area\', dragging: $root.draggingImage, \'options\': { \'appendTo\': \'#page\' } }, style: { backgroundImage: \'url(\\\'\' + thumbnailUrl + \'\\\')\' }">      <img title="Drag this image and drop it on any template image placeholder" style="display: block;" data-bind="tooltips: {}, attr: { src: thumbnailUrl, \'title\': $root.t(\'Drag this image and drop it on any template image placeholder\') }"/>    </div>  </div></div>\x3c!-- ko if: items.pageCount() > 1 --\x3e<div class="galleryPager" data-bind="buttonset: {}">  <a href="javascript:void(0)" data-bind="click: items.moveFirst, button: { disabled: items.currentPage() == 1, icons: { primary: \'fa fa-fast-backward\' }, text: false }">First</a>  <a href="javascript:void(0)" data-bind="click: items.movePrevious, button: { disabled: items.currentPage() == 1, icons: { primary: \'fa fa-backward\' }, text: false }">Previous</a>  <span data-bind="button: { disabled: true, text: true, label: \' \'+items.currentPage()+\' di \'+items.pageCount()+\' \' }"> X di Y </span>  <a href="javascript:void(0)" data-bind="click: items.moveNext, button: { disabled: items.currentPage() == items.pageCount(), icons: { primary: \'fa fa-forward\' }, text: false }">Next</a>  <a href="javascript:void(0)" data-bind="click: items.moveLast, button: { disabled: items.currentPage() == items.pageCount(), icons: { primary: \'fa fa-fast-forward\' }, text: false }">Last</a></div>\x3c!-- /ko --\x3e'),templateSystem.addTemplate("img-wysiwyg",'<table tabfocus="0" cellspacing="0" cellpadding="0" data-drop-content="Drop here" data-bind="style: _stylebind, click: function(obj, evt) { $root.selectItem(_item, _data); return true; }, clickBubble: false, fudroppable: { activeClass: \'ui-state-highlight\', hoverClass: \'ui-state-draghover\' }, droppable: { options: { accept: \'.image\', activeClass: \'ui-state-highlight\', hoverClass: \'ui-state-draghover\' }, data: _src, dragged: $root.fileToImage }, css: { selecteditem: $root.isSelectedItem(_item) }, scrollIntoView: $root.isSelectedItem(_item), attr: { \'data-drop-content\': $root.t(\'Drop here\'), width: _width, height: _height, align: _align }"  class="img-wysiwyg selectable-img" style="display: table;"><tr><td class="uploadzone">  <div class="mo-imgselectionhelper"></div>  <div class="mo-uploadzone"></div>  <div class="img-size" data-bind="text: _size">size</div>  <div class="midtools" data-bind="tooltips: {}">    \x3c!-- ko if: _src() != \'\' --\x3e    <div title="Remove image" class="tool delete" data-bind="attr: { title: $root.t(\'Remove image\') }, click: _src.bind(_src, \'\'), clickBubble: false"><i class="fa fa-fw fa-trash-o"></i></div>    \x3c!-- ko if: typeof $root.editImage !== \'undefined\' --\x3e    <div title="Open the image editing tool" class="tool edit" data-bind="attr: { title: $root.t(\'Open the image editing tool\') }, click: $root.editImage.bind($element, _src), clickBubble: false"><i class="fa fa-fw fa-pencil"></i></div>    \x3c!-- /ko --\x3e    \x3c!-- /ko --\x3e    \x3c!-- ko if: _src() == \'\' --\x3e    <div title="Upload a new image" data-bind="attr: { title: $root.t(\'Upload a new image\') }" class="tool upload" style="position: relative; overflow: hidden;"><i class="fa fa-fw fa-upload"></i>      <input class="fileupload nofile" type="file" name="files[]" data-bind="fileupload: { data: _src, onerror: $root.notifier.error, onfile: $root.loadImage, canvasPreview: true }" style="z-index: 20; position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-width: 100%; min-height: 100%; font-size: 999px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; cursor: inherit; display: block">    </div>    \x3c!-- /ko --\x3e  </div>  \x3c!-- ko template: _template --\x3e\x3c!-- /ko --\x3e  \x3c!-- ko if: _src() == \'\' --\x3e    \x3c!--    <img style="display: block;" class="imgplaceholder" width="200" src="" alt="Insert an image here" data-bind="wysiwygSrc: { src: _src.preloaded, placeholder: _placeholdersrc, width: _width, height: _height, method: _method }" />    --\x3e    <span class="fileuploadtext" style="text-align: center; display: -ms-flexbox; display: flex; align-items: center; flex-align: center; justify-content: center; padding: 1em; position: absolute; top: 0; left: 0; right: 0; bottom: 0;"><span class="textMiddle" style=" text-shadow: 1px 1px 0 #FFFFFF, 0 0 10px #FFFFFF; font-weight: bold;" data-bind="text: $root.t(\'Drop an image here\')">Drop an image here</span></span>  \x3c!-- /ko --\x3e  \x3c!-- ko if: _src() != \'\' --\x3e  \x3c!--    <img style="display: block;" width="200" src="" data-bind="preloader: _src, wysiwygSrc: { src: _src.preloaded, placeholder: _placeholdersrc, width: _width, height: _height, method: _method }" />    --\x3e  \x3c!-- /ko --\x3e  \x3c!-- pulsante per la cancellazione --\x3e  <div title="Drop an image here or click the upload button" data-bind="attr: { title: $root.t(\'Drop an image here or click the upload button\') }, tooltips: {}" class="workzone" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden;">    \x3c!-- ko if: _src.preloaded && _src() != _src.preloaded() --\x3ePRELOADING....\x3c!-- /ko --\x3e    \x3c!-- ko if: _src() != \'\' --\x3e      <input class="fileupload withfile" type="file" name="files[]" data-bind="fileupload: { data: _src, onerror: $root.notifier.error, onfile: $root.galleryRecent.unshift.bind($root.galleryRecent), canvasPreview: true }" style="z-index: -20; position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-width: 100%; min-height: 100%; font-zie: 999px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; cursor: inherit; display: block">    \x3c!-- /ko --\x3e    <div class="progress" style="opacity: .5; width: 80%; margin-left: 10%; position: absolute; bottom: 30%; height: 20px; border: 2px solid black;">      <div class="progress-bar progress-bar-success" style="height: 20px; background-color: black; "></div>    </div>  </div></table>'),templateSystem.addTemplate("main",'<div id="page" style="display: none;" data-bind="visible: true, css: { withToolbox: $root.showToolbox, withPreviewFrame: showPreviewFrame }">  <div id="main-edit-area" data-bind="click: function(obj, evt) { $root.selectBlock(null); return true; }, clickBubble: false">    \x3c!-- ko withProperties: { templateMode: \'wysiwyg\', templateModeFallback: \'show\' } --\x3e    <div id="main-wysiwyg-area" data-bind="wysiwygScrollfix: true, scrollable: true, fudroppable: { active: draggingImage }, css: { isdragging: dragging, isdraggingimg: draggingImage }, block: content"></div>    \x3c!-- /ko --\x3e  </div>  <div id="toolbar" class="mo" data-bind="tooltips: {}">    \x3c!-- ko if: typeof $root.undo != \'undefined\' --\x3e    <span data-bind="buttonset: { }" class="leftButtons">    <a title="Undo last operation" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Undo last operation\') }, click: $root.undo.execute, clickBubble: false, button: { disabled: !$root.undo.enabled(), icons: { primary: \'fa fa-reply\' }, label: $root.undo.name, text: true }">UNDO</a>    <a title="Redo last operation" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Redo last operation\') }, click: $root.redo.execute, clickBubble: false, button: { disabled: !$root.redo.enabled(), icons: { primary: \'fa fa-share\' }, label: $root.redo.name, text: true }">REDO</a>    </span>    \x3c!-- ko if: $root.debug --\x3e    <a href="javascript:void(0)" data-bind="click: $root.undoReset, clickBubble: false, button: { disabled: !$root.undo.enabled() && !$root.redo.enabled(), label: \'reset\', text: true }">RESET</a>    \x3c!-- /ko --\x3e    \x3c!-- /ko --\x3e    <span>    <input id="showGallery" type="checkbox" data-bind="checked: $root.showGallery, button: { refreshOn: $root.showGallery,     icons: { primary: \'fa fa-fw fa-picture-o\', secondary: null }, text: true, label: $root.t(\'Gallery\') }"><label title="Show image gallery" for="showGallery" data-bind="attr: { title: $root.t(\'Show image gallery\') }">show gallery</label></input>    </span>    <input id="previewFrameToggle" type="checkbox" data-bind="checked: $root.showPreviewFrame, button: { refreshOn: $root.showPreviewFrame, icons: { primary: \'fa fa-fw fa-tablet\', secondary: null }, text: false, label: $root.t(\'Preview\') }"><label title="Show live preview" for="previewFrameToggle" data-bind="attr: { title: $root.t(\'Show live preview\') }">PREVIEW</label></input>    \x3c!-- ko if: $root.debug --\x3e    <a href="javascript:void(0)" data-bind="click: $root.export, clickBubble: false, button: { label: \'export\', text: true }">EXPORT</a>    <input type="checkbox" data-bind="checked: $root.debug" /> debug    <a href="javascript:void(0)" data-bind="click: $root.loadDefaultBlocks, clickBubble: false, button: { icons: { primary: \'fa fa-fw fa-upload\' }, label: \'Default\', text: true }">LOAD BLOCKS</a>    [<a id="subscriptionsCount" href="javascript:viewModel.loopSubscriptionsCount()">subs</a>]    \x3c!-- /ko --\x3e    <span data-bind="visible: false">    <input type="checkbox" data-bind="checked: $root.showToolbox" /> toolbox    </span>    <div class="rightButtons">    \x3c!-- ko if: typeof $root.save !== \'undefined\' --\x3e    <a title="Save template" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Save template\') }, click: $root.save.execute, clickBubble: false, button: { disabled: !$root.save.enabled(), icons: { primary: \'fa fa-fw fa-cloud-upload\' }, label: $root.t($root.save.name), text: true }">SALVA</a>    \x3c!-- /ko --\x3e    \x3c!-- ko if: typeof $root.test !== \'undefined\' --\x3e    <a title="Show preview and send test" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Show preview and send test\') }, click: $root.test.execute, clickBubble: false, button: { disabled: !$root.test.enabled(), icons: { primary: \'fa fa-fw fa-paper-plane\' }, label: $root.t($root.test.name), text: true }">TEST</a>    \x3c!-- /ko --\x3e    \x3c!-- ko if: typeof $root.download !== \'undefined\' --\x3e    <form id="downloadForm" action="#" method="POST">    <input type="hidden" name="action" value="download" />    <input type="hidden" name="filename" value="email.html" />    <input type="hidden" name="html" id="downloadHtmlTextarea" />    <a title="Download template" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Download template\') }, click: $root.download.execute, clickBubble: false, button: { disabled: !$root.download.enabled(), icons: { primary: \'fa fa-fw fa-download\' }, label: $root.t($root.download.name), text: true }">DOWNLOAD</a>    </form>    \x3c!-- /ko --\x3e    </div>  </div>  \x3c!-- ko if: $root.showToolbox --\x3e  <div id="main-toolbox" class="mo" data-bind="scrollable: true, withProperties: { templateMode: \'edit\' }">    <div data-bind="template: { name: \'toolbox\' }"></div>  </div>  \x3c!-- /ko --\x3e    <div id="main-preview" class="mo" data-bind="scrollable: true, if: $root.showPreviewFrame">    <div id="preview-toolbar">      <div data-bind="visible: $root.showPreviewFrame, buttonset: { }" style="display: inline-block">        <input id="previewLarge" type="radio" name="previewMode" value="large" data-bind="checked: $root.previewMode, button: { text: false, label: \'large\', icons: { primary: \'fa fa-fw fa-desktop\' } }" />        <label for="previewLarge" title="Large screen" data-bind="attr: { title: $root.t(\'Large screen\') }">Large screen</label>        <input id="previewDesktop" type="radio" name="previewMode" value="desktop" data-bind="checked: $root.previewMode, button: { text: false, label: \'desktop\', icons: { primary: \'fa fa-fw fa-tablet\' } }" />        <label for="previewDesktop" title="Tablet" data-bind="attr: { title: $root.t(\'Tablet\') }">Tablet</label>        <input id="previewMobile" type="radio" name="previewMode" value="mobile" data-bind="checked: $root.previewMode, button: { text: false, label: \'mobile\', icons: { primary: \'fa fa-fw fa-mobile\' } }" />        <label for="previewMobile" title="Smartphone" data-bind="attr: { title: $root.t(\'Smartphone\') }">Smartphone</label>      </div>    </div>    <div id="frame-container" data-bind="css: { desktop: $root.previewMode() == \'desktop\', mobile: $root.previewMode() == \'mobile\', large: $root.previewMode() == \'large\' }">      <iframe data-bind="bindIframe: $data"></iframe>    </div>  </div>  <div class="mo" id="mo-body"></div>  <div id="incompatible-template" title="Saved model is obsolete" style="display: none" data-bind="attr: { title: $root.t(\'Saved model is obsolete\') }, html: $root.t(\'<p>The saved model has been created with a previous, non completely compatible version, of the template</p><p>Some content or style in the model <b>COULD BE LOST</b> if you will <b>save</b></p><p>Contact us for more informations!</p>\')">    Incompatible template  </div>  <div id="fake-image-editor" title="Fake image editor" style="display: none" data-bind="attr: { title: $root.t(\'Fake image editor\') }, html: $root.t(\'<p>Fake image editor</p>\')">    <p>Fake image editor</p>  </div></div>\x3c!-- ko if: $root.logoPath --\x3e<div id="loading" class="loading" style="display: block; width: 300px; text-align: center; height: 32px; position: absolute; top:0; bottom: 0; left: 0; right: 0;  margin: auto;" data-bind="attr: { style: \'position: absolute; top: 5px; left: 6px; z-index: 150;\'}, css: { loading: false }">  <a href="/" data-bind="attr: { href: $root.logoUrl, alt: $root.logoAlt }"><img data-bind="attr: { src: $root.logoPath }" width="32" height="32" alt="mosaico" border="0" /></a>  <div style="opacity: 0" data-bind="visible: false">Oppps... !!</div></div>\x3c!-- /ko --\x3e'),templateSystem.addTemplate("toolbox",'<div id="tooltabs" class="tabs_horizontal button_color" data-bind="tabs: { active: $root.selectedTool }">  <ul>    <li data-bind="tooltips: {}"><a title="Blocks ready to be added to the template" data-local="true" href="#toolblocks" data-bind="attr: { title: $root.t(\'Blocks ready to be added to the template\') }"><i class="fa fa-fw fa-cubes"></i> <span data-bind="html: $root.t(\'Blocks\')">Blocks</span></a></li>    <li data-bind="tooltips: {}"><a title="Edit content options" href="#toolcontents" data-local="true" data-bind="attr: { title: $root.t(\'Edit content options\') }"><i class="fa fa-fw fa-pencil"></i> <span data-bind="html: $root.t(\'Content\')">Content</span></a></li>    <li data-bind="tooltips: {}"><a title="Edit style options" href="#toolstyles" data-local="true" data-bind="attr: { title: $root.t(\'Edit style options\') }"><i class="fa fa-fw fa-paint-brush"></i> <span data-bind="html: $root.t(\'Style\')">Style</span></a></li>  </ul>  <div id="toolblocks" data-bind="scrollable: true">    <div class="block-list" data-bind="foreach: blockDefs" style="text-align: center">      <div class="draggable-item" data-bind="withProperties: { templateMode: \'show\' }">        <div class="block" data-bind="extdraggable: { connectClass: \'sortable-blocks-edit\', data: $data, dropContainer: \'#main-wysiwyg-area\', dragging: $root.dragging, \'options\': { handle: \'.handle\', distance: 10, \'appendTo\': \'#page\' } }, click: $root.addBlock" style="position: relative;">          <div title="Click or drag to add this block to the template" class="handle" data-bind="attr: { title: $root.t(\'Click or drag to add this block to the template\') }, tooltips: {}"></div>          <img data-bind="attr: { alt: $root.t(\'Block __name__\', { name: ko.utils.unwrapObservable(type) }), src: $root.templatePath(\'edres/\'+ko.utils.unwrapObservable(type)+\'.png\') }" alt="Block __name__" />        </div>        <a href="javascript:void(0)" class="addblockbutton" data-bind="click: $root.addBlock, button: { label: $root.t(\'Add\') }">Add</a>      </div>    </div>  </div>  <div id="toolcontents" data-bind="scrollable: true">    \x3c!-- ko if: $root.selectedBlock() !== null --\x3e    <div data-bind="block: $root.selectedBlock"></div>    \x3c!-- /ko --\x3e    \x3c!-- ko if: $root.selectedBlock() == null --\x3e    <div class="noSelectedBlock" data-bind="text: $root.t(\'By clicking on message parts you will select a block and content options, if any, will show here\')">By clicking on message parts you will select a block and content options, if any, will show here</div>    \x3c!-- /ko --\x3e    \x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e  </div>    <div id="toolstyles" data-bind="scrollable: true, withProperties: { templateMode: \'styler\' }">    \x3c!-- ko if: typeof $root.content().theme === \'undefined\' || typeof $root.content().theme().scheme === \'undefined\' || $root.content().theme().scheme() === \'custom\' --\x3e      \x3c!-- ko if: $root.selectedBlock() !== null --\x3e      <div data-bind="block: $root.selectedBlock, css: { workLocal: $root.selectedBlock().customStyle, workGlobal: typeof $root.selectedBlock().customStyle === \'undefined\' || !$root.selectedBlock().customStyle() }"></div>      \x3c!-- /ko --\x3e      \x3c!-- ko if: $root.selectedBlock() == null --\x3e      <div class="noSelectedBlock" data-bind="text: $root.t(\'By clicking on message parts you will select a block and style options, if available, will show here\')">By clicking on message parts you will select a block and style options, if available, will show here</div>      \x3c!-- /ko --\x3e      <div class="workGlobalContent">      \x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e      </div>    \x3c!-- /ko --\x3e  </div></div>        <div id="toolimages" class="slidebar" data-bind="scrollable: true, css: { hidden: $root.showGallery() === false }">  <div class="close" data-bind="click: $root.showGallery.bind($element, false);">X</div>  <span class="pane-title" data-bind="text: $root.t(\'Gallery:\')">Gallery:</span>  <div data-drop-content="Drop here" class="img-dropzone pane uploadzone" data-bind="attr: { \'data-drop-content\': $root.t(\'Drop here\') }, fudroppable: { activeClass: \'ui-state-highlight\', hoverClass: \'ui-state-draghover\' }">  <div class="mo-uploadzone" style="position: relative; padding: 2em; border: 2px dotted #808080">     <input class="fileupload" type="file" multiple name="files[]" data-bind="fileupload: { onerror: $root.notifier.error, onfile: $root.loadImage }" style="z-index: 10; position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-width: 100%; min-height: 100%; font-zie: 999px; text-align: right; filter: alpha(opacity=0); opacity: 0; outline: none; cursor: inherit; display: block">     <span data-bind="text: $root.t(\'Click or drag files here\')">Click or drag files here</span>     <div class="workzone" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden;">       <div class="progress" style="opacity: .5; width: 80%; margin-left: 10%; position: absolute; bottom: 30%; height: 20px; border: 2px solid black;">         <div class="progress-bar progress-bar-success" style="height: 20px; background-color: black; "></div>       </div>     </div>  </div>  </div>  \x3c!-- ko if: $root.showGallery() --\x3e  <div id="toolimagestab" class="tabs_horizontal" data-bind="tabs: { active: $root.selectedImageTab }">    <ul>      <li data-bind="tooltips: {}"><a title="Session images" data-local="true" href="#toolimagesrecent" data-bind="attr: { title: $root.t(\'Session images\') }, text: $root.t(\'Recents\')">Recents</a></li>      <li data-bind="tooltips: {}"><a title="Remote gallery" data-local="true" href="#toolimagesgallery" data-bind="attr: { title: $root.t(\'Remote gallery\') }, text: $root.t(\'Gallery\')">Gallery</a></li>    </ul>    <div id="toolimagesrecent">      \x3c!-- ko if: galleryRecent().length == 0 --\x3e<div class="galleryEmpty" data-bind="text: $root.t(\'No images uploaded, yet\')">No images uploaded, yet</div>\x3c!-- /ko --\x3e      \x3c!-- ko template: {name: \'gallery-images\', data: { items: galleryRecent } } --\x3e# recent gallery #\x3c!-- /ko --\x3e    </div>    <div id="toolimagesgallery" style="text-align: center">    \x3c!-- ko if: $root.galleryLoaded() === false --\x3e<a class="loadbutton" title="Show images from the gallery" href="javascript:void(0)" data-bind="attr: { title: $root.t(\'Show images from the gallery\') }, click: $root.loadGallery, button: { disabled: $root.galleryLoaded, icons: { primary: \'fa fa-fw fa-picture-o\' }, label: $root.galleryLoaded() == \'loading\' ? $root.t(\'Loading...\') : $root.t(\'Load gallery\'), text: true }"># load gally #</a>\x3c!-- /ko --\x3e    \x3c!-- ko if: $root.galleryLoaded() === \'loading\' --\x3e<div class="galleryEmpty" data-bind="text: $root.t(\'Loading gallery...\')">Loading gallery...</div>\x3c!-- /ko --\x3e    \x3c!-- ko if: $root.galleryLoaded() === 0 --\x3e<div class="galleryEmpty" data-bind="text: $root.t(\'The gallery is empty\')">The gallery is empty</div>\x3c!-- /ko --\x3e    \x3c!-- ko template: {name: \'gallery-images\', data: { items: galleryRemote } } --\x3e# remote gallery #\x3c!-- /ko --\x3e    </div>  </div>  \x3c!-- /ko --\x3e</div><div id="tooldebug" class="slidebar" data-bind="css: { hidden: $root.debug() === false }">  <div class="close" data-bind="click: $root.debug.bind($element, false);">X</div>    \x3c!-- ko if: $root.debug --\x3e  Content:  <pre data-bind=\'text: ko.toJSON(content, null, 2)\' style="overflow: auto; height: 20%"></pre>  BlockDefs:  <pre data-bind=\'text: ko.toJSON(blockDefs, null, 2)\' style="overflow: auto; height: 20%"></pre>  \x3c!-- /ko --\x3e  <a href="javascript:void(0)" data-bind="click: $root.exportHTMLtoTextarea.bind($element, \'#outputhtml\'); clickBubble: false, button: { text: true, label:\'Generate\' }">Output</a>  <a href="javascript:void(0)" data-bind="click: $root.exportJSONtoTextarea.bind($element, \'#outputhtml\'); clickBubble: false, button: { text: true, label:\'Export\' }">Export</a>  <a href="javascript:void(0)" data-bind="click: $root.importJSONfromTextarea.bind($element, \'#outputhtml\'); clickBubble: false, button: { text: true, label:\'Import\' }">Import</a>  <textarea id="outputhtml" rows="10" style="width: 100%;"></textarea></div><div id="tooltheme" class="ui-widget slidebar" data-bind="css: { hidden: $root.showTheme() === false }">  <div class="close" data-bind="click: $root.showTheme.bind($element, false);">X</div>    \x3c!-- ko withProperties: { templateMode: \'styler\' } --\x3e    \x3c!-- ko if: $root.showTheme --\x3e      \x3c!-- ko block: $root.content().theme --\x3e\x3c!-- /ko --\x3e    \x3c!-- /ko --\x3e  \x3c!-- /ko --\x3e</div>')});
 | 
						|
 | 
						|
},{"../src/js/bindings/choose-template.js":28}],2:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
'use strict';
 | 
						|
 | 
						|
// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
 | 
						|
// original notice:
 | 
						|
 | 
						|
/*!
 | 
						|
 * The buffer module from node.js, for the browser.
 | 
						|
 *
 | 
						|
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 | 
						|
 * @license  MIT
 | 
						|
 */
 | 
						|
function compare(a, b) {
 | 
						|
  if (a === b) {
 | 
						|
    return 0;
 | 
						|
  }
 | 
						|
 | 
						|
  var x = a.length;
 | 
						|
  var y = b.length;
 | 
						|
 | 
						|
  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
 | 
						|
    if (a[i] !== b[i]) {
 | 
						|
      x = a[i];
 | 
						|
      y = b[i];
 | 
						|
      break;
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  if (x < y) {
 | 
						|
    return -1;
 | 
						|
  }
 | 
						|
  if (y < x) {
 | 
						|
    return 1;
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
function isBuffer(b) {
 | 
						|
  if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
 | 
						|
    return global.Buffer.isBuffer(b);
 | 
						|
  }
 | 
						|
  return !!(b != null && b._isBuffer);
 | 
						|
}
 | 
						|
 | 
						|
// based on node assert, original notice:
 | 
						|
 | 
						|
// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
 | 
						|
//
 | 
						|
// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
 | 
						|
//
 | 
						|
// Originally from narwhal.js (http://narwhaljs.org)
 | 
						|
// Copyright (c) 2009 Thomas Robinson <280north.com>
 | 
						|
//
 | 
						|
// 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 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.
 | 
						|
 | 
						|
var util = require('util/');
 | 
						|
var hasOwn = Object.prototype.hasOwnProperty;
 | 
						|
var pSlice = Array.prototype.slice;
 | 
						|
var functionsHaveNames = (function () {
 | 
						|
  return function foo() {}.name === 'foo';
 | 
						|
}());
 | 
						|
function pToString (obj) {
 | 
						|
  return Object.prototype.toString.call(obj);
 | 
						|
}
 | 
						|
function isView(arrbuf) {
 | 
						|
  if (isBuffer(arrbuf)) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
  if (typeof global.ArrayBuffer !== 'function') {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
  if (typeof ArrayBuffer.isView === 'function') {
 | 
						|
    return ArrayBuffer.isView(arrbuf);
 | 
						|
  }
 | 
						|
  if (!arrbuf) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
  if (arrbuf instanceof DataView) {
 | 
						|
    return true;
 | 
						|
  }
 | 
						|
  if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
 | 
						|
    return true;
 | 
						|
  }
 | 
						|
  return false;
 | 
						|
}
 | 
						|
// 1. The assert module provides functions that throw
 | 
						|
// AssertionError's when particular conditions are not met. The
 | 
						|
// assert module must conform to the following interface.
 | 
						|
 | 
						|
var assert = module.exports = ok;
 | 
						|
 | 
						|
// 2. The AssertionError is defined in assert.
 | 
						|
// new assert.AssertionError({ message: message,
 | 
						|
//                             actual: actual,
 | 
						|
//                             expected: expected })
 | 
						|
 | 
						|
var regex = /\s*function\s+([^\(\s]*)\s*/;
 | 
						|
// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
 | 
						|
function getName(func) {
 | 
						|
  if (!util.isFunction(func)) {
 | 
						|
    return;
 | 
						|
  }
 | 
						|
  if (functionsHaveNames) {
 | 
						|
    return func.name;
 | 
						|
  }
 | 
						|
  var str = func.toString();
 | 
						|
  var match = str.match(regex);
 | 
						|
  return match && match[1];
 | 
						|
}
 | 
						|
assert.AssertionError = function AssertionError(options) {
 | 
						|
  this.name = 'AssertionError';
 | 
						|
  this.actual = options.actual;
 | 
						|
  this.expected = options.expected;
 | 
						|
  this.operator = options.operator;
 | 
						|
  if (options.message) {
 | 
						|
    this.message = options.message;
 | 
						|
    this.generatedMessage = false;
 | 
						|
  } else {
 | 
						|
    this.message = getMessage(this);
 | 
						|
    this.generatedMessage = true;
 | 
						|
  }
 | 
						|
  var stackStartFunction = options.stackStartFunction || fail;
 | 
						|
  if (Error.captureStackTrace) {
 | 
						|
    Error.captureStackTrace(this, stackStartFunction);
 | 
						|
  } else {
 | 
						|
    // non v8 browsers so we can have a stacktrace
 | 
						|
    var err = new Error();
 | 
						|
    if (err.stack) {
 | 
						|
      var out = err.stack;
 | 
						|
 | 
						|
      // try to strip useless frames
 | 
						|
      var fn_name = getName(stackStartFunction);
 | 
						|
      var idx = out.indexOf('\n' + fn_name);
 | 
						|
      if (idx >= 0) {
 | 
						|
        // once we have located the function frame
 | 
						|
        // we need to strip out everything before it (and its line)
 | 
						|
        var next_line = out.indexOf('\n', idx + 1);
 | 
						|
        out = out.substring(next_line + 1);
 | 
						|
      }
 | 
						|
 | 
						|
      this.stack = out;
 | 
						|
    }
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
// assert.AssertionError instanceof Error
 | 
						|
util.inherits(assert.AssertionError, Error);
 | 
						|
 | 
						|
function truncate(s, n) {
 | 
						|
  if (typeof s === 'string') {
 | 
						|
    return s.length < n ? s : s.slice(0, n);
 | 
						|
  } else {
 | 
						|
    return s;
 | 
						|
  }
 | 
						|
}
 | 
						|
function inspect(something) {
 | 
						|
  if (functionsHaveNames || !util.isFunction(something)) {
 | 
						|
    return util.inspect(something);
 | 
						|
  }
 | 
						|
  var rawname = getName(something);
 | 
						|
  var name = rawname ? ': ' + rawname : '';
 | 
						|
  return '[Function' +  name + ']';
 | 
						|
}
 | 
						|
function getMessage(self) {
 | 
						|
  return truncate(inspect(self.actual), 128) + ' ' +
 | 
						|
         self.operator + ' ' +
 | 
						|
         truncate(inspect(self.expected), 128);
 | 
						|
}
 | 
						|
 | 
						|
// At present only the three keys mentioned above are used and
 | 
						|
// understood by the spec. Implementations or sub modules can pass
 | 
						|
// other keys to the AssertionError's constructor - they will be
 | 
						|
// ignored.
 | 
						|
 | 
						|
// 3. All of the following functions must throw an AssertionError
 | 
						|
// when a corresponding condition is not met, with a message that
 | 
						|
// may be undefined if not provided.  All assertion methods provide
 | 
						|
// both the actual and expected values to the assertion error for
 | 
						|
// display purposes.
 | 
						|
 | 
						|
function fail(actual, expected, message, operator, stackStartFunction) {
 | 
						|
  throw new assert.AssertionError({
 | 
						|
    message: message,
 | 
						|
    actual: actual,
 | 
						|
    expected: expected,
 | 
						|
    operator: operator,
 | 
						|
    stackStartFunction: stackStartFunction
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
// EXTENSION! allows for well behaved errors defined elsewhere.
 | 
						|
assert.fail = fail;
 | 
						|
 | 
						|
// 4. Pure assertion tests whether a value is truthy, as determined
 | 
						|
// by !!guard.
 | 
						|
// assert.ok(guard, message_opt);
 | 
						|
// This statement is equivalent to assert.equal(true, !!guard,
 | 
						|
// message_opt);. To test strictly for the value true, use
 | 
						|
// assert.strictEqual(true, guard, message_opt);.
 | 
						|
 | 
						|
function ok(value, message) {
 | 
						|
  if (!value) fail(value, true, message, '==', assert.ok);
 | 
						|
}
 | 
						|
assert.ok = ok;
 | 
						|
 | 
						|
// 5. The equality assertion tests shallow, coercive equality with
 | 
						|
// ==.
 | 
						|
// assert.equal(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.equal = function equal(actual, expected, message) {
 | 
						|
  if (actual != expected) fail(actual, expected, message, '==', assert.equal);
 | 
						|
};
 | 
						|
 | 
						|
// 6. The non-equality assertion tests for whether two objects are not equal
 | 
						|
// with != assert.notEqual(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.notEqual = function notEqual(actual, expected, message) {
 | 
						|
  if (actual == expected) {
 | 
						|
    fail(actual, expected, message, '!=', assert.notEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
// 7. The equivalence assertion tests a deep equality relation.
 | 
						|
// assert.deepEqual(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.deepEqual = function deepEqual(actual, expected, message) {
 | 
						|
  if (!_deepEqual(actual, expected, false)) {
 | 
						|
    fail(actual, expected, message, 'deepEqual', assert.deepEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
 | 
						|
  if (!_deepEqual(actual, expected, true)) {
 | 
						|
    fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
function _deepEqual(actual, expected, strict, memos) {
 | 
						|
  // 7.1. All identical values are equivalent, as determined by ===.
 | 
						|
  if (actual === expected) {
 | 
						|
    return true;
 | 
						|
  } else if (isBuffer(actual) && isBuffer(expected)) {
 | 
						|
    return compare(actual, expected) === 0;
 | 
						|
 | 
						|
  // 7.2. If the expected value is a Date object, the actual value is
 | 
						|
  // equivalent if it is also a Date object that refers to the same time.
 | 
						|
  } else if (util.isDate(actual) && util.isDate(expected)) {
 | 
						|
    return actual.getTime() === expected.getTime();
 | 
						|
 | 
						|
  // 7.3 If the expected value is a RegExp object, the actual value is
 | 
						|
  // equivalent if it is also a RegExp object with the same source and
 | 
						|
  // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
 | 
						|
  } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
 | 
						|
    return actual.source === expected.source &&
 | 
						|
           actual.global === expected.global &&
 | 
						|
           actual.multiline === expected.multiline &&
 | 
						|
           actual.lastIndex === expected.lastIndex &&
 | 
						|
           actual.ignoreCase === expected.ignoreCase;
 | 
						|
 | 
						|
  // 7.4. Other pairs that do not both pass typeof value == 'object',
 | 
						|
  // equivalence is determined by ==.
 | 
						|
  } else if ((actual === null || typeof actual !== 'object') &&
 | 
						|
             (expected === null || typeof expected !== 'object')) {
 | 
						|
    return strict ? actual === expected : actual == expected;
 | 
						|
 | 
						|
  // If both values are instances of typed arrays, wrap their underlying
 | 
						|
  // ArrayBuffers in a Buffer each to increase performance
 | 
						|
  // This optimization requires the arrays to have the same type as checked by
 | 
						|
  // Object.prototype.toString (aka pToString). Never perform binary
 | 
						|
  // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
 | 
						|
  // bit patterns are not identical.
 | 
						|
  } else if (isView(actual) && isView(expected) &&
 | 
						|
             pToString(actual) === pToString(expected) &&
 | 
						|
             !(actual instanceof Float32Array ||
 | 
						|
               actual instanceof Float64Array)) {
 | 
						|
    return compare(new Uint8Array(actual.buffer),
 | 
						|
                   new Uint8Array(expected.buffer)) === 0;
 | 
						|
 | 
						|
  // 7.5 For all other Object pairs, including Array objects, equivalence is
 | 
						|
  // determined by having the same number of owned properties (as verified
 | 
						|
  // with Object.prototype.hasOwnProperty.call), the same set of keys
 | 
						|
  // (although not necessarily the same order), equivalent values for every
 | 
						|
  // corresponding key, and an identical 'prototype' property. Note: this
 | 
						|
  // accounts for both named and indexed properties on Arrays.
 | 
						|
  } else if (isBuffer(actual) !== isBuffer(expected)) {
 | 
						|
    return false;
 | 
						|
  } else {
 | 
						|
    memos = memos || {actual: [], expected: []};
 | 
						|
 | 
						|
    var actualIndex = memos.actual.indexOf(actual);
 | 
						|
    if (actualIndex !== -1) {
 | 
						|
      if (actualIndex === memos.expected.indexOf(expected)) {
 | 
						|
        return true;
 | 
						|
      }
 | 
						|
    }
 | 
						|
 | 
						|
    memos.actual.push(actual);
 | 
						|
    memos.expected.push(expected);
 | 
						|
 | 
						|
    return objEquiv(actual, expected, strict, memos);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
function isArguments(object) {
 | 
						|
  return Object.prototype.toString.call(object) == '[object Arguments]';
 | 
						|
}
 | 
						|
 | 
						|
function objEquiv(a, b, strict, actualVisitedObjects) {
 | 
						|
  if (a === null || a === undefined || b === null || b === undefined)
 | 
						|
    return false;
 | 
						|
  // if one is a primitive, the other must be same
 | 
						|
  if (util.isPrimitive(a) || util.isPrimitive(b))
 | 
						|
    return a === b;
 | 
						|
  if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
 | 
						|
    return false;
 | 
						|
  var aIsArgs = isArguments(a);
 | 
						|
  var bIsArgs = isArguments(b);
 | 
						|
  if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
 | 
						|
    return false;
 | 
						|
  if (aIsArgs) {
 | 
						|
    a = pSlice.call(a);
 | 
						|
    b = pSlice.call(b);
 | 
						|
    return _deepEqual(a, b, strict);
 | 
						|
  }
 | 
						|
  var ka = objectKeys(a);
 | 
						|
  var kb = objectKeys(b);
 | 
						|
  var key, i;
 | 
						|
  // having the same number of owned properties (keys incorporates
 | 
						|
  // hasOwnProperty)
 | 
						|
  if (ka.length !== kb.length)
 | 
						|
    return false;
 | 
						|
  //the same set of keys (although not necessarily the same order),
 | 
						|
  ka.sort();
 | 
						|
  kb.sort();
 | 
						|
  //~~~cheap key test
 | 
						|
  for (i = ka.length - 1; i >= 0; i--) {
 | 
						|
    if (ka[i] !== kb[i])
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
  //equivalent values for every corresponding key, and
 | 
						|
  //~~~possibly expensive deep test
 | 
						|
  for (i = ka.length - 1; i >= 0; i--) {
 | 
						|
    key = ka[i];
 | 
						|
    if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
 | 
						|
      return false;
 | 
						|
  }
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
// 8. The non-equivalence assertion tests for any deep inequality.
 | 
						|
// assert.notDeepEqual(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
 | 
						|
  if (_deepEqual(actual, expected, false)) {
 | 
						|
    fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
assert.notDeepStrictEqual = notDeepStrictEqual;
 | 
						|
function notDeepStrictEqual(actual, expected, message) {
 | 
						|
  if (_deepEqual(actual, expected, true)) {
 | 
						|
    fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// 9. The strict equality assertion tests strict equality, as determined by ===.
 | 
						|
// assert.strictEqual(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.strictEqual = function strictEqual(actual, expected, message) {
 | 
						|
  if (actual !== expected) {
 | 
						|
    fail(actual, expected, message, '===', assert.strictEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
// 10. The strict non-equality assertion tests for strict inequality, as
 | 
						|
// determined by !==.  assert.notStrictEqual(actual, expected, message_opt);
 | 
						|
 | 
						|
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
 | 
						|
  if (actual === expected) {
 | 
						|
    fail(actual, expected, message, '!==', assert.notStrictEqual);
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
function expectedException(actual, expected) {
 | 
						|
  if (!actual || !expected) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
 | 
						|
  if (Object.prototype.toString.call(expected) == '[object RegExp]') {
 | 
						|
    return expected.test(actual);
 | 
						|
  }
 | 
						|
 | 
						|
  try {
 | 
						|
    if (actual instanceof expected) {
 | 
						|
      return true;
 | 
						|
    }
 | 
						|
  } catch (e) {
 | 
						|
    // Ignore.  The instanceof check doesn't work for arrow functions.
 | 
						|
  }
 | 
						|
 | 
						|
  if (Error.isPrototypeOf(expected)) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
 | 
						|
  return expected.call({}, actual) === true;
 | 
						|
}
 | 
						|
 | 
						|
function _tryBlock(block) {
 | 
						|
  var error;
 | 
						|
  try {
 | 
						|
    block();
 | 
						|
  } catch (e) {
 | 
						|
    error = e;
 | 
						|
  }
 | 
						|
  return error;
 | 
						|
}
 | 
						|
 | 
						|
function _throws(shouldThrow, block, expected, message) {
 | 
						|
  var actual;
 | 
						|
 | 
						|
  if (typeof block !== 'function') {
 | 
						|
    throw new TypeError('"block" argument must be a function');
 | 
						|
  }
 | 
						|
 | 
						|
  if (typeof expected === 'string') {
 | 
						|
    message = expected;
 | 
						|
    expected = null;
 | 
						|
  }
 | 
						|
 | 
						|
  actual = _tryBlock(block);
 | 
						|
 | 
						|
  message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
 | 
						|
            (message ? ' ' + message : '.');
 | 
						|
 | 
						|
  if (shouldThrow && !actual) {
 | 
						|
    fail(actual, expected, 'Missing expected exception' + message);
 | 
						|
  }
 | 
						|
 | 
						|
  var userProvidedMessage = typeof message === 'string';
 | 
						|
  var isUnwantedException = !shouldThrow && util.isError(actual);
 | 
						|
  var isUnexpectedException = !shouldThrow && actual && !expected;
 | 
						|
 | 
						|
  if ((isUnwantedException &&
 | 
						|
      userProvidedMessage &&
 | 
						|
      expectedException(actual, expected)) ||
 | 
						|
      isUnexpectedException) {
 | 
						|
    fail(actual, expected, 'Got unwanted exception' + message);
 | 
						|
  }
 | 
						|
 | 
						|
  if ((shouldThrow && actual && expected &&
 | 
						|
      !expectedException(actual, expected)) || (!shouldThrow && actual)) {
 | 
						|
    throw actual;
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
// 11. Expected to throw an error:
 | 
						|
// assert.throws(block, Error_opt, message_opt);
 | 
						|
 | 
						|
assert.throws = function(block, /*optional*/error, /*optional*/message) {
 | 
						|
  _throws(true, block, error, message);
 | 
						|
};
 | 
						|
 | 
						|
// EXTENSION! This is annoying to write outside this module.
 | 
						|
assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
 | 
						|
  _throws(false, block, error, message);
 | 
						|
};
 | 
						|
 | 
						|
assert.ifError = function(err) { if (err) throw err; };
 | 
						|
 | 
						|
var objectKeys = Object.keys || function (obj) {
 | 
						|
  var keys = [];
 | 
						|
  for (var key in obj) {
 | 
						|
    if (hasOwn.call(obj, key)) keys.push(key);
 | 
						|
  }
 | 
						|
  return keys;
 | 
						|
};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"util/":24}],3:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
/*global window, global*/
 | 
						|
var util = require("util")
 | 
						|
var assert = require("assert")
 | 
						|
var now = require("date-now")
 | 
						|
 | 
						|
var slice = Array.prototype.slice
 | 
						|
var console
 | 
						|
var times = {}
 | 
						|
 | 
						|
if (typeof global !== "undefined" && global.console) {
 | 
						|
    console = global.console
 | 
						|
} else if (typeof window !== "undefined" && window.console) {
 | 
						|
    console = window.console
 | 
						|
} else {
 | 
						|
    console = {}
 | 
						|
}
 | 
						|
 | 
						|
var functions = [
 | 
						|
    [log, "log"],
 | 
						|
    [info, "info"],
 | 
						|
    [warn, "warn"],
 | 
						|
    [error, "error"],
 | 
						|
    [time, "time"],
 | 
						|
    [timeEnd, "timeEnd"],
 | 
						|
    [trace, "trace"],
 | 
						|
    [dir, "dir"],
 | 
						|
    [consoleAssert, "assert"]
 | 
						|
]
 | 
						|
 | 
						|
for (var i = 0; i < functions.length; i++) {
 | 
						|
    var tuple = functions[i]
 | 
						|
    var f = tuple[0]
 | 
						|
    var name = tuple[1]
 | 
						|
 | 
						|
    if (!console[name]) {
 | 
						|
        console[name] = f
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
module.exports = console
 | 
						|
 | 
						|
function log() {}
 | 
						|
 | 
						|
function info() {
 | 
						|
    console.log.apply(console, arguments)
 | 
						|
}
 | 
						|
 | 
						|
function warn() {
 | 
						|
    console.log.apply(console, arguments)
 | 
						|
}
 | 
						|
 | 
						|
function error() {
 | 
						|
    console.warn.apply(console, arguments)
 | 
						|
}
 | 
						|
 | 
						|
function time(label) {
 | 
						|
    times[label] = now()
 | 
						|
}
 | 
						|
 | 
						|
function timeEnd(label) {
 | 
						|
    var time = times[label]
 | 
						|
    if (!time) {
 | 
						|
        throw new Error("No such label: " + label)
 | 
						|
    }
 | 
						|
 | 
						|
    var duration = now() - time
 | 
						|
    console.log(label + ": " + duration + "ms")
 | 
						|
}
 | 
						|
 | 
						|
function trace() {
 | 
						|
    var err = new Error()
 | 
						|
    err.name = "Trace"
 | 
						|
    err.message = util.format.apply(null, arguments)
 | 
						|
    console.error(err.stack)
 | 
						|
}
 | 
						|
 | 
						|
function dir(object) {
 | 
						|
    console.log(util.inspect(object) + "\n")
 | 
						|
}
 | 
						|
 | 
						|
function consoleAssert(expression) {
 | 
						|
    if (!expression) {
 | 
						|
        var arr = slice.call(arguments, 1)
 | 
						|
        assert.ok(false, util.format.apply(null, arr))
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"assert":2,"date-now":4,"util":24}],4:[function(require,module,exports){
 | 
						|
module.exports = now
 | 
						|
 | 
						|
function now() {
 | 
						|
    return new Date().getTime()
 | 
						|
}
 | 
						|
 | 
						|
},{}],5:[function(require,module,exports){
 | 
						|
/*
 | 
						|
   evol.colorpicker 3.2.2
 | 
						|
   (c) 2015 Olivier Giulieri
 | 
						|
   http://evoluteur.github.io/colorpicker/
 | 
						|
*/
 | 
						|
!function(a,b){var c=0,d=window.navigator.userAgent,e=d.indexOf("MSIE ")>0,f=e?"-ie":"",g=e?!1:/mozilla/.test(d.toLowerCase())&&!/webkit/.test(d.toLowerCase()),h=[],i=["ffffff","000000","eeece1","1f497d","4f81bd","c0504d","9bbb59","8064a2","4bacc6","f79646"],j=["f2f2f2","7f7f7f","ddd9c3","c6d9f0","dbe5f1","f2dcdb","ebf1dd","e5e0ec","dbeef3","fdeada","d8d8d8","595959","c4bd97","8db3e2","b8cce4","e5b9b7","d7e3bc","ccc1d9","b7dde8","fbd5b5","bfbfbf","3f3f3f","938953","548dd4","95b3d7","d99694","c3d69b","b2a2c7","92cddc","fac08f","a5a5a5","262626","494429","17365d","366092","953734","76923c","5f497a","31859b","e36c09","7f7f7f","0c0c0c","1d1b10","0f243e","244061","632423","4f6128","3f3151","205867","974806"],k=["c00000","ff0000","ffc000","ffff00","92d050","00b050","00b0f0","0070c0","002060","7030a0"],l=[["003366","336699","3366cc","003399","000099","0000cc","000066"],["006666","006699","0099cc","0066cc","0033cc","0000ff","3333ff","333399"],["669999","009999","33cccc","00ccff","0099ff","0066ff","3366ff","3333cc","666699"],["339966","00cc99","00ffcc","00ffff","33ccff","3399ff","6699ff","6666ff","6600ff","6600cc"],["339933","00cc66","00ff99","66ffcc","66ffff","66ccff","99ccff","9999ff","9966ff","9933ff","9900ff"],["006600","00cc00","00ff00","66ff99","99ffcc","ccffff","ccccff","cc99ff","cc66ff","cc33ff","cc00ff","9900cc"],["003300","009933","33cc33","66ff66","99ff99","ccffcc","ffffff","ffccff","ff99ff","ff66ff","ff00ff","cc00cc","660066"],["333300","009900","66ff33","99ff66","ccff99","ffffcc","ffcccc","ff99cc","ff66cc","ff33cc","cc0099","993399"],["336600","669900","99ff33","ccff66","ffff99","ffcc99","ff9999","ff6699","ff3399","cc3399","990099"],["666633","99cc00","ccff33","ffff66","ffcc66","ff9966","ff6666","ff0066","d60094","993366"],["a58800","cccc00","ffff00","ffcc00","ff9933","ff6600","ff0033","cc0066","660033"],["996633","cc9900","ff9900","cc6600","ff3300","ff0000","cc0000","990033"],["663300","996600","cc3300","993300","990000","800000","993333"]],m="#0000ffff",n=function(a){var b=a.toString(16);return 1==b.length&&(b="0"+b),b},o=function(a){return n(Number(a))},p=function(a){var b=n(a);return b+b+b},q=function(a){if(a.length>10){var b=1+a.indexOf("("),c=a.indexOf(")"),d=a.substring(b,c).split(",");return["#",o(d[0]),o(d[1]),o(d[2])].join("")}return a};a.widget("evol.colorpicker",{version:"3.2.1",options:{color:null,showOn:"both",hideButton:!1,displayIndicator:!0,transparentColor:!1,history:!0,defaultPalette:"theme",strings:"Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet."},_active:!1,_create:function(){var b=this;switch(this._paletteIdx="theme"==this.options.defaultPalette?1:2,this._id="evo-cp"+c++,this._enabled=!0,this.options.showOn=this.options.hideButton?"focus":this.options.showOn,this.element.get(0).tagName){case"INPUT":var d=this.options.color,h=this.element,i=("focus"===this.options.showOn?"":"evo-pointer ")+"evo-colorind"+(g?"-ff":f)+(this.options.hideButton?" evo-hidden-button":""),j="";if(this._isPopup=!0,this._palette=null,null!==d)h.val(d);else{var k=h.val();""!==k&&(d=this.options.color=k)}d===m?i+=" evo-transparent":j=null!==d?"background-color:"+d:"",h.addClass("colorPicker "+this._id).wrap('<div style="width:'+(this.options.hideButton?this.element.width():this.element.width()+32)+"px;"+(e?"margin-bottom:-21px;":"")+(g?"padding:1px 0;":"")+'"></div>').after('<div class="'+i+'" style="'+j+'"></div>').on("keyup onpaste",function(c){var d=a(this).val();d!=b.options.color&&b._setValue(d,!0)});var l=this.options.showOn;("both"===l||"focus"===l)&&h.on("focus",function(){b.showPalette()}),("both"===l||"button"===l)&&h.next().on("click",function(a){return a.stopPropagation(),b.showPalette(),!1});break;default:this._isPopup=!1,this._palette=this.element.html(this._paletteHTML()).attr("aria-haspopup","true"),this._bindColors()}if(this.options.history&&(d&&this._add2History(d),this.options.initialHistory)){var n=this.options.initialHistory;for(var o in n)this._add2History(n[o])}},_paletteHTML:function(){var a=this._paletteIdx=Math.abs(this._paletteIdx),b=this.options,c=b.strings.split(","),d='<div class="evo-pop'+f+' ui-widget ui-widget-content ui-corner-all"'+(this._isPopup?' style="position:absolute"':"")+"><span>"+this["_paletteHTML"+a]()+'</span><div class="evo-more"><a href="javascript:void(0)">'+c[1+a]+"</a>";return b.history&&(d+='<a href="javascript:void(0)" class="evo-hist">'+c[5]+"</a>"),d+="</div>",b.displayIndicator&&(d+=this._colorIndHTML(this.options.color)+this._colorIndHTML("")),d+="</div>"},_colorIndHTML:function(a){var b=e?"evo-colorbox-ie ":"",c="";return a?a===m?b+="evo-transparent":c="background-color:"+a:c="display:none",'<div class="evo-color" style="float:left"><div style="'+c+'" class="'+b+'"></div><span>'+(a?a:"")+"</span></div>"},_paletteHTML1:function(){for(var a=this.options,b=a.strings.split(","),c='<td style="background-color:#',d=e?'"><div style="width:2px;"></div></td>':'"><span/></td>',g='<tr><th colspan="10" class="ui-widget-content">',h='<table class="evo-palette'+f+'">'+g+b[0]+"</th></tr><tr>",l=0;10>l;l++)h+=c+i[l]+d;for(h+="</tr>",e||(h+='<tr><th colspan="10"></th></tr>'),h+='<tr class="top">',l=0;10>l;l++)h+=c+j[l]+d;for(var m=1;4>m;m++)for(h+='</tr><tr class="in">',l=0;10>l;l++)h+=c+j[10*m+l]+d;for(h+='</tr><tr class="bottom">',l=40;50>l;l++)h+=c+j[l]+d;for(h+="</tr>"+g,a.transparentColor&&(h+='<div class="evo-transparent evo-tr-box"></div>'),h+=b[1]+"</th></tr><tr>",l=0;10>l;l++)h+=c+k[l]+d;return h+="</tr></table>"},_paletteHTML2:function(){for(var a,b,c='<td style="background-color:#',d=e?'"><div style="width:5px;"></div></td>':'"><span/></td>',g='<table class="evo-palette2'+f+'"><tr>',h="</tr></table>",i='<div class="evo-palcenter">',j=0,k=l.length;k>j;j++){i+=g;var m=l[j];for(a=0,b=m.length;b>a;a++)i+=c+m[a]+d;i+=h}i+='<div class="evo-sep"/>';var n="";for(i+=g,a=255;a>10;a-=10)i+=c+p(a)+d,a-=10,n+=c+p(a)+d;return i+=h+g+n+h+"</div>"},_switchPalette:function(b){if(this._enabled){var c,d,e,f=this.options.strings.split(",");if(a(b).hasClass("evo-hist")){var g=['<table class="evo-palette"><tr><th class="ui-widget-content">',f[5],"</th></tr></tr></table>",'<div class="evo-cHist">'];if(0===h.length)g.push("<p> ",f[6],"</p>");else for(var i=h.length-1;i>-1;i--)9===h[i].length?g.push('<div class="evo-transparent"></div>'):g.push('<div style="background-color:',h[i],'"></div>');g.push("</div>"),c=-this._paletteIdx,d=g.join(""),e=f[4]}else this._paletteIdx<0?(c=-this._paletteIdx,this._palette.find(".evo-hist").show()):c=2==this._paletteIdx?1:2,d=this["_paletteHTML"+c](),e=f[c+1],this._paletteIdx=c;this._paletteIdx=c;var j=this._palette.find(".evo-more").prev().html(d).end().children().eq(0).html(e);0>c&&j.next().hide()}},_downOrUpPositioning:function(){for(var a=this.element,b=0;null!==a&&100>b;){if("visible"!=a.css("overflow")){var c=this._palette.offset().top+this._palette.height(),d=a.offset().top+a.height(),e=this._palette.offset().top-this._palette.height()-this.element.outerHeight(),f=a.offset().top,g=c>d&&e>f;g?this._palette.css({bottom:this.element.outerHeight()+"px"}):this._palette.css({bottom:"auto"});break}if("HTML"==a[0].tagName)break;a=a.offsetParent(),b++}},showPalette:function(){if(this._enabled&&(this._active=!0,a(".colorPicker").not("."+this._id).colorpicker("hidePalette"),null===this._palette)){this._palette=this.element.next().after(this._paletteHTML()).next().on("click",function(a){return a.stopPropagation(),!1}),this._bindColors();var b=this;this._isPopup&&(this._downOrUpPositioning(),a(document.body).on("click."+b._id,function(a){a.target!=b.element.get(0)&&b.hidePalette()}).on("keyup."+b._id,function(a){27===a.keyCode&&b.hidePalette()}))}return this},hidePalette:function(){if(this._isPopup&&this._palette){a(document.body).off("click."+this._id);var b=this;this._palette.off("mouseover click","td,.evo-transparent").fadeOut(function(){b._palette.remove(),b._palette=b._cTxt=null}).find(".evo-more a").off("click")}return this},_bindColors:function(){var b=this,c=this.options,d=this._palette.find("div.evo-color"),e=c.history?"td,.evo-cHist>div":"td";c.transparentColor&&(e+=",.evo-transparent"),this._cTxt1=d.eq(0).children().eq(0),this._cTxt2=d.eq(1).children().eq(0),this._palette.on("click",e,function(c){if(b._enabled){var d=a(this);b._setValue(d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17))),b._active=!1}}).on("mouseover",e,function(c){if(b._enabled){var d=a(this),e=d.hasClass("evo-transparent")?m:q(d.attr("style").substring(17));b.options.displayIndicator&&b._setColorInd(e,2),b._active&&b.element.trigger("mouseover.color",e)}}).find(".evo-more a").on("click",function(){b._switchPalette(this)})},val:function(a){return"undefined"==typeof a?this.options.color:(this._setValue(a),this)},_setValue:function(a,b){a=a.replace(/ /g,""),this.options.color=a,this._isPopup?(b||this.hidePalette(),this._setBoxColor(this.element.val(a).next(),a)):this._setColorInd(a,1),this.options.history&&this._paletteIdx>0&&this._add2History(a),this.element.trigger("change.color",a)},_setColorInd:function(a,b){var c=this["_cTxt"+b];this._setBoxColor(c,a),c.next().html(a)},_setBoxColor:function(a,b){b===m?a.addClass("evo-transparent").removeAttr("style"):a.removeClass("evo-transparent").attr("style","background-color:"+b)},_setOption:function(a,b){"color"==a?this._setValue(b,!0):this.options[a]=b},_add2History:function(a){for(var b=h.length,c=0;b>c;c++)if(a==h[c])return;b>27&&h.shift(),h.push(a)},clear:function(){this.hidePalette().val("")},enable:function(){var a=this.element;return this._isPopup?a.removeAttr("disabled"):a.css({opacity:"1","pointer-events":"auto"}),"focus"!==this.options.showOn&&this.element.next().addClass("evo-pointer"),a.removeAttr("aria-disabled"),this._enabled=!0,this},disable:function(){var a=this.element;return this._isPopup?a.attr("disabled","disabled"):(this.hidePalette(),a.css({opacity:"0.3","pointer-events":"none"})),"focus"!==this.options.showOn&&this.element.next().removeClass("evo-pointer"),a.attr("aria-disabled","true"),this._enabled=!1,this},isDisabled:function(){return!this._enabled},destroy:function(){a(document.body).off("click."+this._id),this._palette&&(this._palette.off("mouseover click","td,.evo-cHist>div,.evo-transparent").find(".evo-more a").off("click"),this._isPopup&&this._palette.remove(),this._palette=this._cTxt=null),this._isPopup&&this.element.next().off("click").remove().end().off("focus").unwrap(),this.element.removeClass("colorPicker "+this.id).empty(),a.Widget.prototype.destroy.call(this)}})}(jQuery);
 | 
						|
},{}],6:[function(require,module,exports){
 | 
						|
//     JavaScript Expression Parser (JSEP) 0.3.3
 | 
						|
//     JSEP may be freely distributed under the MIT License
 | 
						|
//     http://jsep.from.so/
 | 
						|
 | 
						|
/*global module: true, exports: true, console: true */
 | 
						|
(function (root) {
 | 
						|
	'use strict';
 | 
						|
	// Node Types
 | 
						|
	// ----------
 | 
						|
 | 
						|
	// This is the full set of types that any JSEP node can be.
 | 
						|
	// Store them here to save space when minified
 | 
						|
	var COMPOUND = 'Compound',
 | 
						|
		IDENTIFIER = 'Identifier',
 | 
						|
		MEMBER_EXP = 'MemberExpression',
 | 
						|
		LITERAL = 'Literal',
 | 
						|
		THIS_EXP = 'ThisExpression',
 | 
						|
		CALL_EXP = 'CallExpression',
 | 
						|
		UNARY_EXP = 'UnaryExpression',
 | 
						|
		BINARY_EXP = 'BinaryExpression',
 | 
						|
		LOGICAL_EXP = 'LogicalExpression',
 | 
						|
		CONDITIONAL_EXP = 'ConditionalExpression',
 | 
						|
		ARRAY_EXP = 'ArrayExpression',
 | 
						|
 | 
						|
		PERIOD_CODE = 46, // '.'
 | 
						|
		COMMA_CODE  = 44, // ','
 | 
						|
		SQUOTE_CODE = 39, // single quote
 | 
						|
		DQUOTE_CODE = 34, // double quotes
 | 
						|
		OPAREN_CODE = 40, // (
 | 
						|
		CPAREN_CODE = 41, // )
 | 
						|
		OBRACK_CODE = 91, // [
 | 
						|
		CBRACK_CODE = 93, // ]
 | 
						|
		QUMARK_CODE = 63, // ?
 | 
						|
		SEMCOL_CODE = 59, // ;
 | 
						|
		COLON_CODE  = 58, // :
 | 
						|
 | 
						|
		throwError = function(message, index) {
 | 
						|
			var error = new Error(message + ' at character ' + index);
 | 
						|
			error.index = index;
 | 
						|
			error.description = message;
 | 
						|
			throw error;
 | 
						|
		},
 | 
						|
 | 
						|
	// Operations
 | 
						|
	// ----------
 | 
						|
 | 
						|
	// Set `t` to `true` to save space (when minified, not gzipped)
 | 
						|
		t = true,
 | 
						|
	// Use a quickly-accessible map to store all of the unary operators
 | 
						|
	// Values are set to `true` (it really doesn't matter)
 | 
						|
		unary_ops = {'-': t, '!': t, '~': t, '+': t},
 | 
						|
	// Also use a map for the binary operations but set their values to their
 | 
						|
	// binary precedence for quick reference:
 | 
						|
	// see [Order of operations](http://en.wikipedia.org/wiki/Order_of_operations#Programming_language)
 | 
						|
		binary_ops = {
 | 
						|
			'||': 1, '&&': 2, '|': 3,  '^': 4,  '&': 5,
 | 
						|
			'==': 6, '!=': 6, '===': 6, '!==': 6,
 | 
						|
			'<': 7,  '>': 7,  '<=': 7,  '>=': 7,
 | 
						|
			'<<':8,  '>>': 8, '>>>': 8,
 | 
						|
			'+': 9, '-': 9,
 | 
						|
			'*': 10, '/': 10, '%': 10
 | 
						|
		},
 | 
						|
	// Get return the longest key length of any object
 | 
						|
		getMaxKeyLen = function(obj) {
 | 
						|
			var max_len = 0, len;
 | 
						|
			for(var key in obj) {
 | 
						|
				if((len = key.length) > max_len && obj.hasOwnProperty(key)) {
 | 
						|
					max_len = len;
 | 
						|
				}
 | 
						|
			}
 | 
						|
			return max_len;
 | 
						|
		},
 | 
						|
		max_unop_len = getMaxKeyLen(unary_ops),
 | 
						|
		max_binop_len = getMaxKeyLen(binary_ops),
 | 
						|
	// Literals
 | 
						|
	// ----------
 | 
						|
	// Store the values to return for the various literals we may encounter
 | 
						|
		literals = {
 | 
						|
			'true': true,
 | 
						|
			'false': false,
 | 
						|
			'null': null
 | 
						|
		},
 | 
						|
	// Except for `this`, which is special. This could be changed to something like `'self'` as well
 | 
						|
		this_str = 'this',
 | 
						|
	// Returns the precedence of a binary operator or `0` if it isn't a binary operator
 | 
						|
		binaryPrecedence = function(op_val) {
 | 
						|
			return binary_ops[op_val] || 0;
 | 
						|
		},
 | 
						|
	// Utility function (gets called from multiple places)
 | 
						|
	// Also note that `a && b` and `a || b` are *logical* expressions, not binary expressions
 | 
						|
		createBinaryExpression = function (operator, left, right) {
 | 
						|
			var type = (operator === '||' || operator === '&&') ? LOGICAL_EXP : BINARY_EXP;
 | 
						|
			return {
 | 
						|
				type: type,
 | 
						|
				operator: operator,
 | 
						|
				left: left,
 | 
						|
				right: right
 | 
						|
			};
 | 
						|
		},
 | 
						|
		// `ch` is a character code in the next three functions
 | 
						|
		isDecimalDigit = function(ch) {
 | 
						|
			return (ch >= 48 && ch <= 57); // 0...9
 | 
						|
		},
 | 
						|
		isIdentifierStart = function(ch) {
 | 
						|
			return (ch === 36) || (ch === 95) || // `$` and `_`
 | 
						|
					(ch >= 65 && ch <= 90) || // A...Z
 | 
						|
					(ch >= 97 && ch <= 122) || // a...z
 | 
						|
                    (ch >= 128 && !binary_ops[String.fromCharCode(ch)]); // any non-ASCII that is not an operator
 | 
						|
		},
 | 
						|
		isIdentifierPart = function(ch) {
 | 
						|
			return (ch === 36) || (ch === 95) || // `$` and `_`
 | 
						|
					(ch >= 65 && ch <= 90) || // A...Z
 | 
						|
					(ch >= 97 && ch <= 122) || // a...z
 | 
						|
					(ch >= 48 && ch <= 57) || // 0...9
 | 
						|
                    (ch >= 128 && !binary_ops[String.fromCharCode(ch)]); // any non-ASCII that is not an operator
 | 
						|
		},
 | 
						|
 | 
						|
		// Parsing
 | 
						|
		// -------
 | 
						|
		// `expr` is a string with the passed in expression
 | 
						|
		jsep = function(expr) {
 | 
						|
			// `index` stores the character number we are currently at while `length` is a constant
 | 
						|
			// All of the gobbles below will modify `index` as we move along
 | 
						|
			var index = 0,
 | 
						|
				charAtFunc = expr.charAt,
 | 
						|
				charCodeAtFunc = expr.charCodeAt,
 | 
						|
				exprI = function(i) { return charAtFunc.call(expr, i); },
 | 
						|
				exprICode = function(i) { return charCodeAtFunc.call(expr, i); },
 | 
						|
				length = expr.length,
 | 
						|
 | 
						|
				// Push `index` up to the next non-space character
 | 
						|
				gobbleSpaces = function() {
 | 
						|
					var ch = exprICode(index);
 | 
						|
					// space or tab
 | 
						|
					while(ch === 32 || ch === 9 || ch === 10 || ch === 13) {
 | 
						|
						ch = exprICode(++index);
 | 
						|
					}
 | 
						|
				},
 | 
						|
 | 
						|
				// The main parsing function. Much of this code is dedicated to ternary expressions
 | 
						|
				gobbleExpression = function() {
 | 
						|
					var test = gobbleBinaryExpression(),
 | 
						|
						consequent, alternate;
 | 
						|
					gobbleSpaces();
 | 
						|
					if(exprICode(index) === QUMARK_CODE) {
 | 
						|
						// Ternary expression: test ? consequent : alternate
 | 
						|
						index++;
 | 
						|
						consequent = gobbleExpression();
 | 
						|
						if(!consequent) {
 | 
						|
							throwError('Expected expression', index);
 | 
						|
						}
 | 
						|
						gobbleSpaces();
 | 
						|
						if(exprICode(index) === COLON_CODE) {
 | 
						|
							index++;
 | 
						|
							alternate = gobbleExpression();
 | 
						|
							if(!alternate) {
 | 
						|
								throwError('Expected expression', index);
 | 
						|
							}
 | 
						|
							return {
 | 
						|
								type: CONDITIONAL_EXP,
 | 
						|
								test: test,
 | 
						|
								consequent: consequent,
 | 
						|
								alternate: alternate
 | 
						|
							};
 | 
						|
						} else {
 | 
						|
							throwError('Expected :', index);
 | 
						|
						}
 | 
						|
					} else {
 | 
						|
						return test;
 | 
						|
					}
 | 
						|
				},
 | 
						|
 | 
						|
				// Search for the operation portion of the string (e.g. `+`, `===`)
 | 
						|
				// Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
 | 
						|
				// and move down from 3 to 2 to 1 character until a matching binary operation is found
 | 
						|
				// then, return that binary operation
 | 
						|
				gobbleBinaryOp = function() {
 | 
						|
					gobbleSpaces();
 | 
						|
					var biop, to_check = expr.substr(index, max_binop_len), tc_len = to_check.length;
 | 
						|
					while(tc_len > 0) {
 | 
						|
						if(binary_ops.hasOwnProperty(to_check)) {
 | 
						|
							index += tc_len;
 | 
						|
							return to_check;
 | 
						|
						}
 | 
						|
						to_check = to_check.substr(0, --tc_len);
 | 
						|
					}
 | 
						|
					return false;
 | 
						|
				},
 | 
						|
 | 
						|
				// This function is responsible for gobbling an individual expression,
 | 
						|
				// e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
 | 
						|
				gobbleBinaryExpression = function() {
 | 
						|
					var ch_i, node, biop, prec, stack, biop_info, left, right, i;
 | 
						|
 | 
						|
					// First, try to get the leftmost thing
 | 
						|
					// Then, check to see if there's a binary operator operating on that leftmost thing
 | 
						|
					left = gobbleToken();
 | 
						|
					biop = gobbleBinaryOp();
 | 
						|
 | 
						|
					// If there wasn't a binary operator, just return the leftmost node
 | 
						|
					if(!biop) {
 | 
						|
						return left;
 | 
						|
					}
 | 
						|
 | 
						|
					// Otherwise, we need to start a stack to properly place the binary operations in their
 | 
						|
					// precedence structure
 | 
						|
					biop_info = { value: biop, prec: binaryPrecedence(biop)};
 | 
						|
 | 
						|
					right = gobbleToken();
 | 
						|
					if(!right) {
 | 
						|
						throwError("Expected expression after " + biop, index);
 | 
						|
					}
 | 
						|
					stack = [left, biop_info, right];
 | 
						|
 | 
						|
					// Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)
 | 
						|
					while((biop = gobbleBinaryOp())) {
 | 
						|
						prec = binaryPrecedence(biop);
 | 
						|
 | 
						|
						if(prec === 0) {
 | 
						|
							break;
 | 
						|
						}
 | 
						|
						biop_info = { value: biop, prec: prec };
 | 
						|
 | 
						|
						// Reduce: make a binary expression from the three topmost entries.
 | 
						|
						while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
 | 
						|
							right = stack.pop();
 | 
						|
							biop = stack.pop().value;
 | 
						|
							left = stack.pop();
 | 
						|
							node = createBinaryExpression(biop, left, right);
 | 
						|
							stack.push(node);
 | 
						|
						}
 | 
						|
 | 
						|
						node = gobbleToken();
 | 
						|
						if(!node) {
 | 
						|
							throwError("Expected expression after " + biop, index);
 | 
						|
						}
 | 
						|
						stack.push(biop_info, node);
 | 
						|
					}
 | 
						|
 | 
						|
					i = stack.length - 1;
 | 
						|
					node = stack[i];
 | 
						|
					while(i > 1) {
 | 
						|
						node = createBinaryExpression(stack[i - 1].value, stack[i - 2], node);
 | 
						|
						i -= 2;
 | 
						|
					}
 | 
						|
					return node;
 | 
						|
				},
 | 
						|
 | 
						|
				// An individual part of a binary expression:
 | 
						|
				// e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
 | 
						|
				gobbleToken = function() {
 | 
						|
					var ch, to_check, tc_len;
 | 
						|
 | 
						|
					gobbleSpaces();
 | 
						|
					ch = exprICode(index);
 | 
						|
 | 
						|
					if(isDecimalDigit(ch) || ch === PERIOD_CODE) {
 | 
						|
						// Char code 46 is a dot `.` which can start off a numeric literal
 | 
						|
						return gobbleNumericLiteral();
 | 
						|
					} else if(ch === SQUOTE_CODE || ch === DQUOTE_CODE) {
 | 
						|
						// Single or double quotes
 | 
						|
						return gobbleStringLiteral();
 | 
						|
					} else if (ch === OBRACK_CODE) {
 | 
						|
						return gobbleArray();
 | 
						|
					} else {
 | 
						|
						to_check = expr.substr(index, max_unop_len);
 | 
						|
						tc_len = to_check.length;
 | 
						|
						while(tc_len > 0) {
 | 
						|
							if(unary_ops.hasOwnProperty(to_check)) {
 | 
						|
								index += tc_len;
 | 
						|
								return {
 | 
						|
									type: UNARY_EXP,
 | 
						|
									operator: to_check,
 | 
						|
									argument: gobbleToken(),
 | 
						|
									prefix: true
 | 
						|
								};
 | 
						|
							}
 | 
						|
							to_check = to_check.substr(0, --tc_len);
 | 
						|
						}
 | 
						|
 | 
						|
						if (isIdentifierStart(ch) || ch === OPAREN_CODE) { // open parenthesis
 | 
						|
							// `foo`, `bar.baz`
 | 
						|
							return gobbleVariable();
 | 
						|
						}
 | 
						|
					}
 | 
						|
					
 | 
						|
					return false;
 | 
						|
				},
 | 
						|
				// Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
 | 
						|
				// keep track of everything in the numeric literal and then calling `parseFloat` on that string
 | 
						|
				gobbleNumericLiteral = function() {
 | 
						|
					var number = '', ch, chCode;
 | 
						|
					while(isDecimalDigit(exprICode(index))) {
 | 
						|
						number += exprI(index++);
 | 
						|
					}
 | 
						|
 | 
						|
					if(exprICode(index) === PERIOD_CODE) { // can start with a decimal marker
 | 
						|
						number += exprI(index++);
 | 
						|
 | 
						|
						while(isDecimalDigit(exprICode(index))) {
 | 
						|
							number += exprI(index++);
 | 
						|
						}
 | 
						|
					}
 | 
						|
 | 
						|
					ch = exprI(index);
 | 
						|
					if(ch === 'e' || ch === 'E') { // exponent marker
 | 
						|
						number += exprI(index++);
 | 
						|
						ch = exprI(index);
 | 
						|
						if(ch === '+' || ch === '-') { // exponent sign
 | 
						|
							number += exprI(index++);
 | 
						|
						}
 | 
						|
						while(isDecimalDigit(exprICode(index))) { //exponent itself
 | 
						|
							number += exprI(index++);
 | 
						|
						}
 | 
						|
						if(!isDecimalDigit(exprICode(index-1)) ) {
 | 
						|
							throwError('Expected exponent (' + number + exprI(index) + ')', index);
 | 
						|
						}
 | 
						|
					}
 | 
						|
 | 
						|
 | 
						|
					chCode = exprICode(index);
 | 
						|
					// Check to make sure this isn't a variable name that start with a number (123abc)
 | 
						|
					if(isIdentifierStart(chCode)) {
 | 
						|
						throwError('Variable names cannot start with a number (' +
 | 
						|
									number + exprI(index) + ')', index);
 | 
						|
					} else if(chCode === PERIOD_CODE) {
 | 
						|
						throwError('Unexpected period', index);
 | 
						|
					}
 | 
						|
 | 
						|
					return {
 | 
						|
						type: LITERAL,
 | 
						|
						value: parseFloat(number),
 | 
						|
						raw: number
 | 
						|
					};
 | 
						|
				},
 | 
						|
 | 
						|
				// Parses a string literal, staring with single or double quotes with basic support for escape codes
 | 
						|
				// e.g. `"hello world"`, `'this is\nJSEP'`
 | 
						|
				gobbleStringLiteral = function() {
 | 
						|
					var str = '', quote = exprI(index++), closed = false, ch;
 | 
						|
 | 
						|
					while(index < length) {
 | 
						|
						ch = exprI(index++);
 | 
						|
						if(ch === quote) {
 | 
						|
							closed = true;
 | 
						|
							break;
 | 
						|
						} else if(ch === '\\') {
 | 
						|
							// Check for all of the common escape codes
 | 
						|
							ch = exprI(index++);
 | 
						|
							switch(ch) {
 | 
						|
								case 'n': str += '\n'; break;
 | 
						|
								case 'r': str += '\r'; break;
 | 
						|
								case 't': str += '\t'; break;
 | 
						|
								case 'b': str += '\b'; break;
 | 
						|
								case 'f': str += '\f'; break;
 | 
						|
								case 'v': str += '\x0B'; break;
 | 
						|
								default : str += ch;
 | 
						|
							}
 | 
						|
						} else {
 | 
						|
							str += ch;
 | 
						|
						}
 | 
						|
					}
 | 
						|
 | 
						|
					if(!closed) {
 | 
						|
						throwError('Unclosed quote after "'+str+'"', index);
 | 
						|
					}
 | 
						|
 | 
						|
					return {
 | 
						|
						type: LITERAL,
 | 
						|
						value: str,
 | 
						|
						raw: quote + str + quote
 | 
						|
					};
 | 
						|
				},
 | 
						|
 | 
						|
				// Gobbles only identifiers
 | 
						|
				// e.g.: `foo`, `_value`, `$x1`
 | 
						|
				// Also, this function checks if that identifier is a literal:
 | 
						|
				// (e.g. `true`, `false`, `null`) or `this`
 | 
						|
				gobbleIdentifier = function() {
 | 
						|
					var ch = exprICode(index), start = index, identifier;
 | 
						|
 | 
						|
					if(isIdentifierStart(ch)) {
 | 
						|
						index++;
 | 
						|
					} else {
 | 
						|
						throwError('Unexpected ' + exprI(index), index);
 | 
						|
					}
 | 
						|
 | 
						|
					while(index < length) {
 | 
						|
						ch = exprICode(index);
 | 
						|
						if(isIdentifierPart(ch)) {
 | 
						|
							index++;
 | 
						|
						} else {
 | 
						|
							break;
 | 
						|
						}
 | 
						|
					}
 | 
						|
					identifier = expr.slice(start, index);
 | 
						|
 | 
						|
					if(literals.hasOwnProperty(identifier)) {
 | 
						|
						return {
 | 
						|
							type: LITERAL,
 | 
						|
							value: literals[identifier],
 | 
						|
							raw: identifier
 | 
						|
						};
 | 
						|
					} else if(identifier === this_str) {
 | 
						|
						return { type: THIS_EXP };
 | 
						|
					} else {
 | 
						|
						return {
 | 
						|
							type: IDENTIFIER,
 | 
						|
							name: identifier
 | 
						|
						};
 | 
						|
					}
 | 
						|
				},
 | 
						|
 | 
						|
				// Gobbles a list of arguments within the context of a function call
 | 
						|
				// or array literal. This function also assumes that the opening character
 | 
						|
				// `(` or `[` has already been gobbled, and gobbles expressions and commas
 | 
						|
				// until the terminator character `)` or `]` is encountered.
 | 
						|
				// e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
 | 
						|
				gobbleArguments = function(termination) {
 | 
						|
					var ch_i, args = [], node, closed = false;
 | 
						|
					while(index < length) {
 | 
						|
						gobbleSpaces();
 | 
						|
						ch_i = exprICode(index);
 | 
						|
						if(ch_i === termination) { // done parsing
 | 
						|
							closed = true;
 | 
						|
							index++;
 | 
						|
							break;
 | 
						|
						} else if (ch_i === COMMA_CODE) { // between expressions
 | 
						|
							index++;
 | 
						|
						} else {
 | 
						|
							node = gobbleExpression();
 | 
						|
							if(!node || node.type === COMPOUND) {
 | 
						|
								throwError('Expected comma', index);
 | 
						|
							}
 | 
						|
							args.push(node);
 | 
						|
						}
 | 
						|
					}
 | 
						|
					if (!closed) {
 | 
						|
						throwError('Expected ' + String.fromCharCode(termination), index);
 | 
						|
					}
 | 
						|
					return args;
 | 
						|
				},
 | 
						|
 | 
						|
				// Gobble a non-literal variable name. This variable name may include properties
 | 
						|
				// e.g. `foo`, `bar.baz`, `foo['bar'].baz`
 | 
						|
				// It also gobbles function calls:
 | 
						|
				// e.g. `Math.acos(obj.angle)`
 | 
						|
				gobbleVariable = function() {
 | 
						|
					var ch_i, node;
 | 
						|
					ch_i = exprICode(index);
 | 
						|
 | 
						|
					if(ch_i === OPAREN_CODE) {
 | 
						|
						node = gobbleGroup();
 | 
						|
					} else {
 | 
						|
						node = gobbleIdentifier();
 | 
						|
					}
 | 
						|
					gobbleSpaces();
 | 
						|
					ch_i = exprICode(index);
 | 
						|
					while(ch_i === PERIOD_CODE || ch_i === OBRACK_CODE || ch_i === OPAREN_CODE) {
 | 
						|
						index++;
 | 
						|
						if(ch_i === PERIOD_CODE) {
 | 
						|
							gobbleSpaces();
 | 
						|
							node = {
 | 
						|
								type: MEMBER_EXP,
 | 
						|
								computed: false,
 | 
						|
								object: node,
 | 
						|
								property: gobbleIdentifier()
 | 
						|
							};
 | 
						|
						} else if(ch_i === OBRACK_CODE) {
 | 
						|
							node = {
 | 
						|
								type: MEMBER_EXP,
 | 
						|
								computed: true,
 | 
						|
								object: node,
 | 
						|
								property: gobbleExpression()
 | 
						|
							};
 | 
						|
							gobbleSpaces();
 | 
						|
							ch_i = exprICode(index);
 | 
						|
							if(ch_i !== CBRACK_CODE) {
 | 
						|
								throwError('Unclosed [', index);
 | 
						|
							}
 | 
						|
							index++;
 | 
						|
						} else if(ch_i === OPAREN_CODE) {
 | 
						|
							// A function call is being made; gobble all the arguments
 | 
						|
							node = {
 | 
						|
								type: CALL_EXP,
 | 
						|
								'arguments': gobbleArguments(CPAREN_CODE),
 | 
						|
								callee: node
 | 
						|
							};
 | 
						|
						}
 | 
						|
						gobbleSpaces();
 | 
						|
						ch_i = exprICode(index);
 | 
						|
					}
 | 
						|
					return node;
 | 
						|
				},
 | 
						|
 | 
						|
				// Responsible for parsing a group of things within parentheses `()`
 | 
						|
				// This function assumes that it needs to gobble the opening parenthesis
 | 
						|
				// and then tries to gobble everything within that parenthesis, assuming
 | 
						|
				// that the next thing it should see is the close parenthesis. If not,
 | 
						|
				// then the expression probably doesn't have a `)`
 | 
						|
				gobbleGroup = function() {
 | 
						|
					index++;
 | 
						|
					var node = gobbleExpression();
 | 
						|
					gobbleSpaces();
 | 
						|
					if(exprICode(index) === CPAREN_CODE) {
 | 
						|
						index++;
 | 
						|
						return node;
 | 
						|
					} else {
 | 
						|
						throwError('Unclosed (', index);
 | 
						|
					}
 | 
						|
				},
 | 
						|
 | 
						|
				// Responsible for parsing Array literals `[1, 2, 3]`
 | 
						|
				// This function assumes that it needs to gobble the opening bracket
 | 
						|
				// and then tries to gobble the expressions as arguments.
 | 
						|
				gobbleArray = function() {
 | 
						|
					index++;
 | 
						|
					return {
 | 
						|
						type: ARRAY_EXP,
 | 
						|
						elements: gobbleArguments(CBRACK_CODE)
 | 
						|
					};
 | 
						|
				},
 | 
						|
 | 
						|
				nodes = [], ch_i, node;
 | 
						|
 | 
						|
			while(index < length) {
 | 
						|
				ch_i = exprICode(index);
 | 
						|
 | 
						|
				// Expressions can be separated by semicolons, commas, or just inferred without any
 | 
						|
				// separators
 | 
						|
				if(ch_i === SEMCOL_CODE || ch_i === COMMA_CODE) {
 | 
						|
					index++; // ignore separators
 | 
						|
				} else {
 | 
						|
					// Try to gobble each expression individually
 | 
						|
					if((node = gobbleExpression())) {
 | 
						|
						nodes.push(node);
 | 
						|
					// If we weren't able to find a binary expression and are out of room, then
 | 
						|
					// the expression passed in probably has too much
 | 
						|
					} else if(index < length) {
 | 
						|
						throwError('Unexpected "' + exprI(index) + '"', index);
 | 
						|
					}
 | 
						|
				}
 | 
						|
			}
 | 
						|
 | 
						|
			// If there's only one expression just try returning the expression
 | 
						|
			if(nodes.length === 1) {
 | 
						|
				return nodes[0];
 | 
						|
			} else {
 | 
						|
				return {
 | 
						|
					type: COMPOUND,
 | 
						|
					body: nodes
 | 
						|
				};
 | 
						|
			}
 | 
						|
		};
 | 
						|
 | 
						|
	// To be filled in by the template
 | 
						|
	jsep.version = '0.3.3';
 | 
						|
	jsep.toString = function() { return 'JavaScript Expression Parser (JSEP) v' + jsep.version; };
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.addUnaryOp
 | 
						|
	 * @param {string} op_name The name of the unary op to add
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.addUnaryOp = function(op_name) {
 | 
						|
		max_unop_len = Math.max(op_name.length, max_unop_len);
 | 
						|
		unary_ops[op_name] = t; return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.addBinaryOp
 | 
						|
	 * @param {string} op_name The name of the binary op to add
 | 
						|
	 * @param {number} precedence The precedence of the binary op (can be a float)
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.addBinaryOp = function(op_name, precedence) {
 | 
						|
		max_binop_len = Math.max(op_name.length, max_binop_len);
 | 
						|
		binary_ops[op_name] = precedence;
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.addLiteral
 | 
						|
	 * @param {string} literal_name The name of the literal to add
 | 
						|
	 * @param {*} literal_value The value of the literal
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.addLiteral = function(literal_name, literal_value) {
 | 
						|
		literals[literal_name] = literal_value;
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeUnaryOp
 | 
						|
	 * @param {string} op_name The name of the unary op to remove
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeUnaryOp = function(op_name) {
 | 
						|
		delete unary_ops[op_name];
 | 
						|
		if(op_name.length === max_unop_len) {
 | 
						|
			max_unop_len = getMaxKeyLen(unary_ops);
 | 
						|
		}
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeAllUnaryOps
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeAllUnaryOps = function() {
 | 
						|
		unary_ops = {};
 | 
						|
		max_unop_len = 0;
 | 
						|
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeBinaryOp
 | 
						|
	 * @param {string} op_name The name of the binary op to remove
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeBinaryOp = function(op_name) {
 | 
						|
		delete binary_ops[op_name];
 | 
						|
		if(op_name.length === max_binop_len) {
 | 
						|
			max_binop_len = getMaxKeyLen(binary_ops);
 | 
						|
		}
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeAllBinaryOps
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeAllBinaryOps = function() {
 | 
						|
		binary_ops = {};
 | 
						|
		max_binop_len = 0;
 | 
						|
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeLiteral
 | 
						|
	 * @param {string} literal_name The name of the literal to remove
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeLiteral = function(literal_name) {
 | 
						|
		delete literals[literal_name];
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	/**
 | 
						|
	 * @method jsep.removeAllLiterals
 | 
						|
	 * @return jsep
 | 
						|
	 */
 | 
						|
	jsep.removeAllLiterals = function() {
 | 
						|
		literals = {};
 | 
						|
 | 
						|
		return this;
 | 
						|
	};
 | 
						|
 | 
						|
	// In desktop environments, have a way to restore the old value for `jsep`
 | 
						|
	if (typeof exports === 'undefined') {
 | 
						|
		var old_jsep = root.jsep;
 | 
						|
		// The star of the show! It's a function!
 | 
						|
		root.jsep = jsep;
 | 
						|
		// And a courteous function willing to move out of the way for other similarly-named objects!
 | 
						|
		jsep.noConflict = function() {
 | 
						|
			if(root.jsep === jsep) {
 | 
						|
				root.jsep = old_jsep;
 | 
						|
			}
 | 
						|
			return jsep;
 | 
						|
		};
 | 
						|
	} else {
 | 
						|
		// In Node.JS environments
 | 
						|
		if (typeof module !== 'undefined' && module.exports) {
 | 
						|
			exports = module.exports = jsep;
 | 
						|
		} else {
 | 
						|
			exports.parse = jsep;
 | 
						|
		}
 | 
						|
	}
 | 
						|
}(this));
 | 
						|
 | 
						|
},{}],7:[function(require,module,exports){
 | 
						|
'use strict';
 | 
						|
 | 
						|
var utils = require('./utils');
 | 
						|
 | 
						|
module.exports = function makeJuiceClient(juiceClient) {
 | 
						|
 | 
						|
juiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link'];
 | 
						|
juiceClient.widthElements = ['TABLE', 'TD', 'IMG'];
 | 
						|
juiceClient.heightElements = ['TABLE', 'TD', 'IMG'];
 | 
						|
juiceClient.tableElements = ['TABLE', 'TD', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT'];
 | 
						|
juiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ];
 | 
						|
juiceClient.styleToAttribute = {
 | 
						|
  'background-color': 'bgcolor',
 | 
						|
  'background-image': 'background',
 | 
						|
  'text-align': 'align',
 | 
						|
  'vertical-align': 'valign'
 | 
						|
};
 | 
						|
juiceClient.excludedProperties = [];
 | 
						|
 | 
						|
juiceClient.juiceDocument = juiceDocument;
 | 
						|
juiceClient.inlineDocument = inlineDocument;
 | 
						|
 | 
						|
function inlineDocument($, css, options) {
 | 
						|
 | 
						|
  options = options || {};
 | 
						|
  var rules = utils.parseCSS(css);
 | 
						|
  var editedElements = [];
 | 
						|
  var styleAttributeName = 'style';
 | 
						|
 | 
						|
  if (options.styleAttributeName) {
 | 
						|
    styleAttributeName = options.styleAttributeName;
 | 
						|
  }
 | 
						|
 | 
						|
  rules.forEach(handleRule);
 | 
						|
  editedElements.forEach(setStyleAttrs);
 | 
						|
 | 
						|
  if (options.inlinePseudoElements) {
 | 
						|
    editedElements.forEach(inlinePseudoElements);
 | 
						|
  }
 | 
						|
 | 
						|
  if (options.applyWidthAttributes) {
 | 
						|
    editedElements.forEach(function(el) {
 | 
						|
      setDimensionAttrs(el, 'width');
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  if (options.applyHeightAttributes) {
 | 
						|
    editedElements.forEach(function(el) {
 | 
						|
      setDimensionAttrs(el, 'height');
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  if (options.applyAttributesTableElements) {
 | 
						|
    editedElements.forEach(setAttributesOnTableElements);
 | 
						|
  }
 | 
						|
 | 
						|
  if (options.insertPreservedExtraCss && options.extraCss) {
 | 
						|
    var preservedText = utils.getPreservedText(options.extraCss, {
 | 
						|
      mediaQueries: options.preserveMediaQueries,
 | 
						|
      fontFaces: options.preserveFontFaces
 | 
						|
    });
 | 
						|
    if (preservedText) {
 | 
						|
      var $appendTo = null;
 | 
						|
      if (options.insertPreservedExtraCss !== true) {
 | 
						|
        $appendTo = $(options.insertPreservedExtraCss);
 | 
						|
      } else {
 | 
						|
        $appendTo = $('head');
 | 
						|
        if (!$appendTo.length) { $appendTo = $('body'); }
 | 
						|
        if (!$appendTo.length) { $appendTo = $.root(); }
 | 
						|
      }
 | 
						|
 | 
						|
      $appendTo.first().append('<style>' + preservedText + '</style>');
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  function handleRule(rule) {
 | 
						|
    var sel = rule[0];
 | 
						|
    var style = rule[1];
 | 
						|
    var selector = new utils.Selector(sel);
 | 
						|
    var parsedSelector = selector.parsed();
 | 
						|
    var pseudoElementType = getPseudoElementType(parsedSelector);
 | 
						|
 | 
						|
    // skip rule if the selector has any pseudos which are ignored
 | 
						|
    for (var i = 0; i < parsedSelector.length; ++i) {
 | 
						|
      var subSel = parsedSelector[i];
 | 
						|
      if (subSel.pseudos) {
 | 
						|
        for (var j = 0; j < subSel.pseudos.length; ++j) {
 | 
						|
          var subSelPseudo = subSel.pseudos[j];
 | 
						|
          if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) {
 | 
						|
            return;
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
 | 
						|
    if (pseudoElementType) {
 | 
						|
      var last = parsedSelector[parsedSelector.length - 1];
 | 
						|
      var pseudos = last.pseudos;
 | 
						|
      last.pseudos = filterElementPseudos(last.pseudos);
 | 
						|
      sel = parsedSelector.toString();
 | 
						|
      last.pseudos = pseudos;
 | 
						|
    }
 | 
						|
 | 
						|
    var els;
 | 
						|
    try {
 | 
						|
      els = $(sel);
 | 
						|
    } catch (err) {
 | 
						|
      // skip invalid selector
 | 
						|
      return;
 | 
						|
    }
 | 
						|
 | 
						|
    els.each(function() {
 | 
						|
      var el = this;
 | 
						|
 | 
						|
      if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) {
 | 
						|
        return;
 | 
						|
      }
 | 
						|
 | 
						|
      if (pseudoElementType) {
 | 
						|
        var pseudoElPropName = 'pseudo' + pseudoElementType;
 | 
						|
        var pseudoEl = el[pseudoElPropName];
 | 
						|
        if (!pseudoEl) {
 | 
						|
          pseudoEl = el[pseudoElPropName] = $('<span />').get(0);
 | 
						|
          pseudoEl.pseudoElementType = pseudoElementType;
 | 
						|
          pseudoEl.pseudoElementParent = el;
 | 
						|
          el[pseudoElPropName] = pseudoEl;
 | 
						|
        }
 | 
						|
        el = pseudoEl;
 | 
						|
      }
 | 
						|
 | 
						|
      if (!el.styleProps) {
 | 
						|
        el.styleProps = {};
 | 
						|
 | 
						|
        // if the element has inline styles, fake selector with topmost specificity
 | 
						|
        if ($(el).attr(styleAttributeName)) {
 | 
						|
          var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } ';
 | 
						|
          addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('<style>', true));
 | 
						|
        }
 | 
						|
 | 
						|
        // store reference to an element we need to compile style="" attr for
 | 
						|
        editedElements.push(el);
 | 
						|
      }
 | 
						|
 | 
						|
      // go through the properties
 | 
						|
      function addProps(style, selector) {
 | 
						|
        for (var i = 0, l = style.length; i < l; i++) {
 | 
						|
          if (style[i].type == 'property') {
 | 
						|
            var name = style[i].name;
 | 
						|
            var value = style[i].value;
 | 
						|
            var important = style[i].value.match(/!important$/) !== null;
 | 
						|
            if (important && !options.preserveImportant) value = value.replace(/\s*!important$/, '');
 | 
						|
            // adds line number and column number for the properties as "additionalPriority" to the
 | 
						|
            // properties because in CSS the position directly affect the priority.
 | 
						|
            var additionalPriority = [style[i].position.start.line, style[i].position.start.col];
 | 
						|
            var prop = new utils.Property(name, value, selector, important ? 2 : 0, additionalPriority);
 | 
						|
            var existing = el.styleProps[name];
 | 
						|
 | 
						|
            // if property name is not in the excluded properties array
 | 
						|
            if (juiceClient.excludedProperties.indexOf(name) < 0) {
 | 
						|
              if (existing && existing.compare(prop) === prop || !existing) {
 | 
						|
                // deleting a property let us change the order (move it to the end in the setStyleAttrs loop)
 | 
						|
                if (existing && existing.selector !== selector) {
 | 
						|
                  delete el.styleProps[name];
 | 
						|
                } else if (existing) {
 | 
						|
                  // make "prop" a special composed property.
 | 
						|
                  prop.nextProp = existing;
 | 
						|
                }
 | 
						|
 | 
						|
                el.styleProps[name] = prop;
 | 
						|
              }
 | 
						|
            }
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }
 | 
						|
 | 
						|
      addProps(style, selector);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  function setStyleAttrs(el) {
 | 
						|
    var l = Object.keys(el.styleProps).length;
 | 
						|
    var props = [];
 | 
						|
    // Here we loop each property and make sure to "expand"
 | 
						|
    // linked "nextProp" properties happening when the same property
 | 
						|
    // is declared multiple times in the same selector.
 | 
						|
    Object.keys(el.styleProps).forEach(function(key) {
 | 
						|
      var np = el.styleProps[key];
 | 
						|
      while (typeof np !== 'undefined') {
 | 
						|
        props.push(np);
 | 
						|
        np = np.nextProp;
 | 
						|
      }
 | 
						|
    });
 | 
						|
    // sort properties by their originating selector's specificity so that
 | 
						|
    // props like "padding" and "padding-bottom" are resolved as expected.
 | 
						|
    props.sort(function(a, b) {
 | 
						|
      return a.compareFunc(b);
 | 
						|
    });
 | 
						|
    var string = props
 | 
						|
      .filter(function(prop) {
 | 
						|
        // Content becomes the innerHTML of pseudo elements, not used as a
 | 
						|
        // style property
 | 
						|
        return prop.prop !== 'content';
 | 
						|
      })
 | 
						|
      .map(function(prop) {
 | 
						|
        return prop.prop + ': ' + prop.value.replace(/["]/g, '\'') + ';';
 | 
						|
      })
 | 
						|
      .join(' ');
 | 
						|
    if (string) {
 | 
						|
      $(el).attr(styleAttributeName, string);
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  function inlinePseudoElements(el) {
 | 
						|
    if (el.pseudoElementType && el.styleProps.content) {
 | 
						|
      var parsed = parseContent(el.styleProps.content.value);
 | 
						|
      if (parsed.img) {
 | 
						|
        el.name = 'img';
 | 
						|
        $(el).attr('src', parsed.img);
 | 
						|
      } else {
 | 
						|
        $(el).text(parsed);
 | 
						|
      }
 | 
						|
      var parent = el.pseudoElementParent;
 | 
						|
      if (el.pseudoElementType === 'before') {
 | 
						|
        $(parent).prepend(el);
 | 
						|
      } else {
 | 
						|
        $(parent).append(el);
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  function setDimensionAttrs(el, dimension) {
 | 
						|
    if (!el.name) { return; }
 | 
						|
    var elName = el.name.toUpperCase();
 | 
						|
    if (juiceClient[dimension + 'Elements'].indexOf(elName) > -1) {
 | 
						|
      for (var i in el.styleProps) {
 | 
						|
        if (el.styleProps[i].prop === dimension) {
 | 
						|
          if (el.styleProps[i].value.match(/px/)) {
 | 
						|
            var pxSize = el.styleProps[i].value.replace('px', '');
 | 
						|
            $(el).attr(dimension, pxSize);
 | 
						|
            return;
 | 
						|
          }
 | 
						|
          if (juiceClient.tableElements.indexOf(elName) > -1 && el.styleProps[i].value.match(/\%/)) {
 | 
						|
            $(el).attr(dimension, el.styleProps[i].value);
 | 
						|
            return;
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  function extractBackgroundUrl(value) {
 | 
						|
    return value.indexOf('url(') !== 0
 | 
						|
      ? value
 | 
						|
      : value.replace(/^url\((["'])?([^"']+)\1\)$/, '$2');
 | 
						|
  }
 | 
						|
 | 
						|
  function setAttributesOnTableElements(el) {
 | 
						|
    if (!el.name) { return; }
 | 
						|
    var elName = el.name.toUpperCase();
 | 
						|
    var styleProps = Object.keys(juiceClient.styleToAttribute);
 | 
						|
 | 
						|
    if (juiceClient.tableElements.indexOf(elName) > -1) {
 | 
						|
      for (var i in el.styleProps) {
 | 
						|
        if (styleProps.indexOf(el.styleProps[i].prop) > -1) {
 | 
						|
          var prop = juiceClient.styleToAttribute[el.styleProps[i].prop];
 | 
						|
          var value = el.styleProps[i].value;
 | 
						|
          if (prop === 'background') {
 | 
						|
            value = extractBackgroundUrl(value)
 | 
						|
          }
 | 
						|
          $(el).attr(prop, value);
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
function parseContent(content) {
 | 
						|
  if (content === 'none' || content === 'normal') {
 | 
						|
    return '';
 | 
						|
  }
 | 
						|
 | 
						|
  var imageUrlMatch = content.match(/^\s*url\s*\(\s*(.*?)\s*\)\s*$/i);
 | 
						|
  if (imageUrlMatch) {
 | 
						|
    var url = imageUrlMatch[1].replace(/^['"]|['"]$/g, '');
 | 
						|
    return { img: url };
 | 
						|
  }
 | 
						|
 | 
						|
  // Naive parsing, assume well-formed value
 | 
						|
  content = content.slice(1, content.length - 1);
 | 
						|
  // Naive unescape, assume no unicode char codes
 | 
						|
  content = content.replace(/\\/g, '');
 | 
						|
  return content;
 | 
						|
}
 | 
						|
 | 
						|
// Return "before" or "after" if the given selector is a pseudo element (e.g.,
 | 
						|
// a::after).
 | 
						|
function getPseudoElementType(selector) {
 | 
						|
  if (selector.length === 0) {
 | 
						|
    return;
 | 
						|
  }
 | 
						|
 | 
						|
  var pseudos = selector[selector.length - 1].pseudos;
 | 
						|
  if (!pseudos) {
 | 
						|
    return;
 | 
						|
  }
 | 
						|
 | 
						|
  for (var i = 0; i < pseudos.length; i++) {
 | 
						|
    if (isPseudoElementName(pseudos[i])) {
 | 
						|
      return pseudos[i].name;
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
function isPseudoElementName(pseudo) {
 | 
						|
  return pseudo.name === 'before' || pseudo.name === 'after';
 | 
						|
}
 | 
						|
 | 
						|
function filterElementPseudos(pseudos) {
 | 
						|
  return pseudos.filter(function(pseudo) {
 | 
						|
    return !isPseudoElementName(pseudo);
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
function juiceDocument($, options) {
 | 
						|
  options = utils.getDefaultOptions(options);
 | 
						|
  var css = extractCssFromDocument($, options);
 | 
						|
  css += '\n' + options.extraCss;
 | 
						|
  inlineDocument($, css, options);
 | 
						|
  return $;
 | 
						|
}
 | 
						|
 | 
						|
function getStylesData($, options) {
 | 
						|
  var results = [];
 | 
						|
  var stylesList = $('style');
 | 
						|
  var styleDataList, styleData, styleElement;
 | 
						|
  stylesList.each(function() {
 | 
						|
    styleElement = this;
 | 
						|
    styleDataList = styleElement.childNodes;
 | 
						|
    if (styleDataList.length !== 1) {
 | 
						|
      return;
 | 
						|
    }
 | 
						|
    styleData = styleDataList[0].data;
 | 
						|
    if (options.applyStyleTags && $(styleElement).attr('data-embed') === undefined) {
 | 
						|
      results.push(styleData);
 | 
						|
    }
 | 
						|
    if (options.removeStyleTags && $(styleElement).attr('data-embed') === undefined) {
 | 
						|
      var preservedText = utils.getPreservedText(styleElement.childNodes[0].nodeValue, {
 | 
						|
        mediaQueries: options.preserveMediaQueries,
 | 
						|
        fontFaces: options.preserveFontFaces
 | 
						|
      });
 | 
						|
      if (preservedText) {
 | 
						|
        styleElement.childNodes[0].nodeValue = preservedText;
 | 
						|
      } else {
 | 
						|
        $(styleElement).remove();
 | 
						|
      }
 | 
						|
    }
 | 
						|
    $(styleElement).removeAttr('data-embed');
 | 
						|
  });
 | 
						|
  return results;
 | 
						|
}
 | 
						|
 | 
						|
function extractCssFromDocument($, options) {
 | 
						|
  var results = getStylesData($, options);
 | 
						|
  var css = results.join('\n');
 | 
						|
  return css;
 | 
						|
}
 | 
						|
 | 
						|
return juiceClient;
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
},{"./utils":10}],8:[function(require,module,exports){
 | 
						|
'use strict';
 | 
						|
 | 
						|
module.exports = exports = Property;
 | 
						|
 | 
						|
/**
 | 
						|
 * Module dependencies.
 | 
						|
 */
 | 
						|
 | 
						|
var utils = require('./utils');
 | 
						|
 | 
						|
/**
 | 
						|
 * CSS property constructor.
 | 
						|
 *
 | 
						|
 * @param {String} property
 | 
						|
 * @param {String} value
 | 
						|
 * @param {Selector} selector the property originates from
 | 
						|
 * @param {Integer} priority 0 for normal properties, 2 for !important properties.
 | 
						|
 * @param {Array} additional array of integers representing more detailed priorities (sorting)
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
function Property(prop, value, selector, priority, additionalPriority) {
 | 
						|
  this.prop = prop;
 | 
						|
  this.value = value;
 | 
						|
  this.selector = selector;
 | 
						|
  this.priority = priority || 0;
 | 
						|
  this.additionalPriority = additionalPriority || [];
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Compares with another Property based on Selector#specificity.
 | 
						|
 *
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
Property.prototype.compareFunc = function(property) {
 | 
						|
  var a = [];
 | 
						|
  a.push.apply(a, this.selector.specificity());
 | 
						|
  a.push.apply(a, this.additionalPriority);
 | 
						|
  a[0] += this.priority;
 | 
						|
  var b = [];
 | 
						|
  b.push.apply(b, property.selector.specificity());
 | 
						|
  b.push.apply(b, property.additionalPriority);
 | 
						|
  b[0] += property.priority;
 | 
						|
  return utils.compareFunc(a, b);
 | 
						|
};
 | 
						|
 | 
						|
Property.prototype.compare = function(property) {
 | 
						|
  var winner = this.compareFunc(property);
 | 
						|
  if (winner === 1) {
 | 
						|
    return this;
 | 
						|
  }
 | 
						|
  return property;
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * Returns CSS property
 | 
						|
 *
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
Property.prototype.toString = function() {
 | 
						|
  return this.prop + ': ' + this.value.replace(/['"]+/g, '') + ';';
 | 
						|
};
 | 
						|
 | 
						|
},{"./utils":10}],9:[function(require,module,exports){
 | 
						|
'use strict';
 | 
						|
 | 
						|
var parser = require('slick/parser');
 | 
						|
 | 
						|
module.exports = exports = Selector;
 | 
						|
 | 
						|
/**
 | 
						|
 * CSS selector constructor.
 | 
						|
 *
 | 
						|
 * @param {String} selector text
 | 
						|
 * @param {Array} optionally, precalculated specificity
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
function Selector(text, styleAttribute) {
 | 
						|
  this.text = text;
 | 
						|
  this.spec = undefined;
 | 
						|
  this.styleAttribute = styleAttribute || false;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Get parsed selector.
 | 
						|
 *
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
Selector.prototype.parsed = function() {
 | 
						|
  if (!this.tokens) { this.tokens = parse(this.text); }
 | 
						|
  return this.tokens;
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * Lazy specificity getter
 | 
						|
 *
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
Selector.prototype.specificity = function() {
 | 
						|
  var styleAttribute = this.styleAttribute;
 | 
						|
  if (!this.spec) { this.spec = specificity(this.text, this.parsed()); }
 | 
						|
  return this.spec;
 | 
						|
 | 
						|
  function specificity(text, parsed) {
 | 
						|
    var expressions = parsed || parse(text);
 | 
						|
    var spec = [styleAttribute ? 1 : 0, 0, 0, 0];
 | 
						|
    var nots = [];
 | 
						|
 | 
						|
    for (var i = 0; i < expressions.length; i++) {
 | 
						|
      var expression = expressions[i];
 | 
						|
      var pseudos = expression.pseudos;
 | 
						|
 | 
						|
      // id awards a point in the second column
 | 
						|
      if (expression.id) { spec[1]++; }
 | 
						|
 | 
						|
      // classes and attributes award a point each in the third column
 | 
						|
      if (expression.attributes) { spec[2] += expression.attributes.length; }
 | 
						|
      if (expression.classList) { spec[2] += expression.classList.length; }
 | 
						|
 | 
						|
      // tag awards a point in the fourth column
 | 
						|
      if (expression.tag && expression.tag !== '*') { spec[3]++; }
 | 
						|
 | 
						|
      // pseudos award a point each in the fourth column
 | 
						|
      if (pseudos) {
 | 
						|
        spec[3] += pseudos.length;
 | 
						|
 | 
						|
        for (var p = 0; p < pseudos.length; p++) {
 | 
						|
          if (pseudos[p].name === 'not') {
 | 
						|
            nots.push(pseudos[p].value);
 | 
						|
            spec[3]--;
 | 
						|
          }
 | 
						|
        }
 | 
						|
      }
 | 
						|
    }
 | 
						|
 | 
						|
    for (var ii = nots.length; ii--;) {
 | 
						|
      var not = specificity(nots[ii]);
 | 
						|
      for (var jj = 4; jj--;) { spec[jj] += not[jj]; }
 | 
						|
    }
 | 
						|
 | 
						|
    return spec;
 | 
						|
  }
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * Parses a selector and returns the tokens.
 | 
						|
 *
 | 
						|
 * @param {String} selector
 | 
						|
 * @api private.
 | 
						|
 */
 | 
						|
 | 
						|
function parse(text) {
 | 
						|
  try {
 | 
						|
    return parser(text)[0];
 | 
						|
  } catch (e) {
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
},{"slick/parser":19}],10:[function(require,module,exports){
 | 
						|
'use strict';
 | 
						|
 | 
						|
/**
 | 
						|
 * Module dependencies.
 | 
						|
 */
 | 
						|
 | 
						|
var mensch = require('mensch');
 | 
						|
var own = {}.hasOwnProperty;
 | 
						|
var Selector = require('./selector');
 | 
						|
var Property = require('./property');
 | 
						|
 | 
						|
exports.Selector = Selector;
 | 
						|
exports.Property = Property;
 | 
						|
 | 
						|
/**
 | 
						|
 * Returns an array of the selectors.
 | 
						|
 *
 | 
						|
 * @license Sizzle CSS Selector Engine - MIT
 | 
						|
 * @param {String} selectorText from mensch
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
exports.extract = function extract(selectorText) {
 | 
						|
  var attr = 0;
 | 
						|
  var sels = [];
 | 
						|
  var sel = '';
 | 
						|
 | 
						|
  for (var i = 0, l = selectorText.length; i < l; i++) {
 | 
						|
    var c = selectorText.charAt(i);
 | 
						|
 | 
						|
    if (attr) {
 | 
						|
      if (']' === c || ')' === c) { attr--; }
 | 
						|
      sel += c;
 | 
						|
    } else {
 | 
						|
      if (',' === c) {
 | 
						|
        sels.push(sel);
 | 
						|
        sel = '';
 | 
						|
      } else {
 | 
						|
        if ('[' === c || '(' === c) { attr++; }
 | 
						|
        if (sel.length || (c !== ',' && c !== '\n' && c !== ' ')) { sel += c; }
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  if (sel.length) {
 | 
						|
    sels.push(sel);
 | 
						|
  }
 | 
						|
 | 
						|
  return sels;
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * Returns a parse tree for a CSS source.
 | 
						|
 * If it encounters multiple selectors separated by a comma, it splits the
 | 
						|
 * tree.
 | 
						|
 *
 | 
						|
 * @param {String} css source
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
exports.parseCSS = function(css) {
 | 
						|
  var parsed = mensch.parse(css, {position: true, comments: true});
 | 
						|
  var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];
 | 
						|
  var ret = [];
 | 
						|
 | 
						|
  for (var i = 0, l = rules.length; i < l; i++) {
 | 
						|
    if (rules[i].type == 'rule') {
 | 
						|
      var rule = rules[i];
 | 
						|
      var selectors = rule.selectors;
 | 
						|
 | 
						|
      for (var ii = 0, ll = selectors.length; ii < ll; ii++) {
 | 
						|
        ret.push([selectors[ii], rule.declarations]);
 | 
						|
      }
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  return ret;
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * Returns preserved text for a CSS source.
 | 
						|
 *
 | 
						|
 * @param {String} css source
 | 
						|
 * @param {Object} options
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
exports.getPreservedText = function(css, options) {
 | 
						|
  var parsed = mensch.parse(css, {position: true, comments: true});
 | 
						|
  var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];
 | 
						|
  var preserved = [];
 | 
						|
  var lastStart = null;
 | 
						|
 | 
						|
  for (var i = rules.length - 1; i >= 0; i--) {
 | 
						|
    if ((options.fontFaces && rules[i].type === 'font-face') ||
 | 
						|
        (options.mediaQueries && rules[i].type === 'media')) {
 | 
						|
      preserved.unshift(
 | 
						|
        mensch.stringify(
 | 
						|
          { stylesheet: { rules: [ rules[i] ] }},
 | 
						|
          { comments: false, indentation: '  ' }
 | 
						|
        )
 | 
						|
      );
 | 
						|
    }
 | 
						|
    lastStart = rules[i].position.start;
 | 
						|
  }
 | 
						|
 | 
						|
  if (preserved.length === 0) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
  return '\n' + preserved.join('\n') + '\n';
 | 
						|
};
 | 
						|
 | 
						|
exports.normalizeLineEndings = function(text) {
 | 
						|
  return text.replace(/\r\n/g, '\n').replace(/\n/g, '\r\n');
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * Compares two specificity vectors, returning the winning one.
 | 
						|
 *
 | 
						|
 * @param {Array} vector a
 | 
						|
 * @param {Array} vector b
 | 
						|
 * @return {Array}
 | 
						|
 * @api public
 | 
						|
 */
 | 
						|
 | 
						|
exports.compareFunc = function(a, b) {
 | 
						|
  var min = Math.min(a.length, b.length);
 | 
						|
  for (var i = 0; i < min; i++) {
 | 
						|
    if (a[i] === b[i]) { continue; }
 | 
						|
    if (a[i] > b[i]) { return 1; }
 | 
						|
    return -1;
 | 
						|
  }
 | 
						|
 | 
						|
  return a.length - b.length;
 | 
						|
};
 | 
						|
 | 
						|
exports.compare = function(a, b) {
 | 
						|
  return exports.compareFunc(a, b) == 1 ? a : b;
 | 
						|
};
 | 
						|
 | 
						|
exports.extend = function(obj, src) {
 | 
						|
  for (var key in src) {
 | 
						|
    if (own.call(src, key)) {
 | 
						|
      obj[key] = src[key];
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return obj;
 | 
						|
};
 | 
						|
 | 
						|
exports.getDefaultOptions = function(options) {
 | 
						|
  var result = exports.extend({
 | 
						|
    extraCss: '',
 | 
						|
    insertPreservedExtraCss: true,
 | 
						|
    applyStyleTags: true,
 | 
						|
    removeStyleTags: true,
 | 
						|
    preserveMediaQueries: true,
 | 
						|
    preserveFontFaces: true,
 | 
						|
    applyWidthAttributes: true,
 | 
						|
    applyHeightAttributes: true,
 | 
						|
    applyAttributesTableElements: true,
 | 
						|
    url: ''
 | 
						|
  }, options);
 | 
						|
 | 
						|
  result.webResources = result.webResources || {};
 | 
						|
 | 
						|
  return result;
 | 
						|
};
 | 
						|
 | 
						|
},{"./property":8,"./selector":9,"mensch":13}],11:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
// knockout-sortable 1.0.0 | (c) 2016 Ryan Niemeyer |  http://www.opensource.org/licenses/mit-license
 | 
						|
;(function(factory) {
 | 
						|
    if (typeof define === "function" && define.amd) {
 | 
						|
        // AMD anonymous module
 | 
						|
        define(["knockout", "jquery", "jquery-ui/ui/widgets/sortable", "jquery-ui/ui/widgets/draggable"], factory);
 | 
						|
    } else if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
 | 
						|
        // CommonJS module
 | 
						|
        var ko = (typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),
 | 
						|
            jQuery = (typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null);
 | 
						|
        (typeof window !== "undefined" ? window['jQuery']['ui']['sortable'] : typeof global !== "undefined" ? global['jQuery']['ui']['sortable'] : null);
 | 
						|
        (typeof window !== "undefined" ? window['jQuery']['ui']['draggable'] : typeof global !== "undefined" ? global['jQuery']['ui']['draggable'] : null);
 | 
						|
        factory(ko, jQuery);
 | 
						|
    } else {
 | 
						|
        // No module loader (plain <script> tag) - put directly in global namespace
 | 
						|
        factory(window.ko, window.jQuery);
 | 
						|
    }
 | 
						|
})(function(ko, $) {
 | 
						|
    var ITEMKEY = "ko_sortItem",
 | 
						|
        INDEXKEY = "ko_sourceIndex",
 | 
						|
        LISTKEY = "ko_sortList",
 | 
						|
        PARENTKEY = "ko_parentList",
 | 
						|
        DRAGKEY = "ko_dragItem",
 | 
						|
        unwrap = ko.utils.unwrapObservable,
 | 
						|
        dataGet = ko.utils.domData.get,
 | 
						|
        dataSet = ko.utils.domData.set,
 | 
						|
        version = $.ui && $.ui.version,
 | 
						|
        //1.8.24 included a fix for how events were triggered in nested sortables. indexOf checks will fail if version starts with that value (0 vs. -1)
 | 
						|
        hasNestedSortableFix = version && version.indexOf("1.6.") && version.indexOf("1.7.") && (version.indexOf("1.8.") || version === "1.8.24");
 | 
						|
 | 
						|
    //internal afterRender that adds meta-data to children
 | 
						|
    var addMetaDataAfterRender = function(elements, data) {
 | 
						|
        ko.utils.arrayForEach(elements, function(element) {
 | 
						|
            if (element.nodeType === 1) {
 | 
						|
                dataSet(element, ITEMKEY, data);
 | 
						|
                dataSet(element, PARENTKEY, dataGet(element.parentNode, LISTKEY));
 | 
						|
            }
 | 
						|
        });
 | 
						|
    };
 | 
						|
 | 
						|
    //prepare the proper options for the template binding
 | 
						|
    var prepareTemplateOptions = function(valueAccessor, dataName) {
 | 
						|
        var result = {},
 | 
						|
            options = unwrap(valueAccessor()) || {},
 | 
						|
            actualAfterRender;
 | 
						|
 | 
						|
        //build our options to pass to the template engine
 | 
						|
        if (options.data) {
 | 
						|
            result[dataName] = options.data;
 | 
						|
            result.name = options.template;
 | 
						|
        } else {
 | 
						|
            result[dataName] = valueAccessor();
 | 
						|
        }
 | 
						|
 | 
						|
        ko.utils.arrayForEach(["afterAdd", "afterRender", "as", "beforeRemove", "includeDestroyed", "templateEngine", "templateOptions", "nodes"], function (option) {
 | 
						|
            if (options.hasOwnProperty(option)) {
 | 
						|
                result[option] = options[option];
 | 
						|
            } else if (ko.bindingHandlers.sortable.hasOwnProperty(option)) {
 | 
						|
                result[option] = ko.bindingHandlers.sortable[option];
 | 
						|
            }
 | 
						|
        });
 | 
						|
 | 
						|
        //use an afterRender function to add meta-data
 | 
						|
        if (dataName === "foreach") {
 | 
						|
            if (result.afterRender) {
 | 
						|
                //wrap the existing function, if it was passed
 | 
						|
                actualAfterRender = result.afterRender;
 | 
						|
                result.afterRender = function(element, data) {
 | 
						|
                    addMetaDataAfterRender.call(data, element, data);
 | 
						|
                    actualAfterRender.call(data, element, data);
 | 
						|
                };
 | 
						|
            } else {
 | 
						|
                result.afterRender = addMetaDataAfterRender;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        //return options to pass to the template binding
 | 
						|
        return result;
 | 
						|
    };
 | 
						|
 | 
						|
    var updateIndexFromDestroyedItems = function(index, items) {
 | 
						|
        var unwrapped = unwrap(items);
 | 
						|
 | 
						|
        if (unwrapped) {
 | 
						|
            for (var i = 0; i < index; i++) {
 | 
						|
                //add one for every destroyed item we find before the targetIndex in the target array
 | 
						|
                if (unwrapped[i] && unwrap(unwrapped[i]._destroy)) {
 | 
						|
                    index++;
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        return index;
 | 
						|
    };
 | 
						|
 | 
						|
    //remove problematic leading/trailing whitespace from templates
 | 
						|
    var stripTemplateWhitespace = function(element, name) {
 | 
						|
        var templateSource,
 | 
						|
            templateElement;
 | 
						|
 | 
						|
        //process named templates
 | 
						|
        if (name) {
 | 
						|
            templateElement = document.getElementById(name);
 | 
						|
            if (templateElement) {
 | 
						|
                templateSource = new ko.templateSources.domElement(templateElement);
 | 
						|
                templateSource.text($.trim(templateSource.text()));
 | 
						|
            }
 | 
						|
        }
 | 
						|
        else {
 | 
						|
            //remove leading/trailing non-elements from anonymous templates
 | 
						|
            $(element).contents().each(function() {
 | 
						|
                if (this && this.nodeType !== 1) {
 | 
						|
                    element.removeChild(this);
 | 
						|
                }
 | 
						|
            });
 | 
						|
        }
 | 
						|
    };
 | 
						|
 | 
						|
    //connect items with observableArrays
 | 
						|
    ko.bindingHandlers.sortable = {
 | 
						|
        init: function(element, valueAccessor, allBindingsAccessor, data, context) {
 | 
						|
            var $element = $(element),
 | 
						|
                value = unwrap(valueAccessor()) || {},
 | 
						|
                templateOptions = prepareTemplateOptions(valueAccessor, "foreach"),
 | 
						|
                sortable = {},
 | 
						|
                startActual, updateActual;
 | 
						|
 | 
						|
            stripTemplateWhitespace(element, templateOptions.name);
 | 
						|
 | 
						|
            //build a new object that has the global options with overrides from the binding
 | 
						|
            $.extend(true, sortable, ko.bindingHandlers.sortable);
 | 
						|
            if (value.options && sortable.options) {
 | 
						|
                ko.utils.extend(sortable.options, value.options);
 | 
						|
                delete value.options;
 | 
						|
            }
 | 
						|
            ko.utils.extend(sortable, value);
 | 
						|
 | 
						|
            //if allowDrop is an observable or a function, then execute it in a computed observable
 | 
						|
            if (sortable.connectClass && (ko.isObservable(sortable.allowDrop) || typeof sortable.allowDrop == "function")) {
 | 
						|
                ko.computed({
 | 
						|
                    read: function() {
 | 
						|
                        var value = unwrap(sortable.allowDrop),
 | 
						|
                            shouldAdd = typeof value == "function" ? value.call(this, templateOptions.foreach) : value;
 | 
						|
                        ko.utils.toggleDomNodeCssClass(element, sortable.connectClass, shouldAdd);
 | 
						|
                    },
 | 
						|
                    disposeWhenNodeIsRemoved: element
 | 
						|
                }, this);
 | 
						|
            } else {
 | 
						|
                ko.utils.toggleDomNodeCssClass(element, sortable.connectClass, sortable.allowDrop);
 | 
						|
            }
 | 
						|
 | 
						|
            //wrap the template binding
 | 
						|
            ko.bindingHandlers.template.init(element, function() { return templateOptions; }, allBindingsAccessor, data, context);
 | 
						|
 | 
						|
            //keep a reference to start/update functions that might have been passed in
 | 
						|
            startActual = sortable.options.start;
 | 
						|
            updateActual = sortable.options.update;
 | 
						|
 | 
						|
            //ensure draggable table row cells maintain their width while dragging (unless a helper is provided)
 | 
						|
            if ( !sortable.options.helper ) {
 | 
						|
                sortable.options.helper = function(e, ui) {
 | 
						|
                    if (ui.is("tr")) {
 | 
						|
                        ui.children().each(function() {
 | 
						|
                            $(this).width($(this).width());
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
                    return ui;
 | 
						|
                };
 | 
						|
            }
 | 
						|
 | 
						|
            //initialize sortable binding after template binding has rendered in update function
 | 
						|
            var createTimeout = setTimeout(function() {
 | 
						|
                var dragItem;
 | 
						|
                var originalReceive = sortable.options.receive;
 | 
						|
 | 
						|
                $element.sortable(ko.utils.extend(sortable.options, {
 | 
						|
                    start: function(event, ui) {
 | 
						|
                        //track original index
 | 
						|
                        var el = ui.item[0];
 | 
						|
                        dataSet(el, INDEXKEY, ko.utils.arrayIndexOf(ui.item.parent().children(), el));
 | 
						|
 | 
						|
                        //make sure that fields have a chance to update model
 | 
						|
                        ui.item.find("input:focus").change();
 | 
						|
                        if (startActual) {
 | 
						|
                            startActual.apply(this, arguments);
 | 
						|
                        }
 | 
						|
                    },
 | 
						|
                    receive: function(event, ui) {
 | 
						|
                        //optionally apply an existing receive handler
 | 
						|
                        if (typeof originalReceive === "function") {
 | 
						|
                            originalReceive.call(this, event, ui);
 | 
						|
                        }
 | 
						|
 | 
						|
                        dragItem = dataGet(ui.item[0], DRAGKEY);
 | 
						|
                        if (dragItem) {
 | 
						|
                            //copy the model item, if a clone option is provided
 | 
						|
                            if (dragItem.clone) {
 | 
						|
                                dragItem = dragItem.clone();
 | 
						|
                            }
 | 
						|
 | 
						|
                            //configure a handler to potentially manipulate item before drop
 | 
						|
                            if (sortable.dragged) {
 | 
						|
                                dragItem = sortable.dragged.call(this, dragItem, event, ui) || dragItem;
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                    },
 | 
						|
                    update: function(event, ui) {
 | 
						|
                        var sourceParent, targetParent, sourceIndex, targetIndex, arg,
 | 
						|
                            el = ui.item[0],
 | 
						|
                            parentEl = ui.item.parent()[0],
 | 
						|
                            item = dataGet(el, ITEMKEY) || dragItem;
 | 
						|
 | 
						|
                        if (!item) {
 | 
						|
                            $(el).remove();
 | 
						|
                        }
 | 
						|
                        dragItem = null;
 | 
						|
 | 
						|
                        //make sure that moves only run once, as update fires on multiple containers
 | 
						|
                        if (item && (this === parentEl) || (!hasNestedSortableFix && $.contains(this, parentEl))) {
 | 
						|
                            //identify parents
 | 
						|
                            sourceParent = dataGet(el, PARENTKEY);
 | 
						|
                            sourceIndex = dataGet(el, INDEXKEY);
 | 
						|
                            targetParent = dataGet(el.parentNode, LISTKEY);
 | 
						|
                            targetIndex = ko.utils.arrayIndexOf(ui.item.parent().children(), el);
 | 
						|
 | 
						|
                            //take destroyed items into consideration
 | 
						|
                            if (!templateOptions.includeDestroyed) {
 | 
						|
                                sourceIndex = updateIndexFromDestroyedItems(sourceIndex, sourceParent);
 | 
						|
                                targetIndex = updateIndexFromDestroyedItems(targetIndex, targetParent);
 | 
						|
                            }
 | 
						|
 | 
						|
                            //build up args for the callbacks
 | 
						|
                            if (sortable.beforeMove || sortable.afterMove) {
 | 
						|
                                arg = {
 | 
						|
                                    item: item,
 | 
						|
                                    sourceParent: sourceParent,
 | 
						|
                                    sourceParentNode: sourceParent && ui.sender || el.parentNode,
 | 
						|
                                    sourceIndex: sourceIndex,
 | 
						|
                                    targetParent: targetParent,
 | 
						|
                                    targetIndex: targetIndex,
 | 
						|
                                    cancelDrop: false
 | 
						|
                                };
 | 
						|
 | 
						|
                                //execute the configured callback prior to actually moving items
 | 
						|
                                if (sortable.beforeMove) {
 | 
						|
                                    sortable.beforeMove.call(this, arg, event, ui);
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
 | 
						|
                            //call cancel on the correct list, so KO can take care of DOM manipulation
 | 
						|
                            if (sourceParent) {
 | 
						|
                                $(sourceParent === targetParent ? this : ui.sender || this).sortable("cancel");
 | 
						|
                            }
 | 
						|
                            //for a draggable item just remove the element
 | 
						|
                            else {
 | 
						|
                                $(el).remove();
 | 
						|
                            }
 | 
						|
 | 
						|
                            //if beforeMove told us to cancel, then we are done
 | 
						|
                            if (arg && arg.cancelDrop) {
 | 
						|
                                return;
 | 
						|
                            }
 | 
						|
 | 
						|
                            //if the strategy option is unset or false, employ the order strategy involving removal and insertion of items
 | 
						|
                            if (!sortable.hasOwnProperty("strategyMove") || sortable.strategyMove === false) {
 | 
						|
                                //do the actual move
 | 
						|
                                if (targetIndex >= 0) {
 | 
						|
                                    if (sourceParent) {
 | 
						|
                                        sourceParent.splice(sourceIndex, 1);
 | 
						|
 | 
						|
                                        //if using deferred updates plugin, force updates
 | 
						|
                                        if (ko.processAllDeferredBindingUpdates) {
 | 
						|
                                            ko.processAllDeferredBindingUpdates();
 | 
						|
                                        }
 | 
						|
 | 
						|
                                        //if using deferred updates on knockout 3.4, force updates
 | 
						|
                                        if (ko.options && ko.options.deferUpdates) {
 | 
						|
                                            ko.tasks.runEarly();
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
 | 
						|
                                    targetParent.splice(targetIndex, 0, item);
 | 
						|
                                }
 | 
						|
 | 
						|
                                //rendering is handled by manipulating the observableArray; ignore dropped element
 | 
						|
                                dataSet(el, ITEMKEY, null);
 | 
						|
                            }
 | 
						|
                            else { //employ the strategy of moving items
 | 
						|
                                if (targetIndex >= 0) {
 | 
						|
                                    if (sourceParent) {
 | 
						|
                                        if (sourceParent !== targetParent) {
 | 
						|
                                            // moving from one list to another
 | 
						|
 | 
						|
                                            sourceParent.splice(sourceIndex, 1);
 | 
						|
                                            targetParent.splice(targetIndex, 0, item);
 | 
						|
 | 
						|
                                            //rendering is handled by manipulating the observableArray; ignore dropped element
 | 
						|
                                            dataSet(el, ITEMKEY, null);
 | 
						|
                                            ui.item.remove();
 | 
						|
                                        }
 | 
						|
                                        else {
 | 
						|
                                            // moving within same list
 | 
						|
                                            var underlyingList = unwrap(sourceParent);
 | 
						|
 | 
						|
                                            // notify 'beforeChange' subscribers
 | 
						|
                                            if (sourceParent.valueWillMutate) {
 | 
						|
                                                sourceParent.valueWillMutate();
 | 
						|
                                            }
 | 
						|
 | 
						|
                                            // move from source index ...
 | 
						|
                                            underlyingList.splice(sourceIndex, 1);
 | 
						|
                                            // ... to target index
 | 
						|
                                            underlyingList.splice(targetIndex, 0, item);
 | 
						|
 | 
						|
                                            // notify subscribers
 | 
						|
                                            if (sourceParent.valueHasMutated) {
 | 
						|
                                                sourceParent.valueHasMutated();
 | 
						|
                                            }
 | 
						|
                                        }
 | 
						|
                                    }
 | 
						|
                                    else {
 | 
						|
                                        // drop new element from outside
 | 
						|
                                        targetParent.splice(targetIndex, 0, item);
 | 
						|
 | 
						|
                                        //rendering is handled by manipulating the observableArray; ignore dropped element
 | 
						|
                                        dataSet(el, ITEMKEY, null);
 | 
						|
                                        ui.item.remove();
 | 
						|
                                    }
 | 
						|
                                }
 | 
						|
                            }
 | 
						|
 | 
						|
                            //if using deferred updates plugin, force updates
 | 
						|
                            if (ko.processAllDeferredBindingUpdates) {
 | 
						|
                                ko.processAllDeferredBindingUpdates();
 | 
						|
                            }
 | 
						|
 | 
						|
                            //allow binding to accept a function to execute after moving the item
 | 
						|
                            if (sortable.afterMove) {
 | 
						|
                                sortable.afterMove.call(this, arg, event, ui);
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
 | 
						|
                        if (updateActual) {
 | 
						|
                            updateActual.apply(this, arguments);
 | 
						|
                        }
 | 
						|
                    },
 | 
						|
                    connectWith: sortable.connectClass ? "." + sortable.connectClass : false
 | 
						|
                }));
 | 
						|
 | 
						|
                //handle enabling/disabling sorting
 | 
						|
                if (sortable.isEnabled !== undefined) {
 | 
						|
                    ko.computed({
 | 
						|
                        read: function() {
 | 
						|
                            $element.sortable(unwrap(sortable.isEnabled) ? "enable" : "disable");
 | 
						|
                        },
 | 
						|
                        disposeWhenNodeIsRemoved: element
 | 
						|
                    });
 | 
						|
                }
 | 
						|
            }, 0);
 | 
						|
 | 
						|
            //handle disposal
 | 
						|
            ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
 | 
						|
                //only call destroy if sortable has been created
 | 
						|
                if ($element.data("ui-sortable") || $element.data("sortable")) {
 | 
						|
                    $element.sortable("destroy");
 | 
						|
                }
 | 
						|
 | 
						|
                ko.utils.toggleDomNodeCssClass(element, sortable.connectClass, false);
 | 
						|
 | 
						|
                //do not create the sortable if the element has been removed from DOM
 | 
						|
                clearTimeout(createTimeout);
 | 
						|
            });
 | 
						|
 | 
						|
            return { 'controlsDescendantBindings': true };
 | 
						|
        },
 | 
						|
        update: function(element, valueAccessor, allBindingsAccessor, data, context) {
 | 
						|
            var templateOptions = prepareTemplateOptions(valueAccessor, "foreach");
 | 
						|
 | 
						|
            //attach meta-data
 | 
						|
            dataSet(element, LISTKEY, templateOptions.foreach);
 | 
						|
 | 
						|
            //call template binding's update with correct options
 | 
						|
            ko.bindingHandlers.template.update(element, function() { return templateOptions; }, allBindingsAccessor, data, context);
 | 
						|
        },
 | 
						|
        connectClass: 'ko_container',
 | 
						|
        allowDrop: true,
 | 
						|
        afterMove: null,
 | 
						|
        beforeMove: null,
 | 
						|
        options: {}
 | 
						|
    };
 | 
						|
 | 
						|
    //create a draggable that is appropriate for dropping into a sortable
 | 
						|
    ko.bindingHandlers.draggable = {
 | 
						|
        init: function(element, valueAccessor, allBindingsAccessor, data, context) {
 | 
						|
            var value = unwrap(valueAccessor()) || {},
 | 
						|
                options = value.options || {},
 | 
						|
                draggableOptions = ko.utils.extend({}, ko.bindingHandlers.draggable.options),
 | 
						|
                templateOptions = prepareTemplateOptions(valueAccessor, "data"),
 | 
						|
                connectClass = value.connectClass || ko.bindingHandlers.draggable.connectClass,
 | 
						|
                isEnabled = value.isEnabled !== undefined ? value.isEnabled : ko.bindingHandlers.draggable.isEnabled;
 | 
						|
 | 
						|
            value = "data" in value ? value.data : value;
 | 
						|
 | 
						|
            //set meta-data
 | 
						|
            dataSet(element, DRAGKEY, value);
 | 
						|
 | 
						|
            //override global options with override options passed in
 | 
						|
            ko.utils.extend(draggableOptions, options);
 | 
						|
 | 
						|
            //setup connection to a sortable
 | 
						|
            draggableOptions.connectToSortable = connectClass ? "." + connectClass : false;
 | 
						|
 | 
						|
            //initialize draggable
 | 
						|
            $(element).draggable(draggableOptions);
 | 
						|
 | 
						|
            //handle enabling/disabling sorting
 | 
						|
            if (isEnabled !== undefined) {
 | 
						|
                ko.computed({
 | 
						|
                    read: function() {
 | 
						|
                        $(element).draggable(unwrap(isEnabled) ? "enable" : "disable");
 | 
						|
                    },
 | 
						|
                    disposeWhenNodeIsRemoved: element
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            //handle disposal
 | 
						|
            ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
 | 
						|
                $(element).draggable("destroy");
 | 
						|
            });
 | 
						|
 | 
						|
            return ko.bindingHandlers.template.init(element, function() { return templateOptions; }, allBindingsAccessor, data, context);
 | 
						|
        },
 | 
						|
        update: function(element, valueAccessor, allBindingsAccessor, data, context) {
 | 
						|
            var templateOptions = prepareTemplateOptions(valueAccessor, "data");
 | 
						|
 | 
						|
            return ko.bindingHandlers.template.update(element, function() { return templateOptions; }, allBindingsAccessor, data, context);
 | 
						|
        },
 | 
						|
        connectClass: ko.bindingHandlers.sortable.connectClass,
 | 
						|
        options: {
 | 
						|
            helper: "clone"
 | 
						|
        }
 | 
						|
    };
 | 
						|
});
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],12:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
/*! ko-reactor v1.4.0
 | 
						|
 * The MIT License (MIT)
 | 
						|
 * Copyright (c) 2018 Ziad Jeeroburkhan */
 | 
						|
!function(e){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?e((typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null)):"function"==typeof define&&define.amd?define(["knockout"],e):e(window.ko)}(function(e){e.subscribable.fn.watch=function(t,a,n,r){var o=typeof t;return"boolean"===o||"undefined"===o?e.watch(this,{enabled:!1!==t}):"function"!==o||e.isSubscribable(t)?e.watch(t,a,n,r||this):e.watch(this,a||{},t,r||this),this},e.watch=function(t,a,n,r){function o(c,u,f,s,b,h){if(c&&0!==a.depth&&(-1===a.depth||f.length<(a.depth||1))){if(a.watchedOnly&&!c.watchable&&c!=t)return;if(!1!==a.enabled&&!0!==a.enabled||(c.watchable=a.enabled),!1===c.watchable)return;!0===a.seal&&(c.watchable=!1);var d=typeof c;if("object"===d||"function"===d){if(c._watcher===r)return;if(a.hide&&e.utils.arrayIndexOf(a.hide,c)>-1)return;var p=[].concat(f,u&&u!==t?u:[]);if("function"!==d){if("[object Object]"===Object.prototype.toString.call(c))e.utils.objectForEach(c,function(t,n){if(n=a.getter?a.getter.call(r,p,c,t):n){if(a.wrap){var i=Object.prototype.toString.call(n);"[object Function]"!==i&&"[object Object]"!==i&&(a.beforeWrap&&!1===a.beforeWrap.call(r,p,c,n)||(n=c[t]="[object Array]"===i?e.observableArray(n):e.observable(n)))}a.unloop&&(n._watcher=s?void 0:r);var l=o(n,b?null:c,p,s,null,t);a.tagFields&&void 0===n._fieldName&&(l||"parentsOnly"!==a.tagFields&&"function"==typeof n||"object"==typeof n)&&(n._fieldName=t)}});else if(!0!==a.hideArrays)for(var y=0;y<c.length;y++)o(c[y],b?null:c,p,s);return!0}if("function"==typeof c.notifySubscribers&&n){if(!0===a.enabled&&!1===c.watchable)return;if(s||!a.beforeWatch||!1!==a.beforeWatch.call(r,p,c,h)){var v="function"==typeof c.pop;if(s?i(c):l(c,v,p,b),v)return o(c(),b?null:c,p,s,!0),!0;if(!0!==a.hideWrappedValues)return o(c(),b?null:c,p,s,!0)}}}}}function i(e){var t=e[c];if(!t)throw"Subscriptions field (."+c+") not defined for observable child "+(e._fieldName||"");if(t.change)for(n=t.change.length-1;n>=0;n--)t.change[n]._watcher===r&&t.change[n].dispose();if(t.beforeChange&&(a.mutable||a.oldValues>0))for(n=t.beforeChange.length-1;n>=0;n--)t.beforeChange[n]._watcher===r&&t.beforeChange[n].dispose();if(t.arrayChange)for(var n=t.arrayChange.length-1;n>=0;n--)t.arrayChange[n]._watcher===r&&t.arrayChange[n].dispose()}function l(t,i,l,c){i?t.subscribe(function(i){var u;!1===a.splitArrayChanges&&void 0!==(u=n.call(r,l,t,i))&&r(u),e.utils.arrayForEach(i,function(e){if(!1!==a.splitArrayChanges){var i=n.call(r,l,t,e);void 0!==i&&r(i)}e.moved||(!1===a.async?o(e.value,c?null:t,l,"deleted"===e.status):setTimeout(function(){o(e.value,c?null:t,l,"deleted"===e.status)}))})},void 0,"arrayChange")._watcher=r:(t.subscribe(function(){if(!1!==t.watchable){var e=n.call(r,l,t);void 0!==e&&r(e),a.mutable&&"object"==typeof t()&&(!1===a.async?o(t(),c?null:t,l,!1,!0):setTimeout(function(){o(t(),c?null:t,l,!1,!0)}))}},null,"change")._watcher=r,(a.oldValues>0||a.mutable)&&(t.subscribe(function(e){if(a.oldValues>0){var n=t.oldValues?t.oldValues:t.oldValues=[];for(n.unshift(e);n.length>a.oldValues;)n.pop()}a.mutable&&"object"==typeof e&&o(e,c?null:t,l,!0,!0)},null,"beforeChange")._watcher=r))}"function"==typeof a&&(r=r||n,n=a,a={}),r=r||this;var c;switch("function"==typeof e.subscription||e.version){case!0:c="_subscriptions";break;case"3.0.0":c="F";break;case"3.1.0":c="H";break;case"3.2.0":c="M";break;case"3.3.0":c="G";break;case"3.4.0":case"3.4.1":c="K";break;case"3.4.2":c="F";break;case"3.5.0-beta":c="S";break;default:throw"Unsupported Knockout version. Only v3.0.0 to v3.5.0-beta are supported when minified. Current version is "+e.version}return"function"!=typeof t||e.isSubscribable(t)?(o(t,null,[]),{dispose:function(){o(t,null,[],!0)}}):e.computed(t,n,a)}});window.foo = "1.4.0";
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],13:[function(require,module,exports){
 | 
						|
module.exports = {
 | 
						|
    lex  : require('./lib/lexer'),
 | 
						|
    parse: require('./lib/parser'),
 | 
						|
    stringify: require('./lib/stringify')
 | 
						|
};
 | 
						|
 | 
						|
},{"./lib/lexer":15,"./lib/parser":16,"./lib/stringify":17}],14:[function(require,module,exports){
 | 
						|
(function (process){
 | 
						|
exports = module.exports = debug;
 | 
						|
 | 
						|
function debug(label) {
 | 
						|
  return _debug.bind(null, label);
 | 
						|
}
 | 
						|
 | 
						|
function _debug(label) {
 | 
						|
  var args = [].slice.call(arguments, 1);
 | 
						|
  args.unshift('[' + label + ']');
 | 
						|
  process.stderr.write(args.join(' ') + '\n');
 | 
						|
}
 | 
						|
}).call(this,require('_process'))
 | 
						|
 | 
						|
},{"_process":18}],15:[function(require,module,exports){
 | 
						|
var DEBUG = false; // `true` to print debugging info.
 | 
						|
var TIMER = false; // `true` to time calls to `lex()` and print the results.
 | 
						|
 | 
						|
var debug = require('./debug')('lex');
 | 
						|
 | 
						|
exports = module.exports = lex;
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a CSS string into an array of lexical tokens.
 | 
						|
 *
 | 
						|
 * @param {String} css CSS
 | 
						|
 * @returns {Array} lexical tokens
 | 
						|
 */
 | 
						|
function lex(css) {
 | 
						|
  var start; // Debug timer start.
 | 
						|
 | 
						|
  var buffer = '';      // Character accumulator
 | 
						|
  var ch;               // Current character
 | 
						|
  var column = 0;       // Current source column number
 | 
						|
  var cursor = -1;      // Current source cursor position
 | 
						|
  var depth = 0;        // Current nesting depth
 | 
						|
  var line = 1;         // Current source line number
 | 
						|
  var state = 'before-selector'; // Current state
 | 
						|
  var stack = [state];  // State stack
 | 
						|
  var token = {};       // Current token
 | 
						|
  var tokens = [];      // Token accumulator
 | 
						|
 | 
						|
  // Supported @-rules, in roughly descending order of usage probability.
 | 
						|
  var atRules = [
 | 
						|
    'media',
 | 
						|
    'keyframes',
 | 
						|
    { name: '-webkit-keyframes', type: 'keyframes', prefix: '-webkit-' },
 | 
						|
    { name: '-moz-keyframes', type: 'keyframes', prefix: '-moz-' },
 | 
						|
    { name: '-ms-keyframes', type: 'keyframes', prefix: '-ms-' },
 | 
						|
    { name: '-o-keyframes', type: 'keyframes', prefix: '-o-' },
 | 
						|
    'font-face',
 | 
						|
    { name: 'import', state: 'before-at-value' },
 | 
						|
    { name: 'charset', state: 'before-at-value' },
 | 
						|
    'supports',
 | 
						|
    'viewport',
 | 
						|
    { name: 'namespace', state: 'before-at-value' },
 | 
						|
    'document',
 | 
						|
    { name: '-moz-document', type: 'document', prefix: '-moz-' },
 | 
						|
    'page'
 | 
						|
  ];
 | 
						|
 | 
						|
  // -- Functions ------------------------------------------------------------
 | 
						|
 | 
						|
  /**
 | 
						|
   * Advance the character cursor and return the next character.
 | 
						|
   *
 | 
						|
   * @returns {String} The next character.
 | 
						|
   */
 | 
						|
  function getCh() {
 | 
						|
    skip();
 | 
						|
    return css[cursor];
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Return the state at the given index in the stack.
 | 
						|
   * The stack is LIFO so indexing is from the right.
 | 
						|
   *
 | 
						|
   * @param {Number} [index=0] Index to return.
 | 
						|
   * @returns {String} state
 | 
						|
   */
 | 
						|
  function getState(index) {
 | 
						|
    return index ? stack[stack.length - 1 - index] : state;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Look ahead for a string beginning from the next position. The string
 | 
						|
   * being looked for must start at the next position.
 | 
						|
   *
 | 
						|
   * @param {String} str The string to look for.
 | 
						|
   * @returns {Boolean} Whether the string was found.
 | 
						|
   */
 | 
						|
  function isNextString(str) {
 | 
						|
    var start = cursor + 1;
 | 
						|
    return (str === css.slice(start, start + str.length));
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Find the start position of a substring beginning from the next
 | 
						|
   * position. The string being looked for may begin anywhere.
 | 
						|
   *
 | 
						|
   * @param {String} str The substring to look for.
 | 
						|
   * @returns {Number|false} The position, or `false` if not found.
 | 
						|
   */
 | 
						|
  function find(str) {
 | 
						|
    var pos = css.slice(cursor).indexOf(str);
 | 
						|
 | 
						|
    return pos > 0 ? pos : false;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Determine whether a character is next.
 | 
						|
   *
 | 
						|
   * @param {String} ch Character.
 | 
						|
   * @returns {Boolean} Whether the character is next.
 | 
						|
   */
 | 
						|
  function isNextChar(ch) {
 | 
						|
    return ch === peek(1);
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Return the character at the given cursor offset. The offset is relative
 | 
						|
   * to the cursor, so negative values move backwards.
 | 
						|
   *
 | 
						|
   * @param {Number} [offset=1] Cursor offset.
 | 
						|
   * @returns {String} Character.
 | 
						|
   */
 | 
						|
  function peek(offset) {
 | 
						|
    return css[cursor + (offset || 1)];
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Remove the current state from the stack and set the new current state.
 | 
						|
   *
 | 
						|
   * @returns {String} The removed state.
 | 
						|
   */
 | 
						|
  function popState() {
 | 
						|
    var removed = stack.pop();
 | 
						|
    state = stack[stack.length - 1];
 | 
						|
 | 
						|
    return removed;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Set the current state and add it to the stack.
 | 
						|
   *
 | 
						|
   * @param {String} newState The new state.
 | 
						|
   * @returns {Number} The new stack length.
 | 
						|
   */
 | 
						|
  function pushState(newState) {
 | 
						|
    state = newState;
 | 
						|
    stack.push(state);
 | 
						|
 | 
						|
    return stack.length;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Replace the current state with a new state.
 | 
						|
   *
 | 
						|
   * @param {String} newState The new state.
 | 
						|
   * @returns {String} The replaced state.
 | 
						|
   */
 | 
						|
  function replaceState(newState) {
 | 
						|
    var previousState = state;
 | 
						|
    stack[stack.length - 1] = state = newState;
 | 
						|
 | 
						|
    return previousState;
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Move the character cursor. Positive numbers move the cursor forward.
 | 
						|
   * Negative numbers are not supported!
 | 
						|
   *
 | 
						|
   * @param {Number} [n=1] Number of characters to skip.
 | 
						|
   */
 | 
						|
  function skip(n) {
 | 
						|
    if ((n || 1) == 1) {
 | 
						|
      if (css[cursor] == '\n') {
 | 
						|
        line++;
 | 
						|
        column = 1;
 | 
						|
      } else {
 | 
						|
        column++;
 | 
						|
      }
 | 
						|
      cursor++;
 | 
						|
    } else {
 | 
						|
      var skipStr = css.slice(cursor, cursor + n).split('\n');
 | 
						|
      if (skipStr.length > 1) {
 | 
						|
        line += skipStr.length - 1;
 | 
						|
        column = 1;
 | 
						|
      }
 | 
						|
      column += skipStr[skipStr.length - 1].length;
 | 
						|
      cursor = cursor + n;
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Add the current token to the pile and reset the buffer.
 | 
						|
   */
 | 
						|
  function addToken() {
 | 
						|
    token.end = {
 | 
						|
      line: line,
 | 
						|
      col: column
 | 
						|
    };
 | 
						|
 | 
						|
    DEBUG && debug('addToken:', JSON.stringify(token, null, 2));
 | 
						|
 | 
						|
    tokens.push(token);
 | 
						|
 | 
						|
    buffer = '';
 | 
						|
    token = {};
 | 
						|
  }
 | 
						|
 | 
						|
  /**
 | 
						|
   * Set the current token.
 | 
						|
   *
 | 
						|
   * @param {String} type Token type.
 | 
						|
   */
 | 
						|
  function initializeToken(type) {
 | 
						|
    token = {
 | 
						|
      type: type,
 | 
						|
      start: {
 | 
						|
        line: line,
 | 
						|
        col : column
 | 
						|
      }
 | 
						|
    };
 | 
						|
  }
 | 
						|
 | 
						|
  // -- Main Loop ------------------------------------------------------------
 | 
						|
 | 
						|
  /*
 | 
						|
  The main loop is a state machine that reads in one character at a time,
 | 
						|
  and determines what to do based on the current state and character.
 | 
						|
  This is implemented as a series of nested `switch` statements and the
 | 
						|
  case orders have been mildly optimized based on rough probabilities
 | 
						|
  calculated by processing a small sample of real-world CSS.
 | 
						|
 | 
						|
  Further optimization (such as a dispatch table) shouldn't be necessary
 | 
						|
  since the total number of cases is very low.
 | 
						|
  */
 | 
						|
 | 
						|
  TIMER && (start = Date.now());
 | 
						|
 | 
						|
  while (ch = getCh()) {
 | 
						|
    DEBUG && debug(ch, getState());
 | 
						|
 | 
						|
    // column += 1;
 | 
						|
 | 
						|
    switch (ch) {
 | 
						|
    // Space
 | 
						|
    case ' ':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'selector':
 | 
						|
      case 'value':
 | 
						|
      case 'value-paren':
 | 
						|
      case 'at-group':
 | 
						|
      case 'at-value':
 | 
						|
      case 'comment':
 | 
						|
      case 'double-string':
 | 
						|
      case 'single-string':
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    // Newline or tab
 | 
						|
    case '\n':
 | 
						|
    case '\t':
 | 
						|
    case '\r':
 | 
						|
    case '\f':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'value':
 | 
						|
      case 'value-paren':
 | 
						|
      case 'at-group':
 | 
						|
      case 'comment':
 | 
						|
      case 'single-string':
 | 
						|
      case 'double-string':
 | 
						|
      case 'selector':
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'at-value':
 | 
						|
        // Tokenize an @-rule if a semi-colon was omitted.
 | 
						|
        if ('\n' === ch) {
 | 
						|
          token.value = buffer.trim();
 | 
						|
          addToken();
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      // if ('\n' === ch) {
 | 
						|
      //   column = 0;
 | 
						|
      //   line += 1;
 | 
						|
      // }
 | 
						|
      break;
 | 
						|
 | 
						|
    case ':':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'name':
 | 
						|
        token.name = buffer.trim();
 | 
						|
        buffer = '';
 | 
						|
 | 
						|
        replaceState('before-value');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-selector':
 | 
						|
        buffer += ch;
 | 
						|
 | 
						|
        initializeToken('selector');
 | 
						|
        pushState('selector');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    case ';':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'name':
 | 
						|
      case 'before-value':
 | 
						|
      case 'value':
 | 
						|
        // Tokenize a declaration
 | 
						|
        // if value is empty skip the declaration
 | 
						|
        if (buffer.trim().length > 0) {
 | 
						|
          token.value = buffer.trim(),
 | 
						|
          addToken();
 | 
						|
        }
 | 
						|
        replaceState('before-name');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'value-paren':
 | 
						|
        // Insignificant semi-colon
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'at-value':
 | 
						|
        // Tokenize an @-rule
 | 
						|
        token.value = buffer.trim();
 | 
						|
        addToken();
 | 
						|
        popState();
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-name':
 | 
						|
        // Extraneous semi-colon
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    case '{':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'selector':
 | 
						|
        // If the sequence is `\{` then assume that the brace should be escaped.
 | 
						|
        if (peek(-1) === '\\') {
 | 
						|
            buffer += ch;
 | 
						|
            break;
 | 
						|
        }
 | 
						|
 | 
						|
        // Tokenize a selector
 | 
						|
        token.text = buffer.trim();
 | 
						|
        addToken();
 | 
						|
        replaceState('before-name');
 | 
						|
        depth = depth + 1;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'at-group':
 | 
						|
        // Tokenize an @-group
 | 
						|
        token.name = buffer.trim();
 | 
						|
 | 
						|
        // XXX: @-rules are starting to get hairy
 | 
						|
        switch (token.type) {
 | 
						|
        case 'font-face':
 | 
						|
        case 'viewport' :
 | 
						|
        case 'page'     :
 | 
						|
          pushState('before-name');
 | 
						|
          break;
 | 
						|
 | 
						|
        default:
 | 
						|
          pushState('before-selector');
 | 
						|
        }
 | 
						|
 | 
						|
        addToken();
 | 
						|
        depth = depth + 1;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'name':
 | 
						|
      case 'at-rule':
 | 
						|
        // Tokenize a declaration or an @-rule
 | 
						|
        token.name = buffer.trim();
 | 
						|
        addToken();
 | 
						|
        pushState('before-name');
 | 
						|
        depth = depth + 1;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'comment':
 | 
						|
      case 'double-string':
 | 
						|
      case 'single-string':
 | 
						|
        // Ignore braces in comments and strings
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      break;
 | 
						|
 | 
						|
    case '}':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'before-name':
 | 
						|
      case 'name':
 | 
						|
      case 'before-value':
 | 
						|
      case 'value':
 | 
						|
        // If the buffer contains anything, it is a value
 | 
						|
        if (buffer) {
 | 
						|
          token.value = buffer.trim();
 | 
						|
        }
 | 
						|
 | 
						|
        // If the current token has a name and a value it should be tokenized.
 | 
						|
        if (token.name && token.value) {
 | 
						|
          addToken();
 | 
						|
        }
 | 
						|
 | 
						|
        // Leave the block
 | 
						|
        initializeToken('end');
 | 
						|
        addToken();
 | 
						|
        popState();
 | 
						|
 | 
						|
        // We might need to leave again.
 | 
						|
        // XXX: What about 3 levels deep?
 | 
						|
        if ('at-group' === getState()) {
 | 
						|
          initializeToken('at-group-end');
 | 
						|
          addToken();
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
        
 | 
						|
        if (depth > 0) {
 | 
						|
          depth = depth - 1;
 | 
						|
        }
 | 
						|
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'at-group':
 | 
						|
      case 'before-selector':
 | 
						|
      case 'selector':
 | 
						|
        // If the sequence is `\}` then assume that the brace should be escaped.
 | 
						|
        if (peek(-1) === '\\') {
 | 
						|
            buffer += ch;
 | 
						|
            break;
 | 
						|
        }
 | 
						|
 | 
						|
        if (depth > 0) {
 | 
						|
          // Leave block if in an at-group
 | 
						|
          if ('at-group' === getState(1)) {
 | 
						|
            initializeToken('at-group-end');
 | 
						|
            addToken();
 | 
						|
          }
 | 
						|
        }
 | 
						|
 | 
						|
        if (depth > 1) {
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
 | 
						|
        if (depth > 0) {
 | 
						|
          depth = depth - 1;
 | 
						|
        }
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'double-string':
 | 
						|
      case 'single-string':
 | 
						|
      case 'comment':
 | 
						|
        // Ignore braces in comments and strings.
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      break;
 | 
						|
 | 
						|
    // Strings
 | 
						|
    case '"':
 | 
						|
    case "'":
 | 
						|
      switch (getState()) {
 | 
						|
      case 'double-string':
 | 
						|
        if ('"' === ch && '\\' !== peek(-1)) {
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'single-string':
 | 
						|
        if ("'" === ch && '\\' !== peek(-1)) {
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-at-value':
 | 
						|
        replaceState('at-value');
 | 
						|
        pushState('"' === ch ? 'double-string' : 'single-string');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        pushState('"' === ch ? 'double-string' : 'single-string');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'comment':
 | 
						|
        // Ignore strings within comments.
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        if ('\\' !== peek(-1)) {
 | 
						|
          pushState('"' === ch ? 'double-string' : 'single-string');
 | 
						|
        }
 | 
						|
      }
 | 
						|
 | 
						|
      buffer += ch;
 | 
						|
      break;
 | 
						|
 | 
						|
    // Comments
 | 
						|
    case '/':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'comment':
 | 
						|
      case 'double-string':
 | 
						|
      case 'single-string':
 | 
						|
        // Ignore
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-value':
 | 
						|
      case 'selector':
 | 
						|
      case 'name':
 | 
						|
      case 'value':
 | 
						|
        if (isNextChar('*')) {
 | 
						|
          // Ignore comments in selectors, properties and values. They are
 | 
						|
          // difficult to represent in the AST.
 | 
						|
          var pos = find('*/');
 | 
						|
 | 
						|
          if (pos) {
 | 
						|
            skip(pos + 1);
 | 
						|
          }
 | 
						|
        } else {
 | 
						|
          if (getState() == 'before-value') replaceState('value');
 | 
						|
          buffer += ch;
 | 
						|
        }
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        if (isNextChar('*')) {
 | 
						|
          // Create a comment token
 | 
						|
          initializeToken('comment');
 | 
						|
          pushState('comment');
 | 
						|
          skip();
 | 
						|
        }
 | 
						|
        else {
 | 
						|
          buffer += ch;
 | 
						|
        }
 | 
						|
        break;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    // Comment end or universal selector
 | 
						|
    case '*':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'comment':
 | 
						|
        if (isNextChar('/')) {
 | 
						|
          // Tokenize a comment
 | 
						|
          token.text = buffer; // Don't trim()!
 | 
						|
          skip();
 | 
						|
          addToken();
 | 
						|
          popState();
 | 
						|
        }
 | 
						|
        else {
 | 
						|
          buffer += ch;
 | 
						|
        }
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-selector':
 | 
						|
        buffer += ch;
 | 
						|
        initializeToken('selector');
 | 
						|
        pushState('selector');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        buffer += ch;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    // @-rules
 | 
						|
    case '@':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'comment':
 | 
						|
      case 'double-string':
 | 
						|
      case 'single-string':
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        buffer += ch;
 | 
						|
        break;
 | 
						|
 | 
						|
      default:
 | 
						|
        // Iterate over the supported @-rules and attempt to tokenize one.
 | 
						|
        var tokenized = false;
 | 
						|
        var name;
 | 
						|
        var rule;
 | 
						|
 | 
						|
        for (var j = 0, len = atRules.length; !tokenized && j < len; ++j) {
 | 
						|
          rule = atRules[j];
 | 
						|
          name = rule.name || rule;
 | 
						|
 | 
						|
          if (!isNextString(name)) { continue; }
 | 
						|
 | 
						|
          tokenized = true;
 | 
						|
 | 
						|
          initializeToken(name);
 | 
						|
          pushState(rule.state || 'at-group');
 | 
						|
          skip(name.length);
 | 
						|
 | 
						|
          if (rule.prefix) {
 | 
						|
            token.prefix = rule.prefix;
 | 
						|
          }
 | 
						|
 | 
						|
          if (rule.type) {
 | 
						|
            token.type = rule.type;
 | 
						|
          }
 | 
						|
        }
 | 
						|
 | 
						|
        if (!tokenized) {
 | 
						|
          // Keep on truckin' America!
 | 
						|
          buffer += ch;
 | 
						|
        }
 | 
						|
        break;
 | 
						|
      }
 | 
						|
      break;
 | 
						|
 | 
						|
    // Parentheses are tracked to disambiguate semi-colons, such as within a
 | 
						|
    // data URI.
 | 
						|
    case '(':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'value':
 | 
						|
        pushState('value-paren');
 | 
						|
        break;
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      buffer += ch;
 | 
						|
      break;
 | 
						|
 | 
						|
    case ')':
 | 
						|
      switch (getState()) {
 | 
						|
      case 'value-paren':
 | 
						|
        popState();
 | 
						|
        break;
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      buffer += ch;
 | 
						|
      break;
 | 
						|
 | 
						|
    default:
 | 
						|
      switch (getState()) {
 | 
						|
      case 'before-selector':
 | 
						|
        initializeToken('selector');
 | 
						|
        pushState('selector');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-name':
 | 
						|
        initializeToken('property');
 | 
						|
        replaceState('name');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-value':
 | 
						|
        replaceState('value');
 | 
						|
        break;
 | 
						|
 | 
						|
      case 'before-at-value':
 | 
						|
        replaceState('at-value');
 | 
						|
        break;
 | 
						|
      }
 | 
						|
 | 
						|
      buffer += ch;
 | 
						|
      break;
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  TIMER && debug('ran in', (Date.now() - start) + 'ms');
 | 
						|
 | 
						|
  return tokens;
 | 
						|
}
 | 
						|
 | 
						|
},{"./debug":14}],16:[function(require,module,exports){
 | 
						|
var DEBUG = false; // `true` to print debugging info.
 | 
						|
var TIMER = false; // `true` to time calls to `parse()` and print the results.
 | 
						|
 | 
						|
var debug = require('./debug')('parse');
 | 
						|
var lex = require('./lexer');
 | 
						|
 | 
						|
exports = module.exports = parse;
 | 
						|
 | 
						|
var _comments;   // Whether comments are allowed.
 | 
						|
var _depth;      // Current block nesting depth.
 | 
						|
var _position;   // Whether to include line/column position.
 | 
						|
var _tokens;     // Array of lexical tokens.
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a CSS string or array of lexical tokens into a `stringify`-able AST.
 | 
						|
 *
 | 
						|
 * @param {String} css CSS string or array of lexical token
 | 
						|
 * @param {Object} [options]
 | 
						|
 * @param {Boolean} [options.comments=false] allow comment nodes in the AST
 | 
						|
 * @returns {Object} `stringify`-able AST
 | 
						|
 */
 | 
						|
function parse(css, options) {
 | 
						|
  var start; // Debug timer start.
 | 
						|
 | 
						|
  options || (options = {});
 | 
						|
  _comments = !!options.comments;
 | 
						|
  _position = !!options.position;
 | 
						|
 | 
						|
  _depth = 0;
 | 
						|
 | 
						|
  // Operate on a copy of the given tokens, or the lex()'d CSS string.
 | 
						|
  _tokens = Array.isArray(css) ? css.slice() : lex(css);
 | 
						|
 | 
						|
  var rule;
 | 
						|
  var rules = [];
 | 
						|
  var token;
 | 
						|
 | 
						|
  TIMER && (start = Date.now());
 | 
						|
 | 
						|
  while ((token = next())) {
 | 
						|
    rule = parseToken(token);
 | 
						|
    rule && rules.push(rule);
 | 
						|
  }
 | 
						|
 | 
						|
  TIMER && debug('ran in', (Date.now() - start) + 'ms');
 | 
						|
 | 
						|
  return {
 | 
						|
    type: "stylesheet",
 | 
						|
    stylesheet: {
 | 
						|
      rules: rules
 | 
						|
    }
 | 
						|
  };
 | 
						|
}
 | 
						|
 | 
						|
// -- Functions --------------------------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Build an AST node from a lexical token.
 | 
						|
 *
 | 
						|
 * @param {Object} token lexical token
 | 
						|
 * @param {Object} [override] object hash of properties that override those
 | 
						|
 *   already in the token, or that will be added to the token.
 | 
						|
 * @returns {Object} AST node
 | 
						|
 */
 | 
						|
function astNode(token, override) {
 | 
						|
  override || (override = {});
 | 
						|
 | 
						|
  var key;
 | 
						|
  var keys = ['type', 'name', 'value'];
 | 
						|
  var node = {};
 | 
						|
 | 
						|
  // Avoiding [].forEach for performance reasons.
 | 
						|
  for (var i = 0; i < keys.length; ++i) {
 | 
						|
    key = keys[i];
 | 
						|
 | 
						|
    if (token[key]) {
 | 
						|
      node[key] = override[key] || token[key];
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  keys = Object.keys(override);
 | 
						|
 | 
						|
  for (i = 0; i < keys.length; ++i) {
 | 
						|
    key = keys[i];
 | 
						|
 | 
						|
    if (!node[key]) {
 | 
						|
      node[key] = override[key];
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  if (_position) {
 | 
						|
    node.position = {
 | 
						|
      start: token.start,
 | 
						|
      end: token.end
 | 
						|
    };
 | 
						|
  }
 | 
						|
 | 
						|
  DEBUG && debug('astNode:', JSON.stringify(node, null, 2));
 | 
						|
 | 
						|
  return node;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Remove a lexical token from the stack and return the removed token.
 | 
						|
 *
 | 
						|
 * @returns {Object} lexical token
 | 
						|
 */
 | 
						|
function next() {
 | 
						|
  var token = _tokens.shift();
 | 
						|
  DEBUG && debug('next:', JSON.stringify(token, null, 2));
 | 
						|
  return token;
 | 
						|
}
 | 
						|
 | 
						|
// -- Parse* Functions ---------------------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert an @-group lexical token to an AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} token @-group lexical token
 | 
						|
 * @returns {Object} @-group AST node
 | 
						|
 */
 | 
						|
function parseAtGroup(token) {
 | 
						|
  _depth = _depth + 1;
 | 
						|
 | 
						|
  // As the @-group token is assembled, relevant token values are captured here
 | 
						|
  // temporarily. They will later be used as `tokenize()` overrides.
 | 
						|
  var overrides = {};
 | 
						|
 | 
						|
  switch (token.type) {
 | 
						|
  case 'font-face':
 | 
						|
  case 'viewport' :
 | 
						|
    overrides.declarations = parseDeclarations();
 | 
						|
    break;
 | 
						|
 | 
						|
  case 'page':
 | 
						|
    overrides.prefix = token.prefix;
 | 
						|
    overrides.declarations = parseDeclarations();
 | 
						|
    break;
 | 
						|
 | 
						|
  default:
 | 
						|
    overrides.prefix = token.prefix;
 | 
						|
    overrides.rules = parseRules();
 | 
						|
  }
 | 
						|
 | 
						|
  return astNode(token, overrides);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert an @import lexical token to an AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} token @import lexical token
 | 
						|
 * @returns {Object} @import AST node
 | 
						|
 */
 | 
						|
function parseAtImport(token) {
 | 
						|
  return astNode(token);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert an @charset token to an AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} token @charset lexical token
 | 
						|
 * @returns {Object} @charset node
 | 
						|
 */
 | 
						|
function parseCharset(token) {
 | 
						|
  return astNode(token);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a comment token to an AST Node.
 | 
						|
 *
 | 
						|
 * @param {Object} token comment lexical token
 | 
						|
 * @returns {Object} comment node
 | 
						|
 */
 | 
						|
function parseComment(token) {
 | 
						|
  return astNode(token, {text: token.text});
 | 
						|
}
 | 
						|
 | 
						|
function parseNamespace(token) {
 | 
						|
  return astNode(token);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a property lexical token to a property AST node.
 | 
						|
 *
 | 
						|
 * @returns {Object} property node
 | 
						|
 */
 | 
						|
function parseProperty(token) {
 | 
						|
  return astNode(token);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a selector lexical token to a selector AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} token selector lexical token
 | 
						|
 * @returns {Object} selector node
 | 
						|
 */
 | 
						|
function parseSelector(token) {
 | 
						|
  function trim(str) {
 | 
						|
    return str.trim();
 | 
						|
  }
 | 
						|
 | 
						|
  return astNode(token, {
 | 
						|
    type: 'rule',
 | 
						|
    selectors: token.text.split(',').map(trim),
 | 
						|
    declarations: parseDeclarations(token)
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a lexical token to an AST node.
 | 
						|
 *
 | 
						|
 * @returns {Object|undefined} AST node
 | 
						|
 */
 | 
						|
function parseToken(token) {
 | 
						|
  switch (token.type) {
 | 
						|
  // Cases are listed in roughly descending order of probability.
 | 
						|
  case 'property': return parseProperty(token);
 | 
						|
 | 
						|
  case 'selector': return parseSelector(token);
 | 
						|
 | 
						|
  case 'at-group-end': _depth = _depth - 1; return;
 | 
						|
 | 
						|
  case 'media'     :
 | 
						|
  case 'keyframes' :return parseAtGroup(token);
 | 
						|
 | 
						|
  case 'comment': if (_comments) { return parseComment(token); } break;
 | 
						|
 | 
						|
  case 'charset': return parseCharset(token);
 | 
						|
  case 'import': return parseAtImport(token);
 | 
						|
 | 
						|
  case 'namespace': return parseNamespace(token);
 | 
						|
 | 
						|
  case 'font-face':
 | 
						|
  case 'supports' :
 | 
						|
  case 'viewport' :
 | 
						|
  case 'document' :
 | 
						|
  case 'page'     : return parseAtGroup(token);
 | 
						|
  }
 | 
						|
 | 
						|
  DEBUG && debug('parseToken: unexpected token:', JSON.stringify(token));
 | 
						|
}
 | 
						|
 | 
						|
// -- Parse Helper Functions ---------------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Iteratively parses lexical tokens from the stack into AST nodes until a
 | 
						|
 * conditional function returns `false`, at which point iteration terminates
 | 
						|
 * and any AST nodes collected are returned.
 | 
						|
 *
 | 
						|
 * @param {Function} conditionFn
 | 
						|
 *   @param {Object} token the lexical token being parsed
 | 
						|
 *   @returns {Boolean} `true` if the token should be parsed, `false` otherwise
 | 
						|
 * @return {Array} AST nodes
 | 
						|
 */
 | 
						|
function parseTokensWhile(conditionFn) {
 | 
						|
  var node;
 | 
						|
  var nodes = [];
 | 
						|
  var token;
 | 
						|
 | 
						|
  while ((token = next()) && (conditionFn && conditionFn(token))) {
 | 
						|
    node = parseToken(token);
 | 
						|
    node && nodes.push(node);
 | 
						|
  }
 | 
						|
 | 
						|
  // Place an unused non-`end` lexical token back onto the stack.
 | 
						|
  if (token && token.type !== 'end') {
 | 
						|
    _tokens.unshift(token);
 | 
						|
  }
 | 
						|
 | 
						|
  return nodes;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a series of tokens into a sequence of declaration AST nodes.
 | 
						|
 *
 | 
						|
 * @returns {Array} declaration nodes
 | 
						|
 */
 | 
						|
function parseDeclarations() {
 | 
						|
  return parseTokensWhile(function (token) {
 | 
						|
    return (token.type === 'property' || token.type === 'comment');
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a series of tokens into a sequence of rule nodes.
 | 
						|
 *
 | 
						|
 * @returns {Array} rule nodes
 | 
						|
 */
 | 
						|
function parseRules() {
 | 
						|
  return parseTokensWhile(function () { return _depth; });
 | 
						|
}
 | 
						|
 | 
						|
},{"./debug":14,"./lexer":15}],17:[function(require,module,exports){
 | 
						|
var DEBUG = false; // `true` to print debugging info.
 | 
						|
var TIMER = false; // `true` to time calls to `stringify()` and print the results.
 | 
						|
 | 
						|
var debug = require('./debug')('stringify');
 | 
						|
 | 
						|
var _comments;      // Whether comments are allowed in the stringified CSS.
 | 
						|
var _compress;      // Whether the stringified CSS should be compressed.
 | 
						|
var _indentation;   // Indentation option value.
 | 
						|
var _n;             // Compression-aware newline character.
 | 
						|
var _s;             // Compression-aware space character.
 | 
						|
 | 
						|
exports = module.exports = stringify;
 | 
						|
 | 
						|
/**
 | 
						|
 * Convert a `stringify`-able AST into a CSS string.
 | 
						|
 *
 | 
						|
 * @param {Object} `stringify`-able AST
 | 
						|
 * @param {Object} [options]
 | 
						|
 * @param {Boolean} [options.comments=false] allow comments in the CSS
 | 
						|
 * @param {Boolean} [options.compress=false] compress whitespace
 | 
						|
 * @param {String} [options.indentation=''] indentation sequence
 | 
						|
 * @returns {String} CSS
 | 
						|
 */
 | 
						|
function stringify(ast, options) {
 | 
						|
  var start; // Debug timer start.
 | 
						|
 | 
						|
  options || (options = {});
 | 
						|
  _indentation = options.indentation || '';
 | 
						|
  _compress = !!options.compress;
 | 
						|
  _comments = !!options.comments;
 | 
						|
 | 
						|
  if (_compress) {
 | 
						|
    _n = _s = '';
 | 
						|
  } else {
 | 
						|
    _n = '\n';
 | 
						|
    _s = ' ';
 | 
						|
  }
 | 
						|
 | 
						|
  TIMER && (start = Date.now());
 | 
						|
 | 
						|
  var css = reduce(ast.stylesheet.rules, stringifyNode).join('\n').trim();
 | 
						|
 | 
						|
  TIMER && debug('ran in', (Date.now() - start) + 'ms');
 | 
						|
 | 
						|
  return css;
 | 
						|
}
 | 
						|
 | 
						|
// -- Functions --------------------------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Modify the indentation level, or return a compression-aware sequence of
 | 
						|
 * spaces equal to the current indentation level.
 | 
						|
 *
 | 
						|
 * @param {Number} [level=undefined] indentation level modifier
 | 
						|
 * @returns {String} sequence of spaces
 | 
						|
 */
 | 
						|
function indent(level) {
 | 
						|
  this.level || (this.level = 1);
 | 
						|
 | 
						|
  if (level) {
 | 
						|
    this.level += level;
 | 
						|
    return;
 | 
						|
  }
 | 
						|
 | 
						|
  if (_compress) { return ''; }
 | 
						|
 | 
						|
  return Array(this.level).join(_indentation || '');
 | 
						|
}
 | 
						|
 | 
						|
// -- Stringify Functions ------------------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an @-rule AST node.
 | 
						|
 *
 | 
						|
 * Use `stringifyAtGroup()` when dealing with @-groups that may contain blocks
 | 
						|
 * such as @media.
 | 
						|
 *
 | 
						|
 * @param {String} type @-rule type. E.g., import, charset
 | 
						|
 * @returns {String} Stringified @-rule
 | 
						|
 */
 | 
						|
function stringifyAtRule(node) {
 | 
						|
  return '@' + node.type + ' ' + node.value + ';' + _n;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an @-group AST node.
 | 
						|
 *
 | 
						|
 * Use `stringifyAtRule()` when dealing with @-rules that may not contain blocks
 | 
						|
 * such as @import.
 | 
						|
 *
 | 
						|
 * @param {Object} node @-group AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyAtGroup(node) {
 | 
						|
  var label = '';
 | 
						|
  var prefix = node.prefix || '';
 | 
						|
 | 
						|
  if (node.name) {
 | 
						|
    label = ' ' + node.name;
 | 
						|
  }
 | 
						|
 | 
						|
  // FIXME: @-rule conditional logic is leaking everywhere.
 | 
						|
  var chomp = node.type !== 'page';
 | 
						|
 | 
						|
  return '@' + prefix + node.type + label + _s + stringifyBlock(node, chomp) + _n;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify a comment AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} node comment AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyComment(node) {
 | 
						|
  if (!_comments) { return ''; }
 | 
						|
 | 
						|
  return '/*' + (node.text || '') + '*/' + _n;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify a rule AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} node rule AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyRule(node) {
 | 
						|
  var label;
 | 
						|
 | 
						|
  if (node.selectors) {
 | 
						|
    label = node.selectors.join(',' + _n);
 | 
						|
  } else {
 | 
						|
    label = '@' + node.type;
 | 
						|
    label += node.name ? ' ' + node.name : '';
 | 
						|
  }
 | 
						|
 | 
						|
  return indent() + label + _s + stringifyBlock(node) + _n;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// -- Stringify Helper Functions -----------------------------------------------
 | 
						|
 | 
						|
/**
 | 
						|
 * Reduce an array by applying a function to each item and retaining the truthy
 | 
						|
 * results.
 | 
						|
 *
 | 
						|
 * When `item.type` is `'comment'` `stringifyComment` will be applied instead.
 | 
						|
 *
 | 
						|
 * @param {Array} items array to reduce
 | 
						|
 * @param {Function} fn function to call for each item in the array
 | 
						|
 *   @returns {Mixed} Truthy values will be retained, falsy values omitted
 | 
						|
 * @returns {Array} retained results
 | 
						|
 */
 | 
						|
function reduce(items, fn) {
 | 
						|
  return items.reduce(function (results, item) {
 | 
						|
    var result = (item.type === 'comment') ? stringifyComment(item) : fn(item);
 | 
						|
    result && results.push(result);
 | 
						|
    return results;
 | 
						|
  }, []);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an AST node with the assumption that it represents a block of
 | 
						|
 * declarations or other @-group contents.
 | 
						|
 *
 | 
						|
 * @param {Object} node AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
// FIXME: chomp should not be a magic boolean parameter
 | 
						|
function stringifyBlock(node, chomp) {
 | 
						|
  var children = node.declarations;
 | 
						|
  var fn = stringifyDeclaration;
 | 
						|
 | 
						|
  if (node.rules) {
 | 
						|
    children = node.rules;
 | 
						|
    fn = stringifyRule;
 | 
						|
  }
 | 
						|
 | 
						|
  children = stringifyChildren(children, fn);
 | 
						|
  children && (children = _n + children + (chomp ? '' : _n));
 | 
						|
 | 
						|
  return '{' + children + indent() + '}';
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an array of child AST nodes by calling the given stringify function
 | 
						|
 * once for each child, and concatenating the results.
 | 
						|
 *
 | 
						|
 * @param {Array} children `node.rules` or `node.declarations`
 | 
						|
 * @param {Function} fn stringify function
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyChildren(children, fn) {
 | 
						|
  if (!children) { return ''; }
 | 
						|
 | 
						|
  indent(1);
 | 
						|
  var results = reduce(children, fn);
 | 
						|
  indent(-1);
 | 
						|
 | 
						|
  if (!results.length) { return ''; }
 | 
						|
 | 
						|
  return results.join(_n);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify a declaration AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} node declaration AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyDeclaration(node) {
 | 
						|
  if (node.type === 'property') {
 | 
						|
    return stringifyProperty(node);
 | 
						|
  }
 | 
						|
 | 
						|
  DEBUG && debug('stringifyDeclaration: unexpected node:', JSON.stringify(node));
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an AST node.
 | 
						|
 *
 | 
						|
 * @param {Object} node AST node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyNode(node) {
 | 
						|
  switch (node.type) {
 | 
						|
  // Cases are listed in roughly descending order of probability.
 | 
						|
  case 'rule': return stringifyRule(node);
 | 
						|
 | 
						|
  case 'media'    :
 | 
						|
  case 'keyframes': return stringifyAtGroup(node);
 | 
						|
 | 
						|
  case 'comment': return stringifyComment(node);
 | 
						|
 | 
						|
  case 'import'   :
 | 
						|
  case 'charset'  :
 | 
						|
  case 'namespace': return stringifyAtRule(node);
 | 
						|
 | 
						|
  case 'font-face':
 | 
						|
  case 'supports' :
 | 
						|
  case 'viewport' :
 | 
						|
  case 'document' :
 | 
						|
  case 'page'     : return stringifyAtGroup(node);
 | 
						|
  }
 | 
						|
 | 
						|
  DEBUG && debug('stringifyNode: unexpected node: ' + JSON.stringify(node));
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Stringify an AST property node.
 | 
						|
 *
 | 
						|
 * @param {Object} node AST property node
 | 
						|
 * @returns {String}
 | 
						|
 */
 | 
						|
function stringifyProperty(node) {
 | 
						|
  var name = node.name ? node.name + ':' + _s : '';
 | 
						|
 | 
						|
  return indent() + name + node.value + ';';
 | 
						|
}
 | 
						|
 | 
						|
},{"./debug":14}],18:[function(require,module,exports){
 | 
						|
// shim for using process in browser
 | 
						|
var process = module.exports = {};
 | 
						|
 | 
						|
// cached from whatever global is present so that test runners that stub it
 | 
						|
// don't break things.  But we need to wrap it in a try catch in case it is
 | 
						|
// wrapped in strict mode code which doesn't define any globals.  It's inside a
 | 
						|
// function because try/catches deoptimize in certain engines.
 | 
						|
 | 
						|
var cachedSetTimeout;
 | 
						|
var cachedClearTimeout;
 | 
						|
 | 
						|
function defaultSetTimout() {
 | 
						|
    throw new Error('setTimeout has not been defined');
 | 
						|
}
 | 
						|
function defaultClearTimeout () {
 | 
						|
    throw new Error('clearTimeout has not been defined');
 | 
						|
}
 | 
						|
(function () {
 | 
						|
    try {
 | 
						|
        if (typeof setTimeout === 'function') {
 | 
						|
            cachedSetTimeout = setTimeout;
 | 
						|
        } else {
 | 
						|
            cachedSetTimeout = defaultSetTimout;
 | 
						|
        }
 | 
						|
    } catch (e) {
 | 
						|
        cachedSetTimeout = defaultSetTimout;
 | 
						|
    }
 | 
						|
    try {
 | 
						|
        if (typeof clearTimeout === 'function') {
 | 
						|
            cachedClearTimeout = clearTimeout;
 | 
						|
        } else {
 | 
						|
            cachedClearTimeout = defaultClearTimeout;
 | 
						|
        }
 | 
						|
    } catch (e) {
 | 
						|
        cachedClearTimeout = defaultClearTimeout;
 | 
						|
    }
 | 
						|
} ())
 | 
						|
function runTimeout(fun) {
 | 
						|
    if (cachedSetTimeout === setTimeout) {
 | 
						|
        //normal enviroments in sane situations
 | 
						|
        return setTimeout(fun, 0);
 | 
						|
    }
 | 
						|
    // if setTimeout wasn't available but was latter defined
 | 
						|
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
 | 
						|
        cachedSetTimeout = setTimeout;
 | 
						|
        return setTimeout(fun, 0);
 | 
						|
    }
 | 
						|
    try {
 | 
						|
        // when when somebody has screwed with setTimeout but no I.E. maddness
 | 
						|
        return cachedSetTimeout(fun, 0);
 | 
						|
    } catch(e){
 | 
						|
        try {
 | 
						|
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
 | 
						|
            return cachedSetTimeout.call(null, fun, 0);
 | 
						|
        } catch(e){
 | 
						|
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
 | 
						|
            return cachedSetTimeout.call(this, fun, 0);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
}
 | 
						|
function runClearTimeout(marker) {
 | 
						|
    if (cachedClearTimeout === clearTimeout) {
 | 
						|
        //normal enviroments in sane situations
 | 
						|
        return clearTimeout(marker);
 | 
						|
    }
 | 
						|
    // if clearTimeout wasn't available but was latter defined
 | 
						|
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
 | 
						|
        cachedClearTimeout = clearTimeout;
 | 
						|
        return clearTimeout(marker);
 | 
						|
    }
 | 
						|
    try {
 | 
						|
        // when when somebody has screwed with setTimeout but no I.E. maddness
 | 
						|
        return cachedClearTimeout(marker);
 | 
						|
    } catch (e){
 | 
						|
        try {
 | 
						|
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
 | 
						|
            return cachedClearTimeout.call(null, marker);
 | 
						|
        } catch (e){
 | 
						|
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
 | 
						|
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
 | 
						|
            return cachedClearTimeout.call(this, marker);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
}
 | 
						|
var queue = [];
 | 
						|
var draining = false;
 | 
						|
var currentQueue;
 | 
						|
var queueIndex = -1;
 | 
						|
 | 
						|
function cleanUpNextTick() {
 | 
						|
    if (!draining || !currentQueue) {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
    draining = false;
 | 
						|
    if (currentQueue.length) {
 | 
						|
        queue = currentQueue.concat(queue);
 | 
						|
    } else {
 | 
						|
        queueIndex = -1;
 | 
						|
    }
 | 
						|
    if (queue.length) {
 | 
						|
        drainQueue();
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
function drainQueue() {
 | 
						|
    if (draining) {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
    var timeout = runTimeout(cleanUpNextTick);
 | 
						|
    draining = true;
 | 
						|
 | 
						|
    var len = queue.length;
 | 
						|
    while(len) {
 | 
						|
        currentQueue = queue;
 | 
						|
        queue = [];
 | 
						|
        while (++queueIndex < len) {
 | 
						|
            if (currentQueue) {
 | 
						|
                currentQueue[queueIndex].run();
 | 
						|
            }
 | 
						|
        }
 | 
						|
        queueIndex = -1;
 | 
						|
        len = queue.length;
 | 
						|
    }
 | 
						|
    currentQueue = null;
 | 
						|
    draining = false;
 | 
						|
    runClearTimeout(timeout);
 | 
						|
}
 | 
						|
 | 
						|
process.nextTick = function (fun) {
 | 
						|
    var args = new Array(arguments.length - 1);
 | 
						|
    if (arguments.length > 1) {
 | 
						|
        for (var i = 1; i < arguments.length; i++) {
 | 
						|
            args[i - 1] = arguments[i];
 | 
						|
        }
 | 
						|
    }
 | 
						|
    queue.push(new Item(fun, args));
 | 
						|
    if (queue.length === 1 && !draining) {
 | 
						|
        runTimeout(drainQueue);
 | 
						|
    }
 | 
						|
};
 | 
						|
 | 
						|
// v8 likes predictible objects
 | 
						|
function Item(fun, array) {
 | 
						|
    this.fun = fun;
 | 
						|
    this.array = array;
 | 
						|
}
 | 
						|
Item.prototype.run = function () {
 | 
						|
    this.fun.apply(null, this.array);
 | 
						|
};
 | 
						|
process.title = 'browser';
 | 
						|
process.browser = true;
 | 
						|
process.env = {};
 | 
						|
process.argv = [];
 | 
						|
process.version = ''; // empty string to avoid regexp issues
 | 
						|
process.versions = {};
 | 
						|
 | 
						|
function noop() {}
 | 
						|
 | 
						|
process.on = noop;
 | 
						|
process.addListener = noop;
 | 
						|
process.once = noop;
 | 
						|
process.off = noop;
 | 
						|
process.removeListener = noop;
 | 
						|
process.removeAllListeners = noop;
 | 
						|
process.emit = noop;
 | 
						|
process.prependListener = noop;
 | 
						|
process.prependOnceListener = noop;
 | 
						|
 | 
						|
process.listeners = function (name) { return [] }
 | 
						|
 | 
						|
process.binding = function (name) {
 | 
						|
    throw new Error('process.binding is not supported');
 | 
						|
};
 | 
						|
 | 
						|
process.cwd = function () { return '/' };
 | 
						|
process.chdir = function (dir) {
 | 
						|
    throw new Error('process.chdir is not supported');
 | 
						|
};
 | 
						|
process.umask = function() { return 0; };
 | 
						|
 | 
						|
},{}],19:[function(require,module,exports){
 | 
						|
/*
 | 
						|
Slick Parser
 | 
						|
 - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com)
 | 
						|
*/"use strict"
 | 
						|
 | 
						|
// Notable changes from Slick.Parser 1.0.x
 | 
						|
 | 
						|
// The parser now uses 2 classes: Expressions and Expression
 | 
						|
// `new Expressions` produces an array-like object containing a list of Expression objects
 | 
						|
// - Expressions::toString() produces a cleaned up expressions string
 | 
						|
// `new Expression` produces an array-like object
 | 
						|
// - Expression::toString() produces a cleaned up expression string
 | 
						|
// The only exposed method is parse, which produces a (cached) `new Expressions` instance
 | 
						|
// parsed.raw is no longer present, use .toString()
 | 
						|
// parsed.expression is now useless, just use the indices
 | 
						|
// parsed.reverse() has been removed for now, due to its apparent uselessness
 | 
						|
// Other changes in the Expressions object:
 | 
						|
// - classNames are now unique, and save both escaped and unescaped values
 | 
						|
// - attributes now save both escaped and unescaped values
 | 
						|
// - pseudos now save both escaped and unescaped values
 | 
						|
 | 
						|
var escapeRe   = /([-.*+?^${}()|[\]\/\\])/g,
 | 
						|
    unescapeRe = /\\/g
 | 
						|
 | 
						|
var escape = function(string){
 | 
						|
    // XRegExp v2.0.0-beta-3
 | 
						|
    // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js
 | 
						|
    return (string + "").replace(escapeRe, '\\$1')
 | 
						|
}
 | 
						|
 | 
						|
var unescape = function(string){
 | 
						|
    return (string + "").replace(unescapeRe, '')
 | 
						|
}
 | 
						|
 | 
						|
var slickRe = RegExp(
 | 
						|
/*
 | 
						|
#!/usr/bin/env ruby
 | 
						|
puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'')
 | 
						|
__END__
 | 
						|
    "(?x)^(?:\
 | 
						|
      \\s* ( , ) \\s*               # Separator          \n\
 | 
						|
    | \\s* ( <combinator>+ ) \\s*   # Combinator         \n\
 | 
						|
    |      ( \\s+ )                 # CombinatorChildren \n\
 | 
						|
    |      ( <unicode>+ | \\* )     # Tag                \n\
 | 
						|
    | \\#  ( <unicode>+       )     # ID                 \n\
 | 
						|
    | \\.  ( <unicode>+       )     # ClassName          \n\
 | 
						|
    |                               # Attribute          \n\
 | 
						|
    \\[  \
 | 
						|
        \\s* (<unicode1>+)  (?:  \
 | 
						|
            \\s* ([*^$!~|]?=)  (?:  \
 | 
						|
                \\s* (?:\
 | 
						|
                    ([\"']?)(.*?)\\9 \
 | 
						|
                )\
 | 
						|
            )  \
 | 
						|
        )?  \\s*  \
 | 
						|
    \\](?!\\]) \n\
 | 
						|
    |   :+ ( <unicode>+ )(?:\
 | 
						|
    \\( (?:\
 | 
						|
        (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
 | 
						|
    ) \\)\
 | 
						|
    )?\
 | 
						|
    )"
 | 
						|
*/
 | 
						|
"^(?:\\s*(,)\\s*|\\s*(<combinator>+)\\s*|(\\s+)|(<unicode>+|\\*)|\\#(<unicode>+)|\\.(<unicode>+)|\\[\\s*(<unicode1>+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(<unicode>+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
 | 
						|
    .replace(/<combinator>/, '[' + escape(">+~`!@$%^&={}\\;</") + ']')
 | 
						|
    .replace(/<unicode>/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
 | 
						|
    .replace(/<unicode1>/g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
 | 
						|
)
 | 
						|
 | 
						|
// Part
 | 
						|
 | 
						|
var Part = function Part(combinator){
 | 
						|
    this.combinator = combinator || " "
 | 
						|
    this.tag = "*"
 | 
						|
}
 | 
						|
 | 
						|
Part.prototype.toString = function(){
 | 
						|
 | 
						|
    if (!this.raw){
 | 
						|
 | 
						|
        var xpr = "", k, part
 | 
						|
 | 
						|
        xpr += this.tag || "*"
 | 
						|
        if (this.id) xpr += "#" + this.id
 | 
						|
        if (this.classes) xpr += "." + this.classList.join(".")
 | 
						|
        if (this.attributes) for (k = 0; part = this.attributes[k++];){
 | 
						|
            xpr += "[" + part.name + (part.operator ? part.operator + '"' + part.value + '"' : '') + "]"
 | 
						|
        }
 | 
						|
        if (this.pseudos) for (k = 0; part = this.pseudos[k++];){
 | 
						|
            xpr += ":" + part.name
 | 
						|
            if (part.value) xpr += "(" + part.value + ")"
 | 
						|
        }
 | 
						|
 | 
						|
        this.raw = xpr
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    return this.raw
 | 
						|
}
 | 
						|
 | 
						|
// Expression
 | 
						|
 | 
						|
var Expression = function Expression(){
 | 
						|
    this.length = 0
 | 
						|
}
 | 
						|
 | 
						|
Expression.prototype.toString = function(){
 | 
						|
 | 
						|
    if (!this.raw){
 | 
						|
 | 
						|
        var xpr = ""
 | 
						|
 | 
						|
        for (var j = 0, bit; bit = this[j++];){
 | 
						|
            if (j !== 1) xpr += " "
 | 
						|
            if (bit.combinator !== " ") xpr += bit.combinator + " "
 | 
						|
            xpr += bit
 | 
						|
        }
 | 
						|
 | 
						|
        this.raw = xpr
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    return this.raw
 | 
						|
}
 | 
						|
 | 
						|
var replacer = function(
 | 
						|
    rawMatch,
 | 
						|
 | 
						|
    separator,
 | 
						|
    combinator,
 | 
						|
    combinatorChildren,
 | 
						|
 | 
						|
    tagName,
 | 
						|
    id,
 | 
						|
    className,
 | 
						|
 | 
						|
    attributeKey,
 | 
						|
    attributeOperator,
 | 
						|
    attributeQuote,
 | 
						|
    attributeValue,
 | 
						|
 | 
						|
    pseudoMarker,
 | 
						|
    pseudoClass,
 | 
						|
    pseudoQuote,
 | 
						|
    pseudoClassQuotedValue,
 | 
						|
    pseudoClassValue
 | 
						|
){
 | 
						|
 | 
						|
    var expression, current
 | 
						|
 | 
						|
    if (separator || !this.length){
 | 
						|
        expression = this[this.length++] = new Expression
 | 
						|
        if (separator) return ''
 | 
						|
    }
 | 
						|
 | 
						|
    if (!expression) expression = this[this.length - 1]
 | 
						|
 | 
						|
    if (combinator || combinatorChildren || !expression.length){
 | 
						|
        current = expression[expression.length++] = new Part(combinator)
 | 
						|
    }
 | 
						|
 | 
						|
    if (!current) current = expression[expression.length - 1]
 | 
						|
 | 
						|
    if (tagName){
 | 
						|
 | 
						|
        current.tag = unescape(tagName)
 | 
						|
 | 
						|
    } else if (id){
 | 
						|
 | 
						|
        current.id = unescape(id)
 | 
						|
 | 
						|
    } else if (className){
 | 
						|
 | 
						|
        var unescaped = unescape(className)
 | 
						|
 | 
						|
        var classes = current.classes || (current.classes = {})
 | 
						|
        if (!classes[unescaped]){
 | 
						|
            classes[unescaped] = escape(className)
 | 
						|
            var classList = current.classList || (current.classList = [])
 | 
						|
            classList.push(unescaped)
 | 
						|
            classList.sort()
 | 
						|
        }
 | 
						|
 | 
						|
    } else if (pseudoClass){
 | 
						|
 | 
						|
        pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue
 | 
						|
 | 
						|
        ;(current.pseudos || (current.pseudos = [])).push({
 | 
						|
            type         : pseudoMarker.length == 1 ? 'class' : 'element',
 | 
						|
            name         : unescape(pseudoClass),
 | 
						|
            escapedName  : escape(pseudoClass),
 | 
						|
            value        : pseudoClassValue ? unescape(pseudoClassValue) : null,
 | 
						|
            escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null
 | 
						|
        })
 | 
						|
 | 
						|
    } else if (attributeKey){
 | 
						|
 | 
						|
        attributeValue = attributeValue ? escape(attributeValue) : null
 | 
						|
 | 
						|
        ;(current.attributes || (current.attributes = [])).push({
 | 
						|
            operator     : attributeOperator,
 | 
						|
            name         : unescape(attributeKey),
 | 
						|
            escapedName  : escape(attributeKey),
 | 
						|
            value        : attributeValue ? unescape(attributeValue) : null,
 | 
						|
            escapedValue : attributeValue ? escape(attributeValue) : null
 | 
						|
        })
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
    return ''
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
// Expressions
 | 
						|
 | 
						|
var Expressions = function Expressions(expression){
 | 
						|
    this.length = 0
 | 
						|
 | 
						|
    var self = this
 | 
						|
 | 
						|
    var original = expression, replaced
 | 
						|
 | 
						|
    while (expression){
 | 
						|
        replaced = expression.replace(slickRe, function(){
 | 
						|
            return replacer.apply(self, arguments)
 | 
						|
        })
 | 
						|
        if (replaced === expression) throw new Error(original + ' is an invalid expression')
 | 
						|
        expression = replaced
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
Expressions.prototype.toString = function(){
 | 
						|
    if (!this.raw){
 | 
						|
        var expressions = []
 | 
						|
        for (var i = 0, expression; expression = this[i++];) expressions.push(expression)
 | 
						|
        this.raw = expressions.join(", ")
 | 
						|
    }
 | 
						|
 | 
						|
    return this.raw
 | 
						|
}
 | 
						|
 | 
						|
var cache = {}
 | 
						|
 | 
						|
var parse = function(expression){
 | 
						|
    if (expression == null) return null
 | 
						|
    expression = ('' + expression).replace(/^\s+|\s+$/g, '')
 | 
						|
    return cache[expression] || (cache[expression] = new Expressions(expression))
 | 
						|
}
 | 
						|
 | 
						|
module.exports = parse
 | 
						|
 | 
						|
},{}],20:[function(require,module,exports){
 | 
						|
// TinyColor v1.4.1
 | 
						|
// https://github.com/bgrins/TinyColor
 | 
						|
// Brian Grinstead, MIT License
 | 
						|
 | 
						|
(function(Math) {
 | 
						|
 | 
						|
var trimLeft = /^\s+/,
 | 
						|
    trimRight = /\s+$/,
 | 
						|
    tinyCounter = 0,
 | 
						|
    mathRound = Math.round,
 | 
						|
    mathMin = Math.min,
 | 
						|
    mathMax = Math.max,
 | 
						|
    mathRandom = Math.random;
 | 
						|
 | 
						|
function tinycolor (color, opts) {
 | 
						|
 | 
						|
    color = (color) ? color : '';
 | 
						|
    opts = opts || { };
 | 
						|
 | 
						|
    // If input is already a tinycolor, return itself
 | 
						|
    if (color instanceof tinycolor) {
 | 
						|
       return color;
 | 
						|
    }
 | 
						|
    // If we are called as a function, call using new instead
 | 
						|
    if (!(this instanceof tinycolor)) {
 | 
						|
        return new tinycolor(color, opts);
 | 
						|
    }
 | 
						|
 | 
						|
    var rgb = inputToRGB(color);
 | 
						|
    this._originalInput = color,
 | 
						|
    this._r = rgb.r,
 | 
						|
    this._g = rgb.g,
 | 
						|
    this._b = rgb.b,
 | 
						|
    this._a = rgb.a,
 | 
						|
    this._roundA = mathRound(100*this._a) / 100,
 | 
						|
    this._format = opts.format || rgb.format;
 | 
						|
    this._gradientType = opts.gradientType;
 | 
						|
 | 
						|
    // Don't let the range of [0,255] come back in [0,1].
 | 
						|
    // Potentially lose a little bit of precision here, but will fix issues where
 | 
						|
    // .5 gets interpreted as half of the total, instead of half of 1
 | 
						|
    // If it was supposed to be 128, this was already taken care of by `inputToRgb`
 | 
						|
    if (this._r < 1) { this._r = mathRound(this._r); }
 | 
						|
    if (this._g < 1) { this._g = mathRound(this._g); }
 | 
						|
    if (this._b < 1) { this._b = mathRound(this._b); }
 | 
						|
 | 
						|
    this._ok = rgb.ok;
 | 
						|
    this._tc_id = tinyCounter++;
 | 
						|
}
 | 
						|
 | 
						|
tinycolor.prototype = {
 | 
						|
    isDark: function() {
 | 
						|
        return this.getBrightness() < 128;
 | 
						|
    },
 | 
						|
    isLight: function() {
 | 
						|
        return !this.isDark();
 | 
						|
    },
 | 
						|
    isValid: function() {
 | 
						|
        return this._ok;
 | 
						|
    },
 | 
						|
    getOriginalInput: function() {
 | 
						|
      return this._originalInput;
 | 
						|
    },
 | 
						|
    getFormat: function() {
 | 
						|
        return this._format;
 | 
						|
    },
 | 
						|
    getAlpha: function() {
 | 
						|
        return this._a;
 | 
						|
    },
 | 
						|
    getBrightness: function() {
 | 
						|
        //http://www.w3.org/TR/AERT#color-contrast
 | 
						|
        var rgb = this.toRgb();
 | 
						|
        return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
 | 
						|
    },
 | 
						|
    getLuminance: function() {
 | 
						|
        //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
 | 
						|
        var rgb = this.toRgb();
 | 
						|
        var RsRGB, GsRGB, BsRGB, R, G, B;
 | 
						|
        RsRGB = rgb.r/255;
 | 
						|
        GsRGB = rgb.g/255;
 | 
						|
        BsRGB = rgb.b/255;
 | 
						|
 | 
						|
        if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
 | 
						|
        if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
 | 
						|
        if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
 | 
						|
        return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
 | 
						|
    },
 | 
						|
    setAlpha: function(value) {
 | 
						|
        this._a = boundAlpha(value);
 | 
						|
        this._roundA = mathRound(100*this._a) / 100;
 | 
						|
        return this;
 | 
						|
    },
 | 
						|
    toHsv: function() {
 | 
						|
        var hsv = rgbToHsv(this._r, this._g, this._b);
 | 
						|
        return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
 | 
						|
    },
 | 
						|
    toHsvString: function() {
 | 
						|
        var hsv = rgbToHsv(this._r, this._g, this._b);
 | 
						|
        var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
 | 
						|
        return (this._a == 1) ?
 | 
						|
          "hsv("  + h + ", " + s + "%, " + v + "%)" :
 | 
						|
          "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
 | 
						|
    },
 | 
						|
    toHsl: function() {
 | 
						|
        var hsl = rgbToHsl(this._r, this._g, this._b);
 | 
						|
        return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
 | 
						|
    },
 | 
						|
    toHslString: function() {
 | 
						|
        var hsl = rgbToHsl(this._r, this._g, this._b);
 | 
						|
        var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
 | 
						|
        return (this._a == 1) ?
 | 
						|
          "hsl("  + h + ", " + s + "%, " + l + "%)" :
 | 
						|
          "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
 | 
						|
    },
 | 
						|
    toHex: function(allow3Char) {
 | 
						|
        return rgbToHex(this._r, this._g, this._b, allow3Char);
 | 
						|
    },
 | 
						|
    toHexString: function(allow3Char) {
 | 
						|
        return '#' + this.toHex(allow3Char);
 | 
						|
    },
 | 
						|
    toHex8: function(allow4Char) {
 | 
						|
        return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
 | 
						|
    },
 | 
						|
    toHex8String: function(allow4Char) {
 | 
						|
        return '#' + this.toHex8(allow4Char);
 | 
						|
    },
 | 
						|
    toRgb: function() {
 | 
						|
        return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
 | 
						|
    },
 | 
						|
    toRgbString: function() {
 | 
						|
        return (this._a == 1) ?
 | 
						|
          "rgb("  + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
 | 
						|
          "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
 | 
						|
    },
 | 
						|
    toPercentageRgb: function() {
 | 
						|
        return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
 | 
						|
    },
 | 
						|
    toPercentageRgbString: function() {
 | 
						|
        return (this._a == 1) ?
 | 
						|
          "rgb("  + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
 | 
						|
          "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
 | 
						|
    },
 | 
						|
    toName: function() {
 | 
						|
        if (this._a === 0) {
 | 
						|
            return "transparent";
 | 
						|
        }
 | 
						|
 | 
						|
        if (this._a < 1) {
 | 
						|
            return false;
 | 
						|
        }
 | 
						|
 | 
						|
        return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
 | 
						|
    },
 | 
						|
    toFilter: function(secondColor) {
 | 
						|
        var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
 | 
						|
        var secondHex8String = hex8String;
 | 
						|
        var gradientType = this._gradientType ? "GradientType = 1, " : "";
 | 
						|
 | 
						|
        if (secondColor) {
 | 
						|
            var s = tinycolor(secondColor);
 | 
						|
            secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
 | 
						|
        }
 | 
						|
 | 
						|
        return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
 | 
						|
    },
 | 
						|
    toString: function(format) {
 | 
						|
        var formatSet = !!format;
 | 
						|
        format = format || this._format;
 | 
						|
 | 
						|
        var formattedString = false;
 | 
						|
        var hasAlpha = this._a < 1 && this._a >= 0;
 | 
						|
        var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
 | 
						|
 | 
						|
        if (needsAlphaFormat) {
 | 
						|
            // Special case for "transparent", all other non-alpha formats
 | 
						|
            // will return rgba when there is transparency.
 | 
						|
            if (format === "name" && this._a === 0) {
 | 
						|
                return this.toName();
 | 
						|
            }
 | 
						|
            return this.toRgbString();
 | 
						|
        }
 | 
						|
        if (format === "rgb") {
 | 
						|
            formattedString = this.toRgbString();
 | 
						|
        }
 | 
						|
        if (format === "prgb") {
 | 
						|
            formattedString = this.toPercentageRgbString();
 | 
						|
        }
 | 
						|
        if (format === "hex" || format === "hex6") {
 | 
						|
            formattedString = this.toHexString();
 | 
						|
        }
 | 
						|
        if (format === "hex3") {
 | 
						|
            formattedString = this.toHexString(true);
 | 
						|
        }
 | 
						|
        if (format === "hex4") {
 | 
						|
            formattedString = this.toHex8String(true);
 | 
						|
        }
 | 
						|
        if (format === "hex8") {
 | 
						|
            formattedString = this.toHex8String();
 | 
						|
        }
 | 
						|
        if (format === "name") {
 | 
						|
            formattedString = this.toName();
 | 
						|
        }
 | 
						|
        if (format === "hsl") {
 | 
						|
            formattedString = this.toHslString();
 | 
						|
        }
 | 
						|
        if (format === "hsv") {
 | 
						|
            formattedString = this.toHsvString();
 | 
						|
        }
 | 
						|
 | 
						|
        return formattedString || this.toHexString();
 | 
						|
    },
 | 
						|
    clone: function() {
 | 
						|
        return tinycolor(this.toString());
 | 
						|
    },
 | 
						|
 | 
						|
    _applyModification: function(fn, args) {
 | 
						|
        var color = fn.apply(null, [this].concat([].slice.call(args)));
 | 
						|
        this._r = color._r;
 | 
						|
        this._g = color._g;
 | 
						|
        this._b = color._b;
 | 
						|
        this.setAlpha(color._a);
 | 
						|
        return this;
 | 
						|
    },
 | 
						|
    lighten: function() {
 | 
						|
        return this._applyModification(lighten, arguments);
 | 
						|
    },
 | 
						|
    brighten: function() {
 | 
						|
        return this._applyModification(brighten, arguments);
 | 
						|
    },
 | 
						|
    darken: function() {
 | 
						|
        return this._applyModification(darken, arguments);
 | 
						|
    },
 | 
						|
    desaturate: function() {
 | 
						|
        return this._applyModification(desaturate, arguments);
 | 
						|
    },
 | 
						|
    saturate: function() {
 | 
						|
        return this._applyModification(saturate, arguments);
 | 
						|
    },
 | 
						|
    greyscale: function() {
 | 
						|
        return this._applyModification(greyscale, arguments);
 | 
						|
    },
 | 
						|
    spin: function() {
 | 
						|
        return this._applyModification(spin, arguments);
 | 
						|
    },
 | 
						|
 | 
						|
    _applyCombination: function(fn, args) {
 | 
						|
        return fn.apply(null, [this].concat([].slice.call(args)));
 | 
						|
    },
 | 
						|
    analogous: function() {
 | 
						|
        return this._applyCombination(analogous, arguments);
 | 
						|
    },
 | 
						|
    complement: function() {
 | 
						|
        return this._applyCombination(complement, arguments);
 | 
						|
    },
 | 
						|
    monochromatic: function() {
 | 
						|
        return this._applyCombination(monochromatic, arguments);
 | 
						|
    },
 | 
						|
    splitcomplement: function() {
 | 
						|
        return this._applyCombination(splitcomplement, arguments);
 | 
						|
    },
 | 
						|
    triad: function() {
 | 
						|
        return this._applyCombination(triad, arguments);
 | 
						|
    },
 | 
						|
    tetrad: function() {
 | 
						|
        return this._applyCombination(tetrad, arguments);
 | 
						|
    }
 | 
						|
};
 | 
						|
 | 
						|
// If input is an object, force 1 into "1.0" to handle ratios properly
 | 
						|
// String input requires "1.0" as input, so 1 will be treated as 1
 | 
						|
tinycolor.fromRatio = function(color, opts) {
 | 
						|
    if (typeof color == "object") {
 | 
						|
        var newColor = {};
 | 
						|
        for (var i in color) {
 | 
						|
            if (color.hasOwnProperty(i)) {
 | 
						|
                if (i === "a") {
 | 
						|
                    newColor[i] = color[i];
 | 
						|
                }
 | 
						|
                else {
 | 
						|
                    newColor[i] = convertToPercentage(color[i]);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        color = newColor;
 | 
						|
    }
 | 
						|
 | 
						|
    return tinycolor(color, opts);
 | 
						|
};
 | 
						|
 | 
						|
// Given a string or object, convert that input to RGB
 | 
						|
// Possible string inputs:
 | 
						|
//
 | 
						|
//     "red"
 | 
						|
//     "#f00" or "f00"
 | 
						|
//     "#ff0000" or "ff0000"
 | 
						|
//     "#ff000000" or "ff000000"
 | 
						|
//     "rgb 255 0 0" or "rgb (255, 0, 0)"
 | 
						|
//     "rgb 1.0 0 0" or "rgb (1, 0, 0)"
 | 
						|
//     "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
 | 
						|
//     "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
 | 
						|
//     "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
 | 
						|
//     "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
 | 
						|
//     "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
 | 
						|
//
 | 
						|
function inputToRGB(color) {
 | 
						|
 | 
						|
    var rgb = { r: 0, g: 0, b: 0 };
 | 
						|
    var a = 1;
 | 
						|
    var s = null;
 | 
						|
    var v = null;
 | 
						|
    var l = null;
 | 
						|
    var ok = false;
 | 
						|
    var format = false;
 | 
						|
 | 
						|
    if (typeof color == "string") {
 | 
						|
        color = stringInputToObject(color);
 | 
						|
    }
 | 
						|
 | 
						|
    if (typeof color == "object") {
 | 
						|
        if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
 | 
						|
            rgb = rgbToRgb(color.r, color.g, color.b);
 | 
						|
            ok = true;
 | 
						|
            format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
 | 
						|
        }
 | 
						|
        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
 | 
						|
            s = convertToPercentage(color.s);
 | 
						|
            v = convertToPercentage(color.v);
 | 
						|
            rgb = hsvToRgb(color.h, s, v);
 | 
						|
            ok = true;
 | 
						|
            format = "hsv";
 | 
						|
        }
 | 
						|
        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
 | 
						|
            s = convertToPercentage(color.s);
 | 
						|
            l = convertToPercentage(color.l);
 | 
						|
            rgb = hslToRgb(color.h, s, l);
 | 
						|
            ok = true;
 | 
						|
            format = "hsl";
 | 
						|
        }
 | 
						|
 | 
						|
        if (color.hasOwnProperty("a")) {
 | 
						|
            a = color.a;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    a = boundAlpha(a);
 | 
						|
 | 
						|
    return {
 | 
						|
        ok: ok,
 | 
						|
        format: color.format || format,
 | 
						|
        r: mathMin(255, mathMax(rgb.r, 0)),
 | 
						|
        g: mathMin(255, mathMax(rgb.g, 0)),
 | 
						|
        b: mathMin(255, mathMax(rgb.b, 0)),
 | 
						|
        a: a
 | 
						|
    };
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// Conversion Functions
 | 
						|
// --------------------
 | 
						|
 | 
						|
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
 | 
						|
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
 | 
						|
 | 
						|
// `rgbToRgb`
 | 
						|
// Handle bounds / percentage checking to conform to CSS color spec
 | 
						|
// <http://www.w3.org/TR/css3-color/>
 | 
						|
// *Assumes:* r, g, b in [0, 255] or [0, 1]
 | 
						|
// *Returns:* { r, g, b } in [0, 255]
 | 
						|
function rgbToRgb(r, g, b){
 | 
						|
    return {
 | 
						|
        r: bound01(r, 255) * 255,
 | 
						|
        g: bound01(g, 255) * 255,
 | 
						|
        b: bound01(b, 255) * 255
 | 
						|
    };
 | 
						|
}
 | 
						|
 | 
						|
// `rgbToHsl`
 | 
						|
// Converts an RGB color value to HSL.
 | 
						|
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
 | 
						|
// *Returns:* { h, s, l } in [0,1]
 | 
						|
function rgbToHsl(r, g, b) {
 | 
						|
 | 
						|
    r = bound01(r, 255);
 | 
						|
    g = bound01(g, 255);
 | 
						|
    b = bound01(b, 255);
 | 
						|
 | 
						|
    var max = mathMax(r, g, b), min = mathMin(r, g, b);
 | 
						|
    var h, s, l = (max + min) / 2;
 | 
						|
 | 
						|
    if(max == min) {
 | 
						|
        h = s = 0; // achromatic
 | 
						|
    }
 | 
						|
    else {
 | 
						|
        var d = max - min;
 | 
						|
        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
 | 
						|
        switch(max) {
 | 
						|
            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
 | 
						|
            case g: h = (b - r) / d + 2; break;
 | 
						|
            case b: h = (r - g) / d + 4; break;
 | 
						|
        }
 | 
						|
 | 
						|
        h /= 6;
 | 
						|
    }
 | 
						|
 | 
						|
    return { h: h, s: s, l: l };
 | 
						|
}
 | 
						|
 | 
						|
// `hslToRgb`
 | 
						|
// Converts an HSL color value to RGB.
 | 
						|
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
 | 
						|
// *Returns:* { r, g, b } in the set [0, 255]
 | 
						|
function hslToRgb(h, s, l) {
 | 
						|
    var r, g, b;
 | 
						|
 | 
						|
    h = bound01(h, 360);
 | 
						|
    s = bound01(s, 100);
 | 
						|
    l = bound01(l, 100);
 | 
						|
 | 
						|
    function hue2rgb(p, q, t) {
 | 
						|
        if(t < 0) t += 1;
 | 
						|
        if(t > 1) t -= 1;
 | 
						|
        if(t < 1/6) return p + (q - p) * 6 * t;
 | 
						|
        if(t < 1/2) return q;
 | 
						|
        if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
 | 
						|
        return p;
 | 
						|
    }
 | 
						|
 | 
						|
    if(s === 0) {
 | 
						|
        r = g = b = l; // achromatic
 | 
						|
    }
 | 
						|
    else {
 | 
						|
        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
 | 
						|
        var p = 2 * l - q;
 | 
						|
        r = hue2rgb(p, q, h + 1/3);
 | 
						|
        g = hue2rgb(p, q, h);
 | 
						|
        b = hue2rgb(p, q, h - 1/3);
 | 
						|
    }
 | 
						|
 | 
						|
    return { r: r * 255, g: g * 255, b: b * 255 };
 | 
						|
}
 | 
						|
 | 
						|
// `rgbToHsv`
 | 
						|
// Converts an RGB color value to HSV
 | 
						|
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
 | 
						|
// *Returns:* { h, s, v } in [0,1]
 | 
						|
function rgbToHsv(r, g, b) {
 | 
						|
 | 
						|
    r = bound01(r, 255);
 | 
						|
    g = bound01(g, 255);
 | 
						|
    b = bound01(b, 255);
 | 
						|
 | 
						|
    var max = mathMax(r, g, b), min = mathMin(r, g, b);
 | 
						|
    var h, s, v = max;
 | 
						|
 | 
						|
    var d = max - min;
 | 
						|
    s = max === 0 ? 0 : d / max;
 | 
						|
 | 
						|
    if(max == min) {
 | 
						|
        h = 0; // achromatic
 | 
						|
    }
 | 
						|
    else {
 | 
						|
        switch(max) {
 | 
						|
            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
 | 
						|
            case g: h = (b - r) / d + 2; break;
 | 
						|
            case b: h = (r - g) / d + 4; break;
 | 
						|
        }
 | 
						|
        h /= 6;
 | 
						|
    }
 | 
						|
    return { h: h, s: s, v: v };
 | 
						|
}
 | 
						|
 | 
						|
// `hsvToRgb`
 | 
						|
// Converts an HSV color value to RGB.
 | 
						|
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
 | 
						|
// *Returns:* { r, g, b } in the set [0, 255]
 | 
						|
 function hsvToRgb(h, s, v) {
 | 
						|
 | 
						|
    h = bound01(h, 360) * 6;
 | 
						|
    s = bound01(s, 100);
 | 
						|
    v = bound01(v, 100);
 | 
						|
 | 
						|
    var i = Math.floor(h),
 | 
						|
        f = h - i,
 | 
						|
        p = v * (1 - s),
 | 
						|
        q = v * (1 - f * s),
 | 
						|
        t = v * (1 - (1 - f) * s),
 | 
						|
        mod = i % 6,
 | 
						|
        r = [v, q, p, p, t, v][mod],
 | 
						|
        g = [t, v, v, q, p, p][mod],
 | 
						|
        b = [p, p, t, v, v, q][mod];
 | 
						|
 | 
						|
    return { r: r * 255, g: g * 255, b: b * 255 };
 | 
						|
}
 | 
						|
 | 
						|
// `rgbToHex`
 | 
						|
// Converts an RGB color to hex
 | 
						|
// Assumes r, g, and b are contained in the set [0, 255]
 | 
						|
// Returns a 3 or 6 character hex
 | 
						|
function rgbToHex(r, g, b, allow3Char) {
 | 
						|
 | 
						|
    var hex = [
 | 
						|
        pad2(mathRound(r).toString(16)),
 | 
						|
        pad2(mathRound(g).toString(16)),
 | 
						|
        pad2(mathRound(b).toString(16))
 | 
						|
    ];
 | 
						|
 | 
						|
    // Return a 3 character hex if possible
 | 
						|
    if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
 | 
						|
        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
 | 
						|
    }
 | 
						|
 | 
						|
    return hex.join("");
 | 
						|
}
 | 
						|
 | 
						|
// `rgbaToHex`
 | 
						|
// Converts an RGBA color plus alpha transparency to hex
 | 
						|
// Assumes r, g, b are contained in the set [0, 255] and
 | 
						|
// a in [0, 1]. Returns a 4 or 8 character rgba hex
 | 
						|
function rgbaToHex(r, g, b, a, allow4Char) {
 | 
						|
 | 
						|
    var hex = [
 | 
						|
        pad2(mathRound(r).toString(16)),
 | 
						|
        pad2(mathRound(g).toString(16)),
 | 
						|
        pad2(mathRound(b).toString(16)),
 | 
						|
        pad2(convertDecimalToHex(a))
 | 
						|
    ];
 | 
						|
 | 
						|
    // Return a 4 character hex if possible
 | 
						|
    if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
 | 
						|
        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
 | 
						|
    }
 | 
						|
 | 
						|
    return hex.join("");
 | 
						|
}
 | 
						|
 | 
						|
// `rgbaToArgbHex`
 | 
						|
// Converts an RGBA color to an ARGB Hex8 string
 | 
						|
// Rarely used, but required for "toFilter()"
 | 
						|
function rgbaToArgbHex(r, g, b, a) {
 | 
						|
 | 
						|
    var hex = [
 | 
						|
        pad2(convertDecimalToHex(a)),
 | 
						|
        pad2(mathRound(r).toString(16)),
 | 
						|
        pad2(mathRound(g).toString(16)),
 | 
						|
        pad2(mathRound(b).toString(16))
 | 
						|
    ];
 | 
						|
 | 
						|
    return hex.join("");
 | 
						|
}
 | 
						|
 | 
						|
// `equals`
 | 
						|
// Can be called with any tinycolor input
 | 
						|
tinycolor.equals = function (color1, color2) {
 | 
						|
    if (!color1 || !color2) { return false; }
 | 
						|
    return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
 | 
						|
};
 | 
						|
 | 
						|
tinycolor.random = function() {
 | 
						|
    return tinycolor.fromRatio({
 | 
						|
        r: mathRandom(),
 | 
						|
        g: mathRandom(),
 | 
						|
        b: mathRandom()
 | 
						|
    });
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
// Modification Functions
 | 
						|
// ----------------------
 | 
						|
// Thanks to less.js for some of the basics here
 | 
						|
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
 | 
						|
 | 
						|
function desaturate(color, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 10);
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    hsl.s -= amount / 100;
 | 
						|
    hsl.s = clamp01(hsl.s);
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
function saturate(color, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 10);
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    hsl.s += amount / 100;
 | 
						|
    hsl.s = clamp01(hsl.s);
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
function greyscale(color) {
 | 
						|
    return tinycolor(color).desaturate(100);
 | 
						|
}
 | 
						|
 | 
						|
function lighten (color, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 10);
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    hsl.l += amount / 100;
 | 
						|
    hsl.l = clamp01(hsl.l);
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
function brighten(color, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 10);
 | 
						|
    var rgb = tinycolor(color).toRgb();
 | 
						|
    rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
 | 
						|
    rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
 | 
						|
    rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
 | 
						|
    return tinycolor(rgb);
 | 
						|
}
 | 
						|
 | 
						|
function darken (color, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 10);
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    hsl.l -= amount / 100;
 | 
						|
    hsl.l = clamp01(hsl.l);
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
 | 
						|
// Values outside of this range will be wrapped into this range.
 | 
						|
function spin(color, amount) {
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    var hue = (hsl.h + amount) % 360;
 | 
						|
    hsl.h = hue < 0 ? 360 + hue : hue;
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
// Combination Functions
 | 
						|
// ---------------------
 | 
						|
// Thanks to jQuery xColor for some of the ideas behind these
 | 
						|
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
 | 
						|
 | 
						|
function complement(color) {
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    hsl.h = (hsl.h + 180) % 360;
 | 
						|
    return tinycolor(hsl);
 | 
						|
}
 | 
						|
 | 
						|
function triad(color) {
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    var h = hsl.h;
 | 
						|
    return [
 | 
						|
        tinycolor(color),
 | 
						|
        tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
 | 
						|
        tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
 | 
						|
    ];
 | 
						|
}
 | 
						|
 | 
						|
function tetrad(color) {
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    var h = hsl.h;
 | 
						|
    return [
 | 
						|
        tinycolor(color),
 | 
						|
        tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
 | 
						|
        tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
 | 
						|
        tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
 | 
						|
    ];
 | 
						|
}
 | 
						|
 | 
						|
function splitcomplement(color) {
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    var h = hsl.h;
 | 
						|
    return [
 | 
						|
        tinycolor(color),
 | 
						|
        tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
 | 
						|
        tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
 | 
						|
    ];
 | 
						|
}
 | 
						|
 | 
						|
function analogous(color, results, slices) {
 | 
						|
    results = results || 6;
 | 
						|
    slices = slices || 30;
 | 
						|
 | 
						|
    var hsl = tinycolor(color).toHsl();
 | 
						|
    var part = 360 / slices;
 | 
						|
    var ret = [tinycolor(color)];
 | 
						|
 | 
						|
    for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
 | 
						|
        hsl.h = (hsl.h + part) % 360;
 | 
						|
        ret.push(tinycolor(hsl));
 | 
						|
    }
 | 
						|
    return ret;
 | 
						|
}
 | 
						|
 | 
						|
function monochromatic(color, results) {
 | 
						|
    results = results || 6;
 | 
						|
    var hsv = tinycolor(color).toHsv();
 | 
						|
    var h = hsv.h, s = hsv.s, v = hsv.v;
 | 
						|
    var ret = [];
 | 
						|
    var modification = 1 / results;
 | 
						|
 | 
						|
    while (results--) {
 | 
						|
        ret.push(tinycolor({ h: h, s: s, v: v}));
 | 
						|
        v = (v + modification) % 1;
 | 
						|
    }
 | 
						|
 | 
						|
    return ret;
 | 
						|
}
 | 
						|
 | 
						|
// Utility Functions
 | 
						|
// ---------------------
 | 
						|
 | 
						|
tinycolor.mix = function(color1, color2, amount) {
 | 
						|
    amount = (amount === 0) ? 0 : (amount || 50);
 | 
						|
 | 
						|
    var rgb1 = tinycolor(color1).toRgb();
 | 
						|
    var rgb2 = tinycolor(color2).toRgb();
 | 
						|
 | 
						|
    var p = amount / 100;
 | 
						|
 | 
						|
    var rgba = {
 | 
						|
        r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
 | 
						|
        g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
 | 
						|
        b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
 | 
						|
        a: ((rgb2.a - rgb1.a) * p) + rgb1.a
 | 
						|
    };
 | 
						|
 | 
						|
    return tinycolor(rgba);
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
// Readability Functions
 | 
						|
// ---------------------
 | 
						|
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
 | 
						|
 | 
						|
// `contrast`
 | 
						|
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
 | 
						|
tinycolor.readability = function(color1, color2) {
 | 
						|
    var c1 = tinycolor(color1);
 | 
						|
    var c2 = tinycolor(color2);
 | 
						|
    return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
 | 
						|
};
 | 
						|
 | 
						|
// `isReadable`
 | 
						|
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
 | 
						|
// The third argument is an optional Object.
 | 
						|
//      the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
 | 
						|
//      the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
 | 
						|
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
 | 
						|
 | 
						|
// *Example*
 | 
						|
//    tinycolor.isReadable("#000", "#111") => false
 | 
						|
//    tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
 | 
						|
tinycolor.isReadable = function(color1, color2, wcag2) {
 | 
						|
    var readability = tinycolor.readability(color1, color2);
 | 
						|
    var wcag2Parms, out;
 | 
						|
 | 
						|
    out = false;
 | 
						|
 | 
						|
    wcag2Parms = validateWCAG2Parms(wcag2);
 | 
						|
    switch (wcag2Parms.level + wcag2Parms.size) {
 | 
						|
        case "AAsmall":
 | 
						|
        case "AAAlarge":
 | 
						|
            out = readability >= 4.5;
 | 
						|
            break;
 | 
						|
        case "AAlarge":
 | 
						|
            out = readability >= 3;
 | 
						|
            break;
 | 
						|
        case "AAAsmall":
 | 
						|
            out = readability >= 7;
 | 
						|
            break;
 | 
						|
    }
 | 
						|
    return out;
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
// `mostReadable`
 | 
						|
// Given a base color and a list of possible foreground or background
 | 
						|
// colors for that base, returns the most readable color.
 | 
						|
// Optionally returns Black or White if the most readable color is unreadable.
 | 
						|
// *Example*
 | 
						|
//    tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
 | 
						|
//    tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString();  // "#ffffff"
 | 
						|
//    tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
 | 
						|
//    tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
 | 
						|
tinycolor.mostReadable = function(baseColor, colorList, args) {
 | 
						|
    var bestColor = null;
 | 
						|
    var bestScore = 0;
 | 
						|
    var readability;
 | 
						|
    var includeFallbackColors, level, size ;
 | 
						|
    args = args || {};
 | 
						|
    includeFallbackColors = args.includeFallbackColors ;
 | 
						|
    level = args.level;
 | 
						|
    size = args.size;
 | 
						|
 | 
						|
    for (var i= 0; i < colorList.length ; i++) {
 | 
						|
        readability = tinycolor.readability(baseColor, colorList[i]);
 | 
						|
        if (readability > bestScore) {
 | 
						|
            bestScore = readability;
 | 
						|
            bestColor = tinycolor(colorList[i]);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
 | 
						|
        return bestColor;
 | 
						|
    }
 | 
						|
    else {
 | 
						|
        args.includeFallbackColors=false;
 | 
						|
        return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
 | 
						|
    }
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
// Big List of Colors
 | 
						|
// ------------------
 | 
						|
// <http://www.w3.org/TR/css3-color/#svg-color>
 | 
						|
var names = tinycolor.names = {
 | 
						|
    aliceblue: "f0f8ff",
 | 
						|
    antiquewhite: "faebd7",
 | 
						|
    aqua: "0ff",
 | 
						|
    aquamarine: "7fffd4",
 | 
						|
    azure: "f0ffff",
 | 
						|
    beige: "f5f5dc",
 | 
						|
    bisque: "ffe4c4",
 | 
						|
    black: "000",
 | 
						|
    blanchedalmond: "ffebcd",
 | 
						|
    blue: "00f",
 | 
						|
    blueviolet: "8a2be2",
 | 
						|
    brown: "a52a2a",
 | 
						|
    burlywood: "deb887",
 | 
						|
    burntsienna: "ea7e5d",
 | 
						|
    cadetblue: "5f9ea0",
 | 
						|
    chartreuse: "7fff00",
 | 
						|
    chocolate: "d2691e",
 | 
						|
    coral: "ff7f50",
 | 
						|
    cornflowerblue: "6495ed",
 | 
						|
    cornsilk: "fff8dc",
 | 
						|
    crimson: "dc143c",
 | 
						|
    cyan: "0ff",
 | 
						|
    darkblue: "00008b",
 | 
						|
    darkcyan: "008b8b",
 | 
						|
    darkgoldenrod: "b8860b",
 | 
						|
    darkgray: "a9a9a9",
 | 
						|
    darkgreen: "006400",
 | 
						|
    darkgrey: "a9a9a9",
 | 
						|
    darkkhaki: "bdb76b",
 | 
						|
    darkmagenta: "8b008b",
 | 
						|
    darkolivegreen: "556b2f",
 | 
						|
    darkorange: "ff8c00",
 | 
						|
    darkorchid: "9932cc",
 | 
						|
    darkred: "8b0000",
 | 
						|
    darksalmon: "e9967a",
 | 
						|
    darkseagreen: "8fbc8f",
 | 
						|
    darkslateblue: "483d8b",
 | 
						|
    darkslategray: "2f4f4f",
 | 
						|
    darkslategrey: "2f4f4f",
 | 
						|
    darkturquoise: "00ced1",
 | 
						|
    darkviolet: "9400d3",
 | 
						|
    deeppink: "ff1493",
 | 
						|
    deepskyblue: "00bfff",
 | 
						|
    dimgray: "696969",
 | 
						|
    dimgrey: "696969",
 | 
						|
    dodgerblue: "1e90ff",
 | 
						|
    firebrick: "b22222",
 | 
						|
    floralwhite: "fffaf0",
 | 
						|
    forestgreen: "228b22",
 | 
						|
    fuchsia: "f0f",
 | 
						|
    gainsboro: "dcdcdc",
 | 
						|
    ghostwhite: "f8f8ff",
 | 
						|
    gold: "ffd700",
 | 
						|
    goldenrod: "daa520",
 | 
						|
    gray: "808080",
 | 
						|
    green: "008000",
 | 
						|
    greenyellow: "adff2f",
 | 
						|
    grey: "808080",
 | 
						|
    honeydew: "f0fff0",
 | 
						|
    hotpink: "ff69b4",
 | 
						|
    indianred: "cd5c5c",
 | 
						|
    indigo: "4b0082",
 | 
						|
    ivory: "fffff0",
 | 
						|
    khaki: "f0e68c",
 | 
						|
    lavender: "e6e6fa",
 | 
						|
    lavenderblush: "fff0f5",
 | 
						|
    lawngreen: "7cfc00",
 | 
						|
    lemonchiffon: "fffacd",
 | 
						|
    lightblue: "add8e6",
 | 
						|
    lightcoral: "f08080",
 | 
						|
    lightcyan: "e0ffff",
 | 
						|
    lightgoldenrodyellow: "fafad2",
 | 
						|
    lightgray: "d3d3d3",
 | 
						|
    lightgreen: "90ee90",
 | 
						|
    lightgrey: "d3d3d3",
 | 
						|
    lightpink: "ffb6c1",
 | 
						|
    lightsalmon: "ffa07a",
 | 
						|
    lightseagreen: "20b2aa",
 | 
						|
    lightskyblue: "87cefa",
 | 
						|
    lightslategray: "789",
 | 
						|
    lightslategrey: "789",
 | 
						|
    lightsteelblue: "b0c4de",
 | 
						|
    lightyellow: "ffffe0",
 | 
						|
    lime: "0f0",
 | 
						|
    limegreen: "32cd32",
 | 
						|
    linen: "faf0e6",
 | 
						|
    magenta: "f0f",
 | 
						|
    maroon: "800000",
 | 
						|
    mediumaquamarine: "66cdaa",
 | 
						|
    mediumblue: "0000cd",
 | 
						|
    mediumorchid: "ba55d3",
 | 
						|
    mediumpurple: "9370db",
 | 
						|
    mediumseagreen: "3cb371",
 | 
						|
    mediumslateblue: "7b68ee",
 | 
						|
    mediumspringgreen: "00fa9a",
 | 
						|
    mediumturquoise: "48d1cc",
 | 
						|
    mediumvioletred: "c71585",
 | 
						|
    midnightblue: "191970",
 | 
						|
    mintcream: "f5fffa",
 | 
						|
    mistyrose: "ffe4e1",
 | 
						|
    moccasin: "ffe4b5",
 | 
						|
    navajowhite: "ffdead",
 | 
						|
    navy: "000080",
 | 
						|
    oldlace: "fdf5e6",
 | 
						|
    olive: "808000",
 | 
						|
    olivedrab: "6b8e23",
 | 
						|
    orange: "ffa500",
 | 
						|
    orangered: "ff4500",
 | 
						|
    orchid: "da70d6",
 | 
						|
    palegoldenrod: "eee8aa",
 | 
						|
    palegreen: "98fb98",
 | 
						|
    paleturquoise: "afeeee",
 | 
						|
    palevioletred: "db7093",
 | 
						|
    papayawhip: "ffefd5",
 | 
						|
    peachpuff: "ffdab9",
 | 
						|
    peru: "cd853f",
 | 
						|
    pink: "ffc0cb",
 | 
						|
    plum: "dda0dd",
 | 
						|
    powderblue: "b0e0e6",
 | 
						|
    purple: "800080",
 | 
						|
    rebeccapurple: "663399",
 | 
						|
    red: "f00",
 | 
						|
    rosybrown: "bc8f8f",
 | 
						|
    royalblue: "4169e1",
 | 
						|
    saddlebrown: "8b4513",
 | 
						|
    salmon: "fa8072",
 | 
						|
    sandybrown: "f4a460",
 | 
						|
    seagreen: "2e8b57",
 | 
						|
    seashell: "fff5ee",
 | 
						|
    sienna: "a0522d",
 | 
						|
    silver: "c0c0c0",
 | 
						|
    skyblue: "87ceeb",
 | 
						|
    slateblue: "6a5acd",
 | 
						|
    slategray: "708090",
 | 
						|
    slategrey: "708090",
 | 
						|
    snow: "fffafa",
 | 
						|
    springgreen: "00ff7f",
 | 
						|
    steelblue: "4682b4",
 | 
						|
    tan: "d2b48c",
 | 
						|
    teal: "008080",
 | 
						|
    thistle: "d8bfd8",
 | 
						|
    tomato: "ff6347",
 | 
						|
    turquoise: "40e0d0",
 | 
						|
    violet: "ee82ee",
 | 
						|
    wheat: "f5deb3",
 | 
						|
    white: "fff",
 | 
						|
    whitesmoke: "f5f5f5",
 | 
						|
    yellow: "ff0",
 | 
						|
    yellowgreen: "9acd32"
 | 
						|
};
 | 
						|
 | 
						|
// Make it easy to access colors via `hexNames[hex]`
 | 
						|
var hexNames = tinycolor.hexNames = flip(names);
 | 
						|
 | 
						|
 | 
						|
// Utilities
 | 
						|
// ---------
 | 
						|
 | 
						|
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
 | 
						|
function flip(o) {
 | 
						|
    var flipped = { };
 | 
						|
    for (var i in o) {
 | 
						|
        if (o.hasOwnProperty(i)) {
 | 
						|
            flipped[o[i]] = i;
 | 
						|
        }
 | 
						|
    }
 | 
						|
    return flipped;
 | 
						|
}
 | 
						|
 | 
						|
// Return a valid alpha value [0,1] with all invalid values being set to 1
 | 
						|
function boundAlpha(a) {
 | 
						|
    a = parseFloat(a);
 | 
						|
 | 
						|
    if (isNaN(a) || a < 0 || a > 1) {
 | 
						|
        a = 1;
 | 
						|
    }
 | 
						|
 | 
						|
    return a;
 | 
						|
}
 | 
						|
 | 
						|
// Take input from [0, n] and return it as [0, 1]
 | 
						|
function bound01(n, max) {
 | 
						|
    if (isOnePointZero(n)) { n = "100%"; }
 | 
						|
 | 
						|
    var processPercent = isPercentage(n);
 | 
						|
    n = mathMin(max, mathMax(0, parseFloat(n)));
 | 
						|
 | 
						|
    // Automatically convert percentage into number
 | 
						|
    if (processPercent) {
 | 
						|
        n = parseInt(n * max, 10) / 100;
 | 
						|
    }
 | 
						|
 | 
						|
    // Handle floating point rounding errors
 | 
						|
    if ((Math.abs(n - max) < 0.000001)) {
 | 
						|
        return 1;
 | 
						|
    }
 | 
						|
 | 
						|
    // Convert into [0, 1] range if it isn't already
 | 
						|
    return (n % max) / parseFloat(max);
 | 
						|
}
 | 
						|
 | 
						|
// Force a number between 0 and 1
 | 
						|
function clamp01(val) {
 | 
						|
    return mathMin(1, mathMax(0, val));
 | 
						|
}
 | 
						|
 | 
						|
// Parse a base-16 hex value into a base-10 integer
 | 
						|
function parseIntFromHex(val) {
 | 
						|
    return parseInt(val, 16);
 | 
						|
}
 | 
						|
 | 
						|
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
 | 
						|
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
 | 
						|
function isOnePointZero(n) {
 | 
						|
    return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
 | 
						|
}
 | 
						|
 | 
						|
// Check to see if string passed in is a percentage
 | 
						|
function isPercentage(n) {
 | 
						|
    return typeof n === "string" && n.indexOf('%') != -1;
 | 
						|
}
 | 
						|
 | 
						|
// Force a hex value to have 2 characters
 | 
						|
function pad2(c) {
 | 
						|
    return c.length == 1 ? '0' + c : '' + c;
 | 
						|
}
 | 
						|
 | 
						|
// Replace a decimal with it's percentage value
 | 
						|
function convertToPercentage(n) {
 | 
						|
    if (n <= 1) {
 | 
						|
        n = (n * 100) + "%";
 | 
						|
    }
 | 
						|
 | 
						|
    return n;
 | 
						|
}
 | 
						|
 | 
						|
// Converts a decimal to a hex value
 | 
						|
function convertDecimalToHex(d) {
 | 
						|
    return Math.round(parseFloat(d) * 255).toString(16);
 | 
						|
}
 | 
						|
// Converts a hex value to a decimal
 | 
						|
function convertHexToDecimal(h) {
 | 
						|
    return (parseIntFromHex(h) / 255);
 | 
						|
}
 | 
						|
 | 
						|
var matchers = (function() {
 | 
						|
 | 
						|
    // <http://www.w3.org/TR/css3-values/#integers>
 | 
						|
    var CSS_INTEGER = "[-\\+]?\\d+%?";
 | 
						|
 | 
						|
    // <http://www.w3.org/TR/css3-values/#number-value>
 | 
						|
    var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
 | 
						|
 | 
						|
    // Allow positive/negative integer/number.  Don't capture the either/or, just the entire outcome.
 | 
						|
    var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
 | 
						|
 | 
						|
    // Actual matching.
 | 
						|
    // Parentheses and commas are optional, but not required.
 | 
						|
    // Whitespace can take the place of commas or opening paren
 | 
						|
    var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
 | 
						|
    var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
 | 
						|
 | 
						|
    return {
 | 
						|
        CSS_UNIT: new RegExp(CSS_UNIT),
 | 
						|
        rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
 | 
						|
        rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
 | 
						|
        hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
 | 
						|
        hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
 | 
						|
        hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
 | 
						|
        hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
 | 
						|
        hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
 | 
						|
        hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
 | 
						|
        hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
 | 
						|
        hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
 | 
						|
    };
 | 
						|
})();
 | 
						|
 | 
						|
// `isValidCSSUnit`
 | 
						|
// Take in a single string / number and check to see if it looks like a CSS unit
 | 
						|
// (see `matchers` above for definition).
 | 
						|
function isValidCSSUnit(color) {
 | 
						|
    return !!matchers.CSS_UNIT.exec(color);
 | 
						|
}
 | 
						|
 | 
						|
// `stringInputToObject`
 | 
						|
// Permissive string parsing.  Take in a number of formats, and output an object
 | 
						|
// based on detected format.  Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
 | 
						|
function stringInputToObject(color) {
 | 
						|
 | 
						|
    color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
 | 
						|
    var named = false;
 | 
						|
    if (names[color]) {
 | 
						|
        color = names[color];
 | 
						|
        named = true;
 | 
						|
    }
 | 
						|
    else if (color == 'transparent') {
 | 
						|
        return { r: 0, g: 0, b: 0, a: 0, format: "name" };
 | 
						|
    }
 | 
						|
 | 
						|
    // Try to match string input using regular expressions.
 | 
						|
    // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
 | 
						|
    // Just return an object and let the conversion functions handle that.
 | 
						|
    // This way the result will be the same whether the tinycolor is initialized with string or object.
 | 
						|
    var match;
 | 
						|
    if ((match = matchers.rgb.exec(color))) {
 | 
						|
        return { r: match[1], g: match[2], b: match[3] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.rgba.exec(color))) {
 | 
						|
        return { r: match[1], g: match[2], b: match[3], a: match[4] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hsl.exec(color))) {
 | 
						|
        return { h: match[1], s: match[2], l: match[3] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hsla.exec(color))) {
 | 
						|
        return { h: match[1], s: match[2], l: match[3], a: match[4] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hsv.exec(color))) {
 | 
						|
        return { h: match[1], s: match[2], v: match[3] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hsva.exec(color))) {
 | 
						|
        return { h: match[1], s: match[2], v: match[3], a: match[4] };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hex8.exec(color))) {
 | 
						|
        return {
 | 
						|
            r: parseIntFromHex(match[1]),
 | 
						|
            g: parseIntFromHex(match[2]),
 | 
						|
            b: parseIntFromHex(match[3]),
 | 
						|
            a: convertHexToDecimal(match[4]),
 | 
						|
            format: named ? "name" : "hex8"
 | 
						|
        };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hex6.exec(color))) {
 | 
						|
        return {
 | 
						|
            r: parseIntFromHex(match[1]),
 | 
						|
            g: parseIntFromHex(match[2]),
 | 
						|
            b: parseIntFromHex(match[3]),
 | 
						|
            format: named ? "name" : "hex"
 | 
						|
        };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hex4.exec(color))) {
 | 
						|
        return {
 | 
						|
            r: parseIntFromHex(match[1] + '' + match[1]),
 | 
						|
            g: parseIntFromHex(match[2] + '' + match[2]),
 | 
						|
            b: parseIntFromHex(match[3] + '' + match[3]),
 | 
						|
            a: convertHexToDecimal(match[4] + '' + match[4]),
 | 
						|
            format: named ? "name" : "hex8"
 | 
						|
        };
 | 
						|
    }
 | 
						|
    if ((match = matchers.hex3.exec(color))) {
 | 
						|
        return {
 | 
						|
            r: parseIntFromHex(match[1] + '' + match[1]),
 | 
						|
            g: parseIntFromHex(match[2] + '' + match[2]),
 | 
						|
            b: parseIntFromHex(match[3] + '' + match[3]),
 | 
						|
            format: named ? "name" : "hex"
 | 
						|
        };
 | 
						|
    }
 | 
						|
 | 
						|
    return false;
 | 
						|
}
 | 
						|
 | 
						|
function validateWCAG2Parms(parms) {
 | 
						|
    // return valid WCAG2 parms for isReadable.
 | 
						|
    // If input parms are invalid, return {"level":"AA", "size":"small"}
 | 
						|
    var level, size;
 | 
						|
    parms = parms || {"level":"AA", "size":"small"};
 | 
						|
    level = (parms.level || "AA").toUpperCase();
 | 
						|
    size = (parms.size || "small").toLowerCase();
 | 
						|
    if (level !== "AA" && level !== "AAA") {
 | 
						|
        level = "AA";
 | 
						|
    }
 | 
						|
    if (size !== "small" && size !== "large") {
 | 
						|
        size = "small";
 | 
						|
    }
 | 
						|
    return {"level":level, "size":size};
 | 
						|
}
 | 
						|
 | 
						|
// Node: Export function
 | 
						|
if (typeof module !== "undefined" && module.exports) {
 | 
						|
    module.exports = tinycolor;
 | 
						|
}
 | 
						|
// AMD/requirejs: Define the module
 | 
						|
else if (typeof define === 'function' && define.amd) {
 | 
						|
    define(function () {return tinycolor;});
 | 
						|
}
 | 
						|
// Browser: Expose to window
 | 
						|
else {
 | 
						|
    window.tinycolor = tinycolor;
 | 
						|
}
 | 
						|
 | 
						|
})(Math);
 | 
						|
 | 
						|
},{}],21:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
/*
 | 
						|
 * Toastr
 | 
						|
 * Copyright 2012-2015
 | 
						|
 * Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
 | 
						|
 * All Rights Reserved.
 | 
						|
 * Use, reproduction, distribution, and modification of this code is subject to the terms and
 | 
						|
 * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
 | 
						|
 *
 | 
						|
 * ARIA Support: Greta Krafsig
 | 
						|
 *
 | 
						|
 * Project: https://github.com/CodeSeven/toastr
 | 
						|
 */
 | 
						|
/* global define */
 | 
						|
(function (define) {
 | 
						|
    define(['jquery'], function ($) {
 | 
						|
        return (function () {
 | 
						|
            var $container;
 | 
						|
            var listener;
 | 
						|
            var toastId = 0;
 | 
						|
            var toastType = {
 | 
						|
                error: 'error',
 | 
						|
                info: 'info',
 | 
						|
                success: 'success',
 | 
						|
                warning: 'warning'
 | 
						|
            };
 | 
						|
 | 
						|
            var toastr = {
 | 
						|
                clear: clear,
 | 
						|
                remove: remove,
 | 
						|
                error: error,
 | 
						|
                getContainer: getContainer,
 | 
						|
                info: info,
 | 
						|
                options: {},
 | 
						|
                subscribe: subscribe,
 | 
						|
                success: success,
 | 
						|
                version: '2.1.4',
 | 
						|
                warning: warning
 | 
						|
            };
 | 
						|
 | 
						|
            var previousToast;
 | 
						|
 | 
						|
            return toastr;
 | 
						|
 | 
						|
            ////////////////
 | 
						|
 | 
						|
            function error(message, title, optionsOverride) {
 | 
						|
                return notify({
 | 
						|
                    type: toastType.error,
 | 
						|
                    iconClass: getOptions().iconClasses.error,
 | 
						|
                    message: message,
 | 
						|
                    optionsOverride: optionsOverride,
 | 
						|
                    title: title
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            function getContainer(options, create) {
 | 
						|
                if (!options) { options = getOptions(); }
 | 
						|
                $container = $('#' + options.containerId);
 | 
						|
                if ($container.length) {
 | 
						|
                    return $container;
 | 
						|
                }
 | 
						|
                if (create) {
 | 
						|
                    $container = createContainer(options);
 | 
						|
                }
 | 
						|
                return $container;
 | 
						|
            }
 | 
						|
 | 
						|
            function info(message, title, optionsOverride) {
 | 
						|
                return notify({
 | 
						|
                    type: toastType.info,
 | 
						|
                    iconClass: getOptions().iconClasses.info,
 | 
						|
                    message: message,
 | 
						|
                    optionsOverride: optionsOverride,
 | 
						|
                    title: title
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            function subscribe(callback) {
 | 
						|
                listener = callback;
 | 
						|
            }
 | 
						|
 | 
						|
            function success(message, title, optionsOverride) {
 | 
						|
                return notify({
 | 
						|
                    type: toastType.success,
 | 
						|
                    iconClass: getOptions().iconClasses.success,
 | 
						|
                    message: message,
 | 
						|
                    optionsOverride: optionsOverride,
 | 
						|
                    title: title
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            function warning(message, title, optionsOverride) {
 | 
						|
                return notify({
 | 
						|
                    type: toastType.warning,
 | 
						|
                    iconClass: getOptions().iconClasses.warning,
 | 
						|
                    message: message,
 | 
						|
                    optionsOverride: optionsOverride,
 | 
						|
                    title: title
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            function clear($toastElement, clearOptions) {
 | 
						|
                var options = getOptions();
 | 
						|
                if (!$container) { getContainer(options); }
 | 
						|
                if (!clearToast($toastElement, options, clearOptions)) {
 | 
						|
                    clearContainer(options);
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            function remove($toastElement) {
 | 
						|
                var options = getOptions();
 | 
						|
                if (!$container) { getContainer(options); }
 | 
						|
                if ($toastElement && $(':focus', $toastElement).length === 0) {
 | 
						|
                    removeToast($toastElement);
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
                if ($container.children().length) {
 | 
						|
                    $container.remove();
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            // internal functions
 | 
						|
 | 
						|
            function clearContainer (options) {
 | 
						|
                var toastsToClear = $container.children();
 | 
						|
                for (var i = toastsToClear.length - 1; i >= 0; i--) {
 | 
						|
                    clearToast($(toastsToClear[i]), options);
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            function clearToast ($toastElement, options, clearOptions) {
 | 
						|
                var force = clearOptions && clearOptions.force ? clearOptions.force : false;
 | 
						|
                if ($toastElement && (force || $(':focus', $toastElement).length === 0)) {
 | 
						|
                    $toastElement[options.hideMethod]({
 | 
						|
                        duration: options.hideDuration,
 | 
						|
                        easing: options.hideEasing,
 | 
						|
                        complete: function () { removeToast($toastElement); }
 | 
						|
                    });
 | 
						|
                    return true;
 | 
						|
                }
 | 
						|
                return false;
 | 
						|
            }
 | 
						|
 | 
						|
            function createContainer(options) {
 | 
						|
                $container = $('<div/>')
 | 
						|
                    .attr('id', options.containerId)
 | 
						|
                    .addClass(options.positionClass);
 | 
						|
 | 
						|
                $container.appendTo($(options.target));
 | 
						|
                return $container;
 | 
						|
            }
 | 
						|
 | 
						|
            function getDefaults() {
 | 
						|
                return {
 | 
						|
                    tapToDismiss: true,
 | 
						|
                    toastClass: 'toast',
 | 
						|
                    containerId: 'toast-container',
 | 
						|
                    debug: false,
 | 
						|
 | 
						|
                    showMethod: 'fadeIn', //fadeIn, slideDown, and show are built into jQuery
 | 
						|
                    showDuration: 300,
 | 
						|
                    showEasing: 'swing', //swing and linear are built into jQuery
 | 
						|
                    onShown: undefined,
 | 
						|
                    hideMethod: 'fadeOut',
 | 
						|
                    hideDuration: 1000,
 | 
						|
                    hideEasing: 'swing',
 | 
						|
                    onHidden: undefined,
 | 
						|
                    closeMethod: false,
 | 
						|
                    closeDuration: false,
 | 
						|
                    closeEasing: false,
 | 
						|
                    closeOnHover: true,
 | 
						|
 | 
						|
                    extendedTimeOut: 1000,
 | 
						|
                    iconClasses: {
 | 
						|
                        error: 'toast-error',
 | 
						|
                        info: 'toast-info',
 | 
						|
                        success: 'toast-success',
 | 
						|
                        warning: 'toast-warning'
 | 
						|
                    },
 | 
						|
                    iconClass: 'toast-info',
 | 
						|
                    positionClass: 'toast-top-right',
 | 
						|
                    timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
 | 
						|
                    titleClass: 'toast-title',
 | 
						|
                    messageClass: 'toast-message',
 | 
						|
                    escapeHtml: false,
 | 
						|
                    target: 'body',
 | 
						|
                    closeHtml: '<button type="button">×</button>',
 | 
						|
                    closeClass: 'toast-close-button',
 | 
						|
                    newestOnTop: true,
 | 
						|
                    preventDuplicates: false,
 | 
						|
                    progressBar: false,
 | 
						|
                    progressClass: 'toast-progress',
 | 
						|
                    rtl: false
 | 
						|
                };
 | 
						|
            }
 | 
						|
 | 
						|
            function publish(args) {
 | 
						|
                if (!listener) { return; }
 | 
						|
                listener(args);
 | 
						|
            }
 | 
						|
 | 
						|
            function notify(map) {
 | 
						|
                var options = getOptions();
 | 
						|
                var iconClass = map.iconClass || options.iconClass;
 | 
						|
 | 
						|
                if (typeof (map.optionsOverride) !== 'undefined') {
 | 
						|
                    options = $.extend(options, map.optionsOverride);
 | 
						|
                    iconClass = map.optionsOverride.iconClass || iconClass;
 | 
						|
                }
 | 
						|
 | 
						|
                if (shouldExit(options, map)) { return; }
 | 
						|
 | 
						|
                toastId++;
 | 
						|
 | 
						|
                $container = getContainer(options, true);
 | 
						|
 | 
						|
                var intervalId = null;
 | 
						|
                var $toastElement = $('<div/>');
 | 
						|
                var $titleElement = $('<div/>');
 | 
						|
                var $messageElement = $('<div/>');
 | 
						|
                var $progressElement = $('<div/>');
 | 
						|
                var $closeElement = $(options.closeHtml);
 | 
						|
                var progressBar = {
 | 
						|
                    intervalId: null,
 | 
						|
                    hideEta: null,
 | 
						|
                    maxHideTime: null
 | 
						|
                };
 | 
						|
                var response = {
 | 
						|
                    toastId: toastId,
 | 
						|
                    state: 'visible',
 | 
						|
                    startTime: new Date(),
 | 
						|
                    options: options,
 | 
						|
                    map: map
 | 
						|
                };
 | 
						|
 | 
						|
                personalizeToast();
 | 
						|
 | 
						|
                displayToast();
 | 
						|
 | 
						|
                handleEvents();
 | 
						|
 | 
						|
                publish(response);
 | 
						|
 | 
						|
                if (options.debug && console) {
 | 
						|
                    console.log(response);
 | 
						|
                }
 | 
						|
 | 
						|
                return $toastElement;
 | 
						|
 | 
						|
                function escapeHtml(source) {
 | 
						|
                    if (source == null) {
 | 
						|
                        source = '';
 | 
						|
                    }
 | 
						|
 | 
						|
                    return source
 | 
						|
                        .replace(/&/g, '&')
 | 
						|
                        .replace(/"/g, '"')
 | 
						|
                        .replace(/'/g, ''')
 | 
						|
                        .replace(/</g, '<')
 | 
						|
                        .replace(/>/g, '>');
 | 
						|
                }
 | 
						|
 | 
						|
                function personalizeToast() {
 | 
						|
                    setIcon();
 | 
						|
                    setTitle();
 | 
						|
                    setMessage();
 | 
						|
                    setCloseButton();
 | 
						|
                    setProgressBar();
 | 
						|
                    setRTL();
 | 
						|
                    setSequence();
 | 
						|
                    setAria();
 | 
						|
                }
 | 
						|
 | 
						|
                function setAria() {
 | 
						|
                    var ariaValue = '';
 | 
						|
                    switch (map.iconClass) {
 | 
						|
                        case 'toast-success':
 | 
						|
                        case 'toast-info':
 | 
						|
                            ariaValue =  'polite';
 | 
						|
                            break;
 | 
						|
                        default:
 | 
						|
                            ariaValue = 'assertive';
 | 
						|
                    }
 | 
						|
                    $toastElement.attr('aria-live', ariaValue);
 | 
						|
                }
 | 
						|
 | 
						|
                function handleEvents() {
 | 
						|
                    if (options.closeOnHover) {
 | 
						|
                        $toastElement.hover(stickAround, delayedHideToast);
 | 
						|
                    }
 | 
						|
 | 
						|
                    if (!options.onclick && options.tapToDismiss) {
 | 
						|
                        $toastElement.click(hideToast);
 | 
						|
                    }
 | 
						|
 | 
						|
                    if (options.closeButton && $closeElement) {
 | 
						|
                        $closeElement.click(function (event) {
 | 
						|
                            if (event.stopPropagation) {
 | 
						|
                                event.stopPropagation();
 | 
						|
                            } else if (event.cancelBubble !== undefined && event.cancelBubble !== true) {
 | 
						|
                                event.cancelBubble = true;
 | 
						|
                            }
 | 
						|
 | 
						|
                            if (options.onCloseClick) {
 | 
						|
                                options.onCloseClick(event);
 | 
						|
                            }
 | 
						|
 | 
						|
                            hideToast(true);
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
 | 
						|
                    if (options.onclick) {
 | 
						|
                        $toastElement.click(function (event) {
 | 
						|
                            options.onclick(event);
 | 
						|
                            hideToast();
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function displayToast() {
 | 
						|
                    $toastElement.hide();
 | 
						|
 | 
						|
                    $toastElement[options.showMethod](
 | 
						|
                        {duration: options.showDuration, easing: options.showEasing, complete: options.onShown}
 | 
						|
                    );
 | 
						|
 | 
						|
                    if (options.timeOut > 0) {
 | 
						|
                        intervalId = setTimeout(hideToast, options.timeOut);
 | 
						|
                        progressBar.maxHideTime = parseFloat(options.timeOut);
 | 
						|
                        progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
 | 
						|
                        if (options.progressBar) {
 | 
						|
                            progressBar.intervalId = setInterval(updateProgress, 10);
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setIcon() {
 | 
						|
                    if (map.iconClass) {
 | 
						|
                        $toastElement.addClass(options.toastClass).addClass(iconClass);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setSequence() {
 | 
						|
                    if (options.newestOnTop) {
 | 
						|
                        $container.prepend($toastElement);
 | 
						|
                    } else {
 | 
						|
                        $container.append($toastElement);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setTitle() {
 | 
						|
                    if (map.title) {
 | 
						|
                        var suffix = map.title;
 | 
						|
                        if (options.escapeHtml) {
 | 
						|
                            suffix = escapeHtml(map.title);
 | 
						|
                        }
 | 
						|
                        $titleElement.append(suffix).addClass(options.titleClass);
 | 
						|
                        $toastElement.append($titleElement);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setMessage() {
 | 
						|
                    if (map.message) {
 | 
						|
                        var suffix = map.message;
 | 
						|
                        if (options.escapeHtml) {
 | 
						|
                            suffix = escapeHtml(map.message);
 | 
						|
                        }
 | 
						|
                        $messageElement.append(suffix).addClass(options.messageClass);
 | 
						|
                        $toastElement.append($messageElement);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setCloseButton() {
 | 
						|
                    if (options.closeButton) {
 | 
						|
                        $closeElement.addClass(options.closeClass).attr('role', 'button');
 | 
						|
                        $toastElement.prepend($closeElement);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setProgressBar() {
 | 
						|
                    if (options.progressBar) {
 | 
						|
                        $progressElement.addClass(options.progressClass);
 | 
						|
                        $toastElement.prepend($progressElement);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function setRTL() {
 | 
						|
                    if (options.rtl) {
 | 
						|
                        $toastElement.addClass('rtl');
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function shouldExit(options, map) {
 | 
						|
                    if (options.preventDuplicates) {
 | 
						|
                        if (map.message === previousToast) {
 | 
						|
                            return true;
 | 
						|
                        } else {
 | 
						|
                            previousToast = map.message;
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                    return false;
 | 
						|
                }
 | 
						|
 | 
						|
                function hideToast(override) {
 | 
						|
                    var method = override && options.closeMethod !== false ? options.closeMethod : options.hideMethod;
 | 
						|
                    var duration = override && options.closeDuration !== false ?
 | 
						|
                        options.closeDuration : options.hideDuration;
 | 
						|
                    var easing = override && options.closeEasing !== false ? options.closeEasing : options.hideEasing;
 | 
						|
                    if ($(':focus', $toastElement).length && !override) {
 | 
						|
                        return;
 | 
						|
                    }
 | 
						|
                    clearTimeout(progressBar.intervalId);
 | 
						|
                    return $toastElement[method]({
 | 
						|
                        duration: duration,
 | 
						|
                        easing: easing,
 | 
						|
                        complete: function () {
 | 
						|
                            removeToast($toastElement);
 | 
						|
                            clearTimeout(intervalId);
 | 
						|
                            if (options.onHidden && response.state !== 'hidden') {
 | 
						|
                                options.onHidden();
 | 
						|
                            }
 | 
						|
                            response.state = 'hidden';
 | 
						|
                            response.endTime = new Date();
 | 
						|
                            publish(response);
 | 
						|
                        }
 | 
						|
                    });
 | 
						|
                }
 | 
						|
 | 
						|
                function delayedHideToast() {
 | 
						|
                    if (options.timeOut > 0 || options.extendedTimeOut > 0) {
 | 
						|
                        intervalId = setTimeout(hideToast, options.extendedTimeOut);
 | 
						|
                        progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
 | 
						|
                        progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                function stickAround() {
 | 
						|
                    clearTimeout(intervalId);
 | 
						|
                    progressBar.hideEta = 0;
 | 
						|
                    $toastElement.stop(true, true)[options.showMethod](
 | 
						|
                        {duration: options.showDuration, easing: options.showEasing}
 | 
						|
                    );
 | 
						|
                }
 | 
						|
 | 
						|
                function updateProgress() {
 | 
						|
                    var percentage = ((progressBar.hideEta - (new Date().getTime())) / progressBar.maxHideTime) * 100;
 | 
						|
                    $progressElement.width(percentage + '%');
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            function getOptions() {
 | 
						|
                return $.extend({}, getDefaults(), toastr.options);
 | 
						|
            }
 | 
						|
 | 
						|
            function removeToast($toastElement) {
 | 
						|
                if (!$container) { $container = getContainer(); }
 | 
						|
                if ($toastElement.is(':visible')) {
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
                $toastElement.remove();
 | 
						|
                $toastElement = null;
 | 
						|
                if ($container.children().length === 0) {
 | 
						|
                    $container.remove();
 | 
						|
                    previousToast = undefined;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
        })();
 | 
						|
    });
 | 
						|
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
 | 
						|
    if (typeof module !== 'undefined' && module.exports) { //Node
 | 
						|
        module.exports = factory((typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null));
 | 
						|
    } else {
 | 
						|
        window.toastr = factory(window.jQuery);
 | 
						|
    }
 | 
						|
}));
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],22:[function(require,module,exports){
 | 
						|
if (typeof Object.create === 'function') {
 | 
						|
  // implementation from standard node.js 'util' module
 | 
						|
  module.exports = function inherits(ctor, superCtor) {
 | 
						|
    ctor.super_ = superCtor
 | 
						|
    ctor.prototype = Object.create(superCtor.prototype, {
 | 
						|
      constructor: {
 | 
						|
        value: ctor,
 | 
						|
        enumerable: false,
 | 
						|
        writable: true,
 | 
						|
        configurable: true
 | 
						|
      }
 | 
						|
    });
 | 
						|
  };
 | 
						|
} else {
 | 
						|
  // old school shim for old browsers
 | 
						|
  module.exports = function inherits(ctor, superCtor) {
 | 
						|
    ctor.super_ = superCtor
 | 
						|
    var TempCtor = function () {}
 | 
						|
    TempCtor.prototype = superCtor.prototype
 | 
						|
    ctor.prototype = new TempCtor()
 | 
						|
    ctor.prototype.constructor = ctor
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
},{}],23:[function(require,module,exports){
 | 
						|
module.exports = function isBuffer(arg) {
 | 
						|
  return arg && typeof arg === 'object'
 | 
						|
    && typeof arg.copy === 'function'
 | 
						|
    && typeof arg.fill === 'function'
 | 
						|
    && typeof arg.readUInt8 === 'function';
 | 
						|
}
 | 
						|
},{}],24:[function(require,module,exports){
 | 
						|
(function (process,global){
 | 
						|
// Copyright Joyent, Inc. and other Node contributors.
 | 
						|
//
 | 
						|
// 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.
 | 
						|
 | 
						|
var formatRegExp = /%[sdj%]/g;
 | 
						|
exports.format = function(f) {
 | 
						|
  if (!isString(f)) {
 | 
						|
    var objects = [];
 | 
						|
    for (var i = 0; i < arguments.length; i++) {
 | 
						|
      objects.push(inspect(arguments[i]));
 | 
						|
    }
 | 
						|
    return objects.join(' ');
 | 
						|
  }
 | 
						|
 | 
						|
  var i = 1;
 | 
						|
  var args = arguments;
 | 
						|
  var len = args.length;
 | 
						|
  var str = String(f).replace(formatRegExp, function(x) {
 | 
						|
    if (x === '%%') return '%';
 | 
						|
    if (i >= len) return x;
 | 
						|
    switch (x) {
 | 
						|
      case '%s': return String(args[i++]);
 | 
						|
      case '%d': return Number(args[i++]);
 | 
						|
      case '%j':
 | 
						|
        try {
 | 
						|
          return JSON.stringify(args[i++]);
 | 
						|
        } catch (_) {
 | 
						|
          return '[Circular]';
 | 
						|
        }
 | 
						|
      default:
 | 
						|
        return x;
 | 
						|
    }
 | 
						|
  });
 | 
						|
  for (var x = args[i]; i < len; x = args[++i]) {
 | 
						|
    if (isNull(x) || !isObject(x)) {
 | 
						|
      str += ' ' + x;
 | 
						|
    } else {
 | 
						|
      str += ' ' + inspect(x);
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return str;
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
// Mark that a method should not be used.
 | 
						|
// Returns a modified function which warns once by default.
 | 
						|
// If --no-deprecation is set, then it is a no-op.
 | 
						|
exports.deprecate = function(fn, msg) {
 | 
						|
  // Allow for deprecating things in the process of starting up.
 | 
						|
  if (isUndefined(global.process)) {
 | 
						|
    return function() {
 | 
						|
      return exports.deprecate(fn, msg).apply(this, arguments);
 | 
						|
    };
 | 
						|
  }
 | 
						|
 | 
						|
  if (process.noDeprecation === true) {
 | 
						|
    return fn;
 | 
						|
  }
 | 
						|
 | 
						|
  var warned = false;
 | 
						|
  function deprecated() {
 | 
						|
    if (!warned) {
 | 
						|
      if (process.throwDeprecation) {
 | 
						|
        throw new Error(msg);
 | 
						|
      } else if (process.traceDeprecation) {
 | 
						|
        console.trace(msg);
 | 
						|
      } else {
 | 
						|
        console.error(msg);
 | 
						|
      }
 | 
						|
      warned = true;
 | 
						|
    }
 | 
						|
    return fn.apply(this, arguments);
 | 
						|
  }
 | 
						|
 | 
						|
  return deprecated;
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
var debugs = {};
 | 
						|
var debugEnviron;
 | 
						|
exports.debuglog = function(set) {
 | 
						|
  if (isUndefined(debugEnviron))
 | 
						|
    debugEnviron = process.env.NODE_DEBUG || '';
 | 
						|
  set = set.toUpperCase();
 | 
						|
  if (!debugs[set]) {
 | 
						|
    if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
 | 
						|
      var pid = process.pid;
 | 
						|
      debugs[set] = function() {
 | 
						|
        var msg = exports.format.apply(exports, arguments);
 | 
						|
        console.error('%s %d: %s', set, pid, msg);
 | 
						|
      };
 | 
						|
    } else {
 | 
						|
      debugs[set] = function() {};
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return debugs[set];
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * Echos the value of a value. Trys to print the value out
 | 
						|
 * in the best way possible given the different types.
 | 
						|
 *
 | 
						|
 * @param {Object} obj The object to print out.
 | 
						|
 * @param {Object} opts Optional options object that alters the output.
 | 
						|
 */
 | 
						|
/* legacy: obj, showHidden, depth, colors*/
 | 
						|
function inspect(obj, opts) {
 | 
						|
  // default options
 | 
						|
  var ctx = {
 | 
						|
    seen: [],
 | 
						|
    stylize: stylizeNoColor
 | 
						|
  };
 | 
						|
  // legacy...
 | 
						|
  if (arguments.length >= 3) ctx.depth = arguments[2];
 | 
						|
  if (arguments.length >= 4) ctx.colors = arguments[3];
 | 
						|
  if (isBoolean(opts)) {
 | 
						|
    // legacy...
 | 
						|
    ctx.showHidden = opts;
 | 
						|
  } else if (opts) {
 | 
						|
    // got an "options" object
 | 
						|
    exports._extend(ctx, opts);
 | 
						|
  }
 | 
						|
  // set default options
 | 
						|
  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
 | 
						|
  if (isUndefined(ctx.depth)) ctx.depth = 2;
 | 
						|
  if (isUndefined(ctx.colors)) ctx.colors = false;
 | 
						|
  if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
 | 
						|
  if (ctx.colors) ctx.stylize = stylizeWithColor;
 | 
						|
  return formatValue(ctx, obj, ctx.depth);
 | 
						|
}
 | 
						|
exports.inspect = inspect;
 | 
						|
 | 
						|
 | 
						|
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
 | 
						|
inspect.colors = {
 | 
						|
  'bold' : [1, 22],
 | 
						|
  'italic' : [3, 23],
 | 
						|
  'underline' : [4, 24],
 | 
						|
  'inverse' : [7, 27],
 | 
						|
  'white' : [37, 39],
 | 
						|
  'grey' : [90, 39],
 | 
						|
  'black' : [30, 39],
 | 
						|
  'blue' : [34, 39],
 | 
						|
  'cyan' : [36, 39],
 | 
						|
  'green' : [32, 39],
 | 
						|
  'magenta' : [35, 39],
 | 
						|
  'red' : [31, 39],
 | 
						|
  'yellow' : [33, 39]
 | 
						|
};
 | 
						|
 | 
						|
// Don't use 'blue' not visible on cmd.exe
 | 
						|
inspect.styles = {
 | 
						|
  'special': 'cyan',
 | 
						|
  'number': 'yellow',
 | 
						|
  'boolean': 'yellow',
 | 
						|
  'undefined': 'grey',
 | 
						|
  'null': 'bold',
 | 
						|
  'string': 'green',
 | 
						|
  'date': 'magenta',
 | 
						|
  // "name": intentionally not styling
 | 
						|
  'regexp': 'red'
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
function stylizeWithColor(str, styleType) {
 | 
						|
  var style = inspect.styles[styleType];
 | 
						|
 | 
						|
  if (style) {
 | 
						|
    return '\u001b[' + inspect.colors[style][0] + 'm' + str +
 | 
						|
           '\u001b[' + inspect.colors[style][1] + 'm';
 | 
						|
  } else {
 | 
						|
    return str;
 | 
						|
  }
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function stylizeNoColor(str, styleType) {
 | 
						|
  return str;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function arrayToHash(array) {
 | 
						|
  var hash = {};
 | 
						|
 | 
						|
  array.forEach(function(val, idx) {
 | 
						|
    hash[val] = true;
 | 
						|
  });
 | 
						|
 | 
						|
  return hash;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function formatValue(ctx, value, recurseTimes) {
 | 
						|
  // Provide a hook for user-specified inspect functions.
 | 
						|
  // Check that value is an object with an inspect function on it
 | 
						|
  if (ctx.customInspect &&
 | 
						|
      value &&
 | 
						|
      isFunction(value.inspect) &&
 | 
						|
      // Filter out the util module, it's inspect function is special
 | 
						|
      value.inspect !== exports.inspect &&
 | 
						|
      // Also filter out any prototype objects using the circular check.
 | 
						|
      !(value.constructor && value.constructor.prototype === value)) {
 | 
						|
    var ret = value.inspect(recurseTimes, ctx);
 | 
						|
    if (!isString(ret)) {
 | 
						|
      ret = formatValue(ctx, ret, recurseTimes);
 | 
						|
    }
 | 
						|
    return ret;
 | 
						|
  }
 | 
						|
 | 
						|
  // Primitive types cannot have properties
 | 
						|
  var primitive = formatPrimitive(ctx, value);
 | 
						|
  if (primitive) {
 | 
						|
    return primitive;
 | 
						|
  }
 | 
						|
 | 
						|
  // Look up the keys of the object.
 | 
						|
  var keys = Object.keys(value);
 | 
						|
  var visibleKeys = arrayToHash(keys);
 | 
						|
 | 
						|
  if (ctx.showHidden) {
 | 
						|
    keys = Object.getOwnPropertyNames(value);
 | 
						|
  }
 | 
						|
 | 
						|
  // IE doesn't make error fields non-enumerable
 | 
						|
  // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
 | 
						|
  if (isError(value)
 | 
						|
      && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
 | 
						|
    return formatError(value);
 | 
						|
  }
 | 
						|
 | 
						|
  // Some type of object without properties can be shortcutted.
 | 
						|
  if (keys.length === 0) {
 | 
						|
    if (isFunction(value)) {
 | 
						|
      var name = value.name ? ': ' + value.name : '';
 | 
						|
      return ctx.stylize('[Function' + name + ']', 'special');
 | 
						|
    }
 | 
						|
    if (isRegExp(value)) {
 | 
						|
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
 | 
						|
    }
 | 
						|
    if (isDate(value)) {
 | 
						|
      return ctx.stylize(Date.prototype.toString.call(value), 'date');
 | 
						|
    }
 | 
						|
    if (isError(value)) {
 | 
						|
      return formatError(value);
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  var base = '', array = false, braces = ['{', '}'];
 | 
						|
 | 
						|
  // Make Array say that they are Array
 | 
						|
  if (isArray(value)) {
 | 
						|
    array = true;
 | 
						|
    braces = ['[', ']'];
 | 
						|
  }
 | 
						|
 | 
						|
  // Make functions say that they are functions
 | 
						|
  if (isFunction(value)) {
 | 
						|
    var n = value.name ? ': ' + value.name : '';
 | 
						|
    base = ' [Function' + n + ']';
 | 
						|
  }
 | 
						|
 | 
						|
  // Make RegExps say that they are RegExps
 | 
						|
  if (isRegExp(value)) {
 | 
						|
    base = ' ' + RegExp.prototype.toString.call(value);
 | 
						|
  }
 | 
						|
 | 
						|
  // Make dates with properties first say the date
 | 
						|
  if (isDate(value)) {
 | 
						|
    base = ' ' + Date.prototype.toUTCString.call(value);
 | 
						|
  }
 | 
						|
 | 
						|
  // Make error with message first say the error
 | 
						|
  if (isError(value)) {
 | 
						|
    base = ' ' + formatError(value);
 | 
						|
  }
 | 
						|
 | 
						|
  if (keys.length === 0 && (!array || value.length == 0)) {
 | 
						|
    return braces[0] + base + braces[1];
 | 
						|
  }
 | 
						|
 | 
						|
  if (recurseTimes < 0) {
 | 
						|
    if (isRegExp(value)) {
 | 
						|
      return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
 | 
						|
    } else {
 | 
						|
      return ctx.stylize('[Object]', 'special');
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  ctx.seen.push(value);
 | 
						|
 | 
						|
  var output;
 | 
						|
  if (array) {
 | 
						|
    output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
 | 
						|
  } else {
 | 
						|
    output = keys.map(function(key) {
 | 
						|
      return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
 | 
						|
    });
 | 
						|
  }
 | 
						|
 | 
						|
  ctx.seen.pop();
 | 
						|
 | 
						|
  return reduceToSingleString(output, base, braces);
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function formatPrimitive(ctx, value) {
 | 
						|
  if (isUndefined(value))
 | 
						|
    return ctx.stylize('undefined', 'undefined');
 | 
						|
  if (isString(value)) {
 | 
						|
    var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
 | 
						|
                                             .replace(/'/g, "\\'")
 | 
						|
                                             .replace(/\\"/g, '"') + '\'';
 | 
						|
    return ctx.stylize(simple, 'string');
 | 
						|
  }
 | 
						|
  if (isNumber(value))
 | 
						|
    return ctx.stylize('' + value, 'number');
 | 
						|
  if (isBoolean(value))
 | 
						|
    return ctx.stylize('' + value, 'boolean');
 | 
						|
  // For some reason typeof null is "object", so special case here.
 | 
						|
  if (isNull(value))
 | 
						|
    return ctx.stylize('null', 'null');
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function formatError(value) {
 | 
						|
  return '[' + Error.prototype.toString.call(value) + ']';
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
 | 
						|
  var output = [];
 | 
						|
  for (var i = 0, l = value.length; i < l; ++i) {
 | 
						|
    if (hasOwnProperty(value, String(i))) {
 | 
						|
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
 | 
						|
          String(i), true));
 | 
						|
    } else {
 | 
						|
      output.push('');
 | 
						|
    }
 | 
						|
  }
 | 
						|
  keys.forEach(function(key) {
 | 
						|
    if (!key.match(/^\d+$/)) {
 | 
						|
      output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
 | 
						|
          key, true));
 | 
						|
    }
 | 
						|
  });
 | 
						|
  return output;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
 | 
						|
  var name, str, desc;
 | 
						|
  desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
 | 
						|
  if (desc.get) {
 | 
						|
    if (desc.set) {
 | 
						|
      str = ctx.stylize('[Getter/Setter]', 'special');
 | 
						|
    } else {
 | 
						|
      str = ctx.stylize('[Getter]', 'special');
 | 
						|
    }
 | 
						|
  } else {
 | 
						|
    if (desc.set) {
 | 
						|
      str = ctx.stylize('[Setter]', 'special');
 | 
						|
    }
 | 
						|
  }
 | 
						|
  if (!hasOwnProperty(visibleKeys, key)) {
 | 
						|
    name = '[' + key + ']';
 | 
						|
  }
 | 
						|
  if (!str) {
 | 
						|
    if (ctx.seen.indexOf(desc.value) < 0) {
 | 
						|
      if (isNull(recurseTimes)) {
 | 
						|
        str = formatValue(ctx, desc.value, null);
 | 
						|
      } else {
 | 
						|
        str = formatValue(ctx, desc.value, recurseTimes - 1);
 | 
						|
      }
 | 
						|
      if (str.indexOf('\n') > -1) {
 | 
						|
        if (array) {
 | 
						|
          str = str.split('\n').map(function(line) {
 | 
						|
            return '  ' + line;
 | 
						|
          }).join('\n').substr(2);
 | 
						|
        } else {
 | 
						|
          str = '\n' + str.split('\n').map(function(line) {
 | 
						|
            return '   ' + line;
 | 
						|
          }).join('\n');
 | 
						|
        }
 | 
						|
      }
 | 
						|
    } else {
 | 
						|
      str = ctx.stylize('[Circular]', 'special');
 | 
						|
    }
 | 
						|
  }
 | 
						|
  if (isUndefined(name)) {
 | 
						|
    if (array && key.match(/^\d+$/)) {
 | 
						|
      return str;
 | 
						|
    }
 | 
						|
    name = JSON.stringify('' + key);
 | 
						|
    if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
 | 
						|
      name = name.substr(1, name.length - 2);
 | 
						|
      name = ctx.stylize(name, 'name');
 | 
						|
    } else {
 | 
						|
      name = name.replace(/'/g, "\\'")
 | 
						|
                 .replace(/\\"/g, '"')
 | 
						|
                 .replace(/(^"|"$)/g, "'");
 | 
						|
      name = ctx.stylize(name, 'string');
 | 
						|
    }
 | 
						|
  }
 | 
						|
 | 
						|
  return name + ': ' + str;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function reduceToSingleString(output, base, braces) {
 | 
						|
  var numLinesEst = 0;
 | 
						|
  var length = output.reduce(function(prev, cur) {
 | 
						|
    numLinesEst++;
 | 
						|
    if (cur.indexOf('\n') >= 0) numLinesEst++;
 | 
						|
    return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
 | 
						|
  }, 0);
 | 
						|
 | 
						|
  if (length > 60) {
 | 
						|
    return braces[0] +
 | 
						|
           (base === '' ? '' : base + '\n ') +
 | 
						|
           ' ' +
 | 
						|
           output.join(',\n  ') +
 | 
						|
           ' ' +
 | 
						|
           braces[1];
 | 
						|
  }
 | 
						|
 | 
						|
  return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// NOTE: These type checking functions intentionally don't use `instanceof`
 | 
						|
// because it is fragile and can be easily faked with `Object.create()`.
 | 
						|
function isArray(ar) {
 | 
						|
  return Array.isArray(ar);
 | 
						|
}
 | 
						|
exports.isArray = isArray;
 | 
						|
 | 
						|
function isBoolean(arg) {
 | 
						|
  return typeof arg === 'boolean';
 | 
						|
}
 | 
						|
exports.isBoolean = isBoolean;
 | 
						|
 | 
						|
function isNull(arg) {
 | 
						|
  return arg === null;
 | 
						|
}
 | 
						|
exports.isNull = isNull;
 | 
						|
 | 
						|
function isNullOrUndefined(arg) {
 | 
						|
  return arg == null;
 | 
						|
}
 | 
						|
exports.isNullOrUndefined = isNullOrUndefined;
 | 
						|
 | 
						|
function isNumber(arg) {
 | 
						|
  return typeof arg === 'number';
 | 
						|
}
 | 
						|
exports.isNumber = isNumber;
 | 
						|
 | 
						|
function isString(arg) {
 | 
						|
  return typeof arg === 'string';
 | 
						|
}
 | 
						|
exports.isString = isString;
 | 
						|
 | 
						|
function isSymbol(arg) {
 | 
						|
  return typeof arg === 'symbol';
 | 
						|
}
 | 
						|
exports.isSymbol = isSymbol;
 | 
						|
 | 
						|
function isUndefined(arg) {
 | 
						|
  return arg === void 0;
 | 
						|
}
 | 
						|
exports.isUndefined = isUndefined;
 | 
						|
 | 
						|
function isRegExp(re) {
 | 
						|
  return isObject(re) && objectToString(re) === '[object RegExp]';
 | 
						|
}
 | 
						|
exports.isRegExp = isRegExp;
 | 
						|
 | 
						|
function isObject(arg) {
 | 
						|
  return typeof arg === 'object' && arg !== null;
 | 
						|
}
 | 
						|
exports.isObject = isObject;
 | 
						|
 | 
						|
function isDate(d) {
 | 
						|
  return isObject(d) && objectToString(d) === '[object Date]';
 | 
						|
}
 | 
						|
exports.isDate = isDate;
 | 
						|
 | 
						|
function isError(e) {
 | 
						|
  return isObject(e) &&
 | 
						|
      (objectToString(e) === '[object Error]' || e instanceof Error);
 | 
						|
}
 | 
						|
exports.isError = isError;
 | 
						|
 | 
						|
function isFunction(arg) {
 | 
						|
  return typeof arg === 'function';
 | 
						|
}
 | 
						|
exports.isFunction = isFunction;
 | 
						|
 | 
						|
function isPrimitive(arg) {
 | 
						|
  return arg === null ||
 | 
						|
         typeof arg === 'boolean' ||
 | 
						|
         typeof arg === 'number' ||
 | 
						|
         typeof arg === 'string' ||
 | 
						|
         typeof arg === 'symbol' ||  // ES6 symbol
 | 
						|
         typeof arg === 'undefined';
 | 
						|
}
 | 
						|
exports.isPrimitive = isPrimitive;
 | 
						|
 | 
						|
exports.isBuffer = require('./support/isBuffer');
 | 
						|
 | 
						|
function objectToString(o) {
 | 
						|
  return Object.prototype.toString.call(o);
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
function pad(n) {
 | 
						|
  return n < 10 ? '0' + n.toString(10) : n.toString(10);
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
 | 
						|
              'Oct', 'Nov', 'Dec'];
 | 
						|
 | 
						|
// 26 Feb 16:19:34
 | 
						|
function timestamp() {
 | 
						|
  var d = new Date();
 | 
						|
  var time = [pad(d.getHours()),
 | 
						|
              pad(d.getMinutes()),
 | 
						|
              pad(d.getSeconds())].join(':');
 | 
						|
  return [d.getDate(), months[d.getMonth()], time].join(' ');
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
// log is just a thin wrapper to console.log that prepends a timestamp
 | 
						|
exports.log = function() {
 | 
						|
  console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * Inherit the prototype methods from one constructor into another.
 | 
						|
 *
 | 
						|
 * The Function.prototype.inherits from lang.js rewritten as a standalone
 | 
						|
 * function (not on Function.prototype). NOTE: If this file is to be loaded
 | 
						|
 * during bootstrapping this function needs to be rewritten using some native
 | 
						|
 * functions as prototype setup using normal JavaScript does not work as
 | 
						|
 * expected during bootstrapping (see mirror.js in r114903).
 | 
						|
 *
 | 
						|
 * @param {function} ctor Constructor function which needs to inherit the
 | 
						|
 *     prototype.
 | 
						|
 * @param {function} superCtor Constructor function to inherit prototype from.
 | 
						|
 */
 | 
						|
exports.inherits = require('inherits');
 | 
						|
 | 
						|
exports._extend = function(origin, add) {
 | 
						|
  // Don't do anything if add isn't an object
 | 
						|
  if (!add || !isObject(add)) return origin;
 | 
						|
 | 
						|
  var keys = Object.keys(add);
 | 
						|
  var i = keys.length;
 | 
						|
  while (i--) {
 | 
						|
    origin[keys[i]] = add[keys[i]];
 | 
						|
  }
 | 
						|
  return origin;
 | 
						|
};
 | 
						|
 | 
						|
function hasOwnProperty(obj, prop) {
 | 
						|
  return Object.prototype.hasOwnProperty.call(obj, prop);
 | 
						|
}
 | 
						|
 | 
						|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./support/isBuffer":23,"_process":18,"inherits":22}],25:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var templateLoader=require("./template-loader.js"),console=require('console-browserify'),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null);require("./ko-bindings.js");var performanceAwareCaller=require("./timed-call.js").timedCall,addUndoStackExtensionMaker=require("./undomanager/undomain.js"),colorPlugin=require("./ext/color.js"),utilPlugin=require("./ext/util.js"),inlinerPlugin=require("./ext/inliner.js"),localStorageLoader=require("./ext/localstorage.js");if(void 0===ko)throw"Cannot find knockout.js library!";if(void 0===$)throw"Cannot find jquery library!";function _canonicalize(e){var i=global.document.createElement("div");return i.innerHTML="<a></a>",i.firstChild.href=e,i.innerHTML=i.innerHTML,i.firstChild.href}function _appendUrlParameters(e,i){var a=-1==e.indexOf("?")?"?":"&",t=e;for(var n in i)i.hasOwnProperty(n)&&(t+=a+n+"="+encodeURIComponent(i[n]),a="&");return t}var applyBindingOptions=function(e,i){i.bindingHandlers.wysiwygSrc.convertedUrl=function(i,a,t,n){var r=e.imgProcessorBackend?e.imgProcessorBackend:"./upload",o=r.match(/^(https?:\/\/[^\/]*\/).*$/),l=i.match(/^(https?:\/\/[^\/]*\/).*$/);if(null===o||null!==l&&o[1]==l[1])return-1==r.indexOf("?")?"?":"&",_appendUrlParameters(r,{src:i,method:a,params:t+","+n});console.log("Cannot apply backend image resizing to non-local resources ",i,a,t,n,o,l);var s={method:a,width:t};return null!==n&&(s.height=n),_appendUrlParameters(i,s)},i.bindingHandlers.wysiwygSrc.placeholderUrl=function(i,a,t){return _appendUrlParameters(e.imgProcessorBackend?e.imgProcessorBackend:"./upload",{method:"placeholder",params:i+","+a})},e&&e.tinymceConfig&&(i.bindingHandlers.wysiwyg.standardOptions=e.tinymceConfig),e&&e.tinymceConfigFull&&(i.bindingHandlers.wysiwyg.fullOptions=e.tinymceConfigFull)},start=function(e,i,a,t,n){templateLoader.fixPageEvents();var r=[function(i){e&&e.strings&&(i.t=function(a,t){var n=e.strings[a];return void 0===n&&(console.warn("Missing translation string for",a,": using default string"),n=a),i.tt(n,t)})},addUndoStackExtensionMaker(performanceAwareCaller),colorPlugin,utilPlugin,inlinerPlugin];if(void 0!==n)for(var o=0;o<n.length;o++)r.push(n[o]);r.push(function(i){var a={messages:{unknownError:i.t("Unknown error"),uploadedBytes:i.t("Uploaded bytes exceed file size"),maxNumberOfFiles:i.t("Maximum number of files exceeded"),acceptFileTypes:i.t("File type not allowed"),maxFileSize:i.t("File is too large"),minFileSize:i.t("File is too small"),post_max_size:i.t("The uploaded file exceeds the post_max_size directive in php.ini"),max_file_size:i.t("File is too big"),min_file_size:i.t("File is too small"),accept_file_types:i.t("Filetype not allowed"),max_number_of_files:i.t("Maximum number of files exceeded"),max_width:i.t("Image exceeds maximum width"),min_width:i.t("Image requires a minimum width"),max_height:i.t("Image exceeds maximum height"),min_height:i.t("Image requires a minimum height"),abort:i.t("File upload aborted"),image_resize:i.t("Failed to resize image"),generic:i.t("Unexpected upload error")}};e&&e.fileuploadConfig&&(a=$.extend(!0,a,e.fileuploadConfig)),ko.bindingHandlers.fileupload.extendOptions=a});var l=e.fileuploadConfig?e.fileuploadConfig.url:"/upload/";applyBindingOptions(e,ko),$("\x3c!-- ko template: 'main' --\x3e\x3c!-- /ko --\x3e").appendTo(global.document.body),void 0===i&&void 0!==a&&(i=a.template),templateLoader.load(performanceAwareCaller,i,a,t,r,l)},initFromLocalStorage=function(e,i,a){try{var t=localStorageLoader(i,e.emailProcessorBackend),n=void 0!==a?a:[];n.push(t.extension);var r=_canonicalize(t.metadata.template);start(e,r,t.metadata,t.model,n)}catch(e){console.error("TODO not found ",i,e)}},init=function(e,i){var a=global.location.hash?global.location.href.split("#")[1]:void 0;if(e&&(e.template||e.data))if(e.data){var t=JSON.parse(e.data);start(e,void 0,t.metadata,t.content,i)}else start(e,e.template,void 0,void 0,i);else if(a&&7==a.length)initFromLocalStorage(e,a,i);else{if(!a)return!1;start(e,_canonicalize(a),void 0,void 0,i)}return!0};module.exports={isCompatible:templateLoader.isCompatible,init:init,start:start};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./ext/color.js":57,"./ext/inliner.js":58,"./ext/localstorage.js":59,"./ext/util.js":60,"./ko-bindings.js":61,"./template-loader.js":62,"./timed-call.js":63,"./undomanager/undomain.js":64,"console-browserify":3}],26:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify'),addScriptTemplate=function(t,e,n){var o=t.createElement("script");return o.setAttribute("type","text/html"),o.setAttribute("id",e),o.text=n,t.body.appendChild(o),o};ko.bindingHandlers.bindIframe={tpl:'<!DOCTYPE html>\r\n<html>\r\n<head>\r\n</head>\r\n<body><div data-bind="block: content"></div></body>\r\n</html>\r\n',init:function(t,e){!function(n){try{var o=t.contentDocument;o.open(),o.write(ko.bindingHandlers.bindIframe.tpl),o.close();try{var r=o.body;if(r){for(var i=t.contentWindow.parent.document.getElementsByTagName("script"),a=0;a<i.length;a++)"text/html"==i[a].getAttribute("type")&&i[a].getAttribute("id")&&addScriptTemplate(o,i[a].getAttribute("id"),i[a].innerHTML);var d=o.getElementsByTagName("HTML");ko.utils.domNodeDisposal.addDisposeCallback(t,function(){ko.cleanNode(d[0]||r)}),ko.applyBindings(e(),d[0]||r)}else console.log("no iframedoc",n)}catch(t){throw console.log("error reading iframe.body",t,n),t}}catch(t){throw console.log("error reading iframe contentDocument",t,n),t}}("first call")}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],27:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');ko.bindingHandlers.withProperties={init:function(e,n,o,t,l){var a=l.createChildContext(l.$rawData,null,function(e){ko.utils.extend(e,n())});return ko.applyBindingsToDescendants(a,e),{controlsDescendantBindings:!0}}},ko.virtualElements.allowedBindings.withProperties=!0,ko.bindingHandlers.log={init:function(e,n,o,t,l){console.log("log",n())}},ko.bindingHandlers.block={templateExists:function(e){return!!global.document.getElementById(e)},_chooseTemplate:function(e,n,o,t){var l=n+"-"+o;if(ko.bindingHandlers.block.templateExists(l))return l;if(void 0!==t&&null!==t)return ko.bindingHandlers.block._chooseTemplate(e,n,t);var a=e?"array":"object-"+o;if(ko.bindingHandlers.block.templateExists(a))return a;throw"cannot find template for "+l+"/"+a},_displayMode:function(e,n){var o=void 0!==e.type?ko.utils.unwrapObservable(e.type):"notablock-"+typeof e,t=void 0!==e.splice,l=n.templateMode?n.templateMode:"show";return ko.bindingHandlers.block._chooseTemplate(t,o,l,n.templateModeFallback)},_makeTemplateValueAccessor:function(e,n){return function(){var o,t,l=e(),a=ko.utils.peekObservable(l);if(!a||"object"!=typeof a.data&&"function"!=typeof a.data)o=l;else if(o=a.data,void 0!==a.template){var i=ko.utils.unwrapObservable(a.template),r=n.templateMode?n.templateMode:"show";t=ko.bindingHandlers.block._chooseTemplate(!1,i,r,n.templateModeFallback)}var s=ko.utils.unwrapObservable(o);if(ko.isObservable(s)&&console.log("doubleObservable",s),void 0===t)if(void 0===o)t="empty";else try{t=ko.bindingHandlers.block._displayMode(s,n)}catch(e){throw console.log(e,s,n.$data,n.templateMode),e}return{name:t,data:o,templateEngine:ko.nativeTemplateEngine.instance}}},init:function(e,n,o,t,l){void 0===n()&&console.log("found a null block: check ending commas in arrays defs in IE");var a=ko.bindingHandlers.block._makeTemplateValueAccessor(n,l);return ko.bindingHandlers.template.init(e,a)},update:function(e,n,o,t,l){var a=ko.bindingHandlers.block._makeTemplateValueAccessor(n,l);return ko.bindingHandlers.template.update(e,a,o,t,l)}},ko.expressionRewriting.bindingRewriteValidators.block=!1,ko.virtualElements.allowedBindings.block=!0;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],28:[function(require,module,exports){
 | 
						|
"use strict";module.exports=require("./string-template.js");
 | 
						|
 | 
						|
},{"./string-template.js":42}],29:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";require('evol.colorpicker/js/evol.colorpicker.min.js');var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),kojqui=(typeof window !== "undefined" ? window['kojqui'] : typeof global !== "undefined" ? global['kojqui'] : null),ColorPicker=function(){kojqui.BindingHandler.call(this,"colorpicker")};ColorPicker.prototype=kojqui.utils.createObject(kojqui.BindingHandler.prototype),ColorPicker.prototype.constructor=ColorPicker,ColorPicker.prototype.init=function(o,r,e){var i=r(),t=i.color,c=ko.computed({read:t,write:t,disposeWhenNodeIsRemoved:o});ko.bindingHandlers.value.init(o,function(){return c},e);var n=function(o,r){void 0!==r&&c(r)};$(o).on("change.color",n),ko.computed({read:function(){var r={color:ko.utils.unwrapObservable(c),showOn:"button"};for(var e in i)"color"!==e&&i.hasOwnProperty(e)&&(r[e]=ko.utils.unwrapObservable(i[e]));$(o).colorpicker(r)},disposeWhenNodeIsRemoved:o}),ko.utils.domNodeDisposal.addDisposeCallback(o,function(){$(o).off("change.color",n),$(o).colorpicker("destroy")})},kojqui.utils.register(ColorPicker);
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"evol.colorpicker/js/evol.colorpicker.min.js":5}],30:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null);ko.bindingHandlers.cssText={update:function(e,t,n){var r=ko.utils.unwrapObservable(t());try{e.innerText=r}catch(t){e.styleSheet||(e.innerHTML="a{}"),e.styleSheet.cssText=r}}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],31:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null);!function(e,t){e.utils.unwrapObservable;var o=e.utils.domData.get;e.utils.domData.set,e.bindingHandlers.droppable={init:function(a,n,d,i,l){var r,s=t(a),p=e.utils.unwrapObservable(n())||{},u={};t.extend(!0,u,e.bindingHandlers.droppable),p.data?(p.options&&u.options&&(e.utils.extend(u.options,p.options),delete p.options),e.utils.extend(u,p)):u.data=p,r=u.options.drop,s.droppable(e.utils.extend(u.options,{drop:function(e,t){var a=t.draggable[0],n=o(a,"ko_sortItem")||o(a,"ko_dragItem");n&&(n.clone&&(n=n.clone()),u.dragged&&(n=u.dragged.call(this,n,e,t)||n),u.data&&u.data(n)),r&&r.apply(this,arguments)}})),void 0!==u.isEnabled&&e.computed({read:function(){s.droppable(e.utils.unwrapObservable(u.isEnabled)?"enable":"disable")},disposeWhenNodeIsRemoved:a})},update:function(e,t,o,a,n){},targetIndex:null,afterMove:null,beforeMove:null,options:{}}}(ko,$);
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],32:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),console=require('console-browserify');ko.bindingHandlers.focusable={focus:function(){},blur:function(){},init:function(o){ko.utils.domNodeDisposal.addDisposeCallback(o,function(){$(o).off("focusin",ko.bindingHandlers.focusable.focus),$(o).off("focusout",ko.bindingHandlers.focusable.blur)}),$(o).on("focusin",ko.bindingHandlers.focusable.focus),$(o).on("focusout",ko.bindingHandlers.focusable.blur)}},ko.bindingHandlers.scrollable={scroll:function(){},init:function(o){ko.utils.domNodeDisposal.addDisposeCallback(o,function(){$(o).off("scroll",ko.bindingHandlers.scrollable.scroll)}),$(o).on("scroll",ko.bindingHandlers.scrollable.scroll)}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],33:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null);ko.extenders.paging=function(e,t){var n=ko.observable(t||10),r=ko.observable(1);return e.pageSize=ko.computed({read:n,write:function(e){n(e>0?e:10)}}),e.currentPage=ko.computed({read:r,write:function(t){t>e.pageCount()?r(e.pageCount()):r(t<=0?1:t)}}),e.pageCount=ko.computed(function(){return Math.ceil(e().length/e.pageSize())||1}),e.currentPageData=ko.computed(function(){var t=n(),o=r(),u=t*(o-1),a=t*o;return e().slice(u,a)}),e.moveFirst=function(){e.currentPage(1)},e.movePrevious=function(){e.currentPage(e.currentPage()-1)},e.moveNext=function(){e.currentPage(e.currentPage()+1)},e.moveLast=function(){e.currentPage(e.pageCount())},e};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],34:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),sortable=(typeof window !== "undefined" ? window['jQuery']['ui']['sortable'] : typeof global !== "undefined" ? global['jQuery']['ui']['sortable'] : null),draggable=(typeof window !== "undefined" ? window['jQuery']['ui']['draggable'] : typeof global !== "undefined" ? global['jQuery']['ui']['draggable'] : null),console=require('console-browserify');if(require("knockout-sortable"),void 0===sortable)throw"Cannot find jquery-ui sortable widget dependency!";if(void 0===draggable)throw"Cannot find jquery-ui sortable widget dependency!";var isDraggingHelper=function(e,r){e()?r.type==e()+"stop"&&e(!1):"dragstart"!=r.type&&"sortstart"!=r.type||e(r.type.substring(0,4))},makeExtendedValueAccessor=function(e){return function(){var r=e();ko.utils.peekObservable(r);ko.utils.unwrapObservable(r),"undefined"==r.options&&(r.options={});var n=r.options.start;r.options.start=function(e,i){if(void 0!==r.dragging&&ko.isWritableObservable(r.dragging)&&isDraggingHelper(r.dragging,e),void 0!==r.dropContainer&&(r.scrollInterval=global.setInterval(function(){var e=$(r.dropContainer).scrollTop();$(r.dropContainer).scrollTop(e+r.adding)},20)),void 0!==n)return n(e,i)};var i=r.options.stop;r.options.stop=function(e,n){if(void 0!==r.dragging&&ko.isWritableObservable(r.dragging)&&isDraggingHelper(r.dragging,e),void 0!==r.dropContainer&&global.clearInterval(r.scrollInterval),void 0!==i)return i(e,n)};var o=r.options.drag;return r.options.drag=function(e,n){if(void 0!==r.dropContainer){var i=e.pageY-$(r.dropContainer).offset().top,t=i-$(r.dropContainer).height();r.adding=i<-20?-20:i<0?-10:i<10?-5:t>20?20:t>0?10:t>-10?5:0}if(void 0!==o)return o(e,n)},r}};ko.bindingHandlers.extsortable={init:function(e,r,n,i,o){return ko.bindingHandlers.sortable.init(e,makeExtendedValueAccessor(r),n,i,o)},update:function(e,r,n,i,o){return ko.bindingHandlers.sortable.update(e,makeExtendedValueAccessor(r),n,i,o)}},ko.bindingHandlers.extdraggable={init:function(e,r,n,i,o){return ko.bindingHandlers.draggable.init(e,makeExtendedValueAccessor(r),n,i,o)},update:function(e,r,n,i,o){return ko.bindingHandlers.draggable.update(e,makeExtendedValueAccessor(r),n,i,o)}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3,"knockout-sortable":11}],35:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');ko.bindingHandlers.preloader={init:function(e,i){var o=i();if(void 0===o.preloaded){o.preloaded=ko.observable("");var r=function(e){if(e!=o.preloaded())if(""!==e){var i=new Image;i.onload=function(){o.preloaded(e)},i.onerror=function(){o.preloaded(e)},i.src=e}else o.preloaded(e)};o.subscribe(r),r(o())}}},ko.bindingHandlers.advattr={init:function(e,i,o,r,l){var a=ko.utils.unwrapObservable(i()||{});ko.utils.objectForEach(a,function(i,o){var r=e.getAttribute(i);if(ko.isWriteableObservable(o)){var l=o();l!=r&&(o(r),null!==l&&console.log("AdvAttr found a value different from the default",i,l,r))}})},update:function(e,i,o){var r=ko.utils.unwrapObservable(i())||{};ko.utils.objectForEach(r,function(i,o){!1===(o=ko.utils.unwrapObservable(o))||null===o||void 0===o?e.removeAttribute(i):e.setAttribute(i,o.toString())})}},ko.bindingHandlers.advstyle={init:function(e,i,o,r,l){var a=ko.utils.unwrapObservable(i()||{});ko.utils.objectForEach(a,function(i,o){var r;if(i.match(/Px$/)?(i=i.substr(0,i.length-2),(r=e.style[i]).match(/px$/)?r=r.replace(/px$/,""):console.log("AdvStyle binding found an unexpected default value",i,r,e)):r=e.style[i],ko.isWriteableObservable(o)){var l=o();l!=r&&(o(r),null!==l&&console.log("AdvStyle found a value different from the default",i,l,r))}})},update:function(e,i){var o=ko.utils.unwrapObservable(i()||{});ko.utils.objectForEach(o,function(i,o){null!==(o=ko.utils.unwrapObservable(o))&&void 0!==o&&!1!==o||(o=""),i.match(/Px$/)&&(i=i.substr(0,i.length-2),o+="px"),e.style[i]=o})}},ko.bindingHandlers.domlog={init:function(e,i){console.log("initialized",e),ko.utils.domNodeDisposal.addDisposeCallback(e,function(){console.log("disposed",e)})}},ko.bindingHandlers.fudroppable={init:function(e,i){var o=i()||{},r={},l=function(e,i,o,r,l,a){e[i]?global.clearTimeout(e[i]):(void 0!==r&&o.classList.add(r),ko.isWriteableObservable(l)&&!l()&&l(!0));var t=function(){e[i]=null,void 0!==r&&o.classList.remove(r),ko.isWriteableObservable(l)&&l()&&l(!1)};"dragleave"==a.type?t():e[i]=global.setTimeout(t,500)};(o.active||o.activeClass)&&ko.utils.registerEventHandler(global,"dragover",l.bind(void 0,r,"activeTimeout",e,o.activeClass,o.active)),o.hoverClass&&ko.utils.registerEventHandler(e,"dragover dragenter dragleave",l.bind(void 0,r,"hoverTimeout",e,o.hoverClass,void 0))}},ko.bindingHandlers.fileupload={extendOptions:{},remoteFilePreprocessor:function(e){return e},init:function(e,i){ko.utils.domNodeDisposal.addDisposeCallback(e,function(){$(e).fileupload("destroy")}),global.webkitURL?$(e).attr("title"," "):$(e).attr("title","")},update:function(e,i){var o=i()||{},r=$(e),l=r.parents(".uploadzone"),a=o.data;o.data=void 0;var t=o.canvasPreview;ko.utils.extend(o,{url:"/upload/",dataType:"json",dropZone:l.find(".mo-uploadzone")[0],autoUpload:!0,acceptFileTypes:/(\.|\/)(gif|jpe?g|png)$/i,maxFileSize:1048576,disableImageResize:/Android(?!.*Chrome)|Opera/.test(global.navigator.userAgent),previewMaxWidth:200,previewMaxHeight:200,previewCrop:!1,replaceFileInput:!1,messages:{unknownError:"Unknown error",uploadedBytes:"Uploaded bytes exceed file size",maxNumberOfFiles:"Maximum number of files exceeded",acceptFileTypes:"File type not allowed",maxFileSize:"File is too large",minFileSize:"File is too small",post_max_size:"The uploaded file exceeds the post_max_size directive in php.ini",max_file_size:"File is too big",min_file_size:"File is too small",accept_file_types:"Filetype not allowed",max_number_of_files:"Maximum number of files exceeded",max_width:"Image exceeds maximum width",min_width:"Image requires a minimum width",max_height:"Image exceeds maximum height",min_height:"Image requires a minimum height",abort:"File upload aborted",image_resize:"Failed to resize image",generic:"Unexpected upload error"}}),ko.utils.extend(o,ko.bindingHandlers.fileupload.extendOptions);var n=0,s="",d=function(){0==--n&&(a&&a(s),s="",t&&(l.find("img").show(),l.find("canvas").remove()),l.removeClass("uploading"),l.find(".progress-bar").css("width",0))},u=function(e){if("object"==typeof o.messages&&null!==o.messages){var i=e.match(/^([^ ]+)(.*)$/);if(i&&void 0!==o.messages[i[1]])return o.messages[i[1]]+i[2]}return e};r.fileupload(o);for(var p=["fileuploadadd","fileuploadprocessalways","fileuploadprogressall","fileuploaddone","fileuploadfail"],f=function(e,i){if("fileuploadadd"==e.type&&n++,"fileuploadfail"==e.type&&(console.log("fileuploadfail",e,i),o.onerror&&(""===i.errorThrown&&"error"==i.textStatus?o.onerror(u("generic")):o.onerror(u("generic ("+i.errorThrown+")"))),d()),"fileuploaddone"==e.type)if(void 0!==i.result.files[0].url){if(o.onfile)for(var r=0;r<i.result.files.length;r++)i.result.files[r]=ko.bindingHandlers.fileupload.remoteFilePreprocessor(i.result.files[r]),o.onfile(i.result.files[r]);if(""===s&&(s=i.result.files[0].url),t){var a=new Image;a.onload=d,a.onerror=d,a.src=i.result.files[0].url}else d()}else void 0!==i.result.files[0].error?(console.log("remote error",e,i),o.onerror&&o.onerror(u(i.result.files[0].error)),d()):(console.log("unexpected error",e,i),o.onerror&&o.onerror(u("generic (Unexpected Error retrieving uploaded file)")),d());if("fileuploadprocessalways"==e.type){var p=i.index,f=i.files[p];if(f.preview&&0===p&&0===l.find("canvas").length){if(t){var c=$(f.preview).css("width","100%");l.find("img").hide(),l.prepend(c)}l.addClass("uploading"),l.find(".progress-bar").css("width",0)}f.error&&(o.onerror&&o.onerror(u(f.error)),d())}if("fileuploadprogressall"==e.type){var v=parseInt(i.loaded/i.total*100,10);l.find(".progress-bar").css("width",v+"%")}},c=p.length-1;c>=0;c--){var v=p[c];r.on(v,f)}$.support.fileInput||r.prop("disabled",!0).parent().addClass("disabled")}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],36:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var beforeSubscriptionProp,afterSubscriptionProp,ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');if(ko.bindingHandlers.ifSubs={cloneNodes:function(o,e){for(var i=0,r=o.length,n=[];i<r;i++){var s=o[i].cloneNode(!0);n.push(e?ko.cleanNode(s):s)}return n},init:function(o,e,i,r,n){var s,t,u=e();return void 0===u.data.subsCount&&ko.extenders.subscriptionsCount(u.data),ko.computed(function(){var i,r,b=ko.utils.unwrapObservable(e().data.subsCount),p=!t;r=-(void 0!==e().gutter?e().gutter:1),i=b+(s?r:0)>=ko.utils.unwrapObservable(u.threshold),void 0!==e().not&&e().not&&(i=!i),(p||i!==s)&&(p&&ko.computedContext.getDependenciesCount()&&(t=ko.bindingHandlers.ifSubs.cloneNodes(ko.virtualElements.childNodes(o),!0)),i?(p||ko.virtualElements.setDomNodeChildren(o,ko.bindingHandlers.ifSubs.cloneNodes(t)),ko.applyBindingsToDescendants(n,o)):ko.virtualElements.emptyNode(o),s=i)},null,{disposeWhenNodeIsRemoved:o}),{controlsDescendantBindings:!0}}},ko.virtualElements.allowedBindings.ifSubs=!0,"function"==typeof ko.subscription&&void 0!==ko.isWritableObservable)beforeSubscriptionProp="beforeSubscriptionAdd",afterSubscriptionProp="afterSubscriptionRemove";else if("3.2.0"==ko.version)beforeSubscriptionProp="va",afterSubscriptionProp="nb";else if("3.3.0"==ko.version)beforeSubscriptionProp="ja",afterSubscriptionProp="ua";else if("3.4.0"==ko.version)beforeSubscriptionProp="sa",afterSubscriptionProp="Ia";else if("3.4.1"==ko.version)beforeSubscriptionProp="sa",afterSubscriptionProp="Ia";else if("3.4.2"==ko.version)beforeSubscriptionProp="ua",afterSubscriptionProp="Ka";else{if("3.5.0-beta"!=ko.version)throw"Unsupported minimized Knockout version "+ko.version+" (supported DEBUG or minimized 3.2.0 ... 3.5.0-beta)";beforeSubscriptionProp="Pa",afterSubscriptionProp="ab"}ko.extenders.subscriptionsCount=function(o,e,i){if(void 0===o.subsCount){o.subsCount=ko.observable(o.getSubscriptionsCount()).extend({notify:"always"});var r=o[beforeSubscriptionProp],n=o[afterSubscriptionProp];o[beforeSubscriptionProp]=function(n){r&&r.call(o,n);var s=o.getSubscriptionsCount()+1;void 0!==e&&s!=e&&void 0!==i&&s!=i||o.subsCount(s)},o[afterSubscriptionProp]=function(r){n&&n.call(o,r);var s=o.getSubscriptionsCount();void 0!==e&&s!=e&&void 0!==i&&s!=i||o.subsCount(s)}}else console.log("already applied subscriptionCount to observable");return null};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],37:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),spinner=(typeof window !== "undefined" ? window['jQuery']['ui']['spinner'] : typeof global !== "undefined" ? global['jQuery']['ui']['spinner'] : null),console=require('console-browserify');if(void 0===spinner)throw"Cannot find jquery-ui spinner widget dependency!";$.widget("ui.spinner",spinner,{_adjustValue:function(i){this._super(i);var e=this.options;return i=parseFloat(i.toFixed(this._precision())),null!==e.max&&i>e.max?e.max:null!==e.min&&i<e.min?e.min:i}});
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],38:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),console=require('console-browserify'),tabs=(typeof window !== "undefined" ? window['jQuery']['ui']['tabs'] : typeof global !== "undefined" ? global['jQuery']['ui']['tabs'] : null);if(void 0===tabs)throw"Cannot find jquery-ui tabs widget dependency!";$.widget("ui.tabs",tabs,{_isLocal:function(e){return"true"==e.getAttribute("data-local")||this._superApply(arguments)}});
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],39:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";function pushTemplate(e,t){var n=global.document.createElement("script");n.setAttribute("type","text/html"),n.setAttribute("id",e),n.text=t,global.document.body.appendChild(n)}function removeTemplate(e){var t=global.document.getElementById(e);t&&t.parentNode.removeChild(t)}function init(){}function getTemplateContent(e){var t=global.document.getElementById(e);return t?t.innerHTML:void 0}module.exports={init:init,addTemplate:pushTemplate,removeTemplate:removeTemplate,getTemplateContent:getTemplateContent};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],40:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var timeout,ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),console=require('console-browserify'),tinymce=(typeof window !== "undefined" ? window['tinymce'] : typeof global !== "undefined" ? global['tinymce'] : null),render=function(){if(timeout=void 0,void 0!==tinymce.activeEditor&&null!==tinymce.activeEditor&&void 0!==tinymce.activeEditor.theme&&null!==tinymce.activeEditor.theme&&void 0!==tinymce.activeEditor.theme.panel&&null!==tinymce.activeEditor.theme.panel){(void 0!==tinymce.activeEditor.theme.panel._visible&&tinymce.activeEditor.theme.panel._visible&&tinymce.activeEditor.theme.panel._fixed||void 0!==tinymce.activeEditor.theme.panel.state&&tinymce.activeEditor.theme.panel.state.get("visible")&&tinymce.activeEditor.theme.panel.state.get("fixed"))&&tinymce.activeEditor.theme.panel.fixed(!1);var e=void 0!==tinymce.activeEditor.bodyElement?tinymce.activeEditor.bodyElement:tinymce.activeEditor.dom.settings.root_element;null!==e&&void 0!==e.classList&&e.classList.contains("mce-edit-focus")&&(tinymce.activeEditor.nodeChanged(),tinymce.activeEditor.theme.panel.visible(!0),tinymce.activeEditor.theme.panel.layoutRect().y<=40&&tinymce.activeEditor.theme.panel.moveBy(0,40-tinymce.activeEditor.theme.panel.layoutRect().y))}};ko.bindingHandlers.wysiwygScrollfix={scroll:function(e){timeout&&global.clearTimeout(timeout),timeout=global.setTimeout(render,50)},init:function(e){ko.utils.domNodeDisposal.addDisposeCallback(e,function(){$(e).off("scroll",ko.bindingHandlers.wysiwygScrollfix.scroll)}),$(e).on("scroll",ko.bindingHandlers.wysiwygScrollfix.scroll)}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],41:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify'),_scrollIntoView=function(o,e,l,r){var n=l.scrollTop(),t=n-r-(e?20:-20);if(void 0!==l[0].nodeType){var i={scrollTop:Math.round(t)+"px"},s=Math.round(Math.abs(t-n));l.stop().animate(i,s)}else l.scrollTop(t)};ko.bindingHandlers.scrollIntoView={update:function(o,e,l,r,n){if(ko.utils.unwrapObservable(e()))try{for(;8===o.nodeType;)o=o.nextSibling;if(8!==o.nodeType){var t,i=$(o).scrollParent(),s=!1;9==i[0].nodeType?(i=$(i[0].defaultView),t=0,s=!0):t=i.offset().top;var c=i.height(),a=i.scrollTop(),p=t+c,u=$(o),d=u.offset().top;s&&(d-=a);var f=u.height(),w=d+f;d>t&&d+f<p||(f<c?(d<t&&_scrollIntoView(o,!0,i,t-d),w>p&&_scrollIntoView(o,!1,i,p-w)):(d<t&&w<p&&_scrollIntoView(o,!1,i,p-w),d>t&&w>p&&_scrollIntoView(o,!0,i,t-d)))}}catch(o){console.log("TODO exception scrolling into view",o)}}},ko.virtualElements.allowedBindings.scrollIntoView=!0;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],42:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),origTemplateSystem=require("./script-template.js"),templates={};function createStringTemplateEngine(e){var t=e.makeTemplateSource;return e.makeTemplateSource=function(e){return void 0!==templates[e]?new ko.templateSources.stringTemplate(e,templates[e]):t(e)},e}function pushTemplate(e,t){templates[e]=t}function removeTemplate(e){void 0!==templates[e]?templates[e]=void 0:origTemplateSystem.removeTemplate(e)}function init(){ko.setTemplateEngine(createStringTemplateEngine(new ko.nativeTemplateEngine))}function getTemplateContent(e){return void 0!==templates[e]?templates[e]:origTemplateSystem.getTemplateContent(e)}ko.templateSources.stringTemplate=function(e,t){this.templateName=e,this.template=t,this._data={}},ko.utils.extend(ko.templateSources.stringTemplate.prototype,{data:function(e,t){if(1===arguments.length)return this._data[e];this._data[e]=t},text:function(e){if(0===arguments.length)return this.template;this.template=e}}),module.exports={init:init,addTemplate:pushTemplate,removeTemplate:removeTemplate,getTemplateContent:getTemplateContent};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./script-template.js":39}],43:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),kojqui=(typeof window !== "undefined" ? window['kojqui'] : typeof global !== "undefined" ? global['kojqui'] : null),console=require('console-browserify'),extendValueAccessor=function(o,i){return function(){return ko.utils.extend(i,o()),i}},options={show:{delay:500},track:!0,items:'[title][title!=""][title!=" "]'};ko.bindingHandlers.tooltips={init:function(o,i,t,e,n){if(void 0!==$.fn.tooltip&&void 0!==ko.bindingHandlers.tooltip)return ko.bindingHandlers.tooltip.init(o,extendValueAccessor(i,options),t,e,n)},update:function(o,i,t,e,n){if(void 0!==$.fn.tooltip&&void 0!==ko.bindingHandlers.tooltip)return ko.bindingHandlers.tooltip.update(o,extendValueAccessor(i,options),t,e,n)}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],44:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');ko.bindingHandlers.validatedValue={init:function(e,i,n){var t=i;if(void 0!==e.pattern){var a=new RegExp("^(?:"+e.pattern+")$"),o=ko.computed({read:function(){var n=ko.utils.unwrapObservable(i());return null===n||""===n||a.test(n)?e.classList.remove("invalid"):e.classList.add("invalid"),n},write:ko.isWriteableObservable(i())&&function(n){ko.selectExtensions.writeValue(e,n);var t=ko.selectExtensions.readValue(e);i()(t)},disposeWhenNodeIsRemoved:e});t=function(){return o}}ko.bindingHandlers.value.init(e,t,n)}},ko.expressionRewriting._twoWayBindings.validatedValue=!0;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],45:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');ko.bindingHandlers.uniqueId={currentIndex:0,init:function(e,t){var n=ko.utils.unwrapObservable(t())||{};if(""===n.id()){var i,l,r;r="ko_"+(void 0!==n.type?ko.utils.unwrapObservable(n.type):"block");do{i=r+"_"+ ++ko.bindingHandlers.uniqueId.currentIndex,l=global.document.getElementById(i)}while(l);n.id(i)}}},ko.virtualElements.allowedBindings.uniqueId=!0,ko.bindingHandlers.virtualAttr={update:function(e,t){8!==e.nodeType&&ko.bindingHandlers.attr.update(e,t)}},ko.virtualElements.allowedBindings.virtualAttr=!0,ko.bindingHandlers.virtualAttrStyle={update:function(e,t,n,i,l){if(8!==e.nodeType){var r=["style"];(void 0===l.templateMode||"wysiwyg"!=l.templateMode)&&r.push("replacedstyle");for(var o=ko.utils.unwrapObservable(t()),a=0;a<r.length;a++){var d=r[a];!1===o||null===o||void 0===o?e.removeAttribute(d):e.setAttribute(d,o.toString())}}}},ko.virtualElements.allowedBindings.virtualAttrStyle=!0,ko.bindingHandlers.virtualStyle={update:function(e,t){8!==e.nodeType&&ko.bindingHandlers.style.update(e,t)}},ko.virtualElements.allowedBindings.virtualStyle=!0,ko.bindingHandlers.virtualHtml={init:ko.bindingHandlers.html.init,update:function(e,t){if(8===e.nodeType){var n=ko.utils.unwrapObservable(t());if(ko.virtualElements.emptyNode(e),null!==n&&void 0!==n){"string"!=typeof n&&(n=n.toString());var i=ko.utils.parseHtmlFragment(n);if(i)for(var l=e.nextSibling,r=0,o=i.length;r<o;r++)l.parentNode.insertBefore(i[r],l)}}else ko.bindingHandlers.html.update(e,t);return{controlsDescendantBindings:!0}}},ko.virtualElements.allowedBindings.virtualHtml=!0;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],46:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var tinymce=(typeof window !== "undefined" ? window['tinymce'] : typeof global !== "undefined" ? global['tinymce'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');require("./eventable.js"),ko.bindingHandlers.wysiwygOrHtml={init:function(e,t,i,n,o){return void 0===o.templateMode||"wysiwyg"!=o.templateMode?ko.bindingHandlers.virtualHtml.init():ko.bindingHandlers.wysiwyg.init(e,t,i,n,o)},update:function(e,t,i,n,o){if(void 0===o.templateMode||"wysiwyg"!=o.templateMode)return ko.bindingHandlers.virtualHtml.update(e,t,i,n,o)}},ko.virtualElements.allowedBindings.wysiwygOrHtml=!0,ko.bindingHandlers.wysiwygHref={init:function(e,t,i,n,o){if(8!==e.nodeType){t();if(void 0===o.templateMode||"wysiwyg"!=o.templateMode)e.setAttribute("target","_new");else void 0!==i().wysiwygOrHtml?e.setAttribute("href","javascript:void(0)"):(e.removeAttribute("href"),e.setAttribute("disabledhref","#"))}},update:function(e,t,i,n,o){if(8!==e.nodeType){var l=void 0===o.templateMode||"wysiwyg"!=o.templateMode,r=ko.utils.unwrapObservable(t());l&&(!1===r||null===r||void 0===r?e.removeAttribute("href"):e.setAttribute("href",r.toString()))}}},ko.virtualElements.allowedBindings.wysiwygHref=!0,ko.bindingHandlers.wysiwygSrc={convertedUrl:function(e,t,i,n){return e+(-1==e.indexOf("?")?"?":"&")+"method="+t+"&width="+i+(null!==n?"&height="+n:"")},placeholderUrl:function(e,t,i){},update:function(e,t,i,n,o){var l=ko.utils.unwrapObservable(t()),r=ko.utils.unwrapObservable(l.src),s=ko.utils.unwrapObservable(l.placeholder),a=ko.utils.unwrapObservable(l.width),d=ko.utils.unwrapObservable(l.height);if(!1===r||null===r||void 0===r||""===r)"object"==typeof s&&null!==s?e.setAttribute("src",ko.bindingHandlers.wysiwygSrc.placeholderUrl(s.width,s.height,s.text)):e.removeAttribute("src");else{var u=ko.utils.unwrapObservable(l.method);u||(u=a>0&&d>0?"cover":"resize");var g=ko.bindingHandlers.wysiwygSrc.convertedUrl(r.toString(),u,a,d);e.setAttribute("src",g)}void 0!==a&&null!==a?e.setAttribute("width",a):e.removeAttribute("width"),void 0!==d&&null!==d?e.setAttribute("height",d):e.removeAttribute("height")}},ko.bindingHandlers.wysiwygId={init:function(e,t,i,n,o){void 0===o.templateMode||"wysiwyg"!=o.templateMode||e.setAttribute("id",ko.utils.unwrapObservable(t()))},update:function(e,t,i,n,o){void 0===o.templateMode||"wysiwyg"!=o.templateMode||e.setAttribute("id",ko.utils.unwrapObservable(t()))}},ko.virtualElements.allowedBindings.wysiwygId=!0,ko.bindingHandlers.wysiwygClick={init:function(e,t,i,n,o){void 0===o.templateMode||"wysiwyg"!=o.templateMode||ko.bindingHandlers.click.init(e,t,i,n,o)}},ko.virtualElements.allowedBindings.wysiwygClick=!0,ko.bindingHandlers.wysiwygCss={update:function(e,t,i,n,o){void 0===o.templateMode||"wysiwyg"!=o.templateMode||ko.bindingHandlers.css.update(e,t,i,n,o)}},ko.virtualElements.allowedBindings.wysiwygCss=!0,ko.bindingHandlers.wysiwygImg={makeTemplateValueAccessor:function(e,t){return function(){var i=void 0!==t.templateMode&&"wysiwyg"==t.templateMode,n=e(),o=ko.utils.peekObservable(n);return ko.utils.unwrapObservable(n),{name:i?o._editTemplate:o._template,templateEngine:ko.nativeTemplateEngine.instance}}},init:function(e,t,i,n,o){return ko.bindingHandlers.template.init(e,ko.bindingHandlers.wysiwygImg.makeTemplateValueAccessor(t,o))},update:function(e,t,i,n,o){return o=o.extend(t()),ko.bindingHandlers.template.update(e,ko.bindingHandlers.wysiwygImg.makeTemplateValueAccessor(t,o),i,n,o)}},ko.virtualElements.allowedBindings.wysiwygImg=!0,ko.bindingHandlers.wysiwyg={currentIndex:0,standardOptions:{},fullOptions:{toolbar1:"bold italic forecolor backcolor hr styleselect removeformat | link unlink | pastetext code",plugins:["link hr paste lists textcolor code"]},init:function(e,t,i,n,o){ko.bindingHandlers.focusable.init(e),ko.utils.domNodeDisposal.addDisposeCallback(e,function(){tinymce.remove("#"+e.getAttribute("id"))});var l=t();if(!ko.isObservable(l))throw"Wysiwyg binding called with non observable";if(8===e.nodeType)throw"Wysiwyg binding called on virtual node, ignoring...."+e.innerHTML;var r=e.getAttribute("id");r||(r="wysiwyg_"+ ++ko.bindingHandlers.wysiwyg.currentIndex,e.setAttribute("id",r));var s,a="DIV"==e.tagName||"TD"==e.tagName,d=!1,u=!1,g={selector:"#"+r,inline:!0,hidden_input:!1,plugins:["paste"],toolbar1:"bold italic",toolbar2:"",preview_styles:!1,paste_as_text:!0,language:"en",schema:"html5",extended_valid_elements:"strong/b,em/i,*[*]",menubar:!1,skin:"gray-flat",setup:function(e){e.on("change redo undo",function(){d||(u=!0,l(e.getContent({format:"raw"})),u=!1)}),e.on("focus",function(){e.nodeChanged(),e.getElement().click()}),e.on("BeforeSetContent",function(e){e.initial&&(e.format="raw")}),s=e}};return ko.utils.extend(g,ko.bindingHandlers.wysiwyg.standardOptions),a&&ko.utils.extend(g,ko.bindingHandlers.wysiwyg.fullOptions),global.setTimeout(function(){tinymce.init(g)}),ko.computed(function(){var i=ko.utils.unwrapObservable(t());if(!u){try{d=!0,void 0!==s?s.setContent(i,{format:"raw"}):ko.utils.setHtml(e,i)}catch(e){console.log("TODO exception setting content to editable element",typeof s,e)}d=!1}},null,{disposeWhenNodeIsRemoved:e}),{controlsDescendantBindings:!0}}};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./eventable.js":32,"console-browserify":3}],47:[function(require,module,exports){
 | 
						|
"use strict";var console=require('console-browserify'),checkModel=function(e,o,t,n,l){var i,f,r,a=0;if(void 0===l&&(l=!1),void 0!==o&&"function"==typeof o.splice)for(i={},f=0;f<o.length;f++)i[o[f].type]=o[f];else i=o;for(var p in e)if(e.hasOwnProperty(p))if(r=void 0!==n?n+"."+p:p,t.hasOwnProperty(p))if(typeof t[p]!=typeof e[p])null!==t[p]&&null!==e[p]&&("string"==typeof t[p]?String(e[p])!=e[p]&&(console.log("TODO Different type 1 ",r,typeof t[p],typeof e[p],t[p],e[p]),a=Math.max(a,2)):"number"==typeof t[p]?Number(e[p])!=e[p]&&(console.log("TODO Different type 2 ",r,typeof t[p],typeof e[p],t[p],e[p]),a=Math.max(a,2)):(console.log("TODO Different type 3 ",r,typeof t[p],typeof e[p],t[p],e[p]),a=Math.max(a,2)));else if("object"==typeof e[p])if(null!==e[p])if(void 0!==e[p].splice){if(e[p].length>0)if(t[p].length>0){var c=0;for(f=0;f<t[p].length;f++)if("string"==typeof t[p][f].type){for(;c<e[p].length&&e[p][c].type!==t[p][f].type;)console.log("ignoring ",r,e[p][c].type," block type in reference not found in model"),c++;if(c>=e[p].length){console.log("WARN cannot find ",r,t[p][f].type," block in reference"),a=Math.max(a,2);break}a=Math.max(a,checkModel(e[p][c],void 0,t[p][f],r+"["+f+"."+t[p][f].type+"]"))}}else for(f=0;f<e[p].length;f++)"string"!=typeof e[p][f].type?(console.log("TODO found an object with no type",r,e[p][f]),a=Math.max(a,2)):i.hasOwnProperty(e[p][f].type)?a=Math.max(a,checkModel(i[e[p][f].type],i,e[p][f],r+"["+f+"."+e[p][f].type+"]")):(console.warn("TODO the model uses a block type not defined by the template. REMOVING IT!!",r,e[p][f]),e[p].splice(f,1),f--,a=Math.max(a,2))}else null===t[p]?l?(console.log("WARN Null object in model ",r,"instead of",e[p],"deleting it"),a=Math.max(a,2),delete e[p]):(console.log("INFO Null object in model ",r,"instead of",e[p],"cloning it from the reference"),a=Math.max(a,1),t[p]=e[p]):a=Math.max(a,checkModel(e[p],i,t[p],r,l));else null!==t[p]&&(console.log("TODO Null in reference but not null in model",r,t[p]),a=Math.max(a,2));else"string"!=typeof e[p]&&"boolean"!=typeof e[p]&&"number"!=typeof e[p]&&(console.log("TODO unsupported type",r,typeof e[p]),a=Math.max(a,2));else l?(console.warn("WARN Property ",r,"found in model is not defined by template: removing it!"),a=Math.max(a,2),delete e[p]):(console.log("INFO Property ",r,"missing in model, cloning from reference!"),a=Math.max(a,1),t[p]=e[p]);return l||(a=Math.max(a,checkModel(t,o,e,void 0!==n?n+"!R":"!R",!0))),a};module.exports=checkModel;
 | 
						|
 | 
						|
},{"console-browserify":3}],48:[function(require,module,exports){
 | 
						|
"use strict";var converterUtils=require("./utils.js"),cssParse=require("mensch/lib/parser.js"),console=require('console-browserify'),domutils=require("./domutils.js"),_declarationValueLookup=function(e,t,r){for(var l=e.length-1;l>=0;l--)if("property"==e[l].type&&e[l].name==t)return _declarationValueUrlPrefixer(e[l].value,r);return null},_propToCamelCase=function(e){return e.replace(/-([a-z])/g,function(e,t,r,l){return t.toUpperCase()})},_declarationValueUrlPrefixer=function(e,t){return e.match(/url\(.*\)/)?e.replace(/(url\()([^\)]*)(\))/g,function(e,r,l,i){var n=l.trim(),o=l.trim().charAt(0);"'"==o||'"'==o?n=n.substr(1,n.length-2):o="";var a=t(n);return null!==a?r+o+a+o+i:e}):e},elaborateDeclarations=function(e,t,r,l,i,n,o){var a="object"==typeof n&&null!==n?n:{},u=null,s=0;void 0===t&&(t=cssParse("#{\n"+e+"}",{comments:!0,position:!0}).stylesheet.rules[0].declarations,s=1);for(var v=t.length-1;v>=0;v--)if("property"==t[v].type)if(!0===o&&"display"==t[v].name&&"none"==t[v].value)null===u&&(u=e),u=converterUtils.removeStyle(u,t[v].position.start,t[v].position.end,s,0,0,"");else{var d=t[v].name.match(/^-ko-(bind-|attr-)?([a-z0-9-]*?)(-if|-ifnot)?$/);if(null!==d){null===u&&void 0!==e&&(u=e);var c,f,p,m="attr-"==d[1],y="bind-"==d[1],h=d[2],b="-if"==d[3]||"-ifnot"==d[3];if(b){if(c=t[v].name.substr(0,t[v].name.length-d[3].length),null===_declarationValueLookup(t,c,r))throw"Unable to find declaration "+c+" for "+t[v].name}else{if((m||y)&&void 0===i&&void 0!==e)throw"Attributes and bind declarations are only allowed in inline styles!";var S,g=!0;if(m?(p=domutils.getAttribute(i,h),g=!1,S="virtualAttr"):y?(S=null,"text"==h?void 0!==i?p=domutils.getInnerText(i):g=!1:"html"==h&&void 0!==i?p=domutils.getInnerHtml(i):g=!1):((g=void 0!==e)&&(p=_declarationValueLookup(t,h,r)),S="virtualStyle"),g&&null===p)throw console.error("Cannot find default value for",t[v].name,t),"Cannot find default value for "+t[v].name+": "+t[v].value+" in "+i+" ("+typeof e+"/"+h+")";var w=p,U=y||m?-1!=h.indexOf("-")?"'"+h+"'":h:_propToCamelCase(h);try{f=converterUtils.expressionBinding(t[v].value,l,w)}catch(e){throw console.error("Model ensure path failed",e.stack,"name",t[v].name,"value",t[v].value,"default",p,"element",i),e}null!==S&&void 0===a[S]&&(a[S]={}),"virtualAttr"==S&&"href"==U&&(S=null,U="wysiwygHref",void 0!==i&&null!==i&&domutils.removeAttribute(i,"href"));var x=_declarationValueLookup(t,t[v].name+"-if",r),_=!1;if(null===x)x=_declarationValueLookup(t,t[v].name+"-ifnot",r),_=!0;else if(null!==_declarationValueLookup(t,t[v].name+"-ifnot",r))throw"Unexpected error: cannot use both -if and -ifnot property conditions";if(null!==x)try{var A=converterUtils.conditionBinding(x,l);f=(_?"!":"")+"("+A+") ? "+f+" : null"}catch(e){throw console.error("Unable to deal with -ko style binding condition",x,t[v].name),e}null!==S?a[S][U]=f:a[U]=f}if(null!==u)try{if(void 0!==i&&null!==i)u=converterUtils.removeStyle(u,t[v].position.start,t[v].position.end,s,0,0,"");else{var k="";b||(k=h+": \x3c!-- ko text: "+f+" --\x3e"+p+"\x3c!-- /ko --\x3e"),u=converterUtils.removeStyle(u,t[v].position.start,t[v].position.end,s,0,0,k)}}catch(e){throw console.warn("Remove style failed",e,"name",t[v]),e}}else{var C=_declarationValueUrlPrefixer(t[v].value,r);if(C!=t[v].value&&(null===u&&void 0!==e&&(u=e),null!==u))try{u=converterUtils.removeStyle(u,t[v].position.start,t[v].position.end,s,0,0,t[v].name+": "+C)}catch(e){throw console.log("Remove style failed replacing url",e,"name",t[v]),e}var V=_propToCamelCase(t[v].name),P="virtualAttrStyle",j=void 0!==a.virtualStyle?a.virtualStyle[V]:void 0,z=" ";void 0===a[P]&&(a[P]="''",z=""),void 0!==j?(a[P]="'"+t[v].name+": '+("+j+")+';"+z+"'+"+a[P],delete a.virtualStyle[V]):a[P]="'"+t[v].name+": "+converterUtils.addSlashes(C)+";"+z+"'+"+a[P]}}if(void 0!==i&&null!==i){for(var L in a.virtualStyle)if(a.virtualStyle.hasOwnProperty(L))throw console.log("Unexpected virtualStyle binding after conversion to virtualAttr.style",L,a.virtualStyle[L],e),"Unexpected virtualStyle binding after conversion to virtualAttr.style for "+L;delete a.virtualStyle;var q=domutils.getAttribute(i,"data-bind"),O=(null!==q?q+", ":"")+_bindingSerializer(a);domutils.setAttribute(i,"data-bind",O)}if(void 0===e){var T=!1;for(var B in a.virtualStyle)if(a.virtualStyle.hasOwnProperty(B)){T=!0;break}if(T){if(void 0!==a.virtualAttrStyle){var D=a.virtualAttrStyle;delete a.virtualAttrStyle,a.virtualAttrStyle=D}}else delete a.virtualStyle;return _bindingSerializer(a)}return u},_bindingSerializer=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&("object"==typeof e[r]?t.push(r+": { "+_bindingSerializer(e[r])+" }"):t.push(r+": "+e[r]));return t.reverse().join(", ")};module.exports=elaborateDeclarations;
 | 
						|
 | 
						|
},{"./domutils.js":49,"./utils.js":55,"console-browserify":3,"mensch/lib/parser.js":16}],49:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null);function _extend(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var objExtend=function(e,t){return"function"==typeof $.extend?$.extend(!0,e,t):_extend(e,JSON.parse(JSON.stringify(t)))},getAttribute=function(e,t){var n=$(e).attr(t);return void 0===n&&(n=null),n},setAttribute=function(e,t,n){$(e).attr(t,n)},removeAttribute=function(e,t){$(e).removeAttr(t)},getInnerText=function(e){return $(e).text()},getInnerHtml=function(e){return $(e).html()},getLowerTagName=function(e){return""===e.tagName&&"string"==typeof e.name?e.name.toLowerCase():""!==e.tagName?e.tagName.toLowerCase():$(e).prop("tagName").toLowerCase()},setContent=function(e,t){$(e).html(t)},replaceHtml=function(e,t){$(e).replaceWith(t)},removeElements=function(e,t){t&&void 0!==e.detach&&e.detach(),e.remove()};module.exports={getAttribute:getAttribute,setAttribute:setAttribute,removeAttribute:removeAttribute,getInnerText:getInnerText,getInnerHtml:getInnerHtml,getLowerTagName:getLowerTagName,setContent:setContent,replaceHtml:replaceHtml,removeElements:removeElements,objExtend:objExtend};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],50:[function(require,module,exports){
 | 
						|
"use strict";var console=require('console-browserify'),elaborateDeclarations=require("./declarations.js"),utils=require("./utils.js"),modelDef=require("./model.js"),_getOptionsObject=function(e){for(var t=e.split("|"),o={},i=0;i<t.length;i++){var l=t[i].split("=");o[l[0]]=l.length>1?l[1]:l[0]}return o},_filterProps=function(e,t,o){var i=[];for(var l in e)if(!l.match(/^customStyle$/)&&!l.match(/^_/)&&e.hasOwnProperty(l)){var a=null!==e[l]&&void 0!==e[l]._category&&"style"==e[l]._category;if("id"==l||"type"==l||l.match(/Blocks$/));else if("styler"==t)(a||o>0)&&i.push(l);else if("edit"==t){null!==e[l]&&void 0!==e[l]._category&&"content"==e[l]._category&&(void 0===e[l]._context||"block"!=e[l]._context)&&i.push(l)}else void 0===t&&i.push(l)}return i},_propInput=function(e,t,o,i,l){var a,n="";if(null!==e&&void 0!==e._widget&&(a=e._widget),void 0===a)throw"Unknown data type for "+t;var s="focusable: true";if("edit"==i&&(s+=", event: { focus: function(ui, event) { $($element).click(); } } "),n+='<label class="data-'+a+'"'+("boolean"==a?" data-bind=\"event: { mousedown: function(ui, evt) { if (evt.button == 0) { var input = $($element).find('input'); var ch = input.prop('checked'); setTimeout(function() { input.click(); input.prop('checked', !ch); input.trigger('change'); }, 0); } } }, click: function(ui, evt) { evt.preventDefault(); }, clickBubble: false\"":"")+">",void 0!==l&&void 0!==l[a]){var d=l[a],r={};if(void 0!==d.parameters)for(var c in d.parameters)d.parameters.hasOwnProperty(c)&&void 0!==e["_"+c]&&(r[c]=e["_"+c]);n+=d.html(o,s,r)}else if("boolean"==a)n+='<input type="checkbox" value="nothing" data-bind="checked: '+o+", "+s+'" />',n+='<span class="checkbox-replacer" ></span>';else if("color"==a)n+='<input size="7" type="text" data-bind="colorpicker: { color: '+o+", strings: $root.t('Theme Colors,Standard Colors,Web Colors,Theme Colors,Back to Palette,History,No history yet.') }, , "+s+'" />';else if("select"==a){if(void 0!==e._options){var p=_getOptionsObject(e._options);for(var v in n+='<select data-bind="value: '+o+", "+s+'">',p)p.hasOwnProperty(v)&&(n+='<option value="'+v+"\" data-bind=\"text: $root.ut('template', '"+utils.addSlashes(p[v])+"')\">"+p[v]+"</option>");n+="</select>"}}else if("font"==a)n+='<select type="text" data-bind="value: '+o+", "+s+'">',n+='<optgroup label="Sans-Serif Fonts">',n+='<option value="Arial,Helvetica,sans-serif">Arial</option>',n+="<option value=\"'Comic Sans MS',cursive,sans-serif\">Comic Sans MS</option>",n+='<option value="Impact,Charcoal,sans-serif">Impact</option>',n+="<option value=\"'Trebuchet MS',Helvetica,sans-serif\">Trebuchet MS</option>",n+='<option value="Verdana,Geneva,sans-serif">Verdana</option>',n+="</optgroup>",n+='<optgroup label="Serif Fonts">',n+='<option value="Georgia,serif">Georgia</option>',n+="<option value=\"'Times New Roman',Times,serif\">Times New Roman</option>",n+="</optgroup>",n+='<optgroup label="Monospace Fonts">',n+="<option value=\"'Courier New',Courier,monospace\">Courier New</option>",n+="</optgroup>",n+="</select>";else if("url"==a)n+='<div class="ui-textbutton">',n+='<input class="ui-textbutton-input" size="7" type="url" pattern="(mailto:.+@.+|https?://.+\\..+|\\[.*\\].*)" value="nothing" data-bind="css: { withButton: typeof $root.linkDialog !== \'undefined\' }, validatedValue: '+o+", "+s+'" />',n+="<a class=\"ui-textbutton-button\" data-bind=\"visible: typeof $root.linkDialog !== 'undefined', click: typeof $root.linkDialog !== 'undefined' ? $root.linkDialog.bind($element.previousSibling) : false, button: { icons: { primary: 'fa fa-fw fa-ellipsis-h' }, label: 'Opzioni', text: false }\">Opzioni</a>",n+="</div>";else if("integer"==a){var u=0,b=1e3;null!==e&&void 0!==e._max&&(b=e._max),null!==e&&void 0!==e._min&&(u=e._min);var f=b-u>=100?10:1;n+='<input class="number-spinner" size="7" step="'+f+'" type="number" value="-1" data-bind="spinner: { min: '+u+", max: "+b+", page: "+5*f+", value: "+o+" }, valueUpdate: ['change', 'spin'], "+s+'" />'}else n+='<input size="7" type="text" value="nothing" data-bind="value: '+o+", "+s+'" />';return n+="</label>"},_getGlobalStyleProp=function(e,t,o,i){var l;return"object"==typeof t&&null!==t&&void 0===t._widget||void 0!==o&&void 0!==i&&i.length>0&&"object"==typeof e&&void 0!==e[i]&&(l=e[i]),l},_propEditor=function(e,t,o,i,l,a,n,s,d,r,c,p,v,u,b){if(void 0===d&&(d=0),void 0!==n&&"object"==typeof i&&null!==i&&void 0===i._usecount)return console.log("TODO EDITOR ignoring",a,"property because it is not used by the template","prop:",n,"type:",s,"level:",d,e._templateName),"";var f,h=void 0!==p?n+"._defaultComputed":n,m="",g=h,_=1,k=1;if("object"==typeof i&&null!==i&&void 0===i._widget||void 0===p&&(_+=1),void 0===p&&void 0!==r&&(k+=r),void 0!==n&&v&&(m+="\x3c!-- ko ifSubs: { data: "+g+", threshold: "+k+", gutter: "+_+" } --\x3e"),void 0===n||null!==i&&void 0!==i._name||console.log("TODO WARN Missing label for property ",n),void 0===n&&null!==i&&void 0===i._name&&console.log("TODO WARN Missing label for object ",i.type),"object"==typeof i&&null!==i&&void 0===i._widget){var y=_filterProps(i,s,d),x="styler"==s&&null!==i&&void 0!==i.customStyle&&void 0!==p,S="",w="";void 0!==n&&"edit"==s&&(S=", click: function(obj, evt) { $root.selectItem("+n+", $data); return false }, clickBubble: false, css: { selecteditem: $root.isSelectedItem("+n+") }, scrollIntoView: $root.isSelectedItem("+n+"), ",w+=" selectable"),x&&(w+=" supportsCustomStyles"),m+='<div class="objEdit level'+d+w+'" data-bind="tooltips: {}'+S+'">';var $,D,j,B=null!==i&&void 0!==i._name?i._name:void 0!==n?"["+n+"]":"";if(x){var E="Stile";void 0!==l&&null!==l&&void 0!==l._name?E=l._name:console.log("TODO missing label for theme section ",n,null!==i?i.type:"-"),B="<span class=\"blockSelectionMethod\" data-bind=\"text: customStyle() ? $root.ut('template', '"+utils.addSlashes(B)+"') : $root.ut('template', '"+utils.addSlashes(E)+"')\">Block</span>"}else B="<span data-bind=\"text: $root.ut('template', '"+utils.addSlashes(B)+"')\">"+B+"</span>";if(m+="<span"+(f=null!==i&&void 0!==i._help?' title="'+utils.addSlashes(i._help)+"\" data-bind=\"attr: { title: $root.ut('template', '"+utils.addSlashes(i._help)+"') }\"":"")+' class="objLabel level'+d+'">'+B+"</span>","edit"==s&&void 0!==i._blockDescription&&(m+="<div class=\"blockDescription\" data-bind=\"html: $root.ut('template', '"+utils.addSlashes(i._blockDescription)+"')\">"+i._blockDescription+"</div>"),x&&(m+='<label class="data-boolean blockCheck" data-bind="tooltips: { }">',m+='<input type="checkbox" value="nothing" data-bind="focusable: true, checked: customStyle" />',m+='<span title="Switch between global and block level styles editing" data-bind="attr: { title: $root.t(\'Switch between global and block level styles editing\') }" class="checkbox-replacer checkbox-replacer-onoff"></span>',m+="</label>",m+="\x3c!-- ko template: { name: 'customstyle', if: customStyle } --\x3e\x3c!-- /ko --\x3e"),void 0!==n)if(m+="\x3c!-- ko with: "+n+" --\x3e",1==d&&void 0!==n)if(void 0!==i._previewBindings&&void 0!==e)void 0!==u&&(m+='\x3c!-- ko with: $root.content() --\x3e<div class="objPreview" data-bind="'+u+'"></div>\x3c!-- /ko --\x3e'),void 0!==b&&(m+='\x3c!-- ko with: $parent --\x3e<div class="objPreview" data-bind="'+b+'"></div>\x3c!-- /ko --\x3e'),m+='<div class="objPreview"><div class="objPreviewInner" data-bind="'+elaborateDeclarations(void 0,i._previewBindings,o,e.bind(this,a+"."))+'"></div></div>';0===d&&void 0!==i._previewBindings&&($=elaborateDeclarations(void 0,i._previewBindings,o,e.bind(this,a.length>0?a+".":"")));var O,T=m.length;for(D=0;D<y.length;D++)j=a.length>0?a+"."+y[D]:y[D],"object"==typeof i[y[D]]&&null!==i[y[D]]&&void 0===i[y[D]]._widget||(O=void 0,0===d&&"theme"==y[D]?m+=_propEditor(e,t,o,i[y[D]],void 0,j,y[D],s,0,r,void 0,void 0,v,u):(O=_getGlobalStyleProp(c,i[y[D]],y[D],j),m+=_propEditor(e,t,o,i[y[D]],void 0,j,y[D],s,d+1,r,c,O,v,u,$)));for(D=0;D<y.length;D++)j=a.length>0?a+"."+y[D]:y[D],"object"==typeof i[y[D]]&&null!==i[y[D]]&&void 0===i[y[D]]._widget&&(O=void 0,0===d&&"theme"==y[D]?m+=_propEditor(e,t,o,i[y[D]],void 0,j,y[D],s,0,r,void 0,void 0,v,u):(O=_getGlobalStyleProp(c,i[y[D]],y[D],j),m+=_propEditor(e,t,o,i[y[D]],void 0,j,y[D],s,d+1,r,c,O,v,u,$)));if(0===m.length-T){if("object"==typeof i&&null!==i&&"template"==i._context)return"";m+='<div class="objEmpty" data-bind="html: $root.t(\'Selected element has no editable properties\')">Selected element has no editable properties</div>'}void 0!==n&&(m+="\x3c!-- /ko --\x3e"),m+="</div>"}else{var C=!0;if(void 0===c&&(C=!1),null===i||"object"!=typeof i||void 0!==i._widget){var I=[];void 0!==p&&I.push("css: { notnull: "+n+"() !== null }"),(f=null!==i&&void 0!==i._help?' title="'+utils.addSlashes(i._help)+"\" data-bind=\"attr: { title: $root.ut('template', '"+utils.addSlashes(i._help)+"') }\"":"").length>0&&I.push("tooltips: {}");var P=I.length>0?'data-bind="'+utils.addSlashes(I.join())+'"':"";m+='<div class="propEditor '+(C?"checkboxes":"")+'"'+P+">";var N=null!==i&&void 0!==i._name?i._name:void 0!==n?"["+n+"]":"";m+="<span"+f+' class="propLabel">'+(N="<span data-bind=\"text: $root.ut('template', '"+utils.addSlashes(N)+"')\">"+N+"</span>")+"</span>",m+='<div class="propInput '+(void 0!==c?"local":"")+'" data-bind="css: { default: '+n+'() === null }">',m+=_propInput(i,n,h,s,t),m+="</div>",void 0!==p&&(m+='<div class="propInput global" data-bind="css: { overridden: '+n+'() !== null }">',m+=_propInput(i,n,p,s,t),m+="</div>",C&&(m+='<div class="propCheck"><label data-bind="tooltips: {}"><input type="checkbox" data-bind="focusable: true, click: function(evt, obj) { $root.localGlobalSwitch('+n+", "+p+"); return true; }, checked: "+n+'() !== null">',m+='<span class="checkbox-replacer" data-bind="css: { checked: '+n+"() !== null }, attr: { title: $root.t('This style is specific for this block: click here to remove the custom style and revert to the theme value') }\"></span>",m+="</label></div>")),m+="</div>"}else m+=null===i||"object"!=typeof i?'<div class="propEditor unknown">[A|'+n+"|"+typeof i+"]</div>":'<div class="propEditor unknown">[B|'+n+"|"+typeof i+"]</div>"}return void 0!==n&&v&&(m+="\x3c!-- /ko --\x3e",m+="\x3c!-- ko ifSubs: { not: true, data: "+g+", threshold: "+k+", gutter: 0 } --\x3e",m+='<span class="label notused">('+n+")</span>",m+="\x3c!-- /ko --\x3e"),m},createBlockEditor=function(e,t,o,i,l,a,n,s,d,r,c,p){void 0===c&&(c=!0);var v,u=modelDef.getDef(e,a),b=modelDef.getDef(e,l);void 0!==b._previewBindings&&"thaeme"!=a&&"styler"==n&&(v=elaborateDeclarations(void 0,b._previewBindings,i,modelDef.getBindValue.bind(void 0,e,o,l,l,"")));var f,h=void 0!==r&&r?e[a]._globalStyles:void 0,m=void 0!==r&&r?e[a]._globalStyle:void 0;void 0!==m&&(f=modelDef.getDef(e,"theme")[m.replace(/^(\$theme|_theme_)\./,"")]);var g=modelDef.getBindValue.bind(void 0,e,o,l,a);g._templateName=a;var _='<div class="editor">';_+='<div class="blockType'+(void 0!==h?" withdefaults":"")+'">'+u.type+"</div>";var k=_propEditor(g,t,i,u,f,"",void 0,n,p,d,h,m,c,v);k.length>0&&(_+=k),s(_+="</div>",a,n)},createBlockEditors=function(e,t,o,i,l,a,n,s){createBlockEditor(e,t,o,i,l,a,"edit",n,s),createBlockEditor(e,t,o,i,l,a,"styler",n,s,!0)},generateEditors=function(e,t,o,i,l){var a,n=e._defs,s=e.templateName,d=e._blocks,r=[];for(a=0;a<d.length;a++)void 0!==d[a].container&&r.push(modelDef.generateModel(n,d[a].block)),createBlockEditors(n,t,void 0,o,d[a].root,d[a].block,i,l);return void 0!==n.theme&&createBlockEditor(n,t,void 0,o,s,"theme","styler",i,void 0,!1,!1,-1),r};module.exports=generateEditors;
 | 
						|
 | 
						|
},{"./declarations.js":48,"./model.js":52,"./utils.js":55,"console-browserify":3}],51:[function(require,module,exports){
 | 
						|
"use strict";var modelDef=require("./model.js"),wrappedResultModel=function(e){var r=e._defs,t=e.templateName,l=modelDef.getDef(r,t),a=modelDef.generateResultModel(e);return require("./wrapper.js")(a,l,r)},translateTemplate=function(){var e=require("./parser.js");return e.apply(e,arguments)},generateEditors=function(){var e=require("./editor.js");return e.apply(e,arguments)},checkModel=function(){var e=require("./checkmodel.js");return e.apply(e,arguments)};module.exports={translateTemplate:translateTemplate,wrappedResultModel:wrappedResultModel,generateResultModel:modelDef.generateResultModel,generateEditors:generateEditors,checkModel:checkModel};
 | 
						|
 | 
						|
},{"./checkmodel.js":47,"./editor.js":50,"./model.js":52,"./parser.js":53,"./wrapper.js":56}],52:[function(require,module,exports){
 | 
						|
"use strict";var objExtend=require("./domutils.js").objExtend,console=require('console-browserify'),_valueSet=function(e,t,o,l){var r=o.indexOf(".");if(-1==r)if(void 0===t[o])console.log("Undefined prop "+o+" while setting value "+l+" in model._valueSet");else if(null===t[o])"object"==typeof l&&null!==l&&void 0===l.push&&console.log("nullpropobjectvalue",o,l),t[o]=l;else if("object"==typeof t[o]&&"function"==typeof t[o].push){var n;if("string"==typeof l){var i=l.match(/^\[(.*)\]$/);if(null===i)throw"Unexpected default value for array property "+o+": "+l;n=i[1].split(",")}else{if("object"!=typeof l||void 0===l.push)throw"Unexpected default value for array property "+o+": "+l+" typeof "+typeof l;n=l}for(var a=[],d=0;d<n.length;d++)"@"==n[d].substr(0,1)?a.push(_generateModel(e,n[d].substr(1))):n[d].length>0&&a.push(n[d]);t[o]=a}else"string"==typeof t[o]||"boolean"==typeof t[o]?t[o]=l:"object"==typeof t[o]&&null!==t[o]&&void 0!==t[o]._widget?("object"==typeof l&&null!==l&&console.log("objectvalue",o,t[o]._widget,l),t[o]=l):console.log("setting",typeof t[o],t[o],o,l);else{var f=o.substr(0,r);_valueSet(e,t[f],o.substr(r+1),l)}},_modelCreateOrUpdateBlockDef=function(e,t,o,l){if(void 0!==e[t]&&e[t]._initialized&&!e[t]._writeable)throw console.log("_modelCreateOrUpdateBlockDef",e,t,o,l),"Trying to alter non writeable model: "+t+" / "+o;if(void 0===e[t]&&(e[t]={_writeable:!0},void 0===l&&(l={}),void 0===l.category&&void 0===e[t]._category&&(t.match(/(^t|.T)heme$/)||t.match(/(^s|.S)tyle$/)||t.match(/(^c|.C)olor$/)||t.match(/(^r|.R)adius$/)?l.category="style":l.category="content")),void 0!==l){if(void 0!==l.name&&(e[t]._name=l.name),void 0!==l.themeOverride&&(e[t]._themeOverride=l.themeOverride),void 0!==l.globalStyle){e[t]._globalStyle=l.globalStyle;var r=l.globalStyle.replace(/^(\$theme|_theme_)\./,""),n=r.indexOf("."),i=-1!=n?r.substr(0,n):r;_modelCreateOrUpdateBlockDef(e,"theme",i),(void 0===e[t]._themeOverride||e[t]._themeOverride)&&_modelCreateOrUpdateBlockDef(e,t,"customStyle=false")}void 0!==l.contextName&&(e[t]._context=l.contextName,"block"==l.contextName&&void 0===e[t]._globalStyle&&(e[t]._globalStyle="_theme_.bodyTheme",_modelCreateOrUpdateBlockDef(e,"theme","bodyTheme"),(void 0===e[t]._themeOverride||e[t]._themeOverride)&&_modelCreateOrUpdateBlockDef(e,t,"customStyle=false"))),void 0!==l.extend&&(e[t].type=l.extend)}for(var a in l)l.hasOwnProperty(a)&&void 0!==l[a]&&-1==["name","extend","contextName","globalStyle","themeOverride"].indexOf(a)&&(e[t]["_"+a]=l[a]);void 0!==o&&o.length>0&&(e[t]._props=void 0!==e[t]._props&&e[t]._props.length>0?e[t]._props+" "+o:o)},_removePrefix=function(e){var t=e.match(/^[^A-Z]+([A-Z])(.*)$/);return null!==t?t[1].toLowerCase()+t[2]:null},_generateModelFromDef=function(e,t){var o={};for(var l in e)if(!l.match(/^_.*/)&&e.hasOwnProperty(l)){var r=e[l];if("object"==typeof r&&null!==r&&void 0!==r._complex&&r._complex)o[l]=_generateModelFromDef(r,t);else if("type"==l)o[l]=r;else{if("object"!=typeof r)throw console.error("Unexpected model def",l,r,e),"Unexpected model def ["+l+"]="+r;o[l]=null}}if(void 0!==e._defaultValues){var n=e._defaultValues;for(var i in n)n.hasOwnProperty(i)&&_valueSet(t,o,i,n[i])}return o},_generateModel=function(e,t){var o=_getModelDef(e,t,!1,!0);return _generateModelFromDef(o,e)},_getDef=function(e,t){return _getModelDef(e,t,!1,!0)},_getModelDef=function(e,t,o,l){if(void 0===e[t]){if(-1!=t.indexOf(" "))return null;var r=_removePrefix(t);return null!==r?_getModelDef(e,r,o,l):null}var n=e[t];if("object"!=typeof n)throw"Block definition must be an object: found "+n+" for "+t;if(void 0===n._initialized){if(void 0===n.type&&(-1==t.indexOf(" ")?n.type=t:n.type=t.substr(t.indexOf(" ")+1)),n.type!=t&&void 0===n._widget){var i=_getModelDef(e,n.type,!0);n=objExtend(i,n),e[t]=n}else void 0===n._widget&&void 0===n._props&&n._complex;n._writeable=!0,n._initialized=!0}if(void 0!==n._props){var a=n._props;if((a=a.split(" ")).length>0&&void 0===n._writeable)throw console.error("Altering a non writable object ",t,a,n),"Altering a non writable object: "+t+" def: "+a;void 0===n._processedDefs&&(n._processedDefs={}),void 0===n._globalStyles&&(n._globalStyles={}),void 0===n._defaultValues&&(n._defaultValues={});for(var d=0;d<a.length;d++){var f=a[d];if(0!==f.length){var s=f,u=null,c=f.match(/^([^=\[\]]+)(\[\])?(=?)(.*)$/);if(null!==c&&(f=c[1],"[]"==c[2]&&(void 0===n[f]&&(n[f]=[]),u=[]),"="==c[3]&&(u=f.match(/(^v|V)isible$/)?"true"==String(c[4]).toLowerCase():f.match(/^customStyle$/)?"true"==String(c[4]).toLowerCase():c[4])),null!==u&&void 0===n._defaultValues[f]&&(n._defaultValues[f]=u),void 0===n[f]){var _=_getModelDef(e,t+" "+f,!0);null===_&&(_=_getModelDef(e,f,!0)),n[f]=_}n._processedDefs[f]=s,n._complex=!0}}delete n._props}if(o)return n._writeable=!1,objExtend({},n);if(l)return n._writeable=!1,n;if(void 0===n._writeable||!1===n._writeable)throw"Retrieving non writeable object definition: "+t;return n},_increaseUseCount=function(e,t){if(e){if(void 0===t._usecount)throw console.error("ERROR trying to bind an unused property while readonly",t),"ERROR trying to bind an unused property"}else void 0===t._usecount&&(t._usecount=0),t._usecount++},ensureGlobalStyle=function(e,t,o,l,r,n,i,a){var d=o(n,i,a);if(void 0===e[l]._globalStyles[r]){if(t)throw"Cannot find _globalStyle for "+r+" in "+l+"!";(-1!=r.indexOf(".")||"object"==typeof e[l][r]&&void 0!==e[l][r]._widget)&&(e[l]._globalStyles[r]=d)}else if(e[l]._globalStyles[r]!=d)throw"Unexpected conflicting globalStyle [2] for "+l+"/"+r+": old="+e[l]._globalStyles[r]+" new="+d},modelEnsurePathAndGetBindValue=function(e,t,o,l,r,n,i,a,d,f){var s,u,c;if("$"==i.substr(0,1)){console.warn("DEPRECATED $ in bindingProvider: ",i,r);var _=i.indexOf(".");if(-1==_)throw"Unexpected fullPath: "+i+"/"+n+"/"+r+"/"+a+"/"+d;if(s=i.substr(1,_-1),c=i.substr(_+1),"theme"!=s)throw"Unexpected $ sequence: "+s+" in "+i;var v=c.indexOf(".");u="$root.content().theme()."+(s=c.substr(0,v))+"()."+(c=c.substr(v+1)).replace(new RegExp("\\.","g"),"().")}else if("#"==i.substr(0,1))console.warn("DEPRECATED # in bindingProvider: ",i,r),s=l,u="$root.content()."+(c=i.substr(1)).replace(new RegExp("\\.","g"),"().");else if("_theme_."==i.substr(0,8)){var p=i.indexOf(".",8);u="$root.content().theme()."+(s=i.substr(8,p-8))+"()."+(c=i.substr(p+1)).replace(new RegExp("\\.","g"),"().")}else"_root_."==i.substr(0,7)?(s=l,u="$root.content()."+(c=i.substr(7)).replace(new RegExp("\\.","g"),"().")):(s=r,c=n+i,u=i.replace(new RegExp("\\.","g"),"()."));if(void 0===t[s])throw"Cannot find model def for ["+s+"]";var g,b=c.indexOf("."),h=-1==b?c:c.substr(0,b);if(-1!=s.indexOf("-"))throw console.error("ERROR cannot use - for block names",s),"ERROR unexpected char in block name: "+s;if(-1!=h.indexOf("-"))throw console.error("ERROR cannot use - for property names",h),"ERROR unexpected char in property name: "+s;if(e)return void 0!==t[s]._globalStyle&&void 0!==t[s][h]&&"style"==t[s][h]._category&&(u+="._defaultComputed"),u;if(e){if(void 0!==a)throw"Cannot use defaultValue in readonly mode!";if(d)throw"Cannot use overrideDefault in readonly mode for "+s+"/"+c+"/"+d+"!";if(void 0!==f)throw"Cannot set category for "+s+"/"+c+"/"+f+" in readonly mode!";g=_getModelDef(t,s,!1,!0)}else!1===t[s]._writeable&&console.log("TODO debug use cases for this condition",s,c),g=_getModelDef(t,s,!1===t[s]._writeable);if(null===g)throw"Unexpected model for ["+s+"]";if(void 0===g[h]){if(e)throw"Cannot find path "+h+" for "+s+"!";_modelCreateOrUpdateBlockDef(t,s,h),g=_getModelDef(t,s,!1)}void 0!==t[s]._globalStyle&&void 0!==t[s][h]&&null!==t[s][h]&&"style"==t[s][h]._category&&(u+="._defaultComputed");var y=g;try{if(_increaseUseCount(e,y),-1!=b){var m=c;do{var w=m.substr(0,b);if(void 0===y[w])throw"Found an unexpected prop "+w+" for model "+s+" for "+c;y=y[w],_increaseUseCount(e,y),b=(m=m.substr(b+1)).indexOf(".")}while(-1!=b);if(void 0===y[m]||null===y[m])throw"Found an unexpected path termination "+m+" for model "+s+" for "+c;y=y[m]}else y=y[c];if(void 0===y||null===y)throw"Unexpected null model for "+s+"/"+n+"/"+i;void 0!==f&&(y._category=f),_increaseUseCount(e,y)}catch(e){throw console.error("TODO ERROR Property lookup exception",e,s,c,r,i,t),e}if(void 0!==t[s]._globalStyle&&"object"==typeof t[s][h]&&null!==t[s][h]&&void 0!==t[s][h]._category&&"style"==t[s][h]._category){var x=modelEnsurePathAndGetBindValue.bind(void 0,e,t,o,l,r,""),O=-1!=c.indexOf(".")?c.substr(c.indexOf(".")):"";if(-1!=O.indexOf(".",1))throw"TODO unsupported object nesting! "+c;var D=t[s]._globalStyle+"."+h;"object"==typeof t[s][h]&&null!==t[s][h]&&void 0!==t[s][h]._globalStyle&&(D=t[s][h]._globalStyle),ensureGlobalStyle(t,e,x,s,h,D,void 0,!1);var S=D+O;if(void 0===a&&null!==t[s]._defaultValues[c]&&(a=t[s]._defaultValues[c]),ensureGlobalStyle(t,e,x,s,c,S,a,d),void 0!==a){if(e)throw console.error("Cannot set a new theme default value",S.substr(7),a,"while in readonly mode"),"Cannot set a new theme default value ("+a+") for "+S.substr(7)+" while in readonly mode!";o("default",S.substr(7),a)}a=null}if(void 0!==a)if(void 0===t[s]._defaultValues[c]||void 0!==d&&d){if(e)throw"Cannot set new _defaultValues [1] for "+c+" in "+s+"!";t[s]._defaultValues[c]=a}else if(null===a){if(e&&null!==t[s]._defaultValues[c])throw"Cannot set new _defaultValues [2] for "+c+" in "+s+"!";t[s]._defaultValues[c]=null}else if(t[s]._defaultValues[c]!=a)throw console.error("TODO error!!! Trying to set a new default value for "+s+" "+c+" while it already exists (current: "+t[s]._defaultValues[c]+", new: "+a+")"),"Trying to set a new default value for "+s+" "+c+" while it already exists (current: "+t[s].defaultValues[c]+", new: "+a+")";return u},generateResultModel=function(e){var t=e._defs,o=e.templateName,l=_generateModel(t,o);return void 0!==t.theme&&(l.theme=_generateModel(t,"theme")),l};module.exports={ensurePathAndGetBindValue:modelEnsurePathAndGetBindValue.bind(void 0,!1),getBindValue:modelEnsurePathAndGetBindValue.bind(void 0,!0),generateModel:_generateModel,generateResultModel:generateResultModel,getDef:_getDef,createOrUpdateBlockDef:_modelCreateOrUpdateBlockDef};
 | 
						|
 | 
						|
},{"./domutils.js":49,"console-browserify":3}],53:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),console=require('console-browserify'),converterUtils=require("./utils.js"),elaborateDeclarations=require("./declarations.js"),processStylesheetRules=require("./stylesheet.js"),modelDef=require("./model.js"),domutils=require("./domutils.js"),wrapElementWithCondition=function(t,e,o){var a=domutils.getAttribute(e,t);try{var i=converterUtils.conditionBinding(a,o);$(e).before("\x3c!-- ko if: "+i+" --\x3e"),$(e).after("\x3c!-- /ko --\x3e"),domutils.removeAttribute(e,t)}catch(o){throw console.warn("Model ensure path failed in if/variant",e,a,t),o}},replacedAttributes=function(t,e){domutils.setAttribute(t,e,domutils.getAttribute(t,"replaced"+e))},processStyle=function(t,e,o,a){var i,r=domutils.getAttribute(t,"replacedstyle"),l=null;a&&(i={uniqueId:"$data",attr:{id:"id"}});var d=null!==domutils.getAttribute(t,"data-ko-display");null===(l=elaborateDeclarations(r,void 0,e,o,t,i,d))?l=r:domutils.removeAttribute(t,"replacedstyle"),null!==l&&(l.trim().length>0?domutils.setAttribute(t,"style",l):domutils.removeAttribute(t,"style"))},_fixRelativePath=function(t,e,o,a){var i=e(domutils.getAttribute(a,t));null!==i&&domutils.setAttribute(a,t,i)},processBlock=function(t,e,o,a,i,r,l,d,s,c){try{var n;if("block"==r)n=domutils.getAttribute(t,"data-ko-block"),domutils.removeAttribute(t,"data-ko-block");else{if("template"!=r)throw"Unexpected context name while processing block: "+r;n=l}$("[data-ko-remove]",t).remove();for(var u=$("[data-ko-block]",t).replaceWith("<replacedblock>"),m=["href","src","data-ko-placeholder-src","background"],h=0;h<m.length;h++){var p=_fixRelativePath.bind(void 0,m[h],i);$("["+m[h]+"]",t).each(p)}var b=domutils.getAttribute(t,"data-ko-properties");null===b&&(b=""),$("[data-ko-properties]",t).each(function(t,e){b.length>0&&(b+=" "),b+=domutils.getAttribute(e,"data-ko-properties"),domutils.removeAttribute(e,"data-ko-properties")}),modelDef.createOrUpdateBlockDef(e,n,b,{contextName:r});var v=modelDef.ensurePathAndGetBindValue.bind(void 0,e,o,l,n,"");"block"==r&&v("id",""),$("style",t).each(function(t,a){var r=domutils.getInnerHtml(a),d=modelDef.createOrUpdateBlockDef.bind(void 0,e),s=modelDef.ensurePathAndGetBindValue.bind(void 0,e,o,l),u=processStylesheetRules(r,void 0,s,d,o,i,l,n);if(u!=r)if(""!==u.trim()){var m=c(u);domutils.setAttribute(a,"data-bind","template: { name: '"+m+"' }"),domutils.setContent(a,"")}else domutils.removeElements($(a))}),processStyle(t,i,v,s);for(var k=["data-ko-display","data-ko-editable","data-ko-wrap","href"],f=0;f<k.length;f++){if(domutils.getAttribute(t,k[f]))throw console.warn("ERROR: Unsupported "+k[f]+" used together with data-ko-block",t),"ERROR: Unsupported "+k[f]+" used together with data-ko-block"}return $("[data-ko-link]",t).each(function(t,e){var o=domutils.getAttribute(e,"data-ko-link"),a=domutils.getAttribute(e,"replacedstyle");void 0!==a&&null!==a||(a=""),a=""!==a?"-ko-attr-href: @"+o+"; "+a:"-ko-attr-href: @"+o,domutils.setAttribute(e,"replacedstyle",a),domutils.setAttribute(e,"data-ko-wrap",o),domutils.removeAttribute(e,"data-ko-link")}),$("[replacedstyle]",t).each(function(t,e){processStyle(e,i,v,!1)}),$("[replacedhttp-equiv]",t).each(function(t,e){replacedAttributes(e,"http-equiv")}),$("[data-ko-display]",t).each(function(t,e){wrapElementWithCondition("data-ko-display",e,v)}),$("[data-ko-editable]",t).each(function(t,e){var o,a,i,r,l,d,s=domutils.getAttribute(e,"data-ko-editable");if(s.lastIndexOf(".")>0){var n=s.substr(0,s.lastIndexOf("."));l=v(n)}else l=v(s);if(d="wysiwygClick: function(obj, evt) { $root.selectItem("+l+", $data); return false }, clickBubble: false, wysiwygCss: { selecteditem: $root.isSelectedItem("+l+") }, scrollIntoView: $root.isSelectedItem("+l+")","img"!=domutils.getLowerTagName(e)){a=domutils.getInnerHtml(e);var u=v(s,a,!0,"wysiwyg");if(o="",domutils.getAttribute(e,"id")||(o+="wysiwygId: id()+'_"+s.replace(".","_")+"', "),void 0!==d&&(o+=d+", "),o+="wysiwygOrHtml: "+u,"td"==domutils.getLowerTagName(e)){var m=$('<div data-ko-wrap="false" style="width: 100%; height: 100%"></div>')[0];domutils.setAttribute(m,"data-bind",o);var h=domutils.getInnerHtml($("<div></div>").append(m));domutils.setContent(e,h)}else r=(null!==(i=domutils.getAttribute(e,"data-bind"))?i+", ":"")+o,domutils.setAttribute(e,"data-bind",r),domutils.setContent(e,"");domutils.removeAttribute(e,"data-ko-editable")}else{var p=domutils.getAttribute(e,"width");if(""===p&&(p=null),null===p)throw console.error("ERROR: data-ko-editable images must declare a WIDTH attribute!",e),"ERROR: data-ko-editable images must declare a WIDTH attribute!";var b=domutils.getAttribute(e,"height");""===b&&(b=null);var k=domutils.getAttribute(e,"align"),f=(i=domutils.getAttribute(e,"data-bind"))&&i.match(/virtualAttr: {[^}]* height: ([^,}]*)[,}]/);f&&(b=f[1]);var g=i&&i.match(/virtualAttr: {[^}]* width: ([^,}]*)[,}]/);g&&(p=g[1]);var w,A,y="";(a=domutils.getAttribute(e,"data-ko-placeholder-src"))?y=domutils.getAttribute(e,"src"):a=domutils.getAttribute(e,"src"),p&&b?w=p+"+'x'+"+b:b?p||(w="'h'+"+b+"+''"):w="'w'+"+p+"+''";var x=b||domutils.getAttribute(e,"data-ko-placeholder-height"),_=p||domutils.getAttribute(e,"data-ko-placeholder-width");if(domutils.removeAttribute(e,"src"),domutils.removeAttribute(e,"data-ko-editable"),domutils.removeAttribute(e,"data-ko-placeholder-height"),domutils.removeAttribute(e,"data-ko-placeholder-width"),domutils.removeAttribute(e,"data-ko-placeholder-src"),a&&(A="{ width: "+_+", height: "+x+", text: "+w+"}"),!_||!x)throw console.error("IMG data-ko-editable must declare width and height attributes, or their placeholder counterparts data-ko-placeholder-width/data-ko-placeholder-height",e),"ERROR: IMG data-ko-editable MUST declare width and height attributes, or their placeholder counterparts data-ko-placeholder-width/data-ko-placeholder-height";var D=v(s,y,!1,"wysiwyg");o="wysiwygSrc: { width: "+p+", height: "+b+", src: "+D+", placeholder: "+A+" }",r=(null!==i?i+", ":"")+o,domutils.setAttribute(e,"data-bind",r);var R=c(e),B="{ width: "+p;"left"==k?B+=", float: 'left'":"right"==k?B+=", float: 'right'":"center"==k?console.log("non so cosa fa align=center su una img e quindi non so come simularne l'editing"):"top"==k?B+=", verticalAlign: 'top'":"middle"==k?B+=", verticalAlign: 'middle'":"bottom"==k&&(B+=", verticalAlign: 'bottom'"),B+="}",$(e).before("\x3c!-- ko wysiwygImg: { _data: $data, _item: "+l+", _template: '"+R+"', _editTemplate: 'img-wysiwyg', _src: "+D+", _width: "+p+", _height: "+b+", _align: "+(null===k?void 0:"'"+k+"'")+", _size: "+w+", _method: "+void 0+", _placeholdersrc: "+A+", _stylebind: "+B+" } --\x3e"),$(e).after("\x3c!-- /ko --\x3e")}}),$("[href]",t).each(function(t,e){var o=domutils.getAttribute(e,"href"),a="wysiwygHref: '"+converterUtils.addSlashes(o)+"'",i=domutils.getAttribute(e,"data-bind"),r=(null!==i?i+", ":"")+a;domutils.setAttribute(e,"data-bind",r)}),$("replacedblock",t).each(function(t,r){var s=u[t],m=processBlock(s,e,o,a,i,"block",n,d,!0,c),h=modelDef.ensurePathAndGetBindValue(e,o,l,n,"",m);$(r).before("\x3c!-- ko block: { data: "+converterUtils.addSlashes(h)+", template: 'block' } --\x3e"),$(r).after("\x3c!-- /ko --\x3e"),$(r).remove()}),$($("[data-ko-wrap]",t).get().reverse(),t).each(function(t,e){var o=domutils.getAttribute(e,"data-ko-wrap");if(void 0===o||""===o||"true"===o)throw"Unsupported empty value for data-ko-wrap: use false value if you want to always remove the tag";var a,i,r=converterUtils.conditionBinding(o,v),l=domutils.getAttribute(e,"data-bind");if(""!==l&&null!==l&&l.match(/(block|wysiwygOrHtml):/)){var d="\x3c!-- ko "+l+" --\x3e"+domutils.getInnerHtml(e)+"\x3c!-- /ko --\x3e";a=c(d),domutils.removeAttribute(e,"data-ko-wrap"),i=c(e),domutils.replaceHtml(e,"\x3c!-- ko template: /* special */ (typeof templateMode != 'undefined' && templateMode == 'wysiwyg') || "+r+" ? '"+i+"' : '"+a+"' --\x3e\x3c!-- /ko --\x3e")}else a=c(domutils.getInnerHtml(e)),domutils.removeAttribute(e,"data-ko-wrap"),domutils.setContent(e,"\x3c!-- ko template: '"+a+"' --\x3e\x3c!-- /ko --\x3e"),i=c(e),domutils.replaceHtml(e,"\x3c!-- ko template: (typeof templateMode != 'undefined' && templateMode == 'wysiwyg') || "+r+" ? '"+i+"' : '"+a+"' --\x3e\x3c!-- /ko --\x3e")}),c(t,n,"show"),a(l,n,r,d),n}catch(e){throw console.error("Exception while parsing the template",e,t),e}};function conditional_replace(t){return t.replace(/<!--\[if ([^\]]*)\]>((?:(?!--)[\s\S])*?)<!\[endif\]-->/g,function(t,e,o){var a="\x3c!-- cc:start --\x3e";a+=o.replace(/<([A-Za-z:]+)/g,"\x3c!-- cc:bo:$1 --\x3e<cc").replace(/<\/([A-Za-z:]+)>/g,"\x3c!-- cc:bc:$1 --\x3e</cc>\x3c!-- cc:ac:$1 --\x3e").replace(/\/>/g,"/>\x3c!-- cc:sc --\x3e"),a+="\x3c!-- cc:end --\x3e";var i='<replacedcc condition="'+e+'" style="display: none">';return i+=$("<div>").append($(a)).html().replace(/^<!-- cc:start -->/,"").replace(/<!-- cc:end -->$/,""),i+="</replacedcc>"})}var translateTemplate=function(t,e,o,a){var i={},r=conditional_replace(e.replace(/(<[^>]+\s)(style|http-equiv)(="[^"]*"[^>]*>)/gi,function(t,e,o,a){return e+"replaced"+o+a})),l=$(r),d=l[0],s=[],c=function(t,e,o,a){s.push({root:t,block:e,context:o,container:a})},n=function(t,e,o){if(void 0===i.themes&&(i.themes={}),void 0===i.themes[t]&&(i.themes[t]={}),void 0===i.themes[t][e]||null===i.themes[t][e])i.themes[t][e]=o;else if(void 0!==o&&null!==o){var a=i.themes[t][e];a!=o&&console.log("Error setting a new default for property "+e+" in theme "+t+". old:"+a+" new:"+o+"!")}},u={};$("[data-ko-container]",l).each(function(t,e){var o=domutils.getAttribute(e,"data-ko-container")+"Blocks";domutils.removeAttribute(e,"data-ko-container"),domutils.setAttribute(e,"data-bind","block: "+o);var a=$("> [data-ko-block]",e);domutils.removeElements(a,!0),u[o]=a}),modelDef.createOrUpdateBlockDef(i,"id"),modelDef.createOrUpdateBlockDef(i,"bodyTheme"),modelDef.createOrUpdateBlockDef(i,"blocks","blocks[]"),modelDef.createOrUpdateBlockDef(i,"text"),processBlock(d,i,n,c,o,"template",t,void 0,!1,a);var m=function(e,r,l){processBlock(l,i,n,c,o,"block",t,e,!0,a)};for(var h in u)if(u.hasOwnProperty(h)){var p=u[h],b=h;modelDef.ensurePathAndGetBindValue(i,n,t,t,"",b+".blocks","[]"),p.each(m.bind(void 0,b))}var v={_defs:i,templateName:t,_blocks:s};return void 0!==i[t]._version&&(v.version=i[t]._version),v};module.exports=translateTemplate;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./declarations.js":48,"./domutils.js":49,"./model.js":52,"./stylesheet.js":54,"./utils.js":55,"console-browserify":3}],54:[function(require,module,exports){
 | 
						|
"use strict";var cssParse=require("mensch/lib/parser.js"),console=require('console-browserify'),converterUtils=require("./utils.js"),elaborateDeclarations=require("./declarations.js"),_processStyleSheetRules_processBlockDef=function(e,t){for(var o,s,r,l=0;l<t.length;l++)if("rule"==t[l].type){for(var n=t[l].selectors,a=!1,i=!1,c=0;c<n.length;c++)n[c].match(/:preview$/)?i=!0:a=!0;if(i&&a)throw console.log("cannot mix selectors type (:preview and declarations) in @supports -ko-blockdefs ",n),"Cannot mix selectors type (:preview and declarations) in @supports -ko-blockdefs";if(!i&&!a)throw console.log("cannot find known selectors in @supports -ko-blockdefs ",n),"Cannot find known selectors in @supports -ko-blockdefs";if(a){o="",s={},r=t[l].declarations;for(var p=0;p<r.length;p++)"property"==r[p].type&&("label"==r[p].name?s.name=r[p].value:"context"==r[p].name?s.contextName=r[p].value:"properties"==r[p].name?o=r[p].value:"theme"==r[p].name?s.globalStyle="_theme_."+r[p].value:"themeOverride"==r[p].name?s.themeOverride="true"==String(r[p].value).toLowerCase():s[r[p].name]=r[p].value);for(var u=0;u<n.length;u++)e(n[u],o,s)}if(i)for(var d=0;d<n.length;d++){e(n[d].substr(0,n[d].indexOf(":")),void 0,{previewBindings:t[l].declarations})}}},processStylesheetRules=function(e,t,o,s,r,l,n,a){var i,c=e,p=null;if(void 0===t){var u=cssParse(e,{comments:!0,position:!0});if("stylesheet"!=u.type||void 0===u.stylesheet)throw console.log("unable to process styleSheet",u),"Unable to parse stylesheet";t=u.stylesheet.rules}for(var d=t.length-1;d>=0;d--){if("supports"==t[d].type&&"-ko-blockdefs"==t[d].name)_processStyleSheetRules_processBlockDef(s,t[d].rules),c=converterUtils.removeStyle(c,t[d].position.start,p,0,0,0,"");else if("media"==t[d].type||"supports"==t[d].type)c=processStylesheetRules(c,t[d].rules,o,s,r,l,n,a);else if("comment"==t[d].type);else if("rule"==t[d].type){for(var v=t[d].selectors,f="",h=null,y=0;y<v.length;y++){f.length>0&&(f+=", ");var m=v[y].match(/\[data-ko-block=([^ ]*)\]/);if(null!==m){if(null!==h&&h!=m[1])throw"Found multiple block-match attribute selectors: cannot translate it ("+h+" vs "+m[1]+")";h=m[1]}f+="\x3c!-- ko text: templateMode =='wysiwyg' ? '#main-wysiwyg-area ' : '' --\x3e\x3c!-- /ko --\x3e"+v[y]}if(h){var k="\x3c!-- ko foreach: $root.findObjectsOfType($data, '"+h+"') --\x3e",x=p,g=" ";t[d].declarations.length>0&&(t[d].declarations[0].position.start.line!=t[d].position.end.line&&(g="\n"+new Array(t[d].position.start.col).join(" ")),x=t[d].declarations[t[d].declarations.length-1].position.end),null===x?c+=g+"\x3c!-- /ko --\x3e":c=x==p?converterUtils.removeStyle(c,x,p,0,0,0,g+"\x3c!-- /ko --\x3e"):converterUtils.removeStyle(c,x,p,0,0,0,g+"}"+g+"\x3c!-- /ko --\x3e"),f=k+g+f.replace(new RegExp("\\[data-ko-block="+h+"\\]","g"),"\x3c!-- ko text: '#'+id() --\x3e"+h+"\x3c!-- /ko --\x3e"),s(h,"",{contextName:"block"})}var b=h||a;i=o.bind(this,b,"");var w=elaborateDeclarations(c,t[d].declarations,l,i);null!==w&&(c=w),c=converterUtils.removeStyle(c,t[d].position.start,t[d].position.end,0,0,0,f)}else console.log("Unknown rule type",t[d].type,"while parsing <style> rules");p=t[d].position.start}return c};module.exports=processStylesheetRules;
 | 
						|
 | 
						|
},{"./declarations.js":48,"./utils.js":55,"console-browserify":3,"mensch/lib/parser.js":16}],55:[function(require,module,exports){
 | 
						|
"use strict";var console=require('console-browserify'),jsep=require("jsep");jsep.addBinaryOp("or",1),jsep.addBinaryOp("and",2),jsep.addBinaryOp("eq",6),jsep.addBinaryOp("neq",6),jsep.addBinaryOp("lt",7),jsep.addBinaryOp("lte",7),jsep.addBinaryOp("gt",7),jsep.addBinaryOp("gte",7);var addSlashes=function(e){return e.replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")},removeStyle=function(e,r,n,t,o,i,a){for(var s=e.split("\n"),p=o,l=i,u=1+t;u<r.line;u++)p+=s[u-1-t].length+1;if(p+=r.col,null!==n){for(var d=1+t;d<n.line;d++)l+=s[d-1-t].length+1;l+=n.col}else l+=e.length+1;return e.substr(0,p-1)+a+e.substr(l-1)},expressionGenerator=function(e,r,n){return function e(r,n,t,o){if(void 0===t&&(t=!0),void 0!==o&&"Identifier"!==r.type&&"MemberExpression"!==r.type&&console.log("Cannot apply default value to variable when using expressions"),"BinaryExpression"===r.type||"LogicalExpression"===r.type)return"("+e(r.left,n,t)+" "+function(e){switch(e){case"or":return"||";case"and":return"&&";case"lt":return"<";case"lte":return"<=";case"gt":return">";case"gte":return">=";case"eq":return"==";case"neq":return"!=";default:return e}}(r.operator)+" "+e(r.right,n,t)+")";if("CallExpression"===r.type){var i=r.arguments.map(function(r){return e(r,n,t)});return e(r.callee,n,t)+"("+i.join(", ")+")"}if("UnaryExpression"===r.type)return r.operator+e(r.argument,n,t);if("MemberExpression"==r.type&&r.computed)throw"Unexpected computed member expression";if("MemberExpression"!=r.type||r.computed){if("Literal"===r.type)return r.raw;if("Identifier"===r.type){var a=r.name;return t?n(a,o)+"()":a}if("ConditionalExpression"===r.type)return"("+e(r.test,n,t)+" ? "+e(r.consequent,n,t)+" : "+e(r.alternate,n,t)+")";throw"Compound"===r.type?"Syntax error in expression: operator expected after "+e(r.body[0],n,!1):"Found an unsupported expression type: "+r.type}var s=e(r.object,n,!1)+"."+e(r.property,n,!1);return t&&"Math"!==r.object.name&&"Color"!==r.object.name&&"Util"!==r.object.name?n(s,o)+"()":s}(e,r,void 0,n)},expressionBinding=function(e,r,n){var t;if(void 0!==n&&null!==n){var o=e.trim().replace(/@\[([^\]]+)\]|@([a-zA-Z0-9\._]+)\b/g,"###var###");if("###var###"==(o=o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")))t=[null,n];else if(o="^"+o.replace(/###var###/g,"(.+)")+"$",!(t=n.trim().match(new RegExp(o))))throw console.log("Cannot find matches",t,"for",n,e,o,e),"Cannot find default value for "+e+" in "+n}try{var i=0,a="'"+e.replace(/@\[([^\]]+)\]|@([a-zA-Z0-9\._]+)\b|(')/g,function(e,n,o,a){if(a)return"\\"+a;i++;var s,p=n||o;if(t&&(void 0!==t[i]?s=t[i].trim():console.log("ABZZZ Cannot find default value for",p,"in",t,"as",i)),n){var l=jsep(n);return"'+"+expressionGenerator(l,r,s)+"+'"}return"'+"+r(p,s)+"()+'"})+"'";return a=a.replace(/(^|[^\\])''\+/g,"$1").replace(/\+''/g,""),0===i&&"false"!==a&&"true"!==a&&console.error("Unexpected expression with no valid @variable references",e),a}catch(r){throw"Exception parsing expression "+e+" "+r}},conditionBinding=function(e,r){var n=jsep(e);return expressionGenerator(n,r)};module.exports={addSlashes:addSlashes,removeStyle:removeStyle,conditionBinding:conditionBinding,expressionBinding:expressionBinding};
 | 
						|
 | 
						|
},{"console-browserify":3,"jsep":6}],56:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify');function wrap(e){var t=typeof e;if("object"===t&&(e?e.constructor==Date?t="date":"[object Array]"==Object.prototype.toString.call(e)&&(t="array"):t="null"),"array"==t){var n=ko.observableArray();if(!e||0===e.length)return n;for(var o=0,r=e.length;o<r;++o)n.push(wrap(e[o]));return n}if("object"==t){var a={};for(var i in e){var l=e[i];a[i]=wrap(l)}return ko.observable(a)}if("function"==t)return e;var s=ko.observable();return s(e),s}var _getOptionsObject=function(e){for(var t=e.split("|"),n={},o=0;o<t.length;o++){var r=t[o].split("=");n[r[0]]=r.length>1?r[1]:r[0]}return n},_makeComputed=function(e,t,n,o,r,a){return ko.computed({read:function(){var n=e();if(null===n){var i=ko.utils.unwrapObservable(o);return void 0===i||"custom"==i?ko.utils.unwrapObservable(t):a[i][r]}return n},write:function(i){var l,s=ko.utils.unwrapObservable(o);if(l=void 0===s||"custom"==s?ko.utils.peekObservable(t):a[s][r],n)e(i==l?null:i);else{var u=ko.utils.peekObservable(e);i==l&&null===u||e(i)}}})},_nextVariantFunction=function(e,t,n){for(var o=e.utils.unwrapObservable(t),r=0;r<n.length&&e.utils.peekObservable(n[r])!=o;r++);r==n.length&&(console.warn("Didn't find a variant!",t,o,n),r=n.length-1);var a=r+1;a==n.length&&(a=0),t(e.utils.peekObservable(n[a]))},_getVariants=function(e){var t=e._variant;if("object"!=typeof e[t]||void 0===e[t]._widget||"string"!=typeof e[t]._options&&"boolean"!==e[t]._widget)throw console.error("Unexpected variant declaration",t,e[t]),"Unexpected variant declaration: cannot find property "+t+" or its _options string and it is not a boolean";return"string"==typeof e[t]._options?Object.keys(_getOptionsObject(e[t]._options)):[!0,!1]},_makeComputedFunction=function(e,t,n,o,r,a,i){if(void 0===e){if(void 0===o.utils.unwrapObservable(i).type)throw console.log("TODO ERROR Found a non-typed def ",e,i),"Found a non-typed def "+e;var l=o.utils.unwrapObservable(o.utils.unwrapObservable(i).type);"object"!=typeof(e=t[l])&&console.log("TODO ERROR Found a non-object def ",e,"for",l)}void 0===r&&void 0!==a&&a&&(r=i);var s="$root.content().",u=e._globalStyles;if(void 0!==u)for(var p in u)if(u.hasOwnProperty(p)){var b,c,v,d="$root.content().theme().scheme";if(u[p].substr(0,s.length)!=s)throw"UNEXPECTED globalStyle path ("+u[p]+") outside selfPath ("+s+")";v=u[p].substr(s.length),c=r,d.substr(0,s.length)==s?b=d.substr(s.length):(console.log("IS THIS CORRECT?",d,s),b=d);for(var f=c,h=v.split("()."),_="",k=!0,g=0;g<h.length;g++)c=o.utils.unwrapObservable(c)[h[g]],k?"theme"==h[g]&&(k=!1):(_.length>0&&(_+="."),_+=h[g]);for(var m=b.split("()."),w=0;w<m.length;w++)f=o.utils.unwrapObservable(f)[m[w]];for(var O=p.split("."),y=i,R=0;R<O.length;R++)y=o.utils.unwrapObservable(y)[O[R]];if(!o.isObservable(y))throw"Unexpected non observable target "+p+"/"+_;y._defaultComputed=_makeComputed(y,c,!0,f,_,n)}if(void 0!==e._variant){for(var j=e._variant.split("."),F=i,S=o.utils.unwrapObservable(i),C=0;C<j.length;C++)F=o.utils.unwrapObservable(F)[j[C]];if(void 0!==F._defaultComputed&&(console.log("Found variant on a style property: beware variants should be only used on content properties because they don't match the theme fallback behaviour",e._variant),F=F._defaultComputed),void 0===F)throw console.log("ERROR looking for variant target",e._variant,i),"ERROR looking for variant target "+e._variant;S._nextVariant=_nextVariantFunction.bind(F,o,F,_getVariants(e))}for(var x in e)if(e.hasOwnProperty(x)){var P=e[x];if("object"==typeof P&&null!==P&&void 0!==P._context&&"block"==P._context){var B=r[x](),E=_makeComputedFunction(t[x],t,n,o,r,a,B);i[x](E)}else if("object"==typeof P&&null!==P&&"blocks"==P.type){for(var D,I,T,A=r[x](),V=A.blocks(),U=0;U<V.length;U++)D=o.utils.unwrapObservable(V[U]),I=o.utils.unwrapObservable(D.type),T=_makeComputedFunction(t[I],t,n,o,r,a,D),V[U](T);var W=A.blocks;_augmentBlocksObservable(W,_blockInstrumentFunction.bind(A,void 0,t,n,o,void 0,r,a)),r[x]._wrap=_makeBlocksWrap.bind(r[x],W._instrumentBlock),r[x]._unwrap=_unwrap.bind(r[x])}}return i},_augmentBlocksObservable=function(e,t){e._instrumentBlock=t,void 0===e.origPush&&(e.origPush=e.push,e.push=_makePush.bind(e),e.origSplice=e.splice,e.splice=_makeSplice.bind(e))},_makeBlocksWrap=function(e,t){var n=ko.toJS(t),o=n.blocks;n.blocks=[];var r=wrap(n)();_augmentBlocksObservable(r.blocks,e);for(var a=0;a<o.length;a++){var i=ko.toJS(o[a]);i.id="block_"+a,r.blocks.push(i)}this(r)},_makePush=function(){if(arguments.length>1)throw"Array push with multiple arguments not implemented";if(arguments.length>0&&ko.isObservable(arguments[0])&&("function"==typeof arguments[0]._unwrap?arguments[0]=arguments[0]._unwrap():console.log("WARN: pushing observable with no _unwrap function (TODO remove me, expected condition)")),ko.isObservable(arguments[0]))return this.origPush.apply(this,arguments);var e=this._instrumentBlock(arguments[0]);return this.origPush.apply(this,[e])},_makeSplice=function(){if(arguments.length>3)throw"Array splice with multiple objects not implemented";if(arguments.length>2&&ko.isObservable(arguments[2])&&("function"==typeof arguments[2]._unwrap?arguments[2]=arguments[2]._unwrap():console.log("WARN: splicing observable with no _unwrap function (TODO remove me, expected condition)")),arguments.length>2&&!ko.isObservable(arguments[2])){var e=this._instrumentBlock(arguments[2]);return this.origSplice.apply(this,[arguments[0],arguments[1],e])}return this.origSplice.apply(this,arguments)},_blockInstrumentFunction=function(e,t,n,o,r,a,i,l){void 0===r&&(r=l);var s=wrap(r);return s(_makeComputedFunction(e,t,n,o,a,i,s())),s._unwrap=_unwrap.bind(s),s},_wrap=function(e,t){this(ko.utils.unwrapObservable(e(ko,t,void 0,!0)))},_unwrap=function(){return ko.toJS(this)},_modelInstrument=function(e,t,n){var o=_blockInstrumentFunction.bind(void 0,t,n,n.themes),r=o(ko,e,void 0,!0);return r._wrap=_wrap.bind(r,o),r._unwrap=_unwrap.bind(r),r};module.exports=_modelInstrument;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],57:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
var tinycolor=require('tinycolor2');function Color(t){this.getBrightness=function(n){return t(n).getBrightness()},this.isLight=function(n){return t(n).isLight()},this.isDark=function(n){return t(n).isDark()},this.getLuminance=function(n){return t(n).getLuminance()},this.lighten=function(n,i){return t(n).lighten(i).toHexString()},this.brighten=function(n,i){return t(n).brighten(i).toHexString()},this.darken=function(n,i){return t(n).darken(i).toHexString()},this.desaturate=function(n,i){return t(n).desaturate(i).toHexString()},this.saturate=function(n,i){return t(n).saturate(i).toHexString()},this.greyscale=function(n){return t(n).greyscale().toHexString()},this.spin=function(n,i){return t(n).spin(i).toHexString()},this.complement=function(n){return t(n).complement().toHexString()},this.mix=t.mix,this.readability=t.readability,this.isReadable=t.isReadable,this.mostReadable=t.mostReadable}var colorPlugin=function(t){global.Color=new Color(tinycolor)};module.exports=colorPlugin;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"tinycolor2":20}],58:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var console=require('console-browserify'),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),inlineDocument=require("juice/lib/inline")({}).inlineDocument,inlinerPlugin=function(e){e.inline=function(e){$("[style]:not([replacedstyle])",e).each(function(e,n){var t=$(n);t.attr("replacedstyle",t.attr("style"))});var n=[];$('style[data-inline="true"]',e).each(function(e,t){var i=$(t).html();i=(i=i.replace(/<!-- ko ((?!--).)*? -->/g,"")).replace(/<!-- \/ko -->/g,""),n.push(i),$(t).removeAttr("data-inline")});var t=n.join("\n"),i=function(n,t){return void 0===t&&(t=e),$(n,t)};i.root=function(){return $(":root",e)},inlineDocument(i,t,{styleAttributeName:"replacedstyle"})}};module.exports=inlinerPlugin;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3,"juice/lib/inline":7}],59:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var console=require('console-browserify'),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),$=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),lsLoader=function(e,t){var a=global.localStorage.getItem("metadata-"+e);if(null!==a){var o,l=global.localStorage.getItem("template-"+e);null!==l&&(o=JSON.parse(l));var n=JSON.parse(a);return{metadata:n,model:o,extension:lsCommandPluginFactory(n,t)}}throw"Cannot find stored data for "+e},lsCommandPluginFactory=function(e,t){return function(e,a,o){var l={name:"Save",enabled:ko.observable(!0),execute:function(){l.enabled(!1),o.metadata.changed=Date.now(),void 0===o.metadata.key&&(console.warn("Unable to find key in metadata object...",o.metadata),o.metadata.key=e),global.localStorage.setItem("metadata-"+e,o.exportMetadata()),global.localStorage.setItem("template-"+e,o.exportJSON()),l.enabled(!0)}},n={name:"Test",enabled:ko.observable(!0)},r={name:"Download",enabled:ko.observable(!0)};n.execute=function(){n.enabled(!1);var l=global.localStorage.getItem("testemail");if(null!==l&&"null"!=l||(l=o.t("Insert here the recipient email address")),(l=global.prompt(o.t("Test email address"),l)).match(/@/)){global.localStorage.setItem("testemail",l),console.log("TODO testing...",l);var r=t||"/dl/",d=$.post(r,{action:"email",rcpt:l,subject:"[test] "+e+" - "+a,html:o.exportHTML()},null,"html");d.fail(function(){console.log("fail",arguments),o.notifier.error(o.t("Unexpected error talking to server: contact us!"))}),d.success(function(){console.log("success",arguments),o.notifier.success(o.t("Test email sent..."))}),d.always(function(){n.enabled(!0)})}else global.alert(o.t("Invalid email address")),n.enabled(!0)},r.execute=function(){r.enabled(!1),o.notifier.info(o.t("Downloading...")),o.exportHTMLtoTextarea("#downloadHtmlTextarea");var e=t||"/dl/";global.document.getElementById("downloadForm").setAttribute("action",e),global.document.getElementById("downloadForm").submit(),r.enabled(!0)},o.save=l,o.test=n,o.download=r}.bind(void 0,e.key,e.name)};module.exports=lsLoader;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],60:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
var utilPlugin=function(e){global.Util={decodeURI:decodeURI,encodeURI:encodeURI,decodeURIComponent:decodeURIComponent,encodeURIComponent:encodeURIComponent}};module.exports=utilPlugin;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{}],61:[function(require,module,exports){
 | 
						|
"use strict";require("knockout-sortable"),require("./bindings/jqueryui-spinner.js"),require("./bindings/jqueryui-tabs.js"),require("./bindings/colorpicker.js"),require("./bindings/blocks.js"),require("./bindings/csstext.js"),require("./bindings/bind-iframe.js"),require("./bindings/droppable.js"),require("./bindings/fileupload.js"),require("./bindings/virtuals.js"),require("./bindings/wysiwygs.js"),require("./bindings/scrollfix.js"),require("./bindings/if-subs.js"),require("./bindings/extsortables.js"),require("./bindings/eventable.js"),require("./bindings/tooltips.js"),require("./bindings/extender-pagination.js"),require("./bindings/validated-value.js"),require("./bindings/scrollintoview.js");
 | 
						|
 | 
						|
},{"./bindings/bind-iframe.js":26,"./bindings/blocks.js":27,"./bindings/colorpicker.js":29,"./bindings/csstext.js":30,"./bindings/droppable.js":31,"./bindings/eventable.js":32,"./bindings/extender-pagination.js":33,"./bindings/extsortables.js":34,"./bindings/fileupload.js":35,"./bindings/if-subs.js":36,"./bindings/jqueryui-spinner.js":37,"./bindings/jqueryui-tabs.js":38,"./bindings/scrollfix.js":40,"./bindings/scrollintoview.js":41,"./bindings/tooltips.js":43,"./bindings/validated-value.js":44,"./bindings/virtuals.js":45,"./bindings/wysiwygs.js":46,"knockout-sortable":11}],62:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),kojqui=(typeof window !== "undefined" ? window['kojqui'] : typeof global !== "undefined" ? global['kojqui'] : null),templateConverter=require("./converter/main.js"),console=require('console-browserify'),initializeViewmodel=require("./viewmodel.js"),templateSystem=require("./bindings/choose-template.js"),pluginsCall=function(e,t,n,o){var a,i,r,d,l;l=[],void 0!==o&&o?(a=e.length-1,i=0,r=-1):(a=0,i=e.length-1,r=1);for(var s=a;s!=i+r;s+=r)void 0!==e[s][t]&&void 0!==(d=e[s][t].apply(e[s],n))&&l.push(d);return l},origDisposeCallback=ko.utils.domNodeDisposal.addDisposeCallback;ko.utils.domNodeDisposal.addDisposeCallback=function(e,t){origDisposeCallback(e,function(e){try{t(e)}catch(e){console.warn("Caught unexpected dispose callback exception",e)}})};var bindingPluginMaker=function(e){return{viewModel:function(t){try{e("applyBindings",ko.applyBindings.bind(void 0,t))}catch(e){throw console.warn(e,e.stack),e}},dispose:function(){try{e("unapplyBindings",ko.cleanNode.bind(this,global.document.body))}catch(e){throw console.warn(e,e.stack),e}}}},templateCreator=function(e,t,n,o){var a=n;for(void 0!==n&&void 0!==o&&("object"==typeof t&&"replacedhtml"==t.tagName.toLowerCase()||(a+="-"+o));void 0===a||null===a||e.exists(a);)a="anonymous-"+Math.floor(1e5*Math.random()+1);if("object"==typeof t&&"replacedhtml"==t.tagName.toLowerCase()){var i=$(t),r=$("replacedhead",i),d=$("replacedbody",i);e.adder(a+"-head",r.html()||""),e.adder(a+"-show",d.html()||""),e.adder(a+"-preview",i.html()),e.adder(a+"-wysiwyg",i.html()),r.children().detach(),r.html("\x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e"),r.before("\x3c!-- ko withProperties: { templateMode: 'head' } --\x3e"),r.after("\x3c!-- /ko --\x3e"),d.html("\x3c!-- ko block: content --\x3e\x3c!-- /ko --\x3e"),e.adder(a+"-iframe",i[0].outerHTML)}else"object"==typeof t?e.adder(a,t.outerHTML):e.adder(a,t);return a};function _viewModelPluginInstance(e){var t;return{viewModel:function(n){t=e(n)},init:function(){void 0!==t&&void 0!==t.init&&t.init()},dispose:function(){void 0!==t&&void 0!==t.dispose&&t.dispose()}}}var _templateUrlConverter=function(e,t){return t.match(/^[^\/]*:/)||t.match(/^\//)||t.match(/^\[/)||t.match(/^#?$/)?null:e+t},templateLoader=function(e,t,n,o,a,i){var r="string"==typeof t?t:n.template,d="./",l=r.lastIndexOf("/");-1!=l&&(d=r.substr(0,l+1));var s,c=_templateUrlConverter.bind(void 0,d);s=void 0===n?{template:r,name:"No name",created:Date.now()}:n,$.get(r,function(t){templateCompiler(e,c,"template",t,o,s,a,i).init()})},templateCompiler=function(e,t,n,o,a,i,r,d){var l=o.match(/^([\S\s]*)([<]html[^>]*>[\S\s]*<\/html>)([\S\s]*)$/i);if(null===l)throw"Unable to find <html> opening and closing tags in the template";var s=l[1],c={"<html":0,"<head":0,"<body":0,"</html":0,"</body":0,"</head":0},m=l[2].replace(/(<\/?)(html|head|body)([^>]*>)/gi,function(e,t,n,o){return c[(t+n).toLowerCase()]+=1,t+"replaced"+n+o});for(var u in c)if(c.hasOwnProperty(u)&&1!=c[u]){if(0===c[u])throw"ERROR: missing mandatory element "+u+">";if(c[u]>1)throw"ERROR: multiple element "+u+"> occourences are not supported (found "+c[u]+" occourences)"}var p=l[3],h=[],b=[];if(void 0!==r)for(var v=0;v<r.length;v++)"function"==typeof r[v]?b.push(_viewModelPluginInstance(r[v])):b.push(r[v]);var g=[],f={adder:function(e,t){if("string"!=typeof t)throw"Template system: cannot create new template "+e;var n=t.match(/(data)?-ko-[^ =:]*/g);n&&console.error("ERROR: found unexpected -ko- attribute in compiled template",e,", you probably mispelled it:",n),templateSystem.addTemplate(e,t),g.push(e)},exists:function(e){return void 0!==templateSystem.getTemplateContent(e)},dispose:function(){for(var e=g.length-1;e>=0;e--)templateSystem.removeTemplate(g[e])}};ko.bindingHandlers.block.templateExists=f.exists;for(var y=templateCreator.bind(void 0,f),k=e("translateTemplate",templateConverter.translateTemplate.bind(void 0,n,m,t,y)),w=e("generateModel",templateConverter.wrappedResultModel.bind(void 0,k)),C={},x=pluginsCall(b,"widget",[$,ko,kojqui]),S=0;S<x.length;S++)C[x[S].widget]=x[S];h.push.apply(h,e("generateEditors",templateConverter.generateEditors.bind(void 0,k,C,t,y,"+$root.contentListeners()")));var E=!1;if(void 0!==a&&null!==a){var M;M="string"==typeof a?ko.utils.parseJson(a):a,2==e("checkModel",templateConverter.checkModel.bind(void 0,w._unwrap(),h,M))&&(console.error("Trying to compile an incompatible template version!",w._unwrap(),h,M),E=!0);try{w._wrap(M)}catch(e){console.error("Unable to inject model content!",e),E=!0}}var T=s+templateSystem.getTemplateContent(n+"-iframe").replace(/(<\/?)replaced(html|head|body)([^>]*>)/gi,function(e,t,n,o){return t+n+o})+p,L=ko.bindingHandlers.bindIframe.tpl;ko.bindingHandlers.bindIframe.tpl=T;var I={dispose:function(){ko.bindingHandlers.bindIframe.tpl=L}};b.push(I),b.push(f);var D=e("initializeViewmodel",initializeViewmodel.bind(this,w,h,t,d));D.metadata=i;return void 0!==D.metadata.editorversion&&"0.16.0"!==D.metadata.editorversion&&console.warn("The model being loaded has been created with an older editor version",D.metadata.editorversion,"vs","0.16.0"),D.metadata.editorversion="0.16.0",void 0!==k.version&&(void 0!==D.metadata.templateversion&&D.metadata.templateversion!==k.version&&console.error("The model being loaded has been created with a different template version",k.version,"vs",D.metadata.templateversion),D.metadata.templateversion=k.version),templateSystem.init(),b.push(bindingPluginMaker(e)),pluginsCall(b,"viewModel",[D]),E&&$("#incompatible-template").dialog({modal:!0,appendTo:"#mo-body",buttons:{Ok:function(){$(this).dialog("close")}}}),{model:D,init:function(){pluginsCall(b,"init",void 0,!0)},dispose:function(){pluginsCall(b,"dispose",void 0,!0)}}},checkFeature=function(e,t){if(!t())throw console.warn("Missing feature",e),"Missing feature "+e},isCompatible=function(){try{return checkFeature("matchMedia",function(){return void 0!==global.matchMedia}),checkFeature("XMLHttpRequest 2",function(){return"XMLHttpRequest"in global&&"withCredentials"in new global.XMLHttpRequest}),checkFeature("ES5 strict",function(){return function(){return void 0===this}()}),checkFeature("CSS borderRadius",function(){return void 0!==global.document.body.style.borderRadius}),checkFeature("CSS boxShadow",function(){return void 0!==global.document.body.style.boxShadow}),checkFeature("CSS boxSizing",function(){return void 0!==global.document.body.style.boxSizing}),checkFeature("CSS backgroundSize",function(){return void 0!==global.document.body.style.backgroundSize}),checkFeature("CSS backgroundOrigin",function(){return void 0!==global.document.body.style.backgroundOrigin}),checkBadBrowserExtensions(),!0}catch(e){return!1}},checkBadBrowserExtensions=function(){var e="checkbadbrowsersframe",t=ko.bindingHandlers.bindIframe.tpl;ko.bindingHandlers.bindIframe.tpl='<!DOCTYPE html>\r\n<html>\r\n<head><title>A</title>\r\n</head>\r\n<body><p style="color: blue" align="right" data-bind="style: { color: \'red\' }">B</p><div data-bind="text: content"></div></body>\r\n</html>\r\n',$("body").append('<iframe id="'+e+'" data-bind="bindIframe: $data"></iframe>');var n=global.document.getElementById(e);ko.applyBindings({content:"dummy content"},n);var o=n.contentWindow.document.doctype,a="<!DOCTYPE "+o.name+(o.publicId?' PUBLIC "'+o.publicId+'"':"")+(!o.publicId&&o.systemId?" SYSTEM":"")+(o.systemId?' "'+o.systemId+'"':"")+">"+"\n"+n.contentWindow.document.documentElement.outerHTML;ko.cleanNode(n),ko.removeNode(n),ko.bindingHandlers.bindIframe.tpl=t;var i='<!DOCTYPE html>\n<html><head><title>A</title>\n</head>\n<body><p align="right" style="color: red;" data-bind="style: { color: \'red\' }">B</p><div data-bind="text: content">dummy content</div>\n\n</body></html>',r='<!DOCTYPE html>\n<html><head><title>A</title>\n</head>\n<body><p style="color: red;" data-bind="style: { color: \'red\' }" align="right">B</p><div data-bind="text: content">dummy content</div>\n\n</body></html>',d='<!DOCTYPE html>\n<html><head><title>A</title>\n</head>\n<body><p style="color: red;" align="right" data-bind="style: { color: \'red\' }">B</p><div data-bind="text: content">dummy content</div>\n\n</body></html>';if(i!==a&&r!==a&&d!==a)throw console.info("BadBrowser.FrameContentCheck",a.length,i.length,r.length,d.length,a==i,a==r,a==d),console.info(a),"Unexpected frame content. Misbehaving browser: "+a.length+"/"+i.length+"/"+r.length+"/"+d.length},fixPageEvents=function(){global.addEventListener&&(global.addEventListener("drag",function(e){(e=e||global.event).preventDefault()},!1),global.addEventListener("dragstart",function(e){(e=e||global.event).preventDefault()},!1),global.addEventListener("dragover",function(e){(e=e||global.event).preventDefault()},!1),global.addEventListener("drop",function(e){(e=e||global.event).preventDefault()},!1),global.document.body.addEventListener("drop",function(e){e.preventDefault()},!1)),global.document.ondragstart&&(global.document.ondragstart=function(){return!1})};module.exports={compile:templateCompiler,load:templateLoader,isCompatible:isCompatible,fixPageEvents:fixPageEvents};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./bindings/choose-template.js":28,"./converter/main.js":51,"./viewmodel.js":67,"console-browserify":3}],63:[function(require,module,exports){
 | 
						|
"use strict";var console=require('console-browserify'),_call=function(e){return e()},logs=[],_timedCall=function(e,o){var l,t=(new Date).getTime();"object"==typeof console&&console.time&&console.time(e),l=_call(o),"object"==typeof console&&console.time&&console.timeEnd(e);var n=(new Date).getTime()-t;return"object"!=typeof console||console.time||console.log(e,"took",n,"ms"),logs.push({name:e,time:n}),logs.length>100&&logs.unshift(),l};module.exports={timedCall:_timedCall,logs:logs};
 | 
						|
 | 
						|
},{"console-browserify":3}],64:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),undoManager=require("./undomanager.js"),undoserializer=require("./undoserializer.js"),addUndoStackExtensionMaker=function(e){return function(n){n.contentListeners(n.contentListeners()+2);var o=undoManager(n.content,{levels:100,undoLabel:ko.computed(function(){return n.t("Undo (#COUNT#)")}),redoLabel:ko.computed(function(){return n.t("Redo")})});return n.undo=o.undoCommand,n.undo.execute=e.bind(n,"undo",n.undo.execute),n.redo=o.redoCommand,n.redo.execute=e.bind(n,"redo",n.redo.execute),n.undoReset=e.bind(n,"undoReset",o.reset),n.setUndoModeMerge=o.setModeMerge,n.setUndoModeOnce=o.setModeOnce,o.setModeIgnore(),o.setUndoActionMaker(undoserializer.makeUndoAction.bind(void 0,n.content)),undoserializer.watchEnabled(!0),{pause:function(){o.setModeIgnore()},run:function(){o.setModeOnce()},init:function(){o.setModeOnce()},dispose:function(){n.contentListeners(n.contentListeners()-2),undoserializer.watchEnabled(!1),o.dispose()}}}};module.exports=addUndoStackExtensionMaker;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./undomanager.js":65,"./undoserializer.js":66}],65:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),reactor=require('ko-reactor/dist/ko-reactor.min.js'),console=require('console-browserify'),undoManager=function(e,o){var t,n=ko.observableArray(),r=ko.observableArray(),i=0,d=0,u={levels:100,undoLabel:"undo (#COUNT#)",redoLabel:"redo (#COUNT#)"};o="object"==typeof o?ko.utils.extend(u,o):u;var l=function(e){1==i?c(e,r):2==i?c(e,n):0==i&&(c(e,n),r.removeAll())},c=function(e,n){if(n().length>0){var r=(i=n()[n().length-1],d=e,void 0!==i.mergedAction?i.mergedAction(d):null);if(null!==r)return void(n()[n().length-1]=r)}var i,d;n().length>=o.levels&&n.shift(),t=n,n.push(e)},a=function(e,o,n){return{name:ko.computed(function(){return ko.utils.unwrapObservable(e).replace(/#COUNT#/,n().length)}),enabled:ko.computed(function(){return 0!==n().length}),execute:function(){var e=n.pop();if(e){var r=i;i=o;var u=d;d=3,e(),s(t),d=u,i=r}return!0}}},s=function(e){if(void 0===e)throw"Unexpected operation: stack cleaner called with undefined stack";e().length>0&&void 0!==e()[e().length-1].mergedAction&&delete e()[e().length-1].mergedAction},f=function(e,o){var t=function(e,o){e(),o()}.bind(void 0,e,o);return void 0!==e.mergedAction&&(t.mergedAction=e.mergedAction),t},m=function(e,o,t){if(void 0!==o)e(o);else{if(!t)throw"Unexpected condition: no item and no child.oldValues!";if("deleted"==t.status)e.splice(t.index,0,t.value);else{if("added"!=t.status)throw"Unsupported item.status: "+t.status;e.splice(t.index,1)}}},v=function(e,o,t,n,r){return e.bind(void 0,t,n,r)},g=("function"==typeof reactor?reactor:ko.watch)(e,{depth:-1,oldValues:1,mutable:!0,tagFields:!0},function(e,o,t){var n=void 0!==o.oldValues?o.oldValues[0]:void 0,r=v(m,e,o,n,t);1!=d&&(3==d?void 0!==r&&(r.mergedAction=function(e){return void 0!==e.mergeMe&&e.mergeMe?f(e,this):null},r.mergeMe=!0):void 0!==r&&(o.oldValues&&2==d&&(r.mergedAction=function(e,o,t){return"object"==typeof t.mergeableAction&&e==t.mergeableAction.child?this:null}.bind(r,o,t),r.mergeableAction={child:o,item:t}),t&&"deleted"==t.status?r.mergedAction=function(e,o,t){return"object"==typeof t.mergeableMove&&o.value==t.mergeableMove.item.value?f(t,this):null}.bind(r,o,t):t&&"added"==t.status?r.mergeableMove={child:o,item:t}:t&&console.warn("Unsupported item.status",t.status)),void 0!==r&&l(r))},{});return{push:l,undoCommand:a(o.undoLabel,1,n),redoCommand:a(o.redoLabel,2,r),reset:function(){n.removeAll(),r.removeAll()},setModeOnce:function(){d=2,s(n)},setModeMerge:function(){d=3,s(n)},setModeNormal:function(){d=0,s(n)},setModeIgnore:function(){d=1,s(n)},setUndoActionMaker:function(e){v=e},dispose:function(){g.dispose()}}};module.exports=undoManager;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3,"ko-reactor/dist/ko-reactor.min.js":12}],66:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var listener,watchEnabled,ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify'),_reference=function(e,n){for(var t,r,o=0,a=e;o<n.length;)switch(n.charAt(o)){case"(":")"==n.charAt(o+1)&&(a=a()),o+=2;break;case"[":r=n.indexOf("]",o),a=a[n.substring(o+1,r)],o=r+1;break;case".":-1==(t=n.indexOf("(",o))&&(t=n.length),-1==(r=n.indexOf("[",o))&&(r=n.length),r=Math.min(t,r),a=a[n.substring(o+1,r)],o=r}return a},_getPath=function(e,n){for(var t,r="",o=0;o<=e.length;o++)if(t=o<e.length?e[o]:n,ko.isObservable(t)&&(r+="()"),void 0!==t._fieldName)r+="."+t._fieldName;else{if(!(o>0&&"function"==typeof e[o-1].pop))throw console.error("Unexpected parent with no _fieldName and no parent array",o,e),"Unexpected parent with no _fieldName and no parent array";var a=ko.isObservable(e[o-1])?ko.utils.peekObservable(e[o-1]):e[o-1],i=ko.utils.arrayIndexOf(a,t);if(-1==i)throw console.error("Unexpected object not found in parent array",a,t,o,e.length,ko.toJS(a),ko.utils.unwrapObservable(t)),"Unexpected object not found in parent array";r+="["+i+"]"}return r},makeDereferencedUndoAction=function(e,n,t,r,o){e(_reference(n,t),r,o)},_setListener=function(e){listener=e},makeUndoActionDereferenced=function(e,n,t,r,o,a){try{var i=_getPath(t,r);if("object"!=typeof o&&"function"!=typeof o||(o=ko.toJS(o)),void 0!==a&&("object"==typeof a.value||"function"==typeof a.value))a=ko.toJS(a);if(void 0!==listener)try{listener(i,r,o,a)}catch(e){console.log("Undoserializer ignoring exception in listener callback")}return makeDereferencedUndoAction.bind(void 0,n,e,i,o,a)}catch(e){console.error("Exception processing undo",e,t,r,a)}},_watchEnabled=function(e){if(void 0===e)return watchEnabled;watchEnabled=e};module.exports={dereference:_getPath,reference:_reference,makeUndoAction:makeUndoActionDereferenced,setListener:_setListener,watchEnabled:_watchEnabled};
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"console-browserify":3}],67:[function(require,module,exports){
 | 
						|
(function (global){
 | 
						|
"use strict";var $=(typeof window !== "undefined" ? window['jQuery'] : typeof global !== "undefined" ? global['jQuery'] : null),ko=(typeof window !== "undefined" ? window['ko'] : typeof global !== "undefined" ? global['ko'] : null),console=require('console-browserify'),performanceAwareCaller=require("./timed-call.js").timedCall,toastr=require("toastr");function initializeEditor(e,o,t,l){var r={galleryRecent:ko.observableArray([]).extend({paging:16}),galleryRemote:ko.observableArray([]).extend({paging:16}),selectedBlock:ko.observable(null),selectedItem:ko.observable(null),selectedTool:ko.observable(0),selectedImageTab:ko.observable(0),dragging:ko.observable(!1),draggingImage:ko.observable(!1),galleryLoaded:ko.observable(!1),showPreviewFrame:ko.observable(!1),previewMode:ko.observable("mobile"),showToolbox:ko.observable(!0),showTheme:ko.observable(!1),showGallery:ko.observable(!1),debug:ko.observable(!1),contentListeners:ko.observable(0),logoPath:"dist/img/mosaico32.png",logoUrl:".",logoAlt:"mosaico"};return r.content=e,r.blockDefs=o,r.notifier=toastr,r.tt=function(e,o){if(void 0!==o)for(var t in o)o.hasOwnProperty(t)&&(e=e.replace(new RegExp("__"+t+"__","g"),o[t]));return e},r.t=r.tt,r.ut=function(e,o){return o},r.templatePath=t,r.remoteUrlProcessor=function(e){return e},r.remoteFileProcessor=function(e){return void 0!==e.url&&(e.url=r.remoteUrlProcessor(e.url)),void 0!==e.thumbnailUrl&&(e.thumbnailUrl=r.remoteUrlProcessor(e.thumbnailUrl)),e},r.loadGallery=function(){r.galleryLoaded("loading");var e=l||"/upload/";$.getJSON(e,function(e){for(var o=0;o<e.files.length;o++)e.files[o]=r.remoteFileProcessor(e.files[o]);r.galleryLoaded(e.files.length),r.galleryRemote(e.files.reverse())}).fail(function(){r.galleryLoaded(!1),r.notifier.error(r.t("Unexpected error listing files"))})},r.fileToImage=function(e,o,t){return e.url},r.removeBlock=function(e,o){ko.utils.unwrapObservable(r.selectedBlock)==ko.utils.unwrapObservable(e)&&r.selectBlock(null,!0);var t=o.blocks.remove(e);return r.notifier.info(r.t("Block removed: use undo button to restore it...")),t},r.duplicateBlock=function(e,o){var t=ko.utils.unwrapObservable(e),l=ko.toJS(ko.utils.unwrapObservable(o.blocks)[t]);void 0!==l.id&&(l.id=""),o.blocks.splice(t+1,0,l)},r.moveBlock=function(e,o,t){var l=ko.utils.unwrapObservable(e),n=ko.utils.unwrapObservable(o.blocks);if(t&&l>0||!t&&l<n.length-1){var a=l+(t?-1:1),c=n[a];r.startMultiple(),o.blocks.splice(a,1),o.blocks.splice(l,0,c),r.stopMultiple()}},r.loadDefaultBlocks=function(){var e=ko.toJS(r.content().mainBlocks);e.blocks=[];for(var o=ko.utils.unwrapObservable(r.blockDefs),t=0;t<o.length;t++){var l=ko.toJS(o[t]);l.id="block_"+t,e.blocks.push(l)}performanceAwareCaller("setMainBlocks",r.content().mainBlocks._wrap.bind(r.content().mainBlocks,e))},r.addImage=function(e){var o=$("#main-wysiwyg-area .selectable-img.selecteditem");return 1==o.length&&"object"==typeof e&&void 0!==e.url&&(ko.contextFor(o[0])._src(e.url),!0)},r.addBlock=function(e,o){var t,l,n=r.selectedBlock();if(null!==n)for(var a=r.content().mainBlocks().blocks().length-1;a>=0;a--)if(r.content().mainBlocks().blocks()[a]()==n){t=a;break}void 0!==t?(l=t+1,r.content().mainBlocks().blocks.splice(l,0,e),r.notifier.info(r.t("New block added after the selected one (__pos__)",{pos:l}))):(r.content().mainBlocks().blocks.push(e),l=r.content().mainBlocks().blocks().length-1,r.notifier.info(r.t("New block added at the model bottom (__pos__)",{pos:l})));var c=r.content().mainBlocks().blocks()[l]();return r.selectBlock(c,!0),!1},r.findObjectsOfType=function(e,o){var t=[],l=ko.utils.unwrapObservable(e);for(var r in l)if(l.hasOwnProperty(r)){var n=ko.utils.unwrapObservable(l[r]);if(r.match(/Blocks$/))for(var a=ko.utils.unwrapObservable(n.blocks),c=0;c<a.length;c++){var i=ko.utils.unwrapObservable(a[c]);null!==o&&ko.utils.unwrapObservable(i.type)!=o||t.push(i)}else"object"==typeof n&&null!==n&&(null!==o&&ko.utils.unwrapObservable(n.type)!=o||t.push(n))}return t},r.placeholderHelper={element:function(e){return $(e[0].outerHTML).removeClass("ui-draggable").addClass("sortable-placeholder").css("display","block").css("position","relative").css("width","100%").css("height","auto").css("opacity",".8")[0]},update:function(e,o){}},r.startMultiple=function(){void 0!==r.setUndoModeMerge&&r.setUndoModeMerge()},r.stopMultiple=function(){void 0!==r.setUndoModeOnce&&r.setUndoModeOnce()},r.localGlobalSwitch=function(e,o){return e(null===e()?o():null),!1},r.selectItem=function(e,o,t){var l=ko.utils.peekObservable(e);return void 0!==t&&r.selectBlock(t,!1,!0),l!=o&&(e(o),null!==o&&0===r.selectedTool()&&r.selectedTool(1)),!1}.bind(r,r.selectedItem),r.isSelectedItem=function(e){return r.selectedItem()==e},r.selectBlock=function(e,o,t,l){var n=ko.utils.peekObservable(e);l||r.selectItem(null),n!=o&&(e(o),r.showGallery(!1),null===o||t||0!==r.selectedTool()||r.selectedTool(1))}.bind(r,r.selectedBlock),r.countSubscriptions=function(e,o){var t=0;for(var l in e)if(e.hasOwnProperty(l)){var n=e[l];if(ko.isObservable(n)&&(void 0!==n._defaultComputed&&(void 0!==o&&console.log(o+"/"+l+"/_",n._defaultComputed.getSubscriptionsCount()),t+=n._defaultComputed.getSubscriptionsCount()),void 0!==o&&console.log(o+"/"+l+"/-",n.getSubscriptionsCount()),t+=n.getSubscriptionsCount(),n=ko.utils.unwrapObservable(n)),"object"==typeof n&&null!==n){var a=r.countSubscriptions(n,void 0!==o?o+"/"+l+"@":void 0);void 0!==o&&console.log(o+"/"+l+"@",a),t+=a}}return t},r.loopSubscriptionsCount=function(){var e=r.countSubscriptions(r.content());global.document.getElementById("subscriptionsCount").innerHTML=e,global.setTimeout(r.loopSubscriptionsCount,1e3)},r.export=function(){return performanceAwareCaller("exportHTML",r.exportHTML)},r.exportHTML=function(){var e="exportframe";$("body").append('<iframe id="'+e+'" data-bind="bindIframe: $data"></iframe>');var o=global.document.getElementById(e);ko.applyBindings(r,o),ko.cleanNode(o),r.inline&&r.inline(o.contentWindow.document);var t=o.contentWindow.document.doctype,l="<!DOCTYPE "+t.name+(t.publicId?' PUBLIC "'+t.publicId+'"':"")+(!t.publicId&&t.systemId?" SYSTEM":"")+(t.systemId?' "'+t.systemId+'"':"")+">"+"\n"+o.contentWindow.document.documentElement.outerHTML;ko.removeNode(o),l=(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replace(/<script ([^>]* )?type="text\/html"[^>]*>[\s\S]*?<\/script>/gm,"")).replace(/<!-- ko ((?!--).)*? -->/g,"")).replace(/<!-- \/ko -->/g,"")).replace(/ data-bind="[^"]*"/gm,"")).replace(/ data-mce-(href|src|style)="[^"]*"/gm,"")).replace(/ style="[^"]*"([^>]*) replaced(style="[^"]*")/gm,"$1 $2")).replace(/ replaced(style="[^"]*")([^>]*) style="[^"]*"/gm," $1$2")).replace(/ replaced(style="[^"]*")/gm," $1")).replace(/ http-equiv="[^"]*"([^>]*) replaced(http-equiv="[^"]*")/gm,"$1 $2")).replace(/ replaced(http-equiv="[^"]*")([^>]*) http-equiv="[^"]*"/gm," $1$2")).replace(/ replaced(http-equiv="[^"]*")/gm," $1");var n=(l=l.replace(/<replacedcc[^>]* condition="([^"]*)"[^>]*>([\s\S]*?)<\/replacedcc>/g,function(e,o,t){var l="\x3c!--[if "+o.replace(/&/,"&")+"]>";return l+=t.replace(/<!-- cc:bc:([A-Za-z:]*) -->(<\/cc>)?<!-- cc:ac:\1 -->/g,"</$1>").replace(/><\/cc><!-- cc:sc -->/g,"/>").replace(/<!-- cc:bo:([A-Za-z:]*) --><cc/g,"<$1").replace(/^.*<!-- cc:start -->/,"").replace(/<!-- cc:end -->.*$/,""),l+="<![endif]--\x3e"})).match(/ data-[^ =]+(="[^"]+")? /)||l.match(/ replaced([^= ]*=)/);return n&&console.warn("Output HTML contains unexpected data- attributes or replaced attributes",n),l},r.exportHTMLtoTextarea=function(e){$(e).val(r.exportHTML())},r.exportJSONtoTextarea=function(e){$(e).val(r.exportJSON())},r.importJSONfromTextarea=function(e){r.importJSON($(e).val())},r.exportMetadata=function(){return ko.toJSON(r.metadata)},r.exportJSON=function(){return ko.toJSON(r.content)},r.exportJS=function(){return ko.toJS(r.content)},r.importJSON=function(e){var o=ko.utils.parseJson(e);r.content._wrap(o)},r.exportTheme=function(){var e={},o=r.content().theme(),t=function(e,o,l){for(var r in l)if(l.hasOwnProperty(r)){var n=ko.utils.unwrapObservable(l[r]);null!==n&&"object"==typeof n?t(r+".",o,n):o[e+r]=n}};t("",e,o);var l="";for(var n in e)e.hasOwnProperty(n)&&"type"!=n&&(l+=n+": "+e[n]+";\n");return l},r.loadImage=function(e){r.galleryRecent.unshift(e),r.selectedImageTab(0)},r.dialog=function(e,o){$(e).dialog(o)},r.log=function(e,o){},r.selectedImageTab.subscribe(function(e){1==e&&!1===r.galleryLoaded()&&r.loadGallery()},r,"change"),r}toastr.options={closeButton:!1,debug:!1,positionClass:"toast-bottom-full-width",target:"#mo-body",onclick:null,showDuration:"300",hideDuration:"1000",timeOut:"5000",extendedTimeOut:"1000",showEasing:"swing",hideEasing:"linear",showMethod:"fadeIn",hideMethod:"fadeOut"},module.exports=initializeEditor;
 | 
						|
 | 
						|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
 | 
						|
 | 
						|
},{"./timed-call.js":63,"console-browserify":3,"toastr":21}]},{},[25,1])(25)
 | 
						|
});
 | 
						|
//# sourceMappingURL=mosaico.min.js.map
 |