diff --git a/CHANGELOG.md b/CHANGELOG.md
index 68c893f07..9679267f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 5.5.18
+## 11/21/2023
+1. [Common](#common)
+ 1. [](#bugfix)
+ - Regression: Mobile Menu fix (#3198)
# 5.5.17
## 10/30/2023
1. [Common](#common)
diff --git a/assets/common/application/offcanvas/index.js b/assets/common/application/offcanvas/index.js
index e2bc270b1..76ca6e2e7 100644
--- a/assets/common/application/offcanvas/index.js
+++ b/assets/common/application/offcanvas/index.js
@@ -125,12 +125,15 @@ var Offcanvas = new prime({
return this;
},
- attachMutationEvent: function() {
- if (this.offcanvas instanceof Node) {
- var observer = new MutationObserver(this.bound('_checkTogglers'));
- observer.observe(this.offcanvas, { childList: true, subtree: true });
- }
- },
+ attachMutationEvent: function () {
+ this.observer = new MutationObserver(() => {
+ this._checkTogglers();
+ });
+ this.observer.observe(this.offcanvas[0], {
+ childList: true,
+ subtree: true,
+ });
+ },
attachTouchEvents: function() {
var msPointerSupported = window.navigator.msPointerEnabled,
@@ -166,13 +169,10 @@ var Offcanvas = new prime({
return this;
},
- detachMutationEvent: function() {
- if (this.offcanvas instanceof Node) {
- var observer = new MutationObserver(this.bound('_checkTogglers'));
- observer.disconnect();
- }
- },
-
+ detachMutationEvent: function () {
+ this.observer.disconnect();
+ },
+
detachTouchEvents: function() {
var msPointerSupported = window.navigator.msPointerEnabled,
touch = {
diff --git a/assets/common/js/main.js b/assets/common/js/main.js
index c0c323c2d..7862b8778 100644
--- a/assets/common/js/main.js
+++ b/assets/common/js/main.js
@@ -1 +1,5105 @@
-!function i(r,o,s){function a(e,t){if(!o[e]){if(!r[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=o[e]={exports:{}},r[e][0].call(n.exports,function(t){return a(r[e][1][t]||t)},n,n.exports,i,r,o,s)}return o[e].exports}for(var u="function"==typeof require&&require,t=0;t ul > li",parent:".g-parent",item:".g-menu-item",dropdown:".g-dropdown",overlay:".g-menu-overlay",touchIndicator:".g-menu-parent-indicator",linkedParent:"[data-g-menuparent]",mobileTarget:"[data-g-mobile-target]"},states:{active:"g-active",inactive:"g-inactive",selected:"g-selected",touchEvents:"g-menu-hastouch"}},constructor:function(t){this.setOptions(t),this.selectors=this.options.selectors,this.states=this.options.states,this.overlay=n("div"+this.selectors.overlay),this.active=null,this.location=[];var e=f("#g-page-surround");e&&this.overlay.top(e);t=f(this.selectors.mainContainer);t&&(e=t.data("g-hover-expand"),this.hoverExpand=null===e||"true"===e,!r&&this.hoverExpand||t.addClass(this.states.touchEvents),this.attach())},attach:function(){var t=this.selectors,e=f(t.mainContainer+" "+t.item),n=f(t.mobileContainer),i=f("body");e&&(this.hoverExpand&&(e.on("mouseenter",this.bound("mouseenter")),e.on("mouseleave",this.bound("mouseleave"))),i.delegate("click",":not("+t.mainContainer+") "+t.linkedParent+", .g-fullwidth .g-sublevel "+t.linkedParent,this.bound("click")),i.delegate("click",":not("+t.mainContainer+") a[href]",this.bound("resetAfterClick")),!r&&this.hoverExpand||((t=f(t.linkedParent))&&(t.on("touchmove",this.bound("touchmove")),t.on("touchend",this.bound("touchend"))),this.overlay.on("touchend",this.bound("closeAllDropdowns"))),n&&(n="only all and (max-width: "+this._calculateBreakpoint(n.data("g-menu-breakpoint")||"48rem")+")",(n=matchMedia(n)).addListener(this.bound("_checkQuery")),this._checkQuery(n)))},detach:function(){},click:function(t){this.touchend(t)},resetAfterClick:function(t){if(null!==f(t.target).data("g-menuparent"))return!0;this.closeDropdown(t),o.G5&&o.G5.offcanvas&&G5.offcanvas.close()},mouseenter:function(t){t=f(t.target);t.parent(this.options.selectors.mainContainer)&&(t.parent(this.options.selectors.item)&&!t.parent(".g-standard")||this.openDropdown(t))},mouseleave:function(t){t=f(t.target);t.parent(this.options.selectors.mainContainer)&&(t.parent(this.options.selectors.item)&&!t.parent(".g-standard")||this.closeDropdown(t))},touchmove:function(t){f(t.target).isMoving=!0},touchend:function(t){var e,n,i,r,o=this.selectors,s=this.states,a=f(t.target),u=a.parent(o.item).find(o.touchIndicator),c=a.parent(".g-standard")?"standard":"megamenu",l=a.parent(".g-go-back");return a.isMoving?a.isMoving=!1:(a.off("touchmove",this.bound("touchmove")),a.isMoving=!1,n=(e=(a=u?u:a).matches(o.item)?a:a.parent(o.item)).hasClass(s.selected),!e.find(o.dropdown)&&!u||(t.stopPropagation(),u&&!a.matches(o.touchIndicator)||t.preventDefault(),n||(i=e.siblings())&&(i.search(o.touchIndicator+" !> * !> "+o.item+"."+s.selected)||[]).forEach(h(function(t){this.closeDropdown(t)},this)),"megamenu"!=c&&e.parent(o.mainContainer)||!e.find(" > "+o.dropdown+", > * > "+o.dropdown)&&!l||(u=a.parent(".g-sublevel")||a.parent(".g-toplevel"),i=e.find(".g-sublevel"),s=e.parent(".g-dropdown-column"),u&&((c=a.parent(o.mainContainer))&&u.matches(".g-toplevel")||this._fixHeights(u,i,l,c),(u=!c&&s&&(r=s.search("> .g-grid > .g-block"))&&1 .g-sublevel"):u)[n?"removeClass":"addClass"]("g-slide-out"))),this[n?"closeDropdown":"openDropdown"](e),void("click"!==t.type&&this.toggleOverlay(a.parent(o.mainContainer)))))},openDropdown:function(t){var e=(t=f(t.target||t)).find(this.selectors.dropdown);t.addClass(this.states.selected),e&&e.removeClass(this.states.inactive).addClass(this.states.active)},closeDropdown:function(t){var e,n,i=(t=f(t.target||t)).find(this.selectors.dropdown);t.removeClass(this.states.selected),i&&(e=i.search(".g-sublevel"),n=i.search(".g-slide-out, ."+this.states.selected),t=i.search("."+this.states.active),e&&e.attribute("style",null),n&&n.removeClass("g-slide-out").removeClass(this.states.selected),t&&t.removeClass(this.states.active).addClass(this.states.inactive),i.removeClass(this.states.active).addClass(this.states.inactive))},closeAllDropdowns:function(){var t=this.selectors,e=this.states,n=f(t.mainContainer+" > .g-toplevel"),t=n.search(" >"+t.item);t&&t.removeClass(e.selected),n&&((e=n.search("> "+this.options.selectors.item))&&e.forEach(this.closeDropdown.bind(this)),this.closeDropdown(n)),this.toggleOverlay(n)},resetStates:function(t){var e,n;t&&(e=t.search(".g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out"),n=t.search(".g-active"),e&&(t.attribute("style",null).removeClass("g-selected").removeClass("g-slide-out"),e.attribute("style",null).removeClass("g-selected").removeClass("g-slide-out"),n&&n.removeClass("g-active").addClass("g-inactive")))},toggleOverlay:function(t){t&&(t=!!t.find(".g-active, .g-selected"),this.overlay[t?"addClass":"removeClass"]("g-menu-overlay-open"),this.overlay[0].style.opacity=t?1:0)},_fixHeights:function(t,e,n,i){var r,o,s,a,u;t!=e&&(n&&t.attribute("style",null),r={from:t[0].getBoundingClientRect(),to:(i?e:e.parent(".g-dropdown"))[0].getBoundingClientRect()},o=Math.max(r.from.height,r.to.height),n&&(t.parents('[style^="height"]')||[]).forEach(function(t){(t=f(t)).parent(".g-toplevel")&&(t[0].style.height=r.from.height+"px")}),n||(r.from.height .g-grid > .g-block"),u=s,a.forEach(function(t,e){e+1!=a.length?u-=t.getBoundingClientRect().height:f(t).find(".g-sublevel")[0].style.height=u+"px"})):e[0].style.height=s+"px")))},_calculateBreakpoint:function(t){var e=parseFloat(t.match(/^\d{1,}/).shift()),t=t.match(/[a-z]{1,}$/i).shift();return e+(t.match(/r?em/)?-.062:-1)+t},_checkQuery:function(t){var e,n,i=this.options.selectors,r=f(i.mobileContainer),o=f(i.mainContainer+i.mobileTarget)||f(i.mainContainer);t.matches?(e=o.find(i.topLevel))&&(o.parent(".g-block").addClass("hidden"),r.parent(".g-block").removeClass("hidden"),e.top(r)):(e=r.find(i.topLevel))&&(r.parent(".g-block").addClass("hidden"),o.parent(".g-block").removeClass("hidden"),e.top(o)),this.resetStates(e),!t.matches&&e&&(n=e.search("[data-g-item-width]"))&&n.forEach(function(t){(t=f(t))[0].style.width=t.data("g-item-width")})},_debug:function(){}});a.exports=i}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/dollar-extras":6,domready:7,"elements/zen":36,"mout/function/bind":40,"mout/function/timeout":44,prime:85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],3:[function(t,e,n){"use strict";t("domready");var i,r=t("prime"),o=t("mout/function/bind"),s=t("mout/array/forEach"),a=t("mout/math/map"),u=t("mout/math/clamp"),c=t("mout/function/timeout"),l=t("mout/string/trim"),f=t("../utils/decouple"),h=t("prime-util/prime/bound"),d=t("prime-util/prime/options"),p=t("elements"),m=t("elements/zen"),v=(t=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1],{dom:"WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1],lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}),g="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,y=!1,d=new r({mixin:[h,d],options:{effect:"ease",duration:300,tolerance:function(t){return t/3},padding:0,touch:!0,css3:!0,openClass:"g-offcanvas-open",openingClass:"g-offcanvas-opening",closingClass:"g-offcanvas-closing",overlayClass:"g-nav-overlay"},constructor:function(t){if(this.setOptions(t),this.attached=!1,this.opening=!1,this.moved=!1,this.dragging=!1,this.opened=!1,this.preventOpen=!1,this.offset={x:{start:0,current:0},y:{start:0,current:0}},this.bodyEl=p("body"),this.htmlEl=p("html"),this.panel=p("#g-page-surround"),this.offcanvas=p("#g-offcanvas"),!this.panel||!this.offcanvas)return!1;var e=this.offcanvas.data("g-offcanvas-swipe"),t=this.offcanvas.data("g-offcanvas-css3");return this.setOptions({touch:!(null!==e&&!parseInt(e)),css3:!(null!==t&&!parseInt(t))}),this.options.padding||(this.offcanvas[0].style.display="block",t=this.offcanvas[0].getBoundingClientRect().width,this.offcanvas[0].style.removeProperty("display"),this.setOptions({padding:t})),this.tolerance="function"==typeof this.options.tolerance?this.options.tolerance.call(this,this.options.padding):this.options.tolerance,this.htmlEl.addClass("g-offcanvas-"+(this.options.css3?"css3":"css2")),this.attach(),this._checkTogglers(),this},attach:function(){return this.attached=!0,this.options.touch&&g&&this.attachTouchEvents(),s(["toggle","open","close"],o(function(t){this.bodyEl.delegate("click","[data-offcanvas-"+t+"]",this.bound(t)),g&&this.bodyEl.delegate("touchend","[data-offcanvas-"+t+"]",this.bound(t))},this)),this.attachMutationEvent(),this.overlay=m("div[data-offcanvas-close]."+this.options.overlayClass).top(this.panel),this},attachMutationEvent:function(){this.offcanvas instanceof Node&&new MutationObserver(this.bound("_checkTogglers")).observe(this.offcanvas,{childList:!0,subtree:!0})},attachTouchEvents:function(){var t=window.navigator.msPointerEnabled,t={start:t?"MSPointerDown":"touchstart",move:t?"MSPointerMove":"touchmove",end:t?"MSPointerUp":"touchend"};this._scrollBound=f(window,"scroll",this.bound("_bodyScroll")),this.bodyEl.on(t.move,this.bound("_bodyMove")),this.panel.on(t.start,this.bound("_touchStart")),this.panel.on("touchcancel",this.bound("_touchCancel")),this.panel.on(t.end,this.bound("_touchEnd")),this.panel.on(t.move,this.bound("_touchMove"))},detach:function(){return this.attached=!1,this.options.touch&&g&&this.detachTouchEvents(),s(["toggle","open","close"],o(function(t){this.bodyEl.undelegate("click","[data-offcanvas-"+t+"]",this.bound(t)),g&&this.bodyEl.undelegate("touchend","[data-offcanvas-"+t+"]",this.bound(t))},this)),this.detachMutationEvent(),this.overlay.remove(),this},detachMutationEvent:function(){this.offcanvas instanceof Node&&new MutationObserver(this.bound("_checkTogglers")).disconnect()},detachTouchEvents:function(){var t=window.navigator.msPointerEnabled,t={start:t?"MSPointerDown":"touchstart",move:t?"MSPointerMove":"touchmove",end:t?"MSPointerUp":"touchend"};window.removeEventListener("scroll",this._scrollBound),this.bodyEl.off(t.move,this.bound("_bodyMove")),this.panel.off(t.start,this.bound("_touchStart")),this.panel.off("touchcancel",this.bound("_touchCancel")),this.panel.off(t.end,this.bound("_touchEnd")),this.panel.off(t.move,this.bound("_touchMove"))},open:function(t){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,this.opened||(this.htmlEl.addClass(this.options.openClass),this.htmlEl.addClass(this.options.openingClass),this.overlay[0].style.opacity=1,this.options.css3&&(this.panel[0].style[this.getOffcanvasPosition()]="inherit"),this._setTransition(),this._translateXTo((this.bodyEl.hasClass("g-offcanvas-right")?-1:1)*this.options.padding),this.opened=!0,setTimeout(o(function(){var t=this.panel[0];this.htmlEl.removeClass(this.options.openingClass),this.offcanvas.attribute("aria-expanded",!0),p("[data-offcanvas-toggle]").attribute("aria-expanded",!0),t.style.transition=t.style[v.css+"transition"]=""},this),this.options.duration)),this},close:function(t,e){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,e=e||window,this.opened||this.opening?(this.panel===e||!this.dragging)&&(this.htmlEl.addClass(this.options.closingClass),this.overlay[0].style.opacity=0,this._setTransition(),this._translateXTo(0),this.opened=!1,this.offcanvas.attribute("aria-expanded",!1),p("[data-offcanvas-toggle]").attribute("aria-expanded",!1),setTimeout(o(function(){var t=this.panel[0];this.htmlEl.removeClass(this.options.openClass),this.htmlEl.removeClass(this.options.closingClass),t.style.transition=t.style[v.css+"transition"]="",t.style.transform=t.style[v.css+"transform"]="",t.style[this.getOffcanvasPosition()]=""},this),this.options.duration),this):this},toggle:function(t,e){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,this[this.opened?"close":"open"](t,e)},getOffcanvasPosition:function(){return this.bodyEl.hasClass("g-offcanvas-right")?"right":"left"},_setTransition:function(){var t=this.panel[0];this.options.css3?t.style[v.css+"transition"]=t.style.transition=v.css+"transform "+this.options.duration+"ms "+this.options.effect:t.style[v.css+"transition"]=t.style.transition="left "+this.options.duration+"ms "+this.options.effect+", right "+this.options.duration+"ms "+this.options.effect},_translateXTo:function(t){var e=this.panel[0],n=this.getOffcanvasPosition();this.offset.x.current=t,this.options.css3?e.style[v.css+"transform"]=e.style.transform="translate3d("+t+"px, 0, 0)":e.style[n]=Math.abs(t)+"px"},_bodyScroll:function(){this.moved||(clearTimeout(i),y=!0,i=setTimeout(function(){y=!1},250))},_bodyMove:function(){return this.moved&&event.preventDefault(),!(this.dragging=!0)},_touchStart:function(t){t.touches&&(this.moved=!1,this.opening=!1,this.dragging=!1,this.offset.x.start=t.touches[0].pageX,this.offset.y.start=t.touches[0].pageY,this.preventOpen=!this.opened&&0!==this.offcanvas[0].clientWidth)},_touchCancel:function(){this.moved=!1,this.opening=!1},_touchMove:function(t){var e,n,i,r;y||this.preventOpen||!t.touches||(this.options.css3&&(this.panel[0].style[this.getOffcanvasPosition()]="inherit"),e=this.getOffcanvasPosition(),n=u(t.touches[0].clientX-this.offset.x.start,-this.options.padding,this.options.padding),i=this.offset.x.current=n,r=Math.abs(t.touches[0].pageY-this.offset.y.start),t="right"==e?-1:1,Math.abs(i)>this.options.padding||5this.tolerance,n=!!this.bodyEl.hasClass("g-offcanvas-right")?0",t))},firstChild:function(t){return this.find(i("^",t))},lastChild:function(t){return this.find(i("!^",t))},parent:function(t){var e=[];t:for(var n,i=0;n=this[i];i++)for(;(n=n.parentNode)&&n!==document;)if(!t||o.matches(n,t)){e.push(n);break t}return s(e)},parents:function(t){for(var e,n=[],i=0;e=this[i];i++)for(;(e=e.parentNode)&&e!==document;)t&&!o.matches(e,t)||n.push(e);return s(n)}}),e.exports=s},{"./base":9,"mout/array/map":18,slick:97}],36:[function(t,e,n){"use strict";var s=t("mout/array/forEach"),i=t("mout/array/map"),r=t("slick/parser"),a=t("./base");e.exports=function(t,o){return a(i(r(t),function(t){var n,r;return s(t,function(t,e){var i=(o||document).createElement(t.tag);t.id&&(i.id=t.id),t.classList&&(i.className=t.classList.join(" ")),t.attributes&&s(t.attributes,function(t){i.setAttribute(t.name,t.value||"")}),t.pseudos&&s(t.pseudos,function(t){var e=a(i),n=e[t.name];n&&n.call(e,t.value)}),0===e?r=i:" "===t.combinator?n.appendChild(i):"+"!==t.combinator||(t=n.parentNode)&&t.appendChild(i),n=i}),r}))}},{"./base":9,"mout/array/forEach":16,"mout/array/map":18,"slick/parser":98}],37:[function(t,e,n){e.exports=function(t,e,n){if(null!=t)for(var i=-1,r=t.length;++i',!!this.getElementById(e)},QUERY_SELECTOR:function(t){return t.innerHTML="_",t.innerHTML='',1===t.querySelectorAll(".MiX").length},EXPANDOS:function(t,e){return e="slick_"+a++,t._custom_property_=e,t._custom_property_===e},MATCHES_SELECTOR:function(e){e.className="MiX";var n=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector;if(n)try{n.call(e,":slick")}catch(t){return!!n.call(e,".MiX")&&n}return!1},GET_ELEMENTS_BY_CLASS_NAME:function(t){return t.innerHTML='',1===t.getElementsByClassName("b").length&&(t.firstChild.className="b",2===t.getElementsByClassName("b").length&&(t.innerHTML='',2===t.getElementsByClassName("a").length))},GET_ATTRIBUTE:function(t){var e="fus ro dah";return t.innerHTML='',t.firstChild.getAttribute("class")===e}};r.prototype.has=function(t){var e=this.tested,n=e[t];if(null!=n)return n;var i=this.root,r=this.document,o=r.createElement("div");o.setAttribute("style","display: none;"),i.appendChild(o);var s=u[t],n=!1;if(s)try{n=s.call(r,o)}catch(t){}return _.debug&&!n&&console.warn("document has no "+t),i.removeChild(o),e[t]=n};var x={" ":function(t,e,n){var i,r,o=!e.id,s=!e.tag,a=!e.classes;if(e.id&&t.getElementById&&this.has("GET_ELEMENT_BY_ID")&&(i=t.getElementById(e.id))&&i.getAttribute("id")===e.id&&(r=[i],o=!0,"*"===e.tag&&(s=!0)),!r&&(e.classes&&t.getElementsByClassName&&this.has("GET_ELEMENTS_BY_CLASS_NAME")?(r=t.getElementsByClassName(e.classList),a=!0,"*"===e.tag&&(s=!0)):(r=t.getElementsByTagName(e.tag),"*"!==e.tag&&(s=!0)),!r||!r.length))return!1;for(var u=0;i=r[u++];)(s&&o&&a&&!e.attributes&&!e.pseudos||this.match(i,e,s,o,a))&&n(i);return!0},">":function(t,e,n){if(t=t.firstChild)for(;1==t.nodeType&&this.match(t,e)&&n(t),t=t.nextSibling;);},"+":function(t,e,n){for(;t=t.nextSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"^":function(t,e,n){(t=t.firstChild)&&(1===t.nodeType?this.match(t,e)&&n(t):x["+"].call(this,t,e,n))},"~":function(t,e,n){for(;t=t.nextSibling;)1===t.nodeType&&this.match(t,e)&&n(t)},"++":function(t,e,n){x["+"].call(this,t,e,n),x["!+"].call(this,t,e,n)},"~~":function(t,e,n){x["~"].call(this,t,e,n),x["!~"].call(this,t,e,n)},"!":function(t,e,n){for(;t=t.parentNode;)t!==this.document&&this.match(t,e)&&n(t)},"!>":function(t,e,n){(t=t.parentNode)!==this.document&&this.match(t,e)&&n(t)},"!+":function(t,e,n){for(;t=t.previousSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"!^":function(t,e,n){(t=t.lastChild)&&(1==t.nodeType?this.match(t,e)&&n(t):x["!+"].call(this,t,e,n))},"!~":function(t,e,n){for(;t=t.previousSibling;)1===t.nodeType&&this.match(t,e)&&n(t)}};r.prototype.search=function(t,e,n){t?!t.nodeType&&t.document&&(t=t.document):t=this.document;var i=b(e);if(!i||!i.length)throw new Error("invalid expression");var r,o,s,a,u,c=E(n=n||[])?function(t){n[n.length]=t}:function(t){n[n.length++]=t};1+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+y(">+~`!@$%^&={}\\;")+"]").replace(//g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")),w=function(t){this.combinator=t||" ",this.tag="*"};w.prototype.toString=function(){if(!this.raw){var t,e,n="";if(n+=this.tag||"*",this.id&&(n+="#"+this.id),this.classes&&(n+="."+this.classList.join(".")),this.attributes)for(t=0;e=this.attributes[t++];)n+="["+e.name+(e.operator?e.operator+'"'+e.value+'"':"")+"]";if(this.pseudos)for(t=0;e=this.pseudos[t++];)n+=":"+e.name,e.value&&(n+="("+e.value+")");this.raw=n}return this.raw};var E=function(){this.length=0};E.prototype.toString=function(){if(!this.raw){for(var t,e="",n=0;t=this[n++];)1!==n&&(e+=" ")," "!==t.combinator&&(e+=t.combinator+" "),e+=t;this.raw=e}return this.raw};function s(t,e,n,i,r,o,s,a,u,c,l,f,h,d,p,m){var v,g;return(!e&&this.length||(v=this[this.length++]=new E,!e))&&(v=v||this[this.length-1],g=(g=n||i||!v.length?v[v.length++]=new w(n):g)||v[v.length-1],r?g.tag=b(r):o?g.id=b(o):s?(r=b(s),(o=g.classes||(g.classes={}))[r]||(o[r]=y(s),(s=g.classList||(g.classList=[])).push(r),s.sort())):h?(m=m||p,(g.pseudos||(g.pseudos=[])).push({type:1==f.length?"class":"element",name:b(h),escapedName:y(h),value:m?b(m):null,escapedValue:m?y(m):null})):a&&(l=l?y(l):null,(g.attributes||(g.attributes=[])).push({operator:u,name:b(a),escapedName:y(a),value:l?b(l):null,escapedValue:l?y(l):null}))),""}function a(t){this.length=0;for(var e,n=this,i=t;t;){if((e=t.replace(o,function(){return s.apply(n,arguments)}))===t)throw new Error(i+" is an invalid expression");t=e}}a.prototype.toString=function(){if(!this.raw){for(var t,e=[],n=0;t=this[n++];)e.push(t);this.raw=e.join(", ")}return this.raw};var u={};e.exports=function(t){return null==t?null:(t=(""+t).replace(/^\s+|\s+$/g,""),u[t]||(u[t]=new a(t)))}},{}],99:[function(t,e,n){var i,r,e=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var t=a(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f ul > li',
+ parent: '.g-parent',
+ item: '.g-menu-item',
+ dropdown: '.g-dropdown',
+ overlay: '.g-menu-overlay',
+ touchIndicator: '.g-menu-parent-indicator',
+ linkedParent: '[data-g-menuparent]',
+ mobileTarget: '[data-g-mobile-target]'
+ },
+
+ states: {
+ active: 'g-active',
+ inactive: 'g-inactive',
+ selected: 'g-selected',
+ touchEvents: 'g-menu-hastouch'
+ }
+ },
+
+ constructor: function(options) {
+ this.setOptions(options);
+
+ this.selectors = this.options.selectors;
+ this.states = this.options.states;
+ this.overlay = zen('div' + this.selectors.overlay);
+ this.active = null;
+ this.location = [];
+
+ var pageSurround = $('#g-page-surround');
+ if (pageSurround) {
+ this.overlay.top(pageSurround);
+ }
+
+ var mainContainer = $(this.selectors.mainContainer);
+ if (!mainContainer) { return; }
+
+ var gHoverExpand = mainContainer.data('g-hover-expand');
+
+ this.hoverExpand = gHoverExpand === null || gHoverExpand === 'true';
+ if (hasTouchEvents || !this.hoverExpand) {
+ mainContainer.addClass(this.states.touchEvents);
+ }
+
+ this.attach();
+ },
+
+ attach: function() {
+ var selectors = this.selectors,
+ main = $(selectors.mainContainer + ' ' + selectors.item),
+ mobileContainer = $(selectors.mobileContainer),
+ body = $('body');
+
+ if (!main) { return; }
+ if (this.hoverExpand) {
+ main.on('mouseenter', this.bound('mouseenter'));
+ main.on('mouseleave', this.bound('mouseleave'));
+ }
+
+ body.delegate('click', ':not(' + selectors.mainContainer + ') ' + selectors.linkedParent + ', .g-fullwidth .g-sublevel ' + selectors.linkedParent, this.bound('click'));
+ body.delegate('click', ':not(' + selectors.mainContainer + ') a[href]', this.bound('resetAfterClick'));
+
+ if (hasTouchEvents || !this.hoverExpand) {
+ var linkedParent = $(selectors.linkedParent);
+ if (linkedParent) {
+ linkedParent.on('touchmove', this.bound('touchmove'));
+ linkedParent.on('touchend', this.bound('touchend'));
+ }
+ this.overlay.on('touchend', this.bound('closeAllDropdowns'));
+ }
+
+ if (mobileContainer) {
+ var query = 'only all and (max-width: ' + this._calculateBreakpoint((mobileContainer.data('g-menu-breakpoint') || '48rem')) + ')',
+ match = matchMedia(query);
+ match.addListener(this.bound('_checkQuery'));
+ this._checkQuery(match);
+ }
+ },
+
+ detach: function() {},
+
+ click: function(event) {
+ this.touchend(event);
+ },
+
+ resetAfterClick: function(event) {
+ var target = $(event.target);
+
+ if (target.data('g-menuparent') !== null) {
+ return true;
+ }
+
+ this.closeDropdown(event);
+ if (global.G5 && global.G5.offcanvas) {
+ G5.offcanvas.close();
+ }
+ },
+
+ mouseenter: function(event) {
+ var element = $(event.target);
+ if (!element.parent(this.options.selectors.mainContainer)) { return; }
+ if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; }
+
+ this.openDropdown(element);
+ },
+
+ mouseleave: function(event) {
+ var element = $(event.target);
+ if (!element.parent(this.options.selectors.mainContainer)) { return; }
+ if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; }
+
+ this.closeDropdown(element);
+ },
+
+ touchmove: function(event) {
+ var target = $(event.target);
+ target.isMoving = true;
+ },
+
+ touchend: function(event) {
+ var selectors = this.selectors,
+ states = this.states;
+
+ var target = $(event.target),
+ indicator = target.parent(selectors.item).find(selectors.touchIndicator),
+ menuType = target.parent('.g-standard') ? 'standard' : 'megamenu',
+ isGoingBack = target.parent('.g-go-back'),
+ parent, isSelected;
+
+ if (target.isMoving) {
+ target.isMoving = false;
+ return false;
+ }
+
+ target.off('touchmove', this.bound('touchmove'));
+ target.isMoving = false;
+
+ if (indicator) {
+ target = indicator;
+ }
+
+ parent = target.matches(selectors.item) ? target : target.parent(selectors.item);
+ isSelected = parent.hasClass(states.selected);
+
+ if (!parent.find(selectors.dropdown) && !indicator) { return true; }
+
+ event.stopPropagation();
+ if (!indicator || target.matches(selectors.touchIndicator)) {
+ event.preventDefault();
+ }
+
+ if (!isSelected) {
+ var siblings = parent.siblings();
+ if (siblings) {
+ var currentlyOpen = siblings.search(selectors.touchIndicator + ' !> * !> ' + selectors.item + '.' + states.selected);
+ (currentlyOpen || []).forEach(bind(function(open) {
+ this.closeDropdown(open);
+ }, this));
+ }
+ }
+
+ if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
+ var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
+ slideout = parent.find('.g-sublevel'),
+ columns = parent.parent('.g-dropdown-column'),
+ blocks;
+
+ if (sublevel) {
+ var isNavMenu = target.parent(selectors.mainContainer);
+ if (!isNavMenu || (isNavMenu && !sublevel.matches('.g-toplevel'))) { this._fixHeights(sublevel, slideout, isGoingBack, isNavMenu); }
+ if (!isNavMenu && columns && (blocks = columns.search('> .g-grid > .g-block'))) {
+ if (blocks.length > 1) { sublevel = blocks.search('> .g-sublevel'); }
+ }
+
+ sublevel[!isSelected ? 'addClass' : 'removeClass']('g-slide-out');
+ }
+ }
+
+ this[!isSelected ? 'openDropdown' : 'closeDropdown'](parent);
+ if (event.type !== 'click') { this.toggleOverlay(target.parent(selectors.mainContainer)); }
+ },
+
+ openDropdown: function(element) {
+ element = $(element.target || element);
+ var dropdown = element.find(this.selectors.dropdown);
+
+ element.addClass(this.states.selected);
+
+ if (dropdown) {
+ dropdown.removeClass(this.states.inactive).addClass(this.states.active);
+ }
+ },
+
+ closeDropdown: function(element) {
+ element = $(element.target || element);
+ var dropdown = element.find(this.selectors.dropdown);
+
+ element.removeClass(this.states.selected);
+
+ if (dropdown) {
+ var sublevels = dropdown.search('.g-sublevel'),
+ slideouts = dropdown.search('.g-slide-out, .' + this.states.selected),
+ actives = dropdown.search('.' + this.states.active);
+
+ if (sublevels) { sublevels.attribute('style', null); }
+ if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); }
+ if (actives) { actives.removeClass(this.states.active).addClass(this.states.inactive); }
+
+ dropdown.removeClass(this.states.active).addClass(this.states.inactive);
+ }
+ },
+
+ closeAllDropdowns: function() {
+ var selectors = this.selectors,
+ states = this.states,
+ topLevel = $(selectors.mainContainer + ' > .g-toplevel'),
+ roots = topLevel.search(' >' + selectors.item);
+
+ if (roots) { roots.removeClass(states.selected); }
+ if (topLevel) {
+ var allRoots = topLevel.search('> ' + this.options.selectors.item);
+ if (allRoots) { allRoots.forEach(this.closeDropdown.bind(this)); }
+ this.closeDropdown(topLevel);
+ }
+
+ this.toggleOverlay(topLevel);
+ },
+
+ resetStates: function(menu) {
+ if (!menu) { return; }
+ var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
+ actives = menu.search('.g-active');
+ if (!items) { return; }
+
+ menu.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out');
+ items.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out');
+ if (actives) { actives.removeClass('g-active').addClass('g-inactive'); }
+ },
+
+ toggleOverlay: function(menu) {
+ if (!menu) { return; }
+ var shouldOpen = !!menu.find('.g-active, .g-selected');
+
+ this.overlay[shouldOpen ? 'addClass' : 'removeClass']('g-menu-overlay-open');
+ this.overlay[0].style.opacity = shouldOpen ? 1 : 0;
+ },
+
+ _fixHeights: function(parent, sublevel, isGoingBack, isNavMenu) {
+ if (parent == sublevel) { return; }
+ if (isGoingBack) {
+ parent.attribute('style', null);
+ }
+
+ var parents, heights = {
+ from: parent[0].getBoundingClientRect(),
+ to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
+ },
+ height = Math.max(heights.from.height, heights.to.height);
+
+ if (isGoingBack) {
+ parents = parent.parents('[style^="height"]');
+ (parents || []).forEach(function(element) {
+ element = $(element);
+ if (element.parent('.g-toplevel')) {
+ element[0].style.height = heights.from.height + 'px';
+ }
+ });
+ }
+
+ if (!isGoingBack) {
+ // if from height is < than to height set the parent height else, set the target
+ if (heights.from.height < heights.to.height) {
+ parent[0].style.height = height + 'px';
+
+ parents = parent.parents('[style^="height"]');
+ (parents || []).forEach(function(element) {
+ element = $(element);
+ if (element.parent('.g-toplevel')) {
+ element[0].style.height = height + 'px';
+ }
+ });
+ } else if (isNavMenu) {
+ sublevel[0].style.height = height + 'px';
+ }
+
+ // fix sublevels heights in side menu (offcanvas etc)
+ if (!isNavMenu) {
+ var maxHeight = height,
+ block = $(sublevel).parent('.g-block:not(.size-100)'),
+ column = block ? block.parent('.g-dropdown-column') : null;
+ (sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
+ maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10));
+ });
+
+ if (column) {
+ column[0].style.height = maxHeight + 'px';
+
+ var blocks = column.search('> .g-grid > .g-block'),
+ diff = maxHeight;
+
+ blocks.forEach(function(block, i) {
+ if ((i + 1) != blocks.length) {
+ diff -= block.getBoundingClientRect().height;
+ } else {
+ $(block).find('.g-sublevel')[0].style.height = diff + 'px';
+ }
+ });
+
+
+ } else {
+ sublevel[0].style.height = maxHeight + 'px';
+ }
+ }
+ }
+ },
+
+ _calculateBreakpoint: function(value) {
+ var digit = parseFloat(value.match(/^\d{1,}/).shift()),
+ unit = value.match(/[a-z]{1,}$/i).shift(),
+ tolerance = unit.match(/r?em/) ? -0.062 : -1;
+
+ return (digit + tolerance) + unit;
+ },
+
+ _checkQuery: function(mq) {
+ var selectors = this.options.selectors,
+ mobileContainer = $(selectors.mobileContainer),
+ mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
+ find, dropdowns;
+
+ if (mq.matches) {
+ // move to Mobile Container
+ find = mainContainer.find(selectors.topLevel);
+ if (find) {
+ mainContainer.parent('.g-block').addClass('hidden');
+ mobileContainer.parent('.g-block').removeClass('hidden');
+ find.top(mobileContainer);
+ }
+ } else {
+ // move back to Original Location
+ find = mobileContainer.find(selectors.topLevel);
+ if (find) {
+ mobileContainer.parent('.g-block').addClass('hidden');
+ mainContainer.parent('.g-block').removeClass('hidden');
+ find.top(mainContainer);
+ }
+ }
+
+ this.resetStates(find);
+
+ // we need to reintroduce fixed widths for those dropdowns that come with it
+ if (!mq.matches && (find && (dropdowns = find.search('[data-g-item-width]')))) {
+ dropdowns.forEach(function(dropdown) {
+ dropdown = $(dropdown);
+ dropdown[0].style.width = dropdown.data('g-item-width');
+ });
+ }
+ },
+
+ _debug: function() {}
+});
+
+module.exports = Menu;
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"../utils/dollar-extras":6,"domready":7,"elements/zen":36,"mout/function/bind":40,"mout/function/timeout":44,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],3:[function(require,module,exports){
+// Offcanvas slide with desktop, touch and all-in-one touch devices support that supports both left and right placement.
+// Fast and optimized using CSS3 transitions
+// Based on the awesome Slideout.js
+
+"use strict";
+
+var ready = require('domready'),
+ prime = require('prime'),
+ bind = require('mout/function/bind'),
+ forEach = require('mout/array/forEach'),
+ mapNumber = require('mout/math/map'),
+ clamp = require('mout/math/clamp'),
+ timeout = require('mout/function/timeout'),
+ trim = require('mout/string/trim'),
+ decouple = require('../utils/decouple'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ $ = require('elements'),
+ zen = require('elements/zen');
+
+// thanks David Walsh
+var prefix = (function() {
+ var styles = window.getComputedStyle(document.documentElement, ''),
+ pre = (Array.prototype.slice.call(styles).join('')
+ .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o'])
+ )[1],
+ dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1];
+ return {
+ dom: dom,
+ lowercase: pre,
+ css: '-' + pre + '-',
+ js: pre[0].toUpperCase() + pre.substr(1)
+ };
+})();
+
+var hasTouchEvents = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
+ isScrolling = false, scrollTimeout;
+
+var Offcanvas = new prime({
+
+ mixin: [Bound, Options],
+
+ options: {
+ effect: 'ease',
+ duration: 300,
+ tolerance: function(padding) { // tolerance can also be just an integer value
+ return padding / 3;
+ },
+ padding: 0,
+ touch: true,
+ css3: true,
+
+ openClass: 'g-offcanvas-open',
+ openingClass: 'g-offcanvas-opening',
+ closingClass: 'g-offcanvas-closing',
+ overlayClass: 'g-nav-overlay'
+ },
+
+ constructor: function(options) {
+ this.setOptions(options);
+
+ this.attached = false;
+ this.opening = false;
+ this.moved = false;
+ this.dragging = false;
+ this.opened = false;
+ this.preventOpen = false;
+ this.offset = {
+ x: {
+ start: 0,
+ current: 0
+ },
+ y: {
+ start: 0,
+ current: 0
+ }
+ };
+
+ this.bodyEl = $('body');
+ this.htmlEl = $('html');
+
+ this.panel = $('#g-page-surround');
+ this.offcanvas = $('#g-offcanvas');
+
+ if (!this.panel || !this.offcanvas) { return false; }
+
+ var swipe = this.offcanvas.data('g-offcanvas-swipe'),
+ css3 = this.offcanvas.data('g-offcanvas-css3');
+ this.setOptions({ touch: !!(swipe !== null ? parseInt(swipe) : 1), css3: !!(css3 !== null ? parseInt(css3) : 1) });
+
+ if (!this.options.padding) {
+ this.offcanvas[0].style.display = 'block';
+ var width = this.offcanvas[0].getBoundingClientRect().width;
+ this.offcanvas[0].style.removeProperty('display');
+
+ this.setOptions({ padding: width });
+ }
+
+ this.tolerance = typeof this.options.tolerance == 'function' ? this.options.tolerance.call(this, this.options.padding) : this.options.tolerance;
+
+ this.htmlEl.addClass('g-offcanvas-' + (this.options.css3 ? 'css3' : 'css2'));
+
+ this.attach();
+ this._checkTogglers();
+
+ return this;
+ },
+
+ attach: function() {
+ this.attached = true;
+
+ if (this.options.touch && hasTouchEvents) {
+ this.attachTouchEvents();
+ }
+
+ forEach(['toggle', 'open', 'close'], bind(function(mode) {
+ this.bodyEl.delegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode));
+ if (hasTouchEvents) { this.bodyEl.delegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); }
+ }, this));
+
+ this.attachMutationEvent();
+
+ this.overlay = zen('div[data-offcanvas-close].' + this.options.overlayClass).top(this.panel);
+
+ return this;
+ },
+
+ attachMutationEvent: function () {
+ this.observer = new MutationObserver(() => {
+ this._checkTogglers();
+ });
+ this.observer.observe(this.offcanvas[0], {
+ childList: true,
+ subtree: true,
+ });
+ },
+
+ attachTouchEvents: function() {
+ var msPointerSupported = window.navigator.msPointerEnabled,
+ touch = {
+ start: msPointerSupported ? 'MSPointerDown' : 'touchstart',
+ move: msPointerSupported ? 'MSPointerMove' : 'touchmove',
+ end: msPointerSupported ? 'MSPointerUp' : 'touchend'
+ };
+
+ this._scrollBound = decouple(window, 'scroll', this.bound('_bodyScroll'));
+ this.bodyEl.on(touch.move, this.bound('_bodyMove'));
+ this.panel.on(touch.start, this.bound('_touchStart'));
+ this.panel.on('touchcancel', this.bound('_touchCancel'));
+ this.panel.on(touch.end, this.bound('_touchEnd'));
+ this.panel.on(touch.move, this.bound('_touchMove'));
+ },
+
+ detach: function() {
+ this.attached = false;
+
+ if (this.options.touch && hasTouchEvents) {
+ this.detachTouchEvents();
+ }
+
+ forEach(['toggle', 'open', 'close'], bind(function(mode) {
+ this.bodyEl.undelegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode));
+ if (hasTouchEvents) { this.bodyEl.undelegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); }
+ }, this));
+
+ this.detachMutationEvent();
+ this.overlay.remove();
+
+ return this;
+ },
+
+ detachMutationEvent: function () {
+ this.observer.disconnect();
+ },
+
+ detachTouchEvents: function() {
+ var msPointerSupported = window.navigator.msPointerEnabled,
+ touch = {
+ start: msPointerSupported ? 'MSPointerDown' : 'touchstart',
+ move: msPointerSupported ? 'MSPointerMove' : 'touchmove',
+ end: msPointerSupported ? 'MSPointerUp' : 'touchend'
+ };
+
+ window.removeEventListener('scroll', this._scrollBound);
+ this.bodyEl.off(touch.move, this.bound('_bodyMove'));
+ this.panel.off(touch.start, this.bound('_touchStart'));
+ this.panel.off('touchcancel', this.bound('_touchCancel'));
+ this.panel.off(touch.end, this.bound('_touchEnd'));
+ this.panel.off(touch.move, this.bound('_touchMove'));
+ },
+
+
+ open: function(event) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+ else { this.dragging = false; }
+
+ if (this.opened) { return this; }
+
+ this.htmlEl.addClass(this.options.openClass);
+ this.htmlEl.addClass(this.options.openingClass);
+
+ this.overlay[0].style.opacity = 1;
+
+ if (this.options.css3) {
+ // for translate3d
+ this.panel[0].style[this.getOffcanvasPosition()] = 'inherit';
+ }
+
+ this._setTransition();
+ this._translateXTo((this.bodyEl.hasClass('g-offcanvas-right') ? -1 : 1) * this.options.padding);
+ this.opened = true;
+
+ setTimeout(bind(function() {
+ var panel = this.panel[0];
+
+ this.htmlEl.removeClass(this.options.openingClass);
+ this.offcanvas.attribute('aria-expanded', true);
+ $('[data-offcanvas-toggle]').attribute('aria-expanded', true);
+ panel.style.transition = panel.style[prefix.css + 'transition'] = '';
+ }, this), this.options.duration);
+
+ return this;
+ },
+
+ close: function(event, element) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+ else { this.dragging = false; }
+
+ element = element || window;
+
+ if (!this.opened && !this.opening) { return this; }
+ if (this.panel !== element && this.dragging) { return false; }
+
+ this.htmlEl.addClass(this.options.closingClass);
+
+ this.overlay[0].style.opacity = 0;
+
+ this._setTransition();
+ this._translateXTo(0);
+ this.opened = false;
+ this.offcanvas.attribute('aria-expanded', false);
+ $('[data-offcanvas-toggle]').attribute('aria-expanded', false);
+
+ setTimeout(bind(function() {
+ var panel = this.panel[0];
+
+ this.htmlEl.removeClass(this.options.openClass);
+ this.htmlEl.removeClass(this.options.closingClass);
+ panel.style.transition = panel.style[prefix.css + 'transition'] = '';
+ panel.style.transform = panel.style[prefix.css + 'transform'] = '';
+ panel.style[this.getOffcanvasPosition()] = '';
+ }, this), this.options.duration);
+
+
+ return this;
+ },
+
+ toggle: function(event, element) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+ else { this.dragging = false; }
+
+ return this[this.opened ? 'close' : 'open'](event, element);
+ },
+
+ getOffcanvasPosition: function() {
+ return this.bodyEl.hasClass('g-offcanvas-right') ? 'right' : 'left';
+ },
+
+ _setTransition: function() {
+ var panel = this.panel[0];
+
+ if (this.options.css3) {
+ // for translate3d
+ panel.style[prefix.css + 'transition'] = panel.style.transition = prefix.css + 'transform ' + this.options.duration + 'ms ' + this.options.effect;
+ } else {
+ // left/right transition
+ panel.style[prefix.css + 'transition'] = panel.style.transition = 'left ' + this.options.duration + 'ms ' + this.options.effect + ', right ' + this.options.duration + 'ms ' + this.options.effect;
+ }
+ },
+
+ _translateXTo: function(x) {
+ var panel = this.panel[0],
+ placement = this.getOffcanvasPosition();
+
+ this.offset.x.current = x;
+
+ if (this.options.css3) {
+ // for translate3d
+ panel.style[prefix.css + 'transform'] = panel.style.transform = 'translate3d(' + x + 'px, 0, 0)';
+ } else {
+ // left/right transition
+ panel.style[placement] = Math.abs(x) + 'px';
+ }
+ },
+
+ _bodyScroll: function() {
+ if (!this.moved) {
+ clearTimeout(scrollTimeout);
+ isScrolling = true;
+ scrollTimeout = setTimeout(function() {
+ isScrolling = false;
+ }, 250);
+ }
+ },
+
+ _bodyMove: function() {
+ if (this.moved) { event.preventDefault(); }
+ this.dragging = true;
+
+ return false;
+ },
+
+ _touchStart: function(event) {
+ if (!event.touches) { return; }
+
+ this.moved = false;
+ this.opening = false;
+ this.dragging = false;
+ this.offset.x.start = event.touches[0].pageX;
+ this.offset.y.start = event.touches[0].pageY;
+ this.preventOpen = (!this.opened && this.offcanvas[0].clientWidth !== 0);
+ },
+
+ _touchCancel: function() {
+ this.moved = false;
+ this.opening = false;
+ },
+
+ _touchMove: function(event) {
+ if (isScrolling || this.preventOpen || !event.touches) { return; }
+ if (this.options.css3) {
+ this.panel[0].style[this.getOffcanvasPosition()] = 'inherit';
+ }
+
+ var placement = this.getOffcanvasPosition(),
+ diffX = clamp(event.touches[0].clientX - this.offset.x.start, -this.options.padding, this.options.padding),
+ translateX = this.offset.x.current = diffX,
+ diffY = Math.abs(event.touches[0].pageY - this.offset.y.start),
+ offset = placement == 'right' ? -1 : 1,
+ overlayOpacity;
+
+ if (Math.abs(translateX) > this.options.padding) { return; }
+ if (diffY > 5 && !this.moved) { return; }
+
+ if (Math.abs(diffX) > 0) {
+ this.opening = true;
+
+ // offcanvas on left
+ if (placement == 'left' && (this.opened && diffX > 0 || !this.opened && diffX < 0)) { return; }
+
+ // offcanvas on right
+ if (placement == 'right' && (this.opened && diffX < 0 || !this.opened && diffX > 0)) { return; }
+
+ if (!this.moved && !this.htmlEl.hasClass(this.options.openClass)) {
+ this.htmlEl.addClass(this.options.openClass);
+ }
+
+ if ((placement == 'left' && diffX <= 0) || (placement == 'right' && diffX >= 0)) {
+ translateX = diffX + (offset * this.options.padding);
+ this.opening = false;
+ }
+
+ overlayOpacity = mapNumber(Math.abs(translateX), 0, this.options.padding, 0, 1);
+ this.overlay[0].style.opacity = overlayOpacity;
+
+ if (this.options.css3) {
+ // for translate3d
+ this.panel[0].style[prefix.css + 'transform'] = this.panel[0].style.transform = 'translate3d(' + translateX + 'px, 0, 0)';
+ } else {
+ // left/right transition
+ this.panel[0].style[placement] = Math.abs(translateX) + 'px';
+ }
+
+ this.moved = true;
+ }
+ },
+
+ _touchEnd: function(event) {
+ if (this.moved) {
+ var tolerance = Math.abs(this.offset.x.current) > this.tolerance,
+ placement = this.bodyEl.hasClass('g-offcanvas-right') ? true : false,
+ direction = !placement ? (this.offset.x.current < 0) : (this.offset.x.current > 0);
+
+ this.opening = tolerance ? !direction : direction;
+ this.opened = !this.opening;
+ this[this.opening ? 'open' : 'close'](event, this.panel);
+ }
+
+ this.moved = false;
+
+ return true;
+ },
+
+ _checkTogglers: function(mutator) {
+ var togglers = $('[data-offcanvas-toggle], [data-offcanvas-open], [data-offcanvas-close]'),
+ mobileContainer = $('#g-mobilemenu-container'),
+ blocks, mCtext;
+
+ if (!togglers || (mutator && ((mutator.target || mutator.srcElement) !== mobileContainer[0]))) { return; }
+ if (this.opened) { this.close(); }
+
+ timeout(function() {
+ blocks = this.offcanvas.search('.g-block');
+ mCtext = mobileContainer ? mobileContainer.text().length : 0;
+ var shouldCollapse = (blocks && blocks.length === 1) && mobileContainer && (!trim(this.offcanvas.text()).length && !blocks.find('.g-menu-item'));
+
+ togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide');
+ if (mobileContainer) {
+ mobileContainer.parent('.g-block')[!mCtext ? 'addClass' : 'removeClass']('hidden');
+ }
+
+ if (!shouldCollapse && !this.attached) { this.attach(); }
+ else if (shouldCollapse && this.attached) {
+ this.detach();
+ this.attachMutationEvent();
+ }
+ }, 0, this);
+ }
+});
+
+module.exports = Offcanvas;
+
+},{"../utils/decouple":5,"domready":7,"elements":12,"elements/zen":36,"mout/array/forEach":37,"mout/function/bind":40,"mout/function/timeout":44,"mout/math/clamp":49,"mout/math/map":51,"mout/string/trim":60,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],4:[function(require,module,exports){
+"use strict";
+
+var ready = require('domready'),
+ $ = require('../utils/dollar-extras');
+
+var timeOut,
+ scrollToTop = function() {
+ if (document.body.scrollTop != 0 || document.documentElement.scrollTop != 0) {
+ window.scrollBy(0, -50);
+ timeOut = setTimeout(scrollToTop, 10);
+ } else {
+ clearTimeout(timeOut);
+ }
+ };
+
+ready(function() {
+ var totop = $('#g-totop');
+ if (!totop) { return; }
+
+ totop.on('click', function(e) {
+ e.preventDefault();
+ scrollToTop();
+ });
+});
+
+module.exports = {};
+
+},{"../utils/dollar-extras":6,"domready":7}],5:[function(require,module,exports){
+'use strict';
+
+var rAF = (function() {
+ return window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ function(callback) { window.setTimeout(callback, 1000 / 60); };
+}());
+
+var decouple = function(element, event, callback) {
+ var evt, tracking = false;
+ element = element[0] || element;
+
+ var capture = function(e) {
+ evt = e;
+ track();
+ };
+
+ var track = function() {
+ if (!tracking) {
+ rAF(update);
+ tracking = true;
+ }
+ };
+
+ var update = function() {
+ callback.call(element, evt);
+ tracking = false;
+ };
+
+ try {
+ element.addEventListener(event, capture, false);
+ } catch (e) {}
+
+ return capture;
+};
+
+module.exports = decouple;
+},{}],6:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ map = require('mout/array/map'),
+ slick = require('slick');
+
+var walk = function(combinator, method) {
+
+ return function(expression) {
+ var parts = slick.parse(expression || "*");
+
+ expression = map(parts, function(part) {
+ return combinator + " " + part;
+ }).join(', ');
+
+ return this[method](expression);
+ };
+
+};
+
+
+$.implement({
+ sibling: walk('++', 'find'),
+ siblings: walk('~~', 'search')
+});
+
+
+module.exports = $;
+
+},{"elements":12,"mout/array/map":38,"slick":97}],7:[function(require,module,exports){
+/*!
+ * domready (c) Dustin Diaz 2014 - License MIT
+ */
+!function (name, definition) {
+
+ if (typeof module != 'undefined') module.exports = definition()
+ else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
+ else this[name] = definition()
+
+}('domready', function () {
+
+ var fns = [], listener
+ , doc = document
+ , hack = doc.documentElement.doScroll
+ , domContentLoaded = 'DOMContentLoaded'
+ , loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState)
+
+
+ if (!loaded)
+ doc.addEventListener(domContentLoaded, listener = function () {
+ doc.removeEventListener(domContentLoaded, listener)
+ loaded = 1
+ while (listener = fns.shift()) listener()
+ })
+
+ return function (fn) {
+ loaded ? setTimeout(fn, 0) : fns.push(fn)
+ }
+
+});
+
+},{}],8:[function(require,module,exports){
+/*
+attributes
+*/"use strict"
+
+var $ = require("./base")
+
+var trim = require("mout/string/trim"),
+ forEach = require("mout/array/forEach"),
+ filter = require("mout/array/filter"),
+ indexOf = require("mout/array/indexOf")
+
+// attributes
+
+$.implement({
+
+ setAttribute: function(name, value){
+ return this.forEach(function(node){
+ node.setAttribute(name, value)
+ })
+ },
+
+ getAttribute: function(name){
+ var attr = this[0].getAttributeNode(name)
+ return (attr && attr.specified) ? attr.value : null
+ },
+
+ hasAttribute: function(name){
+ var node = this[0]
+ if (node.hasAttribute) return node.hasAttribute(name)
+ var attr = node.getAttributeNode(name)
+ return !!(attr && attr.specified)
+ },
+
+ removeAttribute: function(name){
+ return this.forEach(function(node){
+ var attr = node.getAttributeNode(name)
+ if (attr) node.removeAttributeNode(attr)
+ })
+ }
+
+})
+
+var accessors = {}
+
+forEach(["type", "value", "name", "href", "title", "id"], function(name){
+
+ accessors[name] = function(value){
+ return (value !== undefined) ? this.forEach(function(node){
+ node[name] = value
+ }) : this[0][name]
+ }
+
+})
+
+// booleans
+
+forEach(["checked", "disabled", "selected"], function(name){
+
+ accessors[name] = function(value){
+ return (value !== undefined) ? this.forEach(function(node){
+ node[name] = !!value
+ }) : !!this[0][name]
+ }
+
+})
+
+// className
+
+var classes = function(className){
+ var classNames = trim(className).replace(/\s+/g, " ").split(" "),
+ uniques = {}
+
+ return filter(classNames, function(className){
+ if (className !== "" && !uniques[className]) return uniques[className] = className
+ }).sort()
+}
+
+accessors.className = function(className){
+ return (className !== undefined) ? this.forEach(function(node){
+ node.className = classes(className).join(" ")
+ }) : classes(this[0].className).join(" ")
+}
+
+// attribute
+
+$.implement({
+
+ attribute: function(name, value){
+ var accessor = accessors[name]
+ if (accessor) return accessor.call(this, value)
+ if (value != null) return this.setAttribute(name, value)
+ if (value === null) return this.removeAttribute(name)
+ if (value === undefined) return this.getAttribute(name)
+ }
+
+})
+
+$.implement(accessors)
+
+// shortcuts
+
+$.implement({
+
+ check: function(){
+ return this.checked(true)
+ },
+
+ uncheck: function(){
+ return this.checked(false)
+ },
+
+ disable: function(){
+ return this.disabled(true)
+ },
+
+ enable: function(){
+ return this.disabled(false)
+ },
+
+ select: function(){
+ return this.selected(true)
+ },
+
+ deselect: function(){
+ return this.selected(false)
+ }
+
+})
+
+// classNames, has / add / remove Class
+
+$.implement({
+
+ classNames: function(){
+ return classes(this[0].className)
+ },
+
+ hasClass: function(className){
+ return indexOf(this.classNames(), className) > -1
+ },
+
+ addClass: function(className){
+ return this.forEach(function(node){
+ var nodeClassName = node.className
+ var classNames = classes(nodeClassName + " " + className).join(" ")
+ if (nodeClassName !== classNames) node.className = classNames
+ })
+ },
+
+ removeClass: function(className){
+ return this.forEach(function(node){
+ var classNames = classes(node.className)
+ forEach(classes(className), function(className){
+ var index = indexOf(classNames, className)
+ if (index > -1) classNames.splice(index, 1)
+ })
+ node.className = classNames.join(" ")
+ })
+ },
+
+ toggleClass: function(className, force){
+ var add = force !== undefined ? force : !this.hasClass(className)
+ if (add)
+ this.addClass(className)
+ else
+ this.removeClass(className)
+ return !!add
+ }
+
+})
+
+// toString
+
+$.prototype.toString = function(){
+ var tag = this.tag(),
+ id = this.id(),
+ classes = this.classNames()
+
+ var str = tag
+ if (id) str += '#' + id
+ if (classes.length) str += '.' + classes.join(".")
+ return str
+}
+
+var textProperty = (document.createElement('div').textContent == null) ? 'innerText' : 'textContent'
+
+// tag, html, text, data
+
+$.implement({
+
+ tag: function(){
+ return this[0].tagName.toLowerCase()
+ },
+
+ html: function(html){
+ return (html !== undefined) ? this.forEach(function(node){
+ node.innerHTML = html
+ }) : this[0].innerHTML
+ },
+
+ text: function(text){
+ return (text !== undefined) ? this.forEach(function(node){
+ node[textProperty] = text
+ }) : this[0][textProperty]
+ },
+
+ data: function(key, value){
+ switch(value) {
+ case undefined: return this.getAttribute("data-" + key)
+ case null: return this.removeAttribute("data-" + key)
+ default: return this.setAttribute("data-" + key, value)
+ }
+ }
+
+})
+
+module.exports = $
+
+},{"./base":9,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/indexOf":17,"mout/string/trim":34}],9:[function(require,module,exports){
+/*
+elements
+*/"use strict"
+
+var prime = require("prime")
+
+var forEach = require("mout/array/forEach"),
+ map = require("mout/array/map"),
+ filter = require("mout/array/filter"),
+ every = require("mout/array/every"),
+ some = require("mout/array/some")
+
+// uniqueID
+
+var index = 0,
+ __dc = document.__counter,
+ counter = document.__counter = (__dc ? parseInt(__dc, 36) + 1 : 0).toString(36),
+ key = "uid:" + counter
+
+var uniqueID = function(n){
+ if (n === window) return "window"
+ if (n === document) return "document"
+ if (n === document.documentElement) return "html"
+ return n[key] || (n[key] = (index++).toString(36))
+}
+
+var instances = {}
+
+// elements prime
+
+var $ = prime({constructor: function $(n, context){
+
+ if (n == null) return (this && this.constructor === $) ? new Elements : null
+
+ var self, uid
+
+ if (n.constructor !== Elements){
+
+ self = new Elements
+
+ if (typeof n === "string"){
+ if (!self.search) return null
+ self[self.length++] = context || document
+ return self.search(n)
+ }
+
+ if (n.nodeType || n === window){
+
+ self[self.length++] = n
+
+ } else if (n.length){
+
+ // this could be an array, or any object with a length attribute,
+ // including another instance of elements from another interface.
+
+ var uniques = {}
+
+ for (var i = 0, l = n.length; i < l; i++){ // perform elements flattening
+ var nodes = $(n[i], context)
+ if (nodes && nodes.length) for (var j = 0, k = nodes.length; j < k; j++){
+ var node = nodes[j]
+ uid = uniqueID(node)
+ if (!uniques[uid]){
+ self[self.length++] = node
+ uniques[uid] = true
+ }
+ }
+ }
+
+ }
+
+ } else {
+ self = n
+ }
+
+ if (!self.length) return null
+
+ // when length is 1 always use the same elements instance
+
+ if (self.length === 1){
+ uid = uniqueID(self[0])
+ return instances[uid] || (instances[uid] = self)
+ }
+
+ return self
+
+}})
+
+var Elements = prime({
+
+ inherits: $,
+
+ constructor: function Elements(){
+ this.length = 0
+ },
+
+ unlink: function(){
+ return this.map(function(node){
+ delete instances[uniqueID(node)]
+ return node
+ })
+ },
+
+ // methods
+
+ forEach: function(method, context){
+ forEach(this, method, context)
+ return this
+ },
+
+ map: function(method, context){
+ return map(this, method, context)
+ },
+
+ filter: function(method, context){
+ return filter(this, method, context)
+ },
+
+ every: function(method, context){
+ return every(this, method, context)
+ },
+
+ some: function(method, context){
+ return some(this, method, context)
+ }
+
+})
+
+module.exports = $
+
+},{"mout/array/every":14,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/map":18,"mout/array/some":19,"prime":85}],10:[function(require,module,exports){
+/*
+delegation
+*/"use strict"
+
+var Map = require("prime/map")
+
+var $ = require("./events")
+ require('./traversal')
+
+$.implement({
+
+ delegate: function(event, selector, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node)
+
+ var delegation = self._delegation || (self._delegation = {}),
+ events = delegation[event] || (delegation[event] = {}),
+ map = (events[selector] || (events[selector] = new Map))
+
+ if (map.get(handle)) return
+
+ var action = function(e){
+ var target = $(e.target || e.srcElement),
+ match = target.matches(selector) ? target : target.parent(selector)
+
+ var res
+
+ if (match) res = handle.call(self, e, match)
+
+ return res
+ }
+
+ map.set(handle, action)
+
+ self.on(event, action, useCapture)
+
+ })
+
+ },
+
+ undelegate: function(event, selector, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node), delegation, events, map
+
+ if (!(delegation = self._delegation) || !(events = delegation[event]) || !(map = events[selector])) return;
+
+ var action = map.get(handle)
+
+ if (action){
+ self.off(event, action, useCapture)
+ map.remove(action)
+
+ // if there are no more handles in a given selector, delete it
+ if (!map.count()) delete events[selector]
+ // var evc = evd = 0, x
+ var e1 = true, e2 = true, x
+ for (x in events){
+ e1 = false
+ break
+ }
+ // if no more selectors in a given event type, delete it
+ if (e1) delete delegation[event]
+ for (x in delegation){
+ e2 = false
+ break
+ }
+ // if there are no more delegation events in the element, delete the _delegation object
+ if (e2) delete self._delegation
+ }
+
+ })
+
+ }
+
+})
+
+module.exports = $
+
+},{"./events":11,"./traversal":35,"prime/map":86}],11:[function(require,module,exports){
+/*
+events
+*/"use strict"
+
+var Emitter = require("prime/emitter")
+
+var $ = require("./base")
+
+var html = document.documentElement
+
+var addEventListener = html.addEventListener ? function(node, event, handle, useCapture){
+ node.addEventListener(event, handle, useCapture || false)
+ return handle
+} : function(node, event, handle){
+ node.attachEvent('on' + event, handle)
+ return handle
+}
+
+var removeEventListener = html.removeEventListener ? function(node, event, handle, useCapture){
+ node.removeEventListener(event, handle, useCapture || false)
+} : function(node, event, handle){
+ node.detachEvent("on" + event, handle)
+}
+
+$.implement({
+
+ on: function(event, handle, useCapture){
+
+ return this.forEach(function(node){
+ var self = $(node)
+
+ var internalEvent = event + (useCapture ? ":capture" : "")
+
+ Emitter.prototype.on.call(self, internalEvent, handle)
+
+ var domListeners = self._domListeners || (self._domListeners = {})
+ if (!domListeners[internalEvent]) domListeners[internalEvent] = addEventListener(node, event, function(e){
+ Emitter.prototype.emit.call(self, internalEvent, e || window.event, Emitter.EMIT_SYNC)
+ }, useCapture)
+ })
+ },
+
+ off: function(event, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node)
+
+ var internalEvent = event + (useCapture ? ":capture" : "")
+
+ var domListeners = self._domListeners, domEvent, listeners = self._listeners, events
+
+ if (domListeners && (domEvent = domListeners[internalEvent]) && listeners && (events = listeners[internalEvent])){
+
+ Emitter.prototype.off.call(self, internalEvent, handle)
+
+ if (!self._listeners || !self._listeners[event]){
+ removeEventListener(node, event, domEvent)
+ delete domListeners[event]
+
+ for (var l in domListeners) return
+ delete self._domListeners
+ }
+
+ }
+ })
+ },
+
+ emit: function(){
+ var args = arguments
+ return this.forEach(function(node){
+ Emitter.prototype.emit.apply($(node), args)
+ })
+ }
+
+})
+
+module.exports = $
+
+},{"./base":9,"prime/emitter":84}],12:[function(require,module,exports){
+/*
+elements
+*/"use strict"
+
+var $ = require("./base")
+ require("./attributes")
+ require("./events")
+ require("./insertion")
+ require("./traversal")
+ require("./delegation")
+
+module.exports = $
+
+},{"./attributes":8,"./base":9,"./delegation":10,"./events":11,"./insertion":13,"./traversal":35}],13:[function(require,module,exports){
+/*
+insertion
+*/"use strict"
+
+var $ = require("./base")
+
+// base insertion
+
+$.implement({
+
+ appendChild: function(child){
+ this[0].appendChild($(child)[0])
+ return this
+ },
+
+ insertBefore: function(child, ref){
+ this[0].insertBefore($(child)[0], $(ref)[0])
+ return this
+ },
+
+ removeChild: function(child){
+ this[0].removeChild($(child)[0])
+ return this
+ },
+
+ replaceChild: function(child, ref){
+ this[0].replaceChild($(child)[0], $(ref)[0])
+ return this
+ }
+
+})
+
+// before, after, bottom, top
+
+$.implement({
+
+ before: function(element){
+ element = $(element)[0]
+ var parent = element.parentNode
+ if (parent) this.forEach(function(node){
+ parent.insertBefore(node, element)
+ })
+ return this
+ },
+
+ after: function(element){
+ element = $(element)[0]
+ var parent = element.parentNode
+ if (parent) this.forEach(function(node){
+ parent.insertBefore(node, element.nextSibling)
+ })
+ return this
+ },
+
+ bottom: function(element){
+ element = $(element)[0]
+ return this.forEach(function(node){
+ element.appendChild(node)
+ })
+ },
+
+ top: function(element){
+ element = $(element)[0]
+ return this.forEach(function(node){
+ element.insertBefore(node, element.firstChild)
+ })
+ }
+
+})
+
+// insert, replace
+
+$.implement({
+
+ insert: $.prototype.bottom,
+
+ remove: function(){
+ return this.forEach(function(node){
+ var parent = node.parentNode
+ if (parent) parent.removeChild(node)
+ })
+ },
+
+ replace: function(element){
+ element = $(element)[0]
+ element.parentNode.replaceChild(this[0], element)
+ return this
+ }
+
+})
+
+module.exports = $
+
+},{"./base":9}],14:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array every
+ */
+ function every(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = true;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (!callback(arr[i], i, arr) ) {
+ result = false;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = every;
+
+
+},{"../function/makeIterator_":21}],15:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array filter
+ */
+ function filter(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null) {
+ return results;
+ }
+
+ var i = -1, len = arr.length, value;
+ while (++i < len) {
+ value = arr[i];
+ if (callback(value, i, arr)) {
+ results.push(value);
+ }
+ }
+
+ return results;
+ }
+
+ module.exports = filter;
+
+
+
+},{"../function/makeIterator_":21}],16:[function(require,module,exports){
+
+
+ /**
+ * Array forEach
+ */
+ function forEach(arr, callback, thisObj) {
+ if (arr == null) {
+ return;
+ }
+ var i = -1,
+ len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback.call(thisObj, arr[i], i, arr) === false ) {
+ break;
+ }
+ }
+ }
+
+ module.exports = forEach;
+
+
+
+},{}],17:[function(require,module,exports){
+
+
+ /**
+ * Array.indexOf
+ */
+ function indexOf(arr, item, fromIndex) {
+ fromIndex = fromIndex || 0;
+ if (arr == null) {
+ return -1;
+ }
+
+ var len = arr.length,
+ i = fromIndex < 0 ? len + fromIndex : fromIndex;
+ while (i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (arr[i] === item) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ module.exports = indexOf;
+
+
+},{}],18:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array map
+ */
+ function map(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null){
+ return results;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ results[i] = callback(arr[i], i, arr);
+ }
+
+ return results;
+ }
+
+ module.exports = map;
+
+
+},{"../function/makeIterator_":21}],19:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array some
+ */
+ function some(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = false;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback(arr[i], i, arr) ) {
+ result = true;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = some;
+
+
+},{"../function/makeIterator_":21}],20:[function(require,module,exports){
+
+
+ /**
+ * Returns the first argument provided to it.
+ */
+ function identity(val){
+ return val;
+ }
+
+ module.exports = identity;
+
+
+
+},{}],21:[function(require,module,exports){
+var identity = require('./identity');
+var prop = require('./prop');
+var deepMatches = require('../object/deepMatches');
+
+ /**
+ * Converts argument into a valid iterator.
+ * Used internally on most array/object/collection methods that receives a
+ * callback/iterator providing a shortcut syntax.
+ */
+ function makeIterator(src, thisObj){
+ if (src == null) {
+ return identity;
+ }
+ switch(typeof src) {
+ case 'function':
+ // function is the first to improve perf (most common case)
+ // also avoid using `Function#call` if not needed, which boosts
+ // perf a lot in some cases
+ return (typeof thisObj !== 'undefined')? function(val, i, arr){
+ return src.call(thisObj, val, i, arr);
+ } : src;
+ case 'object':
+ return function(val){
+ return deepMatches(val, src);
+ };
+ case 'string':
+ case 'number':
+ return prop(src);
+ }
+ }
+
+ module.exports = makeIterator;
+
+
+
+},{"../object/deepMatches":27,"./identity":20,"./prop":22}],22:[function(require,module,exports){
+
+
+ /**
+ * Returns a function that gets a property of the passed object
+ */
+ function prop(name){
+ return function(obj){
+ return obj[name];
+ };
+ }
+
+ module.exports = prop;
+
+
+
+},{}],23:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ var isArray = Array.isArray || function (val) {
+ return isKind(val, 'Array');
+ };
+ module.exports = isArray;
+
+
+},{"./isKind":24}],24:[function(require,module,exports){
+var kindOf = require('./kindOf');
+ /**
+ * Check if value is from a specific "kind".
+ */
+ function isKind(val, kind){
+ return kindOf(val) === kind;
+ }
+ module.exports = isKind;
+
+
+},{"./kindOf":25}],25:[function(require,module,exports){
+
+
+ var _rKind = /^\[object (.*)\]$/,
+ _toString = Object.prototype.toString,
+ UNDEF;
+
+ /**
+ * Gets the "kind" of value. (e.g. "String", "Number", etc)
+ */
+ function kindOf(val) {
+ if (val === null) {
+ return 'Null';
+ } else if (val === UNDEF) {
+ return 'Undefined';
+ } else {
+ return _rKind.exec( _toString.call(val) )[1];
+ }
+ }
+ module.exports = kindOf;
+
+
+},{}],26:[function(require,module,exports){
+
+
+ /**
+ * Typecast a value to a String, using an empty string value for null or
+ * undefined.
+ */
+ function toString(val){
+ return val == null ? '' : val.toString();
+ }
+
+ module.exports = toString;
+
+
+
+},{}],27:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var isArray = require('../lang/isArray');
+
+ function containsMatch(array, pattern) {
+ var i = -1, length = array.length;
+ while (++i < length) {
+ if (deepMatches(array[i], pattern)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function matchArray(target, pattern) {
+ var i = -1, patternLength = pattern.length;
+ while (++i < patternLength) {
+ if (!containsMatch(target, pattern[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function matchObject(target, pattern) {
+ var result = true;
+ forOwn(pattern, function(val, key) {
+ if (!deepMatches(target[key], val)) {
+ // Return false to break out of forOwn early
+ return (result = false);
+ }
+ });
+
+ return result;
+ }
+
+ /**
+ * Recursively check if the objects match.
+ */
+ function deepMatches(target, pattern){
+ if (target && typeof target === 'object') {
+ if (isArray(target) && isArray(pattern)) {
+ return matchArray(target, pattern);
+ } else {
+ return matchObject(target, pattern);
+ }
+ } else {
+ return target === pattern;
+ }
+ }
+
+ module.exports = deepMatches;
+
+
+
+},{"../lang/isArray":23,"./forOwn":29}],28:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+
+ var _hasDontEnumBug,
+ _dontEnums;
+
+ function checkDontEnum(){
+ _dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ];
+
+ _hasDontEnumBug = true;
+
+ for (var key in {'toString': null}) {
+ _hasDontEnumBug = false;
+ }
+ }
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forIn(obj, fn, thisObj){
+ var key, i = 0;
+ // no need to check if argument is a real object that way we can use
+ // it for arrays, functions, date, etc.
+
+ //post-pone check till needed
+ if (_hasDontEnumBug == null) checkDontEnum();
+
+ for (key in obj) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+
+
+ if (_hasDontEnumBug) {
+ var ctor = obj.constructor,
+ isProto = !!ctor && obj === ctor.prototype;
+
+ while (key = _dontEnums[i++]) {
+ // For constructor, if it is a prototype object the constructor
+ // is always non-enumerable unless defined otherwise (and
+ // enumerated above). For non-prototype objects, it will have
+ // to be defined on this object, since it cannot be defined on
+ // any prototype objects.
+ //
+ // For other [[DontEnum]] properties, check if the value is
+ // different than Object prototype value.
+ if (
+ (key !== 'constructor' ||
+ (!isProto && hasOwn(obj, key))) &&
+ obj[key] !== Object.prototype[key]
+ ) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ function exec(fn, obj, key, thisObj){
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+
+ module.exports = forIn;
+
+
+
+},{"./hasOwn":30}],29:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var forIn = require('./forIn');
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forOwn(obj, fn, thisObj){
+ forIn(obj, function(val, key){
+ if (hasOwn(obj, key)) {
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+ });
+ }
+
+ module.exports = forOwn;
+
+
+
+},{"./forIn":28,"./hasOwn":30}],30:[function(require,module,exports){
+
+
+ /**
+ * Safer Object.hasOwnProperty
+ */
+ function hasOwn(obj, prop){
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ module.exports = hasOwn;
+
+
+
+},{}],31:[function(require,module,exports){
+
+ /**
+ * Contains all Unicode white-spaces. Taken from
+ * http://en.wikipedia.org/wiki/Whitespace_character.
+ */
+ module.exports = [
+ ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E',
+ '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
+ '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
+ '\u205F', '\u3000'
+ ];
+
+
+},{}],32:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from beginning of string.
+ */
+ function ltrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var start = 0,
+ len = str.length,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && start < len) {
+ found = false;
+ i = -1;
+ c = str.charAt(start);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ start++;
+ break;
+ }
+ }
+ }
+
+ return (start >= len) ? '' : str.substr(start, len);
+ }
+
+ module.exports = ltrim;
+
+
+},{"../lang/toString":26,"./WHITE_SPACES":31}],33:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from end of string.
+ */
+ function rtrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var end = str.length - 1,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && end >= 0) {
+ found = false;
+ i = -1;
+ c = str.charAt(end);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ end--;
+ break;
+ }
+ }
+ }
+
+ return (end >= 0) ? str.substring(0, end + 1) : '';
+ }
+
+ module.exports = rtrim;
+
+
+},{"../lang/toString":26,"./WHITE_SPACES":31}],34:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+var ltrim = require('./ltrim');
+var rtrim = require('./rtrim');
+ /**
+ * Remove white-spaces from beginning and end of string.
+ */
+ function trim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+ return ltrim(rtrim(str, chars), chars);
+ }
+
+ module.exports = trim;
+
+
+},{"../lang/toString":26,"./WHITE_SPACES":31,"./ltrim":32,"./rtrim":33}],35:[function(require,module,exports){
+/*
+traversal
+*/"use strict"
+
+var map = require("mout/array/map")
+
+var slick = require("slick")
+
+var $ = require("./base")
+
+var gen = function(combinator, expression){
+ return map(slick.parse(expression || "*"), function(part){
+ return combinator + " " + part
+ }).join(", ")
+}
+
+var push_ = Array.prototype.push
+
+$.implement({
+
+ search: function(expression){
+ if (this.length === 1) return $(slick.search(expression, this[0], new $))
+
+ var buffer = []
+ for (var i = 0, node; node = this[i]; i++) push_.apply(buffer, slick.search(expression, node))
+ buffer = $(buffer)
+ return buffer && buffer.sort()
+ },
+
+ find: function(expression){
+ if (this.length === 1) return $(slick.find(expression, this[0]))
+
+ for (var i = 0, node; node = this[i]; i++) {
+ var found = slick.find(expression, node)
+ if (found) return $(found)
+ }
+
+ return null
+ },
+
+ sort: function(){
+ return slick.sort(this)
+ },
+
+ matches: function(expression){
+ return slick.matches(this[0], expression)
+ },
+
+ contains: function(node){
+ return slick.contains(this[0], node)
+ },
+
+ nextSiblings: function(expression){
+ return this.search(gen('~', expression))
+ },
+
+ nextSibling: function(expression){
+ return this.find(gen('+', expression))
+ },
+
+ previousSiblings: function(expression){
+ return this.search(gen('!~', expression))
+ },
+
+ previousSibling: function(expression){
+ return this.find(gen('!+', expression))
+ },
+
+ children: function(expression){
+ return this.search(gen('>', expression))
+ },
+
+ firstChild: function(expression){
+ return this.find(gen('^', expression))
+ },
+
+ lastChild: function(expression){
+ return this.find(gen('!^', expression))
+ },
+
+ parent: function(expression){
+ var buffer = []
+ loop: for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){
+ if (!expression || slick.matches(node, expression)){
+ buffer.push(node)
+ break loop
+ break
+ }
+ }
+ return $(buffer)
+ },
+
+ parents: function(expression){
+ var buffer = []
+ for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){
+ if (!expression || slick.matches(node, expression)) buffer.push(node)
+ }
+ return $(buffer)
+ }
+
+})
+
+module.exports = $
+
+},{"./base":9,"mout/array/map":18,"slick":97}],36:[function(require,module,exports){
+/*
+zen
+*/"use strict"
+
+var forEach = require("mout/array/forEach"),
+ map = require("mout/array/map")
+
+var parse = require("slick/parser")
+
+var $ = require("./base")
+
+module.exports = function(expression, doc){
+
+ return $(map(parse(expression), function(expression){
+
+ var previous, result
+
+ forEach(expression, function(part, i){
+
+ var node = (doc || document).createElement(part.tag)
+
+ if (part.id) node.id = part.id
+
+ if (part.classList) node.className = part.classList.join(" ")
+
+ if (part.attributes) forEach(part.attributes, function(attribute){
+ node.setAttribute(attribute.name, attribute.value || "")
+ })
+
+ if (part.pseudos) forEach(part.pseudos, function(pseudo){
+ var n = $(node), method = n[pseudo.name]
+ if (method) method.call(n, pseudo.value)
+ })
+
+ if (i === 0){
+
+ result = node
+
+ } else if (part.combinator === " "){
+
+ previous.appendChild(node)
+
+ } else if (part.combinator === "+"){
+ var parentNode = previous.parentNode
+ if (parentNode) parentNode.appendChild(node)
+ }
+
+ previous = node
+
+ })
+
+ return result
+
+ }))
+
+}
+
+},{"./base":9,"mout/array/forEach":16,"mout/array/map":18,"slick/parser":98}],37:[function(require,module,exports){
+
+
+ /**
+ * Array forEach
+ */
+ function forEach(arr, callback, thisObj) {
+ if (arr == null) {
+ return;
+ }
+ var i = -1,
+ len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback.call(thisObj, arr[i], i, arr) === false ) {
+ break;
+ }
+ }
+ }
+
+ module.exports = forEach;
+
+
+
+},{}],38:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array map
+ */
+ function map(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null){
+ return results;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ results[i] = callback(arr[i], i, arr);
+ }
+
+ return results;
+ }
+
+ module.exports = map;
+
+
+},{"../function/makeIterator_":42}],39:[function(require,module,exports){
+
+
+ /**
+ * Create slice of source array or array-like object
+ */
+ function slice(arr, start, end){
+ var len = arr.length;
+
+ if (start == null) {
+ start = 0;
+ } else if (start < 0) {
+ start = Math.max(len + start, 0);
+ } else {
+ start = Math.min(start, len);
+ }
+
+ if (end == null) {
+ end = len;
+ } else if (end < 0) {
+ end = Math.max(len + end, 0);
+ } else {
+ end = Math.min(end, len);
+ }
+
+ var result = [];
+ while (start < end) {
+ result.push(arr[start++]);
+ }
+
+ return result;
+ }
+
+ module.exports = slice;
+
+
+
+},{}],40:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection.
+ * @param {Function} fn Function.
+ * @param {object} context Execution context.
+ * @param {rest} args Arguments (0...n arguments).
+ * @return {Function} Wrapped Function.
+ */
+ function bind(fn, context, args){
+ var argsArr = slice(arguments, 2); //curried args
+ return function(){
+ return fn.apply(context, argsArr.concat(slice(arguments)));
+ };
+ }
+
+ module.exports = bind;
+
+
+
+},{"../array/slice":39}],41:[function(require,module,exports){
+
+
+ /**
+ * Returns the first argument provided to it.
+ */
+ function identity(val){
+ return val;
+ }
+
+ module.exports = identity;
+
+
+
+},{}],42:[function(require,module,exports){
+var identity = require('./identity');
+var prop = require('./prop');
+var deepMatches = require('../object/deepMatches');
+
+ /**
+ * Converts argument into a valid iterator.
+ * Used internally on most array/object/collection methods that receives a
+ * callback/iterator providing a shortcut syntax.
+ */
+ function makeIterator(src, thisObj){
+ if (src == null) {
+ return identity;
+ }
+ switch(typeof src) {
+ case 'function':
+ // function is the first to improve perf (most common case)
+ // also avoid using `Function#call` if not needed, which boosts
+ // perf a lot in some cases
+ return (typeof thisObj !== 'undefined')? function(val, i, arr){
+ return src.call(thisObj, val, i, arr);
+ } : src;
+ case 'object':
+ return function(val){
+ return deepMatches(val, src);
+ };
+ case 'string':
+ case 'number':
+ return prop(src);
+ }
+ }
+
+ module.exports = makeIterator;
+
+
+
+},{"../object/deepMatches":53,"./identity":41,"./prop":43}],43:[function(require,module,exports){
+
+
+ /**
+ * Returns a function that gets a property of the passed object
+ */
+ function prop(name){
+ return function(obj){
+ return obj[name];
+ };
+ }
+
+ module.exports = prop;
+
+
+
+},{}],44:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * Delays the call of a function within a given context.
+ */
+ function timeout(fn, millis, context){
+
+ var args = slice(arguments, 3);
+
+ return setTimeout(function() {
+ fn.apply(context, args);
+ }, millis);
+ }
+
+ module.exports = timeout;
+
+
+
+},{"../array/slice":39}],45:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ var isArray = Array.isArray || function (val) {
+ return isKind(val, 'Array');
+ };
+ module.exports = isArray;
+
+
+},{"./isKind":46}],46:[function(require,module,exports){
+var kindOf = require('./kindOf');
+ /**
+ * Check if value is from a specific "kind".
+ */
+ function isKind(val, kind){
+ return kindOf(val) === kind;
+ }
+ module.exports = isKind;
+
+
+},{"./kindOf":47}],47:[function(require,module,exports){
+
+ /**
+ * Gets the "kind" of value. (e.g. "String", "Number", etc)
+ */
+ function kindOf(val) {
+ return Object.prototype.toString.call(val).slice(8, -1);
+ }
+ module.exports = kindOf;
+
+
+},{}],48:[function(require,module,exports){
+
+
+ /**
+ * Typecast a value to a String, using an empty string value for null or
+ * undefined.
+ */
+ function toString(val){
+ return val == null ? '' : val.toString();
+ }
+
+ module.exports = toString;
+
+
+
+},{}],49:[function(require,module,exports){
+
+ /**
+ * Clamps value inside range.
+ */
+ function clamp(val, min, max){
+ return val < min? min : (val > max? max : val);
+ }
+ module.exports = clamp;
+
+
+},{}],50:[function(require,module,exports){
+
+ /**
+ * Linear interpolation.
+ * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE
+ */
+ function lerp(ratio, start, end){
+ return start + (end - start) * ratio;
+ }
+
+ module.exports = lerp;
+
+
+},{}],51:[function(require,module,exports){
+var lerp = require('./lerp');
+var norm = require('./norm');
+ /**
+ * Maps a number from one scale to another.
+ * @example map(3, 0, 4, -1, 1) -> 0.5
+ */
+ function map(val, min1, max1, min2, max2){
+ return lerp( norm(val, min1, max1), min2, max2 );
+ }
+ module.exports = map;
+
+
+},{"./lerp":50,"./norm":52}],52:[function(require,module,exports){
+
+ /**
+ * Gets normalized ratio of value inside range.
+ */
+ function norm(val, min, max){
+ if (val < min || val > max) {
+ throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max);
+ }
+
+ return val === max ? 1 : (val - min) / (max - min);
+ }
+ module.exports = norm;
+
+
+},{}],53:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var isArray = require('../lang/isArray');
+
+ function containsMatch(array, pattern) {
+ var i = -1, length = array.length;
+ while (++i < length) {
+ if (deepMatches(array[i], pattern)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function matchArray(target, pattern) {
+ var i = -1, patternLength = pattern.length;
+ while (++i < patternLength) {
+ if (!containsMatch(target, pattern[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function matchObject(target, pattern) {
+ var result = true;
+ forOwn(pattern, function(val, key) {
+ if (!deepMatches(target[key], val)) {
+ // Return false to break out of forOwn early
+ return (result = false);
+ }
+ });
+
+ return result;
+ }
+
+ /**
+ * Recursively check if the objects match.
+ */
+ function deepMatches(target, pattern){
+ if (target && typeof target === 'object' &&
+ pattern && typeof pattern === 'object') {
+ if (isArray(target) && isArray(pattern)) {
+ return matchArray(target, pattern);
+ } else {
+ return matchObject(target, pattern);
+ }
+ } else {
+ return target === pattern;
+ }
+ }
+
+ module.exports = deepMatches;
+
+
+
+},{"../lang/isArray":45,"./forOwn":55}],54:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+
+ var _hasDontEnumBug,
+ _dontEnums;
+
+ function checkDontEnum(){
+ _dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ];
+
+ _hasDontEnumBug = true;
+
+ for (var key in {'toString': null}) {
+ _hasDontEnumBug = false;
+ }
+ }
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forIn(obj, fn, thisObj){
+ var key, i = 0;
+ // no need to check if argument is a real object that way we can use
+ // it for arrays, functions, date, etc.
+
+ //post-pone check till needed
+ if (_hasDontEnumBug == null) checkDontEnum();
+
+ for (key in obj) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+
+
+ if (_hasDontEnumBug) {
+ var ctor = obj.constructor,
+ isProto = !!ctor && obj === ctor.prototype;
+
+ while (key = _dontEnums[i++]) {
+ // For constructor, if it is a prototype object the constructor
+ // is always non-enumerable unless defined otherwise (and
+ // enumerated above). For non-prototype objects, it will have
+ // to be defined on this object, since it cannot be defined on
+ // any prototype objects.
+ //
+ // For other [[DontEnum]] properties, check if the value is
+ // different than Object prototype value.
+ if (
+ (key !== 'constructor' ||
+ (!isProto && hasOwn(obj, key))) &&
+ obj[key] !== Object.prototype[key]
+ ) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ function exec(fn, obj, key, thisObj){
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+
+ module.exports = forIn;
+
+
+
+},{"./hasOwn":56}],55:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var forIn = require('./forIn');
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forOwn(obj, fn, thisObj){
+ forIn(obj, function(val, key){
+ if (hasOwn(obj, key)) {
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+ });
+ }
+
+ module.exports = forOwn;
+
+
+
+},{"./forIn":54,"./hasOwn":56}],56:[function(require,module,exports){
+
+
+ /**
+ * Safer Object.hasOwnProperty
+ */
+ function hasOwn(obj, prop){
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ module.exports = hasOwn;
+
+
+
+},{}],57:[function(require,module,exports){
+
+ /**
+ * Contains all Unicode white-spaces. Taken from
+ * http://en.wikipedia.org/wiki/Whitespace_character.
+ */
+ module.exports = [
+ ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E',
+ '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
+ '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
+ '\u205F', '\u3000'
+ ];
+
+
+},{}],58:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from beginning of string.
+ */
+ function ltrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var start = 0,
+ len = str.length,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && start < len) {
+ found = false;
+ i = -1;
+ c = str.charAt(start);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ start++;
+ break;
+ }
+ }
+ }
+
+ return (start >= len) ? '' : str.substr(start, len);
+ }
+
+ module.exports = ltrim;
+
+
+},{"../lang/toString":48,"./WHITE_SPACES":57}],59:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from end of string.
+ */
+ function rtrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var end = str.length - 1,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && end >= 0) {
+ found = false;
+ i = -1;
+ c = str.charAt(end);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ end--;
+ break;
+ }
+ }
+ }
+
+ return (end >= 0) ? str.substring(0, end + 1) : '';
+ }
+
+ module.exports = rtrim;
+
+
+},{"../lang/toString":48,"./WHITE_SPACES":57}],60:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+var ltrim = require('./ltrim');
+var rtrim = require('./rtrim');
+ /**
+ * Remove white-spaces from beginning and end of string.
+ */
+ function trim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+ return ltrim(rtrim(str, chars), chars);
+ }
+
+ module.exports = trim;
+
+
+},{"../lang/toString":48,"./WHITE_SPACES":57,"./ltrim":58,"./rtrim":59}],61:[function(require,module,exports){
+
+
+ /**
+ * Create slice of source array or array-like object
+ */
+ function slice(arr, start, end){
+ var len = arr.length;
+
+ if (start == null) {
+ start = 0;
+ } else if (start < 0) {
+ start = Math.max(len + start, 0);
+ } else {
+ start = Math.min(start, len);
+ }
+
+ if (end == null) {
+ end = len;
+ } else if (end < 0) {
+ end = Math.max(len + end, 0);
+ } else {
+ end = Math.min(end, len);
+ }
+
+ var result = [];
+ while (start < end) {
+ result.push(arr[start++]);
+ }
+
+ return result;
+ }
+
+ module.exports = slice;
+
+
+
+},{}],62:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection.
+ * @param {Function} fn Function.
+ * @param {object} context Execution context.
+ * @param {rest} args Arguments (0...n arguments).
+ * @return {Function} Wrapped Function.
+ */
+ function bind(fn, context, args){
+ var argsArr = slice(arguments, 2); //curried args
+ return function(){
+ return fn.apply(context, argsArr.concat(slice(arguments)));
+ };
+ }
+
+ module.exports = bind;
+
+
+
+},{"../array/slice":61}],63:[function(require,module,exports){
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+var mixIn = require('../object/mixIn');
+
+ /**
+ * Clone native types.
+ */
+ function clone(val){
+ switch (kindOf(val)) {
+ case 'Object':
+ return cloneObject(val);
+ case 'Array':
+ return cloneArray(val);
+ case 'RegExp':
+ return cloneRegExp(val);
+ case 'Date':
+ return cloneDate(val);
+ default:
+ return val;
+ }
+ }
+
+ function cloneObject(source) {
+ if (isPlainObject(source)) {
+ return mixIn({}, source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneRegExp(r) {
+ var flags = '';
+ flags += r.multiline ? 'm' : '';
+ flags += r.global ? 'g' : '';
+ flags += r.ignorecase ? 'i' : '';
+ return new RegExp(r.source, flags);
+ }
+
+ function cloneDate(date) {
+ return new Date(+date);
+ }
+
+ function cloneArray(arr) {
+ return arr.slice();
+ }
+
+ module.exports = clone;
+
+
+
+},{"../object/mixIn":73,"./isPlainObject":67,"./kindOf":68}],64:[function(require,module,exports){
+var clone = require('./clone');
+var forOwn = require('../object/forOwn');
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+
+ /**
+ * Recursively clone native types.
+ */
+ function deepClone(val, instanceClone) {
+ switch ( kindOf(val) ) {
+ case 'Object':
+ return cloneObject(val, instanceClone);
+ case 'Array':
+ return cloneArray(val, instanceClone);
+ default:
+ return clone(val);
+ }
+ }
+
+ function cloneObject(source, instanceClone) {
+ if (isPlainObject(source)) {
+ var out = {};
+ forOwn(source, function(val, key) {
+ this[key] = deepClone(val, instanceClone);
+ }, out);
+ return out;
+ } else if (instanceClone) {
+ return instanceClone(source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneArray(arr, instanceClone) {
+ var out = [],
+ i = -1,
+ n = arr.length,
+ val;
+ while (++i < n) {
+ out[i] = deepClone(arr[i], instanceClone);
+ }
+ return out;
+ }
+
+ module.exports = deepClone;
+
+
+
+
+},{"../object/forOwn":70,"./clone":63,"./isPlainObject":67,"./kindOf":68}],65:[function(require,module,exports){
+arguments[4][24][0].apply(exports,arguments)
+},{"./kindOf":68,"dup":24}],66:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isObject(val) {
+ return isKind(val, 'Object');
+ }
+ module.exports = isObject;
+
+
+},{"./isKind":65}],67:[function(require,module,exports){
+
+
+ /**
+ * Checks if the value is created by the `Object` constructor.
+ */
+ function isPlainObject(value) {
+ return (!!value && typeof value === 'object' &&
+ value.constructor === Object);
+ }
+
+ module.exports = isPlainObject;
+
+
+
+},{}],68:[function(require,module,exports){
+arguments[4][25][0].apply(exports,arguments)
+},{"dup":25}],69:[function(require,module,exports){
+arguments[4][28][0].apply(exports,arguments)
+},{"./hasOwn":71,"dup":28}],70:[function(require,module,exports){
+arguments[4][29][0].apply(exports,arguments)
+},{"./forIn":69,"./hasOwn":71,"dup":29}],71:[function(require,module,exports){
+arguments[4][30][0].apply(exports,arguments)
+},{"dup":30}],72:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var deepClone = require('../lang/deepClone');
+var isObject = require('../lang/isObject');
+
+ /**
+ * Deep merge objects.
+ */
+ function merge() {
+ var i = 1,
+ key, val, obj, target;
+
+ // make sure we don't modify source element and it's properties
+ // objects are passed by reference
+ target = deepClone( arguments[0] );
+
+ while (obj = arguments[i++]) {
+ for (key in obj) {
+ if ( ! hasOwn(obj, key) ) {
+ continue;
+ }
+
+ val = obj[key];
+
+ if ( isObject(val) && isObject(target[key]) ){
+ // inception, deep merge objects
+ target[key] = merge(target[key], val);
+ } else {
+ // make sure arrays, regexp, date, objects are cloned
+ target[key] = deepClone(val);
+ }
+
+ }
+ }
+
+ return target;
+ }
+
+ module.exports = merge;
+
+
+
+},{"../lang/deepClone":64,"../lang/isObject":66,"./hasOwn":71}],73:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Combine properties from all the objects into first one.
+ * - This method affects target object in place, if you want to create a new Object pass an empty object as first param.
+ * @param {object} target Target Object
+ * @param {...object} objects Objects to be combined (0...n objects).
+ * @return {object} Target Object.
+ */
+ function mixIn(target, objects){
+ var i = 0,
+ n = arguments.length,
+ obj;
+ while(++i < n){
+ obj = arguments[i];
+ if (obj != null) {
+ forOwn(obj, copyProp, target);
+ }
+ }
+ return target;
+ }
+
+ function copyProp(val, key){
+ this[key] = val;
+ }
+
+ module.exports = mixIn;
+
+
+},{"./forOwn":70}],74:[function(require,module,exports){
+/*
+prime
+ - prototypal inheritance
+*/"use strict"
+
+var hasOwn = require("mout/object/hasOwn"),
+ mixIn = require("mout/object/mixIn"),
+ create = require("mout/lang/createObject"),
+ kindOf = require("mout/lang/kindOf")
+
+var hasDescriptors = true
+
+try {
+ Object.defineProperty({}, "~", {})
+ Object.getOwnPropertyDescriptor({}, "~")
+} catch (e){
+ hasDescriptors = false
+}
+
+// we only need to be able to implement "toString" and "valueOf" in IE < 9
+var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"),
+ buggy = ["toString", "valueOf"]
+
+var verbs = /^constructor|inherits|mixin$/
+
+var implement = function(proto){
+ var prototype = this.prototype
+
+ for (var key in proto){
+ if (key.match(verbs)) continue
+ if (hasDescriptors){
+ var descriptor = Object.getOwnPropertyDescriptor(proto, key)
+ if (descriptor){
+ Object.defineProperty(prototype, key, descriptor)
+ continue
+ }
+ }
+ prototype[key] = proto[key]
+ }
+
+ if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){
+ var value = proto[key]
+ if (value !== Object.prototype[key]) prototype[key] = value
+ }
+
+ return this
+}
+
+var prime = function(proto){
+
+ if (kindOf(proto) === "Function") proto = {constructor: proto}
+
+ var superprime = proto.inherits
+
+ // if our nice proto object has no own constructor property
+ // then we proceed using a ghosting constructor that all it does is
+ // call the parent's constructor if it has a superprime, else an empty constructor
+ // proto.constructor becomes the effective constructor
+ var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){
+ return superprime.apply(this, arguments)
+ } : function(){}
+
+ if (superprime){
+
+ mixIn(constructor, superprime)
+
+ var superproto = superprime.prototype
+ // inherit from superprime
+ var cproto = constructor.prototype = create(superproto)
+
+ // setting constructor.parent to superprime.prototype
+ // because it's the shortest possible absolute reference
+ constructor.parent = superproto
+ cproto.constructor = constructor
+ }
+
+ if (!constructor.implement) constructor.implement = implement
+
+ var mixins = proto.mixin
+ if (mixins){
+ if (kindOf(mixins) !== "Array") mixins = [mixins]
+ for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype))
+ }
+
+ // implement proto and return constructor
+ return constructor.implement(proto)
+
+}
+
+module.exports = prime
+
+},{"mout/lang/createObject":75,"mout/lang/kindOf":76,"mout/object/hasOwn":79,"mout/object/mixIn":80}],75:[function(require,module,exports){
+var mixIn = require('../object/mixIn');
+
+ /**
+ * Create Object using prototypal inheritance and setting custom properties.
+ * - Mix between Douglas Crockford Prototypal Inheritance and the EcmaScript 5 `Object.create()` method.
+ * @param {object} parent Parent Object.
+ * @param {object} [props] Object properties.
+ * @return {object} Created object.
+ */
+ function createObject(parent, props){
+ function F(){}
+ F.prototype = parent;
+ return mixIn(new F(), props);
+
+ }
+ module.exports = createObject;
+
+
+
+},{"../object/mixIn":80}],76:[function(require,module,exports){
+arguments[4][25][0].apply(exports,arguments)
+},{"dup":25}],77:[function(require,module,exports){
+arguments[4][28][0].apply(exports,arguments)
+},{"./hasOwn":79,"dup":28}],78:[function(require,module,exports){
+arguments[4][29][0].apply(exports,arguments)
+},{"./forIn":77,"./hasOwn":79,"dup":29}],79:[function(require,module,exports){
+arguments[4][30][0].apply(exports,arguments)
+},{"dup":30}],80:[function(require,module,exports){
+arguments[4][73][0].apply(exports,arguments)
+},{"./forOwn":78,"dup":73}],81:[function(require,module,exports){
+"use strict";
+
+// credits to @cpojer's Class.Binds, released under the MIT license
+// https://github.com/cpojer/mootools-class-extras/blob/master/Source/Class.Binds.js
+
+var prime = require("prime")
+var bind = require("mout/function/bind")
+
+var bound = prime({
+
+ bound: function(name){
+ var bound = this._bound || (this._bound = {})
+ return bound[name] || (bound[name] = bind(this[name], this))
+ }
+
+})
+
+module.exports = bound
+
+},{"mout/function/bind":62,"prime":74}],82:[function(require,module,exports){
+"use strict";
+
+var prime = require("prime")
+var merge = require("mout/object/merge")
+
+var Options = prime({
+
+ setOptions: function(options){
+ var args = [{}, this.options]
+ args.push.apply(args, arguments)
+ this.options = merge.apply(null, args)
+ return this
+ }
+
+})
+
+module.exports = Options
+
+},{"mout/object/merge":72,"prime":74}],83:[function(require,module,exports){
+(function (process,global,setImmediate){(function (){
+/*
+defer
+*/"use strict"
+
+var kindOf = require("mout/lang/kindOf"),
+ now = require("mout/time/now"),
+ forEach = require("mout/array/forEach"),
+ indexOf = require("mout/array/indexOf")
+
+var callbacks = {
+ timeout: {},
+ frame: [],
+ immediate: []
+}
+
+var push = function(collection, callback, context, defer){
+
+ var iterator = function(){
+ iterate(collection)
+ }
+
+ if (!collection.length) defer(iterator)
+
+ var entry = {
+ callback: callback,
+ context: context
+ }
+
+ collection.push(entry)
+
+ return function(){
+ var io = indexOf(collection, entry)
+ if (io > -1) collection.splice(io, 1)
+ }
+}
+
+var iterate = function(collection){
+ var time = now()
+
+ forEach(collection.splice(0), function(entry) {
+ entry.callback.call(entry.context, time)
+ })
+}
+
+var defer = function(callback, argument, context){
+ return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument)
+}
+
+if (global.process && process.nextTick){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, process.nextTick)
+ }
+
+} else if (global.setImmediate){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, setImmediate)
+ }
+
+} else if (global.postMessage && global.addEventListener){
+
+ addEventListener("message", function(event){
+ if (event.source === global && event.data === "@deferred"){
+ event.stopPropagation()
+ iterate(callbacks.immediate)
+ }
+ }, true)
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(){
+ postMessage("@deferred", "*")
+ })
+ }
+
+} else {
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(iterator){
+ setTimeout(iterator, 0)
+ })
+ }
+
+}
+
+var requestAnimationFrame = global.requestAnimationFrame ||
+ global.webkitRequestAnimationFrame ||
+ global.mozRequestAnimationFrame ||
+ global.oRequestAnimationFrame ||
+ global.msRequestAnimationFrame ||
+ function(callback) {
+ setTimeout(callback, 1e3 / 60)
+ }
+
+defer.frame = function(callback, context){
+ return push(callbacks.frame, callback, context, requestAnimationFrame)
+}
+
+var clear
+
+defer.timeout = function(callback, ms, context){
+ var ct = callbacks.timeout
+
+ if (!clear) clear = defer.immediate(function(){
+ clear = null
+ callbacks.timeout = {}
+ })
+
+ return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){
+ setTimeout(iterator, ms)
+ })
+}
+
+module.exports = defer
+
+}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
+
+},{"_process":99,"mout/array/forEach":87,"mout/array/indexOf":88,"mout/lang/kindOf":90,"mout/time/now":95,"timers":100}],84:[function(require,module,exports){
+/*
+Emitter
+*/"use strict"
+
+var indexOf = require("mout/array/indexOf"),
+ forEach = require("mout/array/forEach")
+
+var prime = require("./index"),
+ defer = require("./defer")
+
+var slice = Array.prototype.slice;
+
+var Emitter = prime({
+
+ constructor: function(stoppable){
+ this._stoppable = stoppable
+ },
+
+ on: function(event, fn){
+ var listeners = this._listeners || (this._listeners = {}),
+ events = listeners[event] || (listeners[event] = [])
+
+ if (indexOf(events, fn) === -1) events.push(fn)
+
+ return this
+ },
+
+ off: function(event, fn){
+ var listeners = this._listeners, events
+ if (listeners && (events = listeners[event])){
+
+ var io = indexOf(events, fn)
+ if (io > -1) events.splice(io, 1)
+ if (!events.length) delete listeners[event];
+ for (var l in listeners) return this
+ delete this._listeners
+ }
+ return this
+ },
+
+ emit: function(event){
+ var self = this,
+ args = slice.call(arguments, 1)
+
+ var emit = function(){
+ var listeners = self._listeners, events
+ if (listeners && (events = listeners[event])){
+ forEach(events.slice(0), function(event){
+ var result = event.apply(self, args)
+ if (self._stoppable) return result
+ })
+ }
+ }
+
+ if (args[args.length - 1] === Emitter.EMIT_SYNC){
+ args.pop()
+ emit()
+ } else {
+ defer(emit)
+ }
+
+ return this
+ }
+
+})
+
+Emitter.EMIT_SYNC = {}
+
+module.exports = Emitter
+
+},{"./defer":83,"./index":85,"mout/array/forEach":87,"mout/array/indexOf":88}],85:[function(require,module,exports){
+/*
+prime
+ - prototypal inheritance
+*/"use strict"
+
+var hasOwn = require("mout/object/hasOwn"),
+ mixIn = require("mout/object/mixIn"),
+ create = require("mout/lang/createObject"),
+ kindOf = require("mout/lang/kindOf")
+
+var hasDescriptors = true
+
+try {
+ Object.defineProperty({}, "~", {})
+ Object.getOwnPropertyDescriptor({}, "~")
+} catch (e){
+ hasDescriptors = false
+}
+
+// we only need to be able to implement "toString" and "valueOf" in IE < 9
+var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"),
+ buggy = ["toString", "valueOf"]
+
+var verbs = /^constructor|inherits|mixin$/
+
+var implement = function(proto){
+ var prototype = this.prototype
+
+ for (var key in proto){
+ if (key.match(verbs)) continue
+ if (hasDescriptors){
+ var descriptor = Object.getOwnPropertyDescriptor(proto, key)
+ if (descriptor){
+ Object.defineProperty(prototype, key, descriptor)
+ continue
+ }
+ }
+ prototype[key] = proto[key]
+ }
+
+ if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){
+ var value = proto[key]
+ if (value !== Object.prototype[key]) prototype[key] = value
+ }
+
+ return this
+}
+
+var prime = function(proto){
+
+ if (kindOf(proto) === "Function") proto = {constructor: proto}
+
+ var superprime = proto.inherits
+
+ // if our nice proto object has no own constructor property
+ // then we proceed using a ghosting constructor that all it does is
+ // call the parent's constructor if it has a superprime, else an empty constructor
+ // proto.constructor becomes the effective constructor
+ var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){
+ return superprime.apply(this, arguments)
+ } : function(){}
+
+ if (superprime){
+
+ mixIn(constructor, superprime)
+
+ var superproto = superprime.prototype
+ // inherit from superprime
+ var cproto = constructor.prototype = create(superproto)
+
+ // setting constructor.parent to superprime.prototype
+ // because it's the shortest possible absolute reference
+ constructor.parent = superproto
+ cproto.constructor = constructor
+ }
+
+ if (!constructor.implement) constructor.implement = implement
+
+ var mixins = proto.mixin
+ if (mixins){
+ if (kindOf(mixins) !== "Array") mixins = [mixins]
+ for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype))
+ }
+
+ // implement proto and return constructor
+ return constructor.implement(proto)
+
+}
+
+module.exports = prime
+
+},{"mout/lang/createObject":89,"mout/lang/kindOf":90,"mout/object/hasOwn":93,"mout/object/mixIn":94}],86:[function(require,module,exports){
+/*
+Map
+*/"use strict"
+
+var indexOf = require("mout/array/indexOf")
+
+var prime = require("./index")
+
+var Map = prime({
+
+ constructor: function Map(){
+ this.length = 0
+ this._values = []
+ this._keys = []
+ },
+
+ set: function(key, value){
+ var index = indexOf(this._keys, key)
+
+ if (index === -1){
+ this._keys.push(key)
+ this._values.push(value)
+ this.length++
+ } else {
+ this._values[index] = value
+ }
+
+ return this
+ },
+
+ get: function(key){
+ var index = indexOf(this._keys, key)
+ return (index === -1) ? null : this._values[index]
+ },
+
+ count: function(){
+ return this.length
+ },
+
+ forEach: function(method, context){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (method.call(context, this._values[i], this._keys[i], this) === false) break
+ }
+ return this
+ },
+
+ map: function(method, context){
+ var results = new Map
+ this.forEach(function(value, key){
+ results.set(key, method.call(context, value, key, this))
+ }, this)
+ return results
+ },
+
+ filter: function(method, context){
+ var results = new Map
+ this.forEach(function(value, key){
+ if (method.call(context, value, key, this)) results.set(key, value)
+ }, this)
+ return results
+ },
+
+ every: function(method, context){
+ var every = true
+ this.forEach(function(value, key){
+ if (!method.call(context, value, key, this)) return (every = false)
+ }, this)
+ return every
+ },
+
+ some: function(method, context){
+ var some = false
+ this.forEach(function(value, key){
+ if (method.call(context, value, key, this)) return !(some = true)
+ }, this)
+ return some
+ },
+
+ indexOf: function(value){
+ var index = indexOf(this._values, value)
+ return (index > -1) ? this._keys[index] : null
+ },
+
+ remove: function(value){
+ var index = indexOf(this._values, value)
+
+ if (index !== -1){
+ this._values.splice(index, 1)
+ this.length--
+ return this._keys.splice(index, 1)[0]
+ }
+
+ return null
+ },
+
+ unset: function(key){
+ var index = indexOf(this._keys, key)
+
+ if (index !== -1){
+ this._keys.splice(index, 1)
+ this.length--
+ return this._values.splice(index, 1)[0]
+ }
+
+ return null
+ },
+
+ keys: function(){
+ return this._keys.slice()
+ },
+
+ values: function(){
+ return this._values.slice()
+ }
+
+})
+
+var map = function(){
+ return new Map
+}
+
+map.prototype = Map.prototype
+
+module.exports = map
+
+},{"./index":85,"mout/array/indexOf":88}],87:[function(require,module,exports){
+arguments[4][16][0].apply(exports,arguments)
+},{"dup":16}],88:[function(require,module,exports){
+arguments[4][17][0].apply(exports,arguments)
+},{"dup":17}],89:[function(require,module,exports){
+arguments[4][75][0].apply(exports,arguments)
+},{"../object/mixIn":94,"dup":75}],90:[function(require,module,exports){
+arguments[4][25][0].apply(exports,arguments)
+},{"dup":25}],91:[function(require,module,exports){
+arguments[4][28][0].apply(exports,arguments)
+},{"./hasOwn":93,"dup":28}],92:[function(require,module,exports){
+arguments[4][29][0].apply(exports,arguments)
+},{"./forIn":91,"./hasOwn":93,"dup":29}],93:[function(require,module,exports){
+arguments[4][30][0].apply(exports,arguments)
+},{"dup":30}],94:[function(require,module,exports){
+arguments[4][73][0].apply(exports,arguments)
+},{"./forOwn":92,"dup":73}],95:[function(require,module,exports){
+
+
+ /**
+ * Get current time in miliseconds
+ */
+ function now(){
+ // yes, we defer the work to another function to allow mocking it
+ // during the tests
+ return now.get();
+ }
+
+ now.get = (typeof Date.now === 'function')? Date.now : function(){
+ return +(new Date());
+ };
+
+ module.exports = now;
+
+
+
+},{}],96:[function(require,module,exports){
+/*
+Slick Finder
+*/"use strict"
+
+// Notable changes from Slick.Finder 1.0.x
+
+// faster bottom -> up expression matching
+// prefers mental sanity over *obsessive compulsive* milliseconds savings
+// uses prototypes instead of objects
+// tries to use matchesSelector smartly, whenever available
+// can populate objects as well as arrays
+// lots of stuff is broken or not implemented
+
+var parse = require("./parser")
+
+// utilities
+
+var index = 0,
+ counter = document.__counter = (parseInt(document.__counter || -1, 36) + 1).toString(36),
+ key = "uid:" + counter
+
+var uniqueID = function(n, xml){
+ if (n === window) return "window"
+ if (n === document) return "document"
+ if (n === document.documentElement) return "html"
+
+ if (xml) {
+ var uid = n.getAttribute(key)
+ if (!uid) {
+ uid = (index++).toString(36)
+ n.setAttribute(key, uid)
+ }
+ return uid
+ } else {
+ return n[key] || (n[key] = (index++).toString(36))
+ }
+}
+
+var uniqueIDXML = function(n) {
+ return uniqueID(n, true)
+}
+
+var isArray = Array.isArray || function(object){
+ return Object.prototype.toString.call(object) === "[object Array]"
+}
+
+// tests
+
+var uniqueIndex = 0;
+
+var HAS = {
+
+ GET_ELEMENT_BY_ID: function(test, id){
+ id = "slick_" + (uniqueIndex++);
+ // checks if the document has getElementById, and it works
+ test.innerHTML = ''
+ return !!this.getElementById(id)
+ },
+
+ QUERY_SELECTOR: function(test){
+ // this supposedly fixes a webkit bug with matchesSelector / querySelector & nth-child
+ test.innerHTML = '_'
+
+ // checks if the document has querySelectorAll, and it works
+ test.innerHTML = ''
+
+ return test.querySelectorAll('.MiX').length === 1
+ },
+
+ EXPANDOS: function(test, id){
+ id = "slick_" + (uniqueIndex++);
+ // checks if the document has elements that support expandos
+ test._custom_property_ = id
+ return test._custom_property_ === id
+ },
+
+ // TODO: use this ?
+
+ // CHECKED_QUERY_SELECTOR: function(test){
+ //
+ // // checks if the document supports the checked query selector
+ // test.innerHTML = ''
+ // return test.querySelectorAll(':checked').length === 1
+ // },
+
+ // TODO: use this ?
+
+ // EMPTY_ATTRIBUTE_QUERY_SELECTOR: function(test){
+ //
+ // // checks if the document supports the empty attribute query selector
+ // test.innerHTML = ''
+ // return test.querySelectorAll('[class*=""]').length === 1
+ // },
+
+ MATCHES_SELECTOR: function(test){
+
+ test.className = "MiX"
+
+ // checks if the document has matchesSelector, and we can use it.
+
+ var matches = test.matchesSelector || test.mozMatchesSelector || test.webkitMatchesSelector
+
+ // if matchesSelector trows errors on incorrect syntax we can use it
+ if (matches) try {
+ matches.call(test, ':slick')
+ } catch(e){
+ // just as a safety precaution, also test if it works on mixedcase (like querySelectorAll)
+ return matches.call(test, ".MiX") ? matches : false
+ }
+
+ return false
+ },
+
+ GET_ELEMENTS_BY_CLASS_NAME: function(test){
+ test.innerHTML = ''
+ if (test.getElementsByClassName('b').length !== 1) return false
+
+ test.firstChild.className = 'b'
+ if (test.getElementsByClassName('b').length !== 2) return false
+
+ // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
+ test.innerHTML = ''
+ if (test.getElementsByClassName('a').length !== 2) return false
+
+ // tests passed
+ return true
+ },
+
+ // no need to know
+
+ // GET_ELEMENT_BY_ID_NOT_NAME: function(test, id){
+ // test.innerHTML = ''
+ // return this.getElementById(id) !== test.firstChild
+ // },
+
+ // this is always checked for and fixed
+
+ // STAR_GET_ELEMENTS_BY_TAG_NAME: function(test){
+ //
+ // // IE returns comment nodes for getElementsByTagName('*') for some documents
+ // test.appendChild(this.createComment(''))
+ // if (test.getElementsByTagName('*').length > 0) return false
+ //
+ // // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents
+ // test.innerHTML = 'foo'
+ // if (test.getElementsByTagName('*').length) return false
+ //
+ // // tests passed
+ // return true
+ // },
+
+ // this is always checked for and fixed
+
+ // STAR_QUERY_SELECTOR: function(test){
+ //
+ // // returns closed nodes (EG:"") for querySelector('*') for some documents
+ // test.innerHTML = 'foo'
+ // return !!(test.querySelectorAll('*').length)
+ // },
+
+ GET_ATTRIBUTE: function(test){
+ // tests for working getAttribute implementation
+ var shout = "fus ro dah"
+ test.innerHTML = ''
+ return test.firstChild.getAttribute('class') === shout
+ }
+
+}
+
+// Finder
+
+var Finder = function Finder(document){
+
+ this.document = document
+ var root = this.root = document.documentElement
+ this.tested = {}
+
+ // uniqueID
+
+ this.uniqueID = this.has("EXPANDOS") ? uniqueID : uniqueIDXML
+
+ // getAttribute
+
+ this.getAttribute = (this.has("GET_ATTRIBUTE")) ? function(node, name){
+
+ return node.getAttribute(name)
+
+ } : function(node, name){
+
+ node = node.getAttributeNode(name)
+ return (node && node.specified) ? node.value : null
+
+ }
+
+ // hasAttribute
+
+ this.hasAttribute = (root.hasAttribute) ? function(node, attribute){
+
+ return node.hasAttribute(attribute)
+
+ } : function(node, attribute) {
+
+ node = node.getAttributeNode(attribute)
+ return !!(node && node.specified)
+
+ }
+
+ // contains
+
+ this.contains = (document.contains && root.contains) ? function(context, node){
+
+ return context.contains(node)
+
+ } : (root.compareDocumentPosition) ? function(context, node){
+
+ return context === node || !!(context.compareDocumentPosition(node) & 16)
+
+ } : function(context, node){
+
+ do {
+ if (node === context) return true
+ } while ((node = node.parentNode))
+
+ return false
+ }
+
+ // sort
+ // credits to Sizzle (http://sizzlejs.com/)
+
+ this.sorter = (root.compareDocumentPosition) ? function(a, b){
+
+ if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0
+ return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1
+
+ } : ('sourceIndex' in root) ? function(a, b){
+
+ if (!a.sourceIndex || !b.sourceIndex) return 0
+ return a.sourceIndex - b.sourceIndex
+
+ } : (document.createRange) ? function(a, b){
+
+ if (!a.ownerDocument || !b.ownerDocument) return 0
+ var aRange = a.ownerDocument.createRange(),
+ bRange = b.ownerDocument.createRange()
+
+ aRange.setStart(a, 0)
+ aRange.setEnd(a, 0)
+ bRange.setStart(b, 0)
+ bRange.setEnd(b, 0)
+ return aRange.compareBoundaryPoints(Range.START_TO_END, bRange)
+
+ } : null
+
+ this.failed = {}
+
+ var nativeMatches = this.has("MATCHES_SELECTOR")
+
+ if (nativeMatches) this.matchesSelector = function(node, expression){
+
+ if (this.failed[expression]) return null
+
+ try {
+ return nativeMatches.call(node, expression)
+ } catch(e){
+ if (slick.debug) console.warn("matchesSelector failed on " + expression)
+ this.failed[expression] = true
+ return null
+ }
+
+ }
+
+ if (this.has("QUERY_SELECTOR")){
+
+ this.querySelectorAll = function(node, expression){
+
+ if (this.failed[expression]) return true
+
+ var result, _id, _expression, _combinator, _node
+
+
+ // non-document rooted QSA
+ // credits to Andrew Dupont
+
+ if (node !== this.document){
+
+ _combinator = expression[0].combinator
+
+ _id = node.getAttribute("id")
+ _expression = expression
+
+ if (!_id){
+ _node = node
+ _id = "__slick__"
+ _node.setAttribute("id", _id)
+ }
+
+ expression = "#" + _id + " " + _expression
+
+
+ // these combinators need a parentNode due to how querySelectorAll works, which is:
+ // finding all the elements that match the given selector
+ // then filtering by the ones that have the specified element as an ancestor
+ if (_combinator.indexOf("~") > -1 || _combinator.indexOf("+") > -1){
+
+ node = node.parentNode
+ if (!node) result = true
+ // if node has no parentNode, we return "true" as if it failed, without polluting the failed cache
+
+ }
+
+ }
+
+ if (!result) try {
+ result = node.querySelectorAll(expression.toString())
+ } catch(e){
+ if (slick.debug) console.warn("querySelectorAll failed on " + (_expression || expression))
+ result = this.failed[_expression || expression] = true
+ }
+
+ if (_node) _node.removeAttribute("id")
+
+ return result
+
+ }
+
+ }
+
+}
+
+Finder.prototype.has = function(FEATURE){
+
+ var tested = this.tested,
+ testedFEATURE = tested[FEATURE]
+
+ if (testedFEATURE != null) return testedFEATURE
+
+ var root = this.root,
+ document = this.document,
+ testNode = document.createElement("div")
+
+ testNode.setAttribute("style", "display: none;")
+
+ root.appendChild(testNode)
+
+ var TEST = HAS[FEATURE], result = false
+
+ if (TEST) try {
+ result = TEST.call(document, testNode)
+ } catch(e){}
+
+ if (slick.debug && !result) console.warn("document has no " + FEATURE)
+
+ root.removeChild(testNode)
+
+ return tested[FEATURE] = result
+
+}
+
+var combinators = {
+
+ " ": function(node, part, push){
+
+ var item, items
+
+ var noId = !part.id, noTag = !part.tag, noClass = !part.classes
+
+ if (part.id && node.getElementById && this.has("GET_ELEMENT_BY_ID")){
+ item = node.getElementById(part.id)
+
+ // return only if id is found, else keep checking
+ // might be a tad slower on non-existing ids, but less insane
+
+ if (item && item.getAttribute('id') === part.id){
+ items = [item]
+ noId = true
+ // if tag is star, no need to check it in match()
+ if (part.tag === "*") noTag = true
+ }
+ }
+
+ if (!items){
+
+ if (part.classes && node.getElementsByClassName && this.has("GET_ELEMENTS_BY_CLASS_NAME")){
+ items = node.getElementsByClassName(part.classList)
+ noClass = true
+ // if tag is star, no need to check it in match()
+ if (part.tag === "*") noTag = true
+ } else {
+ items = node.getElementsByTagName(part.tag)
+ // if tag is star, need to check it in match because it could select junk, boho
+ if (part.tag !== "*") noTag = true
+ }
+
+ if (!items || !items.length) return false
+
+ }
+
+ for (var i = 0; item = items[i++];)
+ if ((noTag && noId && noClass && !part.attributes && !part.pseudos) || this.match(item, part, noTag, noId, noClass))
+ push(item)
+
+ return true
+
+ },
+
+ ">": function(node, part, push){ // direct children
+ if ((node = node.firstChild)) do {
+ if (node.nodeType == 1 && this.match(node, part)) push(node)
+ } while ((node = node.nextSibling))
+ },
+
+ "+": function(node, part, push){ // next sibling
+ while ((node = node.nextSibling)) if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ break
+ }
+ },
+
+ "^": function(node, part, push){ // first child
+ node = node.firstChild
+ if (node){
+ if (node.nodeType === 1){
+ if (this.match(node, part)) push(node)
+ } else {
+ combinators['+'].call(this, node, part, push)
+ }
+ }
+ },
+
+ "~": function(node, part, push){ // next siblings
+ while ((node = node.nextSibling)){
+ if (node.nodeType === 1 && this.match(node, part)) push(node)
+ }
+ },
+
+ "++": function(node, part, push){ // next sibling and previous sibling
+ combinators['+'].call(this, node, part, push)
+ combinators['!+'].call(this, node, part, push)
+ },
+
+ "~~": function(node, part, push){ // next siblings and previous siblings
+ combinators['~'].call(this, node, part, push)
+ combinators['!~'].call(this, node, part, push)
+ },
+
+ "!": function(node, part, push){ // all parent nodes up to document
+ while ((node = node.parentNode)) if (node !== this.document && this.match(node, part)) push(node)
+ },
+
+ "!>": function(node, part, push){ // direct parent (one level)
+ node = node.parentNode
+ if (node !== this.document && this.match(node, part)) push(node)
+ },
+
+ "!+": function(node, part, push){ // previous sibling
+ while ((node = node.previousSibling)) if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ break
+ }
+ },
+
+ "!^": function(node, part, push){ // last child
+ node = node.lastChild
+ if (node){
+ if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ } else {
+ combinators['!+'].call(this, node, part, push)
+ }
+ }
+ },
+
+ "!~": function(node, part, push){ // previous siblings
+ while ((node = node.previousSibling)){
+ if (node.nodeType === 1 && this.match(node, part)) push(node)
+ }
+ }
+
+}
+
+Finder.prototype.search = function(context, expression, found){
+
+ if (!context) context = this.document
+ else if (!context.nodeType && context.document) context = context.document
+
+ var expressions = parse(expression)
+
+ // no expressions were parsed. todo: is this really necessary?
+ if (!expressions || !expressions.length) throw new Error("invalid expression")
+
+ if (!found) found = []
+
+ var uniques, push = isArray(found) ? function(node){
+ found[found.length] = node
+ } : function(node){
+ found[found.length++] = node
+ }
+
+ // if there is more than one expression we need to check for duplicates when we push to found
+ // this simply saves the old push and wraps it around an uid dupe check.
+ if (expressions.length > 1){
+ uniques = {}
+ var plush = push
+ push = function(node){
+ var uid = uniqueID(node)
+ if (!uniques[uid]){
+ uniques[uid] = true
+ plush(node)
+ }
+ }
+ }
+
+ // walker
+
+ var node, nodes, part
+
+ main: for (var i = 0; expression = expressions[i++];){
+
+ // querySelector
+
+ // TODO: more functional tests
+
+ // if there is querySelectorAll (and the expression does not fail) use it.
+ if (!slick.noQSA && this.querySelectorAll){
+
+ nodes = this.querySelectorAll(context, expression)
+ if (nodes !== true){
+ if (nodes && nodes.length) for (var j = 0; node = nodes[j++];) if (node.nodeName > '@'){
+ push(node)
+ }
+ continue main
+ }
+ }
+
+ // if there is only one part in the expression we don't need to check each part for duplicates.
+ // todo: this might be too naive. while solid, there can be expression sequences that do not
+ // produce duplicates. "body div" for instance, can never give you each div more than once.
+ // "body div a" on the other hand might.
+ if (expression.length === 1){
+
+ part = expression[0]
+ combinators[part.combinator].call(this, context, part, push)
+
+ } else {
+
+ var cs = [context], c, f, u, p = function(node){
+ var uid = uniqueID(node)
+ if (!u[uid]){
+ u[uid] = true
+ f[f.length] = node
+ }
+ }
+
+ // loop the expression parts
+ for (var j = 0; part = expression[j++];){
+ f = []; u = {}
+ // loop the contexts
+ for (var k = 0; c = cs[k++];) combinators[part.combinator].call(this, c, part, p)
+ // nothing was found, the expression failed, continue to the next expression.
+ if (!f.length) continue main
+ cs = f // set the contexts for future parts (if any)
+ }
+
+ if (i === 0) found = f // first expression. directly set found.
+ else for (var l = 0; l < f.length; l++) push(f[l]) // any other expression needs to push to found.
+ }
+
+ }
+
+ if (uniques && found && found.length > 1) this.sort(found)
+
+ return found
+
+}
+
+Finder.prototype.sort = function(nodes){
+ return this.sorter ? Array.prototype.sort.call(nodes, this.sorter) : nodes
+}
+
+// TODO: most of these pseudo selectors include and qsa doesnt. fixme.
+
+var pseudos = {
+
+
+ // TODO: returns different results than qsa empty.
+
+ 'empty': function(){
+ return !(this && this.nodeType === 1) && !(this.innerText || this.textContent || '').length
+ },
+
+ 'not': function(expression){
+ return !slick.matches(this, expression)
+ },
+
+ 'contains': function(text){
+ return (this.innerText || this.textContent || '').indexOf(text) > -1
+ },
+
+ 'first-child': function(){
+ var node = this
+ while ((node = node.previousSibling)) if (node.nodeType == 1) return false
+ return true
+ },
+
+ 'last-child': function(){
+ var node = this
+ while ((node = node.nextSibling)) if (node.nodeType == 1) return false
+ return true
+ },
+
+ 'only-child': function(){
+ var prev = this
+ while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false
+
+ var next = this
+ while ((next = next.nextSibling)) if (next.nodeType == 1) return false
+
+ return true
+ },
+
+ 'first-of-type': function(){
+ var node = this, nodeName = node.nodeName
+ while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false
+ return true
+ },
+
+ 'last-of-type': function(){
+ var node = this, nodeName = node.nodeName
+ while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false
+ return true
+ },
+
+ 'only-of-type': function(){
+ var prev = this, nodeName = this.nodeName
+ while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false
+ var next = this
+ while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false
+ return true
+ },
+
+ 'enabled': function(){
+ return !this.disabled
+ },
+
+ 'disabled': function(){
+ return this.disabled
+ },
+
+ 'checked': function(){
+ return this.checked || this.selected
+ },
+
+ 'selected': function(){
+ return this.selected
+ },
+
+ 'focus': function(){
+ var doc = this.ownerDocument
+ return doc.activeElement === this && (this.href || this.type || slick.hasAttribute(this, 'tabindex'))
+ },
+
+ 'root': function(){
+ return (this === this.ownerDocument.documentElement)
+ }
+
+}
+
+Finder.prototype.match = function(node, bit, noTag, noId, noClass){
+
+ // TODO: more functional tests ?
+
+ if (!slick.noQSA && this.matchesSelector){
+ var matches = this.matchesSelector(node, bit)
+ if (matches !== null) return matches
+ }
+
+ // normal matching
+
+ if (!noTag && bit.tag){
+
+ var nodeName = node.nodeName.toLowerCase()
+ if (bit.tag === "*"){
+ if (nodeName < "@") return false
+ } else if (nodeName != bit.tag){
+ return false
+ }
+
+ }
+
+ if (!noId && bit.id && node.getAttribute('id') !== bit.id) return false
+
+ var i, part
+
+ if (!noClass && bit.classes){
+
+ var className = this.getAttribute(node, "class")
+ if (!className) return false
+
+ for (part in bit.classes) if (!RegExp('(^|\\s)' + bit.classes[part] + '(\\s|$)').test(className)) return false
+ }
+
+ var name, value
+
+ if (bit.attributes) for (i = 0; part = bit.attributes[i++];){
+
+ var operator = part.operator,
+ escaped = part.escapedValue
+
+ name = part.name
+ value = part.value
+
+ if (!operator){
+
+ if (!this.hasAttribute(node, name)) return false
+
+ } else {
+
+ var actual = this.getAttribute(node, name)
+ if (actual == null) return false
+
+ switch (operator){
+ case '^=' : if (!RegExp( '^' + escaped ).test(actual)) return false; break
+ case '$=' : if (!RegExp( escaped + '$' ).test(actual)) return false; break
+ case '~=' : if (!RegExp('(^|\\s)' + escaped + '(\\s|$)').test(actual)) return false; break
+ case '|=' : if (!RegExp( '^' + escaped + '(-|$)' ).test(actual)) return false; break
+
+ case '=' : if (actual !== value) return false; break
+ case '*=' : if (actual.indexOf(value) === -1) return false; break
+ default : return false
+ }
+
+ }
+ }
+
+ if (bit.pseudos) for (i = 0; part = bit.pseudos[i++];){
+
+ name = part.name
+ value = part.value
+
+ if (pseudos[name]) return pseudos[name].call(node, value)
+
+ if (value != null){
+ if (this.getAttribute(node, name) !== value) return false
+ } else {
+ if (!this.hasAttribute(node, name)) return false
+ }
+
+ }
+
+ return true
+
+}
+
+Finder.prototype.matches = function(node, expression){
+
+ var expressions = parse(expression)
+
+ if (expressions.length === 1 && expressions[0].length === 1){ // simplest match
+ return this.match(node, expressions[0][0])
+ }
+
+ // TODO: more functional tests ?
+
+ if (!slick.noQSA && this.matchesSelector){
+ var matches = this.matchesSelector(node, expressions)
+ if (matches !== null) return matches
+ }
+
+ var nodes = this.search(this.document, expression, {length: 0})
+
+ for (var i = 0, res; res = nodes[i++];) if (node === res) return true
+ return false
+
+}
+
+var finders = {}
+
+var finder = function(context){
+ var doc = context || document
+ if (doc.ownerDocument) doc = doc.ownerDocument
+ else if (doc.document) doc = doc.document
+
+ if (doc.nodeType !== 9) throw new TypeError("invalid document")
+
+ var uid = uniqueID(doc)
+ return finders[uid] || (finders[uid] = new Finder(doc))
+}
+
+// ... API ...
+
+var slick = function(expression, context){
+ return slick.search(expression, context)
+}
+
+slick.search = function(expression, context, found){
+ return finder(context).search(context, expression, found)
+}
+
+slick.find = function(expression, context){
+ return finder(context).search(context, expression)[0] || null
+}
+
+slick.getAttribute = function(node, name){
+ return finder(node).getAttribute(node, name)
+}
+
+slick.hasAttribute = function(node, name){
+ return finder(node).hasAttribute(node, name)
+}
+
+slick.contains = function(context, node){
+ return finder(context).contains(context, node)
+}
+
+slick.matches = function(node, expression){
+ return finder(node).matches(node, expression)
+}
+
+slick.sort = function(nodes){
+ if (nodes && nodes.length > 1) finder(nodes[0]).sort(nodes)
+ return nodes
+}
+
+slick.parse = parse;
+
+// slick.debug = true
+// slick.noQSA = true
+
+module.exports = slick
+
+},{"./parser":98}],97:[function(require,module,exports){
+(function (global){(function (){
+/*
+slick
+*/"use strict"
+
+module.exports = "document" in global ? require("./finder") : { parse: require("./parser") }
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"./finder":96,"./parser":98}],98:[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* ( + ) \\s* # Combinator \n\
+ | ( \\s+ ) # CombinatorChildren \n\
+ | ( + | \\* ) # Tag \n\
+ | \\# ( + ) # ID \n\
+ | \\. ( + ) # ClassName \n\
+ | # Attribute \n\
+ \\[ \
+ \\s* (+) (?: \
+ \\s* ([*^$!~|]?=) (?: \
+ \\s* (?:\
+ ([\"']?)(.*?)\\9 \
+ )\
+ ) \
+ )? \\s* \
+ \\](?!\\]) \n\
+ | :+ ( + )(?:\
+ \\( (?:\
+ (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
+ ) \\)\
+ )?\
+ )"
+*/
+"^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
+ .replace(//, '[' + escape(">+~`!@$%^&={}\\;") + ']')
+ .replace(//g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
+ .replace(//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
+
+},{}],99:[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; };
+
+},{}],100:[function(require,module,exports){
+(function (setImmediate,clearImmediate){(function (){
+var nextTick = require('process/browser.js').nextTick;
+var apply = Function.prototype.apply;
+var slice = Array.prototype.slice;
+var immediateIds = {};
+var nextImmediateId = 0;
+
+// DOM APIs, for completeness
+
+exports.setTimeout = function() {
+ return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+};
+exports.setInterval = function() {
+ return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+};
+exports.clearTimeout =
+exports.clearInterval = function(timeout) { timeout.close(); };
+
+function Timeout(id, clearFn) {
+ this._id = id;
+ this._clearFn = clearFn;
+}
+Timeout.prototype.unref = Timeout.prototype.ref = function() {};
+Timeout.prototype.close = function() {
+ this._clearFn.call(window, this._id);
+};
+
+// Does not start the time, just sets up the members needed.
+exports.enroll = function(item, msecs) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = msecs;
+};
+
+exports.unenroll = function(item) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = -1;
+};
+
+exports._unrefActive = exports.active = function(item) {
+ clearTimeout(item._idleTimeoutId);
+
+ var msecs = item._idleTimeout;
+ if (msecs >= 0) {
+ item._idleTimeoutId = setTimeout(function onTimeout() {
+ if (item._onTimeout)
+ item._onTimeout();
+ }, msecs);
+ }
+};
+
+// That's not how node.js implements it but the exposed api is the same.
+exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
+ var id = nextImmediateId++;
+ var args = arguments.length < 2 ? false : slice.call(arguments, 1);
+
+ immediateIds[id] = true;
+
+ nextTick(function onNextTick() {
+ if (immediateIds[id]) {
+ // fn.call() is faster so we optimize for the common use-case
+ // @see http://jsperf.com/call-apply-segu
+ if (args) {
+ fn.apply(null, args);
+ } else {
+ fn.call(null);
+ }
+ // Prevent ids from leaking
+ exports.clearImmediate(id);
+ }
+ });
+
+ return id;
+};
+
+exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
+ delete immediateIds[id];
+};
+}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
+
+},{"process/browser.js":99,"timers":100}]},{},[1])
+
+//# sourceMappingURL=main.js.map
diff --git a/platforms/common/js/main.js b/platforms/common/js/main.js
index bf245ac7c..e39c2178e 100644
--- a/platforms/common/js/main.js
+++ b/platforms/common/js/main.js
@@ -1 +1,41074 @@
-require=function i(r,o,a){function s(e,t){if(!o[e]){if(!r[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=o[e]={exports:{}},r[e][0].call(n.exports,function(t){return s(r[e][1][t]||t)},n,n.exports,i,r,o,a)}return o[e].exports}for(var l="function"==typeof require&&require,t=0;t label").style("display","block");var l,u=0,c=0;s||e.parent(".card").style("display",a.checked()||i?"none":"inline-block"),f(s,function(t,e){var n;t=p(t),l=h(t.text()),l=l.match(new RegExp("^"+i+"|\\s"+i,"gi")),(l=a.checked()?Number(!!l)&Number(t.parent("label, h4").find('.enabler input[type="hidden"]').value()):l)?(!(n=(n=t.parent("[data-g-assignments-parent]"))&&n.data("g-assignments-parent"))||(n=t.parent(".card").find('[data-g-assignments-group="'+n+'"]'))&&n.style("display","block"),t.parent("label, h4").style("display","block"),c++):(t.parent("label, h4").style("display","none"),0),++u==s.length&&r&&o.style("display",c?"inline-block":"none")})},filterEnabledOnly:function(t,e){var n=p('[data-g-global-filter] input[type="text"]');g.globalFilterSection(t,n,e)},treatLabel:function(t,e){if(t&&t.stopPropagation&&t.preventDefault&&(t.stopPropagation(),t.preventDefault()),!p(t.target).matches(".knob, .toggle")){t=e.find('input[type="hidden"]:not([disabled])');if(t){e=!!+(e=t.value());return t.value(Number(!e)).emit("change"),p("body").emit("change",{target:t}),!1}}},globalToggleSection:function(i,t){var e=null==t.data("g-assignments-check")?"[data-g-assignments-uncheck]":"[data-g-assignments-check]",t=p("[data-save]"),e=p("#assignments .card "+e+", .settings-assignments .card "+e);e&&(t.disabled(!0),f(e,function(t,e,n){g.toggleSection(i,p(t),e,n)}))},globalFilterSection:function(e,t){var n=t.value(),i=p("[data-assignments-enabledonly]"),t=p('#assignments .card .search input[type="text"], .settings-assignments .card .search input[type="text"]');(t||i.checked())&&f(t,function(t){g.filterSection(e,p(t),n,"global")})},toggleStateDelegation:function(t,e){var n="1"==e.value();e.attribute("disabled",!n)},chromeFix:function(){var t,n,i;!g.isChrome()||(t=p("#assignments .settings-param-wrapper, .settings-assignments .settings-param-wrapper"))&&t.forEach(function(t){var e;t=p(t),i=parseInt(t.compute("max-height"),10),n=t[0].getBoundingClientRect().height,t.style({overflow:i<=n?"auto":"visible"}),i<=n&&(e=100,o(t,"scroll",function(){e=100==e?100.01:100,t.parent(".card").style("width",e+"%")}))})},isChrome:function(){return-1 ol > li > a").forEach(function(e,t){var n=(e=r(e)).href(),i=new RegExp("#(common|"+GANTRY_PLATFORM+")$","gi"),n=!n.match(i),i="chevron-"+(n?"down":"up");l(e.text())&&(t&&!n&&e.parent("li").after(e.parent("ol").find("> li")),o('i[class="fa g-changelog-toggle fa-fw fa-'+i+'"][aria-hidden="true"]').bottom(e),n&&e.nextSibling().style({overflow:"hidden",height:0}),e.on("click",function(t){t.preventDefault();t=e.find('i[class*="fa-chevron-"]');t.hasClass("fa-chevron-down")?(t.removeClass("fa-chevron-down").addClass("fa-chevron-up"),e.nextSibling().slideDown()):(t.removeClass("fa-chevron-up").addClass("fa-chevron-down"),e.nextSibling().slideUp())}))})}})})})},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,elements:113,"elements/domready":111,"elements/zen":137,"mout/string/interpolate":261,"mout/string/trim":272}],5:[function(t,e,n){"use strict";var p=t("elements"),i=t("elements/domready"),r=t("agent"),f=t("../ui").modal,m=t("mout/random/guid"),o=t("mout/string/trim"),a=t("../utils/get-ajax-suffix"),g=t("../utils/get-ajax-url").parse,v=(t("../utils/get-ajax-url").global,t("../utils/history")),b=t("mout/queryString/getParam"),y=t("mout/queryString/setParam");i(function(){var c,d,h,e,i=p("body");i.delegate("keydown",".config-select-wrap [data-title-edit]",function(t,e){var n=t.which||t.keyCode;32!=n&&13!=n||(t.preventDefault(),i.emit("mousedown",t))}),i.delegate("mousedown",".config-select-wrap [data-title-edit]",function(t,u){c=u.siblings(".g-selectize-control"),d=u.siblings("select"),(h=u.siblings("[data-title-editable]")).gConfEditAttached||(h.gConfEditAttached=!0,h.on("title-edit-end",function(s,l,t){return s=o(s),t||s==l?(c.style("display","inline-block"),void h.style("display","none").attribute("contenteditable",null)):(u.addClass("disabled"),u.removeClass("fa-pencil").addClass("fa-spin-fast fa-spinner"),e=h.data("g-config-href"),void r("post",g(e+a()),{title:s},function(t,e){var n,i,r,o,a;e.body.success?(n=d.selectizeInstance,a=d.value(),(o=n.Options[a])[n.options.labelField]=s,n.updateOption(a,o),c.style("display","inline-block"),h.style("display","none")):(f.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),h.data("title-editable",l).text(l)),n=s,i=a,"wordpress"==GANTRY_PLATFORM&&(r=n.replace(/[^a-z\d_-\s]/i,"_").toLowerCase(),o=p('[href*="/'+i+'/"]'),a=v.getPageUrl(),n=b(a,"view"),o&&o.forEach(function(t){var e=(t=p(t)).href().replace("/"+i+"/","/"+r+"/");t.href(e)}),n=n.replace("/"+i+"/","/"+r+"/"),a=y(a,"view",n),v.replaceState({uuid:m(),doNothing:!0},window.document.title,a)),u.removeClass("disabled"),u.removeClass("fa-spin-fast fa-spinner").addClass("fa-pencil")}))})),h.style({width:c.compute("width"),display:"inline-block"}),c.style("display","none")})}),e.exports={}},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,agent:80,elements:113,"elements/domready":111,"mout/queryString/getParam":247,"mout/queryString/setParam":249,"mout/random/guid":251,"mout/string/trim":272}],6:[function(t,e,n){"use strict";var c=t("elements"),d=t("elements/zen"),i=t("elements/domready"),l=t("mout/string/trim"),h=t("mout/object/keys"),p=t("../ui").modal,f=t("../ui").toastr,m=t("agent"),g=t("../utils/get-ajax-suffix"),v=t("../utils/get-ajax-url").parse,b=t("../utils/get-ajax-url").global,y=t("../utils/flags-state");t("./dropdown-edit"),i(function(){var s=c("body");s.delegate("click","[data-g5-outline-create], [data-g5-outline-duplicate]",function(t,e){t&&t.preventDefault(),p.open({content:"Loading",method:"post",overlayClickToClose:!1,remote:v(e.href()+g()),remoteLoaded:function(t,a){var s,l;t.body.success?(s=a.elements.content.find('[name="title"]'),l=a.elements.content.find("[data-g-outline-create-confirm]"),s.on("keyup",function(t){13===t.which&&l.emit("click")}),l.on("click",function(){l.hideIndicator(),l.showIndicator();var t=v(l.data("g-outline-create-confirm")+g()),e=a.elements.content.find('[name="from"]:checked'),n=a.elements.content.find('[name="preset"]'),i=a.elements.content.find('[name="outline"]'),r=a.elements.content.find('[name="inherit"]'),o={title:s.value(),from:e?e.value():null,preset:n?n.value():null,outline:i?i.value():null,inherit:r.checked()?1:0};["title","from","preset","outline"].forEach(function(t){o[t]||delete o[t]}),m("post",t,o,function(t,e){var n,i;l.hideIndicator(),e.body.success?(n=c("#configurations").find("ul").find("li"),(i=d("li").attribute("class",n.attribute("class"))).after(n).html(e.body.outline),f.success(e.body.html||"Action successfully completed.",e.body.title||""),u(i.find("[data-title-editable]")),p.close()):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})}),setTimeout(function(){s[0].focus()},5)):p.enableCloseByOverlay()}})}),s.delegate("change",'input[type="radio"]#from-preset, input[type="radio"]#from-outline',function(t,e){var n=(e=c(e)).value(),e=e.parent(".card").search(".g-create-from").style("display","none").filter(function(t){return(t=c(t)).hasClass("g-create-from-"+n)});e&&c(e).style("display","block")}),s.delegate("click","#configurations [data-g-config]",function(t,a){var e=a.data("g-config"),n=a.data("g-config-href"),i=a.data("g-config-href-confirm"),r=window.btoa(n),o=(a.data("g-config-method")||"post").toLowerCase();if(t&&t.preventDefault&&t.preventDefault(),"delete"==e&&!y.get("free:to:delete:"+r,!1))return y.warning({url:v(n+g()),callback:function(t,e){var n=e.find("[data-g-delete-confirm]"),i=e.find("[data-g-delete-cancel]");n&&(n.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(y.get("free:to:delete:"+r,!0),c([n,i]).attribute("disabled"),s.emit("click",{target:a}),void p.close())}),i.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(c([n,i]).attribute("disabled"),y.get("free:to:delete:"+r,!1),void p.close())}))}}),!1;a.hideIndicator(),a.showIndicator(),m(o,v((i||n)+g()),{},function(t,e){var n,i,r,o;e.body.success?(n=(o=c("#configuration-selector")).value(),i=e.body.outline,r=c('[href="'+b("configurations")+'"]'),!i||n!=i||(o=h(o.selectizeInstance.Options)).length&&r.href(r.href().replace("style="+i,"style="+o.shift())),r?s.emit("click",{target:r}):window.location=window.location,f.success(e.body.html||"Action successfully completed.",e.body.title||""),i&&(s.outlineDeleted=i)):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.hideIndicator()})});function e(r,o,t){var a,e,s;this.style("text-overflow","ellipsis"),t||r==o||(e=(a=this).data("g-config-href"),t=(a.data("g-config-method")||"post").toLowerCase(),(s=a.parent()).showIndicator(),s.find("[data-title-edit]").addClass("disabled"),m(t,v(e+g()),{title:l(r)},function(t,e){var n,i;e.body.success?(a.data("title",r).data("tip",r),n=(i=d("div").html(e.body.outline)).find("h4 span:last-child"),i=i.find(".outline-actions"),a.parent(".card").find("h4 span:last-child").html(n.html()),a.parent(".card").find(".outline-actions").html(i.html())):(p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.data("title-editable",o).text(o)),s.hideIndicator(),s.find("[data-title-edit]").removeClass("disabled")}))}var u=function(t){t&&t.length&&t.forEach(function(t){(t=c(t)).confWasAttached=!0,t.on("title-edit-start",function(){t.style("text-overflow","inherit")}),t.on("title-edit-end",e)})};s.on("statechangeAfter",function(t,e){var n=c("#configurations [data-title-editable]");if(!n)return!0;n=n.filter(function(t){return void 0===c(t).confWasAttached}),u(n)}),u(c("#configurations [data-title-editable]"))}),e.exports={}},{"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"./dropdown-edit":5,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272}],7:[function(t,e,n){"use strict";var i=t("elements/domready"),a=t("elements/attributes"),s=t("prime/map"),o=t("mout/lang/deepEquals"),l=t("mout/lang/is"),u=t("mout/lang/isString"),c=t("mout/object/has"),d=t("mout/collection/forEach"),h=(t("mout/array/invoke"),t("../utils/history")),p=t("../utils/flags-state"),r=t("./submit");t("./multicheckbox");function f(t){var e,n,i=new s,r=a("[data-g-styles-defaults]"),o=a('input[type="checkbox"].settings-param-toggle'),r=r?JSON.parse(r.data("g-styles-defaults")):{};return o&&(e={},o.forEach(function(t){t=a(t),e[t.id()]=t.checked()}),i.set("__js__overrides",JSON.stringify(e))),t?(t.forEach(function(t){(n=a('[name="'+t+'"]'))&&i.set(t,n.value())}),i):!!(t=a(".settings-block [name]"))&&(t.forEach(function(t){var e=(t=a(t)).attribute("name"),n=!c(r,e);"checkbox"!=t.type()||t.value().length||t.value("0"),i.set(e,n?t.value():r[e])},this),i)}var m,g={single:function(){},whole:function(){},blanks:function(){},presets:function(){}};i(function(){var r,i=a("body");m=f(),g.single=function(t,e){var n=e.parent(".settings-param")||e.parent("h4")||e.parent(".input-group"),i=n?n.matches("h4")?n:n.find(".settings-param-title, .g-instancepicker-title"):null,r=!!n&&n.find(".settings-param-toggle"),o=!1,a=e.hasClass("settings-param-toggle");if(n){if(a)return g.whole("force");"checkbox"==e.type()&&e.value(Number(e.checked()).toString()),m&&null==m.get(e.attribute("name"))&&(m.set(e.attribute("name"),e.value()),o=!0),i&&m&&null!=m.get(e.attribute("name"))&&(m.get(e.attribute("name"))!==e.value()||o?(r&&t.forceOverride&&!r.checked()&&r[0].click(),i.showIndicator("changes-indicator font-small far fa-circle fa-fw")):(r&&t.forceOverride&&r.checked()&&r[0].click(),i.hideIndicator()),g.blanks(t,n.find(".settings-param-field")),g.whole("force"),g.presets())}},g.whole=function(t){var e;m&&(e=o(m,f(t?m.keys():null),function(t,e){return u(t)&&u(e)&&"#"==t.substr(0,1)&&"#"==e.substr(0,1)?t.toLowerCase()==e.toLowerCase():l(t,e)}),(t=a("[data-save]"))&&(p.set("pending",!e),t[e?"hideIndicator":"showIndicator"]("changes-indicator far fa-circle fa-fw")))},g.blanks=function(t,e){if(e){var n=e.find("[name]"),e=e.find(".g-reset-field");if(!n||!e)return!0;!n.value()||n.disabled()?e.style("display","none"):e.removeAttribute("style")}},g.presets=function(){var i,n,t=a("[data-g-styles]");t&&(r||(r=new s,d(t,function(t,e){var n;t=a(t),i={index:e,map:(e=JSON.parse(t.data("g-styles")),n=new s,d(e,function(t,e){n.set(e,t)}),n)},r.set(t,i)})),r.forEach(function(t,e){(n=f(t.map.keys())).unset("__js__overrides"),n=o(n,t.map,function(t,e){return t==e}),a(a("[data-g-styles]")[t.index]).parent()[n?"addClass":"removeClass"]("g-preset-match")}))},i.delegate("input",'.settings-block input[name][type="text"], .settings-block textarea[name]',g.single),i.delegate("change",'.settings-block input[name][type="hidden"], .settings-block input[name][type="checkbox"], .settings-block select[name], .settings-block .selectized[name], .settings-block input[id][type="checkbox"].settings-param-toggle',g.single),i.delegate("input",".g-urltemplate",function(t,e){var n,i=e.parent(".settings-param").siblings();(i=i&&i.find("[data-g-urltemplate]"))&&(n=i.data("g-urltemplate"),i.attribute("href",n.replace(/#ID#/g,e.value())))}),i.delegate("mouseenter",".settings-param-field",g.blanks,!0),i.delegate("click",".g-reset-field",function(t,e){var n,e=e.parent(".settings-param-field");e&&(n=e.find("[name]"))&&!n.disabled()&&((e=n.selectizeInstance)?e.setValue(""):n.value(""),n.emit("change"),i.emit("input",{target:n}),i.emit("keyup",{target:n}))}),i.on("statechangeEnd",function(){h.getState();i.emit("updateOriginalFields")}),i.on("updateOriginalFields",function(){m=f(),g.presets()}),g.presets()}),e.exports={compare:g,collect:f,submit:r}},{"../utils/flags-state":69,"../utils/history":75,"./multicheckbox":8,"./submit":9,"elements/attributes":108,"elements/domready":111,"mout/array/invoke":178,"mout/collection/forEach":189,"mout/lang/deepEquals":201,"mout/lang/is":202,"mout/lang/isString":211,"mout/object/has":234,"prime/map":302}],8:[function(t,e,n){"use strict";var a=t("elements/attributes"),i=t("elements/domready"),s=t("mout/array/remove"),l=t("mout/array/insert");t("mout/array/contains");i(function(){var o=a("body");o.delegate("change",'.input-multicheckbox .input-group input[name][type="hidden"]',function(t,e){var n=e.attribute("name"),i=e.value().split(","),n=a('[data-multicheckbox-field="'+n+'"]');n&&n.forEach(function(t){(t=a(t)).checked()&&l(i,t.value()),t.checked()||s(i,t.value())}),e.value(i.filter(String).join(","))}),o.delegate("change",'.input-multicheckbox .input-group input[data-multicheckbox-field][type="checkbox"]',function(t,e){var n=a('[name="'+e.data("multicheckbox-field")+'"]'),i=e.value(),r=n.value().split(","),e=e.checked();e&&l(r,i),e||s(r,i),n.value(r.filter(String).join(",")),o.emit("change",{target:n})})})},{"elements/attributes":108,"elements/domready":111,"mout/array/contains":166,"mout/array/insert":176,"mout/array/remove":181}],9:[function(t,e,n){"use strict";var l=t("elements"),u=t("mout/lang/isArray"),c=t("mout/array/contains"),i=t("mout/string/trim"),d=t("../utils/field-validation");e.exports=function(t,r,o){var a=[],s=[];t=l(t),r=l(r),o=o||{},l(t).forEach(function(t){var e,n=(t=l(t)).attribute("name"),i=t.attribute("type");!n||t.disabled()||"radio"==i&&!t.checked()||(t=r.find('[name="'+n+'"]'+("radio"==i?":checked":"")),(t="checkbox"===i&&r.find('[type="hidden"][name="'+n+'"]')?r.find('[name="'+n+'"][type="checkbox"]'):t)&&(e="checkbox"==t.type()?Number(t.checked()):t.value(),i=(i=(i=t.parent(".settings-param"))?i.find('> input[type="checkbox"]'):null)||l(t.data("override-target")),c(["select","select-multiple"],t.type())&&t.attribute("multiple")&&(e=(t.search("option[selected]")||[]).map(function(t){return l(t).value()})),i&&!i.checked()||(d(t)||s.push(t),u(e)?e.forEach(function(t){a.push(n+"[]="+encodeURIComponent(t))}):(!o.submitUnchecked||"checkbox"!=t.type()||"checkbox"==t.type()&&e)&&a.push(n+"="+encodeURIComponent(e)))))});var e,t=r.search("h4 [data-title-editable]");return t&&t.forEach(function(t){(t=l(t)).parent("[data-collection-template]")||(e=t.data("collection-key")||(o.isRoot?"settings[title]":"title"),a.push(e+"="+encodeURIComponent(i(t.data("title-editable")))))}),{valid:a,invalid:s}}},{"../utils/field-validation":68,elements:113,"mout/array/contains":166,"mout/lang/isArray":203,"mout/string/trim":272}],10:[function(t,e,n){"use strict";var i=t("prime"),r=t("elements"),o=t("./base"),a=t("elements/zen"),s=t("../../utils/get-ajax-url").config,i=new i({inherits:o,options:{type:"atom"},constructor:function(t){o.call(this,t),this.on("changed",this.hasChanged)},updateTitle:function(t){return this.block.find(".title").text(t),this.setTitle(t),this},layout:function(){var t=s(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),e=this.getSubType()?'data-lm-blocksubtype="'+this.getSubType()+'"':"";return''+this.getTitle()+''+(this.getSubType()||this.getKey()||this.getType())+'
'},hasChanged:function(t,e){var n=this.block.find("span > i.changes-indicator:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),t&&!n&&a("i.far.fa-circle.changes-indicator").before(this.block.find(".icon")))},onRendered:function(t,e){!r('[data-lm-disabled][data-lm-subtype="'+this.getSubType()+'"]')&&0!==this.getAttribute("enabled")||this.disable()}});e.exports=i},{"../../utils/get-ajax-url":71,"./base":12,elements:113,"elements/zen":137,prime:301}],11:[function(t,e,n){"use strict";var i=t("prime"),r=t("elements"),o=t("elements/zen"),a=t("mout/function/bind"),t=new i({inherits:t("./section"),options:{type:"atoms",attributes:{name:"Atoms Section"}},layout:function(){return this.deprecated='Looking for Atoms? To make it easier we moved them in the
Page Settings.
','"},getId:function(){return this.id||(this.id=this.options.type)},onDone:function(t){if(!this.block.search('[data-lm-blocktype="atom"]')){var e=[this.getId()],n=this.block.search("[data-lm-id]");return n&&n.forEach(function(t){e.push(r(t).data("lm-id"))}),e.reverse().forEach(a(function(t){this.options.builder.remove(t)},this)),this.block.empty()[0].outerHTML=this.deprecated,void this._attachRedirect()}this.block.search("[data-lm-id]")||(this.grid.insert(this.block,"bottom"),this.options.builder.add(this.grid)),o("div").html(this.deprecated).firstChild().after(this.block),this._attachRedirect()},_attachRedirect:function(){var e=r('[data-g5-nav="page"]');e&&r(".atoms-notice a").on("click",function(t){t.preventDefault(),r("body").emit("click",{target:e})})}});e.exports=t},{"./section":20,elements:113,"elements/zen":137,"mout/function/bind":192,prime:301}],12:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime-util/prime/options"),o=t("prime-util/prime/bound"),a=t("prime/emitter"),s=t("elements/zen"),l=t("mout/string/trim"),u=t("elements"),c=t("../id"),d=t("mout/object/size"),h=t("mout/object/get"),p=t("mout/object/has"),f=t("mout/object/set"),m=t("../../utils/translate"),g=t("../../utils/get-outline").getCurrentOutline;t("elements/traversal");a=new i({mixin:[o,r],inherits:a,options:{subtype:!1,attributes:{},inherit:{}},constructor:function(t){return this.setOptions(t),this.fresh=!this.options.id,this.id=this.options.id||c(this.options),this.attributes=this.options.attributes||{},this.inherit=this.options.inherit||{},this.block=s("div").html(this.layout()).firstChild(),this.on("rendered",this.bound("onRendered")),this},guid:function(){return guid()},getId:function(){return this.id||(this.id=c(this.options))},getType:function(){return this.options.type||""},getSubType:function(){return this.options.subtype||""},getTitle:function(){return l(this.options.title||"Untitled")},setTitle:function(t){return this.options.title=l(t||"Untitled"),this},getKey:function(){return""},getPageId:function(){var t=u("[data-lm-root]");return t?t.data("lm-page"):"data-root-not-found"},getAttribute:function(t){return h(this.attributes,t)},getAttributes:function(){return this.attributes||{}},getInheritance:function(){return this.inherit||{}},updateTitle:function(){return this},setAttribute:function(t,e){return f(this.attributes,t,e),this},setAttributes:function(t){return this.attributes=t,this},setInheritance:function(t){return this.inherit=t,this},hasAttribute:function(t){return p(this.attributes,t)},enableInheritance:function(){},disableInheritance:function(){},refreshInheritance:function(){},hasInheritance:function(){return d(this.inherit)&&this.inherit.outline!=g()},disable:function(){this.block.title(m("GANTRY5_PLATFORM_JS_LM_DISABLED_PARTICLE","particle")),this.block.addClass("particle-disabled")},enable:function(){this.block.removeAttribute("title"),this.block.removeClass("particle-disabled")},insert:function(t,e){return this.block[e||"after"](t),this},adopt:function(t){return t.insert(this.block),this},isNew:function(t){return void 0!==t&&(this.fresh=!!t),this.fresh},dropzone:function(){return"data-lm-dropzone"},addDropzone:function(){this.block.data("lm-dropzone",!0)},removeDropzone:function(){this.block.data("lm-dropzone",null)},layout:function(){},onRendered:function(){},setLayout:function(t){return this.block=t,this},getLimits:function(){return!1}});e.exports=a},{"../../utils/get-outline":72,"../../utils/translate":78,"../id":27,elements:113,"elements/traversal":136,"elements/zen":137,"mout/object/get":233,"mout/object/has":234,"mout/object/set":241,"mout/object/size":242,"mout/string/trim":272,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],13:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=t("../../utils/elements.utils"),a=t("elements/zen"),s=t("mout/number/enforcePrecision"),l=t("mout/function/bind"),i=new i({inherits:r,options:{type:"block",attributes:{size:100}},constructor:function(t){r.call(this,t),t.attributes&&t.attributes.size&&this.setAttribute("size",s(t.attributes.size,1)),this.on("changed",this.hasChanged)},getSize:function(){return s(this.getAttribute("size"),1)},setSize:function(t,e){t=void 0===t?this.getSize():Math.max(0,Math.min(100,parseFloat(t))),t=s(t,1),e&&this.setAttribute("size",t),o(this.block).style({flex:"0 1 "+t+"%","-webkit-flex":"0 1 "+t+"%","-ms-flex":"0 1 "+t+"%"}),this.emit("resized",t,this)},setAnimatedSize:function(t,e){t=void 0===t?this.getSize():Math.max(0,Math.min(100,parseFloat(t))),t=s(t,1),e&&this.setAttribute("size",t),o(this.block).animate({flex:"0 1 "+t+"%","-webkit-flex":"0 1 "+t+"%","-ms-flex":"0 1 "+t+"%"},l(function(){this.block.attribute("style",null),this.setSize(t)},this)),this.emit("resized",t,this)},setLabelSize:function(t){var e=this.block.find("> .particle-size");if(!e)return!1;e.text(s(t,1)+"%")},layout:function(){return''},onRendered:function(t,e){t.block.find('> [data-lm-blocktype="section"]')&&this.removeDropzone(),!e||((e=e.block.parent()).data("lm-root")||"container"==e.data("lm-blocktype")&&(e.parent().data("lm-root")||"wrapper"==e.parent().data("lm-blocktype")))&&(a("span.particle-size").text(this.getSize()+"%").top(t.block),t.on("resized",this.bound("onResize")))},onResize:function(t){this.setLabelSize(t)},hasChanged:function(t){var e,n=this.block.find('> [data-lm-id]:not([data-lm-blocktype="section"]):not([data-lm-blocktype="container"])');if(this.changeState=t,!n)return e=(n=this.block.find("> .particle-size")||this.block.parent('[data-lm-blocktype="block"]').find("> .particle-size")).find("i:first-child"),!t&&e&&e.remove(),void(t&&!e&&a("i.far.fa-circle.changes-indicator").top(n));n=this.options.builder.get(n.data("lm-id"));n&&n.emit("changed",t,this)}});e.exports=i},{"../../utils/elements.utils":66,"./base":12,"elements/zen":137,"mout/function/bind":192,"mout/number/enforcePrecision":222,prime:301}],14:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=t("elements/zen"),a=(t("elements"),t("../../utils/get-ajax-url").config),s=t("../../utils/translate"),i=new i({inherits:r,options:{type:"container"},constructor:function(t){r.call(this,t),this.on("changed",this.hasChanged)},layout:function(){return''},onRendered:function(t,e){e||this.addSettings(t)},hasChanged:function(t,e){var n=this.block.find("span.title > i:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),!t||n||(n=this.block.find("span.title"))&&o("i.far.fa-circle.changes-indicator").top(n))},addSettings:function(t){var e=a(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n=o("div.container-wrapper.clearfix").top(t.block),t=o("div.container-title").bottom(n),n=o("div.container-actions").bottom(n);t.html(''+this.getType()+""),n.html('')}});e.exports=i},{"../../utils/get-ajax-url":71,"../../utils/translate":78,"./base":12,elements:113,"elements/zen":137,prime:301}],15:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),i=(t("elements"),t("../../utils/get-ajax-url").config,new i({inherits:r,options:{type:"grid"},constructor:function(t){r.call(this,t),this.on("changed",this.hasChanged)},layout:function(){return''},onRendered:function(){var t=this.block.parent();t&&"atoms"==t.data("lm-blocktype")&&this.block.removeClass("nowrap"),(t&&t.data("lm-root")||"container"==t.data("lm-blocktype")&&t.parent().data("lm-root"))&&this.removeDropzone()},hasChanged:function(t){var e=this.block.parent('[data-lm-blocktype="section"]'),n=!!e&&e.data("lm-id");this.changeState=t,e&&n&&this.options.builder&&this.options.builder.get(n).emit("changed",t,this)}}));e.exports=i},{"../../utils/get-ajax-url":71,"./base":12,elements:113,prime:301}],16:[function(t,e,n){e.exports={base:t("./base"),atom:t("./atom"),section:t("./section"),offcanvas:t("./offcanvas"),wrapper:t("./wrapper"),atoms:t("./atoms"),grid:t("./grid"),container:t("./container"),block:t("./block"),particle:t("./particle"),position:t("./position"),system:t("./system"),spacer:t("./spacer")}},{"./atom":10,"./atoms":11,"./base":12,"./block":13,"./container":14,"./grid":15,"./offcanvas":17,"./particle":18,"./position":19,"./section":20,"./spacer":21,"./system":22,"./wrapper":23}],17:[function(t,e,n){"use strict";var i=t("prime"),r=t("./section"),o=t("../../utils/get-ajax-url").config,a=t("../../utils/get-outline").getOutlineNameById,s=t("../../utils/translate"),r=new i({inherits:r,options:{type:"offcanvas",attributes:{name:"Offcanvas Section"}},layout:function(){var t,e=o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n="",i="";return this.hasInheritance()&&(t=a(this.inherit.outline),n=''+s("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"")+"
",i=" g-inheriting g-inheriting-"+this.inherit.include.join(" g-inheriting-")),''+n+"
"},getId:function(){return this.id||(this.id=this.options.type)}});e.exports=r},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./section":20,prime:301}],18:[function(u,c,t){!function(l){!function(){"use strict";var t=u("prime"),i=u("elements"),e=u("./atom"),n=(u("mout/function/bind"),u("mout/number/enforcePrecision")),r=u("mout/object/forOwn"),o=u("../../utils/get-ajax-url").config,a=u("../../utils/get-outline").getOutlineNameById,s=u("../../utils/translate"),t=new t({inherits:e,options:{type:"particle"},constructor:function(t){e.call(this,t)},layout:function(){var t=o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),e=this.getSubType()?'data-lm-blocksubtype="'+this.getSubType()+'"':"",n="";return this.hasInheritance()&&(n=" g-inheriting",this.inherit.include.length&&(n+=" g-inheriting-"+this.inherit.include.join(" g-inheriting-"))),''+this.getTitle()+''+(this.getKey()||this.getSubType()||this.getType())+'
'},enableInheritance:function(){var n;this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.hasInheritance()&&(a(this.inherit.outline),n=this.block.find(".icon"),this.block.addClass("g-inheriting"),this.inherit.include.length&&this.block.addClass("g-inheriting-"+this.inherit.include.join(" g-inheriting-")),this.block.find(".icon .fa").attribute("class","fa "+this.getIcon()),r(this.getInheritanceTip(),function(t,e){n.data(e,t)}),l.G5.tips.reload())},disableInheritance:function(){var n=this.block.find(".icon");this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.removeClass("g-inheriting"),this.block.find(".icon .fa").attribute("class","fa "+this.getIcon()),r(this.getInheritanceTip(),function(t,e){n.data(e,null)}),l.G5.tips.reload()},refreshInheritance:function(){this.block[this.hasInheritance()?"removeClass":"addClass"]("g-inheritance"),this.hasInheritance()&&this.block.attribute("class",this.cleanKlass(this.block.attribute("class")))},addInheritanceTip:function(t){var n,e=this.getInheritanceTip();return t&&(n="",r(e,function(t,e){n+="data-"+e+'="'+t+'" '}),e=n),this.hasInheritance()?e:""},getInheritanceTip:function(){var t=a(this.inherit?this.inherit.outline:null),e=this.inherit.particle||"",n=(this.inherit.include||[]).join(", ");return{tip:s("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"")+"
ID: "+e+"
Replace: "+n,"tip-offset":-10,"tip-place":"top-right"}},cleanKlass:function(t){return(t=(t||"").split(" ")).filter(function(t){return!t.match(/^g-inheriting-/)}).join(" ")},setLabelSize:function(t){var e=this.block.find(".particle-size");if(!e)return!1;e.text(n(t,1)+"%")},onRendered:function(t,e){var n=e.getSize()||100;!i('[data-lm-disabled][data-lm-subtype="'+this.getSubType()+'"]')&&0!==this.getAttribute("enabled")||this.disable(),this.setLabelSize(n),e.on("resized",this.bound("onParentResize"))},getParent:function(){var t=this.block.parent("[data-lm-id]");return this.options.builder.get(t.data("lm-id"))},onParentResize:function(t){this.setLabelSize(t)},getIcon:function(){if(this.hasInheritance())return"fa-lock";var t=this.getType(),e=this.getSubType(),e=i('.particles-container [data-lm-blocktype="'+t+'"][data-lm-subtype="'+e+'"]');return e?e.data("lm-icon"):"fa-cube"},getLimits:function(t){if(!t)return!1;t=t.block.nextSibling()||t.block.previousSibling()||!1;if(!t)return[100,100];t=this.options.builder.get(t.data("lm-id"));return[5,this.getParent().getSize()+t.getSize()-5]}});c.exports=t}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./atom":10,elements:113,"mout/function/bind":192,"mout/number/enforcePrecision":222,"mout/object/forOwn":232,prime:301}],19:[function(t,e,n){"use strict";var i=t("prime"),r=t("mout/string/trim"),o=t("./particle"),a=0,i=new i({inherits:o,options:{type:"position"},constructor:function(t){++a,o.call(this,t),this.setAttribute("title",this.getTitle()),this.setAttribute("key",this.getKey()),this.isNew()&&--a},getTitle:function(){return r(this.options.title||"Position "+a)},getKey:function(){return this.getAttribute("key")||r(this.getTitle()).replace(/\s/g,"-").toLowerCase()},updateKey:function(t){return this.options.key=t||this.getKey(),this.block.find(".font-small").text(this.getKey()),this}});e.exports=i},{"./particle":18,"mout/string/trim":272,prime:301}],20:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=(t("prime-util/prime/bound"),t("./grid")),a=t("elements"),s=t("elements/zen"),l=t("mout/function/bind"),u=t("mout/object/forOwn"),c=t("../../utils/get-ajax-url").config,d=t("../../utils/get-outline").getOutlineNameById,h=t("../../utils/translate");t("elements/insertion");i=new i({inherits:r,options:{},constructor:function(t){this.grid=new o,r.call(this,t),this.on("done",this.bound("onDone")),this.on("changed",this.hasChanged)},layout:function(){var t,e=c(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n="",i="";return this.hasInheritance()&&(t=d(this.inherit.outline),n=this.renderInheritanceLabel(t),i=" g-inheriting",this.inherit.include.length&&(i+=" g-inheriting-"+this.inherit.include.join(" g-inheriting-"))),''+n+"
"},adopt:function(t){a(t).insert(this.block.find(".g-grid"))},renderInheritanceLabel:function(t){t=h("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"");return this.block&&this.getParent()&&(t=""),'"},enableInheritance:function(){var t,e;this.hasInheritance()&&(this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.addClass("g-inheriting"),this.inherit.include.length&&this.block.addClass("g-inheriting-"+this.inherit.include.join(" g-inheriting-")),this.block.find("> .g-inherit")||(t=s("div"),e=d(this.inherit.outline),e=this.renderInheritanceLabel(e),t.html(e).children().after(this.block.find("> .section-header"))))},disableInheritance:function(){var t;!this.block.find("> .g-inherit")||(t=this.block.find("> .g-inherit.g-section-inherit"))&&t.remove(),this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.removeClass("g-inheriting")},refreshInheritance:function(){var t,e;this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.hasInheritance()&&(this.enableInheritance(),(t=this.block.find("> .g-inherit"))&&(e=d(this.inherit.outline),e=s("div").html(this.renderInheritanceLabel(e)),t&&e&&t.html(e.children().html())))},addInheritanceTip:function(t){var n,e=this.getInheritanceTip();return t&&(n="",u(e,function(t,e){n+="data-"+e+'="'+t+'" '}),e=n),this.hasInheritance()?e:""},getInheritanceTip:function(){var t=this.inherit?this.inherit.outline:null,e=d(t),n=(this.inherit.include||[]).join(", ");return{tip:h("GANTRY5_PLATFORM_INHERITING_FROM_X",""+e+"")+"
Outline ID: "+t+"
Replace: "+n,"tip-offset":-2,"tip-place":"top-right"}},cleanKlass:function(t){return(t=(t||"").split(" ")).filter(function(t){return!t.match(/^g-inheriting-/)}).join(" ")},hasChanged:function(t,e){var n=this.block.find("h4 > i:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),t&&!n&&s("i.far.fa-circle.changes-indicator").top(this.block.find("h4")))},onDone:function(t){this.block.search("[data-lm-id]")||(this.grid.insert(this.block,"bottom"),this.options.builder.add(this.grid));var e=this.block.find(".fa-plus");e&&e.on("click",l(function(t){return t&&t.preventDefault(),!this.block.find(".g-grid:last-child:empty")&&(this.grid=new o,this.grid.insert(this.block.find('[data-lm-blocktype="container"]')?this.block.find('[data-lm-blocktype="container"]'):this.block,"bottom"),void this.options.builder.add(this.grid))},this)),this.refreshInheritance()},getParent:function(){var t=this.block.parent("[data-lm-id]");return t?this.options.builder.get(t.data("lm-id")):null},getLimits:function(t){if(!t)return!1;t=t.block.nextSibling()||t.block.previousSibling()||!1;if(!t)return[100,100];t=this.options.builder.get(t.data("lm-id"));return"block"===t.getType()&&[5,this.getParent().getSize()+t.getSize()-5]}});e.exports=i},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./base":12,"./grid":15,elements:113,"elements/insertion":114,"elements/zen":137,"mout/function/bind":192,"mout/object/forOwn":232,prime:301,"prime-util/prime/bound":297}],21:[function(t,e,n){"use strict";t=new(t("prime"))({inherits:t("./particle"),options:{type:"spacer",title:"Spacer",attributes:{}}});e.exports=t},{"./particle":18,prime:301}],22:[function(t,e,n){"use strict";t=new(t("prime"))({inherits:t("./particle"),options:{type:"system",attributes:{}}});e.exports=t},{"./particle":18,prime:301}],23:[function(t,e,n){"use strict";var i=t("prime"),r=t("./section"),o=t("../../utils/get-ajax-url").config,r=new i({inherits:r,options:{type:"wrapper",attributes:{name:"Wrapper"}},layout:function(){o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId());return''},hasChanged:function(){},getSize:function(){return!1},getId:function(){return this.id||(this.id=this.options.type)}});e.exports=r},{"../../utils/get-ajax-url":71,"./section":20,prime:301}],24:[function(t,e,n){"use strict";var i=t("prime"),s=t("elements"),r=t("prime/emitter"),o=t("./blocks/"),l=(t("mout/object/forOwn"),t("mout/collection/forEach")),a=t("mout/collection/size"),u=(t("mout/lang/isArray"),t("mout/array/flatten"),t("./id")),c=t("mout/object/set"),d=t("mout/object/unset"),h=t("mout/object/get"),p=t("mout/object/deepFillIn"),f=t("mout/object/omit");t("elements/attributes"),t("elements/traversal");t("mout/string/rpad"),t("mout/string/repeat");s.implement({empty:function(){return this.forEach(function(t){for(var e;e=t.firstChild;)t.removeChild(e)})}});r=new i({inherits:r,constructor:function(t){return t&&this.setStructure(t),this.map={},this},setStructure:function(t){try{this.structure="object"==typeof t?t:JSON.parse(t)}catch(t){console.error("Parsing error:",t)}},add:function(t){var e="string"==typeof t?t:t.id;c(this.map,e,t),t.isNew(!1)},remove:function(t){t="string"==typeof t?t:t.id,d(this.map,t)},get:function(t){var e="string"==typeof t?t:t.id;return h(this.map,e,t)},load:function(t){return this.recursiveLoad(t),this.emit("loaded",t),this},serialize:function(t,e){var n=[];if(t=t||s("[data-lm-root]")){var i,r,o,a,t=t.search((e?"":"> ")+"[data-lm-id]");return l(t,function(t){t=s(t),i=t.data("lm-id"),r=t.data("lm-blocktype"),o=t.data("lm-blocksubtype")||!1,a=t.search("> [data-lm-id]"),a=e?!!a&&a.map(function(t){return s(t).data("lm-id")}):a?this.serialize(t):[],a={id:i,type:r,subtype:o,title:h(this.map,i)?h(this.map,i).getTitle():"Untitled",attributes:h(this.map,i)?h(this.map,i).getAttributes():{},inherit:h(this.map,i)?h(this.map,i).getInheritance():{},children:a},e&&((t={})[i]=a,a=t),n.push(a)},this),n}},insert:function(t,e,n){var i=s("[data-lm-root]");if(i){o[e.type]||console[console.error?"error":"log"](e.type+" does not exist");e=new(o[e.type]||o.section)(p({id:t,attributes:{},inherit:{},subtype:e.subtype||!1,builder:this},f(e,"children")));return n?e.block.insert(s('[data-lm-id="'+n+'"]')):e.block.insert(i),"block"===e.getType()&&e.setSize(),this.add(e),e.emit("rendered",e,n?h(this.map,n):null),e}},reset:function(t){this.map={},this.setStructure(t||{}),s("[data-lm-root]").empty(),this.load()},cleanupLonely:function(){var e,n,i=[],t=s("[data-lm-root] > .g-section > .g-grid > .g-block .g-grid > .g-block, [data-lm-root] > .g-section > .g-grid > .g-block > .g-block");if(t)return t.forEach(function(t){return t=s(t),e=null,(!(n=t.parent().hasClass("g-grid"))||!t.siblings())&&(n&&(i.push(t.data("lm-id")),e=t.parent()),i.push(t.data("lm-id")),t.children().before(e||t),void(e||t).remove())}),i},recursiveLoad:function(t,n,i,r){t=t||this.structure,i=i||0,r=r||!1,n=n||this.insert,l(t,function(e){e.id||(e.id=u({builder:{map:this.map},type:e.type,subtype:e.subtype})),console&&console.log,this.emit("loading",n.call(this,e.id,e,r,i)),e.children&&a(e.children)&&(i++,l(e.children,function(t){this.recursiveLoad([t],n,i,e.id)},this)),this.get(e.id).emit("done",this.get(e.id)),i--},this)}});e.exports=r},{"./blocks/":16,"./id":27,elements:113,"elements/attributes":108,"elements/traversal":136,"mout/array/flatten":173,"mout/collection/forEach":189,"mout/collection/size":191,"mout/lang/isArray":203,"mout/object/deepFillIn":225,"mout/object/forOwn":232,"mout/object/get":233,"mout/object/omit":240,"mout/object/set":241,"mout/object/unset":244,"mout/string/repeat":266,"mout/string/rpad":269,prime:301,"prime/emitter":300}],25:[function(t,e,n){"use strict";var i=t("../ui/drag.events"),r=t("prime"),o=(t("prime/emitter"),t("prime-util/prime/bound")),a=t("prime-util/prime/options"),s=t("mout/function/bind"),l=t("mout/lang/isString"),c=t("mout/math/map"),d=t("mout/math/clamp"),h=t("mout/number/enforcePrecision"),u=t("mout/object/get"),p=t("../utils/elements.utils");t("elements/events"),t("elements/delegation");i=new r({mixin:[o,a],DRAG_EVENTS:i,options:{minSize:5},constructor:function(t,e){this.setOptions(e),this.history=this.options.history||{},this.builder=this.options.builder||{},this.origin={x:0,y:0,transform:null,offset:{x:0,y:0}}},getBlock:function(t){return u(this.builder.map,l(t)?t:p(t).data("lm-id")||"")},getAttribute:function(t,e){return this.getBlock(t).getAttribute(e)},getSize:function(t){return this.getAttribute(p(t),"size")},start:function(t,e,n,i){if(t&&t.type.match(/^touch/i)&&t.preventDefault(),window.G5.tips.hide(e[0]),t.which&&1!==t.which)return!0;t.preventDefault(),this.element=p(e),this.siblings={occupied:0,elements:n,next:this.element.nextSibling(),prevs:this.element.previousSiblings(),sizeBefore:0},1 [data-lm-id]:first-child")[0].getBoundingClientRect().left,this.origin.offset.parentRect.right=this.element.parent().find("> [data-lm-id]:last-child")[0].getBoundingClientRect().right,this.DRAG_EVENTS.EVENTS.MOVE.forEach(s(function(t){p(document).on(t,this.bound("move"))},this)),this.DRAG_EVENTS.EVENTS.STOP.forEach(s(function(t){p(document).on(t,this.bound("stop"))},this))},move:function(t){t&&t.type.match(/^touch/i)&&t.preventDefault();var e=t.clientX||t.touches[0].clientX||0,n=t.clientY||t.touches[0].clientY||0,i=this.origin.offset.parentRect,r=(this.lastX||e)-e,t=(this.lastY||n)-n;this.direction=(Math.abs(r)>Math.abs(t)&&0Math.abs(t)&&r<0&&"right")||Math.abs(t)>Math.abs(r)&&0 .g-block > [data-lm-blocktype]:not([data-lm-nodrag]) !> .g-block, .g5-lm-particles-picker [data-lm-blocktype], [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag])',droppables:"[data-lm-dropzone]",exclude:".section-header .button, .section-header .fa, .lm-newblocks .float-right .button, [data-lm-nodrag], [data-lm-disabled]",resize_handles:"[data-lm-root] .g-grid > .g-block:not(:last-child)",builder:h,history:f,savestate:i}),e.exports.layoutmanager=p,u&&((n=JSON.parse(u.data("lm-root"))).name&&(n=n.layout),h.setStructure(n),h.load(),p.history.setSession(h.serialize(),JSON.parse(u.data("lm-preset"))),p.savestate.setSession(h.serialize(null,!0))),d.delegate("click",".g-tabs a",function(t,e){return t.preventDefault(),!1}),d.delegate("keydown",".g-tabs a",function(t,e){var n=t.which||t.keyCode;if(32==n||13==n)return t.preventDefault(),d.emit("mouseup",t),!1}),d.delegate("mouseup",".g-tabs a",function(t,n){n=m(n),t.preventDefault();var i=0,e=n.parent(".g-tabs"),t=e.siblings(".g-panes");e.search("a").forEach(function(t,e){t==n[0]&&(i=e+1)}),t.find("> .active").removeClass("active"),e.find("> ul > .active").removeClass("active"),t.find("> .g-pane:nth-child("+i+")").addClass("active"),e.find("> ul > li:nth-child("+i+")").addClass("active"),t.search("> [aria-expanded]")&&t.search("> [aria-expanded]").attribute("aria-expanded","false"),e.search("> [aria-expanded]")&&e.search("> [aria-expanded]").attribute("aria-expanded","false"),t.find("> .g-pane:nth-child("+i+")").attribute("aria-expanded","true"),e.find("> ul >li:nth-child("+i+") [aria-expanded]")&&e.find("> ul > li:nth-child("+i+") > [aria-expanded]").attribute("aria-expanded","true")}),d.delegate("statechangeBefore","[data-g5-lm-picker]",function(){v.close()}),d.on("statechangeAfter",function(t,e){return!(u=m("[data-lm-root]"))||(n=JSON.parse(u.data("lm-root")),h.setStructure(n),h.load(),p.refresh(),p.history.setSession(h.serialize(),JSON.parse(u.data("lm-preset"))),p.savestate.setSession(h.serialize(null,!0)),p.eraser.element=m("[data-lm-eraseblock]"),void p.eraser.hide(!0))}),d.delegate("input",".sidebar-block .search input",function(t,e){var n,i,r=m(e).value().toLowerCase(),e=m(".sidebar-block [data-lm-blocktype]");if(!e)return!1;e.style({display:"none"}).forEach(function(t){t=m(t),i=t.data("lm-blocktype").toLowerCase(),n=s(t.text()).toLowerCase(),i.substr(0,r.length)!=r&&!n.match(r)||t.style({display:"block"})},this)}),["click","touchend"].forEach(function(t){d.delegate(t,"[data-lm-samewidth]:not(:empty)",function(t,e){window.G5.tips.hide(e[0]);var n,i,r=e[0].getBoundingClientRect();(t.clientX||t.pageX||t.changedTouches[0].pageX||0) [data-lm-blocktype="block"]'))&&1!=n.length&&(n.forEach(function(t){i=m(t).data("lm-id"),h.get(i).setSize(100/n.length,!0)}),f.push(h.serialize(),f.get().preset))})}),d.delegate("mouseover","[data-lm-samewidth]:not(:empty)",function(t,e){var n=e[0].getBoundingClientRect(),i=t.clientX||t.touches&&t.touches[0].clientX||0,t=i+5>n.width+n.left,n=i-5=o&&parseFloat(s.value())<=a?"":O("GANTRY5_PLATFORM_JS_LM_SIZE_LIMITS_RANGE"))})),r.on("click",function(t){t.preventDefault();var a=m(t.currentTarget);a.disabled(!0),a.hideIndicator(),a.showIndicator();t=e.elements.content.find("form")[0].elements,t=g(t,e.elements.content);if(t.invalid.length)return a.disabled(!1),a.hideIndicator(),a.showIndicator("fa fa-fw fa-exclamation-triangle"),void b.error(O("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),O("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));y(i.attribute("method"),C(i.attribute("action")+S()),t.valid.join("&")||{},function(t,e){var n,i,r,o;e.body.success?(i=null,(n=h.get(u)).setAttributes(e.body.data.options),n.hasAttribute("enabled")&&n[n.getAttribute("enabled")?"enable":"disable"](),"section"!==n.getType()&&(n.setTitle(e.body.data.title||"Untitled"),n.updateTitle(n.getTitle())),"position"===n.getType()&&n.updateKey(),e.body.data.block&&x(e.body.data.block)&&(r=(i=h.get(c)).block.nextSibling()||i.block.previousSibling(),o=i.getSize(),i.setAttributes(e.body.data.block),o=o-i.getSize(),i.setAnimatedSize(i.getSize()),r&&(r=h.get(r.data("lm-id"))).setAnimatedSize(parseFloat(r.getSize())+o,!0)),e.body.data.inherit&&(delete e.body.data.inherit.section,n.setInheritance(e.body.data.inherit),n.enableInheritance(),n.refreshInheritance()),e.body.data.children&&(p.clear(n.block,{save:!1,dropLastGrid:!!e.body.data.children.length,emptyInherits:!0}),h.recursiveLoad(e.body.data.children,h.insert,0,n.getId())),n.hasInheritance()&&!e.body.data.inherit&&(n.setInheritance({}),n.disableInheritance()),f.push(h.serialize(),f.get().preset),null===a.data("apply-and-save")||(o=m("body").find(".button-save"))&&d.emit("click",{target:o}),v.close(),b.success(O("GANTRY5_PLATFORM_JS_PARTICLE_SETTINGS_APPLIED",n.getTitle()),O("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.hideIndicator()})})}else v.enableCloseByOverlay()}})})}),e.exports={$:m,builder:h,layoutmanager:p,history:f,savestate:i}},{"../fields/submit":9,"../ui":54,"../ui/popover":56,"../utils/field-validation":68,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,"../utils/save-state":77,"../utils/translate":78,"./builder":24,"./history":26,"./inheritance":29,"./layoutmanager":30,"./particles-sidebar":31,agent:80,"elements/attributes":108,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/collection/size":191,"mout/number/enforcePrecision":222,"mout/string/properCase":264,"mout/string/replace":267,"mout/string/trim":272}],29:[function(t,e,n){"use strict";var b=t("elements"),i=t("elements/domready"),o=t("agent"),y=t("../../ui").modal,w=t("mout/lang/isArray"),x=t("mout/collection/forEach"),a=t("mout/object/filter"),s=t("mout/object/keys"),k=t("mout/collection/contains"),l=t("../../utils/get-ajax-suffix"),S=t("../../utils/get-ajax-url").parse,C=t("../../utils/get-ajax-url").global,T=(t("../../utils/get-outline").getOutlineNameById,t("../../utils/get-outline").getCurrentOutline),E={attributes:["g-settings-particle","g-settings-atom"],block:{panel:"g-settings-block-attributes",tab:"g-settings-block"},particles:"g-inherit-particle",atoms:"g-inherit-atom"};i(function(){var m=b("body"),g={},v={};m.delegate("change",'[name="inherit[outline]"]',function(t,e){var n=e.parent(".settings-param").find(".settings-param-title"),i=e.siblings().find(".g-item"),u=e.value(),c=b('[name="inherit[section]"]')?b('[name="inherit[section]"]').value():"",d=e.parent("[data-g-inheritance-settings]"),h=b('[data-multicheckbox-field="inherit[include]"]:checked')||[],p={list:b("#g-inherit-particle, #g-inherit-atom"),mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')};if(!i)return!0;var f=g[c]!==u||v[c]!==p.mode.value();f&&!u&&h.forEach(function(t){b(t).checked(!1),m.emit("change",{target:t})});var r=JSON.parse(d.data("g-inheritance-settings")),i={outline:u||T(),type:r.type||"",subtype:r.subtype||"",mode:p.mode.value(),inherit:u&&"inherit"===p.mode.value()?"1":"0"};i.id=r.id,n.showIndicator(),e.selectizeInstance.blur(),p.radios&&p.checked&&(f||(i.selected=p.checked.value(),i.id=p.checked.value(),p.list=!1));e="atom"===i.type?"atoms":"layouts",e=p.list?e+"/list":e;o("POST",S(C(e)+l()),i,function(t,e){var r,o,a,s,l;n.hideIndicator(),e.body.success?(r=e.body,o=d.find('[name="inherit[include]"]').value().split(","),a=d.search('[data-multicheckbox-field="inherit[include]"]').map(function(t){return b(t).value()}),s=y.getByID(y.getLast()),x(E,function(t,i){t=t.panel||t,(t=w(t)?t:[t]).forEach(function(t){var e=k(o,i),n=k(a,i);(e||!n)&&r.html[t]&&(l=s.find("#"+t))&&(l.html(r.html[t]),(t=l.search("[data-selectize]"))&&t.selectize())})}),f&&h&&""===g[c]&&h.forEach(function(t){m.emit("change",{target:t})}),g[c]=u,v[c]=p.mode.value()):y.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})}),m.delegate("change","#g-settings-inheritance [data-multicheckbox-field]",function(t,o){if(!(a=b('[name="inherit[outline]"]')))return!0;var a=a.value(),e=o.value(),s=o.checked(),l=t.noRefresh,u={mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')},c={panel:E[e]&&E[e].panel||E[e],tab:E[e]&&E[e].tab||E[e]};w(c.panel)||(c.panel=[c.panel],c.tab=[c.tab]),c.panel.forEach(function(t,e){var n=b("#"+t),i=b("#"+c.tab[e]+"-tab");if(!n||!i)return!0;var r=n.find(".g-inherit"),t="clone"===u.mode.value(),e=function(t){t||m.emit("change",{target:o.parent(".settings-block").find('[name="inherit[outline]"]')})};s&&a&&!t?((n=i.find(".fa-unlock"))&&n.removeClass("fa-unlock").addClass("fa-lock"),r&&r.show(),e(l)):((i=i.find(".fa-lock"))&&i.removeClass("fa-lock").addClass("fa-unlock"),r&&r.hide(),t&&e(l))})}),m.delegate("change",'[name="inherit[mode]"], [name="inherit[particle]"], [name="inherit[atom]"]',function(t,e){var n=y.getByID(y.getLast()),i=n.find('[name="inherit[outline]"]'),n=n.search("[data-multicheckbox-field]")||[],r=!1;"inherit[mode]"===e.attribute("name")&&(r=!0),m.emit("change",{target:i,noRefresh:r}),n.forEach(function(t){m.emit("change",{target:t,noRefresh:r})})}),m.delegate("click","#g-inherit-particle .fa-info-circle, #g-inherit-atom .fa-info-circle",function(t,e){t.preventDefault();var n=y.getByID(y.getLast()).find('[name="inherit[outline]"]'),t=e.siblings('input[name="inherit[particle]"], input[name="inherit[atom]"]');if(!t||!n)return!1;e="inherit[atom]"===t.name()?"atoms/instance":"layouts/particle";return y.open({content:"Loading",method:"post",data:{id:t.value(),outline:n.value()||T()},remote:S(C(e)+l()),remoteLoaded:function(t,e){t.body.success||y.enableCloseByOverlay()}}),!1}),m.delegate("mouseup",".g-tabs .fa-lock, .g-tabs .fa-unlock",function(t,e){if(!e.parent("li").hasClass("active"))return!1;var n=y.getByID(y.getLast()),i=e.hasClass("fa-lock"),r=e.parent("a").id().replace(/\-tab$/,""),e=s(a(E,function(t){return t===r||t.tab===r||k(t,r)})||[]).shift(),n=n.find('[data-multicheckbox-field][value="'+e+'"]'),e={mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')};if(n){if("clone"===e.mode.value()||e.radios&&!e.checked)return!1;n.checked(!i),m.emit("change",{target:n})}})})},{"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/get-outline":72,agent:80,elements:113,"elements/domready":111,"mout/collection/contains":187,"mout/collection/forEach":189,"mout/lang/isArray":203,"mout/object/filter":229,"mout/object/keys":236}],30:[function(t,e,n){"use strict";var i=t("prime"),f=t("../utils/elements.utils"),c=t("mout/function/bind"),u=t("elements/zen"),r=t("prime/emitter"),o=t("prime-util/prime/bound"),a=t("prime-util/prime/options"),m=t("./blocks"),s=t("../ui/drag.drop"),l=t("../ui/eraser"),d=t("../utils/flags-state"),h=t("./drag.resizer"),g=t("mout/object/get"),p=t("mout/object/keys"),v=(t("mout/array/every"),t("mout/number/enforcePrecision")),b=(t("mout/lang/isArray"),t("mout/lang/deepEquals")),y=t("mout/collection/find"),w=(t("mout/lang/isObject"),t("mout/array/contains")),x=t("mout/collection/forEach"),k={disable:function(){var t=f('[data-lm-root] [data-lm-blocktype="grid"]');t&&t.removeClass("no-hover")},enable:function(){var t=f('[data-lm-root] [data-lm-blocktype="grid"]');t&&t.addClass("no-hover")},cleanup:function(e,n,t){t=t?t.search("> .g-grid:empty"):f('[data-lm-blocktype="section"] > .g-grid:empty, [data-lm-blocktype="container"] > .g-grid:empty, [data-lm-blocktype="offcanvas"] > .g-grid:empty');t&&t.forEach(function(t){((t=f(t)).nextSibling("[data-lm-id]")||n)&&(e.remove(t.data("lm-id")),t.remove())})}},r=new i({mixin:[o,a],inherits:r,options:{},constructor:function(t,e){this.setOptions(e),(this.refElement=t)&&f(t)&&this.init(t)},init:function(){this.dragdrop=new s(this.refElement,this.options),this.resizer=new h(this.refElement,this.options),this.eraser=new l("[data-lm-eraseblock]",this.options),this.dragdrop.on("dragdrop:start",this.bound("start")).on("dragdrop:location",this.bound("location")).on("dragdrop:nolocation",this.bound("nolocation")).on("dragdrop:resize",this.bound("resize")).on("dragdrop:stop:erase",this.bound("removeElement")).on("dragdrop:stop",this.bound("stop")).on("dragdrop:stop:animation",this.bound("stopAnimation")),this.builder=this.options.builder,this.history=this.options.history,this.savestate=this.options.savestate||null,k.disable()},refresh:function(){this.refElement&&f(this.refElement)&&this.init()},singles:function(t,e,n,i){k[t](e,n,i)},clear:function(t,n){var i,r,o=t?(t.search("[data-lm-id]")||[]).map(function(t){return f(t).data("lm-id")}):[];n=n||{save:!0,dropLastGrid:!1,emptyInherits:!1},x(this.builder.map,function(t,e){o.length&&!w(o,e)||!n.emptyInherits&&t.block.parent(".g-inheriting")||(i=t.getType(),r=(r=t.block.find("> [data-lm-id]"))&&r.data("lm-blocktype"),w(["particle","spacer","position","widget","system","block"],i)&&"block"==i&&r&&"section"!==r&&"container"!==r?(this.builder.remove(e),t.block.remove()):!n.emptyInherits||"section"!=i&&"offcanvas"!=i&&"container"!=i||t.hasInheritance&&(t.inherit={},t.disableInheritance()))},this),this.singles("cleanup",this.builder,n.dropLastGrid,t),n.save&&this.history.push(this.builder.serialize(),this.history.get().preset)},updatePendingChanges:function(){var e,n,i,r,o=this.savestate.getData(),a=this.builder.serialize(null,!0),t=b(o,a),s=f('[data-save="Layout"]'),l=(s.find("i"),s.find(".changes-indicator"));t&&l&&s.hideIndicator(),t||l||s.showIndicator("changes-indicator far fa-fw fa-circle"),d.set("pending",!t),a.forEach(function(t){r=p(t)[0],n=y(o,function(t){return t[r]}),i=y(a,function(t){return t[r]}),e=!b(n,i),(r=this.builder.get(r))&&r.emit("changed",e)},this)},start:function(t,e){var n=f("[data-lm-root]"),i=f(e).position(),r=f(e)[0].getBoundingClientRect();this.block=null,this.mode=n.data("lm-root")||"page",n.addClass("moving");var o,a=f(e).data("lm-blocktype"),s=e[0].cloneNode(!0);this.placeholder||(this.placeholder=u("div.block.placeholder[data-lm-placeholder]")),this.placeholder.style({display:"none"}),s=f(s),this.original=s.after(e).style({display:s.hasClass("g-grid")?"flex":"block",opacity:.5}).addClass("original-placeholder").data("lm-dropzone",null),"grid"===a&&this.original.style({display:"flex"}),this.originalType=a,this.block=g(this.builder.map,e.data("lm-id")||"")||new m[a]({builder:this.builder,subtype:e.data("lm-subtype"),title:e.text()}),this.block.isNew()?(s=e.position(),this.original.style({position:"fixed",opacity:.5}).style({left:r.left,top:r.top,width:s.width,height:s.height}),this.element=this.dragdrop.element,this.dragdrop.element=this.original):(e.style({position:"fixed",zIndex:2500,opacity:.5,margin:0,width:Math.ceil(i.width),height:Math.ceil(i.height),left:r.left,top:r.top}).find("[data-lm-blocktype]"),"grid"!==this.block.getType()||(r=this.block.block.siblings(":not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)"))&&r.search("[data-lm-id]").style({"pointer-events":"none"}),this.placeholder.before(e),this.eraser.show()),"grid"===a&&(o=n.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&o.style({"pointer-events":"none"}),k.enable()},location:function(t,e,n){n=f(n),(this.block.isNew()?this.element:this.original).style({transform:"translate(0, 0)"}),this.placeholder||(this.placeholder=u("div.block.placeholder[data-lm-placeholder]").style({display:"none"}));var i=n.data("lm-blocktype"),r=this.block.getType();if(!i&&n.data("lm-root")&&(i="root"),!("page"!==this.mode&&"section"===i||"grid"===i&&(n.parent().data("lm-root")||"container"===n.parent().data("lm-blocktype")&&n.parent().parent().data("lm-root")))){var o=':not(.placeholder):not([data-lm-id="'+this.original.data("lm-id")+'"])',a={before:this.original.previousSiblings(o),after:this.original.nextSiblings(o)};if(a.before&&(a.before=f(a.before[0])),a.after&&(a.after=f(a.after[0])),!("block"===i&&(a.before===n&&"after"===e.x||a.after===n&&"before"===e.x)||"grid"===i&&(a.before===n&&"below"===e.y||a.after===n&&"above"===e.y))){var s,o=n.parent('[data-lm-blocktype="atoms"]'),a=this.block.block.find("[data-lm-id]");if("atom"==(a?a.data("lm-blocktype"):r)){if(!o)return}else if(o)return;switch(i){case"root":case"section":break;case"grid":var l=!n.children(":not(.placeholder)");if("grid"!==r&&!l)return;l?"grid"===r?this.placeholder.before(n):this.placeholder.bottom(n):(s="above"===e.y?"before":"after",this.placeholder[s](n));break;case"block":s="above"===e.y?"top":"bottom",s="other"===e.x?s:e.x,this.placeholder[s](n)}this.placeholder.removeClass("in-between").removeClass("in-between-grids").removeClass("in-between-grids-first").removeClass("in-between-grids-last"),this.placeholder.style({display:"block"})["block"!==i?"removeClass":"addClass"]("in-between"),"grid"===r&&"grid"===i&&(o=this.placeholder.nextSibling(),i=this.placeholder.previousSibling(),this.placeholder.addClass("in-between-grids"),i&&!i.data("lm-blocktype")&&this.placeholder.addClass("in-between-grids-first"),o&&o.data("lm-blocktype")||this.placeholder.addClass("in-between-grids-last"))}}},nolocation:function(t){(this.block.isNew()?this.element:this.original).style({transform:"translate(0, 0)"}),this.placeholder&&this.placeholder.remove(),this.block&&(t=t.type.match(/^touch/i)?document.elementFromPoint(t.touches.item(0).clientX,t.touches.item(0).clientY):t.target,this.block.isNew()||((t=f(t)).matches(this.eraser.element)||this.eraser.element.find(t)?(this.dragdrop.removeElement=!0,this.eraser.over()):(this.dragdrop.removeElement=!1,this.eraser.out())))},resize:function(t,e,n,i){this.resizer.start(t,e,n,i)},removeElement:function(t,e){this.dragdrop.removeElement=!1;e.animate({opacity:0},{duration:"150ms"});var n,e=f("[data-lm-root]");"grid"===this.block.getType()&&(n=e.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&n.style({"pointer-events":"inherit"});var i,r,o,a,s,l=this.block.block.siblings(":not(.original-placeholder)");l&&"block"==this.block.getType()&&(i=(u=this.block.getSize())/l.length,a=0,l.forEach(function(t,e){t=f(t),o=g(this.builder.map,t.data("lm-id")),e+1==l.length&&(s=o),r=v(o.getSize()+i,0),a+=r,o.setSize(r,!0)},this),100!=a&&s&&(u=s.getSize(),i=100-a,s.setSize(u+i,!0))),this.eraser.hide(),this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(c(function(t){f("body").off(t,this.dragdrop.bound("move"))},this)),this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(c(function(t){f("body").off(t,this.dragdrop.bound("deferStop"))},this)),this.builder.remove(this.block.getId());var u=this.block.block.search("[data-lm-id]");u&&u.length&&u.forEach(function(t){this.builder.remove(f(t).data("lm-id"))},this),this.block.block.remove(),this.placeholder&&this.placeholder.remove(),this.original&&this.original.remove(),this.element=this.block=null,k.disable(),k.cleanup(this.builder),this.history.push(this.builder.serialize(),this.history.get().preset),e.removeClass("moving")},stop:function(t,e){var n,i,r,o,a,s,l,u,c,d,h,p=f(this.dragdrop.lastOvered);p&&p.matches(this.eraser.element.find(".trash-zone"))?this.eraser.hide():("grid"!==this.block.getType()||(s=this.block.block.siblings(":not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)"))&&s.search("[data-lm-id]").style({"pointer-events":"inherit"}),this.block.isNew()||this.eraser.hide(),this.dragdrop.matched?(e=f(e),n=!1,i=this.block.isNew(),r=this.block.getType(),p=!!(o=e.data("lm-id"))&&(g(this.builder.map,o)?g(this.builder.map,o).getType():e.data("lm-blocktype")),(o=this.placeholder.parent())&&(e=o.data("lm-id"),o=!!g(this.builder.map,e||"")&&g(this.builder.map,e).getType(),e=!1,this.original.remove(),"block"!==r&&"grid"!==r&&("section"===p||"grid"===p||"block"===p&&"block"!==o)&&(a=new m.block({builder:this.builder}).adopt(this.block.block),o=new m[r]({id:this.block.block.data("lm-id"),type:r,subtype:this.element.data("lm-blocksubtype"),title:this.element.text(),builder:this.builder}).setLayout(this.block.block),a.setSize(),this.block=a,this.builder.add(a),this.builder.add(o),o.emit("rendered",o,a),a.emit("rendered",a,null),e={case:1}),"block"===this.originalType&&"block"===this.block.getType()&&(e={case:3},a=this.block.block.parent('[data-lm-blocktype="grid"]'),this.placeholder.parent('[data-lm-blocktype="grid"]')!==a&&(n={from:this.block.block.siblings(":not(.placeholder)"),to:this.placeholder.siblings(":not(.placeholder)")}),a=(a=a.find('!> [data-lm-blocktype="container"]')?a.parent():a).siblings(":not(.original-placeholder)"),!this.block.isNew()&&a.length&&this.resizer.evenResize(a),this.block.block.attribute("style",null),this.block.setSize()),"grid"!==r||s||(s=this.block.block.parent('[data-lm-blocktype="section"]').find(".fa-plus"))&&s.emit("click"),this.block.hasAttribute("size")&&"function"==typeof this.block.getSize&&this.block.setSize(this.placeholder.compute("flex")),this.block.insert(this.placeholder),this.placeholder.remove(),i&&(e&&this.resizer.evenResize(f([this.block.block,this.block.block.siblings()])),this.element.attribute("style",null)),(n.from||n.to&&n.to!=this.block.block)&&(l=this.block.getSize(),n.to||this.block.setSize(100,!0),n.from&&(c=l/n.from.length,d=0,n.from.forEach(function(t){t=f(t),u=g(this.builder.map,t.data("lm-id")),h=u.getSize()+c,u.setSize(h,!0),d+=h},this),100!==d&&(c=(100-d)/n.from.length,n.from.forEach(function(t){t=f(t),u=g(this.builder.map,t.data("lm-id")),h=u.getSize()+c,u.setSize(h,!0)},this))),n.to&&(l=100/(n.to.length+1),n.to.forEach(function(t){t=f(t),(u=g(this.builder.map,t.data("lm-id"))).setSize(l,!0)},this),this.block.setSize(l,!0))),k.disable(),k.cleanup(this.builder),this.history.push(this.builder.serialize(),this.history.get().preset))):this.placeholder&&this.placeholder.remove())},stopAnimation:function(t){var e,n,i=f("[data-lm-root]");i.removeClass("moving"),this.original&&this.original.remove(),k.disable(),this.block||(this.block=g(this.builder.map,t.data("lm-id"))),this.block&&"block"===this.block.getType()&&this.block.setSize(),this.block&&this.block.isNew()&&this.element&&this.element.attribute("style",null),"grid"===this.originalType&&(e=i.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&e.forEach(function(t){t=f(t),n=g(this.builder.map,t.data("lm-id")),t.attribute("style",null),n.setSize()},this)}});e.exports=r},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"../utils/flags-state":69,"./blocks":16,"./drag.resizer":25,"elements/zen":137,"mout/array/contains":166,"mout/array/every":169,"mout/collection/find":188,"mout/collection/forEach":189,"mout/function/bind":192,"mout/lang/deepEquals":201,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/number/enforcePrecision":222,"mout/object/get":233,"mout/object/keys":236,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],31:[function(t,e,n){"use strict";function i(){(o=g(".sidebar-block"))&&(a=o.find(".g5-lm-particles-picker"))&&(r=a.find("> .search"),s=a.find("> .particles-container"),l=window.innerHeight,p=a[c=u=0].getBoundingClientRect(),f=a.position().top,d=g("body.admin.com_gantry5 nav.navbar-fixed-top, #wpadminbar, #admin-main #titlebar, #admin-main .grav-update.grav"),h=g("body.admin.com_gantry5 #status"),d&&g(d).forEach(function(t){u+=t.offsetHeight}),h&&g(h).forEach(function(t){c+=t.offsetHeight}),s.style({"max-height":l-u-c-r[0].offsetHeight-30,overflow:"auto"}),s[0].scrollHeight!==s[0].offsetHeight&&s.addClass("has-scrollbar").style({"margin-right":-b()}))}var o,a,r,s,l,u,c,d,h,p,f,m=t("elements/domready"),g=t("elements"),v=t("../utils/decouple"),b=t("../utils/get-scrollbar-width");m(function(){i();function t(){var t,e,n,i,r;o&&a&&(i=this.scrollY||this.scrollTop,r=(t=o[0].getBoundingClientRect()).top+t.height,e=a[0].getBoundingClientRect(),n=i>p.top-u-10&&f-10<=i,i=e.height+10+u+parseInt(o.compute("padding-bottom"),10)>=r,r=t.height<=e.height,a.style("width",e.width),n&&!i?(a.removeClass("particles-absolute").addClass("particles-fixed"),a.style({top:u+10,bottom:"inherit"})):n&&i?(r||"grav"===GANTRY_PLATFORM&&t.bottom input[type="checkbox"]'):null)||p(t.data("override-target"));!e||t.disabled()||r&&!r.checked()||"radio"==n&&!t.checked()||(k(t)||a.push(t),o[e]=i)})}if(a.length)return n.disabled(!1),n.hideIndicator(),n.showIndicator("fa fa-fw fa-exclamation-triangle"),void b.error(E("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),E("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));"other"==s&&p(".settings-param-title, .card.settings-block > h4").hideIndicator(),d.emit("updateOriginalFields"),f("post",l,o,function(t,e){e.body.success?(v.close(),p("#styles")&&(r="
"+(e.body.warning?"
"+e.body.title+"
"+e.body.html:E("GANTRY5_PLATFORM_JS_CSS_COMPILED"))),b[e.body.warning?"warning":"success"](m(h,{verb:"s"==i.slice(-1)?"have":"has",type:i,extras:r}),i+" "+E("GANTRY5_PLATFORM_SAVED"))):v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),n.disabled(!1),n.hideIndicator(),n.forEach(function(t){p(t).lastSaved=new Date}),"layout"==s&&S.layoutmanager.updatePendingChanges(),x.set("pending",!1),x.emit("update:pending")})}),d.delegate("keydown","[data-title-edit]",function(t,e){var n=t.which||t.keyCode;32!=n&&13!=n||(t.preventDefault(),d.emit("click",t))}),d.delegate("click","[data-title-edit]",function(t,e){if((e=p(e)).hasClass("disabled"))return!1;var n=e.siblings("[data-title-editable]")||e.previousSiblings().find("[data-title-editable]")||e.nextSiblings().find("[data-title-editable]");if(!n)return!0;i=n[0],n.text(g(n.text())),n.attribute("contenteditable",!0),i.focus();var i,e=document.createRange();e.selectNodeContents(i),(i=window.getSelection()).removeAllRanges(),i.addRange(e),n.storedTitle=g(n.text()),n.titleEditCanceled=!1,n.emit("title-edit-start",n.storedTitle)}),d.delegate("keydown","[data-title-editable]",function(t,e){switch(e=p(e),t.keyCode){case 13:case 27:return t.stopPropagation(),27==t.keyCode&&void 0!==e.storedTitle&&(e.text(e.storedTitle),e.titleEditCanceled=!0),e.attribute("contenteditable",null),e[0].blur(),e.emit("title-edit-exit",e.data("title-editable"),13==t.keyCode?"enter":"esc"),!1;default:return!0}}),d.delegate("blur","[data-title-editable]",function(t,e){(e=p(e))[0].scrollLeft=0,e.attribute("contenteditable",null),e.data("title-editable",g(e.text())),window.getSelection().removeAllRanges(),e.emit("title-edit-end",e.data("title-editable"),e.storedTitle,e.titleEditCanceled)},!0),d.delegate("click","[data-ajax-action]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.attribute("href")||e.data("ajax-action"),t=e.data("ajax-action-method")||"post",i=p(e.data("ajax-action-indicator"))||e;if(!n)return!1;i.showIndicator(),f(t,y(n+w()),function(t,e){return e.body.success?(b[e.body.warning?"warning":"success"](e.body.html||"Action successfully completed.",e.body.title||""),void i.hideIndicator()):(v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),i.hideIndicator(),!1)})})});t={lm:S,mm:C,assingments:t("./assignments"),ui:t("./ui"),styles:t("./styles"),$:p,domready:t("elements/domready"),particles:t("./particles"),zen:t("elements/zen"),moofx:t("moofx"),atoms:t("./pagesettings"),tips:t("./ui/tooltips")};window.G5=t,e.exports=t},{"./assignments":3,"./changelog":4,"./configurations":6,"./fields":7,"./lm":28,"./menu":35,"./pagesettings":37,"./particles":43,"./positions":48,"./positions/cards":47,"./styles":49,"./ui":54,"./ui/popover":56,"./ui/tooltips":61,"./utils/ajaxify-links":62,"./utils/field-validation":68,"./utils/flags-state":69,"./utils/get-ajax-suffix":70,"./utils/get-ajax-url":71,"./utils/rAF-polyfill":76,"./utils/translate":78,agent:80,elements:113,"elements/attributes":108,"elements/delegation":110,"elements/domready":111,"elements/events":112,"elements/insertion":114,"elements/traversal":136,"elements/zen":137,moofx:138,"mout/queryString/setParam":249,"mout/string/interpolate":261,"mout/string/trim":272}],33:[function(t,e,n){"use strict";var i=t("../ui/drag.events"),r=t("prime"),o=(t("prime/emitter"),t("prime-util/prime/bound")),a=t("prime-util/prime/options"),s=t("mout/function/bind"),l=t("mout/lang/isString"),c=t("mout/math/map"),d=t("mout/math/clamp"),h=t("mout/number/enforcePrecision"),u=t("mout/object/get"),p=t("../utils/elements.utils");t("elements/events"),t("elements/delegation");i=new r({mixin:[o,a],DRAG_EVENTS:i,options:{minSize:5},constructor:function(t,e,n){this.setOptions(e),this.history=this.options.history||{},this.builder=this.options.builder||{},this.map=this.builder.map,this.menumanager=n,this.origin={x:0,y:0,transform:null,offset:{x:0,y:0}}},getBlock:function(t){return u(this.map,l(t)?t:p(t).data("lm-id")||"")},getAttribute:function(t,e){return this.getBlock(t).getAttribute(e)},getSize:function(t){t=((t=p(t)).matches("[data-mm-id]")?t:t.parent("[data-mm-id]")).find(".percentage input");return Number(t.value())},setSize:function(t,e,n){n=void 0!==n&&n;var i=(t=p(t)).matches("[data-mm-id]")?t:t.parent("[data-mm-id]"),t=i.find(".percentage input");i[n?"animate":"style"]({flex:"0 1 "+e+"%"}),t.value(h(e,1))},start:function(t,e,n,i){if(t&&t.type.match(/^touch/i)&&t.preventDefault(),t.which&&1!==t.which)return!0;t.preventDefault(),this.element=p(e);e=this.element.parent(".submenu-selector");if(!e)return!1;e.addClass("moving"),this.siblings={occupied:0,elements:n,next:this.element.parent("[data-mm-id]").nextSibling().find("> .submenu-column"),prevs:this.element.parent("[data-mm-id]").previousSiblings(),sizeBefore:0},1 [data-mm-id]:first-child")[0].getBoundingClientRect().left,this.origin.offset.parentRect.right=this.element.parent(".submenu-selector").find("> [data-mm-id]:last-child")[0].getBoundingClientRect().right,this.DRAG_EVENTS.EVENTS.MOVE.forEach(s(function(t){p(document).on(t,this.bound("move"))},this)),this.DRAG_EVENTS.EVENTS.STOP.forEach(s(function(t){p(document).on(t,this.bound("stop"))},this))},move:function(t){t&&t.type.match(/^touch/i)&&t.preventDefault();var e=t.clientX||t.touches[0].clientX||0,n=t.clientY||t.touches[0].clientY||0,i=this.origin.offset.parentRect,r=(this.lastX||e)-e,t=(this.lastY||n)-n;this.direction=(Math.abs(r)>Math.abs(t)&&0Math.abs(t)&&r<0&&"right")||Math.abs(t)>Math.abs(r)&&0 [data-mm-id]"),i=[],e=p(".menu-selector .active"),e=e?e.data("mm-id"):null;return n.forEach(function(t){i.push(this.getSize(t))},this),this.menumanager.items[e].columns=i,this.updateMaxValues(t),i},updateMaxValues:function(t){var n,i,e=this.element?this.element.parent(".submenu-selector"):null;if(!e&&!t)return!1;(t||e.search("> [data-mm-id]")).forEach(function(t){var e=(t=p(t)).nextSibling()||t.previousSibling();e&&(i={block:t.find("input.column-pc"),sibling:e.find("input.column-pc")},(n={current:this.getSize(t),sibling:this.getSize(e)}).total=n.current+n.sibling,i.block.attribute("max",n.total-Number(i.block.attribute("min"))),i.sibling.attribute("max",n.total-Number(i.sibling.attribute("min"))))},this)},evenResize:function(t,e){var n=t.length,i=h(100/n,4);t.forEach(function(t){t=p(t),this.setSize(t,i,void 0!==e&&e)},this),this.updateItemSizes(t),this.menumanager.emit("dragEnd",this.menumanager.map,"evenResize")}});e.exports=i},{"../ui/drag.events":52,"../utils/elements.utils":66,"elements/delegation":110,"elements/events":112,"mout/function/bind":192,"mout/lang/isString":211,"mout/math/clamp":216,"mout/math/map":218,"mout/number/enforcePrecision":222,"mout/object/get":233,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],34:[function(t,e,n){"use strict";function h(t,e){for(var n="",i=0,r="a"==(e=e&&e.toLowerCase())?10:0,o="n"==e?10:62;i++ ul").appendChild(o.children()),S.serialize(l),S.updatePendingChanges(),v.success(k("GANTRY5_PLATFORM_JS_POSITIONS_SETTINGS_APPLIED"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))}else g.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}});g.close(),u.hideIndicator(),C(n)})})})})}),e.exports=function(t,e){var n;this.isNewParticle&&"reorder"!==e||(this.resizer.updateItemSizes(),T=this,n=p("[data-save]"),e={settings:this.settings,ordering:this.ordering,items:this.items},this.isNewParticle||(a(t,e)?(n.hideIndicator(),r.set("pending",!1)):(n.showIndicator("far fa-fw changes-indicator fa-circle"),r.set("pending",!0))),this.isParticle&&this.isNewParticle&&(n=this.block.data("mm-blocktype"),this.block.attribute("data-mm-blocktype",null).addClass("g-menu-item-"+n).data("mm-original-type",n),f("span.menu-item-type.badge").text(n).after(this.block.find(".menu-item .title")),g.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",remote:w(p(this.block).find(".config-cog").attribute("href")+x()),remoteLoaded:function(t,e){var n=e.elements.content.find(".search input"),i=e.elements.content.search("[data-mm-type]"),r=e.elements.content.search("[data-mm-filter]");n&&r&&i&&(n.on("input",function(){var e,n;this.value()?(i.addClass("hidden"),e=[],n=this.value().toLowerCase(),r.forEach(function(t){t=p(t),o(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&p(e).removeClass("hidden")):i.removeClass("hidden")}),setTimeout(function(){n[0].focus()},5))}})),this.type=void 0)}},{"../fields/submit":9,"../positions/cards":47,"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"../utils/wp-widgets-customizer":79,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/lang/deepEquals":201,"mout/string/trim":272}],35:[function(t,e,n){"use strict";var h,i=t("elements/domready"),r=t("./menumanager"),p=t("../fields/submit"),f=t("elements"),m=t("elements/zen"),g=t("../ui").modal,v=t("../ui").toastr,o=t("./extra-items"),b=t("agent"),y=t("mout/string/trim"),a=t("mout/math/clamp"),s=t("mout/array/contains"),l=t("mout/array/indexOf"),w=t("../utils/get-ajax-url").parse,x=t("../utils/get-ajax-suffix"),k=t("../utils/translate"),t=-1 section ul li, .submenu-column, .submenu-column li[data-mm-id], .column-container .g-block",droppables:"#menu-editor [data-mm-id]",exclude:"[data-lm-nodrag], .menu-item-back, .fa-cog, .config-cog",resize_handles:".submenu-column:not(:last-child)",catchClick:!0})).on("dragEnd",o),(e.exports.menumanager=h).setRoot(),d.delegate("statechangeAfter","#main-header [data-g5-ajaxify], select.menu-select-wrap",function(){h.setRoot(),h.refresh(),h.eraser&&(h.eraser.element=f("[data-mm-eraseparticle]"),h.eraser.hide())}),d.delegate(u,".percentage input",function(t,e){(e=f(e)).currentSize=Number(e.value()),e[0].focus(),e[0].select()},!0),d.delegate("keydown",".percentage input",function(t){s([46,8,9,27,13,110,190],t.keyCode)||65==t.keyCode&&(!0===t.ctrlKey||!0===t.ctrlKey)||82==t.keyCode&&(!0===t.ctrlKey||!0===t.metaKey)||35<=t.keyCode&&t.keyCode<=40||(t.shiftKey||t.keyCode<48||57 [data-mm-id]")),h.emit("dragEnd",h.map,"inputChange"))}),d.delegate(c,".percentage input",function(t,e){e=f(e);var n=Number(e.value());(nNumber(e.attribute("max")))&&e.value(e.currentSize)},!0),d.delegate("click",".add-column",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=(e=f(e)).parent("[data-g5-menu-columns]").find(".submenu-selector"),i=n.children(),t=n.find("> :last-child"),e=i?i.length:0,n=f(".menu-selector .active"),n=n?n.data("mm-id"):null;if(1==e&&!i.search(".submenu-items > [data-mm-id]"))return!1;i=f(t[0].cloneNode(!0));i.data("mm-id","list-"+e),i.find(".submenu-items").empty(),i.find("[data-mm-base-level]").data("mm-base-level",1),i.find(".submenu-level").text("Level 1"),i.after(t),h.ordering[n]||(h.ordering[n]=[[]]),h.ordering[n].push([]),h.resizer.evenResize(f(".submenu-selector > [data-mm-id]"))}),["click","touchend"].forEach(function(t){d.delegate(t,"[data-g5-menu-columns] .submenu-items:empty",function(t,e){var n=e[0].getBoundingClientRect(),i=t.pageX||t.changedTouches[0].pageX||0,r=t.pageY||t.changedTouches[0].pageY||0,o=36,a=36;if((t=f(".submenu-selector > [data-mm-id]")).length<=1)return!1;i>=n.left+n.width-o&&i<=n.left+n.width&&Math.abs(window.scrollY-r)-n.top [data-mm-id]"),h.ordering[a].splice(e,1),h.resizer.evenResize(t))})}),d.delegate("click","#menu-editor .config-cog, #menu-editor .global-menu-settings",function(t,u){t.preventDefault();var t={},c=u.hasClass("global-menu-settings");c?t.settings=JSON.stringify(h.settings):t.item=JSON.stringify(h.items[u.parent("[data-mm-id]").data("mm-id")]),g.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",data:t,overlayClickToClose:!1,remote:w(f(u).attribute("href")+x()),remoteLoaded:function(t,e){if(t.body.success){var o,n=e.elements.content.find("form"),i=m("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),a=e.elements.content.find(".search input"),s=e.elements.content.search("[data-mm-type]"),l=e.elements.content.search("[data-mm-filter]"),t=e.elements.content.find(".g-urltemplate");t&&d.emit("input",{target:t});t=e.elements.content.find("[data-title-editable]");if(t&&t.on("title-edit-end",function(t,e){if(!(t=y(t)))return t=y(e)||"Title",this.text(t).data("title-editable",t),!0}),a&&l&&s&&a.on("input",function(){var e,n;this.value()?(s.addClass("hidden"),e=[],n=this.value().toLowerCase(),l.forEach(function(t){t=f(t),y(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&f(e).removeClass("hidden")):s.removeClass("hidden")}),a&&setTimeout(function(){a[0].focus()},5),!n&&!i||!r)return!0;r.on("click",function(t){t.preventDefault();var r=f(t.currentTarget);r.disabled(!0),r.hideIndicator(),r.showIndicator();t=p(i[0].elements,e.elements.content,{isRoot:c});if(t.invalid.length)return r.disabled(!1),r.hideIndicator(),r.showIndicator("fa fa-fw fa-exclamation-triangle"),void v.error(k("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),k("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));b(i.attribute("method"),w(i.attribute("action")+x()),t.valid.join("&"),function(t,e){var n,i;e.body.success?(e.body.path||e.body.item&&"particle"==e.body.item.type?(o=e.body.path||u.parent("[data-mm-id]").data("mm-id"),h.items[o]=e.body.item):e.body.item&&"particle"==e.body.item.type||(h.settings=e.body.settings),!e.body.html||(n=u.parent("[data-mm-id]"))&&(i=e.body.item.enabled||e.body.item.options.particle.enabled,n.html(e.body.html),n["0"==i?"addClass":"removeClass"]("g-menu-item-disabled")),h.emit("dragEnd",h.map),null===r.data("apply-and-save")||(i=f("body").find(".button-save"))&&d.emit("click",{target:i}),g.close(),v.success(k("GANTRY5_PLATFORM_JS_MENU_SETTINGS_APPLIED"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):g.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),r.hideIndicator()})})}else g.enableCloseByOverlay()}})})}),e.exports={menumanager:h}},{"../fields/submit":9,"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"./extra-items":34,"./menumanager":36,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/array/indexOf":175,"mout/math/clamp":216,"mout/string/trim":272}],36:[function(t,e,n){"use strict";var i=t("prime"),d=t("../utils/elements.utils"),r=t("mout/function/bind"),l=t("elements/zen"),o=t("prime/emitter"),a=t("prime-util/prime/bound"),s=t("prime-util/prime/options"),u=t("../ui/drag.drop"),c=t("../ui/eraser"),h=t("./drag.resizer"),p=(t("mout/object/get"),t("mout/string/ltrim")),f=(t("mout/array/every"),t("mout/array/last")),m=t("mout/array/indexOf"),g=(t("mout/lang/isArray"),t("mout/lang/isObject"),t("mout/lang/deepClone")),o=(t("mout/object/equals"),new i({mixin:[a,s],inherits:o,options:{},constructor:function(t,e){this.setOptions(e),this.refElement=t,this.map={},t&&d(t)&&this.init(t)},init:function(){this.setRoot(),this.dragdrop=new u(this.refElement,this.options,this),this.resizer=new h(this.refElement,this.options,this),this.eraser=new c("[data-mm-eraseparticle]",this.options),this.dragdrop.on("dragdrop:click",this.bound("click")).on("dragdrop:start",this.bound("start")).on("dragdrop:move:once",this.bound("moveOnce")).on("dragdrop:location",this.bound("location")).on("dragdrop:nolocation",this.bound("nolocation")).on("dragdrop:resize",this.bound("resize")).on("dragdrop:stop:erase",this.bound("removeElement")).on("dragdrop:stop",this.bound("stop")).on("dragdrop:stop:animation",this.bound("stopAnimation"))},refresh:function(){this.refElement&&d(this.refElement)&&this.init()},setRoot:function(){var t,e;this.root=d("#menu-editor"),this.root&&(this.settings=JSON.parse(this.root.data("menu-settings")),this.ordering=JSON.parse(this.root.data("menu-ordering")),this.items=JSON.parse(this.root.data("menu-items")),this.map={settings:g(this.settings),ordering:g(this.ordering),items:g(this.items)},t=d("[data-g5-menu-columns] .submenu-selector"),this.resizer&&t&&(e=t.search("> [data-mm-id]"))&&this.resizer.updateMaxValues(e))},click:function(t,e){t=d(t.target);if(t.matches(".g-menu-addblock")||t.parent(".g-menu-addblock"))return!1;if(e.hasClass("g-block"))return this.stopAnimation(),!0;e.find("[data-g5-ajaxify]")&&(t=e.siblings(),e.addClass("active"),t&&t.removeClass("active")),e.emit("click");e=e.find("a");e&&e[0].click()},resize:function(t,e,n,i){this.resizer.start(t,e,n,i)},start:function(t,e){var n=e.parent(".menu-selector")||e.parent(".submenu-column")||e.parent(".submenu-selector")||e.parent(".g5-mm-particles-picker"),i=d(e).position(),r=d(e)[0].getBoundingClientRect();this.block=null,this.targetLevel=void 0,this.addNewItem=!1,this.type=e.parent(".g-toplevel")||e.matches(".g-toplevel")?"main":e.matches(".g-block")?"column":"columns_items",this.isParticle=e.matches("[data-mm-blocktype]")||e.matches("[data-mm-original-type]"),this.wasActive=e.hasClass("active"),this.isNewParticle=e.parent(".g5-mm-particles-picker"),this.ParticleIndex=-1,this.root=n,this.Element=e,this.itemID=e.data("mm-id"),this.itemLevel=e.data("mm-level"),this.itemFrom=e.parent("[data-mm-id]"),this.itemTo=null,this.isParticle&&!this.isNewParticle&&(a=e.parent().children("[data-mm-id]"),this.ParticleIndex=m(a,e[0])),n.addClass("moving");var o=d(e).data("mm-id"),a=e[0].cloneNode(!0);this.placeholder||(this.placeholder=l(("column"==this.type?"div":"li")+".block.placeholder[data-mm-placeholder]")),this.placeholder.style({display:"none"}),this.original=d(a).after(e).style({display:"inline-block",opacity:1}).addClass("original-placeholder").data("lm-dropzone",null),this.originalType=o,this.block=e,this.isNewParticle?(o=e.position(),this.original.style({position:"fixed",opacity:.5}).style({left:r.left,top:r.top,width:o.width,height:o.height}),this.element=this.dragdrop.element,this.block=this.dragdrop.element,this.dragdrop.element=this.original):(e.style({position:"fixed",zIndex:1500,width:Math.ceil(i.width),height:Math.ceil(i.height),left:r.left,top:r.top}).addClass("active"),this.placeholder.before(e)),"column"==this.type&&n.search(".g-block > *").style({"pointer-events":"none"})},moveOnce:function(t){t=d(t),this.original&&this.original.style({opacity:.5}),this.isNewParticle||!t.hasClass("g-menu-removable")&&!this.isParticle||this.eraser.show()},location:function(t,e,n){n=d(n),(this.isNewParticle?this.block:this.original).style({transform:"translate(0, 0)"}),this.placeholder||(this.placeholder=l(("column"==this.type?"div":"li")+".block.placeholder[data-mm-placeholder]").style({display:"none"}));var i=n.parent(".g-toplevel")||n.matches(".g-toplevel")?"main":n.matches(".g-block")?"column":"columns_items",r=n.data("mm-level"),o=this.block.data("mm-level");if(!this.isParticle||"main"!=i||r){if(null===r&&"columns_items"===this.type&&this.isParticle&&this.isNewParticle)return(a=n.find(".submenu-items"))?(this.placeholder.style({display:"block"}).bottom(a),this.addNewItem=a,this.targetLevel=2,void(this.dragdrop.matched=!1)):void(this.dragdrop.matched=!1);if(null===r&&("columns_items"===this.type||this.isParticle)){var a,s=(a=n.find(".submenu-items")).data("mm-base-level");return!n.hasClass("g-block")||n.find(this.block)||!this.isParticle&&o!=s&&(!a||a.children()||2 *").style({"pointer-events":"none"}),this.eraser.hide(),this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(r(function(t){d("body").off(t,this.dragdrop.bound("move"))},this)),this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(r(function(t){d("body").off(t,this.dragdrop.bound("deferStop"))},this));var n=this.block,i=n.parent("[data-mm-base]").data("mm-base"),e=(n.parent("[data-mm-id]").data("mm-id").match(/\d+$/)||[0])[0],n=m(n.parent().children("[data-mm-id]:not(.original-placeholder)"),n[0]);delete this.items[this.itemID],this.ordering[i][e].splice(n,1),this.block.remove(),this.original.remove(),this.root.removeClass("moving"),this.root.find(".submenu-items")&&(this.root.find(".submenu-items").children()||this.root.find(".submenu-items").text("")),this.emit("dragEnd",this.map,"reorder")},stop:function(t,e,n){e=d(e);var i=d(this.dragdrop.lastOvered);if(i&&i.matches(this.eraser.element.find(".trash-zone")))this.eraser.hide();else{if(e&&n.removeClass("active"),"column"==this.type&&this.root.search(".g-block > *").attribute("style",null),!this.dragdrop.matched&&!this.addNewItem)return this.placeholder&&this.placeholder.remove(),this.type=void 0,this.targetLevel=!1,this.isParticle=void 0,void this.eraser.hide();if(!this.placeholder.parent())return this.type=void 0,this.targetLevel=!1,void(this.isParticle=void 0);this.addNewItem&&this.block.attribute("style",null).removeClass("active");i=this.block.parent();this.eraser.hide(),this.original&&(this.isNewParticle?this.original.attribute("style",null).removeClass("original-placeholder"):this.original.remove()),this.block.after(this.placeholder),this.placeholder.remove(),this.itemTo=this.block.parent("[data-mm-id]"),this.currentLevel=this.itemLevel,this.wasActive&&n.addClass("active"),this.isParticle&&(a=f(this.itemID.split("/")),o=(e||this.itemTo)[e&&!e.hasClass("g-block")?"parent":"find"]("[data-mm-base]").data("mm-base"),this.itemID=o?o+"/"+a:a,this.itemLevel=this.targetLevel,this.block.data("mm-id",this.itemID).data("mm-level",this.targetLevel));var r,o,a,s,l,u,c=this.itemID.split("/");c.splice(this.itemLevel-1),c=c.join("/"),(this.itemFrom||this.itemTo)&&((this.itemFrom==this.itemTo?[this.itemFrom]:[this.itemFrom,this.itemTo]).forEach(function(t){t&&(u=t.search("[data-mm-id]"),r=Number(2 [data-mm-id]")).forEach(function(t,e){var n=(t=d(t)).data("mm-id"),i=Number((n.match(/\d+$/)||[0])[0]);t.data("mm-id",n.replace(/\d+$/,""+e)),s.push(this.ordering[l][i])},this),this.ordering[l]=s),i.children()||i.empty();i=this.block.parent(".submenu-selector");i&&this.resizer.updateItemSizes(i.search("> [data-mm-id]")),this.emit("dragEnd",this.map,"reorder")}},stopAnimation:function(){var t=null;"column"==this.type&&(t=this.resizer.getSize(this.block)),this.root&&this.root.removeClass("moving"),this.block&&(this.block.attribute("style",null),t&&this.block.style("flex","0 1 "+t+" %")),this.original&&(this.isNewParticle&&(this.dragdrop.matched||this.targetLevel)?this.original.attribute("style",null).removeClass("original-placeholder"):this.original.remove()),!this.wasActive&&this.block&&this.block.removeClass("active")}}));e.exports=o},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"./drag.resizer":33,"elements/zen":137,"mout/array/every":169,"mout/array/indexOf":175,"mout/array/last":179,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/object/equals":227,"mout/object/get":233,"mout/string/ltrim":263,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],37:[function(i,l,t){!function(S){!function(){"use strict";function n(t){t&&(t.SimpleSort||s.createSortables(t))}var d=i("elements"),t=i("elements/domready"),h=i("elements/zen"),p=i("../fields/submit"),f=i("../ui").modal,m=i("../ui").toastr,e=i("../ui/eraser"),g=i("agent"),v=i("mout/array/indexOf"),r=i("sortablejs"),b=(i("mout/string/trim"),i("mout/object/size")),y=i("../utils/get-ajax-url").parse,w=i("../utils/get-ajax-suffix"),x=i("../utils/get-outline").getOutlineNameById,k=i("../utils/translate"),a='[name="page[head][atoms][_json]"]',o=[{name:"atoms",pull:"clone",put:!1},{name:"atoms",pull:!0,put:!0},{name:"atoms",pull:!1,put:!1}],s={eraser:null,lists:{picker:null,items:null},serialize:function(){var e=[],t=d(".atoms-list"),n=t.search("[data-atom-picked]");return n?(n.forEach(function(t){t=d(t),e.push(JSON.parse(t.data("atom-picked")))}),JSON.stringify(e).replace(/\//g,"\\/")):(t.empty(),"[]")},attachEraser:function(){s.eraser?s.eraser.element=d("[data-atoms-erase]"):s.eraser=new e("[data-atoms-erase]")},createSortables:function(n){var i;s.attachEraser(),o.forEach(function(t,e){i=d(e?1==e?".atoms-list":"#trash":".atoms-picker"),i=r.create(i[0],{sort:1==e,filter:"[data-atom-ignore]",group:t,scroll:!1,forceFallback:!0,animation:100,onStart:function(t){s.attachEraser(),d(t.item).addClass("atom-dragging"),d(t.from).hasClass("atoms-list")&&s.eraser.show()},onEnd:function(t){var e,n=d(t.item),i=d("#trash"),r=d(this.originalEvent.target),o=!1;if("touchend"===this.originalEvent.type&&(e=i[0].getBoundingClientRect(),o=((i=this.originalEvent).pageY||i.changedTouches[0].pageY)-window.scrollY<=e.height),r.matches("#trash")||r.parent("#trash")||o)return n.remove(),s.eraser.hide(),void this.options.onSort();n.removeClass("atom-dragging"),d(t.from).hasClass("atoms-list")&&s.eraser.hide()},onSort:function(){var t=s.serialize(),e=d(a);if(!e)throw new Error('Field "'+a+'" not found in the DOM.');e.value(t),d("body").emit("change",{target:e})},onOver:function(t){d(t.from).matches(".atoms-list")&&((t=d(t.newIndex)).matches("#trash")||t.parent("#trash")?s.eraser.over():s.eraser.out())}}),s.lists[e?"items":"picker"]=i,1==e&&(n.SimpleSort=i)})}};t(function(){var c,t=d("#atoms");d("body").delegate("mouseover","#atoms",function(t,e){n(e)}),n(t),(c=d("body")).delegate("click",".atoms-list [data-atom-picked] .config-cog",function(t,e){t&&t.preventDefault&&t.preventDefault();var t=e.parent("ul"),s=d(a),o=s.value(),l=t.search("> [data-atom-picked]"),u=e.parent("[data-atom-picked]"),t=u.data("atom-picked");f.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",data:{data:t},overlayClickToClose:!1,remote:y(e.attribute("href")+w()),remoteLoaded:function(t,e){var n=e.elements.content.find("form"),i=h("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),a=JSON.parse(o);if(1"+n+"")+"
ID: "+i+"
Replace: "+r)),c.emit("change",{target:s}),S.G5.tips.reload(),null===o.data("apply-and-save")||(r=d("body").find(".button-save"))&&c.emit("click",{target:r}),f.close(),m.success(k("GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED","Atom"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):f.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),o.hideIndicator()})})}})})}),l.exports=s}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../fields/submit":9,"../ui":54,"../ui/eraser":53,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/get-outline":72,"../utils/translate":78,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/object/size":242,"mout/string/trim":272,sortablejs:316}],38:[function(t,e,n){"use strict";var i=t("elements/domready"),h=t("elements"),p=t("elements/zen"),f=t("../../fields/submit"),m=t("../../ui").modal,g=t("../../ui").toastr,v=t("agent"),l=t("mout/array/last"),b=t("mout/array/indexOf"),r=t("sortablejs"),u=t("mout/string/trim"),y=t("../../utils/get-ajax-url").parse,w=t("../../utils/get-ajax-suffix"),x=t("../../utils/translate");t("elements/insertion"),i(function(){function s(t,e){"enter"==e&&this.CollectionNew&&(this.CollectionNew=!1,d.emit("click",{target:this.parent(".settings-param").find("[data-collection-addnew]")})),"esc"==e&&this.CollectionNew&&(this.CollectionNew=!1,d.emit("click",{target:this.parent("[data-collection-item]").find("[data-collection-remove]")}))}function n(t){(t=t||h(".collection-list ul"))&&t.forEach(function(t){(t=h(t)).SimpleSort=r.create(t[0],{handle:".fa-reorder",filter:"[data-collection-nosort]",scroll:!1,animation:150,onStart:function(){h(this.el).addClass("collection-sorting")},onEnd:function(t){var e,n=h(this.el);n.removeClass("collection-sorting"),t.oldIndex!==t.newIndex&&(n=(e=n.parent(".settings-param").find("[data-collection-data]")).value(),(n=JSON.parse(n)).splice(t.newIndex,0,n.splice(t.oldIndex,1)[0]),e.value(JSON.stringify(n)),d.emit("change",{target:e}))}})})}var d=h("body");n(),d.delegate("mouseover",".collection-list ul",function(t,e){e.SimpleSort||n(e)}),d.delegate("click","[data-collection-addnew]",function(t,e){var n=e.parent(".settings-param"),i=n.find("ul"),r=i.parent("[data-field-name]").find("[data-collection-editall]"),o=n.find("[data-collection-data]"),a=n.find("[data-collection-template]"),e=i.search("> [data-collection-item]")||[],n=h(l(e)),a=h(a[0].cloneNode(!0));n?a.after(n):a.top(i),e.length&&r&&r.style("display","inline-block");i=(n=a.find("a")).find("[data-title-editable]"),r=new RegExp("%id%","g");n.href(n.href().replace(r,e.length)),a.attribute("style",null).data("collection-item",a.data("collection-template")),a.attribute("data-collection-template",null),a.attribute("data-collection-nosort",null),i.CollectionNew=!0,d.emit("click",{target:n.siblings("[data-title-edit]")}),i.on("title-edit-exit",s),d.emit("change",{target:o})}),d.delegate("blur","[data-collection-item] [data-title-editable]",function(t,e){var n=u(e.text()),i=e.parent("[data-collection-item]"),r=i.data("collection-item"),o=e.parent("ul").search("> [data-collection-item]"),a=e.parent(".settings-param").find("[data-collection-data]"),e=a.value(),i=b(o,i[0]);-1!=i&&((e=JSON.parse(e))[i]||e.splice(i,0,{}),e[i][r]=n,a.value(JSON.stringify(e)),d.emit("change",{target:a}))},!0),d.delegate("click","[data-collection-remove]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.parent("[data-collection-item]"),i=e.parent("ul"),r=i.parent("[data-field-name]").find("[data-collection-editall]"),o=i.search("> [data-collection-item]"),t=b(o,n[0]),i=e.parent(".settings-param").find("[data-collection-data]"),e=i.value();(e=JSON.parse(e)).splice(t,1),i.value(JSON.stringify(e)),n.remove(),o.length<=2&&r&&r.style("display","none"),d.emit("change",{target:i})}),d.delegate("click","[data-collection-duplicate]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.parent(".settings-param"),i=e.parent("[data-collection-item]"),r=e.parent("ul"),o=r.parent("[data-field-name]").find("[data-collection-editall]"),a=n.find("[data-collection-template]").find("a").href(),s=r.search("> [data-collection-item]"),t=b(s,i[0]),n=h(i[0].cloneNode(!0)).after(i),r=e.parent(".settings-param").find("[data-collection-data]"),i=r.value(),e=new RegExp("%id%","g");n.find("a").href(a.replace(e,s.length+1)),(i=JSON.parse(i)).splice(t,0,i[t]),r.value(JSON.stringify(i)),1<=s.length&&o.style("display","inline-block"),d.emit("change",{target:r})}),d.delegate("click","[data-collection-item] a",function(t,e){e.find("[contenteditable]")&&(t.preventDefault(),t.stopPropagation())}),d.delegate("click","[data-collection-item] .config-cog, [data-collection-editall]",function(t,a){t&&t.preventDefault&&t.preventDefault();var e=a.find("[data-title-editable]");if(e&&e.attribute("contenteditable"))return t.stopPropagation(),!1;var e=null!==a.data("collection-editall"),t=a.parent(".settings-param"),s=t.find("[data-collection-data]"),l=s.value(),u=a.parent("[data-collection-item]"),c=t.search("ul > [data-collection-item]"),t={data:e?l:JSON.stringify(JSON.parse(l)[b(c,u[0])])};m.open({content:x("GANTRY5_PLATFORM_JS_LOADING"),method:"post",className:"g5-dialog-theme-default g5-modal-collection g5-modal-collection-"+(e?"editall":"single"),data:t,overlayClickToClose:!1,remote:y(a.attribute("href")+w()),remoteLoaded:function(t,e){if(t.body.success){var n=e.elements.content.find("form"),r=p("div").html(t.body.html).find("form"),i=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),o=JSON.parse(l);if(1 [data-collection-item]").forEach(function(t,e){var n=(t=h(t)).find("[data-title-editable]"),t=o[e][t.data("collection-item")];n.data("title-editable",t).text(t)}),null===i.data("apply-and-save")||(n=h("body").find(".button-save"))&&d.emit("click",{target:n}),m.close(),g.success(x("GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED","Collection"),x("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):m.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),i.hideIndicator()})})}else m.enableCloseByOverlay()}})})}),e.exports={}},{"../../fields/submit":9,"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,elements:113,"elements/domready":111,"elements/insertion":114,"elements/zen":137,"mout/array/indexOf":175,"mout/array/last":179,"mout/string/trim":272,sortablejs:316}],39:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime/emitter"),o=t("prime-util/prime/bound"),a=t("prime-util/prime/options"),h=t("elements"),s=t("elements/domready"),l=t("elements/zen"),u=t("../../ui/drag.events"),c=t("mout/collection/forEach"),d=t("mout/function/bind"),b=t("mout/math/clamp"),t=-1r.width&&(s=r.width),(l=l<0?0:l)>r.height&&(l=r.height),t.parent(".cp-mode-wheel")&&i.parent(".cp-grid")&&(a=75-s,e=75-l,r=Math.sqrt(a*a+e*e),(a=Math.atan2(e,a))<0&&(a+=2*Math.PI),75 div",d(function(t,e){if(e==this.tabs.transparent){this.opacity=0;var n=this.opacitySlider.position().height;return this.opacitySlider.find(".cp-picker").style({top:b(n-n*this.opacity,0,n)}),void this.move(this.opacitySlider,{manualOpacity:!0})}var i=o.find(".active"),r=i.attribute("class").replace(/\s|active|cp-tab-/g,""),n=e.attribute("class").replace(/\s|active|cp-tab-/g,"");this.wrapper.removeClass("cp-mode-"+r).addClass("cp-mode-"+n),i.removeClass("active"),e.addClass("active"),this.mode=n,this.updateFromInput()},this))},this)),this.wrapper.bottom("#g5-container"),this.built=!0,this.mode="hue"},updateFromInput:function(t,e){var n,i,r=(o=(e=h(e)||this.element).value()).replace(/\s/g,"").match(/^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/),o=w(o)||o,r=r?b(r[1],0,1):1;if((n=y(o))||(n="#ffffff"),i=k(n),this.built){this.opacity=Math.max(r,0);var a=this.opacitySlider.position().height;this.opacitySlider.find(".cp-picker").style({top:b(a-a*this.opacity,0,a)});var s,l,u,c=this.grid.position().height,d=this.grid.position().width,a=this.slider.position().height;switch(this.mode){case"wheel":u=b(Math.ceil(.75*i.s),0,c/2),s=i.h*Math.PI/180,l=b(75-Math.cos(s)*u,0,d),u=b(75-Math.sin(s)*u,0,c),this.grid.style({backgroundColor:"transparent"}).find(".cp-picker").style({top:u,left:l}),u=150-i.b/(100/c),""===n&&(u=0),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:i.s,b:100})});break;case"saturation":l=b(5*i.h/12,0,150),u=b(c-Math.ceil(i.b/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.s*(a/100),0,a),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:100,b:i.b})}),this.grid.find(".cp-grid-inner").style({opacity:i.s/100});break;case"brightness":l=b(5*i.h/12,0,150),u=b(c-Math.ceil(i.s/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.b*(a/100),0,a),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:i.s,b:100})}),this.grid.find(".cp-grid-inner").style({opacity:1-i.b/100});break;default:l=b(Math.ceil(i.s/(100/d)),0,d),u=b(c-Math.ceil(i.b/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.h/(360/a),0,a),this.slider.find(".cp-picker").style({top:u}),this.grid.style({backgroundColor:x({h:i.h,s:100,b:100})})}}t||e.value(this.getValue(n)),this.emit("change",e,n,r)},updateFromPicker:function(t,e){var n,i,r,o,a=function(t,e){var n,i;return t.length&&e?(n=t[0].getBoundingClientRect().left,i=t[0].getBoundingClientRect().top,{x:n-e[0].getBoundingClientRect().left+t[0].offsetWidth/2,y:i-e[0].getBoundingClientRect().top+t[0].offsetHeight/2}):null},s=this.wrapper.find(".cp-grid"),l=this.wrapper.find(".cp-slider"),u=this.wrapper.find(".cp-opacity-slider"),c=s.find(".cp-picker"),d=l.find(".cp-picker"),h=u.find(".cp-picker"),p=a(c,s),f=a(d,l),a=a(h,u),m=s[0].getBoundingClientRect().width,g=s[0].getBoundingClientRect().height,v=l[0].getBoundingClientRect().height,h=u[0].getBoundingClientRect().height,u=this.element.value(),u=w(u)||u;if((n=y(u))||(n="#ffffff"),e.hasClass("cp-grid")||e.hasClass("cp-slider"))switch(this.mode){case"wheel":i=m/2-p.x,o=g/2-p.y,r=Math.sqrt(i*i+o*o),(o=Math.atan2(o,i))<0&&(o+=2*Math.PI),75>16,g:(65280&t)>>8,b:255&t}};s(function(){var t=new v,o=h("body");t.on("change",function(t,e,n){clearTimeout(this.timer);var i=C(e),r="dark"==(128<=(299*i.r+587*i.g+114*i.b)/1e3?"dark":"light")||!n||n<.35;n<1?(n="rgba("+i.r+", "+i.g+", "+i.b+", "+n+")",t.style({backgroundColor:n})):t.style({backgroundColor:e}),t.parent(".g-colorpicker")[r?"removeClass":"addClass"]("light-text"),this.timer=setTimeout(function(){t.emit("input"),o.emit("input",{target:t})},150)})}),e.exports=v},{"../../ui/drag.events":52,elements:113,"elements/domready":111,"elements/zen":137,"mout/collection/forEach":189,"mout/function/bind":192,"mout/math/clamp":216,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],40:[function(i,r,t){!function(w){!function(){"use strict";var d=i("../../utils/elements.utils"),t=i("prime"),o=i("agent"),a=i("elements/zen"),e=i("elements/domready"),h=i("mout/function/bind"),s=(i("mout/string/rtrim"),i("mout/lang/deepClone")),l=i("mout/object/deepFillIn"),p=i("../../ui").modal,f=i("../../utils/get-ajax-suffix"),m=i("../../utils/get-ajax-url").parse,g=i("../../utils/get-ajax-url").global,v=i("../../utils/translate"),b=i("../../utils/cookie"),y=i("dropzone").default,n=new t({constructor:function(t){t=t.data("g5-filepicker");this.data=!!t&&JSON.parse(t),this.data&&!this.data.value&&(this.data.value=d(this.data.field).value()),this.colors={error:"#D84747",success:"#9ADF87",small:"#aaaaaa",gradient:["#9e38eb","#4e68fc"]}},open:function(){this.data&&(this.data.value=d(this.data.field).value()),p.open({method:"post",data:this.data,content:v("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-filepicker",remote:m(g("filepicker")+f()),remoteLoaded:h(this.loaded,this),afterClose:h(function(){this.dropzone&&this.dropzone.destroy()},this)})},getPath:function(){var t=this.content.search(".g-folders .active");return t?(t=d(t[t.length-1]),JSON.parse(t.data("folder")).pathname.replace(/\/$/,"")+"/"):null},getPreviewTemplate:function(){var t=a("li[data-file]"),e=(a("span.g-file-delete[data-g-file-delete][data-dz-remove]").html('').bottom(t),a("div.g-thumb[data-dz-thumbnail]").bottom(t));a("span.g-file-name[data-dz-name]").bottom(t),a("span.g-file-size[data-dz-size]").bottom(t),a("span.g-file-mtime[data-dz-mtime]").bottom(t);a("span.g-file-progress[data-file-uploadprogress]").html('').bottom(t),a("div").bottom(e),t.bottom("body");e=t[0].outerHTML;return t.remove(),e},loaded:function(t,e){var i=e.elements.content,u=(i.search(".g-bookmark"),i.find(".g-files")),n=s(this.data),c=this.colors,r=this;this.content=i,u&&(this.dropzone=new y("body",{previewTemplate:this.getPreviewTemplate(),previewsContainer:u.find("ul:not(.g-list-labels)")[0],thumbnailWidth:100,thumbnailHeight:100,clickable:"[data-upload]",acceptedFiles:this.acceptedFiles(this.data.filter)||"",accept:h(function(t,e){!this.data.filter||t.name.toLowerCase().match(this.data.filter)?e():e(""+t.name+"
"+v("GANTRY5_PLATFORM_JS_FILTER_MISMATCH")+":
"+this.data.filter+"
")},this),url:h(function(t){return m(g("filepicker/upload/"+w.btoa(encodeURIComponent(this.getPath()+t[0].name)))+f())},this)}),this.dropzone.on("thumbnail",function(t,e){var n=(n=t.name.split(".")).length&&1!=n.length?n.reverse()[0]:"-";d(t.previewElement).addClass("g-image g-image-"+n.toLowerCase()).find("[data-dz-thumbnail] > div").attribute("style","background-image: url("+encodeURI(e)+");")}),this.dropzone.on("addedfile",function(t){var e=d(t.previewElement),n=e.find("[data-file-uploadprogress]"),i=u.hasClass("g-filemode-list"),r={value:0,animation:!1,insertLocation:"bottom"},o=(o=t.name.split(".")).length&&1!=o.length?o.reverse()[0]:"-";t.type.match(/image.*/)?e.find(".g-thumb").addClass("g-image g-image-"+o.toLowerCase()):e.find(".g-thumb").text(o),r=l(i?{size:20,thickness:10,fill:{color:c.small,gradient:!1}}:{size:50,thickness:"auto",fill:{gradient:c.gradient,color:!1}},r),e.addClass("g-file-uploading"),n.progresser(r),n.attribute("title",v("GANTRY5_PLATFORM_JS_PROCESSING")).find(".g-file-progress-text").html("•••").attribute("title",v("GANTRY5_PLATFORM_JS_PROCESSING"))}).on("processing",function(t){d(t.previewElement).find("[data-file-uploadprogress]").find(".g-file-progress-text").text("0%").attribute("title","0%")}).on("sending",function(t,e,n){d(t.previewElement).find("[data-file-uploadprogress]").attribute("title","0%").find(".g-file-progress-text").text("0%").attribute("title","0%")}).on("uploadprogress",function(t,e,n){t=d(t.previewElement).find("[data-file-uploadprogress]");t.progresser({value:e/100}),t.attribute("title",Math.round(e)+"%").find(".g-file-progress-text").text(Math.round(e)+"%").attribute("title",Math.round(e)+"%")}).on("complete",function(t){r.refreshFiles(i)}).on("error",function(t,e){var n=d(t.previewElement),i=n.find("[data-file-uploadprogress]"),r=n.find(".g-file-progress-text"),t=u.hasClass("g-filemode-list");n.addClass("g-file-error"),i.title("Error").progresser({fill:{color:c.error,gradient:!1},value:1,thickness:t?10:25}),r.title("Error").html('').parent("[data-file-uploadprogress]").popover({content:e.html||(e.error&&e.error.message?e.error.message:e),placement:"auto",trigger:"mouse",style:"filepicker, above-modal",width:"auto",targetEvents:!1})}).on("success",function(t,e,n){var i=d(t.previewElement),r=i.find("[data-file-uploadprogress]"),o=i.find(".g-file-mtime"),a=i.find(".g-file-progress-text"),s=i.find(".g-thumb"),l=u.hasClass("g-filemode-list");r.progresser({fill:{color:c.success,gradient:!1},value:1,thickness:l?10:25}),a.html(''),setTimeout(h(function(){r.animate({opacity:0},{duration:500}),s.animate({opacity:1},{duration:500,callback:function(){i.data("file",JSON.stringify(e.finfo)).data("file-url",e.url).removeClass("g-file-uploading"),i.dropzone=t,r.remove(),o.text(v("GANTRY5_PLATFORM_JUST_NOW"))}})},this),500)})),i.delegate("click",".g-bookmark-title",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.nextSibling(".g-folders"),i=e.parent(".g-bookmark");n&&n.slideToggle(function(){i.toggleClass("collapsed",n.gSlideCollapsed)})}),i.delegate("click","[data-folder]",h(function(t,r){t&&t.preventDefault&&t.preventDefault();var e=JSON.parse(r.data("folder")),t=d("[data-file].selected");n.root=e.pathname,n.value=!!t&&t.data("file-url"),n.subfolder=!0,r.showIndicator("fa fa-li fa-fw fa-spin-fast fa-spinner"),o(m(g("filepicker")+f()),n).send(h(function(t,e){var n,i;r.hideIndicator(),this.addActiveState(r),e.body.success?(e.body.subfolder&&(n=a("div").html(e.body.subfolder),(i=r.nextSibling())&&!i.attribute("data-folder")&&i.remove(),n.children().after(r)),e.body.files?(u.empty(),(n=a("div").html(e.body.files)).children().bottom(u).style({opacity:0}).animate({opacity:1},{duration:"250ms"})):u.find("> ul:not(.g-list-labels)").empty(),this.dropzone.previewsContainer=u.find("ul:not(.g-list-labels)")[0]):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})},this))},this)),i.delegate("click","[data-g-file-preview]",h(function(t,e){t.preventDefault(),t.stopPropagation();e=e.parent("[data-file]");JSON.parse(e.data("file")).isImage&&(e=e.find(".g-thumb > div"),p.open({className:"g5-dialog-theme-default g5-modal-filepreview center",content:''}))},this)),i.delegate("click","[data-g-file-delete]",h(function(t,e){t.preventDefault();var n=e.parent("[data-file]"),t=JSON.parse(n.data("file")),e=m(g("filepicker/"+w.btoa(encodeURIComponent(t.pathname))+f()));if(!t.isInCustom)return!1;o("delete",e,function(t,e){e.body.success?(n.addClass("g-file-deleted"),setTimeout(function(){n.remove(),r.refreshFiles(i)},210)):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})},this)),i.delegate("click","[data-file]",h(function(t,e){t&&t.preventDefault&&t.preventDefault();var n=d(t.target),t=null!==n.data("g-file-delete")||n.parent("[data-g-file-delete]"),n=null!==n.data("g-file-preview")||n.parent("[data-g-file-preview]");e.hasClass("g-file-error")||e.hasClass("g-file-uploading")||t||n||(JSON.parse(e.data("file")),u.search("[data-file]").removeClass("selected"),e.addClass("selected"))},this)),i.delegate("click","[data-select]",h(function(t,e){t&&t.preventDefault&&t.preventDefault();t=u.find("[data-file].selected"),t=t?t.data("file-url"):"";d(this.data.field).value(t),d("body").emit("input",{target:this.data.field}),p.close()},this)),i.delegate("click","[data-files-mode]",h(function(t,e){t&&t.preventDefault&&t.preventDefault(),e.hasClass("active")||(d("[data-files-mode]").removeClass("active"),e.addClass("active"),b.write("g5_files_mode",e.data("files-mode")),u.animate({opacity:0},{duration:200,callback:function(){var n=e.data("files-mode"),t=u.search("[data-file-uploadprogress]"),i="list"==n?{size:20,thickness:10,fill:{color:c.small,gradient:!1}}:{size:50,thickness:"auto",fill:{gradient:c.gradient,color:!1}};u.attribute("class","g-files g-block g-filemode-"+n),t&&t.forEach(function(t){t=d(t);var e=s(i);t.parent(".g-file-error")&&(e.fill={color:c.error},e.value=1,e.thickness="list"==n?10:25),t.progresser(e)}),u.animate({opacity:1},{duration:200})}}))},this))},addActiveState:function(t){var e=this.content.search("[data-folder].active, .g-folders > .active"),n=t.parent();for(e&&e.removeClass("active"),t.addClass("active");"ul"==n.tag()&&!n.hasClass("g-folders");)n.previousSibling().addClass("active"),n=n.parent()},acceptedFiles:function(t){var e="";switch(t){case".(jpe?g|gif|png|svg)$":e=".jpg,.jpeg,.gif,.png,.svg,.JPG,.JPEG,.GIF,.PNG,.SVG";break;case".(mp4|webm|ogv|mov)$":e=".mp4,.webm,.ogv,.mov,.MP4,.WEBM,.OGV,.MOV"}return e},refreshFiles:function(t){var e=d("[data-folder].active"),e=e[e.length-1];e&&t.emit("click",{target:d(e)})}});e(function(){d("body").delegate("click","[data-g5-filepicker]",function(t,e){t&&t.preventDefault&&t.preventDefault(),(e=d(e)).GantryFilePicker||(e.GantryFilePicker=new n(e)),e.GantryFilePicker.open()})}),r.exports=n}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../ui":54,"../../utils/cookie":64,"../../utils/elements.utils":66,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,dropzone:107,"elements/domready":111,"elements/zen":137,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/object/deepFillIn":225,"mout/string/rtrim":270,prime:301}],41:[function(t,e,n){"use strict";var i=t("prime"),s=t("../../utils/elements.utils"),a=t("elements/zen"),r=t("prime/map")(),o=t("prime/emitter"),l=t("prime-util/prime/bound"),u=(t("prime-util/prime/options"),t("elements/domready")),c=t("../../utils/decouple"),d=t("mout/function/bind"),h=(t("mout/array/map"),t("mout/array/forEach"),t("mout/array/contains")),p=(t("mout/array/last"),t("mout/array/split"),t("mout/array/removeAll")),f=t("mout/array/insert"),m=(t("mout/array/append"),t("mout/array/find"),t("mout/array/combine"),t("mout/array/intersection")),g=(t("mout/object/merge"),t("mout/string/unhyphenate")),v=t("mout/string/properCase"),b=t("mout/string/trim"),y=t("../../utils/get-ajax-suffix"),w=t("../../utils/get-ajax-url").parse,x=t("../../utils/get-ajax-url").global,k=t("../../ui").modal,S=t("../../utils/async-foreach"),C=t("../../utils/translate"),T=(t("agent"),t("webfontloader"));t("../../utils/elements.viewport");var E=new i({mixin:l,inherits:o,previewSentence:{latin:"Wizard boy Jack loves the grumpy Queen's fox.","latin-ext":"Wizard boy Jack loves the grumpy Queen's fox.",arabic:"نص حكيم له سر قاطع وذو شأن عظيم مكتوب على ثوب أخضر ومغلف بجلد أزرق",cyrillic:"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!","cyrillic-ext":"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!",devanagari:"एक पल का क्रोध आपका भविष्य बिगाड सकता है",greek:"Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός","greek-ext":"Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός",hebrew:"דג סקרן שט בים מאוכזב ולפתע מצא חברה",khmer:"ខ្ញុំអាចញ៉ាំកញ្ចក់បាន ដោយគ្មានបញ្ហា",telugu:"దేశ భాషలందు తెలుగు లెస్స",vietnamese:"Tôi có thể ăn thủy tinh mà không hại gì."},constructor:function(){this.wf=T,this.field=null,this.element=null,this.throttle=!1,this.selected=null,this.loadedFonts=[],this.filters={search:"",script:"latin",categories:[]}},open:function(t,e){e=e.data("g5-fontpicker");if(!e)throw new Error("No fontpicker data found");e=JSON.parse(e),this.field=s(e.field),k.open({content:C("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-fonts",remote:w(x("fontpicker")+y()),remoteLoaded:d(function(t,e){var n=e.elements.content;this.attachEvents(n),this.updateCategories(n),this.search(),this.scroll(n.find("ul.g-fonts-list")),this.updateTotal(),this.selectFromValue(),setTimeout(function(){n.find(".particle-search-wrapper input")[0].focus()},5)},this)})},scroll:function(n){clearTimeout(this.throttle),this.throttle=setTimeout(d(function(){var i,t;n?(t=(n.find("ul.g-fonts-list")||n).inviewport(" > li:not(.g-font-hide)",550*(0<(t=window.navigator.userAgent).indexOf("MSIE ")||0 .preview').style({fontFamily:t,fontWeight:e}),this.loadedFonts.push(t)},this)}))):clearTimeout(this.throttle)},this),100)},unselect:function(t){if(!(t=t||this.selected))return!1;var e=t.element.data("variant");t.element.removeClass("selected"),t.element.search("input[type=checkbox]").checked(!1),t.element.search("[data-font]").addClass("g-variant-hide"),t.element.find('[data-variant="'+e+'"]').removeClass("g-variant-hide"),t.variants=[t.baseVariant],t.selected=[]},selectFromValue:function(){var t=!1;if((o=this.field.value()).match("family="))var e=o.split("&"),n=e[0].split(":"),i=n[0].replace("family=","").replace(/\+/g," "),r=n[1]?n[1].split(","):["regular"],n=e[1]?e[1].replace("subset=","").split(","):["latin"];else{var e=(e=s('[data-category="local-fonts"][data-font]')||[]).map(function(t){return s(t).data("font")}),o=o.replace(/(\s{1,})?,(\s{1,})?/gi,",").split(","),o=m(e,o);if(!o.length)return!1;t=!0,i=o.shift()}var a=s('ul.g-fonts-list > [data-font="'+i+'"]'+(t?'[data-category="local-fonts"]':':not([data-category="local-fonts"])'));r=r||a.data("variants").split(",")||["regular"],h(r,"400")&&(p(r,"400"),f(r,"regular")),h(r,"400italic")&&(p(r,"400italic"),f(r,"italic")),this.selected={font:i,baseVariant:a.data("variant"),element:a,variants:r,selected:[],local:t,charsets:n,availableVariants:a.data("variants").split(","),expanded:t,loaded:t},(t?[i]:r).forEach(function(t){this.select(a,t),(t=a.find('> ul > [data-variant="'+t+'"]'))&&t.removeClass("g-variant-hide")},this);i=a.find(".font-charsets-selected");i&&(r=a.data("subsets").split(",").length,i.html('( '+n.length+" of "+r+" selected)")),t||(s("ul.g-fonts-list")[0].scrollTop=a[0].offsetTop),this.toggleExpansion(),setTimeout(d(function(){this.toggleExpansion()},this),50),t||setTimeout(d(function(){s("ul.g-fonts-list")[0].scrollTop=a[0].offsetTop},this,250))},select:function(t,e){var n,i,r=t.data("variant"),o=!r;this.selected&&this.selected.element==t||(e&&this.selected&&((n=this.selected.element.find(".font-charsets-selected"))&&(i=t.data("subsets").split(",").length,n.html('( 1 of '+i+" selected)"))),this.selected={font:t.data("font"),baseVariant:r,element:t,variants:[r],selected:[],local:o,charsets:["latin"],availableVariants:t.data("variants").split(","),expanded:o,loaded:o}),e||this.toggleExpansion(),(e||o)&&((t=s('ul.g-fonts-list > [data-font]:not([data-font="'+this.selected.font+'"]) input[type="checkbox"]:checked'))&&(t.checked(!1),t.parent("[data-variants]").removeClass("font-selected")),o=(t=this.selected.element.find('input[type="checkbox"][value="'+(o?this.selected.font:e)+'"]')).checked(),t&&t.checked(!o),o?(e!=this.selected.baseVariant&&p(this.selected.variants,e),p(this.selected.selected,e)):(f(this.selected.variants,e),f(this.selected.selected,e)),this.updateSelection())},toggleExpansion:function(){var t;this.selected.availableVariants.length<=1||(this.selected.local?this.selected.expanded=!0:(this.selected.expanded?(t=':not([data-variant="'+this.selected.variants.join('"]):not([data-variant="')+'"])',(t=this.selected.element.search("[data-font]"+t))&&t.addClass("g-variant-hide")):1<(t=this.selected.element.data("variants")).split(",").length&&(this.manipulateLink(this.selected.font),this.selected.element.search("[data-font]").removeClass("g-variant-hide"),this.selected.loaded||this.wf.load({classes:!1,google:{families:[this.selected.font.replace(/\s/g,"+")+":"+t]},fontactive:d(function(t,e){t=this.fvdToStyle(t,e),e=t.fontWeight;"400"==e?e="normal"==t.fontStyle?"regular":"italic":"italic"==t.fontStyle&&(e+="italic"),this.selected.element.find('li[data-variant="'+e+'"] .preview').style(t),this.selected.loaded=!0},this)})),this.selected.expanded=!this.selected.expanded))},manipulateLink:function(t){t=t.replace(/\s/g,"+");var e,n=s('head link[href*="'+t+'"]');n&&(!(e=decodeURIComponent(n.href()).split("|"))||e.length<=1||(p(e,t),n.attribute("href",encodeURI(e.join("|")))))},toggle:function(t,e){e=s(e);t=s(t.target);return"checkbox"==t.attribute("type")&&t.checked(!t.checked()),this.select(e.parent("[data-font]")||e,!!e.parent("[data-font]")&&e.data("variant"),e),!1},updateSelection:function(){var t,e=s(".g-particles-footer .font-selected");if(e){if(!this.selected.selected.length)return e.empty(),void this.selected.element.removeClass("font-selected");t=this.selected.selected.sort(),t=this.selected.local?"(local)":"("+t.join(", ").replace("regular","normal")+")",this.selected.element.addClass("font-selected"),e.html(""+this.selected.font+" "+t)}},updateTotal:function(){var t=s(".g-particles-header .particle-search-total"),e=s(".g-fonts-list > [data-font]:not(.g-font-hide)");t.text(e?e.length:0)},updateCategories:function(t){t=t.find("[data-font-categories]");t&&(this.filters.categories=t.data("font-categories").split(","))},attachEvents:function(t){var e=t.find(".g-particles-header"),n=t.find(".g-fonts-list"),i=e.find("input.font-search"),e=e.find("input.font-preview");c(n,"scroll",d(this.scroll,this,n)),t.delegate("click",".g-fonts-list li[data-font]",d(this.toggle,this)),i&&i.on("keyup",d(this.search,this,i)),e&&e.on("keyup",d(this.updatePreview,this,e)),this.attachCharsets(t),this.attachLocalVariants(t),this.attachFooter(t)},attachCharsets:function(t){t.delegate("mouseover",".font-charsets-selected",d(function(t,o){o.PopoverDefined||(o.getPopover({placement:"auto",width:"200",trigger:"mouse",style:"font-categories, above-modal"}),o.on("beforeshow.popover",d(function(t){var n,e,i=o.parent("[data-subsets]").data("subsets").split(","),r=t.$target.find(".g5-popover-content");r.empty(),i.forEach(function(t){e=h(this.selected.charsets,t)?"latin"==t?"checked disabled":"checked":"",a("div").html('").bottom(r)},this),r.delegate("click",'input[type="checkbox"]',d(function(t,e){e=s(e),n=r.search('input[type="checkbox"]:checked'),this.selected.charsets=n?n.map("value"):[],o.html('( '+this.selected.charsets.length+" of "+i.length+" selected)")},this)),t.displayContent()},this)),o.getPopover().show())},this))},attachLocalVariants:function(t){t.delegate("mouseover",".g-font-variants-list",d(function(t,i){i.PopoverDefined||(i.getPopover({placement:"auto",width:"200",trigger:"mouse",style:"font-categories, above-modal"}),i.on("beforeshow.popover",d(function(t){var e=t.$target.find(".g5-popover-content"),n=i.parent("[data-variants]").data("variants").split(",");e.empty(),S(n,d(function(t){t="400"==t?"regular":"400italic"==t?"italic":t+"",a("div").text(this.mapVariant(t)).bottom(e)},this)),t.displayContent()},this)))},this))},attachFooter:function(t){var r,e=t.find(".g-particles-footer"),n=e.find("button.button-primary"),o=e.find(".font-category"),i=e.find(".font-subsets");return n.on("click",d(function(){if(!s('ul.g-fonts-list > [data-font] input[type="checkbox"]:checked'))return this.field.value(""),void k.close();var t=this.selected.font.replace(/\s/g,"+"),e=this.selected.selected,n=this.selected.charsets;e&&1==e.length&&"regular"==e[0]&&(e=[]),n&&1==n.length&&"latin"==n[0]&&(n=[]),h(e,"regular")&&(p(e,"regular"),f(e,"400")),h(e,"italic")&&(p(e,"italic"),f(e,"400italic")),this.selected.local?this.field.value(t):this.field.value("family="+t+(e.length?":"+e.join(","):"")+(n.length?"&subset="+n.join(","):"")),this.field.emit("input"),s("body").emit("input",{target:this.field}),k.close()},this)),o.popover({placement:"top",width:"200",trigger:"mouse",style:"font-categories, above-modal"}).on("beforeshow.popover",d(function(t){var n,e=o.data("font-categories").split(","),i=t.$target.find(".g5-popover-content");i.empty(),e.forEach(function(t){"local-fonts"!=t&&(r=h(this.filters.categories,t)?"checked":"",a("div").html('").bottom(i))},this),i.delegate("click",'input[type="checkbox"]',d(function(t,e){e=s(e),n=i.search('input[type="checkbox"]:checked'),this.filters.categories=n?n.map("value"):[],o.find("small").text(this.filters.categories.length),this.search()},this)),t.displayContent()},this)),i.popover({placement:"top",width:"200",trigger:"mouse",style:"font-subsets, above-modal"}).on("beforeshow.popover",d(function(t){var e=i.data("font-subsets").split(","),n=t.$target.find(".g5-popover-content");n.empty(),e.forEach(function(t){r=t==this.filters.script?"checked":"",a("div").html('").bottom(n)},this),n.delegate("change",'input[type="radio"]',d(function(t,e){e=s(e),this.filters.script=e.value(),s(".g-particles-header input.font-preview").value(this.previewSentence[this.filters.script]),i.find("small").text(v(g(e.value().replace("ext","extended")))),this.search(),this.updatePreview()},this)),t.displayContent()},this)),t},search:function(t){t=t||s(".g-particles-header input.font-search");var e,n,i,r=s(".g-fonts-list"),o=t.value();r.search("> [data-font]").forEach(function(t){t=s(t),e=t.data("font"),n=t.data("subsets").split(","),i=t.data("category"),t.removeClass("g-font-hide"),this.selected&&this.selected.font==e&&this.selected.selected.length||(h(n,this.filters.script)&&h(this.filters.categories,i)&&e.match(new RegExp("^"+o+"|\\s"+o,"gi"))?t.removeClass("g-font-hide"):t.addClass("g-font-hide"))},this),this.updateTotal(),clearTimeout(t.refreshTimer),t.refreshTimer=setTimeout(d(function(){this.scroll(s("ul.g-fonts-list"))},this),400),t.previousValue=o},updatePreview:function(t){t=t||s(".g-particles-header input.font-preview"),clearTimeout(t.refreshTimer);var e=t.value(),n=s(".g-fonts-list"),e=b(e)?b(e):this.previewSentence[this.filters.script];if(t.previousValue==e)return!0;n.search("[data-font] .preview").text(e),t.previousValue=e},fvdToStyle:function(t,e){e=e.match(/([a-z])([0-9])/);if(!e)return"";return{fontFamily:t,fontStyle:{n:"normal",i:"italic",o:"oblique"}[e[1]],fontWeight:(100*e[2]).toString()}},mapVariant:function(t){switch(t){case"100":return"Thin 100";case"100italic":return"Thin 100 Italic";case"200":return"Extra-Light 200";case"200italic":return"Extra-Light 200 Italic";case"300":return"Light 300";case"300italic":return"Light 300 Italic";case"400":case"regular":return"Normal 400";case"400italic":case"italic":return"Normal 400 Italic";case"500":return"Medium 500";case"500italic":return"Medium 500 Italic";case"600":return"Semi-Bold 600";case"600italic":return"Semi-Bold 600 Italic";case"700":return"Bold 700";case"700italic":return"Bold 700 Italic";case"800":return"Extra-Bold 800";case"800italic":return"Extra-Bold 800 Italic";case"900":return"Ultra-Bold 900";case"900italic":return"Ultra-Bold 900 Italic";default:return"Unknown Variant"}}});u(function(){s("body").delegate("click","[data-g5-fontpicker]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=r.get(e);n||(n=new E,r.set(e,n)),n.open(t,e)})}),e.exports=E},{"../../ui":54,"../../utils/async-foreach":63,"../../utils/decouple":65,"../../utils/elements.utils":66,"../../utils/elements.viewport":67,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,"elements/domready":111,"elements/zen":137,"mout/array/append":164,"mout/array/combine":165,"mout/array/contains":166,"mout/array/find":171,"mout/array/forEach":174,"mout/array/insert":176,"mout/array/intersection":177,"mout/array/last":179,"mout/array/map":180,"mout/array/removeAll":182,"mout/array/split":185,"mout/function/bind":192,"mout/object/merge":237,"mout/string/properCase":264,"mout/string/trim":272,"mout/string/unhyphenate":275,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302,webfontloader:317}],42:[function(t,e,n){"use strict";var c=t("../../utils/elements.utils"),i=t("elements/domready"),d=t("../../ui").modal,r=t("../../utils/get-ajax-suffix"),o=t("../../utils/get-ajax-url").parse,a=t("../../utils/get-ajax-url").global,s=t("../../utils/translate"),h=t("mout/string/trim"),p=t("mout/array/contains");i(function(){var t=c("body");t.delegate("keyup",'.g-icons input[type="text"]',function(t,e){var n=(e=c(e)).sibling("[data-g5-iconpicker]")||e.siblings().find("[data-g5-iconpicker]"),e=e.value();n.find("i").attribute("class",e||"far fa-hand-point-up picker"),n[0].offsetWidth||n.find("i").attribute("class","far fa-hand-point-up picker")}),t.delegate("click","[data-g5-iconpicker]",function(t,e){t&&t.preventDefault&&t.preventDefault(),e=c(e);var n=c(e.data("g5-iconpicker")),l=e,u=h(n.value()).replace(/\s{2,}/g," ").split(" ");d.open({content:s("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-icons",remote:o(a("icons")+r()),afterClose:function(){var t=c(".g5-popover");t&&t.remove()},remoteLoaded:function(t,e){var r,o,a=e.elements.content,e=a.search("[data-g-icon]");if(!e||!t.body.success)return a.html(t.body.html||t.body),!1;function s(){var e=[],t=a.find("[data-g-icon].active"),n=a.search(".g-particles-header .float-right input:checked, .g-particles-header .float-right select");t&&e.push(t.data("g-icon")),n&&n.forEach(function(t){t=c(t).value();t&&"fa-"!==t&&e.push(t)}),a.find(".g-icon-preview").html(' '+e[0]+""),a.find("[data-g-select]").disabled(!a.find("[data-g-icon].active")||null)}function i(){var t=a.search("[data-g-icon]:not(.hide-icon)");a.find(".particle-search-total").text(t?t.length:0)}a.find("[data-g-select]").disabled(!a.find("[data-g-icon].active")||null),a.delegate("click","[data-g-icon]",function(t,e){t&&t.preventDefault&&t.preventDefault(),e=c(e);t=a.find("[data-g-icon].active");t&&t.removeClass("active"),e.addClass("active"),a.find("[data-g-select]").disabled(null),s()}),a.delegate("click","[data-g-select]",function(t){if(t.preventDefault(),!a.find("[data-g-icon].active"))return!1;t=a.find(".g-icon-preview i");n.value(t.attribute("class")),l.find("i").attribute("class",t.attribute("class")),n.emit("input"),c("body").emit("input",{target:n}),d.close()}),a.delegate("change",'.g-particles-header .float-right input[type="checkbox"], .g-particles-header .float-right select',function(){s()}),a.delegate("keyup",'.particle-search-wrapper input[type="text"]',function(t,e){var n=(e=c(e)).value(),e=a.search("[data-g-icon].hide-icon");if(!n)return e&&(e.removeClass("hide-icon"),i()),!0;n=a.search('[data-g-icon*="'+n+'"]');a.search("[data-g-icon]").addClass("hide-icon"),n&&n.removeClass("hide-icon"),i()}),e.forEach(function(t){t=c(t),r="";for(var e,n,i=5;0 ';r+=""+t.data("g-icon")+"
",t.popover({content:r,placement:"auto",trigger:"mouse",style:"above-modal, icons-preview",width:"auto",targetEvents:!1,delay:1}).on("hidden.popover",function(t){t.$target&&t.$target.remove()}),p(u,t.data("g-icon"))&&(t.addClass("active"),u.forEach(function(t){var e=a.find('[name="'+t+'"]');e?e.checked(!0):(e=a.find('option[value="'+t+'"]'))&&e.parent().value(t)}),n=(e=t.parent(".icons-wrapper"))[0].offsetHeight,e[0].scrollTop=t[0].offsetTop-n/2,s())}),setTimeout(function(){a.find(".particle-search-wrapper input")[0].focus()},5)}})})}),e.exports={}},{"../../ui":54,"../../utils/elements.utils":66,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"elements/domready":111,"mout/array/contains":166,"mout/string/trim":272}],43:[function(t,e,n){"use strict";e.exports={colorpicker:t("./colorpicker"),fonts:t("./fonts"),menu:t("./menu"),icons:t("./icons"),filepicker:t("./filepicker"),collections:t("./collections"),keyvalue:t("./keyvalue"),instancepicker:t("./instancepicker")}},{"./collections":38,"./colorpicker":39,"./filepicker":40,"./fonts":41,"./icons":42,"./instancepicker":44,"./keyvalue":45,"./menu":46}],44:[function(t,e,n){"use strict";var h=t("elements"),p=t("elements/zen"),i=t("elements/domready"),f=t("../../fields/submit"),m=t("../../ui").modal,g=t("agent"),v=t("mout/string/trim"),b=t("../../utils/get-ajax-url").parse,r=t("../../utils/get-ajax-url").global,y=t("../../utils/get-ajax-suffix"),o=t("../../utils/translate"),w=t("../../utils/wp-widgets-customizer");i(function(){var t=h("body"),d=(h('[data-g-instancepicker] ~ input[type="hidden"]'),{wordpress:"widget",joomla:"module"});t.delegate("input",'[data-g-instancepicker] ~ input[type="hidden"]',function(t,e){var n,i;e.value()||(n=e.siblings(".g-instancepicker-title"),i=e.siblings("[data-g-instancepicker]"),e=e.sibling(".g-reset-field"),n.text(""),i.text(i.data("g-instancepicker-text")),e.style("display","none"))}),t.delegate("click","[data-g-instancepicker]",function(t,u){t&&t.preventDefault();var e=JSON.parse(u.data("g-instancepicker")),c=h('[name="'+e.field+'"]'),n=e.type==d[GANTRY_PLATFORM]?("widget"!=e.type?"particle/":"")+d[GANTRY_PLATFORM]:"particle";return!!c&&(t=c.value(),"particle"!=e.type&&"widget"!=e.type||!t||(n=(t=JSON.parse(t||{})).type+"/"+t[e.type]),!!e.modal_close||void m.open({content:o("GANTRY5_PLATFORM_JS_LOADING"),method:t&&"module"!=e.type?"post":"get",data:t&&"module"!=e.type?t:{},overlayClickToClose:!1,remote:b(r(n)+y()),remoteLoaded:function(t,e){if(t.body.success){var n=e.elements.content,i=n.find("[data-mm-select]"),r=n.find(".search input"),o=n.search("[data-mm-type]"),a=n.search("[data-mm-filter]");r&&a&&o&&(r.on("input",function(){var e,n;this.value()?(o.addClass("hidden"),e=[],n=this.value().toLowerCase(),a.forEach(function(t){t=h(t),v(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&h(e).removeClass("hidden")):o.removeClass("hidden")}),setTimeout(function(){r[0].focus()},5));e=JSON.parse(u.data("g-instancepicker"));if(e.type==d[GANTRY_PLATFORM]&&(e.modal_close=!0),i)i.data("g-instancepicker",JSON.stringify(e));else{var e=n.find("form"),s=p("div").html(t.body.html||t.body).find("form"),l=n.find('input[type="submit"], button[type="submit"]');if(!e&&!s||!l)return!0;e=n.search("[data-apply-and-save]");e&&e.remove(),l.on("click",function(t){t.preventDefault(),l.showIndicator();t=f(s[0].elements,n);g(s.attribute("method"),b(s.attribute("action")+y()),t.valid.join("&")||{},function(t,e){var n;e.body.success?(n=c.siblings(".g-instancepicker-title"),c&&(c.value(JSON.stringify(e.body.item)),h("body").emit("change",{target:c})),n&&n.text(e.body.item.title)):m.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),m.close(),l.hideIndicator(),w(c)})})}}else m.enableCloseByOverlay()}}))})}),e.exports={}},{"../../fields/submit":9,"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"../../utils/wp-widgets-customizer":79,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/string/trim":272}],45:[function(t,e,n){"use strict";var i=t("elements/domready"),a=t("elements"),f=(t("elements/zen"),t("mout/object/has")),m=t("mout/array/some"),g=(t("../../ui").modal,t("../../ui").toastr,t("agent"),t("mout/array/indexOf")),v=t("mout/array/contains"),r=t("mout/array/last"),s=t("mout/object/keys"),o=t("sortablejs"),b=t("mout/string/escapeUnicode"),y=t("mout/string/trim"),w=(t("../../utils/get-ajax-suffix"),t("../../utils/translate"));t("elements/insertion"),i(function(){function n(t){(t=t||a(".g-keyvalue-field ul"))&&t.forEach(function(t){(t=a(t)).SimpleSort=o.create(t[0],{handle:".fa-reorder",filter:"[data-keyvalue-nosort]",scroll:!1,animation:150,onStart:function(){a(this.el).addClass("keyvalue-sorting")},onEnd:function(t){var e,n=a(this.el);n.removeClass("keyvalue-sorting"),t.oldIndex!==t.newIndex&&(n=(e=n.parent(".settings-param").find("[data-keyvalue-data]")).value(),(n=JSON.parse(n)).splice(t.newIndex,0,n.splice(t.oldIndex,1)[0]),e.value(JSON.stringify(n)),p.emit("change",{target:e}))}})})}var p=a("body");n(),p.delegate("mouseover",".g-keyvalue-field ul",function(t,e){e.SimpleSort||n(e)}),p.delegate("click","[data-keyvalue-addnew]",function(t,e){var n=e.parent(".settings-param"),i=n.find("ul"),e=n.find("[data-keyvalue-template]"),n=i.search("> [data-keyvalue-item]")||[],n=a(r(n)),e=a(e[0].cloneNode(!0));n?e.after(n):e.top(i),e.attribute("style",null).data("keyvalue-item",e.data("keyvalue-template")),e.attribute("data-keyvalue-template",null),e.attribute("data-keyvalue-nosort",null),e.find("[data-keyvalue-key]")[0].focus()}),p.delegate("click","[data-keyvalue-remove]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.parent("[data-keyvalue-item]"),i=(n.find('input[type="text"]').data("keyvalue-key"),e.parent(".settings-param").find("[data-keyvalue-data]")),t=e.parent("ul").search("> [data-keyvalue-item]"),e=g(t,n[0]),t=JSON.parse(i.value());t.splice(e,1),i.value(b(JSON.stringify(t))),n.remove(),p.emit("change",{target:i})});function i(t,e){var n=e.parent("[data-keyvalue-item]"),i=n.find(".g-keyvalue-wrapper"),r=n.find("[data-keyvalue-key]"),o=n.find("[data-keyvalue-value]"),a=r.data("keyvalue-key"),s=y(r.value()),l=y(o.value()),u=e.parent("ul").search("> [data-keyvalue-item]:not(.g-keyvalue-warning):not(.g-keyvalue-excluded)"),c=g(u,n[0]),d=e.parent(".settings-param").find("[data-keyvalue-data]"),h=JSON.parse(d.value()),o=JSON.parse(d.data("keyvalue-exclude")),u=v(o,s),o=m(h,function(t){return f(t,s)})&&a!==s;r==e&&(a===s||o||(void 0!==h[c]&&delete h[c][a],r.data("keyvalue-key",s||"")),n[o?"addClass":"removeClass"]("g-keyvalue-warning"),n[u?"addClass":"removeClass"]("g-keyvalue-excluded"),i.data("tip",o?w("GANTRY5_PLATFORM_JS_KEYVALUE_DUPLICATE",s):u?w("GANTRY5_PLATFORM_JS_KEYVALUE_EXCLUDED",s):null).data("tip-place","top-right").data("tip-spacing",2).data("tip-offset",8),u||o?window.G5.tips.get(i[0]).show():window.G5.tips.remove(i[0])),!s||u||o||(h[c]||h.splice(c,0,{}),h[c][s]=l),d.value(b(JSON.stringify(h))),p.emit("change",{target:d})}p.delegate("keydown",'[data-keyvalue-item] input[type="text"]',function(t,e){13===(t.which||t.keyCode)&&i(0,e)}),p.delegate("blur",'[data-keyvalue-item] input[type="text"]',i,!0),p.delegate("update","[data-keyvalue-data]",function(t,e){var n=e.parent(),i=n.search("[data-keyvalue-item]"),r=n.find("ul"),e=JSON.parse(e.value()),o=n.find("[data-keyvalue-template]");i&&i.remove(),e.forEach(function(t,e){var n=a(o[0].cloneNode(!0)),i=s(t).shift(),t=t[i];r.appendChild(n),n.attribute("style",null).data("keyvalue-item",n.data("keyvalue-template")),n.attribute("data-keyvalue-template",null),n.attribute("data-keyvalue-nosort",null),n.find("[data-keyvalue-key]").value(i),n.find("[data-keyvalue-value]").value(t)})})}),e.exports={}},{"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/translate":78,agent:80,elements:113,"elements/domready":111,"elements/insertion":114,"elements/zen":137,"mout/array/contains":166,"mout/array/indexOf":175,"mout/array/last":179,"mout/array/some":184,"mout/object/has":234,"mout/object/keys":236,"mout/string/escapeUnicode":260,"mout/string/trim":272,sortablejs:316}],46:[function(t,e,n){"use strict";var i=t("../../utils/elements.utils");t("elements/domready")(function(){i("body").delegate("click","[data-g5-content] .g-main-nav .g-toplevel [data-g5-ajaxify]",function(t,e){t&&t.preventDefault&&t.preventDefault();t=i("[data-g5-content] .g-main-nav .g-toplevel [data-g5-ajaxify] !> li");t&&t.removeClass("active"),e.parent("li").addClass("active")})}),e.exports={}},{"../../utils/elements.utils":66,"elements/domready":111}],47:[function(t,e,n){"use strict";function i(t){t&&(t.SimpleSort||c.createSortables(t))}var a=t("elements"),r=(t("elements/zen"),t("elements/domready")),o=(t("mout/string/trim"),t("mout/object/keys"),t("../ui").modal,t("../ui").toastr,t("agent"),t("../utils/get-ajax-suffix"),t("../utils/get-ajax-url").parse,t("../utils/get-ajax-url").global,t("../ui/eraser")),s=t("sortablejs"),l=t("../utils/flags-state"),u=[{name:"positions",pull:!0,put:!0},{name:"positions",pull:!1,put:!1}],c={eraser:null,lists:[],state:[],init:function(t){return c.state=c.serialize(t),c.state},equals:function(){return c.state===c.serialize()},updatePendingChanges:function(){var t=c.equals(),e=a('[data-save="Positions"]'),n=(e.find("i"),e.find(".changes-indicator"));t&&n&&e.hideIndicator(),t||n||e.showIndicator("changes-indicator far fa-fw fa-circle"),l.set("pending",!t)},serialize:function(t){var e,n=[],t=a(t)||a("[data-g5-position]");return t?(t.forEach(function(t){t=a(t),(e=JSON.parse(t.data("g5-position"))).modules=[],(t.search("[data-pm-data]")||[]).forEach(function(t){t=a(t),e.modules.push(JSON.parse(t.data("pm-data")||"{}"))}),n.push(e),t.data("g5-position",JSON.stringify(e))}),JSON.stringify(n).replace(/\//g,"\\/")):"[]"},attachEraser:function(){if(c.eraser)return c.eraser.element=a("[data-g5-positions-erase]"),void c.eraser.hide("fast");c.eraser=new o("[data-g5-positions-erase]")},createSortables:function(t){var r;c.attachEraser(),u.forEach(function(n,i){a(i?"#trash":"[data-g5-position] ul").forEach(function(t,e){r=s.create(t,{sort:!i,filter:"[data-g5-position-ignore]",group:n,scroll:!0,forceFallback:!0,animation:100,onStart:function(t){c.attachEraser(),a(t.item).addClass("position-dragging"),c.eraser.show()},onEnd:function(t){var e,n=a(t.item),i=a("#trash"),r=a(this.originalEvent.target),o=!1;if("touchend"===this.originalEvent.type&&(e=i[0].getBoundingClientRect(),o=((i=this.originalEvent).pageY||i.changedTouches[0].pageY)-window.scrollY<=e.height),r.matches("#trash")||r.parent("#trash")||o)return n.remove(),c.eraser.hide(),void this.options.onSort(t);n.removeClass("position-dragging"),c.eraser.hide()},onSort:function(t){var e=a(t.from),n=a(t.to),n=[e.parent("[data-g5-position]"),n.parent("[data-g5-position]")];t.from[0]===t.to[0]&&n.shift(),c.serialize(n),c.updatePendingChanges()},onOver:function(t){a(t.from).matches("ul")&&((t=a(t.newIndex)).matches("#trash")||t.parent("#trash")?c.eraser.over():c.eraser.out())}}),i||c.lists[e]||(c.lists[e]=r)}),i||(t.SimpleSort=r)})}};r(function(){var t=a("#positions");a("body").delegate("mouseover","#positions",function(t,e){i(e)}),i(t)}),e.exports=c},{"../ui":54,"../ui/eraser":53,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272,sortablejs:316}],48:[function(t,e,n){"use strict";var u=t("elements"),c=t("elements/zen"),i=t("elements/domready"),d=t("mout/string/trim"),h=(t("mout/object/keys"),t("../ui").modal),p=t("../ui").toastr,f=t("agent"),m=t("../utils/get-ajax-suffix"),g=t("../utils/get-ajax-url").parse,v=t("../utils/get-ajax-url").global,b=t("../fields/submit"),y=t("../utils/flags-state"),w=t("../utils/translate"),x=t("./cards");i(function(){var l=u("body"),a=g(v("confirmdeletion")+m());x.init(),l.delegate("click",'#positions [data-g-config], [data-g-create="position"]',function(t,r){var e=r.data("g-config"),n=r.data("g-config-href"),o=window.btoa(n),i=(r.data("g-config-method")||"post").toLowerCase();if(t&&t.preventDefault&&t.preventDefault(),"delete"==e&&!y.get("free:to:delete:"+o,!1))return y.warning({url:a,data:{page_type:"POSITION"},callback:function(t,e){var n=e.find("[data-g-delete-confirm]"),i=e.find("[data-g-delete-cancel]");n&&(n.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(y.get("free:to:delete:"+o,!0),u([n,i]).attribute("disabled"),l.emit("click",{target:r}),void h.close())}),i.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(u([n,i]).attribute("disabled"),y.get("free:to:delete:"+o,!1),void h.close())}))}}),!1;r.hideIndicator(),r.showIndicator(),f(i,g(n+m()),{},function(t,e){var n,i;e.body.success?(n=e.body.position,(i=u('[href="'+v("positions")+'"]'))?l.emit("click",{target:i}):window.location=window.location,p.success(e.body.html||"Action successfully completed.",e.body.title||""),n&&(l.positionDeleted=n)):h.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),r.hideIndicator()})}),l.delegate("click","#positions .position-add",function(t,e){t.preventDefault();h.open({content:w("GANTRY5_PLATFORM_JS_LOADING"),method:"get",overlayClickToClose:!1,remote:g(e.attribute("href")+m()),remoteLoaded:function(t,e){if(t.body.success){var n=e.elements.content.find("form"),i=c("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),o=e.elements.content.find(".search input"),a=e.elements.content.search("[data-mm-type]"),s=e.elements.content.search("[data-mm-filter]"),t=e.elements.content.find(".g-urltemplate");t&&l.emit("input",{target:t});e=e.elements.content.find("[data-title-editable]");return e&&e.on("title-edit-end",function(t,e){if(!(t=d(t)))return t=d(e)||"Title",this.text(t).data("title-editable",t),!0}),o&&s&&a&&o.on("input",function(){var e,n;this.value()?(a.addClass("hidden"),e=[],n=this.value().toLowerCase(),s.forEach(function(t){t=u(t),d(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&u(e).removeClass("hidden")):a.removeClass("hidden")}),o&&setTimeout(function(){o[0].focus()},5),!n&&!i||!r||void 0}h.enableCloseByOverlay()}})}),l.delegate("click","#positions .item-settings",function(t,a){t.preventDefault();var e={},n=a.parent("[data-pm-data]"),t=JSON.parse(a.parent("[data-g5-position]").data("g5-position"));e.position=t.name,e.item=n.data("pm-data"),h.open({content:w("GANTRY5_PLATFORM_JS_LOADING"),method:"post",data:e,overlayClickToClose:!1,remote:g(v("positions/edit/"+n.data("pm-blocktype"))+m()),remoteLoaded:function(t,e){if(t.body.success){var n=e.elements.content.find("form"),i=c("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),t=e.elements.content.find("[data-title-editable]");if(t&&t.on("title-edit-end",function(t,e){if(!(t=d(t)))return t=d(e)||"Title",this.text(t).data("title-editable",t),!0}),!n&&!i||!r)return!0;r.on("click",function(t){t.preventDefault(),i=e.elements.content.find("form");var o=u(t.currentTarget);o.disabled(!0),o.hideIndicator(),o.showIndicator();t=b(i[0].elements,e.elements.content);if(t.invalid.length)return o.disabled(!1),o.hideIndicator(),o.showIndicator("fa fa-fw fa-exclamation-triangle"),void p.error(w("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),w("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));f(i.attribute("method"),g(i.attribute("action")+m()),t.valid.join("&"),function(t,e){var n,i,r;e.body.success?((n=a.parent("[data-pm-data]"))&&(n.data("pm-data",JSON.stringify(e.body.item)),r=e.body.item.enabled||e.body.item.options.attributes.enabled,i=c("div").html(e.body.html),n.html(i.firstChild().html()),n["0"==r?"addClass":"removeClass"]("g-menu-item-disabled")),null===o.data("apply-and-save")||(r=u("body").find(".button-save"))&&l.emit("click",{target:r}),x.serialize(a.parent("[data-g5-position]")),x.updatePendingChanges(),h.close(),p.success(w("GANTRY5_PLATFORM_JS_POSITIONS_SETTINGS_APPLIED"),w("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):h.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),o.hideIndicator()})})}else h.enableCloseByOverlay()}})});function e(t,i,e){var r,n,o,a;this.style("text-overflow","ellipsis"),e||t==i||(n=(r=this).data("g-config-href"),o=r.data("title-editable-type"),e=(r.data("g-config-method")||"post").toLowerCase(),(a=r.parent("[id]")).showIndicator(),a.find("[data-title-edit]").addClass("disabled"),(t="title"===o?{title:d(t)}:{key:d(t)}).data=a.find("[data-g5-position]").data("g5-position"),f(e,g(n+m()),t,function(t,e){var n;e.body.success?(n=c("div").html(e.body.position),a.html(n.find("[id]").html()),n=a.search("[data-title-editable]"),s(n)):(h.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),r.data("title-editable",i).text(i)),a.hideIndicator(),a.find("[data-title-edit]").removeClass("disabled")}))}var s=function(t){t&&t.length&&t.forEach(function(t){(t=u(t)).confWasAttached=!0,t.on("title-edit-start",function(){t.style("text-overflow","inherit")}),t.on("title-edit-end",e)})};l.delegate("change",'[data-g5-positions-assignments] input[type="hidden"]',function(t,e){var n=e.parent(".card").find(".settings-param-wrapper");n[1==e.value()?"addClass":"removeClass"]("hide"),n.search('input[type="hidden"]').forEach(function(t){(t=u(t)).value(0).disabled(!0)})}),l.on("statechangeAfter",function(t,e){var n=u("#positions [data-title-editable]");if(!n)return!0;n=n.filter(function(t){return void 0===u(t).confWasAttached}),s(n)}),s(u("#positions [data-title-editable]"))}),e.exports={}},{"../fields/submit":9,"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"./cards":47,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272}],49:[function(t,e,n){"use strict";var i=t("elements/domready"),s=t("elements/attributes"),r=t("../ui").modal,l=t("mout/array/contains"),u=t("mout/collection/forEach");t("../ui/popover");navigator.userAgent.toLowerCase().indexOf("firefox");i(function(){var a=s("body");a.delegate("click","[data-g-styles]",function(t,e){var n=s(t.target);if(t&&t.preventDefault&&t.preventDefault(),n.hasClass("swatch-preview")||n.parent(".swatch-preview"))return!0;var i,r,o,e=JSON.parse(e.data("g-styles"));u(e,function(t,e){i=s('[name="'+e+'"]'),r=!!i&&i.value(),i&&r!==t&&(o={target:i,forceOverride:!0},r="select"==i.tag()||l(["hidden","checkbox"],i.type())?"change":"input",i.value(t),a.emit(r,o),a.emit("keyup",o))})}),a.delegate("click","[data-g-styles] .swatch-preview",function(t,e){var n=e.parent("[data-g-styles]").find("img");if(!n)return!1;r.open({content:n[0].outerHTML,afterOpen:function(t){var e=parseInt(t.compute("padding-left"),10)+parseInt(t.compute("padding-right"),10);t.style({maxWidth:"80%",width:e+(n[0].naturalWidth||n[0].width)})}})})}),e.exports={}},{"../ui":54,"../ui/popover":56,"elements/attributes":108,"elements/domready":111,"mout/array/contains":166,"mout/collection/forEach":189}],50:[function(t,e,n){"use strict";var i=t("elements/domready"),s=t("mout/string/trim"),l=t("mout/object/forOwn"),c=t("elements"),d=t("../utils/cookie");i(function(){var o,a,u,t=c("body");t.delegate("click","[data-g-collapse]",function(t,e){if(e=t.element||e,o=JSON.parse(e.data("g-collapse")),a=c(t.target),u=(!1!==o.store?d.read("g5-collapsed"):u)||{},o.handle||(o.handle=e.find(".g-collapse")),!a.matches(o.handle)&&!a.parent(o.handle))return!1;void 0===u[o.id]&&(u[o.id]=o.collapsed,!1!==o.store&&d.write("g5-collapsed",u));var n=u[o.id],i=o.target?e.find(o.target):e,r=i.parent(".card")||i;r&&r.hasClass("g-collapsed")&&(r.removeClass("g-collapsed"),e.removeClass("g-collapsed-main"));t=function(t){(n="number"!=typeof t?t:n)||(r.addClass("g-collapsed"),e.addClass("g-collapsed-main"),e.attribute("style",null)),o.handle.data("title",n?o.collapse:o.expand).data("tip",n?o.collapse:o.expand),u[o.id]=!n,o.collapsed=!n;t=JSON.parse(e.data("g-collapse"));t.collapsed=!n,e.data("g-collapse",JSON.stringify(t)),!1!==o.store&&d.write("g5-collapsed",u)};e.gFastCollapse?(i[n?"removeClass":"addClass"]("g-collapsed"),e[n?"removeClass":"addClass"]("g-collapsed-main")):(e.removeClass("g-collapsed-main"),i.removeClass("g-collapsed")[n?"removeClass":"addClass"]("g-collapsed")),t(n),e.gFastCollapse=!1}),t.delegate("click","[data-g-collapse-all]",function(t,e){var n,i,r,o,a,s="true"===e.data("g-collapse-all"),e=e.parent(".g-filter-actions").nextSibling().search("[data-g-collapse]"),l=d.read("g5-collapsed")||{};e&&e.forEach(function(t){t=c(t),o=t.parent(".card"),a=o.find("> .g-collapsed"),i=JSON.parse(t.data("g-collapse")),r=i.handle?t.find(i.handle):t.find(".g-collapse"),n=i.target?t.find(i.target):t,r.data("title",s?i.expand:i.collapse).data("tip",s?i.expand:i.collapse),(u=(!1!==i.store?l:u)||{})[i.id]=s,!1!==i.store&&d.write("g5-collapsed",u),n.attribute("style",null),t[s?"addClass":"removeClass"]("g-collapsed-main"),o[s?"addClass":"removeClass"]("g-collapsed"),a&&a[s?"addClass":"removeClass"]("g-collapsed")})}),t.delegate("input","[data-g-collapse-filter]",function(t,e){var n=JSON.parse(e.data("g-collapse-filter")||"{}"),i=e.parent(".g-filter-actions").nextSibling().search(n.element||".card"),r=e.value();i&&(r||i.attribute("style",null),i.forEach(function(t,e){t=c(t),s(t.find(n.title||"h4 .g-title").text()).match(new RegExp("^"+r+"|\\s"+r,"gi"))?t.attribute("style",null):t.style("display","none")}))})}),e.exports=function(){var n,i,r,o,a,t=d.read("g5-collapsed")||{};if(!c("[data-g-collapse]"))return!1;l(t,function(t,e){(n=c('[data-g-collapse-id="'+e+'"]'))&&(i=JSON.parse(n.data("g-collapse")),r=i.handle?n.find(i.handle):n.find(".g-collapse"),o=i.target?n.find(i.target):n,a=n.parent(".card")||o,r.data("title",t?i.expand:i.collapse).data("tip",t?i.expand:i.collapse),o.attribute("style",null),a[t?"addClass":"removeClass"]("g-collapsed"),n[t?"addClass":"removeClass"]("g-collapsed-main"))})}},{"../utils/cookie":64,elements:113,"elements/domready":111,"mout/object/forOwn":232,"mout/string/trim":272}],51:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime/emitter"),o=t("prime-util/prime/bound"),a=t("prime-util/prime/options"),s=t("mout/function/bind"),l=(t("mout/array/contains"),t("./drag.events")),d=t("../utils/elements.utils");t("elements/events"),t("elements/delegation");var u="Microsoft Internet Explorer"===navigator.appName,l=new i({mixin:[o,a],inherits:r,options:{delegate:null,droppables:!1,catchClick:!1},DRAG_EVENTS:l,constructor:function(t,e){this.container=d(t),this.container&&(this.setOptions(e),this.element=null,this.origin={x:0,y:0,transform:null,offset:{x:0,y:0}},this.matched=!1,this.lastMatched=!1,this.lastOvered=null,this.attach())},attach:function(){this.DRAG_EVENTS.EVENTS.START.forEach(s(function(t){this.container.delegate(t,this.options.delegate,this.bound("start"))},this))},detach:function(){this.DRAG_EVENTS.EVENTS.START.forEach(s(function(t){this.container.undelegate(t,this.options.delegate,this.bound("start"))},this))},start:function(t,e){clearTimeout(this.scrollInterval),e.LMTooltip&&e.LMTooltip.remove(),d("html").attribute("style","height: 100% !important"),this.scrollHeight=document.body.scrollHeight;var n=d(t.target);if(!e.parent("[data-lm-root]")&&e.hasClass("g-block")&&!n.matches(".submenu-reorder")&&!n.parent(".submenu-reorder"))return!0;if(t.which&&1!==t.which||d(t.target).matches(this.options.exclude))return!0;this.element=d(e),this.original=this.element,this.matched=!1,this.options.catchClick&&(this.moved=!1),(n.matches(".submenu-reorder")||n.parent(".submenu-reorder"))&&(this.element=n.parent("[data-mm-id]")),this.emit("dragdrop:beforestart",t,this.element),u&&this.element.style({"-ms-touch-action":"none","touch-action":"none"}),t.preventDefault(),this.origin={x:(t.changedTouches?t.changedTouches[0]:t).pageX,y:(t.changedTouches?t.changedTouches[0]:t).pageY,transform:this.element.compute("transform")};var i=this.element[0].getBoundingClientRect();if(this.origin.offset={clientRect:i,scroll:{x:window.scrollX,y:window.scrollY},x:this.origin.x-i.right,y:i.top-this.origin.y},"grid"===this.element.data("lm-blocktype")&&Math.abs(this.origin.offset.x)Math.abs(c)&&0Math.abs(c)&&e<0&&"right")||Math.abs(c)>Math.abs(e)&&0=c.width-c.width/2&&"after")||"other",y:(Math.abs(a-c.top)=c.height/2&&"below")||"other"},this.emit("dragdrop:location",t,c,this.matched,this.element)):this.emit("dragdrop:nolocation",t)),this.lastOvered=s,this.lastX=o,this.lastY=a,this.emit("dragdrop:move",t,this.element)}},_removeStyleAttribute:function(t){(t=d(t||this.element)).data("mm-id")||t.attribute("style",null)}});e.exports=l},{"../utils/elements.utils":66,"./drag.events":52,"elements/delegation":110,"elements/events":112,"mout/array/contains":166,"mout/function/bind":192,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],52:[function(t,e,n){"use strict";function r(t){t=t.split(" ");for(var e,n=document.createElement("div"),i=!1,r=t.length-1;0<=r;r--)if((i=(e="on"+t[r])in n)||(n.setAttribute(e,"return;"),i="function"==typeof n[e]),i){i=t[r];break}return n=null,i}var i=function(t){for(var e,n=[],i=(t=t.split(" ")).length-1;0<=i;i--)(e=r(t[i]))&&n.push(e);return n},o={START:r("mousedown touchstart MSPointerDown pointerdown"),MOVE:r("mousemove touchmove MSPointerMove pointermove"),STOP:r("mouseup touchend MSPointerUp pointerup")},i={START:i("mousedown touchstart MSPointerDown pointerdown"),MOVE:i("mousemove touchmove MSPointerMove pointermove"),STOP:i("mouseup touchend MSPointerUp pointerup")};e.exports={EVENT:o,EVENTS:i}},{}],53:[function(t,e,n){"use strict";var i=t("prime"),r=t("../utils/elements.utils"),o=t("prime/emitter"),a=t("prime-util/prime/bound"),o=new i({mixin:[t("prime-util/prime/options"),a],inherits:o,constructor:function(t,e){this.setOptions(e),this.element=r(t),this.element&&this.hide(!0)},setTop:function(){void 0===this.top&&(this.top=parseInt(this.element.compute("top"),10),this.left=r("#g5-container")[0].getBoundingClientRect().left,"grav"==GANTRY_PLATFORM&&(this.left=0))},show:function(t){this.element&&(this.setTop(),this.out(),this.element[t?"style":"animate"]({top:this.top,left:this.left},{duration:"150ms"}))},hide:function(t){var e;this.element&&(this.setTop(),this.element.style("display","block"),e={top:-this.element[0].offsetHeight},this.out(),this.element[t?"style":"animate"](e,{duration:"150ms"}))},over:function(){this.element.find(".trash-zone").animate({transform:"scale(1.2)"},{duration:"150ms",equation:"cubic-bezier(0.5,0,0.5,1)"})},out:function(){this.element.find(".trash-zone").animate({transform:"scale(1)"},{duration:"150ms",equation:"cubic-bezier(0.5,0,0.5,1)"})}});e.exports=o},{"../utils/elements.utils":66,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],54:[function(t,e,n){"use strict";var i=t("./selectize");e.exports={modal:t("./modal"),togglers:t("./togglers"),collapse:t("./collapse"),selectize:i,toastr:t("./toastr")}},{"./collapse":50,"./modal":55,"./selectize":58,"./toastr":59,"./togglers":60}],55:[function(t,e,n){"use strict";var i=t("prime"),r=t("../utils/elements.utils"),o=t("elements/zen"),a=t("prime/map")(),s=t("prime/emitter"),l=t("prime-util/prime/bound"),u=t("prime-util/prime/options"),c=t("elements/domready"),d=t("mout/function/bind"),h=t("mout/array/map"),p=t("mout/array/forEach"),f=t("mout/array/last"),m=t("mout/object/merge"),g=(t("mout/string/trim"),t("agent")),v=!1,b=new i({mixin:[l,u],inherits:s,animationEndEvent:["animationend","webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend"],globalID:1,options:{baseClassNames:{container:"g5-dialog",content:"g5-content",overlay:"g5-overlay",close:"g5-close",closing:"g5-closing",open:"g5-dialog-open"},content:"",remote:"",showCloseButton:!0,escapeToClose:!0,overlayClickToClose:!0,appendNode:"#g5-container",className:"g5-dialog-theme-default",css:{},overlayClassName:"",overlayCSS:"",contentClassName:"",contentCSS:"",closeClassName:"g5-dialog-close",closeCSS:"",afterOpen:null,afterClose:null},constructor:function(t){this.setOptions(t),this.defaults=this.options;var e=this;c(function(){r(window).on("keydown",function(t){if(27===t.keyCode)return e.closeByEscape()}),e.animationEndEvent=v}),this.on("dialogOpen",function(t){r("body").addClass(t.baseClassNames.open),r("html").addClass(t.baseClassNames.open)}).on("dialogAfterClose",d(function(t){var e=this.getAll();e&&e.length||(r("body").removeClass(t.baseClassNames.open),r("html").removeClass(t.baseClassNames.open))},this))},storage:function(){return a},open:function(n){(n=m(this.options,n)).id=this.globalID++;var i={};i.container=o("div").addClass(n.baseClassNames.container).addClass(n.className).style(n.css).attribute("tabindex","0").attribute("role","dialog").attribute("aria-hidden","true").attribute("aria-labelledby","g-modal-labelledby").attribute("aria-describedby","g-modal-describedby"),a.set(i.container,{dialog:n}),i.overlay=o("div").addClass(n.baseClassNames.overlay).addClass(n.overlayClassName).style(n.overlayCSS),a.set(i.overlay,{dialog:n}),n.overlayClickToClose&&(i.container.on("click",d(this._overlayClick,this,i.container[0])),i.overlay.on("click",d(this._overlayClick,this,i.overlay[0]))),i.container.appendChild(i.overlay),i.content=o("div").addClass(n.baseClassNames.content).addClass(n.contentClassName).style(n.contentCSS).attribute("aria-live","assertive").attribute("tabindex","0").html(n.content),a.set(i.content,{dialog:n}),i.container.appendChild(i.content),n.overlayClickToClose&&i.content.on("click",function(){return!0}),n.remote&&1 "+n.appendNode)||o("div.g5wp-out-of-scope"+n.appendNode).top(t):e).appendChild(i.container),n.elements=i,n.afterOpen&&n.afterOpen(i.content,n),setTimeout(d(function(){return this.emit("dialogOpen",n)},this),0),i.content},getAll:function(){var t=this.options;return r("."+t.baseClassNames.container+":not(."+t.baseClassNames.closing+") ."+t.baseClassNames.content)},getByID:function(e){var t=this.getAll();return t?r(t.filter(function(t){return t=r(t),a.get(t).dialog.id===e})):[]},getLast:function(){var t=h(this.getAll(),function(t){return t=r(t),a.get(t).dialog.id});return!!t.length&&Math.max.apply(Math,t)},close:function(t){if(!t){var e=r(f(this.getAll()));if(!e)return!1;t=a.get(e).dialog.id}return this.closeByID(t)},closeAll:function(){var t=h(this.getAll(),function(t){return t=r(t),a.get(t).dialog.id});return!!t.length&&(p(t.reverse(),function(t){return this.closeByID(t)},this),!0)},closeByID:function(t){var e=this.getByID(t);if(!e||!e.length)return!1;var n=a.get(e).dialog.elements.container,i=m({},a.get(e).dialog),t=function(){if(i.beforeClose)return i.beforeClose(e,i)},r=d(function(){if(i.remoteLoaded&&(i.remoteLoaded=function(){}),e.emit("dialogClose",i),n.remove(),this.emit("dialogAfterClose",i),i.afterClose)return i.afterClose(e,i)},this);return v?(t(),n.off(this.animationEndEvent).on(this.animationEndEvent,function(){return r()}).addClass(i.baseClassNames.closing)):(t(),r()),!0},closeByEscape:function(){var t=this.getLast();if(!1===t)return!1;var e=this.getByID(t);return!!a.get(e).dialog.escapeToClose&&this.closeByID(t)},enableCloseByOverlay:function(){var t=this.getLast();if(!1===t)return!1;t=a.get(this.getByID(t)).dialog.elements;t.container.on("click",d(this._overlayClick,this,t.container[0])),t.overlay.on("click",d(this._overlayClick,this,t.overlay[0])),t.content.on("click",function(){return!0})},showLoading:function(){return this.hideLoading(),r("#g5-container").appendChild(o("div.g5-dialog-loading-spinner."+this.options.className))},hideLoading:function(){var t=r(".g5-dialog-loading-spinner");return!!t&&t.remove()},_overlayClick:function(t,e){if(e.target===t)return this.close(a.get(r(t)).dialog.id)},_closeButtonClick:function(t){return this.close(a.get(r(t)).dialog.id)}});c(function(){var n=(document.body||document.documentElement).style;p(["animation","WebkitAnimation","MozAnimation","MsAnimation","OAnimation"],function(t,e){v=v||void 0!==n[t]&&b.prototype.animationEndEvent[e]})});s=new b;e.exports=s},{"../utils/elements.utils":66,agent:80,"elements/domready":111,"elements/zen":137,"mout/array/forEach":174,"mout/array/last":179,"mout/array/map":180,"mout/function/bind":192,"mout/object/merge":237,"mout/string/trim":272,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302}],56:[function(t,e,n){"use strict";var i=t("prime"),a=t("../utils/elements.utils"),s=t("elements/zen"),r=t("prime/map")(),o=t("prime/emitter"),l=t("prime-util/prime/bound"),u=t("prime-util/prime/options"),c=(t("elements/domready"),t("mout/function/bind")),d=(t("mout/array/map"),t("mout/array/forEach"),t("mout/array/last"),t("mout/object/merge"),t("mout/lang/isFunction")),h=t("agent"),p=new i({mixin:[l,u],inherits:o,options:{mainClass:"g5-popover",placement:"auto",width:"auto",height:"auto",trigger:"click",style:"",delay:300,cache:!0,multi:!1,arrow:!0,title:"",content:"",closeable:!1,padding:!0,targetEvents:!0,allowElementsClick:!1,url:"",type:"html",where:"#g5-container",template:''},constructor:function(t,e){this.setOptions(e),this.element=a(t),"click"===this.options.trigger?this.element.off("click",this.bound("toggle")).on("click",this.bound("toggle")):this.element.off("mouseenter",this.bound("mouseenterHandler")).off("mouseleave",this.bound("mouseleaveHandler")).on("mouseenter",this.bound("mouseenterHandler")).on("mouseleave",this.bound("mouseleaveHandler")),this._poped=!1},destroy:function(){this.hide(),r.set(this.element[0],null),this.element.off("click",this.bound("toggle")).off("mouseenter",this.bound("mouseenterHandler")).off("mouseleave",this.bound("mouseleaveHandler")),this.$target&&this.$target.remove()},hide:function(t){t&&(t.preventDefault(),t.stopPropagation()),this.element.emit("hide.popover",this),this.$target&&(this.$target.removeClass("in").style({display:"none"}),this.$target.remove()),this.element.emit("hidden.popover",this),this._focusAttached&&(a("body").off("focus",this.bound("focus"),!0),this._focusAttached=!1,this.restoreFocus())},toggle:function(t){t&&(t.preventDefault(),t.stopPropagation()),this[this.getTarget().hasClass("in")?"hide":"show"]()},focus:function(t){this.getTarget().hasClass("in")&&(t=a(t.target||t),this.$target[0]===t[0]||t.parent(this.$target)||this.element[0]===t[0]||t.parent(this.element)||(this.hide(),this._focusAttached&&this.restoreFocus()))},restoreFocus:function(e){var n=(e=a(e||this.element)).tag();setTimeout(function(){var t;"a"!=n&&"input"!=n&&"button"!=n?(t=e.find("a, button, input"))&&t[0].focus():e[0].focus()},0)},hideAll:function(t){var e="",e=t?"div."+this.options.mainClass:"div."+this.options.mainClass+":not(."+this.options.mainClass+"-fixed)",e=a(e);return e&&(e.removeClass("in").style({display:"none"}).attribute("tabindex","-1"),!t&&this._focusAttached&&this.restoreFocus(),this._focusAttached&&(a("body").off("focus",this.bound("focus"),!0),this._focusAttached=!1)),this},show:function(){var t=this.getTarget().attribute("class",null).addClass(this.options.mainClass).attribute("tabindex","0");if(this.options.multi||this.hideAll(),this.element.emit("beforeshow.popover",this),!this.options.cache||!this._poped){if(this.setTitle(this.getTitle()),this.options.closeable||t.find(".close").off("click").remove(),this.isAsync())return this.setContentASync(this.options.content),void this.displayContent();this.setContent(this.getContent()),t.style({display:"block"})}this.displayContent(),this.bindBodyEvents(),setTimeout(function(){t[0].focus()},0),this._focusAttached||(a("body").on("focus",this.bound("focus"),!0),this._focusAttached=!0)},displayContent:function(){var t=this.element.position(),e=this.getTarget().attribute("class",null).addClass(this.options.mainClass),n=this.getContentElement();this.element.emit("show.popover",this),"auto"!==this.options.width&&e.style({width:this.options.width}),"auto"!==this.options.height&&n.style({height:this.options.height}),!this.options.arrow&&e.find(".g-arrow")&&e.find(".g-arrow").remove();var i,r=a(this.options.where);"wordpress"==GANTRY_PLATFORM&&"#"+(r=a("#widgets-editor")||a("#customize-preview")||a("#widgets-right")||a(this.options.where)).id()!=this.options.where&&(r="wpwrap"==(i=a("#wpwrap")||a(".wp-customizer")).id()?i.nextSibling(this.options.where)||s("div.g5wp-out-of-scope"+this.options.where).after(i):i.find("> "+this.options.where)||s("div.g5wp-out-of-scope"+this.options.where).top(i)),e.remove().style({top:-1e3,left:-1e3,display:"block"}).bottom(r),this.options.style&&("string"==typeof this.options.style&&(this.options.style=this.options.style.split(",").map(Function.prototype.call,String.prototype.trim)),this.options.style.forEach(function(t){this.$target.addClass(this.options.mainClass+"-"+t)},this)),this.options.padding||(n.css("height",n.position().height),this.$target.addClass("g5-popover-no-padding")),i=e[0].offsetWidth,r=e[0].offsetHeight,n=this.getPlacement(t,r),this.options.targetEvents&&this.initTargetEvents();var o,r=this.getTargetPosition(t,n,i,r);this.$target.style(r.position).addClass(n).addClass("in"),"iframe"===this.options.type&&(o=e.find("iframe")).style({width:e.position().width,height:o.parent().position.height}),this.options.arrow||this.$target.style({margin:0}),this.options.arrow&&((o=this.$target.find(".g-arrow")).attribute("style",null),r.arrowOffset&&o.style(r.arrowOffset)),this._poped=!0,this.element[0].focus(),this.element.emit("shown.popover",this)},getTarget:function(){return this.$target||(this.$target=a(s("div").html(this.options.template).children()[0])),this.$target},getTitleElement:function(){return this.getTarget().find("."+this.options.mainClass+"-title")},getContentElement:function(){return this.getTarget().find("."+this.options.mainClass+"-content")},getTitle:function(){return this.options.title||this.element.data("g5-popover-title")||this.element.attribute("title")},setTitle:function(t){var e=this.getTitleElement();t?e.html(t):e.remove()},hasContent:function(){return this.getContent()},getContent:function(){var t;return this.options.url?"iframe"===this.options.type&&(this.content=a('').attribute("src",this.options.url)):this.content||(t="",t=d(this.options.content)?this.options.content.apply(this.element[0],arguments):this.options.content,this.content=this.element.data("g5-popover-content")||t),this.content},setContent:function(t){var e=this.getTarget();this.getContentElement().html(t),this.$target=e},isAsync:function(){return"async"===this.options.type},setContentASync:function(i){h("get",this.options.url,c(function(t,e){i&&d(i)?this.content=i.apply(this.element[0],[e]):this.content=e.body.html,this.setContent(this.content);var n=this.getContentElement();n.attribute("style",null),setTimeout(c(function(){n.parent("."+this.options.mainClass)[0].focus()},this),0),this.displayContent(),this.bindBodyEvents();e=a("[data-selectize]");e&&e.selectize()},this))},bindBodyEvents:function(){var t=a("body");t.off("keyup",this.bound("escapeHandler")).on("keyup",this.bound("escapeHandler")),t.off("click",this.bound("bodyClickHandler")).on("click",this.bound("bodyClickHandler"))},mouseenterHandler:function(){this._timeout&&clearTimeout(this._timeout),0'+t.html+""},optgroup_header:function(t,e){return'"},option:function(t,e){var n=''+e(t[r])+"
";return n=this.options.Subtitles?'":n},item:function(t,e){var n="",i=e(t[o]);return"single"!==a&&(n='×'),''+e(t[r])+n},option_create:function(t,e){return'
Add '+e(t.input)+"…
"}},this.options.render)},setupCallbacks:function(){var t,e,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in n)n.hasOwnProperty(t)&&(e=this.options[n[t]])&&this.on(t,e)},onClick:function(t){this.isFocused||(this.focus(),t.preventDefault())},onMouseDown:function(t){var e=t.defaultPrevented||void 0===t.defaultPrevented;k(t.target);if(this.isFocused){if(t.target!==this.$control_input[0])return"single"===this.options.mode?this.isOpen?this.close():this.open():e||this.setActiveItem(null),!1}else e||window.setTimeout(m(function(){this.focus()},this),0)},onChange:function(){this.input.emit("change",this.input.value(),this),k("body").emit("change",{target:this.input})},onPaste:function(t){this.isFull()||this.isInputHidden||this.isLocked?t.preventDefault():this.options.splitOn&&setTimeout(m(function(){for(var t=A(this.$control_input.value()||"").split(this.options.splitOn),e=0,n=t.length;e
=this.options.maxItems},updateOriginalInput:function(t){var e;if(t=t||{},1===this.tagType){for(var n=[],i=0,r=this.items.length;i'+O(e)+"");n.length||this.input.attribute("multiple")||n.push(''),this.input.html(n.join(""))}else this.input.value(this.getValue()),this.input.attribute("value",this.input.value());this.isSetup&&!t.silent&&this.emit("change",this.input.value())},updatePlaceholder:function(){var t;this.options.placeholder&&(t=this.$control_input,this.items.length?t.attribute("placeholder",null):t.attribute("placeholder",this.options.placeholder),t.emit("update",{force:!0}))},open:function(){this.isLocked||this.isOpen||"multi"===this.options.mode&&this.isFull()||(this.focus(),this.isOpen=!0,this.refreshState(),this.$dropdown.style({visibility:"hidden",display:"block"}),this.positionDropdown(),this.$dropdown.style({visibility:"visible"}),this.emit("dropdown_open",this.$dropdown))},close:function(){var t=this.isOpen;"single"===this.options.mode&&this.items.length&&this.hideInput(),this.isOpen=!1,this.$dropdown.hide(),this.setActiveOption(null),this.refreshState(),t&&this.emit("dropdown_close",this.$dropdown)},positionDropdown:function(){var t=this.$control;t.position().top+=t[0].offsetHeight,this.$dropdown.style({width:t[0].offsetWidth,top:t[0].offsetTop+t[0].offsetHeight,left:t[0].offsetLeft})},clear:function(t){var e;this.items.length&&((e=this.$control.children(":not(input)"))&&e.remove(),this.items=[],this.lastQuery=null,this.setCaret(0),this.setActiveItem(null),this.updatePlaceholder(),this.updateOriginalInput({silent:t}),this.refreshState(),this.showInput(),this.emit("clear"))},insertAtCaret:function(t){var e=Math.min(this.caretPos,this.items.length);0===e?t.top(this.$control):t.after(this.$control.find(":nth-child("+e+")")),this.setCaret(e+1)},deleteSelection:function(t){var e,n,i,r,o,a=t&&8===t.keyCode?-1:1,s=c(this.$control_input[0]);if(this.$activeOption&&!this.options.hideSelected&&(r=(r=this.getAdjacentOption(this.$activeOption,-1))&&r.attribute("data-value")),i=[],this.$activeItems.length){var l,u=this.$control.children(":not(input)");for(l=(l=this.$control.children(".g-active"))&&k(0>>0;!function t(e){for(var n,i=!1===e;!(++s in r)&&s!==l;);i||s===l?a&&a(!i,r):(e=o.call({async:function(){return n=!0,t}},r[s],s,r),n||t(e))}()}},{}],64:[function(t,e,n){"use strict";e.exports={write:function(t,e){var n=new Date;n.setTime(n.getTime()+31536e6);var i=window.location.host.toString(),r=i.substring(i.lastIndexOf(".",i.lastIndexOf(".")-1)+1);i.match(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)&&(r=i);r=[t,"=",JSON.stringify(e),"; expires=",n.toGMTString(),"; domain=.",r,"; path=/;"];document.cookie=r.join("")},read:function(t){t=t.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");t=document.cookie.match("(?:^|;)\\s*"+t+"=([^;]*)");return t?JSON.parse(decodeURIComponent(t[1])):null}}},{}],65:[function(t,e,n){"use strict";var s=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)};e.exports=function(t,e,n){var i,r=!1;t=t[0]||t;function o(t){i=t,function(){if(!r){s(a);r=true}}()}var a=function(){n.call(t,i),r=!1};try{t.addEventListener(e,o,!1)}catch(t){}return o}},{}],66:[function(t,e,n){"use strict";var r=t("elements"),i=t("moofx"),o=t("mout/array/map"),a=t("mout/function/series"),s=t("slick"),l=t("elements/zen"),u=t("../ui/progresser"),t=function(n,i){return function(t){var e=s.parse(t||"*");return t=o(e,function(t){return n+" "+t}).join(", "),this[i](t)}};r.implement({style:function(){var t=i(this);return t.style.apply(t,arguments),this},animate:function(){var t=i(this);return t.animate.apply(t,arguments),this},hide:function(){return this.style("display","none")},show:function(t){return this.style("display",t||"inherit")},progresser:function(e){var n;this.forEach(function(t){return(n=t.ProgresserInstance)?n.constructor(t,e):n=new u(t,e),t.ProgresserInstance=n})},compute:function(){var t=i(this);return t.compute.apply(t,arguments)},showIndicator:function(n,i){this.forEach(function(t){t=r(t),"boolean"==typeof n&&(i=n,n=null);var e=!i&&t.find("i");t.gHadIcon=!!e,e||(t.find("span")||t.children()||l("span").text(t.text()).top(t.empty()),(e=l("i")).top(t)),t.gIndicator||(t.gIndicator=e.attribute("class")||!0),e.attribute("class",n||"fa fa-fw fa-spin-fast fa-spinner")})},hideIndicator:function(){this.forEach(function(t){var e;!(t=r(t)).gIndicator||(e=t.find("i"))&&(t.gHadIcon?e.attribute("class",t.gIndicator):e.remove(),t.gIndicator=null)})},slideDown:function(t,e){var n=this,i=this.getRealSize();if(e="function"==typeof t?t:e||function(){},!1===this.gSlideCollapsed)return e();e=a(function(){n.gSlideCollapsed=!1},e,function(){n.attribute("style",n.gSlideStyle)}),t="string"==typeof t?t:{duration:"250ms",callback:e},this.style("visibility","visible").attribute("aria-hidden",!1),this.animate({height:i.height},t)},slideUp:function(t,e){void 0===this.gSlideCollapsed&&(this.gSlideStyle=this.attribute("style"));var n=this;if(e="function"==typeof t?t:e||function(){},!0===this.gSlideCollapsed)return e();e=a(function(){n.gSlideCollapsed=!0},e,function(){n.style("visibility","hidden").attribute("aria-hidden",!0)}),t="string"==typeof t?t:{duration:"250ms",callback:e},this.style({overflow:"hidden"}).animate({height:0},t)},slideToggle:function(t,e){var n=this.getRealSize();return this[n.height&&!this.gSlideCollapsed?"slideUp":"slideDown"](t,e)},getRealSize:function(){var t,e=this.attribute("style");return this.style({position:"relative",overflow:"inherit",top:-5e4,height:"auto",width:"auto"}),t={width:parseInt(this.compute("width"),10),height:parseInt(this.compute("height"),10)},this[0].style=e,t},sibling:t("++","find"),siblings:t("~~","search")}),e.exports=r},{"../ui/progresser":57,elements:113,"elements/zen":137,moofx:138,"mout/array/map":180,"mout/function/series":197,slick:314}],67:[function(t,e,n){"use strict";var i=t("elements");i.implement({belowthefold:function(t,e){t=this.search(t);if(e=e||0,!t)return!1;var n=this.position().height+this[0].scrollTop;return t.filter(function(t){return n<=i(t)[0].offsetTop-e})},abovethetop:function(t,e){t=this.search(t);if(e=e||0,!t)return!1;var n=this[0].scrollTop;return t.filter(function(t){return n>=i(t)[0].offsetTop+i(t).position().height-e})},rightofscreen:function(t,e){t=this.search(t);if(e=e||0,!t)return!1;var n=this.position().width+this[0].scrollLeft;return t.filter(function(t){return n<=i(t)[0].offsetLeft-e})},leftofscreen:function(t,e){t=this.search(t);if(e=e||0,!t)return!1;var n=this[0].scrollLeft;return t.filter(function(t){return n>=i(t)[0].offsetLeft+i(t).position().width-e})},inviewport:function(t,e){t=this.search(t);if(e=e||0,!t)return!1;var n=this.position();return t.filter(function(t){return(t=i(t))[0].offsetTop+e>=this[0].scrollTop&&t[0].offsetTop-e<=this[0].scrollTop+n.height},this)}}),e.exports=i},{elements:113}],68:[function(t,e,n){"use strict";function o(t){var e=!0,n=(t=d(t)).value(),i="checkbox"==(c=t.type())||"radio"==c,r=t.attribute("disabled"),o=t.attribute("required"),a=t.attribute("minlength"),s=t.attribute("maxlength"),l=t.attribute("min"),u=t.attribute("max"),c=t.attribute("pattern");return r||!(e=(e=(e=e&&(!o||i&&t.checked()||!i&&n))&&(i||(!a||n.length>=a)&&(!s||n.length<=s)))&&c?(c=new RegExp(c)).test(n):e)||null===l&&null===u||(null!==l&&(e=parseFloat(n)>=parseFloat(l)),null!==u&&(e=parseFloat(n)<=parseFloat(u))),e}var d=t("elements");e.exports=function(t){var e=(t=d(t))[0],n=t.tag(),i=t.type(),r=!0;return~["input","textarea","select"].indexOf(n)?(void 0!==e.willValidate?("input"!=n||e.type.toLowerCase()===i&&!t.hasClass("custom-validation-field")||e.setCustomValidity(o(t)?"":"The field value is invalid"),e.checkValidity()):(e.validity=e.validity||{},e.validity.valid=o(t)),r=e.validity.valid):r}},{elements:113}],69:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime/map"),o=t("prime/emitter"),a=t("../ui").modal,s=t("./get-ajax-url").global,l=t("./get-ajax-url").parse,u=t("./get-ajax-suffix"),o=new i({inherits:o,constructor:function(){this.flags=r()},set:function(t,e){return this.flags.set(t,e).get(t)},get:function(t,e){var n=this.flags.get(t);return n||this.set(t,e)},keys:function(){return this.flags.keys()},values:function(){return this.flags.values()},warning:function(t){var i=t.callback||function(){},e=t.afterclose||function(){},n=l(t.url||s("unsaved")+u());t.url||t.message||(t.url=!0),t.url?a.open({content:"Loading...",remote:n,data:t.data||!1,remoteLoaded:function(t,e){var n=e.elements.content;i&&i.call(this,t,n,e)},afterClose:e||function(){}}):a.open({content:t.message,afterOpen:function(t,e){var n=e.elements.content;i&&i.call(this,t,n,e)},afterClose:e||function(){}})}});e.exports=new o},{"../ui":54,"./get-ajax-suffix":70,"./get-ajax-url":71,prime:301,"prime/emitter":300,"prime/map":302}],70:[function(t,e,n){"use strict";e.exports=function(){var t=window.GANTRY_AJAX_SUFFIX||void 0;return void 0===t?"":t}},{}],71:[function(t,e,n){"use strict";var i=t("mout/string/unescapeHtml"),o=t("./get-ajax-suffix"),a=t("mout/string/endsWith"),s=t("mout/queryString/getQuery"),l=t("mout/queryString/getParam");t("mout/queryString/setParam");e.exports={global:function(t,e){var n=window.GANTRY_AJAX_URL||"";e=e||"%ajax%";e=new RegExp(e,"g");return i((void 0===n?"":n).replace(e,t))},config:function(t,e){var n=window.GANTRY_AJAX_CONF_URL||"";e=e||"%ajax%";e=new RegExp(e,"g");return i((void 0===n?"":n).replace(e,t))},parse:function(t){var e=window.GANTRY_PLATFORM||"";switch(void 0===e?"":e){case"wordpress":t=t.replace(/themes\.php/gi,"admin-ajax.php");break;case"grav":var n,i,r=o();a(t,r)&&(n=""+s(t),i=""+l(t,"nonce"),t=t.replace(n,r)+n.replace(i,i.replace(r,"")))}return t}}},{"./get-ajax-suffix":70,"mout/queryString/getParam":247,"mout/queryString/getQuery":248,"mout/queryString/setParam":249,"mout/string/endsWith":258,"mout/string/unescapeHtml":274}],72:[function(t,e,n){"use strict";var i=t("elements"),r=t("mout/string/trim");e.exports={getOutlineNameById:function(t){return null==t?"":r(i("#configuration-selector").selectizeInstance.Options[t].text)},getCurrentOutline:function(){return r(i("#configuration-selector").selectizeInstance.getValue())}}},{elements:113,"mout/string/trim":272}],73:[function(t,e,n){"use strict";var i=t("elements/zen"),r=null;e.exports=function(){if(null!==r)return r;var t,e=i("div").bottom("#g5-container");return e.style({width:100,height:100,overflow:"scroll",position:"absolute",zIndex:-9999}),t=e[0].offsetWidth-e[0].clientWidth,e.remove(),r=t}},{"elements/zen":137}],74:[function(t,e,n){"use strict";var i=t("elements"),r=t("elements/domready"),t={};if(void 0!==t.Adapter)throw new Error("History.js Adapter has already been loaded...");t.Adapter={bind:function(t,e,n){i(t).on(e,n)},trigger:function(t,e,n){i(t).emit(e,n)},extractEventData:function(t,e){return e&&e.event&&e.event[t]||e&&e[t]||void 0},onDomLoad:function(t){r(t)}},void 0!==t.init&&t.init(),e.exports=t},{elements:113,"elements/domready":111}],75:[function(t,e,n){"use strict";var s=window.console||void 0,l=window.document,i=window.navigator,r=!1,o=window.setTimeout,a=window.clearTimeout,u=window.setInterval,c=window.clearInterval,d=window.JSON,h=window.alert,p=window.History=t("./history-adapter")||{},f=window.history;try{(r=window.sessionStorage).setItem("TEST","1"),r.removeItem("TEST")}catch(t){r=!1}d.stringify=d.stringify||d.encode,d.parse=d.parse||d.decode,void 0===p.init&&(p.init=function(t){return void 0!==p.Adapter&&(void 0!==p.initCore&&p.initCore(),void 0!==p.initHtml4&&p.initHtml4(),!0)},p.initCore=function(t){if(void 0!==p.initCore.initialized)return!1;var e;if(p.initCore.initialized=!0,p.options=p.options||{},p.options.hashChangeInterval=p.options.hashChangeInterval||100,p.options.safariPollInterval=p.options.safariPollInterval||500,p.options.doubleCheckInterval=p.options.doubleCheckInterval||500,p.options.disableSuid=p.options.disableSuid||!1,p.options.storeInterval=p.options.storeInterval||1e3,p.options.busyDelay=p.options.busyDelay||250,p.options.debug=p.options.debug||!1,p.options.initialTitle=p.options.initialTitle||l.title,p.options.html4Mode=p.options.html4Mode||!1,p.options.delayInit=p.options.delayInit||!1,p.intervalList=[],p.clearAllIntervals=function(){var t,e=p.intervalList;if(null!=e){for(t=0;t",">").replace(" & "," & ")}catch(t){}return l.title=n,p},p.queues=[],p.busy=function(t){var n;return void 0!==t?p.busy.flag=t:void 0===p.busy.flag&&(p.busy.flag=!1),p.busy.flag||(a(p.busy.timeout),n=function(){var t,e;if(!p.busy.flag)for(t=p.queues.length-1;0<=t;--t)0!==(e=p.queues[t]).length&&(e=e.shift(),p.fireQueueItem(e),p.busy.timeout=o(n,p.options.busyDelay))},p.busy.timeout=o(n,p.options.busyDelay)),p.busy.flag},p.busy.flag=!1,p.fireQueueItem=function(t){return t.callback.apply(t.scope||p,t.args||[])},p.pushQueue=function(t){return p.queues[t.queue||0]=p.queues[t.queue||0]||[],p.queues[t.queue||0].push(t),p},p.queue=function(t,e){return"function"==typeof t&&(t={callback:t}),void 0!==e&&(t.queue=e),p.busy()?p.pushQueue(t):p.fireQueueItem(t),p},p.clearQueue=function(){return p.busy.flag=!1,p.queues=[],p},p.stateChanged=!1,p.doubleChecker=!1,p.doubleCheckComplete=function(){return p.stateChanged=!0,p.doubleCheckClear(),p},p.doubleCheckClear=function(){return p.doubleChecker&&(a(p.doubleChecker),p.doubleChecker=!1),p},p.doubleCheck=function(t){return p.stateChanged=!1,p.doubleCheckClear(),p.bugs.ieDoubleCheck&&(p.doubleChecker=o(function(){return p.doubleCheckClear(),p.stateChanged||t(),!0},p.options.doubleCheckInterval)),p},p.safariStatePoll=function(){var t=p.extractState(p.getLocationHref());if(!p.isLastSavedState(t))return t||p.createStateObject(),p.Adapter.trigger(window,"popstate"),p},p.back=function(t){return!1!==t&&p.busy()?(p.pushQueue({scope:p,callback:p.back,args:arguments,queue:t}),!1):(p.busy(!0),p.doubleCheck(function(){p.back(!1)}),f.go(-1),!0)},p.forward=function(t){return!1!==t&&p.busy()?(p.pushQueue({scope:p,callback:p.forward,args:arguments,queue:t}),!1):(p.busy(!0),p.doubleCheck(function(){p.forward(!1)}),f.go(1),!0)},p.go=function(t,e){var n;if(00&&a[a.length-1].lhs&&Object.getOwnPropertyDescriptor(a[a.length-1].lhs,o);var v=d!=="undefined"||a&&a.length>0&&a[a.length-1].rhs&&Object.getOwnPropertyDescriptor(a[a.length-1].rhs,o);if(!g&&v)n.push(new x(l,e));else if(!v&&g)n.push(new k(l,t));else if(C(t)!==C(e))n.push(new w(l,t,e));else if(C(t)==="date"&&t-e!==0)n.push(new w(l,t,e));else if(c==="object"&&t!==null&&e!==null){for(h=a.length-1;h>-1;--h)if(a[h].lhs===t){m=true;break}if(!m){a.push({lhs:t,rhs:e});if(Array.isArray(t)){if(s){t.sort(function(t,e){return T(t)-T(e)});e.sort(function(t,e){return T(t)-T(e)})}h=e.length-1;p=t.length-1;while(h>p)n.push(new S(l,h,new x(undefined,e[h--])));while(p>h)n.push(new S(l,p,new k(undefined,t[p--])));for(;h>=0;--h)E(t[h],e[h],n,i,l,h,a,s)}else{var b=Object.keys(t);var y=Object.keys(e);for(h=0;h=0){E(t[f],e[f],n,i,l,f,a,s);y[m]=null}else E(t[f],undefined,n,i,l,f,a,s)}for(h=0;h>8&255]}function o(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function a(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function s(t){return M(t,23,4)}function l(t){return M(t,52,8)}function u(t,e,n,i){var r=w(n),n=I(t);if(r+e>n.byteLength)throw z(D);return t=I(n.buffer).bytes,n=r+n.byteOffset,e=t.slice(n,n+e),i?e:e.reverse()}function c(t,e,n,i,r,o){if(n=w(n),t=I(t),n+e>t.byteLength)throw z(D);for(var a=I(t.buffer).bytes,s=n+t.byteOffset,l=i(+r),u=0;uq;)(U=$[q++])in F||f(F,U,L[U]);g.constructor=F}S&&k(n)!==A&&S(n,A);var A=new P(new F(2)),G=n.setInt8;A.setInt8(0,2147483648),A.setInt8(1,2147483649),!A.getInt8(0)&&A.getInt8(1)||m(n,{setInt8:function(t,e){G.call(this,t,e<<24>>24)},setUint8:function(t,e){G.call(this,t,e<<24>>24)}},{unsafe:!0})}else F=function(t){v(this,F,j);t=w(t);_(this,{bytes:E.call(new Array(t),0),byteLength:t}),h||(this.byteLength=t)},P=function(t,e,n){v(this,P,R),v(t,F,R);var i=I(t).byteLength,e=b(e);if(e<0||i>24},getUint8:function(t){return u(this,1,t)[0]},getInt16:function(t){t=u(this,2,t,1>16},getUint16:function(t){t=u(this,2,t,1>>0},getFloat32:function(t){return B(u(this,4,t,1")}),g="$0"==="a".replace(/./,"$0"),n=d("replace"),v=!!/./[n]&&""===/./[n]("a","$0"),b=!c(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};t="ab".split(t);return 2!==t.length||"a"!==t[0]||"b"!==t[1]});t.exports=function(n,t,e,i){var o,r,a=d(n),s=!c(function(){var t={};return t[a]=function(){return 7},7!=""[n](t)}),l=s&&!c(function(){var t=!1,e=/a/;return"split"===n&&((e={constructor:{}}).constructor[f]=function(){return e},e.flags="",e[a]=/./[a]),e.exec=function(){return t=!0,null},e[a](""),!t});s&&l&&("replace"!==n||m&&g&&!v)&&("split"!==n||b)||(o=/./[a],e=(l=e(a,""[n],function(t,e,n,i,r){return e.exec===h?s&&!r?{done:!0,value:o.call(e,n,i)}:{done:!0,value:t.call(n,e,i)}:{done:!1}},{REPLACE_KEEPS_$0:g,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:v}))[0],r=l[1],u(String.prototype,n,e),u(RegExp.prototype,a,2==t?function(t,e){return r.call(t,this,e)}:function(t){return r.call(t,this)})),i&&p(RegExp.prototype[a],"sham",!0)}},9974:function(t,e,n){var o=n(3099);t.exports=function(i,r,t){if(o(i),void 0===r)return i;switch(t){case 0:return function(){return i.call(r)};case 1:return function(t){return i.call(r,t)};case 2:return function(t,e){return i.call(r,t,e)};case 3:return function(t,e,n){return i.call(r,t,e,n)}}return function(){return i.apply(r,arguments)}}},5005:function(t,e,n){function i(t){return"function"==typeof t?t:void 0}var r=n(857),o=n(7854);t.exports=function(t,e){return arguments.length<2?i(r[t])||i(o[t]):r[t]&&r[t][e]||o[t]&&o[t][e]}},1246:function(t,e,n){var i=n(648),r=n(7497),o=n(5112)("iterator");t.exports=function(t){if(null!=t)return t[o]||t["@@iterator"]||r[i(t)]}},8554:function(t,e,n){var i=n(9670),r=n(1246);t.exports=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(String(t)+" is not iterable");return i(e.call(t))}},647:function(t,e,n){var i=n(7908),h=Math.floor,r="".replace,p=/\$([$&'`]|\d\d?|<[^>]*>)/g,f=/\$([$&'`]|\d\d?)/g;t.exports=function(o,a,s,l,u,t){var c=s+o.length,d=l.length,e=f;return void 0!==u&&(u=i(u),e=p),r.call(t,e,function(t,e){var n;switch(e.charAt(0)){case"$":return"$";case"&":return o;case"`":return a.slice(0,s);case"'":return a.slice(c);case"<":n=u[e.slice(1,-1)];break;default:var i=+e;if(0==i)return t;if(d>1,u=23===e?p(2,-24)-p(2,-77):0,c=t<0||0===t&&1/t<0?1:0,d=0;for((t=h(t))!=t||t===1/0?(r=t!=t?1:0,i=s):(i=f(m(t)/g),t*(n=p(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+l?u/n:u*p(2,1-l))*n&&(i++,n/=2),s<=i+l?(r=0,i=s):1<=i+l?(r=(t*n-1)*p(2,e),i+=l):(r=t*p(2,l-1)*p(2,e),i=0));8<=e;o[d++]=255&r,r/=256,e-=8);for(i=i<>1,s=r-7,l=i-1,i=t[l--],u=127&i;for(i>>=7;0>=-s,s+=e;0"+t+""+h+">"},m=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;m=r?function(t){t.write(f("")),t.close();var e=t.parentWindow.Object;return t=null,e}(r):(t=c("iframe"),e="java"+h+":",t.style.display="none",u.appendChild(t),t.src=String(e),(t=t.contentWindow.document).open(),t.write(f("document.F=Object")),t.close(),t.F);for(var n=s.length;n--;)delete m[d][s[n]];return m()};l[p]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(i[d]=o(t),n=new i,i[d]=null,n[p]=t):n=m(),void 0===e?n:a(n,e)}},6048:function(t,e,n){var i=n(9781),a=n(3070),s=n(9670),l=n(1956);t.exports=i?Object.defineProperties:function(t,e){s(t);for(var n,i=l(e),r=i.length,o=0;or;)a(i,n=e[r++])&&(~l(o,n)||o.push(n));return o}},1956:function(t,e,n){var i=n(6324),r=n(748);t.exports=Object.keys||function(t){return i(t,r)}},5296:function(t,e){"use strict";var n={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,r=i&&!n.call({1:2},1);e.f=r?function(t){t=i(this,t);return!!t&&t.enumerable}:n},7674:function(t,e,n){var r=n(9670),o=n(6077);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n,i=!1,t={};try{(n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(t,[]),i=t instanceof Array}catch(t){}return function(t,e){return r(t),o(e),i?n.call(t,e):t.__proto__=e,t}}():void 0)},288:function(t,e,n){"use strict";var i=n(1694),r=n(648);t.exports=i?{}.toString:function(){return"[object "+r(this)+"]"}},3887:function(t,e,n){var i=n(5005),r=n(8006),o=n(5181),a=n(9670);t.exports=i("Reflect","ownKeys")||function(t){var e=r.f(a(t)),n=o.f;return n?e.concat(n(t)):e}},857:function(t,e,n){n=n(7854);t.exports=n},2248:function(t,e,n){var r=n(1320);t.exports=function(t,e,n){for(var i in e)r(t,i,e[i],n);return t}},1320:function(t,e,n){var s=n(7854),l=n(8880),u=n(6656),c=n(3505),i=n(2788),n=n(9909),r=n.get,d=n.enforce,h=String(String).split("String");(t.exports=function(t,e,n,i){var r=!!i&&!!i.unsafe,o=!!i&&!!i.enumerable,a=!!i&&!!i.noTargetGet;"function"==typeof n&&("string"!=typeof e||u(n,"name")||l(n,"name",e),(i=d(n)).source||(i.source=h.join("string"==typeof e?e:""))),t!==s?(r?!a&&t[e]&&(o=!0):delete t[e],o?t[e]=n:l(t,e,n)):o?t[e]=n:c(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&r(this).source||i(this)})},7651:function(t,e,n){var i=n(4326),r=n(2261);t.exports=function(t,e){var n=t.exec;if("function"==typeof n){n=n.call(t,e);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==i(t))throw TypeError("RegExp#exec called on incompatible receiver");return r.call(t,e)}},2261:function(t,e,n){"use strict";var i,d=n(7066),r=n(2999),h=RegExp.prototype.exec,p=String.prototype.replace,o=h,f=(i=/a/,n=/b*/g,h.call(i,"a"),h.call(n,"a"),0!==i.lastIndex||0!==n.lastIndex),m=r.UNSUPPORTED_Y||r.BROKEN_CARET,g=void 0!==/()??/.exec("")[1];(f||g||m)&&(o=function(t){var e,n,i,r,o=this,a=m&&o.sticky,s=d.call(o),l=o.source,u=0,c=t;return a&&(-1===(s=s.replace("y","")).indexOf("g")&&(s+="g"),c=String(t).slice(o.lastIndex),0T((b-o)/d))throw RangeError(S);for(o+=(u-r)*d,r=u,c=0;cb)throw RangeError(S);if(e==r){for(var h=o,p=y;;p+=y){var f=p<=a?1:a+w<=p?w:p-a;if(h>1,t+=T(t/e);C*w>>1=e.length?{value:t.target=void 0,done:!0}:"keys"==n?{value:i,done:!1}:"values"==n?{value:e[i],done:!1}:{value:[i,e[i]],done:!1}},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},1249:function(t,e,n){"use strict";var i=n(2109),r=n(2092).map;i({target:"Array",proto:!0,forced:!n(1194)("map")},{map:function(t){return r(this,t,1=e.length?{value:void 0,done:!0}:(n=i(e,n),t.index+=n.length,{value:n,done:!1})})},4723:function(t,e,n){"use strict";var i=n(7007),c=n(9670),d=n(7466),r=n(4488),h=n(1530),p=n(7651);i("match",1,function(i,l,u){return[function(t){var e=r(this),n=null==t?void 0:t[i];return void 0!==n?n.call(t,e):new RegExp(t)[i](String(e))},function(t){var e=u(l,t,this);if(e.done)return e.value;var n=c(t),i=String(this);if(!n.global)return p(n,i);for(var r=n.unicode,o=[],a=n.lastIndex=0;null!==(s=p(n,i));){var s=String(s[0]);""===(o[a]=s)&&(n.lastIndex=h(i,d(n.lastIndex),r)),a++}return 0===a?null:o}]})},5306:function(t,e,n){"use strict";var i=n(7007),T=n(9670),E=n(7466),O=n(9958),o=n(4488),A=n(1530),I=n(647),_=n(7651),j=Math.max,R=Math.min;i("replace",2,function(r,w,x,t){var k=t.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,S=t.REPLACE_KEEPS_$0,C=k?"$":"$0";return[function(t,e){var n=o(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,n,e):w.call(String(n),t,e)},function(t,e){if(!k&&S||"string"==typeof e&&-1===e.indexOf(C)){var n=x(w,t,this,e);if(n.done)return n.value}var i=T(t),r=String(this),o="function"==typeof e;o||(e=String(e));var a,s=i.global;s&&(a=i.unicode,i.lastIndex=0);for(var l=[];;){if(null===(p=_(i,r)))break;if(l.push(p),!s)break;""===String(p[0])&&(i.lastIndex=A(r,E(i.lastIndex),a))}for(var u,c="",d=0,h=0;h>>0;if(0==i)return[];if(void 0===t)return[n];if(!c(t))return f.call(n,t,i);for(var r,o,a,s=[],e=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,u=new RegExp(t.source,e+"g");(r=h.call(u,n))&&!(l<(o=u.lastIndex)&&(s.push(n.slice(l,r.index)),1=i));)u.lastIndex===r.index&&u.lastIndex++;return l===n.length?!a&&u.test("")||s.push(""):s.push(n.slice(l)),s.length>i?s.slice(0,i):s}:"0".split(void 0,0).length?function(t,e){return void 0===t&&0===e?[]:f.call(this,t,e)}:f;return[function(t,e){var n=d(this),i=null==t?void 0:t[r];return void 0!==i?i.call(t,n,e):g.call(String(n),t,e)},function(t,e){var n=m(g,t,this,e,g!==f);if(n.done)return n.value;var i=v(t),r=String(this),n=b(i,RegExp),o=i.unicode,t=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(C?"y":"g"),a=new n(C?i:"^(?:"+i.source+")",t),s=void 0===e?S:e>>>0;if(0==s)return[];if(0===r.length)return null===x(a,r)?[r]:[];for(var l=0,u=0,c=[];ut.key){i.splice(e,0,t);break}e===o&&i.push(t)}n.updateURL()},forEach:function(t){for(var e,n=R(this).entries,i=y(t,16)return;s=0;while(h()){l=null;if(s>0)if(h()=="."&&s<4)r++;else return;if(!P.test(h()))return;while(P.test(h())){u=parseInt(h(),10);if(l===null)l=u;else if(l==0)return;else l=l*10+u;if(l>255)return;r++}e[n]=e[n]*256+l;s++;if(s==2||s==4)n++}if(s!=4)return;break}else if(h()==":"){r++;if(!h())return}else if(h())return;e[n++]=o}if(i!==null){c=n-i;n=7;while(n!=0&&c>0){d=e[n];e[n--]=e[i+c-1];e[i+--c]=d}}else if(n!=8)return;return e}(e.slice(1,-1)))?void(t.host=n):N;if(tt(t))return e=x(e),$.test(e)||null===(n=function(t){var e=t.split("."),n,i,r,o,a,s,l;if(e.length&&e[e.length-1]=="")e.pop();if((n=e.length)>4)return t;for(i=[],r=0;r1&&o.charAt(0)=="0"){a=z.test(o)?16:8;o=o.slice(a==8?1:2)}if(o==="")s=0;else{if(!(a==10?B:a==8?M:U).test(o))return t;s=parseInt(o,a)}i.push(s)}for(r=0;r=_(256,5-n))return null}else if(s>255)return null}for(l=i.pop(),r=0;r":1,"`":1}),X=g({},W,{"#":1,"?":1,"{":1,"}":1}),K=g({},X,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Q=function(t,e){var n=w(t,0);return 32=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw r}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw r}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n '),this.element.appendChild(t));var r=t.getElementsByTagName("span")[0];return r&&(null!=r.textContent?r.textContent=this.options.dictFallbackMessage:null!=r.innerText&&(r.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(t,e,n,i){var r={srcX:0,srcY:0,srcWidth:t.width,srcHeight:t.height},o=t.width/t.height;null==e&&null==n?(e=r.srcWidth,n=r.srcHeight):null==e?e=n*o:null==n&&(n=e/o);var a=(e=Math.min(e,r.srcWidth))/(n=Math.min(n,r.srcHeight));if(r.srcWidth>e||r.srcHeight>n)if("crop"===i)a
',drop:function(t){return this.element.classList.remove("dz-drag-hover")},dragstart:function(t){},dragend:function(t){return this.element.classList.remove("dz-drag-hover")},dragenter:function(t){return this.element.classList.add("dz-drag-hover")},dragover:function(t){return this.element.classList.add("dz-drag-hover")},dragleave:function(t){return this.element.classList.remove("dz-drag-hover")},paste:function(t){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var n=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){e.previewElement=v.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);var t,i=c(e.previewElement.querySelectorAll("[data-dz-name]"),!0);try{for(i.s();!(t=i.n()).done;){var r=t.value;r.textContent=e.name}}catch(t){i.e(t)}finally{i.f()}var o,a=c(e.previewElement.querySelectorAll("[data-dz-size]"),!0);try{for(a.s();!(o=a.n()).done;)(r=o.value).innerHTML=this.filesize(e.size)}catch(t){a.e(t)}finally{a.f()}this.options.addRemoveLinks&&(e._removeLink=v.createElement(''.concat(this.options.dictRemoveFile,"")),e.previewElement.appendChild(e._removeLink));var s,l=function(t){return t.preventDefault(),t.stopPropagation(),e.status===v.UPLOADING?v.confirm(n.options.dictCancelUploadConfirmation,function(){return n.removeFile(e)}):n.options.dictRemoveFileConfirmation?v.confirm(n.options.dictRemoveFileConfirmation,function(){return n.removeFile(e)}):n.removeFile(e)},u=c(e.previewElement.querySelectorAll("[data-dz-remove]"),!0);try{for(u.s();!(s=u.n()).done;)s.value.addEventListener("click",l)}catch(t){u.e(t)}finally{u.f()}}},removedfile:function(t){return null!=t.previewElement&&null!=t.previewElement.parentNode&&t.previewElement.parentNode.removeChild(t.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(t,e){if(t.previewElement){t.previewElement.classList.remove("dz-file-preview");var n,i=c(t.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.alt=t.name,r.src=e}}catch(t){i.e(t)}finally{i.f()}return setTimeout(function(){return t.previewElement.classList.add("dz-image-preview")},1)}},error:function(t,e){if(t.previewElement){t.previewElement.classList.add("dz-error"),"string"!=typeof e&&e.error&&(e=e.error);var n,i=c(t.previewElement.querySelectorAll("[data-dz-errormessage]"),!0);try{for(i.s();!(n=i.n()).done;)n.value.textContent=e}catch(t){i.e(t)}finally{i.f()}}},errormultiple:function(){},processing:function(t){if(t.previewElement&&(t.previewElement.classList.add("dz-processing"),t._removeLink))return t._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(t,e,n){if(t.previewElement){var i,r=c(t.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0);try{for(r.s();!(i=r.n()).done;){var o=i.value;"PROGRESS"===o.nodeName?o.value=e:o.style.width="".concat(e,"%")}}catch(t){r.e(t)}finally{r.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(t){if(t.previewElement)return t.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(t){return this.emit("error",t,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(t){if(t._removeLink&&(t._removeLink.innerHTML=this.options.dictRemoveFile),t.previewElement)return t.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}};function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function k(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,e=function(){};return{s:e,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,a=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return o=t.done,t},e:function(t){a=!0,r=t},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw r}}}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n"))),this.clickableElements.length&&function r(){o.hiddenFileInput&&o.hiddenFileInput.parentNode.removeChild(o.hiddenFileInput),o.hiddenFileInput=document.createElement("input"),o.hiddenFileInput.setAttribute("type","file"),(null===o.options.maxFiles||1".concat(this.options.dictFallbackText,"
")),e+='');e=x.createElement(e);return"FORM"!==this.element.tagName?(t=x.createElement(''))).appendChild(e):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:e}},{key:"getExistingFallback",value:function(){for(var t,e=0,n=["div","form"];e".concat(e," ").concat(this.options.dictFileSizeUnits[n])}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(t){if(t.dataTransfer){this.emit("drop",t);for(var e,n=[],i=0;i1024*this.options.maxFilesize*1024?e(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(t.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):x.isValidFile(t,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(e(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",t)):this.options.accept.call(this,t,e):e(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var n=this;e.upload={uuid:x.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=x.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(t){t?(e.accepted=!1,n._errorProcessing([e],t)):(e.accepted=!0,n.options.autoQueue&&n.enqueueFile(e)),n._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(t){var e,n=k(t,!0);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.enqueueFile(i)}}catch(t){n.e(t)}finally{n.f()}return null}},{key:"enqueueFile",value:function(t){var e=this;if(t.status!==x.ADDED||!0!==t.accepted)throw new Error("This file can't be queued because it has already been processed or was rejected.");if(t.status=x.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return e.processQueue()},0)}},{key:"_enqueueThumbnail",value:function(t){var e=this;if(this.options.createImageThumbnails&&t.type.match(/image.*/)&&t.size<=1024*this.options.maxThumbnailFilesize*1024)return this._thumbnailQueue.push(t),setTimeout(function(){return e._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var n=this._thumbnailQueue.shift();return this.createThumbnail(n,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(t){return e.emit("thumbnail",n,t),e._processingThumbnail=!1,e._processThumbnailQueue()})}}},{key:"removeFile",value:function(t){if(t.status===x.UPLOADING&&this.cancelUpload(t),this.files=b(this.files,t),this.emit("removedfile",t),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(t){null==t&&(t=!1);var e,n=k(this.files.slice(),!0);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.status===x.UPLOADING&&!t||this.removeFile(i)}}catch(t){n.e(t)}finally{n.f()}return null}},{key:"resizeImage",value:function(i,t,e,n,r){var o=this;return this.createThumbnail(i,t,e,n,!0,function(t,e){if(null==e)return r(i);var n=o.options.resizeMimeType;null==n&&(n=i.type);e=e.toDataURL(n,o.options.resizeQuality);return"image/jpeg"!==n&&"image/jpg"!==n||(e=S.restore(i.dataURL,e)),r(x.dataURItoBlob(e))})}},{key:"createThumbnail",value:function(t,e,n,i,r,o){var a=this,s=new FileReader;s.onload=function(){t.dataURL=s.result,"image/svg+xml"!==t.type?a.createThumbnailFromUrl(t,e,n,i,r,o):null!=o&&o(s.result)},s.readAsDataURL(t)}},{key:"displayExistingFile",value:function(e,t,n,i){var r=this,o=!(4u.options.chunkSize),l[0].upload.totalChunkCount=Math.ceil(e.size/u.options.chunkSize)),l[0].upload.chunked){var r=l[0],i=t[0];r.upload.chunks=[];var o=function(){for(var t,e,n=0;void 0!==r.upload.chunks[n];)n++;n>=r.upload.totalChunkCount||(t=n*u.options.chunkSize,e=Math.min(t+u.options.chunkSize,i.size),e={name:u._getParamName(0),data:i.webkitSlice?i.webkitSlice(t,e):i.slice(t,e),filename:r.upload.filename,chunkIndex:n},r.upload.chunks[n]={file:r,index:n,dataBlock:e,status:x.UPLOADING,progress:0,retries:0},u._uploadData(l,[e]))};if(r.upload.finishedChunkUpload=function(t,e){var n=!0;t.status=x.SUCCESS,t.dataBlock=null,t.xhr=null;for(var i=0;i>1;e=a/e;return 0==e?1:e}(e);return t.drawImage(e,n,i,r,o,a,s,l,u/c)},S=function(){function t(){a(this,t)}return e(t,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(t){for(var e,n,i,r,o="",a="",s=void 0,l="",u=0;;)if(i=(e=t[u++])>>2,r=(3&e)<<4|(n=t[u++])>>4,s=(15&n)<<2|(a=t[u++])>>6,l=63&a,isNaN(n)?s=l=64:isNaN(a)&&(l=64),o=o+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(l),s=l=a="",!(ut.length)break}return r}},{key:"decode64",value:function(t){var e,n,i,r,o=void 0,a="",s=0,l=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(t)&&console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");;)if(e=this.KEY_STR.indexOf(t.charAt(s++)),o=(15&(n=this.KEY_STR.indexOf(t.charAt(s++))))<<4|(i=this.KEY_STR.indexOf(t.charAt(s++)))>>2,a=(3&i)<<6|(r=this.KEY_STR.indexOf(t.charAt(s++))),l.push(e<<2|n>>4),64!==i&&l.push(o),64!==r&&l.push(a),o=a="",!(s",t))},firstChild:function(t){return this.find(i("^",t))},lastChild:function(t){return this.find(i("!^",t))},parent:function(t){var e=[];t:for(var n,i=0;n=this[i];i++)for(;(n=n.parentNode)&&n!==document;)if(!t||o.matches(n,t)){e.push(n);break t}return a(e)},parents:function(t){for(var e,n=[],i=0;e=this[i];i++)for(;(e=e.parentNode)&&e!==document;)t&&!o.matches(e,t)||n.push(e);return a(n)}}),e.exports=a},{"./base":109,"mout/array/map":119,slick:314}],137:[function(t,e,n){"use strict";var a=t("mout/array/forEach"),i=t("mout/array/map"),r=t("slick/parser"),s=t("./base");e.exports=function(t,o){return s(i(r(t),function(t){var n,r;return a(t,function(t,e){var i=(o||document).createElement(t.tag);t.id&&(i.id=t.id),t.classList&&(i.className=t.classList.join(" ")),t.attributes&&a(t.attributes,function(t){i.setAttribute(t.name,t.value||"")}),t.pseudos&&a(t.pseudos,function(t){var e=s(i),n=e[t.name];n&&n.call(e,t.value)}),0===e?r=i:" "===t.combinator?n.appendChild(i):"+"!==t.combinator||(t=n.parentNode)&&t.appendChild(i),n=i}),r}))}},{"./base":109,"mout/array/forEach":117,"mout/array/map":119,"slick/parser":315}],138:[function(t,e,n){"use strict";var i=t("./lib/color"),r=t("./lib/frame"),t="undefined"!=typeof document?t("./lib/browser"):t("./lib/fx");t.requestFrame=function(t){return r.request(t),this},t.cancelFrame=function(t){return r.cancel(t),this},t.color=i,e.exports=t},{"./lib/browser":139,"./lib/color":140,"./lib/frame":141,"./lib/fx":142}],139:[function(dt,ht,t){!function(ct){!function(){"use strict";function n(t,e){return String.prototype.match.call(t,e)}function r(t){return y[t]||(y[t]=p(t))}function s(t){return Math.round(1e3*t)/1e3}function l(t,e){var n=t.parentNode,t=1;return n&&(x.style.cssText=k+"width:100"+e+";",n.appendChild(x),t=x.offsetWidth/100,n.removeChild(x)),t}function i(t){var e=t.length;return 1===e?t.push(t[0],t[0],t[0]):2===e?t.push(t[0],t[1]):3===e&&t.push(t[1]),t}function o(t,e){return null==t||""===t?e?"1":"":isFinite(t=+t)?t<0?"0":t+"":"1"}var u=dt("./color"),t=dt("./frame"),a=(t.cancel,t.request),e=dt("prime"),c=dt("prime/string/camelize"),d=dt("prime/string/clean"),h=dt("prime/string/capitalize"),p=dt("prime/string/hyphenate"),f=dt("prime/array/map"),m=dt("prime/array/forEach"),g=dt("prime/array/indexOf"),v=dt("elements"),b=dt("./fx"),y={},w=ct.getComputedStyle?function(t){var e=getComputedStyle(t,null);return function(t){return e?e.getPropertyValue(r(t)):""}}:function(t){var e=t.currentStyle;return function(t){return e?e[c(t)]:""}},x=document.createElement("div"),k="border:none;margin:none;padding:none;visibility:hidden;position:absolute;height:0;",S="([-.\\d]+)(%|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vm)",t=S+"?",C=RegExp(S,"g"),T=RegExp(t),E=RegExp(t,"g"),O=RegExp("none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit");try{x.style.color="rgba(0,0,0,0.5)"}catch(t){}function A(t,e){return null!=t&&""!==t&&t.match(O)?t:e?"none":""}function I(t,e){var n,i="0px none rgba(0,0,0,1)";return null==t||""===t?e?i:"":0===t||"none"===t?e?i:t+"":(i=(t=t.replace(u.x,function(t){return n=t,""})).match(O),t=t.match(E),d([F(t?t[0]:"",e),A(i?i[0]:"",e),L(n,e)].join(" ")))}function _(t,e){return null==t||""===t?e?"0px 0px 0px 0px":"":d(i(f(d(t).split(" "),function(t){return F(t,e)})).join(" "))}function j(t,r,o){var e="rgba(0,0,0,0)",e=3===o?e+" 0px 0px 0px":e+" 0px 0px 0px 0px";if(null==t||""===t)return r?e:"";if("none"===t)return r?e:t;var a=[],t=d(t).replace(u.x,function(t){return a.push(t),""});return f(t.split(","),function(t,e){for(var n=L(a[e],r),e=/inset/.test(t),i=t.match(E)||["0px"],i=f(i,function(t){return F(t,r)});i.length>>0;i>>0;r>>0;i>>0,r=n<0?Math.max(0,i+n):n||0;r>>0,r=Array(i),o=0,a=i;o>>0;i/g,">").replace(/'/g,"'").replace(/"/g,""")}},{"../lang/toString":215}],260:[function(t,e,n){var i=t("../lang/toString");e.exports=function(t,e){return(t=i(t)).replace(/[\s\S]/g,function(t){return!e&&/[\x20-\x7E]/.test(t)?t:"\\u"+("000"+t.charCodeAt(0).toString(16)).slice(-4)})}},{"../lang/toString":215}],261:[function(t,e,n){var i=t("../lang/toString"),r=t("../object/get"),o=/\{\{([^\}]+)\}\}/g;e.exports=function(t,n,e){return(t=i(t)).replace(e||o,function(t,e){return i(r(n,e))})}},{"../lang/toString":215,"../object/get":233}],262:[function(t,e,n){var i=t("../lang/toString");e.exports=function(t){return(t=i(t)).toLowerCase()}},{"../lang/toString":215}],263:[function(t,e,n){var l=t("../lang/toString"),u=t("./WHITE_SPACES");e.exports=function(t,e){for(var n,i,r=0,o=(t=l(t)).length,a=(e=e||u).length,s=!0;s&&r").replace(/*39;/g,"'").replace(/"/g,'"')}},{"../lang/toString":215}],275:[function(t,e,n){var i=t("../lang/toString");e.exports=function(t){return(t=i(t)).replace(/(\w)(-)(\w)/g,"$1 $3")}},{"../lang/toString":215}],276:[function(t,e,n){var i=t("../lang/toString");e.exports=function(t){return(t=i(t)).toUpperCase()}},{"../lang/toString":215}],277:[function(t,e,n){e.exports=function(t,e,n){var i=t.length;e=null==e?0:e<0?Math.max(i+e,0):Math.min(e,i),n=null==n?i:n<0?Math.max(i+n,0):Math.min(n,i);for(var r=[];e',!!this.getElementById(e)},QUERY_SELECTOR:function(t){return t.innerHTML="_",t.innerHTML='',1===t.querySelectorAll(".MiX").length},EXPANDOS:function(t,e){return e="slick_"+s++,t._custom_property_=e,t._custom_property_===e},MATCHES_SELECTOR:function(e){e.className="MiX";var n=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector;if(n)try{n.call(e,":slick")}catch(t){return!!n.call(e,".MiX")&&n}return!1},GET_ELEMENTS_BY_CLASS_NAME:function(t){return t.innerHTML='',1===t.getElementsByClassName("b").length&&(t.firstChild.className="b",2===t.getElementsByClassName("b").length&&(t.innerHTML='',2===t.getElementsByClassName("a").length))},GET_ATTRIBUTE:function(t){var e="fus ro dah";return t.innerHTML='',t.firstChild.getAttribute("class")===e}};r.prototype.has=function(t){var e=this.tested,n=e[t];if(null!=n)return n;var i=this.root,r=this.document,o=r.createElement("div");o.setAttribute("style","display: none;"),i.appendChild(o);var a=l[t],n=!1;if(a)try{n=a.call(r,o)}catch(t){}return S.debug&&!n&&console.warn("document has no "+t),i.removeChild(o),e[t]=n};var k={" ":function(t,e,n){var i,r,o=!e.id,a=!e.tag,s=!e.classes;if(e.id&&t.getElementById&&this.has("GET_ELEMENT_BY_ID")&&(i=t.getElementById(e.id))&&i.getAttribute("id")===e.id&&(r=[i],o=!0,"*"===e.tag&&(a=!0)),!r&&(e.classes&&t.getElementsByClassName&&this.has("GET_ELEMENTS_BY_CLASS_NAME")?(r=t.getElementsByClassName(e.classList),s=!0,"*"===e.tag&&(a=!0)):(r=t.getElementsByTagName(e.tag),"*"!==e.tag&&(a=!0)),!r||!r.length))return!1;for(var l=0;i=r[l++];)(a&&o&&s&&!e.attributes&&!e.pseudos||this.match(i,e,a,o,s))&&n(i);return!0},">":function(t,e,n){if(t=t.firstChild)for(;1==t.nodeType&&this.match(t,e)&&n(t),t=t.nextSibling;);},"+":function(t,e,n){for(;t=t.nextSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"^":function(t,e,n){(t=t.firstChild)&&(1===t.nodeType?this.match(t,e)&&n(t):k["+"].call(this,t,e,n))},"~":function(t,e,n){for(;t=t.nextSibling;)1===t.nodeType&&this.match(t,e)&&n(t)},"++":function(t,e,n){k["+"].call(this,t,e,n),k["!+"].call(this,t,e,n)},"~~":function(t,e,n){k["~"].call(this,t,e,n),k["!~"].call(this,t,e,n)},"!":function(t,e,n){for(;t=t.parentNode;)t!==this.document&&this.match(t,e)&&n(t)},"!>":function(t,e,n){(t=t.parentNode)!==this.document&&this.match(t,e)&&n(t)},"!+":function(t,e,n){for(;t=t.previousSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"!^":function(t,e,n){(t=t.lastChild)&&(1==t.nodeType?this.match(t,e)&&n(t):k["!+"].call(this,t,e,n))},"!~":function(t,e,n){for(;t=t.previousSibling;)1===t.nodeType&&this.match(t,e)&&n(t)}};r.prototype.search=function(t,e,n){t?!t.nodeType&&t.document&&(t=t.document):t=this.document;var i=y(e);if(!i||!i.length)throw new Error("invalid expression");var r,o,a,s,l,u=x(n=n||[])?function(t){n[n.length]=t}:function(t){n[n.length++]=t};1+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+b(">+~`!@$%^&={}\\;")+"]").replace(//g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")),w=function(t){this.combinator=t||" ",this.tag="*"};w.prototype.toString=function(){if(!this.raw){var t,e,n="";if(n+=this.tag||"*",this.id&&(n+="#"+this.id),this.classes&&(n+="."+this.classList.join(".")),this.attributes)for(t=0;e=this.attributes[t++];)n+="["+e.name+(e.operator?e.operator+'"'+e.value+'"':"")+"]";if(this.pseudos)for(t=0;e=this.pseudos[t++];)n+=":"+e.name,e.value&&(n+="("+e.value+")");this.raw=n}return this.raw};var x=function(){this.length=0};x.prototype.toString=function(){if(!this.raw){for(var t,e="",n=0;t=this[n++];)1!==n&&(e+=" ")," "!==t.combinator&&(e+=t.combinator+" "),e+=t;this.raw=e}return this.raw};function a(t,e,n,i,r,o,a,s,l,u,c,d,h,p,f,m){var g,v;return(!e&&this.length||(g=this[this.length++]=new x,!e))&&(g=g||this[this.length-1],v=(v=n||i||!g.length?g[g.length++]=new w(n):v)||g[g.length-1],r?v.tag=y(r):o?v.id=y(o):a?(r=y(a),(o=v.classes||(v.classes={}))[r]||(o[r]=b(a),(a=v.classList||(v.classList=[])).push(r),a.sort())):h?(m=m||f,(v.pseudos||(v.pseudos=[])).push({type:1==d.length?"class":"element",name:y(h),escapedName:b(h),value:m?y(m):null,escapedValue:m?b(m):null})):s&&(c=c?b(c):null,(v.attributes||(v.attributes=[])).push({operator:l,name:y(s),escapedName:b(s),value:c?y(c):null,escapedValue:c?b(c):null}))),""}function s(t){this.length=0;for(var e,n=this,i=t;t;){if((e=t.replace(o,function(){return a.apply(n,arguments)}))===t)throw new Error(i+" is an invalid expression");t=e}}s.prototype.toString=function(){if(!this.raw){for(var t,e=[],n=0;t=this[n++];)e.push(t);this.raw=e.join(", ")}return this.raw};var l={};e.exports=function(t){return null==t?null:(t=(""+t).replace(/^\s+|\s+$/g,""),l[t]||(l[t]=new s(t)))}},{}],316:[function(t,e,n){!function(t){"use strict";"function"==typeof define&&define.amd?define(t):void 0!==e&&void 0!==e.exports?e.exports=t():"undefined"!=typeof Package?Sortable=t():window.Sortable=t()}(function(){"use strict";if("undefined"==typeof window||void 0===window.document)return function(){throw new Error("Sortable.js requires a window with a document")};function o(t){var e=t.group;e&&"object"==typeof e||(e=t.group={name:e}),["pull","put"].forEach(function(t){t in e||(e[t]=!0)}),t.groups=" "+e.name+(e.put.join?" "+e.put.join(" "):"")+" "}var h,p,f,m,g,v,d,b,y,w,x,u,i,k,s,r,S,t,C={},a=/\s+/g,T="Sortable"+(new Date).getTime(),E=window,c=E.document,l=E.parseInt,O=!!("draggable"in c.createElement("div")),A=((t=c.createElement("x")).style.cssText="pointer-events:auto","auto"===t.style.pointerEvents),I=!1,_=Math.abs,j=[],R=e(function(t,e,n){if(n&&e.scroll){var i,r,o,a=e.scrollSensitivity,s=e.scrollSpeed,l=t.clientX,u=t.clientY,c=window.innerWidth,t=window.innerHeight;if(b!==n&&(d=e.scroll,b=n,!0===d)){d=n;do{if(d.offsetWidth*",ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",ignore:"a, img",filter:null,animation:0,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1};for(n in r)n in e||(e[n]=r[n]);for(i in o(e),this)"_"===i.charAt(0)&&(this[i]=this[i].bind(this));this.nativeDraggable=!e.forceFallback&&O,F(t,"mousedown",this._onTapStart),F(t,"touchstart",this._onTapStart),this.nativeDraggable&&(F(t,"dragover",this),F(t,"dragenter",this)),j.push(this._onDragOver),e.store&&this.sort(e.store.get(this))}function D(t){m&&m.state!==t&&(M(m,"display",t?"none":""),!t&&m.state&&g.insertBefore(m,h),m.state=t)}function L(t,e,n){if(t){n=n||c;do{if(">*"===e&&t.parentNode===n||V(t,e))return t}while(t!==n&&(t=t.parentNode))}return null}function F(t,e,n){t.addEventListener(e,n,!1)}function P(t,e,n){t.removeEventListener(e,n,!1)}function z(t,e,n){var i;t&&(t.classList?t.classList[n?"add":"remove"](e):(i=(" "+t.className+" ").replace(a," ").replace(" "+e+" "," "),t.className=(i+(n?" "+e:"")).replace(a," ")))}function M(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return c.defaultView&&c.defaultView.getComputedStyle?n=c.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];i[e=!(e in i)?"-webkit-"+e:e]=n+("string"==typeof n?"":"px")}}function B(t,e,n){if(t){var i=t.getElementsByTagName(e),r=0,o=i.length;if(n)for(;rh.offsetWidth,o=u.offsetHeight>h.offsetHeight,n=.5<(r?(t.clientX-e.left)/n:(t.clientY-e.top)/d),t=u.nextElementSibling,!1!==(d=$(g,a,h,s,u,e))&&(I=!0,setTimeout(G,30),D(c),o=1===d||-1===d?1===d:r?(d=h.offsetTop)===(r=u.offsetTop)?u.previousElementSibling===h&&!i||n&&i:d=o.f?i():r.fonts.load(k(t=o.a)+" "+t.f+"00 300px "+w(t.c),o.h).then(function(t){1<=t.length?n():setTimeout(e,25)},function(){i()})}()}),n=null,e=new Promise(function(t,e){n=setTimeout(e,o.f)});Promise.race([e,t]).then(function(){n&&(clearTimeout(n),n=null),o.g(o.a)},function(){o.j(o.a)})};var R={D:"serif",C:"sans-serif"},N=null;function D(){var t;return null===N&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),N=!!t&&(parseInt(t[1],10)<536||536===parseInt(t[1],10)&&parseInt(t[2],10)<=11)),N}function L(t,e,n){for(var i in R)if(R.hasOwnProperty(i)&&e===t.f[R[i]]&&n===t.f[R[i]])return!0;return!1}function F(t){var e,n=t.g.a.offsetWidth,i=t.h.a.offsetWidth;(e=!(e=n===t.f.serif&&i===t.f["sans-serif"])?D()&&L(t,n,i):e)?s()-t.A>=t.w?D()&&L(t,n,i)&&(null===t.u||t.u.hasOwnProperty(t.a.c))?P(t,t.v):P(t,t.B):setTimeout(f(function(){F(this)},t),50):P(t,t.v)}function P(t,e){setTimeout(f(function(){n(this.g.a),n(this.h.a),n(this.j.a),n(this.m.a),e(this.a)},t),0)}function z(t,e,n){this.c=t,this.a=e,this.f=0,this.m=this.j=!1,this.s=n}j.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),F(this)};var M=null;function B(t){0==--t.f&&t.j&&(t.m?((t=t.a).g&&m(t.f,[t.a.c("wf","active")],[t.a.c("wf","loading"),t.a.c("wf","inactive")]),T(t,"active")):C(t.a))}function t(t){this.j=t,this.a=new E,this.h=0,this.f=this.g=!0}function U(t,e){this.c=t,this.a=e}function $(t,e){this.c=t,this.a=e}function q(t,e){this.c=t||"https://fonts.googleapis.com/css",this.a=[],this.f=[],this.g=e||""}z.prototype.g=function(t){var e=this.a;e.g&&m(e.f,[e.a.c("wf",t.c,x(t).toString(),"active")],[e.a.c("wf",t.c,x(t).toString(),"loading"),e.a.c("wf",t.c,x(t).toString(),"inactive")]),T(e,"fontactive",t),this.m=!0,B(this)},z.prototype.h=function(t){var e,n,i,r=this.a;r.g&&(e=o(r.f,r.a.c("wf",t.c,x(t).toString(),"active")),n=[],i=[r.a.c("wf",t.c,x(t).toString(),"loading")],e||n.push(r.a.c("wf",t.c,x(t).toString(),"inactive")),m(r.f,n,i)),T(r,"fontinactive",t),B(this)},t.prototype.load=function(t){this.c=new e(this.j,t.context||this.j),this.g=!1!==t.events,this.f=!1!==t.classes,function(i,t,e){var n=[],r=e.timeout;!function(t){t.g&&m(t.f,[t.a.c("wf","loading")]),T(t,"loading")}(t);var n=function(t,e,n){var i,r,o=[];for(i in e)!e.hasOwnProperty(i)||(r=t.c[i])&&o.push(r(e[i],n));return o}(i.a,e,i.c),o=new z(i.c,t,r);for(i.h=n.length,t=0,e=n.length;t= winPos.bottom) {\n \t\t\tplace[0] = 'top';\n \t\t}\n \t\tswitch (place[1]) {\n \t\t\tcase 'left':\n \t\t\t\tif (target.right - this.width <= winPos.left) {\n \t\t\t\t\tplace[1] = 'right';\n \t\t\t\t}\n \t\t\t\tbreak;\n \t\t\tcase 'right':\n \t\t\t\tif (target.left + this.width >= winPos.right) {\n \t\t\t\t\tplace[1] = 'left';\n \t\t\t\t}\n \t\t\t\tbreak;\n \t\t\tdefault:\n \t\t\t\tif (target.left + target.width / 2 + this.width / 2 >= winPos.right) {\n \t\t\t\t\tplace[1] = 'left';\n \t\t\t\t} else if (target.right - target.width / 2 - this.width / 2 <= winPos.left) {\n \t\t\t\t\tplace[1] = 'right';\n \t\t\t\t}\n \t\t}\n \t} else {\n \t\tif (target.left - this.width - spacing <= winPos.left) {\n \t\t\tplace[0] = 'right';\n \t\t} else if (target.right + this.width + spacing >= winPos.right) {\n \t\t\tplace[0] = 'left';\n \t\t}\n \t\tswitch (place[1]) {\n \t\t\tcase 'top':\n \t\t\t\tif (target.bottom - this.height <= winPos.top) {\n \t\t\t\t\tplace[1] = 'bottom';\n \t\t\t\t}\n \t\t\t\tbreak;\n \t\t\tcase 'bottom':\n \t\t\t\tif (target.top + this.height >= winPos.bottom) {\n \t\t\t\t\tplace[1] = 'top';\n \t\t\t\t}\n \t\t\t\tbreak;\n \t\t\tdefault:\n \t\t\t\tif (target.top + target.height / 2 + this.height / 2 >= winPos.bottom) {\n \t\t\t\t\tplace[1] = 'top';\n \t\t\t\t} else if (target.bottom - target.height / 2 - this.height / 2 <= winPos.top) {\n \t\t\t\t\tplace[1] = 'bottom';\n \t\t\t\t}\n \t\t}\n \t}\n \n \treturn place.join('-');\n };\n \n /**\n * Position the element to an element or a specific coordinates.\n *\n * @param {Integer|Element} x\n * @param {Integer} y\n *\n * @return {Tooltip}\n */\n Tooltip.prototype.position = function (x, y) {\n \tif (this.attachedTo) {\n \t\tx = this.attachedTo;\n \t}\n \tif (x == null && this._p) {\n \t\tx = this._p[0];\n \t\ty = this._p[1];\n \t} else {\n \t\tthis._p = arguments;\n \t}\n \tvar target = typeof x === 'number' ? {\n \t\tleft: 0|x,\n \t\tright: 0|x,\n \t\ttop: 0|y,\n \t\tbottom: 0|y,\n \t\twidth: 0,\n \t\theight: 0\n \t} : position(x);\n \tvar spacing = Number(this.spacing), offset = Number(this.offset);\n \tvar newPlace = this._pickPlace(target);\n \n \t// Add/Change place class when necessary\n \tif (newPlace !== this.curPlace) {\n \t\tif (this.curPlace) {\n \t\t\tthis.classes.remove(this.curPlace);\n \t\t}\n \t\tthis.classes.add(newPlace);\n \t\tthis.curPlace = newPlace;\n \t}\n \n \t// Position the tip\n \tvar top, left;\n \tswitch (this.curPlace) {\n \t\tcase 'top':\n \t\t\ttop = target.top - this.height - spacing;\n \t\t\tleft = target.left + target.width / 2 - this.width / 2;\n \t\t\tbreak;\n \t\tcase 'top-left':\n \t\t\ttop = target.top - this.height - spacing;\n \t\t\tleft = target.right - this.width - offset;\n \t\t\tbreak;\n \t\tcase 'top-right':\n \t\t\ttop = target.top - this.height - spacing;\n \t\t\tleft = target.left + offset;\n \t\t\tbreak;\n \n \t\tcase 'bottom':\n \t\t\ttop = target.bottom + spacing;\n \t\t\tleft = target.left + target.width / 2 - this.width / 2;\n \t\t\tbreak;\n \t\tcase 'bottom-left':\n \t\t\ttop = target.bottom + spacing;\n \t\t\tleft = target.right - this.width - offset;\n \t\t\tbreak;\n \t\tcase 'bottom-right':\n \t\t\ttop = target.bottom + spacing;\n \t\t\tleft = target.left + offset;\n \t\t\tbreak;\n \n \t\tcase 'left':\n \t\t\ttop = target.top + target.height / 2 - this.height / 2;\n \t\t\tleft = target.left - this.width - spacing;\n \t\t\tbreak;\n \t\tcase 'left-top':\n \t\t\ttop = target.bottom - this.height;\n \t\t\tleft = target.left - this.width - spacing;\n \t\t\tbreak;\n \t\tcase 'left-bottom':\n \t\t\ttop = target.top;\n \t\t\tleft = target.left - this.width - spacing;\n \t\t\tbreak;\n \n \t\tcase 'right':\n \t\t\ttop = target.top + target.height / 2 - this.height / 2;\n \t\t\tleft = target.right + spacing;\n \t\t\tbreak;\n \t\tcase 'right-top':\n \t\t\ttop = target.bottom - this.height;\n \t\t\tleft = target.right + spacing;\n \t\t\tbreak;\n \t\tcase 'right-bottom':\n \t\t\ttop = target.top;\n \t\t\tleft = target.right + spacing;\n \t\t\tbreak;\n \t}\n \n \t// Set tip position & class\n \tthis.element.style.top = Math.round(top) + 'px';\n \tthis.element.style.left = Math.round(left) + 'px';\n \n \treturn this;\n };\n \n /**\n * Show the tooltip.\n *\n * @param {Integer|Element} x\n * @param {Integer} y\n *\n * @return {Tooltip}\n */\n Tooltip.prototype.show = function (x, y) {\n \tx = this.attachedTo ? this.attachedTo : x;\n \n \t// Clear potential ongoing animation\n \tclearTimeout(this.aIndex);\n \n \t// Position the element when requested\n \tif (x != null) {\n \t\tthis.position(x, y);\n \t}\n \n \t// Stop here if tip is already visible\n \tif (this.hidden) {\n \t\tthis.hidden = 0;\n \t\twindow.document.body.appendChild(this.element);\n \t}\n \n \t// Make tooltip aware of window resize\n \tif (this.attachedTo) {\n \t\tthis._aware();\n \t}\n \n \t// Trigger layout and kick in the transition\n \tif (this.options.inClass) {\n \t\tif (this.options.effectClass) {\n \t\t\tvoid this.element.clientHeight;\n \t\t}\n \t\tthis.classes.add(this.options.inClass);\n \t}\n \n \treturn this;\n };\n \n /**\n * Hide the tooltip.\n *\n * @return {Tooltip}\n */\n Tooltip.prototype.hide = function () {\n \tif (this.hidden) {\n \t\treturn;\n \t}\n \n \tvar self = this;\n \tvar duration = 0;\n \n \t// Remove .in class and calculate transition duration if any\n \tif (this.options.inClass) {\n \t\tthis.classes.remove(this.options.inClass);\n \t\tif (this.options.effectClass) {\n \t\t\tduration = transitionDuration(this.element);\n \t\t}\n \t}\n \n \t// Remove tip from window resize awareness\n \tif (this.attachedTo) {\n \t\tthis._unaware();\n \t}\n \n \t// Remove the tip from the DOM when transition is done\n \tclearTimeout(this.aIndex);\n \tthis.aIndex = setTimeout(function () {\n \t\tself.aIndex = 0;\n \t\twindow.document.body.removeChild(self.element);\n \t\tself.hidden = 1;\n \t}, duration);\n \n \treturn this;\n };\n \n Tooltip.prototype.toggle = function (x, y) {\n \treturn this[this.hidden ? 'show' : 'hide'](x, y);\n };\n \n Tooltip.prototype.destroy = function () {\n \tclearTimeout(this.aIndex);\n \tthis._unaware();\n \tif (!this.hidden) {\n \t\twindow.document.body.removeChild(this.element);\n \t}\n \tthis.element = this.options = null;\n };\n \n /**\n * Make the tip window resize aware.\n *\n * @return {Void}\n */\n Tooltip.prototype._aware = function () {\n \tvar index = indexOf(Tooltip.winAware, this);\n \tif (!~index) {\n \t\tTooltip.winAware.push(this);\n \t}\n };\n \n /**\n * Remove the window resize awareness.\n *\n * @return {Void}\n */\n Tooltip.prototype._unaware = function () {\n \tvar index = indexOf(Tooltip.winAware, this);\n \tif (~index) {\n \t\tTooltip.winAware.splice(index, 1);\n \t}\n };\n \n /**\n * Handles repositioning of tooltips on window resize.\n *\n * @return {Void}\n */\n Tooltip.reposition = (function () {\n \tvar rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {\n \t\treturn setTimeout(fn, 17);\n \t};\n \tvar rIndex;\n \n \tfunction requestReposition() {\n \t\tif (rIndex || !Tooltip.winAware.length) {\n \t\t\treturn;\n \t\t}\n \t\trIndex = rAF(reposition, 17);\n \t}\n \n \tfunction reposition() {\n \t\trIndex = 0;\n \t\tvar tip;\n \t\tfor (var i = 0, l = Tooltip.winAware.length; i < l; i++) {\n \t\t\ttip = Tooltip.winAware[i];\n \t\t\ttip.position();\n \t\t}\n \t}\n \n \treturn requestReposition;\n }());\n Tooltip.winAware = [];\n \n // Bind winAware repositioning to window resize event\n evt.bind(window, 'resize', Tooltip.reposition);\n evt.bind(window, 'scroll', Tooltip.reposition);\n \n /**\n * Array with dynamic class types.\n *\n * @type {Array}\n */\n Tooltip.classTypes = ['type', 'effect'];\n \n /**\n * Default options for Tooltip constructor.\n *\n * @type {Object}\n */\n Tooltip.defaults = {\n \tbaseClass: 'tooltip', // Base tooltip class name.\n \ttypeClass: null, // Type tooltip class name.\n \teffectClass: null, // Effect tooltip class name.\n \tinClass: 'in', // Class used to transition stuff in.\n \tplace: 'top', // Default place.\n \tspacing: null, // Gap between target and tooltip.\n \toffset: null, // Horizontal offset to align arrow\n \tauto: 0 // Whether to automatically adjust place to fit into window.\n };//# sourceURL=darsain-tooltip/index.js")),o.register("darsain-event/index.js",Function("exports, fakeRequire, module","'use strict';\n \n /**\n * Bind `el` event `type` to `fn`.\n *\n * @param {Element} el\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n *\n * @return {Function}\n */\n exports.bind = window.addEventListener ? function (el, type, fn, capture) {\n \tel.addEventListener(type, fn, capture || false);\n \treturn fn;\n } : function (el, type, fn) {\n \tvar fnid = type + fn;\n \tel[fnid] = el[fnid] || function () {\n \t\tvar event = window.event;\n \t\tevent.target = event.srcElement;\n \t\tevent.preventDefault = function () {\n \t\t\tevent.returnValue = false;\n \t\t};\n \t\tevent.stopPropagation = function () {\n \t\t\tevent.cancelBubble = true;\n \t\t};\n \t\tfn.call(el, event);\n \t};\n \tel.attachEvent('on' + type, el[fnid]);\n \treturn fn;\n };\n \n /**\n * Unbind `el` event `type`'s callback `fn`.\n *\n * @param {Element} el\n * @param {String} type\n * @param {Function} fn\n * @param {Boolean} capture\n *\n * @return {Function}\n */\n exports.unbind = window.removeEventListener ? function (el, type, fn, capture) {\n \tel.removeEventListener(type, fn, capture || false);\n \treturn fn;\n } : function (el, type, fn) {\n \tvar fnid = type + fn;\n \tel.detachEvent('on' + type, el[fnid]);\n \ttry {\n \t\tdelete el[fnid];\n \t} catch (err) {\n \t\t// can't delete window object properties\n \t\tel[fnid] = undefined;\n \t}\n \treturn fn;\n };//# sourceURL=darsain-event/index.js")),o.register("component-indexof/index.js",Function("exports, fakeRequire, module","module.exports = function(arr, obj){\n if (arr.indexOf) return arr.indexOf(obj);\n for (var i = 0; i < arr.length; ++i) {\n if (arr[i] === obj) return i;\n }\n return -1;\n };//# sourceURL=component-indexof/index.js")),o.register("code42day-dataset/index.js",Function("exports, fakeRequire, module","module.exports=dataset;\n \n /*global document*/\n \n \n // replace namesLikeThis with names-like-this\n function toDashed(name) {\n return name.replace(/([A-Z])/g, function(u) {\n return \"-\" + u.toLowerCase();\n });\n }\n \n var fn;\n \n if (document.head.dataset) {\n fn = {\n set: function(node, attr, value) {\n if (!node.dataset) return; node.dataset[attr] = value;\n },\n get: function(node, attr) {\n return node.dataset && node.dataset[attr];\n }\n };\n } else {\n fn = {\n set: function(node, attr, value) {\n node.setAttribute('data-' + toDashed(attr), value);\n },\n get: function(node, attr) {\n return node.getAttribute('data-' + toDashed(attr));\n }\n };\n }\n \n function dataset(node, attr, value) {\n var self = {\n set: set,\n get: get\n };\n \n function set(attr, value) {\n fn.set(node, attr, value);\n return self;\n }\n \n function get(attr) {\n return fn.get(node, attr);\n }\n \n if (arguments.length === 3) {\n return set(attr, value);\n }\n if (arguments.length == 2) {\n return get(attr);\n }\n \n return self;\n }//# sourceURL=code42day-dataset/index.js")),o.register("tooltips/index.js",Function("exports, fakeRequire, module","'use strict';\n \n /**\n * Dependencies.\n */\n var evt = fakeRequire('event');\n var indexOf = fakeRequire('indexof');\n var Tooltip = fakeRequire('tooltip');\n var dataset = fakeRequire('dataset');\n \n /**\n * Transport.\n */\n module.exports = Tooltips;\n \n /**\n * Globals.\n */\n var MObserver = window.MutationObserver || window.WebkitMutationObserver;\n \n /**\n * Prototypal inheritance.\n *\n * @param {Object} o\n *\n * @return {Object}\n */\n var objectCreate = Object.create || (function () {\n \tfunction F() {}\n \treturn function (o) {\n \t\tF.prototype = o;\n \t\treturn new F();\n \t};\n })();\n \n /**\n * Poor man's shallow object extend.\n *\n * @param {Object} a\n * @param {Object} b\n *\n * @return {Object}\n */\n function extend(a, b) {\n \tfor (var key in b) {\n \t\ta[key] = b[key];\n \t}\n \treturn a;\n }\n \n /**\n * Capitalize the first letter of a string.\n *\n * @param {String} string\n *\n * @return {String}\n */\n function ucFirst(string) {\n \treturn string.charAt(0).toUpperCase() + string.slice(1);\n }\n \n /**\n * Tooltips constructor.\n *\n * @param {Element} container\n * @param {Object} options\n *\n * @return {Tooltips}\n */\n function Tooltips(container, options) {\n \tif (!(this instanceof Tooltips)) {\n \t\treturn new Tooltips(container, options);\n \t}\n \n \tvar self = this;\n \tvar observer, TID;\n \n \t/**\n \t * Show tooltip attached to an element.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.show = function (element) {\n \t\treturn callTooltipMethod(element, 'show');\n \t};\n \n \t/**\n \t * Hide tooltip attached to an element.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.hide = function (element) {\n \t\treturn callTooltipMethod(element, 'hide');\n \t};\n \n \t/**\n \t * Toggle tooltip attached to an element.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.toggle = function (element) {\n \t\treturn callTooltipMethod(element, 'toggle');\n \t};\n \n \t/**\n \t * Retrieve tooltip attached to an element and call it's method.\n \t *\n \t * @param {Element} element\n \t * @param {String} method\n \t *\n \t * @return {Tooltips}\n \t */\n \tfunction callTooltipMethod(element, method) {\n \t\tvar tip = self.get(element);\n \t\tif (tip) {\n \t\t\ttip[method]();\n \t\t}\n \t\treturn self;\n \t}\n \n \t/**\n \t * Return a tooltip attached to an element. Tooltip is created if it doesn't exist yet.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Tooltip}\n \t */\n \tself.get = function (element) {\n \t\tvar tip = !!element && (element[TID] || createTip(element));\n \t\tif (tip && !element[TID]) {\n \t\t\telement[TID] = tip;\n \t\t}\n \t\treturn tip;\n \t};\n \n \t/**\n \t * Add element(s) to Tooltips instance.\n \t *\n \t * @param {[type]} element Can be element, or container containing elements to be added.\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.add = function (element) {\n \t\tif (!element || element.nodeType !== 1) {\n \t\t\treturn self;\n \t\t}\n \t\tif (dataset(element).get(options.key)) {\n \t\t\tbindElement(element);\n \t\t} else if (element.children) {\n \t\t\tbindElements(element.querySelectorAll(self.selector));\n \t\t}\n \t\treturn self;\n \t};\n \n \t/**\n \t * Remove element(s) from Tooltips instance.\n \t *\n \t * @param {Element} element Can be element, or container containing elements to be removed.\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.remove = function (element) {\n \t\tif (!element || element.nodeType !== 1) {\n \t\t\treturn self;\n \t\t}\n \t\tif (dataset(element).get(options.key)) {\n \t\t\tunbindElement(element);\n \t\t} else if (element.children) {\n \t\t\tunbindElements(element.querySelectorAll(self.selector));\n \t\t}\n \t\treturn self;\n \t};\n \n \t/**\n \t * Reload Tooltips instance.\n \t *\n \t * Unbinds current tooltipped elements, than selects the\n \t * data-key elements from container and binds them again.\n \t *\n \t * @return {Tooltips}\n \t */\n \tself.reload = function () {\n \t\t// Unbind old elements\n \t\tunbindElements(self.elements);\n \t\t// Bind new elements\n \t\tbindElements(self.container.querySelectorAll(self.selector));\n \t\treturn self;\n \t};\n \n \t/**\n \t * Destroy Tooltips instance.\n \t *\n \t * @return {Void}\n \t */\n \tself.destroy = function () {\n \t\tunbindElements(this.elements);\n \t\tif (observer) {\n \t\t\tobserver.disconnect();\n \t\t}\n \t\tthis.container = this.elements = this.options = observer = null;\n \t};\n \n \t/**\n \t * Create a tip from element data attributes.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Tooltip}\n \t */\n \tfunction createTip(element) {\n \t\tvar data = dataset(element);\n \t\tvar content = data.get(options.key);\n \t\tif (!content) {\n \t\t\treturn false;\n \t\t}\n \t\tvar tipOptions = objectCreate(options.tooltip);\n \t\tvar keyData;\n \t\tfor (var key in Tooltip.defaults) {\n \t\t\tkeyData = data.get(options.key + ucFirst(key.replace(/Class$/, '')));\n \t\t\tif (!keyData) {\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\ttipOptions[key] = keyData;\n \t\t}\n \t\treturn new Tooltip(content, tipOptions).attach(element);\n \t}\n \n \t/**\n \t * Bind Tooltips events to Array/NodeList of elements.\n \t *\n \t * @param {Array} elements\n \t *\n \t * @return {Void}\n \t */\n \tfunction bindElements(elements) {\n \t\tfor (var i = 0, l = elements.length; i < l; i++) {\n \t\t\tbindElement(elements[i]);\n \t\t}\n \t}\n \n \t/**\n \t * Bind Tooltips events to element.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Void}\n \t */\n \tfunction bindElement(element) {\n \t\tif (element[TID] || ~indexOf(self.elements, element)) {\n \t\t\treturn;\n \t\t}\n \t\tevt.bind(element, options.showOn, eventHandler);\n \t\tevt.bind(element, options.hideOn, eventHandler);\n \t\tself.elements.push(element);\n \t}\n \n \t/**\n \t * Unbind Tooltips events from Array/NodeList of elements.\n \t *\n \t * @param {Array} elements\n \t *\n \t * @return {Void}\n \t */\n \tfunction unbindElements(elements) {\n \t\tif (self.elements === elements) {\n \t\t\telements = elements.slice();\n \t\t}\n \t\tfor (var i = 0, l = elements.length; i < l; i++) {\n \t\t\tunbindElement(elements[i]);\n \t\t}\n \t}\n \n \t/**\n \t * Unbind Tooltips events from element.\n \t *\n \t * @param {Element} element\n \t *\n \t * @return {Void}\n \t */\n \tfunction unbindElement(element) {\n \t\tvar index = indexOf(self.elements, element);\n \t\tif (!~index) {\n \t\t\treturn;\n \t\t}\n \t\tif (element[TID]) {\n \t\t\telement[TID].destroy();\n \t\t\tdelete element[TID];\n \t\t}\n \t\tevt.unbind(element, options.showOn, eventHandler);\n \t\tevt.unbind(element, options.hideOn, eventHandler);\n \t\tself.elements.splice(index, 1);\n \t}\n \n \t/**\n \t * Tooltips events handler.\n \t *\n \t * @param {Event} event\n \t *\n \t * @return {Void}\n \t */\n \tfunction eventHandler(event) {\n \t\t/*jshint validthis:true */\n \t\tif (options.showOn === options.hideOn) {\n \t\t\tself.toggle(this);\n \t\t} else {\n \t\t\tself[event.type === options.showOn ? 'show' : 'hide'](this);\n \t\t}\n \t}\n \n \t/**\n \t * Mutations handler.\n \t *\n \t * @param {Array} mutations\n \t *\n \t * @return {Void}\n \t */\n \tfunction mutationsHandler(mutations) {\n \t\tvar added, removed, i, l;\n \t\tfor (var m = 0, ml = mutations.length; m < ml; m++) {\n \t\t\tadded = mutations[m].addedNodes;\n \t\t\tremoved = mutations[m].removedNodes;\n \t\t\tfor (i = 0, l = added.length; i < l; i++) {\n \t\t\t\tself.add(added[i]);\n \t\t\t}\n \t\t\tfor (i = 0, l = removed.length; i < l; i++) {\n \t\t\t\tself.remove(removed[i]);\n \t\t\t}\n \t\t\tif (mutations[m].type == 'attributes' && mutations[m].attributeName == 'data-title'){\n \t\t\t\tif (!self.get(mutations[m])) { self.add(mutations[m].target); }\n \t\t\t\tself.get(mutations[m].target).content(dataset(mutations[m].target).get('title'));\n \t\t\t}\n \t\t}\n \t}\n \n \t// Construct\n \t(function () {\n \t\tself.container = container;\n \t\tself.options = options = extend(objectCreate(Tooltips.defaults), options);\n \t\tself.ID = TID = options.key + Math.random().toString(36).slice(2);\n \t\tself.elements = [];\n \n \t\t// Create tips selector\n \t\tself.selector = '[data-' + options.key + ']';\n \n \t\t// Load tips\n \t\tself.reload();\n \n \t\t// Create mutations observer\n \t\tif (options.observe && MObserver) {\n \t\t\tobserver = new MObserver(mutationsHandler);\n \t\t\tobserver.observe(self.container, {\n \t\t\t\tchildList: true,\n \t\t\t\tsubtree: true,\n \t\t\t\tattributes: true\n \t\t\t});\n \t\t}\n \t}());\n }\n \n /**\n * Expose Tooltip.\n */\n Tooltips.Tooltip = Tooltip;\n \n /**\n * Default Tooltips options.\n *\n * @type {Object}\n */\n Tooltips.defaults = {\n \ttooltip: {}, // Options for individual Tooltip instances.\n \tkey: 'tooltip', // Tooltips data attribute key.\n \tshowOn: 'mouseenter', // Show tooltip event.\n \thideOn: 'mouseleave', // Hide tooltip event.\n \tobserve: 0 // Enable mutation observer (used only when supported).\n };//# sourceURL=tooltips/index.js")),o.alias("darsain-tooltip/index.js","tooltips/deps/tooltip/index.js"),o.alias("darsain-tooltip/index.js","tooltip/index.js"),o.alias("darsain-event/index.js","darsain-tooltip/deps/event/index.js"),o.alias("darsain-position/index.js","darsain-tooltip/deps/position/index.js"),o.alias("component-classes/index.js","darsain-tooltip/deps/classes/index.js"),o.alias("component-indexof/index.js","component-classes/deps/indexof/index.js"),o.alias("component-indexof/index.js","darsain-tooltip/deps/indexof/index.js"),o.alias("darsain-event/index.js","tooltips/deps/event/index.js"),o.alias("darsain-event/index.js","event/index.js"),o.alias("component-indexof/index.js","tooltips/deps/indexof/index.js"),o.alias("component-indexof/index.js","indexof/index.js"),o.alias("code42day-dataset/index.js","tooltips/deps/dataset/index.js"),o.alias("code42day-dataset/index.js","dataset/index.js"),"object"==typeof n?e.exports=o("tooltips"):"function"==typeof define&&define.amd?define(function(){return o("tooltips")}):this.Tooltips=o("tooltips")}()},{}]},{},[32]);
\ No newline at end of file
+require=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 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; };
+
+},{}],2:[function(require,module,exports){
+(function (setImmediate,clearImmediate){(function (){
+var nextTick = require('process/browser.js').nextTick;
+var apply = Function.prototype.apply;
+var slice = Array.prototype.slice;
+var immediateIds = {};
+var nextImmediateId = 0;
+
+// DOM APIs, for completeness
+
+exports.setTimeout = function() {
+ return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+};
+exports.setInterval = function() {
+ return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+};
+exports.clearTimeout =
+exports.clearInterval = function(timeout) { timeout.close(); };
+
+function Timeout(id, clearFn) {
+ this._id = id;
+ this._clearFn = clearFn;
+}
+Timeout.prototype.unref = Timeout.prototype.ref = function() {};
+Timeout.prototype.close = function() {
+ this._clearFn.call(window, this._id);
+};
+
+// Does not start the time, just sets up the members needed.
+exports.enroll = function(item, msecs) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = msecs;
+};
+
+exports.unenroll = function(item) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = -1;
+};
+
+exports._unrefActive = exports.active = function(item) {
+ clearTimeout(item._idleTimeoutId);
+
+ var msecs = item._idleTimeout;
+ if (msecs >= 0) {
+ item._idleTimeoutId = setTimeout(function onTimeout() {
+ if (item._onTimeout)
+ item._onTimeout();
+ }, msecs);
+ }
+};
+
+// That's not how node.js implements it but the exposed api is the same.
+exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
+ var id = nextImmediateId++;
+ var args = arguments.length < 2 ? false : slice.call(arguments, 1);
+
+ immediateIds[id] = true;
+
+ nextTick(function onNextTick() {
+ if (immediateIds[id]) {
+ // fn.call() is faster so we optimize for the common use-case
+ // @see http://jsperf.com/call-apply-segu
+ if (args) {
+ fn.apply(null, args);
+ } else {
+ fn.call(null);
+ }
+ // Prevent ids from leaking
+ exports.clearImmediate(id);
+ }
+ });
+
+ return id;
+};
+
+exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
+ delete immediateIds[id];
+};
+}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
+
+},{"process/browser.js":1,"timers":2}],3:[function(require,module,exports){
+"use strict";
+
+var ready = require('elements/domready'),
+ map = require('prime/map')(),
+ merge = require('mout/object/merge'),
+ forEach = require('mout/array/forEach'),
+ trim = require('mout/string/trim'),
+ $ = require('../utils/elements.utils'),
+ decouple = require('../utils/decouple'),
+ asyncForEach = require('../utils/async-foreach');
+
+var Map = map,
+ Assignments = {
+ toggleSection: function(e, element, index, array) {
+ if (e.type.match(/^touch/)) { e.preventDefault(); }
+ if (element.siblings('[data-g-global-filter]') || element.parent('[data-g-global-filter]')) { return Assignments.globalToggleSection(e, element); }
+ if (element.matches('label')) { return Assignments.treatLabel(e, element); }
+
+ var card = element.parent('.card'),
+ toggles = Map.get(card),
+ save = $('[data-save]'),
+ mode = element.data('g-assignments-check') == null ? 0 : 1;
+
+ if (!toggles || !toggles.inputs) {
+ var inputs = card.search('.enabler input[type=hidden]');
+
+ if (!toggles) { toggles = Map.set(card, { inputs: inputs }).get(card); }
+ if (!toggles.inputs) { toggles = Map.set(card, merge(Map.get(card), { inputs: inputs })).get(card); }
+ }
+
+ // if necessary we should move to asyncForEach for an asynchronous loop, else forEach
+ asyncForEach(toggles.inputs, function(item) {
+ item = $(item);
+
+ if (item.parent('label, h4').compute('display') == 'none') { return; }
+
+ item.value(mode).emit('change');
+ $('body').emit('change', { target: item });
+ }, function() {
+ if (typeof index !== 'undefined' && typeof array !== 'undefined' && (index + 1 == array.length)) {
+ save.disabled(false);
+ }
+ });
+ },
+
+ filterSection: function(e, element, value, global) {
+ if (element.siblings('[data-g-global-filter]') || element.parent('[data-g-global-filter]')) { return Assignments.globalFilterSection(e, element); }
+
+ var card = element.parent('.card'),
+ onlyEnabled = $('[data-assignments-enabledonly]'),
+ items = Map.get(card) || Map.set(card, { labels: card.search('label .settings-param-title') }).get(card);
+
+ value = value || element.value();
+
+ if (!items || !items.labels) {
+ var labels = card.search('label .settings-param-title');
+
+ if (!items) { items = Map.set(card, { labels: labels }).get(card); }
+ if (!items.labels) { items = Map.set(card, merge(Map.get(card), { labels: labels })).get(card); }
+ }
+
+ items = $(items.labels);
+
+ if (!value && !onlyEnabled.checked()) {
+ card.style('display', 'inline-block');
+ return items ? items.search('!> label').style('display', 'block') : items;
+ }
+
+ var count = 0, off = 0, on = 0, text, match;
+
+ if (!items) {
+ element.parent('.card').style('display', onlyEnabled.checked() || value ? 'none' : 'inline-block');
+ }
+
+ asyncForEach(items, function(item, i) {
+ item = $(item);
+ text = trim(item.text());
+ match = text.match(new RegExp("^" + value + '|\\s' + value, 'gi'));
+
+ if (onlyEnabled.checked()) {
+ match = Number(!!match) & Number(item.parent('label, h4').find('.enabler input[type="hidden"]').value());
+ }
+
+ if (match) {
+ var group = item.parent('[data-g-assignments-parent]');
+ if (group && (group = group.data('g-assignments-parent'))) {
+ var parentGroup = item.parent('.card').find('[data-g-assignments-group="' + group + '"]');
+ if (parentGroup) { parentGroup.style('display', 'block'); }
+ }
+
+ item.parent('label, h4').style('display', 'block');
+ on++;
+ } else {
+ item.parent('label, h4').style('display', 'none');
+ off++;
+ }
+
+ count++;
+ if (count == items.length && global) {
+ card.style('display', !on ? 'none' : 'inline-block');
+ }
+ });
+ },
+
+ filterEnabledOnly: function(e, element) {
+ var global = $('[data-g-global-filter] input[type="text"]');
+ Assignments.globalFilterSection(e, global, element);
+ },
+
+ treatLabel: function(event, element) {
+ if (event && event.stopPropagation && event.preventDefault) {
+ event.stopPropagation();
+ event.preventDefault();
+ }
+
+ if ($(event.target).matches('.knob, .toggle')) { return; }
+ var input = element.find('input[type="hidden"]:not([disabled])');
+ if (!input) { return; }
+
+ var value = input.value();
+ value = !!+value;
+ input.value(Number(!value)).emit('change');
+ $('body').emit('change', { target: input });
+
+ return false;
+ },
+
+ globalToggleSection: function(e, element) {
+ var mode = element.data('g-assignments-check') == null ? '[data-g-assignments-uncheck]' : '[data-g-assignments-check]',
+ save = $('[data-save]'),
+ search = $('#assignments .card ' + mode + ', ' + '.settings-assignments .card ' + mode);
+
+ if (!search) { return; }
+
+ save.disabled(true);
+ // if necessary we should move to asyncForEach for an asynchronous loop
+ asyncForEach(search, function(item, index, array) {
+ Assignments.toggleSection(e, $(item), index, array);
+ });
+ },
+
+ globalFilterSection: function(e, element) {
+ var value = element.value(),
+ onlyEnabled = $('[data-assignments-enabledonly]'),
+ search = $('#assignments .card .search input[type="text"], .settings-assignments .card .search input[type="text"]');
+
+ if (!search && !onlyEnabled.checked()) { return; }
+
+ asyncForEach(search, function(item) {
+ Assignments.filterSection(e, $(item), value, 'global');
+ });
+ },
+
+ toggleStateDelegation: function(event, element) {
+ var enabled = element.value() == '1';
+ element.attribute('disabled', !enabled);
+ },
+
+ // chrome workaround for overflow and columns
+ chromeFix: function() {
+ if (!Assignments.isChrome()) { return; }
+ var panels = $('#assignments .settings-param-wrapper, .settings-assignments .settings-param-wrapper'), height, maxHeight;
+ if (!panels) { return; }
+
+ panels.forEach(function(panel){
+ panel = $(panel);
+ maxHeight = parseInt(panel.compute('max-height'), 10);
+ height = panel[0].getBoundingClientRect().height;
+ panel.style({overflow: height >= maxHeight ? 'auto' : 'visible'});
+
+ if (height >= maxHeight) {
+ var alt = 100;
+ decouple(panel, 'scroll', function() {
+ alt = alt == 100 ? 100.01 : 100;
+ panel.parent('.card').style('width', alt + '%');
+ });
+ }
+ });
+ },
+
+ isChrome: function() {
+ return navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
+ }
+ };
+
+ready(function() {
+ var body = $('body');
+
+ body.delegate('input', '#assignments .search input[type="text"], .settings-assignments .search input[type="text"]', Assignments.filterSection);
+ body.delegate('click', '#assignments .card label, #assignments [data-g-assignments-check], #assignments [data-g-assignments-uncheck], .settings-assignments .card label, .settings-assignments [data-g-assignments-check], .settings-assignments [data-g-assignments-uncheck]', Assignments.toggleSection);
+ body.delegate('touchend', '#assignments .card label, #assignments [data-g-assignments-check], #assignments [data-g-assignments-uncheck], .settings-assignments .card label, .settings-assignments [data-g-assignments-check], .settings-assignments [data-g-assignments-uncheck]', Assignments.toggleSection);
+ body.delegate('change', '[data-assignments-enabledonly]', Assignments.filterEnabledOnly);
+ body.delegate('change', '#assignments input[type="hidden"][name], .settings-assignments input[type="hidden"][name]', Assignments.toggleStateDelegation);
+
+ // chrome workaround for overflow and columns
+ //if (Assignments.isChrome()) Assignments.chromeFix();
+});
+
+module.exports = Assignments;
+
+},{"../utils/async-foreach":63,"../utils/decouple":65,"../utils/elements.utils":66,"elements/domready":111,"mout/array/forEach":174,"mout/object/merge":237,"mout/string/trim":272,"prime/map":302}],4:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ ui = require('../ui'),
+ interpolate = require('mout/string/interpolate'),
+ modal = ui.modal,
+ trim = require('mout/string/trim'),
+
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+ getAjaxSuffix = require('../utils/get-ajax-suffix');
+
+ready(function() {
+ // Changelog links
+ $('body').delegate('click', '[data-changelog]', function(event, element) {
+ event.preventDefault();
+
+ modal.open({
+ content: 'Loading',
+ method: 'post',
+ className: 'g5-dialog-theme-default g5-modal-changelog',
+ data: { version: element.data('changelog') },
+ remote: parseAjaxURI(getAjaxURL('changelog') + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) { return; }
+
+ var wrapper = content.elements.content,
+ sections = wrapper.search('#g-changelog > ol > li > a');
+
+ sections.forEach(function(section, i) {
+ section = $(section);
+ var href = section.href(),
+ re = new RegExp('#(common|' + GANTRY_PLATFORM + ')$', "gi"),
+ collapsed = !href.match(re),
+ status = 'chevron-' + (!collapsed ? 'up' : 'down');
+
+ if (!trim(section.text())) {
+ // no platforms
+ return;
+ }
+
+ // if it's not common but the current platform, move it after common
+ if (i && !collapsed) {
+ section.parent('li').after(section.parent('ol').find('> li'));
+ }
+
+ zen('i[class="fa g-changelog-toggle fa-fw fa-' + status + '"][aria-hidden="true"]').bottom(section);
+
+ if (collapsed) {
+ section.nextSibling().style({
+ overflow: 'hidden',
+ height: 0
+ });
+ }
+
+ section.on('click', function(e) {
+ e.preventDefault();
+ var icon = section.find('i[class*="fa-chevron-"]'),
+ collapsed = icon.hasClass('fa-chevron-down');
+
+ if (collapsed) {
+ icon.removeClass('fa-chevron-down').addClass('fa-chevron-up');
+ section.nextSibling().slideDown();
+ } else {
+ icon.removeClass('fa-chevron-up').addClass('fa-chevron-down');
+ section.nextSibling().slideUp();
+ }
+ });
+ });
+ }
+ });
+ });
+});
+
+},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"elements":113,"elements/domready":111,"elements/zen":137,"mout/string/interpolate":261,"mout/string/trim":272}],5:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ ready = require('elements/domready'),
+ request = require('agent'),
+
+ modal = require('../ui').modal,
+ guid = require('mout/random/guid'),
+ trim = require('mout/string/trim'),
+
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+
+ History = require('../utils/history'),
+ getParam = require('mout/queryString/getParam'),
+ setParam = require('mout/queryString/setParam');
+
+
+var refreshWordpressLinks = function (title, value) {
+ if (GANTRY_PLATFORM == 'wordpress') {
+ // refresh URIs with new configuration name
+ var replace = title.replace(/[^a-z\d_-\s]/i, '_').toLowerCase(),
+ find = $('[href*="/' + value + '/"]'),
+ currentURI = History.getPageUrl(),
+ currentView = getParam(currentURI, 'view');
+
+ if (find) {
+ find.forEach(function(lnk){
+ lnk = $(lnk);
+ var href = lnk.href().replace('/' + value + '/', '/' + replace + '/');
+ lnk.href(href);
+ });
+ }
+
+ currentView = currentView.replace('/' + value + '/', '/' + replace + '/');
+ currentURI = setParam(currentURI, 'view', currentView);
+ History.replaceState({ uuid: guid(), doNothing: true }, window.document.title, currentURI);
+ }
+};
+
+ready(function() {
+ var body = $('body');
+
+ var selectized, select, editable, href;
+ body.delegate('keydown', '.config-select-wrap [data-title-edit]', function(event, element) {
+ var key = (event.which ? event.which : event.keyCode);
+ if (key == 32 || key == 13) { // ARIA support: Space / Enter toggle
+ event.preventDefault();
+ body.emit('mousedown', event);
+ }
+ });
+
+ body.delegate('mousedown', '.config-select-wrap [data-title-edit]', function(event, element) {
+ selectized = element.siblings('.g-selectize-control');
+ select = element.siblings('select');
+ editable = element.siblings('[data-title-editable]');
+
+ if (!editable.gConfEditAttached) {
+ editable.gConfEditAttached = true;
+ editable.on('title-edit-end', function(title, original, canceled) {
+ title = trim(title);
+ if (canceled || title == original) {
+ selectized.style('display', 'inline-block');
+ editable.style('display', 'none').attribute('contenteditable', null);
+
+ return;
+ }
+
+ element.addClass('disabled');
+ element.removeClass('fa-pencil').addClass('fa-spin-fast fa-spinner');
+ href = editable.data('g-config-href');
+
+ request('post', parseAjaxURI(href + getAjaxSuffix()), { title: title }, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ editable.data('title-editable', original).text(original);
+ } else {
+ var selectize = select.selectizeInstance,
+ value = select.value(),
+ data = selectize.Options[value];
+
+ data[selectize.options.labelField] = title;
+ selectize.updateOption(value, data);
+
+ selectized.style('display', 'inline-block');
+ editable.style('display', 'none')
+ }
+
+ // fix Wordpress non unique IDs by refreshing all hrefs
+ refreshWordpressLinks(title, value);
+
+ element.removeClass('disabled');
+ element.removeClass('fa-spin-fast fa-spinner').addClass('fa-pencil');
+ });
+ });
+ }
+
+ editable.style({
+ width: selectized.compute('width'),
+ display: 'inline-block'
+ });
+ selectized.style('display', 'none');
+ });
+});
+
+module.exports = {};
+
+},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,"agent":80,"elements":113,"elements/domready":111,"mout/queryString/getParam":247,"mout/queryString/setParam":249,"mout/random/guid":251,"mout/string/trim":272}],6:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ trim = require('mout/string/trim'),
+ keys = require('mout/object/keys'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ request = require('agent'),
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+
+ flags = require('../utils/flags-state');
+
+require('./dropdown-edit');
+
+ready(function() {
+ var body = $('body');
+
+ // Handles Creating new Configurations
+ body.delegate('click', '[data-g5-outline-create], [data-g5-outline-duplicate]', function(event, element) {
+ if (event) { event.preventDefault(); }
+
+ modal.open({
+ content: 'Loading',
+ method: 'post',
+ overlayClickToClose: false,
+ remote: parseAjaxURI(element.href() + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var title = content.elements.content.find('[name="title"]'),
+ confirm = content.elements.content.find('[data-g-outline-create-confirm]');
+
+ title.on('keyup', function(event) {
+ var code = event.which;
+ if (code === 13) {
+ confirm.emit('click');
+ }
+ });
+
+ confirm.on('click', function() {
+ confirm.hideIndicator();
+ confirm.showIndicator();
+
+ var URI = parseAjaxURI(confirm.data('g-outline-create-confirm') + getAjaxSuffix()),
+ from = content.elements.content.find('[name="from"]:checked'),
+ preset = content.elements.content.find('[name="preset"]'),
+ outline = content.elements.content.find('[name="outline"]'),
+ inherit = content.elements.content.find('[name="inherit"]'),
+ data = {
+ title: title.value(),
+ from: from ? from.value() : null,
+ preset: preset ? preset.value() : null,
+ outline: outline ? outline.value() : null,
+ inherit: inherit.checked() ? 1 : 0
+ };
+
+ ['title', 'from', 'preset', 'outline'].forEach(function(key) {
+ if (!data[key]) { delete data[key]; }
+ });
+
+ request('post', URI, data, function(error, response) {
+ confirm.hideIndicator();
+
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var base = $('#configurations').find('ul').find('li'),
+ outline = zen('li').attribute('class', base.attribute('class'));
+
+ outline.after(base).html(response.body.outline);
+
+ toastr.success(response.body.html || 'Action successfully completed.', response.body.title || '');
+
+ attachEditables(outline.find('[data-title-editable]'));
+ modal.close();
+ }
+
+ });
+ });
+
+ setTimeout(function() {
+ title[0].focus();
+ }, 5);
+ }
+ });
+ });
+
+ // Handles Preset / Outline switcher in Outline creation
+ body.delegate('change', 'input[type="radio"]#from-preset, input[type="radio"]#from-outline', function(event, element) {
+ element = $(element);
+ var value = element.value(),
+ elements = element.parent('.card').search('.g-create-from');
+
+ var filtered = elements.style('display', 'none').filter(function(block) {
+ block = $(block);
+ return block.hasClass('g-create-from-' + value);
+ });
+
+ if (filtered) {
+ $(filtered).style('display', 'block');
+ }
+ });
+
+ // Handles Configurations Duplicate / Remove
+ body.delegate('click', '#configurations [data-g-config]', function(event, element) {
+ var mode = element.data('g-config'),
+ href = element.data('g-config-href'),
+ hrefConfirm = element.data('g-config-href-confirm'),
+ encode = window.btoa(href),//.substr(-20, 20), // in case the strings gets too long
+ method = (element.data('g-config-method') || 'post').toLowerCase();
+
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ if (mode == 'delete' && !flags.get('free:to:delete:' + encode, false)) {
+ // confirm before proceeding
+ flags.warning({
+ url: parseAjaxURI(href + getAjaxSuffix()),
+ callback: function(response, content) {
+ var confirm = content.find('[data-g-delete-confirm]'),
+ cancel = content.find('[data-g-delete-cancel]');
+
+ if (!confirm) { return; }
+
+ confirm.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ flags.get('free:to:delete:' + encode, true);
+ $([confirm, cancel]).attribute('disabled');
+ body.emit('click', { target: element });
+
+ modal.close();
+ });
+
+ cancel.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([confirm, cancel]).attribute('disabled');
+ flags.get('free:to:delete:' + encode, false);
+
+ modal.close();
+ });
+ }
+ });
+
+ return false;
+ }
+
+ element.hideIndicator();
+ element.showIndicator();
+
+ request(method, parseAjaxURI((hrefConfirm || href) + getAjaxSuffix()), {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var confSelector = $('#configuration-selector'),
+ currentOutline = confSelector.value(),
+ outlineDeleted = response.body.outline,
+ reload = $('[href="' + getAjaxURL('configurations') + '"]');
+
+ // if the current outline is the one that's been deleted,
+ // fallback to default
+ if (outlineDeleted && currentOutline == outlineDeleted) {
+ var ids = keys(confSelector.selectizeInstance.Options);
+ if (ids.length) {
+ reload.href(reload.href().replace('style=' + outlineDeleted, 'style=' + ids.shift()));
+ }
+ }
+
+ if (!reload) { window.location = window.location; }
+ else {
+ body.emit('click', { target: reload });
+ }
+
+ toastr.success(response.body.html || 'Action successfully completed.', response.body.title || '');
+ if (outlineDeleted) {
+ body.outlineDeleted = outlineDeleted;
+ }
+ }
+
+ element.hideIndicator();
+ });
+
+ });
+
+ // Handles Configurations Titles Rename
+ var updateTitle = function(title, original, wasCanceled) {
+ this.style('text-overflow', 'ellipsis');
+ if (wasCanceled || title == original) { return; }
+ var element = this,
+ href = element.data('g-config-href'),
+ method = (element.data('g-config-method') || 'post').toLowerCase(),
+ parent = element.parent();
+
+ parent.showIndicator();
+ parent.find('[data-title-edit]').addClass('disabled');
+
+ request(method, parseAjaxURI(href + getAjaxSuffix()), { title: trim(title) }, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ element.data('title-editable', original).text(original);
+ } else {
+ element.data('title', title).data('tip', title);
+
+ // refresh ID label and actions buttons
+ var dummy = zen('div').html(response.body.outline),
+ id = dummy.find('h4 span:last-child'),
+ actions = dummy.find('.outline-actions');
+
+ element.parent('.card').find('h4 span:last-child').html(id.html());
+ element.parent('.card').find('.outline-actions').html(actions.html());
+ }
+
+ parent.hideIndicator();
+ parent.find('[data-title-edit]').removeClass('disabled');
+ });
+ },
+
+ attachEditables = function(editables) {
+ if (!editables || !editables.length) { return; }
+ editables.forEach(function(editable) {
+ editable = $(editable);
+ editable.confWasAttached = true;
+ editable.on('title-edit-start', function() {
+ editable.style('text-overflow', 'inherit');
+ });
+ editable.on('title-edit-end', updateTitle);
+ });
+ };
+
+ body.on('statechangeAfter', function(event, element) {
+ var editables = $('#configurations [data-title-editable]');
+ if (!editables) { return true; }
+
+ editables = editables.filter(function(editable) {
+ return (typeof $(editable).confWasAttached) === 'undefined';
+ });
+
+ attachEditables(editables);
+ });
+
+ attachEditables($('#configurations [data-title-editable]'));
+});
+
+module.exports = {};
+
+},{"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"./dropdown-edit":5,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272}],7:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ $ = require('elements/attributes'),
+ storage = require('prime/map'),
+ deepEquals = require('mout/lang/deepEquals'),
+ is = require('mout/lang/is'),
+ isString = require('mout/lang/isString'),
+ hasOwn = require('mout/object/has'),
+ forEach = require('mout/collection/forEach'),
+ invoke = require('mout/array/invoke'),
+ History = require('../utils/history'),
+ flags = require('../utils/flags-state'),
+ submit = require('./submit');
+
+require('./multicheckbox');
+
+var originals,
+ collectFieldsValues = function(keys) {
+ var map = new storage(),
+ defaults = $('[data-g-styles-defaults]'),
+ overridables = $('input[type="checkbox"].settings-param-toggle');
+
+ defaults = defaults ? JSON.parse(defaults.data('g-styles-defaults')) : {};
+
+ // keep track of overrides getting enabled / disabled
+ // in order to detect if has changed
+ if (overridables) {
+ var overrides = {};
+
+ overridables.forEach(function(override) {
+ override = $(override);
+ overrides[override.id()] = override.checked();
+ });
+
+ map.set('__js__overrides', JSON.stringify(overrides));
+ }
+
+ if (keys) {
+ var field;
+ keys.forEach(function(key) {
+ field = $('[name="' + key + '"]');
+ if (field) {
+ map.set(key, field.value());
+ }
+ });
+
+ return map;
+ }
+
+ var fields = $('.settings-block [name]');
+ if (!fields) { return false; }
+
+ fields.forEach(function(field) {
+ field = $(field);
+ var key = field.attribute('name'),
+ isInput = !hasOwn(defaults, key);
+
+ if (field.type() == 'checkbox' && !field.value().length) { field.value('0'); }
+ map.set(key, isInput ? field.value() : defaults[key]);
+ }, this);
+
+ return map;
+ },
+ createMapFrom = function(data) {
+ var map = new storage();
+
+ forEach(data, function(value, key) {
+ map.set(key, value);
+ });
+
+ return map;
+ };
+
+var compare = {
+ single: function() {},
+ whole: function() {},
+ blanks: function() {},
+ presets: function() {}
+};
+
+ready(function() {
+ var body = $('body'), presetsCache;
+
+ originals = collectFieldsValues();
+
+ compare.single = function(event, element) {
+ var parent = element.parent('.settings-param') || element.parent('h4') || element.parent('.input-group'),
+ target = parent ? (parent.matches('h4') ? parent : parent.find('.settings-param-title, .g-instancepicker-title')) : null,
+ isOverride = parent ? parent.find('.settings-param-toggle') : false,
+ isNewWidget = false,
+ isOverrideToggle = element.hasClass('settings-param-toggle');
+
+ if (!parent) { return; }
+
+ if (isOverrideToggle) {
+ return compare.whole('force');
+ }
+
+ if (element.type() == 'checkbox') {
+ element.value(Number(element.checked()).toString());
+ }
+
+ if (originals && originals.get(element.attribute('name')) == null) {
+ originals.set(element.attribute('name'), element.value());
+ isNewWidget = true;
+ }
+
+ if (!target || !originals || originals.get(element.attribute('name')) == null) { return; }
+ if (originals.get(element.attribute('name')) !== element.value() || isNewWidget) {
+ if (isOverride && event.forceOverride && !isOverride.checked()) { isOverride[0].click(); }
+ target.showIndicator('changes-indicator font-small far fa-circle fa-fw');
+ } else {
+ if (isOverride && event.forceOverride && isOverride.checked()) { isOverride[0].click(); }
+ target.hideIndicator();
+ }
+
+ compare.blanks(event, parent.find('.settings-param-field'));
+ compare.whole('force');
+ compare.presets();
+ };
+
+ compare.whole = function(force) {
+ if (!originals) { return; }
+ var equals = deepEquals(originals, collectFieldsValues(force ? originals.keys() : null), function(a, b) {
+ if (isString(a) && isString(b) && a.substr(0, 1) == '#' && b.substr(0, 1) == '#') {
+ return a.toLowerCase() == b.toLowerCase();
+ } else {
+ return is(a, b);
+ }
+ }),
+ save = $('[data-save]');
+
+ if (!save) { return; }
+
+ flags.set('pending', !equals);
+ save[equals ? 'hideIndicator' : 'showIndicator']('changes-indicator far fa-circle fa-fw');
+ };
+
+ compare.blanks = function(event, element) {
+ if (!element) { return; }
+ var field = element.find('[name]'),
+ reset = element.find('.g-reset-field');
+ if (!field || !reset) { return true; }
+
+ var value = field.value();
+ if (!value || field.disabled()) { reset.style('display', 'none'); }
+ else { reset.removeAttribute('style'); }
+ };
+
+ compare.presets = function() {
+ var presets = $('[data-g-styles]'), store;
+ if (!presets) { return; }
+
+ if (!presetsCache) {
+ presetsCache = new storage();
+ forEach(presets, function(preset, index) {
+ preset = $(preset);
+ store = {
+ index: index,
+ map: createMapFrom(JSON.parse(preset.data('g-styles')))
+ };
+ presetsCache.set(preset, store);
+ });
+ }
+
+ var fields, equals;
+ presetsCache.forEach(function(data, element) {
+ fields = collectFieldsValues(data.map.keys());
+
+ // Do not consider __js__overrides when comparing for equality
+ fields.unset('__js__overrides');
+
+ equals = deepEquals(fields, data.map, function(a, b) { return a == b; });
+ $($('[data-g-styles]')[data.index]).parent()[equals ? 'addClass' : 'removeClass']('g-preset-match');
+ });
+ };
+
+ body.delegate('input', '.settings-block input[name][type="text"], .settings-block textarea[name]', compare.single);
+ body.delegate('change', '.settings-block input[name][type="hidden"], .settings-block input[name][type="checkbox"], .settings-block select[name], .settings-block .selectized[name], .settings-block input[id][type="checkbox"].settings-param-toggle', compare.single);
+
+ body.delegate('input', '.g-urltemplate', function(event, element) {
+ var previous = element.parent('.settings-param').siblings();
+ if (!previous) { return; }
+
+ previous = previous.find('[data-g-urltemplate]');
+
+ if (previous) {
+ var template = previous.data('g-urltemplate');
+ previous.attribute('href', template.replace(/#ID#/g, element.value()));
+ }
+ });
+
+ // fields resets
+ body.delegate('mouseenter', '.settings-param-field', compare.blanks, true);
+ body.delegate('click', '.g-reset-field', function(e, element) {
+ var parent = element.parent('.settings-param-field'), field;
+ if (!parent) { return; }
+
+ field = parent.find('[name]');
+ if (field && !field.disabled()) {
+ var selectize = field.selectizeInstance;
+ if (selectize) { selectize.setValue(''); }
+ else { field.value(''); }
+
+ field.emit('change');
+ body.emit('input', { target: field });
+ body.emit('keyup', { target: field });
+ }
+ });
+
+ body.on('statechangeEnd', function() {
+ var State = History.getState();
+ body.emit('updateOriginalFields');
+ });
+
+ body.on('updateOriginalFields', function() {
+ originals = collectFieldsValues();
+ compare.presets();
+ });
+
+ // force a presets comparison check
+ compare.presets();
+});
+
+module.exports = {
+ compare: compare,
+ collect: collectFieldsValues,
+ submit: submit
+};
+
+},{"../utils/flags-state":69,"../utils/history":75,"./multicheckbox":8,"./submit":9,"elements/attributes":108,"elements/domready":111,"mout/array/invoke":178,"mout/collection/forEach":189,"mout/lang/deepEquals":201,"mout/lang/is":202,"mout/lang/isString":211,"mout/object/has":234,"prime/map":302}],8:[function(require,module,exports){
+"use strict";
+var $ = require('elements/attributes'),
+ ready = require('elements/domready'),
+ remove = require('mout/array/remove'),
+ insert = require('mout/array/insert'),
+ contains = require('mout/array/contains');
+
+
+ready(function() {
+ var body = $('body');
+
+ body.delegate('change', '.input-multicheckbox .input-group input[name][type="hidden"]', function(event, element) {
+ var name = element.attribute('name'),
+ values = element.value().split(','),
+ fields = $('[data-multicheckbox-field="' + name +'"]');
+
+ if (fields) {
+ fields.forEach(function(field) {
+ field = $(field);
+ if (field.checked()) { insert(values, field.value()); }
+ if (!field.checked()) { remove(values, field.value()); }
+ });
+ }
+
+ element.value(values.filter(String).join(','));
+ });
+
+ body.delegate('change', '.input-multicheckbox .input-group input[data-multicheckbox-field][type="checkbox"]', function(event, element) {
+ var field = $('[name="' + element.data('multicheckbox-field') + '"]'),
+ value = element.value(),
+ values = field.value().split(','),
+ isChecked = element.checked();
+
+ if (isChecked) { insert(values, value); }
+ if (!isChecked) { remove(values, value); }
+
+ field.value(values.filter(String).join(','));
+
+ body.emit('change', {target: field});
+ });
+});
+
+
+},{"elements/attributes":108,"elements/domready":111,"mout/array/contains":166,"mout/array/insert":176,"mout/array/remove":181}],9:[function(require,module,exports){
+'use strict';
+
+var $ = require('elements'),
+ isArray = require('mout/lang/isArray'),
+ contains = require('mout/array/contains'),
+ trim = require('mout/string/trim'),
+ validateField = require('../utils/field-validation');
+
+var submit = function(elements, container, options) {
+ var valid = [],
+ invalid = [];
+
+ elements = $(elements);
+ container = $(container);
+ options = options || {};
+
+ $(elements).forEach(function(input) {
+ input = $(input);
+ var name = input.attribute('name'),
+ type = input.attribute('type');
+ if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
+
+ input = container.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
+
+ // workaround for checkboxes trick that has both a hidden and checkbox field
+ if (type === 'checkbox' && container.find('[type="hidden"][name="' + name + '"]')) {
+ input = container.find('[name="' + name + '"][type="checkbox"]');
+ }
+
+ if (input) {
+ var value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
+ parent = input.parent('.settings-param'),
+ override = parent ? parent.find('> input[type="checkbox"]') : null;
+
+ override = override || $(input.data('override-target'));
+
+ if (contains(['select', 'select-multiple'], input.type()) && input.attribute('multiple')) {
+ value = (input.search('option[selected]') || []).map(function(selection) {
+ return $(selection).value();
+ });
+ }
+
+ if (override && !override.checked()) { return; }
+ if (!validateField(input)) { invalid.push(input); }
+
+ if (isArray(value)) {
+ value.forEach(function(selection) {
+ valid.push(name + '[]=' + encodeURIComponent(selection));
+ });
+ } else {
+ if (!options.submitUnchecked || (input.type() != 'checkbox' || (input.type() == 'checkbox' && !!value))) {
+ valid.push(name + '=' + encodeURIComponent(value));
+ }
+ }
+ }
+ });
+
+ var titles = container.search('h4 [data-title-editable]'), key;
+ if (titles) {
+ titles.forEach(function(title) {
+ title = $(title);
+ if (title.parent('[data-collection-template]')) { return; }
+
+ key = title.data('collection-key') || (options.isRoot ? 'settings[title]' : 'title');
+ valid.push(key + '=' + encodeURIComponent(trim(title.data('title-editable'))));
+ });
+ }
+
+ return { valid: valid, invalid: invalid };
+};
+
+module.exports = submit;
+},{"../utils/field-validation":68,"elements":113,"mout/array/contains":166,"mout/lang/isArray":203,"mout/string/trim":272}],10:[function(require,module,exports){
+"use strict";
+// deprecated (5.2.0)
+var prime = require('prime'),
+ $ = require('elements'),
+ Base = require('./base'),
+ zen = require('elements/zen'),
+ getAjaxURL = require('../../utils/get-ajax-url').config;
+
+var Atom = new prime({
+ inherits: Base,
+ options: {
+ type: 'atom'
+ },
+
+ constructor: function(options) {
+ Base.call(this, options);
+
+ this.on('changed', this.hasChanged);
+ },
+
+ updateTitle: function(title) {
+ this.block.find('.title').text(title);
+ this.setTitle(title);
+ return this;
+ },
+
+ layout: function() {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId()),
+ subtype = this.getSubType() ? 'data-lm-blocksubtype="' + this.getSubType() + '"' : '';
+ return '' + this.getTitle() + '' + (this.getSubType() || this.getKey() || this.getType()) + '
';
+ },
+
+ hasChanged: function(state, parent) {
+ var icon = this.block.find('span > i.changes-indicator:first-child');
+
+ // if the particle has changes but the parent block doesn't, we want to keep the indicator showing
+ if (icon && parent && !parent.changeState) { return; }
+
+ this.block[state ? 'addClass' : 'removeClass']('block-has-changes');
+
+ if (!state && icon) { icon.remove(); }
+ if (state && !icon) { zen('i.far.fa-circle.changes-indicator').before(this.block.find('.icon')); }
+ },
+
+ onRendered: function(element, parent) {
+ var globally_disabled = $('[data-lm-disabled][data-lm-subtype="' + this.getSubType() + '"]');
+
+ if (globally_disabled || this.getAttribute('enabled') === 0) { this.disable(); }
+ }
+});
+
+module.exports = Atom;
+
+},{"../../utils/get-ajax-url":71,"./base":12,"elements":113,"elements/zen":137,"prime":301}],11:[function(require,module,exports){
+"use strict";
+// deprecated (5.2.0)
+var prime = require('prime'),
+ $ = require('elements'),
+ zen = require('elements/zen'),
+ bind = require('mout/function/bind'),
+ Section = require('./section');
+
+var Atoms = new prime({
+ inherits: Section,
+ options: {
+ type: 'atoms',
+ attributes: {
+ name: "Atoms Section"
+ }
+ },
+
+ layout: function() {
+ this.deprecated = 'Looking for Atoms? To make it easier we moved them in the
Page Settings.
';
+
+ return '';
+ },
+
+ getId: function() {
+ return this.id || (this.id = this.options.type);
+ },
+
+ onDone: function(event) {
+ // Gantry 5.2.0: Remove atoms section if empty to keep the layout clear
+ if (!this.block.search('[data-lm-blocktype="atom"]')) {
+ var ids = [this.getId()], segments = this.block.search('[data-lm-id]');
+ if (segments) {
+ segments.forEach(function(element) {
+ ids.push($(element).data('lm-id'));
+ });
+ }
+
+ ids.reverse().forEach(bind(function(id) {
+ this.options.builder.remove(id);
+ }, this));
+
+ this.block.empty()[0].outerHTML = this.deprecated;
+ this._attachRedirect();
+
+ return;
+ }
+
+ if (!this.block.search('[data-lm-id]')) {
+ this.grid.insert(this.block, 'bottom');
+ this.options.builder.add(this.grid);
+ }
+
+ zen('div').html(this.deprecated).firstChild().after(this.block);
+
+ this._attachRedirect();
+ },
+
+ _attachRedirect: function() {
+ var item = $('[data-g5-nav="page"]');
+ if (!item) { return; }
+
+ $('.atoms-notice a').on('click', function(event) {
+ event.preventDefault();
+ $('body').emit('click', { target: item });
+ });
+ }
+});
+
+module.exports = Atoms;
+
+},{"./section":20,"elements":113,"elements/zen":137,"mout/function/bind":192,"prime":301}],12:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Options = require('prime-util/prime/options'),
+ Bound = require('prime-util/prime/bound'),
+ Emitter = require('prime/emitter'),
+ zen = require('elements/zen'),
+ trim = require('mout/string/trim'),
+ $ = require('elements'),
+ ID = require('../id'),
+
+ size = require('mout/object/size'),
+ get = require('mout/object/get'),
+ has = require('mout/object/has'),
+ set = require('mout/object/set'),
+ translate = require('../../utils/translate'),
+ getCurrentOutline = require('../../utils/get-outline').getCurrentOutline;
+
+require('elements/traversal');
+
+var Base = new prime({
+ mixin: [Bound, Options],
+ inherits: Emitter,
+ options: {
+ subtype: false,
+ attributes: {},
+ inherit: {}
+ },
+ constructor: function(options) {
+ this.setOptions(options);
+
+ this.fresh = !this.options.id;
+ this.id = this.options.id || ID(this.options);
+ this.attributes = this.options.attributes || {};
+ this.inherit = this.options.inherit || {};
+
+ this.block = zen('div').html(this.layout()).firstChild();
+
+ this.on('rendered', this.bound('onRendered'));
+
+ return this;
+ },
+
+ guid: function() {
+ return guid();
+ },
+
+ getId: function() {
+ return this.id || (this.id = ID(this.options));
+ },
+
+ getType: function() {
+ return this.options.type || '';
+ },
+
+ getSubType: function() {
+ return this.options.subtype || '';
+ },
+
+ getTitle: function() {
+ return trim(this.options.title || 'Untitled');
+ },
+
+ setTitle: function(title) {
+ this.options.title = trim(title || 'Untitled');
+ return this;
+ },
+
+ getKey: function() {
+ return '';
+ },
+
+ getPageId: function() {
+ var root = $('[data-lm-root]');
+ if (!root) return 'data-root-not-found';
+
+ return root.data('lm-page');
+ },
+
+ getAttribute: function(key) {
+ return get(this.attributes, key);
+ },
+
+ getAttributes: function() {
+ return this.attributes || {};
+ },
+
+ getInheritance: function() {
+ return this.inherit || {};
+ },
+
+ updateTitle: function() {
+ return this;
+ },
+
+ setAttribute: function(key, value) {
+ set(this.attributes, key, value);
+ return this;
+ },
+
+ setAttributes: function(attributes) {
+ this.attributes = attributes;
+
+ return this;
+ },
+
+ setInheritance: function(inheritance) {
+ this.inherit = inheritance;
+
+ return this;
+ },
+
+ hasAttribute: function(key) {
+ return has(this.attributes, key);
+ },
+
+ enableInheritance: function() {},
+
+ disableInheritance: function() {},
+
+ refreshInheritance: function() {},
+
+ hasInheritance: function() {
+ return size(this.inherit) && this.inherit.outline != getCurrentOutline();
+ },
+
+ disable: function() {
+ this.block.title(translate('GANTRY5_PLATFORM_JS_LM_DISABLED_PARTICLE', 'particle'));
+ this.block.addClass('particle-disabled');
+ },
+
+ enable: function() {
+ this.block.removeAttribute('title');
+ this.block.removeClass('particle-disabled');
+ },
+
+ insert: function(target, location) {
+ this.block[location || 'after'](target);
+ return this;
+ },
+
+ adopt: function(element) {
+ element.insert(this.block);
+ return this;
+ },
+
+ isNew: function(fresh) {
+ if (typeof fresh !== 'undefined') {
+ this.fresh = !!fresh;
+ }
+ return this.fresh;
+ },
+
+ dropzone: function() {
+ return 'data-lm-dropzone';
+ },
+
+ addDropzone: function() {
+ this.block.data('lm-dropzone', true);
+ },
+
+ removeDropzone: function() {
+ this.block.data('lm-dropzone', null);
+ },
+
+ layout: function() {},
+
+ onRendered: function() {},
+
+ setLayout: function(layout) {
+ this.block = layout;
+ return this;
+ },
+
+ getLimits: function() {
+ return false;
+ }
+});
+
+module.exports = Base;
+
+},{"../../utils/get-outline":72,"../../utils/translate":78,"../id":27,"elements":113,"elements/traversal":136,"elements/zen":137,"mout/object/get":233,"mout/object/has":234,"mout/object/set":241,"mout/object/size":242,"mout/string/trim":272,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],13:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Base = require('./base'),
+ $ = require('../../utils/elements.utils'),
+ zen = require('elements/zen'),
+ precision = require('mout/number/enforcePrecision'),
+ bind = require('mout/function/bind');
+
+var Block = new prime({
+ inherits: Base,
+ options: {
+ type: 'block',
+ attributes: {
+ size: 100
+ }
+ },
+
+ constructor: function(options) {
+ Base.call(this, options);
+ if (options.attributes && options.attributes.size) this.setAttribute('size', precision(options.attributes.size, 1));
+
+ this.on('changed', this.hasChanged);
+ },
+
+ getSize: function() {
+ return precision(this.getAttribute('size'), 1);
+ },
+
+ setSize: function(size, store) {
+ size = typeof size === 'undefined' ? this.getSize() : Math.max(0, Math.min(100, parseFloat(size)));
+ size = precision(size, 1);
+ if (store) {
+ this.setAttribute('size', size);
+ }
+
+ $(this.block).style({
+ flex: '0 1 ' + size + '%',
+ '-webkit-flex': '0 1 ' + size + '%',
+ '-ms-flex': '0 1 ' + size + '%'
+ });
+
+ this.emit('resized', size, this);
+ },
+
+ setAnimatedSize: function(size, store) {
+ size = typeof size === 'undefined' ? this.getSize() : Math.max(0, Math.min(100, parseFloat(size)));
+ size = precision(size, 1);
+ if (store) {
+ this.setAttribute('size', size);
+ }
+ $(this.block).animate({
+ flex: '0 1 ' + size + '%',
+ '-webkit-flex': '0 1 ' + size + '%',
+ '-ms-flex': '0 1 ' + size + '%'
+ }, bind(function() {
+ this.block.attribute('style', null);
+ this.setSize(size);
+ }, this));
+
+ this.emit('resized', size, this);
+ },
+
+ setLabelSize: function(size) {
+ var label = this.block.find('> .particle-size');
+ if (!label) { return false; }
+
+ label.text(precision(size, 1) + '%');
+ },
+
+ layout: function() {
+ return '';
+ },
+
+ onRendered: function(element, parent) {
+ if (element.block.find('> [data-lm-blocktype="section"]')) {
+ this.removeDropzone();
+ }
+
+ if (!parent) { return; }
+
+ var grandpa = parent.block.parent();
+ if (grandpa.data('lm-root') || (grandpa.data('lm-blocktype') == 'container' && (grandpa.parent().data('lm-root') || grandpa.parent().data('lm-blocktype') == 'wrapper'))) {
+ zen('span.particle-size').text(this.getSize() + '%').top(element.block);
+ element.on('resized', this.bound('onResize'));
+ }
+ },
+
+ onResize: function(resize) {
+ this.setLabelSize(resize);
+ },
+
+ hasChanged: function(state) {
+ var icon,
+ child = this.block.find('> [data-lm-id]:not([data-lm-blocktype="section"]):not([data-lm-blocktype="container"])');
+
+ this.changeState = state;
+
+ if (!child) {
+ child = this.block.find('> .particle-size') || this.block.parent('[data-lm-blocktype="block"]').find('> .particle-size');
+ icon = child.find('i:first-child');
+
+ if (!state && icon) { icon.remove(); }
+ if (state && !icon) { zen('i.far.fa-circle.changes-indicator').top(child); }
+
+ return;
+ }
+
+ var mapped = this.options.builder.get(child.data('lm-id'));
+ if (mapped) { mapped.emit('changed', state, this); }
+ }
+});
+
+module.exports = Block;
+
+},{"../../utils/elements.utils":66,"./base":12,"elements/zen":137,"mout/function/bind":192,"mout/number/enforcePrecision":222,"prime":301}],14:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Base = require('./base'),
+ zen = require('elements/zen'),
+ $ = require('elements'),
+ getAjaxURL = require('../../utils/get-ajax-url').config,
+ translate = require('../../utils/translate');
+
+var Container = new prime({
+ inherits: Base,
+ options: {
+ type: 'container'
+ },
+
+ constructor: function(options) {
+ Base.call(this, options);
+ this.on('changed', this.hasChanged);
+ },
+
+ layout: function() {
+ return '';
+ },
+
+ onRendered: function(element, parent) {
+ if (!parent) {
+ this.addSettings(element);
+ }
+ },
+
+ hasChanged: function(state, child) {
+ var icon = this.block.find('span.title > i:first-child');
+
+ // if the the event is triggered from a grid we need to be cautious not to override the proper state
+ if (icon && child && !child.changeState) { return; }
+
+ this.block[state ? 'addClass' : 'removeClass']('block-has-changes');
+
+ if (!state && icon) { icon.remove(); }
+ if (state && !icon) {
+ var title = this.block.find('span.title');
+ if (title) { zen('i.far.fa-circle.changes-indicator').top(title); }
+ }
+ },
+
+ addSettings: function(container) {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId()),
+ wrapper = zen('div.container-wrapper.clearfix').top(container.block),
+ title = zen('div.container-title').bottom(wrapper),
+ actions = zen('div.container-actions').bottom(wrapper);
+
+ title.html('' + this.getType() + '');
+ actions.html('');
+ }
+});
+
+module.exports = Container;
+
+},{"../../utils/get-ajax-url":71,"../../utils/translate":78,"./base":12,"elements":113,"elements/zen":137,"prime":301}],15:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Base = require('./base'),
+ $ = require('elements'),
+ getAjaxURL = require('../../utils/get-ajax-url').config;
+
+var Grid = new prime({
+ inherits: Base,
+ options: {
+ type: 'grid'
+ },
+
+ constructor: function(options) {
+ Base.call(this, options);
+
+ this.on('changed', this.hasChanged);
+ },
+
+ layout: function() {
+ return '';
+ },
+
+ onRendered: function() {
+ var parent = this.block.parent();
+ if (parent && parent.data('lm-blocktype') == 'atoms') {
+ this.block.removeClass('nowrap');
+ }
+
+ if (parent && parent.data('lm-root') || (parent.data('lm-blocktype') == 'container' && parent.parent().data('lm-root'))) {
+ this.removeDropzone();
+ }
+ },
+
+ hasChanged: function(state) {
+ // Grids don't have room for an indicator so we forward it to the parent Section
+ var parent = this.block.parent('[data-lm-blocktype="section"]'),
+ id = parent ? parent.data('lm-id') : false;
+
+ this.changeState = state;
+
+ if (!parent || !id) { return; }
+
+ if (this.options.builder) { this.options.builder.get(id).emit('changed', state, this); }
+ }
+});
+
+module.exports = Grid;
+
+},{"../../utils/get-ajax-url":71,"./base":12,"elements":113,"prime":301}],16:[function(require,module,exports){
+module.exports = {
+ base: require('./base'),
+ atom: require('./atom'),
+ section: require('./section'),
+ offcanvas: require('./offcanvas'),
+ wrapper: require('./wrapper'),
+ atoms: require('./atoms'),
+ grid: require('./grid'),
+ container: require('./container'),
+ block: require('./block'),
+ particle: require('./particle'),
+ position: require('./position'),
+ system: require('./system'),
+ spacer: require('./spacer')
+};
+
+},{"./atom":10,"./atoms":11,"./base":12,"./block":13,"./container":14,"./grid":15,"./offcanvas":17,"./particle":18,"./position":19,"./section":20,"./spacer":21,"./system":22,"./wrapper":23}],17:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Section = require('./section'),
+
+ getAjaxURL = require('../../utils/get-ajax-url').config,
+ getOutlineNameById = require('../../utils/get-outline').getOutlineNameById,
+ translate = require('../../utils/translate');
+
+var Offcanvas = new prime({
+ inherits: Section,
+ options: {
+ type: 'offcanvas',
+ attributes: {
+ name: "Offcanvas Section"
+ }
+ },
+
+ layout: function() {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId()),
+ inheritance = '',
+ klass = '';
+
+ if (this.hasInheritance()) {
+ var outline = getOutlineNameById(this.inherit.outline);
+ inheritance = '' + translate('GANTRY5_PLATFORM_INHERITING_FROM_X', '' + outline + '') + '
';
+ klass = ' g-inheriting g-inheriting-' + this.inherit.include.join(' g-inheriting-');
+ }
+
+ return '' + inheritance + '
';
+ },
+
+ getId: function() {
+ return this.id || (this.id = this.options.type);
+ }
+});
+
+module.exports = Offcanvas;
+
+},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./section":20,"prime":301}],18:[function(require,module,exports){
+(function (global){(function (){
+"use strict";
+var prime = require('prime'),
+ $ = require('elements'),
+ Atom = require('./atom'),
+ bind = require('mout/function/bind'),
+ precision = require('mout/number/enforcePrecision'),
+ forOwn = require('mout/object/forOwn'),
+ getAjaxURL = require('../../utils/get-ajax-url').config,
+ getOutlineNameById = require('../../utils/get-outline').getOutlineNameById,
+ translate = require('../../utils/translate');
+
+var UID = 0;
+
+var Particle = new prime({
+ inherits: Atom,
+ options: {
+ type: 'particle'
+ },
+
+ constructor: function(options) {
+ ++UID;
+ Atom.call(this, options);
+ },
+
+ layout: function() {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId()),
+ subtype = this.getSubType() ? 'data-lm-blocksubtype="' + this.getSubType() + '"' : '',
+ klass = '';
+
+ if (this.hasInheritance()) {
+ klass = ' g-inheriting';
+ if (this.inherit.include.length) {
+ klass += ' g-inheriting-' + this.inherit.include.join(' g-inheriting-');
+ }
+ }
+
+ return '' + this.getTitle() + '' + (this.getKey() || this.getSubType() || this.getType()) + '
';
+ },
+
+ enableInheritance: function() {
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ if (this.hasInheritance()) {
+ var outline = getOutlineNameById(this.inherit.outline),
+ icon = this.block.find('.icon');
+
+ this.block.addClass('g-inheriting');
+ if (this.inherit.include.length) {
+ this.block.addClass('g-inheriting-' + this.inherit.include.join(' g-inheriting-'));
+ }
+
+ this.block.find('.icon .fa').attribute('class', 'fa ' + this.getIcon());
+
+ forOwn(this.getInheritanceTip(), function(value, key) {
+ icon.data(key, value);
+ });
+
+ global.G5.tips.reload();
+ }
+ },
+
+ disableInheritance: function() {
+ var icon = this.block.find('.icon');
+
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ this.block.removeClass('g-inheriting');
+ this.block.find('.icon .fa').attribute('class', 'fa ' + this.getIcon());
+
+ forOwn(this.getInheritanceTip(), function(value, key) {
+ icon.data(key, null);
+ });
+
+ global.G5.tips.reload();
+ },
+
+ refreshInheritance: function() {
+ this.block[this.hasInheritance() ? 'removeClass' : 'addClass']('g-inheritance');
+ if (this.hasInheritance()) {
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ }
+ },
+
+ addInheritanceTip: function(html) {
+ var tooltip = this.getInheritanceTip();
+
+ if (html) {
+ var tooltipHTML = '';
+ forOwn(tooltip, function(value, key) {
+ tooltipHTML += 'data-' + key + '="' + value + '" ';
+ });
+
+ tooltip = tooltipHTML;
+ }
+
+ return this.hasInheritance() ? tooltip : '';
+ },
+
+ getInheritanceTip: function() {
+ var outline = getOutlineNameById(this.inherit ? this.inherit.outline : null),
+ particle = this.inherit.particle || '',
+ include = (this.inherit.include || []).join(', ');
+
+ return {
+ 'tip': translate('GANTRY5_PLATFORM_INHERITING_FROM_X', '' + outline + '') + '
ID: ' + particle + '
Replace: ' + include,
+ 'tip-offset': -10,
+ 'tip-place': 'top-right'
+ };
+ },
+
+ cleanKlass: function(klass) {
+ klass = (klass || '').split(' ');
+
+ return klass.filter(function(item) { return !item.match(/^g-inheriting-/); }).join(' ');
+ },
+
+ setLabelSize: function(size) {
+ var label = this.block.find('.particle-size');
+ if (!label) { return false; }
+
+ label.text(precision(size, 1) + '%');
+ },
+
+ onRendered: function(element, parent) {
+ var size = parent.getSize() || 100,
+ globally_disabled = $('[data-lm-disabled][data-lm-subtype="' + this.getSubType() + '"]');
+
+ if (globally_disabled || this.getAttribute('enabled') === 0) { this.disable(); }
+
+ this.setLabelSize(size);
+ parent.on('resized', this.bound('onParentResize'));
+ },
+
+ getParent: function() {
+ var parent = this.block.parent('[data-lm-id]');
+
+ return this.options.builder.get(parent.data('lm-id'));
+ },
+
+ onParentResize: function(resize) {
+ this.setLabelSize(resize);
+ },
+
+ getIcon: function() {
+ if (this.hasInheritance()) {
+ return 'fa-lock';
+ }
+
+ var type = this.getType(),
+ subtype = this.getSubType(),
+ template = $('.particles-container [data-lm-blocktype="' + type + '"][data-lm-subtype="' + subtype + '"]');
+
+ return template ? template.data('lm-icon') : 'fa-cube';
+ },
+
+ getLimits: function(parent) {
+ if (!parent) { return false; }
+
+ var sibling = parent.block.nextSibling() || parent.block.previousSibling() || false;
+
+ if (!sibling) { return [100, 100]; }
+
+ var siblingBlock = this.options.builder.get(sibling.data('lm-id')),
+ sizes = {
+ current: this.getParent().getSize(),
+ sibling: siblingBlock.getSize()
+ };
+
+ return [5, (sizes.current + sizes.sibling) - 5];
+ }
+});
+
+module.exports = Particle;
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./atom":10,"elements":113,"mout/function/bind":192,"mout/number/enforcePrecision":222,"mout/object/forOwn":232,"prime":301}],19:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ trim = require('mout/string/trim'),
+ Particle = require('./particle');
+
+var UID = 0;
+
+var Position = new prime({
+ inherits: Particle,
+ options: {
+ type: 'position'
+ },
+
+ constructor: function(options) {
+ ++UID;
+ Particle.call(this, options);
+ this.setAttribute('title', this.getTitle());
+ this.setAttribute('key', this.getKey());
+
+ if (this.isNew()) { --UID; }
+ },
+
+ getTitle: function() {
+ return trim(this.options.title || 'Position ' + UID);
+ },
+
+ getKey: function() {
+ return (this.getAttribute('key') || trim(this.getTitle()).replace(/\s/g, '-').toLowerCase());
+ },
+
+ updateKey: function(key) {
+ this.options.key = key || this.getKey();
+ this.block.find('.font-small').text(this.getKey());
+ return this;
+ },
+});
+
+module.exports = Position;
+
+},{"./particle":18,"mout/string/trim":272,"prime":301}],20:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Base = require('./base'),
+ Bound = require('prime-util/prime/bound'),
+ Grid = require('./grid'),
+ $ = require('elements'),
+ zen = require('elements/zen'),
+
+ bind = require('mout/function/bind'),
+ forOwn = require('mout/object/forOwn'),
+ getAjaxURL = require('../../utils/get-ajax-url').config,
+ getOutlineNameById = require('../../utils/get-outline').getOutlineNameById,
+ translate = require('../../utils/translate');
+
+require('elements/insertion');
+
+var UID = 0;
+
+var Section = new prime({
+ inherits: Base,
+ options: {},
+
+ constructor: function(options) {
+ ++UID;
+ this.grid = new Grid();
+ Base.call(this, options);
+
+ this.on('done', this.bound('onDone'));
+ this.on('changed', this.hasChanged);
+ },
+
+ layout: function() {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId()),
+ inheritanceLabel = '',
+ klass = '';
+
+ if (this.hasInheritance()) {
+ var outline = getOutlineNameById(this.inherit.outline);
+ inheritanceLabel = this.renderInheritanceLabel(outline);
+ klass = ' g-inheriting';
+
+ if (this.inherit.include.length) {
+ klass += ' g-inheriting-' + this.inherit.include.join(' g-inheriting-');
+ }
+ }
+
+ return '' + inheritanceLabel + '
';
+ },
+
+ adopt: function(child) {
+ $(child).insert(this.block.find('.g-grid'));
+ },
+
+ renderInheritanceLabel: function(outline) {
+ var content = translate('GANTRY5_PLATFORM_INHERITING_FROM_X', '' + outline + '');
+
+ if (this.block && this.getParent()) {
+ content = '';
+ }
+
+ return '';
+ },
+
+ enableInheritance: function() {
+ if (this.hasInheritance()) {
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ this.block.addClass('g-inheriting');
+ if (this.inherit.include.length) {
+ this.block.addClass('g-inheriting-' + this.inherit.include.join(' g-inheriting-'));
+ }
+
+ if (!this.block.find('> .g-inherit')) {
+ var inherit = zen('div'),
+ outline = getOutlineNameById(this.inherit.outline),
+ html = this.renderInheritanceLabel(outline);
+
+ inherit.html(html).children().after(this.block.find('> .section-header'));
+ }
+ }
+ },
+
+ disableInheritance: function() {
+ if (this.block.find('> .g-inherit')) {
+ var inherit = this.block.find('> .g-inherit.g-section-inherit');
+ if (inherit) {
+ inherit.remove();
+ }
+ }
+
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ this.block.removeClass('g-inheriting');
+ },
+
+ refreshInheritance: function() {
+ this.block.attribute('class', this.cleanKlass(this.block.attribute('class')));
+ if (this.hasInheritance()) {
+ this.enableInheritance();
+ var overlay = this.block.find('> .g-inherit');
+ if (overlay) {
+ var outline = getOutlineNameById(this.inherit.outline),
+ content = zen('div').html(this.renderInheritanceLabel(outline));
+
+ if (overlay && content) { overlay.html(content.children().html()); }
+ }
+ }
+ },
+
+ addInheritanceTip: function(html) {
+ var tooltip = this.getInheritanceTip();
+
+ if (html) {
+ var tooltipHTML = '';
+ forOwn(tooltip, function(value, key) {
+ tooltipHTML += 'data-' + key + '="' + value + '" ';
+ });
+
+ tooltip = tooltipHTML;
+ }
+
+ return this.hasInheritance() ? tooltip : '';
+ },
+
+ getInheritanceTip: function() {
+ var outline = this.inherit ? this.inherit.outline : null,
+ name = getOutlineNameById(outline),
+ include = (this.inherit.include || []).join(', ');
+
+ return {
+ 'tip': translate('GANTRY5_PLATFORM_INHERITING_FROM_X', '' + name + '') + '
Outline ID: ' + outline + '
Replace: ' + include,
+ 'tip-offset': -2,
+ 'tip-place': 'top-right'
+ };
+ },
+
+ cleanKlass: function(klass) {
+ klass = (klass || '').split(' ');
+
+ return klass.filter(function(item) { return !item.match(/^g-inheriting-/); }).join(' ');
+ },
+
+ hasChanged: function(state, child) {
+ var icon = this.block.find('h4 > i:first-child');
+
+ // if the the event is triggered from a grid we need to be cautious not to override the proper state
+ if (icon && child && !child.changeState) { return; }
+
+ this.block[state ? 'addClass' : 'removeClass']('block-has-changes');
+
+ if (!state && icon) { icon.remove(); }
+ if (state && !icon) { zen('i.far.fa-circle.changes-indicator').top(this.block.find('h4')); }
+ },
+
+ onDone: function(event) {
+ if (!this.block.search('[data-lm-id]')) {
+ this.grid.insert(this.block, 'bottom');
+ this.options.builder.add(this.grid);
+ }
+
+ var plus = this.block.find('.fa-plus');
+ if (plus) {
+ plus.on('click', bind(function(e) {
+ if (e) { e.preventDefault(); }
+
+ if (this.block.find('.g-grid:last-child:empty')) { return false; }
+
+ this.grid = new Grid();
+ this.grid.insert(this.block.find('[data-lm-blocktype="container"]') ? this.block.find('[data-lm-blocktype="container"]') : this.block, 'bottom');
+ this.options.builder.add(this.grid);
+ }, this));
+ }
+
+ this.refreshInheritance();
+ },
+
+ getParent: function() {
+ var parent = this.block.parent('[data-lm-id]');
+
+ return parent ? this.options.builder.get(parent.data('lm-id')) : null;
+ },
+
+ getLimits: function(parent) {
+ if (!parent) { return false; }
+
+ var sibling = parent.block.nextSibling() || parent.block.previousSibling() || false;
+
+ if (!sibling) { return [100, 100]; }
+
+ var siblingBlock = this.options.builder.get(sibling.data('lm-id'));
+ if (siblingBlock.getType() !== 'block') { return false; }
+
+ var sizes = {
+ current: this.getParent().getSize(),
+ sibling: siblingBlock.getSize()
+ };
+
+ return [5, (sizes.current + sizes.sibling) - 5];
+ }
+});
+
+module.exports = Section;
+
+},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./base":12,"./grid":15,"elements":113,"elements/insertion":114,"elements/zen":137,"mout/function/bind":192,"mout/object/forOwn":232,"prime":301,"prime-util/prime/bound":297}],21:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Particle = require('./particle');
+
+var UID = 0;
+
+var Spacer = new prime({
+ inherits: Particle,
+ options: {
+ type: 'spacer',
+ title: 'Spacer',
+ attributes: {}
+ }
+});
+
+module.exports = Spacer;
+
+},{"./particle":18,"prime":301}],22:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Particle = require('./particle');
+
+var System = new prime({
+ inherits: Particle,
+ options: {
+ type: 'system',
+ attributes: {}
+ }
+});
+
+module.exports = System;
+
+},{"./particle":18,"prime":301}],23:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ Section = require('./section'),
+
+ getAjaxURL = require('../../utils/get-ajax-url').config;
+
+var Wrapper = new prime({
+ inherits: Section,
+ options: {
+ type: 'wrapper',
+ attributes: {
+ name: "Wrapper"
+ }
+ },
+
+ layout: function() {
+ var settings_uri = getAjaxURL(this.getPageId() + '/layout/' + this.getType() + '/' + this.getId());
+ return '';
+ },
+
+ hasChanged: function() {},
+
+ getSize: function() {
+ return false;
+ },
+
+ getId: function() {
+ return this.id || (this.id = this.options.type);
+ }
+});
+
+module.exports = Wrapper;
+
+},{"../../utils/get-ajax-url":71,"./section":20,"prime":301}],24:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ $ = require('elements'),
+ Emitter = require('prime/emitter');
+
+var Blocks = require('./blocks/');
+
+var forOwn = require('mout/object/forOwn'),
+ forEach = require('mout/collection/forEach'),
+ size = require('mout/collection/size'),
+ isArray = require('mout/lang/isArray'),
+ flatten = require('mout/array/flatten'),
+ ID = require('./id'),
+
+ set = require('mout/object/set'),
+ unset = require('mout/object/unset'),
+ get = require('mout/object/get'),
+ deepFillIn = require('mout/object/deepFillIn'),
+ omit = require('mout/object/omit');
+
+require('elements/attributes');
+require('elements/traversal');
+
+
+// start Debug
+var DEBUG = false,
+ rpad = require('mout/string/rpad'),
+ repeat = require('mout/string/repeat');
+// end Debug
+
+$.implement({
+ empty: function() {
+ return this.forEach(function(node) {
+ var first;
+ while ((first = node.firstChild)) {
+ node.removeChild(first);
+ }
+ });
+ }
+});
+
+var Builder = new prime({
+
+ inherits: Emitter,
+
+ constructor: function(structure) {
+ if (structure) {
+ this.setStructure(structure);
+ }
+ this.map = {};
+
+ return this;
+ },
+
+ setStructure: function(structure) {
+ try {
+ this.structure = (typeof structure === 'object') ? structure : JSON.parse(structure);
+ }
+ catch (e) {
+ console.error("Parsing error:", e);
+ }
+ },
+
+ add: function(block) {
+ var id = typeof block === 'string' ? block : block.id;
+ set(this.map, id, block);
+ block.isNew(false);
+ },
+
+ remove: function(block) {
+ block = typeof block === 'string' ? block : block.id;
+ unset(this.map, block);
+ },
+
+ get: function(block) {
+ var id = typeof block === 'string' ? block : block.id;
+ return get(this.map, id, block);
+ },
+
+ load: function(data) {
+ this.recursiveLoad(data);
+ this.emit('loaded', data);
+
+ return this;
+ },
+
+ serialize: function(root, flat) {
+ var serieChildren = [];
+ root = root || $('[data-lm-root]');
+
+ if (!root) { return; }
+
+ var blocks = root.search((!flat ? '> ' : '') + '[data-lm-id]'),
+ id, type, subtype, serial, hasChildren, children;
+
+ forEach(blocks, function(element) {
+ element = $(element);
+ id = element.data('lm-id');
+ type = element.data('lm-blocktype');
+ subtype = element.data('lm-blocksubtype') || false;
+ hasChildren = element.search('> [data-lm-id]');
+
+ if (flat) {
+ children = hasChildren ? hasChildren.map(function(element){ return $(element).data('lm-id'); }) : false;
+ } else {
+ children = hasChildren ? this.serialize(element) : [];
+ }
+
+ serial = {
+ id: id,
+ type: type,
+ subtype: subtype,
+ title: get(this.map, id) ? get(this.map, id).getTitle() : 'Untitled',
+ attributes: get(this.map, id) ? get(this.map, id).getAttributes() : {},
+ inherit: get(this.map, id) ? get(this.map, id).getInheritance() : {},
+ children: children
+ };
+
+ if (flat) {
+ var obj = {}; obj[id] = serial;
+ serial = obj;
+ }
+
+ serieChildren.push(serial);
+ }, this);
+
+ return serieChildren;
+ },
+
+ insert: function(key, value, parent/*, object*/) {
+ var root = $('[data-lm-root]');
+ if (!root) {
+ return;
+ }
+
+ if (!Blocks[value.type]) {
+ console[console.error ? 'error' : 'log'](value.type + ' does not exist');
+ }
+
+ var Element = new (Blocks[value.type] || Blocks['section'])(deepFillIn({
+ id: key,
+ attributes: {},
+ inherit: {},
+ subtype: value.subtype || false,
+ builder: this
+ }, omit(value, 'children')));
+
+ if (!parent) {
+ Element.block.insert(root);
+ }
+ else {
+ Element.block.insert($('[data-lm-id="' + parent + '"]'));
+ }
+
+ if (Element.getType() === 'block') {
+ Element.setSize();
+ }
+
+ this.add(Element);
+ Element.emit('rendered', Element, parent ? get(this.map, parent) : null);
+
+ return Element;
+ },
+
+ reset: function(data) {
+ this.map = {};
+ this.setStructure(data || {});
+ $('[data-lm-root]').empty();
+ this.load();
+ },
+
+ cleanupLonely: function() {
+ var ghosts = [],
+ parent, children = $('[data-lm-root] > .g-section > .g-grid > .g-block .g-grid > .g-block, [data-lm-root] > .g-section > .g-grid > .g-block > .g-block');
+
+ if (!children) {
+ return;
+ }
+
+
+ var isGrid;
+ children.forEach(function(child) {
+ child = $(child);
+ parent = null;
+ isGrid = child.parent().hasClass('g-grid');
+
+ if (isGrid && child.siblings()) {
+ return false;
+ }
+
+ if (isGrid) {
+ ghosts.push(child.data('lm-id'));
+ parent = child.parent();
+ }
+
+ ghosts.push(child.data('lm-id'));
+ child.children().before(parent ? parent : child);
+ (parent ? parent : child).remove();
+ });
+
+ return ghosts;
+ },
+
+ recursiveLoad: function(data, callback, depth, parent) {
+ data = data || this.structure;
+ depth = depth || 0;
+ parent = parent || false;
+ callback = callback || this.insert;
+
+ forEach(data, function(value/*, key, object*/) {
+
+ if (!value.id) {
+ value.id = ID({ builder: { map: this.map }, type: value.type, subtype: value.subtype });
+ }
+
+ // debug (flat view of the structure)
+ if (console && console.log && DEBUG) {
+ console.log(rpad(repeat(' ', depth) + '' + value.type, 35) + ' (' + rpad(value.id, 36) + ') parent: ' + parent);
+ }
+
+ this.emit('loading', callback.call(this, value.id, value, parent, depth));
+ if (value.children && size(value.children)) {
+ depth++;
+
+ forEach(value.children, function(childValue/*, childKey, array*/) {
+ this.recursiveLoad([childValue], callback, depth, value.id);
+ }, this);
+ }
+
+ this.get(value.id).emit('done', this.get(value.id));
+
+ depth--;
+ }, this);
+ }
+});
+
+module.exports = Builder;
+
+},{"./blocks/":16,"./id":27,"elements":113,"elements/attributes":108,"elements/traversal":136,"mout/array/flatten":173,"mout/collection/forEach":189,"mout/collection/size":191,"mout/lang/isArray":203,"mout/object/deepFillIn":225,"mout/object/forOwn":232,"mout/object/get":233,"mout/object/omit":240,"mout/object/set":241,"mout/object/unset":244,"mout/string/repeat":266,"mout/string/rpad":269,"prime":301,"prime/emitter":300}],25:[function(require,module,exports){
+"use strict";
+var DragEvents = require('../ui/drag.events'),
+ prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ bind = require('mout/function/bind'),
+ isString = require('mout/lang/isString'),
+ nMap = require('mout/math/map'),
+ clamp = require('mout/math/clamp'),
+ precision = require('mout/number/enforcePrecision'),
+ get = require('mout/object/get'),
+ $ = require('../utils/elements.utils');
+
+require('elements/events');
+require('elements/delegation');
+
+var Resizer = new prime({
+ mixin: [Bound, Options],
+ DRAG_EVENTS: DragEvents,
+ options: {
+ minSize: 5
+ },
+ constructor: function(container, options) {
+ this.setOptions(options);
+ this.history = this.options.history || {};
+ this.builder = this.options.builder || {};
+ this.origin = {
+ x: 0,
+ y: 0,
+ transform: null,
+ offset: {
+ x: 0,
+ y: 0
+ }
+ };
+ },
+
+ getBlock: function(element) {
+ return get(this.builder.map, isString(element) ? element : $(element).data('lm-id') || '');
+ },
+
+ getAttribute: function(element, prop) {
+ return this.getBlock(element).getAttribute(prop);
+ },
+
+ getSize: function(element) {
+ return this.getAttribute($(element), 'size');
+ },
+
+ start: function(event, element, siblings, offset) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ window.G5.tips.hide(element[0]);
+ if (event.which && event.which !== 1) { return true; }
+
+ // Stops text selection
+ event.preventDefault();
+
+ this.element = $(element);
+ this.siblings = {
+ occupied: 0,
+ elements: siblings,
+ next: this.element.nextSibling(),
+ prevs: this.element.previousSiblings(),
+ sizeBefore: 0
+ };
+
+ if (this.siblings.elements.length > 1) {
+ this.siblings.occupied -= this.getSize(this.siblings.next);
+ this.siblings.elements.forEach(function(sibling) {
+ this.siblings.occupied += this.getSize(sibling);
+ }, this);
+ }
+
+ if (this.siblings.prevs) {
+ this.siblings.prevs.forEach(function(sibling) {
+ this.siblings.sizeBefore += this.getSize(sibling);
+ }, this);
+ }
+
+ this.origin = {
+ size: this.getSize(this.element),
+ maxSize: this.getSize(this.element) + this.getSize(this.siblings.next),
+ x: event.changedTouches ? event.changedTouches[0].pageX : event.pageX + 6,
+ y: event.changedTouches ? event.changedTouches[0].pageY : event.pageY
+ };
+
+ var clientRect = this.element[0].getBoundingClientRect(),
+ parentRect = this.element.parent()[0].getBoundingClientRect();
+
+ this.origin.offset = {
+ clientRect: clientRect,
+ parentRect: {left: parentRect.left, right: parentRect.right},
+ x: this.origin.x - clientRect.right,
+ y: clientRect.top - this.origin.y,
+ down: offset
+ };
+
+ this.origin.offset.parentRect.left = this.element.parent().find('> [data-lm-id]:first-child')[0].getBoundingClientRect().left;
+ this.origin.offset.parentRect.right = this.element.parent().find('> [data-lm-id]:last-child')[0].getBoundingClientRect().right;
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $(document).on(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $(document).on(event, this.bound('stop'));
+ }, this));
+ },
+
+ move: function(event) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ var clientX = event.clientX || event.touches[0].clientX || 0,
+ clientY = event.clientY || event.touches[0].clientY || 0,
+ parentRect = this.origin.offset.parentRect;
+
+ var deltaX = (this.lastX || clientX) - clientX,
+ deltaY = (this.lastY || clientY) - clientY;
+
+ this.direction =
+ Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0 && 'left' ||
+ Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0 && 'right' ||
+ Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0 && 'up' ||
+ 'down';
+ var size,
+ diff = 100 - this.siblings.occupied,
+ value = clientX + (!this.siblings.prevs ? this.origin.offset.x - this.origin.offset.down : this.siblings.prevs.length),
+ normalized = clamp(value, parentRect.left, parentRect.right);
+
+ size = nMap(normalized, parentRect.left, parentRect.right, 0, 100);
+ size = size - this.siblings.sizeBefore;
+ size = precision(clamp(size, this.options.minSize, this.origin.maxSize - this.options.minSize), 0);
+
+ //grids?
+ //console.log((size / 12) * (100 / 12));
+
+ diff = precision(diff - size, 0);
+
+ this.getBlock(this.element).setSize(size, true);
+ this.getBlock(this.siblings.next).setSize(diff, true);
+
+ // Hack to handle cases where size is not an integer
+ var siblings = this.element.siblings(),
+ amount = siblings ? siblings.length + 1 : 1;
+ if (amount == 3 || amount == 6 || amount == 7 || amount == 8 || amount == 9 || amount == 11 || amount == 12) {
+ var total = 0, blocks;
+
+ blocks = $([siblings, this.element]);
+ blocks.forEach(function(block, index){
+ block = this.getBlock(block);
+ size = block.getSize();
+ if (size % 1) {
+ size = precision(100 / amount, 0);
+ block.setSize(size, true);
+ }
+
+ total += size;
+
+ if (blocks.length == index + 1 && total != 100) {
+ diff = 100 - total;
+ block.setSize(size + diff, true);
+ }
+
+ }, this);
+ }
+
+ this.lastX = clientX;
+ this.lastY = clientY;
+ },
+
+ stop: function(event) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $(document).off(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $(document).off(event, this.bound('stop'));
+ }, this));
+
+ if (event.target.matches('[data-lm-back], [data-lm-forward]')) { return; }
+ if (this.origin.size !== this.getSize(this.element)) { this.history.push(this.builder.serialize(), this.history.get().preset); }
+ },
+
+ evenResize: function(elements, animated) {
+ var total = elements.length,
+ size = precision(100 / total, 4),
+ block;
+
+ if (typeof animated === 'undefined') { animated = true; }
+
+ elements.forEach(function(element) {
+ element = $(element);
+ block = this.getBlock(element);
+ if (block && block.hasAttribute('size') && typeof block.getSize === 'function') {
+ block[animated ? 'setAnimatedSize' : 'setSize'](size, size !== block.getSize());
+ } else {
+ if (element) { element[animated ? 'animate' : 'style']({ flex: '0 1 ' + size + '%' }); }
+ }
+ }, this);
+ }
+});
+
+module.exports = Resizer;
+
+},{"../ui/drag.events":52,"../utils/elements.utils":66,"elements/delegation":110,"elements/events":112,"mout/function/bind":192,"mout/lang/isString":211,"mout/math/clamp":216,"mout/math/map":218,"mout/number/enforcePrecision":222,"mout/object/get":233,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],26:[function(require,module,exports){
+var prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ slice = require('mout/array/slice'),
+ merge = require('mout/object/merge'),
+ deepEquals = require('mout/lang/deepEquals'),
+ deepDiff = require('deep-diff').diff;
+
+var History = new prime({
+
+ inherits: Emitter,
+
+ constructor: function(session, preset) {
+ this.index = 0;
+ session = merge({}, session);
+ preset = merge({}, preset);
+ this.setSession(session, preset);
+ },
+
+ undo: function() {
+ if (!this.index) return;
+ this.index--;
+
+ var session = this.get();
+ this.emit('undo', session, this.index);
+ return session;
+ },
+
+ redo: function() {
+ if (this.index == this.session.length - 1) return;
+ this.index++;
+
+ var session = this.get();
+ this.emit('redo', session, this.index);
+ return session;
+ },
+
+ reset: function() {
+ this.index = 0;
+
+ var session = this.get();
+ this.emit('reset', session, this.index);
+ return session;
+ },
+
+ push: function(session, preset) {
+ session = merge({}, session);
+ preset = merge({}, preset);
+ var sliced = this.index < this.session.length - 1;
+ if (this.index < this.session.length - 1) this.session = slice(this.session, 0, -(this.session.length - 1 - this.index));
+ session = {
+ time: +(new Date()),
+ data: session,
+ preset: preset
+ };
+
+ if (this.equals(session.data)) { return session; }
+
+ this.session.push(session);
+ this.index = this.session.length - 1;
+
+ this.emit('push', session, this.index, sliced);
+ return session;
+ },
+
+ get: function(index) {
+ return this.session[typeof index !== 'undefined' ? index : this.index] || false;
+ },
+
+ equals: function(session, compare) {
+ if (!compare) { compare = this.get().data; }
+
+ return deepEquals(session, compare);
+ },
+
+ diff: function(obj1, obj2) {
+ if (!obj1 && !obj2 && this.session.length <= 1) { return 'Not enough sessions to diff'; }
+ if (!obj2) { obj2 = this.get(); }
+ if (!obj1) { obj1 = this.get(this.index - 1); }
+
+ return deepDiff(obj1, obj2);
+ },
+
+ setSession: function(session, preset) {
+ session = !session ? []
+ : [{
+ time: +(new Date()),
+ data: merge({}, session),
+ preset: preset
+ }];
+
+ this.session = session;
+ this.index = 0;
+ return this.session;
+ },
+
+ import: function() {},
+ export: function() {}
+});
+
+module.exports = History;
+
+},{"deep-diff":106,"mout/array/slice":183,"mout/lang/deepEquals":201,"mout/object/merge":237,"prime":301,"prime/emitter":300}],27:[function(require,module,exports){
+'use strict';
+
+var keys = require('mout/object/keys'),
+ contains = require('mout/array/contains'),
+ rand = require('mout/random/randInt');
+
+var ID = function(options) {
+ var map = options.builder ? keys(options.builder.map) : {},
+ type = options.type,
+ subtype = options.subtype,
+
+ result = [], key, id;
+
+ if (type != 'particle') result.push(type);
+ if (subtype) result.push(subtype);
+
+ key = result.join('-');
+
+ while (id = rand(1000, 9999)) {
+ if (!contains(map, key + '-' + id)) {
+ break;
+ }
+ }
+
+ return key + '-' + id;
+};
+
+module.exports = ID;
+},{"mout/array/contains":166,"mout/object/keys":236,"mout/random/randInt":254}],28:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ $ = require('elements/attributes'),
+ Submit = require('../fields/submit'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ sidebar = require('./particles-sidebar'),
+ request = require('agent'),
+ zen = require('elements/zen'),
+ contains = require('mout/array/contains'),
+ size = require('mout/collection/size'),
+ trim = require('mout/string/trim'),
+ strReplace = require('mout/string/replace'),
+ properCase = require('mout/string/properCase'),
+ precision = require('mout/number/enforcePrecision'),
+
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+
+ flags = require('../utils/flags-state'),
+ Builder = require('./builder'),
+ History = require('../utils/history'),
+ validateField = require('../utils/field-validation'),
+ LMHistory = require('./history'),
+ LayoutManager = require('./layoutmanager'),
+ SaveState = require('../utils/save-state'),
+ translate = require('../utils/translate');
+
+require('../ui/popover');
+require('./inheritance');
+
+var builder, layoutmanager, lmhistory, savestate, Tips;
+
+builder = new Builder();
+lmhistory = new LMHistory();
+savestate = new SaveState();
+
+ready(function() {
+ var body = $('body');
+
+ body.delegate('click', '[data-lm-back]', function(e, element) {
+ if (e) { e.preventDefault(); }
+ if ($(element).hasClass('disabled')) return false;
+ lmhistory.undo();
+ });
+
+ body.delegate('click', '[data-lm-forward]', function(e, element) {
+ if (e) { e.preventDefault(); }
+ if ($(element).hasClass('disabled')) return false;
+ lmhistory.redo();
+ });
+
+ /* lmhistory events */
+ lmhistory.on('push', function(session, index, reset) {
+ var HM = {
+ back: $('[data-lm-back]'),
+ forward: $('[data-lm-forward]')
+ };
+
+ if (index && HM.back && HM.back.hasClass('disabled')) HM.back.removeClass('disabled');
+ if (reset && HM.forward && !HM.forward.hasClass('disabled')) HM.forward.addClass('disabled');
+ layoutmanager.updatePendingChanges();
+ });
+
+ lmhistory.on('undo', function(session, index) {
+ var notice = $('#lm-no-layout'),
+ title = $('.layout-title .title small'),
+ preset_name = session.preset.name || 'Default',
+ HM = {
+ back: $('[data-lm-back]'),
+ forward: $('[data-lm-forward]')
+ };
+
+ if (notice) { notice.style({ display: !size(session.data) ? 'block' : 'none' }); }
+ if (title) { title.text('(' + properCase(trim(strReplace(preset_name, [/_/g, /\//g], [' ', ' / ']))) + ')'); }
+
+ builder.reset(session.data);
+ HM.forward.removeClass('disabled');
+ if (!index) HM.back.addClass('disabled');
+ layoutmanager.singles('disable');
+ layoutmanager.updatePendingChanges();
+ });
+ lmhistory.on('redo', function(session, index) {
+ var notice = $('#lm-no-layout'),
+ title = $('.layout-title .title small'),
+ preset_name = session.preset.name || 'Default',
+ HM = {
+ back: $('[data-lm-back]'),
+ forward: $('[data-lm-forward]')
+ };
+
+ if (notice) { notice.style({ display: !size(session.data) ? 'block' : 'none' }); }
+ if (title) { title.text('(' + properCase(trim(strReplace(preset_name, [/_/g, /\//g], [' ', ' / ']))) + ')'); }
+
+ builder.reset(session.data);
+ HM.back.removeClass('disabled');
+ if (index == this.session.length - 1) HM.forward.addClass('disabled');
+ layoutmanager.singles('disable');
+ layoutmanager.updatePendingChanges();
+ });
+
+});
+
+ready(function() {
+ var body = $('body'), root = $('[data-lm-root]'), data;
+
+ // Layout Manager
+ layoutmanager = new LayoutManager('[data-lm-container]', {
+ delegate: '[data-lm-root] .g-grid > .g-block > [data-lm-blocktype]:not([data-lm-nodrag]) !> .g-block, .g5-lm-particles-picker [data-lm-blocktype], [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag])',
+ droppables: '[data-lm-dropzone]',
+ exclude: '.section-header .button, .section-header .fa, .lm-newblocks .float-right .button, [data-lm-nodrag], [data-lm-disabled]',
+ resize_handles: '[data-lm-root] .g-grid > .g-block:not(:last-child)',
+ builder: builder,
+ history: lmhistory,
+ savestate: savestate
+ });
+
+ module.exports.layoutmanager = layoutmanager;
+
+ // load builder data
+ if (root) {
+ data = JSON.parse(root.data('lm-root'));
+ if (data.name) { data = data.layout; }
+ builder.setStructure(data);
+ builder.load();
+
+ layoutmanager.history.setSession(builder.serialize(), JSON.parse(root.data('lm-preset')));
+ layoutmanager.savestate.setSession(builder.serialize(null, true));
+ }
+
+ // attach events
+ // Modal Tabs
+ body.delegate('click', '.g-tabs a', function(event, element) {
+ event.preventDefault();
+ return false;
+ });
+ body.delegate('keydown', '.g-tabs a', function(event, element) {
+ var key = (event.which ? event.which : event.keyCode);
+ if (key == 32 || key == 13) { // ARIA support: Space / Enter toggle
+ event.preventDefault();
+ body.emit('mouseup', event);
+ return false;
+ }
+ });
+ body.delegate('mouseup', '.g-tabs a', function(event, element) {
+ element = $(element);
+ event.preventDefault();
+
+ var index = 0,
+ parent = element.parent('.g-tabs'),
+ panes = parent.siblings('.g-panes'),
+ links = parent.search('a');
+
+ links.forEach(function(link, i) {
+ if (link == element[0]) { index = i + 1; }
+ });
+
+ panes.find('> .active').removeClass('active');
+ parent.find('> ul > .active').removeClass('active');
+ panes.find('> .g-pane:nth-child(' + index + ')').addClass('active');
+ parent.find('> ul > li:nth-child(' + index + ')').addClass('active');
+
+ // ARIA
+ if (panes.search('> [aria-expanded]')) { panes.search('> [aria-expanded]').attribute('aria-expanded', 'false'); }
+ if (parent.search('> [aria-expanded]')) { parent.search('> [aria-expanded]').attribute('aria-expanded', 'false'); }
+
+ panes.find('> .g-pane:nth-child(' + index + ')').attribute('aria-expanded', 'true');
+ if (parent.find('> ul >li:nth-child(' + index + ') [aria-expanded]')) { parent.find('> ul > li:nth-child(' + index + ') > [aria-expanded]').attribute('aria-expanded', 'true'); }
+ });
+
+ // Picker
+ body.delegate('statechangeBefore', '[data-g5-lm-picker]', function() {
+ modal.close();
+ });
+
+ // Sub-navigation links
+ body.on('statechangeAfter', function(event, element) {
+ root = $('[data-lm-root]');
+ if (!root) { return true; }
+ data = JSON.parse(root.data('lm-root'));
+ builder.setStructure(data);
+ builder.load();
+
+ layoutmanager.refresh();
+ layoutmanager.history.setSession(builder.serialize(), JSON.parse(root.data('lm-preset')));
+ layoutmanager.savestate.setSession(builder.serialize(null, true));
+
+ // refresh LM eraser
+ layoutmanager.eraser.element = $('[data-lm-eraseblock]');
+ layoutmanager.eraser.hide(true);
+ });
+
+ // Particles filtering
+ body.delegate('input', '.sidebar-block .search input', function(event, element) {
+ var value = $(element).value().toLowerCase(),
+ list = $('.sidebar-block [data-lm-blocktype]'),
+ text, type;
+ if (!list) { return false; }
+
+ list.style({ display: 'none' }).forEach(function(blocktype) {
+ blocktype = $(blocktype);
+ type = blocktype.data('lm-blocktype').toLowerCase();
+ text = trim(blocktype.text()).toLowerCase();
+ if (type.substr(0, value.length) == value || text.match(value)) {
+ blocktype.style({ display: 'block' });
+ }
+ }, this);
+ });
+
+ // Grid same widths button (evenize, equalize)
+ ['click', 'touchend'].forEach(function(evt){
+ body.delegate(evt, '[data-lm-samewidth]:not(:empty)', function(event, element) {
+ window.G5.tips.hide(element[0]);
+ var clientRect = element[0].getBoundingClientRect();
+ if ((event.clientX || event.pageX || event.changedTouches[0].pageX || 0) < clientRect.width + clientRect.left) { return; }
+
+ var blocks = element.search('> [data-lm-blocktype="block"]'), id;
+ if (!blocks || blocks.length == 1) { return; }
+
+ blocks.forEach(function(block) {
+ id = $(block).data('lm-id');
+ builder.get(id).setSize(100 / blocks.length, true);
+ });
+
+ lmhistory.push(builder.serialize(), lmhistory.get().preset);
+ });
+ });
+
+ body.delegate('mouseover', '[data-lm-samewidth]:not(:empty)', function(event, element) {
+ var clientRect = element[0].getBoundingClientRect(),
+ clientX = event.clientX || (event.touches && event.touches[0].clientX) || 0,
+ tooltips = {
+ equalize: clientX + 5 > clientRect.width + clientRect.left,
+ move: clientX - 5 < clientRect.left
+ };
+
+ if (!tooltips.equalize && !tooltips.move) { return; }
+
+ var msg = tooltips.equalize ? translate('GANTRY5_PLATFORM_JS_LM_GRID_EQUALIZE') : translate('GANTRY5_PLATFORM_JS_LM_GRID_SORT_MOVE');
+
+ element.data('tip', msg).data('tip-offset', -30);
+
+ window.G5.tips
+ .get(element[0])
+ .content(msg)
+ .place(tooltips.equalize ? 'top-left' : 'top-right')
+ .show();
+ });
+
+ body.delegate('mouseout', '[data-lm-samewidth]:not(:empty)', function(event, element) {
+ window.G5.tips.hide(element[0]);
+ });
+
+ // Clear Layout
+ body.delegate('click', '[data-lm-clear]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ var mode = element.data('lm-clear'),
+ options = {};
+
+ switch (mode) {
+ case 'keep-inheritance':
+ options = { save: true, dropLastGrid: false, emptyInherits: false };
+ break;
+ case 'full':
+ default:
+ options = { save: true, dropLastGrid: false, emptyInherits: true };
+ }
+
+ layoutmanager.clear(null, options);
+ });
+
+ // Switcher
+ var SWITCHER_HIT = false;
+ body.delegate('mouseover', '[data-lm-switcher]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ SWITCHER_HIT = element;
+ if (!element.PopoverDefined) {
+ element.getPopover({
+ type: 'async',
+ width: '500',
+ url: parseAjaxURI(element.data('lm-switcher') + getAjaxSuffix()),
+ allowElementsClick: '.g-tabs a'
+ });
+ }
+ });
+
+ // Switch Layout
+ body.delegate('keydown', '[data-switch]', function(event, element){
+ var key = (event.which ? event.which : event.keyCode);
+ if (key == 32 || key == 13) { // ARIA support: Space toggle
+ event.preventDefault();
+ body.emit('mousedown', event);
+ }
+ });
+
+ // Disable keeping particles if inherit option is selected
+ body.delegate('change', '[data-g-inherit="outline"]', function(event, element) {
+ var keeper = element.parent('.g-pane').find('input[type="checkbox"][data-g-preserve="outline"]');
+ if (keeper) { keeper.checked(false); }
+ });
+
+ // Disable inheriting section/particles if keep option is selected
+ body.delegate('change', '[data-g-preserve="outline"]', function(event, element) {
+ var inherit = element.parent('.g-pane').find('input[type="checkbox"][data-g-inherit="outline"]');
+ if (inherit) { inherit.checked(false); }
+ });
+
+ body.delegate('mousedown', '[data-switch]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ // it's already loading something.
+ if (element.parent('.g5-popover-content').find('[data-switch] i')) {
+ return false;
+ }
+
+ element.showIndicator();
+
+ var preset = $('[data-lm-preset]'),
+ preserve = element.parent('.g-pane').find('input[type="checkbox"][data-g-preserve]'),
+ inherit = element.parent('.g-pane').find('input[type="checkbox"][data-g-inherit]'),
+ method = !preserve ? 'get' : 'post',
+ data = {};
+
+ preserve = preserve && preserve.checked();
+ inherit = inherit && inherit.checked();
+
+ if (preserve) {
+ var lm = layoutmanager;
+ lm.singles('cleanup', lm.builder, true);
+ lm.savestate.setSession(lm.builder.serialize(null, true));
+
+ data.preset = preset && preset.data('lm-preset') ? preset.data('lm-preset') : 'default';
+ data.layout = JSON.stringify(lm.builder.serialize());
+ }
+
+ if (inherit) {
+ data.inherit = 1;
+ }
+
+ var uri = parseAjaxURI(element.data('switch') + getAjaxSuffix());
+ request(method, uri, data, function(error, response) {
+ element.hideIndicator();
+
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ return;
+ }
+
+ if (response.body.message && !flags.get('lm:switcher:' + window.btoa(uri), false)) {
+ // confirm before proceeding
+ flags.warning({
+ message: response.body.message,
+ callback: function(response, content) {
+ var confirm = content.find('[data-g-delete-confirm]'),
+ cancel = content.find('[data-g-delete-cancel]');
+
+ if (!confirm) { return; }
+
+ confirm.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ flags.get('lm:switcher:' + window.btoa(uri), true);
+ $([confirm, cancel]).attribute('disabled');
+ body.emit('mousedown', { target: element });
+
+ modal.close();
+ });
+
+ cancel.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([confirm, cancel]).attribute('disabled');
+ flags.get('lm:switcher:' + window.btoa(uri), false);
+
+ modal.close();
+ if (SWITCHER_HIT) {
+ setTimeout(function(){
+ SWITCHER_HIT.getPopover().show();
+ }, 5);
+ }
+ });
+ }
+ });
+
+ return false;
+ }
+
+ var preset = response.body.preset || { name: 'default' },
+ preset_name = response.body.title || 'Default',
+ structure = response.body.data,
+ notice = $('#lm-no-layout'),
+ title = $('.layout-title .title small');
+
+ root.data('lm-root', JSON.stringify(structure)).empty();
+ root.data('lm-preset', preset);
+ if (notice) { notice.style({ display: 'none' }); }
+ if (title) { title.text('(' + preset_name + ')'); }
+ builder.setStructure(structure);
+ builder.load();
+
+ lmhistory.push(builder.serialize(), JSON.parse(preset));
+
+ $('[data-lm-switcher]').getPopover().hideAll().destroy();
+ });
+ });
+
+ // Particles settings
+ body.delegate('click', '[data-lm-settings]', function(event, element) {
+ element = $(element);
+
+ var blocktype = element.data('lm-blocktype'),
+ settingsURL = element.data('lm-settings'),
+ data = null, parent, section;
+
+ // grid is a special case, since relies on pseudo elements for sorting and same width (evenize)
+ // we need to check where the user clicked.
+ if (blocktype === 'grid') {
+ var clientX = event.clientX || (event.touches && event.touches[0].clientX) || 0,
+ boundings = element[0].getBoundingClientRect();
+
+ if (clientX + 4 - boundings.left < boundings.width) {
+ return false;
+ }
+ }
+
+ element = element.parent('[data-lm-blocktype]');
+ parent = element.parent('[data-lm-blocktype]');
+ section = element.parent('[data-lm-blocktype="section"]');
+ blocktype = element.data('lm-blocktype');
+
+ var ID = element.data('lm-id'),
+ parentID = parent ? parent.data('lm-id') : false,
+ parentType = parent ? parent.data('lm-blocktype') : false;
+
+ if (!contains(['block', 'grid'], blocktype)) {
+ data = {};
+ data.id = builder.get(element.data('lm-id')).getId() || null;
+ data.type = builder.get(element.data('lm-id')).getType() || element.data('lm-blocktype') || false;
+ data.subtype = builder.get(element.data('lm-id')).getSubType() || element.data('lm-blocksubtype') || false;
+ data.title = (element.find('h4') || element.find('.title')).text() || data.type || 'Untitled';
+ data.options = builder.get(element.data('lm-id')).getAttributes() || {};
+ data.inherit = builder.get(element.data('lm-id')).getInheritance() || {};
+ data.block = parent && parentType !== 'wrapper' ? builder.get(parent.data('lm-id')).getAttributes() || {} : {};
+ data.size_limits = builder.get(element.data('lm-id')).getLimits(!parent ? false : builder.get(parent.data('lm-id')));
+ data.parent = section ? section.data('lm-id') : null;
+
+ if (!data.type) { delete data.type; }
+ if (!data.subtype) { delete data.subtype; }
+ if (!size(data.options)) { delete data.options; }
+ if (!size(data.inherit)) { delete data.inherit; }
+ if (!size(data.block)) { delete data.block; }
+ }
+
+ modal.open({
+ content: 'Loading',
+ method: 'post',
+ data: data,
+ overlayClickToClose: false,
+ remote: parseAjaxURI(settingsURL + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]');
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+
+ var urlTemplate = content.elements.content.find('.g-urltemplate');
+ if (urlTemplate) { body.emit('input', { target: urlTemplate }); }
+
+ var blockSize = content.elements.content.find('[name="block[size]"]');
+
+ // logic for limits
+ if (blockSize && data.size_limits) {
+ var note = content.elements.content.find('.blocksize-note'),
+ min = precision(data.size_limits[0], 1),
+ max = precision(data.size_limits[1], 1);
+
+ blockSize.attribute('min', min);
+ blockSize.attribute('max', max);
+
+ if (note) {
+ var noteHTML = note.html();
+ noteHTML = noteHTML.replace(/#min#/g, min);
+ noteHTML = noteHTML.replace(/#max#/g, max);
+
+ note.html(noteHTML);
+ note.find('.blocksize-' + (min == max ? 'range' : 'fixed')).addClass('hidden');
+ }
+
+ var isValid = function() {
+ return parseFloat(blockSize.value()) >= min && parseFloat(blockSize.value()) <= max ? '' : translate('GANTRY5_PLATFORM_JS_LM_SIZE_LIMITS_RANGE');
+ };
+
+ blockSize.on('input', function(){
+ blockSize[0].setCustomValidity(isValid());
+ });
+ }
+
+ // Particle Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ var target = $(e.currentTarget);
+ target.disabled(true);
+
+ target.hideIndicator();
+ target.showIndicator();
+
+ // Refresh the form to collect fresh and dynamic fields
+ var formElements = content.elements.content.find('form')[0].elements;
+ var post = Submit(formElements, content.elements.content);
+
+ if (post.invalid.length) {
+ target.disabled(false);
+ target.hideIndicator();
+ target.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&') || {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var particle = builder.get(ID),
+ block = null;
+
+ // particle attributes
+ particle.setAttributes(response.body.data.options);
+
+ if (particle.hasAttribute('enabled')) { particle[particle.getAttribute('enabled') ? 'enable' : 'disable'](); }
+
+ if (particle.getType() !== 'section') {
+ particle.setTitle(response.body.data.title || 'Untitled');
+ particle.updateTitle(particle.getTitle());
+ }
+
+ if (particle.getType() === 'position') {
+ particle.updateKey();
+ }
+
+ // parent block attributes
+ if (response.body.data.block && size(response.body.data.block)) {
+ block = builder.get(parentID);
+
+ var sibling = block.block.nextSibling() || block.block.previousSibling(),
+ currentSize = block.getSize(),
+ diffSize;
+
+ block.setAttributes(response.body.data.block);
+
+ diffSize = currentSize - block.getSize();
+
+ block.setAnimatedSize(block.getSize());
+
+ if (sibling) {
+ sibling = builder.get(sibling.data('lm-id'));
+ sibling.setAnimatedSize(parseFloat(sibling.getSize()) + diffSize, true);
+ }
+ }
+
+ // particle inheritance
+ if (response.body.data.inherit) {
+ delete response.body.data.inherit.section;
+ particle.setInheritance(response.body.data.inherit);
+
+ particle.enableInheritance();
+ particle.refreshInheritance();
+ }
+
+ if (response.body.data.children) {
+ layoutmanager.clear(particle.block, { save: false, dropLastGrid: !!response.body.data.children.length, emptyInherits: true });
+ builder.recursiveLoad(response.body.data.children, builder.insert, 0, particle.getId());
+ }
+
+ if (particle.hasInheritance() && !response.body.data.inherit) {
+ particle.setInheritance({});
+ particle.disableInheritance();
+ }
+
+ lmhistory.push(builder.serialize(), lmhistory.get().preset);
+
+ // if it's apply and save we also save the panel
+ if (target.data('apply-and-save') !== null) {
+ var save = $('body').find('.button-save');
+ if (save) { body.emit('click', { target: save }); }
+ }
+
+ modal.close();
+
+ toastr.success(translate('GANTRY5_PLATFORM_JS_PARTICLE_SETTINGS_APPLIED', particle.getTitle()), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+
+ target.hideIndicator();
+ });
+ });
+ }
+ });
+
+ });
+
+});
+
+module.exports = {
+ $: $,
+ builder: builder,
+ layoutmanager: layoutmanager,
+ history: lmhistory,
+ savestate: savestate
+};
+
+},{"../fields/submit":9,"../ui":54,"../ui/popover":56,"../utils/field-validation":68,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,"../utils/save-state":77,"../utils/translate":78,"./builder":24,"./history":26,"./inheritance":29,"./layoutmanager":30,"./particles-sidebar":31,"agent":80,"elements/attributes":108,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/collection/size":191,"mout/number/enforcePrecision":222,"mout/string/properCase":264,"mout/string/replace":267,"mout/string/trim":272}],29:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ ready = require('elements/domready'),
+ request = require('agent'),
+ modal = require('../../ui').modal,
+
+ isArray = require('mout/lang/isArray'),
+ forEach = require('mout/collection/forEach'),
+ filter = require('mout/object/filter'),
+ keys = require('mout/object/keys'),
+ contains = require('mout/collection/contains'),
+
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxURL = require('../../utils/get-ajax-url').global,
+ getOutlineNameById = require('../../utils/get-outline').getOutlineNameById,
+ getCurrentOutline = require('../../utils/get-outline').getCurrentOutline;
+
+
+var IDsMap = {
+ attributes: ['g-settings-particle', 'g-settings-atom'],
+ block: { panel: 'g-settings-block-attributes', tab: 'g-settings-block' },
+ particles: 'g-inherit-particle',
+ atoms: 'g-inherit-atom'
+};
+
+ready(function() {
+ var body = $('body'),
+ currentSelection = {},
+ currentMode = {};
+
+ body.delegate('change', '[name="inherit[outline]"]', function(event, element) {
+ var label = element.parent('.settings-param').find('.settings-param-title'),
+ text = element.siblings().find('.g-item'),
+ value = element.value(),
+ name = $('[name="inherit[section]"]') ? $('[name="inherit[section]"]').value() : '',
+ form = element.parent('[data-g-inheritance-settings]'),
+ includesFields = $('[data-multicheckbox-field="inherit[include]"]:checked') || [],
+ particle = {
+ list: $('#g-inherit-particle, #g-inherit-atom'),
+ mode: $('[name="inherit[mode]"]:checked'),
+ radios: $('[name="inherit[particle]"], [name="inherit[atom]"]'),
+ checked: $('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')
+ };
+
+ if (!text) { return true; }
+
+ var hasChanged = currentSelection[name] !== value || currentMode[name] !== particle.mode.value();
+
+ if (hasChanged && !value) {
+ includesFields.forEach(function(include) {
+ $(include).checked(false);
+ body.emit('change', { target: include });
+ });
+ }
+
+ var formData = JSON.parse(form.data('g-inheritance-settings')),
+ data = {
+ outline: value || getCurrentOutline(),
+ type: formData.type || '',
+ subtype: formData.subtype || '',
+ mode: particle.mode.value(),
+ inherit: !!value && particle.mode.value() === 'inherit' ? '1' : '0'
+ };
+
+ data.id = formData.id;
+
+ label.showIndicator();
+ element.selectizeInstance.blur();
+
+ if (particle.radios && particle.checked) {
+ if (!hasChanged) {
+ data.selected = particle.checked.value();
+ data.id = particle.checked.value();
+ particle.list = false;
+ }
+ }
+
+ var URI_mode = data.type === 'atom' ? 'atoms' : 'layouts',
+ URI = particle.list ? URI_mode + '/list' : URI_mode;
+
+ request('POST', parseAjaxURI(getAjaxURL(URI) + getAjaxSuffix()), data, function(error, response) {
+ label.hideIndicator();
+
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ return;
+ }
+
+ var data = response.body,
+ includes = form.find('[name="inherit[include]"]').value().split(','),
+ available = form.search('[data-multicheckbox-field="inherit[include]"]').map(function(item) { return $(item).value(); }),
+ container = modal.getByID(modal.getLast()),
+ element;
+
+ // refresh field values based on settings and ajax response
+ forEach(IDsMap, function(id, option) {
+ id = id.panel || id;
+ id = !isArray(id) ? [id] : id;
+
+ id.forEach(function(currentID) {
+ var shouldRefresh = contains(includes, option),
+ isAvailable = contains(available, option);
+
+ if ((shouldRefresh || !isAvailable) && data.html[currentID] && (element = container.find('#' + currentID))) {
+ element.html(data.html[currentID]);
+ var selects = element.search('[data-selectize]');
+ if (selects) { selects.selectize(); }
+ }
+ });
+ });
+
+ if (hasChanged && includesFields && currentSelection[name] === '') {
+ includesFields.forEach(function(include) { body.emit('change', { target: include }); });
+ }
+
+ currentSelection[name] = value;
+ currentMode[name] = particle.mode.value();
+ });
+ });
+
+ body.delegate('change', '#g-settings-inheritance [data-multicheckbox-field]', function(event, element) {
+ var outline = $('[name="inherit[outline]"]');
+ if (!outline) { return true; }
+
+ outline = outline.value();
+
+ var value = element.value(),
+ isChecked = element.checked(),
+ noRefresh = event.noRefresh,
+ particle = {
+ mode: $('[name="inherit[mode]"]:checked'),
+ radios: $('[name="inherit[particle]"], [name="inherit[atom]"]'),
+ checked: $('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')
+ };
+
+ var IDs = {
+ panel: (IDsMap[value] && IDsMap[value].panel || IDsMap[value]),
+ tab: (IDsMap[value] && IDsMap[value].tab || IDsMap[value])
+ };
+
+ if (!isArray(IDs.panel)) {
+ IDs.panel = [IDs.panel];
+ IDs.tab = [IDs.tab];
+ }
+
+ IDs.panel.forEach(function(currentPanel, index) {
+ var panel = $('#' + currentPanel),
+ tab = $('#' + IDs.tab[index] + '-tab');
+
+ if (!panel || !tab) { return true; }
+
+ var inherit = panel.find('.g-inherit'),
+ isClone = particle.mode.value() === 'clone',
+ refresh = function(noRefresh) {
+ if (!noRefresh) {
+ body.emit('change', { target: element.parent('.settings-block').find('[name="inherit[outline]"]') });
+ }
+ };
+
+ if (!isChecked || !outline || isClone) {
+ var lock = tab.find('.fa-lock');
+
+ if (lock) { lock.removeClass('fa-lock').addClass('fa-unlock'); }
+ if (inherit) { inherit.hide(); }
+ if (isClone) { refresh(noRefresh); }
+ } else {
+ var unlock = tab.find('.fa-unlock');
+
+ if (unlock) { unlock.removeClass('fa-unlock').addClass('fa-lock'); }
+ if (inherit) { inherit.show(); }
+
+ refresh(noRefresh);
+ }
+ });
+ });
+
+
+ body.delegate('change', '[name="inherit[mode]"], [name="inherit[particle]"], [name="inherit[atom]"]', function(event, element) {
+ var container = modal.getByID(modal.getLast()),
+ outline = container.find('[name="inherit[outline]"]'),
+ checkboxes = container.search('[data-multicheckbox-field]') || [],
+ noRefresh = false;
+
+ if (element.attribute('name') === 'inherit[mode]') {
+ noRefresh = true;
+ }
+
+ body.emit('change', { target: outline, noRefresh: noRefresh });
+ checkboxes.forEach(function(checkbox) {
+ body.emit('change', { target: checkbox, noRefresh: noRefresh });
+ });
+ });
+
+ body.delegate('click', '#g-inherit-particle .fa-info-circle, #g-inherit-atom .fa-info-circle', function(event, element) {
+ event.preventDefault();
+
+ var container = modal.getByID(modal.getLast()),
+ outline = container.find('[name="inherit[outline]"]'),
+ id = element.siblings('input[name="inherit[particle]"], input[name="inherit[atom]"]');
+
+ if (!id || !outline) { return false; }
+
+ var URI = id.name() === 'inherit[atom]' ? 'atoms/instance' : 'layouts/particle';
+ modal.open({
+ content: 'Loading',
+ method: 'post',
+ data: { id: id.value(), outline: outline.value() || getCurrentOutline() },
+ remote: parseAjaxURI(getAjaxURL(URI) + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+ }
+ });
+
+ return false;
+ });
+
+ body.delegate('mouseup', '.g-tabs .fa-lock, .g-tabs .fa-unlock', function(event, element) {
+ if (!element.parent('li').hasClass('active')) { return false; }
+
+ var container = modal.getByID(modal.getLast()),
+ isLocked = element.hasClass('fa-lock'),
+ id = element.parent('a').id().replace(/\-tab$/, ''),
+ prop = keys(filter(IDsMap, function(value) { return value === id || value.tab === id || contains(value, id); }) || []).shift(),
+ input = container.find('[data-multicheckbox-field][value="' + prop + '"]'),
+ particle = {
+ mode: $('[name="inherit[mode]"]:checked'),
+ radios: $('[name="inherit[particle]"], [name="inherit[atom]"]'),
+ checked: $('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')
+ };
+
+ if (input) {
+ // do not try to refresh attributes/block inheritance when there's no particle selected
+ // or if we are in clone mode
+ if (particle.mode.value() === 'clone' || (particle.radios && !particle.checked)) {
+ return false;
+ }
+
+ input.checked(!isLocked);
+ body.emit('change', { target: input });
+ }
+ });
+});
+
+},{"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"agent":80,"elements":113,"elements/domready":111,"mout/collection/contains":187,"mout/collection/forEach":189,"mout/lang/isArray":203,"mout/object/filter":229,"mout/object/keys":236}],30:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ bind = require('mout/function/bind'),
+ zen = require('elements/zen'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ Blocks = require('./blocks'),
+ DragDrop = require('../ui/drag.drop'),
+ Eraser = require('../ui/eraser'),
+ flags = require('../utils/flags-state'),
+ Resizer = require('./drag.resizer'),
+ get = require('mout/object/get'),
+ keys = require('mout/object/keys'),
+
+ every = require('mout/array/every'),
+ precision = require('mout/number/enforcePrecision'),
+ isArray = require('mout/lang/isArray'),
+ deepEquals = require('mout/lang/deepEquals'),
+ find = require('mout/collection/find'),
+ isObject = require('mout/lang/isObject'),
+
+ contains = require('mout/array/contains'),
+ forEach = require('mout/collection/forEach');
+
+var singles = {
+ disable: function() {
+ var grids = $('[data-lm-root] [data-lm-blocktype="grid"]');
+ if (grids) { grids.removeClass('no-hover'); }
+ },
+ enable: function() {
+ var grids = $('[data-lm-root] [data-lm-blocktype="grid"]');
+ if (grids) { grids.addClass('no-hover'); }
+ },
+ cleanup: function(builder, dropLast, start) {
+ var emptyGrids = start ? start.search('> .g-grid:empty') : $('[data-lm-blocktype="section"] > .g-grid:empty, [data-lm-blocktype="container"] > .g-grid:empty, [data-lm-blocktype="offcanvas"] > .g-grid:empty');
+
+ if (emptyGrids) {
+ emptyGrids.forEach(function(grid) {
+ grid = $(grid);
+ // empty grids should go away unless they are last and/or dropLast is true
+ if (grid.nextSibling('[data-lm-id]') || dropLast) {
+ builder.remove(grid.data('lm-id'));
+ grid.remove();
+ }
+ });
+ }
+ }
+
+};
+
+var LayoutManager = new prime({
+
+ mixin: [Bound, Options],
+ inherits: Emitter,
+
+ options: {},
+
+ constructor: function(element, options) {
+ this.setOptions(options);
+ this.refElement = element;
+
+ if (!element || !$(element)) { return; }
+
+ this.init(element);
+ },
+
+ init: function() {
+ this.dragdrop = new DragDrop(this.refElement, this.options);
+ this.resizer = new Resizer(this.refElement, this.options);
+ this.eraser = new Eraser('[data-lm-eraseblock]', this.options);
+ this.dragdrop
+ .on('dragdrop:start', this.bound('start'))
+ .on('dragdrop:location', this.bound('location'))
+ .on('dragdrop:nolocation', this.bound('nolocation'))
+ .on('dragdrop:resize', this.bound('resize'))
+ .on('dragdrop:stop:erase', this.bound('removeElement'))
+ .on('dragdrop:stop', this.bound('stop'))
+ .on('dragdrop:stop:animation', this.bound('stopAnimation'));
+
+ this.builder = this.options.builder;
+ this.history = this.options.history;
+ this.savestate = this.options.savestate || null;
+
+ singles.disable();
+ },
+
+ refresh: function() {
+ if (!this.refElement || !$(this.refElement)) { return; }
+ this.init();
+ },
+
+ singles: function(mode, builder, dropLast, start) {
+ singles[mode](builder, dropLast, start);
+ },
+
+ clear: function(parent, options) {
+ var type, child,
+ filter = !parent ? [] : (parent.search('[data-lm-id]') || []).map(function(element) { return $(element).data('lm-id'); });
+
+ options = options || { save: true, dropLastGrid: false, emptyInherits: false };
+
+ forEach(this.builder.map, function(obj, id) {
+ if (filter.length && !contains(filter, id)) { return; }
+ if (!options.emptyInherits && obj.block.parent('.g-inheriting')) { return; }
+
+ type = obj.getType();
+ child = obj.block.find('> [data-lm-id]');
+ if (child) { child = child.data('lm-blocktype'); }
+ if (contains(['particle', 'spacer', 'position', 'widget', 'system', 'block'], type) && (type == 'block' && (child && (child !== 'section' && child !== 'container')))) {
+ this.builder.remove(id);
+ obj.block.remove();
+ } else if (options.emptyInherits && (type == 'section' || type == 'offcanvas' || type == 'container')) {
+ if (obj.hasInheritance) {
+ obj.inherit = {};
+ obj.disableInheritance();
+ }
+ }
+ }, this);
+
+ this.singles('cleanup', this.builder, options.dropLastGrid, parent);
+ if (options.save) { this.history.push(this.builder.serialize(), this.history.get().preset); }
+ },
+
+ updatePendingChanges: function() {
+ var saveData = this.savestate.getData(),
+ serialData = this.builder.serialize(null, true),
+ different = false,
+
+ equals = deepEquals(saveData, serialData),
+ save = $('[data-save="Layout"]'),
+ icon = save.find('i'),
+ indicator = save.find('.changes-indicator');
+
+ if (equals && indicator) { save.hideIndicator(); }
+ if (!equals && !indicator) { save.showIndicator('changes-indicator far fa-fw fa-circle') }
+ flags.set('pending', !equals);
+
+ // Emits the changed event for all particles
+ // Used for UI to show particles where there have been differences applied
+ // After a saved state
+ var saved, current, id;
+ serialData.forEach(function(block) {
+ id = keys(block)[0];
+ saved = find(saveData, function(data) { return data[id]; });
+ current = find(serialData, function(data) { return data[id]; });
+ different = !deepEquals(saved, current);
+
+ id = this.builder.get(id);
+ if (id) { id.emit('changed', different); }
+ }, this);
+ },
+
+ start: function(event, element) {
+ var root = $('[data-lm-root]'),
+ size = $(element).position(),
+ coords = $(element)[0].getBoundingClientRect();
+
+ this.block = null;
+ this.mode = root.data('lm-root') || 'page';
+
+ root.addClass('moving');
+
+ var type = $(element).data('lm-blocktype'),
+ clone = element[0].cloneNode(true);
+
+ if (!this.placeholder) { this.placeholder = zen('div.block.placeholder[data-lm-placeholder]'); }
+ this.placeholder.style({ display: 'none' });
+
+ clone = $(clone);
+ this.original = clone.after(element).style({
+ display: clone.hasClass('g-grid') ? 'flex' : 'block',
+ opacity: 0.5
+ }).addClass('original-placeholder').data('lm-dropzone', null);
+
+ if (type === 'grid') { this.original.style({ display: 'flex' }); }
+
+ this.originalType = type;
+
+ this.block = get(this.builder.map, element.data('lm-id') || '') || new Blocks[type]({
+ builder: this.builder,
+ subtype: element.data('lm-subtype'),
+ title: element.text()
+ });
+
+ if (!this.block.isNew()) {
+ element.style({
+ position: 'fixed',
+ zIndex: 2500,
+ opacity: 0.5,
+ margin: 0,
+ width: Math.ceil(size.width),
+ height: Math.ceil(size.height),
+ left: coords.left,
+ top: coords.top
+ }).find('[data-lm-blocktype]');
+
+ if (this.block.getType() === 'grid') {
+ var siblings = this.block.block.siblings(':not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)');
+ if (siblings) {
+ siblings.search('[data-lm-id]').style({ 'pointer-events': 'none' });
+ }
+ }
+
+ this.placeholder.before(element);
+ this.eraser.show();
+ } else {
+ var position = element.position();
+ this.original.style({
+ position: 'fixed',
+ opacity: 0.5
+ }).style({
+ left: coords.left,
+ top: coords.top,
+ width: position.width,
+ height: position.height
+ });
+ this.element = this.dragdrop.element;
+ this.dragdrop.element = this.original;
+ }
+
+ var blocks;
+ if (type === 'grid' && (blocks = root.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))) {
+ blocks.style({ 'pointer-events': 'none' });
+ }
+
+ singles.enable();
+ },
+
+ location: function(event, location, target/*, element*/) {
+ target = $(target);
+ (!this.block.isNew() ? this.original : this.element).style({ transform: 'translate(0, 0)' });
+ if (!this.placeholder) { this.placeholder = zen('div.block.placeholder[data-lm-placeholder]').style({ display: 'none' }); }
+
+ var position,
+ dataType = target.data('lm-blocktype'),
+ originalType = this.block.getType();
+
+ if (!dataType && target.data('lm-root')) { dataType = 'root'; }
+ if (this.mode !== 'page' && dataType === 'section') { return; }
+ if (dataType === 'grid' && (target.parent().data('lm-root') || (target.parent().data('lm-blocktype') === 'container' && target.parent().parent().data('lm-root')))) { return; }
+
+ // Check for adjacents and avoid inserting any placeholder since it would be the same position
+ var exclude = ':not(.placeholder):not([data-lm-id="' + this.original.data('lm-id') + '"])',
+ adjacents = {
+ before: this.original.previousSiblings(exclude),
+ after: this.original.nextSiblings(exclude)
+ };
+
+ if (adjacents.before) { adjacents.before = $(adjacents.before[0]); }
+ if (adjacents.after) { adjacents.after = $(adjacents.after[0]); }
+
+ if (dataType === 'block' && ((adjacents.before === target && location.x === 'after') || (adjacents.after === target && location.x === 'before'))) {
+ return;
+ }
+ if (dataType === 'grid' && ((adjacents.before === target && location.y === 'below') || (adjacents.after === target && location.y === 'above'))) {
+ return;
+ }
+
+ var nonVisible = target.parent('[data-lm-blocktype="atoms"]'),
+ child = this.block.block.find('[data-lm-id]');
+
+ if ((child ? child.data('lm-blocktype') : originalType) == 'atom') {
+ if (!nonVisible) { return; }
+ } else {
+ if (nonVisible) { return; }
+ }
+
+ // handles the types cases and normalizes the locations (x and y)
+ var grid, block, method;
+
+ switch (dataType) {
+ case 'root':
+ case 'section':
+ break;
+ case 'grid':
+ var empty = !target.children(':not(.placeholder)');
+ // new particles cannot be dropped in existing grids, only empty ones
+ if (originalType !== 'grid' && !empty) { return; }
+
+
+ if (empty) {
+ if (originalType === 'grid') {
+ this.placeholder.before(target);
+ } else {
+ // we are dropping a new particle into an empty grid, placeholder goes inside
+ this.placeholder.bottom(target);
+ }
+ } else {
+ // we are sorting grids ordering, placeholder goes above/below
+ method = (location.y === 'above' ? 'before' : 'after');
+ this.placeholder[method](target);
+ }
+
+ break;
+ case 'block':
+ method = (location.y === 'above' ? 'top' : 'bottom');
+ position = (location.x === 'other') ? method : location.x;
+ this.placeholder[position](target);
+
+ break;
+ }
+
+ // If it's not a block we don't want a small version of the placeholder
+ this.placeholder.removeClass('in-between').removeClass('in-between-grids').removeClass('in-between-grids-first').removeClass('in-between-grids-last');
+ this.placeholder.style({ display: 'block' })[dataType !== 'block' ? 'removeClass' : 'addClass']('in-between');
+
+ if (originalType === 'grid' && dataType === 'grid') {
+ var next = this.placeholder.nextSibling(),
+ previous = this.placeholder.previousSibling();
+
+ this.placeholder.addClass('in-between-grids');
+ if (previous && !previous.data('lm-blocktype')) { this.placeholder.addClass('in-between-grids-first'); }
+ if (!next || !next.data('lm-blocktype')) { this.placeholder.addClass('in-between-grids-last'); }
+ }
+ },
+
+ nolocation: function(event) {
+ (!this.block.isNew() ? this.original : this.element).style({ transform: 'translate(0, 0)' });
+ if (this.placeholder) { this.placeholder.remove(); }
+ if (!this.block) { return; }
+
+ var target = event.type.match(/^touch/i) ? document.elementFromPoint(event.touches.item(0).clientX, event.touches.item(0).clientY) : event.target;
+
+ if (!this.block.isNew()) {
+ target = $(target);
+ if (target.matches(this.eraser.element) || this.eraser.element.find(target)) {
+ this.dragdrop.removeElement = true;
+ this.eraser.over();
+ } else {
+ this.dragdrop.removeElement = false;
+ this.eraser.out();
+ }
+ }
+ },
+
+ resize: function(event, element, siblings, offset) {
+ this.resizer.start(event, element, siblings, offset);
+ },
+
+ removeElement: function(event, element) {
+ this.dragdrop.removeElement = false;
+
+ var transition = {
+ opacity: 0
+ };
+
+ element.animate(transition, {
+ duration: '150ms'
+ });
+
+ var root = $('[data-lm-root]'), blocks;
+ if (this.block.getType() === 'grid' && (blocks = root.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))) {
+ blocks.style({ 'pointer-events': 'inherit' });
+ }
+
+ var siblings = this.block.block.siblings(':not(.original-placeholder)');
+
+ if (siblings && this.block.getType() == 'block') {
+ var size = this.block.getSize(),
+ diff = size / siblings.length,
+ newSize, block, total = 0, last;
+ siblings.forEach(function(sibling, index) {
+ sibling = $(sibling);
+ block = get(this.builder.map, sibling.data('lm-id'));
+ if (index + 1 == siblings.length) { last = block; }
+ newSize = precision(block.getSize() + diff, 0);
+ total += newSize;
+ block.setSize(newSize, true);
+ }, this);
+
+ // ensuring it's always 100%
+ if (total != 100 && last) {
+ size = last.getSize();
+ diff = 100 - total;
+ last.setSize(size + diff, true);
+ }
+ }
+
+ this.eraser.hide();
+
+ this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').off(event, this.dragdrop.bound('move'));
+ }, this));
+
+ this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $('body').off(event, this.dragdrop.bound('deferStop'));
+ }, this));
+
+ this.builder.remove(this.block.getId());
+
+ var children = this.block.block.search('[data-lm-id]');
+ if (children && children.length) {
+ children.forEach(function(child) {
+ this.builder.remove($(child).data('lm-id'));
+ }, this);
+ }
+
+ this.block.block.remove();
+
+ if (this.placeholder) { this.placeholder.remove(); }
+ if (this.original) { this.original.remove(); }
+ this.element = this.block = null;
+
+ singles.disable();
+ singles.cleanup(this.builder);
+
+ this.history.push(this.builder.serialize(), this.history.get().preset);
+ root.removeClass('moving');
+
+ },
+
+ stop: function(event, target/*, element*/) {
+ // we are removing the block
+ var lastOvered = $(this.dragdrop.lastOvered);
+ if (lastOvered && lastOvered.matches(this.eraser.element.find('.trash-zone'))) {
+ this.eraser.hide();
+ return;
+ }
+
+ if (this.block.getType() === 'grid') {
+ var siblings = this.block.block.siblings(':not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)');
+ if (siblings) {
+ siblings.search('[data-lm-id]').style({ 'pointer-events': 'inherit' });
+ }
+ }
+
+ if (!this.block.isNew()) { this.eraser.hide(); }
+ if (!this.dragdrop.matched) {
+ if (this.placeholder) { this.placeholder.remove(); }
+
+ return;
+ }
+
+ target = $(target);
+
+ var wrapper, insider,
+ multiLocationResize = false,
+ blockWasNew = this.block.isNew(),
+ type = this.block.getType(),
+ targetId = target.data('lm-id'),
+ targetType = !targetId ? false : get(this.builder.map, targetId) ? get(this.builder.map, targetId).getType() : target.data('lm-blocktype'),
+ placeholderParent = this.placeholder.parent();
+
+ if (!placeholderParent) { return; }
+
+ var parentId = placeholderParent.data('lm-id'),
+ parentType = get(this.builder.map, parentId || '') ? get(this.builder.map, parentId).getType() : false,
+ resizeCase = false;
+
+ this.original.remove();
+
+ // case 1: it's a new particle dropped in the LM, we need to wrap it inside a block
+ if (type !== 'block' && type !== 'grid' && ((targetType === 'section' || targetType === 'grid') || (targetType === 'block' && parentType !== 'block'))) {
+ wrapper = new Blocks.block({
+ builder: this.builder
+ }).adopt(this.block.block);
+
+ insider = new Blocks[type]({
+ id: this.block.block.data('lm-id'),
+ type: type,
+ subtype: this.element.data('lm-blocksubtype'),
+ title: this.element.text(),
+ builder: this.builder
+ }).setLayout(this.block.block);
+
+ wrapper.setSize();
+
+ this.block = wrapper;
+ this.builder.add(wrapper);
+ this.builder.add(insider);
+
+ insider.emit('rendered', insider, wrapper);
+ wrapper.emit('rendered', wrapper, null);
+
+ resizeCase = { case: 1 };
+ }
+
+ // case 2: moving a block around, need to fix sizes if it's a multi location resize
+ if (this.originalType === 'block' && this.block.getType() === 'block') {
+ resizeCase = { case: 3 };
+ var previous = this.block.block.parent('[data-lm-blocktype="grid"]'),
+ placeholderPrevious = this.placeholder.parent('[data-lm-blocktype="grid"]');
+ //if (previous.find('!> [data-lm-blocktype="container"]')) { previous = previous.parent(); }
+ //if (placeholderPrevious.find('!> [data-lm-blocktype="container"]')) { placeholderPrevious = placeholderPrevious.parent(); }
+ if (placeholderPrevious !== previous) {
+ multiLocationResize = {
+ from: this.block.block.siblings(':not(.placeholder)'),
+ to: this.placeholder.siblings(':not(.placeholder)')
+ };
+ }
+
+ if (previous.find('!> [data-lm-blocktype="container"]')) { previous = previous.parent(); }
+ previous = previous.siblings(':not(.original-placeholder)');
+ if (!this.block.isNew() && previous.length) { this.resizer.evenResize(previous); }
+
+ this.block.block.attribute('style', null);
+ this.block.setSize();
+ }
+
+ if (type === 'grid' && !siblings) {
+ var plus = this.block.block.parent('[data-lm-blocktype="section"]').find('.fa-plus');
+ if (plus) { plus.emit('click'); }
+ }
+
+ if (this.block.hasAttribute('size') && typeof this.block.getSize === 'function') { this.block.setSize(this.placeholder.compute('flex')); }
+
+ this.block.insert(this.placeholder);
+ this.placeholder.remove();
+
+ if (blockWasNew) {
+ if (resizeCase) { this.resizer.evenResize($([this.block.block, this.block.block.siblings()])); }
+
+ this.element.attribute('style', null);
+ }
+
+
+ if (multiLocationResize.from || (multiLocationResize.to && multiLocationResize.to != this.block.block)) {
+ // if !from / !to means it's empty grid, should we remove it?
+ var size = this.block.getSize(), diff, block;
+
+ // we are moving the particle to an empty grid, resetting the size to 100%
+ if (!multiLocationResize.to) { this.block.setSize(100, true); }
+
+ // we need to compensate the remaining blocks on the FROM with the leaving particle size
+ if (multiLocationResize.from) {
+ diff = size / multiLocationResize.from.length;
+ var total = 0, curSize;
+ multiLocationResize.from.forEach(function(sibling) {
+ sibling = $(sibling);
+ block = get(this.builder.map, sibling.data('lm-id'));
+ curSize = block.getSize() + diff;
+ block.setSize(curSize, true);
+ total += curSize;
+ }, this);
+
+ if (total !== 100) {
+ diff = (100 - total) / multiLocationResize.from.length;
+ multiLocationResize.from.forEach(function(sibling) {
+ sibling = $(sibling);
+ block = get(this.builder.map, sibling.data('lm-id'));
+ curSize = block.getSize() + diff;
+ block.setSize(curSize, true);
+ }, this);
+ }
+ }
+
+ // the TO is receiving a new block so we are going to evenize
+ if (multiLocationResize.to) {
+ size = 100 / (multiLocationResize.to.length + 1);
+ multiLocationResize.to.forEach(function(sibling) {
+ sibling = $(sibling);
+ block = get(this.builder.map, sibling.data('lm-id'));
+ block.setSize(size, true);
+ }, this);
+ this.block.setSize(size, true);
+ }
+ }
+
+ singles.disable();
+ singles.cleanup(this.builder);
+
+ this.history.push(this.builder.serialize(), this.history.get().preset);
+ },
+
+ stopAnimation: function(element) {
+ var root = $('[data-lm-root]');
+ root.removeClass('moving');
+
+ if (this.original) { this.original.remove(); }
+ singles.disable();
+
+ if (!this.block) { this.block = get(this.builder.map, element.data('lm-id')); }
+ if (this.block && this.block.getType() === 'block') { this.block.setSize(); }
+ if (this.block && this.block.isNew() && this.element) { this.element.attribute('style', null); }
+
+ if (this.originalType === 'grid') {
+ var blocks, block;
+ if (blocks = root.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])')) {
+ blocks.forEach(function(element) {
+ element = $(element);
+ block = get(this.builder.map, element.data('lm-id'));
+ element.attribute('style', null);
+ block.setSize();
+ }, this);
+ }
+ }
+ }
+});
+
+module.exports = LayoutManager;
+
+},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"../utils/flags-state":69,"./blocks":16,"./drag.resizer":25,"elements/zen":137,"mout/array/contains":166,"mout/array/every":169,"mout/collection/find":188,"mout/collection/forEach":189,"mout/function/bind":192,"mout/lang/deepEquals":201,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/number/enforcePrecision":222,"mout/object/get":233,"mout/object/keys":236,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],31:[function(require,module,exports){
+"use strict";
+
+var ready = require('elements/domready'),
+ $ = require('elements'),
+ decouple = require('../utils/decouple'),
+ scrollbarWidth = require('../utils/get-scrollbar-width');
+
+var container, sidebar, search, particles, height, heightTop, heightBottom, excludeTop, excludeBottom,
+ initialSidebarCoords, realSidebarTop;
+
+var initSizes = function() {
+ // fixed and contained particles sidebar
+ container = $('.sidebar-block');
+ if (!container) { return; }
+
+ sidebar = container.find('.g5-lm-particles-picker');
+ if (!sidebar) { return; }
+
+ search = sidebar.find('> .search');
+ particles = sidebar.find('> .particles-container');
+ height = window.innerHeight;
+ heightTop = 0;
+ heightBottom = 0;
+ initialSidebarCoords = sidebar[0].getBoundingClientRect();
+ realSidebarTop = sidebar.position().top;
+ excludeTop = $('body.admin.com_gantry5 nav.navbar-fixed-top, #wpadminbar, #admin-main #titlebar, #admin-main .grav-update.grav');
+ excludeBottom = $('body.admin.com_gantry5 #status');
+
+ if (excludeTop) {
+ $(excludeTop).forEach(function(element) {
+ heightTop += element.offsetHeight;
+ });
+ }
+
+ if (excludeBottom) {
+ $(excludeBottom).forEach(function(element) {
+ heightBottom += element.offsetHeight;
+ });
+ }
+
+ particles.style({
+ 'max-height': (height - heightTop - heightBottom - search[0].offsetHeight - 30),
+ overflow: 'auto'
+ });
+
+ if (particles[0].scrollHeight !== particles[0].offsetHeight) {
+ particles.addClass('has-scrollbar').style({ 'margin-right': -scrollbarWidth() });
+ }
+};
+
+ready(function() {
+ initSizes();
+
+ var scrollElement = $(GANTRY_PLATFORM === 'grav' ? '#admin-main .content-padding' : window) || [window],
+ scroll = function() {
+ if (!container || !sidebar) { return; }
+
+ var scrollTop = this.scrollY || this.scrollTop,
+ containerBounds = container[0].getBoundingClientRect(),
+ limit = containerBounds.top + containerBounds.height,
+ sidebarCoords = sidebar[0].getBoundingClientRect(),
+ shouldBeFixed = (scrollTop > (initialSidebarCoords.top - heightTop - 10)) && scrollTop >= realSidebarTop - 10,
+ reachedTheLimit = sidebarCoords.height + 10 + heightTop + parseInt(container.compute('padding-bottom'), 10) >= limit,
+ sidebarTallerThanContainer = containerBounds.height <= sidebarCoords.height;
+
+ sidebar.style('width', sidebarCoords.width);
+ if (shouldBeFixed && !reachedTheLimit) {
+ sidebar.removeClass('particles-absolute').addClass('particles-fixed');
+ sidebar.style({
+ top: heightTop + 10,
+ bottom: 'inherit'
+ });
+ } else if (shouldBeFixed && reachedTheLimit) {
+ if (sidebarTallerThanContainer || (GANTRY_PLATFORM === 'grav' && containerBounds.bottom < sidebarCoords.bottom)) {
+ sidebar.removeClass('particles-fixed').addClass('particles-absolute');
+ sidebar.style({
+ top: 'inherit',
+ bottom: parseInt(container.compute('padding-bottom'), 10)
+ });
+ }
+ } else {
+ sidebar.removeClass('particles-fixed').removeClass('particles-absolute');
+ sidebar.style({
+ top: 'inherit',
+ bottom: 'inherit'
+ });
+ }
+ };
+
+ decouple(scrollElement[0], 'scroll', scroll.bind(scrollElement[0]));
+
+ decouple(window, 'resize', function() {
+ if (!particles) { return; }
+
+ // initSizes();
+ scroll.call(scrollElement[0]);
+
+ particles.style({
+ 'max-height': (window.innerHeight - heightTop - heightBottom - search[0].offsetHeight - 30)
+ });
+ });
+
+ $('body').on('statechangeEnd', function() {
+ initSizes();
+ });
+});
+
+module.exports = initSizes;
+
+},{"../utils/decouple":65,"../utils/get-scrollbar-width":73,"elements":113,"elements/domready":111}],32:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ request = require('agent'),
+ ui = require('./ui'),
+ interpolate = require('mout/string/interpolate'),
+ trim = require('mout/string/trim'),
+ setParam = require('mout/queryString/setParam'),
+ modal = ui.modal,
+ toastr = ui.toastr,
+
+ parseAjaxURI = require('./utils/get-ajax-url').parse,
+ getAjaxURL = require('./utils/get-ajax-url').global,
+ getAjaxSuffix = require('./utils/get-ajax-suffix'),
+
+ flags = require('./utils/flags-state'),
+ validateField = require('./utils/field-validation'),
+ lm = require('./lm'),
+ mm = require('./menu'),
+ pm = require('./positions/cards'),
+ configurations = require('./configurations'),
+ positions = require('./positions'),
+ changelog = require('./changelog'),
+ translate = require('./utils/translate');
+
+require('elements/attributes');
+require('elements/events');
+require('elements/delegation');
+require('elements/insertion');
+require('elements/traversal');
+require('./fields');
+require('./ui/popover');
+require('./utils/ajaxify-links');
+require('./utils/rAF-polyfill');
+
+var createHandler = function(divisor, noun, restOfString) {
+ return function(diff) {
+ var n = Math.floor(diff / divisor);
+ var pluralizedNoun = noun + ( n > 1 ? 's' : '' );
+ return "" + n + " " + pluralizedNoun + " " + restOfString;
+ }
+};
+
+var formatters = [
+ { threshold: -31535999, handler: createHandler(-31536000, "year", "from now" ) },
+ { threshold: -2591999, handler: createHandler(-2592000, "month", "from now" ) },
+ { threshold: -604799, handler: createHandler(-604800, "week", "from now" ) },
+ { threshold: -172799, handler: createHandler(-86400, "day", "from now" ) },
+ { threshold: -86399, handler: function(){ return "tomorrow" } },
+ { threshold: -3599, handler: createHandler(-3600, "hour", "from now" ) },
+ { threshold: -59, handler: createHandler(-60, "minute", "from now" ) },
+ { threshold: -0.9999, handler: createHandler(-1, "second", "from now" ) },
+ { threshold: 1, handler: function(){ return "just now" } },
+ { threshold: 60, handler: createHandler(1, "second", "ago" ) },
+ { threshold: 3600, handler: createHandler(60, "minute", "ago" ) },
+ { threshold: 86400, handler: createHandler(3600, "hour", "ago" ) },
+ { threshold: 172800, handler: function(){ return "yesterday" } },
+ { threshold: 604800, handler: createHandler(86400, "day", "ago" ) },
+ { threshold: 2592000, handler: createHandler(604800, "week", "ago" ) },
+ { threshold: 31536000, handler: createHandler(2592000, "month", "ago" ) },
+ { threshold: Infinity, handler: createHandler(31536000, "year", "ago" ) }
+];
+
+var prettyDate = {
+ format: function(date) {
+ var diff = (((new Date()).getTime() - date.getTime()) / 1000);
+ for (var i = 0; i < formatters.length; i++) {
+ if (diff < formatters[i].threshold) {
+ return formatters[i].handler(diff);
+ }
+ }
+ throw new Error("exhausted all formatter options, none found"); //should never be reached
+ }
+};
+
+window.onbeforeunload = function() {
+ if (flags.get('pending')) {
+ return translate('GANTRY5_PLATFORM_JS_NO_SAVE_DETECTED');
+ }
+};
+
+ready(function() {
+ var body = $('body'),
+ sentence = translate('GANTRY5_PLATFORM_JS_SAVE_SUCCESS');
+
+ // Close notification
+ body.delegate('click', '[data-g-close]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var parent = element.data('g-close');
+ parent = parent ? element.parent(parent) : element;
+
+ parent.slideUp(function() {
+ parent.remove();
+ });
+ });
+
+ // Generic Popovers
+ body.delegate('click', '[data-g-popover]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ if (!element.PopoverDefined) {
+ var content = element.find('[data-popover-content]') || element.siblings('[data-popover-content]'),
+ popover = element.getPopover({
+ style: element.data('g-popover-style') || 'generic',
+ width: element.data('g-popover-width') || 220,
+ content: zen('ul').html(content.html())[0].outerHTML,
+ allowElementsClick: element.data('g-popover-elementsclick') || '.toggle'
+ });
+ element.on('shown.popover', function(popover){
+ var enabler = element.find('.enabler');
+ element.attribute('aria-expanded', true).attribute('aria-hidden', false);
+
+ if (enabler) {
+ enabler[0].focus();
+ }
+ });
+
+ element.on('hide.popover', function(popover){
+ element.attribute('aria-expanded', false).attribute('aria-hidden', true);
+ });
+
+ element.getPopover().show();
+ }
+ });
+
+ // Platform Settings redirect
+ body.delegate('mousedown', '[data-settings-key]', function(event, element) {
+ var key = element.data('settings-key');
+ if (!key) { return true; }
+
+ var redirect = window.location.search,
+ settings = element.attribute('href'),
+ uri = window.location.href.split('?');
+ if (uri.length > 1 && uri[0].match(/index.php$/)) { redirect = 'index.php' + redirect; }
+
+ redirect = setParam(settings, key, btoa(redirect));
+ element.href(redirect);
+ });
+
+ // Save Tooltip
+ body.delegate('mouseover', '.button-save', function(event, element) {
+ if (!element.lastSaved) { return true; }
+ var feedback = translate('GANTRY5_PLATFORM_LAST_SAVED') + ': ' + prettyDate.format(element.lastSaved);
+ element
+ .data('tip', feedback)
+ .data('title', feedback);
+ });
+
+ // Save
+ body.delegate('click', '.button-save', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var saves = $('.button-save');
+
+ if (saves.disabled()) {
+ return false;
+ }
+
+ saves.disabled(true);
+ saves.hideIndicator();
+ saves.showIndicator();
+
+ var data = {},
+ invalid = [],
+ type = element.data('save'),
+ extras = '',
+ page = $('[data-lm-root]') ? 'layout' : ($('[data-mm-id]') ? 'menu' : ($('[data-g5-position]') ? 'positions' : 'other')),
+ saveURL = parseAjaxURI(trim(window.location.href, '#') + getAjaxSuffix());
+
+ switch (page) {
+ case 'layout':
+ var preset = $('[data-lm-preset]');
+ lm.layoutmanager.singles('cleanup', lm.builder, false);
+ lm.savestate.setSession(lm.builder.serialize(null, true));
+
+ data.preset = preset && preset.data('lm-preset') ? preset.data('lm-preset') : 'default';
+
+ var layout = JSON.stringify(lm.builder.serialize());
+
+ // base64 encoding doesn't quite work with mod_security
+ // data.layout = btoa ? btoa(encodeURIComponent(layout)) : layout;
+
+ data.layout = layout;
+ break;
+
+ case 'menu':
+ data.menutype = $('select.menu-select-wrap').value();
+ data.settings = JSON.stringify(mm.menumanager.settings);
+ data.ordering = JSON.stringify(mm.menumanager.ordering);
+
+ var items = JSON.stringify(mm.menumanager.items);
+
+ // base64 encoding doesn't quite work with mod_security
+ // data.items = btoa ? btoa(encodeURIComponent(items)) : items;
+
+ data.items = items;
+
+ saveURL = parseAjaxURI(element.parent('form').attribute('action') + getAjaxSuffix());
+ break;
+
+ case 'positions':
+ data.positions = pm.serialize();
+ break;
+
+ case 'other':
+ default:
+ var form = element.parent('form');
+
+ if (form && element.attribute('type') == 'submit') {
+ $(form[0].elements).forEach(function(input) {
+ input = $(input);
+ var name = input.attribute('name'),
+ type = input.attribute('type'),
+ value = input.value(),
+ parent = input.parent('.settings-param, .card-overrideable'),
+ override = parent ? parent.find('> input[type="checkbox"]') : null;
+
+ override = override || $(input.data('override-target'));
+
+ if (!name || input.disabled() || (override && !override.checked()) || (type == 'radio' && !input.checked())) { return; }
+ if (!validateField(input)) { invalid.push(input); }
+ data[name] = value;
+ });
+ }
+ }
+
+ if (invalid.length) {
+ saves.disabled(false);
+ saves.hideIndicator();
+ saves.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ if (page == 'other') { $('.settings-param-title, .card.settings-block > h4').hideIndicator(); }
+ body.emit('updateOriginalFields');
+
+ request('post', saveURL, data, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ modal.close();
+
+ if ($('#styles')) {
+ extras = '
' + (response.body.warning ? '
' + response.body.title + '
' + response.body.html : translate('GANTRY5_PLATFORM_JS_CSS_COMPILED'));
+ }
+
+ toastr[response.body.warning ? 'warning' : 'success'](interpolate(sentence, {
+ verb: type.slice(-1) == 's' ? 'have' : 'has',
+ type: type,
+ extras: extras
+ }), type + ' ' + translate('GANTRY5_PLATFORM_SAVED'));
+ }
+
+ saves.disabled(false);
+ saves.hideIndicator();
+ saves.forEach(function(save) {
+ $(save).lastSaved = new Date();
+ });
+
+ if (page == 'layout') { lm.layoutmanager.updatePendingChanges(); }
+
+ // all good, disable 'pending' flag
+ flags.set('pending', false);
+ flags.emit('update:pending');
+ });
+ });
+
+ // Editable titles
+ body.delegate('keydown', '[data-title-edit]', function(event, element) {
+ var key = (event.which ? event.which : event.keyCode);
+ if (key == 32 || key == 13) { // ARIA support: Space / Enter toggle
+ event.preventDefault();
+ body.emit('click', event);
+ }
+ });
+
+ body.delegate('click', '[data-title-edit]', function(event, element) {
+ element = $(element);
+ if (element.hasClass('disabled')) { return false; }
+
+ var $title = element.siblings('[data-title-editable]') || element.previousSiblings().find('[data-title-editable]') || element.nextSiblings().find('[data-title-editable]'), title;
+ if (!$title) { return true; }
+
+ title = $title[0];
+ $title.text(trim($title.text()));
+
+ $title.attribute('contenteditable', true);
+ title.focus();
+
+ var range = document.createRange(), selection;
+ range.selectNodeContents(title);
+ selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(range);
+
+ $title.storedTitle = trim($title.text());
+ $title.titleEditCanceled = false;
+ $title.emit('title-edit-start', $title.storedTitle);
+ });
+
+ body.delegate('keydown', '[data-title-editable]', function(event, element) {
+ element = $(element);
+ switch (event.keyCode) {
+ case 13: // return
+ case 27: // esc
+ event.stopPropagation();
+
+ if (event.keyCode == 27) {
+ if (typeof element.storedTitle !== 'undefined') {
+ element.text(element.storedTitle);
+ element.titleEditCanceled = true;
+ }
+ }
+
+ element.attribute('contenteditable', null);
+ element[0].blur();
+
+ element.emit('title-edit-exit', element.data('title-editable'), event.keyCode == 13 ? 'enter' : 'esc');
+ return false;
+ default:
+ return true;
+ }
+ });
+
+ body.delegate('blur', '[data-title-editable]', function(event, element) {
+ element = $(element);
+ element[0].scrollLeft = 0;
+ element.attribute('contenteditable', null);
+ element.data('title-editable', trim(element.text()));
+ window.getSelection().removeAllRanges();
+ element.emit('title-edit-end', element.data('title-editable'), element.storedTitle, element.titleEditCanceled);
+ }, true);
+
+ // Quick Ajax Calls [data-ajax-action]
+ body.delegate('click', '[data-ajax-action]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ var href = element.attribute('href') || element.data('ajax-action'),
+ method = element.data('ajax-action-method') || 'post',
+ indicator = $(element.data('ajax-action-indicator')) || element;
+
+ if (!href) { return false; }
+
+ indicator.showIndicator();
+ request(method, parseAjaxURI(href + getAjaxSuffix()), function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ indicator.hideIndicator();
+ return false;
+ } else {
+ toastr[response.body.warning ? 'warning' : 'success'](response.body.html || 'Action successfully completed.', response.body.title || '');
+ }
+
+ indicator.hideIndicator();
+ })
+ });
+});
+
+var modules = {
+ /*mout : require('mout'),
+ prime : require('prime'),
+ "$" : elements,
+ zen : zen,
+ domready: domready,
+ agent : require('agent'),*/
+ lm: lm,
+ mm: mm,
+ assingments: require('./assignments'),
+ ui: require('./ui'),
+ styles: require('./styles'),
+ "$": $,
+ domready: require('elements/domready'),
+ particles: require('./particles'),
+ zen: require('elements/zen'),
+ moofx: require('moofx'),
+ atoms: require('./pagesettings'),
+ tips: require('./ui/tooltips')
+};
+
+window.G5 = modules;
+module.exports = modules;
+
+},{"./assignments":3,"./changelog":4,"./configurations":6,"./fields":7,"./lm":28,"./menu":35,"./pagesettings":37,"./particles":43,"./positions":48,"./positions/cards":47,"./styles":49,"./ui":54,"./ui/popover":56,"./ui/tooltips":61,"./utils/ajaxify-links":62,"./utils/field-validation":68,"./utils/flags-state":69,"./utils/get-ajax-suffix":70,"./utils/get-ajax-url":71,"./utils/rAF-polyfill":76,"./utils/translate":78,"agent":80,"elements":113,"elements/attributes":108,"elements/delegation":110,"elements/domready":111,"elements/events":112,"elements/insertion":114,"elements/traversal":136,"elements/zen":137,"moofx":138,"mout/queryString/setParam":249,"mout/string/interpolate":261,"mout/string/trim":272}],33:[function(require,module,exports){
+"use strict";
+var DragEvents = require('../ui/drag.events'),
+ prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ bind = require('mout/function/bind'),
+ isString = require('mout/lang/isString'),
+ nMap = require('mout/math/map'),
+ clamp = require('mout/math/clamp'),
+ precision = require('mout/number/enforcePrecision'),
+ get = require('mout/object/get'),
+ $ = require('../utils/elements.utils');
+
+require('elements/events');
+require('elements/delegation');
+
+var Resizer = new prime({
+ mixin: [Bound, Options],
+ DRAG_EVENTS: DragEvents,
+ options: {
+ minSize: 5
+ },
+ constructor: function(container, options, menumanager) {
+ this.setOptions(options);
+ this.history = this.options.history || {};
+ this.builder = this.options.builder || {};
+ this.map = this.builder.map;
+ this.menumanager = menumanager;
+ this.origin = {
+ x: 0,
+ y: 0,
+ transform: null,
+ offset: {
+ x: 0,
+ y: 0
+ }
+ };
+ },
+
+ getBlock: function(element) {
+ return get(this.map, isString(element) ? element : $(element).data('lm-id') || '');
+ },
+
+ getAttribute: function(element, prop) {
+ return this.getBlock(element).getAttribute(prop);
+ },
+
+ getSize: function(element) {
+ element = $(element);
+ var parent = element.matches('[data-mm-id]') ? element : element.parent('[data-mm-id]'),
+ size = parent.find('.percentage input');
+
+ return Number(size.value());
+ },
+
+ setSize: function(element, size, animated) {
+ element = $(element);
+ animated = typeof animated === 'undefined' ? false : animated;
+
+ var parent = element.matches('[data-mm-id]') ? element : element.parent('[data-mm-id]'),
+ pc = parent.find('.percentage input');
+
+ parent[animated ? 'animate' : 'style']({'flex': '0 1 '+size+'%'});
+ pc.value(precision(size, 1));
+ },
+
+ start: function(event, element, siblings, offset) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+ if (event.which && event.which !== 1) { return true; }
+
+ // Stops text selection
+ event.preventDefault();
+
+ this.element = $(element);
+
+ var parent = this.element.parent('.submenu-selector');
+ if (!parent) { return false; }
+
+ parent.addClass('moving');
+
+ this.siblings = {
+ occupied: 0,
+ elements: siblings,
+ next: this.element.parent('[data-mm-id]').nextSibling().find('> .submenu-column'),
+ prevs: this.element.parent('[data-mm-id]').previousSiblings(),
+ sizeBefore: 0
+ };
+
+ if (this.siblings.elements.length > 1) {
+ this.siblings.occupied -= this.getSize(this.siblings.next);
+ this.siblings.elements.forEach(function(sibling) {
+ this.siblings.occupied += this.getSize(sibling);
+ }, this);
+ }
+
+ if (this.siblings.prevs) {
+ this.siblings.prevs.forEach(function(sibling) {
+ this.siblings.sizeBefore += this.getSize(sibling);
+ }, this);
+ }
+
+ this.origin = {
+ size: this.getSize(this.element),
+ maxSize: this.getSize(this.element) + this.getSize(this.siblings.next),
+ x: event.changedTouches ? event.changedTouches[0].pageX : event.pageX + 6,
+ y: event.changedTouches ? event.changedTouches[0].pageY : event.pageY
+ };
+
+ var clientRect = this.element[0].getBoundingClientRect(),
+ parentRect = this.element.parent()[0].getBoundingClientRect();
+
+ this.origin.offset = {
+ clientRect: clientRect,
+ parentRect: {left: parentRect.left, right: parentRect.right},
+ x: this.origin.x - clientRect.right,
+ y: clientRect.top - this.origin.y,
+ down: offset
+ };
+
+ this.origin.offset.parentRect.left = this.element.parent('.submenu-selector').find('> [data-mm-id]:first-child')[0].getBoundingClientRect().left;
+ this.origin.offset.parentRect.right = this.element.parent('.submenu-selector').find('> [data-mm-id]:last-child')[0].getBoundingClientRect().right;
+
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $(document).on(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $(document).on(event, this.bound('stop'));
+ }, this));
+ },
+
+ move: function(event) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ var clientX = event.clientX || event.touches[0].clientX || 0,
+ clientY = event.clientY || event.touches[0].clientY || 0,
+ parentRect = this.origin.offset.parentRect;
+
+ var deltaX = (this.lastX || clientX) - clientX,
+ deltaY = (this.lastY || clientY) - clientY;
+
+ this.direction =
+ Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0 && 'left' ||
+ Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0 && 'right' ||
+ Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0 && 'up' ||
+ 'down';
+ var size,
+ diff = 100 - this.siblings.occupied,
+ value = clientX + (!this.siblings.prevs ? this.origin.offset.x - this.origin.offset.down : this.siblings.prevs.length),
+ normalized = clamp(value, parentRect.left, parentRect.right);
+
+ size = nMap(normalized, parentRect.left, parentRect.right, 0, 100);
+ size = size - this.siblings.sizeBefore;
+ size = precision(clamp(size, this.options.minSize, this.origin.maxSize - this.options.minSize), 0);
+
+ diff = precision(diff - size, 0);
+
+ this.setSize(this.element, size);
+ this.setSize(this.siblings.next, diff);
+
+ // Hack to handle cases where size is not an integer
+ var siblings = this.siblings.elements,
+ amount = siblings ? siblings.length + 1 : 1;
+ if (amount == 3 || amount == 6 || amount == 7 || amount == 8 || amount == 9 || amount == 11 || amount == 12) {
+ var total = 0, blocks;
+
+ blocks = $([siblings, this.element.parent('[data-mm-id]')]);
+ blocks.forEach(function(block, index){
+ block = $(block);
+ size = this.getSize(block);
+ if (size % 1) {
+ size = precision(100 / amount, 0);
+ this.setSize(block, size);
+ }
+
+ total += size;
+
+ if (blocks.length == index + 1 && total != 100) {
+ diff = 100 - total;
+ this.setSize(block, (size + diff));
+ }
+
+ }, this);
+ }
+
+ this.lastX = clientX;
+ this.lastY = clientY;
+ },
+
+ stop: function(event) {
+ if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $(document).off(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $(document).off(event, this.bound('stop'));
+ }, this));
+
+ this.element.parent('.submenu-selector').removeClass('moving');
+
+ this.menumanager.emit('dragEnd', this.menumanager.map, 'resize');
+ //if (this.origin.size !== this.getSize(this.element)) { this.history.push(this.builder.serialize()); }
+ },
+
+ updateItemSizes: function(elements) {
+ var parent = this.element ? this.element.parent('.submenu-selector') : null;
+ if (!parent && !elements) { return false; }
+
+ var blocks = elements || parent.search('> [data-mm-id]'),
+ sizes = [],
+ active = $('.menu-selector .active'),
+ path = active ? active.data('mm-id') : null;
+
+ blocks.forEach(function(block){
+ sizes.push(this.getSize(block));
+ }, this);
+
+ // update active path with new columns sizes
+ this.menumanager.items[path].columns = sizes;
+
+ this.updateMaxValues(elements);
+
+ return sizes;
+ },
+
+ updateMaxValues: function(elements) {
+ var parent = this.element ? this.element.parent('.submenu-selector') : null;
+ if (!parent && !elements) { return false; }
+
+ var blocks = elements || parent.search('> [data-mm-id]'), sizes, inputs;
+
+ blocks.forEach(function(block){
+ block = $(block);
+ var sibling = block.nextSibling() || block.previousSibling();
+ if (!sibling) { return; }
+
+ inputs = {
+ block: block.find('input.column-pc'),
+ sibling: sibling.find('input.column-pc')
+ };
+
+ sizes = {
+ current: this.getSize(block),
+ sibling: this.getSize(sibling)
+ };
+
+ sizes.total = sizes.current + sizes.sibling;
+ inputs.block.attribute('max', sizes.total - Number(inputs.block.attribute('min')));
+ inputs.sibling.attribute('max', sizes.total - Number(inputs.sibling.attribute('min')));
+ }, this);
+ },
+
+ evenResize: function(elements, animated) {
+ var total = elements.length,
+ size = precision(100 / total, 4);
+
+ elements.forEach(function(element) {
+ element = $(element);
+ this.setSize(element, size, (typeof animated == 'undefined' ? false : animated));
+ }, this);
+
+ this.updateItemSizes(elements);
+ this.menumanager.emit('dragEnd', this.menumanager.map, 'evenResize');
+ }
+});
+
+module.exports = Resizer;
+
+},{"../ui/drag.events":52,"../utils/elements.utils":66,"elements/delegation":110,"elements/events":112,"mout/function/bind":192,"mout/lang/isString":211,"mout/math/clamp":216,"mout/math/map":218,"mout/number/enforcePrecision":222,"mout/object/get":233,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],34:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ Submit = require('../fields/submit'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ request = require('agent'),
+ indexOf = require('mout/array/indexOf'),
+ trim = require('mout/string/trim'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ flags = require('../utils/flags-state'),
+ deepEquals = require('mout/lang/deepEquals'),
+ translate = require('../utils/translate'),
+
+ Cards = require('../positions/cards'); // required for Positions
+
+var WordpressWidgetsCustomizer = require('../utils/wp-widgets-customizer');
+
+var menumanager = null;
+
+var randomID = function randomString(len, an) {
+ an = an && an.toLowerCase();
+ var str = "", i = 0, min = an == 'a' ? 10 : 0, max = an == 'n' ? 10 : 62;
+
+ for (; i++ < len;) {
+ var r = Math.random() * (max - min) + min << 0;
+ str += String.fromCharCode(r += r > 9 ? r < 36 ? 55 : 61 : 48);
+ }
+ return str;
+};
+
+var StepOne = function(map, mode) { // mode [reorder, resize, evenResize]
+ if (this.isNewParticle && mode !== 'reorder') { return; }
+ this.resizer.updateItemSizes();
+
+ menumanager = this;
+
+ var save = $('[data-save]'),
+ current = {
+ settings: this.settings,
+ ordering: this.ordering,
+ items: this.items
+ };
+
+ if (!this.isNewParticle) {
+ if (!deepEquals(map, current)) {
+ save.showIndicator('far fa-fw changes-indicator fa-circle');
+ flags.set('pending', true);
+ } else {
+ save.hideIndicator();
+ flags.set('pending', false);
+ }
+ }
+
+ if (this.isParticle && this.isNewParticle) {
+ var blocktype = this.block.data('mm-blocktype');
+ this.block.attribute('data-mm-blocktype', null).addClass('g-menu-item-' + blocktype).data('mm-original-type', blocktype);
+ zen('span.menu-item-type.badge').text(blocktype).after(this.block.find('.menu-item .title'));
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'post',
+ //data: data,
+ remote: parseAjaxURI($(this.block).find('.config-cog').attribute('href') + getAjaxSuffix()),
+ remoteLoaded: function(response, modal) {
+ var search = modal.elements.content.find('.search input'),
+ blocks = modal.elements.content.search('[data-mm-type]'),
+ filters = modal.elements.content.search('[data-mm-filter]');
+
+ if (!search || !filters || !blocks) { return; }
+
+ search.on('input', function() {
+ if (!this.value()) {
+ blocks.removeClass('hidden');
+ return;
+ }
+
+ blocks.addClass('hidden');
+
+ var found = [], value = this.value().toLowerCase(), text;
+
+ filters.forEach(function(filter) {
+ filter = $(filter);
+ text = trim(filter.data('mm-filter')).toLowerCase();
+ if (text.match(new RegExp("^" + value + '|\\s' + value, 'gi'))) {
+ found.push(filter.matches('[data-mm-type]') ? filter : filter.parent('[data-mm-type]'));
+ }
+ }, this);
+
+ if (found.length) { $(found).removeClass('hidden'); }
+ });
+
+ setTimeout(function(){
+ search[0].focus();
+ }, 5);
+ }
+ });
+ }
+
+ this.type = undefined;
+};
+
+var StepTwo = function(data, content, button) {
+ var uri = content.find('[data-mm-particle-stepone]').data('mm-particle-stepone'),
+ picker = data.instancepicker,
+ moduleType = {
+ wordpress: 'widget',
+ joomla: 'particle'
+ };
+
+ if (picker) {
+ var item = JSON.parse(data.item);
+ picker = JSON.parse(picker);
+ delete(data.instancepicker);
+ //uri = getAjaxURL(item.type + '/' + item[moduleType[GANTRY_PLATFORM]]);
+ uri = getAjaxURL(item.type + '/' + item[item.type]);
+ }
+
+ request('post', parseAjaxURI(uri + getAjaxSuffix()), data, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ button.hideIndicator();
+
+ return;
+ }
+
+ content.html(response.body.html);
+
+ var selects = $('[data-selectize]');
+ if (selects) { selects.selectize(); }
+
+ var urlTemplate = content.find('.g-urltemplate');
+ if (urlTemplate) { $('body').emit('input', { target: urlTemplate }); }
+
+ var form = content.find('form'),
+ submit = content.find('input[type="submit"], button[type="submit"]'),
+ fakeDOM = zen('div').html(response.body.html).find('form');
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+
+ var applyAndSave = content.search('[data-apply-and-save]');
+ if (applyAndSave) { applyAndSave.remove(); }
+
+ // Module / Particle Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ submit.showIndicator();
+
+ var post = Submit(fakeDOM[0].elements, content, { submitUnchecked: true });
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&') || {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ // it's menu
+ // FIXME: this is now handling both the Menu and the Positions when inserting a new Particle. Needs to be separated
+ if (!picker) {
+ if (menumanager) {
+ // case for Menu Manager
+ var element = menumanager.element,
+ path = element.data('mm-id') + '-',
+ id = randomID(5),
+ base = element.parent('[data-mm-base]').data('mm-base'),
+ col = (element.parent('[data-mm-id]').data('mm-id').match(/\d+$/) || [0])[0],
+ index = indexOf(element.parent().children('[data-mm-id]'), element[0]);
+
+ while (menumanager.items[path + id]) { id = randomID(5); }
+
+ menumanager.items[path + id] = response.body.item;
+ if (!menumanager.ordering[base]) menumanager.ordering[base] = [];
+ if (!menumanager.ordering[base][col]) menumanager.ordering[base][col] = [];
+ menumanager.ordering[base][col].splice(index, 1, path + id);
+ element.data('mm-id', path + id);
+
+ if (response.body.html) {
+ element.html(response.body.html);
+ }
+
+ menumanager.isNewParticle = false;
+ menumanager.emit('dragEnd', menumanager.map);
+ toastr.success(translate('GANTRY5_PLATFORM_JS_MENU_SETTINGS_APPLIED'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+
+ } else {
+ // case for Positions
+ var position = $('[data-g5-position-name="' + response.body.position + '"]'),
+ dummy = zen('div').html(response.body.html);
+
+ position.find('> ul').appendChild(dummy.children());
+
+ Cards.serialize(position);
+ Cards.updatePendingChanges();
+
+ toastr.success(translate('GANTRY5_PLATFORM_JS_POSITIONS_SETTINGS_APPLIED'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+ } else { // it's field picker
+ var field = $('[name="' + picker.field + '"]'),
+ btnPicker = field.siblings('[data-g-instancepicker]'),
+ label = field.siblings('.g-instancepicker-title');
+
+ if (field) {
+ field.value(JSON.stringify(response.body.item));
+ $('body').emit('change', { target: field });
+ }
+ if (label) { label.text(response.body.item.title); }
+
+ if (item.type == 'particle') {
+ btnPicker.text(btnPicker.data('g-instancepicker-alttext'));
+ }
+ }
+ }
+
+ modal.close();
+ submit.hideIndicator();
+ WordpressWidgetsCustomizer(field);
+ });
+ });
+ });
+};
+
+
+ready(function() {
+ var body = $('body');
+
+ body.delegate('click', '.menu-editor-extras [data-lm-blocktype], .menu-editor-extras [data-mm-module]', function(event, element) {
+ var container = element.parent('.menu-editor-extras'),
+ elements = container.search('[data-lm-blocktype], [data-mm-module]'),
+ selectButton = container.find('[data-mm-select]');
+
+ elements.removeClass('selected');
+ element.addClass('selected');
+
+ selectButton.attribute('disabled', null);
+ });
+
+ // second step
+ body.delegate('click', '.menu-editor-extras [data-mm-select]', function(event, element) {
+ event.preventDefault();
+
+ if (element.hasClass('disabled') || element.attribute('disabled')) { return false; }
+
+ var container = element.parent('.menu-editor-extras'),
+ selected = container.find('[data-lm-blocktype].selected, [data-mm-module].selected'),
+ type = selected.data('mm-type');
+
+ data = { type: type };
+
+ switch (type) {
+ case 'particle':
+ data['particle'] = selected.data('lm-subtype');
+ break;
+
+ case 'widget':
+ data['widget'] = selected.data('lm-subtype');
+ break;
+
+ case 'module':
+ data['particle'] = type;
+ data['title'] = selected.find('[data-mm-title]').data('mm-title');
+ data['options'] = { particle: { module_id: selected.data('mm-module') } };
+ break;
+ }
+
+ element.showIndicator();
+
+
+ var data, instancepicker = element.data('g-instancepicker');
+
+ if (instancepicker && type == 'module') {
+ data = JSON.parse(instancepicker);
+ var field = $('[name="' + data.field + '"]');
+ if (field) {
+ field.value(selected.data('mm-module'));
+ body.emit('input', { target: field });
+ }
+
+ element.hideIndicator();
+ modal.close();
+
+ return false;
+ } else {
+ var ip = instancepicker;
+ element.data('g-instancepicker', null);
+ StepTwo({
+ item: JSON.stringify(data),
+ instancepicker: ip ? ip : null
+ }, element.parent('.g5-content'), element);
+ }
+ });
+});
+
+module.exports = StepOne;
+
+},{"../fields/submit":9,"../positions/cards":47,"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"../utils/wp-widgets-customizer":79,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/lang/deepEquals":201,"mout/string/trim":272}],35:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ MenuManager = require('./menumanager'),
+ Submit = require('../fields/submit'),
+ $ = require('elements'),
+ zen = require('elements/zen'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ extraItems = require('./extra-items'),
+ request = require('agent'),
+ trim = require('mout/string/trim'),
+ clamp = require('mout/math/clamp'),
+ contains = require('mout/array/contains'),
+ indexOf = require('mout/array/indexOf'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ translate = require('../utils/translate');
+
+var menumanager;
+
+var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
+
+var FOCUSIN = isFirefox ? 'focus' : 'focusin',
+ FOCUSOUT = isFirefox ? 'blur' : 'focusout';
+
+ready(function() {
+ var body = $('body');
+
+ menumanager = new MenuManager('[data-mm-container]', {
+ delegate: '.g5-mm-particles-picker ul li, #menu-editor > section ul li, .submenu-column, .submenu-column li[data-mm-id], .column-container .g-block',
+ droppables: '#menu-editor [data-mm-id]',
+ exclude: '[data-lm-nodrag], .menu-item-back, .fa-cog, .config-cog',
+ resize_handles: '.submenu-column:not(:last-child)',
+ catchClick: true
+ });
+
+
+ // Handles Modules / Particles items in the Menu
+ menumanager.on('dragEnd', extraItems);
+
+ module.exports.menumanager = menumanager;
+
+ // Menu Manager
+ menumanager.setRoot();
+
+ // Refresh ordering/items on menu type change or Menu navigation link
+ body.delegate('statechangeAfter', '#main-header [data-g5-ajaxify], select.menu-select-wrap', function(/*event, element*/) {
+ menumanager.setRoot();
+ menumanager.refresh();
+
+ // refresh MM eraser
+ if (menumanager.eraser) {
+ menumanager.eraser.element = $('[data-mm-eraseparticle]');
+ menumanager.eraser.hide();
+ }
+ });
+
+ body.delegate(FOCUSIN, '.percentage input', function(event, element) {
+ element = $(element);
+ element.currentSize = Number(element.value());
+
+ element[0].focus();
+ element[0].select();
+ }, true);
+
+ body.delegate('keydown', '.percentage input', function(event/*, element*/) {
+ if (contains([46, 8, 9, 27, 13, 110, 190], event.keyCode) ||
+ // Allow: [Ctrl|Cmd]+A | [Ctrl|Cmd]+R
+ (event.keyCode == 65 && (event.ctrlKey === true || event.ctrlKey === true)) ||
+ (event.keyCode == 82 && (event.ctrlKey === true || event.metaKey === true)) ||
+ // Allow: home, end, left, right, down, up
+ (event.keyCode >= 35 && event.keyCode <= 40)) {
+ // let it happen, don't do anything
+ return;
+ }
+ // Ensure that it is a number and stop the keypress
+ if ((event.shiftKey || (event.keyCode < 48 || event.keyCode > 57)) && (event.keyCode < 96 || event.keyCode > 105)) {
+ event.preventDefault();
+ }
+ });
+
+ body.delegate('keydown', '.percentage input', function(event, element) {
+ element = $(element);
+ var value = Number(element.value()),
+ min = Number(element.attribute('min')),
+ max = Number(element.attribute('max')),
+ upDown = event.keyCode == 38 || event.keyCode == 40;
+
+ if (upDown) {
+ value += event.keyCode == 38 ? +1 : -1;
+ value = clamp(value, min, max);
+ element.value(value);
+ body.emit('keyup', { target: element });
+ }
+ });
+
+ body.delegate('keyup', '.percentage input', function(event, element) {
+ element = $(element);
+ var value = Number(element.value()),
+ min = Number(element.attribute('min')),
+ max = Number(element.attribute('max'));
+
+ var resizer = menumanager.resizer,
+ parent = element.parent('[data-mm-id]'),
+ sibling = parent.nextSibling('[data-mm-id]') || parent.previousSibling('[data-mm-id]');
+
+ if (!value || value < min || value > max) { return; }
+
+ var sizes = {
+ current: Number(element.currentSize),
+ sibling: Number(resizer.getSize(sibling))
+ };
+
+ element.currentSize = value;
+
+ sizes.total = sizes.current + sizes.sibling;
+ sizes.diff = sizes.total - value;
+
+ resizer.setSize(parent, value);
+ resizer.setSize(sibling, sizes.diff);
+
+ menumanager.resizer.updateItemSizes(parent.parent('.submenu-selector').search('> [data-mm-id]'));
+ menumanager.emit('dragEnd', menumanager.map, 'inputChange');
+ });
+
+ body.delegate(FOCUSOUT, '.percentage input', function(event, element) {
+ element = $(element);
+ var value = Number(element.value());
+ if (value < Number(element.attribute('min')) || value > Number(element.attribute('max'))) {
+ element.value(element.currentSize);
+ }
+ }, true);
+
+ // Add new columns
+ body.delegate('click', '.add-column', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ element = $(element);
+
+ var container = element.parent('[data-g5-menu-columns]').find('.submenu-selector'),
+ children = container.children(),
+ last = container.find('> :last-child'),
+ count = children ? children.length : 0,
+ active = $('.menu-selector .active'),
+ path = active ? active.data('mm-id') : null;
+
+ // do not allow to create a new column if there's already one and it's empty
+ if (count == 1 && !children.search('.submenu-items > [data-mm-id]')) { return false; }
+
+ var block = $(last[0].cloneNode(true));
+ block.data('mm-id', 'list-' + count);
+ block.find('.submenu-items').empty();
+ block.find('[data-mm-base-level]').data('mm-base-level', 1);
+ block.find('.submenu-level').text('Level 1');
+ block.after(last);
+
+ if (!menumanager.ordering[path]) {
+ menumanager.ordering[path] = [[]];
+ }
+
+ menumanager.ordering[path].push([]);
+ menumanager.resizer.evenResize($('.submenu-selector > [data-mm-id]'));
+ });
+
+ // Attach events to pseudo (x) for deleting a column
+ ['click', 'touchend'].forEach(function(evt) {
+ body.delegate(evt, '[data-g5-menu-columns] .submenu-items:empty', function(event, element) {
+ var bounding = element[0].getBoundingClientRect(),
+ x = event.pageX || event.changedTouches[0].pageX || 0, y = event.pageY || event.changedTouches[0].pageY || 0,
+ siblings = $('.submenu-selector > [data-mm-id]'),
+ deleter = {
+ width: 36,
+ height: 36
+ };
+
+ if (siblings.length <= 1) {
+ return false;
+ }
+
+ if (x >= bounding.left + bounding.width - deleter.width && x <= bounding.left + bounding.width &&
+ Math.abs(window.scrollY - y) - bounding.top < deleter.height) {
+ var parent = element.parent('[data-mm-id]'),
+ container = parent.parent('.submenu-selector').children('[data-mm-id]'),
+ index = indexOf(container, parent),
+ active = $('.menu-selector .active'),
+ path = active ? active.data('mm-id') : null;
+
+ parent.remove();
+ siblings = $('.submenu-selector > [data-mm-id]');
+ menumanager.ordering[path].splice(index, 1);
+ menumanager.resizer.evenResize(siblings);
+ }
+ });
+ });
+
+ // Menu Items settings
+ body.delegate('click', '#menu-editor .config-cog, #menu-editor .global-menu-settings', function(event, element) {
+ event.preventDefault();
+
+ var data = {}, isRoot = element.hasClass('global-menu-settings');
+
+ if (isRoot) {
+ data.settings = JSON.stringify(menumanager.settings);
+ } else {
+ data.item = JSON.stringify(menumanager.items[element.parent('[data-mm-id]').data('mm-id')]);
+ }
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'post',
+ data: data,
+ overlayClickToClose: false,
+ remote: parseAjaxURI($(element).attribute('href') + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),
+ path;
+
+ var search = content.elements.content.find('.search input'),
+ blocks = content.elements.content.search('[data-mm-type]'),
+ filters = content.elements.content.search('[data-mm-filter]'),
+ urlTemplate = content.elements.content.find('.g-urltemplate');
+
+ if (urlTemplate) { body.emit('input', { target: urlTemplate }); }
+
+ var editable = content.elements.content.find('[data-title-editable]');
+ if (editable) {
+ editable.on('title-edit-end', function(title, original/*, canceled*/) {
+ title = trim(title);
+ if (!title) {
+ title = trim(original) || 'Title';
+ this.text(title).data('title-editable', title);
+
+ return true;
+ }
+ });
+ }
+
+ if (search && filters && blocks) {
+ search.on('input', function() {
+ if (!this.value()) {
+ blocks.removeClass('hidden');
+ return;
+ }
+
+ blocks.addClass('hidden');
+
+ var found = [], value = this.value().toLowerCase(), text;
+
+ filters.forEach(function(filter) {
+ filter = $(filter);
+ text = trim(filter.data('mm-filter')).toLowerCase();
+ if (text.match(new RegExp("^" + value + '|\\s' + value, 'gi'))) {
+ found.push(filter.matches('[data-mm-type]') ? filter : filter.parent('[data-mm-type]'));
+ }
+ }, this);
+
+ if (found.length) { $(found).removeClass('hidden'); }
+ });
+ }
+
+ if (search) {
+ setTimeout(function() {
+ search[0].focus();
+ }, 5);
+ }
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+
+ // Menuitems Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ var target = $(e.currentTarget);
+ target.disabled(true);
+ target.hideIndicator();
+ target.showIndicator();
+
+ var post = Submit(fakeDOM[0].elements, content.elements.content, {isRoot: isRoot});
+
+ if (post.invalid.length) {
+ target.disabled(false);
+ target.hideIndicator();
+ target.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&'), function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ if (response.body.path || (response.body.item && response.body.item.type == 'particle')) {
+ path = response.body.path || element.parent('[data-mm-id]').data('mm-id');
+ menumanager.items[path] = response.body.item;
+ } else if (response.body.item && response.body.item.type == 'particle') {
+
+ } else {
+ menumanager.settings = response.body.settings;
+ }
+
+ if (response.body.html) {
+ var parent = element.parent('[data-mm-id]');
+ if (parent) {
+ var status = response.body.item.enabled || response.body.item.options.particle.enabled;
+ parent.html(response.body.html);
+ parent[status == '0' ? 'addClass' : 'removeClass']('g-menu-item-disabled');
+ }
+ }
+
+ menumanager.emit('dragEnd', menumanager.map);
+
+ // if it's apply and save we also save the panel
+ if (target.data('apply-and-save') !== null) {
+ var save = $('body').find('.button-save');
+ if (save) { body.emit('click', { target: save }); }
+ }
+
+ modal.close();
+ toastr.success(translate('GANTRY5_PLATFORM_JS_MENU_SETTINGS_APPLIED'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+
+ target.hideIndicator();
+ });
+ });
+ }
+ });
+ });
+});
+
+module.exports = {
+ menumanager: menumanager
+};
+
+},{"../fields/submit":9,"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"./extra-items":34,"./menumanager":36,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/array/indexOf":175,"mout/math/clamp":216,"mout/string/trim":272}],36:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ bind = require('mout/function/bind'),
+ zen = require('elements/zen'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ DragDrop = require('../ui/drag.drop'),
+ Eraser = require('../ui/eraser'),
+ Resizer = require('./drag.resizer'),
+ get = require('mout/object/get'),
+
+ ltrim = require('mout/string/ltrim'),
+ every = require('mout/array/every'),
+ last = require('mout/array/last'),
+ indexOf = require('mout/array/indexOf'),
+ isArray = require('mout/lang/isArray'),
+ isObject = require('mout/lang/isObject'),
+ deepClone = require('mout/lang/deepClone'),
+ equals = require('mout/object/equals');
+
+
+var MenuManager = new prime({
+
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ options: {},
+
+ constructor: function(element, options) {
+ this.setOptions(options);
+ this.refElement = element;
+ this.map = {};
+
+ if (!element || !$(element)) { return; }
+
+ this.init(element);
+ },
+
+ init: function() {
+ this.setRoot();
+
+ this.dragdrop = new DragDrop(this.refElement, this.options, this);
+ this.resizer = new Resizer(this.refElement, this.options, this);
+ this.eraser = new Eraser('[data-mm-eraseparticle]', this.options);
+ this.dragdrop
+ .on('dragdrop:click', this.bound('click'))
+ .on('dragdrop:start', this.bound('start'))
+ .on('dragdrop:move:once', this.bound('moveOnce'))
+ .on('dragdrop:location', this.bound('location'))
+ .on('dragdrop:nolocation', this.bound('nolocation'))
+ .on('dragdrop:resize', this.bound('resize'))
+ .on('dragdrop:stop:erase', this.bound('removeElement'))
+ .on('dragdrop:stop', this.bound('stop'))
+ .on('dragdrop:stop:animation', this.bound('stopAnimation'));
+ },
+
+ refresh: function() {
+ if (!this.refElement || !$(this.refElement)) { return; }
+ this.init();
+ },
+
+ setRoot: function() {
+ this.root = $('#menu-editor');
+
+ if (this.root) {
+ this.settings = JSON.parse(this.root.data('menu-settings'));
+ this.ordering = JSON.parse(this.root.data('menu-ordering'));
+ this.items = JSON.parse(this.root.data('menu-items'));
+
+ this.map = {
+ settings: deepClone(this.settings),
+ ordering: deepClone(this.ordering),
+ items: deepClone(this.items)
+ };
+
+ var submenus = $('[data-g5-menu-columns] .submenu-selector'), columns;
+ if (this.resizer && submenus && (columns = submenus.search('> [data-mm-id]'))) { this.resizer.updateMaxValues(columns); }
+ }
+ },
+
+ click: function(event, element) {
+ var target = $(event.target);
+ if (target.matches('.g-menu-addblock') || target.parent('.g-menu-addblock')) {
+ return false;
+ }
+
+ if (element.hasClass('g-block')) {
+ this.stopAnimation();
+ return true;
+ }
+
+ if (element.find('[data-g5-ajaxify]')) {
+ var siblings = element.siblings();
+ element.addClass('active');
+ if (siblings) { siblings.removeClass('active'); }
+ }
+
+ element.emit('click');
+
+ var link = element.find('a');
+ if (link) { link[0].click(); }
+ },
+
+ resize: function(event, element, siblings, offset) {
+ this.resizer.start(event, element, siblings, offset);
+ },
+
+ start: function(event, element) {
+ var root = element.parent('.menu-selector') || element.parent('.submenu-column') || element.parent('.submenu-selector') || element.parent('.g5-mm-particles-picker'),
+ size = $(element).position(),
+ coords = $(element)[0].getBoundingClientRect();
+
+ this.block = null;
+ this.targetLevel = undefined;
+ this.addNewItem = false;
+ this.type = element.parent('.g-toplevel') || element.matches('.g-toplevel') ? 'main' : (element.matches('.g-block') ? 'column' : 'columns_items');
+ this.isParticle = element.matches('[data-mm-blocktype]') || element.matches('[data-mm-original-type]');
+ this.wasActive = element.hasClass('active');
+ this.isNewParticle = element.parent('.g5-mm-particles-picker');
+ this.ParticleIndex = -1;
+ this.root = root;
+ this.Element = element;
+
+ this.itemID = element.data('mm-id');
+ this.itemLevel = element.data('mm-level');
+ this.itemFrom = element.parent('[data-mm-id]');
+ this.itemTo = null;
+
+ if (this.isParticle && !this.isNewParticle) {
+ var children = element.parent().children('[data-mm-id]');
+ this.ParticleIndex = indexOf(children, element[0]);
+ }
+
+ root.addClass('moving');
+
+ var type = $(element).data('mm-id'),
+ clone = element[0].cloneNode(true);
+
+ if (!this.placeholder) { this.placeholder = zen((this.type == 'column' ? 'div' : 'li') + '.block.placeholder[data-mm-placeholder]'); }
+ this.placeholder.style({ display: 'none' });
+ this.original = $(clone).after(element).style({
+ display: 'inline-block',
+ opacity: 1
+ }).addClass('original-placeholder').data('lm-dropzone', null);
+ this.originalType = type;
+ this.block = element;
+
+ if (!this.isNewParticle) {
+ element.style({
+ position: 'fixed',
+ zIndex: 1500,
+ width: Math.ceil(size.width),
+ height: Math.ceil(size.height),
+ left: coords.left,
+ top: coords.top
+ }).addClass('active');
+
+ this.placeholder.before(element);
+ } else {
+ var position = element.position();
+ this.original.style({
+ position: 'fixed',
+ opacity: 0.5
+ }).style({
+ left: coords.left,
+ top: coords.top,
+ width: position.width,
+ height: position.height
+ });
+ this.element = this.dragdrop.element;
+ this.block = this.dragdrop.element;
+ this.dragdrop.element = this.original;
+ }
+
+ if (this.type == 'column') {
+ root.search('.g-block > *').style({ 'pointer-events': 'none' });
+ }
+ },
+
+ moveOnce: function(element) {
+ element = $(element);
+ if (this.original) { this.original.style({ opacity: 0.5 }); }
+
+ // it's a module or a particle and we allow for them to be deleted
+ if (!this.isNewParticle && (element.hasClass('g-menu-removable') || this.isParticle)) {
+ this.eraser.show();
+ }
+ },
+
+ location: function(event, location, target/*, element*/) {
+ target = $(target);
+ (!this.isNewParticle ? this.original : this.block).style({transform: 'translate(0, 0)'});
+ if (!this.placeholder) { this.placeholder = zen((this.type == 'column' ? 'div' : 'li') + '.block.placeholder[data-mm-placeholder]').style({ display: 'none' }); }
+
+ var targetType = target.parent('.g-toplevel') || target.matches('.g-toplevel') ? 'main' : (target.matches('.g-block') ? 'column' : 'columns_items'),
+ dataLevel = target.data('mm-level'),
+ originalLevel = this.block.data('mm-level');
+
+ if (this.isParticle && (targetType === 'main' && !dataLevel)) {
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ // Support for nested new particles/modules/widgets
+ if (dataLevel === null && this.type === 'columns_items' && this.isParticle && this.isNewParticle) {
+ var submenu_items = target.find('.submenu-items');
+ if (!submenu_items) {
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ this.placeholder.style({ display: 'block' }).bottom(submenu_items);
+ this.addNewItem = submenu_items;
+ this.targetLevel = 2;
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ // Workaround for layout and style of columns
+ if (dataLevel === null && (this.type === 'columns_items' || this.isParticle)) {
+ var submenu_items = target.find('.submenu-items'),
+ submenu_items_level = submenu_items.data('mm-base-level');
+
+ // extend drop areas and ensure items cannot be dragged between different levels
+ if ((!target.hasClass('g-block') || target.find(this.block)) || (!this.isParticle && originalLevel != submenu_items_level) && (!submenu_items || submenu_items.children() || originalLevel > 2)) {
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ this.placeholder.style({ display: 'block' }).bottom(submenu_items);
+ this.addNewItem = submenu_items;
+ this.targetLevel = 2;
+ this.dragdrop.matched = false;
+ return;
+ }
+
+
+ if (!this.isParticle) {
+
+ // We only allow sorting between same level items
+ if (this.type !== 'column' && originalLevel !== dataLevel) {
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ // Ensuring columns can only be dragged before/after other columns
+ if (this.type == 'column' && dataLevel) {
+ this.dragdrop.matched = false;
+ return;
+ }
+
+ // For levels > 2 we only allow sorting within the same column
+ if (dataLevel > 2 && target.parent('ul') != this.block.parent('ul')) {
+ this.dragdrop.matched = false;
+ return;
+ }
+ }
+
+ // Check for adjacents and avoid inserting any placeholder since it would be the same position
+ var exclude = ':not(.placeholder):not([data-mm-id="' + this.original.data('mm-id') + '"])',
+ adjacents = {
+ before: this.original.previousSiblings(exclude),
+ after: this.original.nextSiblings(exclude)
+ };
+
+ if (adjacents.before) { adjacents.before = $(adjacents.before[0]); }
+ if (adjacents.after) { adjacents.after = $(adjacents.after[0]); }
+
+
+ if (targetType === 'main' && ((adjacents.before === target && location.x === 'after') || (adjacents.after === target && location.x === 'before'))) {
+ return;
+ }
+ if (targetType === 'column' && ((adjacents.before === target && location.x === 'after') || (adjacents.after === target && location.x === 'before'))) {
+ return;
+ }
+ if (targetType === 'columns_items' && ((adjacents.before === target && location.y === 'below') || (adjacents.after === target && location.y === 'above'))) {
+ return;
+ }
+
+ // Handles the types cases and normalizes the locations (x and y)
+ switch (targetType) {
+ case 'main':
+ case 'column':
+ this.placeholder[location.x](target);
+ break;
+ case 'columns_items':
+ this.placeholder[location.y === 'above' ? 'before' : 'after'](target);
+
+ break;
+ }
+
+ this.targetLevel = dataLevel;
+
+ // If it's not a block we don't want a small version of the placeholder
+ this.placeholder.style({ display: 'block' })[targetType !== 'main' ? 'removeClass' : 'addClass']('in-between');
+
+ },
+
+ nolocation: function(event) {
+ (!this.isNewParticle ? this.original : this.block).style({transform: 'translate(0, 0)'});
+ if (this.placeholder) { this.placeholder.remove(); }
+ this.targetLevel = undefined;
+
+ var target = event.type.match(/^touch/i) ? document.elementFromPoint(event.touches.item(0).clientX, event.touches.item(0).clientY) : event.target;
+
+ if (!this.isNewParticle && (this.Element.hasClass('g-menu-removable') || this.isParticle)) {
+ target = $(target);
+ if (target.matches(this.eraser.element) || this.eraser.element.find(target)) {
+ this.dragdrop.removeElement = true;
+ this.eraser.over();
+ } else {
+ this.dragdrop.removeElement = false;
+ this.eraser.out();
+ }
+ }
+ },
+
+ removeElement: function(event, element) {
+ this.dragdrop.removeElement = false;
+
+ var transition = {
+ opacity: 0
+ };
+
+ element.animate(transition, {
+ duration: '150ms'
+ });
+
+ if (this.type == 'column') {
+ this.root.search('.g-block > *').style({ 'pointer-events': 'none' });
+ }
+
+ this.eraser.hide();
+
+ this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').off(event, this.dragdrop.bound('move'));
+ }, this));
+
+ this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $('body').off(event, this.dragdrop.bound('deferStop'));
+ }, this));
+
+ var particle = this.block,
+ base = particle.parent('[data-mm-base]').data('mm-base'),
+ col = (particle.parent('[data-mm-id]').data('mm-id').match(/\d+$/) || [0])[0],
+ index = indexOf(particle.parent().children('[data-mm-id]:not(.original-placeholder)'), particle[0]);
+
+ delete this.items[this.itemID];
+ this.ordering[base][col].splice(index, 1);
+
+ this.block.remove();
+ this.original.remove();
+ this.root.removeClass('moving');
+
+ if (this.root.find('.submenu-items')) {
+ if (!this.root.find('.submenu-items').children()) { this.root.find('.submenu-items').text(''); }
+ }
+
+ this.emit('dragEnd', this.map, 'reorder');
+ },
+
+ stop: function(event, target, element) {
+ target = $(target);
+
+ // we are removing the block
+ var lastOvered = $(this.dragdrop.lastOvered);
+ if (lastOvered && lastOvered.matches(this.eraser.element.find('.trash-zone'))) {
+ this.eraser.hide();
+ return;
+ }
+
+ if (target) { element.removeClass('active'); }
+ if (this.type == 'column') {
+ this.root.search('.g-block > *').attribute('style', null);
+ }
+
+ if (!this.dragdrop.matched && !this.addNewItem) {
+ if (this.placeholder) { this.placeholder.remove(); }
+
+ this.type = undefined;
+ this.targetLevel = false;
+ this.isParticle = undefined;
+ this.eraser.hide();
+ return;
+ }
+
+ var placeholderParent = this.placeholder.parent();
+ if (!placeholderParent) {
+ this.type = undefined;
+ this.targetLevel = false;
+ this.isParticle = undefined;
+ return;
+ }
+
+ if (this.addNewItem) { this.block.attribute('style', null).removeClass('active'); }
+
+ var parent = this.block.parent();
+ this.eraser.hide();
+
+ if (this.original) {
+ if (!this.isNewParticle) { this.original.remove(); }
+ else { this.original.attribute('style', null).removeClass('original-placeholder'); }
+ }
+
+
+ this.block.after(this.placeholder);
+ this.placeholder.remove();
+ this.itemTo = this.block.parent('[data-mm-id]');
+ this.currentLevel = this.itemLevel;
+ if (this.wasActive) { element.addClass('active'); }
+
+ if (this.isParticle) {
+ var id = last(this.itemID.split('/')),
+ targetItem = (target || this.itemTo),
+ base = targetItem[target && !target.hasClass('g-block') ? 'parent' : 'find']('[data-mm-base]').data('mm-base');
+
+ this.itemID = base ? base + '/' + id : id;
+ this.itemLevel = this.targetLevel;
+ this.block.data('mm-id', this.itemID).data('mm-level', this.targetLevel);
+ }
+
+ var path = this.itemID.split('/'),
+ items, column;
+
+ path.splice(this.itemLevel - 1);
+ path = path.join('/');
+
+ // Items reorder for root or sublevels with logic to reorder FROM and TO sublevel column if needed
+ if (this.itemFrom || this.itemTo) {
+ var sources = this.itemFrom == this.itemTo ? [this.itemFrom] : [this.itemFrom, this.itemTo];
+ sources.forEach(function(source) {
+ if (!source) { return; }
+
+ items = source.search('[data-mm-id]');
+ column = Number(this.block.data('mm-level') > 2 ? 0 : (source.data('mm-id').match(/\d+$/) || [0])[0]);
+
+ if (!items) {
+ this.ordering[path][column] = [];
+ return;
+ }
+
+ items = items.map(function(element) {
+ return $(element).data('mm-id');
+ });
+
+ if (!this.ordering[path]) { this.ordering[path] = []; }
+ this.ordering[path][column] = items;
+ }, this);
+
+ // Refresh the origin if it's a particle
+ base = this.itemFrom ? (this.itemFrom.attribute('data-mm-base') !== null ? this.itemFrom : this.itemFrom.find('[data-mm-base]')) : null;
+ if (this.isParticle && base && this.targetLevel != this.currentLevel) {
+ var list = (this.itemFrom.data('mm-id').match(/\d+$/) || [0])[0],
+ location = base.data('mm-base') || '',
+ currentLocation = ltrim([location, id].join('/'), ['/']);
+
+ this.ordering[location][list].splice(this.ParticleIndex, 1);
+ this.items[this.itemID] = this.items[currentLocation];
+ delete this.items[currentLocation];
+ }
+ }
+
+ // Column reordering, we just need to swap the array indexes
+ if (!this.itemFrom && !this.itemTo && !this.isParticle) {
+ var colsOrder = [],
+ active = $('.g-toplevel [data-mm-id].active').data('mm-id');
+ items = parent.search('> [data-mm-id]');
+
+ items.forEach(function(element, index) {
+ element = $(element);
+
+ var id = element.data('mm-id'),
+ column = Number((id.match(/\d+$/) || [0])[0]);
+
+ element.data('mm-id', id.replace(/\d+$/, '' + index));
+ colsOrder.push(this.ordering[active][column]);
+ }, this);
+
+ this.ordering[active] = colsOrder;
+ }
+
+ if (!parent.children()) { parent.empty(); }
+
+ /*if (console && console.group && console.info && console.table && console.groupEnd) {
+ console.group();
+ console.info('New Ordering');
+ console.table(this.ordering);
+ console.groupEnd();
+ }*/
+
+ var selector = this.block.parent('.submenu-selector');
+ if (selector) { this.resizer.updateItemSizes(selector.search('> [data-mm-id]')); }
+
+ this.emit('dragEnd', this.map, 'reorder');
+ },
+
+ stopAnimation: function(/*element*/) {
+ var flex = null;
+ if (this.type == 'column') { flex = this.resizer.getSize(this.block); }
+ if (this.root) { this.root.removeClass('moving'); }
+ if (this.block) {
+ this.block.attribute('style', null);
+ if (flex) { this.block.style('flex', '0 1 ' + flex + ' %'); }
+ }
+
+ if (this.original) {
+ if (!this.isNewParticle || (!this.dragdrop.matched && !this.targetLevel)) { this.original.remove(); }
+ else { this.original.attribute('style', null).removeClass('original-placeholder'); }
+ }
+
+ if (!this.wasActive && this.block) { this.block.removeClass('active'); }
+ }
+});
+
+
+module.exports = MenuManager;
+
+},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"./drag.resizer":33,"elements/zen":137,"mout/array/every":169,"mout/array/indexOf":175,"mout/array/last":179,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/object/equals":227,"mout/object/get":233,"mout/string/ltrim":263,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],37:[function(require,module,exports){
+(function (global){(function (){
+'use strict';
+var $ = require('elements'),
+ ready = require('elements/domready'),
+ zen = require('elements/zen'),
+ Submit = require('../fields/submit'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ Eraser = require('../ui/eraser'),
+ request = require('agent'),
+ indexOf = require('mout/array/indexOf'),
+ simpleSort = require('sortablejs'),
+
+ trim = require('mout/string/trim'),
+ size = require('mout/object/size'),
+
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ getOutlineNameById = require('../utils/get-outline').getOutlineNameById,
+ translate = require('../utils/translate');
+
+var AtomsField = '[name="page[head][atoms][_json]"]',
+ groupOptions = [
+ { name: 'atoms', pull: 'clone', put: false },
+ { name: 'atoms', pull: true, put: true },
+ { name: 'atoms', pull: false, put: false }
+ ];
+
+var Atoms = {
+ eraser: null,
+ lists: {
+ picker: null,
+ items: null
+ },
+
+ serialize: function() {
+ var output = [],
+ list = $('.atoms-list'),
+ atoms = list.search('[data-atom-picked]');
+
+ if (!atoms) {
+ list.empty();
+ return '[]';
+ }
+
+ atoms.forEach(function(item) {
+ item = $(item);
+ output.push(JSON.parse(item.data('atom-picked')));
+ });
+
+ return JSON.stringify(output).replace(/\//g, '\\/');
+ },
+
+ attachEraser: function() {
+ if (Atoms.eraser) {
+ Atoms.eraser.element = $('[data-atoms-erase]');
+ return;
+ }
+
+ Atoms.eraser = new Eraser('[data-atoms-erase]');
+ },
+
+ createSortables: function(element) {
+ var list, sort;
+
+ Atoms.attachEraser();
+
+ groupOptions.forEach(function(groupOption, i) {
+ list = !i ? '.atoms-picker' : (i == 1 ? '.atoms-list' : '#trash');
+ list = $(list);
+ sort = simpleSort.create(list[0], {
+ sort: i == 1,
+ filter: '[data-atom-ignore]',
+ group: groupOption,
+ scroll: false,
+ forceFallback: true,
+ animation: 100,
+
+ onStart: function(event) {
+ Atoms.attachEraser();
+
+ var item = $(event.item);
+ item.addClass('atom-dragging');
+
+ if ($(event.from).hasClass('atoms-list')) {
+ Atoms.eraser.show();
+ }
+ },
+
+ onEnd: function(event) {
+ var item = $(event.item),
+ trash = $('#trash'),
+ target = $(this.originalEvent.target),
+ touchTrash = false;
+
+ // workaround for touch devices
+ if (this.originalEvent.type === 'touchend') {
+ var trashSize = trash[0].getBoundingClientRect(),
+ oE = this.originalEvent,
+ position = (oE.pageY || oE.changedTouches[0].pageY) - window.scrollY;
+
+ touchTrash = position <= trashSize.height;
+ }
+
+ if (target.matches('#trash') || target.parent('#trash') || touchTrash) {
+ item.remove();
+ Atoms.eraser.hide();
+ this.options.onSort();
+ return;
+ }
+
+ item.removeClass('atom-dragging');
+
+ if ($(event.from).hasClass('atoms-list')) {
+ Atoms.eraser.hide();
+ }
+ },
+
+ onSort: function() {
+ var serial = Atoms.serialize(),
+ field = $(AtomsField);
+
+ if (!field) { throw new Error('Field "' + AtomsField + '" not found in the DOM.'); }
+
+ field.value(serial);
+ $('body').emit('change', { target: field });
+ },
+
+ onOver: function(evt) {
+ if (!$(evt.from).matches('.atoms-list')) { return; }
+
+ var over = $(evt.newIndex);
+ if (over.matches('#trash') || over.parent('#trash')) {
+ Atoms.eraser.over();
+ } else {
+ Atoms.eraser.out();
+ }
+ }
+ });
+
+ Atoms.lists[!i ? 'picker' : 'items'] = sort;
+ if (i == 1) {
+ element.SimpleSort = sort;
+ }
+ });
+ }
+};
+
+var AttachSettings = function() {
+ var body = $('body');
+
+ body.delegate('click', '.atoms-list [data-atom-picked] .config-cog', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ var list = element.parent('ul'),
+ dataField = $(AtomsField),
+ data = dataField.value(),
+ items = list.search('> [data-atom-picked]'),
+ item = element.parent('[data-atom-picked]'),
+ itemData = item.data('atom-picked');
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'post',
+ data: { data: itemData },
+ overlayClickToClose: false,
+ remote: parseAjaxURI(element.attribute('href') + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),
+ dataValue = JSON.parse(data);
+
+ if (modal.getAll().length > 1) {
+ var applyAndSave = content.elements.content.search('[data-apply-and-save]');
+ if (applyAndSave) { applyAndSave.remove(); }
+ }
+
+ if ((!form && !fakeDOM) || !submit) {
+ return true;
+ }
+
+ // Atom Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ var target = $(e.currentTarget);
+
+ target.hideIndicator();
+ target.showIndicator();
+
+ // Refresh the form to collect fresh and dynamic fields
+ var formElements = content.elements.content.find('form')[0].elements;
+ var post = Submit(formElements, content.elements.content);
+
+ if (post.invalid.length) {
+ target.hideIndicator();
+ target.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&') || {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var index = indexOf(items, item[0]);
+ dataValue[index] = response.body.item;
+
+ dataField.value(JSON.stringify(dataValue).replace(/\//g, '\\/'));
+ item.find('.atom-title').text(dataValue[index].title);
+ item.data('atom-picked', JSON.stringify(dataValue[index]).replace(/\//g, '\\/'));
+
+ // toggle enabled/disabled status as needed
+ var enabled = Number(dataValue[index].attributes.enabled),
+ inheriting = response.body.item.inherit && size(response.body.item.inherit);
+ item[enabled ? 'removeClass' : 'addClass']('atom-disabled');
+ item[!inheriting ? 'removeClass' : 'addClass']('g-inheriting');
+ item.attribute('title', enabled ? '' : translate('GANTRY5_PLATFORM_JS_LM_DISABLED_PARTICLE', 'atom'));
+
+ item.data('tip', null);
+ if (inheriting) {
+ var inherit = response.body.item.inherit,
+ outline = getOutlineNameById(inherit ? inherit.outline : null),
+ atom = inherit.atom || '',
+ include = (inherit.include || []).join(', ');
+
+ item.data('tip', translate('GANTRY5_PLATFORM_INHERITING_FROM_X', '' + outline + '') + '
ID: ' + atom + '
Replace: ' + include);
+ }
+
+ body.emit('change', { target: dataField });
+ global.G5.tips.reload();
+
+ // if it's apply and save we also save the panel
+ if (target.data('apply-and-save') !== null) {
+ var save = $('body').find('.button-save');
+ if (save) { body.emit('click', { target: save }); }
+ }
+
+ modal.close();
+ toastr.success(translate('GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED', 'Atom'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+
+ target.hideIndicator();
+ });
+ });
+ }
+ });
+ });
+};
+
+var AttachSortableAtoms = function(atoms) {
+ if (!atoms) { return; }
+ if (!atoms.SimpleSort) { Atoms.createSortables(atoms); }
+};
+
+ready(function() {
+ var atoms = $('#atoms');
+
+ $('body').delegate('mouseover', '#atoms', function(event, element) {
+ AttachSortableAtoms(element);
+ });
+
+ AttachSortableAtoms(atoms);
+ AttachSettings();
+});
+
+module.exports = Atoms;
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"../fields/submit":9,"../ui":54,"../ui/eraser":53,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/get-outline":72,"../utils/translate":78,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/object/size":242,"mout/string/trim":272,"sortablejs":316}],38:[function(require,module,exports){
+"use strict";
+
+var ready = require('elements/domready'),
+ $ = require('elements'),
+ zen = require('elements/zen'),
+ Submit = require('../../fields/submit'),
+ modal = require('../../ui').modal,
+ toastr = require('../../ui').toastr,
+ request = require('agent'),
+ lastItem = require('mout/array/last'),
+ indexOf = require('mout/array/indexOf'),
+ simpleSort = require('sortablejs'),
+
+ trim = require('mout/string/trim'),
+
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ translate = require('../../utils/translate');
+
+require('elements/insertion');
+
+ready(function() {
+ var body = $('body');
+
+ var addNewByEnter = function(title, key) {
+ if (key == 'enter' && this.CollectionNew) {
+ this.CollectionNew = false;
+ body.emit('click', { target: this.parent('.settings-param').find('[data-collection-addnew]') });
+ }
+
+ if (key == 'esc' && this.CollectionNew) {
+ this.CollectionNew = false;
+ body.emit('click', { target: this.parent('[data-collection-item]').find('[data-collection-remove]') });
+ }
+ };
+
+ var createSortables = function(list) {
+ var lists = list || $('.collection-list ul');
+ if (!lists) { return; }
+ lists.forEach(function(list) {
+ list = $(list);
+ list.SimpleSort = simpleSort.create(list[0], {
+ handle: '.fa-reorder',
+ filter: '[data-collection-nosort]',
+ scroll: false,
+ animation: 150,
+ onStart: function() {
+ $(this.el).addClass('collection-sorting');
+ },
+ onEnd: function(evt) {
+ var element = $(this.el);
+ element.removeClass('collection-sorting');
+
+ if (evt.oldIndex === evt.newIndex) { return; }
+
+ var dataField = element.parent('.settings-param').find('[data-collection-data]'),
+ data = dataField.value();
+
+ data = JSON.parse(data);
+
+ data.splice(evt.newIndex, 0, data.splice(evt.oldIndex, 1)[0]);
+ dataField.value(JSON.stringify(data));
+ body.emit('change', { target: dataField });
+ }
+ });
+ });
+ };
+
+ createSortables();
+
+ // delegate sortables collections for ajax support
+ body.delegate('mouseover', '.collection-list ul', function(event, element) {
+ if (!element.SimpleSort) { createSortables(element); }
+ });
+
+ // Add new item
+ body.delegate('click', '[data-collection-addnew]', function(event, element) {
+ var param = element.parent('.settings-param'),
+ list = param.find('ul'),
+ editall = list.parent('[data-field-name]').find('[data-collection-editall]'),
+ dataField = param.find('[data-collection-data]'),
+ tmpl = param.find('[data-collection-template]'),
+ items = list.search('> [data-collection-item]') || [],
+ last = $(lastItem(items));
+
+ var clone = $(tmpl[0].cloneNode(true)), title, editable;
+
+ if (last) { clone.after(last); }
+ else { clone.top(list); }
+
+ if (items.length && editall) { editall.style('display', 'inline-block'); }
+
+ title = clone.find('a');
+ editable = title.find('[data-title-editable]');
+
+ var re = new RegExp('%id%', 'g');
+ title.href(title.href().replace(re, items.length));
+
+ clone.attribute('style', null).data('collection-item', clone.data('collection-template'));
+ clone.attribute('data-collection-template', null);
+ clone.attribute('data-collection-nosort', null);
+ editable.CollectionNew = true;
+ body.emit('click', { target: title.siblings('[data-title-edit]') });
+
+ editable.on('title-edit-exit', addNewByEnter);
+ body.emit('change', { target: dataField });
+ });
+
+ // Edit Title
+ body.delegate('blur', '[data-collection-item] [data-title-editable]', function(event, element) {
+ var text = trim(element.text()),
+ item = element.parent('[data-collection-item]'),
+ key = item.data('collection-item'),
+ items = element.parent('ul').search('> [data-collection-item]'),
+ dataField = element.parent('.settings-param').find('[data-collection-data]'),
+ data = dataField.value(),
+ index = indexOf(items, item[0]);
+
+ if (index == -1) { return; }
+
+ data = JSON.parse(data);
+ if (!data[index]) { data.splice(index, 0, {}); }
+ data[index][key] = text;
+ dataField.value(JSON.stringify(data));
+ body.emit('change', { target: dataField });
+ }, true);
+
+ // Remove item
+ body.delegate('click', '[data-collection-remove]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var item = element.parent('[data-collection-item]'),
+ list = element.parent('ul'),
+ editall = list.parent('[data-field-name]').find('[data-collection-editall]'),
+ items = list.search('> [data-collection-item]'),
+ index = indexOf(items, item[0]),
+ dataField = element.parent('.settings-param').find('[data-collection-data]'),
+ data = dataField.value();
+
+ data = JSON.parse(data);
+ data.splice(index, 1);
+ dataField.value(JSON.stringify(data));
+ item.remove();
+ if (items.length <= 2 && editall) { editall.style('display', 'none'); }
+ body.emit('change', { target: dataField });
+ });
+
+ // Duplicate item
+ body.delegate('click', '[data-collection-duplicate]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var param = element.parent('.settings-param'),
+ item = element.parent('[data-collection-item]'),
+ list = element.parent('ul'),
+ editall = list.parent('[data-field-name]').find('[data-collection-editall]'),
+ url = param.find('[data-collection-template]').find('a').href(),
+ items = list.search('> [data-collection-item]'),
+ index = indexOf(items, item[0]),
+ clone = $(item[0].cloneNode(true)).after(item),
+ dataField = element.parent('.settings-param').find('[data-collection-data]'),
+ data = dataField.value();
+
+ var re = new RegExp('%id%', 'g');
+ clone.find('a').href(url.replace(re, items.length + 1));
+
+ data = JSON.parse(data);
+ data.splice(index, 0, data[index]);
+ dataField.value(JSON.stringify(data));
+
+ if (items.length >= 1) { editall.style('display', 'inline-block'); }
+ body.emit('change', { target: dataField });
+ });
+
+ // Preventing click of links when title is being edited
+ body.delegate('click', '[data-collection-item] a', function(event, element) {
+ if (element.find('[contenteditable]')) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ });
+
+ // Load item settings
+ body.delegate('click', '[data-collection-item] .config-cog, [data-collection-editall]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ var editable = element.find('[data-title-editable]');
+ if (editable && editable.attribute('contenteditable')) {
+ event.stopPropagation();
+ return false;
+ }
+
+ var isEditAll = element.data('collection-editall') !== null,
+ parent = element.parent('.settings-param'),
+ dataField = parent.find('[data-collection-data]'),
+ data = dataField.value(),
+ item = element.parent('[data-collection-item]'),
+ items = parent.search('ul > [data-collection-item]');
+
+ var dataPost = { data: isEditAll ? data : JSON.stringify(JSON.parse(data)[indexOf(items, item[0])]) };
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'post',
+ className: 'g5-dialog-theme-default g5-modal-collection g5-modal-collection-' + (isEditAll ? 'editall' : 'single'),
+ data: dataPost,
+ overlayClickToClose: false,
+ remote: parseAjaxURI(element.attribute('href') + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),
+ dataValue = JSON.parse(data);
+
+ if (modal.getAll().length > 1) {
+ var applyAndSave = content.elements.content.search('[data-apply-and-save]');
+ if (applyAndSave) { applyAndSave.remove(); }
+ }
+
+ if (dataValue.length == 1) {
+ // TODO: need to determine better how to handle single collections cards
+ //content.elements.content.style({ width: 450 });
+ }
+
+ if ((!form && !fakeDOM) || !submit) {
+ return true;
+ }
+
+ // Collection Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ var target = $(e.currentTarget);
+
+ target.hideIndicator();
+ target.showIndicator();
+
+ var post = Submit(fakeDOM[0].elements, content.elements.content);
+
+ if (post.invalid.length) {
+ target.hideIndicator();
+ target.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&') || {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ if (item) { // single editing
+ dataValue[indexOf(items, item[0])] = response.body.data;
+ } else { // multi editing
+ dataValue = response.body.data;
+ }
+
+ dataField.value(JSON.stringify(dataValue));
+ body.emit('change', { target: dataField });
+
+ element.parent('.settings-param-field').search('ul > [data-collection-item]').forEach(function(item, index) {
+ item = $(item);
+ var label = item.find('[data-title-editable]'),
+ text = dataValue[index][item.data('collection-item')];
+
+ label.data('title-editable', text).text(text);
+ });
+
+ // if it's apply and save we also save the panel
+ if (target.data('apply-and-save') !== null) {
+ var save = $('body').find('.button-save');
+ if (save) { body.emit('click', { target: save }); }
+ }
+
+ modal.close();
+ toastr.success(translate('GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED', 'Collection'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+
+ target.hideIndicator();
+ });
+ });
+ }
+ });
+ });
+});
+
+module.exports = {};
+
+},{"../../fields/submit":9,"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"agent":80,"elements":113,"elements/domready":111,"elements/insertion":114,"elements/zen":137,"mout/array/indexOf":175,"mout/array/last":179,"mout/string/trim":272,"sortablejs":316}],39:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ $ = require('elements'),
+ ready = require('elements/domready'),
+ zen = require('elements/zen'),
+
+ DragEvents = require('../../ui/drag.events'),
+
+ forEach = require('mout/collection/forEach'),
+ bind = require('mout/function/bind'),
+ clamp = require('mout/math/clamp');
+
+var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
+
+var MOUSEDOWN = DragEvents.EVENTS.START,
+ MOUSEMOVE = DragEvents.EVENTS.MOVE,
+ MOUSEUP = DragEvents.EVENTS.STOP,
+ FOCUSIN = isFirefox ? 'focus' : 'focusin';
+
+var ColorPicker = new prime({
+ mixin: [Options, Bound],
+ inherits: Emitter,
+ options: {},
+ constructor: function(options) {
+ this.setOptions(options);
+ this.built = false;
+ this.attach();
+ },
+
+ attach: function() {
+ var body = $('body');
+
+ MOUSEDOWN.forEach(bind(function(mousedown) {
+ body.delegate(mousedown, '#g5-container .g-colorpicker i', this.bound('iconClick'));
+ }, this));
+
+ body.delegate(FOCUSIN, '#g5-container .g-colorpicker input', this.bound('show'), true);
+
+
+ body.delegate('keydown', '#g5-container .g-colorpicker input', bind(function(event, element) {
+ switch (event.keyCode) {
+ case 9: // tab
+ this.hide();
+ break;
+ case 13: // enter
+ case 27: // esc
+ this.hide();
+ element[0].blur();
+ break;
+ }
+ return true;
+ }, this));
+
+ // Update on keyup
+ body.delegate('keyup', '#g5-container .g-colorpicker input', bind(function(event, element) {
+ this.updateFromInput(true, element);
+ return true;
+ }, this));
+
+ // Update on paste
+ body.delegate('paste', '#g5-container .g-colorpicker input', bind(function(event, element) {
+ setTimeout(bind(function() {
+ this.updateFromInput(true, element);
+ }, this), 1);
+ }, this));
+ },
+
+ show: function(event, element) {
+ var body = $('body');
+
+ if (!this.built) {
+ this.build();
+ }
+
+ this.element = element;
+ this.reposition();
+ this.wrapper.addClass('cp-visible');
+ this.updateFromInput();
+
+ MOUSEMOVE.forEach(bind(function(mousemove) {
+ body.on(mousemove, this.bound('bodyMove'));
+ }, this));
+
+ MOUSEDOWN.forEach(bind(function(mousedown) {
+ this.wrapper.delegate(mousedown, '.cp-grid, .cp-slider, .cp-opacity-slider', this.bound('bodyDown'));
+ body.on(mousedown, this.bound('bodyClick'));
+ }, this));
+
+ MOUSEUP.forEach(bind(function(mouseup) {
+ body.on(mouseup, this.bound('targetReset'));
+ }, this));
+ },
+
+ hide: function() {
+ var body = $('body');
+
+ if (!this.built) { return; }
+ this.wrapper.removeClass('cp-visible');
+
+ MOUSEMOVE.forEach(bind(function(mousemove) {
+ body.off(mousemove, this.bound('bodyMove'));
+ }, this));
+
+ MOUSEDOWN.forEach(bind(function(mousedown) {
+ this.wrapper.undelegate(mousedown, '.cp-grid, .cp-slider, .cp-opacity-slider', this.bound('bodyDown'));
+ body.off(mousedown, this.bound('bodyClick'));
+ }, this));
+
+ MOUSEUP.forEach(bind(function(mouseup) {
+ body.off(mouseup, this.bound('targetReset'));
+ }, this));
+ },
+
+ iconClick: function(event, element) {
+ event.preventDefault();
+
+ var input = $(element).sibling('input');
+ input[0].focus();
+
+ this.show(event, input);
+ },
+
+ bodyMove: function(event) {
+ event.preventDefault();
+
+ if (this.target) { this.move(this.target, event); }
+ },
+
+ bodyClick: function(event) {
+ var target = $(event.target);
+ if (!target.parent('.cp-wrapper') && !target.parent('.g-colorpicker')) {
+ this.hide();
+ }
+ },
+
+ bodyDown: function(event, element) {
+ event.preventDefault();
+
+ this.target = element;
+ this.move(this.target, event, true);
+ },
+
+ targetReset: function(event) {
+ event.preventDefault();
+
+ this.target = null;
+ },
+
+ move: function(target, event) {
+ var input = this.element,
+ picker = target.find('.cp-picker'),
+ clientRect = target[0].getBoundingClientRect(),
+ offsetX = clientRect.left + window.scrollX,
+ offsetY = clientRect.top + window.scrollY,
+ x = Math.round((event ? event.pageX : 0) - offsetX),
+ y = Math.round((event ? event.pageY : 0) - offsetY),
+ wx, wy, r, phi;
+
+ // Touch support
+ if (event && event.changedTouches) {
+ x = (event.changedTouches ? event.changedTouches[0].pageX : 0) - offsetX;
+ y = (event.changedTouches ? event.changedTouches[0].pageY : 0) - offsetY;
+ }
+
+ if (event && event.manualOpacity) {
+ y = clientRect.height;
+ }
+
+ // Constrain picker to its container
+ if (x < 0) x = 0;
+ if (y < 0) y = 0;
+ if (x > clientRect.width) x = clientRect.width;
+ if (y > clientRect.height) y = clientRect.height;
+
+ // Constrain color wheel values to the wheel
+ if (target.parent('.cp-mode-wheel') && picker.parent('.cp-grid')) {
+ wx = 75 - x;
+ wy = 75 - y;
+ r = Math.sqrt(wx * wx + wy * wy);
+ phi = Math.atan2(wy, wx);
+
+ if (phi < 0) phi += Math.PI * 2;
+ if (r > 75) {
+ x = 75 - (75 * Math.cos(phi));
+ y = 75 - (75 * Math.sin(phi));
+ }
+
+ x = Math.round(x);
+ y = Math.round(y);
+ }
+
+ // Move the picker
+ if (target.hasClass('cp-grid')) {
+ picker.style({
+ top: y,
+ left: x
+ });
+
+ this.updateFromPicker(input, target);
+ } else {
+ picker.style({
+ top: y
+ });
+ this.updateFromPicker(input, target);
+ }
+ },
+
+ build: function() {
+ this.wrapper = zen('div.cp-wrapper.cp-with-opacity.cp-mode-hue');
+ this.slider = zen('div.cp-slider.cp-sprite').bottom(this.wrapper).appendChild(zen('div.cp-picker'));
+ this.opacitySlider = zen('div.cp-opacity-slider.cp-sprite').bottom(this.wrapper).appendChild(zen('div.cp-picker'));
+ this.grid = zen('div.cp-grid.cp-sprite').bottom(this.wrapper).appendChild(zen('div.cp-grid-inner')).appendChild(zen('div.cp-picker'));
+
+ zen('div').bottom(this.grid.find('.cp-picker'));
+
+ var tabs = zen('div.cp-tabs').bottom(this.wrapper);
+
+ this.tabs = {
+ hue: zen('div.cp-tab-hue.active').text('HUE').bottom(tabs),
+ brightness: zen('div.cp-tab-brightness').text('BRI').bottom(tabs),
+ saturation: zen('div.cp-tab-saturation').text('SAT').bottom(tabs),
+ wheel: zen('div.cp-tab-wheel').text('WHEEL').bottom(tabs),
+ transparent: zen('div.cp-tab-transp').text('TRANSPARENT').bottom(tabs)
+ };
+
+ MOUSEDOWN.forEach(bind(function(mousedown) {
+ tabs.delegate(mousedown, '> div', bind(function(event, element) {
+ if (element == this.tabs.transparent) {
+ this.opacity = 0;
+ var sliderHeight = this.opacitySlider.position().height;
+ this.opacitySlider.find('.cp-picker').style({ 'top': clamp(sliderHeight - (sliderHeight * this.opacity), 0, sliderHeight) });
+ this.move(this.opacitySlider, { manualOpacity: true });
+ return;
+ }
+
+ var active = tabs.find('.active'),
+ mode = active.attribute('class').replace(/\s|active|cp-tab-/g, ''),
+ newMode = element.attribute('class').replace(/\s|active|cp-tab-/g, '');
+
+ this.wrapper.removeClass('cp-mode-' + mode).addClass('cp-mode-' + newMode);
+ active.removeClass('active');
+ element.addClass('active');
+
+ this.mode = newMode;
+ this.updateFromInput();
+ }, this));
+ }, this));
+
+ this.wrapper.bottom('#g5-container');
+
+ this.built = true;
+ this.mode = 'hue';
+ },
+
+ updateFromInput: function(dontFireEvent, element) {
+ element = $(element) || this.element;
+ var value = element.value(),
+ opacity = value.replace(/\s/g, '').match(/^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/),
+ hex, hsb;
+
+ value = rgbstr2hex(value) || value;
+ opacity = opacity ? clamp(opacity[1], 0, 1) : 1;
+
+ if (!(hex = parseHex(value))) { hex = '#ffffff'; }
+ hsb = hex2hsb(hex);
+
+ if (this.built) {
+ // opacity
+ this.opacity = Math.max(opacity, 0);
+ var sliderHeight = this.opacitySlider.position().height;
+ this.opacitySlider.find('.cp-picker').style({ 'top': clamp(sliderHeight - (sliderHeight * this.opacity), 0, sliderHeight) });
+
+ // bg color
+ var gridHeight = this.grid.position().height,
+ gridWidth = this.grid.position().width,
+ r, phi, x, y;
+
+ sliderHeight = this.slider.position().height;
+
+ switch (this.mode) {
+ case 'wheel':
+ // Set grid position
+ r = clamp(Math.ceil(hsb.s * 0.75), 0, gridHeight / 2);
+ phi = hsb.h * Math.PI / 180;
+ x = clamp(75 - Math.cos(phi) * r, 0, gridWidth);
+ y = clamp(75 - Math.sin(phi) * r, 0, gridHeight);
+ this.grid.style({ backgroundColor: 'transparent' }).find('.cp-picker').style({
+ top: y,
+ left: x
+ });
+
+ // Set slider position
+ y = 150 - (hsb.b / (100 / gridHeight));
+ if (hex === '') y = 0;
+ this.slider.find('.cp-picker').style({ top: y });
+
+ // Update panel color
+ this.slider.style({
+ backgroundColor: hsb2hex({
+ h: hsb.h,
+ s: hsb.s,
+ b: 100
+ })
+ });
+ break;
+
+ case 'saturation':
+ // Set grid position
+ x = clamp((5 * hsb.h) / 12, 0, 150);
+ y = clamp(gridHeight - Math.ceil(hsb.b / (100 / gridHeight)), 0, gridHeight);
+ this.grid.find('.cp-picker').style({
+ top: y,
+ left: x
+ });
+
+ // Set slider position
+ y = clamp(sliderHeight - (hsb.s * (sliderHeight / 100)), 0, sliderHeight);
+ this.slider.find('.cp-picker').style({ top: y });
+
+ // Update UI
+ this.slider.style({
+ backgroundColor: hsb2hex({
+ h: hsb.h,
+ s: 100,
+ b: hsb.b
+ })
+ });
+ this.grid.find('.cp-grid-inner').style({ opacity: hsb.s / 100 });
+ break;
+
+ case 'brightness':
+ // Set grid position
+ x = clamp((5 * hsb.h) / 12, 0, 150);
+ y = clamp(gridHeight - Math.ceil(hsb.s / (100 / gridHeight)), 0, gridHeight);
+ this.grid.find('.cp-picker').style({
+ top: y,
+ left: x
+ });
+
+ // Set slider position
+ y = clamp(sliderHeight - (hsb.b * (sliderHeight / 100)), 0, sliderHeight);
+ this.slider.find('.cp-picker').style({ top: y });
+
+ // Update UI
+ this.slider.style({
+ backgroundColor: hsb2hex({
+ h: hsb.h,
+ s: hsb.s,
+ b: 100
+ })
+ });
+ this.grid.find('.cp-grid-inner').style({ opacity: 1 - (hsb.b / 100) });
+ break;
+ case 'hue':
+ default:
+ // Set grid position
+ x = clamp(Math.ceil(hsb.s / (100 / gridWidth)), 0, gridWidth);
+ y = clamp(gridHeight - Math.ceil(hsb.b / (100 / gridHeight)), 0, gridHeight);
+ this.grid.find('.cp-picker').style({
+ top: y,
+ left: x
+ });
+
+ // Set slider position
+ y = clamp(sliderHeight - (hsb.h / (360 / sliderHeight)), 0, sliderHeight);
+ this.slider.find('.cp-picker').style({ top: y });
+
+ // Update panel color
+ this.grid.style({
+ backgroundColor: hsb2hex({
+ h: hsb.h,
+ s: 100,
+ b: 100
+ })
+ });
+ break;
+ }
+ }
+
+ if (!dontFireEvent) { element.value(this.getValue(hex)); }
+
+ this.emit('change', element, hex, opacity);
+
+ },
+
+ updateFromPicker: function(input, target) {
+ var getCoords = function(picker, container) {
+
+ var left, top;
+ if (!picker.length || !container) return null;
+ left = picker[0].getBoundingClientRect().left;
+ top = picker[0].getBoundingClientRect().top;
+
+ return {
+ x: left - container[0].getBoundingClientRect().left + (picker[0].offsetWidth / 2),
+ y: top - container[0].getBoundingClientRect().top + (picker[0].offsetHeight / 2)
+ };
+
+ };
+
+ var hex, hue, saturation, brightness, x, y, r, phi,
+
+ // Panel objects
+ grid = this.wrapper.find('.cp-grid'),
+ slider = this.wrapper.find('.cp-slider'),
+ opacitySlider = this.wrapper.find('.cp-opacity-slider'),
+
+ // Picker objects
+ gridPicker = grid.find('.cp-picker'),
+ sliderPicker = slider.find('.cp-picker'),
+ opacityPicker = opacitySlider.find('.cp-picker'),
+
+ // Picker positions
+ gridPos = getCoords(gridPicker, grid),
+ sliderPos = getCoords(sliderPicker, slider),
+ opacityPos = getCoords(opacityPicker, opacitySlider),
+
+ // Sizes
+ gridWidth = grid[0].getBoundingClientRect().width,
+ gridHeight = grid[0].getBoundingClientRect().height,
+ sliderHeight = slider[0].getBoundingClientRect().height,
+ opacitySliderHeight = opacitySlider[0].getBoundingClientRect().height;
+
+ var value = this.element.value();
+ value = rgbstr2hex(value) || value;
+ if (!(hex = parseHex(value))) { hex = '#ffffff'; }
+
+ // Handle colors
+ if (target.hasClass('cp-grid') || target.hasClass('cp-slider')) {
+
+ // Determine HSB values
+ switch (this.mode) {
+ case 'wheel':
+ // Calculate hue, saturation, and brightness
+ x = (gridWidth / 2) - gridPos.x;
+ y = (gridHeight / 2) - gridPos.y;
+ r = Math.sqrt(x * x + y * y);
+ phi = Math.atan2(y, x);
+ if (phi < 0) phi += Math.PI * 2;
+ if (r > 75) {
+ r = 75;
+ gridPos.x = 69 - (75 * Math.cos(phi));
+ gridPos.y = 69 - (75 * Math.sin(phi));
+ }
+ saturation = clamp(r / 0.75, 0, 100);
+ hue = clamp(phi * 180 / Math.PI, 0, 360);
+ brightness = clamp(100 - Math.floor(sliderPos.y * (100 / sliderHeight)), 0, 100);
+ hex = hsb2hex({
+ h: hue,
+ s: saturation,
+ b: brightness
+ });
+
+ // Update UI
+ slider.style({
+ backgroundColor: hsb2hex({
+ h: hue,
+ s: saturation,
+ b: 100
+ })
+ });
+ break;
+
+ case 'saturation':
+ // Calculate hue, saturation, and brightness
+ hue = clamp(parseInt(gridPos.x * (360 / gridWidth), 10), 0, 360);
+ saturation = clamp(100 - Math.floor(sliderPos.y * (100 / sliderHeight)), 0, 100);
+ brightness = clamp(100 - Math.floor(gridPos.y * (100 / gridHeight)), 0, 100);
+ hex = hsb2hex({
+ h: hue,
+ s: saturation,
+ b: brightness
+ });
+
+ // Update UI
+ slider.style({
+ backgroundColor: hsb2hex({
+ h: hue,
+ s: 100,
+ b: brightness
+ })
+ });
+ grid.find('.cp-grid-inner').style({ opacity: saturation / 100 });
+ break;
+
+ case 'brightness':
+ // Calculate hue, saturation, and brightness
+ hue = clamp(parseInt(gridPos.x * (360 / gridWidth), 10), 0, 360);
+ saturation = clamp(100 - Math.floor(gridPos.y * (100 / gridHeight)), 0, 100);
+ brightness = clamp(100 - Math.floor(sliderPos.y * (100 / sliderHeight)), 0, 100);
+ hex = hsb2hex({
+ h: hue,
+ s: saturation,
+ b: brightness
+ });
+
+ // Update UI
+ slider.style({
+ backgroundColor: hsb2hex({
+ h: hue,
+ s: saturation,
+ b: 100
+ })
+ });
+ grid.find('.cp-grid-inner').style({ opacity: 1 - (brightness / 100) });
+ break;
+
+ default:
+ // Calculate hue, saturation, and brightness
+ hue = clamp(360 - parseInt(sliderPos.y * (360 / sliderHeight), 10), 0, 360);
+ saturation = clamp(Math.floor(gridPos.x * (100 / gridWidth)), 0, 100);
+ brightness = clamp(100 - Math.floor(gridPos.y * (100 / gridHeight)), 0, 100);
+ hex = hsb2hex({
+ h: hue,
+ s: saturation,
+ b: brightness
+ });
+
+ // Update UI
+ grid.style({
+ backgroundColor: hsb2hex({
+ h: hue,
+ s: 100,
+ b: 100
+ })
+ });
+ break;
+
+ }
+ }
+
+ // Handle opacity
+ if (target.hasClass('cp-opacity-slider')) {
+ this.opacity = Math.max(parseFloat(1 - (opacityPos.y / opacitySliderHeight)).toFixed(2), 0);
+ }
+
+ // Adjust case
+ input.value(this.getValue(hex));
+
+ // Handle change event
+ this.emit('change', this.element, hex, this.opacity);
+
+ },
+
+ reposition: function() {
+ var offset = this.element[0].getBoundingClientRect(),
+ ct = $('#g5-container')[0].getBoundingClientRect();
+ this.wrapper.style({
+ top: offset.top + offset.height - ct.top,
+ left: offset.left - ct.left
+ });
+ },
+
+ getValue: function(hex) {
+ if (this.opacity == 1) { return hex; }
+ var rgb = hex2rgb(hex);
+ return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + this.opacity + ')';
+ }
+});
+
+// Parses a string and returns a valid hex string when possible
+var parseHex = function(string) {
+ string = string.replace(/[^A-F0-9]/ig, '');
+ if (string.length !== 3 && string.length !== 6) return '';
+ if (string.length === 3) {
+ string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
+ }
+
+ return '#' + string.toLowerCase();
+};
+
+// Converts an HSB object to an RGB object
+var hsb2rgb = function(hsb) {
+ var rgb = {};
+ var h = Math.round(hsb.h);
+ var s = Math.round(hsb.s * 255 / 100);
+ var v = Math.round(hsb.b * 255 / 100);
+ if (s === 0) {
+ rgb.r = rgb.g = rgb.b = v;
+ } else {
+ var t1 = v;
+ var t2 = (255 - s) * v / 255;
+ var t3 = (t1 - t2) * (h % 60) / 60;
+ if (h === 360) h = 0;
+ if (h < 60) {
+ rgb.r = t1;
+ rgb.b = t2;
+ rgb.g = t2 + t3;
+ }
+ else if (h < 120) {
+ rgb.g = t1;
+ rgb.b = t2;
+ rgb.r = t1 - t3;
+ }
+ else if (h < 180) {
+ rgb.g = t1;
+ rgb.r = t2;
+ rgb.b = t2 + t3;
+ }
+ else if (h < 240) {
+ rgb.b = t1;
+ rgb.r = t2;
+ rgb.g = t1 - t3;
+ }
+ else if (h < 300) {
+ rgb.b = t1;
+ rgb.g = t2;
+ rgb.r = t2 + t3;
+ }
+ else if (h < 360) {
+ rgb.r = t1;
+ rgb.g = t2;
+ rgb.b = t1 - t3;
+ }
+ else {
+ rgb.r = 0;
+ rgb.g = 0;
+ rgb.b = 0;
+ }
+ }
+ return {
+ r: Math.round(rgb.r),
+ g: Math.round(rgb.g),
+ b: Math.round(rgb.b)
+ };
+};
+
+// Converts an RGB object to a hex string
+var rgb2hex = function(rgb) {
+ var hex = [
+ rgb.r.toString(16),
+ rgb.g.toString(16),
+ rgb.b.toString(16)
+ ];
+
+ forEach(hex, function(val, nr) {
+ if (val.length === 1) hex[nr] = '0' + val;
+ });
+
+ return '#' + hex.join('');
+};
+
+var rgbstr2hex = function(rgb) {
+ rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
+ return (rgb && rgb.length === 4) ? "#" +
+ ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
+ ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
+ ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
+};
+
+// Converts an HSB object to a hex string
+var hsb2hex = function(hsb) {
+ return rgb2hex(hsb2rgb(hsb));
+};
+
+// Converts a hex string to an HSB object
+var hex2hsb = function(hex) {
+ var hsb = rgb2hsb(hex2rgb(hex));
+ if (hsb.s === 0) hsb.h = 360;
+ return hsb;
+};
+
+// Converts an RGB object to an HSB object
+var rgb2hsb = function(rgb) {
+ var hsb = {
+ h: 0,
+ s: 0,
+ b: 0
+ };
+ var min = Math.min(rgb.r, rgb.g, rgb.b);
+ var max = Math.max(rgb.r, rgb.g, rgb.b);
+ var delta = max - min;
+ hsb.b = max;
+ hsb.s = max !== 0 ? 255 * delta / max : 0;
+ if (hsb.s !== 0) {
+ if (rgb.r === max) {
+ hsb.h = (rgb.g - rgb.b) / delta;
+ } else if (rgb.g === max) {
+ hsb.h = 2 + (rgb.b - rgb.r) / delta;
+ } else {
+ hsb.h = 4 + (rgb.r - rgb.g) / delta;
+ }
+ } else {
+ hsb.h = -1;
+ }
+ hsb.h *= 60;
+ if (hsb.h < 0) {
+ hsb.h += 360;
+ }
+ hsb.s *= 100 / 255;
+ hsb.b *= 100 / 255;
+ return hsb;
+};
+
+// Converts a hex string to an RGB object
+var hex2rgb = function(hex) {
+ hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
+ return {
+ /* jshint ignore:start */
+ r: hex >> 16,
+ g: (hex & 0x00FF00) >> 8,
+ b: (hex & 0x0000FF)
+ /* jshint ignore:end */
+ };
+};
+
+
+ready(function() {
+ var x = new ColorPicker(), body = $('body');
+ x.on('change', function(element, hex, opacity) {
+ clearTimeout(this.timer);
+ var rgb = hex2rgb(hex),
+ yiq = (((rgb.r * 299) + (rgb.g * 587) + (rgb.b * 114)) / 1000) >= 128 ? 'dark' : 'light',
+ check = yiq == 'dark' || (!opacity || opacity < 0.35);
+
+ if (opacity < 1) {
+ var str = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + opacity + ')';
+ element.style({ backgroundColor: str });
+ } else {
+ element.style({ backgroundColor: hex });
+ }
+
+ element.parent('.g-colorpicker')[!check ? 'addClass' : 'removeClass']('light-text');
+
+ this.timer = setTimeout(function() {
+ element.emit('input');
+ body.emit('input', { target: element });
+ }, 150);
+
+ });
+});
+
+module.exports = ColorPicker;
+
+},{"../../ui/drag.events":52,"elements":113,"elements/domready":111,"elements/zen":137,"mout/collection/forEach":189,"mout/function/bind":192,"mout/math/clamp":216,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],40:[function(require,module,exports){
+(function (global){(function (){
+"use strict";
+
+var $ = require('../../utils/elements.utils'),
+ prime = require('prime'),
+ request = require('agent'),
+ zen = require('elements/zen'),
+ domready = require('elements/domready'),
+ bind = require('mout/function/bind'),
+ rtrim = require('mout/string/rtrim'),
+ deepClone = require('mout/lang/deepClone'),
+ deepFillIn = require('mout/object/deepFillIn'),
+ modal = require('../../ui').modal,
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxURL = require('../../utils/get-ajax-url').global,
+ translate = require('../../utils/translate'),
+ Cookie = require('../../utils/cookie'),
+ dropzone = require('dropzone').default;
+
+var FilePicker = new prime({
+ constructor: function(element) {
+ var data = element.data('g5-filepicker'), value;
+ this.data = data ? JSON.parse(data) : false;
+
+ if (this.data && !this.data.value) {
+ this.data.value = $(this.data.field).value();
+ }
+
+ this.colors = {
+ error: '#D84747',
+ success: '#9ADF87',
+ small: '#aaaaaa',
+ gradient: ['#9e38eb', '#4e68fc']
+ };
+
+ //console.log(this.data);
+ },
+
+ open: function() {
+ if (this.data) {
+ this.data.value = $(this.data.field).value();
+ }
+
+ modal.open({
+ method: 'post',
+ data: this.data,
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ className: 'g5-dialog-theme-default g5-modal-filepicker',
+ remote: parseAjaxURI(getAjaxURL('filepicker') + getAjaxSuffix()),
+ remoteLoaded: bind(this.loaded, this),
+ afterClose: bind(function() {
+ if (this.dropzone) { this.dropzone.destroy(); }
+ }, this)
+ });
+ },
+
+ getPath: function() {
+ var actives = this.content.search('.g-folders .active'), active, path;
+ if (!actives) { return null; }
+
+ active = $(actives[actives.length - 1]);
+ path = JSON.parse(active.data('folder')).pathname;
+ return path.replace(/\/$/, '') + '/';
+ },
+
+ getPreviewTemplate: function() {
+ var li = zen('li[data-file]'),
+ del = zen('span.g-file-delete[data-g-file-delete][data-dz-remove]').html('').bottom(li),
+ thumb = zen('div.g-thumb[data-dz-thumbnail]').bottom(li),
+ name = zen('span.g-file-name[data-dz-name]').bottom(li),
+ size = zen('span.g-file-size[data-dz-size]').bottom(li),
+ mtime = zen('span.g-file-mtime[data-dz-mtime]').bottom(li);
+
+ zen('span.g-file-progress[data-file-uploadprogress]').html('').bottom(li);
+ zen('div').bottom(thumb);
+
+ li.bottom('body');
+ var html = li[0].outerHTML;
+ li.remove();
+
+ return html;
+ },
+
+ loaded: function(response, modalInstance) {
+ var content = modalInstance.elements.content,
+ bookmarks = content.search('.g-bookmark'),
+ files = content.find('.g-files'),
+ fieldData = deepClone(this.data),
+ colors = this.colors,
+ self = this;
+
+ this.content = content;
+
+ if (files) {
+ this.dropzone = new dropzone('body', {
+ previewTemplate: this.getPreviewTemplate(),
+ previewsContainer: files.find('ul:not(.g-list-labels)')[0],
+ thumbnailWidth: 100,
+ thumbnailHeight: 100,
+ clickable: '[data-upload]',
+ acceptedFiles: this.acceptedFiles(this.data.filter) || '',
+ accept: bind(function(file, done) {
+ if (!this.data.filter) { done(); }
+ else {
+ if (file.name.toLowerCase().match(this.data.filter)) { done(); }
+ else { done('' + file.name + '
' + translate('GANTRY5_PLATFORM_JS_FILTER_MISMATCH') + ':
' + this.data.filter + '
'); }
+ }
+ }, this),
+ url: bind(function(file) {
+ return parseAjaxURI(getAjaxURL('filepicker/upload/' + global.btoa(encodeURIComponent(this.getPath() + file[0].name))) + getAjaxSuffix());
+ }, this)
+ });
+
+ // dropzone events
+ this.dropzone.on('thumbnail', function(file, dataUrl) {
+ var ext = file.name.split('.');
+ ext = (!ext.length || ext.length == 1) ? '-' : ext.reverse()[0];
+ $(file.previewElement).addClass('g-image g-image-' + ext.toLowerCase()).find('[data-dz-thumbnail] > div').attribute('style', 'background-image: url(' + encodeURI(dataUrl) + ');');
+ });
+
+ this.dropzone.on('addedfile', function(file) {
+ var element = $(file.previewElement),
+ uploader = element.find('[data-file-uploadprogress]'),
+ isList = files.hasClass('g-filemode-list'),
+ progressConf = {
+ value: 0,
+ animation: false,
+ insertLocation: 'bottom'
+ };
+
+ var ext = file.name.split('.');
+ ext = (!ext.length || ext.length == 1) ? '-' : ext.reverse()[0];
+
+ if (!file.type.match(/image.*/)) {
+ element.find('.g-thumb').text(ext);
+ } else {
+ element.find('.g-thumb').addClass('g-image g-image-' + ext.toLowerCase());
+ }
+
+ progressConf = deepFillIn((isList ? {
+ size: 20,
+ thickness: 10,
+ fill: {
+ color: colors.small,
+ gradient: false
+ }
+ } : {
+ size: 50,
+ thickness: 'auto',
+ fill: {
+ gradient: colors.gradient,
+ color: false
+ }
+ }), progressConf);
+
+ element.addClass('g-file-uploading');
+ uploader.progresser(progressConf);
+ uploader.attribute('title', translate('GANTRY5_PLATFORM_JS_PROCESSING')).find('.g-file-progress-text').html('•••').attribute('title', translate('GANTRY5_PLATFORM_JS_PROCESSING'));
+
+ }).on('processing', function(file) {
+
+ var element = $(file.previewElement).find('[data-file-uploadprogress]');
+ element.find('.g-file-progress-text').text('0%').attribute('title', '0%');
+
+ }).on('sending', function(file, xhr, formData) {
+
+ var element = $(file.previewElement).find('[data-file-uploadprogress]');
+ element.attribute('title', '0%').find('.g-file-progress-text').text('0%').attribute('title', '0%');
+
+ }).on('uploadprogress', function(file, progress, bytesSent) {
+
+ var element = $(file.previewElement).find('[data-file-uploadprogress]');
+ element.progresser({ value: progress / 100 });
+ element.attribute('title', Math.round(progress) + '%').find('.g-file-progress-text').text(Math.round(progress) + '%').attribute('title', Math.round(progress) + '%');
+
+ }).on('complete', function(file) {
+ self.refreshFiles(content);
+ }).on('error', function(file, error) {
+ var element = $(file.previewElement),
+ uploader = element.find('[data-file-uploadprogress]'),
+ text = element.find('.g-file-progress-text'),
+ isList = files.hasClass('g-filemode-list');
+
+ element.addClass('g-file-error');
+
+ uploader.title('Error').progresser({
+ fill: {
+ color: colors.error,
+ gradient: false
+ },
+ value: 1,
+ thickness: isList ? 10 : 25
+ });
+
+ text.title('Error').html('').parent('[data-file-uploadprogress]').popover({
+ content: error.html ? error.html : (error.error && error.error.message ? error.error.message : error),
+ placement: 'auto',
+ trigger: 'mouse',
+ style: 'filepicker, above-modal',
+ width: 'auto',
+ targetEvents: false
+ });
+
+ }).on('success', function(file, response, xhr) {
+ var element = $(file.previewElement),
+ uploader = element.find('[data-file-uploadprogress]'),
+ mtime = element.find('.g-file-mtime'),
+ text = element.find('.g-file-progress-text'),
+ thumb = element.find('.g-thumb'),
+ isList = files.hasClass('g-filemode-list');
+
+ uploader.progresser({
+ fill: {
+ color: colors.success,
+ gradient: false
+ },
+ value: 1,
+ thickness: isList ? 10 : 25
+ });
+
+ text.html('');
+
+ setTimeout(bind(function() {
+ uploader.animate({ opacity: 0 }, { duration: 500 });
+ thumb.animate({ opacity: 1 }, {
+ duration: 500,
+ callback: function() {
+ element.data('file', JSON.stringify(response.finfo)).data('file-url', response.url).removeClass('g-file-uploading');
+ element.dropzone = file;
+ uploader.remove();
+ mtime.text(translate('GANTRY5_PLATFORM_JUST_NOW'));
+ }
+ });
+ }, this), 500);
+ });
+ }
+
+ // g5 events
+ content.delegate('click', '.g-bookmark-title', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var sibling = element.nextSibling('.g-folders'),
+ parent = element.parent('.g-bookmark');
+
+ if (!sibling) { return; }
+ sibling.slideToggle(function() {
+ parent.toggleClass('collapsed', sibling.gSlideCollapsed);
+ });
+ });
+
+ content.delegate('click', '[data-folder]', bind(function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var data = JSON.parse(element.data('folder')),
+ selected = $('[data-file].selected');
+
+ fieldData.root = data.pathname;
+ fieldData.value = selected ? selected.data('file-url') : false;
+ fieldData.subfolder = true;
+
+ element.showIndicator('fa fa-li fa-fw fa-spin-fast fa-spinner');
+ request(parseAjaxURI(getAjaxURL('filepicker') + getAjaxSuffix()), fieldData).send(bind(function(error, response) {
+ element.hideIndicator();
+ this.addActiveState(element);
+
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var dummy, next;
+ if (response.body.subfolder) {
+ dummy = zen('div').html(response.body.subfolder);
+ next = element.nextSibling();
+
+ if (next && !next.attribute('data-folder')) { next.remove(); }
+ dummy.children().after(element);
+ }
+
+ if (response.body.files) {
+ files.empty();
+ dummy = zen('div').html(response.body.files);
+ dummy.children().bottom(files).style({ opacity: 0 }).animate({ opacity: 1 }, { duration: '250ms' });
+ } else {
+ files.find('> ul:not(.g-list-labels)').empty();
+ }
+
+ this.dropzone.previewsContainer = files.find('ul:not(.g-list-labels)')[0];
+ }
+ }, this));
+ }, this));
+
+ content.delegate('click', '[data-g-file-preview]', bind(function(event, element) {
+ event.preventDefault();
+ event.stopPropagation();
+ var parent = element.parent('[data-file]'),
+ data = JSON.parse(parent.data('file'));
+
+ if (data.isImage) {
+ var thumb = parent.find('.g-thumb > div');
+ modal.open({
+ className: 'g5-dialog-theme-default g5-modal-filepreview center',
+ content: ''
+ });
+ }
+ }, this));
+
+ content.delegate('click', '[data-g-file-delete]', bind(function(event, element) {
+ event.preventDefault();
+ var parent = element.parent('[data-file]'),
+ data = JSON.parse(parent.data('file')),
+ deleteURI = parseAjaxURI(getAjaxURL('filepicker/' + global.btoa(encodeURIComponent(data.pathname)) + getAjaxSuffix()));
+
+ if (!data.isInCustom) { return false; }
+
+ request('delete', deleteURI, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ parent.addClass('g-file-deleted');
+ setTimeout(function() {
+ parent.remove();
+
+ self.refreshFiles(content);
+ }, 210);
+ }
+ });
+ }, this));
+
+ content.delegate('click', '[data-file]', bind(function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var target = $(event.target),
+ remove = target.data('g-file-delete') !== null || target.parent('[data-g-file-delete]'),
+ preview = target.data('g-file-preview') !== null || target.parent('[data-g-file-preview]');
+
+ if (element.hasClass('g-file-error') || element.hasClass('g-file-uploading') || remove || preview) { return; }
+ var data = JSON.parse(element.data('file'));
+
+ files.search('[data-file]').removeClass('selected');
+ element.addClass('selected');
+ }, this));
+
+ content.delegate('click', '[data-select]', bind(function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var selected = files.find('[data-file].selected'),
+ value = selected ? selected.data('file-url') : '';
+
+ $(this.data.field).value(value);
+ $('body').emit('input', { target: this.data.field });
+ modal.close();
+ }, this));
+
+ content.delegate('click', '[data-files-mode]', bind(function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ if (element.hasClass('active')) { return; }
+
+ var modes = $('[data-files-mode]');
+ modes.removeClass('active');
+ element.addClass('active');
+ Cookie.write('g5_files_mode', element.data('files-mode'));
+
+ files.animate({ opacity: 0 }, {
+ duration: 200,
+ callback: function() {
+ var mode = element.data('files-mode'),
+ uploadProgress = files.search('[data-file-uploadprogress]'),
+ progressConf = (mode == 'list') ? {
+ size: 20,
+ thickness: 10,
+ fill: {
+ color: colors.small,
+ gradient: false
+ }
+ } : {
+ size: 50,
+ thickness: 'auto',
+ fill: {
+ gradient: colors.gradient,
+ color: false
+ }
+ };
+
+
+ files.attribute('class', 'g-files g-block g-filemode-' + mode);
+ if (uploadProgress) {
+ uploadProgress.forEach(function(element) {
+ element = $(element);
+ var config = deepClone(progressConf);
+
+ if (element.parent('.g-file-error')) {
+ config.fill = { color: colors.error };
+ config.value = 1;
+ config.thickness = mode == 'list' ? 10 : 25;
+ }
+
+ element.progresser(config);
+ });
+ }
+ files.animate({ opacity: 1 }, { duration: 200 });
+ }
+ });
+
+ }, this));
+ },
+
+ addActiveState: function(element) {
+ var opened = this.content.search('[data-folder].active, .g-folders > .active'), parent = element.parent();
+ if (opened) { opened.removeClass('active'); }
+
+ element.addClass('active');
+
+ while (parent.tag() == 'ul' && !parent.hasClass('g-folders')) {
+ parent.previousSibling().addClass('active');
+ parent = parent.parent();
+ }
+ },
+
+ acceptedFiles: function(filter) {
+ var attr = '';
+ switch (filter) {
+ case '.(jpe?g|gif|png|svg)$':
+ attr = '.jpg,.jpeg,.gif,.png,.svg,.JPG,.JPEG,.GIF,.PNG,.SVG';
+ break;
+ case '.(mp4|webm|ogv|mov)$':
+ attr = '.mp4,.webm,.ogv,.mov,.MP4,.WEBM,.OGV,.MOV';
+ break;
+ }
+
+ return attr;
+ },
+
+ refreshFiles: function(content) {
+ var active = $('[data-folder].active'),
+ folder = active[active.length - 1];
+ if (folder) {
+ content.emit('click', { target: $(folder) });
+ }
+ }
+});
+
+domready(function() {
+ var body = $('body');
+ body.delegate('click', '[data-g5-filepicker]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ element = $(element);
+ if (!element.GantryFilePicker) {
+ element.GantryFilePicker = new FilePicker(element);
+ }
+
+ element.GantryFilePicker.open();
+ });
+});
+
+
+module.exports = FilePicker;
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"../../ui":54,"../../utils/cookie":64,"../../utils/elements.utils":66,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"agent":80,"dropzone":107,"elements/domready":111,"elements/zen":137,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/object/deepFillIn":225,"mout/string/rtrim":270,"prime":301}],41:[function(require,module,exports){
+"use strict";
+// fonts list: https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyB2yJM8DBwt66u2MVRgb6M4t9CqkW7_IRY
+var prime = require('prime'),
+ $ = require('../../utils/elements.utils'),
+ zen = require('elements/zen'),
+ storage = require('prime/map')(),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ domready = require('elements/domready'),
+
+ decouple = require('../../utils/decouple'),
+
+ bind = require('mout/function/bind'),
+ map = require('mout/array/map'),
+ forEach = require('mout/array/forEach'),
+ contains = require('mout/array/contains'),
+ last = require('mout/array/last'),
+ split = require('mout/array/split'),
+ removeAll = require('mout/array/removeAll'),
+ insert = require('mout/array/insert'),
+ append = require('mout/array/append'),
+ find = require('mout/array/find'),
+ combine = require('mout/array/combine'),
+ intersection = require('mout/array/intersection'),
+ merge = require('mout/object/merge'),
+
+ unhyphenate = require('mout/string/unhyphenate'),
+ properCase = require('mout/string/properCase'),
+ trim = require('mout/string/trim'),
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxURL = require('../../utils/get-ajax-url').global,
+
+ modal = require('../../ui').modal,
+ asyncForEach = require('../../utils/async-foreach'),
+ translate = require('../../utils/translate'),
+
+ request = require('agent'),
+
+ wf = require('webfontloader');
+
+require('../../utils/elements.viewport');
+
+var isIE = function() {
+ var ua = window.navigator.userAgent;
+ return ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/') > 0 || false;
+};
+
+var Fonts = new prime({
+
+ mixin: Bound,
+
+ inherits: Emitter,
+
+ previewSentence: {
+ 'latin': 'Wizard boy Jack loves the grumpy Queen\'s fox.',
+ 'latin-ext': 'Wizard boy Jack loves the grumpy Queen\'s fox.',
+ 'arabic': 'نص حكيم له سر قاطع وذو شأن عظيم مكتوب على ثوب أخضر ومغلف بجلد أزرق',
+ 'cyrillic': 'В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!',
+ 'cyrillic-ext': 'В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!',
+ 'devanagari': 'एक पल का क्रोध आपका भविष्य बिगाड सकता है',
+ 'greek': 'Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός',
+ 'greek-ext': 'Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός',
+ 'hebrew': 'דג סקרן שט בים מאוכזב ולפתע מצא חברה',
+ 'khmer': 'ខ្ញុំអាចញ៉ាំកញ្ចក់បាន ដោយគ្មានបញ្ហា',
+ 'telugu': 'దేశ భాషలందు తెలుగు లెస్స',
+ 'vietnamese': 'Tôi có thể ăn thủy tinh mà không hại gì.'
+ },
+
+ constructor: function() {
+ this.wf = wf;
+ this.field = null;
+ this.element = null;
+ this.throttle = false;
+ this.selected = null;
+ this.loadedFonts = [];
+ this.filters = {
+ search: '',
+ script: 'latin',
+ categories: []
+ };
+ },
+
+ open: function(event, element) {
+ var data = element.data('g5-fontpicker');
+ if (!data) {
+ throw new Error('No fontpicker data found');
+ }
+
+ data = JSON.parse(data);
+ this.field = $(data.field);
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ className: 'g5-dialog-theme-default g5-modal-fonts',
+ remote: parseAjaxURI(getAjaxURL('fontpicker') + getAjaxSuffix()),
+ remoteLoaded: bind(function(response, content) {
+ var container = content.elements.content;
+
+ this.attachEvents(container);
+ this.updateCategories(container);
+
+ this.search();
+
+ this.scroll(container.find('ul.g-fonts-list'));
+ this.updateTotal();
+ this.selectFromValue();
+
+ setTimeout(function() {
+ container.find('.particle-search-wrapper input')[0].focus();
+ }, 5);
+ }, this)
+ });
+ },
+
+ scroll: function(container) {
+ clearTimeout(this.throttle);
+ this.throttle = setTimeout(bind(function() {
+ if (!container) {
+ clearTimeout(this.throttle);
+ return;
+ }
+
+ // 550 = container height, 5 = pages
+ var elements = (container.find('ul.g-fonts-list') || container).inviewport(' > li:not(.g-font-hide)', (550 * (isIE() ? 2 : 7))),
+ list = [];
+
+ if (!elements) { return; }
+
+ $(elements).forEach(function(element) {
+ element = $(element);
+ var dataFont = element.data('font'),
+ variant = element.data('variant');
+
+ if (!contains(this.loadedFonts, dataFont) && variant) {
+ list.push(dataFont + (variant != 'regular' ? ':' + variant : ''));
+ }
+ else {
+ if (variant) {
+ element.find('[data-variant="' + variant + '"] .preview').style({
+ fontFamily: dataFont,
+ fontWeight: variant == 'regular' ? 'normal' : variant
+ });
+ }
+ }
+ }, this);
+
+ if (!list || !list.length) { return; }
+
+ this.wf.load({
+ classes: false,
+ google: {
+ families: list
+ },
+ fontactive: bind(function(family, fvd) {
+ container.find('li[data-font="' + family + '"]:not(.g-variant-hide) > .preview').style({
+ fontFamily: family,
+ fontWeight: fvd
+ });
+ this.loadedFonts.push(family);
+ }, this)
+ });
+ }, this), 100);
+ },
+
+ unselect: function(selected) {
+ selected = selected || this.selected;
+ if (!selected) { return false; }
+
+ var baseVariant = selected.element.data('variant');
+ selected.element.removeClass('selected');
+ selected.element.search('input[type=checkbox]').checked(false);
+ selected.element.search('[data-font]').addClass('g-variant-hide');
+ selected.element.find('[data-variant="' + baseVariant + '"]').removeClass('g-variant-hide');
+ selected.variants = [selected.baseVariant];
+ selected.selected = [];
+ },
+
+ selectFromValue: function() {
+ var value = this.field.value(), name, variants, subset, isLocal = false;
+
+ if (!value.match('family=')) {
+ var locals = $('[data-category="local-fonts"][data-font]') || [], intersect;
+ locals = locals.map(function(l) { return $(l).data('font'); });
+ value = value.replace(/(\s{1,})?,(\s{1,})?/gi, ',').split(',');
+ intersect = intersection(locals, value);
+ if (!intersect.length) { return false; }
+
+ isLocal = true;
+ name = intersect.shift();
+ } else {
+ var split = value.split('&'),
+ family = split[0],
+ split2 = family.split(':');
+
+ name = split2[0].replace('family=', '').replace(/\+/g, ' ');
+ variants = split2[1] ? split2[1].split(',') : ['regular'];
+ subset = split[1] ? split[1].replace('subset=', '').split(',') : ['latin'];
+ }
+
+ var noConflict = isLocal ? '[data-category="local-fonts"]' : ':not([data-category="local-fonts"])',
+ element = $('ul.g-fonts-list > [data-font="' + name + '"]' + noConflict);
+ variants = variants || element.data('variants').split(',') || ['regular'];
+
+ if (contains(variants, '400')) {
+ removeAll(variants, '400');
+ insert(variants, 'regular');
+ }
+
+ if (contains(variants, '400italic')) {
+ removeAll(variants, '400italic');
+ insert(variants, 'italic');
+ }
+
+ this.selected = {
+ font: name,
+ baseVariant: element.data('variant'),
+ element: element,
+ variants: variants,
+ selected: [],
+ local: isLocal,
+ charsets: subset,
+ availableVariants: element.data('variants').split(','),
+ expanded: isLocal,
+ loaded: isLocal
+ };
+
+ (isLocal ? [name] : variants).forEach(function(variant) {
+ this.select(element, variant);
+ variant = element.find('> ul > [data-variant="' + variant + '"]');
+ if (variant) { variant.removeClass('g-variant-hide'); }
+ }, this);
+
+ var charsetSelected = element.find('.font-charsets-selected');
+ if (charsetSelected) {
+ var subsetsLength = element.data('subsets').split(',').length;
+ charsetSelected.html('( ' + subset.length + ' of ' + subsetsLength + ' selected)');
+ }
+
+ if (!isLocal) { $('ul.g-fonts-list')[0].scrollTop = element[0].offsetTop; }
+
+ this.toggleExpansion();
+ setTimeout(bind(function() { this.toggleExpansion(); }, this), 50);
+ if (!isLocal) { setTimeout(bind(function() { $('ul.g-fonts-list')[0].scrollTop = element[0].offsetTop; }, this, 250)); }
+ },
+
+ select: function(element, variant/*, target*/) {
+ var baseVariant = element.data('variant'),
+ isLocal = !baseVariant;
+
+ if (!this.selected || this.selected.element != element) {
+ if (variant && this.selected) {
+ var charsetSelected = this.selected.element.find('.font-charsets-selected');
+ if (charsetSelected) {
+ var subsetsLength = element.data('subsets').split(',').length;
+ charsetSelected.html('( 1 of ' + subsetsLength + ' selected)');
+ }
+ }
+ this.selected = {
+ font: element.data('font'),
+ baseVariant: baseVariant,
+ element: element,
+ variants: [baseVariant],
+ selected: [],
+ local: isLocal,
+ charsets: ['latin'],
+ availableVariants: element.data('variants').split(','),
+ expanded: isLocal,
+ loaded: isLocal
+ };
+ }
+
+ if (!variant) {
+ this.toggleExpansion();
+ }
+
+
+ if (variant || isLocal) {
+ var selected = ($('ul.g-fonts-list > [data-font]:not([data-font="' + this.selected.font + '"]) input[type="checkbox"]:checked'));
+ if (selected) {
+ selected.checked(false);
+ selected.parent('[data-variants]').removeClass('font-selected');
+ }
+ var checkbox = this.selected.element.find('input[type="checkbox"][value="' + (isLocal ? this.selected.font : variant) + '"]'),
+ checked = checkbox.checked();
+ if (checkbox) {
+ checkbox.checked(!checked);
+ }
+
+ if (!checked) {
+ insert(this.selected.variants, variant);
+ insert(this.selected.selected, variant);
+ } else {
+ if (variant != this.selected.baseVariant) { removeAll(this.selected.variants, variant); }
+ removeAll(this.selected.selected, variant);
+ }
+
+ this.updateSelection();
+ }
+ },
+
+ toggleExpansion: function() {
+ if (this.selected.availableVariants.length <= 1) { return; }
+ if (this.selected.local) {
+ this.selected.expanded = true;
+ return;
+ }
+
+ if (!this.selected.expanded) {
+ var variants = this.selected.element.data('variants'), variant;
+ if (variants.split(',').length > 1) {
+ this.manipulateLink(this.selected.font);
+ this.selected.element.search('[data-font]').removeClass('g-variant-hide');
+
+ if (!this.selected.loaded) {
+ this.wf.load({
+ classes: false,
+ google: {
+ families: [this.selected.font.replace(/\s/g, '+') + ':' + variants]
+ },
+ fontactive: bind(function(family, fvd) {
+ var style = this.fvdToStyle(family, fvd),
+ search = style.fontWeight;
+
+ if (search == '400') {
+ search = style.fontStyle == 'normal' ? 'regular' : 'italic';
+ } else if (style.fontStyle == 'italic') {
+ search += 'italic';
+ }
+
+ this.selected.element.find('li[data-variant="' + search + '"] .preview').style(style);
+ this.selected.loaded = true;
+ }, this)
+ });
+ }
+ }
+ } else {
+ var exclude = ':not([data-variant="' + this.selected.variants.join('"]):not([data-variant="') + '"])';
+ exclude = this.selected.element.search('[data-font]' + exclude);
+ if (exclude) { exclude.addClass('g-variant-hide'); }
+ }
+
+ this.selected.expanded = !this.selected.expanded;
+ },
+
+ manipulateLink: function(family) {
+ family = family.replace(/\s/g, '+');
+ var link = $('head link[href*="' + family + '"]');
+ if (!link) { return; }
+
+ var parts = decodeURIComponent(link.href()).split('|');
+ if (!parts || parts.length <= 1) { return; }
+
+ removeAll(parts, family);
+
+ link.attribute('href', encodeURI(parts.join('|')));
+ },
+
+ toggle: function(event, element) {
+ element = $(element);
+ var target = $(event.target);
+
+ if (target.attribute('type') == 'checkbox') {
+ target.checked(!target.checked());
+ }
+
+ this.select(element.parent('[data-font]') || element, element.parent('[data-font]') ? element.data('variant') : false, element);
+
+ return false;
+ },
+
+ updateSelection: function() {
+ var preview = $('.g-particles-footer .font-selected'), selected, variants;
+ if (!preview) { return; }
+
+ if (!this.selected.selected.length) {
+ preview.empty();
+ this.selected.element.removeClass('font-selected');
+ return;
+ }
+
+ selected = this.selected.selected.sort();
+ variants = this.selected.local ? '(local)' : '(' + selected.join(', ').replace('regular', 'normal') + ')';
+ this.selected.element.addClass('font-selected');
+ preview.html('' + this.selected.font + ' ' + variants);
+ },
+
+ updateTotal: function() {
+ var totals = $('.g-particles-header .particle-search-total'),
+ count = $('.g-fonts-list > [data-font]:not(.g-font-hide)');
+
+ totals.text(count ? count.length : 0);
+ },
+
+ updateCategories: function(container) {
+ var categories = container.find('[data-font-categories]');
+ if (!categories) { return; }
+
+ this.filters.categories = categories.data('font-categories').split(',');
+ },
+
+ attachEvents: function(container) {
+ var header = container.find('.g-particles-header'),
+ list = container.find('.g-fonts-list'),
+ search = header.find('input.font-search'),
+ preview = header.find('input.font-preview');
+
+ decouple(list, 'scroll', bind(this.scroll, this, list));
+ container.delegate('click', '.g-fonts-list li[data-font]', bind(this.toggle, this));
+
+ if (search) { search.on('keyup', bind(this.search, this, search)); }
+ if (preview) { preview.on('keyup', bind(this.updatePreview, this, preview)); }
+
+ this.attachCharsets(container);
+ this.attachLocalVariants(container);
+ this.attachFooter(container);
+ },
+
+ attachCharsets: function(container) {
+ container.delegate('mouseover', '.font-charsets-selected', bind(function(event, element) {
+ if (!element.PopoverDefined) {
+ var popover = element.getPopover({
+ placement: 'auto',
+ width: '200',
+ trigger: 'mouse',
+ style: 'font-categories, above-modal'
+ });
+
+ element.on('beforeshow.popover', bind(function(popover) {
+ var subsets = element.parent('[data-subsets]').data('subsets').split(','),
+ content = popover.$target.find('.g5-popover-content'),
+ checked;
+
+ content.empty();
+
+ var div, current;
+ subsets.forEach(function(cs) {
+ current = contains(this.selected.charsets, cs) ? (cs == 'latin' ? 'checked disabled' : 'checked') : '';
+ zen('div').html('').bottom(content);
+ }, this);
+
+ content.delegate('click', 'input[type="checkbox"]', bind(function(event, input) {
+ input = $(input);
+ checked = content.search('input[type="checkbox"]:checked');
+ this.selected.charsets = checked ? checked.map('value') : [];
+
+ element.html('( ' + this.selected.charsets.length + ' of ' + subsets.length + ' selected)');
+ }, this));
+
+ popover.displayContent();
+ }, this));
+
+ element.getPopover().show();
+ }
+ }, this));
+ },
+
+ attachLocalVariants: function(container) {
+ container.delegate('mouseover', '.g-font-variants-list', bind(function(event, element) {
+ if (!element.PopoverDefined) {
+ var popover = element.getPopover({
+ placement: 'auto',
+ width: '200',
+ trigger: 'mouse',
+ style: 'font-categories, above-modal'
+ });
+
+ element.on('beforeshow.popover', bind(function(popover) {
+ var content = popover.$target.find('.g5-popover-content'),
+ variants = element.parent('[data-variants]').data('variants').split(',');
+
+ content.empty();
+
+ asyncForEach(variants, bind(function(variant) {
+ variant = variant == '400' ? 'regular' : (variant == '400italic' ? 'italic' : variant + '');
+ zen('div').text(this.mapVariant(variant)).bottom(content);
+ }, this));
+
+ popover.displayContent();
+ }, this));
+ }
+ }, this));
+ },
+
+ attachFooter: function(container) {
+ var footer = container.find('.g-particles-footer'),
+ select = footer.find('button.button-primary'),
+ categories = footer.find('.font-category'),
+ subsets = footer.find('.font-subsets'),
+ current;
+
+ select.on('click', bind(function() {
+ if (!$('ul.g-fonts-list > [data-font] input[type="checkbox"]:checked')) {
+ this.field.value('');
+ modal.close();
+ return;
+ }
+
+ var name = this.selected.font.replace(/\s/g, '+'),
+ variation = this.selected.selected,
+ charset = this.selected.charsets;
+
+ if (variation && variation.length == 1 && variation[0] == 'regular') { variation = []; }
+ if (charset && charset.length == 1 && charset[0] == 'latin') { charset = []; }
+
+ if (contains(variation, 'regular')) {
+ removeAll(variation, 'regular');
+ insert(variation, '400');
+ }
+ if (contains(variation, 'italic')) {
+ removeAll(variation, 'italic');
+ insert(variation, '400italic');
+ }
+
+ if (!this.selected.local) {
+ this.field.value('family=' + name + (variation.length ? ':' + variation.join(',') : '') + (charset.length ? '&subset=' + charset.join(',') : ''));
+ } else {
+ this.field.value(name);
+ }
+
+ this.field.emit('input');
+ $('body').emit('input', { target: this.field });
+
+ modal.close();
+ }, this));
+
+ categories.popover({
+ placement: 'top',
+ width: '200',
+ trigger: 'mouse',
+ style: 'font-categories, above-modal'
+ }).on('beforeshow.popover', bind(function(popover) {
+ var cats = categories.data('font-categories').split(','),
+ content = popover.$target.find('.g5-popover-content'),
+ checked;
+
+ content.empty();
+
+ cats.forEach(function(category) {
+ if (category == 'local-fonts') { return; }
+ current = contains(this.filters.categories, category) ? 'checked' : '';
+ zen('div').html('').bottom(content);
+ }, this);
+
+ content.delegate('click', 'input[type="checkbox"]', bind(function(event, input) {
+ input = $(input);
+ checked = content.search('input[type="checkbox"]:checked');
+ this.filters.categories = checked ? checked.map('value') : [];
+ categories.find('small').text(this.filters.categories.length);
+ this.search();
+ }, this));
+
+ popover.displayContent();
+ }, this));
+
+ subsets.popover({
+ placement: 'top',
+ width: '200',
+ trigger: 'mouse',
+ style: 'font-subsets, above-modal'
+ }).on('beforeshow.popover', bind(function(popover) {
+ var subs = subsets.data('font-subsets').split(','),
+ content = popover.$target.find('.g5-popover-content');
+
+ content.empty();
+
+ var div;
+ subs.forEach(function(sub) {
+ current = sub == this.filters.script ? 'checked' : '';
+ zen('div').html('').bottom(content);
+ }, this);
+
+ content.delegate('change', 'input[type="radio"]', bind(function(event, input) {
+ input = $(input);
+ this.filters.script = input.value();
+ $('.g-particles-header input.font-preview').value(this.previewSentence[this.filters.script]);
+ subsets.find('small').text(properCase(unhyphenate(input.value().replace('ext', 'extended'))));
+ this.search();
+ this.updatePreview();
+ }, this));
+
+ popover.displayContent();
+ }, this));
+
+ return container;
+ },
+
+ search: function(input) {
+ input = input || $('.g-particles-header input.font-search');
+ var list = $('.g-fonts-list'),
+ value = input.value(),
+ name, subsets, category, data;
+
+ list.search('> [data-font]').forEach(function(font) {
+ font = $(font);
+ name = font.data('font');
+ subsets = font.data('subsets').split(',');
+ category = font.data('category');
+ font.removeClass('g-font-hide');
+
+ // We dont want to hide selected fonts
+ if (this.selected && this.selected.font == name && this.selected.selected.length) { return; }
+
+ // Filter by Subset
+ if (!contains(subsets, this.filters.script)) {
+ font.addClass('g-font-hide');
+ return;
+ }
+
+ // Filter by Category
+ if (!contains(this.filters.categories, category)) {
+ font.addClass('g-font-hide');
+ return;
+ }
+
+ // Filter by Name
+ if (!name.match(new RegExp("^" + value + '|\\s' + value, 'gi'))) {
+ font.addClass('g-font-hide');
+ } else {
+ font.removeClass('g-font-hide');
+ }
+ }, this);
+
+ this.updateTotal();
+
+ clearTimeout(input.refreshTimer);
+
+ input.refreshTimer = setTimeout(bind(function() {
+ this.scroll($('ul.g-fonts-list'));
+ }, this), 400);
+
+ input.previousValue = value;
+ },
+
+ updatePreview: function(input) {
+ input = input || $('.g-particles-header input.font-preview');
+
+ clearTimeout(input.refreshTimer);
+
+ var value = input.value(),
+ list = $('.g-fonts-list');
+
+ value = trim(value) ? trim(value) : this.previewSentence[this.filters.script];
+
+ if (input.previousValue == value) { return true; }
+
+ list.search('[data-font] .preview').text(value);
+
+ input.previousValue = value;
+ },
+
+ fvdToStyle: function(family, fvd) {
+ var match = fvd.match(/([a-z])([0-9])/);
+ if (!match) return '';
+
+ var styleMap = {
+ n: 'normal',
+ i: 'italic',
+ o: 'oblique'
+ };
+ return {
+ fontFamily: family,
+ fontStyle: styleMap[match[1]],
+ fontWeight: (match[2] * 100).toString()
+ }
+ },
+
+ mapVariant: function(variant) {
+ switch (variant) {
+ case '100':
+ return 'Thin 100';
+ break;
+ case '100italic':
+ return 'Thin 100 Italic';
+ break;
+ case '200':
+ return 'Extra-Light 200';
+ break;
+ case '200italic':
+ return 'Extra-Light 200 Italic';
+ break;
+ case '300':
+ return 'Light 300';
+ break;
+ case '300italic':
+ return 'Light 300 Italic';
+ break;
+ case '400':
+ case 'regular':
+ return 'Normal 400';
+ break;
+ case '400italic':
+ case 'italic':
+ return 'Normal 400 Italic';
+ break;
+ case '500':
+ return 'Medium 500';
+ break;
+ case '500italic':
+ return 'Medium 500 Italic';
+ break;
+ case '600':
+ return 'Semi-Bold 600';
+ break;
+ case '600italic':
+ return 'Semi-Bold 600 Italic';
+ break;
+ case '700':
+ return 'Bold 700';
+ break;
+ case '700italic':
+ return 'Bold 700 Italic';
+ break;
+ case '800':
+ return 'Extra-Bold 800';
+ break;
+ case '800italic':
+ return 'Extra-Bold 800 Italic';
+ break;
+ case '900':
+ return 'Ultra-Bold 900';
+ break;
+ case '900italic':
+ return 'Ultra-Bold 900 Italic';
+ break;
+ default:
+ return 'Unknown Variant';
+ }
+ }
+});
+
+domready(function() {
+ var body = $('body');
+ body.delegate('click', '[data-g5-fontpicker]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var FontPicker = storage.get(element);
+ if (!FontPicker) {
+ FontPicker = new Fonts();
+ storage.set(element, FontPicker);
+ }
+
+ FontPicker.open(event, element);
+ });
+});
+
+module.exports = Fonts;
+
+},{"../../ui":54,"../../utils/async-foreach":63,"../../utils/decouple":65,"../../utils/elements.utils":66,"../../utils/elements.viewport":67,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"agent":80,"elements/domready":111,"elements/zen":137,"mout/array/append":164,"mout/array/combine":165,"mout/array/contains":166,"mout/array/find":171,"mout/array/forEach":174,"mout/array/insert":176,"mout/array/intersection":177,"mout/array/last":179,"mout/array/map":180,"mout/array/removeAll":182,"mout/array/split":185,"mout/function/bind":192,"mout/object/merge":237,"mout/string/properCase":264,"mout/string/trim":272,"mout/string/unhyphenate":275,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302,"webfontloader":317}],42:[function(require,module,exports){
+"use strict";
+var $ = require('../../utils/elements.utils'),
+ domready = require('elements/domready'),
+ modal = require('../../ui').modal,
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxURL = require('../../utils/get-ajax-url').global,
+ translate = require('../../utils/translate'),
+
+ trim = require('mout/string/trim'),
+ contains = require('mout/array/contains');
+
+domready(function() {
+ var body = $('body');
+ body.delegate('keyup', '.g-icons input[type="text"]', function(event, element){
+ element = $(element);
+ var preview = element.sibling('[data-g5-iconpicker]') || element.siblings().find('[data-g5-iconpicker]'),
+ value = element.value(),
+ size;
+
+ preview.find('i').attribute('class', value || 'far fa-hand-point-up picker');
+
+ size = preview[0].offsetWidth;
+
+ if (!size) { preview.find('i').attribute('class', 'far fa-hand-point-up picker'); }
+ });
+
+ body.delegate('click', '[data-g5-iconpicker]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ element = $(element);
+ var field = $(element.data('g5-iconpicker')),
+ realPreview = element,
+ value = trim(field.value()).replace(/\s{2,}/g, ' ').split(' ');
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ className: 'g5-dialog-theme-default g5-modal-icons',
+ remote: parseAjaxURI(getAjaxURL('icons') + getAjaxSuffix()),
+ afterClose: function() {
+ var popovers = $('.g5-popover');
+ if (popovers) { popovers.remove(); }
+ },
+ remoteLoaded: function(response, content) {
+ var html, large,
+ container = content.elements.content,
+ icons = container.search('[data-g-icon]');
+
+ if (!icons || !response.body.success) {
+ container.html(response.body.html || response.body);
+ return false;
+ }
+
+ var updatePreview = function() {
+ var data = [],
+ active = container.find('[data-g-icon].active'),
+ options = container.search('.g-particles-header .float-right input:checked, .g-particles-header .float-right select');
+
+ if (active) { data.push(active.data('g-icon')); }
+ if (options) {
+ options.forEach(function(option) {
+ var v = $(option).value();
+ if (v && v !== 'fa-') { data.push(v); }
+ });
+ }
+
+ container.find('.g-icon-preview').html(' ' + data[0] + '');
+ container.find('[data-g-select]').disabled(container.find('[data-g-icon].active') ? null : true);
+ };
+
+ var updateTotal = function() {
+ var total = container.search('[data-g-icon]:not(.hide-icon)');
+ container.find('.particle-search-total').text(total ? total.length : 0);
+ };
+
+ container.find('[data-g-select]').disabled(container.find('[data-g-icon].active') ? null : true);
+
+ container.delegate('click', '[data-g-icon]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ element = $(element);
+
+ var active = container.find('[data-g-icon].active');
+ if (active) { active.removeClass('active'); }
+
+ element.addClass('active');
+ container.find('[data-g-select]').disabled(null);
+
+ updatePreview();
+ });
+
+ container.delegate('click', '[data-g-select]', function(event){
+ event.preventDefault();
+
+ if (!container.find('[data-g-icon].active')) { return false; }
+
+ var output = container.find('.g-icon-preview i');
+ field.value(output.attribute('class'));
+ realPreview.find('i').attribute('class', output.attribute('class'));
+
+ field.emit('input');
+
+ $('body').emit('input', {target: field});
+
+ modal.close();
+ });
+
+ container.delegate('change', '.g-particles-header .float-right input[type="checkbox"], .g-particles-header .float-right select', function(/*e, input*/) {
+ updatePreview();
+ });
+
+ container.delegate('keyup', '.particle-search-wrapper input[type="text"]', function(e, input) {
+ input = $(input);
+ var value = input.value(),
+ hidden = container.search('[data-g-icon].hide-icon');
+
+ if (!value) {
+ if (hidden) {
+ hidden.removeClass('hide-icon');
+ updateTotal();
+ }
+ return true;
+ }
+
+ var found = container.search('[data-g-icon*="' + value + '"]');
+ container.search('[data-g-icon]').addClass('hide-icon');
+ if (found) {
+ found.removeClass('hide-icon');
+ }
+
+ updateTotal();
+
+ });
+
+ icons.forEach(function(icon) {
+ icon = $(icon);
+ html = '';
+
+ for (var i = 5, l = 0; i > l; i--) {
+ large = (!i) ? 'lg' : i + 'x';
+ html += ' ';
+ }
+
+ html += '' + icon.data('g-icon') + '
';
+
+ icon.popover({
+ content: html,
+ placement: 'auto',
+ trigger: 'mouse',
+ style: 'above-modal, icons-preview',
+ width: 'auto',
+ targetEvents: false,
+ delay: 1
+ }).on('hidden.popover', function(instance) {
+ if (instance.$target) { instance.$target.remove(); }
+ });
+
+ if (contains(value, icon.data('g-icon'))) {
+ // set active icon
+ icon.addClass('active');
+
+ // toggle options
+ value.forEach(function(name) {
+ var field = container.find('[name="' + name + '"]');
+ if (field) { field.checked(true); }
+ else {
+ field = container.find('option[value="' + name + '"]');
+ if (field) { field.parent().value(name); }
+ }
+ });
+
+ // scroll into place of active icon
+ var wrap = icon.parent('.icons-wrapper'),
+ wrapHeight = wrap[0].offsetHeight;
+ wrap[0].scrollTop = icon[0].offsetTop - (wrapHeight / 2);
+
+ // update preview
+ updatePreview();
+ }
+ });
+
+ setTimeout(function() {
+ container.find('.particle-search-wrapper input')[0].focus();
+ }, 5);
+ }
+ });
+ });
+});
+
+module.exports = {};
+
+},{"../../ui":54,"../../utils/elements.utils":66,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"elements/domready":111,"mout/array/contains":166,"mout/string/trim":272}],43:[function(require,module,exports){
+"use strict";
+
+module.exports = {
+ colorpicker: require('./colorpicker'),
+ fonts: require('./fonts'),
+ menu: require('./menu'),
+ icons: require('./icons'),
+ filepicker: require('./filepicker'),
+ collections: require('./collections'),
+ keyvalue: require('./keyvalue'),
+ instancepicker: require('./instancepicker')
+};
+},{"./collections":38,"./colorpicker":39,"./filepicker":40,"./fonts":41,"./icons":42,"./instancepicker":44,"./keyvalue":45,"./menu":46}],44:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ Submit = require('../../fields/submit'),
+ modal = require('../../ui').modal,
+ request = require('agent'),
+ trim = require('mout/string/trim'),
+ parseAjaxURI = require('../../utils/get-ajax-url').parse,
+ getAjaxURL = require('../../utils/get-ajax-url').global,
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ translate = require('../../utils/translate');
+
+var WordpressWidgetsCustomizer = require('../../utils/wp-widgets-customizer');
+
+ready(function() {
+ var body = $('body'),
+ particleField = $('[data-g-instancepicker] ~ input[type="hidden"]'),
+ moduleType = {
+ wordpress: 'widget',
+ joomla: 'module'
+ };
+
+ //if (particleField) {
+ //particleField.on('change', function(){
+ body.delegate('input', '[data-g-instancepicker] ~ input[type="hidden"]', function(event, element){
+ if (!element.value()) {
+ var title = element.siblings('.g-instancepicker-title'),
+ label = element.siblings('[data-g-instancepicker]'),
+ reset = element.sibling('.g-reset-field');
+
+ title.text('');
+ label.text(label.data('g-instancepicker-text'));
+ reset.style('display', 'none');
+ }
+ });
+ //}
+
+
+ body.delegate('click', '[data-g-instancepicker]', function(event, element) {
+ if (event) { event.preventDefault(); }
+
+ var data = JSON.parse(element.data('g-instancepicker')),
+ field = $('[name="' + data.field + '"]'),
+ value, uri; // = 'particle' + ((data.type == moduleType[GANTRY_PLATFORM]) ? '/' + moduleType[GANTRY_PLATFORM] : ''),
+
+ if (data.type == moduleType[GANTRY_PLATFORM]) {
+ uri = (data.type != 'widget' ? 'particle/' : '') + moduleType[GANTRY_PLATFORM];
+ } else {
+ uri = 'particle';
+ }
+
+ if (!field) { return false; }
+
+ value = field.value();
+
+ if ((data.type == 'particle' || data.type == 'widget') && value) {
+ value = JSON.parse(value || {});
+ uri = value.type + '/' + value[data.type];
+ }
+
+ if (data.modal_close) { return true; }
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: !value || data.type == 'module' ? 'get' : 'post', // data.type == moduleType[GANTRY_PLATFORM]
+ data: !value || data.type == 'module' ? {} : value, // data.type == moduleType[GANTRY_PLATFORM]
+ overlayClickToClose: false,
+ remote: parseAjaxURI(getAjaxURL(uri) + getAjaxSuffix()),
+ remoteLoaded: function(response, modalInstance) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var content = modalInstance.elements.content,
+ select = content.find('[data-mm-select]');
+
+ var search = content.find('.search input'),
+ blocks = content.search('[data-mm-type]'),
+ filters = content.search('[data-mm-filter]');
+
+ if (search && filters && blocks) {
+ search.on('input', function() {
+ if (!this.value()) {
+ blocks.removeClass('hidden');
+ return;
+ }
+
+ blocks.addClass('hidden');
+
+ var found = [], value = this.value().toLowerCase(), text;
+
+ filters.forEach(function(filter) {
+ filter = $(filter);
+ text = trim(filter.data('mm-filter')).toLowerCase();
+ if (text.match(new RegExp("^" + value + '|\\s' + value, 'gi'))) {
+ found.push(filter.matches('[data-mm-type]') ? filter : filter.parent('[data-mm-type]'));
+ }
+ }, this);
+
+ if (found.length) { $(found).removeClass('hidden'); }
+ });
+
+ setTimeout(function() {
+ search[0].focus();
+ }, 5);
+ }
+
+ var elementData = JSON.parse(element.data('g-instancepicker'));
+ if (elementData.type == moduleType[GANTRY_PLATFORM]) { elementData.modal_close = true; }
+ if (select) { select.data('g-instancepicker', JSON.stringify(elementData)); }
+ else {
+ var form = content.find('form'),
+ fakeDOM = zen('div').html(response.body.html || response.body).find('form'),
+ submit = content.find('input[type="submit"], button[type="submit"]');
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+
+ var applyAndSave = content.search('[data-apply-and-save]');
+ if (applyAndSave) { applyAndSave.remove(); }
+
+ submit.on('click', function(e) {
+ e.preventDefault();
+
+ submit.showIndicator();
+
+ var post = Submit(fakeDOM[0].elements, content);
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&') || {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+
+ var label = field.siblings('.g-instancepicker-title');
+
+ if (field) {
+ field.value(JSON.stringify(response.body.item));
+ $('body').emit('change', { target: field });
+ }
+
+ if (label) { label.text(response.body.item.title); }
+ }
+
+ modal.close();
+ submit.hideIndicator();
+
+ WordpressWidgetsCustomizer(field);
+ });
+ });
+
+ }
+ }
+ });
+ });
+});
+
+module.exports = {};
+
+},{"../../fields/submit":9,"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,"../../utils/wp-widgets-customizer":79,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/string/trim":272}],45:[function(require,module,exports){
+"use strict";
+
+var ready = require('elements/domready'),
+ $ = require('elements'),
+ zen = require('elements/zen'),
+ has = require('mout/object/has'),
+ some = require('mout/array/some'),
+ modal = require('../../ui').modal,
+ toastr = require('../../ui').toastr,
+ request = require('agent'),
+ indexOf = require('mout/array/indexOf'),
+ contains = require('mout/array/contains'),
+ lastItem = require('mout/array/last'),
+ keys = require('mout/object/keys'),
+ simpleSort = require('sortablejs'),
+ escapeUnicode = require('mout/string/escapeUnicode'),
+
+ trim = require('mout/string/trim'),
+
+ getAjaxSuffix = require('../../utils/get-ajax-suffix'),
+ translate = require('../../utils/translate');
+
+require('elements/insertion');
+
+ready(function() {
+ var body = $('body');
+
+ var createSortables = function(list) {
+ var lists = list || $('.g-keyvalue-field ul');
+ if (!lists) { return; }
+ lists.forEach(function(list) {
+ list = $(list);
+ list.SimpleSort = simpleSort.create(list[0], {
+ handle: '.fa-reorder',
+ filter: '[data-keyvalue-nosort]',
+ scroll: false,
+ animation: 150,
+ onStart: function() {
+ $(this.el).addClass('keyvalue-sorting');
+ },
+ onEnd: function(evt) {
+ var element = $(this.el);
+ element.removeClass('keyvalue-sorting');
+
+ if (evt.oldIndex === evt.newIndex) { return; }
+
+ var dataField = element.parent('.settings-param').find('[data-keyvalue-data]'),
+ data = dataField.value();
+
+ data = JSON.parse(data);
+
+ data.splice(evt.newIndex, 0, data.splice(evt.oldIndex, 1)[0]);
+ dataField.value(JSON.stringify(data));
+ body.emit('change', { target: dataField });
+ }
+ });
+ });
+ };
+
+ createSortables();
+
+ // delegate sortables collections for ajax support
+ body.delegate('mouseover', '.g-keyvalue-field ul', function(event, element) {
+ if (!element.SimpleSort) { createSortables(element); }
+ });
+
+ // Add new item
+ body.delegate('click', '[data-keyvalue-addnew]', function(event, element) {
+ var param = element.parent('.settings-param'),
+ list = param.find('ul'),
+ tmpl = param.find('[data-keyvalue-template]'),
+ items = list.search('> [data-keyvalue-item]') || [],
+ last = $(lastItem(items));
+
+ var clone = $(tmpl[0].cloneNode(true));
+
+ if (last) { clone.after(last); }
+ else { clone.top(list); }
+
+ clone.attribute('style', null).data('keyvalue-item', clone.data('keyvalue-template'));
+ clone.attribute('data-keyvalue-template', null);
+ clone.attribute('data-keyvalue-nosort', null);
+ clone.find('[data-keyvalue-key]')[0].focus();
+
+ //body.emit('change', { target: dataField });
+ });
+
+ // Remove item
+ body.delegate('click', '[data-keyvalue-remove]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var item = element.parent('[data-keyvalue-item]'),
+ key = item.find('input[type="text"]').data('keyvalue-key'),
+ dataField = element.parent('.settings-param').find('[data-keyvalue-data]'),
+ items = element.parent('ul').search('> [data-keyvalue-item]'),
+ index = indexOf(items, item[0]),
+ data = JSON.parse(dataField.value());
+
+ data.splice(index, 1);
+ dataField.value(escapeUnicode(JSON.stringify(data)));
+ item.remove();
+
+ body.emit('change', { target: dataField });
+ });
+
+ var onBlur = function(event, element) {
+ var parent = element.parent('[data-keyvalue-item]'),
+ wrapper = parent.find('.g-keyvalue-wrapper'),
+ keyElement = parent.find('[data-keyvalue-key]'),
+ valElement = parent.find('[data-keyvalue-value]'),
+ key = keyElement.data('keyvalue-key'),
+ keyValue = trim(keyElement.value()),
+ valValue = trim(valElement.value()),
+ items = element.parent('ul').search('> [data-keyvalue-item]:not(.g-keyvalue-warning):not(.g-keyvalue-excluded)'),
+ index = indexOf(items, parent[0]),
+
+ dataField = element.parent('.settings-param').find('[data-keyvalue-data]'),
+ data = JSON.parse(dataField.value()),
+ exclude = JSON.parse(dataField.data('keyvalue-exclude')),
+ excluded = contains(exclude, keyValue),
+ duplicate = some(data, function(obj) { return has(obj, keyValue); }) && key !== keyValue;
+
+ if (keyElement == element) {
+ // renamed or cleared key, need to cleanup JSON
+ if (key !== keyValue && !duplicate) {
+ if(typeof data[index] !== 'undefined') {
+ delete data[index][key];
+ }
+ keyElement.data('keyvalue-key', keyValue || '');
+ }
+
+ parent[duplicate ? 'addClass' : 'removeClass']('g-keyvalue-warning');
+ parent[excluded ? 'addClass' : 'removeClass']('g-keyvalue-excluded');
+
+ wrapper
+ .data('tip', duplicate ? translate('GANTRY5_PLATFORM_JS_KEYVALUE_DUPLICATE', keyValue) : (excluded ? translate('GANTRY5_PLATFORM_JS_KEYVALUE_EXCLUDED', keyValue) : null))
+ .data('tip-place', 'top-right')
+ .data('tip-spacing', 2)
+ .data('tip-offset', 8);
+
+ if (excluded || duplicate) {
+ window.G5.tips.get(wrapper[0]).show();
+ } else {
+ window.G5.tips.remove(wrapper[0]);
+ }
+ }
+
+ if (keyValue && !excluded && !duplicate) {
+ if (!data[index]) { data.splice(index, 0, {}); }
+ data[index][keyValue] = valValue;
+ }
+
+ dataField.value(escapeUnicode(JSON.stringify(data)));
+ body.emit('change', { target: dataField });
+
+ };
+
+ // Catch return key
+ body.delegate('keydown', '[data-keyvalue-item] input[type="text"]', function(event, element) {
+ var key = (event.which ? event.which : event.keyCode);
+ if (key === 13) { // Enter
+ onBlur(event, element);
+ }
+ });
+
+ // Change values
+ body.delegate('blur', '[data-keyvalue-item] input[type="text"]', onBlur, true);
+
+ body.delegate('update', '[data-keyvalue-data]', function(event, element) {
+ var parent = element.parent(),
+ items = parent.search('[data-keyvalue-item]'),
+ list = parent.find('ul'),
+ data = JSON.parse(element.value()),
+ tmpl = parent.find('[data-keyvalue-template]');
+
+ if (items) { items.remove(); }
+
+ data.forEach(function(obj, index) {
+ var clone = $(tmpl[0].cloneNode(true)),
+ key = keys(obj).shift(),
+ value = obj[key];
+
+ list.appendChild(clone);
+
+ clone.attribute('style', null).data('keyvalue-item', clone.data('keyvalue-template'));
+ clone.attribute('data-keyvalue-template', null);
+ clone.attribute('data-keyvalue-nosort', null);
+ clone.find('[data-keyvalue-key]').value(key);
+ clone.find('[data-keyvalue-value]').value(value);
+ });
+ });
+
+});
+
+module.exports = {};
+
+},{"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/translate":78,"agent":80,"elements":113,"elements/domready":111,"elements/insertion":114,"elements/zen":137,"mout/array/contains":166,"mout/array/indexOf":175,"mout/array/last":179,"mout/array/some":184,"mout/object/has":234,"mout/object/keys":236,"mout/string/escapeUnicode":260,"mout/string/trim":272,"sortablejs":316}],46:[function(require,module,exports){
+"use strict";
+var $ = require('../../utils/elements.utils'),
+ domready = require('elements/domready');
+
+domready(function() {
+ var body = $('body');
+ body.delegate('click', '[data-g5-content] .g-main-nav .g-toplevel [data-g5-ajaxify]', function(event, element) {
+ if (event && event.preventDefault) { event.preventDefault(); }
+ var items = $('[data-g5-content] .g-main-nav .g-toplevel [data-g5-ajaxify] !> li');
+ if (items) { items.removeClass('active'); }
+ element.parent('li').addClass('active');
+ });
+});
+
+module.exports = {};
+},{"../../utils/elements.utils":66,"elements/domready":111}],47:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ trim = require('mout/string/trim'),
+ keys = require('mout/object/keys'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ request = require('agent'),
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+
+ Eraser = require('../ui/eraser'),
+ simpleSort = require('sortablejs'),
+
+ flags = require('../utils/flags-state');
+
+
+var PositionsField = '[name="page[head][atoms][_json]"]',
+ groupOptions = [
+ { name: 'positions', pull: true, put: true },
+ { name: 'positions', pull: false, put: false }
+ ];
+
+var Positions = {
+ eraser: null,
+ lists: [],
+ state: [],
+
+ init: function(position) {
+ Positions.state = Positions.serialize(position);
+
+ return Positions.state;
+ },
+
+ equals: function() {
+ return Positions.state === Positions.serialize();
+ },
+
+ updatePendingChanges: function() {
+ var different = false,
+
+ equals = Positions.equals(),
+ save = $('[data-save="Positions"]'),
+ icon = save.find('i'),
+ indicator = save.find('.changes-indicator');
+
+ if (equals && indicator) { save.hideIndicator(); }
+ if (!equals && !indicator) { save.showIndicator('changes-indicator far fa-fw fa-circle') }
+ flags.set('pending', !equals);
+ },
+
+ serialize: function(position) {
+ var data,
+ output = [],
+ positions = $(position) || $('[data-g5-position]');
+
+ if (!positions) {
+ return '[]';
+ }
+
+ positions.forEach(function(position) {
+ position = $(position);
+ data = JSON.parse(position.data('g5-position'));
+ data.modules = [];
+
+ // collect positions items
+ (position.search('[data-pm-data]') || []).forEach(function(item) {
+ item = $(item);
+ data.modules.push(JSON.parse(item.data('pm-data') || '{}'));
+ });
+
+ output.push(data);
+ position.data('g5-position', JSON.stringify(data));
+ });
+
+ return JSON.stringify(output).replace(/\//g, '\\/');
+ },
+
+ attachEraser: function() {
+ if (Positions.eraser) {
+ Positions.eraser.element = $('[data-g5-positions-erase]');
+ Positions.eraser.hide('fast');
+ return;
+ }
+
+ Positions.eraser = new Eraser('[data-g5-positions-erase]');
+ },
+
+ createSortables: function(element) {
+ var list, sort;
+
+ Positions.attachEraser();
+
+ groupOptions.forEach(function(groupOption, i) {
+ list = !i ? '[data-g5-position] ul' : '#trash';
+ list = $(list);
+
+ list.forEach(function(element, listIndex) {
+ sort = simpleSort.create(element, {
+ sort: !i,
+ filter: '[data-g5-position-ignore]',
+ group: groupOption,
+ scroll: true,
+ forceFallback: true,
+ animation: 100,
+
+ onStart: function(event) {
+ Positions.attachEraser();
+
+ var item = $(event.item);
+ item.addClass('position-dragging');
+
+ Positions.eraser.show();
+ },
+
+ onEnd: function(event) {
+ var item = $(event.item),
+ trash = $('#trash'),
+ target = $(this.originalEvent.target),
+ touchTrash = false;
+
+ // workaround for touch devices
+ if (this.originalEvent.type === 'touchend') {
+ var trashSize = trash[0].getBoundingClientRect(),
+ oE = this.originalEvent,
+ position = (oE.pageY || oE.changedTouches[0].pageY) - window.scrollY;
+
+ touchTrash = position <= trashSize.height;
+ }
+
+ if (target.matches('#trash') || target.parent('#trash') || touchTrash) {
+ item.remove();
+ Positions.eraser.hide();
+ this.options.onSort(event);
+ return;
+ }
+
+ item.removeClass('position-dragging');
+
+ Positions.eraser.hide();
+ },
+
+ onSort: function(event) {
+ var from = $(event.from),
+ to = $(event.to),
+ lists = [from.parent('[data-g5-position]'), to.parent('[data-g5-position]')];
+
+ if (event.from[0] === event.to[0]) {
+ lists.shift();
+ }
+
+ Positions.serialize(lists);
+ Positions.updatePendingChanges();
+ },
+
+ onOver: function(event) {
+ if (!$(event.from).matches('ul')) { return; }
+
+ var over = $(event.newIndex);
+ if (over.matches('#trash') || over.parent('#trash')) {
+ Positions.eraser.over();
+ } else {
+ Positions.eraser.out();
+ }
+ }
+ });
+
+ if (!i) {
+ if (!Positions.lists[listIndex]) {
+ Positions.lists[listIndex] = sort;
+ }
+ }
+ });
+
+ if (!i) {
+ element.SimpleSort = sort;
+ }
+ });
+ }
+};
+
+
+var AttachSortablePositions = function(positions) {
+ if (!positions) { return; }
+ if (!positions.SimpleSort) { Positions.createSortables(positions); }
+};
+
+ready(function() {
+ var positions = $('#positions');
+
+ $('body').delegate('mouseover', '#positions', function(event, element) {
+ AttachSortablePositions(element);
+ });
+
+ AttachSortablePositions(positions);
+});
+
+module.exports = Positions;
+},{"../ui":54,"../ui/eraser":53,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272,"sortablejs":316}],48:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ zen = require('elements/zen'),
+ ready = require('elements/domready'),
+ trim = require('mout/string/trim'),
+ keys = require('mout/object/keys'),
+ modal = require('../ui').modal,
+ toastr = require('../ui').toastr,
+ request = require('agent'),
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global,
+ Submit = require('../fields/submit'),
+
+ flags = require('../utils/flags-state'),
+ translate = require('../utils/translate'),
+ Cards = require('./cards');
+
+ready(function() {
+ var body = $('body'),
+ warningURL = parseAjaxURI(getAjaxURL('confirmdeletion') + getAjaxSuffix());
+
+ Cards.init();
+
+ // Handles Positions Duplicate / Remove
+ body.delegate('click', '#positions [data-g-config], [data-g-create="position"]', function(event, element) {
+ var mode = element.data('g-config'),
+ href = element.data('g-config-href'),
+ encode = window.btoa(href),//.substr(-20, 20), // in case the strings gets too long
+ method = (element.data('g-config-method') || 'post').toLowerCase();
+
+ if (event && event.preventDefault) { event.preventDefault(); }
+
+ if (mode == 'delete' && !flags.get('free:to:delete:' + encode, false)) {
+ // confirm before proceeding
+ flags.warning({
+ url: warningURL,
+ data: {page_type: 'POSITION'},
+ callback: function(response, content) {
+ var confirm = content.find('[data-g-delete-confirm]'),
+ cancel = content.find('[data-g-delete-cancel]');
+
+ if (!confirm) { return; }
+
+ confirm.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ flags.get('free:to:delete:' + encode, true);
+ $([confirm, cancel]).attribute('disabled');
+ body.emit('click', { target: element });
+
+ modal.close();
+ });
+
+ cancel.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([confirm, cancel]).attribute('disabled');
+ flags.get('free:to:delete:' + encode, false);
+
+ modal.close();
+ });
+ }
+ });
+
+ return false;
+ }
+
+ element.hideIndicator();
+ element.showIndicator();
+
+ request(method, parseAjaxURI(href + getAjaxSuffix()), {}, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var positionDeleted = response.body.position,
+ reload = $('[href="' + getAjaxURL('positions') + '"]');
+
+ if (!reload) { window.location = window.location; }
+ else {
+ body.emit('click', {target: reload});
+ }
+
+ toastr.success(response.body.html || 'Action successfully completed.', response.body.title || '');
+ if (positionDeleted) {
+ body.positionDeleted = positionDeleted;
+ }
+ }
+
+ element.hideIndicator();
+ });
+
+ });
+
+ // Positions Add
+ body.delegate('click', '#positions .position-add', function(event, element) {
+ event.preventDefault();
+
+ var data = {};
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'get',
+ overlayClickToClose: false,
+ remote: parseAjaxURI(element.attribute('href') + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]');
+
+ var search = content.elements.content.find('.search input'),
+ blocks = content.elements.content.search('[data-mm-type]'),
+ filters = content.elements.content.search('[data-mm-filter]'),
+ urlTemplate = content.elements.content.find('.g-urltemplate');
+
+ if (urlTemplate) { body.emit('input', { target: urlTemplate }); }
+
+ var editable = content.elements.content.find('[data-title-editable]');
+ if (editable) {
+ editable.on('title-edit-end', function(title, original/*, canceled*/) {
+ title = trim(title);
+ if (!title) {
+ title = trim(original) || 'Title';
+ this.text(title).data('title-editable', title);
+
+ return true;
+ }
+ });
+ }
+
+ if (search && filters && blocks) {
+ search.on('input', function() {
+ if (!this.value()) {
+ blocks.removeClass('hidden');
+ return;
+ }
+
+ blocks.addClass('hidden');
+
+ var found = [], value = this.value().toLowerCase(), text;
+
+ filters.forEach(function(filter) {
+ filter = $(filter);
+ text = trim(filter.data('mm-filter')).toLowerCase();
+ if (text.match(new RegExp("^" + value + '|\\s' + value, 'gi'))) {
+ found.push(filter.matches('[data-mm-type]') ? filter : filter.parent('[data-mm-type]'));
+ }
+ }, this);
+
+ if (found.length) { $(found).removeClass('hidden'); }
+ });
+ }
+
+ if (search) {
+ setTimeout(function() {
+ search[0].focus();
+ }, 5);
+ }
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+ }
+ });
+ });
+
+ // Positions Items settings
+ body.delegate('click', '#positions .item-settings', function(event, element) {
+ event.preventDefault();
+
+ var data = {},
+ parent = element.parent('[data-pm-data]'),
+ position = JSON.parse(element.parent('[data-g5-position]').data('g5-position'));
+
+ data.position = position.name;
+ data.item = parent.data('pm-data');
+
+ modal.open({
+ content: translate('GANTRY5_PLATFORM_JS_LOADING'),
+ method: 'post',
+ data: data,
+ overlayClickToClose: false,
+ remote: parseAjaxURI(getAjaxURL('positions/edit/' + parent.data('pm-blocktype')) + getAjaxSuffix()),
+ remoteLoaded: function(response, content) {
+ if (!response.body.success) {
+ modal.enableCloseByOverlay();
+ return;
+ }
+
+ var form = content.elements.content.find('form'),
+ fakeDOM = zen('div').html(response.body.html).find('form'),
+ submit = content.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]');
+
+ var editable = content.elements.content.find('[data-title-editable]');
+ if (editable) {
+ editable.on('title-edit-end', function(title, original/*, canceled*/) {
+ title = trim(title);
+ if (!title) {
+ title = trim(original) || 'Title';
+ this.text(title).data('title-editable', title);
+
+ return true;
+ }
+ });
+ }
+
+ if ((!form && !fakeDOM) || !submit) { return true; }
+
+ // Position Settings apply
+ submit.on('click', function(e) {
+ e.preventDefault();
+ fakeDOM = content.elements.content.find('form');
+
+ var target = $(e.currentTarget);
+ target.disabled(true);
+ target.hideIndicator();
+ target.showIndicator();
+
+ var post = Submit(fakeDOM[0].elements, content.elements.content);
+
+ if (post.invalid.length) {
+ target.disabled(false);
+ target.hideIndicator();
+ target.showIndicator('fa fa-fw fa-exclamation-triangle');
+ toastr.error(translate('GANTRY5_PLATFORM_JS_REVIEW_FIELDS'), translate('GANTRY5_PLATFORM_JS_INVALID_FIELDS'));
+ return;
+ }
+
+ request(fakeDOM.attribute('method'), parseAjaxURI(fakeDOM.attribute('action') + getAjaxSuffix()), post.valid.join('&'), function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+ } else {
+ var parent = element.parent('[data-pm-data]');
+
+ if (parent) {
+ parent.data('pm-data', JSON.stringify(response.body.item));
+
+ var status = response.body.item.enabled || response.body.item.options.attributes.enabled;
+ var dummy = zen('div').html(response.body.html);
+ parent.html(dummy.firstChild().html());
+ parent[status == '0' ? 'addClass' : 'removeClass']('g-menu-item-disabled');
+ }
+
+ // if it's apply and save we also save the panel
+ if (target.data('apply-and-save') !== null) {
+ var save = $('body').find('.button-save');
+ if (save) { body.emit('click', { target: save }); }
+ }
+
+ Cards.serialize(element.parent('[data-g5-position]'));
+ Cards.updatePendingChanges();
+
+ modal.close();
+ toastr.success(translate('GANTRY5_PLATFORM_JS_POSITIONS_SETTINGS_APPLIED'), translate('GANTRY5_PLATFORM_JS_SETTINGS_APPLIED'));
+ }
+
+ target.hideIndicator();
+ });
+ });
+ }
+ });
+ });
+
+ // Handles Positions Titles Rename
+ var updateTitle = function(title, original, wasCanceled) {
+ this.style('text-overflow', 'ellipsis');
+ if (wasCanceled || title == original) { return; }
+ var element = this,
+ href = element.data('g-config-href'),
+ type = element.data('title-editable-type'),
+ method = (element.data('g-config-method') || 'post').toLowerCase(),
+ parent = element.parent('[id]');
+
+ parent.showIndicator();
+ parent.find('[data-title-edit]').addClass('disabled');
+
+ var data = type === 'title' ? { title: trim(title) } : { key: trim(title) };
+ data.data = parent.find('[data-g5-position]').data('g5-position');
+
+ request(method, parseAjaxURI(href + getAjaxSuffix()), data, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ element.data('title-editable', original).text(original);
+ } else {
+ var dummy = zen('div').html(response.body.position);
+
+ parent.html(dummy.find('[id]').html());
+
+ var editables = parent.search('[data-title-editable]');
+ attachEditables(editables);
+ }
+
+ parent.hideIndicator();
+ parent.find('[data-title-edit]').removeClass('disabled');
+ });
+ },
+
+ attachEditables = function(editables) {
+ if (!editables || !editables.length) { return; }
+ editables.forEach(function(editable) {
+ editable = $(editable);
+ editable.confWasAttached = true;
+ editable.on('title-edit-start', function(){
+ editable.style('text-overflow', 'inherit');
+ });
+ editable.on('title-edit-end', updateTitle);
+ });
+ };
+
+ // Toggle all assignments on/off
+ body.delegate('change', '[data-g5-positions-assignments] input[type="hidden"]', function(event, element) {
+ var card = element.parent('.card'),
+ wrapper = card.find('.settings-param-wrapper');
+
+ wrapper[element.value() == 1 ? 'addClass' : 'removeClass']('hide');
+ wrapper.search('input[type="hidden"]').forEach(function(element) {
+ element = $(element);
+ element.value(0).disabled(true);
+ });
+ });
+
+ // Global state change
+ body.on('statechangeAfter', function(event, element) {
+ var editables = $('#positions [data-title-editable]');
+ if (!editables) { return true; }
+
+ editables = editables.filter(function(editable) {
+ return (typeof $(editable).confWasAttached) === 'undefined';
+ });
+
+ attachEditables(editables);
+ });
+
+ attachEditables($('#positions [data-title-editable]'));
+});
+
+module.exports = {};
+
+},{"../fields/submit":9,"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"./cards":47,"agent":80,"elements":113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272}],49:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ $ = require('elements/attributes'),
+ modal = require('../ui').modal,
+ contains = require('mout/array/contains'),
+ forEach = require('mout/collection/forEach');
+
+require('../ui/popover');
+
+var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1,
+ FOCUSIN = isFirefox ? 'focus' : 'focusin';
+
+ready(function() {
+
+ var body = $('body');
+
+ body.delegate('click', '[data-g-styles]', function(event, element) {
+ var target = $(event.target);
+ if (event && event.preventDefault) { event.preventDefault(); }
+ if (target.hasClass('swatch-preview') || target.parent('.swatch-preview')) { return true; }
+
+ var data = JSON.parse(element.data('g-styles')), input, value, type, evt;
+ forEach(data, function(preset, name) {
+ input = $('[name="' + name + '"]');
+ value = input ? input.value() : false;
+
+ if (!input || value === preset) { return; }
+
+ evt = {
+ target: input,
+ forceOverride: true
+ };
+
+ type = (input.tag() == 'select' || contains(['hidden', 'checkbox'], input.type())) ? 'change' : 'input';
+
+ input.value(preset);
+ body.emit(type, evt);
+ body.emit('keyup', evt);
+ });
+ });
+
+ body.delegate('click', '[data-g-styles] .swatch-preview', function(event, element) {
+ var image = element.parent('[data-g-styles]').find('img');
+ if (!image) { return false; }
+
+ modal.open({
+ content: image[0].outerHTML,
+ afterOpen: function(container) {
+ var padding = parseInt(container.compute('padding-left'), 10) + parseInt(container.compute('padding-right'), 10);
+ container.style({
+ maxWidth: '80%',
+ width: padding + (image[0].naturalWidth || image[0].width)
+ });
+ }
+ });
+ });
+
+});
+
+module.exports = {};
+
+},{"../ui":54,"../ui/popover":56,"elements/attributes":108,"elements/domready":111,"mout/array/contains":166,"mout/collection/forEach":189}],50:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ trim = require('mout/string/trim'),
+ forOwn = require('mout/object/forOwn'),
+ $ = require('elements'),
+ Cookie = require('../utils/cookie');
+
+
+var loadFromStorage = function() {
+ var storage = Cookie.read('g5-collapsed') || {},
+ collapsers = $('[data-g-collapse]');
+ if (!collapsers) { return false; }
+
+ var item, data, handle, panel, card;
+ forOwn(storage, function(value, key) {
+ item = $('[data-g-collapse-id="' + key + '"]');
+ if (!item) { return; }
+
+ data = JSON.parse(item.data('g-collapse'));
+ handle = data.handle ? item.find(data.handle) : item.find('.g-collapse');
+ panel = data.target ? item.find(data.target) : item;
+ card = item.parent('.card') || panel;
+ handle
+ .data('title', value ? data.expand : data.collapse)
+ .data('tip', value ? data.expand : data.collapse);
+
+ panel.attribute('style', null);
+ card[!value ? 'removeClass' : 'addClass']('g-collapsed');
+ item[!value ? 'removeClass' : 'addClass']('g-collapsed-main');
+ });
+};
+
+ready(function() {
+ var body = $('body'), data, target, storage;
+
+ // single collapser
+ body.delegate('click', '[data-g-collapse]', function(event, element) {
+ element = event.element || element;
+
+ data = JSON.parse(element.data('g-collapse'));
+ target = $(event.target);
+ storage = ((data.store !== false) ? Cookie.read('g5-collapsed') : storage) || {};
+ if (!data.handle) { data.handle = element.find('.g-collapse'); }
+
+ if (!target.matches(data.handle) && !target.parent(data.handle)) { return false; }
+
+ if (storage[data.id] === undefined) {
+ storage[data.id] = data.collapsed;
+
+ if (data.store !== false) { Cookie.write('g5-collapsed', storage); }
+ }
+
+ var collapsed = storage[data.id],
+ panel = data.target ? element.find(data.target) : element,
+ card = panel.parent('.card') || panel;
+
+ if (card && card.hasClass('g-collapsed')) {
+ card.removeClass('g-collapsed');
+ element.removeClass('g-collapsed-main');
+ /* for animations
+ panel.style({
+ overflow: 'hidden',
+ height: 0
+ });*/
+ }
+
+ var slide = function(override) {
+ collapsed = typeof override !== 'number' ? override : collapsed;
+ if (!collapsed) {
+ card.addClass('g-collapsed');
+ element.addClass('g-collapsed-main');
+ element.attribute('style', null);
+ }
+
+ data.handle
+ .data('title', !collapsed ? data.expand : data.collapse)
+ .data('tip', !collapsed ? data.expand : data.collapse);
+ storage[data.id] = !collapsed;
+ data.collapsed = !collapsed;
+
+ var refreshData = JSON.parse(element.data('g-collapse'));
+ refreshData.collapsed = !collapsed;
+ element.data('g-collapse', JSON.stringify(refreshData));
+
+ if (data.store !== false) {
+ Cookie.write('g5-collapsed', storage);
+ }
+ };
+
+ if (element.gFastCollapse) {
+ panel[collapsed ? 'removeClass' : 'addClass']('g-collapsed');
+ element[collapsed ? 'removeClass' : 'addClass']('g-collapsed-main');
+ slide(collapsed);
+ } else {
+ element.removeClass('g-collapsed-main');
+ // for animations
+ // panel.removeClass('g-collapsed')[collapsed ? 'slideDown' : 'slideUp'](slide);
+ panel.removeClass('g-collapsed')[collapsed ? 'removeClass' : 'addClass']('g-collapsed');
+ slide(collapsed);
+ }
+
+ element.gFastCollapse = false;
+ });
+
+ // global collapse togglers
+ body.delegate('click', '[data-g-collapse-all]', function(event, element) {
+ var mode = element.data('g-collapse-all') === 'true',
+ parent = element.parent('.g-filter-actions'),
+ container = parent.nextSibling(),
+ collapsers = container.search('[data-g-collapse]'),
+ CookieStorage = Cookie.read('g5-collapsed') || {},
+ panel, data, handle, card, inner;
+
+ if (!collapsers) { return; }
+
+ collapsers.forEach(function(collapser) {
+ collapser = $(collapser);
+ card = collapser.parent('.card');
+ inner = card.find('> .g-collapsed');
+ data = JSON.parse(collapser.data('g-collapse'));
+ handle = data.handle ? collapser.find(data.handle) : collapser.find('.g-collapse');
+ panel = data.target ? collapser.find(data.target) : collapser;
+
+ handle
+ .data('title', mode ? data.expand : data.collapse)
+ .data('tip', mode ? data.expand : data.collapse);
+
+ storage = ((data.store !== false) ? CookieStorage : storage) || {};
+
+ storage[data.id] = mode;
+ if (data.store !== false) {
+ Cookie.write('g5-collapsed', storage);
+ }
+
+ panel.attribute('style', null);
+ collapser[!mode ? 'removeClass' : 'addClass']('g-collapsed-main');
+ card[!mode ? 'removeClass' : 'addClass']('g-collapsed');
+
+ if (inner) {
+ inner[!mode ? 'removeClass' : 'addClass']('g-collapsed');
+ }
+ });
+ });
+
+ // filter by card title
+ body.delegate('input', '[data-g-collapse-filter]', function(event, element) {
+ var filter = JSON.parse(element.data('g-collapse-filter') || '{}'),
+ parent = element.parent('.g-filter-actions'),
+ container = parent.nextSibling(),
+ cards = container.search(filter.element || '.card'),
+ value = element.value();
+
+ if (!cards) { return; }
+
+ if (!value) { cards.attribute('style', null); }
+ cards.forEach(function(element, index) {
+ element = $(element);
+ var title = trim(element.find(filter.title || 'h4 .g-title').text()),
+ matches = title.match(new RegExp("^" + value + '|\\s' + value, 'gi'));
+
+ if (matches) { element.attribute('style', null); }
+ else { element.style('display', 'none'); }
+ });
+ });
+
+ // this is now handled from the twig files
+ // no need to run on domready
+ //loadFromStorage();
+});
+
+module.exports = loadFromStorage;
+
+},{"../utils/cookie":64,"elements":113,"elements/domready":111,"mout/object/forOwn":232,"mout/string/trim":272}],51:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ bind = require('mout/function/bind'),
+ contains = require('mout/array/contains'),
+ DragEvents = require('./drag.events'),
+ $ = require('../utils/elements.utils');
+
+// $ utils
+require('elements/events');
+require('elements/delegation');
+
+var isIE = (navigator.appName === "Microsoft Internet Explorer");
+
+var DragDrop = new prime({
+
+ mixin: [Bound, Options],
+ inherits: Emitter,
+
+ options: {
+ delegate: null,
+ droppables: false,
+ catchClick: false
+ },
+
+ DRAG_EVENTS: DragEvents,
+
+ constructor: function(container, options) {
+ this.container = $(container);
+ if (!this.container) { return; }
+ this.setOptions(options);
+
+ this.element = null;
+ this.origin = {
+ x: 0,
+ y: 0,
+ transform: null,
+ offset: {
+ x: 0,
+ y: 0
+ }
+ };
+
+ this.matched = false;
+ this.lastMatched = false;
+ this.lastOvered = null;
+
+ this.attach();
+ },
+
+ attach: function() {
+ this.DRAG_EVENTS.EVENTS.START.forEach(bind(function(event) {
+ this.container.delegate(event, this.options.delegate, this.bound('start'));
+ }, this));
+ },
+
+ detach: function() {
+ this.DRAG_EVENTS.EVENTS.START.forEach(bind(function(event) {
+ this.container.undelegate(event, this.options.delegate, this.bound('start'));
+ }, this));
+ },
+
+ start: function(event, element) {
+ //if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ clearTimeout(this.scrollInterval);
+ if (element.LMTooltip) { element.LMTooltip.remove(); }
+ $('html').attribute('style', 'height: 100% !important');
+ this.scrollHeight = document.body.scrollHeight;
+
+ // Prevents dragging a column from itself and limiting to its handle
+ var target = $(event.target);
+ if (!element.parent('[data-lm-root]') && element.hasClass('g-block') && (!target.matches('.submenu-reorder') && !target.parent('.submenu-reorder'))) { return true; }
+
+ if (event.which && event.which !== 1 || $(event.target).matches(this.options.exclude)) { return true; }
+ this.element = $(element);
+ this.original = this.element;
+ this.matched = false;
+ if (this.options.catchClick) { this.moved = false; }
+
+ // we force the menu column reorder handle to the g-block parent
+ if (target.matches('.submenu-reorder') || target.parent('.submenu-reorder')) {
+ this.element = target.parent('[data-mm-id]');
+ }
+
+ this.emit('dragdrop:beforestart', event, this.element);
+
+ // Stops default MS touch actions since preventDefault doesn't work
+ if (isIE) {
+ this.element.style({
+ '-ms-touch-action': 'none',
+ 'touch-action': 'none'
+ });
+ }
+
+ // Stops text selection
+ event.preventDefault();
+
+ this.origin = {
+ x: event.changedTouches ? event.changedTouches[0].pageX : event.pageX,
+ y: event.changedTouches ? event.changedTouches[0].pageY : event.pageY,
+ transform: this.element.compute('transform')
+ };
+
+ var clientRect = this.element[0].getBoundingClientRect();
+ this.origin.offset = {
+ clientRect: clientRect,
+ scroll: {
+ x: window.scrollX,
+ y: window.scrollY
+ },
+ x: this.origin.x - clientRect.right,
+ y: clientRect.top - this.origin.y
+ };
+
+ // Only allow to sort grids when targeting the left handle
+ if (this.element.data('lm-blocktype') === 'grid' && Math.abs(this.origin.offset.x) < clientRect.width) {
+ return false;
+ }
+
+ var offset = Math.abs(this.origin.offset.x),
+ columns = (this.element.parent().data('lm-blocktype') === 'grid' && this.element.parent().parent().data('lm-root')) ||
+ (this.element.parent().parent().data('lm-blocktype') == 'container' && (this.element.parent().parent().parent().data('lm-root') || this.element.parent().parent().parent().data('lm-blocktype') == 'wrapper'));
+
+ if (
+ this.element.data('lm-blocktype') == 'grid' &&
+ (this.element.parent().data('lm-blocktype') === 'container' && this.element.parent().parent().parent().data('lm-root')) ||
+ (this.element.parent().data('lm-blocktype') === 'section' && this.element.parent().parent().parent().data('lm-root'))
+ ) { columns = false; }
+
+ // Resizing and only if it's not a non-visible (atoms) section
+ if ((offset < 6 && this.element.parent().find(':last-child') !== this.element) || (columns && offset > 3 && offset < 10)) {
+ if (this.element.parent('[data-lm-blocktype="atoms"]')) { return false; }
+
+ this.emit('dragdrop:resize', event, this.element, (this.element.parent('[data-mm-id]') || this.element).siblings(':not(.placeholder)'), this.origin.offset.x);
+ return false;
+ }
+
+ if (columns || (element.hasClass('submenu-column') && (!target.matches('.submenu-reorder') && !target.parent('.submenu-reorder')))) { return true; }
+
+ this.element.style({
+ 'pointer-events': 'none',
+ zIndex: 100
+ });
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').on(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ // Trackpads `tap` (mousedown + mouseup) happens too fast and the stop event
+ // won't get attached. We need to defer it to avoid issues
+
+ $('body').on(event, this.bound('deferStop'));
+ }, this));
+
+ this.emit('dragdrop:start', event, this.element);
+
+ return this.element;
+ },
+
+ deferStop: function(event) {
+ var self = this;
+ setTimeout(function() {
+ self.stop(event);
+ }, 0);
+ },
+
+ stop: function(event) {
+ //if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ clearTimeout(this.scrollInterval);
+ $('html').attribute('style', null);
+ if (!this.moved && this.options.catchClick) {
+ // this is just a click
+ this.element.style({ transform: this.origin.transform || 'translate(0, 0)' });
+ this.emit('dragdrop:stop', event, this.matched, this.element);
+ this._removeStyleAttribute(this.element);
+ this.emit('dragdrop:stop:animation', this.element);
+ this.emit('dragdrop:click', event, this.element);
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').off(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $('body').off(event, this.bound('deferStop'));
+ }, this));
+
+ this.element = null;
+
+ return;
+ }
+
+ var settings = { duration: '250ms' };
+
+ if (this.removeElement) {
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').off(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $('body').off(event, this.bound('deferStop'));
+ }, this));
+
+ return this.emit('dragdrop:stop:erase', event, this.element);
+ }
+
+ if (this.element) {
+
+ this.emit('dragdrop:stop', event, this.matched, this.element);
+
+ if (this.matched) {
+ this.element.style({
+ opacity: 0,
+ transform: 'translate(0, 0)'
+ }).removeClass('active');
+ }
+
+ if (!this.matched) {
+
+ settings.callback = bind(function(element) {
+ this._removeStyleAttribute(element);
+ setTimeout(bind(function() {
+ this.emit('dragdrop:stop:animation', element);
+ }, this), 1);
+ }, this, this.element);
+
+ this.element.animate({
+ transform: this.origin.transform || 'translate(0, 0)',
+ opacity: 1
+ }, settings);
+ } else {
+
+ this.element.style({
+ transform: this.origin.transform || 'translate(0, 0)',
+ opacity: 1
+ });
+
+ this._removeStyleAttribute(this.element);
+ this.emit('dragdrop:stop:animation', this.element);
+ }
+ }
+
+ this.DRAG_EVENTS.EVENTS.MOVE.forEach(bind(function(event) {
+ $('body').off(event, this.bound('move'));
+ }, this));
+
+ this.DRAG_EVENTS.EVENTS.STOP.forEach(bind(function(event) {
+ $('body').off(event, this.bound('deferStop'));
+ }, this));
+
+ this.element = null;
+ },
+
+ move: function(event) {
+ //if (event && event.type.match(/^touch/i)) { event.preventDefault(); }
+
+ if (this.options.catchClick) {
+ var didItMove = {
+ x: event.changedTouches ? event.changedTouches[0].pageX : event.pageX,
+ y: event.changedTouches ? event.changedTouches[0].pageY : event.pageY
+ };
+
+ if (Math.abs(didItMove.x - this.origin.x) <= 3 && Math.abs(didItMove.y - this.origin.y) <= 3) {
+ return;
+ }
+
+ if (!this.moved) {
+ this.element.style({ opacity: 0.5 });
+ this.emit('dragdrop:move:once', this.element);
+ }
+
+ this.moved = true;
+ }
+
+ var clientX = event.clientX || (event.touches && event.touches[0].clientX) || 0,
+ clientY = event.clientY || (event.touches && event.touches[0].clientY) || 0,
+ overing = document.elementFromPoint(clientX, clientY),
+ isGrid = this.element.data('lm-blocktype') === 'grid';
+
+
+ // Logic to auto-scroll on drag
+ var scrollHeight = this.scrollHeight,
+ Height = document.body.clientHeight,
+ Scroll = window.pageYOffset;
+
+ clearTimeout(this.scrollInterval);
+ if (!overing) { return; }
+
+ if (!$(overing).matches('#trash') && !$(overing).parent('#trash')) {
+ var st, sl, trash = $('#g5-container #trash');
+ if (clientY + 50 >= Height && Scroll + Height < scrollHeight) {
+ this.scrollInterval = setInterval(function() {
+ sl = (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0);
+ st = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);
+ window.scrollTo(sl, Math.min(scrollHeight, st + 4));
+ }, 8);
+ } else if (clientY - 50 <= (trash ? trash[0].offsetHeight : 0) && scrollHeight > 0) {
+ this.scrollInterval = setInterval(function() {
+ sl = (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0);
+ st = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);
+ window.scrollTo(sl, Math.max(0, st - 4));
+ }, 8);
+ }
+ }
+
+ // We tweak the overing to take into account the negative offset for the handle
+ if (isGrid) {
+ // More accurate is: clientX + (this.element[0].getBoundingClientRect().left - clientX)
+ overing = document.elementFromPoint(clientX + 30, clientY);
+ }
+
+ if (!overing) { return false; }
+
+ this.matched = $(overing).matches(this.options.droppables) ? overing : ($(overing).parent(this.options.droppables) || [false])[0];
+ this.isPlaceHolder = $(overing).matches('[data-lm-placeholder]') ? true : ($(overing).parent('[data-lm-placeholder]') ? true : false);
+
+ var deltaX = this.lastX - clientX,
+ deltaY = this.lastY - clientY,
+ direction = Math.abs(deltaX) > Math.abs(deltaY) && deltaX > 0 && 'left' ||
+ Math.abs(deltaX) > Math.abs(deltaY) && deltaX < 0 && 'right' ||
+ Math.abs(deltaY) > Math.abs(deltaX) && deltaY > 0 && 'up' ||
+ 'down';
+
+
+ deltaX = (event.changedTouches ? event.changedTouches[0].pageX : event.pageX) - this.origin.x;
+ deltaY = (event.changedTouches ? event.changedTouches[0].pageY : event.pageY) - this.origin.y;
+
+ var isNew = this.element.parent('.particles-container');
+ if (isNew) {
+ deltaY += this.origin.offset.scroll.y - window.scrollY;
+ }
+
+ this.direction = direction;
+ this.element.style({ transform: 'translate(' + deltaX + 'px, ' + deltaY + 'px)' });
+
+ if (!this.isPlaceHolder) {
+ if (this.lastMatched && this.matched !== this.lastMatched) {
+ this.emit('dragdrop:leave', event, this.lastMatched, this.element);
+ this.lastMatched = false;
+ }
+
+ if (this.matched && this.matched !== this.lastMatched && overing !== this.lastOvered) {
+ this.emit('dragdrop:enter', event, this.matched, this.element);
+ this.lastMatched = this.matched;
+ }
+
+ if (this.matched && this.lastMatched) {
+ var rect = this.matched.getBoundingClientRect();
+ // Note: you can divide x axis by 3 rather than 2 for 4 directions
+ var location = {
+ x: Math.abs((clientX - rect.left)) < (rect.width / 2) && 'before' ||
+ Math.abs((clientX - rect.left)) >= (rect.width - (rect.width / 2)) && 'after' ||
+ 'other',
+ y: Math.abs((clientY - rect.top)) < (rect.height / 2) && 'above' ||
+ Math.abs((clientY - rect.top)) >= (rect.height / 2) && 'below' ||
+ 'other'
+ };
+
+ this.emit('dragdrop:location', event, location, this.matched, this.element);
+ } else {
+ this.emit('dragdrop:nolocation', event);
+ }
+ }
+
+ this.lastOvered = overing;
+ this.lastX = clientX;
+ this.lastY = clientY;
+
+ this.emit('dragdrop:move', event, this.element);
+ },
+
+ _removeStyleAttribute: function(element) {
+ element = $(element || this.element);
+ if (element.data('mm-id')) { return; }
+
+ element.attribute('style', null);//.style({flex: flex});
+ }
+
+});
+
+module.exports = DragDrop;
+
+},{"../utils/elements.utils":66,"./drag.events":52,"elements/delegation":110,"elements/events":112,"mout/array/contains":166,"mout/function/bind":192,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],52:[function(require,module,exports){
+"use strict";
+var getSupportedEvent = function(events) {
+ events = events.split(' ');
+
+ var element = document.createElement('div'), event;
+ var isSupported = false;
+
+ for (var i = events.length - 1; i >= 0; i--) {
+ event = 'on' + events[i];
+ isSupported = (event in element);
+
+ if (!isSupported) {
+ element.setAttribute(event, 'return;');
+ isSupported = typeof element[event] === 'function';
+ }
+
+ if (isSupported) {
+ isSupported = events[i];
+ break;
+ }
+ }
+
+ element = null;
+ return isSupported;
+};
+
+var getSupportedEvents = function(events) {
+ events = events.split(' ');
+
+ var isSupported = false, supported = [];
+ for (var i = events.length - 1; i >= 0; i--) {
+ isSupported = getSupportedEvent(events[i]);
+ if (isSupported) { supported.push(isSupported); }
+ }
+
+ return supported;
+};
+
+var EVENT = {
+ START: getSupportedEvent('mousedown touchstart MSPointerDown pointerdown'),
+ MOVE: getSupportedEvent('mousemove touchmove MSPointerMove pointermove'),
+ STOP: getSupportedEvent('mouseup touchend MSPointerUp pointerup')
+ },
+ EVENTS = {
+ START: getSupportedEvents('mousedown touchstart MSPointerDown pointerdown'),
+ MOVE: getSupportedEvents('mousemove touchmove MSPointerMove pointermove'),
+ STOP: getSupportedEvents('mouseup touchend MSPointerUp pointerup')
+ };
+
+
+module.exports = {
+ EVENT: EVENT,
+ EVENTS: EVENTS
+};
+
+},{}],53:[function(require,module,exports){
+"use strict";
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options');
+
+
+var Eraser = new prime({
+ mixin: [Options, Bound],
+
+ inherits: Emitter,
+
+ constructor: function(element, options){
+ this.setOptions(options);
+
+ this.element = $(element);
+
+ if (!this.element) { return; }
+
+ this.hide(true);
+ },
+
+ setTop: function() {
+ if (typeof this.top !== 'undefined') { return; }
+ this.top = parseInt(this.element.compute('top'), 10);
+ this.left = $('#g5-container')[0].getBoundingClientRect().left;
+ if (GANTRY_PLATFORM == 'grav') {
+ this.left = 0;
+ }
+ },
+
+ show: function(fast){
+ if (!this.element) { return; }
+ this.setTop();
+ this.out();
+ this.element[fast ? 'style' : 'animate']({top: this.top, left: this.left}, {duration: '150ms'});
+ },
+
+ hide: function(fast){
+ if (!this.element) { return; }
+ this.setTop();
+ this.element.style('display', 'block');
+ var top = {top: -(this.element[0].offsetHeight)};
+ this.out();
+ this.element[fast ? 'style' : 'animate'](top, {duration: '150ms'});
+ },
+
+ over: function(){
+ this.element.find('.trash-zone').animate({transform: 'scale(1.2)'}, {duration: '150ms', equation: 'cubic-bezier(0.5,0,0.5,1)'});
+ },
+
+ out: function(){
+ this.element.find('.trash-zone').animate({transform: 'scale(1)'}, {duration: '150ms', equation: 'cubic-bezier(0.5,0,0.5,1)'});
+ }
+});
+
+module.exports = Eraser;
+
+},{"../utils/elements.utils":66,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],54:[function(require,module,exports){
+"use strict";
+
+var Selectize = require('./selectize');
+
+module.exports = {
+ modal: require('./modal'),
+ togglers: require('./togglers'),
+ collapse: require('./collapse'),
+ selectize: Selectize,
+ toastr: require('./toastr')
+};
+
+},{"./collapse":50,"./modal":55,"./selectize":58,"./toastr":59,"./togglers":60}],55:[function(require,module,exports){
+"use strict";
+// Based on Vex (https://github.com/hubspot/vex)
+
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ zen = require('elements/zen'),
+ storage = require('prime/map')(),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ domready = require('elements/domready'),
+
+ bind = require('mout/function/bind'),
+ map = require('mout/array/map'),
+ forEach = require('mout/array/forEach'),
+ last = require('mout/array/last'),
+ merge = require('mout/object/merge'),
+ trim = require('mout/string/trim'),
+
+ request = require('agent');
+
+var animationEndSupport = false;
+
+var Modal = new prime({
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ animationEndEvent: ['animationend', 'webkitAnimationEnd', 'mozAnimationEnd', 'MSAnimationEnd', 'oanimationend'],
+
+ globalID: 1,
+
+ options: {
+ baseClassNames: {
+ container: 'g5-dialog',
+ content: 'g5-content',
+ overlay: 'g5-overlay',
+ close: 'g5-close',
+ closing: 'g5-closing',
+ open: 'g5-dialog-open'
+ },
+
+ content: '',
+ remote: '',
+ showCloseButton: true,
+ escapeToClose: true,
+ overlayClickToClose: true,
+ appendNode: '#g5-container',
+ className: 'g5-dialog-theme-default',
+ css: {},
+ overlayClassName: '',
+ overlayCSS: '',
+ contentClassName: '',
+ contentCSS: '',
+ closeClassName: 'g5-dialog-close',
+ closeCSS: '',
+
+ afterOpen: null,
+ afterClose: null
+ },
+
+ constructor: function(options) {
+ this.setOptions(options);
+ this.defaults = this.options;
+
+ var self = this;
+ domready(function() {
+ $(window).on('keydown', function(event) {
+ if (event.keyCode === 27) {
+ return self.closeByEscape();
+ }
+ });
+
+ self.animationEndEvent = animationEndSupport;
+ });
+
+ this
+ .on('dialogOpen', function(options) {
+ $('body').addClass(options.baseClassNames.open);
+ $('html').addClass(options.baseClassNames.open);
+ })
+ .on('dialogAfterClose', bind(function(options) {
+ var all = this.getAll();
+ if (!all || !all.length) {
+ $('body').removeClass(options.baseClassNames.open);
+ $('html').removeClass(options.baseClassNames.open);
+ }
+ }, this));
+ },
+
+ storage: function() {
+ return storage;
+ },
+
+ open: function(options) {
+ options = merge(this.options, options);
+ options.id = this.globalID++;
+
+ var elements = {};
+
+ // container
+ elements.container = zen('div')
+ .addClass(options.baseClassNames.container)
+ .addClass(options.className)
+ .style(options.css)
+ .attribute('tabindex', '0')
+ .attribute('role', 'dialog')
+ .attribute('aria-hidden', 'true')
+ .attribute('aria-labelledby', 'g-modal-labelledby')
+ .attribute('aria-describedby', 'g-modal-describedby');
+
+ storage.set(elements.container, { dialog: options });
+
+ // overlay
+ elements.overlay = zen('div')
+ .addClass(options.baseClassNames.overlay)
+ .addClass(options.overlayClassName)
+ .style(options.overlayCSS);
+
+ storage.set(elements.overlay, { dialog: options });
+
+ if (options.overlayClickToClose) {
+ elements.container.on('click', bind(this._overlayClick, this, elements.container[0]));
+ elements.overlay.on('click', bind(this._overlayClick, this, elements.overlay[0]));
+ }
+
+ elements.container.appendChild(elements.overlay);
+
+ // content
+ elements.content = zen('div')
+ .addClass(options.baseClassNames.content)
+ .addClass(options.contentClassName)
+ .style(options.contentCSS)
+ .attribute('aria-live', 'assertive')
+ .attribute('tabindex', '0')
+ .html(options.content);
+
+ storage.set(elements.content, { dialog: options });
+ elements.container.appendChild(elements.content);
+
+ if (options.overlayClickToClose) {
+ elements.content.on('click', function(/*e*/){
+ return true;
+ });
+ }
+
+ // remote
+ if (options.remote && options.remote.length > 1) {
+ this.showLoading();
+
+ options.method = options.method || 'get';
+ var agent = request();
+ agent.method(options.method);
+ agent.url(options.remote);
+ if (options.data) { agent.data(options.data); }
+
+ agent.send(bind(function(error, response) {
+ if (elements.container.hasClass(options.baseClassNames.closing)) {
+ this.hideLoading();
+ return;
+ }
+
+ elements.content.html(response.body.html || response.body);
+
+ if (!response.body.success) {
+ if (!response.body.html && !response.body.message) { elements.content.style({ width: '90%' }); }
+ }
+
+ this.hideLoading();
+ if (options.remoteLoaded && !elements.container.hasClass(options.baseClassNames.closing)) {
+ options.remoteLoaded(response, options);
+ }
+
+ elements.container.attribute('aria-hidden', 'false');
+ setTimeout(function(){ elements.content[0].focus(); }, 0);
+
+ var selects = $('[data-selectize]');
+ if (selects) { selects.selectize(); }
+ }, this));
+ } else {
+ elements.container.attribute('aria-hidden', 'false');
+ setTimeout(function(){ elements.content[0].focus(); }, 0);
+ }
+
+ // close button
+ if (options.showCloseButton) {
+ elements.closeButton = zen('div')
+ .addClass(options.baseClassNames.close)
+ .addClass(options.closeClassName)
+ .attribute('role', 'button').attribute('aria-label', 'Close')
+ .style(options.closeCSS);
+
+ storage.set(elements.closeButton, { dialog: options });
+ elements.content.appendChild(elements.closeButton);
+ }
+
+ // delegate container to pick g5-close clicks
+ elements.container.delegate('click', '.g5-dialog-close', bind(function(event){
+ event.preventDefault();
+ this._closeButtonClick(elements.container);
+ }, this));
+
+ // inject the dialog in the DOM
+ var container = $(options.appendNode);
+
+ // wordpress workaround for out-of-scope cases
+ if (GANTRY_PLATFORM == 'wordpress') {
+ container = $('#widgets-editor') || $('#customize-preview') || $('#widgets-right') || $(options.appendNode);
+ if ('#' + container.id() != options.appendNode) {
+ var wpwrap = $('#wpwrap') || $('.wp-customizer'), sibling, workaround;
+ if (wpwrap.id() == 'wpwrap') {
+ sibling = wpwrap.nextSibling(options.appendNode);
+ workaround = sibling ? sibling : zen('div.g5wp-out-of-scope' + options.appendNode).after(wpwrap);
+ } else {
+ sibling = wpwrap.find('> ' + options.appendNode);
+ workaround = sibling ? sibling : zen('div.g5wp-out-of-scope' + options.appendNode).top(wpwrap);
+ }
+ container = workaround;
+ }
+ }
+
+ container.appendChild(elements.container);
+
+ options.elements = elements;
+
+ if (options.afterOpen) {
+ options.afterOpen(elements.content, options);
+ }
+
+ setTimeout(bind(function() {
+ return this.emit('dialogOpen', options);
+ }, this), 0);
+
+ return elements.content;
+ },
+
+ getAll: function() {
+ var options = this.options;
+ return $("." + options.baseClassNames.container + ":not(." + options.baseClassNames.closing + ") ." + options.baseClassNames.content);
+ },
+
+ getByID: function(id) {
+ var all = this.getAll();
+ if (!all) { return []; }
+
+ return $(all.filter(function(element) {
+ element = $(element);
+ return storage.get(element).dialog.id === id;
+ }));
+ },
+
+ getLast: function() {
+ var ids, id;
+
+ ids = map(this.getAll(), function(element) {
+ element = $(element);
+
+ return storage.get(element).dialog.id;
+ });
+
+ if (!ids.length) {
+ return false;
+ }
+
+ return Math.max.apply(Math, ids);
+ },
+
+ close: function(id) {
+ if (!id) {
+ var element = $(last(this.getAll()));
+ if (!element) {
+ return false;
+ }
+
+ id = storage.get(element).dialog.id;
+ }
+
+ return this.closeByID(id);
+ },
+
+ closeAll: function() {
+ var ids;
+
+ ids = map(this.getAll(), function(element) {
+ element = $(element);
+
+ return storage.get(element).dialog.id;
+ });
+
+ if (!ids.length) {
+ return false;
+ }
+
+ forEach(ids.reverse(), function(id) {
+ return this.closeByID(id);
+ }, this);
+
+ return true;
+ },
+
+ closeByID: function(id) {
+ var content = this.getByID(id);
+ if (!content || !content.length) {
+ return false;
+ }
+
+ var container, options;
+
+ container = storage.get(content).dialog.elements.container;
+ options = merge({}, storage.get(content).dialog);
+
+ var beforeClose = function() {
+ if (options.beforeClose) {
+ return options.beforeClose(content, options);
+ }
+ },
+ close = bind(function() {
+ if (options.remoteLoaded) { options.remoteLoaded = function(){}; }
+ content.emit('dialogClose', options);
+ container.remove();
+ this.emit('dialogAfterClose', options);
+ if (options.afterClose) {
+ return options.afterClose(content, options);
+ }
+
+ }, this);
+
+ if (animationEndSupport) {
+ beforeClose();
+ container.off(this.animationEndEvent).on(this.animationEndEvent, function() {
+ return close();
+ }).addClass(options.baseClassNames.closing);
+ } else {
+ beforeClose();
+ close();
+ }
+
+ return true;
+ },
+
+ closeByEscape: function() {
+ var id = this.getLast();
+
+ if (id === false) {
+ return false;
+ }
+
+ var element = this.getByID(id);
+
+ if (!storage.get(element).dialog.escapeToClose) {
+ return false;
+ }
+
+ return this.closeByID(id);
+
+ },
+
+ enableCloseByOverlay: function() {
+ var id = this.getLast();
+
+ if (id === false) {
+ return false;
+ }
+
+ var elements = storage.get(this.getByID(id)).dialog.elements;
+
+ elements.container.on('click', bind(this._overlayClick, this, elements.container[0]));
+ elements.overlay.on('click', bind(this._overlayClick, this, elements.overlay[0]));
+
+ elements.content.on('click', function(/*e*/){
+ return true;
+ });
+ },
+
+ showLoading: function() {
+ this.hideLoading();
+ return $('#g5-container').appendChild(zen('div.g5-dialog-loading-spinner.' + this.options.className));
+ },
+
+ hideLoading: function() {
+ var spinner = $('.g5-dialog-loading-spinner');
+ return spinner ? spinner.remove() : false;
+ },
+
+ // private
+ _overlayClick: function(element, event) {
+ if (event.target !== element) {
+ return;
+ }
+
+ return this.close(storage.get($(element)).dialog.id);
+ },
+
+ _closeButtonClick: function(element) {
+ return this.close(storage.get($(element)).dialog.id);
+ }
+});
+
+domready(function() {
+ var style = (document.body || document.documentElement).style;
+
+ forEach(['animation', 'WebkitAnimation', 'MozAnimation', 'MsAnimation', 'OAnimation'], function(animation, index) {
+ if (animationEndSupport) {
+ return;
+ }
+ animationEndSupport = style[animation] !== undefined ? Modal.prototype.animationEndEvent[index] : false;
+ });
+});
+
+var modal = new Modal();
+
+module.exports = modal;
+
+},{"../utils/elements.utils":66,"agent":80,"elements/domready":111,"elements/zen":137,"mout/array/forEach":174,"mout/array/last":179,"mout/array/map":180,"mout/function/bind":192,"mout/object/merge":237,"mout/string/trim":272,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302}],56:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ zen = require('elements/zen'),
+ storage = require('prime/map')(),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ domready = require('elements/domready'),
+
+ bind = require('mout/function/bind'),
+ map = require('mout/array/map'),
+ forEach = require('mout/array/forEach'),
+ last = require('mout/array/last'),
+ merge = require('mout/object/merge'),
+ isFunct = require('mout/lang/isFunction'),
+
+ request = require('agent');
+
+var Popover = new prime({
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ options: {
+ mainClass: 'g5-popover',
+ placement: 'auto',
+ width: 'auto',
+ height: 'auto',
+ trigger: 'click',
+ style: '',
+ delay: 300,
+ cache: true,
+ multi: false,
+ arrow: true,
+ title: '',
+ content: '',
+ closeable: false,
+ padding: true,
+ targetEvents: true,
+ allowElementsClick: false,
+ url: '',
+ type: 'html',
+ where: '#g5-container',
+ template: '' +
+ '
' +
+ '
' +
+ '
x' +
+ '
' +
+ '
' +
+ '
' +
+ '
'
+ },
+
+ constructor: function(element, options) {
+ this.setOptions(options);
+ this.element = $(element);
+
+ if (this.options.trigger === 'click') {
+ this.element.off('click', this.bound('toggle')).on('click', this.bound('toggle'));
+ } else {
+ this.element.off('mouseenter', this.bound('mouseenterHandler')).off('mouseleave', this.bound('mouseleaveHandler'))
+ .on('mouseenter', this.bound('mouseenterHandler'))
+ .on('mouseleave', this.bound('mouseleaveHandler'));
+ }
+
+ this._poped = false;
+ //this._inited = true;
+ },
+
+ destroy: function() {
+ this.hide();
+ storage.set(this.element[0], null);
+ this.element.off('click', this.bound('toggle')).off('mouseenter', this.bound('mouseenterHandler')).off('mouseleave', this.bound('mouseleaveHandler'));
+
+ if (this.$target) {
+ this.$target.remove();
+ }
+ },
+
+ hide: function(event) {
+ if (event) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ //var e = $.Event('hide.' + pluginType);
+ this.element.emit('hide.popover', this);
+ if (this.$target) {
+ this.$target.removeClass('in').style({ display: 'none' });
+ this.$target.remove();
+ }
+ this.element.emit('hidden.popover', this);
+
+ if (this._focusAttached) {
+ $('body').off('focus', this.bound('focus'), true);
+ this._focusAttached = false;
+ this.restoreFocus();
+ }
+ },
+
+ toggle: function(e) {
+ if (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ this[this.getTarget().hasClass('in') ? 'hide' : 'show']();
+ },
+
+ focus: function(e) {
+ if (!this.getTarget().hasClass('in')) { return; }
+ var self = this,
+ target = $(e.target || e);
+
+ if (
+ this.$target[0] === target[0] || target.parent(this.$target) ||
+ this.element[0] === target[0] || target.parent(this.element)
+ ) { return; }
+
+ this.hide();
+ if (this._focusAttached) this.restoreFocus();
+ },
+
+ restoreFocus: function(element) {
+ element = $(element || this.element);
+ var tag = element.tag();
+
+ setTimeout(function(){
+ if (tag != 'a' && tag != 'input' && tag != 'button') {
+ var items = element.find('a, button, input');
+ if (items) items[0].focus();
+ } else {
+ element[0].focus();
+ }
+ }, 0);
+ },
+
+ hideAll: function(force) {
+ var css = '';
+ if (force) { css = 'div.' + this.options.mainClass; }
+ else { css = 'div.' + this.options.mainClass + ':not(.' + this.options.mainClass + '-fixed)'; }
+
+ var elements = $(css);
+ if (!elements) { return this; }
+ elements.removeClass('in').style({ display: 'none' }).attribute('tabindex', '-1');
+ if (!force && this._focusAttached) this.restoreFocus();
+
+ if (this._focusAttached) {
+ $('body').off('focus', this.bound('focus'), true);
+ this._focusAttached = false;
+ }
+ return this;
+ },
+
+ show: function() {
+ var target = this.getTarget().attribute('class', null).addClass(this.options.mainClass).attribute('tabindex', '0');
+
+ if (!this.options.multi) {
+ this.hideAll();
+ }
+
+ // use cache by default, if not cache setted , reInit the contents
+ this.element.emit('beforeshow.popover', this);
+ if (!this.options.cache || !this._poped) {
+ this.setTitle(this.getTitle());
+
+ if (!this.options.closeable) {
+ target.find('.close').off('click').remove();
+ }
+
+ if (!this.isAsync()) {
+ this.setContent(this.getContent());
+ } else {
+ this.setContentASync(this.options.content);
+ this.displayContent();
+ return;
+ }
+
+ target.style({ display: 'block' });
+ }
+
+ this.displayContent();
+ this.bindBodyEvents();
+
+ setTimeout(function(){
+ target[0].focus();
+ }, 0);
+
+ if (!this._focusAttached) {
+ $('body').on('focus', this.bound('focus'), true);
+ this._focusAttached = true;
+ }
+ },
+
+ displayContent: function() {
+ var elementPos = this.element.position(),
+ target = this.getTarget().attribute('class', null).addClass(this.options.mainClass),
+ targetContent = this.getContentElement(),
+ targetWidth, targetHeight, placement;
+
+ this.element.emit('show.popover', this);
+
+ if (this.options.width !== 'auto') {
+ target.style({ width: this.options.width });
+ }
+ if (this.options.height !== 'auto') {
+ targetContent.style({ height: this.options.height });
+ }
+
+ // init the popover and insert into the document body
+ if (!this.options.arrow && target.find('.g-arrow')) {
+ target.find('.g-arrow').remove();
+ }
+
+ var container = $(this.options.where);
+
+ // wordpress workaround for out-of-scope cases
+ if (GANTRY_PLATFORM == 'wordpress') {
+ container = $('#widgets-editor') || $('#customize-preview') || $('#widgets-right') || $(this.options.where);
+ if ('#' + container.id() != this.options.where) {
+ var wpwrap = $('#wpwrap') || $('.wp-customizer'), sibling, workaround;
+ if (wpwrap.id() == 'wpwrap') {
+ sibling = wpwrap.nextSibling(this.options.where);
+ workaround = sibling ? sibling : zen('div.g5wp-out-of-scope' + this.options.where).after(wpwrap);
+ } else {
+ sibling = wpwrap.find('> ' + this.options.where);
+ workaround = sibling ? sibling : zen('div.g5wp-out-of-scope' + this.options.where).top(wpwrap);
+ }
+ container = workaround;
+ }
+ }
+
+ target.remove().style({
+ top: -1000,
+ left: -1000,
+ display: 'block'
+ }).bottom(container);
+
+ if (this.options.style) {
+ if (typeof this.options.style === 'string') {
+ this.options.style = this.options.style.split(',').map(Function.prototype.call, String.prototype.trim);
+ }
+
+ this.options.style.forEach(function(style) {
+ this.$target.addClass(this.options.mainClass + '-' + style);
+ }, this);
+ }
+
+ if (!this.options.padding) {
+ targetContent.css('height', targetContent.position().height);
+ this.$target.addClass('g5-popover-no-padding');
+ }
+
+ targetWidth = target[0].offsetWidth;
+ targetHeight = target[0].offsetHeight;
+ placement = this.getPlacement(elementPos, targetHeight);
+ if (this.options.targetEvents) { this.initTargetEvents(); }
+ var positionInfo = this.getTargetPosition(elementPos, placement, targetWidth, targetHeight);
+ this.$target.style(positionInfo.position).addClass(placement).addClass('in');
+
+ if (this.options.type === 'iframe') {
+ var iframe = target.find('iframe');
+ iframe.style({
+ width: target.position().width,
+ height: iframe.parent().position.height
+ });
+ }
+
+ if (!this.options.arrow) {
+ this.$target.style({ 'margin': 0 });
+ }
+ if (this.options.arrow) {
+ var arrow = this.$target.find('.g-arrow');
+ arrow.attribute('style', null);
+ if (positionInfo.arrowOffset) {
+ arrow.style(positionInfo.arrowOffset);
+ }
+ }
+
+ this._poped = true;
+ this.element[0].focus();
+ this.element.emit('shown.popover', this);
+
+ },
+
+
+ /*getter setters */
+ getTarget: function() {
+ if (!this.$target) {
+ this.$target = $(zen('div').html(this.options.template).children()[0]);
+ }
+ return this.$target;
+ },
+
+ getTitleElement: function() {
+ return this.getTarget().find('.' + this.options.mainClass + '-title');
+ },
+
+ getContentElement: function() {
+ return this.getTarget().find('.' + this.options.mainClass + '-content');
+ },
+
+ getTitle: function() {
+ return this.options.title || this.element.data('g5-popover-title') || this.element.attribute('title');
+ },
+
+ setTitle: function(title) {
+ var element = this.getTitleElement();
+ if (title) {
+ element.html(title);
+ }
+ else {
+ element.remove();
+ }
+ },
+
+ hasContent: function() {
+ return this.getContent();
+ },
+
+ getContent: function() {
+ if (this.options.url) {
+ if (this.options.type === 'iframe') {
+ this.content = $('').attribute('src', this.options.url);
+ }
+ } else if (!this.content) {
+ var content = '';
+ if (isFunct(this.options.content)) {
+ content = this.options.content.apply(this.element[0], arguments);
+ } else {
+ content = this.options.content;
+ }
+ this.content = this.element.data('g5-popover-content') || content;
+ }
+ return this.content;
+ },
+
+ setContent: function(content) {
+ var target = this.getTarget();
+ this.getContentElement().html(content);
+ this.$target = target;
+ },
+
+ isAsync: function() {
+ return this.options.type === 'async';
+ },
+
+ setContentASync: function(content) {
+ request('get', this.options.url, bind(function(error, response) {
+ if (content && isFunct(content)) {
+ this.content = content.apply(this.element[0], [response]);
+ } else {
+ this.content = response.body.html;
+ }
+
+ this.setContent(this.content);
+
+ var target = this.getContentElement();
+ target.attribute('style', null);
+
+ setTimeout(bind(function(){
+ target.parent('.' + this.options.mainClass)[0].focus();
+ }, this), 0);
+
+ this.displayContent();
+ this.bindBodyEvents();
+
+ var selects = $('[data-selectize]');
+ if (selects) { selects.selectize(); }
+ }, this));
+ },
+
+ bindBodyEvents: function() {
+ var body = $('body');
+ body.off('keyup', this.bound('escapeHandler')).on('keyup', this.bound('escapeHandler'));
+ body.off('click', this.bound('bodyClickHandler')).on('click', this.bound('bodyClickHandler'));
+ },
+
+
+ /* event handlers */
+ mouseenterHandler: function() {
+ if (this._timeout) {
+ clearTimeout(this._timeout);
+ }
+ if (!(this.getTarget()[0].offsetWidth > 0 || this.getTarget()[0].offsetHeight > 0)) {
+ this.show();
+ }
+ },
+ mouseleaveHandler: function() {
+ // key point, set the _timeout then use clearTimeout when mouse leave
+ this._timeout = setTimeout(bind(function() {
+ this.hide();
+ }, this), this.options.delay);
+ },
+
+ escapeHandler: function(e) {
+ if (e.keyCode === 27) {
+ this.hideAll();
+ }
+ },
+
+ bodyClickHandler: function() {
+ this.hideAll();
+ },
+
+ targetClickHandler: function(e) {
+ var target = $(e.target);
+ if (target.matches(this.options.allowElementsClick)) { e.preventDefault(); }
+ if (!target.parent('[data-g-popover-follow]') && target.data('g-popover-follow') === null) { e.stopPropagation(); }
+ },
+
+ initTargetEvents: function() {
+ if (this.options.trigger !== 'click') {
+ this.$target
+ .off('mouseenter', this.bound('mouseenter'))
+ .off('mouseleave', this.bound('mouseleave'))
+ .on('mouseenter', this.bound('mouseenterHandler'))
+ .on('mouseleave', this.bound('mouseleaveHandler'));
+ }
+
+ var close = this.$target.find('.close');
+ if (close) {
+ close.off('click', this.bound('hide')).on('click', this.bound('hide'));
+ }
+
+ this.$target.off('click', this.bound('targetClickHandler')).on('click', this.bound('targetClickHandler'));
+ },
+
+ /* utils methods */
+ getPlacement: function(pos, targetHeight) {
+ var
+ placement,
+ de = document.documentElement,
+ db = document.body,
+ clientWidth = de.clientWidth,
+ clientHeight = de.clientHeight,
+ scrollTop = Math.max(db.scrollTop, de.scrollTop),
+ scrollLeft = Math.max(db.scrollLeft, de.scrollLeft),
+ pageX = Math.max(0, pos.left - scrollLeft),
+ pageY = Math.max(0, pos.top - scrollTop),
+ arrowSize = 20;
+
+ // if placement equals auto,caculate the placement by element information;
+ if (typeof(this.options.placement) === 'function') {
+ placement = this.options.placement.call(this, this.getTarget()[0], this.element[0]);
+ } else {
+ placement = this.element.data('g5-popover-placement') || this.options.placement;
+ }
+
+ if (placement === 'auto') {
+ if (pageX < clientWidth / 3) {
+ if (pageY < clientHeight / 3) {
+ placement = 'bottom-right';
+ } else if (pageY < clientHeight * 2 / 3) {
+ placement = 'right';
+ } else {
+ placement = 'top-right';
+ }
+ //placement= pageY>targetHeight+arrowSize?'top-right':'bottom-right';
+ } else if (pageX < clientWidth * 2 / 3) {
+ if (pageY < clientHeight / 3) {
+ placement = 'bottom';
+ } else if (pageY < clientHeight * 2 / 3) {
+ placement = 'bottom';
+ } else {
+ placement = 'top';
+ }
+ } else {
+ placement = pageY > targetHeight + arrowSize ? 'top-left' : 'bottom-left';
+ if (pageY < clientHeight / 3) {
+ placement = 'bottom-left';
+ } else if (pageY < clientHeight * 2 / 3) {
+ placement = 'left';
+ } else {
+ placement = 'top-left';
+ }
+ }
+ }
+ return placement;
+ },
+
+ getTargetPosition: function(elementPos, placement, targetWidth, targetHeight) {
+ var pos = elementPos,
+ elementW = this.element[0].offsetWidth,
+ elementH = this.element[0].offsetHeight,
+ position = {},
+ arrowOffset = null,
+ arrowSize = this.options.arrow ? 28 : 0,
+ fixedW = elementW < arrowSize + 10 ? arrowSize : 0,
+ fixedH = elementH < arrowSize + 10 ? arrowSize : 0;
+
+ switch (placement) {
+ case 'bottom':
+ position = {
+ top: pos.top + pos.height,
+ left: pos.left + pos.width / 2 - targetWidth / 2
+ };
+ break;
+ case 'top':
+ position = {
+ top: pos.top - targetHeight,
+ left: pos.left + pos.width / 2 - targetWidth / 2
+ };
+ break;
+ case 'left':
+ position = {
+ top: pos.top + pos.height / 2 - targetHeight / 2,
+ left: pos.left - targetWidth
+ };
+ break;
+ case 'right':
+ position = {
+ top: pos.top + pos.height / 2 - targetHeight / 2,
+ left: pos.left + pos.width
+ };
+ break;
+ case 'top-right':
+ position = {
+ top: pos.top - targetHeight,
+ left: pos.left - fixedW
+ };
+ arrowOffset = { left: elementW / 2 + fixedW };
+ break;
+ case 'top-left':
+ position = {
+ top: pos.top - targetHeight,
+ left: pos.left - targetWidth + pos.width + fixedW
+ };
+ arrowOffset = { left: targetWidth - elementW / 2 - fixedW };
+ break;
+ case 'bottom-right':
+ position = {
+ top: pos.top + pos.height,
+ left: pos.left - fixedW
+ };
+ arrowOffset = { left: elementW / 2 + fixedW };
+ break;
+ case 'bottom-left':
+ position = {
+ top: pos.top + pos.height,
+ left: pos.left - targetWidth + pos.width + fixedW
+ };
+ arrowOffset = { left: targetWidth - elementW / 2 - fixedW };
+ break;
+ case 'right-top':
+ position = {
+ top: pos.top - targetHeight + pos.height + fixedH,
+ left: pos.left + pos.width
+ };
+ arrowOffset = { top: targetHeight - elementH / 2 - fixedH };
+ break;
+ case 'right-bottom':
+ position = {
+ top: pos.top - fixedH,
+ left: pos.left + pos.width
+ };
+ arrowOffset = { top: elementH / 2 + fixedH };
+ break;
+ case 'left-top':
+ position = {
+ top: pos.top - targetHeight + pos.height + fixedH,
+ left: pos.left - targetWidth
+ };
+ arrowOffset = { top: targetHeight - elementH / 2 - fixedH };
+ break;
+ case 'left-bottom':
+ position = {
+ top: pos.top,
+ left: pos.left - targetWidth
+ };
+ arrowOffset = { top: elementH / 2 };
+ break;
+
+ }
+
+ return {
+ position: position,
+ arrowOffset: arrowOffset
+ };
+ }
+
+});
+
+$.implement({
+ getPopover: function(options) {
+ var popover = storage.get(this);
+
+ if (!popover && options !== 'destroy') {
+ options = options || {};
+ popover = new Popover(this, options);
+ storage.set(this, popover);
+ this.PopoverDefined = true;
+ }
+
+ return popover;
+ },
+
+ popover: function(options) {
+ return this.forEach(function(element) {
+ var popover = storage.get(element);
+
+ if (!popover && options !== 'destroy') {
+ options = options || {};
+ popover = new Popover(element, options);
+ storage.set(element, popover);
+ }
+ });
+ },
+
+ position: function() {
+ var node = this[0],
+ ct = $('#g5-container')[0].getBoundingClientRect(),
+ box = {
+ left: 0,
+ right: 0,
+ top: 0,
+ bottom: 0
+ };
+
+ if (typeof node.getBoundingClientRect !== "undefined") {
+ box = node.getBoundingClientRect();
+ }
+
+ return {
+ x: box.left - ct.left,
+ left: box.left - ct.left,
+ y: box.top - ct.top,
+ top: box.top - ct.top,
+ right: box.right - ct.right,
+ bottom: box.bottom - ct.bottom,
+ width: box.right - box.left,
+ height: box.bottom - box.top
+ };
+ }
+});
+
+module.exports = $;
+
+},{"../utils/elements.utils":66,"agent":80,"elements/domready":111,"elements/zen":137,"mout/array/forEach":174,"mout/array/last":179,"mout/array/map":180,"mout/function/bind":192,"mout/lang/isFunction":205,"mout/object/merge":237,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302}],57:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ zen = require('elements/zen'),
+ moofx = require('moofx'),
+
+ bind = require('mout/function/bind'),
+ isArray = require('mout/lang/isArray'),
+ isNumber = require('mout/lang/isNumber');
+
+var Progresser = new prime({
+
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ options: {
+ value: 0.0,
+ size: 50.0,
+ startAngle: -Math.PI / 2,
+ thickness: 'auto',
+ fill: { // { color: 'hex|rgba' } || { gradient: [from, to], gradientAngle: Math.PI / 4, gradientDirection: [x0, y0, x1, y1] }
+ gradient: ['#9e38eb', '#4e68fc']//['#3aeabb', '#fdd250']
+ },
+ emptyFill: 'rgba(0, 0, 0, .1)',
+ animation: {
+ duration: 1200,
+ equation: 'cubic-bezier(0.645, 0.045, 0.355, 1)'
+ },
+ animationStartValue: 0.0,
+ reverse: false,
+ lineCap: 'butt', // butt, round, square
+ insertElement: null,
+ insertLocation: 'before'
+ },
+
+ constructor: function(element, options) {
+ this.setOptions(options);
+
+ this.element = this.element || $(element);
+ this.canvas = this.canvas || zen('canvas')[this.options.insertLocation || 'before'](this.options.insertElement || this.element)[0];
+ this.radius = this.options.size / 2;
+ this.arcFill = null;
+ this.lastFrameValue = 0.0;
+
+ this.canvas.width = this.options.size;
+ this.canvas.height = this.options.size;
+ this.ctx = this.canvas.getContext('2d');
+
+ this.initFill();
+ this.draw();
+ },
+
+ initFill: function() {
+ var fill = this.options.fill,
+ size = this.options.size,
+ ctx = this.ctx;
+
+ if (!fill) { throw Error('The fill is not specified.'); }
+
+ if (fill.color) {
+ this.arcFill = fill.color;
+ }
+
+ if (fill.gradient) {
+ var gr = fill.gradient;
+
+ if (gr.length == 1) { this.arcFill = gr[0]; }
+ else {
+ var ga = fill.gradientAngle || 0, // gradient direction angle; 0 by default
+ gd = fill.gradientDirection || [
+ size / 2 * (1 - Math.cos(ga)), // x0
+ size / 2 * (1 + Math.sin(ga)), // y0
+ size / 2 * (1 + Math.cos(ga)), // x1
+ size / 2 * (1 - Math.sin(ga)) // y1
+ ],
+ lg = ctx.createLinearGradient.apply(ctx, gd);
+
+ for (var i = 0; i < gr.length; i++) {
+ var color = gr[i],
+ pos = i / (gr.length - 1);
+
+ if (isArray(color)) {
+ pos = color[1];
+ color = color[0];
+ }
+
+ lg.addColorStop(pos, color);
+ }
+
+ this.arcFill = lg;
+ }
+ }
+ },
+
+ draw: function() {
+ this[this.options.animation ? 'drawAnimated' : 'drawFrame'](this.options.value);
+ },
+
+ drawFrame: function(v) {
+ this.lastFrameValue = v;
+ this.ctx.clearRect(0, 0, this.options.size, this.options.size);
+ this.drawEmptyArc(v);
+ this.drawArc(v);
+ },
+
+ drawArc: function(v) {
+ var ctx = this.ctx,
+ r = this.radius,
+ t = this.getThickness(),
+ a = this.options.startAngle;
+
+ ctx.save();
+ ctx.beginPath();
+
+ if (!this.options.reverse) {
+ ctx.arc(r, r, r - t / 2, a, a + Math.PI * 2 * v);
+ } else {
+ ctx.arc(r, r, r - t / 2, a - Math.PI * 2 * v, a);
+ }
+
+ ctx.lineWidth = t;
+ ctx.lineCap = this.options.lineCap;
+ ctx.strokeStyle = this.arcFill;
+ ctx.stroke();
+ ctx.restore();
+ },
+
+ drawEmptyArc: function(v) {
+ var ctx = this.ctx,
+ r = this.radius,
+ t = this.getThickness(),
+ a = this.options.startAngle;
+
+ if (v < 1) {
+ ctx.save();
+ ctx.beginPath();
+
+ if (v <= 0) {
+ ctx.arc(r, r, r - t / 2, 0, Math.PI * 2);
+ } else {
+ if (!this.reverse) {
+ ctx.arc(r, r, r - t / 2, a + Math.PI * 2 * v, a);
+ } else {
+ ctx.arc(r, r, r - t / 2, a, a - Math.PI * 2 * v);
+ }
+ }
+
+ ctx.lineWidth = t;
+ ctx.strokeStyle = this.options.emptyFill;
+ ctx.stroke();
+ ctx.restore();
+ }
+ },
+
+ drawAnimated: function(v) {
+ this.element.emit('progress-animation-start');
+
+ moofx(bind(function(now) {
+ var stepValue = this.options.animationStartValue * (1 - now) + v * now;
+ this.drawFrame(stepValue);
+ this.element.emit('progress-animation-change', now, stepValue);
+ }, this), {
+ duration: this.options.animation.duration || '1200',
+ equation: this.options.animation.equation || 'linear',
+ callback: bind(function() {
+ if (this.options.animation.callback) { this.options.animation.callback(); }
+ this.element.emit('progress-animation-end');
+ }, this)
+ }).start(0, 1);
+ },
+
+ getThickness: function() {
+ return isNumber(this.options.thickness) ? this.options.thickness : this.options.size / 14;
+ }
+});
+
+module.exports = Progresser;
+
+},{"elements":113,"elements/zen":137,"moofx":138,"mout/function/bind":192,"mout/lang/isArray":203,"mout/lang/isNumber":207,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],58:[function(require,module,exports){
+"use strict";
+// selectize (v0.12.1) (commit: 4dae761)
+
+var prime = require('prime'),
+ ready = require('elements/domready'),
+ zen = require('elements/zen'),
+
+ sifter = require('sifter'),
+
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+
+ $ = require('../utils/elements.utils'),
+ moofx = require('moofx'),
+
+ bind = require('mout/function/bind'),
+ forEach = require('mout/collection/forEach'),
+ indexOf = require('mout/array/indexOf'),
+ last = require('mout/array/last'),
+ debounce = require('mout/function/debounce'),
+ isArray = require('mout/lang/isArray'),
+ isBoolean = require('mout/lang/isBoolean'),
+ merge = require('mout/object/merge'),
+ unset = require('mout/object/unset'),
+ size = require('mout/object/size'),
+ values = require('mout/object/values'),
+ escapeHTML = require('mout/string/escapeHtml'),
+ trim = require('mout/string/trim'),
+ slugify = require('mout/string/slugify');
+
+
+var IS_MAC = /Mac/.test(navigator.userAgent),
+ IS_IE = /MSIE 9/i.test(navigator.userAgent) || /MSIE 10/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent),
+ COUNT = 0,
+
+ KEY_A = 65,
+ KEY_COMMA = 188,
+ KEY_RETURN = 13,
+ KEY_ESC = 27,
+ KEY_LEFT = 37,
+ KEY_UP = 38,
+ KEY_P = 80,
+ KEY_RIGHT = 39,
+ KEY_DOWN = 40,
+ KEY_N = 78,
+ KEY_BACKSPACE = 8,
+ KEY_DELETE = 46,
+ KEY_SHIFT = 16,
+ KEY_CMD = IS_MAC ? 91 : 17,
+ KEY_CTRL = IS_MAC ? 18 : 17,
+ KEY_TAB = 9,
+
+ TAG_SELECT = 1,
+ TAG_INPUT = 2,
+
+ // for now, android support in general is too spotty to support validity
+ SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('form').validity;
+
+var hash_key = function(value) {
+ if (typeof value === 'undefined' || value === null) return null;
+ if (typeof value === 'boolean') return value ? '1' : '0';
+ return value + '';
+};
+
+var isset = function(object) {
+ return typeof object !== 'undefined';
+};
+
+var escape_replace = function(str) {
+ return (str + '').replace(/\$/g, '$$$$');
+};
+
+var once = function(fn) {
+ var called = false;
+ return function() {
+ if (called) return;
+ called = true;
+ fn.apply(this, arguments);
+ };
+};
+
+var debounce_events = function(self, types, fn) {
+ var type;
+ var trigger = self.emit;
+ var event_args = {};
+
+ // override trigger method
+ self.emit = function() {
+ var type = arguments[0];
+ if (types.indexOf(type) !== -1) {
+ event_args[type] = arguments;
+ } else {
+ return trigger.apply(self, arguments);
+ }
+ };
+
+ // invoke provided function
+ fn.apply(self, []);
+ self.emit = trigger;
+
+ // trigger queued events
+ for (type in event_args) {
+ if (event_args.hasOwnProperty(type)) {
+ trigger.apply(self, event_args[type]);
+ }
+ }
+};
+
+var build_hash_table = function(key, objects) {
+ if (!isArray(objects)) return objects;
+ var i, n, table = {};
+ for (i = 0, n = objects.length; i < n; i++) {
+ if (objects[i].hasOwnProperty(key)) {
+ table[objects[i][key]] = objects[i];
+ }
+ }
+ return table;
+};
+
+var domToString = function(d) {
+ var tmp = document.createElement('div');
+ tmp.appendChild(d.cloneNode(true));
+ return tmp.innerHTML;
+};
+
+var getSelection = function(input) {
+ var result = {};
+ if ('selectionStart' in input) {
+ result.start = input.selectionStart;
+ result.length = input.selectionEnd - result.start;
+ } else if (document.selection) {
+ input.focus();
+ var sel = document.selection.createRange();
+ var selLen = document.selection.createRange().text.length;
+ sel.moveStart('character', -input.value.length);
+ result.start = sel.text.length - selLen;
+ result.length = selLen;
+ }
+ return result;
+};
+
+var transferStyles = function($from, $to, properties) {
+ var i, n, styles = {};
+ if (properties) {
+ for (i = 0, n = properties.length; i < n; i++) {
+ styles[properties[i]] = $from.compute(properties[i]);
+ }
+ } else {
+ styles = $from.compute();
+ }
+ $to.style(styles);
+};
+
+var measured = null;
+var measureString = function(str, $parent) {
+ if (!str) {
+ return 0;
+ }
+
+ var $test;
+ if (!measured) {
+ $test = zen('test').style({
+ position: 'absolute',
+ top: -99999,
+ left: -99999,
+ width: 'auto',
+ padding: 0,
+ whiteSpace: 'pre'
+ }).text(str).bottom('body');
+
+ transferStyles($parent, $test, [
+ 'letterSpacing',
+ 'fontSize',
+ 'fontFamily',
+ 'fontWeight',
+ 'textTransform'
+ ]);
+
+ measured = $test;
+ } else {
+ $test = measured;
+ $test.text(str);
+ }
+
+ //var width = $test[0].offsetWidth;
+ //$test.remove();
+
+ return $test[0].offsetWidth;
+};
+
+var highlight = function($element, pattern) {
+ if (typeof pattern === 'string' && !pattern.length) return;
+ var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;
+
+ var highlight = function(node) {
+ var skip = 0;
+ if (node.nodeType === 3) {
+ var pos = node.data.search(regex);
+ if (pos >= 0 && node.data.length > 0) {
+ var match = node.data.match(regex);
+ var spannode = document.createElement('span');
+ spannode.className = 'g-highlight';
+ var middlebit = node.splitText(pos);
+ var endbit = middlebit.splitText(match[0].length);
+ var middleclone = middlebit.cloneNode(true);
+ spannode.appendChild(middleclone);
+ middlebit.parentNode.replaceChild(spannode, middlebit);
+ skip = 1;
+ }
+ } else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
+ for (var i = 0; i < node.childNodes.length; ++i) {
+ i += highlight(node.childNodes[i]);
+ }
+ }
+ return skip;
+ };
+
+ return forEach($element, function(el) {
+ highlight(el);
+ });
+};
+
+var autoGrow = function(input) {
+ input = $(input);
+ var currentWidth = null;
+
+ var update = function(options, e) {
+ var value, keyCode, printable, placeholder, width;
+ var shift, character, selection;
+ e = e || window.event || {};
+ options = options || {};
+
+ if (e.metaKey || e.altKey) return;
+ if (!options.force && input.selectizeGrow === false) return;
+
+ value = input.value();
+ if (e.type && e.type.toLowerCase() === 'keydown') {
+ keyCode = e.keyCode;
+ printable = (
+ (keyCode >= 97 && keyCode <= 122) || // a-z
+ (keyCode >= 65 && keyCode <= 90) || // A-Z
+ (keyCode >= 48 && keyCode <= 57) || // 0-9
+ keyCode === 32 // space
+ );
+
+ if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {
+ selection = getSelection(input[0]);
+ if (selection.length) {
+ value = value.substring(0, selection.start) + value.substring(selection.start + selection.length);
+ } else if (keyCode === KEY_BACKSPACE && selection.start) {
+ value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);
+ } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {
+ value = value.substring(0, selection.start) + value.substring(selection.start + 1);
+ }
+ } else if (printable) {
+ shift = e.shiftKey;
+ character = String.fromCharCode(e.keyCode);
+ if (shift) character = character.toUpperCase();
+ else character = character.toLowerCase();
+ value += character;
+ }
+ }
+
+ placeholder = input.attribute('placeholder');
+ if (!value && placeholder) {
+ value = placeholder;
+ }
+
+ width = measureString(value, input) + 4;
+ if (width !== currentWidth) {
+ currentWidth = width;
+ input[0].style.width = width + 'px';
+ input.emit('resize');
+ }
+ };
+
+ input.on('keydown', update);
+ input.on('keyup', update);
+ input.on('update', update);
+ input.on('blur', update);
+
+ update();
+};
+
+var Selectize = new prime({
+
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ options: {
+ delimiter: ' ',
+ splitOn: null, // regexp or string for splitting up values from a paste command
+ persist: true,
+ diacritics: true,
+ create: false,
+ createOnBlur: true,
+ createFilter: null,
+ highlight: true,
+ openOnFocus: true,
+ maxOptions: 1000,
+ maxItems: null,
+ hideSelected: null,
+ addPrecedence: false,
+ selectOnTab: false,
+ preload: false,
+ allowEmptyOption: false,
+ closeAfterSelect: false,
+ searchOnKeypress: true,
+
+ scrollDuration: 60,
+ loadThrottle: 300,
+ loadingClass: 'g-loading',
+
+ dataAttr: 'data-data',
+ optgroupField: 'optgroup',
+ valueField: 'value',
+ labelField: 'text',
+ optgroupLabelField: 'label',
+ optgroupValueField: 'value',
+ lockOptgroupOrder: false,
+
+ sortField: '$order',
+ searchField: ['text'],
+ searchConjunction: 'and',
+
+ mode: null,
+ wrapperClass: 'g-selectize-control',
+ inputClass: 'g-selectize-input',
+ dropdownClass: 'g-selectize-dropdown',
+ dropdownContentClass: 'g-selectize-dropdown-content',
+
+ dropdownParent: null,
+
+ copyClassesToDropdown: true,
+
+ /*
+ load : null, // function(query, callback) { ... }
+ score : null, // function(search) { ... }
+ onInitialize : null, // function() { ... }
+ onChange : null, // function(value) { ... }
+ onItemAdd : null, // function(value, $item) { ... }
+ onItemRemove : null, // function(value) { ... }
+ onClear : null, // function() { ... }
+ onOptionAdd : null, // function(value, data) { ... }
+ onOptionRemove : null, // function(value) { ... }
+ onOptionClear : null, // function() { ... }
+ onOptionGroupAdd : null, // function(id, data) { ... }
+ onOptionGroupRemove : null, // function(id) { ... }
+ onOptionGroupClear : null, // function() { ... }
+ onDropdownOpen : null, // function($dropdown) { ... }
+ onDropdownClose : null, // function($dropdown) { ... }
+ onType : null, // function(str) { ... }
+ onDelete : null, // function(values) { ... }
+ */
+
+ render: {
+ /*
+ item: null,
+ optgroup: null,
+ optgroup_header: null,
+ option: null,
+ option_create: null
+ */
+ }
+ },
+
+ constructor: function(input, options) {
+ input = $(input);
+ this.setOptions(options);
+
+ // detect rtl environment
+ var computedStyle = window.getComputedStyle && window.getComputedStyle(input[0], null);
+ var dir = computedStyle ? computedStyle.getPropertyValue('direction') : input[0].currentStyle && input[0].currentStyle.direction;
+ dir = dir || input.parents('[dir]:first').attr('dir') || '';
+
+ this.rand = 'selectize-id-' + (Math.random() + 1).toString(36).substring(5);
+ this.input = input;
+ this.input.selectizeInstance = this;
+
+ this.order = 0;
+ this.tabIndex = input.attribute('tabindex') || '';
+ this.tagType = input.tag() == 'select' ? TAG_SELECT : TAG_INPUT;
+ this.rtl = /rtl/i.test(dir);
+ this.highlightedValue = null;
+ this.isRequired = input.attribute('required');
+ forEach(['isOpen', 'isDisabled', 'isInvalid', 'isLocked', 'isFocused', 'isInputHidden', 'isSetup', 'isShiftDown', 'isCmdDown', 'isCtrlDown', 'ignoreFocus', 'ignoreBlur', 'ignoreHover', 'hasOptions'], function(option) {
+ this[option] = false;
+ }, this);
+ this.currentResults = null;
+ this.lastValue = '';
+ this.caretPos = 0;
+ this.loading = 0;
+ this.loadedSearches = {};
+
+ this.$activeOption = null;
+ this.$activeItems = [];
+
+ this.Optgroups = {};
+ this.Options = {};
+ this.UserOptions = {};
+ this.items = [];
+ this.renderCache = {};
+ this.onSearchChange = this.options.loadThrottle === null ? this.onSearchChange : debounce(this.onSearchChange, this.options.loadThrottle);
+
+ // search system
+ this.sifter = new sifter(this.Options, { diacritics: this.options.diacritics });
+
+ var i, n;
+
+ // build options table
+ if (this.options.Options) {
+ for (i = 0, n = this.options.Options.length; i < n; i++) {
+ this.registerOption(this.options.Options[i]);
+ }
+ delete this.options.Options;
+ }
+
+ // build optgroup table
+ if (this.options.Optgroups) {
+ for (i = 0, n = this.options.Optgroups.length; i < n; i++) {
+ this.registerOptionGroup(this.options.Optgroups[i]);
+ }
+ delete this.options.Optgroups;
+ }
+
+ // option-demand defaults
+ this.options.mode = this.options.mode || (this.options.maxItems === 1 ? 'single' : 'multi');
+ if (!isBoolean(this.options.hideSelected)) { this.options.hideSelected = (this.options.mode === 'multi'); }
+
+ this.setupCallbacks();
+ this.setupTemplates();
+ this.setup();
+
+ },
+
+ setup: function() {
+ var $input = this.input,
+ $wrapper,
+ $control,
+ $control_input,
+ $dropdown,
+ $dropdown_content,
+ $dropdown_parent,
+ inputMode,
+ timeout_blur,
+ timeout_focus,
+ classes;
+
+ inputMode = this.options.mode;
+ classes = $input.attribute('class') || '';
+
+ $wrapper = zen('div').addClass(this.options.wrapperClass).addClass(classes).addClass('g-' + inputMode).after(this.input);
+ $control = zen('div').addClass(this.options.inputClass).addClass('g-items').bottom($wrapper);
+ $control_input = zen('input[type="text"][autocomplete="off"][role="textbox"]').bottom($control).attribute('tabindex', $input.disabled() ? '-1' : this.tabIndex);
+ $dropdown_parent = $(this.options.dropdownParent || $wrapper);
+ $dropdown = zen('div').addClass(this.options.dropdownClass).addClass('g-' + inputMode).hide().bottom($dropdown_parent);
+ $dropdown_content = zen('div[id="' + this.rand + '"]').addClass(this.options.dropdownContentClass).bottom($dropdown);
+
+ if (this.options.copyClassesToDropdown) {
+ $dropdown.addClass(classes);
+ }
+
+ if (inputMode == 'single') {
+ $wrapper.style('width', parseInt($input[0].offsetWidth) + 12 + 24); // padding compensation
+ }
+
+ if ((this.options.maxItems === null || this.options.maxItems > 1) && this.tagType === TAG_SELECT) {
+ $input.attribute('multiple', 'multiple');
+ }
+
+ if (this.options.placeholder) {
+ $control_input.attribute('placeholder', this.options.placeholder);
+ }
+
+ // if splitOn was not passed in, construct it from the delimiter to allow pasting universally
+ if (!this.options.splitOn && this.options.delimiter) {
+ var delimiterEscaped = this.options.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ this.options.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*');
+ }
+
+ if ($input.attribute('autocorrect')) {
+ $control_input.attribute('autocorrect', $input.attribute('autocorrect'));
+ }
+
+ if ($input.attribute('autocapitalize')) {
+ $control_input.attribute('autocapitalize', $input.attribute('autocapitalize'));
+ }
+
+ this.$wrapper = $wrapper;
+ this.$control = $control;
+ this.$control_input = $control_input;
+ this.$dropdown = $dropdown;
+ this.$dropdown_content = $dropdown_content;
+
+ $dropdown.delegate('mouseover', '[data-selectable]', bind(function() { return this.onOptionHover.apply(this, arguments); }, this));
+ $dropdown.delegate('mousedown', '[data-selectable]', bind(function() { return this.onOptionSelect.apply(this, arguments); }, this));
+ $dropdown.delegate('click', '[data-selectable]', bind(function() { return this.onOptionSelect.apply(this, arguments); }, this));
+
+ autoGrow($control_input);
+
+ $control.delegate('mousedown', '*:not(input)', bind(function(event, element) {
+ if (element == $control) { return true; }
+ return this.onItemSelect.apply(this, arguments);
+ }, this));
+
+ $control.on('mousedown', bind(function() { return this.onMouseDown.apply(this, arguments); }, this));
+ $control.on('click', bind(function() { return this.onClick.apply(this, arguments); }, this));
+ $control.delegate('click', '.g-remove-single-item', bind(function() { return this.onItemRemoveViaX.apply(this, arguments); }, this));
+
+ $control_input.on('mousedown', function(e) { e.stopPropagation(); });
+ $control_input.on('keydown', bind(function() { return this.onKeyDown.apply(this, arguments); }, this));
+ $control_input.on('keyup', bind(function() { return this.onKeyUp.apply(this, arguments); }, this));
+ $control_input.on('keypress', bind(function() { return this.onKeyPress.apply(this, arguments); }, this));
+ $control_input.on('resize', bind(function() { this.positionDropdown.apply(this, []); }, this));
+ $control_input.on('blur', bind(function() { return this.onBlur.apply(this, arguments); }, this));
+ $control_input.on('focus', bind(function() {
+ this.ignoreBlur = false;
+ return this.onFocus.apply(this, arguments);
+ }, this));
+ $control_input.on('paste', bind(function() { return this.onPaste.apply(this, arguments); }, this));
+
+ $(document).on('keydown', bind(function(e) {
+ this.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];
+ this.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];
+ this.isShiftDown = e.shiftKey;
+ }, this));
+
+ $(document).on('keyup', bind(function(e) {
+ if (e.keyCode === KEY_CTRL) this.isCtrlDown = false;
+ if (e.keyCode === KEY_SHIFT) this.isShiftDown = false;
+ if (e.keyCode === KEY_CMD) this.isCmdDown = false;
+ }, this));
+
+ $(document).on('mousedown', bind(function(e) {
+ if (this.isFocused) {
+ // prevent events on the dropdown scrollbar from causing the control to blur
+ if (e.target === this.$dropdown[0] || e.target.parentNode === this.$dropdown[0]) {
+ e.preventDefault();
+ return false;
+ }
+ // blur on click outside
+ if (!this.$control.find($(e.target)) && e.target !== this.$control[0]) {
+ this.blur(e.target);
+ }
+ }
+ }, this));
+
+ $(window).on('scroll', bind(function() {
+ if (this.isOpen) {
+ this.positionDropdown.apply(this, arguments);
+ }
+ }, this));
+ $(window).on('resize', bind(function() {
+ if (this.isOpen) {
+ this.positionDropdown.apply(this, arguments);
+ }
+ }, this));
+ $(window).on('mousemove', bind(function() {
+ this.ignoreHover = false;
+ }, this));
+
+ // store original children and tab index so that they can be
+ // restored when the destroy() method is called.
+ this.revertSettings = {
+ $children: this.input.children(),//.detach(),
+ tabindex: this.input.attribute('tabindex')
+ };
+
+ this.input.attribute('tabindex', -1).attribute('aria-hidden', true).hide().after($wrapper);
+
+ if (isArray(this.options.items)) {
+ this.setValue(this.options.items);
+ delete this.options.items;
+ }
+
+ // feature detect for the validation API
+ if (SUPPORTS_VALIDITY_API) {
+ this.input.on('invalid', bind(function(e) {
+ e.preventDefault();
+ this.isInvalid = true;
+ this.refreshState();
+ }, this));
+ }
+
+ this.updateOriginalInput();
+ this.refreshItems();
+ this.refreshState();
+ this.updatePlaceholder();
+ this.isSetup = true;
+
+ if (this.input.disabled()) {
+ this.disable();
+ }
+
+ this.on('change', this.onChange);
+
+ this.input.selectizeInstance = this;
+ this.input.addClass('selectized');
+ this.emit('initialize');
+
+ // preload options
+ if (this.options.preload === true) {
+ this.onSearchChange('');
+ }
+ // ARIA
+ $wrapper
+ .attribute('role', 'combobox')
+ .attribute('aria-autocomplete', 'list')
+ .attribute('aria-haspopup', true)
+ .attribute('aria-expanded', false)
+ .attribute('aria-labelledby', this.rand + '-' + slugify(this.getValue()));
+
+ $dropdown_content
+ .attribute('role', 'tree')
+ .attribute('aria-expanded', false)
+ .attribute('aria-hidden', true);
+
+
+ },
+
+ setupTemplates: function() {
+ var field_label = this.options.labelField,
+ field_value = this.options.valueField,
+ field_optgroup = this.options.optgroupLabelField,
+ mode = this.options.mode;
+
+ var templates = {
+ 'optgroup': function(data) {
+ return '' + data.html + '
';
+ },
+ 'optgroup_header': function(data, escape) {
+ return '';
+ },
+ 'option': function(data, escape) {
+ var label = '' + escape(data[field_label]) + '
';
+ if (this.options.Subtitles) {
+ label = '' + escape(data[field_label]) + ' ' + escape(data[field_value]) + '
';
+ }
+ return label;
+ },
+ 'item': function(data, escape) {
+ var removeButton = '',
+ title = escape(data[field_value]);
+
+ if (mode !== 'single') {
+ removeButton = '×';
+ }
+
+ if (this.options.Subtitles) {
+ title = 'class name: ' + title;
+ }
+
+ return '' + escape(data[field_label]) + removeButton;
+ },
+ 'option_create': function(data, escape) {
+ return '
Add ' + escape(data.input) + '…
';
+ }
+ };
+
+ this.options.render = merge({}, templates, this.options.render);
+ },
+
+ setupCallbacks: function() {
+ var key, fn, callbacks = {
+ 'initialize': 'onInitialize',
+ 'change': 'onChange',
+ 'item_add': 'onItemAdd',
+ 'item_remove': 'onItemRemove',
+ 'clear': 'onClear',
+ 'option_add': 'onOptionAdd',
+ 'option_remove': 'onOptionRemove',
+ 'option_clear': 'onOptionClear',
+ 'optgroup_add': 'onOptionGroupAdd',
+ 'optgroup_remove': 'onOptionGroupRemove',
+ 'optgroup_clear': 'onOptionGroupClear',
+ 'dropdown_open': 'onDropdownOpen',
+ 'dropdown_close': 'onDropdownClose',
+ 'type': 'onType',
+ 'load': 'onLoad',
+ 'focus': 'onFocus',
+ 'blur': 'onBlur'
+ };
+
+ for (key in callbacks) {
+ if (callbacks.hasOwnProperty(key)) {
+ fn = this.options[callbacks[key]];
+ if (fn) { this.on(key, fn); }
+ }
+ }
+ },
+
+
+
+ onClick: function(e) {
+ // necessary for mobile webkit devices (manual focus triggering
+ // is ignored unless invoked within a click event)
+ if (!this.isFocused) {
+ this.focus();
+ e.preventDefault();
+ }
+ },
+
+ onMouseDown: function(e) {
+ var defaultPrevented = e.defaultPrevented || (typeof e.defaultPrevented === 'undefined');
+ var $target = $(e.target);
+
+ if (this.isFocused) {
+ // retain focus by preventing native handling. if the
+ // event target is the input it should not be modified.
+ // otherwise, text selection within the input won't work.
+ if (e.target !== this.$control_input[0]) {
+ if (this.options.mode === 'single') {
+ // toggle dropdown
+ this.isOpen ? this.close() : this.open();
+ } else if (!defaultPrevented) {
+ this.setActiveItem(null);
+ }
+
+ /*e.preventDefault();
+ e.stopPropagation();*/
+ return false;
+ }
+ } else {
+ // give control focus
+ if (!defaultPrevented) {
+ window.setTimeout(bind(function() {
+ this.focus();
+ }, this), 0);
+ }
+ }
+ },
+
+ onChange: function() {
+ this.input.emit('change', this.input.value(), this);
+ $('body').emit('change', { target: this.input });
+ },
+
+ onPaste: function(e) {
+ if (this.isFull() || this.isInputHidden || this.isLocked) {
+ e.preventDefault();
+ } else {
+ // If a regex or string is included, this will split the pasted
+ // input and create Items for each separate value
+ if (this.options.splitOn) {
+ setTimeout(bind(function() {
+ var splitInput = trim(this.$control_input.value() || '').split(this.options.splitOn);
+ for (var i = 0, n = splitInput.length; i < n; i++) {
+ this.createItem(splitInput[i]);
+ }
+ }, this), 0);
+ }
+ }
+ },
+
+ onKeyPress: function(e) {
+ if (this.isLocked) return e && e.preventDefault();
+ var character = String.fromCharCode(e.keyCode || e.which);
+ if (this.options.create && this.options.mode === 'multi' && character === this.options.delimiter) {
+ this.createItem();
+ e.preventDefault();
+ return false;
+ }
+ },
+
+ onKeyDown: function(e) {
+ var isInput = e.target === this.$control_input[0];
+
+ if (this.isLocked) {
+ if (e.keyCode !== KEY_TAB) {
+ e.preventDefault();
+ }
+ return;
+ }
+
+ switch (e.keyCode) {
+ case KEY_A:
+ if (this.isCmdDown) {
+ this.selectAll();
+ return;
+ }
+ break;
+ case KEY_ESC:
+ if (this.isOpen) {
+ e.preventDefault();
+ e.stopPropagation();
+ this.close();
+ //this.blur();
+ }
+ return;
+ case KEY_N:
+ if (!e.ctrlKey || e.altKey) break;
+ case KEY_DOWN:
+ if (!this.isOpen && this.hasOptions) {
+ this.open();
+ } else if (this.$activeOption) {
+ this.ignoreHover = true;
+ var $next = this.getAdjacentOption(this.$activeOption, 1);
+ if ($next) { this.setActiveOption($next, true, true); }
+ }
+ e.preventDefault();
+ return;
+ case KEY_P:
+ if (!e.ctrlKey || e.altKey) break;
+ case KEY_UP:
+ if (this.$activeOption) {
+ this.ignoreHover = true;
+ var $prev = this.getAdjacentOption(this.$activeOption, -1);
+ if ($prev) { this.setActiveOption($prev, true, true); }
+ }
+ e.preventDefault();
+ return;
+ case KEY_RETURN:
+ if (this.isOpen && this.$activeOption) {
+ this.onOptionSelect({ currentTarget: this.$activeOption });
+ e.preventDefault();
+ }
+ return;
+ case KEY_LEFT:
+ this.advanceSelection(-1, e);
+ return;
+ case KEY_RIGHT:
+ this.advanceSelection(1, e);
+ return;
+ case KEY_TAB:
+ if (this.options.selectOnTab && this.isOpen && this.$activeOption) {
+ this.onOptionSelect({ currentTarget: this.$activeOption });
+
+ // Default behaviour is to jump to the next field, we only want this
+ // if the current field doesn't accept any more entries
+ if (!self.isFull()) {
+ e.preventDefault();
+ }
+ }
+ if (this.options.create && this.createItem()) {
+ e.preventDefault();
+ }
+ return;
+ case KEY_BACKSPACE:
+ case KEY_DELETE:
+ this.deleteSelection(e);
+ return;
+ }
+
+ if ((this.isFull() || this.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {
+ e.preventDefault();
+ return;
+ }
+ },
+
+ onKeyUp: function(e) {
+
+ if (this.isLocked) return e && e.preventDefault();
+ var value = this.$control_input.value() || '';
+ if (this.lastValue !== value) {
+ this.lastValue = value;
+ this.onSearchChange(value);
+ this.refreshOptions();
+ this.emit('type', value);
+ }
+ },
+
+ onSearchChange: function(value) {
+ var fn = this.options.load;
+ if (!fn) return;
+ if (this.loadedSearches.hasOwnProperty(value)) return;
+ this.loadedSearches[value] = true;
+ this.load(bind(function(callback) {
+ fn.apply(this, [value, callback]);
+ }, this));
+ },
+
+ onFocus: function(e) {
+ var wasFocused = this.isFocused;
+
+ if (this.isDisabled) {
+ this.blur();
+ e && e.preventDefault();
+ return false;
+ }
+
+ if (this.ignoreFocus) return;
+ this.isFocused = true;
+ if (this.options.preload === 'focus') this.onSearchChange('');
+
+ if (!wasFocused) this.emit('focus');
+
+ if (!this.$activeItems.length) {
+ this.showInput();
+ this.setActiveItem(null);
+ this.refreshOptions(!!this.options.openOnFocus);
+ }
+
+ this.refreshState();
+ },
+
+ onBlur: function(e, dest) {
+ if (!this.isFocused) return;
+ this.isFocused = false;
+
+ if (this.ignoreFocus) {
+ return;
+ } else if (!this.ignoreBlur && (document.activeElement === this.$dropdown_content[0])) {
+ // ^- g5 custom [before: no e.target && ..]
+ // necessary to prevent IE closing the dropdown when the scrollbar is clicked
+ this.ignoreBlur = true;
+ this.onFocus(e);
+ return;
+ }
+
+ var deactivate = bind(function() {
+ this.close();
+ this.setTextboxValue('');
+ this.setActiveItem(null);
+ this.setActiveOption(null);
+ this.setCaret(this.items.length);
+ this.refreshState();
+
+ dest && dest.focus();
+
+ this.ignoreFocus = false;
+ this.emit('blur');
+
+ }, this);
+
+ this.ignoreFocus = true;
+ if (this.options.create && this.options.createOnBlur) {
+ this.createItem(null, false, deactivate);
+ } else {
+ deactivate();
+ }
+ },
+
+ onOptionHover: function(e, element) {
+ element = $(element);
+ if (this.ignoreHover) return;
+ this.setActiveOption(element || e.currentTarget, false);
+ },
+
+ onOptionSelect: function(e, element) {
+ var value, $target, $option, self = this;
+
+ if (e.preventDefault) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+
+ $target = $(element || e.currentTarget);
+ if ($target.hasClass('g-create')) {
+ this.createItem(null, bind(function() {
+ if (this.options.closeAfterSelect) {
+ this.close();
+ }
+ }, this));
+ } else {
+ value = $target.attribute('data-value');
+ if (typeof value !== 'undefined') {
+ this.lastQuery = null;
+ this.setTextboxValue('');
+ this.addItem(value);
+ if (this.options.closeAfterSelect) {
+ this.close();
+ } else if (!this.options.hideSelected && e.type && /mouse/.test(e.type)) {
+ this.setActiveOption(this.getOption(value));
+ }
+ }
+ }
+ },
+
+ onItemSelect: function(e, element) {
+ if (this.isLocked) return;
+ if (this.options.mode === 'multi') {
+ e.preventDefault();
+ this.setActiveItem(element || e.currentTarget, e);
+ }
+ },
+
+ onItemRemoveViaX: function(e, element) {
+ e.preventDefault();
+ if (this.isLocked || this.options.mode == 'single') return;
+
+ var $item = element.parent();
+ this.setActiveItem($item);
+ if (this.deleteSelection()) {
+ this.setCaret(this.items.length);
+ }
+ },
+
+ load: function(fn) {
+ var $wrapper = this.$wrapper.addClass(this.options.loadingClass);
+
+ this.loading++;
+ fn.apply(this, [bind(function(results) {
+ this.loading = Math.max(this.loading - 1, 0);
+ if (results && results.length) {
+ this.addOption(results);
+ this.refreshOptions(this.isFocused && !this.isInputHidden);
+ }
+ if (!this.loading) {
+ $wrapper.removeClass(this.options.loadingClass);
+ }
+ this.emit('load', results);
+ }, this)]);
+ },
+
+ setTextboxValue: function(value) {
+ var $input = this.$control_input;
+ var changed = $input.value() !== value;
+ if (changed) {
+ $input.value(value).emit('update');
+ this.lastValue = value;
+ }
+ },
+
+ getValue: function(value) {
+ // g5 custom
+ if (this.tagType === TAG_SELECT && this.input.attribute('multiple')) {
+ return value || this.items;
+ } else {
+ return (value || this.items).join(this.options.delimiter);
+ }
+ },
+
+ setValue: function(value, silent) {
+ var events = silent ? [] : ['change'];
+
+ debounce_events(this, events, function() {
+ this.clear(silent);
+ this.previousValue = this.getValue() || value;
+ this.addItems(value, silent);
+ });
+ },
+
+ setActiveItem: function(item, e) {
+ var eventName, idx, begin, end, $item, swap, $last;
+
+ if (this.options.mode === 'single') { return; }
+ item = $(item);
+
+ // clear the active selection
+ if (!item) {
+ if (this.$activeItems.length) { $(this.$activeItems).removeClass('g-active'); }
+ this.$activeItems = [];
+ if (this.isFocused) {
+ this.showInput();
+ }
+ return;
+ }
+
+ // modify selection
+ eventName = e && e.type.toLowerCase();
+
+ if (eventName === 'mousedown' && this.isShiftDown && this.$activeItems.length) {
+ $last = $(last(this.$control.children('.g-active')));
+ begin = Array.prototype.indexOf.apply(this.$control[0].childNodes, [$last[0]]);
+ end = Array.prototype.indexOf.apply(this.$control[0].childNodes, [item[0]]);
+ if (begin > end) {
+ swap = begin;
+ begin = end;
+ end = swap;
+ }
+ for (var i = begin; i <= end; i++) {
+ $item = this.$control[0].childNodes[i];
+ if (this.$activeItems.indexOf($item) === -1) {
+ $($item).addClass('g-active');
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + $($item).attribute('data-value')));
+ this.$activeItems.push($item);
+ }
+ }
+ e.preventDefault();
+ } else if ((eventName === 'mousedown' && this.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {
+ if (item.hasClass('g-active')) {
+ idx = this.$activeItems.indexOf(item[0]);
+ this.$activeItems.splice(idx, 1);
+ item.removeClass('g-active');
+ } else {
+ this.$activeItems.push(item.addClass('g-active')[0]);
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + item.attribute('data-value')));
+ }
+ } else {
+ if ($(this.$activeItems)) $(this.$activeItems).removeClass('g-active');
+ this.$activeItems = [item.addClass('g-active')[0]];
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + item.attribute('data-value')));
+ }
+
+ // ensure control has focus
+ this.hideInput();
+ if (!this.isFocused) {
+ this.focus();
+ }
+ },
+
+ setActiveOption: function($option, scroll, animate) {
+ var height_menu, height_item, y;
+ var scroll_top, scroll_bottom;
+
+ if (this.$activeOption) this.$activeOption.removeClass('g-active');
+ this.$activeOption = null;
+
+ $option = $($option);
+ if (!$option) return;
+
+ this.$activeOption = $option.addClass('g-active');
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + $option.attribute('data-value')));
+
+ if (scroll || !isset(scroll)) {
+
+ height_menu = this.$dropdown_content[0].offsetHeight;
+ height_item = this.$activeOption[0].offsetHeight;
+ scroll = this.$dropdown_content[0].scrollTop || 0;
+ y = this.$activeOption.position().top - this.$dropdown_content.position().top + scroll;
+ scroll_top = y;
+ scroll_bottom = y - height_menu + height_item;
+
+ if (y + height_item > height_menu + scroll) {
+ this.$dropdown_content[0].scrollTop = scroll_bottom;
+ /*moofx(bind(function(value){
+ this.$dropdown_content[0].scrollTop = value;
+ }, this), {
+ duration: animate ? this.options.scrollDuration : 0,
+ equation: 'linear'
+ }).start(scroll, scroll_bottom);*/
+ } else if (y < scroll) {
+ this.$dropdown_content[0].scrollTop = scroll_top;
+ /*moofx(bind(function(value){
+ this.$dropdown_content[0].scrollTop = value;
+ }, this), {
+ duration: animate ? this.options.scrollDuration : 0,
+ equation: 'linear'
+ }).start(scroll, scroll_top);*/
+ }
+
+ }
+ },
+
+ selectAll: function() {
+ if (this.options.mode === 'single') return;
+
+ var items = this.$control.children(':not(input)');
+ if (items) {
+ items.addClass('g-active');
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + items.attribute('data-value')));
+ }
+
+ this.$activeItems = Array.prototype.slice.apply(items || []);
+ if (this.$activeItems.length) {
+ this.hideInput();
+ this.close();
+ }
+ this.focus();
+ },
+
+ hideInput: function() {
+
+ this.setTextboxValue('');
+ this.$control_input.style({
+ opacity: 0,
+ position: 'absolute',
+ left: this.rtl ? 10000 : -10000
+ });
+ this.isInputHidden = true;
+ },
+
+ showInput: function() {
+ this.$control_input.style({
+ opacity: 1,
+ position: 'relative',
+ left: 0
+ });
+ this.isInputHidden = false;
+ },
+
+ focus: function() {
+ if (this.isDisabled) { return; }
+
+ this.ignoreFocus = true;
+ this.$control_input[0].focus();
+ setTimeout(bind(function() {
+ this.ignoreFocus = false;
+ this.onFocus();
+ }, this), 0);
+ },
+
+ blur: function(dest) {
+ this.$control_input[0].blur();
+ this.onBlur(null, dest);
+ // g5 custom
+ //this.$control_input[0].blur();
+ },
+
+ getScoreFunction: function(query) {
+ return this.sifter.getScoreFunction(query, this.getSearchOptions());
+ },
+
+ getSearchOptions: function() {
+ var sort = this.options.sortField;
+ if (typeof sort === 'string') {
+ sort = [{ field: sort }];
+ }
+
+ return {
+ fields: this.options.searchField,
+ conjunction: this.options.searchConjunction,
+ sort: sort
+ };
+ },
+
+ search: function(query) {
+ var i, value, score, result, calculateScore;
+ var options = this.getSearchOptions();
+
+ // validate user-provided result scoring function
+ if (this.options.score) {
+ calculateScore = this.options.score.apply(this, [query]);
+ if (typeof calculateScore !== 'function') {
+ throw new Error('Selectize "score" setting must be a function that returns a function');
+ }
+ }
+
+ // perform search
+ if (query !== this.lastQuery) {
+ this.lastQuery = query;
+ result = this.sifter.search(query, merge(options, { score: calculateScore }));
+ this.currentResults = result;
+ } else {
+ result = merge({}, this.currentResults);
+ }
+
+ // filter out selected items
+ if (this.options.hideSelected) {
+ for (i = result.items.length - 1; i >= 0; i--) {
+ if (this.items.indexOf(hash_key(result.items[i].id)) !== -1) {
+ result.items.splice(i, 1);
+ }
+ }
+ }
+
+ return result;
+ },
+
+ refreshOptions: function(triggerDropdown) {
+ var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
+ var $active, $active_before, $create;
+
+ if (typeof triggerDropdown === 'undefined') {
+ triggerDropdown = true;
+ }
+
+ var query = trim(this.$control_input.value());
+ var results = this.search(query);
+ var $dropdown_content = this.$dropdown_content;
+ var active_before = this.$activeOption && hash_key(this.$activeOption.attribute('data-value'));
+
+ // build markup
+ n = results.items.length;
+ if (typeof this.options.maxOptions === 'number') {
+ n = Math.min(n, this.options.maxOptions);
+ }
+
+ // render and group available options individually
+ groups = {};
+ groups_order = [];
+
+ // g5 custom
+ //if (this.options.optgroupOrder) {
+ // groups_order = this.options.optgroupOrder;
+ // for (i = 0; i < groups_order.length; i++) {
+ // groups[groups_order[i]] = [];
+ // }
+ //} else {
+ // groups_order = [];
+ //}
+
+ for (i = 0; i < n; i++) {
+ option = this.Options[results.items[i].id];
+ option_html = this.render('option', option);
+ optgroup = option[this.options.optgroupField] || '';
+ optgroups = isArray(optgroup) ? optgroup : [optgroup];
+
+ for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
+ optgroup = optgroups[j];
+ if (!this.Optgroups.hasOwnProperty(optgroup)) {
+ optgroup = '';
+ }
+ if (!groups.hasOwnProperty(optgroup)) {
+ groups[optgroup] = document.createDocumentFragment();
+ groups_order.push(optgroup);
+ }
+ groups[optgroup].appendChild(option_html);
+ }
+ }
+
+ // sort optgroups
+ if (this.options.lockOptgroupOrder) {
+ groups_order.sort(function(a, b) {
+ var a_order = this.Optgroups[a].$order || 0;
+ var b_order = this.Optgroups[b].$order || 0;
+ return a_order - b_order;
+ });
+ }
+
+ // render optgroup headers & join groups
+ html = document.createDocumentFragment();
+ for (i = 0, n = groups_order.length; i < n; i++) {
+ optgroup = groups_order[i];
+ if (this.Optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {
+ // render the optgroup header and options within it,
+ // then pass it to the wrapper template
+ html_children = document.createDocumentFragment();
+ html_children.appendChild(this.render('optgroup_header', this.Optgroups[optgroup]));
+ html_children.appendChild(groups[optgroup]);
+ html.appendChild(this.render('optgroup', merge({}, this.Optgroups[optgroup], {
+ html: domToString(html_children),
+ dom: html_children
+ })));
+ } else {
+ html.appendChild(groups[optgroup]);
+ }
+ }
+
+ $dropdown_content.html(domToString(html));
+
+ // highlight matching terms inline
+ if (this.options.highlight && results.query.length && results.tokens.length) {
+ for (i = 0, n = results.tokens.length; i < n; i++) {
+ highlight($dropdown_content, results.tokens[i].regex);
+ }
+ }
+
+ // add "selected" class to selected options
+ if (!this.options.hideSelected) {
+ for (i = 0, n = this.items.length; i < n; i++) {
+ this.getOption(this.items[i]).addClass('g-selected').attribute('aria-selected', true);
+ }
+ }
+
+ // add create option
+ has_create_option = this.canCreate(query);
+ if (has_create_option) {
+ //$dropdown_content.prepend(this.render('option_create', { input: query }));
+ $(this.render('option_create', { input: query })).top($dropdown_content);
+ $create = $($dropdown_content[0].childNodes[0]);
+ }
+
+ // activate
+ this.hasOptions = results.items.length > 0 || has_create_option;
+ if (this.hasOptions) {
+ if (results.items.length > 0) {
+ $active_before = active_before && this.getOption(active_before);
+ if ($active_before && $active_before.length) {
+ $active = $active_before;
+ } else if (this.options.mode === 'single' && this.items.length) {
+ $active = this.getOption(this.items[0]);
+ }
+ if (!$active || !$active.length) {
+ if ($create && !this.options.addPrecedence) {
+ $active = this.getAdjacentOption($create, 1);
+ } else {
+ $active = $dropdown_content.find('[data-selectable]:first-child');
+ }
+ }
+ } else {
+ $active = $create;
+ }
+ this.setActiveOption($active);
+ if (triggerDropdown && !this.isOpen) { this.open(); }
+ } else {
+ this.setActiveOption(null);
+ if (triggerDropdown && this.isOpen) { this.close(); }
+ }
+ },
+
+ addOption: function(data) {
+ var value;
+
+ if (isArray(data)) {
+ for (var i = 0, n = data.length; i < n; i++) {
+ this.addOption(data[i]);
+ }
+ return;
+ }
+
+ if (value = this.registerOption(data)) {
+ this.UserOptions[value] = true;
+ this.lastQuery = null;
+ this.emit('option_add', value, data);
+ }
+
+ // g5 custom
+ /*value = hash_key(data[this.options.valueField]);
+ if (typeof value !== 'string' || this.Options.hasOwnProperty(value)) return;
+
+ this.UserOptions[value] = true;
+ this.Options[value] = data;
+ this.lastQuery = null;
+ this.emit('option_add', value, data);*/
+ },
+
+ registerOption: function(data) {
+ var key = hash_key(data[this.options.valueField]);
+ if ((!key && !this.options.allowEmptyOption) || this.options.hasOwnProperty(key)) return false;
+ data.$order = data.$order || ++this.order;
+ this.Options[key] = data;
+
+ return key;
+ },
+
+ registerOptionGroup: function(data) {
+ var key = hash_key(data[this.options.optgroupValueField]);
+ if (!key) return false;
+
+ data.$order = data.$order || ++this.order;
+ this.Optgroups[key] = data;
+
+ return key;
+ },
+
+
+ addOptionGroup: function(id, data) {
+ data[this.options.optgroupValueField] = id;
+ if (id = this.registerOptionGroup(data)) {
+ this.emit('optgroup_add', id, data);
+ }
+ },
+
+ removeOptionGroup: function(id) {
+ if (this.Optgroups.hasOwnProperty(id)) {
+ delete this.Optgroups[id];
+ this.renderCache = {};
+ this.emit('optgroup_remove', id);
+ }
+ },
+
+ clearOptionGroups: function() {
+ this.Optgroups = {};
+ this.renderCache = {};
+ this.emit('optgroup_clear');
+ },
+
+ updateOption: function(value, data) {
+ var self = this;
+ var $item, $item_new, dummy;
+ var value_new, index_item, cache_items, cache_options, order_old;
+
+ value = hash_key(value);
+ value_new = hash_key(data[this.options.valueField]);
+
+ // sanity checks
+ if (value === null) return;
+ if (!this.Options.hasOwnProperty(value)) return;
+ if (typeof value_new !== 'string') throw new Error('Value must be set in option data');
+
+ order_old = this.Options[value].$order;
+
+ // update references
+ if (value_new !== value) {
+ delete this.Options[value];
+ index_item = this.items.indexOf(value);
+ if (index_item !== -1) {
+ this.items.splice(index_item, 1, value_new);
+ }
+ }
+ data.$order = data.$order || order_old;
+ this.Options[value_new] = data;
+
+ // invalidate render cache
+ cache_items = this.renderCache['item'];
+ cache_options = this.renderCache['option'];
+
+ if (cache_items) {
+ delete cache_items[value];
+ delete cache_items[value_new];
+ }
+ if (cache_options) {
+ delete cache_options[value];
+ delete cache_options[value_new];
+ }
+
+ // update the item if it's selected
+ if (this.items.indexOf(value_new) !== -1) {
+ $item = this.getItem(value);
+ $item_new = $(this.render('item', data));
+ if ($item.hasClass('g-active')) {
+ $item_new.addClass('g-active');
+ this.$wrapper.attribute('aria-activedescendant', slugify(this.rand + '-' + $item_new.attribute('data-value')));
+ }
+
+ $item_new.after($item);
+ $item.remove();
+ }
+
+ // invalidate last query because we might have updated the sortField
+ this.lastQuery = null;
+
+ // update dropdown contents
+ if (this.isOpen) {
+ this.refreshOptions(false);
+ }
+ },
+
+ removeOption: function(value, silent) {
+ value = hash_key(value);
+
+ var cache_items = this.renderCache['item'];
+ var cache_options = this.renderCache['option'];
+ if (cache_items) delete cache_items[value];
+ if (cache_options) delete cache_options[value];
+
+ delete this.UserOptions[value];
+ delete this.Options[value];
+ this.lastQuery = null;
+ this.emit('option_remove', value);
+ this.removeItem(value, silent);
+ },
+
+ clearOptions: function() {
+ this.loadedSearches = {};
+ this.UserOptions = {};
+ this.renderCache = {};
+ this.Options = this.sifter.items = {};
+ this.lastQuery = null;
+ this.emit('option_clear');
+ this.clear();
+ },
+
+ getOption: function(value) {
+ return this.getElementWithValue(value, this.$dropdown_content.search('[data-selectable]'));
+ },
+
+ getAdjacentOption: function($option, direction) {
+ var $options = this.$dropdown.search('[data-selectable]');
+ var index = indexOf($options, ($option ? $option[0] : null)) + direction;
+
+ return index >= 0 && index < ($options ? $options.length : 0) ? $($options[index]) : $();
+ },
+
+ getElementWithValue: function(value, $els) {
+ value = hash_key(value);
+
+ if (typeof value !== 'undefined' && value !== null) {
+ for (var i = 0, n = ($els ? $els.length : 0); i < n; i++) {
+ if ($els[i].getAttribute('data-value') === value) {
+ return $($els[i]);
+ }
+ }
+ }
+
+ return $();
+ },
+
+ getItem: function(value) {
+ return this.getElementWithValue(value, this.$control.children());
+ },
+
+ addItems: function(values, silent) {
+ var items = isArray(values) ? values : [values];
+ for (var i = 0, n = items.length; i < n; i++) {
+ this.isPending = (i < n - 1);
+ this.addItem(items[i], silent);
+ }
+ },
+
+ addItem: function(value, silent) {
+ var events = silent ? [] : ['change'];
+
+ debounce_events(this, events, function() {
+ var $item, $option, $options;
+ var inputMode = this.options.mode;
+ var i, active, value_next, wasFull;
+ value = hash_key(value);
+
+ if (this.items.indexOf(value) !== -1) {
+ // g5 custom [before: && this.isOpen]
+ if (inputMode === 'single') this.close();
+ return;
+ }
+
+ if (!this.Options.hasOwnProperty(value)) return;
+ if (inputMode === 'single') this.clear(silent);
+ if (inputMode === 'multi' && this.isFull()) return;
+
+ $item = $(this.render('item', this.Options[value]));
+ // if (inputMode !== 'multi') $item.find('.g-remove-single-item').remove();
+
+ // ARIA
+ $item.attribute('id', this.rand + '-' + slugify($item.attribute('data-value')));
+ if (inputMode === 'multi') $item.attribute('aria-selected', true);
+
+ wasFull = this.isFull();
+ this.items.splice(this.caretPos, 0, value);
+ this.insertAtCaret($item);
+ if (!this.isPending || (!wasFull && this.isFull())) {
+ this.refreshState();
+ }
+
+ if (this.isSetup) {
+ $options = this.$dropdown_content.search('[data-selectable]');
+
+ // update menu / remove the option (if this is not one item being added as part of series)
+ if (!this.isPending) {
+ $option = this.getOption(value);
+ var adj = this.getAdjacentOption($option, 1);
+ value_next = (adj) ? adj.attribute('data-value') : null;
+ this.refreshOptions(this.isFocused && inputMode !== 'single');
+ if (value_next) {
+ this.setActiveOption(this.getOption(value_next));
+ }
+ }
+
+ // hide the menu if the maximum number of items have been selected or no options are left
+ if (!$options || this.isFull()) {
+ this.close();
+ } else {
+ this.positionDropdown();
+ }
+
+ this.updatePlaceholder();
+ this.emit('item_add', value, $item);
+ this.updateOriginalInput({ silent: silent });
+ }
+ });
+ },
+
+ removeItem: function(value, silent) {
+ var $item, i, idx;
+
+ $item = (value instanceof $) ? value : this.getItem(value);
+ value = hash_key($item.attribute('data-value'));
+ i = this.items.indexOf(value);
+
+ if (i !== -1) {
+ $item.remove();
+ if ($item.hasClass('g-active')) {
+ idx = this.$activeItems.indexOf($item[0]);
+ this.$activeItems.splice(idx, 1);
+ }
+
+ this.items.splice(i, 1);
+ this.lastQuery = null;
+ if (!this.options.persist && this.UserOptions.hasOwnProperty(value)) {
+ this.removeOption(value, silent);
+ }
+
+ if (i < this.caretPos) {
+ this.setCaret(this.caretPos - 1);
+ }
+
+ this.refreshState();
+ this.updatePlaceholder();
+ this.updateOriginalInput({ silent: silent });
+ this.positionDropdown();
+ this.emit('item_remove', value, $item);
+ }
+ },
+
+ createItem: function(input, triggerDropdown) {
+ var caret = this.caretPos;
+ input = input || trim(this.$control_input.value() || '');
+
+ var callback = arguments[arguments.length - 1];
+ if (typeof callback !== 'function') callback = function() {};
+
+ if (!isBoolean(triggerDropdown)) {
+ triggerDropdown = true;
+ }
+
+ if (!this.canCreate(input)) {
+ callback();
+ return false;
+ }
+
+ this.lock();
+
+ var setup = (typeof this.options.create === 'function') ? this.options.create : bind(function(input) {
+ var data = {};
+ data[this.options.labelField] = input;
+ data[this.options.valueField] = input;
+ return data;
+ }, this);
+
+ var create = once(bind(function(data) {
+ this.unlock();
+
+ if (!data || typeof data !== 'object') return callback();
+ var value = hash_key(data[this.options.valueField]);
+ if (typeof value !== 'string') return callback();
+
+ this.setTextboxValue('');
+ this.addOption(data);
+ this.setCaret(caret);
+ this.addItem(value);
+ this.refreshOptions(triggerDropdown && this.options.mode !== 'single');
+ callback(data);
+ }, this));
+
+ var output = setup.apply(this, [input, create]);
+ if (typeof output !== 'undefined') {
+ create(output);
+ }
+
+ return true;
+ },
+
+ refreshItems: function() {
+ this.lastQuery = null;
+
+ if (this.isSetup) {
+ this.addItem(this.items);
+ }
+
+ this.refreshState();
+ this.updateOriginalInput();
+ },
+
+ refreshState: function() {
+ var invalid;
+ if (this.isRequired) {
+ if (this.items.length) this.isInvalid = false;
+ this.$control_input.attribute('required', this.isInvalid || null);
+ }
+ this.refreshClasses();
+ },
+
+ refreshClasses: function() {
+ var isFull = this.isFull(),
+ isLocked = this.isLocked;
+
+ this.$wrapper.toggleClass('g-rtl', this.rtl);
+
+ this.$control.toggleClass('g-focus', this.isFocused);
+ this.$control.toggleClass('g-disabled', this.isDisabled);
+ this.$control.toggleClass('g-required', this.isRequired);
+ this.$control.toggleClass('g-invalid', this.isInvalid);
+ this.$control.toggleClass('g-locked', isLocked);
+ this.$control.toggleClass('g-full', isFull);
+ this.$control.toggleClass('g-not-full', !isFull);
+ this.$control.toggleClass('g-input-active', this.isFocused && !this.isInputHidden);
+ this.$control.toggleClass('g-dropdown-active', this.isOpen);
+ this.$control.toggleClass('g-has-options', !size(this.options.Options));
+ this.$control.toggleClass('g-has-items', this.items.length > 0);
+
+ // ARIA
+ if (this.isOpen) {
+ this.$wrapper
+ .attribute('aria-owns', this.rand)
+ .attribute('aria-activedescendant', slugify(this.rand + '-' + this.getValue()))
+ .attribute('aria-expanded', true);
+
+ this.$dropdown_content
+ .attribute('aria-expanded', true)
+ .attribute('aria-hidden', false);
+ } else {
+ this.$wrapper
+ .attribute('aria-owns', null)
+ .attribute('aria-activedescendant', null)
+ .attribute('aria-expanded', false);
+
+ this.$dropdown_content
+ .attribute('aria-expanded', false)
+ .attribute('aria-hidden', true);
+ }
+
+ this.$control_input.selectizeGrow = !isFull && !isLocked;
+ },
+
+ isFull: function() {
+ return this.options.maxItems !== null && this.items.length >= this.options.maxItems;
+ },
+
+ updateOriginalInput: function(opts) {
+ var options, label;
+ opts = opts || {};
+
+ if (this.tagType === TAG_SELECT) {
+ options = [];
+ for (var i = 0, n = this.items.length; i < n; i++) {
+ label = this.Options[this.items[i]][this.options.labelField] || '';
+ options.push('
');
+ }
+ if (!options.length && !this.input.attribute('multiple')) {
+ options.push('
');
+ }
+ this.input.html(options.join(''));
+ } else {
+ this.input.value(this.getValue());
+ this.input.attribute('value', this.input.value());
+ }
+
+ if (this.isSetup && !opts.silent) {
+ this.emit('change', this.input.value());
+ }
+ },
+
+ updatePlaceholder: function() {
+ if (!this.options.placeholder) return;
+ var control_input = this.$control_input;
+
+ if (this.items.length) {
+ control_input.attribute('placeholder', null);
+ } else {
+ control_input.attribute('placeholder', this.options.placeholder);
+ }
+ control_input.emit('update', { force: true });
+ },
+
+ open: function() {
+ if (this.isLocked || this.isOpen || (this.options.mode === 'multi' && this.isFull())) return;
+ this.focus();
+ this.isOpen = true;
+ this.refreshState();
+ this.$dropdown.style({
+ visibility: 'hidden',
+ display: 'block'
+ });
+ this.positionDropdown();
+ this.$dropdown.style({ visibility: 'visible' });
+ this.emit('dropdown_open', this.$dropdown);
+ },
+
+ close: function() {
+ var trigger = this.isOpen;
+
+ if (this.options.mode === 'single' && this.items.length) {
+ this.hideInput();
+ }
+
+ this.isOpen = false;
+ this.$dropdown.hide();
+ this.setActiveOption(null);
+ this.refreshState();
+
+ if (trigger) this.emit('dropdown_close', this.$dropdown);
+ },
+
+ positionDropdown: function() {
+ var control = this.$control,
+ offset = control.position();//this.options.dropdownParent === 'body' ? control.offset() : control.position();
+ offset.top += control[0].offsetHeight;
+
+ this.$dropdown.style({
+ width: control[0].offsetWidth,
+ top: control[0].offsetTop + control[0].offsetHeight,
+ left: control[0].offsetLeft
+ });
+ },
+
+ clear: function(silent) {
+ if (!this.items.length) return;
+
+ var non_input = this.$control.children(':not(input)');
+ if (non_input) non_input.remove();
+
+ this.items = [];
+ this.lastQuery = null;
+ this.setCaret(0);
+ this.setActiveItem(null);
+ this.updatePlaceholder();
+ this.updateOriginalInput({ silent: silent });
+ this.refreshState();
+ this.showInput();
+ this.emit('clear');
+ },
+
+ insertAtCaret: function($el) {
+ var caret = Math.min(this.caretPos, this.items.length);
+ if (caret === 0) {
+ $el.top(this.$control);//.prepend($el);
+ } else {
+ //$(this.$control[0].childNodes[caret]).before($el);
+ $el.after(this.$control.find(':nth-child(' + caret + ')'));
+ //this.$control.find(':nth-child(' + caret + ')').before($el);
+ }
+ this.setCaret(caret + 1);
+ },
+
+ deleteSelection: function(e) {
+ var i, n, direction, selection, values, caret, option_select, $option_select, $tail;
+
+ direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;
+ selection = getSelection(this.$control_input[0]);
+
+ if (this.$activeOption && !this.options.hideSelected) {
+ option_select = this.getAdjacentOption(this.$activeOption, -1);
+ if (option_select) { option_select = option_select.attribute('data-value'); }
+ }
+
+ // determine items that will be removed
+ values = [];
+
+ if (this.$activeItems.length) {
+ var children = this.$control.children(':not(input)');
+ $tail = this.$control.children('.g-active');
+ if ($tail) { $tail = $(direction > 0 ? last($tail) : $tail[0]); }
+ caret = (!children ? -1 : indexOf(children, $tail[0]));
+ if (direction > 0) { caret++; }
+
+ for (i = 0, n = this.$activeItems.length; i < n; i++) {
+ values.push($(this.$activeItems[i]).attribute('data-value'));
+ }
+ if (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+ } else if ((this.isFocused || this.options.mode === 'single') && this.items.length) {
+ if (direction < 0 && selection.start === 0 && selection.length === 0) {
+ values.push(this.items[this.caretPos - 1]);
+ } else if (direction > 0 && selection.start === this.$control_input.value().length) {
+ values.push(this.items[this.caretPos]);
+ }
+ }
+
+ // allow the callback to abort
+ if (!values.length || (typeof this.options.onDelete === 'function' && this.options.onDelete.apply(this, [values]) === false)) {
+ return false;
+ }
+
+ // perform removal
+ if (typeof caret !== 'undefined') {
+ this.setCaret(caret);
+ }
+ while (values.length) {
+ this.removeItem(values.pop());
+ }
+
+ this.showInput();
+ this.positionDropdown();
+ this.refreshOptions(true);
+
+ // select previous option
+ if (option_select) {
+ $option_select = this.getOption(option_select);
+ if ($option_select.length) {
+ this.setActiveOption($option_select);
+ }
+ }
+
+ return true;
+ },
+
+ advanceSelection: function(direction, e) {
+ var tail, selection, idx, valueLength, cursorAtEdge, $tail;
+
+ if (direction === 0) return;
+ if (this.rtl) direction *= -1;
+
+ tail = direction > 0 ? 'last-child' : 'first-child';
+ selection = getSelection(this.$control_input[0]);
+
+ if (this.isFocused && !this.isInputHidden) {
+ valueLength = this.$control_input.value().length;
+ cursorAtEdge = direction < 0
+ ? selection.start === 0 && selection.length === 0
+ : selection.start === valueLength;
+
+ if (cursorAtEdge && !valueLength) {
+ this.advanceCaret(direction, e);
+ }
+ } else {
+ $tail = this.$control.children('.g-active:' + tail);
+ if ($tail) {
+ idx = indexOf(this.$control.children(':not(input)'), $tail);
+ this.setActiveItem(null);
+ this.setCaret(direction > 0 ? idx + 1 : idx);
+ }
+ }
+ },
+
+ advanceCaret: function(direction, e) {
+ var fn, $adj;
+
+ if (direction === 0) return;
+
+ fn = direction > 0 ? 'nextSibling' : 'previousSibling';
+ if (this.isShiftDown) {
+ $adj = this.$control_input[fn]();
+ if ($adj) {
+ this.hideInput();
+ this.setActiveItem($adj);
+ e && e.preventDefault();
+ }
+ } else {
+ this.setCaret(this.caretPos + direction);
+ }
+ },
+
+ setCaret: function(i) {
+
+ if (this.options.mode === 'single') {
+ i = this.items.length;
+ } else {
+ i = Math.max(0, Math.min(this.items.length, i));
+ }
+
+ if (!this.isPending) {
+ // the input must be moved by leaving it in place and moving the
+ // siblings, due to the fact that focus cannot be restored once lost
+ // on mobile webkit devices
+ var j, n, fn, $children, $child;
+ $children = this.$control.children(':not(input)');
+ for (j = 0, n = ($children ? $children.length : 0); j < n; j++) {
+ $child = $($children[j]);//.detach();
+ if (j < i) {
+ $child.before(this.$control_input);
+ } else {
+ this.$control.appendChild($child);
+ }
+ }
+ }
+
+ this.caretPos = i;
+ },
+
+ lock: function() {
+ this.close();
+ this.isLocked = true;
+ this.refreshState();
+ },
+
+ unlock: function() {
+ this.isLocked = false;
+ this.refreshState();
+ },
+
+ disable: function() {
+ this.input.disabled(true);
+ this.$control_input.attribute('disabled', true).attribute('tabindex', -1);
+ this.isDisabled = true;
+ this.lock();
+ },
+
+ enable: function() {
+ this.input.attribute('disabled', null);
+ this.$control_input.attribute('disabled', null).attribute('tabindex', this.tabIndex);
+ this.isDisabled = false;
+ this.unlock();
+ },
+
+ destroy: function() {
+ var revertSettings = this.revertSettings;
+
+ this.emit('destroy');
+ this.off();
+ this.$wrapper.remove();
+ this.$dropdown.remove();
+
+ this.input
+ .html('')
+ .appendChild(revertSettings.$children)
+ .attribute('tabindex', null)
+ .removeClass('selectized')
+ .attribute({ tabindex: revertSettings.tabindex })
+ .show();
+
+ /*$(window).off(eventNS);
+ $(document).off(eventNS);
+ $(document.body).off(eventNS);*/
+
+ delete this.$control_input.selectizeGrow;
+ delete this.input.selectizeInstance;
+ delete this.input[0].selectize;
+ },
+
+ render: function(templateName, data) {
+ var value, id, label;
+ var name = '';
+ var cache = false;
+ var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i;
+
+ if (templateName === 'option' || templateName === 'item') {
+ value = hash_key(data[this.options.valueField]);
+ cache = !!value;
+ }
+
+ // pull markup from cache if it exists
+ if (cache) {
+ if (!isset(this.renderCache[templateName])) {
+ this.renderCache[templateName] = {};
+ }
+ if (this.renderCache[templateName].hasOwnProperty(value)) {
+ return this.renderCache[templateName][value];
+ }
+ }
+
+ // render markup
+ var html = zen('div').html(this.options.render[templateName].apply(this, [data, escapeHTML]));
+ html = html.firstChild();
+
+ // add mandatory attributes
+ if (templateName === 'option' || templateName === 'option_create') {
+ html = html.data('selectable', '');
+ }
+ if (templateName === 'optgroup') {
+ id = data[this.options.optgroupValueField] || '';
+ name = escape_replace(escapeHTML(id));
+ html = html.data('group', name).attribute('role', 'group').attribute('aria-label', name);
+ }
+ if (templateName === 'option' || templateName === 'item') {
+ name = escape_replace(escapeHTML(value || ''));
+ html = html.data('value', name).attribute('id', slugify(this.rand + '-' + name)).attribute('role', 'treeitem').attribute('aria-label', trim(data.text)).attribute('aria-selected', 'false');
+ }
+
+ // update cache
+ if (cache) {
+ this.renderCache[templateName][value] = html[0];
+ }
+
+ return html[0];
+ },
+
+ clearCache: function(templateName) {
+ if (typeof templateName === 'undefined') {
+ this.renderCache = {};
+ } else {
+ delete this.renderCache[templateName];
+ }
+ },
+
+ canCreate: function(input) {
+ if (!this.options.create) return false;
+ var filter = this.options.createFilter;
+ return input.length
+ && (typeof filter !== 'function' || filter.apply(self, [input]))
+ && (typeof filter !== 'string' || new RegExp(filter).test(input))
+ && (!(filter instanceof RegExp) || filter.test(input));
+ },
+
+ getPreviousValue: function() {
+ return this.previousValue;
+ }
+});
+
+$.implement({
+ selectize: function(settings_user) {
+ settings_user = settings_user || {};
+ var defaults = Selectize.prototype.options,
+ settings = merge({}, defaults, settings_user),
+ attr_data = settings.dataAttr,
+ field_label = settings.labelField,
+ field_value = settings.valueField,
+ field_optgroup = settings.optgroupField,
+ field_optgroup_label = settings.optgroupLabelField,
+ field_optgroup_value = settings.optgroupValueField;
+
+ var init_textbox = function(input, settings_element) {
+ input = $(input);
+ var i, n, values, option;
+
+ var data_raw = input.attribute(attr_data);
+
+ if (!data_raw) {
+ var value = trim(input.value() || '');
+ if (!settings.allowEmptyOption && !value.length) return;
+
+ values = value.split(settings.delimiter);
+ for (i = 0, n = values.length; i < n; i++) {
+ option = {};
+ option[field_label] = values[i];
+ option[field_value] = values[i];
+
+ settings_element.Options.push(option);
+ }
+
+ settings_element.items = values;
+ } else {
+ settings_element.Options = JSON.parse(data_raw);
+ for (i = 0, n = settings_element.Options.length; i < n; i++) {
+ settings_element.items.push(settings_element.Options[i][field_value]);
+ }
+ }
+ };
+
+ var init_select = function(input, settings_element) {
+ var i, n, tagName, children, order = 0;
+ var options = settings_element.Options;
+ var optionsMap = {};
+
+ var readData = function(el) {
+ var data = attr_data && el.attribute(attr_data);
+ if (typeof data === 'string' && data.length) {
+ return JSON.parse(data);
+ }
+ return null;
+ };
+
+ var addOption = function(option, group) {
+ var value, opt;
+
+ option = $(option);
+
+ value = hash_key(option.value());
+ if (!value.length && !settings.allowEmptyOption) return;
+
+ // if the option already exists, it's probably been
+ // duplicated in another optgroup. in this case, push
+ // the current group to the "optgroup" property on the
+ // existing option so that it's rendered in both places.
+ if (optionsMap.hasOwnProperty(value)) {
+ if (group) {
+ var arr = optionsMap[value][field_optgroup];
+ if (!arr) {
+ optionsMap[value][field_optgroup] = group;
+ } else if (!isArray(arr)) {
+ optionsMap[value][field_optgroup] = [arr, group];
+ } else {
+ arr.push(group);
+ }
+ }
+ return;
+ }
+
+ opt = readData(option) || {};
+ opt[field_label] = opt[field_label] || option.text();
+ opt[field_value] = opt[field_value] || value;
+ opt[field_optgroup] = opt[field_optgroup] || group;
+
+ optionsMap[value] = opt;
+ options.push(opt);
+
+ if (option.matches(':selected')) {
+ settings_element.items.push(value);
+ }
+ };
+
+ var addGroup = function(optgroup) {
+ var i, n, id, optgrp, options;
+
+ optgroup = $(optgroup);
+ id = optgroup.attribute('label');
+
+ if (id) {
+ optgrp = readData(optgroup) || {};
+ optgrp[field_optgroup_label] = id;
+ optgrp[field_optgroup_value] = id;
+ settings_element.Optgroups.push(optgrp);
+ }
+
+ options = optgroup.search('option');
+ for (i = 0, n = options.length; i < n; i++) {
+ addOption(options[i], id);
+ }
+ };
+
+ settings_element.maxItems = input.attribute('multiple') ? null : 1;
+
+ children = input.children() || 0;
+ for (i = 0, n = children.length; i < n; i++) {
+ tagName = children[i].tagName.toLowerCase();
+ if (tagName === 'optgroup') {
+ addGroup(children[i]);
+ } else if (tagName === 'option') {
+ addOption(children[i]);
+ }
+ }
+ };
+
+ return this.forEach(function($input, i) {
+ settings = merge({}, defaults, settings_user),
+ $input = $($input);
+ if ($input.selectizeInstance) return;
+
+ var instance,
+ dataOptions = $input.data('selectize'),
+ tag_name = $input.tag().toLowerCase(),
+ placeholder = $input.attribute('placeholder') || $input.attribute('data-placeholder');
+
+ // g5 custom
+ if (dataOptions) { dataOptions = JSON.parse(dataOptions); }
+ settings = merge({}, settings, dataOptions);
+ // end g5 custom
+
+ if (!placeholder && !settings.allowEmptyOption) {
+ var chlds = $input.children('option[value=""]');
+ placeholder = chlds ? $input.children('option[value=""]').text() : '';
+ }
+
+ var settings_element = {
+ 'placeholder': placeholder,
+ 'Options': [],
+ 'Optgroups': [],
+ 'items': []
+ };
+
+ if (tag_name === 'select') {
+ init_select($input, settings_element);
+ } else {
+ init_textbox($input, settings_element);
+ }
+
+ instance = new Selectize($input, merge({}, defaults, settings_element, settings_user, dataOptions));
+ $input.selectizeInstance = instance;
+ });
+ }
+});
+
+ready(function() {
+ var selects = $('[data-selectize]');
+ if (!selects) { return; }
+
+ selects.selectize();
+});
+
+
+module.exports = Selectize;
+
+},{"../utils/elements.utils":66,"elements/domready":111,"elements/zen":137,"moofx":138,"mout/array/indexOf":175,"mout/array/last":179,"mout/collection/forEach":189,"mout/function/bind":192,"mout/function/debounce":193,"mout/lang/isArray":203,"mout/lang/isBoolean":204,"mout/object/merge":237,"mout/object/size":242,"mout/object/unset":244,"mout/object/values":245,"mout/string/escapeHtml":259,"mout/string/slugify":271,"mout/string/trim":272,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"sifter":312}],59:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ Emitter = require('prime/emitter'),
+ Bound = require('prime-util/prime/bound'),
+ Options = require('prime-util/prime/options'),
+ zen = require('elements/zen'),
+ $ = require('../utils/elements.utils.js'),
+ storage = require('prime/map')(),
+
+ bind = require('mout/function/bind'),
+ merge = require('mout/object/merge');
+
+var Toaster = new prime({
+ mixin: [Bound, Options],
+
+ inherits: Emitter,
+
+ options: {
+ tapToDismiss: true,
+ noticeClass: 'g-notifications',
+ containerID: 'g-notifications-container',
+
+ types: {
+ base: '',
+ error: 'fa-minus-circle',
+ info: 'fa-info-circle',
+ success: 'fa-check-circle',
+ warning: 'fa-exclamation-triangle'
+ },
+
+ showDuration: 300,
+ showEquation: 'cubic-bezier(0.02, 0.01, 0.47, 1)',
+ hideDuration: 500,
+ hideEquation: 'cubic-bezier(0.02, 0.01, 0.47, 1)',
+
+ timeOut: 2500, // timeOut and extendedTimeout to 0 == sticky
+ extendedTimeout: 2500,
+
+ location: 'bottom-right',
+
+ titleClass: 'g-notifications-title',
+ messageClass: 'g-notifications-message',
+ closeButton: true,
+
+ target: '#g5-container',
+ targetLocation: 'bottom',
+
+ newestOnTop: true,
+ preventDuplicates: false,
+ progressBar: true
+
+
+ /*
+ onShow: function() {},
+ onHidden: function() {},
+ onClick: function() {}
+ */
+ },
+
+ constructor: function(options) {
+ this.setOptions(options);
+
+ this.id = 0;
+ this.previousNotice = null;
+ this.map = storage;
+ },
+
+ mergeOptions: function(options) {
+ return merge(this.options, options || {});
+ },
+
+ base: function(message, title, options) {
+ options = this.mergeOptions(options);
+
+ return this.notify(merge(options, {
+ title: title || '',
+ type: options.type || 'base',
+ message: message
+ }));
+ },
+
+ success: function(message, title, options) {
+ options = this.mergeOptions(options);
+
+ return this.notify(merge(options, {
+ title: title || 'Success!',
+ type: 'success',
+ message: message
+ }));
+ },
+
+ info: function(message, title, options) {
+ options = this.mergeOptions(options);
+
+ return this.notify(merge(options, {
+ title: title || 'Info',
+ type: 'info',
+ message: message
+ }));
+ },
+ warning: function(message, title, options) {
+ options = this.mergeOptions(options);
+
+ return this.notify(merge(options, {
+ title: title || 'Warning!',
+ type: 'warning',
+ message: message
+ }));
+ },
+
+ error: function(message, title, options) {
+ options = this.mergeOptions(options);
+
+ return this.notify(merge(options, {
+ title: title || 'Error!',
+ type: 'error',
+ message: message
+ }));
+ },
+
+ notify: function(options) {
+ options = this.mergeOptions(options);
+
+ if (options.preventDuplicates && this.previousNotice === options.message) { return; }
+
+ this.id++;
+ this.previousNotice = options.message;
+
+ var container = this.getContainer(options, true),
+ element = zen('div'), title = zen('div'), message = zen('div'),
+ icon = zen('i.fa'),
+ progress = zen('div.g-notifications-progress'),
+ close = zen('a.fa.fa-close[href="#"]');
+
+ this.map.set(element, {
+ container: container,
+ interval: null,
+ progressBar: {
+ interval: null,
+ hideETA: null,
+ maxHideTime: null
+ },
+ response: {
+ id: this.id,
+ state: 'visible',
+ start: new Date(),
+ options: options
+ },
+ options: options
+ });
+
+ if (options.title) {
+ element.appendChild(title.html(options.title).addClass(options.titleClass));
+ }
+
+ if (options.message) {
+ element.appendChild(message.html(options.message).addClass(options.messageClass));
+ }
+
+ if (options.closeButton) {
+ close.top(element);
+ }
+
+ if (options.progressBar) {
+ progress.top(element);
+ }
+
+ if (options.type && options.title) {
+ if (options.types[options.type]) {
+ element.addClass('g-notifications-theme-' + options.type);
+ icon.top(title).addClass(options.types[options.type]);
+ }
+ }
+
+ element.style({ opacity: 0 });
+ element[options.newestOnTop ? 'top' : 'bottom'](container);
+ element.animate({ opacity: 1 }, {
+ duration: options.showDuration,
+ equation: options.showEquation,
+ callback: options.onShow
+ });
+
+ if (options.timeOut > 0) {
+ var map = this.map.get(element);
+ map.interval = setTimeout(bind(function() {
+ this.hide(element);
+ }, this), options.timeOut);
+ map.progressBar.maxHideTime = parseFloat(options.timeOut);
+ map.progressBar.hideETA = new Date().getTime() + map.progressBar.maxHideTime;
+
+ if (options.progressBar) {
+ map.progressBar.interval = setInterval(bind(function() {
+ this.updateProgress(element, progress);
+ }, this), 10);
+ }
+
+ this.map.set(element, map);
+ }
+
+ var stick = bind(function() { this.stickAround(element); }, this),
+ delay = bind(function() { this.delayedHide(element); }, this);
+ element.on('mouseover', stick);
+ element.on('mouseout', delay);
+
+ if (!options.onClick && options.tapToDismiss) {
+ element.on('click', bind(function(){
+ element.off('mouseover', stick);
+ element.off('mouseout', delay);
+
+ this.hide(element);
+ }, this));
+ }
+
+ if (options.closeButton && close) {
+ close.on('click', bind(function(event){
+ event.stopPropagation();
+ event.preventDefault();
+
+ element.off('mouseover', stick);
+ element.off('mouseout', delay);
+ this.hide(element, true);
+ }, this));
+ }
+
+ },
+
+ stickAround: function(element) {
+ var map = this.map.get(element);
+
+ clearTimeout(map.interval);
+ map.progressBar.hideETA = 0;
+ element.animate({ opacity: 1 }, {
+ duration: map.options.showDuration,
+ equation: map.options.showEquation,
+ callback: map.options.onShow
+ });
+
+ this.map.set(element, map);
+ },
+
+ hide: function(element, override) {
+ if (element.find(':focus') && !override) { return; }
+
+ var map = this.map.get(element);
+
+ clearTimeout(map.progressBar.interval);
+
+ this.map.set(element, map);
+ return element.animate({ opacity: 0 }, {
+ duration: map.options.hideDuration,
+ equation: map.options.hideEquation,
+ callback: bind(function() {
+ this.remove(element);
+ if (map.options.onHidden && map.response.state !== 'hidden') { map.options.onHidden(); }
+ map.response.state = 'hidden';
+ map.response.endTime = new Date();
+
+ this.map.set(element, map);
+ }, this)
+ });
+ },
+
+ delayedHide: function(element, override) {
+ var map = this.map.get(element);
+
+ if (map.options.timeOut > 0 || map.options.extendedTimeout > 0) {
+ map.interval = setTimeout(bind(function() {
+ this.hide(element);
+ }, this), map.options.extendedTimeout);
+ map.progressBar.maxHideTime = parseFloat(map.options.extendedTimeout);
+ map.progressBar.hideETA = new Date().getTime() + map.progressBar.maxHideTime;
+ }
+
+ this.map.set(element, map);
+ },
+
+ updateProgress: function(element, progress) {
+ var map = this.map.get(element),
+ percentage = ((map.progressBar.hideETA - (new Date().getTime())) / map.progressBar.maxHideTime) * 100;
+
+ this.map.set(element, map);
+ progress.style({ width: percentage + '%' });
+ },
+
+ getContainer: function(options, create) {
+ options = this.mergeOptions(options);
+
+ var container = $('#' + options.containerID);
+ if (container) { return container; }
+
+ if (create) { container = this.createContainer(options); }
+
+ return container;
+ },
+
+ createContainer: function(options) {
+ options = this.mergeOptions(options);
+
+ return zen('div#' + options.containerID + '.' + options.location)[options.targetLocation](options.target).attribute('aria-live', 'polite').attribute('role', 'alert');
+ },
+
+ remove: function(element) {
+ if (!element) { return; }
+
+ var map = this.map.get(element);
+ if (!map.container) { map.container = this.getContainer(map.options); }
+ /*if ($toastElement.is(':visible')) {
+ return;
+ }*/
+
+ element.remove();
+ if (!map.container.children()) {
+ map.container.remove();
+ this.previousNotice = null;
+ }
+
+ this.map.set(element, map);
+ }
+});
+
+var toaster = new Toaster();
+
+module.exports = toaster;
+
+},{"../utils/elements.utils.js":66,"elements/zen":137,"mout/function/bind":192,"mout/object/merge":237,"prime":301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302}],60:[function(require,module,exports){
+"use strict";
+var ready = require('elements/domready'),
+ $ = require('elements'),
+
+ modal = require('./modal'),
+ toastr = require('./toastr'),
+ request = require('agent'),
+
+ getAjaxSuffix = require('../utils/get-ajax-suffix'),
+ parseAjaxURI = require('../utils/get-ajax-url').parse,
+ getAjaxURL = require('../utils/get-ajax-url').global;
+
+var hiddens,
+ toggles = function(event, element) {
+ if (event.type.match(/^touch/) || event.type == 'click') { event.preventDefault(); }
+ if (event.type == 'click') { return false; }
+ element = $(element);
+ hiddens = element.find('~~ [type=hidden]');
+
+ if (!hiddens) return true;
+ hiddens.value(hiddens.value() == '0' ? '1' : '0');
+ element.parent('.enabler').attribute('aria-checked', hiddens.value() == '1' ? 'true' : 'false');
+
+ hiddens.emit('change');
+ $('body').emit('change', { target: hiddens });
+
+ return false;
+ };
+
+ready(function() {
+ var body = $('body');
+ body.delegate('keydown', '.enabler', function(event, element){
+ element = $(element);
+ if (element.disabled() || element.find('[disabled]')) {
+ return;
+ }
+
+ var key = (event.which ? event.which : event.keyCode);
+ if (key == 32 || key == 13) { // ARIA support: Space / Enter toggle
+ event.preventDefault();
+ toggles(event, element.find('.toggle'));
+ }
+ });
+
+ ['touchend', 'mouseup', 'click'].forEach(function(event) {
+ body.delegate(event, '.enabler .toggle', toggles);
+ });
+
+ var URI = parseAjaxURI(getAjaxURL('devprod') + getAjaxSuffix());
+ body.delegate('change', '[data-g-devprod] input[type="hidden"]', function(event, element) {
+ var value = element.value(),
+ parent = element.parent('[data-g-devprod]'),
+ labels = JSON.parse(parent.data('g-devprod'));
+
+ parent.showIndicator();
+
+ request('post', URI, { mode: value }, function(error, response) {
+ if (!response.body.success) {
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ element.value(!value);
+ } else {
+ parent.find('.devprod-mode').text(labels[response.body.mode] || 'Unknown');
+ toastr.success(response.body.html, response.body.title);
+ }
+
+ parent.hideIndicator();
+ });
+ });
+});
+
+module.exports = {};
+
+},{"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"./modal":55,"./toastr":59,"agent":80,"elements":113,"elements/domready":111}],61:[function(require,module,exports){
+"use strict";
+
+var ready = require('elements/domready'),
+ tooltips = require('ext/tooltips');
+
+tooltips.defaults = {
+ baseClass: 'g-tips',
+ typeClass: null,
+ effectClass: 'g-fade',
+ inClass: 'g-tip-in',
+ place: 'top',
+ spacing: 10,
+ offset: -3,
+ auto: 1
+};
+
+var Instance = null;
+
+ready(function() {
+ Instance = new tooltips(document, {
+ tooltip: tooltips.defaults,
+ key: 'tip',
+ showOn: 'mouseenter',
+ hideOn: 'mouseleave',
+ observe: 1
+ });
+
+ window.G5.tips = Instance;
+});
+
+module.exports = Instance;
+
+},{"elements/domready":111,"ext/tooltips":"ext/tooltips"}],62:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ $ = require('../utils/elements.utils'),
+ zen = require('elements/zen'),
+ domready = require('elements/domready'),
+ storage = require('prime/map')(),
+ modal = require('../ui').modal,
+
+ size = require('mout/collection/size'),
+ indexOf = require('mout/array/indexOf'),
+ merge = require('mout/object/merge'),
+ keys = require('mout/object/keys'),
+ guid = require('mout/random/guid'),
+ toQueryString = require('mout/queryString/encode'),
+ contains = require('mout/string/contains'),
+
+ getParam = require('mout/queryString/getParam'),
+ setParam = require('mout/queryString/setParam'),
+
+ request = require('agent')(),
+ History = require('./history'),
+ flags = require('./flags-state'),
+ parseAjaxURI = require('./get-ajax-url').parse,
+ getAjaxSuffix = require('./get-ajax-suffix'),
+ lm = require('../lm'),
+ mm = require('../menu'),
+ assignments = require('../assignments');
+
+require('../ui/popover');
+
+var ERROR = false, TMP_SELECTIZE_DISABLE = false, ConfNavIndex = -1;
+
+History.Adapter.bind(window, 'statechange', function() {
+ if (request.running()) {
+ return false;
+ }
+ var body = $('body'),
+ State = History.getState(),
+ URI = State.url,
+ Data = State.data,
+ sidebar = $('#navbar'),
+ mainheader = $('#main-header'),
+ params = '';
+
+ if (Data.doNothing) { return true; }
+
+ if (size(Data) && Data.parsed !== false && storage.get(Data.uuid)) {
+ Data = storage.get(Data.uuid);
+ }
+
+ if (Data.element) {
+ var isTopNavOrMenu = Data.element.parent('#main-header') || Data.element.matches('.menu-select-wrap');
+ body.emit('statechangeBefore', {
+ target: Data.element,
+ Data: Data
+ });
+ } else {
+ var url = URI.replace(window.location.origin, '');
+ Data.element = $('[href="' + url + '"]');
+ }
+
+ URI = parseAjaxURI(URI + getAjaxSuffix());
+
+ var lis;
+ if (sidebar && Data.element) {
+ var active = sidebar.search('li.active');
+ lis = sidebar.search('li');
+ lis.removeClass('active');
+
+ if (Data.element.parent('#navbar')) {
+ Data.element.parent('li').addClass('active');
+ }
+ }
+
+ if (mainheader && Data.element && (!Data.element.matches('a.menu-item') && !Data.element.matches('select.menu-select-wrap'))) {
+ lis = mainheader.search('.float-right li');
+ lis.removeClass('active');
+
+ if (Data.element.parent('#main-header')) {
+ Data.element.parent('li').addClass('active');
+ }
+ }
+
+ if (Data.params) {
+ params = toQueryString(JSON.parse(Data.params));
+ if (contains(URI, '?')) { params = params.replace(/^\?/, '&'); }
+ }
+
+ if (!ERROR) { modal.closeAll(); }
+ request.url(URI + params).data(Data.extras || {}).method(Data.extras ? 'post' : 'get').send(function(error, response) {
+ if (!response.body.success) {
+ if (!ERROR) {
+ ERROR = true;
+ modal.open({
+ content: response.body.html || response.body.message || response.body,
+ afterOpen: function(container) {
+ if (!response.body.html && !response.body.message) { container.style({ width: '90%' }); }
+ }
+ });
+
+ History.back();
+ } else {
+ ERROR = false;
+ }
+
+ if (Data.element) {
+ Data.element.hideIndicator();
+ }
+
+ return false;
+
+ }
+
+ var target = Data.parent ? Data.element.parent(Data.parent) : $(Data.target),
+ destination = (target || $('[data-g5-content]') || body);
+
+ if (response.body && response.body.html) {
+ var fader;
+ destination.html(response.body.html);
+ if (fader = (destination.matches('[data-g5-content]') ? destination : destination.find('[data-g5-content]'))) {
+ var navbar = $('#navbar');
+ fader.style({ opacity: 0 });
+
+ if (isTopNavOrMenu) {
+ $(navbar).attribute('tabindex', '-1').attribute('aria-hidden', 'true');
+ }
+
+ navbar[isTopNavOrMenu ? 'slideUp' : 'slideDown']();
+ fader.animate({ opacity: 1 });
+ }
+ } else { destination.html(response.body); }
+
+ body.getPopover().hideAll(true).destroy();
+
+ if (Data.element) {
+ body.emit('statechangeAfter', {
+ target: Data.element,
+ Data: Data
+ });
+ }
+
+ var element = (Data.event && Data.event.activeSpinner) || Data.element;
+ if (element) {
+ element.hideIndicator();
+ }
+
+ var selects = $('[data-selectize]');
+ if (selects) { selects.selectize(); }
+ selectorChangeEvent();
+ assignments.chromeFix();
+
+ body.emit('statechangeEnd');
+ });
+});
+
+var selectorChangeEvent = function() {
+ var selectors = $('[data-selectize-ajaxify]');
+ if (!selectors) { return; }
+
+ selectors.forEach(function(selector) {
+ selector = $(selector);
+ var selectize = selector.selectize().selectizeInstance;
+ if (!selectize || selectize.HasChangeEvent) { return; }
+
+ selectize.on('change', function() {
+ if (TMP_SELECTIZE_DISABLE) {
+ TMP_SELECTIZE_DISABLE = false;
+ return false;
+ }
+ var value = selectize.getValue(),
+ options = selectize.Options,
+ flagCallback = function() {
+ flags.off('update:pending', flagCallback);
+ modal.close();
+
+ selectize.input
+ .data('g5-ajaxify', '')
+ .data('g5-ajaxify-target', selector.data('g5-ajaxify-target') || '[data-g5-content-wrapper]')
+ .data('g5-ajaxify-target-parent', selector.data('g5-ajaxify-target-parent') || null)
+ .data('g5-ajaxify-href', options[value].url)
+ .data('g5-ajaxify-params', options[value].params ? JSON.stringify(options[value].params) : null);
+
+
+ var active = $('#navbar li.active') || $('#main-header li.active') || $('#navbar li:nth-child(2)');
+ if (active) { active.showIndicator(); }
+
+ $('body').emit('click', {
+ target: selectize.input,
+ activeSpinner: active
+ });
+ };
+
+ if (!options[value]) { return; }
+
+ if (flags.get('pending')) {
+ flags.warning({
+ callback: function(response, content) {
+ var saveContinue = content.find('[data-g-unsaved-save]'),
+ discardContinue = content.find('[data-g-unsaved-discard]');
+
+ if (!saveContinue) { return; }
+ saveContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.on('update:pending', flagCallback);
+ $('body').emit('click', { target: $('.button-save') });
+ });
+
+ discardContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.set('pending', false);
+ flagCallback();
+ });
+ },
+
+ afterclose: function() {
+ TMP_SELECTIZE_DISABLE = true;
+ selectize.setValue(selectize.getPreviousValue());
+ }
+ });
+
+ return;
+ }
+
+ flagCallback();
+ });
+
+ selectize.HasChangeEvent = true;
+ });
+};
+
+
+domready(function() {
+ var body = $('body');
+
+ // Update NONCE if any
+ if (GANTRY_AJAX_NONCE) {
+ var currentURI = History.getPageUrl(),
+ currentNonce, currentView;
+
+ // hack to inject the default view in WP/Grav in case it's missing
+ switch (GANTRY_PLATFORM) {
+ case 'wordpress':
+ currentNonce = getParam(currentURI, '_wpnonce');
+ // currentView = getParam(currentURI, 'view');
+
+ /*
+ if (!currentView) {
+ currentURI = setParam(currentURI, 'view', 'configurations/default/styles');
+ History.replaceState({ uuid: guid(), doNothing: true }, window.document.title, currentURI);
+ }
+ */
+
+ // refresh nonce
+ if (currentNonce !== GANTRY_AJAX_NONCE) {
+ currentURI = setParam(currentURI, '_wpnonce', GANTRY_AJAX_NONCE);
+ History.replaceState({ uuid: guid(), doNothing: true }, window.document.title, currentURI);
+ }
+ break;
+
+ case 'grav':
+ currentNonce = getParam(currentURI, 'nonce');
+ // currentView = contains(currentURI, 'configurations/default/styles');
+
+ /*
+ if (!currentView) {
+ currentURI += 'configurations/default/styles';
+ History.replaceState({ uuid: guid(), doNothing: true }, window.document.title, currentURI);
+ }
+ */
+
+ // refresh nonce
+ if (currentNonce !== GANTRY_AJAX_NONCE) {
+ currentURI = setParam(currentURI, 'nonce', GANTRY_AJAX_NONCE);
+ History.replaceState({ uuid: guid(), doNothing: true }, window.document.title, currentURI);
+ }
+ break;
+ }
+
+
+ }
+
+ // back to configuration
+ body.delegate('click', '.button-back-to-conf', function(event, element) {
+ event.preventDefault();
+
+ var confSelector = $('#configuration-selector'),
+ outlineDeleted = body.outlineDeleted,
+ currentOutline = confSelector.value();
+
+ ConfNavIndex = ConfNavIndex == -1 ? 1 : ConfNavIndex;
+ var navbar = $('#navbar'),
+ item = navbar.find('li:nth-child(' + (ConfNavIndex + 1) + ') [data-g5-ajaxify]');
+
+ if (flags.get('pending')) {
+ flags.warning({
+ callback: function(response, content) {
+ var saveContinue = content.find('[data-g-unsaved-save]'),
+ discardContinue = content.find('[data-g-unsaved-discard]'),
+ flagCallback = function() {
+ flags.off('update:pending', flagCallback);
+ modal.close();
+
+ body.emit('click', { target: item });
+ navbar.attribute('tabindex', null).attribute('aria-hidden', 'false');
+ navbar.slideDown();
+ };
+
+ if (!saveContinue) { return; }
+ saveContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.on('update:pending', flagCallback);
+ body.emit('click', { target: $('.button-save') });
+ });
+
+ discardContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.set('pending', false);
+ flagCallback();
+ });
+ }
+ });
+
+ return;
+ }
+
+ element.showIndicator();
+
+ if (outlineDeleted == currentOutline) {
+ var ids = keys(confSelector.selectizeInstance.Options),
+ id = ids.shift();
+ body.outlineDeleted = null;
+ item.href(item.href().replace('/' + outlineDeleted + '/', '/' + id + '/').replace('style=' + outlineDeleted, 'style=' + id));
+ }
+
+ body.emit('click', { target: item });
+ navbar.attribute('tabindex', null);
+ navbar.slideDown();
+ });
+
+ body.delegate('click', '#navbar a[data-g5-ajaxify]', function(event, element) {
+ var navbar = $('#navbar'),
+ lis = navbar.search('li a[data-g5-ajaxify]');
+
+ ConfNavIndex = indexOf(lis, element[0]) + 1;
+ });
+
+ // generic ajaxified links
+ body.delegate('click', '[data-g5-ajaxify]', function(event, element) {
+ if (event && event.preventDefault) {
+ if (event.which === 2 || event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) {
+ return true;
+ }
+
+ event.preventDefault();
+ }
+
+ if (flags.get('pending') && (!element.matches('a.menu-item') && !element.parent('[data-menu-items]'))) {
+ flags.warning({
+ callback: function(response, content) {
+ var saveContinue = content.find('[data-g-unsaved-save]'),
+ discardContinue = content.find('[data-g-unsaved-discard]'),
+ flagCallback = function() {
+ flags.off('update:pending', flagCallback);
+ modal.close();
+ body.emit('click', event);
+ };
+
+ if (!saveContinue) { return; }
+ saveContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.on('update:pending', flagCallback);
+ body.emit('click', { target: $('.button-save') });
+ });
+
+ discardContinue.on('click', function(e) {
+ e.preventDefault();
+ if (this.attribute('disabled')) { return false; }
+
+ $([saveContinue, discardContinue]).attribute('disabled');
+ flags.set('pending', false);
+ flagCallback();
+ });
+ }
+ });
+
+ return;
+ }
+
+ element.showIndicator();
+
+ var data = element.data('g5-ajaxify'),
+ target = element.data('g5-ajaxify-target'),
+ parent = element.data('g5-ajaxify-target-parent'),
+ url = element.attribute('href') || element.data('g5-ajaxify-href'),
+ params = element.data('g5-ajaxify-params') || false,
+ title = element.attribute('title') || window.document.title;
+
+ data = data ? JSON.parse(data) : { parsed: false };
+ if (data) {
+ var uuid = guid(), extras;
+
+ // TODO: The menu needs to be able to receive POST
+ if (element.data('mm-id') || element.parent('[data-mm-id]')) {
+ extras = {};
+ extras.menutype = $('select.menu-select-wrap').value();
+ extras.settings = JSON.stringify(mm.menumanager.settings);
+ extras.ordering = JSON.stringify(mm.menumanager.ordering);
+ extras.items = JSON.stringify(mm.menumanager.items);
+ }
+
+ storage.set(uuid, merge({}, data, {
+ target: target,
+ parent: parent,
+ element: element,
+ params: params,
+ extras: extras,
+ event: event
+ }));
+ data = { uuid: uuid };
+ }
+
+ History.pushState(data, title, url);
+
+ var navbar, active, actives = $('#navbar .active, #main-header .active');
+
+ if (navbar = element.parent('#navbar, #main-header')) {
+ if (actives) { actives.removeClass('active'); }
+
+ active = navbar.search('.active');
+ if (active) { active.removeClass('active'); }
+ element.parent('li').addClass('active');
+ }
+ });
+
+ // attach change events to configurations selector
+ selectorChangeEvent();
+});
+
+
+module.exports = {};
+
+},{"../assignments":3,"../lm":28,"../menu":35,"../ui":54,"../ui/popover":56,"../utils/elements.utils":66,"./flags-state":69,"./get-ajax-suffix":70,"./get-ajax-url":71,"./history":75,"agent":80,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/collection/size":191,"mout/object/keys":236,"mout/object/merge":237,"mout/queryString/encode":246,"mout/queryString/getParam":247,"mout/queryString/setParam":249,"mout/random/guid":251,"mout/string/contains":257,"prime":301,"prime/map":302}],63:[function(require,module,exports){
+"use strict";
+
+// credits: https://github.com/cowboy/javascript-sync-async-foreach
+var asyncForEach = function(arr, eachFn, doneFn) {
+ arr = arr || [];
+ var i = -1;
+ // Resolve array length to a valid (ToUint32) number.
+ var len = arr.length >>> 0;
+
+ (function next(result) {
+ // This flag will be set to true if `this.async` is called inside the
+ // eachFn` callback.
+ var async;
+ // Was false returned from the `eachFn` callback or passed to the
+ // `this.async` done function?
+ var abort = result === false;
+
+ // Increment counter variable and skip any indices that don't exist. This
+ // allows sparse arrays to be iterated.
+ do { ++i; } while (!(i in arr) && i !== len);
+
+ // Exit if result passed to `this.async` done function or returned from
+ // the `eachFn` callback was false, or when done iterating.
+ if (abort || i === len) {
+ // If a `doneFn` callback was specified, invoke that now. Pass in a
+ // boolean value representing "not aborted" state along with the array.
+ if (doneFn) {
+ doneFn(!abort, arr);
+ }
+ return;
+ }
+
+ // Invoke the `eachFn` callback, setting `this` inside the callback to a
+ // custom object that contains one method, and passing in the array item,
+ // index, and the array.
+ result = eachFn.call({
+ // If `this.async` is called inside the `eachFn` callback, set the async
+ // flag and return a function that can be used to continue iterating.
+ async: function() {
+ async = true;
+ return next;
+ }
+ }, arr[i], i, arr);
+
+ // If the async flag wasn't set, continue by calling `next` synchronously,
+ // passing in the result of the `eachFn` callback.
+ if (!async) {
+ next(result);
+ }
+ }());
+};
+
+module.exports = asyncForEach;
+
+},{}],64:[function(require,module,exports){
+'use strict';
+
+var Cookie = {
+ write: function(name, value) {
+ var date = new Date();
+ date.setTime(date.getTime() + 3600 * 1000 * 24 * 365 * 1); // 1 year
+
+ var host = window.location.host.toString(),
+ domain = host.substring(host.lastIndexOf(".", host.lastIndexOf(".") - 1) + 1);
+
+ if (host.match(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/)) { domain = host; }
+ var cookie = [name, '=', JSON.stringify(value), '; expires=', date.toGMTString(), '; domain=.', domain, '; path=/;'];
+
+ document.cookie = cookie.join('');
+ },
+
+ read: function(name) {
+ name = name.replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1');
+ var value = document.cookie.match('(?:^|;)\\s*' + name + '=([^;]*)');
+ return (value) ? JSON.parse(decodeURIComponent(value[1])) : null;
+ }
+};
+
+module.exports = Cookie;
+
+},{}],65:[function(require,module,exports){
+'use strict';
+
+var rAF = (function() {
+ return window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ function(callback) { window.setTimeout(callback, 1000 / 60); };
+}());
+
+var decouple = function(element, event, callback) {
+ var evt, tracking = false;
+ element = element[0] || element;
+
+ var capture = function(e) {
+ evt = e;
+ track();
+ };
+
+ var track = function() {
+ if (!tracking) {
+ rAF(update);
+ tracking = true;
+ }
+ };
+
+ var update = function() {
+ callback.call(element, evt);
+ tracking = false;
+ };
+
+ try {
+ element.addEventListener(event, capture, false);
+ } catch (e) {}
+
+ return capture;
+};
+
+module.exports = decouple;
+},{}],66:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ moofx = require('moofx'),
+ map = require('mout/array/map'),
+ series = require('mout/function/series'),
+ slick = require('slick'),
+ zen = require('elements/zen'),
+ progresser = require('../ui/progresser');
+
+var walk = function(combinator, method) {
+
+ return function(expression) {
+ var parts = slick.parse(expression || "*");
+
+ expression = map(parts, function(part) {
+ return combinator + " " + part;
+ }).join(', ');
+
+ return this[method](expression);
+ };
+
+};
+
+
+$.implement({
+ style: function() {
+ var moo = moofx(this);
+ moo.style.apply(moo, arguments);
+ return this;
+ },
+
+ animate: function() {
+ var moo = moofx(this);
+ moo.animate.apply(moo, arguments);
+ return this;
+ },
+
+ hide: function() {
+ return this.style('display', 'none');
+ },
+
+ show: function(mode) {
+ return this.style('display', mode || 'inherit');
+ },
+
+ progresser: function(options) {
+ var instance;
+
+ this.forEach(function(node) {
+ instance = node.ProgresserInstance;
+
+ if (!instance) { instance = new progresser(node, options); }
+ else { instance.constructor(node, options); }
+
+ node.ProgresserInstance = instance;
+ return instance;
+ });
+ },
+
+ compute: function() {
+ var moo = moofx(this);
+ return moo.compute.apply(moo, arguments);
+ },
+
+ showIndicator: function(klass, keepIcon) {
+ this.forEach(function(node) {
+ node = $(node);
+ if (typeof klass == 'boolean') {
+ keepIcon = klass;
+ klass = null;
+ }
+
+ var icon = keepIcon ? false : node.find('i');
+ node.gHadIcon = !!icon;
+
+ if (!icon) {
+ if (!node.find('span') && !node.children()) { zen('span').text(node.text()).top(node.empty()); }
+
+ icon = zen('i');
+ icon.top(node);
+ }
+
+ if (!node.gIndicator) { node.gIndicator = icon.attribute('class') || true; }
+ icon.attribute('class', klass || 'fa fa-fw fa-spin-fast fa-spinner');
+ });
+ },
+
+ hideIndicator: function() {
+ this.forEach(function(node) {
+ node = $(node);
+ if (!node.gIndicator) { return; }
+
+ var icon = node.find('i');
+
+ if (!icon) { return; }
+
+ if (!node.gHadIcon) { icon.remove(); }
+ else { icon.attribute('class', node.gIndicator); }
+
+ node.gIndicator = null;
+ });
+ },
+
+ slideDown: function(animation, callback) {
+ var element = this,
+ size = this.getRealSize(),
+ callbackStart = function() {
+ element.gSlideCollapsed = false;
+ },
+ callbackEnd = function() {
+ element.attribute('style', element.gSlideStyle);
+ };
+
+ callback = typeof animation === 'function' ? animation : (callback || function() {});
+ if (this.gSlideCollapsed === false) { return callback(); }
+ callback = series(callbackStart, callback, callbackEnd);
+
+ animation = typeof animation === 'string' ? animation : {
+ duration: '250ms',
+ callback: callback
+ };
+
+ this.style('visibility', 'visible').attribute('aria-hidden', false);
+ this.animate({ height: size.height }, animation);
+ },
+
+ slideUp: function(animation, callback) {
+ if (typeof this.gSlideCollapsed === 'undefined') {
+ this.gSlideStyle = this.attribute('style');
+ }
+
+ var element = this,
+ callbackStart = function() {
+ element.gSlideCollapsed = true;
+ },
+ callbackEnd = function() {
+ element.style('visibility', 'hidden').attribute('aria-hidden', true);
+ };
+
+ callback = typeof animation === 'function' ? animation : (callback || function() {});
+ if (this.gSlideCollapsed === true) { return callback(); }
+ callback = series(callbackStart, callback, callbackEnd);
+
+ animation = typeof animation === 'string' ? animation : {
+ duration: '250ms',
+ callback: callback
+ };
+ this.style({ overflow: 'hidden' }).animate({ height: 0 }, animation);
+ },
+
+ slideToggle: function(animation, callback) {
+ var size = this.getRealSize();
+ return this[size.height && !this.gSlideCollapsed ? 'slideUp' : 'slideDown'](animation, callback);
+ },
+
+ getRealSize: function() {
+ var style = this.attribute('style'), size;
+ this.style({
+ position: 'relative',
+ overflow: 'inherit',
+ top: -50000,
+ height: 'auto',
+ width: 'auto'
+ });
+
+ size = {
+ width: parseInt(this.compute('width'), 10),
+ height: parseInt(this.compute('height'), 10)
+ };
+
+ this[0].style = style;
+
+ return size;
+ },
+
+ sibling: walk('++', 'find'),
+
+ siblings: walk('~~', 'search')
+});
+
+module.exports = $;
+
+},{"../ui/progresser":57,"elements":113,"elements/zen":137,"moofx":138,"mout/array/map":180,"mout/function/series":197,"slick":314}],67:[function(require,module,exports){
+"use strict";
+var $ = require('elements');
+
+$.implement({
+ belowthefold: function(expression, treshold) {
+ var elements = this.search(expression);
+ treshold = treshold || 0;
+ if (!elements) { return false; }
+
+ var fold = this.position().height + this[0].scrollTop;
+ return elements.filter(function(element) {
+ return fold <= $(element)[0].offsetTop - treshold;
+ });
+ },
+
+ abovethetop: function(expression, treshold) {
+ var elements = this.search(expression);
+ treshold = treshold || 0;
+ if (!elements) { return false; }
+
+ var top = this[0].scrollTop;
+ return elements.filter(function(element) {
+ return top >= $(element)[0].offsetTop + $(element).position().height - treshold;
+ });
+ },
+
+ rightofscreen: function(expression, treshold) {
+ var elements = this.search(expression);
+ treshold = treshold || 0;
+ if (!elements) { return false; }
+
+ var fold = this.position().width + this[0].scrollLeft;
+ return elements.filter(function(element) {
+ return fold <= $(element)[0].offsetLeft - treshold;
+ });
+ },
+
+ leftofscreen: function(expression, treshold) {
+ var elements = this.search(expression);
+ treshold = treshold || 0;
+ if (!elements) { return false; }
+
+ var left = this[0].scrollLeft;
+ return elements.filter(function(element) {
+ return left >= $(element)[0].offsetLeft + $(element).position().width - treshold;
+ });
+ },
+
+ inviewport: function(expression, treshold) {
+ var elements = this.search(expression);
+ treshold = treshold || 0;
+ if (!elements) { return false; }
+
+ var position = this.position();
+ return elements.filter(function(element) {
+ element = $(element);
+ return element[0].offsetTop + treshold >= this[0].scrollTop &&
+ element[0].offsetTop - treshold <= this[0].scrollTop + position.height;
+ }, this);
+ }
+});
+
+module.exports = $;
+
+},{"elements":113}],68:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements');
+
+var fieldValidation = function(field) {
+ field = $(field);
+ var _field = field[0],
+ tag = field.tag(),
+ type = field.type(),
+ isValid = true;
+
+ // only validate input, textarea, select
+ if (!~['input', 'textarea', 'select'].indexOf(tag)) { return isValid; }
+
+ // use native validation if available
+ if (typeof _field.willValidate !== 'undefined') {
+ if (tag == 'input' && (_field.type.toLowerCase() !== type || field.hasClass('custom-validation-field'))) {
+ // type not supported or custom, fallback validation
+ _field.setCustomValidity(validate(field) ? '' : 'The field value is invalid');
+ }
+
+ // native validity check
+ _field.checkValidity();
+
+ } else {
+ _field.validity = _field.validity || {};
+ _field.validity.valid = validate(field);
+ }
+
+ isValid = _field.validity.valid;
+
+ return isValid;
+};
+
+var validate = function(field) {
+ field = $(field);
+
+ var isValid = true,
+ value = field.value(),
+ type = field.type(),
+ isCheckbox = (type == 'checkbox' || type == 'radio'),
+ disabled = field.attribute('disabled'),
+ required = field.attribute('required'),
+ minlength = field.attribute('minlength'),
+ maxlength = field.attribute('maxlength'),
+ min = field.attribute('min'),
+ max = field.attribute('max'),
+ pattern = field.attribute('pattern');
+
+ // disabled fields should not be validated
+ if (disabled) { return isValid; }
+
+ // required
+ isValid = isValid && (!required || (isCheckbox && field.checked()) || (!isCheckbox && value));
+
+ // minlength / maxlength
+ isValid = isValid && (isCheckbox || ((!minlength || value.length >= minlength) && (!maxlength || value.length <= maxlength)));
+
+ // pattern
+ if (isValid && pattern) {
+ pattern = new RegExp(pattern);
+ isValid = pattern.test(value);
+ }
+
+ // min / max
+ if (isValid && (min !== null || max !== null)) {
+ if (min !== null) {
+ isValid = parseFloat(value) >= parseFloat(min);
+ }
+
+ if (max !== null) {
+ isValid = parseFloat(value) <= parseFloat(max);
+ }
+ }
+
+ return isValid;
+};
+
+module.exports = fieldValidation;
+
+},{"elements":113}],69:[function(require,module,exports){
+"use strict";
+
+var prime = require('prime'),
+ map = require('prime/map'),
+ Emitter = require('prime/emitter'),
+ modal = require('../ui').modal,
+
+ getAjaxURL = require('./get-ajax-url').global,
+ parseAjaxURI = require('./get-ajax-url').parse,
+ getAjaxSuffix = require('./get-ajax-suffix');
+
+var FlagsState = new prime({
+
+ inherits: Emitter,
+
+ constructor: function() {
+ this.flags = map();
+ },
+
+ set: function(key, value) {
+ return this.flags.set(key, value).get(key);
+ },
+
+ get: function(key, def) {
+ var value = this.flags.get(key);
+ return value ? value : this.set(key, def);
+ },
+
+ keys: function() {
+ return this.flags.keys();
+ },
+
+ values: function() {
+ return this.flags.values();
+ },
+
+ warning: function(options){
+ var callback = options.callback || function() {},
+ afterclose = options.afterclose || function() {},
+ warningURL = parseAjaxURI(options.url || getAjaxURL('unsaved') + getAjaxSuffix());
+
+ if (!options.url && !options.message) { options.url = true; }
+ if (options.url) {
+ modal.open({
+ content: 'Loading...',
+ remote: warningURL,
+ data: options.data || false,
+ remoteLoaded: function(response, modal) {
+ var content = modal.elements.content;
+ if (!callback) { return; }
+
+ callback.call(this, response, content, modal);
+ },
+ afterClose: afterclose || function() {}
+ });
+ } else {
+ modal.open({
+ content: options.message,
+ afterOpen: function(response, modal) {
+ var content = modal.elements.content;
+ if (!callback) { return; }
+
+ callback.call(this, response, content, modal);
+ },
+ afterClose: afterclose || function() {}
+ });
+ }
+ }
+
+});
+
+module.exports = new FlagsState();
+
+},{"../ui":54,"./get-ajax-suffix":70,"./get-ajax-url":71,"prime":301,"prime/emitter":300,"prime/map":302}],70:[function(require,module,exports){
+"use strict";
+
+var getAjaxSuffix = function() {
+ var GANTRY_AJAX_SUFFIX = window.GANTRY_AJAX_SUFFIX || undefined;
+ return typeof GANTRY_AJAX_SUFFIX == 'undefined' ? '' : GANTRY_AJAX_SUFFIX;
+};
+
+module.exports = getAjaxSuffix;
+
+},{}],71:[function(require,module,exports){
+"use strict";
+var unescapeHtml = require('mout/string/unescapeHtml'),
+ getAjaxSuffix = require('./get-ajax-suffix'),
+ endsWith = require('mout/string/endsWith'),
+ getQuery = require('mout/queryString/getQuery'),
+ getParam = require('mout/queryString/getParam'),
+ setParam = require('mout/queryString/setParam');
+
+var getAjaxURL = function(view, search) {
+ var GANTRY_AJAX_URL = window.GANTRY_AJAX_URL || '';
+ if (!search) { search = '%ajax%'; }
+ var re = new RegExp(search, 'g'),
+ url = typeof GANTRY_AJAX_URL == 'undefined' ? '' : GANTRY_AJAX_URL;
+
+ return unescapeHtml(url.replace(re, view));
+};
+
+var getConfAjaxURL = function(view, search) {
+ var GANTRY_AJAX_CONF_URL = window.GANTRY_AJAX_CONF_URL || '';
+ if (!search) { search = '%ajax%'; }
+ var re = new RegExp(search, 'g'),
+ url = typeof GANTRY_AJAX_CONF_URL == 'undefined' ? '' : GANTRY_AJAX_CONF_URL;
+
+ return unescapeHtml(url.replace(re, view));
+};
+
+var parseAjaxURI = function(uri) {
+ var GANTRY_PLATFORM = window.GANTRY_PLATFORM || '',
+ platform = typeof GANTRY_PLATFORM == 'undefined' ? '' : GANTRY_PLATFORM;
+
+ switch (platform) {
+ case 'wordpress':
+ uri = uri.replace(/themes\.php/ig, 'admin-ajax.php');
+ break;
+ case 'grav':
+ // converts foo/bar?nonce=1234.json to foo/bar.json?nonce=1234
+ var suffix = getAjaxSuffix();
+ if (endsWith(uri, suffix)) {
+ var query = '' + getQuery(uri),
+ nonce = '' + getParam(uri, 'nonce');
+
+ uri = uri.replace(query, suffix) + query.replace(nonce, (nonce.replace(suffix, '')));
+ }
+ break;
+ default:
+ }
+
+ return uri;
+};
+
+module.exports = {
+ global: getAjaxURL,
+ config: getConfAjaxURL,
+ parse: parseAjaxURI
+};
+
+},{"./get-ajax-suffix":70,"mout/queryString/getParam":247,"mout/queryString/getQuery":248,"mout/queryString/setParam":249,"mout/string/endsWith":258,"mout/string/unescapeHtml":274}],72:[function(require,module,exports){
+"use strict";
+var $ = require('elements'),
+ trim = require('mout/string/trim');
+
+var getOutlineNameById = function(outline) {
+ if (outline == null) { return ''; }
+ return trim($('#configuration-selector').selectizeInstance.Options[outline].text);
+};
+
+var getCurrentOutline = function() {
+ return trim($('#configuration-selector').selectizeInstance.getValue());
+};
+
+module.exports = { getOutlineNameById: getOutlineNameById, getCurrentOutline: getCurrentOutline };
+
+},{"elements":113,"mout/string/trim":272}],73:[function(require,module,exports){
+"use strict";
+
+var zen = require('elements/zen');
+
+var cached = null,
+ getScrollbarWidth = function() {
+ if (cached !== null) { return cached; }
+
+ var size, dummy = zen('div').bottom('#g5-container');
+ dummy.style({
+ width: 100,
+ height: 100,
+ overflow: 'scroll',
+ position: 'absolute',
+ zIndex: -9999
+ });
+
+ size = dummy[0].offsetWidth - dummy[0].clientWidth;
+ dummy.remove();
+
+ cached = size;
+ return size;
+ };
+
+module.exports = getScrollbarWidth;
+
+},{"elements/zen":137}],74:[function(require,module,exports){
+"use strict";
+
+var $ = require('elements'),
+ domready = require('elements/domready');
+
+// Localise Globals
+var History = {};
+
+// Check Existence
+if (typeof History.Adapter !== 'undefined') {
+ throw new Error('History.js Adapter has already been loaded...');
+}
+
+// Add the Adapter
+History.Adapter = {
+ /**
+ * History.Adapter.bind(el,event,callback)
+ * @param {Element|string} el
+ * @param {string} event - custom and standard events
+ * @param {function} callback
+ * @return {void}
+ */
+ bind: function(el, event, callback) {
+ $(el).on(event, callback);
+ },
+
+ /**
+ * History.Adapter.trigger(el,event)
+ * @param {Element|string} el
+ * @param {string} event - custom and standard events
+ * @param {Object=} extra - a object of extra event data (optional)
+ * @return void
+ */
+ trigger: function(el, event, extra) {
+ $(el).emit(event, extra);
+ },
+
+ /**
+ * History.Adapter.extractEventData(key,event,extra)
+ * @param {string} key - key for the event data to extract
+ * @param {string} event - custom and standard events
+ */
+ extractEventData: function(key, event) {
+ // MooTools Native then MooTools Custom
+ return (event && event.event && event.event[key]) || (event && event[key]) || undefined;
+ },
+
+ /**
+ * History.Adapter.onDomLoad(callback)
+ * @param {function} callback
+ * @return {void}
+ */
+ onDomLoad: function(callback) {
+ domready(callback);
+ }
+};
+
+// Try and Initialise History
+if (typeof History.init !== 'undefined') {
+ History.init();
+}
+
+module.exports = History;
+},{"elements":113,"elements/domready":111}],75:[function(require,module,exports){
+"use strict";
+
+// ========================================================================
+// Initialise
+
+// Localise Globals
+var
+ console = window.console || undefined, // Prevent a JSLint complain
+ document = window.document, // Make sure we are using the correct document
+ navigator = window.navigator, // Make sure we are using the correct navigator
+ sessionStorage = false, // sessionStorage
+ setTimeout = window.setTimeout,
+ clearTimeout = window.clearTimeout,
+ setInterval = window.setInterval,
+ clearInterval = window.clearInterval,
+ JSON = window.JSON,
+ alert = window.alert,
+ History = window.History = require('./history-adapter') || {}, // Public History Object
+ history = window.history; // Old History Object
+
+try {
+ sessionStorage = window.sessionStorage; // This will throw an exception in some browsers when cookies/localStorage are explicitly disabled (i.e. Chrome)
+ sessionStorage.setItem('TEST', '1');
+ sessionStorage.removeItem('TEST');
+} catch (e) {
+ sessionStorage = false;
+}
+
+// MooTools Compatibility
+JSON.stringify = JSON.stringify || JSON.encode;
+JSON.parse = JSON.parse || JSON.decode;
+
+// Check Existence
+if (typeof History.init === 'undefined') {
+
+ // Initialise History
+ History.init = function (options) {
+ // Check Load Status of Adapter
+ if (typeof History.Adapter === 'undefined') {
+ return false;
+ }
+
+ // Check Load Status of Core
+ if (typeof History.initCore !== 'undefined') {
+ History.initCore();
+ }
+
+ // Check Load Status of HTML4 Support
+ if (typeof History.initHtml4 !== 'undefined') {
+ History.initHtml4();
+ }
+
+ // Return true
+ return true;
+ };
+
+
+ // ========================================================================
+ // Initialise Core
+
+ // Initialise Core
+ History.initCore = function (options) {
+ // Initialise
+ if (typeof History.initCore.initialized !== 'undefined') {
+ // Already Loaded
+ return false;
+ }
+ else {
+ History.initCore.initialized = true;
+ }
+
+
+ // ====================================================================
+ // Options
+
+ /**
+ * History.options
+ * Configurable options
+ */
+ History.options = History.options || {};
+
+ /**
+ * History.options.hashChangeInterval
+ * How long should the interval be before hashchange checks
+ */
+ History.options.hashChangeInterval = History.options.hashChangeInterval || 100;
+
+ /**
+ * History.options.safariPollInterval
+ * How long should the interval be before safari poll checks
+ */
+ History.options.safariPollInterval = History.options.safariPollInterval || 500;
+
+ /**
+ * History.options.doubleCheckInterval
+ * How long should the interval be before we perform a double check
+ */
+ History.options.doubleCheckInterval = History.options.doubleCheckInterval || 500;
+
+ /**
+ * History.options.disableSuid
+ * Force History not to append suid
+ */
+ History.options.disableSuid = History.options.disableSuid || false;
+
+ /**
+ * History.options.storeInterval
+ * How long should we wait between store calls
+ */
+ History.options.storeInterval = History.options.storeInterval || 1000;
+
+ /**
+ * History.options.busyDelay
+ * How long should we wait between busy events
+ */
+ History.options.busyDelay = History.options.busyDelay || 250;
+
+ /**
+ * History.options.debug
+ * If true will enable debug messages to be logged
+ */
+ History.options.debug = History.options.debug || false;
+
+ /**
+ * History.options.initialTitle
+ * What is the title of the initial state
+ */
+ History.options.initialTitle = History.options.initialTitle || document.title;
+
+ /**
+ * History.options.html4Mode
+ * If true, will force HTMl4 mode (hashtags)
+ */
+ History.options.html4Mode = History.options.html4Mode || false;
+
+ /**
+ * History.options.delayInit
+ * Want to override default options and call init manually.
+ */
+ History.options.delayInit = History.options.delayInit || false;
+
+
+ // ====================================================================
+ // Interval record
+
+ /**
+ * History.intervalList
+ * List of intervals set, to be cleared when document is unloaded.
+ */
+ History.intervalList = [];
+
+ /**
+ * History.clearAllIntervals
+ * Clears all setInterval instances.
+ */
+ History.clearAllIntervals = function () {
+ var i, il = History.intervalList;
+ if (typeof il !== "undefined" && il !== null) {
+ for (i = 0; i < il.length; i++) {
+ clearInterval(il[i]);
+ }
+ History.intervalList = null;
+ }
+ };
+
+
+ // ====================================================================
+ // Debug
+
+ /**
+ * History.debug(message,...)
+ * Logs the passed arguments if debug enabled
+ */
+ History.debug = function () {
+ if ((History.options.debug || false)) {
+ History.log.apply(History, arguments);
+ }
+ };
+
+ /**
+ * History.log(message,...)
+ * Logs the passed arguments
+ */
+ History.log = function () {
+ // Prepare
+ var
+ consoleExists = !(typeof console === 'undefined' || typeof console.log === 'undefined' || typeof console.log.apply === 'undefined'),
+ textarea = document.getElementById('log'),
+ message,
+ i, n,
+ args, arg
+ ;
+
+ // Write to Console
+ if (consoleExists) {
+ args = Array.prototype.slice.call(arguments);
+ message = args.shift();
+ if (typeof console.debug !== 'undefined') {
+ console.debug.apply(console, [message, args]);
+ }
+ else {
+ console.log.apply(console, [message, args]);
+ }
+ }
+ else {
+ message = ("\n" + arguments[0] + "\n");
+ }
+
+ // Write to log
+ for (i = 1, n = arguments.length; i < n; ++i) {
+ arg = arguments[i];
+ if (typeof arg === 'object' && typeof JSON !== 'undefined') {
+ try {
+ arg = JSON.stringify(arg);
+ }
+ catch (Exception) {
+ // Recursive Object
+ }
+ }
+ message += "\n" + arg + "\n";
+ }
+
+ // Textarea
+ if (textarea) {
+ textarea.value += message + "\n-----\n";
+ textarea.scrollTop = textarea.scrollHeight - textarea.clientHeight;
+ }
+ // No Textarea, No Console
+ else if (!consoleExists) {
+ alert(message);
+ }
+
+ // Return true
+ return true;
+ };
+
+
+ // ====================================================================
+ // Emulated Status
+
+ /**
+ * History.getInternetExplorerMajorVersion()
+ * Get's the major version of Internet Explorer
+ * @return {integer}
+ * @license Public Domain
+ * @author Benjamin Arthur Lupton
+ * @author James Padolsey
+ */
+ History.getInternetExplorerMajorVersion = function () {
+ var result = History.getInternetExplorerMajorVersion.cached =
+ (typeof History.getInternetExplorerMajorVersion.cached !== 'undefined')
+ ? History.getInternetExplorerMajorVersion.cached
+ : (function () {
+ var v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+ while ((div.innerHTML = '') && all[0]) {
+ }
+ return (v > 4) ? v : false;
+ })()
+ ;
+ return result;
+ };
+
+ /**
+ * History.isInternetExplorer()
+ * Are we using Internet Explorer?
+ * @return {boolean}
+ * @license Public Domain
+ * @author Benjamin Arthur Lupton
+ */
+ History.isInternetExplorer = function () {
+ var result =
+ History.isInternetExplorer.cached =
+ (typeof History.isInternetExplorer.cached !== 'undefined')
+ ? History.isInternetExplorer.cached
+ : Boolean(History.getInternetExplorerMajorVersion())
+ ;
+ return result;
+ };
+
+ /**
+ * History.emulated
+ * Which features require emulating?
+ */
+
+ if (History.options.html4Mode) {
+ History.emulated = {
+ pushState: true,
+ hashChange: true
+ };
+ }
+
+ else {
+
+ History.emulated = {
+ pushState: !Boolean(
+ window.history && window.history.pushState && window.history.replaceState
+ && !(
+ (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) /* disable for versions of iOS before version 4.3 (8F190) */
+ || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
+ )
+ ),
+ hashChange: Boolean(
+ !(('onhashchange' in window) || ('onhashchange' in document))
+ ||
+ (History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8)
+ )
+ };
+ }
+
+ /**
+ * History.enabled
+ * Is History enabled?
+ */
+ History.enabled = !History.emulated.pushState;
+
+ /**
+ * History.bugs
+ * Which bugs are present
+ */
+ History.bugs = {
+ /**
+ * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
+ * https://bugs.webkit.org/show_bug.cgi?id=56249
+ */
+ setHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
+
+ /**
+ * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
+ * https://bugs.webkit.org/show_bug.cgi?id=42940
+ */
+ safariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
+
+ /**
+ * MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
+ */
+ ieDoubleCheck: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8),
+
+ /**
+ * MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event
+ */
+ hashEscape: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 7)
+ };
+
+ /**
+ * History.isEmptyObject(obj)
+ * Checks to see if the Object is Empty
+ * @param {Object} obj
+ * @return {boolean}
+ */
+ History.isEmptyObject = function (obj) {
+ for (var name in obj) {
+ if (obj.hasOwnProperty(name)) {
+ return false;
+ }
+ }
+ return true;
+ };
+
+ /**
+ * History.cloneObject(obj)
+ * Clones a object and eliminate all references to the original contexts
+ * @param {Object} obj
+ * @return {Object}
+ */
+ History.cloneObject = function (obj) {
+ var hash, newObj;
+ if (obj) {
+ hash = JSON.stringify(obj);
+ newObj = JSON.parse(hash);
+ }
+ else {
+ newObj = {};
+ }
+ return newObj;
+ };
+
+
+ // ====================================================================
+ // URL Helpers
+
+ /**
+ * History.getRootUrl()
+ * Turns "http://mysite.com/dir/page.html?asd" into "http://mysite.com"
+ * @return {String} rootUrl
+ */
+ History.getRootUrl = function () {
+ // Create
+ var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host);
+ if (document.location.port || false) {
+ rootUrl += ':' + document.location.port;
+ }
+ rootUrl += '/';
+
+ // Return
+ return rootUrl;
+ };
+
+ /**
+ * History.getBaseHref()
+ * Fetches the `href` attribute of the `` element if it exists
+ * @return {String} baseHref
+ */
+ History.getBaseHref = function () {
+ // Create
+ var
+ baseElements = document.getElementsByTagName('base'),
+ baseElement = null,
+ baseHref = '';
+
+ // Test for Base Element
+ if (baseElements.length === 1) {
+ // Prepare for Base Element
+ baseElement = baseElements[0];
+ baseHref = baseElement.href.replace(/[^\/]+$/, '');
+ }
+
+ // Adjust trailing slash
+ baseHref = baseHref.replace(/\/+$/, '');
+ if (baseHref) baseHref += '/';
+
+ // Return
+ return baseHref;
+ };
+
+ /**
+ * History.getBaseUrl()
+ * Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)
+ * @return {String} baseUrl
+ */
+ History.getBaseUrl = function () {
+ // Create
+ var baseUrl = History.getBaseHref() || History.getBasePageUrl() || History.getRootUrl();
+
+ // Return
+ return baseUrl;
+ };
+
+ /**
+ * History.getPageUrl()
+ * Fetches the URL of the current page
+ * @return {String} pageUrl
+ */
+ History.getPageUrl = function () {
+ // Fetch
+ var
+ State = History.getState(false, false),
+ stateUrl = (State || {}).url || History.getLocationHref(),
+ pageUrl;
+
+ // Create
+ pageUrl = stateUrl.replace(/\/+$/, '').replace(/[^\/]+$/, function (part, index, string) {
+ return (/\./).test(part) ? part : part + '/';
+ });
+
+ // Return
+ return pageUrl;
+ };
+
+ /**
+ * History.getBasePageUrl()
+ * Fetches the Url of the directory of the current page
+ * @return {String} basePageUrl
+ */
+ History.getBasePageUrl = function () {
+ // Create
+ var basePageUrl = (History.getLocationHref()).replace(/[#\?].*/, '').replace(/[^\/]+$/, function (part, index, string) {
+ return (/[^\/]$/).test(part) ? '' : part;
+ }).replace(/\/+$/, '') + '/';
+
+ // Return
+ return basePageUrl;
+ };
+
+ /**
+ * History.getFullUrl(url)
+ * Ensures that we have an absolute URL and not a relative URL
+ * @param {string} url
+ * @param {Boolean} allowBaseHref
+ * @return {string} fullUrl
+ */
+ History.getFullUrl = function (url, allowBaseHref) {
+ // Prepare
+ var fullUrl = url, firstChar = url.substring(0, 1);
+ allowBaseHref = (typeof allowBaseHref === 'undefined') ? true : allowBaseHref;
+
+ // Check
+ if (/[a-z]+\:\/\//.test(url)) {
+ // Full URL
+ }
+ else if (firstChar === '/') {
+ // Root URL
+ fullUrl = History.getRootUrl() + url.replace(/^\/+/, '');
+ }
+ else if (firstChar === '#') {
+ // Anchor URL
+ fullUrl = History.getPageUrl().replace(/#.*/, '') + url;
+ }
+ else if (firstChar === '?') {
+ // Query URL
+ fullUrl = History.getPageUrl().replace(/[\?#].*/, '') + url;
+ }
+ else {
+ // Relative URL
+ if (allowBaseHref) {
+ fullUrl = History.getBaseUrl() + url.replace(/^(\.\/)+/, '');
+ } else {
+ fullUrl = History.getBasePageUrl() + url.replace(/^(\.\/)+/, '');
+ }
+ // We have an if condition above as we do not want hashes
+ // which are relative to the baseHref in our URLs
+ // as if the baseHref changes, then all our bookmarks
+ // would now point to different locations
+ // whereas the basePageUrl will always stay the same
+ }
+
+ // Return
+ return fullUrl.replace(/\#$/, '');
+ };
+
+ /**
+ * History.getShortUrl(url)
+ * Ensures that we have a relative URL and not a absolute URL
+ * @param {string} url
+ * @return {string} url
+ */
+ History.getShortUrl = function (url) {
+ // Prepare
+ var shortUrl = url, baseUrl = History.getBaseUrl(), rootUrl = History.getRootUrl();
+
+ // Trim baseUrl
+ if (History.emulated.pushState) {
+ // We are in a if statement as when pushState is not emulated
+ // The actual url these short urls are relative to can change
+ // So within the same session, we the url may end up somewhere different
+ shortUrl = shortUrl.replace(baseUrl, '');
+ }
+
+ // Trim rootUrl
+ shortUrl = shortUrl.replace(rootUrl, '/');
+
+ // Ensure we can still detect it as a state
+ if (History.isTraditionalAnchor(shortUrl)) {
+ shortUrl = './' + shortUrl;
+ }
+
+ // Clean It
+ shortUrl = shortUrl.replace(/^(\.\/)+/g, './').replace(/\#$/, '');
+
+ // Return
+ return shortUrl;
+ };
+
+ /**
+ * History.getLocationHref(document)
+ * Returns a normalized version of document.location.href
+ * accounting for browser inconsistencies, etc.
+ *
+ * This URL will be URI-encoded and will include the hash
+ *
+ * @param {object} document
+ * @return {string} url
+ */
+ History.getLocationHref = function (doc) {
+ doc = doc || document;
+
+ // most of the time, this will be true
+ if (doc.URL === doc.location.href)
+ return doc.location.href;
+
+ // some versions of webkit URI-decode document.location.href
+ // but they leave document.URL in an encoded state
+ if (doc.location.href === decodeURIComponent(doc.URL))
+ return doc.URL;
+
+ // FF 3.6 only updates document.URL when a page is reloaded
+ // document.location.href is updated correctly
+ if (doc.location.hash && decodeURIComponent(doc.location.href.replace(/^[^#]+/, "")) === doc.location.hash)
+ return doc.location.href;
+
+ if (doc.URL.indexOf('#') == -1 && doc.location.href.indexOf('#') != -1)
+ return doc.location.href;
+
+ return doc.URL || doc.location.href;
+ };
+
+
+ // ====================================================================
+ // State Storage
+
+ /**
+ * History.store
+ * The store for all session specific data
+ */
+ History.store = {};
+
+ /**
+ * History.idToState
+ * 1-1: State ID to State Object
+ */
+ History.idToState = History.idToState || {};
+
+ /**
+ * History.stateToId
+ * 1-1: State String to State ID
+ */
+ History.stateToId = History.stateToId || {};
+
+ /**
+ * History.urlToId
+ * 1-1: State URL to State ID
+ */
+ History.urlToId = History.urlToId || {};
+
+ /**
+ * History.storedStates
+ * Store the states in an array
+ */
+ History.storedStates = History.storedStates || [];
+
+ /**
+ * History.savedStates
+ * Saved the states in an array
+ */
+ History.savedStates = History.savedStates || [];
+
+ /**
+ * History.noramlizeStore()
+ * Noramlize the store by adding necessary values
+ */
+ History.normalizeStore = function () {
+ History.store.idToState = History.store.idToState || {};
+ History.store.urlToId = History.store.urlToId || {};
+ History.store.stateToId = History.store.stateToId || {};
+ };
+
+ /**
+ * History.getState()
+ * Get an object containing the data, title and url of the current state
+ * @param {Boolean} friendly
+ * @param {Boolean} create
+ * @return {Object} State
+ */
+ History.getState = function (friendly, create) {
+ // Prepare
+ if (typeof friendly === 'undefined') {
+ friendly = true;
+ }
+ if (typeof create === 'undefined') {
+ create = true;
+ }
+
+ // Fetch
+ var State = History.getLastSavedState();
+
+ // Create
+ if (!State && create) {
+ State = History.createStateObject();
+ }
+
+ // Adjust
+ if (friendly) {
+ State = History.cloneObject(State);
+ State.url = State.cleanUrl || State.url;
+ }
+
+ // Return
+ return State;
+ };
+
+ /**
+ * History.getIdByState(State)
+ * Gets a ID for a State
+ * @param {State} newState
+ * @return {String} id
+ */
+ History.getIdByState = function (newState) {
+
+ // Fetch ID
+ var id = History.extractId(newState.url),
+ str;
+
+ if (!id) {
+ // Find ID via State String
+ str = History.getStateString(newState);
+ if (typeof History.stateToId[str] !== 'undefined') {
+ id = History.stateToId[str];
+ }
+ else if (typeof History.store.stateToId[str] !== 'undefined') {
+ id = History.store.stateToId[str];
+ }
+ else {
+ // Generate a new ID
+ while (true) {
+ id = (new Date()).getTime() + String(Math.random()).replace(/\D/g, '');
+ if (typeof History.idToState[id] === 'undefined' && typeof History.store.idToState[id] === 'undefined') {
+ break;
+ }
+ }
+
+ // Apply the new State to the ID
+ History.stateToId[str] = id;
+ History.idToState[id] = newState;
+ }
+ }
+
+ // Return ID
+ return id;
+ };
+
+ /**
+ * History.normalizeState(State)
+ * Expands a State Object
+ * @param {object} State
+ * @return {object}
+ */
+ History.normalizeState = function (oldState) {
+ // Variables
+ var newState, dataNotEmpty;
+
+ // Prepare
+ if (!oldState || (typeof oldState !== 'object')) {
+ oldState = {};
+ }
+
+ // Check
+ if (typeof oldState.normalized !== 'undefined') {
+ return oldState;
+ }
+
+ // Adjust
+ if (!oldState.data || (typeof oldState.data !== 'object')) {
+ oldState.data = {};
+ }
+
+ // ----------------------------------------------------------------
+
+ // Create
+ newState = {};
+ newState.normalized = true;
+ newState.title = oldState.title || '';
+ newState.url = History.getFullUrl(oldState.url ? oldState.url : (History.getLocationHref()));
+ newState.hash = History.getShortUrl(newState.url);
+ newState.data = History.cloneObject(oldState.data);
+
+ // Fetch ID
+ newState.id = History.getIdByState(newState);
+
+ // ----------------------------------------------------------------
+
+ // Clean the URL
+ newState.cleanUrl = newState.url.replace(/\??\&_suid.*/, '');
+ newState.url = newState.cleanUrl;
+
+ // Check to see if we have more than just a url
+ dataNotEmpty = !History.isEmptyObject(newState.data);
+
+ // Apply
+ if ((newState.title || dataNotEmpty) && History.options.disableSuid !== true) {
+ // Add ID to Hash
+ newState.hash = History.getShortUrl(newState.url).replace(/\??\&_suid.*/, '');
+ if (!/\?/.test(newState.hash)) {
+ newState.hash += '?';
+ }
+ newState.hash += '&_suid=' + newState.id;
+ }
+
+ // Create the Hashed URL
+ newState.hashedUrl = History.getFullUrl(newState.hash);
+
+ // ----------------------------------------------------------------
+
+ // Update the URL if we have a duplicate
+ if ((History.emulated.pushState || History.bugs.safariPoll) && History.hasUrlDuplicate(newState)) {
+ newState.url = newState.hashedUrl;
+ }
+
+ // ----------------------------------------------------------------
+
+ // Return
+ return newState;
+ };
+
+ /**
+ * History.createStateObject(data,title,url)
+ * Creates a object based on the data, title and url state params
+ * @param {object} data
+ * @param {string} title
+ * @param {string} url
+ * @return {object}
+ */
+ History.createStateObject = function (data, title, url) {
+ // Hashify
+ var State = {
+ 'data': data,
+ 'title': title,
+ 'url': url
+ };
+
+ // Expand the State
+ State = History.normalizeState(State);
+
+ // Return object
+ return State;
+ };
+
+ /**
+ * History.getStateById(id)
+ * Get a state by it's UID
+ * @param {String} id
+ */
+ History.getStateById = function (id) {
+ // Prepare
+ id = String(id);
+
+ // Retrieve
+ var State = History.idToState[id] || History.store.idToState[id] || undefined;
+
+ // Return State
+ return State;
+ };
+
+ /**
+ * Get a State's String
+ * @param {State} passedState
+ */
+ History.getStateString = function (passedState) {
+ // Prepare
+ var State, cleanedState, str;
+
+ // Fetch
+ State = History.normalizeState(passedState);
+
+ // Clean
+ cleanedState = {
+ data: State.data,
+ title: passedState.title,
+ url: passedState.url
+ };
+
+ // Fetch
+ str = JSON.stringify(cleanedState);
+
+ // Return
+ return str;
+ };
+
+ /**
+ * Get a State's ID
+ * @param {State} passedState
+ * @return {String} id
+ */
+ History.getStateId = function (passedState) {
+ // Prepare
+ var State, id;
+
+ // Fetch
+ State = History.normalizeState(passedState);
+
+ // Fetch
+ id = State.id;
+
+ // Return
+ return id;
+ };
+
+ /**
+ * History.getHashByState(State)
+ * Creates a Hash for the State Object
+ * @param {State} passedState
+ * @return {String} hash
+ */
+ History.getHashByState = function (passedState) {
+ // Prepare
+ var State, hash;
+
+ // Fetch
+ State = History.normalizeState(passedState);
+
+ // Hash
+ hash = State.hash;
+
+ // Return
+ return hash;
+ };
+
+ /**
+ * History.extractId(url_or_hash)
+ * Get a State ID by it's URL or Hash
+ * @param {string} url_or_hash
+ * @return {string} id
+ */
+ History.extractId = function (url_or_hash) {
+ // Prepare
+ var id, parts, url, tmp;
+
+ // Extract
+
+ // If the URL has a #, use the id from before the #
+ if (url_or_hash.indexOf('#') != -1) {
+ tmp = url_or_hash.split("#")[0];
+ }
+ else {
+ tmp = url_or_hash;
+ }
+
+ parts = /(.*)\&_suid=([0-9]+)$/.exec(tmp);
+ url = parts ? (parts[1] || url_or_hash) : url_or_hash;
+ id = parts ? String(parts[2] || '') : '';
+
+ // Return
+ return id || false;
+ };
+
+ /**
+ * History.isTraditionalAnchor
+ * Checks to see if the url is a traditional anchor or not
+ * @param {String} url_or_hash
+ * @return {Boolean}
+ */
+ History.isTraditionalAnchor = function (url_or_hash) {
+ // Check
+ var isTraditional = !(/[\/\?\.]/.test(url_or_hash));
+
+ // Return
+ return isTraditional;
+ };
+
+ /**
+ * History.extractState
+ * Get a State by it's URL or Hash
+ * @param {String} url_or_hash
+ * @return {State|null}
+ */
+ History.extractState = function (url_or_hash, create) {
+ // Prepare
+ var State = null, id, url;
+ create = create || false;
+
+ // Fetch SUID
+ id = History.extractId(url_or_hash);
+ if (id) {
+ State = History.getStateById(id);
+ }
+
+ // Fetch SUID returned no State
+ if (!State) {
+ // Fetch URL
+ url = History.getFullUrl(url_or_hash);
+
+ // Check URL
+ id = History.getIdByUrl(url) || false;
+ if (id) {
+ State = History.getStateById(id);
+ }
+
+ // Create State
+ if (!State && create && !History.isTraditionalAnchor(url_or_hash)) {
+ State = History.createStateObject(null, null, url);
+ }
+ }
+
+ // Return
+ return State;
+ };
+
+ /**
+ * History.getIdByUrl()
+ * Get a State ID by a State URL
+ */
+ History.getIdByUrl = function (url) {
+ // Fetch
+ var id = History.urlToId[url] || History.store.urlToId[url] || undefined;
+
+ // Return
+ return id;
+ };
+
+ /**
+ * History.getLastSavedState()
+ * Get an object containing the data, title and url of the current state
+ * @return {Object} State
+ */
+ History.getLastSavedState = function () {
+ return History.savedStates[History.savedStates.length - 1] || undefined;
+ };
+
+ /**
+ * History.getLastStoredState()
+ * Get an object containing the data, title and url of the current state
+ * @return {Object} State
+ */
+ History.getLastStoredState = function () {
+ return History.storedStates[History.storedStates.length - 1] || undefined;
+ };
+
+ /**
+ * History.hasUrlDuplicate
+ * Checks if a Url will have a url conflict
+ * @param {Object} newState
+ * @return {Boolean} hasDuplicate
+ */
+ History.hasUrlDuplicate = function (newState) {
+ // Prepare
+ var hasDuplicate = false,
+ oldState;
+
+ // Fetch
+ oldState = History.extractState(newState.url);
+
+ // Check
+ hasDuplicate = oldState && oldState.id !== newState.id;
+
+ // Return
+ return hasDuplicate;
+ };
+
+ /**
+ * History.storeState
+ * Store a State
+ * @param {Object} newState
+ * @return {Object} newState
+ */
+ History.storeState = function (newState) {
+ // Store the State
+ History.urlToId[newState.url] = newState.id;
+
+ // Push the State
+ History.storedStates.push(History.cloneObject(newState));
+
+ // Return newState
+ return newState;
+ };
+
+ /**
+ * History.isLastSavedState(newState)
+ * Tests to see if the state is the last state
+ * @param {Object} newState
+ * @return {boolean} isLast
+ */
+ History.isLastSavedState = function (newState) {
+ // Prepare
+ var isLast = false,
+ newId, oldState, oldId;
+
+ // Check
+ if (History.savedStates.length) {
+ newId = newState.id;
+ oldState = History.getLastSavedState();
+ oldId = oldState.id;
+
+ // Check
+ isLast = (newId === oldId);
+ }
+
+ // Return
+ return isLast;
+ };
+
+ /**
+ * History.saveState
+ * Push a State
+ * @param {Object} newState
+ * @return {boolean} changed
+ */
+ History.saveState = function (newState) {
+ // Check Hash
+ if (History.isLastSavedState(newState)) {
+ return false;
+ }
+
+ // Push the State
+ History.savedStates.push(History.cloneObject(newState));
+
+ // Return true
+ return true;
+ };
+
+ /**
+ * History.getStateByIndex()
+ * Gets a state by the index
+ * @param {integer} index
+ * @return {Object}
+ */
+ History.getStateByIndex = function (index) {
+ // Prepare
+ var State = null;
+
+ // Handle
+ if (typeof index === 'undefined') {
+ // Get the last inserted
+ State = History.savedStates[History.savedStates.length - 1];
+ }
+ else if (index < 0) {
+ // Get from the end
+ State = History.savedStates[History.savedStates.length + index];
+ }
+ else {
+ // Get from the beginning
+ State = History.savedStates[index];
+ }
+
+ // Return State
+ return State;
+ };
+
+ /**
+ * History.getCurrentIndex()
+ * Gets the current index
+ * @return (integer)
+ */
+ History.getCurrentIndex = function () {
+ // Prepare
+ var index = null;
+
+ // No states saved
+ if (History.savedStates.length < 1) {
+ index = 0;
+ }
+ else {
+ index = History.savedStates.length - 1;
+ }
+ return index;
+ };
+
+ // ====================================================================
+ // Hash Helpers
+
+ /**
+ * History.getHash()
+ * @param {Location=} location
+ * Gets the current document hash
+ * Note: unlike location.hash, this is guaranteed to return the escaped hash in all browsers
+ * @return {string}
+ */
+ History.getHash = function (doc) {
+ var url = History.getLocationHref(doc),
+ hash;
+ hash = History.getHashByUrl(url);
+ return hash;
+ };
+
+ /**
+ * History.unescapeHash()
+ * normalize and Unescape a Hash
+ * @param {String} hash
+ * @return {string}
+ */
+ History.unescapeHash = function (hash) {
+ // Prepare
+ var result = History.normalizeHash(hash);
+
+ // Unescape hash
+ result = decodeURIComponent(result);
+
+ // Return result
+ return result;
+ };
+
+ /**
+ * History.normalizeHash()
+ * normalize a hash across browsers
+ * @return {string}
+ */
+ History.normalizeHash = function (hash) {
+ // Prepare
+ var result = hash.replace(/[^#]*#/, '').replace(/#.*/, '');
+
+ // Return result
+ return result;
+ };
+
+ /**
+ * History.setHash(hash)
+ * Sets the document hash
+ * @param {string} hash
+ * @return {History}
+ */
+ History.setHash = function (hash, queue) {
+ // Prepare
+ var State, pageUrl;
+
+ // Handle Queueing
+ if (queue !== false && History.busy()) {
+ // Wait + Push to Queue
+ //History.debug('History.setHash: we must wait', arguments);
+ History.pushQueue({
+ scope: History,
+ callback: History.setHash,
+ args: arguments,
+ queue: queue
+ });
+ return false;
+ }
+
+ // Log
+ //History.debug('History.setHash: called',hash);
+
+ // Make Busy + Continue
+ History.busy(true);
+
+ // Check if hash is a state
+ State = History.extractState(hash, true);
+ if (State && !History.emulated.pushState) {
+ // Hash is a state so skip the setHash
+ //History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);
+
+ // PushState
+ History.pushState(State.data, State.title, State.url, false);
+ }
+ else if (History.getHash() !== hash) {
+ // Hash is a proper hash, so apply it
+
+ // Handle browser bugs
+ if (History.bugs.setHash) {
+ // Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249
+
+ // Fetch the base page
+ pageUrl = History.getPageUrl();
+
+ // Safari hash apply
+ History.pushState(null, null, pageUrl + '#' + hash, false);
+ }
+ else {
+ // Normal hash apply
+ document.location.hash = hash;
+ }
+ }
+
+ // Chain
+ return History;
+ };
+
+ /**
+ * History.escape()
+ * normalize and Escape a Hash
+ * @return {string}
+ */
+ History.escapeHash = function (hash) {
+ // Prepare
+ var result = History.normalizeHash(hash);
+
+ // Escape hash
+ result = window.encodeURIComponent(result);
+
+ // IE6 Escape Bug
+ if (!History.bugs.hashEscape) {
+ // Restore common parts
+ result = result
+ .replace(/\%21/g, '!')
+ .replace(/\%26/g, '&')
+ .replace(/\%3D/g, '=')
+ .replace(/\%3F/g, '?');
+ }
+
+ // Return result
+ return result;
+ };
+
+ /**
+ * History.getHashByUrl(url)
+ * Extracts the Hash from a URL
+ * @param {string} url
+ * @return {string} url
+ */
+ History.getHashByUrl = function (url) {
+ // Extract the hash
+ var hash = String(url)
+ .replace(/([^#]*)#?([^#]*)#?(.*)/, '$2')
+ ;
+
+ // Unescape hash
+ hash = History.unescapeHash(hash);
+
+ // Return hash
+ return hash;
+ };
+
+ /**
+ * History.setTitle(title)
+ * Applies the title to the document
+ * @param {State} newState
+ * @return {Boolean}
+ */
+ History.setTitle = function (newState) {
+ // Prepare
+ var title = newState.title,
+ firstState;
+
+ // Initial
+ if (!title) {
+ firstState = History.getStateByIndex(0);
+ if (firstState && firstState.url === newState.url) {
+ title = firstState.title || History.options.initialTitle;
+ }
+ }
+
+ // Apply
+ try {
+ document.getElementsByTagName('title')[0].innerHTML = title.replace('<', '<').replace('>', '>').replace(' & ', ' & ');
+ }
+ catch (Exception) {
+ }
+ document.title = title;
+
+ // Chain
+ return History;
+ };
+
+
+ // ====================================================================
+ // Queueing
+
+ /**
+ * History.queues
+ * The list of queues to use
+ * First In, First Out
+ */
+ History.queues = [];
+
+ /**
+ * History.busy(value)
+ * @param {boolean} value [optional]
+ * @return {boolean} busy
+ */
+ History.busy = function (value) {
+ // Apply
+ if (typeof value !== 'undefined') {
+ //History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);
+ History.busy.flag = value;
+ }
+ // Default
+ else if (typeof History.busy.flag === 'undefined') {
+ History.busy.flag = false;
+ }
+
+ // Queue
+ if (!History.busy.flag) {
+ // Execute the next item in the queue
+ clearTimeout(History.busy.timeout);
+ var fireNext = function () {
+ var i, queue, item;
+ if (History.busy.flag) return;
+ for (i = History.queues.length - 1; i >= 0; --i) {
+ queue = History.queues[i];
+ if (queue.length === 0) continue;
+ item = queue.shift();
+ History.fireQueueItem(item);
+ History.busy.timeout = setTimeout(fireNext, History.options.busyDelay);
+ }
+ };
+ History.busy.timeout = setTimeout(fireNext, History.options.busyDelay);
+ }
+
+ // Return
+ return History.busy.flag;
+ };
+
+ /**
+ * History.busy.flag
+ */
+ History.busy.flag = false;
+
+ /**
+ * History.fireQueueItem(item)
+ * Fire a Queue Item
+ * @param {Object} item
+ * @return {Mixed} result
+ */
+ History.fireQueueItem = function (item) {
+ return item.callback.apply(item.scope || History, item.args || []);
+ };
+
+ /**
+ * History.pushQueue(callback,args)
+ * Add an item to the queue
+ * @param {Object} item [scope,callback,args,queue]
+ */
+ History.pushQueue = function (item) {
+ // Prepare the queue
+ History.queues[item.queue || 0] = History.queues[item.queue || 0] || [];
+
+ // Add to the queue
+ History.queues[item.queue || 0].push(item);
+
+ // Chain
+ return History;
+ };
+
+ /**
+ * History.queue (item,queue), (func,queue), (func), (item)
+ * Either firs the item now if not busy, or adds it to the queue
+ */
+ History.queue = function (item, queue) {
+ // Prepare
+ if (typeof item === 'function') {
+ item = {
+ callback: item
+ };
+ }
+ if (typeof queue !== 'undefined') {
+ item.queue = queue;
+ }
+
+ // Handle
+ if (History.busy()) {
+ History.pushQueue(item);
+ } else {
+ History.fireQueueItem(item);
+ }
+
+ // Chain
+ return History;
+ };
+
+ /**
+ * History.clearQueue()
+ * Clears the Queue
+ */
+ History.clearQueue = function () {
+ History.busy.flag = false;
+ History.queues = [];
+ return History;
+ };
+
+
+ // ====================================================================
+ // IE Bug Fix
+
+ /**
+ * History.stateChanged
+ * States whether or not the state has changed since the last double check was initialised
+ */
+ History.stateChanged = false;
+
+ /**
+ * History.doubleChecker
+ * Contains the timeout used for the double checks
+ */
+ History.doubleChecker = false;
+
+ /**
+ * History.doubleCheckComplete()
+ * Complete a double check
+ * @return {History}
+ */
+ History.doubleCheckComplete = function () {
+ // Update
+ History.stateChanged = true;
+
+ // Clear
+ History.doubleCheckClear();
+
+ // Chain
+ return History;
+ };
+
+ /**
+ * History.doubleCheckClear()
+ * Clear a double check
+ * @return {History}
+ */
+ History.doubleCheckClear = function () {
+ // Clear
+ if (History.doubleChecker) {
+ clearTimeout(History.doubleChecker);
+ History.doubleChecker = false;
+ }
+
+ // Chain
+ return History;
+ };
+
+ /**
+ * History.doubleCheck()
+ * Create a double check
+ * @return {History}
+ */
+ History.doubleCheck = function (tryAgain) {
+ // Reset
+ History.stateChanged = false;
+ History.doubleCheckClear();
+
+ // Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)
+ // Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940
+ if (History.bugs.ieDoubleCheck) {
+ // Apply Check
+ History.doubleChecker = setTimeout(
+ function () {
+ History.doubleCheckClear();
+ if (!History.stateChanged) {
+ //History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
+ // Re-Attempt
+ tryAgain();
+ }
+ return true;
+ },
+ History.options.doubleCheckInterval
+ );
+ }
+
+ // Chain
+ return History;
+ };
+
+
+ // ====================================================================
+ // Safari Bug Fix
+
+ /**
+ * History.safariStatePoll()
+ * Poll the current state
+ * @return {History}
+ */
+ History.safariStatePoll = function () {
+ // Poll the URL
+
+ // Get the Last State which has the new URL
+ var
+ urlState = History.extractState(History.getLocationHref()),
+ newState;
+
+ // Check for a difference
+ if (!History.isLastSavedState(urlState)) {
+ newState = urlState;
+ }
+ else {
+ return;
+ }
+
+ // Check if we have a state with that url
+ // If not create it
+ if (!newState) {
+ //History.debug('History.safariStatePoll: new');
+ newState = History.createStateObject();
+ }
+
+ // Apply the New State
+ //History.debug('History.safariStatePoll: trigger');
+ History.Adapter.trigger(window, 'popstate');
+
+ // Chain
+ return History;
+ };
+
+
+ // ====================================================================
+ // State Aliases
+
+ /**
+ * History.back(queue)
+ * Send the browser history back one item
+ * @param {Integer} queue [optional]
+ */
+ History.back = function (queue) {
+ //History.debug('History.back: called', arguments);
+
+ // Handle Queueing
+ if (queue !== false && History.busy()) {
+ // Wait + Push to Queue
+ //History.debug('History.back: we must wait', arguments);
+ History.pushQueue({
+ scope: History,
+ callback: History.back,
+ args: arguments,
+ queue: queue
+ });
+ return false;
+ }
+
+ // Make Busy + Continue
+ History.busy(true);
+
+ // Fix certain browser bugs that prevent the state from changing
+ History.doubleCheck(function () {
+ History.back(false);
+ });
+
+ // Go back
+ history.go(-1);
+
+ // End back closure
+ return true;
+ };
+
+ /**
+ * History.forward(queue)
+ * Send the browser history forward one item
+ * @param {Integer} queue [optional]
+ */
+ History.forward = function (queue) {
+ //History.debug('History.forward: called', arguments);
+
+ // Handle Queueing
+ if (queue !== false && History.busy()) {
+ // Wait + Push to Queue
+ //History.debug('History.forward: we must wait', arguments);
+ History.pushQueue({
+ scope: History,
+ callback: History.forward,
+ args: arguments,
+ queue: queue
+ });
+ return false;
+ }
+
+ // Make Busy + Continue
+ History.busy(true);
+
+ // Fix certain browser bugs that prevent the state from changing
+ History.doubleCheck(function () {
+ History.forward(false);
+ });
+
+ // Go forward
+ history.go(1);
+
+ // End forward closure
+ return true;
+ };
+
+ /**
+ * History.go(index,queue)
+ * Send the browser history back or forward index times
+ * @param {Integer} queue [optional]
+ */
+ History.go = function (index, queue) {
+ //History.debug('History.go: called', arguments);
+
+ // Prepare
+ var i;
+
+ // Handle
+ if (index > 0) {
+ // Forward
+ for (i = 1; i <= index; ++i) {
+ History.forward(queue);
+ }
+ }
+ else if (index < 0) {
+ // Backward
+ for (i = -1; i >= index; --i) {
+ History.back(queue);
+ }
+ }
+ else {
+ throw new Error('History.go: History.go requires a positive or negative integer passed.');
+ }
+
+ // Chain
+ return History;
+ };
+
+
+ // ====================================================================
+ // HTML5 State Support
+
+ // Non-Native pushState Implementation
+ if (History.emulated.pushState) {
+ /*
+ * Provide Skeleton for HTML4 Browsers
+ */
+
+ // Prepare
+ var emptyFunction = function () {};
+ History.pushState = History.pushState || emptyFunction;
+ History.replaceState = History.replaceState || emptyFunction;
+ } // History.emulated.pushState
+
+ // Native pushState Implementation
+ else {
+ /*
+ * Use native HTML5 History API Implementation
+ */
+
+ /**
+ * History.onPopState(event,extra)
+ * Refresh the Current State
+ */
+ History.onPopState = function (event, extra) {
+ // Prepare
+ var stateId = false, newState = false, currentHash, currentState;
+
+ // Reset the double check
+ History.doubleCheckComplete();
+
+ // Check for a Hash, and handle apporiatly
+ currentHash = History.getHash();
+ if (currentHash) {
+ // Expand Hash
+ currentState = History.extractState(currentHash || History.getLocationHref(), true);
+ if (currentState) {
+ // We were able to parse it, it must be a State!
+ // Let's forward to replaceState
+ //History.debug('History.onPopState: state anchor', currentHash, currentState);
+ History.replaceState(currentState.data, currentState.title, currentState.url, false);
+ }
+ else {
+ // Traditional Anchor
+ //History.debug('History.onPopState: traditional anchor', currentHash);
+ History.Adapter.trigger(window, 'anchorchange');
+ History.busy(false);
+ }
+
+ // We don't care for hashes
+ History.expectedStateId = false;
+ return false;
+ }
+
+ // Ensure
+ stateId = History.Adapter.extractEventData('state', event, extra) || false;
+
+ // Fetch State
+ if (stateId) {
+ // Vanilla: Back/forward button was used
+ newState = History.getStateById(stateId);
+ }
+ else if (History.expectedStateId) {
+ // Vanilla: A new state was pushed, and popstate was called manually
+ newState = History.getStateById(History.expectedStateId);
+ }
+ else {
+ // Initial State
+ newState = History.extractState(History.getLocationHref());
+ }
+
+ // The State did not exist in our store
+ if (!newState) {
+ // Regenerate the State
+ newState = History.createStateObject(null, null, History.getLocationHref());
+ }
+
+ // Clean
+ History.expectedStateId = false;
+
+ // Check if we are the same state
+ if (History.isLastSavedState(newState)) {
+ // There has been no change (just the page's hash has finally propagated)
+ //History.debug('History.onPopState: no change', newState, History.savedStates);
+ History.busy(false);
+ return false;
+ }
+
+ // Store the State
+ History.storeState(newState);
+ History.saveState(newState);
+
+ // Force update of the title
+ History.setTitle(newState);
+
+ // Fire Our Event
+ History.Adapter.trigger(window, 'statechange');
+ History.busy(false);
+
+ // Return true
+ return true;
+ };
+ History.Adapter.bind(window, 'popstate', History.onPopState);
+
+ /**
+ * History.pushState(data,title,url)
+ * Add a new State to the history object, become it, and trigger onpopstate
+ * We have to trigger for HTML4 compatibility
+ * @param {object} data
+ * @param {string} title
+ * @param {string} url
+ * @return {true}
+ */
+ History.pushState = function (data, title, url, queue) {
+ //History.debug('History.pushState: called', arguments);
+
+ // Check the State
+ if (History.getHashByUrl(url) && History.emulated.pushState) {
+ throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
+ }
+
+ // Handle Queueing
+ if (queue !== false && History.busy()) {
+ // Wait + Push to Queue
+ //History.debug('History.pushState: we must wait', arguments);
+ History.pushQueue({
+ scope: History,
+ callback: History.pushState,
+ args: arguments,
+ queue: queue
+ });
+ return false;
+ }
+
+ // Make Busy + Continue
+ History.busy(true);
+
+ // Create the newState
+ var newState = History.createStateObject(data, title, url);
+
+ // Check it
+ if (History.isLastSavedState(newState)) {
+ // Won't be a change
+ History.busy(false);
+ }
+ else {
+ // Store the newState
+ History.storeState(newState);
+ History.expectedStateId = newState.id;
+
+ // Push the newState
+ history.pushState(newState.id, newState.title, newState.url);
+
+ // Fire HTML5 Event
+ History.Adapter.trigger(window, 'popstate');
+ }
+
+ // End pushState closure
+ return true;
+ };
+
+ /**
+ * History.replaceState(data,title,url)
+ * Replace the State and trigger onpopstate
+ * We have to trigger for HTML4 compatibility
+ * @param {object} data
+ * @param {string} title
+ * @param {string} url
+ * @return {true}
+ */
+ History.replaceState = function (data, title, url, queue) {
+ //History.debug('History.replaceState: called', arguments);
+
+ // Check the State
+ if (History.getHashByUrl(url) && History.emulated.pushState) {
+ throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
+ }
+
+ // Handle Queueing
+ if (queue !== false && History.busy()) {
+ // Wait + Push to Queue
+ //History.debug('History.replaceState: we must wait', arguments);
+ History.pushQueue({
+ scope: History,
+ callback: History.replaceState,
+ args: arguments,
+ queue: queue
+ });
+ return false;
+ }
+
+ // Make Busy + Continue
+ History.busy(true);
+
+ // Create the newState
+ var newState = History.createStateObject(data, title, url);
+
+ // Check it
+ if (History.isLastSavedState(newState)) {
+ // Won't be a change
+ History.busy(false);
+ }
+ else {
+ // Store the newState
+ History.storeState(newState);
+ History.expectedStateId = newState.id;
+
+ // Push the newState
+ history.replaceState(newState.id, newState.title, newState.url);
+
+ // Fire HTML5 Event
+ History.Adapter.trigger(window, 'popstate');
+ }
+
+ // End replaceState closure
+ return true;
+ };
+
+ } // !History.emulated.pushState
+
+
+ // ====================================================================
+ // Initialise
+
+ /**
+ * Load the Store
+ */
+ if (sessionStorage) {
+ // Fetch
+ try {
+ History.store = JSON.parse(sessionStorage.getItem('History.store')) || {};
+ }
+ catch (err) {
+ History.store = {};
+ }
+
+ // Normalize
+ History.normalizeStore();
+ }
+ else {
+ // Default Load
+ History.store = {};
+ History.normalizeStore();
+ }
+
+ /**
+ * Clear Intervals on exit to prevent memory leaks
+ */
+ History.Adapter.bind(window, "unload", History.clearAllIntervals);
+
+ /**
+ * Create the initial State
+ */
+ History.saveState(History.storeState(History.extractState(History.getLocationHref(), true)));
+
+ /**
+ * Bind for Saving Store
+ */
+ if (sessionStorage) {
+ // When the page is closed
+ History.onUnload = function () {
+ // Prepare
+ var currentStore, item, currentStoreString;
+
+ // Fetch
+ try {
+ currentStore = JSON.parse(sessionStorage.getItem('History.store')) || {};
+ }
+ catch (err) {
+ currentStore = {};
+ }
+
+ // Ensure
+ currentStore.idToState = currentStore.idToState || {};
+ currentStore.urlToId = currentStore.urlToId || {};
+ currentStore.stateToId = currentStore.stateToId || {};
+
+ // Sync
+ for (item in History.idToState) {
+ if (!History.idToState.hasOwnProperty(item)) {
+ continue;
+ }
+ currentStore.idToState[item] = History.idToState[item];
+ }
+ for (item in History.urlToId) {
+ if (!History.urlToId.hasOwnProperty(item)) {
+ continue;
+ }
+ currentStore.urlToId[item] = History.urlToId[item];
+ }
+ for (item in History.stateToId) {
+ if (!History.stateToId.hasOwnProperty(item)) {
+ continue;
+ }
+ currentStore.stateToId[item] = History.stateToId[item];
+ }
+
+ // Update
+ History.store = currentStore;
+ History.normalizeStore();
+
+ // In Safari, going into Private Browsing mode causes the
+ // Session Storage object to still exist but if you try and use
+ // or set any property/function of it it throws the exception
+ // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to
+ // add something to storage that exceeded the quota." infinitely
+ // every second.
+ currentStoreString = JSON.stringify(currentStore);
+ try {
+ // Store
+ sessionStorage.setItem('History.store', currentStoreString);
+ }
+ catch (e) {
+ if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {
+ if (sessionStorage.length) {
+ // Workaround for a bug seen on iPads. Sometimes the quota exceeded error comes up and simply
+ // removing/resetting the storage can work.
+ sessionStorage.removeItem('History.store');
+ sessionStorage.setItem('History.store', currentStoreString);
+ } else {
+ // Otherwise, we're probably private browsing in Safari, so we'll ignore the exception.
+ }
+ } else {
+ throw e;
+ }
+ }
+ };
+
+ // For Internet Explorer
+ History.isInternetExplorer() && History.intervalList.push(setInterval(History.onUnload, History.options.storeInterval));
+
+ // For Other Browsers
+ History.Adapter.bind(window, 'beforeunload', History.onUnload);
+ History.Adapter.bind(window, 'unload', History.onUnload);
+
+ // Both are enabled for consistency
+ }
+
+ // Non-Native pushState Implementation
+ if (!History.emulated.pushState) {
+ // Be aware, the following is only for native pushState implementations
+ // If you are wanting to include something for all browsers
+ // Then include it above this if block
+
+ /**
+ * Setup Safari Fix
+ */
+ if (History.bugs.safariPoll) {
+ History.intervalList.push(setInterval(History.safariStatePoll, History.options.safariPollInterval));
+ }
+
+ /**
+ * Ensure Cross Browser Compatibility
+ */
+ if (navigator.vendor === 'Apple Computer, Inc.' || (navigator.appCodeName || '') === 'Mozilla') {
+ /**
+ * Fix Safari HashChange Issue
+ */
+
+ // Setup Alias
+ History.Adapter.bind(window, 'hashchange', function () {
+ History.Adapter.trigger(window, 'popstate');
+ });
+
+ // Initialise Alias
+ if (History.getHash()) {
+ History.Adapter.onDomLoad(function () {
+ History.Adapter.trigger(window, 'hashchange');
+ });
+ }
+ }
+
+ } // !History.emulated.pushState
+
+
+ }; // History.initCore
+
+ // Try to Initialise History
+ if (!History.options || !History.options.delayInit) {
+ History.init();
+ }
+}
+
+module.exports = History;
+},{"./history-adapter":74}],76:[function(require,module,exports){
+(function() {
+ var lastTime = 0;
+ var vendors = ['ms', 'moz', 'webkit', 'o'];
+ for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
+ window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
+ window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
+ || window[vendors[x]+'CancelRequestAnimationFrame'];
+ }
+
+ if (!window.requestAnimationFrame)
+ window.requestAnimationFrame = function(callback, element) {
+ var currTime = new Date().getTime();
+ var timeToCall = Math.max(0, 16 - (currTime - lastTime));
+ var id = window.setTimeout(function() { callback(currTime + timeToCall); },
+ timeToCall);
+ lastTime = currTime + timeToCall;
+ return id;
+ };
+
+ if (!window.cancelAnimationFrame)
+ window.cancelAnimationFrame = function(id) {
+ clearTimeout(id);
+ };
+}());
+
+module.exports = {};
+},{}],77:[function(require,module,exports){
+var prime = require('prime'),
+ deepClone = require('mout/lang/deepClone');
+
+//var objectDiff = require('objectdiff');
+
+var SaveState = new prime({
+
+ constructor: function(session) {
+ session = deepClone(session);
+ this.setSession(session);
+ },
+
+ setSession: function(session) {
+ session = !session ? {}
+ : {
+ time: +(new Date()),
+ data: deepClone(session)
+ };
+
+ this.session = session;
+ return this.session;
+ },
+
+ getTime: function() {
+ return this.session.time;
+ },
+
+ getData: function() {
+ return this.session.data;
+ },
+
+ getSession: function() {
+ return this.session;
+ },
+
+ getDiff: function(data) {
+ // Unsupported at this state
+ return data;
+ /*
+ var diff = objectDiff.diff(this.getData(), data);
+ return {
+ diff: diff,
+ xml: objectDiff.convertToXMLString(diff)
+ };
+ */
+ }
+});
+
+module.exports = SaveState;
+
+},{"mout/lang/deepClone":200,"prime":301}],78:[function(require,module,exports){
+(function (global){(function (){
+"use strict";
+
+var replace = require('mout/string/replace');
+
+module.exports = function(key, replacement) {
+ var G5T = global.G5T || function(key) { return key; };
+ return replace(G5T(key), '%s', replacement || '');
+};
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"mout/string/replace":267}],79:[function(require,module,exports){
+var $ = require('elements');
+
+module.exports = function(field) {
+ if (!field) { return false; }
+
+ if (($('body').hasClass('wp-customizer') || $('body').hasClass('widgets-php')) && jQuery) {
+ var widgetContainer = field.parent('.widget-content'),
+ title = field.siblings('.g-instancepicker-title');
+
+ if (widgetContainer) {
+ var jQueryEvent = jQuery.Event('change');
+ jQueryEvent.target = field[0];
+ jQuery(widgetContainer[0]).trigger(jQueryEvent);
+ }
+
+ if (title) {
+ setTimeout(function(){
+ title.hideIndicator();
+ }, 5);
+ }
+ }
+};
+},{"elements":113}],80:[function(require,module,exports){
+/*
+Agent
+- heavily inspired by superagent by visionmedia https://github.com/visionmedia/superagent, released under the MIT license
+- code derived from MooTools 1.4 Request.js && superagent
+- MIT-License
+*/"use strict";
+/* global ActiveXObject */
+
+var prime = require("prime"),
+ Emitter = require("prime/emitter")
+
+var isObject = require("mout/lang/isObject"),
+ isString = require("mout/lang/isString"),
+ isArray = require("mout/lang/isArray"),
+ isFunction = require("mout/lang/isFunction"),
+ trim = require("mout/string/trim"),
+ upperCase = require("mout/string/upperCase"),
+ forIn = require("mout/object/forIn"),
+ mixIn = require("mout/object/mixIn"),
+ remove = require("mout/array/remove"),
+ forEach = require("mout/array/forEach")
+
+var capitalize = function(str){
+ return str.replace(/\b[a-z]/g, upperCase)
+}
+
+// MooTools
+
+var getRequest = (function(){
+
+ var XMLHTTP = function(){
+ return new XMLHttpRequest()
+ }, MSXML2 = function(){
+ return new ActiveXObject("MSXML2.XMLHTTP")
+ }, MSXML = function(){
+ return new ActiveXObject("Microsoft.XMLHTTP")
+ }
+
+ try {
+ XMLHTTP()
+ return XMLHTTP
+ } catch(e){}
+ try {
+ MSXML2()
+ return MSXML2
+ } catch(e){}
+ try {
+ MSXML()
+ return MSXML
+ } catch(e){}
+
+ return null
+
+})()
+
+var encodeJSON = function(object){
+ if (object == null) return ""
+ if (object.toJSON) return object.toJSON()
+ return JSON.stringify(object)
+}
+
+// MooTools
+
+var encodeQueryString = function(object, base){
+
+ if (object == null) return ""
+ if (object.toQueryString) return object.toQueryString()
+
+ var queryString = []
+
+ forIn(object, function(value, key){
+ if (base) key = base + "[" + key + "]"
+ var result
+
+ if (value == null) return
+
+ if (isArray(value)){
+ var qs = {}
+ for (var i = 0; i < value.length; i++) qs[i] = value[i]
+ result = encodeQueryString(qs, key)
+ } else if (isObject(value)){
+ result = encodeQueryString(value, key)
+ } else {
+ result = key + "=" + encodeURIComponent(value)
+ }
+
+ queryString.push(result)
+ })
+
+ return queryString.join("&")
+
+}
+
+var decodeJSON = JSON.parse
+
+// decodeQueryString by Brian Donovan
+// http://stackoverflow.com/users/549363/brian-donovan
+
+var decodeQueryString = function(params){
+
+ var pairs = params.split('&'),
+ result = {}
+
+ for (var i = 0; i < pairs.length; i++){
+
+ var pair = pairs[i].split('='),
+ key = decodeURIComponent(pair[0]),
+ value = decodeURIComponent(pair[1]),
+ isArray = /\[\]$/.test(key),
+ dictMatch = key.match(/^(.+)\[([^\]]+)\]$/)
+
+ if (dictMatch){
+ key = dictMatch[1]
+ var subkey = dictMatch[2]
+
+ result[key] = result[key] || {}
+ result[key][subkey] = value
+ } else if (isArray){
+ key = key.substring(0, key.length - 2)
+ result[key] = result[key] || []
+ result[key].push(value)
+ } else {
+ result[key] = value
+ }
+
+ }
+
+ return result
+
+}
+
+var encoders = {
+ "application/json" : encodeJSON,
+ "application/x-www-form-urlencoded" : encodeQueryString
+}
+
+var decoders = {
+ "application/json": decodeJSON,
+ "application/x-www-form-urlencoded": decodeQueryString
+}
+
+// parseHeader from superagent
+// https://github.com/visionmedia/superagent
+// MIT
+
+var parseHeader = function(str){
+ var lines = str.split(/\r?\n/), fields = {}
+
+ lines.pop() // trailing CRLF
+
+ for (var i = 0, l = lines.length; i < l; ++i){
+ var line = lines[i],
+ index = line.indexOf(':'),
+ field = capitalize(line.slice(0, index)),
+ value = trim(line.slice(index + 1))
+
+ fields[field] = value
+ }
+
+ return fields
+}
+
+var REQUESTS = 0, Q = [] // Queue stuff
+
+var Request = prime({
+
+ constructor: function Request(){
+ this._header = {
+ "Content-Type": "application/x-www-form-urlencoded"
+ }
+ },
+
+ header: function(name, value){
+ if (isObject(name)) for (var key in name) this.header(key, name[key])
+ else if (!arguments.length) return this._header
+ else if (arguments.length === 1) return this._header[capitalize(name)]
+ else if (arguments.length === 2){
+ if (value == null) delete this._header[capitalize(name)]
+ else this._header[capitalize(name)] = value
+ }
+ return this
+ },
+
+ running: function(){
+ return !!this._running
+ },
+
+ abort: function(){
+
+ if (this._queued){
+ remove(Q, this._queued)
+ delete this._queued
+ }
+
+ if (this._xhr){
+ this._xhr.abort()
+ this._end()
+ }
+
+ return this
+ },
+
+ method: function(m){
+ if (!arguments.length) return this._method
+ this._method = m.toUpperCase()
+ return this
+ },
+
+ data: function(d){
+ if (!arguments.length) return this._data
+ this._data = d
+ return this
+ },
+
+ url: function(u){
+ if (!arguments.length) return this._url
+ this._url = u
+ return this
+ },
+
+ user: function(u){
+ if (!arguments.length) return this._user
+ this._user = u
+ return this
+ },
+
+ password: function(p){
+ if (!arguments.length) return this._password
+ this._password = p
+ return this
+ },
+
+ _send: function(method, url, data, header, user, password, callback){
+ var self = this
+
+ if (REQUESTS === agent.MAX_REQUESTS) return Q.unshift(this._queued = function(){
+ delete self._queued
+ self._send(method, url, data, header, user, password, callback)
+ })
+
+ REQUESTS++
+
+ var xhr = this._xhr = agent.getRequest()
+
+ if (xhr.addEventListener) forEach(['progress', 'load', 'error' , 'abort', 'loadend'], function(method){
+ xhr.addEventListener(method, function(event){
+ self.emit(method, event)
+ }, false)
+ })
+
+ xhr.open(method, url, true, user, password)
+ if (user != null && "withCredentials" in xhr) xhr.withCredentials = true
+
+ xhr.onreadystatechange = function(){
+ if (xhr.readyState === 4){
+ var status = xhr.status
+ var response = new Response(xhr.responseText, status, parseHeader(xhr.getAllResponseHeaders()))
+ var error = response.error ? new Error(method + " " + url + " " + status) : null
+ self._end()
+ callback(error, response)
+ }
+ }
+
+ for (var field in header) xhr.setRequestHeader(field, header[field])
+ xhr.send(data || null)
+ },
+
+ _end: function(){
+ this._xhr.onreadystatechange = function(){}
+
+ delete this._xhr
+ delete this._running
+
+ REQUESTS--
+
+ var queued = Q.pop()
+ if (queued) queued()
+ },
+
+ send: function(callback){
+ if (this._running) this.abort()
+ this._running = true
+
+ if (!callback) callback = function(){}
+
+ var method = this._method || "POST",
+ data = this._data || null,
+ url = this._url,
+ user = this._user || null,
+ password = this._password || null
+
+ if (data && !isString(data)){
+ var contentType = this._header['Content-Type'].split(/ *; */).shift(),
+ encode = encoders[contentType]
+ if (encode) data = encode(data)
+ }
+
+ if (/GET|HEAD/.test(method) && data) url += (url.indexOf("?") > -1 ? "&" : "?") + data
+
+ var header = mixIn({}, this._header);
+
+ this._send(method, url, data, header, user, password, callback)
+
+ return this
+
+ }
+
+})
+
+Request.implement(new Emitter)
+
+var Response = prime({
+
+ constructor: function Response(text, status, header){
+
+ this.text = text
+ this.status = status
+
+ this.header = header
+
+ // statuses from superagent
+ // https://github.com/visionmedia/superagent
+ // MIT
+
+ var t = status / 100 | 0
+
+ this.info = t === 1
+ this.ok = t === 2
+ this.clientError = t === 4
+ this.serverError = t === 5
+ this.error = t === 4 || t === 5
+ var length = '' + header['Content-Length']
+
+ // sugar
+ this.accepted = status === 202
+ this.noContent = length === '0' || status === 204 || status === 1223
+ this.badRequest = status === 400
+ this.unauthorized = status === 401
+ this.notAcceptable = status === 406
+ this.notFound = status === 404
+
+ var contentType = header['Content-Type'] ? header['Content-Type'].split(/ *; */).shift() : '',
+ decode
+
+ if (!this.noContent) decode = decoders[contentType]
+
+ this.body = decode ? decode(this.text) : this.text
+
+ }
+
+})
+
+var methods = "get|post|put|delete|head|patch|options",
+ rMethods = new RegExp("^(" + methods + ")$", "i")
+
+var agent = function(method, url, data, callback){
+ var request = new Request()
+
+ if (!arguments.length) return request
+
+ if (!rMethods.test(method)){ // shift
+ callback = data
+ data = url
+ url = method
+ method = "post"
+ }
+
+ if (isFunction(data)){
+ callback = data
+ data = null
+ }
+
+ request.method(method)
+
+ if (url) request.url(url)
+ if (data) request.data(data)
+ if (callback) request.send(callback)
+
+ return request
+}
+
+agent.encoder = function(ct, encode){
+ if (arguments.length === 1) return encoders[ct]
+ encoders[ct] = encode
+ return agent
+}
+
+agent.decoder = function(ct, decode){
+ if (arguments.length === 1) return decoders[ct]
+ decoders[ct] = decode
+ return agent
+}
+
+forEach(methods.split("|"), function(method){
+ agent[method] = function(url, data, callback){
+ return agent(method, url, data, callback)
+ }
+})
+
+agent.MAX_REQUESTS = Infinity
+agent.getRequest = getRequest
+agent.Request = Request
+agent.Response = Response
+
+module.exports = agent
+
+},{"mout/array/forEach":81,"mout/array/remove":83,"mout/lang/isArray":85,"mout/lang/isFunction":86,"mout/lang/isObject":88,"mout/lang/isString":89,"mout/object/forIn":92,"mout/object/mixIn":95,"mout/string/trim":99,"mout/string/upperCase":100,"prime":104,"prime/emitter":103}],81:[function(require,module,exports){
+
+
+ /**
+ * Array forEach
+ */
+ function forEach(arr, callback, thisObj) {
+ if (arr == null) {
+ return;
+ }
+ var i = -1,
+ len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback.call(thisObj, arr[i], i, arr) === false ) {
+ break;
+ }
+ }
+ }
+
+ module.exports = forEach;
+
+
+
+},{}],82:[function(require,module,exports){
+
+
+ /**
+ * Array.indexOf
+ */
+ function indexOf(arr, item, fromIndex) {
+ fromIndex = fromIndex || 0;
+ if (arr == null) {
+ return -1;
+ }
+
+ var len = arr.length,
+ i = fromIndex < 0 ? len + fromIndex : fromIndex;
+ while (i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (arr[i] === item) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ module.exports = indexOf;
+
+
+},{}],83:[function(require,module,exports){
+var indexOf = require('./indexOf');
+
+ /**
+ * Remove a single item from the array.
+ * (it won't remove duplicates, just a single item)
+ */
+ function remove(arr, item){
+ var idx = indexOf(arr, item);
+ if (idx !== -1) arr.splice(idx, 1);
+ }
+
+ module.exports = remove;
+
+
+},{"./indexOf":82}],84:[function(require,module,exports){
+var mixIn = require('../object/mixIn');
+
+ /**
+ * Create Object using prototypal inheritance and setting custom properties.
+ * - Mix between Douglas Crockford Prototypal Inheritance and the EcmaScript 5 `Object.create()` method.
+ * @param {object} parent Parent Object.
+ * @param {object} [props] Object properties.
+ * @return {object} Created object.
+ */
+ function createObject(parent, props){
+ function F(){}
+ F.prototype = parent;
+ return mixIn(new F(), props);
+
+ }
+ module.exports = createObject;
+
+
+
+},{"../object/mixIn":95}],85:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ var isArray = Array.isArray || function (val) {
+ return isKind(val, 'Array');
+ };
+ module.exports = isArray;
+
+
+},{"./isKind":87}],86:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isFunction(val) {
+ return isKind(val, 'Function');
+ }
+ module.exports = isFunction;
+
+
+},{"./isKind":87}],87:[function(require,module,exports){
+var kindOf = require('./kindOf');
+ /**
+ * Check if value is from a specific "kind".
+ */
+ function isKind(val, kind){
+ return kindOf(val) === kind;
+ }
+ module.exports = isKind;
+
+
+},{"./kindOf":90}],88:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isObject(val) {
+ return isKind(val, 'Object');
+ }
+ module.exports = isObject;
+
+
+},{"./isKind":87}],89:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isString(val) {
+ return isKind(val, 'String');
+ }
+ module.exports = isString;
+
+
+},{"./isKind":87}],90:[function(require,module,exports){
+
+
+ var _rKind = /^\[object (.*)\]$/,
+ _toString = Object.prototype.toString,
+ UNDEF;
+
+ /**
+ * Gets the "kind" of value. (e.g. "String", "Number", etc)
+ */
+ function kindOf(val) {
+ if (val === null) {
+ return 'Null';
+ } else if (val === UNDEF) {
+ return 'Undefined';
+ } else {
+ return _rKind.exec( _toString.call(val) )[1];
+ }
+ }
+ module.exports = kindOf;
+
+
+},{}],91:[function(require,module,exports){
+
+
+ /**
+ * Typecast a value to a String, using an empty string value for null or
+ * undefined.
+ */
+ function toString(val){
+ return val == null ? '' : val.toString();
+ }
+
+ module.exports = toString;
+
+
+
+},{}],92:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+
+ var _hasDontEnumBug,
+ _dontEnums;
+
+ function checkDontEnum(){
+ _dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ];
+
+ _hasDontEnumBug = true;
+
+ for (var key in {'toString': null}) {
+ _hasDontEnumBug = false;
+ }
+ }
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forIn(obj, fn, thisObj){
+ var key, i = 0;
+ // no need to check if argument is a real object that way we can use
+ // it for arrays, functions, date, etc.
+
+ //post-pone check till needed
+ if (_hasDontEnumBug == null) checkDontEnum();
+
+ for (key in obj) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+
+
+ if (_hasDontEnumBug) {
+ var ctor = obj.constructor,
+ isProto = !!ctor && obj === ctor.prototype;
+
+ while (key = _dontEnums[i++]) {
+ // For constructor, if it is a prototype object the constructor
+ // is always non-enumerable unless defined otherwise (and
+ // enumerated above). For non-prototype objects, it will have
+ // to be defined on this object, since it cannot be defined on
+ // any prototype objects.
+ //
+ // For other [[DontEnum]] properties, check if the value is
+ // different than Object prototype value.
+ if (
+ (key !== 'constructor' ||
+ (!isProto && hasOwn(obj, key))) &&
+ obj[key] !== Object.prototype[key]
+ ) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ function exec(fn, obj, key, thisObj){
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+
+ module.exports = forIn;
+
+
+
+},{"./hasOwn":94}],93:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var forIn = require('./forIn');
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forOwn(obj, fn, thisObj){
+ forIn(obj, function(val, key){
+ if (hasOwn(obj, key)) {
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+ });
+ }
+
+ module.exports = forOwn;
+
+
+
+},{"./forIn":92,"./hasOwn":94}],94:[function(require,module,exports){
+
+
+ /**
+ * Safer Object.hasOwnProperty
+ */
+ function hasOwn(obj, prop){
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ module.exports = hasOwn;
+
+
+
+},{}],95:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Combine properties from all the objects into first one.
+ * - This method affects target object in place, if you want to create a new Object pass an empty object as first param.
+ * @param {object} target Target Object
+ * @param {...object} objects Objects to be combined (0...n objects).
+ * @return {object} Target Object.
+ */
+ function mixIn(target, objects){
+ var i = 0,
+ n = arguments.length,
+ obj;
+ while(++i < n){
+ obj = arguments[i];
+ if (obj != null) {
+ forOwn(obj, copyProp, target);
+ }
+ }
+ return target;
+ }
+
+ function copyProp(val, key){
+ this[key] = val;
+ }
+
+ module.exports = mixIn;
+
+
+},{"./forOwn":93}],96:[function(require,module,exports){
+
+ /**
+ * Contains all Unicode white-spaces. Taken from
+ * http://en.wikipedia.org/wiki/Whitespace_character.
+ */
+ module.exports = [
+ ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E',
+ '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
+ '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
+ '\u205F', '\u3000'
+ ];
+
+
+},{}],97:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from beginning of string.
+ */
+ function ltrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var start = 0,
+ len = str.length,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && start < len) {
+ found = false;
+ i = -1;
+ c = str.charAt(start);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ start++;
+ break;
+ }
+ }
+ }
+
+ return (start >= len) ? '' : str.substr(start, len);
+ }
+
+ module.exports = ltrim;
+
+
+},{"../lang/toString":91,"./WHITE_SPACES":96}],98:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from end of string.
+ */
+ function rtrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var end = str.length - 1,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && end >= 0) {
+ found = false;
+ i = -1;
+ c = str.charAt(end);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ end--;
+ break;
+ }
+ }
+ }
+
+ return (end >= 0) ? str.substring(0, end + 1) : '';
+ }
+
+ module.exports = rtrim;
+
+
+},{"../lang/toString":91,"./WHITE_SPACES":96}],99:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+var ltrim = require('./ltrim');
+var rtrim = require('./rtrim');
+ /**
+ * Remove white-spaces from beginning and end of string.
+ */
+ function trim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+ return ltrim(rtrim(str, chars), chars);
+ }
+
+ module.exports = trim;
+
+
+},{"../lang/toString":91,"./WHITE_SPACES":96,"./ltrim":97,"./rtrim":98}],100:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * "Safer" String.toUpperCase()
+ */
+ function upperCase(str){
+ str = toString(str);
+ return str.toUpperCase();
+ }
+ module.exports = upperCase;
+
+
+},{"../lang/toString":91}],101:[function(require,module,exports){
+
+
+ /**
+ * Get current time in miliseconds
+ */
+ function now(){
+ // yes, we defer the work to another function to allow mocking it
+ // during the tests
+ return now.get();
+ }
+
+ now.get = (typeof Date.now === 'function')? Date.now : function(){
+ return +(new Date());
+ };
+
+ module.exports = now;
+
+
+
+},{}],102:[function(require,module,exports){
+(function (process,global,setImmediate){(function (){
+/*
+defer
+*/"use strict"
+
+var kindOf = require("mout/lang/kindOf"),
+ now = require("mout/time/now"),
+ forEach = require("mout/array/forEach"),
+ indexOf = require("mout/array/indexOf")
+
+var callbacks = {
+ timeout: {},
+ frame: [],
+ immediate: []
+}
+
+var push = function(collection, callback, context, defer){
+
+ var iterator = function(){
+ iterate(collection)
+ }
+
+ if (!collection.length) defer(iterator)
+
+ var entry = {
+ callback: callback,
+ context: context
+ }
+
+ collection.push(entry)
+
+ return function(){
+ var io = indexOf(collection, entry)
+ if (io > -1) collection.splice(io, 1)
+ }
+}
+
+var iterate = function(collection){
+ var time = now()
+
+ forEach(collection.splice(0), function(entry) {
+ entry.callback.call(entry.context, time)
+ })
+}
+
+var defer = function(callback, argument, context){
+ return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument)
+}
+
+if (global.process && process.nextTick){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, process.nextTick)
+ }
+
+} else if (global.setImmediate){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, setImmediate)
+ }
+
+} else if (global.postMessage && global.addEventListener){
+
+ addEventListener("message", function(event){
+ if (event.source === global && event.data === "@deferred"){
+ event.stopPropagation()
+ iterate(callbacks.immediate)
+ }
+ }, true)
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(){
+ postMessage("@deferred", "*")
+ })
+ }
+
+} else {
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(iterator){
+ setTimeout(iterator, 0)
+ })
+ }
+
+}
+
+var requestAnimationFrame = global.requestAnimationFrame ||
+ global.webkitRequestAnimationFrame ||
+ global.mozRequestAnimationFrame ||
+ global.oRequestAnimationFrame ||
+ global.msRequestAnimationFrame ||
+ function(callback) {
+ setTimeout(callback, 1e3 / 60)
+ }
+
+defer.frame = function(callback, context){
+ return push(callbacks.frame, callback, context, requestAnimationFrame)
+}
+
+var clear
+
+defer.timeout = function(callback, ms, context){
+ var ct = callbacks.timeout
+
+ if (!clear) clear = defer.immediate(function(){
+ clear = null
+ callbacks.timeout = {}
+ })
+
+ return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){
+ setTimeout(iterator, ms)
+ })
+}
+
+module.exports = defer
+
+}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
+
+},{"_process":1,"mout/array/forEach":81,"mout/array/indexOf":82,"mout/lang/kindOf":90,"mout/time/now":101,"timers":2}],103:[function(require,module,exports){
+/*
+Emitter
+*/"use strict"
+
+var indexOf = require("mout/array/indexOf"),
+ forEach = require("mout/array/forEach")
+
+var prime = require("./index"),
+ defer = require("./defer")
+
+var slice = Array.prototype.slice;
+
+var Emitter = prime({
+
+ on: function(event, fn){
+ var listeners = this._listeners || (this._listeners = {}),
+ events = listeners[event] || (listeners[event] = [])
+
+ if (indexOf(events, fn) === -1) events.push(fn)
+
+ return this
+ },
+
+ off: function(event, fn){
+ var listeners = this._listeners, events, key, length = 0
+ if (listeners && (events = listeners[event])){
+
+ var io = indexOf(events, fn)
+ if (io > -1) events.splice(io, 1)
+ if (!events.length) delete listeners[event];
+ for (var l in listeners) return this
+ delete this._listeners
+ }
+ return this
+ },
+
+ emit: function(event){
+ var self = this,
+ args = slice.call(arguments, 1)
+
+ var emit = function(){
+ var listeners = self._listeners, events
+ if (listeners && (events = listeners[event])){
+ forEach(events.slice(0), function(event){
+ return event.apply(self, args)
+ })
+ }
+ }
+
+ if (args[args.length - 1] === Emitter.EMIT_SYNC){
+ args.pop()
+ emit()
+ } else {
+ defer(emit)
+ }
+
+ return this
+ }
+
+})
+
+Emitter.EMIT_SYNC = {}
+
+module.exports = Emitter
+
+},{"./defer":102,"./index":104,"mout/array/forEach":81,"mout/array/indexOf":82}],104:[function(require,module,exports){
+/*
+prime
+ - prototypal inheritance
+*/"use strict"
+
+var hasOwn = require("mout/object/hasOwn"),
+ mixIn = require("mout/object/mixIn"),
+ create = require("mout/lang/createObject"),
+ kindOf = require("mout/lang/kindOf")
+
+var hasDescriptors = true
+
+try {
+ Object.defineProperty({}, "~", {})
+ Object.getOwnPropertyDescriptor({}, "~")
+} catch (e){
+ hasDescriptors = false
+}
+
+// we only need to be able to implement "toString" and "valueOf" in IE < 9
+var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"),
+ buggy = ["toString", "valueOf"]
+
+var verbs = /^constructor|inherits|mixin$/
+
+var implement = function(proto){
+ var prototype = this.prototype
+
+ for (var key in proto){
+ if (key.match(verbs)) continue
+ if (hasDescriptors){
+ var descriptor = Object.getOwnPropertyDescriptor(proto, key)
+ if (descriptor){
+ Object.defineProperty(prototype, key, descriptor)
+ continue
+ }
+ }
+ prototype[key] = proto[key]
+ }
+
+ if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){
+ var value = proto[key]
+ if (value !== Object.prototype[key]) prototype[key] = value
+ }
+
+ return this
+}
+
+var prime = function(proto){
+
+ if (kindOf(proto) === "Function") proto = {constructor: proto}
+
+ var superprime = proto.inherits
+
+ // if our nice proto object has no own constructor property
+ // then we proceed using a ghosting constructor that all it does is
+ // call the parent's constructor if it has a superprime, else an empty constructor
+ // proto.constructor becomes the effective constructor
+ var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){
+ return superprime.apply(this, arguments)
+ } : function(){}
+
+ if (superprime){
+
+ mixIn(constructor, superprime)
+
+ var superproto = superprime.prototype
+ // inherit from superprime
+ var cproto = constructor.prototype = create(superproto)
+
+ // setting constructor.parent to superprime.prototype
+ // because it's the shortest possible absolute reference
+ constructor.parent = superproto
+ cproto.constructor = constructor
+ }
+
+ if (!constructor.implement) constructor.implement = implement
+
+ var mixins = proto.mixin
+ if (mixins){
+ if (kindOf(mixins) !== "Array") mixins = [mixins]
+ for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype))
+ }
+
+ // implement proto and return constructor
+ return constructor.implement(proto)
+
+}
+
+module.exports = prime
+
+},{"mout/lang/createObject":84,"mout/lang/kindOf":90,"mout/object/hasOwn":94,"mout/object/mixIn":95}],105:[function(require,module,exports){
+
+module.exports = function(x1, y1, x2, y2, epsilon){
+
+ var curveX = function(t){
+ var v = 1 - t;
+ return 3 * v * v * t * x1 + 3 * v * t * t * x2 + t * t * t;
+ };
+
+ var curveY = function(t){
+ var v = 1 - t;
+ return 3 * v * v * t * y1 + 3 * v * t * t * y2 + t * t * t;
+ };
+
+ var derivativeCurveX = function(t){
+ var v = 1 - t;
+ return 3 * (2 * (t - 1) * t + v * v) * x1 + 3 * (- t * t * t + 2 * v * t) * x2;
+ };
+
+ return function(t){
+
+ var x = t, t0, t1, t2, x2, d2, i;
+
+ // First try a few iterations of Newton's method -- normally very fast.
+ for (t2 = x, i = 0; i < 8; i++){
+ x2 = curveX(t2) - x;
+ if (Math.abs(x2) < epsilon) return curveY(t2);
+ d2 = derivativeCurveX(t2);
+ if (Math.abs(d2) < 1e-6) break;
+ t2 = t2 - x2 / d2;
+ }
+
+ t0 = 0, t1 = 1, t2 = x;
+
+ if (t2 < t0) return curveY(t0);
+ if (t2 > t1) return curveY(t1);
+
+ // Fallback to the bisection method for reliability.
+ while (t0 < t1){
+ x2 = curveX(t2);
+ if (Math.abs(x2 - x) < epsilon) return curveY(t2);
+ if (x > x2) t0 = t2;
+ else t1 = t2;
+ t2 = (t1 - t0) * .5 + t0;
+ }
+
+ // Failure
+ return curveY(t2);
+
+ };
+
+};
+
+},{}],106:[function(require,module,exports){
+;(function(root, factory) { // eslint-disable-line no-extra-semi
+ var deepDiff = factory(root);
+ // eslint-disable-next-line no-undef
+ if (typeof define === 'function' && define.amd) {
+ // AMD
+ define('DeepDiff', function() { // eslint-disable-line no-undef
+ return deepDiff;
+ });
+ } else if (typeof exports === 'object' || typeof navigator === 'object' && navigator.product.match(/ReactNative/i)) {
+ // Node.js or ReactNative
+ module.exports = deepDiff;
+ } else {
+ // Browser globals
+ var _deepdiff = root.DeepDiff;
+ deepDiff.noConflict = function() {
+ if (root.DeepDiff === deepDiff) {
+ root.DeepDiff = _deepdiff;
+ }
+ return deepDiff;
+ };
+ root.DeepDiff = deepDiff;
+ }
+}(this, function(root) {
+ var validKinds = ['N', 'E', 'A', 'D'];
+
+ // nodejs compatible on server side and in the browser.
+ function inherits(ctor, superCtor) {
+ ctor.super_ = superCtor;
+ ctor.prototype = Object.create(superCtor.prototype, {
+ constructor: {
+ value: ctor,
+ enumerable: false,
+ writable: true,
+ configurable: true
+ }
+ });
+ }
+
+ function Diff(kind, path) {
+ Object.defineProperty(this, 'kind', {
+ value: kind,
+ enumerable: true
+ });
+ if (path && path.length) {
+ Object.defineProperty(this, 'path', {
+ value: path,
+ enumerable: true
+ });
+ }
+ }
+
+ function DiffEdit(path, origin, value) {
+ DiffEdit.super_.call(this, 'E', path);
+ Object.defineProperty(this, 'lhs', {
+ value: origin,
+ enumerable: true
+ });
+ Object.defineProperty(this, 'rhs', {
+ value: value,
+ enumerable: true
+ });
+ }
+ inherits(DiffEdit, Diff);
+
+ function DiffNew(path, value) {
+ DiffNew.super_.call(this, 'N', path);
+ Object.defineProperty(this, 'rhs', {
+ value: value,
+ enumerable: true
+ });
+ }
+ inherits(DiffNew, Diff);
+
+ function DiffDeleted(path, value) {
+ DiffDeleted.super_.call(this, 'D', path);
+ Object.defineProperty(this, 'lhs', {
+ value: value,
+ enumerable: true
+ });
+ }
+ inherits(DiffDeleted, Diff);
+
+ function DiffArray(path, index, item) {
+ DiffArray.super_.call(this, 'A', path);
+ Object.defineProperty(this, 'index', {
+ value: index,
+ enumerable: true
+ });
+ Object.defineProperty(this, 'item', {
+ value: item,
+ enumerable: true
+ });
+ }
+ inherits(DiffArray, Diff);
+
+ function arrayRemove(arr, from, to) {
+ var rest = arr.slice((to || from) + 1 || arr.length);
+ arr.length = from < 0 ? arr.length + from : from;
+ arr.push.apply(arr, rest);
+ return arr;
+ }
+
+ function realTypeOf(subject) {
+ var type = typeof subject;
+ if (type !== 'object') {
+ return type;
+ }
+
+ if (subject === Math) {
+ return 'math';
+ } else if (subject === null) {
+ return 'null';
+ } else if (Array.isArray(subject)) {
+ return 'array';
+ } else if (Object.prototype.toString.call(subject) === '[object Date]') {
+ return 'date';
+ } else if (typeof subject.toString === 'function' && /^\/.*\//.test(subject.toString())) {
+ return 'regexp';
+ }
+ return 'object';
+ }
+
+ // http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
+ function hashThisString(string) {
+ var hash = 0;
+ if (string.length === 0) { return hash; }
+ for (var i = 0; i < string.length; i++) {
+ var char = string.charCodeAt(i);
+ hash = ((hash << 5) - hash) + char;
+ hash = hash & hash; // Convert to 32bit integer
+ }
+ return hash;
+ }
+
+ // Gets a hash of the given object in an array order-independent fashion
+ // also object key order independent (easier since they can be alphabetized)
+ function getOrderIndependentHash(object) {
+ var accum = 0;
+ var type = realTypeOf(object);
+
+ if (type === 'array') {
+ object.forEach(function (item) {
+ // Addition is commutative so this is order indep
+ accum += getOrderIndependentHash(item);
+ });
+
+ var arrayString = '[type: array, hash: ' + accum + ']';
+ return accum + hashThisString(arrayString);
+ }
+
+ if (type === 'object') {
+ for (var key in object) {
+ if (object.hasOwnProperty(key)) {
+ var keyValueString = '[ type: object, key: ' + key + ', value hash: ' + getOrderIndependentHash(object[key]) + ']';
+ accum += hashThisString(keyValueString);
+ }
+ }
+
+ return accum;
+ }
+
+ // Non object, non array...should be good?
+ var stringToHash = '[ type: ' + type + ' ; value: ' + object + ']';
+ return accum + hashThisString(stringToHash);
+ }
+
+ function deepDiff(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
+ changes = changes || [];
+ path = path || [];
+ stack = stack || [];
+ var currentPath = path.slice(0);
+ if (typeof key !== 'undefined' && key !== null) {
+ if (prefilter) {
+ if (typeof (prefilter) === 'function' && prefilter(currentPath, key)) {
+ return;
+ } else if (typeof (prefilter) === 'object') {
+ if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
+ return;
+ }
+ if (prefilter.normalize) {
+ var alt = prefilter.normalize(currentPath, key, lhs, rhs);
+ if (alt) {
+ lhs = alt[0];
+ rhs = alt[1];
+ }
+ }
+ }
+ }
+ currentPath.push(key);
+ }
+
+ // Use string comparison for regexes
+ if (realTypeOf(lhs) === 'regexp' && realTypeOf(rhs) === 'regexp') {
+ lhs = lhs.toString();
+ rhs = rhs.toString();
+ }
+
+ var ltype = typeof lhs;
+ var rtype = typeof rhs;
+ var i, j, k, other;
+
+ var ldefined = ltype !== 'undefined' ||
+ (stack && (stack.length > 0) && stack[stack.length - 1].lhs &&
+ Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key));
+ var rdefined = rtype !== 'undefined' ||
+ (stack && (stack.length > 0) && stack[stack.length - 1].rhs &&
+ Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key));
+
+ if (!ldefined && rdefined) {
+ changes.push(new DiffNew(currentPath, rhs));
+ } else if (!rdefined && ldefined) {
+ changes.push(new DiffDeleted(currentPath, lhs));
+ } else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
+ changes.push(new DiffEdit(currentPath, lhs, rhs));
+ } else if (realTypeOf(lhs) === 'date' && (lhs - rhs) !== 0) {
+ changes.push(new DiffEdit(currentPath, lhs, rhs));
+ } else if (ltype === 'object' && lhs !== null && rhs !== null) {
+ for (i = stack.length - 1; i > -1; --i) {
+ if (stack[i].lhs === lhs) {
+ other = true;
+ break;
+ }
+ }
+ if (!other) {
+ stack.push({ lhs: lhs, rhs: rhs });
+ if (Array.isArray(lhs)) {
+ // If order doesn't matter, we need to sort our arrays
+ if (orderIndependent) {
+ lhs.sort(function (a, b) {
+ return getOrderIndependentHash(a) - getOrderIndependentHash(b);
+ });
+
+ rhs.sort(function (a, b) {
+ return getOrderIndependentHash(a) - getOrderIndependentHash(b);
+ });
+ }
+ i = rhs.length - 1;
+ j = lhs.length - 1;
+ while (i > j) {
+ changes.push(new DiffArray(currentPath, i, new DiffNew(undefined, rhs[i--])));
+ }
+ while (j > i) {
+ changes.push(new DiffArray(currentPath, j, new DiffDeleted(undefined, lhs[j--])));
+ }
+ for (; i >= 0; --i) {
+ deepDiff(lhs[i], rhs[i], changes, prefilter, currentPath, i, stack, orderIndependent);
+ }
+ } else {
+ var akeys = Object.keys(lhs);
+ var pkeys = Object.keys(rhs);
+ for (i = 0; i < akeys.length; ++i) {
+ k = akeys[i];
+ other = pkeys.indexOf(k);
+ if (other >= 0) {
+ deepDiff(lhs[k], rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
+ pkeys[other] = null;
+ } else {
+ deepDiff(lhs[k], undefined, changes, prefilter, currentPath, k, stack, orderIndependent);
+ }
+ }
+ for (i = 0; i < pkeys.length; ++i) {
+ k = pkeys[i];
+ if (k) {
+ deepDiff(undefined, rhs[k], changes, prefilter, currentPath, k, stack, orderIndependent);
+ }
+ }
+ }
+ stack.length = stack.length - 1;
+ } else if (lhs !== rhs) {
+ // lhs is contains a cycle at this element and it differs from rhs
+ changes.push(new DiffEdit(currentPath, lhs, rhs));
+ }
+ } else if (lhs !== rhs) {
+ if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
+ changes.push(new DiffEdit(currentPath, lhs, rhs));
+ }
+ }
+ }
+
+ function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
+ var changes = [];
+ deepDiff(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
+ if (observer) {
+ for (var i = 0; i < changes.length; ++i) {
+ observer(changes[i]);
+ }
+ }
+ return changes;
+ }
+
+ function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
+ return deepDiff(lhs, rhs, changes, prefilter, path, key, stack, true);
+ }
+
+ function accumulateDiff(lhs, rhs, prefilter, accum) {
+ var observer = (accum) ?
+ function (difference) {
+ if (difference) {
+ accum.push(difference);
+ }
+ } : undefined;
+ var changes = observableDiff(lhs, rhs, observer, prefilter);
+ return (accum) ? accum : (changes.length) ? changes : undefined;
+ }
+
+ function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
+ var observer = (accum) ?
+ function (difference) {
+ if (difference) {
+ accum.push(difference);
+ }
+ } : undefined;
+ var changes = observableDiff(lhs, rhs, observer, prefilter, true);
+ return (accum) ? accum : (changes.length) ? changes : undefined;
+ }
+
+ function applyArrayChange(arr, index, change) {
+ if (change.path && change.path.length) {
+ var it = arr[index],
+ i, u = change.path.length - 1;
+ for (i = 0; i < u; i++) {
+ it = it[change.path[i]];
+ }
+ switch (change.kind) {
+ case 'A':
+ applyArrayChange(it[change.path[i]], change.index, change.item);
+ break;
+ case 'D':
+ delete it[change.path[i]];
+ break;
+ case 'E':
+ case 'N':
+ it[change.path[i]] = change.rhs;
+ break;
+ }
+ } else {
+ switch (change.kind) {
+ case 'A':
+ applyArrayChange(arr[index], change.index, change.item);
+ break;
+ case 'D':
+ arr = arrayRemove(arr, index);
+ break;
+ case 'E':
+ case 'N':
+ arr[index] = change.rhs;
+ break;
+ }
+ }
+ return arr;
+ }
+
+ function applyChange(target, source, change) {
+ if (typeof change === 'undefined' && source && ~validKinds.indexOf(source.kind)) {
+ change = source;
+ }
+ if (target && change && change.kind) {
+ var it = target,
+ i = -1,
+ last = change.path ? change.path.length - 1 : 0;
+ while (++i < last) {
+ if (typeof it[change.path[i]] === 'undefined') {
+ it[change.path[i]] = (typeof change.path[i + 1] !== 'undefined' && typeof change.path[i + 1] === 'number') ? [] : {};
+ }
+ it = it[change.path[i]];
+ }
+ switch (change.kind) {
+ case 'A':
+ if (change.path && typeof it[change.path[i]] === 'undefined') {
+ it[change.path[i]] = [];
+ }
+ applyArrayChange(change.path ? it[change.path[i]] : it, change.index, change.item);
+ break;
+ case 'D':
+ delete it[change.path[i]];
+ break;
+ case 'E':
+ case 'N':
+ it[change.path[i]] = change.rhs;
+ break;
+ }
+ }
+ }
+
+ function revertArrayChange(arr, index, change) {
+ if (change.path && change.path.length) {
+ // the structure of the object at the index has changed...
+ var it = arr[index],
+ i, u = change.path.length - 1;
+ for (i = 0; i < u; i++) {
+ it = it[change.path[i]];
+ }
+ switch (change.kind) {
+ case 'A':
+ revertArrayChange(it[change.path[i]], change.index, change.item);
+ break;
+ case 'D':
+ it[change.path[i]] = change.lhs;
+ break;
+ case 'E':
+ it[change.path[i]] = change.lhs;
+ break;
+ case 'N':
+ delete it[change.path[i]];
+ break;
+ }
+ } else {
+ // the array item is different...
+ switch (change.kind) {
+ case 'A':
+ revertArrayChange(arr[index], change.index, change.item);
+ break;
+ case 'D':
+ arr[index] = change.lhs;
+ break;
+ case 'E':
+ arr[index] = change.lhs;
+ break;
+ case 'N':
+ arr = arrayRemove(arr, index);
+ break;
+ }
+ }
+ return arr;
+ }
+
+ function revertChange(target, source, change) {
+ if (target && source && change && change.kind) {
+ var it = target,
+ i, u;
+ u = change.path.length - 1;
+ for (i = 0; i < u; i++) {
+ if (typeof it[change.path[i]] === 'undefined') {
+ it[change.path[i]] = {};
+ }
+ it = it[change.path[i]];
+ }
+ switch (change.kind) {
+ case 'A':
+ // Array was modified...
+ // it will be an array...
+ revertArrayChange(it[change.path[i]], change.index, change.item);
+ break;
+ case 'D':
+ // Item was deleted...
+ it[change.path[i]] = change.lhs;
+ break;
+ case 'E':
+ // Item was edited...
+ it[change.path[i]] = change.lhs;
+ break;
+ case 'N':
+ // Item is new...
+ delete it[change.path[i]];
+ break;
+ }
+ }
+ }
+
+ function applyDiff(target, source, filter) {
+ if (target && source) {
+ var onChange = function (change) {
+ if (!filter || filter(target, source, change)) {
+ applyChange(target, source, change);
+ }
+ };
+ observableDiff(target, source, onChange);
+ }
+ }
+
+ Object.defineProperties(accumulateDiff, {
+
+ diff: {
+ value: accumulateDiff,
+ enumerable: true
+ },
+ orderIndependentDiff: {
+ value: accumulateOrderIndependentDiff,
+ enumerable: true
+ },
+ observableDiff: {
+ value: observableDiff,
+ enumerable: true
+ },
+ orderIndependentObservableDiff: {
+ value: orderIndependentDeepDiff,
+ enumerable: true
+ },
+ orderIndepHash: {
+ value: getOrderIndependentHash,
+ enumerable: true
+ },
+ applyDiff: {
+ value: applyDiff,
+ enumerable: true
+ },
+ applyChange: {
+ value: applyChange,
+ enumerable: true
+ },
+ revertChange: {
+ value: revertChange,
+ enumerable: true
+ },
+ isConflict: {
+ value: function () {
+ return typeof $conflict !== 'undefined';
+ },
+ enumerable: true
+ }
+ });
+
+ // hackish...
+ accumulateDiff.DeepDiff = accumulateDiff;
+ // ...but works with:
+ // import DeepDiff from 'deep-diff'
+ // import { DeepDiff } from 'deep-diff'
+ // const DeepDiff = require('deep-diff');
+ // const { DeepDiff } = require('deep-diff');
+
+ if (root) {
+ root.DeepDiff = accumulateDiff;
+ }
+
+ return accumulateDiff;
+}));
+
+},{}],107:[function(require,module,exports){
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+ else {
+ var a = factory();
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
+ }
+})(self, function() {
+return /******/ (function() { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ 3099:
+/***/ (function(module) {
+
+module.exports = function (it) {
+ if (typeof it != 'function') {
+ throw TypeError(String(it) + ' is not a function');
+ } return it;
+};
+
+
+/***/ }),
+
+/***/ 6077:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+
+module.exports = function (it) {
+ if (!isObject(it) && it !== null) {
+ throw TypeError("Can't set " + String(it) + ' as a prototype');
+ } return it;
+};
+
+
+/***/ }),
+
+/***/ 1223:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var wellKnownSymbol = __webpack_require__(5112);
+var create = __webpack_require__(30);
+var definePropertyModule = __webpack_require__(3070);
+
+var UNSCOPABLES = wellKnownSymbol('unscopables');
+var ArrayPrototype = Array.prototype;
+
+// Array.prototype[@@unscopables]
+// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
+if (ArrayPrototype[UNSCOPABLES] == undefined) {
+ definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
+ configurable: true,
+ value: create(null)
+ });
+}
+
+// add a key to Array.prototype[@@unscopables]
+module.exports = function (key) {
+ ArrayPrototype[UNSCOPABLES][key] = true;
+};
+
+
+/***/ }),
+
+/***/ 1530:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var charAt = __webpack_require__(8710).charAt;
+
+// `AdvanceStringIndex` abstract operation
+// https://tc39.es/ecma262/#sec-advancestringindex
+module.exports = function (S, index, unicode) {
+ return index + (unicode ? charAt(S, index).length : 1);
+};
+
+
+/***/ }),
+
+/***/ 5787:
+/***/ (function(module) {
+
+module.exports = function (it, Constructor, name) {
+ if (!(it instanceof Constructor)) {
+ throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
+ } return it;
+};
+
+
+/***/ }),
+
+/***/ 9670:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+
+module.exports = function (it) {
+ if (!isObject(it)) {
+ throw TypeError(String(it) + ' is not an object');
+ } return it;
+};
+
+
+/***/ }),
+
+/***/ 4019:
+/***/ (function(module) {
+
+module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
+
+
+/***/ }),
+
+/***/ 260:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var NATIVE_ARRAY_BUFFER = __webpack_require__(4019);
+var DESCRIPTORS = __webpack_require__(9781);
+var global = __webpack_require__(7854);
+var isObject = __webpack_require__(111);
+var has = __webpack_require__(6656);
+var classof = __webpack_require__(648);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var redefine = __webpack_require__(1320);
+var defineProperty = __webpack_require__(3070).f;
+var getPrototypeOf = __webpack_require__(9518);
+var setPrototypeOf = __webpack_require__(7674);
+var wellKnownSymbol = __webpack_require__(5112);
+var uid = __webpack_require__(9711);
+
+var Int8Array = global.Int8Array;
+var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
+var Uint8ClampedArray = global.Uint8ClampedArray;
+var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
+var TypedArray = Int8Array && getPrototypeOf(Int8Array);
+var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
+var ObjectPrototype = Object.prototype;
+var isPrototypeOf = ObjectPrototype.isPrototypeOf;
+
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
+// Fixing native typed arrays in Opera Presto crashes the browser, see #595
+var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
+var TYPED_ARRAY_TAG_REQIRED = false;
+var NAME;
+
+var TypedArrayConstructorsList = {
+ Int8Array: 1,
+ Uint8Array: 1,
+ Uint8ClampedArray: 1,
+ Int16Array: 2,
+ Uint16Array: 2,
+ Int32Array: 4,
+ Uint32Array: 4,
+ Float32Array: 4,
+ Float64Array: 8
+};
+
+var BigIntArrayConstructorsList = {
+ BigInt64Array: 8,
+ BigUint64Array: 8
+};
+
+var isView = function isView(it) {
+ if (!isObject(it)) return false;
+ var klass = classof(it);
+ return klass === 'DataView'
+ || has(TypedArrayConstructorsList, klass)
+ || has(BigIntArrayConstructorsList, klass);
+};
+
+var isTypedArray = function (it) {
+ if (!isObject(it)) return false;
+ var klass = classof(it);
+ return has(TypedArrayConstructorsList, klass)
+ || has(BigIntArrayConstructorsList, klass);
+};
+
+var aTypedArray = function (it) {
+ if (isTypedArray(it)) return it;
+ throw TypeError('Target is not a typed array');
+};
+
+var aTypedArrayConstructor = function (C) {
+ if (setPrototypeOf) {
+ if (isPrototypeOf.call(TypedArray, C)) return C;
+ } else for (var ARRAY in TypedArrayConstructorsList) if (has(TypedArrayConstructorsList, NAME)) {
+ var TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && (C === TypedArrayConstructor || isPrototypeOf.call(TypedArrayConstructor, C))) {
+ return C;
+ }
+ } throw TypeError('Target is not a typed array constructor');
+};
+
+var exportTypedArrayMethod = function (KEY, property, forced) {
+ if (!DESCRIPTORS) return;
+ if (forced) for (var ARRAY in TypedArrayConstructorsList) {
+ var TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) {
+ delete TypedArrayConstructor.prototype[KEY];
+ }
+ }
+ if (!TypedArrayPrototype[KEY] || forced) {
+ redefine(TypedArrayPrototype, KEY, forced ? property
+ : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
+ }
+};
+
+var exportTypedArrayStaticMethod = function (KEY, property, forced) {
+ var ARRAY, TypedArrayConstructor;
+ if (!DESCRIPTORS) return;
+ if (setPrototypeOf) {
+ if (forced) for (ARRAY in TypedArrayConstructorsList) {
+ TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) {
+ delete TypedArrayConstructor[KEY];
+ }
+ }
+ if (!TypedArray[KEY] || forced) {
+ // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
+ try {
+ return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && Int8Array[KEY] || property);
+ } catch (error) { /* empty */ }
+ } else return;
+ }
+ for (ARRAY in TypedArrayConstructorsList) {
+ TypedArrayConstructor = global[ARRAY];
+ if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
+ redefine(TypedArrayConstructor, KEY, property);
+ }
+ }
+};
+
+for (NAME in TypedArrayConstructorsList) {
+ if (!global[NAME]) NATIVE_ARRAY_BUFFER_VIEWS = false;
+}
+
+// WebKit bug - typed arrays constructors prototype is Object.prototype
+if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
+ // eslint-disable-next-line no-shadow -- safe
+ TypedArray = function TypedArray() {
+ throw TypeError('Incorrect invocation');
+ };
+ if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
+ if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
+ }
+}
+
+if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
+ TypedArrayPrototype = TypedArray.prototype;
+ if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
+ if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
+ }
+}
+
+// WebKit bug - one more object in Uint8ClampedArray prototype chain
+if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
+ setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
+}
+
+if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
+ TYPED_ARRAY_TAG_REQIRED = true;
+ defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
+ return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
+ } });
+ for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
+ createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
+ }
+}
+
+module.exports = {
+ NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
+ TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
+ aTypedArray: aTypedArray,
+ aTypedArrayConstructor: aTypedArrayConstructor,
+ exportTypedArrayMethod: exportTypedArrayMethod,
+ exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
+ isView: isView,
+ isTypedArray: isTypedArray,
+ TypedArray: TypedArray,
+ TypedArrayPrototype: TypedArrayPrototype
+};
+
+
+/***/ }),
+
+/***/ 3331:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var global = __webpack_require__(7854);
+var DESCRIPTORS = __webpack_require__(9781);
+var NATIVE_ARRAY_BUFFER = __webpack_require__(4019);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var redefineAll = __webpack_require__(2248);
+var fails = __webpack_require__(7293);
+var anInstance = __webpack_require__(5787);
+var toInteger = __webpack_require__(9958);
+var toLength = __webpack_require__(7466);
+var toIndex = __webpack_require__(7067);
+var IEEE754 = __webpack_require__(1179);
+var getPrototypeOf = __webpack_require__(9518);
+var setPrototypeOf = __webpack_require__(7674);
+var getOwnPropertyNames = __webpack_require__(8006).f;
+var defineProperty = __webpack_require__(3070).f;
+var arrayFill = __webpack_require__(1285);
+var setToStringTag = __webpack_require__(8003);
+var InternalStateModule = __webpack_require__(9909);
+
+var getInternalState = InternalStateModule.get;
+var setInternalState = InternalStateModule.set;
+var ARRAY_BUFFER = 'ArrayBuffer';
+var DATA_VIEW = 'DataView';
+var PROTOTYPE = 'prototype';
+var WRONG_LENGTH = 'Wrong length';
+var WRONG_INDEX = 'Wrong index';
+var NativeArrayBuffer = global[ARRAY_BUFFER];
+var $ArrayBuffer = NativeArrayBuffer;
+var $DataView = global[DATA_VIEW];
+var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
+var ObjectPrototype = Object.prototype;
+var RangeError = global.RangeError;
+
+var packIEEE754 = IEEE754.pack;
+var unpackIEEE754 = IEEE754.unpack;
+
+var packInt8 = function (number) {
+ return [number & 0xFF];
+};
+
+var packInt16 = function (number) {
+ return [number & 0xFF, number >> 8 & 0xFF];
+};
+
+var packInt32 = function (number) {
+ return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
+};
+
+var unpackInt32 = function (buffer) {
+ return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
+};
+
+var packFloat32 = function (number) {
+ return packIEEE754(number, 23, 4);
+};
+
+var packFloat64 = function (number) {
+ return packIEEE754(number, 52, 8);
+};
+
+var addGetter = function (Constructor, key) {
+ defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
+};
+
+var get = function (view, count, index, isLittleEndian) {
+ var intIndex = toIndex(index);
+ var store = getInternalState(view);
+ if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
+ var bytes = getInternalState(store.buffer).bytes;
+ var start = intIndex + store.byteOffset;
+ var pack = bytes.slice(start, start + count);
+ return isLittleEndian ? pack : pack.reverse();
+};
+
+var set = function (view, count, index, conversion, value, isLittleEndian) {
+ var intIndex = toIndex(index);
+ var store = getInternalState(view);
+ if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
+ var bytes = getInternalState(store.buffer).bytes;
+ var start = intIndex + store.byteOffset;
+ var pack = conversion(+value);
+ for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
+};
+
+if (!NATIVE_ARRAY_BUFFER) {
+ $ArrayBuffer = function ArrayBuffer(length) {
+ anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
+ var byteLength = toIndex(length);
+ setInternalState(this, {
+ bytes: arrayFill.call(new Array(byteLength), 0),
+ byteLength: byteLength
+ });
+ if (!DESCRIPTORS) this.byteLength = byteLength;
+ };
+
+ $DataView = function DataView(buffer, byteOffset, byteLength) {
+ anInstance(this, $DataView, DATA_VIEW);
+ anInstance(buffer, $ArrayBuffer, DATA_VIEW);
+ var bufferLength = getInternalState(buffer).byteLength;
+ var offset = toInteger(byteOffset);
+ if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
+ byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
+ if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
+ setInternalState(this, {
+ buffer: buffer,
+ byteLength: byteLength,
+ byteOffset: offset
+ });
+ if (!DESCRIPTORS) {
+ this.buffer = buffer;
+ this.byteLength = byteLength;
+ this.byteOffset = offset;
+ }
+ };
+
+ if (DESCRIPTORS) {
+ addGetter($ArrayBuffer, 'byteLength');
+ addGetter($DataView, 'buffer');
+ addGetter($DataView, 'byteLength');
+ addGetter($DataView, 'byteOffset');
+ }
+
+ redefineAll($DataView[PROTOTYPE], {
+ getInt8: function getInt8(byteOffset) {
+ return get(this, 1, byteOffset)[0] << 24 >> 24;
+ },
+ getUint8: function getUint8(byteOffset) {
+ return get(this, 1, byteOffset)[0];
+ },
+ getInt16: function getInt16(byteOffset /* , littleEndian */) {
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
+ return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
+ },
+ getUint16: function getUint16(byteOffset /* , littleEndian */) {
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
+ return bytes[1] << 8 | bytes[0];
+ },
+ getInt32: function getInt32(byteOffset /* , littleEndian */) {
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
+ },
+ getUint32: function getUint32(byteOffset /* , littleEndian */) {
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
+ },
+ getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
+ return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
+ },
+ getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
+ return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
+ },
+ setInt8: function setInt8(byteOffset, value) {
+ set(this, 1, byteOffset, packInt8, value);
+ },
+ setUint8: function setUint8(byteOffset, value) {
+ set(this, 1, byteOffset, packInt8, value);
+ },
+ setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
+ set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
+ },
+ setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
+ set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
+ }
+ });
+} else {
+ /* eslint-disable no-new -- required for testing */
+ if (!fails(function () {
+ NativeArrayBuffer(1);
+ }) || !fails(function () {
+ new NativeArrayBuffer(-1);
+ }) || fails(function () {
+ new NativeArrayBuffer();
+ new NativeArrayBuffer(1.5);
+ new NativeArrayBuffer(NaN);
+ return NativeArrayBuffer.name != ARRAY_BUFFER;
+ })) {
+ /* eslint-enable no-new -- required for testing */
+ $ArrayBuffer = function ArrayBuffer(length) {
+ anInstance(this, $ArrayBuffer);
+ return new NativeArrayBuffer(toIndex(length));
+ };
+ var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE];
+ for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
+ if (!((key = keys[j++]) in $ArrayBuffer)) {
+ createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
+ }
+ }
+ ArrayBufferPrototype.constructor = $ArrayBuffer;
+ }
+
+ // WebKit bug - the same parent prototype for typed arrays and data view
+ if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
+ setPrototypeOf($DataViewPrototype, ObjectPrototype);
+ }
+
+ // iOS Safari 7.x bug
+ var testView = new $DataView(new $ArrayBuffer(2));
+ var nativeSetInt8 = $DataViewPrototype.setInt8;
+ testView.setInt8(0, 2147483648);
+ testView.setInt8(1, 2147483649);
+ if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, {
+ setInt8: function setInt8(byteOffset, value) {
+ nativeSetInt8.call(this, byteOffset, value << 24 >> 24);
+ },
+ setUint8: function setUint8(byteOffset, value) {
+ nativeSetInt8.call(this, byteOffset, value << 24 >> 24);
+ }
+ }, { unsafe: true });
+}
+
+setToStringTag($ArrayBuffer, ARRAY_BUFFER);
+setToStringTag($DataView, DATA_VIEW);
+
+module.exports = {
+ ArrayBuffer: $ArrayBuffer,
+ DataView: $DataView
+};
+
+
+/***/ }),
+
+/***/ 1048:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var toObject = __webpack_require__(7908);
+var toAbsoluteIndex = __webpack_require__(1400);
+var toLength = __webpack_require__(7466);
+
+var min = Math.min;
+
+// `Array.prototype.copyWithin` method implementation
+// https://tc39.es/ecma262/#sec-array.prototype.copywithin
+module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
+ var O = toObject(this);
+ var len = toLength(O.length);
+ var to = toAbsoluteIndex(target, len);
+ var from = toAbsoluteIndex(start, len);
+ var end = arguments.length > 2 ? arguments[2] : undefined;
+ var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
+ var inc = 1;
+ if (from < to && to < from + count) {
+ inc = -1;
+ from += count - 1;
+ to += count - 1;
+ }
+ while (count-- > 0) {
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ to += inc;
+ from += inc;
+ } return O;
+};
+
+
+/***/ }),
+
+/***/ 1285:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var toObject = __webpack_require__(7908);
+var toAbsoluteIndex = __webpack_require__(1400);
+var toLength = __webpack_require__(7466);
+
+// `Array.prototype.fill` method implementation
+// https://tc39.es/ecma262/#sec-array.prototype.fill
+module.exports = function fill(value /* , start = 0, end = @length */) {
+ var O = toObject(this);
+ var length = toLength(O.length);
+ var argumentsLength = arguments.length;
+ var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
+ var end = argumentsLength > 2 ? arguments[2] : undefined;
+ var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
+ while (endPos > index) O[index++] = value;
+ return O;
+};
+
+
+/***/ }),
+
+/***/ 8533:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $forEach = __webpack_require__(2092).forEach;
+var arrayMethodIsStrict = __webpack_require__(9341);
+
+var STRICT_METHOD = arrayMethodIsStrict('forEach');
+
+// `Array.prototype.forEach` method implementation
+// https://tc39.es/ecma262/#sec-array.prototype.foreach
+module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
+ return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+} : [].forEach;
+
+
+/***/ }),
+
+/***/ 8457:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var bind = __webpack_require__(9974);
+var toObject = __webpack_require__(7908);
+var callWithSafeIterationClosing = __webpack_require__(3411);
+var isArrayIteratorMethod = __webpack_require__(7659);
+var toLength = __webpack_require__(7466);
+var createProperty = __webpack_require__(6135);
+var getIteratorMethod = __webpack_require__(1246);
+
+// `Array.from` method implementation
+// https://tc39.es/ecma262/#sec-array.from
+module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
+ var O = toObject(arrayLike);
+ var C = typeof this == 'function' ? this : Array;
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iteratorMethod = getIteratorMethod(O);
+ var index = 0;
+ var length, result, step, iterator, next, value;
+ if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
+ // if the target is not iterable or it's an array with the default iterator - use a simple case
+ if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
+ iterator = iteratorMethod.call(O);
+ next = iterator.next;
+ result = new C();
+ for (;!(step = next.call(iterator)).done; index++) {
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
+ createProperty(result, index, value);
+ }
+ } else {
+ length = toLength(O.length);
+ result = new C(length);
+ for (;length > index; index++) {
+ value = mapping ? mapfn(O[index], index) : O[index];
+ createProperty(result, index, value);
+ }
+ }
+ result.length = index;
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 1318:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toIndexedObject = __webpack_require__(5656);
+var toLength = __webpack_require__(7466);
+var toAbsoluteIndex = __webpack_require__(1400);
+
+// `Array.prototype.{ indexOf, includes }` methods implementation
+var createMethod = function (IS_INCLUDES) {
+ return function ($this, el, fromIndex) {
+ var O = toIndexedObject($this);
+ var length = toLength(O.length);
+ var index = toAbsoluteIndex(fromIndex, length);
+ var value;
+ // Array#includes uses SameValueZero equality algorithm
+ // eslint-disable-next-line no-self-compare -- NaN check
+ if (IS_INCLUDES && el != el) while (length > index) {
+ value = O[index++];
+ // eslint-disable-next-line no-self-compare -- NaN check
+ if (value != value) return true;
+ // Array#indexOf ignores holes, Array#includes - not
+ } else for (;length > index; index++) {
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
+ } return !IS_INCLUDES && -1;
+ };
+};
+
+module.exports = {
+ // `Array.prototype.includes` method
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
+ includes: createMethod(true),
+ // `Array.prototype.indexOf` method
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
+ indexOf: createMethod(false)
+};
+
+
+/***/ }),
+
+/***/ 2092:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var bind = __webpack_require__(9974);
+var IndexedObject = __webpack_require__(8361);
+var toObject = __webpack_require__(7908);
+var toLength = __webpack_require__(7466);
+var arraySpeciesCreate = __webpack_require__(5417);
+
+var push = [].push;
+
+// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
+var createMethod = function (TYPE) {
+ var IS_MAP = TYPE == 1;
+ var IS_FILTER = TYPE == 2;
+ var IS_SOME = TYPE == 3;
+ var IS_EVERY = TYPE == 4;
+ var IS_FIND_INDEX = TYPE == 6;
+ var IS_FILTER_OUT = TYPE == 7;
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
+ return function ($this, callbackfn, that, specificCreate) {
+ var O = toObject($this);
+ var self = IndexedObject(O);
+ var boundFunction = bind(callbackfn, that, 3);
+ var length = toLength(self.length);
+ var index = 0;
+ var create = specificCreate || arraySpeciesCreate;
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
+ var value, result;
+ for (;length > index; index++) if (NO_HOLES || index in self) {
+ value = self[index];
+ result = boundFunction(value, index, O);
+ if (TYPE) {
+ if (IS_MAP) target[index] = result; // map
+ else if (result) switch (TYPE) {
+ case 3: return true; // some
+ case 5: return value; // find
+ case 6: return index; // findIndex
+ case 2: push.call(target, value); // filter
+ } else switch (TYPE) {
+ case 4: return false; // every
+ case 7: push.call(target, value); // filterOut
+ }
+ }
+ }
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
+ };
+};
+
+module.exports = {
+ // `Array.prototype.forEach` method
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
+ forEach: createMethod(0),
+ // `Array.prototype.map` method
+ // https://tc39.es/ecma262/#sec-array.prototype.map
+ map: createMethod(1),
+ // `Array.prototype.filter` method
+ // https://tc39.es/ecma262/#sec-array.prototype.filter
+ filter: createMethod(2),
+ // `Array.prototype.some` method
+ // https://tc39.es/ecma262/#sec-array.prototype.some
+ some: createMethod(3),
+ // `Array.prototype.every` method
+ // https://tc39.es/ecma262/#sec-array.prototype.every
+ every: createMethod(4),
+ // `Array.prototype.find` method
+ // https://tc39.es/ecma262/#sec-array.prototype.find
+ find: createMethod(5),
+ // `Array.prototype.findIndex` method
+ // https://tc39.es/ecma262/#sec-array.prototype.findIndex
+ findIndex: createMethod(6),
+ // `Array.prototype.filterOut` method
+ // https://github.com/tc39/proposal-array-filtering
+ filterOut: createMethod(7)
+};
+
+
+/***/ }),
+
+/***/ 6583:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var toIndexedObject = __webpack_require__(5656);
+var toInteger = __webpack_require__(9958);
+var toLength = __webpack_require__(7466);
+var arrayMethodIsStrict = __webpack_require__(9341);
+
+var min = Math.min;
+var nativeLastIndexOf = [].lastIndexOf;
+var NEGATIVE_ZERO = !!nativeLastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
+var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
+var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;
+
+// `Array.prototype.lastIndexOf` method implementation
+// https://tc39.es/ecma262/#sec-array.prototype.lastindexof
+module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
+ // convert -0 to +0
+ if (NEGATIVE_ZERO) return nativeLastIndexOf.apply(this, arguments) || 0;
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var index = length - 1;
+ if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
+ if (index < 0) index = length + index;
+ for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
+ return -1;
+} : nativeLastIndexOf;
+
+
+/***/ }),
+
+/***/ 1194:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+var wellKnownSymbol = __webpack_require__(5112);
+var V8_VERSION = __webpack_require__(7392);
+
+var SPECIES = wellKnownSymbol('species');
+
+module.exports = function (METHOD_NAME) {
+ // We can't use this feature detection in V8 since it causes
+ // deoptimization and serious performance degradation
+ // https://github.com/zloirock/core-js/issues/677
+ return V8_VERSION >= 51 || !fails(function () {
+ var array = [];
+ var constructor = array.constructor = {};
+ constructor[SPECIES] = function () {
+ return { foo: 1 };
+ };
+ return array[METHOD_NAME](Boolean).foo !== 1;
+ });
+};
+
+
+/***/ }),
+
+/***/ 9341:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var fails = __webpack_require__(7293);
+
+module.exports = function (METHOD_NAME, argument) {
+ var method = [][METHOD_NAME];
+ return !!method && fails(function () {
+ // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
+ method.call(null, argument || function () { throw 1; }, 1);
+ });
+};
+
+
+/***/ }),
+
+/***/ 3671:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var aFunction = __webpack_require__(3099);
+var toObject = __webpack_require__(7908);
+var IndexedObject = __webpack_require__(8361);
+var toLength = __webpack_require__(7466);
+
+// `Array.prototype.{ reduce, reduceRight }` methods implementation
+var createMethod = function (IS_RIGHT) {
+ return function (that, callbackfn, argumentsLength, memo) {
+ aFunction(callbackfn);
+ var O = toObject(that);
+ var self = IndexedObject(O);
+ var length = toLength(O.length);
+ var index = IS_RIGHT ? length - 1 : 0;
+ var i = IS_RIGHT ? -1 : 1;
+ if (argumentsLength < 2) while (true) {
+ if (index in self) {
+ memo = self[index];
+ index += i;
+ break;
+ }
+ index += i;
+ if (IS_RIGHT ? index < 0 : length <= index) {
+ throw TypeError('Reduce of empty array with no initial value');
+ }
+ }
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
+ memo = callbackfn(memo, self[index], index, O);
+ }
+ return memo;
+ };
+};
+
+module.exports = {
+ // `Array.prototype.reduce` method
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
+ left: createMethod(false),
+ // `Array.prototype.reduceRight` method
+ // https://tc39.es/ecma262/#sec-array.prototype.reduceright
+ right: createMethod(true)
+};
+
+
+/***/ }),
+
+/***/ 5417:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+var isArray = __webpack_require__(3157);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var SPECIES = wellKnownSymbol('species');
+
+// `ArraySpeciesCreate` abstract operation
+// https://tc39.es/ecma262/#sec-arrayspeciescreate
+module.exports = function (originalArray, length) {
+ var C;
+ if (isArray(originalArray)) {
+ C = originalArray.constructor;
+ // cross-realm fallback
+ if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
+ else if (isObject(C)) {
+ C = C[SPECIES];
+ if (C === null) C = undefined;
+ }
+ } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
+};
+
+
+/***/ }),
+
+/***/ 3411:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var anObject = __webpack_require__(9670);
+var iteratorClose = __webpack_require__(9212);
+
+// call something on iterator step with safe closing on error
+module.exports = function (iterator, fn, value, ENTRIES) {
+ try {
+ return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
+ // 7.4.6 IteratorClose(iterator, completion)
+ } catch (error) {
+ iteratorClose(iterator);
+ throw error;
+ }
+};
+
+
+/***/ }),
+
+/***/ 7072:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var wellKnownSymbol = __webpack_require__(5112);
+
+var ITERATOR = wellKnownSymbol('iterator');
+var SAFE_CLOSING = false;
+
+try {
+ var called = 0;
+ var iteratorWithReturn = {
+ next: function () {
+ return { done: !!called++ };
+ },
+ 'return': function () {
+ SAFE_CLOSING = true;
+ }
+ };
+ iteratorWithReturn[ITERATOR] = function () {
+ return this;
+ };
+ // eslint-disable-next-line no-throw-literal -- required for testing
+ Array.from(iteratorWithReturn, function () { throw 2; });
+} catch (error) { /* empty */ }
+
+module.exports = function (exec, SKIP_CLOSING) {
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
+ var ITERATION_SUPPORT = false;
+ try {
+ var object = {};
+ object[ITERATOR] = function () {
+ return {
+ next: function () {
+ return { done: ITERATION_SUPPORT = true };
+ }
+ };
+ };
+ exec(object);
+ } catch (error) { /* empty */ }
+ return ITERATION_SUPPORT;
+};
+
+
+/***/ }),
+
+/***/ 4326:
+/***/ (function(module) {
+
+var toString = {}.toString;
+
+module.exports = function (it) {
+ return toString.call(it).slice(8, -1);
+};
+
+
+/***/ }),
+
+/***/ 648:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var TO_STRING_TAG_SUPPORT = __webpack_require__(1694);
+var classofRaw = __webpack_require__(4326);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+// ES3 wrong here
+var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
+
+// fallback for IE11 Script Access Denied error
+var tryGet = function (it, key) {
+ try {
+ return it[key];
+ } catch (error) { /* empty */ }
+};
+
+// getting tag from ES6+ `Object.prototype.toString`
+module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
+ var O, tag, result;
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
+ // @@toStringTag case
+ : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
+ // builtinTag case
+ : CORRECT_ARGUMENTS ? classofRaw(O)
+ // ES3 arguments fallback
+ : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
+};
+
+
+/***/ }),
+
+/***/ 9920:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var has = __webpack_require__(6656);
+var ownKeys = __webpack_require__(3887);
+var getOwnPropertyDescriptorModule = __webpack_require__(1236);
+var definePropertyModule = __webpack_require__(3070);
+
+module.exports = function (target, source) {
+ var keys = ownKeys(source);
+ var defineProperty = definePropertyModule.f;
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
+ }
+};
+
+
+/***/ }),
+
+/***/ 8544:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+
+module.exports = !fails(function () {
+ function F() { /* empty */ }
+ F.prototype.constructor = null;
+ return Object.getPrototypeOf(new F()) !== F.prototype;
+});
+
+
+/***/ }),
+
+/***/ 4994:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var IteratorPrototype = __webpack_require__(3383).IteratorPrototype;
+var create = __webpack_require__(30);
+var createPropertyDescriptor = __webpack_require__(9114);
+var setToStringTag = __webpack_require__(8003);
+var Iterators = __webpack_require__(7497);
+
+var returnThis = function () { return this; };
+
+module.exports = function (IteratorConstructor, NAME, next) {
+ var TO_STRING_TAG = NAME + ' Iterator';
+ IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
+ setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
+ Iterators[TO_STRING_TAG] = returnThis;
+ return IteratorConstructor;
+};
+
+
+/***/ }),
+
+/***/ 8880:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var definePropertyModule = __webpack_require__(3070);
+var createPropertyDescriptor = __webpack_require__(9114);
+
+module.exports = DESCRIPTORS ? function (object, key, value) {
+ return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
+} : function (object, key, value) {
+ object[key] = value;
+ return object;
+};
+
+
+/***/ }),
+
+/***/ 9114:
+/***/ (function(module) {
+
+module.exports = function (bitmap, value) {
+ return {
+ enumerable: !(bitmap & 1),
+ configurable: !(bitmap & 2),
+ writable: !(bitmap & 4),
+ value: value
+ };
+};
+
+
+/***/ }),
+
+/***/ 6135:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var toPrimitive = __webpack_require__(7593);
+var definePropertyModule = __webpack_require__(3070);
+var createPropertyDescriptor = __webpack_require__(9114);
+
+module.exports = function (object, key, value) {
+ var propertyKey = toPrimitive(key);
+ if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
+ else object[propertyKey] = value;
+};
+
+
+/***/ }),
+
+/***/ 654:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var createIteratorConstructor = __webpack_require__(4994);
+var getPrototypeOf = __webpack_require__(9518);
+var setPrototypeOf = __webpack_require__(7674);
+var setToStringTag = __webpack_require__(8003);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var redefine = __webpack_require__(1320);
+var wellKnownSymbol = __webpack_require__(5112);
+var IS_PURE = __webpack_require__(1913);
+var Iterators = __webpack_require__(7497);
+var IteratorsCore = __webpack_require__(3383);
+
+var IteratorPrototype = IteratorsCore.IteratorPrototype;
+var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
+var ITERATOR = wellKnownSymbol('iterator');
+var KEYS = 'keys';
+var VALUES = 'values';
+var ENTRIES = 'entries';
+
+var returnThis = function () { return this; };
+
+module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
+ createIteratorConstructor(IteratorConstructor, NAME, next);
+
+ var getIterationMethod = function (KIND) {
+ if (KIND === DEFAULT && defaultIterator) return defaultIterator;
+ if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
+ switch (KIND) {
+ case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
+ case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
+ case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
+ } return function () { return new IteratorConstructor(this); };
+ };
+
+ var TO_STRING_TAG = NAME + ' Iterator';
+ var INCORRECT_VALUES_NAME = false;
+ var IterablePrototype = Iterable.prototype;
+ var nativeIterator = IterablePrototype[ITERATOR]
+ || IterablePrototype['@@iterator']
+ || DEFAULT && IterablePrototype[DEFAULT];
+ var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
+ var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
+ var CurrentIteratorPrototype, methods, KEY;
+
+ // fix native
+ if (anyNativeIterator) {
+ CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
+ if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
+ if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
+ if (setPrototypeOf) {
+ setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
+ } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
+ createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
+ }
+ }
+ // Set @@toStringTag to native iterators
+ setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
+ if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
+ }
+ }
+
+ // fix Array#{values, @@iterator}.name in V8 / FF
+ if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
+ INCORRECT_VALUES_NAME = true;
+ defaultIterator = function values() { return nativeIterator.call(this); };
+ }
+
+ // define iterator
+ if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
+ createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
+ }
+ Iterators[NAME] = defaultIterator;
+
+ // export additional methods
+ if (DEFAULT) {
+ methods = {
+ values: getIterationMethod(VALUES),
+ keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
+ entries: getIterationMethod(ENTRIES)
+ };
+ if (FORCED) for (KEY in methods) {
+ if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
+ redefine(IterablePrototype, KEY, methods[KEY]);
+ }
+ } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
+ }
+
+ return methods;
+};
+
+
+/***/ }),
+
+/***/ 9781:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+
+// Detect IE8's incomplete defineProperty implementation
+module.exports = !fails(function () {
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
+});
+
+
+/***/ }),
+
+/***/ 317:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var isObject = __webpack_require__(111);
+
+var document = global.document;
+// typeof document.createElement is 'object' in old IE
+var EXISTS = isObject(document) && isObject(document.createElement);
+
+module.exports = function (it) {
+ return EXISTS ? document.createElement(it) : {};
+};
+
+
+/***/ }),
+
+/***/ 8324:
+/***/ (function(module) {
+
+// iterable DOM collections
+// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
+module.exports = {
+ CSSRuleList: 0,
+ CSSStyleDeclaration: 0,
+ CSSValueList: 0,
+ ClientRectList: 0,
+ DOMRectList: 0,
+ DOMStringList: 0,
+ DOMTokenList: 1,
+ DataTransferItemList: 0,
+ FileList: 0,
+ HTMLAllCollection: 0,
+ HTMLCollection: 0,
+ HTMLFormElement: 0,
+ HTMLSelectElement: 0,
+ MediaList: 0,
+ MimeTypeArray: 0,
+ NamedNodeMap: 0,
+ NodeList: 1,
+ PaintRequestList: 0,
+ Plugin: 0,
+ PluginArray: 0,
+ SVGLengthList: 0,
+ SVGNumberList: 0,
+ SVGPathSegList: 0,
+ SVGPointList: 0,
+ SVGStringList: 0,
+ SVGTransformList: 0,
+ SourceBufferList: 0,
+ StyleSheetList: 0,
+ TextTrackCueList: 0,
+ TextTrackList: 0,
+ TouchList: 0
+};
+
+
+/***/ }),
+
+/***/ 8113:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var getBuiltIn = __webpack_require__(5005);
+
+module.exports = getBuiltIn('navigator', 'userAgent') || '';
+
+
+/***/ }),
+
+/***/ 7392:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var userAgent = __webpack_require__(8113);
+
+var process = global.process;
+var versions = process && process.versions;
+var v8 = versions && versions.v8;
+var match, version;
+
+if (v8) {
+ match = v8.split('.');
+ version = match[0] + match[1];
+} else if (userAgent) {
+ match = userAgent.match(/Edge\/(\d+)/);
+ if (!match || match[1] >= 74) {
+ match = userAgent.match(/Chrome\/(\d+)/);
+ if (match) version = match[1];
+ }
+}
+
+module.exports = version && +version;
+
+
+/***/ }),
+
+/***/ 748:
+/***/ (function(module) {
+
+// IE8- don't enum bug keys
+module.exports = [
+ 'constructor',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'toLocaleString',
+ 'toString',
+ 'valueOf'
+];
+
+
+/***/ }),
+
+/***/ 2109:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var getOwnPropertyDescriptor = __webpack_require__(1236).f;
+var createNonEnumerableProperty = __webpack_require__(8880);
+var redefine = __webpack_require__(1320);
+var setGlobal = __webpack_require__(3505);
+var copyConstructorProperties = __webpack_require__(9920);
+var isForced = __webpack_require__(4705);
+
+/*
+ options.target - name of the target object
+ options.global - target is the global object
+ options.stat - export as static methods of target
+ options.proto - export as prototype methods of target
+ options.real - real prototype method for the `pure` version
+ options.forced - export even if the native feature is available
+ options.bind - bind methods to the target, required for the `pure` version
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
+ options.sham - add a flag to not completely full polyfills
+ options.enumerable - export as enumerable property
+ options.noTargetGet - prevent calling a getter on target
+*/
+module.exports = function (options, source) {
+ var TARGET = options.target;
+ var GLOBAL = options.global;
+ var STATIC = options.stat;
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
+ if (GLOBAL) {
+ target = global;
+ } else if (STATIC) {
+ target = global[TARGET] || setGlobal(TARGET, {});
+ } else {
+ target = (global[TARGET] || {}).prototype;
+ }
+ if (target) for (key in source) {
+ sourceProperty = source[key];
+ if (options.noTargetGet) {
+ descriptor = getOwnPropertyDescriptor(target, key);
+ targetProperty = descriptor && descriptor.value;
+ } else targetProperty = target[key];
+ FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
+ // contained in target
+ if (!FORCED && targetProperty !== undefined) {
+ if (typeof sourceProperty === typeof targetProperty) continue;
+ copyConstructorProperties(sourceProperty, targetProperty);
+ }
+ // add a flag to not completely full polyfills
+ if (options.sham || (targetProperty && targetProperty.sham)) {
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
+ }
+ // extend global
+ redefine(target, key, sourceProperty, options);
+ }
+};
+
+
+/***/ }),
+
+/***/ 7293:
+/***/ (function(module) {
+
+module.exports = function (exec) {
+ try {
+ return !!exec();
+ } catch (error) {
+ return true;
+ }
+};
+
+
+/***/ }),
+
+/***/ 7007:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+// TODO: Remove from `core-js@4` since it's moved to entry points
+__webpack_require__(4916);
+var redefine = __webpack_require__(1320);
+var fails = __webpack_require__(7293);
+var wellKnownSymbol = __webpack_require__(5112);
+var regexpExec = __webpack_require__(2261);
+var createNonEnumerableProperty = __webpack_require__(8880);
+
+var SPECIES = wellKnownSymbol('species');
+
+var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
+ // #replace needs built-in support for named groups.
+ // #match works fine because it just return the exec results, even if it has
+ // a "grops" property.
+ var re = /./;
+ re.exec = function () {
+ var result = [];
+ result.groups = { a: '7' };
+ return result;
+ };
+ return ''.replace(re, '$') !== '7';
+});
+
+// IE <= 11 replaces $0 with the whole match, as if it was $&
+// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
+var REPLACE_KEEPS_$0 = (function () {
+ return 'a'.replace(/./, '$0') === '$0';
+})();
+
+var REPLACE = wellKnownSymbol('replace');
+// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
+var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
+ if (/./[REPLACE]) {
+ return /./[REPLACE]('a', '$0') === '';
+ }
+ return false;
+})();
+
+// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
+// Weex JS has frozen built-in prototypes, so use try / catch wrapper
+var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
+ var re = /(?:)/;
+ var originalExec = re.exec;
+ re.exec = function () { return originalExec.apply(this, arguments); };
+ var result = 'ab'.split(re);
+ return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
+});
+
+module.exports = function (KEY, length, exec, sham) {
+ var SYMBOL = wellKnownSymbol(KEY);
+
+ var DELEGATES_TO_SYMBOL = !fails(function () {
+ // String methods call symbol-named RegEp methods
+ var O = {};
+ O[SYMBOL] = function () { return 7; };
+ return ''[KEY](O) != 7;
+ });
+
+ var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
+ // Symbol-named RegExp methods call .exec
+ var execCalled = false;
+ var re = /a/;
+
+ if (KEY === 'split') {
+ // We can't use real regex here since it causes deoptimization
+ // and serious performance degradation in V8
+ // https://github.com/zloirock/core-js/issues/306
+ re = {};
+ // RegExp[@@split] doesn't call the regex's exec method, but first creates
+ // a new one. We need to return the patched regex when creating the new one.
+ re.constructor = {};
+ re.constructor[SPECIES] = function () { return re; };
+ re.flags = '';
+ re[SYMBOL] = /./[SYMBOL];
+ }
+
+ re.exec = function () { execCalled = true; return null; };
+
+ re[SYMBOL]('');
+ return !execCalled;
+ });
+
+ if (
+ !DELEGATES_TO_SYMBOL ||
+ !DELEGATES_TO_EXEC ||
+ (KEY === 'replace' && !(
+ REPLACE_SUPPORTS_NAMED_GROUPS &&
+ REPLACE_KEEPS_$0 &&
+ !REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ )) ||
+ (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
+ ) {
+ var nativeRegExpMethod = /./[SYMBOL];
+ var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
+ if (regexp.exec === regexpExec) {
+ if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
+ // The native String method already delegates to @@method (this
+ // polyfilled function), leasing to infinite recursion.
+ // We avoid it by directly calling the native @@method method.
+ return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
+ }
+ return { done: true, value: nativeMethod.call(str, regexp, arg2) };
+ }
+ return { done: false };
+ }, {
+ REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
+ REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
+ });
+ var stringMethod = methods[0];
+ var regexMethod = methods[1];
+
+ redefine(String.prototype, KEY, stringMethod);
+ redefine(RegExp.prototype, SYMBOL, length == 2
+ // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
+ // 21.2.5.11 RegExp.prototype[@@split](string, limit)
+ ? function (string, arg) { return regexMethod.call(string, this, arg); }
+ // 21.2.5.6 RegExp.prototype[@@match](string)
+ // 21.2.5.9 RegExp.prototype[@@search](string)
+ : function (string) { return regexMethod.call(string, this); }
+ );
+ }
+
+ if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
+};
+
+
+/***/ }),
+
+/***/ 9974:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var aFunction = __webpack_require__(3099);
+
+// optional / simple context binding
+module.exports = function (fn, that, length) {
+ aFunction(fn);
+ if (that === undefined) return fn;
+ switch (length) {
+ case 0: return function () {
+ return fn.call(that);
+ };
+ case 1: return function (a) {
+ return fn.call(that, a);
+ };
+ case 2: return function (a, b) {
+ return fn.call(that, a, b);
+ };
+ case 3: return function (a, b, c) {
+ return fn.call(that, a, b, c);
+ };
+ }
+ return function (/* ...args */) {
+ return fn.apply(that, arguments);
+ };
+};
+
+
+/***/ }),
+
+/***/ 5005:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var path = __webpack_require__(857);
+var global = __webpack_require__(7854);
+
+var aFunction = function (variable) {
+ return typeof variable == 'function' ? variable : undefined;
+};
+
+module.exports = function (namespace, method) {
+ return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
+ : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
+};
+
+
+/***/ }),
+
+/***/ 1246:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var classof = __webpack_require__(648);
+var Iterators = __webpack_require__(7497);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var ITERATOR = wellKnownSymbol('iterator');
+
+module.exports = function (it) {
+ if (it != undefined) return it[ITERATOR]
+ || it['@@iterator']
+ || Iterators[classof(it)];
+};
+
+
+/***/ }),
+
+/***/ 8554:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var anObject = __webpack_require__(9670);
+var getIteratorMethod = __webpack_require__(1246);
+
+module.exports = function (it) {
+ var iteratorMethod = getIteratorMethod(it);
+ if (typeof iteratorMethod != 'function') {
+ throw TypeError(String(it) + ' is not iterable');
+ } return anObject(iteratorMethod.call(it));
+};
+
+
+/***/ }),
+
+/***/ 647:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toObject = __webpack_require__(7908);
+
+var floor = Math.floor;
+var replace = ''.replace;
+var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
+var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
+
+// https://tc39.es/ecma262/#sec-getsubstitution
+module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
+ var tailPos = position + matched.length;
+ var m = captures.length;
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
+ if (namedCaptures !== undefined) {
+ namedCaptures = toObject(namedCaptures);
+ symbols = SUBSTITUTION_SYMBOLS;
+ }
+ return replace.call(replacement, symbols, function (match, ch) {
+ var capture;
+ switch (ch.charAt(0)) {
+ case '$': return '$';
+ case '&': return matched;
+ case '`': return str.slice(0, position);
+ case "'": return str.slice(tailPos);
+ case '<':
+ capture = namedCaptures[ch.slice(1, -1)];
+ break;
+ default: // \d\d?
+ var n = +ch;
+ if (n === 0) return match;
+ if (n > m) {
+ var f = floor(n / 10);
+ if (f === 0) return match;
+ if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
+ return match;
+ }
+ capture = captures[n - 1];
+ }
+ return capture === undefined ? '' : capture;
+ });
+};
+
+
+/***/ }),
+
+/***/ 7854:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var check = function (it) {
+ return it && it.Math == Math && it;
+};
+
+// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
+module.exports =
+ /* global globalThis -- safe */
+ check(typeof globalThis == 'object' && globalThis) ||
+ check(typeof window == 'object' && window) ||
+ check(typeof self == 'object' && self) ||
+ check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) ||
+ // eslint-disable-next-line no-new-func -- fallback
+ (function () { return this; })() || Function('return this')();
+
+
+/***/ }),
+
+/***/ 6656:
+/***/ (function(module) {
+
+var hasOwnProperty = {}.hasOwnProperty;
+
+module.exports = function (it, key) {
+ return hasOwnProperty.call(it, key);
+};
+
+
+/***/ }),
+
+/***/ 3501:
+/***/ (function(module) {
+
+module.exports = {};
+
+
+/***/ }),
+
+/***/ 490:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var getBuiltIn = __webpack_require__(5005);
+
+module.exports = getBuiltIn('document', 'documentElement');
+
+
+/***/ }),
+
+/***/ 4664:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var fails = __webpack_require__(7293);
+var createElement = __webpack_require__(317);
+
+// Thank's IE8 for his funny defineProperty
+module.exports = !DESCRIPTORS && !fails(function () {
+ return Object.defineProperty(createElement('div'), 'a', {
+ get: function () { return 7; }
+ }).a != 7;
+});
+
+
+/***/ }),
+
+/***/ 1179:
+/***/ (function(module) {
+
+// IEEE754 conversions based on https://github.com/feross/ieee754
+var abs = Math.abs;
+var pow = Math.pow;
+var floor = Math.floor;
+var log = Math.log;
+var LN2 = Math.LN2;
+
+var pack = function (number, mantissaLength, bytes) {
+ var buffer = new Array(bytes);
+ var exponentLength = bytes * 8 - mantissaLength - 1;
+ var eMax = (1 << exponentLength) - 1;
+ var eBias = eMax >> 1;
+ var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
+ var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
+ var index = 0;
+ var exponent, mantissa, c;
+ number = abs(number);
+ // eslint-disable-next-line no-self-compare -- NaN check
+ if (number != number || number === Infinity) {
+ // eslint-disable-next-line no-self-compare -- NaN check
+ mantissa = number != number ? 1 : 0;
+ exponent = eMax;
+ } else {
+ exponent = floor(log(number) / LN2);
+ if (number * (c = pow(2, -exponent)) < 1) {
+ exponent--;
+ c *= 2;
+ }
+ if (exponent + eBias >= 1) {
+ number += rt / c;
+ } else {
+ number += rt * pow(2, 1 - eBias);
+ }
+ if (number * c >= 2) {
+ exponent++;
+ c /= 2;
+ }
+ if (exponent + eBias >= eMax) {
+ mantissa = 0;
+ exponent = eMax;
+ } else if (exponent + eBias >= 1) {
+ mantissa = (number * c - 1) * pow(2, mantissaLength);
+ exponent = exponent + eBias;
+ } else {
+ mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
+ exponent = 0;
+ }
+ }
+ for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8);
+ exponent = exponent << mantissaLength | mantissa;
+ exponentLength += mantissaLength;
+ for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8);
+ buffer[--index] |= sign * 128;
+ return buffer;
+};
+
+var unpack = function (buffer, mantissaLength) {
+ var bytes = buffer.length;
+ var exponentLength = bytes * 8 - mantissaLength - 1;
+ var eMax = (1 << exponentLength) - 1;
+ var eBias = eMax >> 1;
+ var nBits = exponentLength - 7;
+ var index = bytes - 1;
+ var sign = buffer[index--];
+ var exponent = sign & 127;
+ var mantissa;
+ sign >>= 7;
+ for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8);
+ mantissa = exponent & (1 << -nBits) - 1;
+ exponent >>= -nBits;
+ nBits += mantissaLength;
+ for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8);
+ if (exponent === 0) {
+ exponent = 1 - eBias;
+ } else if (exponent === eMax) {
+ return mantissa ? NaN : sign ? -Infinity : Infinity;
+ } else {
+ mantissa = mantissa + pow(2, mantissaLength);
+ exponent = exponent - eBias;
+ } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
+};
+
+module.exports = {
+ pack: pack,
+ unpack: unpack
+};
+
+
+/***/ }),
+
+/***/ 8361:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+var classof = __webpack_require__(4326);
+
+var split = ''.split;
+
+// fallback for non-array-like ES3 and non-enumerable old V8 strings
+module.exports = fails(function () {
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
+ // eslint-disable-next-line no-prototype-builtins -- safe
+ return !Object('z').propertyIsEnumerable(0);
+}) ? function (it) {
+ return classof(it) == 'String' ? split.call(it, '') : Object(it);
+} : Object;
+
+
+/***/ }),
+
+/***/ 9587:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+var setPrototypeOf = __webpack_require__(7674);
+
+// makes subclassing work correct for wrapped built-ins
+module.exports = function ($this, dummy, Wrapper) {
+ var NewTarget, NewTargetPrototype;
+ if (
+ // it can work only with native `setPrototypeOf`
+ setPrototypeOf &&
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
+ typeof (NewTarget = dummy.constructor) == 'function' &&
+ NewTarget !== Wrapper &&
+ isObject(NewTargetPrototype = NewTarget.prototype) &&
+ NewTargetPrototype !== Wrapper.prototype
+ ) setPrototypeOf($this, NewTargetPrototype);
+ return $this;
+};
+
+
+/***/ }),
+
+/***/ 2788:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var store = __webpack_require__(5465);
+
+var functionToString = Function.toString;
+
+// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
+if (typeof store.inspectSource != 'function') {
+ store.inspectSource = function (it) {
+ return functionToString.call(it);
+ };
+}
+
+module.exports = store.inspectSource;
+
+
+/***/ }),
+
+/***/ 9909:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var NATIVE_WEAK_MAP = __webpack_require__(8536);
+var global = __webpack_require__(7854);
+var isObject = __webpack_require__(111);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var objectHas = __webpack_require__(6656);
+var shared = __webpack_require__(5465);
+var sharedKey = __webpack_require__(6200);
+var hiddenKeys = __webpack_require__(3501);
+
+var WeakMap = global.WeakMap;
+var set, get, has;
+
+var enforce = function (it) {
+ return has(it) ? get(it) : set(it, {});
+};
+
+var getterFor = function (TYPE) {
+ return function (it) {
+ var state;
+ if (!isObject(it) || (state = get(it)).type !== TYPE) {
+ throw TypeError('Incompatible receiver, ' + TYPE + ' required');
+ } return state;
+ };
+};
+
+if (NATIVE_WEAK_MAP) {
+ var store = shared.state || (shared.state = new WeakMap());
+ var wmget = store.get;
+ var wmhas = store.has;
+ var wmset = store.set;
+ set = function (it, metadata) {
+ metadata.facade = it;
+ wmset.call(store, it, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return wmget.call(store, it) || {};
+ };
+ has = function (it) {
+ return wmhas.call(store, it);
+ };
+} else {
+ var STATE = sharedKey('state');
+ hiddenKeys[STATE] = true;
+ set = function (it, metadata) {
+ metadata.facade = it;
+ createNonEnumerableProperty(it, STATE, metadata);
+ return metadata;
+ };
+ get = function (it) {
+ return objectHas(it, STATE) ? it[STATE] : {};
+ };
+ has = function (it) {
+ return objectHas(it, STATE);
+ };
+}
+
+module.exports = {
+ set: set,
+ get: get,
+ has: has,
+ enforce: enforce,
+ getterFor: getterFor
+};
+
+
+/***/ }),
+
+/***/ 7659:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var wellKnownSymbol = __webpack_require__(5112);
+var Iterators = __webpack_require__(7497);
+
+var ITERATOR = wellKnownSymbol('iterator');
+var ArrayPrototype = Array.prototype;
+
+// check on default Array iterator
+module.exports = function (it) {
+ return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
+};
+
+
+/***/ }),
+
+/***/ 3157:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var classof = __webpack_require__(4326);
+
+// `IsArray` abstract operation
+// https://tc39.es/ecma262/#sec-isarray
+module.exports = Array.isArray || function isArray(arg) {
+ return classof(arg) == 'Array';
+};
+
+
+/***/ }),
+
+/***/ 4705:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+
+var replacement = /#|\.prototype\./;
+
+var isForced = function (feature, detection) {
+ var value = data[normalize(feature)];
+ return value == POLYFILL ? true
+ : value == NATIVE ? false
+ : typeof detection == 'function' ? fails(detection)
+ : !!detection;
+};
+
+var normalize = isForced.normalize = function (string) {
+ return String(string).replace(replacement, '.').toLowerCase();
+};
+
+var data = isForced.data = {};
+var NATIVE = isForced.NATIVE = 'N';
+var POLYFILL = isForced.POLYFILL = 'P';
+
+module.exports = isForced;
+
+
+/***/ }),
+
+/***/ 111:
+/***/ (function(module) {
+
+module.exports = function (it) {
+ return typeof it === 'object' ? it !== null : typeof it === 'function';
+};
+
+
+/***/ }),
+
+/***/ 1913:
+/***/ (function(module) {
+
+module.exports = false;
+
+
+/***/ }),
+
+/***/ 7850:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+var classof = __webpack_require__(4326);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var MATCH = wellKnownSymbol('match');
+
+// `IsRegExp` abstract operation
+// https://tc39.es/ecma262/#sec-isregexp
+module.exports = function (it) {
+ var isRegExp;
+ return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
+};
+
+
+/***/ }),
+
+/***/ 9212:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var anObject = __webpack_require__(9670);
+
+module.exports = function (iterator) {
+ var returnMethod = iterator['return'];
+ if (returnMethod !== undefined) {
+ return anObject(returnMethod.call(iterator)).value;
+ }
+};
+
+
+/***/ }),
+
+/***/ 3383:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var fails = __webpack_require__(7293);
+var getPrototypeOf = __webpack_require__(9518);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var has = __webpack_require__(6656);
+var wellKnownSymbol = __webpack_require__(5112);
+var IS_PURE = __webpack_require__(1913);
+
+var ITERATOR = wellKnownSymbol('iterator');
+var BUGGY_SAFARI_ITERATORS = false;
+
+var returnThis = function () { return this; };
+
+// `%IteratorPrototype%` object
+// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
+var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
+
+if ([].keys) {
+ arrayIterator = [].keys();
+ // Safari 8 has buggy iterators w/o `next`
+ if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
+ else {
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
+ }
+}
+
+var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
+ var test = {};
+ // FF44- legacy iterators case
+ return IteratorPrototype[ITERATOR].call(test) !== test;
+});
+
+if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
+
+// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
+if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) {
+ createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
+}
+
+module.exports = {
+ IteratorPrototype: IteratorPrototype,
+ BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
+};
+
+
+/***/ }),
+
+/***/ 7497:
+/***/ (function(module) {
+
+module.exports = {};
+
+
+/***/ }),
+
+/***/ 133:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+
+module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
+ // Chrome 38 Symbol has incorrect toString conversion
+ /* global Symbol -- required for testing */
+ return !String(Symbol());
+});
+
+
+/***/ }),
+
+/***/ 590:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+var wellKnownSymbol = __webpack_require__(5112);
+var IS_PURE = __webpack_require__(1913);
+
+var ITERATOR = wellKnownSymbol('iterator');
+
+module.exports = !fails(function () {
+ var url = new URL('b?a=1&b=2&c=3', 'http://a');
+ var searchParams = url.searchParams;
+ var result = '';
+ url.pathname = 'c%20d';
+ searchParams.forEach(function (value, key) {
+ searchParams['delete']('b');
+ result += key + value;
+ });
+ return (IS_PURE && !url.toJSON)
+ || !searchParams.sort
+ || url.href !== 'http://a/c%20d?a=1&c=3'
+ || searchParams.get('c') !== '3'
+ || String(new URLSearchParams('?a=1')) !== 'a=1'
+ || !searchParams[ITERATOR]
+ // throws in Edge
+ || new URL('https://a@b').username !== 'a'
+ || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
+ // not punycoded in Edge
+ || new URL('http://тест').host !== 'xn--e1aybc'
+ // not escaped in Chrome 62-
+ || new URL('http://a#б').hash !== '#%D0%B1'
+ // fails in Chrome 66-
+ || result !== 'a1c3'
+ // throws in Safari
+ || new URL('http://x', undefined).host !== 'x';
+});
+
+
+/***/ }),
+
+/***/ 8536:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var inspectSource = __webpack_require__(2788);
+
+var WeakMap = global.WeakMap;
+
+module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
+
+
+/***/ }),
+
+/***/ 1574:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var DESCRIPTORS = __webpack_require__(9781);
+var fails = __webpack_require__(7293);
+var objectKeys = __webpack_require__(1956);
+var getOwnPropertySymbolsModule = __webpack_require__(5181);
+var propertyIsEnumerableModule = __webpack_require__(5296);
+var toObject = __webpack_require__(7908);
+var IndexedObject = __webpack_require__(8361);
+
+var nativeAssign = Object.assign;
+var defineProperty = Object.defineProperty;
+
+// `Object.assign` method
+// https://tc39.es/ecma262/#sec-object.assign
+module.exports = !nativeAssign || fails(function () {
+ // should have correct order of operations (Edge bug)
+ if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
+ enumerable: true,
+ get: function () {
+ defineProperty(this, 'b', {
+ value: 3,
+ enumerable: false
+ });
+ }
+ }), { b: 2 })).b !== 1) return true;
+ // should work with symbols and should have deterministic property order (V8 bug)
+ var A = {};
+ var B = {};
+ /* global Symbol -- required for testing */
+ var symbol = Symbol();
+ var alphabet = 'abcdefghijklmnopqrst';
+ A[symbol] = 7;
+ alphabet.split('').forEach(function (chr) { B[chr] = chr; });
+ return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
+}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
+ var T = toObject(target);
+ var argumentsLength = arguments.length;
+ var index = 1;
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ var propertyIsEnumerable = propertyIsEnumerableModule.f;
+ while (argumentsLength > index) {
+ var S = IndexedObject(arguments[index++]);
+ var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
+ var length = keys.length;
+ var j = 0;
+ var key;
+ while (length > j) {
+ key = keys[j++];
+ if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
+ }
+ } return T;
+} : nativeAssign;
+
+
+/***/ }),
+
+/***/ 30:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var anObject = __webpack_require__(9670);
+var defineProperties = __webpack_require__(6048);
+var enumBugKeys = __webpack_require__(748);
+var hiddenKeys = __webpack_require__(3501);
+var html = __webpack_require__(490);
+var documentCreateElement = __webpack_require__(317);
+var sharedKey = __webpack_require__(6200);
+
+var GT = '>';
+var LT = '<';
+var PROTOTYPE = 'prototype';
+var SCRIPT = 'script';
+var IE_PROTO = sharedKey('IE_PROTO');
+
+var EmptyConstructor = function () { /* empty */ };
+
+var scriptTag = function (content) {
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
+};
+
+// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
+var NullProtoObjectViaActiveX = function (activeXDocument) {
+ activeXDocument.write(scriptTag(''));
+ activeXDocument.close();
+ var temp = activeXDocument.parentWindow.Object;
+ activeXDocument = null; // avoid memory leak
+ return temp;
+};
+
+// Create object with fake `null` prototype: use iframe Object with cleared prototype
+var NullProtoObjectViaIFrame = function () {
+ // Thrash, waste and sodomy: IE GC bug
+ var iframe = documentCreateElement('iframe');
+ var JS = 'java' + SCRIPT + ':';
+ var iframeDocument;
+ iframe.style.display = 'none';
+ html.appendChild(iframe);
+ // https://github.com/zloirock/core-js/issues/475
+ iframe.src = String(JS);
+ iframeDocument = iframe.contentWindow.document;
+ iframeDocument.open();
+ iframeDocument.write(scriptTag('document.F=Object'));
+ iframeDocument.close();
+ return iframeDocument.F;
+};
+
+// Check for document.domain and active x support
+// No need to use active x approach when document.domain is not set
+// see https://github.com/es-shims/es5-shim/issues/150
+// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
+// avoid IE GC bug
+var activeXDocument;
+var NullProtoObject = function () {
+ try {
+ /* global ActiveXObject -- old IE */
+ activeXDocument = document.domain && new ActiveXObject('htmlfile');
+ } catch (error) { /* ignore */ }
+ NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
+ var length = enumBugKeys.length;
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
+ return NullProtoObject();
+};
+
+hiddenKeys[IE_PROTO] = true;
+
+// `Object.create` method
+// https://tc39.es/ecma262/#sec-object.create
+module.exports = Object.create || function create(O, Properties) {
+ var result;
+ if (O !== null) {
+ EmptyConstructor[PROTOTYPE] = anObject(O);
+ result = new EmptyConstructor();
+ EmptyConstructor[PROTOTYPE] = null;
+ // add "__proto__" for Object.getPrototypeOf polyfill
+ result[IE_PROTO] = O;
+ } else result = NullProtoObject();
+ return Properties === undefined ? result : defineProperties(result, Properties);
+};
+
+
+/***/ }),
+
+/***/ 6048:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var definePropertyModule = __webpack_require__(3070);
+var anObject = __webpack_require__(9670);
+var objectKeys = __webpack_require__(1956);
+
+// `Object.defineProperties` method
+// https://tc39.es/ecma262/#sec-object.defineproperties
+module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
+ anObject(O);
+ var keys = objectKeys(Properties);
+ var length = keys.length;
+ var index = 0;
+ var key;
+ while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
+ return O;
+};
+
+
+/***/ }),
+
+/***/ 3070:
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var IE8_DOM_DEFINE = __webpack_require__(4664);
+var anObject = __webpack_require__(9670);
+var toPrimitive = __webpack_require__(7593);
+
+var nativeDefineProperty = Object.defineProperty;
+
+// `Object.defineProperty` method
+// https://tc39.es/ecma262/#sec-object.defineproperty
+exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
+ anObject(O);
+ P = toPrimitive(P, true);
+ anObject(Attributes);
+ if (IE8_DOM_DEFINE) try {
+ return nativeDefineProperty(O, P, Attributes);
+ } catch (error) { /* empty */ }
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
+ if ('value' in Attributes) O[P] = Attributes.value;
+ return O;
+};
+
+
+/***/ }),
+
+/***/ 1236:
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var propertyIsEnumerableModule = __webpack_require__(5296);
+var createPropertyDescriptor = __webpack_require__(9114);
+var toIndexedObject = __webpack_require__(5656);
+var toPrimitive = __webpack_require__(7593);
+var has = __webpack_require__(6656);
+var IE8_DOM_DEFINE = __webpack_require__(4664);
+
+var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+// `Object.getOwnPropertyDescriptor` method
+// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
+exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
+ O = toIndexedObject(O);
+ P = toPrimitive(P, true);
+ if (IE8_DOM_DEFINE) try {
+ return nativeGetOwnPropertyDescriptor(O, P);
+ } catch (error) { /* empty */ }
+ if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
+};
+
+
+/***/ }),
+
+/***/ 8006:
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+var internalObjectKeys = __webpack_require__(6324);
+var enumBugKeys = __webpack_require__(748);
+
+var hiddenKeys = enumBugKeys.concat('length', 'prototype');
+
+// `Object.getOwnPropertyNames` method
+// https://tc39.es/ecma262/#sec-object.getownpropertynames
+exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
+ return internalObjectKeys(O, hiddenKeys);
+};
+
+
+/***/ }),
+
+/***/ 5181:
+/***/ (function(__unused_webpack_module, exports) {
+
+exports.f = Object.getOwnPropertySymbols;
+
+
+/***/ }),
+
+/***/ 9518:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var has = __webpack_require__(6656);
+var toObject = __webpack_require__(7908);
+var sharedKey = __webpack_require__(6200);
+var CORRECT_PROTOTYPE_GETTER = __webpack_require__(8544);
+
+var IE_PROTO = sharedKey('IE_PROTO');
+var ObjectPrototype = Object.prototype;
+
+// `Object.getPrototypeOf` method
+// https://tc39.es/ecma262/#sec-object.getprototypeof
+module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
+ O = toObject(O);
+ if (has(O, IE_PROTO)) return O[IE_PROTO];
+ if (typeof O.constructor == 'function' && O instanceof O.constructor) {
+ return O.constructor.prototype;
+ } return O instanceof Object ? ObjectPrototype : null;
+};
+
+
+/***/ }),
+
+/***/ 6324:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var has = __webpack_require__(6656);
+var toIndexedObject = __webpack_require__(5656);
+var indexOf = __webpack_require__(1318).indexOf;
+var hiddenKeys = __webpack_require__(3501);
+
+module.exports = function (object, names) {
+ var O = toIndexedObject(object);
+ var i = 0;
+ var result = [];
+ var key;
+ for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
+ // Don't enum bug & hidden keys
+ while (names.length > i) if (has(O, key = names[i++])) {
+ ~indexOf(result, key) || result.push(key);
+ }
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 1956:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var internalObjectKeys = __webpack_require__(6324);
+var enumBugKeys = __webpack_require__(748);
+
+// `Object.keys` method
+// https://tc39.es/ecma262/#sec-object.keys
+module.exports = Object.keys || function keys(O) {
+ return internalObjectKeys(O, enumBugKeys);
+};
+
+
+/***/ }),
+
+/***/ 5296:
+/***/ (function(__unused_webpack_module, exports) {
+
+"use strict";
+
+var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
+var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+
+// Nashorn ~ JDK8 bug
+var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
+
+// `Object.prototype.propertyIsEnumerable` method implementation
+// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
+exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
+ var descriptor = getOwnPropertyDescriptor(this, V);
+ return !!descriptor && descriptor.enumerable;
+} : nativePropertyIsEnumerable;
+
+
+/***/ }),
+
+/***/ 7674:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+/* eslint-disable no-proto -- safe */
+var anObject = __webpack_require__(9670);
+var aPossiblePrototype = __webpack_require__(6077);
+
+// `Object.setPrototypeOf` method
+// https://tc39.es/ecma262/#sec-object.setprototypeof
+// Works with __proto__ only. Old v8 can't work with null proto objects.
+module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
+ var CORRECT_SETTER = false;
+ var test = {};
+ var setter;
+ try {
+ setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
+ setter.call(test, []);
+ CORRECT_SETTER = test instanceof Array;
+ } catch (error) { /* empty */ }
+ return function setPrototypeOf(O, proto) {
+ anObject(O);
+ aPossiblePrototype(proto);
+ if (CORRECT_SETTER) setter.call(O, proto);
+ else O.__proto__ = proto;
+ return O;
+ };
+}() : undefined);
+
+
+/***/ }),
+
+/***/ 288:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var TO_STRING_TAG_SUPPORT = __webpack_require__(1694);
+var classof = __webpack_require__(648);
+
+// `Object.prototype.toString` method implementation
+// https://tc39.es/ecma262/#sec-object.prototype.tostring
+module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
+ return '[object ' + classof(this) + ']';
+};
+
+
+/***/ }),
+
+/***/ 3887:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var getBuiltIn = __webpack_require__(5005);
+var getOwnPropertyNamesModule = __webpack_require__(8006);
+var getOwnPropertySymbolsModule = __webpack_require__(5181);
+var anObject = __webpack_require__(9670);
+
+// all object keys, includes non-enumerable and symbols
+module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
+ var keys = getOwnPropertyNamesModule.f(anObject(it));
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
+ return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
+};
+
+
+/***/ }),
+
+/***/ 857:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+
+module.exports = global;
+
+
+/***/ }),
+
+/***/ 2248:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var redefine = __webpack_require__(1320);
+
+module.exports = function (target, src, options) {
+ for (var key in src) redefine(target, key, src[key], options);
+ return target;
+};
+
+
+/***/ }),
+
+/***/ 1320:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var has = __webpack_require__(6656);
+var setGlobal = __webpack_require__(3505);
+var inspectSource = __webpack_require__(2788);
+var InternalStateModule = __webpack_require__(9909);
+
+var getInternalState = InternalStateModule.get;
+var enforceInternalState = InternalStateModule.enforce;
+var TEMPLATE = String(String).split('String');
+
+(module.exports = function (O, key, value, options) {
+ var unsafe = options ? !!options.unsafe : false;
+ var simple = options ? !!options.enumerable : false;
+ var noTargetGet = options ? !!options.noTargetGet : false;
+ var state;
+ if (typeof value == 'function') {
+ if (typeof key == 'string' && !has(value, 'name')) {
+ createNonEnumerableProperty(value, 'name', key);
+ }
+ state = enforceInternalState(value);
+ if (!state.source) {
+ state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ }
+ }
+ if (O === global) {
+ if (simple) O[key] = value;
+ else setGlobal(key, value);
+ return;
+ } else if (!unsafe) {
+ delete O[key];
+ } else if (!noTargetGet && O[key]) {
+ simple = true;
+ }
+ if (simple) O[key] = value;
+ else createNonEnumerableProperty(O, key, value);
+// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
+})(Function.prototype, 'toString', function toString() {
+ return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
+});
+
+
+/***/ }),
+
+/***/ 7651:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var classof = __webpack_require__(4326);
+var regexpExec = __webpack_require__(2261);
+
+// `RegExpExec` abstract operation
+// https://tc39.es/ecma262/#sec-regexpexec
+module.exports = function (R, S) {
+ var exec = R.exec;
+ if (typeof exec === 'function') {
+ var result = exec.call(R, S);
+ if (typeof result !== 'object') {
+ throw TypeError('RegExp exec method returned something other than an Object or null');
+ }
+ return result;
+ }
+
+ if (classof(R) !== 'RegExp') {
+ throw TypeError('RegExp#exec called on incompatible receiver');
+ }
+
+ return regexpExec.call(R, S);
+};
+
+
+
+/***/ }),
+
+/***/ 2261:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var regexpFlags = __webpack_require__(7066);
+var stickyHelpers = __webpack_require__(2999);
+
+var nativeExec = RegExp.prototype.exec;
+// This always refers to the native implementation, because the
+// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
+// which loads this file before patching the method.
+var nativeReplace = String.prototype.replace;
+
+var patchedExec = nativeExec;
+
+var UPDATES_LAST_INDEX_WRONG = (function () {
+ var re1 = /a/;
+ var re2 = /b*/g;
+ nativeExec.call(re1, 'a');
+ nativeExec.call(re2, 'a');
+ return re1.lastIndex !== 0 || re2.lastIndex !== 0;
+})();
+
+var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
+
+// nonparticipating capturing group, copied from es5-shim's String#split patch.
+// eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
+var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
+
+var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y;
+
+if (PATCH) {
+ patchedExec = function exec(str) {
+ var re = this;
+ var lastIndex, reCopy, match, i;
+ var sticky = UNSUPPORTED_Y && re.sticky;
+ var flags = regexpFlags.call(re);
+ var source = re.source;
+ var charsAdded = 0;
+ var strCopy = str;
+
+ if (sticky) {
+ flags = flags.replace('y', '');
+ if (flags.indexOf('g') === -1) {
+ flags += 'g';
+ }
+
+ strCopy = String(str).slice(re.lastIndex);
+ // Support anchored sticky behavior.
+ if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
+ source = '(?: ' + source + ')';
+ strCopy = ' ' + strCopy;
+ charsAdded++;
+ }
+ // ^(? + rx + ) is needed, in combination with some str slicing, to
+ // simulate the 'y' flag.
+ reCopy = new RegExp('^(?:' + source + ')', flags);
+ }
+
+ if (NPCG_INCLUDED) {
+ reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
+ }
+ if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
+
+ match = nativeExec.call(sticky ? reCopy : re, strCopy);
+
+ if (sticky) {
+ if (match) {
+ match.input = match.input.slice(charsAdded);
+ match[0] = match[0].slice(charsAdded);
+ match.index = re.lastIndex;
+ re.lastIndex += match[0].length;
+ } else re.lastIndex = 0;
+ } else if (UPDATES_LAST_INDEX_WRONG && match) {
+ re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
+ }
+ if (NPCG_INCLUDED && match && match.length > 1) {
+ // Fix browsers whose `exec` methods don't consistently return `undefined`
+ // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
+ nativeReplace.call(match[0], reCopy, function () {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+
+ return match;
+ };
+}
+
+module.exports = patchedExec;
+
+
+/***/ }),
+
+/***/ 7066:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var anObject = __webpack_require__(9670);
+
+// `RegExp.prototype.flags` getter implementation
+// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
+module.exports = function () {
+ var that = anObject(this);
+ var result = '';
+ if (that.global) result += 'g';
+ if (that.ignoreCase) result += 'i';
+ if (that.multiline) result += 'm';
+ if (that.dotAll) result += 's';
+ if (that.unicode) result += 'u';
+ if (that.sticky) result += 'y';
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 2999:
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var fails = __webpack_require__(7293);
+
+// babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
+// so we use an intermediate function.
+function RE(s, f) {
+ return RegExp(s, f);
+}
+
+exports.UNSUPPORTED_Y = fails(function () {
+ // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
+ var re = RE('a', 'y');
+ re.lastIndex = 2;
+ return re.exec('abcd') != null;
+});
+
+exports.BROKEN_CARET = fails(function () {
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
+ var re = RE('^r', 'gy');
+ re.lastIndex = 2;
+ return re.exec('str') != null;
+});
+
+
+/***/ }),
+
+/***/ 4488:
+/***/ (function(module) {
+
+// `RequireObjectCoercible` abstract operation
+// https://tc39.es/ecma262/#sec-requireobjectcoercible
+module.exports = function (it) {
+ if (it == undefined) throw TypeError("Can't call method on " + it);
+ return it;
+};
+
+
+/***/ }),
+
+/***/ 3505:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var createNonEnumerableProperty = __webpack_require__(8880);
+
+module.exports = function (key, value) {
+ try {
+ createNonEnumerableProperty(global, key, value);
+ } catch (error) {
+ global[key] = value;
+ } return value;
+};
+
+
+/***/ }),
+
+/***/ 6340:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var getBuiltIn = __webpack_require__(5005);
+var definePropertyModule = __webpack_require__(3070);
+var wellKnownSymbol = __webpack_require__(5112);
+var DESCRIPTORS = __webpack_require__(9781);
+
+var SPECIES = wellKnownSymbol('species');
+
+module.exports = function (CONSTRUCTOR_NAME) {
+ var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
+ var defineProperty = definePropertyModule.f;
+
+ if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
+ defineProperty(Constructor, SPECIES, {
+ configurable: true,
+ get: function () { return this; }
+ });
+ }
+};
+
+
+/***/ }),
+
+/***/ 8003:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var defineProperty = __webpack_require__(3070).f;
+var has = __webpack_require__(6656);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+
+module.exports = function (it, TAG, STATIC) {
+ if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
+ defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
+ }
+};
+
+
+/***/ }),
+
+/***/ 6200:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var shared = __webpack_require__(2309);
+var uid = __webpack_require__(9711);
+
+var keys = shared('keys');
+
+module.exports = function (key) {
+ return keys[key] || (keys[key] = uid(key));
+};
+
+
+/***/ }),
+
+/***/ 5465:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var setGlobal = __webpack_require__(3505);
+
+var SHARED = '__core-js_shared__';
+var store = global[SHARED] || setGlobal(SHARED, {});
+
+module.exports = store;
+
+
+/***/ }),
+
+/***/ 2309:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var IS_PURE = __webpack_require__(1913);
+var store = __webpack_require__(5465);
+
+(module.exports = function (key, value) {
+ return store[key] || (store[key] = value !== undefined ? value : {});
+})('versions', []).push({
+ version: '3.9.0',
+ mode: IS_PURE ? 'pure' : 'global',
+ copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
+});
+
+
+/***/ }),
+
+/***/ 6707:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var anObject = __webpack_require__(9670);
+var aFunction = __webpack_require__(3099);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var SPECIES = wellKnownSymbol('species');
+
+// `SpeciesConstructor` abstract operation
+// https://tc39.es/ecma262/#sec-speciesconstructor
+module.exports = function (O, defaultConstructor) {
+ var C = anObject(O).constructor;
+ var S;
+ return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
+};
+
+
+/***/ }),
+
+/***/ 8710:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toInteger = __webpack_require__(9958);
+var requireObjectCoercible = __webpack_require__(4488);
+
+// `String.prototype.{ codePointAt, at }` methods implementation
+var createMethod = function (CONVERT_TO_STRING) {
+ return function ($this, pos) {
+ var S = String(requireObjectCoercible($this));
+ var position = toInteger(pos);
+ var size = S.length;
+ var first, second;
+ if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
+ first = S.charCodeAt(position);
+ return first < 0xD800 || first > 0xDBFF || position + 1 === size
+ || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
+ ? CONVERT_TO_STRING ? S.charAt(position) : first
+ : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
+ };
+};
+
+module.exports = {
+ // `String.prototype.codePointAt` method
+ // https://tc39.es/ecma262/#sec-string.prototype.codepointat
+ codeAt: createMethod(false),
+ // `String.prototype.at` method
+ // https://github.com/mathiasbynens/String.prototype.at
+ charAt: createMethod(true)
+};
+
+
+/***/ }),
+
+/***/ 3197:
+/***/ (function(module) {
+
+"use strict";
+
+// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
+var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
+var base = 36;
+var tMin = 1;
+var tMax = 26;
+var skew = 38;
+var damp = 700;
+var initialBias = 72;
+var initialN = 128; // 0x80
+var delimiter = '-'; // '\x2D'
+var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
+var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
+var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
+var baseMinusTMin = base - tMin;
+var floor = Math.floor;
+var stringFromCharCode = String.fromCharCode;
+
+/**
+ * Creates an array containing the numeric code points of each Unicode
+ * character in the string. While JavaScript uses UCS-2 internally,
+ * this function will convert a pair of surrogate halves (each of which
+ * UCS-2 exposes as separate characters) into a single code point,
+ * matching UTF-16.
+ */
+var ucs2decode = function (string) {
+ var output = [];
+ var counter = 0;
+ var length = string.length;
+ while (counter < length) {
+ var value = string.charCodeAt(counter++);
+ if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ // It's a high surrogate, and there is a next character.
+ var extra = string.charCodeAt(counter++);
+ if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
+ output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ } else {
+ // It's an unmatched surrogate; only append this code unit, in case the
+ // next code unit is the high surrogate of a surrogate pair.
+ output.push(value);
+ counter--;
+ }
+ } else {
+ output.push(value);
+ }
+ }
+ return output;
+};
+
+/**
+ * Converts a digit/integer into a basic code point.
+ */
+var digitToBasic = function (digit) {
+ // 0..25 map to ASCII a..z or A..Z
+ // 26..35 map to ASCII 0..9
+ return digit + 22 + 75 * (digit < 26);
+};
+
+/**
+ * Bias adaptation function as per section 3.4 of RFC 3492.
+ * https://tools.ietf.org/html/rfc3492#section-3.4
+ */
+var adapt = function (delta, numPoints, firstTime) {
+ var k = 0;
+ delta = firstTime ? floor(delta / damp) : delta >> 1;
+ delta += floor(delta / numPoints);
+ for (; delta > baseMinusTMin * tMax >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin);
+ }
+ return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+};
+
+/**
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
+ */
+// eslint-disable-next-line max-statements -- TODO
+var encode = function (input) {
+ var output = [];
+
+ // Convert the input in UCS-2 to an array of Unicode code points.
+ input = ucs2decode(input);
+
+ // Cache the length.
+ var inputLength = input.length;
+
+ // Initialize the state.
+ var n = initialN;
+ var delta = 0;
+ var bias = initialBias;
+ var i, currentValue;
+
+ // Handle the basic code points.
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < 0x80) {
+ output.push(stringFromCharCode(currentValue));
+ }
+ }
+
+ var basicLength = output.length; // number of basic code points.
+ var handledCPCount = basicLength; // number of code points that have been handled;
+
+ // Finish the basic string with a delimiter unless it's empty.
+ if (basicLength) {
+ output.push(delimiter);
+ }
+
+ // Main encoding loop:
+ while (handledCPCount < inputLength) {
+ // All non-basic code points < n have been handled already. Find the next larger one:
+ var m = maxInt;
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue >= n && currentValue < m) {
+ m = currentValue;
+ }
+ }
+
+ // Increase `delta` enough to advance the decoder's state to , but guard against overflow.
+ var handledCPCountPlusOne = handledCPCount + 1;
+ if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+
+ delta += (m - n) * handledCPCountPlusOne;
+ n = m;
+
+ for (i = 0; i < input.length; i++) {
+ currentValue = input[i];
+ if (currentValue < n && ++delta > maxInt) {
+ throw RangeError(OVERFLOW_ERROR);
+ }
+ if (currentValue == n) {
+ // Represent delta as a generalized variable-length integer.
+ var q = delta;
+ for (var k = base; /* no condition */; k += base) {
+ var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ if (q < t) break;
+ var qMinusT = q - t;
+ var baseMinusT = base - t;
+ output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
+ q = floor(qMinusT / baseMinusT);
+ }
+
+ output.push(stringFromCharCode(digitToBasic(q)));
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
+ delta = 0;
+ ++handledCPCount;
+ }
+ }
+
+ ++delta;
+ ++n;
+ }
+ return output.join('');
+};
+
+module.exports = function (input) {
+ var encoded = [];
+ var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
+ var i, label;
+ for (i = 0; i < labels.length; i++) {
+ label = labels[i];
+ encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
+ }
+ return encoded.join('.');
+};
+
+
+/***/ }),
+
+/***/ 6091:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var fails = __webpack_require__(7293);
+var whitespaces = __webpack_require__(1361);
+
+var non = '\u200B\u0085\u180E';
+
+// check that a method works with the correct list
+// of whitespaces and has a correct name
+module.exports = function (METHOD_NAME) {
+ return fails(function () {
+ return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
+ });
+};
+
+
+/***/ }),
+
+/***/ 3111:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var requireObjectCoercible = __webpack_require__(4488);
+var whitespaces = __webpack_require__(1361);
+
+var whitespace = '[' + whitespaces + ']';
+var ltrim = RegExp('^' + whitespace + whitespace + '*');
+var rtrim = RegExp(whitespace + whitespace + '*$');
+
+// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
+var createMethod = function (TYPE) {
+ return function ($this) {
+ var string = String(requireObjectCoercible($this));
+ if (TYPE & 1) string = string.replace(ltrim, '');
+ if (TYPE & 2) string = string.replace(rtrim, '');
+ return string;
+ };
+};
+
+module.exports = {
+ // `String.prototype.{ trimLeft, trimStart }` methods
+ // https://tc39.es/ecma262/#sec-string.prototype.trimstart
+ start: createMethod(1),
+ // `String.prototype.{ trimRight, trimEnd }` methods
+ // https://tc39.es/ecma262/#sec-string.prototype.trimend
+ end: createMethod(2),
+ // `String.prototype.trim` method
+ // https://tc39.es/ecma262/#sec-string.prototype.trim
+ trim: createMethod(3)
+};
+
+
+/***/ }),
+
+/***/ 1400:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toInteger = __webpack_require__(9958);
+
+var max = Math.max;
+var min = Math.min;
+
+// Helper for a popular repeating case of the spec:
+// Let integer be ? ToInteger(index).
+// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
+module.exports = function (index, length) {
+ var integer = toInteger(index);
+ return integer < 0 ? max(integer + length, 0) : min(integer, length);
+};
+
+
+/***/ }),
+
+/***/ 7067:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toInteger = __webpack_require__(9958);
+var toLength = __webpack_require__(7466);
+
+// `ToIndex` abstract operation
+// https://tc39.es/ecma262/#sec-toindex
+module.exports = function (it) {
+ if (it === undefined) return 0;
+ var number = toInteger(it);
+ var length = toLength(number);
+ if (number !== length) throw RangeError('Wrong length or index');
+ return length;
+};
+
+
+/***/ }),
+
+/***/ 5656:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+// toObject with fallback for non-array-like ES3 strings
+var IndexedObject = __webpack_require__(8361);
+var requireObjectCoercible = __webpack_require__(4488);
+
+module.exports = function (it) {
+ return IndexedObject(requireObjectCoercible(it));
+};
+
+
+/***/ }),
+
+/***/ 9958:
+/***/ (function(module) {
+
+var ceil = Math.ceil;
+var floor = Math.floor;
+
+// `ToInteger` abstract operation
+// https://tc39.es/ecma262/#sec-tointeger
+module.exports = function (argument) {
+ return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
+};
+
+
+/***/ }),
+
+/***/ 7466:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toInteger = __webpack_require__(9958);
+
+var min = Math.min;
+
+// `ToLength` abstract operation
+// https://tc39.es/ecma262/#sec-tolength
+module.exports = function (argument) {
+ return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
+};
+
+
+/***/ }),
+
+/***/ 7908:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var requireObjectCoercible = __webpack_require__(4488);
+
+// `ToObject` abstract operation
+// https://tc39.es/ecma262/#sec-toobject
+module.exports = function (argument) {
+ return Object(requireObjectCoercible(argument));
+};
+
+
+/***/ }),
+
+/***/ 4590:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toPositiveInteger = __webpack_require__(3002);
+
+module.exports = function (it, BYTES) {
+ var offset = toPositiveInteger(it);
+ if (offset % BYTES) throw RangeError('Wrong offset');
+ return offset;
+};
+
+
+/***/ }),
+
+/***/ 3002:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toInteger = __webpack_require__(9958);
+
+module.exports = function (it) {
+ var result = toInteger(it);
+ if (result < 0) throw RangeError("The argument can't be less than 0");
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 7593:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var isObject = __webpack_require__(111);
+
+// `ToPrimitive` abstract operation
+// https://tc39.es/ecma262/#sec-toprimitive
+// instead of the ES6 spec version, we didn't implement @@toPrimitive case
+// and the second argument - flag - preferred type is a string
+module.exports = function (input, PREFERRED_STRING) {
+ if (!isObject(input)) return input;
+ var fn, val;
+ if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
+ if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
+ throw TypeError("Can't convert object to primitive value");
+};
+
+
+/***/ }),
+
+/***/ 1694:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var wellKnownSymbol = __webpack_require__(5112);
+
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var test = {};
+
+test[TO_STRING_TAG] = 'z';
+
+module.exports = String(test) === '[object z]';
+
+
+/***/ }),
+
+/***/ 9843:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var global = __webpack_require__(7854);
+var DESCRIPTORS = __webpack_require__(9781);
+var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(3832);
+var ArrayBufferViewCore = __webpack_require__(260);
+var ArrayBufferModule = __webpack_require__(3331);
+var anInstance = __webpack_require__(5787);
+var createPropertyDescriptor = __webpack_require__(9114);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var toLength = __webpack_require__(7466);
+var toIndex = __webpack_require__(7067);
+var toOffset = __webpack_require__(4590);
+var toPrimitive = __webpack_require__(7593);
+var has = __webpack_require__(6656);
+var classof = __webpack_require__(648);
+var isObject = __webpack_require__(111);
+var create = __webpack_require__(30);
+var setPrototypeOf = __webpack_require__(7674);
+var getOwnPropertyNames = __webpack_require__(8006).f;
+var typedArrayFrom = __webpack_require__(7321);
+var forEach = __webpack_require__(2092).forEach;
+var setSpecies = __webpack_require__(6340);
+var definePropertyModule = __webpack_require__(3070);
+var getOwnPropertyDescriptorModule = __webpack_require__(1236);
+var InternalStateModule = __webpack_require__(9909);
+var inheritIfRequired = __webpack_require__(9587);
+
+var getInternalState = InternalStateModule.get;
+var setInternalState = InternalStateModule.set;
+var nativeDefineProperty = definePropertyModule.f;
+var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
+var round = Math.round;
+var RangeError = global.RangeError;
+var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
+var DataView = ArrayBufferModule.DataView;
+var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
+var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
+var TypedArray = ArrayBufferViewCore.TypedArray;
+var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
+var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
+var isTypedArray = ArrayBufferViewCore.isTypedArray;
+var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
+var WRONG_LENGTH = 'Wrong length';
+
+var fromList = function (C, list) {
+ var index = 0;
+ var length = list.length;
+ var result = new (aTypedArrayConstructor(C))(length);
+ while (length > index) result[index] = list[index++];
+ return result;
+};
+
+var addGetter = function (it, key) {
+ nativeDefineProperty(it, key, { get: function () {
+ return getInternalState(this)[key];
+ } });
+};
+
+var isArrayBuffer = function (it) {
+ var klass;
+ return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
+};
+
+var isTypedArrayIndex = function (target, key) {
+ return isTypedArray(target)
+ && typeof key != 'symbol'
+ && key in target
+ && String(+key) == String(key);
+};
+
+var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
+ return isTypedArrayIndex(target, key = toPrimitive(key, true))
+ ? createPropertyDescriptor(2, target[key])
+ : nativeGetOwnPropertyDescriptor(target, key);
+};
+
+var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
+ if (isTypedArrayIndex(target, key = toPrimitive(key, true))
+ && isObject(descriptor)
+ && has(descriptor, 'value')
+ && !has(descriptor, 'get')
+ && !has(descriptor, 'set')
+ // TODO: add validation descriptor w/o calling accessors
+ && !descriptor.configurable
+ && (!has(descriptor, 'writable') || descriptor.writable)
+ && (!has(descriptor, 'enumerable') || descriptor.enumerable)
+ ) {
+ target[key] = descriptor.value;
+ return target;
+ } return nativeDefineProperty(target, key, descriptor);
+};
+
+if (DESCRIPTORS) {
+ if (!NATIVE_ARRAY_BUFFER_VIEWS) {
+ getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
+ definePropertyModule.f = wrappedDefineProperty;
+ addGetter(TypedArrayPrototype, 'buffer');
+ addGetter(TypedArrayPrototype, 'byteOffset');
+ addGetter(TypedArrayPrototype, 'byteLength');
+ addGetter(TypedArrayPrototype, 'length');
+ }
+
+ $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
+ getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
+ defineProperty: wrappedDefineProperty
+ });
+
+ module.exports = function (TYPE, wrapper, CLAMPED) {
+ var BYTES = TYPE.match(/\d+$/)[0] / 8;
+ var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
+ var GETTER = 'get' + TYPE;
+ var SETTER = 'set' + TYPE;
+ var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
+ var TypedArrayConstructor = NativeTypedArrayConstructor;
+ var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
+ var exported = {};
+
+ var getter = function (that, index) {
+ var data = getInternalState(that);
+ return data.view[GETTER](index * BYTES + data.byteOffset, true);
+ };
+
+ var setter = function (that, index, value) {
+ var data = getInternalState(that);
+ if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
+ data.view[SETTER](index * BYTES + data.byteOffset, value, true);
+ };
+
+ var addElement = function (that, index) {
+ nativeDefineProperty(that, index, {
+ get: function () {
+ return getter(this, index);
+ },
+ set: function (value) {
+ return setter(this, index, value);
+ },
+ enumerable: true
+ });
+ };
+
+ if (!NATIVE_ARRAY_BUFFER_VIEWS) {
+ TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
+ anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME);
+ var index = 0;
+ var byteOffset = 0;
+ var buffer, byteLength, length;
+ if (!isObject(data)) {
+ length = toIndex(data);
+ byteLength = length * BYTES;
+ buffer = new ArrayBuffer(byteLength);
+ } else if (isArrayBuffer(data)) {
+ buffer = data;
+ byteOffset = toOffset(offset, BYTES);
+ var $len = data.byteLength;
+ if ($length === undefined) {
+ if ($len % BYTES) throw RangeError(WRONG_LENGTH);
+ byteLength = $len - byteOffset;
+ if (byteLength < 0) throw RangeError(WRONG_LENGTH);
+ } else {
+ byteLength = toLength($length) * BYTES;
+ if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH);
+ }
+ length = byteLength / BYTES;
+ } else if (isTypedArray(data)) {
+ return fromList(TypedArrayConstructor, data);
+ } else {
+ return typedArrayFrom.call(TypedArrayConstructor, data);
+ }
+ setInternalState(that, {
+ buffer: buffer,
+ byteOffset: byteOffset,
+ byteLength: byteLength,
+ length: length,
+ view: new DataView(buffer)
+ });
+ while (index < length) addElement(that, index++);
+ });
+
+ if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
+ TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
+ } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
+ TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
+ anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME);
+ return inheritIfRequired(function () {
+ if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
+ if (isArrayBuffer(data)) return $length !== undefined
+ ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length)
+ : typedArrayOffset !== undefined
+ ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
+ : new NativeTypedArrayConstructor(data);
+ if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
+ return typedArrayFrom.call(TypedArrayConstructor, data);
+ }(), dummy, TypedArrayConstructor);
+ });
+
+ if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
+ forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
+ if (!(key in TypedArrayConstructor)) {
+ createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
+ }
+ });
+ TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
+ }
+
+ if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
+ }
+
+ if (TYPED_ARRAY_TAG) {
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
+ }
+
+ exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
+
+ $({
+ global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
+ }, exported);
+
+ if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
+ createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
+ }
+
+ if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
+ }
+
+ setSpecies(CONSTRUCTOR_NAME);
+ };
+} else module.exports = function () { /* empty */ };
+
+
+/***/ }),
+
+/***/ 3832:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+/* eslint-disable no-new -- required for testing */
+var global = __webpack_require__(7854);
+var fails = __webpack_require__(7293);
+var checkCorrectnessOfIteration = __webpack_require__(7072);
+var NATIVE_ARRAY_BUFFER_VIEWS = __webpack_require__(260).NATIVE_ARRAY_BUFFER_VIEWS;
+
+var ArrayBuffer = global.ArrayBuffer;
+var Int8Array = global.Int8Array;
+
+module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
+ Int8Array(1);
+}) || !fails(function () {
+ new Int8Array(-1);
+}) || !checkCorrectnessOfIteration(function (iterable) {
+ new Int8Array();
+ new Int8Array(null);
+ new Int8Array(1.5);
+ new Int8Array(iterable);
+}, true) || fails(function () {
+ // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
+ return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
+});
+
+
+/***/ }),
+
+/***/ 3074:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var aTypedArrayConstructor = __webpack_require__(260).aTypedArrayConstructor;
+var speciesConstructor = __webpack_require__(6707);
+
+module.exports = function (instance, list) {
+ var C = speciesConstructor(instance, instance.constructor);
+ var index = 0;
+ var length = list.length;
+ var result = new (aTypedArrayConstructor(C))(length);
+ while (length > index) result[index] = list[index++];
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 7321:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var toObject = __webpack_require__(7908);
+var toLength = __webpack_require__(7466);
+var getIteratorMethod = __webpack_require__(1246);
+var isArrayIteratorMethod = __webpack_require__(7659);
+var bind = __webpack_require__(9974);
+var aTypedArrayConstructor = __webpack_require__(260).aTypedArrayConstructor;
+
+module.exports = function from(source /* , mapfn, thisArg */) {
+ var O = toObject(source);
+ var argumentsLength = arguments.length;
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
+ var mapping = mapfn !== undefined;
+ var iteratorMethod = getIteratorMethod(O);
+ var i, length, result, step, iterator, next;
+ if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) {
+ iterator = iteratorMethod.call(O);
+ next = iterator.next;
+ O = [];
+ while (!(step = next.call(iterator)).done) {
+ O.push(step.value);
+ }
+ }
+ if (mapping && argumentsLength > 2) {
+ mapfn = bind(mapfn, arguments[2], 2);
+ }
+ length = toLength(O.length);
+ result = new (aTypedArrayConstructor(this))(length);
+ for (i = 0; length > i; i++) {
+ result[i] = mapping ? mapfn(O[i], i) : O[i];
+ }
+ return result;
+};
+
+
+/***/ }),
+
+/***/ 9711:
+/***/ (function(module) {
+
+var id = 0;
+var postfix = Math.random();
+
+module.exports = function (key) {
+ return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
+};
+
+
+/***/ }),
+
+/***/ 3307:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var NATIVE_SYMBOL = __webpack_require__(133);
+
+module.exports = NATIVE_SYMBOL
+ /* global Symbol -- safe */
+ && !Symbol.sham
+ && typeof Symbol.iterator == 'symbol';
+
+
+/***/ }),
+
+/***/ 5112:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var shared = __webpack_require__(2309);
+var has = __webpack_require__(6656);
+var uid = __webpack_require__(9711);
+var NATIVE_SYMBOL = __webpack_require__(133);
+var USE_SYMBOL_AS_UID = __webpack_require__(3307);
+
+var WellKnownSymbolsStore = shared('wks');
+var Symbol = global.Symbol;
+var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
+
+module.exports = function (name) {
+ if (!has(WellKnownSymbolsStore, name)) {
+ if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
+ else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
+ } return WellKnownSymbolsStore[name];
+};
+
+
+/***/ }),
+
+/***/ 1361:
+/***/ (function(module) {
+
+// a string of all valid unicode whitespaces
+module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
+ '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
+
+
+/***/ }),
+
+/***/ 8264:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var global = __webpack_require__(7854);
+var arrayBufferModule = __webpack_require__(3331);
+var setSpecies = __webpack_require__(6340);
+
+var ARRAY_BUFFER = 'ArrayBuffer';
+var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER];
+var NativeArrayBuffer = global[ARRAY_BUFFER];
+
+// `ArrayBuffer` constructor
+// https://tc39.es/ecma262/#sec-arraybuffer-constructor
+$({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
+ ArrayBuffer: ArrayBuffer
+});
+
+setSpecies(ARRAY_BUFFER);
+
+
+/***/ }),
+
+/***/ 2222:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var fails = __webpack_require__(7293);
+var isArray = __webpack_require__(3157);
+var isObject = __webpack_require__(111);
+var toObject = __webpack_require__(7908);
+var toLength = __webpack_require__(7466);
+var createProperty = __webpack_require__(6135);
+var arraySpeciesCreate = __webpack_require__(5417);
+var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
+var wellKnownSymbol = __webpack_require__(5112);
+var V8_VERSION = __webpack_require__(7392);
+
+var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
+var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
+var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
+
+// We can't use this feature detection in V8 since it causes
+// deoptimization and serious performance degradation
+// https://github.com/zloirock/core-js/issues/679
+var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
+ var array = [];
+ array[IS_CONCAT_SPREADABLE] = false;
+ return array.concat()[0] !== array;
+});
+
+var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
+
+var isConcatSpreadable = function (O) {
+ if (!isObject(O)) return false;
+ var spreadable = O[IS_CONCAT_SPREADABLE];
+ return spreadable !== undefined ? !!spreadable : isArray(O);
+};
+
+var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
+
+// `Array.prototype.concat` method
+// https://tc39.es/ecma262/#sec-array.prototype.concat
+// with adding support of @@isConcatSpreadable and @@species
+$({ target: 'Array', proto: true, forced: FORCED }, {
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
+ concat: function concat(arg) {
+ var O = toObject(this);
+ var A = arraySpeciesCreate(O, 0);
+ var n = 0;
+ var i, k, length, len, E;
+ for (i = -1, length = arguments.length; i < length; i++) {
+ E = i === -1 ? O : arguments[i];
+ if (isConcatSpreadable(E)) {
+ len = toLength(E.length);
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
+ } else {
+ if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
+ createProperty(A, n++, E);
+ }
+ }
+ A.length = n;
+ return A;
+ }
+});
+
+
+/***/ }),
+
+/***/ 7327:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var $filter = __webpack_require__(2092).filter;
+var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
+
+var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
+
+// `Array.prototype.filter` method
+// https://tc39.es/ecma262/#sec-array.prototype.filter
+// with adding support of @@species
+$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
+ filter: function filter(callbackfn /* , thisArg */) {
+ return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+
+/***/ }),
+
+/***/ 2772:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var $indexOf = __webpack_require__(1318).indexOf;
+var arrayMethodIsStrict = __webpack_require__(9341);
+
+var nativeIndexOf = [].indexOf;
+
+var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
+var STRICT_METHOD = arrayMethodIsStrict('indexOf');
+
+// `Array.prototype.indexOf` method
+// https://tc39.es/ecma262/#sec-array.prototype.indexof
+$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
+ indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
+ return NEGATIVE_ZERO
+ // convert -0 to +0
+ ? nativeIndexOf.apply(this, arguments) || 0
+ : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+
+/***/ }),
+
+/***/ 6992:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var toIndexedObject = __webpack_require__(5656);
+var addToUnscopables = __webpack_require__(1223);
+var Iterators = __webpack_require__(7497);
+var InternalStateModule = __webpack_require__(9909);
+var defineIterator = __webpack_require__(654);
+
+var ARRAY_ITERATOR = 'Array Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
+
+// `Array.prototype.entries` method
+// https://tc39.es/ecma262/#sec-array.prototype.entries
+// `Array.prototype.keys` method
+// https://tc39.es/ecma262/#sec-array.prototype.keys
+// `Array.prototype.values` method
+// https://tc39.es/ecma262/#sec-array.prototype.values
+// `Array.prototype[@@iterator]` method
+// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
+// `CreateArrayIterator` internal method
+// https://tc39.es/ecma262/#sec-createarrayiterator
+module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
+ setInternalState(this, {
+ type: ARRAY_ITERATOR,
+ target: toIndexedObject(iterated), // target
+ index: 0, // next index
+ kind: kind // kind
+ });
+// `%ArrayIteratorPrototype%.next` method
+// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
+}, function () {
+ var state = getInternalState(this);
+ var target = state.target;
+ var kind = state.kind;
+ var index = state.index++;
+ if (!target || index >= target.length) {
+ state.target = undefined;
+ return { value: undefined, done: true };
+ }
+ if (kind == 'keys') return { value: index, done: false };
+ if (kind == 'values') return { value: target[index], done: false };
+ return { value: [index, target[index]], done: false };
+}, 'values');
+
+// argumentsList[@@iterator] is %ArrayProto_values%
+// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
+// https://tc39.es/ecma262/#sec-createmappedargumentsobject
+Iterators.Arguments = Iterators.Array;
+
+// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
+addToUnscopables('keys');
+addToUnscopables('values');
+addToUnscopables('entries');
+
+
+/***/ }),
+
+/***/ 1249:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var $map = __webpack_require__(2092).map;
+var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
+
+var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
+
+// `Array.prototype.map` method
+// https://tc39.es/ecma262/#sec-array.prototype.map
+// with adding support of @@species
+$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
+ map: function map(callbackfn /* , thisArg */) {
+ return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ }
+});
+
+
+/***/ }),
+
+/***/ 7042:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var isObject = __webpack_require__(111);
+var isArray = __webpack_require__(3157);
+var toAbsoluteIndex = __webpack_require__(1400);
+var toLength = __webpack_require__(7466);
+var toIndexedObject = __webpack_require__(5656);
+var createProperty = __webpack_require__(6135);
+var wellKnownSymbol = __webpack_require__(5112);
+var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
+
+var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
+
+var SPECIES = wellKnownSymbol('species');
+var nativeSlice = [].slice;
+var max = Math.max;
+
+// `Array.prototype.slice` method
+// https://tc39.es/ecma262/#sec-array.prototype.slice
+// fallback for not array-like ES3 strings and DOM objects
+$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
+ slice: function slice(start, end) {
+ var O = toIndexedObject(this);
+ var length = toLength(O.length);
+ var k = toAbsoluteIndex(start, length);
+ var fin = toAbsoluteIndex(end === undefined ? length : end, length);
+ // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
+ var Constructor, result, n;
+ if (isArray(O)) {
+ Constructor = O.constructor;
+ // cross-realm fallback
+ if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
+ Constructor = undefined;
+ } else if (isObject(Constructor)) {
+ Constructor = Constructor[SPECIES];
+ if (Constructor === null) Constructor = undefined;
+ }
+ if (Constructor === Array || Constructor === undefined) {
+ return nativeSlice.call(O, k, fin);
+ }
+ }
+ result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
+ for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
+ result.length = n;
+ return result;
+ }
+});
+
+
+/***/ }),
+
+/***/ 561:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var toAbsoluteIndex = __webpack_require__(1400);
+var toInteger = __webpack_require__(9958);
+var toLength = __webpack_require__(7466);
+var toObject = __webpack_require__(7908);
+var arraySpeciesCreate = __webpack_require__(5417);
+var createProperty = __webpack_require__(6135);
+var arrayMethodHasSpeciesSupport = __webpack_require__(1194);
+
+var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
+
+var max = Math.max;
+var min = Math.min;
+var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
+var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
+
+// `Array.prototype.splice` method
+// https://tc39.es/ecma262/#sec-array.prototype.splice
+// with adding support of @@species
+$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
+ splice: function splice(start, deleteCount /* , ...items */) {
+ var O = toObject(this);
+ var len = toLength(O.length);
+ var actualStart = toAbsoluteIndex(start, len);
+ var argumentsLength = arguments.length;
+ var insertCount, actualDeleteCount, A, k, from, to;
+ if (argumentsLength === 0) {
+ insertCount = actualDeleteCount = 0;
+ } else if (argumentsLength === 1) {
+ insertCount = 0;
+ actualDeleteCount = len - actualStart;
+ } else {
+ insertCount = argumentsLength - 2;
+ actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
+ }
+ if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
+ throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
+ }
+ A = arraySpeciesCreate(O, actualDeleteCount);
+ for (k = 0; k < actualDeleteCount; k++) {
+ from = actualStart + k;
+ if (from in O) createProperty(A, k, O[from]);
+ }
+ A.length = actualDeleteCount;
+ if (insertCount < actualDeleteCount) {
+ for (k = actualStart; k < len - actualDeleteCount; k++) {
+ from = k + actualDeleteCount;
+ to = k + insertCount;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
+ } else if (insertCount > actualDeleteCount) {
+ for (k = len - actualDeleteCount; k > actualStart; k--) {
+ from = k + actualDeleteCount - 1;
+ to = k + insertCount - 1;
+ if (from in O) O[to] = O[from];
+ else delete O[to];
+ }
+ }
+ for (k = 0; k < insertCount; k++) {
+ O[k + actualStart] = arguments[k + 2];
+ }
+ O.length = len - actualDeleteCount + insertCount;
+ return A;
+ }
+});
+
+
+/***/ }),
+
+/***/ 8309:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var DESCRIPTORS = __webpack_require__(9781);
+var defineProperty = __webpack_require__(3070).f;
+
+var FunctionPrototype = Function.prototype;
+var FunctionPrototypeToString = FunctionPrototype.toString;
+var nameRE = /^\s*function ([^ (]*)/;
+var NAME = 'name';
+
+// Function instances `.name` property
+// https://tc39.es/ecma262/#sec-function-instances-name
+if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
+ defineProperty(FunctionPrototype, NAME, {
+ configurable: true,
+ get: function () {
+ try {
+ return FunctionPrototypeToString.call(this).match(nameRE)[1];
+ } catch (error) {
+ return '';
+ }
+ }
+ });
+}
+
+
+/***/ }),
+
+/***/ 489:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var $ = __webpack_require__(2109);
+var fails = __webpack_require__(7293);
+var toObject = __webpack_require__(7908);
+var nativeGetPrototypeOf = __webpack_require__(9518);
+var CORRECT_PROTOTYPE_GETTER = __webpack_require__(8544);
+
+var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });
+
+// `Object.getPrototypeOf` method
+// https://tc39.es/ecma262/#sec-object.getprototypeof
+$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {
+ getPrototypeOf: function getPrototypeOf(it) {
+ return nativeGetPrototypeOf(toObject(it));
+ }
+});
+
+
+
+/***/ }),
+
+/***/ 1539:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var TO_STRING_TAG_SUPPORT = __webpack_require__(1694);
+var redefine = __webpack_require__(1320);
+var toString = __webpack_require__(288);
+
+// `Object.prototype.toString` method
+// https://tc39.es/ecma262/#sec-object.prototype.tostring
+if (!TO_STRING_TAG_SUPPORT) {
+ redefine(Object.prototype, 'toString', toString, { unsafe: true });
+}
+
+
+/***/ }),
+
+/***/ 4916:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var exec = __webpack_require__(2261);
+
+// `RegExp.prototype.exec` method
+// https://tc39.es/ecma262/#sec-regexp.prototype.exec
+$({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
+ exec: exec
+});
+
+
+/***/ }),
+
+/***/ 9714:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var redefine = __webpack_require__(1320);
+var anObject = __webpack_require__(9670);
+var fails = __webpack_require__(7293);
+var flags = __webpack_require__(7066);
+
+var TO_STRING = 'toString';
+var RegExpPrototype = RegExp.prototype;
+var nativeToString = RegExpPrototype[TO_STRING];
+
+var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
+// FF44- RegExp#toString has a wrong name
+var INCORRECT_NAME = nativeToString.name != TO_STRING;
+
+// `RegExp.prototype.toString` method
+// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
+if (NOT_GENERIC || INCORRECT_NAME) {
+ redefine(RegExp.prototype, TO_STRING, function toString() {
+ var R = anObject(this);
+ var p = String(R.source);
+ var rf = R.flags;
+ var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
+ return '/' + p + '/' + f;
+ }, { unsafe: true });
+}
+
+
+/***/ }),
+
+/***/ 8783:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var charAt = __webpack_require__(8710).charAt;
+var InternalStateModule = __webpack_require__(9909);
+var defineIterator = __webpack_require__(654);
+
+var STRING_ITERATOR = 'String Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
+
+// `String.prototype[@@iterator]` method
+// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
+defineIterator(String, 'String', function (iterated) {
+ setInternalState(this, {
+ type: STRING_ITERATOR,
+ string: String(iterated),
+ index: 0
+ });
+// `%StringIteratorPrototype%.next` method
+// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
+}, function next() {
+ var state = getInternalState(this);
+ var string = state.string;
+ var index = state.index;
+ var point;
+ if (index >= string.length) return { value: undefined, done: true };
+ point = charAt(string, index);
+ state.index += point.length;
+ return { value: point, done: false };
+});
+
+
+/***/ }),
+
+/***/ 4723:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var fixRegExpWellKnownSymbolLogic = __webpack_require__(7007);
+var anObject = __webpack_require__(9670);
+var toLength = __webpack_require__(7466);
+var requireObjectCoercible = __webpack_require__(4488);
+var advanceStringIndex = __webpack_require__(1530);
+var regExpExec = __webpack_require__(7651);
+
+// @@match logic
+fixRegExpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
+ return [
+ // `String.prototype.match` method
+ // https://tc39.es/ecma262/#sec-string.prototype.match
+ function match(regexp) {
+ var O = requireObjectCoercible(this);
+ var matcher = regexp == undefined ? undefined : regexp[MATCH];
+ return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
+ },
+ // `RegExp.prototype[@@match]` method
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
+ function (regexp) {
+ var res = maybeCallNative(nativeMatch, regexp, this);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ if (!rx.global) return regExpExec(rx, S);
+
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ var A = [];
+ var n = 0;
+ var result;
+ while ((result = regExpExec(rx, S)) !== null) {
+ var matchStr = String(result[0]);
+ A[n] = matchStr;
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ n++;
+ }
+ return n === 0 ? null : A;
+ }
+ ];
+});
+
+
+/***/ }),
+
+/***/ 5306:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var fixRegExpWellKnownSymbolLogic = __webpack_require__(7007);
+var anObject = __webpack_require__(9670);
+var toLength = __webpack_require__(7466);
+var toInteger = __webpack_require__(9958);
+var requireObjectCoercible = __webpack_require__(4488);
+var advanceStringIndex = __webpack_require__(1530);
+var getSubstitution = __webpack_require__(647);
+var regExpExec = __webpack_require__(7651);
+
+var max = Math.max;
+var min = Math.min;
+
+var maybeToString = function (it) {
+ return it === undefined ? it : String(it);
+};
+
+// @@replace logic
+fixRegExpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = reason.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;
+ var REPLACE_KEEPS_$0 = reason.REPLACE_KEEPS_$0;
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
+
+ return [
+ // `String.prototype.replace` method
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
+ function replace(searchValue, replaceValue) {
+ var O = requireObjectCoercible(this);
+ var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
+ return replacer !== undefined
+ ? replacer.call(searchValue, O, replaceValue)
+ : nativeReplace.call(String(O), searchValue, replaceValue);
+ },
+ // `RegExp.prototype[@@replace]` method
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
+ function (regexp, replaceValue) {
+ if (
+ (!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE && REPLACE_KEEPS_$0) ||
+ (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1)
+ ) {
+ var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
+ if (res.done) return res.value;
+ }
+
+ var rx = anObject(regexp);
+ var S = String(this);
+
+ var functionalReplace = typeof replaceValue === 'function';
+ if (!functionalReplace) replaceValue = String(replaceValue);
+
+ var global = rx.global;
+ if (global) {
+ var fullUnicode = rx.unicode;
+ rx.lastIndex = 0;
+ }
+ var results = [];
+ while (true) {
+ var result = regExpExec(rx, S);
+ if (result === null) break;
+
+ results.push(result);
+ if (!global) break;
+
+ var matchStr = String(result[0]);
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
+ }
+
+ var accumulatedResult = '';
+ var nextSourcePosition = 0;
+ for (var i = 0; i < results.length; i++) {
+ result = results[i];
+
+ var matched = String(result[0]);
+ var position = max(min(toInteger(result.index), S.length), 0);
+ var captures = [];
+ // NOTE: This is equivalent to
+ // captures = result.slice(1).map(maybeToString)
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
+ for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
+ var namedCaptures = result.groups;
+ if (functionalReplace) {
+ var replacerArgs = [matched].concat(captures, position, S);
+ if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
+ var replacement = String(replaceValue.apply(undefined, replacerArgs));
+ } else {
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
+ }
+ if (position >= nextSourcePosition) {
+ accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
+ nextSourcePosition = position + matched.length;
+ }
+ }
+ return accumulatedResult + S.slice(nextSourcePosition);
+ }
+ ];
+});
+
+
+/***/ }),
+
+/***/ 3123:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var fixRegExpWellKnownSymbolLogic = __webpack_require__(7007);
+var isRegExp = __webpack_require__(7850);
+var anObject = __webpack_require__(9670);
+var requireObjectCoercible = __webpack_require__(4488);
+var speciesConstructor = __webpack_require__(6707);
+var advanceStringIndex = __webpack_require__(1530);
+var toLength = __webpack_require__(7466);
+var callRegExpExec = __webpack_require__(7651);
+var regexpExec = __webpack_require__(2261);
+var fails = __webpack_require__(7293);
+
+var arrayPush = [].push;
+var min = Math.min;
+var MAX_UINT32 = 0xFFFFFFFF;
+
+// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
+var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
+
+// @@split logic
+fixRegExpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
+ var internalSplit;
+ if (
+ 'abbc'.split(/(b)*/)[1] == 'c' ||
+ // eslint-disable-next-line regexp/no-empty-group -- required for testing
+ 'test'.split(/(?:)/, -1).length != 4 ||
+ 'ab'.split(/(?:ab)*/).length != 2 ||
+ '.'.split(/(.?)(.?)/).length != 4 ||
+ // eslint-disable-next-line regexp/no-assertion-capturing-group, regexp/no-empty-group -- required for testing
+ '.'.split(/()()/).length > 1 ||
+ ''.split(/.?/).length
+ ) {
+ // based on es5-shim implementation, need to rework it
+ internalSplit = function (separator, limit) {
+ var string = String(requireObjectCoercible(this));
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (separator === undefined) return [string];
+ // If `separator` is not a regex, use native split
+ if (!isRegExp(separator)) {
+ return nativeSplit.call(string, separator, lim);
+ }
+ var output = [];
+ var flags = (separator.ignoreCase ? 'i' : '') +
+ (separator.multiline ? 'm' : '') +
+ (separator.unicode ? 'u' : '') +
+ (separator.sticky ? 'y' : '');
+ var lastLastIndex = 0;
+ // Make `global` and avoid `lastIndex` issues by working with a copy
+ var separatorCopy = new RegExp(separator.source, flags + 'g');
+ var match, lastIndex, lastLength;
+ while (match = regexpExec.call(separatorCopy, string)) {
+ lastIndex = separatorCopy.lastIndex;
+ if (lastIndex > lastLastIndex) {
+ output.push(string.slice(lastLastIndex, match.index));
+ if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
+ lastLength = match[0].length;
+ lastLastIndex = lastIndex;
+ if (output.length >= lim) break;
+ }
+ if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
+ }
+ if (lastLastIndex === string.length) {
+ if (lastLength || !separatorCopy.test('')) output.push('');
+ } else output.push(string.slice(lastLastIndex));
+ return output.length > lim ? output.slice(0, lim) : output;
+ };
+ // Chakra, V8
+ } else if ('0'.split(undefined, 0).length) {
+ internalSplit = function (separator, limit) {
+ return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
+ };
+ } else internalSplit = nativeSplit;
+
+ return [
+ // `String.prototype.split` method
+ // https://tc39.es/ecma262/#sec-string.prototype.split
+ function split(separator, limit) {
+ var O = requireObjectCoercible(this);
+ var splitter = separator == undefined ? undefined : separator[SPLIT];
+ return splitter !== undefined
+ ? splitter.call(separator, O, limit)
+ : internalSplit.call(String(O), separator, limit);
+ },
+ // `RegExp.prototype[@@split]` method
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
+ //
+ // NOTE: This cannot be properly polyfilled in engines that don't support
+ // the 'y' flag.
+ function (regexp, limit) {
+ var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
+ if (res.done) return res.value;
+
+ var rx = anObject(regexp);
+ var S = String(this);
+ var C = speciesConstructor(rx, RegExp);
+
+ var unicodeMatching = rx.unicode;
+ var flags = (rx.ignoreCase ? 'i' : '') +
+ (rx.multiline ? 'm' : '') +
+ (rx.unicode ? 'u' : '') +
+ (SUPPORTS_Y ? 'y' : 'g');
+
+ // ^(? + rx + ) is needed, in combination with some S slicing, to
+ // simulate the 'y' flag.
+ var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
+ var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
+ if (lim === 0) return [];
+ if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
+ var p = 0;
+ var q = 0;
+ var A = [];
+ while (q < S.length) {
+ splitter.lastIndex = SUPPORTS_Y ? q : 0;
+ var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
+ var e;
+ if (
+ z === null ||
+ (e = min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
+ ) {
+ q = advanceStringIndex(S, q, unicodeMatching);
+ } else {
+ A.push(S.slice(p, q));
+ if (A.length === lim) return A;
+ for (var i = 1; i <= z.length - 1; i++) {
+ A.push(z[i]);
+ if (A.length === lim) return A;
+ }
+ q = p = e;
+ }
+ }
+ A.push(S.slice(p));
+ return A;
+ }
+ ];
+}, !SUPPORTS_Y);
+
+
+/***/ }),
+
+/***/ 3210:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var $ = __webpack_require__(2109);
+var $trim = __webpack_require__(3111).trim;
+var forcedStringTrimMethod = __webpack_require__(6091);
+
+// `String.prototype.trim` method
+// https://tc39.es/ecma262/#sec-string.prototype.trim
+$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
+ trim: function trim() {
+ return $trim(this);
+ }
+});
+
+
+/***/ }),
+
+/***/ 2990:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $copyWithin = __webpack_require__(1048);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.copyWithin` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin
+exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) {
+ return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 8927:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $every = __webpack_require__(2092).every;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.every` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.every
+exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) {
+ return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 3105:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $fill = __webpack_require__(1285);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.fill` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
+// eslint-disable-next-line no-unused-vars -- required for `.length`
+exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
+ return $fill.apply(aTypedArray(this), arguments);
+});
+
+
+/***/ }),
+
+/***/ 5035:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $filter = __webpack_require__(2092).filter;
+var fromSpeciesAndList = __webpack_require__(3074);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.filter` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter
+exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
+ var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+ return fromSpeciesAndList(this, list);
+});
+
+
+/***/ }),
+
+/***/ 7174:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $findIndex = __webpack_require__(2092).findIndex;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.findIndex` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex
+exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) {
+ return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 4345:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $find = __webpack_require__(2092).find;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.find` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.find
+exportTypedArrayMethod('find', function find(predicate /* , thisArg */) {
+ return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 2846:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $forEach = __webpack_require__(2092).forEach;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.forEach` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach
+exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) {
+ $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 4731:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $includes = __webpack_require__(1318).includes;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.includes` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes
+exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) {
+ return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 7209:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $indexOf = __webpack_require__(1318).indexOf;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.indexOf` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof
+exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) {
+ return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 6319:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var global = __webpack_require__(7854);
+var ArrayBufferViewCore = __webpack_require__(260);
+var ArrayIterators = __webpack_require__(6992);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var ITERATOR = wellKnownSymbol('iterator');
+var Uint8Array = global.Uint8Array;
+var arrayValues = ArrayIterators.values;
+var arrayKeys = ArrayIterators.keys;
+var arrayEntries = ArrayIterators.entries;
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR];
+
+var CORRECT_ITER_NAME = !!nativeTypedArrayIterator
+ && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined);
+
+var typedArrayValues = function values() {
+ return arrayValues.call(aTypedArray(this));
+};
+
+// `%TypedArray%.prototype.entries` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
+exportTypedArrayMethod('entries', function entries() {
+ return arrayEntries.call(aTypedArray(this));
+});
+// `%TypedArray%.prototype.keys` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys
+exportTypedArrayMethod('keys', function keys() {
+ return arrayKeys.call(aTypedArray(this));
+});
+// `%TypedArray%.prototype.values` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
+exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME);
+// `%TypedArray%.prototype[@@iterator]` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator
+exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME);
+
+
+/***/ }),
+
+/***/ 8867:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var $join = [].join;
+
+// `%TypedArray%.prototype.join` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.join
+// eslint-disable-next-line no-unused-vars -- required for `.length`
+exportTypedArrayMethod('join', function join(separator) {
+ return $join.apply(aTypedArray(this), arguments);
+});
+
+
+/***/ }),
+
+/***/ 7789:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $lastIndexOf = __webpack_require__(6583);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.lastIndexOf` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
+// eslint-disable-next-line no-unused-vars -- required for `.length`
+exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
+ return $lastIndexOf.apply(aTypedArray(this), arguments);
+});
+
+
+/***/ }),
+
+/***/ 3739:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $map = __webpack_require__(2092).map;
+var speciesConstructor = __webpack_require__(6707);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.map` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.map
+exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) {
+ return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) {
+ return new (aTypedArrayConstructor(speciesConstructor(O, O.constructor)))(length);
+ });
+});
+
+
+/***/ }),
+
+/***/ 4483:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $reduceRight = __webpack_require__(3671).right;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.reduceRicht` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright
+exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
+ return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 9368:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $reduce = __webpack_require__(3671).left;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.reduce` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce
+exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) {
+ return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 2056:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var floor = Math.floor;
+
+// `%TypedArray%.prototype.reverse` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
+exportTypedArrayMethod('reverse', function reverse() {
+ var that = this;
+ var length = aTypedArray(that).length;
+ var middle = floor(length / 2);
+ var index = 0;
+ var value;
+ while (index < middle) {
+ value = that[index];
+ that[index++] = that[--length];
+ that[length] = value;
+ } return that;
+});
+
+
+/***/ }),
+
+/***/ 3462:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var toLength = __webpack_require__(7466);
+var toOffset = __webpack_require__(4590);
+var toObject = __webpack_require__(7908);
+var fails = __webpack_require__(7293);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+var FORCED = fails(function () {
+ /* global Int8Array -- safe */
+ new Int8Array(1).set({});
+});
+
+// `%TypedArray%.prototype.set` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
+exportTypedArrayMethod('set', function set(arrayLike /* , offset */) {
+ aTypedArray(this);
+ var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
+ var length = this.length;
+ var src = toObject(arrayLike);
+ var len = toLength(src.length);
+ var index = 0;
+ if (len + offset > length) throw RangeError('Wrong length');
+ while (index < len) this[offset + index] = src[index++];
+}, FORCED);
+
+
+/***/ }),
+
+/***/ 678:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var speciesConstructor = __webpack_require__(6707);
+var fails = __webpack_require__(7293);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var $slice = [].slice;
+
+var FORCED = fails(function () {
+ /* global Int8Array -- safe */
+ new Int8Array(1).slice();
+});
+
+// `%TypedArray%.prototype.slice` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
+exportTypedArrayMethod('slice', function slice(start, end) {
+ var list = $slice.call(aTypedArray(this), start, end);
+ var C = speciesConstructor(this, this.constructor);
+ var index = 0;
+ var length = list.length;
+ var result = new (aTypedArrayConstructor(C))(length);
+ while (length > index) result[index] = list[index++];
+ return result;
+}, FORCED);
+
+
+/***/ }),
+
+/***/ 7462:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var $some = __webpack_require__(2092).some;
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.some` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.some
+exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
+ return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
+});
+
+
+/***/ }),
+
+/***/ 3824:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var $sort = [].sort;
+
+// `%TypedArray%.prototype.sort` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
+exportTypedArrayMethod('sort', function sort(comparefn) {
+ return $sort.call(aTypedArray(this), comparefn);
+});
+
+
+/***/ }),
+
+/***/ 5021:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var ArrayBufferViewCore = __webpack_require__(260);
+var toLength = __webpack_require__(7466);
+var toAbsoluteIndex = __webpack_require__(1400);
+var speciesConstructor = __webpack_require__(6707);
+
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+
+// `%TypedArray%.prototype.subarray` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray
+exportTypedArrayMethod('subarray', function subarray(begin, end) {
+ var O = aTypedArray(this);
+ var length = O.length;
+ var beginIndex = toAbsoluteIndex(begin, length);
+ return new (speciesConstructor(O, O.constructor))(
+ O.buffer,
+ O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT,
+ toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex)
+ );
+});
+
+
+/***/ }),
+
+/***/ 2974:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var global = __webpack_require__(7854);
+var ArrayBufferViewCore = __webpack_require__(260);
+var fails = __webpack_require__(7293);
+
+var Int8Array = global.Int8Array;
+var aTypedArray = ArrayBufferViewCore.aTypedArray;
+var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
+var $toLocaleString = [].toLocaleString;
+var $slice = [].slice;
+
+// iOS Safari 6.x fails here
+var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
+ $toLocaleString.call(new Int8Array(1));
+});
+
+var FORCED = fails(function () {
+ return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
+}) || !fails(function () {
+ Int8Array.prototype.toLocaleString.call([1, 2]);
+});
+
+// `%TypedArray%.prototype.toLocaleString` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
+exportTypedArrayMethod('toLocaleString', function toLocaleString() {
+ return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments);
+}, FORCED);
+
+
+/***/ }),
+
+/***/ 5016:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+var exportTypedArrayMethod = __webpack_require__(260).exportTypedArrayMethod;
+var fails = __webpack_require__(7293);
+var global = __webpack_require__(7854);
+
+var Uint8Array = global.Uint8Array;
+var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {};
+var arrayToString = [].toString;
+var arrayJoin = [].join;
+
+if (fails(function () { arrayToString.call({}); })) {
+ arrayToString = function toString() {
+ return arrayJoin.call(this);
+ };
+}
+
+var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
+
+// `%TypedArray%.prototype.toString` method
+// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring
+exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD);
+
+
+/***/ }),
+
+/***/ 2472:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var createTypedArrayConstructor = __webpack_require__(9843);
+
+// `Uint8Array` constructor
+// https://tc39.es/ecma262/#sec-typedarray-objects
+createTypedArrayConstructor('Uint8', function (init) {
+ return function Uint8Array(data, byteOffset, length) {
+ return init(this, data, byteOffset, length);
+ };
+});
+
+
+/***/ }),
+
+/***/ 4747:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var DOMIterables = __webpack_require__(8324);
+var forEach = __webpack_require__(8533);
+var createNonEnumerableProperty = __webpack_require__(8880);
+
+for (var COLLECTION_NAME in DOMIterables) {
+ var Collection = global[COLLECTION_NAME];
+ var CollectionPrototype = Collection && Collection.prototype;
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
+ createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
+ } catch (error) {
+ CollectionPrototype.forEach = forEach;
+ }
+}
+
+
+/***/ }),
+
+/***/ 3948:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+var global = __webpack_require__(7854);
+var DOMIterables = __webpack_require__(8324);
+var ArrayIteratorMethods = __webpack_require__(6992);
+var createNonEnumerableProperty = __webpack_require__(8880);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var ITERATOR = wellKnownSymbol('iterator');
+var TO_STRING_TAG = wellKnownSymbol('toStringTag');
+var ArrayValues = ArrayIteratorMethods.values;
+
+for (var COLLECTION_NAME in DOMIterables) {
+ var Collection = global[COLLECTION_NAME];
+ var CollectionPrototype = Collection && Collection.prototype;
+ if (CollectionPrototype) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
+ createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
+ } catch (error) {
+ CollectionPrototype[ITERATOR] = ArrayValues;
+ }
+ if (!CollectionPrototype[TO_STRING_TAG]) {
+ createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
+ }
+ if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
+ // some Chrome versions have non-configurable methods on DOMTokenList
+ if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
+ createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
+ } catch (error) {
+ CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
+ }
+ }
+ }
+}
+
+
+/***/ }),
+
+/***/ 1637:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+__webpack_require__(6992);
+var $ = __webpack_require__(2109);
+var getBuiltIn = __webpack_require__(5005);
+var USE_NATIVE_URL = __webpack_require__(590);
+var redefine = __webpack_require__(1320);
+var redefineAll = __webpack_require__(2248);
+var setToStringTag = __webpack_require__(8003);
+var createIteratorConstructor = __webpack_require__(4994);
+var InternalStateModule = __webpack_require__(9909);
+var anInstance = __webpack_require__(5787);
+var hasOwn = __webpack_require__(6656);
+var bind = __webpack_require__(9974);
+var classof = __webpack_require__(648);
+var anObject = __webpack_require__(9670);
+var isObject = __webpack_require__(111);
+var create = __webpack_require__(30);
+var createPropertyDescriptor = __webpack_require__(9114);
+var getIterator = __webpack_require__(8554);
+var getIteratorMethod = __webpack_require__(1246);
+var wellKnownSymbol = __webpack_require__(5112);
+
+var $fetch = getBuiltIn('fetch');
+var Headers = getBuiltIn('Headers');
+var ITERATOR = wellKnownSymbol('iterator');
+var URL_SEARCH_PARAMS = 'URLSearchParams';
+var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
+var setInternalState = InternalStateModule.set;
+var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
+var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
+
+var plus = /\+/g;
+var sequences = Array(4);
+
+var percentSequence = function (bytes) {
+ return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
+};
+
+var percentDecode = function (sequence) {
+ try {
+ return decodeURIComponent(sequence);
+ } catch (error) {
+ return sequence;
+ }
+};
+
+var deserialize = function (it) {
+ var result = it.replace(plus, ' ');
+ var bytes = 4;
+ try {
+ return decodeURIComponent(result);
+ } catch (error) {
+ while (bytes) {
+ result = result.replace(percentSequence(bytes--), percentDecode);
+ }
+ return result;
+ }
+};
+
+var find = /[!'()~]|%20/g;
+
+var replace = {
+ '!': '%21',
+ "'": '%27',
+ '(': '%28',
+ ')': '%29',
+ '~': '%7E',
+ '%20': '+'
+};
+
+var replacer = function (match) {
+ return replace[match];
+};
+
+var serialize = function (it) {
+ return encodeURIComponent(it).replace(find, replacer);
+};
+
+var parseSearchParams = function (result, query) {
+ if (query) {
+ var attributes = query.split('&');
+ var index = 0;
+ var attribute, entry;
+ while (index < attributes.length) {
+ attribute = attributes[index++];
+ if (attribute.length) {
+ entry = attribute.split('=');
+ result.push({
+ key: deserialize(entry.shift()),
+ value: deserialize(entry.join('='))
+ });
+ }
+ }
+ }
+};
+
+var updateSearchParams = function (query) {
+ this.entries.length = 0;
+ parseSearchParams(this.entries, query);
+};
+
+var validateArgumentsLength = function (passed, required) {
+ if (passed < required) throw TypeError('Not enough arguments');
+};
+
+var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
+ setInternalState(this, {
+ type: URL_SEARCH_PARAMS_ITERATOR,
+ iterator: getIterator(getInternalParamsState(params).entries),
+ kind: kind
+ });
+}, 'Iterator', function next() {
+ var state = getInternalIteratorState(this);
+ var kind = state.kind;
+ var step = state.iterator.next();
+ var entry = step.value;
+ if (!step.done) {
+ step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];
+ } return step;
+});
+
+// `URLSearchParams` constructor
+// https://url.spec.whatwg.org/#interface-urlsearchparams
+var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
+ anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+ var init = arguments.length > 0 ? arguments[0] : undefined;
+ var that = this;
+ var entries = [];
+ var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
+
+ setInternalState(that, {
+ type: URL_SEARCH_PARAMS,
+ entries: entries,
+ updateURL: function () { /* empty */ },
+ updateSearchParams: updateSearchParams
+ });
+
+ if (init !== undefined) {
+ if (isObject(init)) {
+ iteratorMethod = getIteratorMethod(init);
+ if (typeof iteratorMethod === 'function') {
+ iterator = iteratorMethod.call(init);
+ next = iterator.next;
+ while (!(step = next.call(iterator)).done) {
+ entryIterator = getIterator(anObject(step.value));
+ entryNext = entryIterator.next;
+ if (
+ (first = entryNext.call(entryIterator)).done ||
+ (second = entryNext.call(entryIterator)).done ||
+ !entryNext.call(entryIterator).done
+ ) throw TypeError('Expected sequence with length 2');
+ entries.push({ key: first.value + '', value: second.value + '' });
+ }
+ } else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });
+ } else {
+ parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
+ }
+ }
+};
+
+var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
+
+redefineAll(URLSearchParamsPrototype, {
+ // `URLSearchParams.prototype.append` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-append
+ append: function append(name, value) {
+ validateArgumentsLength(arguments.length, 2);
+ var state = getInternalParamsState(this);
+ state.entries.push({ key: name + '', value: value + '' });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.delete` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-delete
+ 'delete': function (name) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index].key === key) entries.splice(index, 1);
+ else index++;
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.get` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-get
+ get: function get(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) return entries[index].value;
+ }
+ return null;
+ },
+ // `URLSearchParams.prototype.getAll` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-getall
+ getAll: function getAll(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var result = [];
+ var index = 0;
+ for (; index < entries.length; index++) {
+ if (entries[index].key === key) result.push(entries[index].value);
+ }
+ return result;
+ },
+ // `URLSearchParams.prototype.has` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-has
+ has: function has(name) {
+ validateArgumentsLength(arguments.length, 1);
+ var entries = getInternalParamsState(this).entries;
+ var key = name + '';
+ var index = 0;
+ while (index < entries.length) {
+ if (entries[index++].key === key) return true;
+ }
+ return false;
+ },
+ // `URLSearchParams.prototype.set` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-set
+ set: function set(name, value) {
+ validateArgumentsLength(arguments.length, 1);
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ var found = false;
+ var key = name + '';
+ var val = value + '';
+ var index = 0;
+ var entry;
+ for (; index < entries.length; index++) {
+ entry = entries[index];
+ if (entry.key === key) {
+ if (found) entries.splice(index--, 1);
+ else {
+ found = true;
+ entry.value = val;
+ }
+ }
+ }
+ if (!found) entries.push({ key: key, value: val });
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.sort` method
+ // https://url.spec.whatwg.org/#dom-urlsearchparams-sort
+ sort: function sort() {
+ var state = getInternalParamsState(this);
+ var entries = state.entries;
+ // Array#sort is not stable in some engines
+ var slice = entries.slice();
+ var entry, entriesIndex, sliceIndex;
+ entries.length = 0;
+ for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
+ entry = slice[sliceIndex];
+ for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
+ if (entries[entriesIndex].key > entry.key) {
+ entries.splice(entriesIndex, 0, entry);
+ break;
+ }
+ }
+ if (entriesIndex === sliceIndex) entries.push(entry);
+ }
+ state.updateURL();
+ },
+ // `URLSearchParams.prototype.forEach` method
+ forEach: function forEach(callback /* , thisArg */) {
+ var entries = getInternalParamsState(this).entries;
+ var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ boundFunction(entry.value, entry.key, this);
+ }
+ },
+ // `URLSearchParams.prototype.keys` method
+ keys: function keys() {
+ return new URLSearchParamsIterator(this, 'keys');
+ },
+ // `URLSearchParams.prototype.values` method
+ values: function values() {
+ return new URLSearchParamsIterator(this, 'values');
+ },
+ // `URLSearchParams.prototype.entries` method
+ entries: function entries() {
+ return new URLSearchParamsIterator(this, 'entries');
+ }
+}, { enumerable: true });
+
+// `URLSearchParams.prototype[@@iterator]` method
+redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);
+
+// `URLSearchParams.prototype.toString` method
+// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
+redefine(URLSearchParamsPrototype, 'toString', function toString() {
+ var entries = getInternalParamsState(this).entries;
+ var result = [];
+ var index = 0;
+ var entry;
+ while (index < entries.length) {
+ entry = entries[index++];
+ result.push(serialize(entry.key) + '=' + serialize(entry.value));
+ } return result.join('&');
+}, { enumerable: true });
+
+setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
+
+$({ global: true, forced: !USE_NATIVE_URL }, {
+ URLSearchParams: URLSearchParamsConstructor
+});
+
+// Wrap `fetch` for correct work with polyfilled `URLSearchParams`
+// https://github.com/zloirock/core-js/issues/674
+if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {
+ $({ global: true, enumerable: true, forced: true }, {
+ fetch: function fetch(input /* , init */) {
+ var args = [input];
+ var init, body, headers;
+ if (arguments.length > 1) {
+ init = arguments[1];
+ if (isObject(init)) {
+ body = init.body;
+ if (classof(body) === URL_SEARCH_PARAMS) {
+ headers = init.headers ? new Headers(init.headers) : new Headers();
+ if (!headers.has('content-type')) {
+ headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
+ }
+ init = create(init, {
+ body: createPropertyDescriptor(0, String(body)),
+ headers: createPropertyDescriptor(0, headers)
+ });
+ }
+ }
+ args.push(init);
+ } return $fetch.apply(this, args);
+ }
+ });
+}
+
+module.exports = {
+ URLSearchParams: URLSearchParamsConstructor,
+ getState: getInternalParamsState
+};
+
+
+/***/ }),
+
+/***/ 285:
+/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+
+// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
+__webpack_require__(8783);
+var $ = __webpack_require__(2109);
+var DESCRIPTORS = __webpack_require__(9781);
+var USE_NATIVE_URL = __webpack_require__(590);
+var global = __webpack_require__(7854);
+var defineProperties = __webpack_require__(6048);
+var redefine = __webpack_require__(1320);
+var anInstance = __webpack_require__(5787);
+var has = __webpack_require__(6656);
+var assign = __webpack_require__(1574);
+var arrayFrom = __webpack_require__(8457);
+var codeAt = __webpack_require__(8710).codeAt;
+var toASCII = __webpack_require__(3197);
+var setToStringTag = __webpack_require__(8003);
+var URLSearchParamsModule = __webpack_require__(1637);
+var InternalStateModule = __webpack_require__(9909);
+
+var NativeURL = global.URL;
+var URLSearchParams = URLSearchParamsModule.URLSearchParams;
+var getInternalSearchParamsState = URLSearchParamsModule.getState;
+var setInternalState = InternalStateModule.set;
+var getInternalURLState = InternalStateModule.getterFor('URL');
+var floor = Math.floor;
+var pow = Math.pow;
+
+var INVALID_AUTHORITY = 'Invalid authority';
+var INVALID_SCHEME = 'Invalid scheme';
+var INVALID_HOST = 'Invalid host';
+var INVALID_PORT = 'Invalid port';
+
+var ALPHA = /[A-Za-z]/;
+var ALPHANUMERIC = /[\d+-.A-Za-z]/;
+var DIGIT = /\d/;
+var HEX_START = /^(0x|0X)/;
+var OCT = /^[0-7]+$/;
+var DEC = /^\d+$/;
+var HEX = /^[\dA-Fa-f]+$/;
+/* eslint-disable no-control-regex -- safe */
+var FORBIDDEN_HOST_CODE_POINT = /[\u0000\t\u000A\u000D #%/:?@[\\]]/;
+var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\t\u000A\u000D #/:?@[\\]]/;
+var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
+var TAB_AND_NEW_LINE = /[\t\u000A\u000D]/g;
+/* eslint-enable no-control-regex -- safe */
+var EOF;
+
+var parseHost = function (url, input) {
+ var result, codePoints, index;
+ if (input.charAt(0) == '[') {
+ if (input.charAt(input.length - 1) != ']') return INVALID_HOST;
+ result = parseIPv6(input.slice(1, -1));
+ if (!result) return INVALID_HOST;
+ url.host = result;
+ // opaque host
+ } else if (!isSpecial(url)) {
+ if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;
+ result = '';
+ codePoints = arrayFrom(input);
+ for (index = 0; index < codePoints.length; index++) {
+ result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
+ }
+ url.host = result;
+ } else {
+ input = toASCII(input);
+ if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;
+ result = parseIPv4(input);
+ if (result === null) return INVALID_HOST;
+ url.host = result;
+ }
+};
+
+var parseIPv4 = function (input) {
+ var parts = input.split('.');
+ var partsLength, numbers, index, part, radix, number, ipv4;
+ if (parts.length && parts[parts.length - 1] == '') {
+ parts.pop();
+ }
+ partsLength = parts.length;
+ if (partsLength > 4) return input;
+ numbers = [];
+ for (index = 0; index < partsLength; index++) {
+ part = parts[index];
+ if (part == '') return input;
+ radix = 10;
+ if (part.length > 1 && part.charAt(0) == '0') {
+ radix = HEX_START.test(part) ? 16 : 8;
+ part = part.slice(radix == 8 ? 1 : 2);
+ }
+ if (part === '') {
+ number = 0;
+ } else {
+ if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;
+ number = parseInt(part, radix);
+ }
+ numbers.push(number);
+ }
+ for (index = 0; index < partsLength; index++) {
+ number = numbers[index];
+ if (index == partsLength - 1) {
+ if (number >= pow(256, 5 - partsLength)) return null;
+ } else if (number > 255) return null;
+ }
+ ipv4 = numbers.pop();
+ for (index = 0; index < numbers.length; index++) {
+ ipv4 += numbers[index] * pow(256, 3 - index);
+ }
+ return ipv4;
+};
+
+// eslint-disable-next-line max-statements -- TODO
+var parseIPv6 = function (input) {
+ var address = [0, 0, 0, 0, 0, 0, 0, 0];
+ var pieceIndex = 0;
+ var compress = null;
+ var pointer = 0;
+ var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
+
+ var char = function () {
+ return input.charAt(pointer);
+ };
+
+ if (char() == ':') {
+ if (input.charAt(1) != ':') return;
+ pointer += 2;
+ pieceIndex++;
+ compress = pieceIndex;
+ }
+ while (char()) {
+ if (pieceIndex == 8) return;
+ if (char() == ':') {
+ if (compress !== null) return;
+ pointer++;
+ pieceIndex++;
+ compress = pieceIndex;
+ continue;
+ }
+ value = length = 0;
+ while (length < 4 && HEX.test(char())) {
+ value = value * 16 + parseInt(char(), 16);
+ pointer++;
+ length++;
+ }
+ if (char() == '.') {
+ if (length == 0) return;
+ pointer -= length;
+ if (pieceIndex > 6) return;
+ numbersSeen = 0;
+ while (char()) {
+ ipv4Piece = null;
+ if (numbersSeen > 0) {
+ if (char() == '.' && numbersSeen < 4) pointer++;
+ else return;
+ }
+ if (!DIGIT.test(char())) return;
+ while (DIGIT.test(char())) {
+ number = parseInt(char(), 10);
+ if (ipv4Piece === null) ipv4Piece = number;
+ else if (ipv4Piece == 0) return;
+ else ipv4Piece = ipv4Piece * 10 + number;
+ if (ipv4Piece > 255) return;
+ pointer++;
+ }
+ address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
+ numbersSeen++;
+ if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;
+ }
+ if (numbersSeen != 4) return;
+ break;
+ } else if (char() == ':') {
+ pointer++;
+ if (!char()) return;
+ } else if (char()) return;
+ address[pieceIndex++] = value;
+ }
+ if (compress !== null) {
+ swaps = pieceIndex - compress;
+ pieceIndex = 7;
+ while (pieceIndex != 0 && swaps > 0) {
+ swap = address[pieceIndex];
+ address[pieceIndex--] = address[compress + swaps - 1];
+ address[compress + --swaps] = swap;
+ }
+ } else if (pieceIndex != 8) return;
+ return address;
+};
+
+var findLongestZeroSequence = function (ipv6) {
+ var maxIndex = null;
+ var maxLength = 1;
+ var currStart = null;
+ var currLength = 0;
+ var index = 0;
+ for (; index < 8; index++) {
+ if (ipv6[index] !== 0) {
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ currStart = null;
+ currLength = 0;
+ } else {
+ if (currStart === null) currStart = index;
+ ++currLength;
+ }
+ }
+ if (currLength > maxLength) {
+ maxIndex = currStart;
+ maxLength = currLength;
+ }
+ return maxIndex;
+};
+
+var serializeHost = function (host) {
+ var result, index, compress, ignore0;
+ // ipv4
+ if (typeof host == 'number') {
+ result = [];
+ for (index = 0; index < 4; index++) {
+ result.unshift(host % 256);
+ host = floor(host / 256);
+ } return result.join('.');
+ // ipv6
+ } else if (typeof host == 'object') {
+ result = '';
+ compress = findLongestZeroSequence(host);
+ for (index = 0; index < 8; index++) {
+ if (ignore0 && host[index] === 0) continue;
+ if (ignore0) ignore0 = false;
+ if (compress === index) {
+ result += index ? ':' : '::';
+ ignore0 = true;
+ } else {
+ result += host[index].toString(16);
+ if (index < 7) result += ':';
+ }
+ }
+ return '[' + result + ']';
+ } return host;
+};
+
+var C0ControlPercentEncodeSet = {};
+var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
+ ' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
+});
+var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
+ '#': 1, '?': 1, '{': 1, '}': 1
+});
+var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
+ '/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
+});
+
+var percentEncode = function (char, set) {
+ var code = codeAt(char, 0);
+ return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
+};
+
+var specialSchemes = {
+ ftp: 21,
+ file: null,
+ http: 80,
+ https: 443,
+ ws: 80,
+ wss: 443
+};
+
+var isSpecial = function (url) {
+ return has(specialSchemes, url.scheme);
+};
+
+var includesCredentials = function (url) {
+ return url.username != '' || url.password != '';
+};
+
+var cannotHaveUsernamePasswordPort = function (url) {
+ return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
+};
+
+var isWindowsDriveLetter = function (string, normalized) {
+ var second;
+ return string.length == 2 && ALPHA.test(string.charAt(0))
+ && ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));
+};
+
+var startsWithWindowsDriveLetter = function (string) {
+ var third;
+ return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (
+ string.length == 2 ||
+ ((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#')
+ );
+};
+
+var shortenURLsPath = function (url) {
+ var path = url.path;
+ var pathSize = path.length;
+ if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
+ path.pop();
+ }
+};
+
+var isSingleDot = function (segment) {
+ return segment === '.' || segment.toLowerCase() === '%2e';
+};
+
+var isDoubleDot = function (segment) {
+ segment = segment.toLowerCase();
+ return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
+};
+
+// States:
+var SCHEME_START = {};
+var SCHEME = {};
+var NO_SCHEME = {};
+var SPECIAL_RELATIVE_OR_AUTHORITY = {};
+var PATH_OR_AUTHORITY = {};
+var RELATIVE = {};
+var RELATIVE_SLASH = {};
+var SPECIAL_AUTHORITY_SLASHES = {};
+var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
+var AUTHORITY = {};
+var HOST = {};
+var HOSTNAME = {};
+var PORT = {};
+var FILE = {};
+var FILE_SLASH = {};
+var FILE_HOST = {};
+var PATH_START = {};
+var PATH = {};
+var CANNOT_BE_A_BASE_URL_PATH = {};
+var QUERY = {};
+var FRAGMENT = {};
+
+// eslint-disable-next-line max-statements -- TODO
+var parseURL = function (url, input, stateOverride, base) {
+ var state = stateOverride || SCHEME_START;
+ var pointer = 0;
+ var buffer = '';
+ var seenAt = false;
+ var seenBracket = false;
+ var seenPasswordToken = false;
+ var codePoints, char, bufferCodePoints, failure;
+
+ if (!stateOverride) {
+ url.scheme = '';
+ url.username = '';
+ url.password = '';
+ url.host = null;
+ url.port = null;
+ url.path = [];
+ url.query = null;
+ url.fragment = null;
+ url.cannotBeABaseURL = false;
+ input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
+ }
+
+ input = input.replace(TAB_AND_NEW_LINE, '');
+
+ codePoints = arrayFrom(input);
+
+ while (pointer <= codePoints.length) {
+ char = codePoints[pointer];
+ switch (state) {
+ case SCHEME_START:
+ if (char && ALPHA.test(char)) {
+ buffer += char.toLowerCase();
+ state = SCHEME;
+ } else if (!stateOverride) {
+ state = NO_SCHEME;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case SCHEME:
+ if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
+ buffer += char.toLowerCase();
+ } else if (char == ':') {
+ if (stateOverride && (
+ (isSpecial(url) != has(specialSchemes, buffer)) ||
+ (buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||
+ (url.scheme == 'file' && !url.host)
+ )) return;
+ url.scheme = buffer;
+ if (stateOverride) {
+ if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;
+ return;
+ }
+ buffer = '';
+ if (url.scheme == 'file') {
+ state = FILE;
+ } else if (isSpecial(url) && base && base.scheme == url.scheme) {
+ state = SPECIAL_RELATIVE_OR_AUTHORITY;
+ } else if (isSpecial(url)) {
+ state = SPECIAL_AUTHORITY_SLASHES;
+ } else if (codePoints[pointer + 1] == '/') {
+ state = PATH_OR_AUTHORITY;
+ pointer++;
+ } else {
+ url.cannotBeABaseURL = true;
+ url.path.push('');
+ state = CANNOT_BE_A_BASE_URL_PATH;
+ }
+ } else if (!stateOverride) {
+ buffer = '';
+ state = NO_SCHEME;
+ pointer = 0;
+ continue;
+ } else return INVALID_SCHEME;
+ break;
+
+ case NO_SCHEME:
+ if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;
+ if (base.cannotBeABaseURL && char == '#') {
+ url.scheme = base.scheme;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ url.cannotBeABaseURL = true;
+ state = FRAGMENT;
+ break;
+ }
+ state = base.scheme == 'file' ? FILE : RELATIVE;
+ continue;
+
+ case SPECIAL_RELATIVE_OR_AUTHORITY:
+ if (char == '/' && codePoints[pointer + 1] == '/') {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ pointer++;
+ } else {
+ state = RELATIVE;
+ continue;
+ } break;
+
+ case PATH_OR_AUTHORITY:
+ if (char == '/') {
+ state = AUTHORITY;
+ break;
+ } else {
+ state = PATH;
+ continue;
+ }
+
+ case RELATIVE:
+ url.scheme = base.scheme;
+ if (char == EOF) {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '/' || (char == '\\' && isSpecial(url))) {
+ state = RELATIVE_SLASH;
+ } else if (char == '?') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ url.path = base.path.slice();
+ url.path.pop();
+ state = PATH;
+ continue;
+ } break;
+
+ case RELATIVE_SLASH:
+ if (isSpecial(url) && (char == '/' || char == '\\')) {
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ } else if (char == '/') {
+ state = AUTHORITY;
+ } else {
+ url.username = base.username;
+ url.password = base.password;
+ url.host = base.host;
+ url.port = base.port;
+ state = PATH;
+ continue;
+ } break;
+
+ case SPECIAL_AUTHORITY_SLASHES:
+ state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
+ if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;
+ pointer++;
+ break;
+
+ case SPECIAL_AUTHORITY_IGNORE_SLASHES:
+ if (char != '/' && char != '\\') {
+ state = AUTHORITY;
+ continue;
+ } break;
+
+ case AUTHORITY:
+ if (char == '@') {
+ if (seenAt) buffer = '%40' + buffer;
+ seenAt = true;
+ bufferCodePoints = arrayFrom(buffer);
+ for (var i = 0; i < bufferCodePoints.length; i++) {
+ var codePoint = bufferCodePoints[i];
+ if (codePoint == ':' && !seenPasswordToken) {
+ seenPasswordToken = true;
+ continue;
+ }
+ var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
+ if (seenPasswordToken) url.password += encodedCodePoints;
+ else url.username += encodedCodePoints;
+ }
+ buffer = '';
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (seenAt && buffer == '') return INVALID_AUTHORITY;
+ pointer -= arrayFrom(buffer).length + 1;
+ buffer = '';
+ state = HOST;
+ } else buffer += char;
+ break;
+
+ case HOST:
+ case HOSTNAME:
+ if (stateOverride && url.scheme == 'file') {
+ state = FILE_HOST;
+ continue;
+ } else if (char == ':' && !seenBracket) {
+ if (buffer == '') return INVALID_HOST;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PORT;
+ if (stateOverride == HOSTNAME) return;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url))
+ ) {
+ if (isSpecial(url) && buffer == '') return INVALID_HOST;
+ if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ buffer = '';
+ state = PATH_START;
+ if (stateOverride) return;
+ continue;
+ } else {
+ if (char == '[') seenBracket = true;
+ else if (char == ']') seenBracket = false;
+ buffer += char;
+ } break;
+
+ case PORT:
+ if (DIGIT.test(char)) {
+ buffer += char;
+ } else if (
+ char == EOF || char == '/' || char == '?' || char == '#' ||
+ (char == '\\' && isSpecial(url)) ||
+ stateOverride
+ ) {
+ if (buffer != '') {
+ var port = parseInt(buffer, 10);
+ if (port > 0xFFFF) return INVALID_PORT;
+ url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;
+ buffer = '';
+ }
+ if (stateOverride) return;
+ state = PATH_START;
+ continue;
+ } else return INVALID_PORT;
+ break;
+
+ case FILE:
+ url.scheme = 'file';
+ if (char == '/' || char == '\\') state = FILE_SLASH;
+ else if (base && base.scheme == 'file') {
+ if (char == EOF) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ } else if (char == '?') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.host = base.host;
+ url.path = base.path.slice();
+ url.query = base.query;
+ url.fragment = '';
+ state = FRAGMENT;
+ } else {
+ if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ url.host = base.host;
+ url.path = base.path.slice();
+ shortenURLsPath(url);
+ }
+ state = PATH;
+ continue;
+ }
+ } else {
+ state = PATH;
+ continue;
+ } break;
+
+ case FILE_SLASH:
+ if (char == '/' || char == '\\') {
+ state = FILE_HOST;
+ break;
+ }
+ if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
+ if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);
+ else url.host = base.host;
+ }
+ state = PATH;
+ continue;
+
+ case FILE_HOST:
+ if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
+ if (!stateOverride && isWindowsDriveLetter(buffer)) {
+ state = PATH;
+ } else if (buffer == '') {
+ url.host = '';
+ if (stateOverride) return;
+ state = PATH_START;
+ } else {
+ failure = parseHost(url, buffer);
+ if (failure) return failure;
+ if (url.host == 'localhost') url.host = '';
+ if (stateOverride) return;
+ buffer = '';
+ state = PATH_START;
+ } continue;
+ } else buffer += char;
+ break;
+
+ case PATH_START:
+ if (isSpecial(url)) {
+ state = PATH;
+ if (char != '/' && char != '\\') continue;
+ } else if (!stateOverride && char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ state = PATH;
+ if (char != '/') continue;
+ } break;
+
+ case PATH:
+ if (
+ char == EOF || char == '/' ||
+ (char == '\\' && isSpecial(url)) ||
+ (!stateOverride && (char == '?' || char == '#'))
+ ) {
+ if (isDoubleDot(buffer)) {
+ shortenURLsPath(url);
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else if (isSingleDot(buffer)) {
+ if (char != '/' && !(char == '\\' && isSpecial(url))) {
+ url.path.push('');
+ }
+ } else {
+ if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
+ if (url.host) url.host = '';
+ buffer = buffer.charAt(0) + ':'; // normalize windows drive letter
+ }
+ url.path.push(buffer);
+ }
+ buffer = '';
+ if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
+ while (url.path.length > 1 && url.path[0] === '') {
+ url.path.shift();
+ }
+ }
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ }
+ } else {
+ buffer += percentEncode(char, pathPercentEncodeSet);
+ } break;
+
+ case CANNOT_BE_A_BASE_URL_PATH:
+ if (char == '?') {
+ url.query = '';
+ state = QUERY;
+ } else if (char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case QUERY:
+ if (!stateOverride && char == '#') {
+ url.fragment = '';
+ state = FRAGMENT;
+ } else if (char != EOF) {
+ if (char == "'" && isSpecial(url)) url.query += '%27';
+ else if (char == '#') url.query += '%23';
+ else url.query += percentEncode(char, C0ControlPercentEncodeSet);
+ } break;
+
+ case FRAGMENT:
+ if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);
+ break;
+ }
+
+ pointer++;
+ }
+};
+
+// `URL` constructor
+// https://url.spec.whatwg.org/#url-class
+var URLConstructor = function URL(url /* , base */) {
+ var that = anInstance(this, URLConstructor, 'URL');
+ var base = arguments.length > 1 ? arguments[1] : undefined;
+ var urlString = String(url);
+ var state = setInternalState(that, { type: 'URL' });
+ var baseState, failure;
+ if (base !== undefined) {
+ if (base instanceof URLConstructor) baseState = getInternalURLState(base);
+ else {
+ failure = parseURL(baseState = {}, String(base));
+ if (failure) throw TypeError(failure);
+ }
+ }
+ failure = parseURL(state, urlString, null, baseState);
+ if (failure) throw TypeError(failure);
+ var searchParams = state.searchParams = new URLSearchParams();
+ var searchParamsState = getInternalSearchParamsState(searchParams);
+ searchParamsState.updateSearchParams(state.query);
+ searchParamsState.updateURL = function () {
+ state.query = String(searchParams) || null;
+ };
+ if (!DESCRIPTORS) {
+ that.href = serializeURL.call(that);
+ that.origin = getOrigin.call(that);
+ that.protocol = getProtocol.call(that);
+ that.username = getUsername.call(that);
+ that.password = getPassword.call(that);
+ that.host = getHost.call(that);
+ that.hostname = getHostname.call(that);
+ that.port = getPort.call(that);
+ that.pathname = getPathname.call(that);
+ that.search = getSearch.call(that);
+ that.searchParams = getSearchParams.call(that);
+ that.hash = getHash.call(that);
+ }
+};
+
+var URLPrototype = URLConstructor.prototype;
+
+var serializeURL = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var username = url.username;
+ var password = url.password;
+ var host = url.host;
+ var port = url.port;
+ var path = url.path;
+ var query = url.query;
+ var fragment = url.fragment;
+ var output = scheme + ':';
+ if (host !== null) {
+ output += '//';
+ if (includesCredentials(url)) {
+ output += username + (password ? ':' + password : '') + '@';
+ }
+ output += serializeHost(host);
+ if (port !== null) output += ':' + port;
+ } else if (scheme == 'file') output += '//';
+ output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+ if (query !== null) output += '?' + query;
+ if (fragment !== null) output += '#' + fragment;
+ return output;
+};
+
+var getOrigin = function () {
+ var url = getInternalURLState(this);
+ var scheme = url.scheme;
+ var port = url.port;
+ if (scheme == 'blob') try {
+ return new URL(scheme.path[0]).origin;
+ } catch (error) {
+ return 'null';
+ }
+ if (scheme == 'file' || !isSpecial(url)) return 'null';
+ return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
+};
+
+var getProtocol = function () {
+ return getInternalURLState(this).scheme + ':';
+};
+
+var getUsername = function () {
+ return getInternalURLState(this).username;
+};
+
+var getPassword = function () {
+ return getInternalURLState(this).password;
+};
+
+var getHost = function () {
+ var url = getInternalURLState(this);
+ var host = url.host;
+ var port = url.port;
+ return host === null ? ''
+ : port === null ? serializeHost(host)
+ : serializeHost(host) + ':' + port;
+};
+
+var getHostname = function () {
+ var host = getInternalURLState(this).host;
+ return host === null ? '' : serializeHost(host);
+};
+
+var getPort = function () {
+ var port = getInternalURLState(this).port;
+ return port === null ? '' : String(port);
+};
+
+var getPathname = function () {
+ var url = getInternalURLState(this);
+ var path = url.path;
+ return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
+};
+
+var getSearch = function () {
+ var query = getInternalURLState(this).query;
+ return query ? '?' + query : '';
+};
+
+var getSearchParams = function () {
+ return getInternalURLState(this).searchParams;
+};
+
+var getHash = function () {
+ var fragment = getInternalURLState(this).fragment;
+ return fragment ? '#' + fragment : '';
+};
+
+var accessorDescriptor = function (getter, setter) {
+ return { get: getter, set: setter, configurable: true, enumerable: true };
+};
+
+if (DESCRIPTORS) {
+ defineProperties(URLPrototype, {
+ // `URL.prototype.href` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-href
+ href: accessorDescriptor(serializeURL, function (href) {
+ var url = getInternalURLState(this);
+ var urlString = String(href);
+ var failure = parseURL(url, urlString);
+ if (failure) throw TypeError(failure);
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.origin` getter
+ // https://url.spec.whatwg.org/#dom-url-origin
+ origin: accessorDescriptor(getOrigin),
+ // `URL.prototype.protocol` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-protocol
+ protocol: accessorDescriptor(getProtocol, function (protocol) {
+ var url = getInternalURLState(this);
+ parseURL(url, String(protocol) + ':', SCHEME_START);
+ }),
+ // `URL.prototype.username` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-username
+ username: accessorDescriptor(getUsername, function (username) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(username));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.username = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.password` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-password
+ password: accessorDescriptor(getPassword, function (password) {
+ var url = getInternalURLState(this);
+ var codePoints = arrayFrom(String(password));
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ url.password = '';
+ for (var i = 0; i < codePoints.length; i++) {
+ url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
+ }
+ }),
+ // `URL.prototype.host` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-host
+ host: accessorDescriptor(getHost, function (host) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(host), HOST);
+ }),
+ // `URL.prototype.hostname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hostname
+ hostname: accessorDescriptor(getHostname, function (hostname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ parseURL(url, String(hostname), HOSTNAME);
+ }),
+ // `URL.prototype.port` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-port
+ port: accessorDescriptor(getPort, function (port) {
+ var url = getInternalURLState(this);
+ if (cannotHaveUsernamePasswordPort(url)) return;
+ port = String(port);
+ if (port == '') url.port = null;
+ else parseURL(url, port, PORT);
+ }),
+ // `URL.prototype.pathname` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-pathname
+ pathname: accessorDescriptor(getPathname, function (pathname) {
+ var url = getInternalURLState(this);
+ if (url.cannotBeABaseURL) return;
+ url.path = [];
+ parseURL(url, pathname + '', PATH_START);
+ }),
+ // `URL.prototype.search` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-search
+ search: accessorDescriptor(getSearch, function (search) {
+ var url = getInternalURLState(this);
+ search = String(search);
+ if (search == '') {
+ url.query = null;
+ } else {
+ if ('?' == search.charAt(0)) search = search.slice(1);
+ url.query = '';
+ parseURL(url, search, QUERY);
+ }
+ getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
+ }),
+ // `URL.prototype.searchParams` getter
+ // https://url.spec.whatwg.org/#dom-url-searchparams
+ searchParams: accessorDescriptor(getSearchParams),
+ // `URL.prototype.hash` accessors pair
+ // https://url.spec.whatwg.org/#dom-url-hash
+ hash: accessorDescriptor(getHash, function (hash) {
+ var url = getInternalURLState(this);
+ hash = String(hash);
+ if (hash == '') {
+ url.fragment = null;
+ return;
+ }
+ if ('#' == hash.charAt(0)) hash = hash.slice(1);
+ url.fragment = '';
+ parseURL(url, hash, FRAGMENT);
+ })
+ });
+}
+
+// `URL.prototype.toJSON` method
+// https://url.spec.whatwg.org/#dom-url-tojson
+redefine(URLPrototype, 'toJSON', function toJSON() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+
+// `URL.prototype.toString` method
+// https://url.spec.whatwg.org/#URL-stringification-behavior
+redefine(URLPrototype, 'toString', function toString() {
+ return serializeURL.call(this);
+}, { enumerable: true });
+
+if (NativeURL) {
+ var nativeCreateObjectURL = NativeURL.createObjectURL;
+ var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
+ // `URL.createObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
+ if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
+ return nativeCreateObjectURL.apply(NativeURL, arguments);
+ });
+ // `URL.revokeObjectURL` method
+ // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
+ if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
+ return nativeRevokeObjectURL.apply(NativeURL, arguments);
+ });
+}
+
+setToStringTag(URLConstructor, 'URL');
+
+$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {
+ URL: URLConstructor
+});
+
+
+/***/ })
+
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ if(__webpack_module_cache__[moduleId]) {
+/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ !function() {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = function(exports, definition) {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ }();
+/******/
+/******/ /* webpack/runtime/global */
+/******/ !function() {
+/******/ __webpack_require__.g = (function() {
+/******/ if (typeof globalThis === 'object') return globalThis;
+/******/ try {
+/******/ return this || new Function('return this')();
+/******/ } catch (e) {
+/******/ if (typeof window === 'object') return window;
+/******/ }
+/******/ })();
+/******/ }();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ !function() {
+/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ }();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ !function() {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ }();
+/******/
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be in strict mode.
+!function() {
+"use strict";
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+ "Dropzone": function() { return /* reexport */ Dropzone; },
+ "default": function() { return /* binding */ dropzone_dist; }
+});
+
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.concat.js
+var es_array_concat = __webpack_require__(2222);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.filter.js
+var es_array_filter = __webpack_require__(7327);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.index-of.js
+var es_array_index_of = __webpack_require__(2772);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.iterator.js
+var es_array_iterator = __webpack_require__(6992);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.map.js
+var es_array_map = __webpack_require__(1249);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.slice.js
+var es_array_slice = __webpack_require__(7042);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.splice.js
+var es_array_splice = __webpack_require__(561);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.constructor.js
+var es_array_buffer_constructor = __webpack_require__(8264);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.function.name.js
+var es_function_name = __webpack_require__(8309);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.get-prototype-of.js
+var es_object_get_prototype_of = __webpack_require__(489);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.to-string.js
+var es_object_to_string = __webpack_require__(1539);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.exec.js
+var es_regexp_exec = __webpack_require__(4916);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.to-string.js
+var es_regexp_to_string = __webpack_require__(9714);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.iterator.js
+var es_string_iterator = __webpack_require__(8783);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.match.js
+var es_string_match = __webpack_require__(4723);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
+var es_string_replace = __webpack_require__(5306);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.split.js
+var es_string_split = __webpack_require__(3123);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.trim.js
+var es_string_trim = __webpack_require__(3210);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.uint8-array.js
+var es_typed_array_uint8_array = __webpack_require__(2472);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.copy-within.js
+var es_typed_array_copy_within = __webpack_require__(2990);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.every.js
+var es_typed_array_every = __webpack_require__(8927);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.fill.js
+var es_typed_array_fill = __webpack_require__(3105);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.filter.js
+var es_typed_array_filter = __webpack_require__(5035);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.find.js
+var es_typed_array_find = __webpack_require__(4345);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.find-index.js
+var es_typed_array_find_index = __webpack_require__(7174);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.for-each.js
+var es_typed_array_for_each = __webpack_require__(2846);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.includes.js
+var es_typed_array_includes = __webpack_require__(4731);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.index-of.js
+var es_typed_array_index_of = __webpack_require__(7209);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.iterator.js
+var es_typed_array_iterator = __webpack_require__(6319);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.join.js
+var es_typed_array_join = __webpack_require__(8867);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.last-index-of.js
+var es_typed_array_last_index_of = __webpack_require__(7789);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.map.js
+var es_typed_array_map = __webpack_require__(3739);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.reduce.js
+var es_typed_array_reduce = __webpack_require__(9368);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.reduce-right.js
+var es_typed_array_reduce_right = __webpack_require__(4483);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.reverse.js
+var es_typed_array_reverse = __webpack_require__(2056);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.set.js
+var es_typed_array_set = __webpack_require__(3462);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.slice.js
+var es_typed_array_slice = __webpack_require__(678);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.some.js
+var es_typed_array_some = __webpack_require__(7462);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.sort.js
+var es_typed_array_sort = __webpack_require__(3824);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.subarray.js
+var es_typed_array_subarray = __webpack_require__(5021);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.to-locale-string.js
+var es_typed_array_to_locale_string = __webpack_require__(2974);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.to-string.js
+var es_typed_array_to_string = __webpack_require__(5016);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.for-each.js
+var web_dom_collections_for_each = __webpack_require__(4747);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom-collections.iterator.js
+var web_dom_collections_iterator = __webpack_require__(3948);
+// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url.js
+var web_url = __webpack_require__(285);
+;// CONCATENATED MODULE: ./src/emitter.js
+
+
+function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
+
+function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+// The Emitter class provides the ability to call `.on()` on Dropzone to listen
+// to events.
+// It is strongly based on component's emitter class, and I removed the
+// functionality because of the dependency hell with different frameworks.
+var Emitter = /*#__PURE__*/function () {
+ function Emitter() {
+ _classCallCheck(this, Emitter);
+ }
+
+ _createClass(Emitter, [{
+ key: "on",
+ value: // Add an event listener for given event
+ function on(event, fn) {
+ this._callbacks = this._callbacks || {}; // Create namespace for this event
+
+ if (!this._callbacks[event]) {
+ this._callbacks[event] = [];
+ }
+
+ this._callbacks[event].push(fn);
+
+ return this;
+ }
+ }, {
+ key: "emit",
+ value: function emit(event) {
+ this._callbacks = this._callbacks || {};
+ var callbacks = this._callbacks[event];
+
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ if (callbacks) {
+ var _iterator = _createForOfIteratorHelper(callbacks, true),
+ _step;
+
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var callback = _step.value;
+ callback.apply(this, args);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ } // trigger a corresponding DOM event
+
+
+ if (this.element) {
+ this.element.dispatchEvent(this.makeEvent("dropzone:" + event, {
+ args: args
+ }));
+ }
+
+ return this;
+ }
+ }, {
+ key: "makeEvent",
+ value: function makeEvent(eventName, detail) {
+ var params = {
+ bubbles: true,
+ cancelable: true,
+ detail: detail
+ };
+
+ if (typeof window.CustomEvent === "function") {
+ return new CustomEvent(eventName, params);
+ } else {
+ // IE 11 support
+ // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
+ var evt = document.createEvent("CustomEvent");
+ evt.initCustomEvent(eventName, params.bubbles, params.cancelable, params.detail);
+ return evt;
+ }
+ } // Remove event listener for given event. If fn is not provided, all event
+ // listeners for that event will be removed. If neither is provided, all
+ // event listeners will be removed.
+
+ }, {
+ key: "off",
+ value: function off(event, fn) {
+ if (!this._callbacks || arguments.length === 0) {
+ this._callbacks = {};
+ return this;
+ } // specific event
+
+
+ var callbacks = this._callbacks[event];
+
+ if (!callbacks) {
+ return this;
+ } // remove all handlers
+
+
+ if (arguments.length === 1) {
+ delete this._callbacks[event];
+ return this;
+ } // remove specific handler
+
+
+ for (var i = 0; i < callbacks.length; i++) {
+ var callback = callbacks[i];
+
+ if (callback === fn) {
+ callbacks.splice(i, 1);
+ break;
+ }
+ }
+
+ return this;
+ }
+ }]);
+
+ return Emitter;
+}();
+
+
+;// CONCATENATED MODULE: ./src/preview-template.html
+// Module
+var code = " ";
+// Exports
+/* harmony default export */ var preview_template = (code);
+;// CONCATENATED MODULE: ./src/options.js
+
+
+
+
+
+function options_createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = options_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
+
+function options_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return options_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return options_arrayLikeToArray(o, minLen); }
+
+function options_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+
+
+var defaultOptions = {
+ /**
+ * Has to be specified on elements other than form (or when the form
+ * doesn't have an `action` attribute). You can also
+ * provide a function that will be called with `files` and
+ * must return the url (since `v3.12.0`)
+ */
+ url: null,
+
+ /**
+ * Can be changed to `"put"` if necessary. You can also provide a function
+ * that will be called with `files` and must return the method (since `v3.12.0`).
+ */
+ method: "post",
+
+ /**
+ * Will be set on the XHRequest.
+ */
+ withCredentials: false,
+
+ /**
+ * The timeout for the XHR requests in milliseconds (since `v4.4.0`).
+ * If set to null or 0, no timeout is going to be set.
+ */
+ timeout: null,
+
+ /**
+ * How many file uploads to process in parallel (See the
+ * Enqueuing file uploads documentation section for more info)
+ */
+ parallelUploads: 2,
+
+ /**
+ * Whether to send multiple files in one request. If
+ * this it set to true, then the fallback file input element will
+ * have the `multiple` attribute as well. This option will
+ * also trigger additional events (like `processingmultiple`). See the events
+ * documentation section for more information.
+ */
+ uploadMultiple: false,
+
+ /**
+ * Whether you want files to be uploaded in chunks to your server. This can't be
+ * used in combination with `uploadMultiple`.
+ *
+ * See [chunksUploaded](#config-chunksUploaded) for the callback to finalise an upload.
+ */
+ chunking: false,
+
+ /**
+ * If `chunking` is enabled, this defines whether **every** file should be chunked,
+ * even if the file size is below chunkSize. This means, that the additional chunk
+ * form data will be submitted and the `chunksUploaded` callback will be invoked.
+ */
+ forceChunking: false,
+
+ /**
+ * If `chunking` is `true`, then this defines the chunk size in bytes.
+ */
+ chunkSize: 2000000,
+
+ /**
+ * If `true`, the individual chunks of a file are being uploaded simultaneously.
+ */
+ parallelChunkUploads: false,
+
+ /**
+ * Whether a chunk should be retried if it fails.
+ */
+ retryChunks: false,
+
+ /**
+ * If `retryChunks` is true, how many times should it be retried.
+ */
+ retryChunksLimit: 3,
+
+ /**
+ * The maximum filesize (in bytes) that is allowed to be uploaded.
+ */
+ maxFilesize: 256,
+
+ /**
+ * The name of the file param that gets transferred.
+ * **NOTE**: If you have the option `uploadMultiple` set to `true`, then
+ * Dropzone will append `[]` to the name.
+ */
+ paramName: "file",
+
+ /**
+ * Whether thumbnails for images should be generated
+ */
+ createImageThumbnails: true,
+
+ /**
+ * In MB. When the filename exceeds this limit, the thumbnail will not be generated.
+ */
+ maxThumbnailFilesize: 10,
+
+ /**
+ * If `null`, the ratio of the image will be used to calculate it.
+ */
+ thumbnailWidth: 120,
+
+ /**
+ * The same as `thumbnailWidth`. If both are null, images will not be resized.
+ */
+ thumbnailHeight: 120,
+
+ /**
+ * How the images should be scaled down in case both, `thumbnailWidth` and `thumbnailHeight` are provided.
+ * Can be either `contain` or `crop`.
+ */
+ thumbnailMethod: "crop",
+
+ /**
+ * If set, images will be resized to these dimensions before being **uploaded**.
+ * If only one, `resizeWidth` **or** `resizeHeight` is provided, the original aspect
+ * ratio of the file will be preserved.
+ *
+ * The `options.transformFile` function uses these options, so if the `transformFile` function
+ * is overridden, these options don't do anything.
+ */
+ resizeWidth: null,
+
+ /**
+ * See `resizeWidth`.
+ */
+ resizeHeight: null,
+
+ /**
+ * The mime type of the resized image (before it gets uploaded to the server).
+ * If `null` the original mime type will be used. To force jpeg, for example, use `image/jpeg`.
+ * See `resizeWidth` for more information.
+ */
+ resizeMimeType: null,
+
+ /**
+ * The quality of the resized images. See `resizeWidth`.
+ */
+ resizeQuality: 0.8,
+
+ /**
+ * How the images should be scaled down in case both, `resizeWidth` and `resizeHeight` are provided.
+ * Can be either `contain` or `crop`.
+ */
+ resizeMethod: "contain",
+
+ /**
+ * The base that is used to calculate the **displayed** filesize. You can
+ * change this to 1024 if you would rather display kibibytes, mebibytes,
+ * etc... 1024 is technically incorrect, because `1024 bytes` are `1 kibibyte`
+ * not `1 kilobyte`. You can change this to `1024` if you don't care about
+ * validity.
+ */
+ filesizeBase: 1000,
+
+ /**
+ * If not `null` defines how many files this Dropzone handles. If it exceeds,
+ * the event `maxfilesexceeded` will be called. The dropzone element gets the
+ * class `dz-max-files-reached` accordingly so you can provide visual
+ * feedback.
+ */
+ maxFiles: null,
+
+ /**
+ * An optional object to send additional headers to the server. Eg:
+ * `{ "My-Awesome-Header": "header value" }`
+ */
+ headers: null,
+
+ /**
+ * If `true`, the dropzone element itself will be clickable, if `false`
+ * nothing will be clickable.
+ *
+ * You can also pass an HTML element, a CSS selector (for multiple elements)
+ * or an array of those. In that case, all of those elements will trigger an
+ * upload when clicked.
+ */
+ clickable: true,
+
+ /**
+ * Whether hidden files in directories should be ignored.
+ */
+ ignoreHiddenFiles: true,
+
+ /**
+ * The default implementation of `accept` checks the file's mime type or
+ * extension against this list. This is a comma separated list of mime
+ * types or file extensions.
+ *
+ * Eg.: `image/*,application/pdf,.psd`
+ *
+ * If the Dropzone is `clickable` this option will also be used as
+ * [`accept`](https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept)
+ * parameter on the hidden file input as well.
+ */
+ acceptedFiles: null,
+
+ /**
+ * **Deprecated!**
+ * Use acceptedFiles instead.
+ */
+ acceptedMimeTypes: null,
+
+ /**
+ * If false, files will be added to the queue but the queue will not be
+ * processed automatically.
+ * This can be useful if you need some additional user input before sending
+ * files (or if you want want all files sent at once).
+ * If you're ready to send the file simply call `myDropzone.processQueue()`.
+ *
+ * See the [enqueuing file uploads](#enqueuing-file-uploads) documentation
+ * section for more information.
+ */
+ autoProcessQueue: true,
+
+ /**
+ * If false, files added to the dropzone will not be queued by default.
+ * You'll have to call `enqueueFile(file)` manually.
+ */
+ autoQueue: true,
+
+ /**
+ * If `true`, this will add a link to every file preview to remove or cancel (if
+ * already uploading) the file. The `dictCancelUpload`, `dictCancelUploadConfirmation`
+ * and `dictRemoveFile` options are used for the wording.
+ */
+ addRemoveLinks: false,
+
+ /**
+ * Defines where to display the file previews – if `null` the
+ * Dropzone element itself is used. Can be a plain `HTMLElement` or a CSS
+ * selector. The element should have the `dropzone-previews` class so
+ * the previews are displayed properly.
+ */
+ previewsContainer: null,
+
+ /**
+ * Set this to `true` if you don't want previews to be shown.
+ */
+ disablePreviews: false,
+
+ /**
+ * This is the element the hidden input field (which is used when clicking on the
+ * dropzone to trigger file selection) will be appended to. This might
+ * be important in case you use frameworks to switch the content of your page.
+ *
+ * Can be a selector string, or an element directly.
+ */
+ hiddenInputContainer: "body",
+
+ /**
+ * If null, no capture type will be specified
+ * If camera, mobile devices will skip the file selection and choose camera
+ * If microphone, mobile devices will skip the file selection and choose the microphone
+ * If camcorder, mobile devices will skip the file selection and choose the camera in video mode
+ * On apple devices multiple must be set to false. AcceptedFiles may need to
+ * be set to an appropriate mime type (e.g. "image/*", "audio/*", or "video/*").
+ */
+ capture: null,
+
+ /**
+ * **Deprecated**. Use `renameFile` instead.
+ */
+ renameFilename: null,
+
+ /**
+ * A function that is invoked before the file is uploaded to the server and renames the file.
+ * This function gets the `File` as argument and can use the `file.name`. The actual name of the
+ * file that gets used during the upload can be accessed through `file.upload.filename`.
+ */
+ renameFile: null,
+
+ /**
+ * If `true` the fallback will be forced. This is very useful to test your server
+ * implementations first and make sure that everything works as
+ * expected without dropzone if you experience problems, and to test
+ * how your fallbacks will look.
+ */
+ forceFallback: false,
+
+ /**
+ * The text used before any files are dropped.
+ */
+ dictDefaultMessage: "Drop files here to upload",
+
+ /**
+ * The text that replaces the default message text it the browser is not supported.
+ */
+ dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
+
+ /**
+ * The text that will be added before the fallback form.
+ * If you provide a fallback element yourself, or if this option is `null` this will
+ * be ignored.
+ */
+ dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
+
+ /**
+ * If the filesize is too big.
+ * `{{filesize}}` and `{{maxFilesize}}` will be replaced with the respective configuration values.
+ */
+ dictFileTooBig: "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",
+
+ /**
+ * If the file doesn't match the file type.
+ */
+ dictInvalidFileType: "You can't upload files of this type.",
+
+ /**
+ * If the server response was invalid.
+ * `{{statusCode}}` will be replaced with the servers status code.
+ */
+ dictResponseError: "Server responded with {{statusCode}} code.",
+
+ /**
+ * If `addRemoveLinks` is true, the text to be used for the cancel upload link.
+ */
+ dictCancelUpload: "Cancel upload",
+
+ /**
+ * The text that is displayed if an upload was manually canceled
+ */
+ dictUploadCanceled: "Upload canceled.",
+
+ /**
+ * If `addRemoveLinks` is true, the text to be used for confirmation when cancelling upload.
+ */
+ dictCancelUploadConfirmation: "Are you sure you want to cancel this upload?",
+
+ /**
+ * If `addRemoveLinks` is true, the text to be used to remove a file.
+ */
+ dictRemoveFile: "Remove file",
+
+ /**
+ * If this is not null, then the user will be prompted before removing a file.
+ */
+ dictRemoveFileConfirmation: null,
+
+ /**
+ * Displayed if `maxFiles` is st and exceeded.
+ * The string `{{maxFiles}}` will be replaced by the configuration value.
+ */
+ dictMaxFilesExceeded: "You can not upload any more files.",
+
+ /**
+ * Allows you to translate the different units. Starting with `tb` for terabytes and going down to
+ * `b` for bytes.
+ */
+ dictFileSizeUnits: {
+ tb: "TB",
+ gb: "GB",
+ mb: "MB",
+ kb: "KB",
+ b: "b"
+ },
+
+ /**
+ * Called when dropzone initialized
+ * You can add event listeners here
+ */
+ init: function init() {},
+
+ /**
+ * Can be an **object** of additional parameters to transfer to the server, **or** a `Function`
+ * that gets invoked with the `files`, `xhr` and, if it's a chunked upload, `chunk` arguments. In case
+ * of a function, this needs to return a map.
+ *
+ * The default implementation does nothing for normal uploads, but adds relevant information for
+ * chunked uploads.
+ *
+ * This is the same as adding hidden input fields in the form element.
+ */
+ params: function params(files, xhr, chunk) {
+ if (chunk) {
+ return {
+ dzuuid: chunk.file.upload.uuid,
+ dzchunkindex: chunk.index,
+ dztotalfilesize: chunk.file.size,
+ dzchunksize: this.options.chunkSize,
+ dztotalchunkcount: chunk.file.upload.totalChunkCount,
+ dzchunkbyteoffset: chunk.index * this.options.chunkSize
+ };
+ }
+ },
+
+ /**
+ * A function that gets a [file](https://developer.mozilla.org/en-US/docs/DOM/File)
+ * and a `done` function as parameters.
+ *
+ * If the done function is invoked without arguments, the file is "accepted" and will
+ * be processed. If you pass an error message, the file is rejected, and the error
+ * message will be displayed.
+ * This function will not be called if the file is too big or doesn't match the mime types.
+ */
+ accept: function accept(file, done) {
+ return done();
+ },
+
+ /**
+ * The callback that will be invoked when all chunks have been uploaded for a file.
+ * It gets the file for which the chunks have been uploaded as the first parameter,
+ * and the `done` function as second. `done()` needs to be invoked when everything
+ * needed to finish the upload process is done.
+ */
+ chunksUploaded: function chunksUploaded(file, done) {
+ done();
+ },
+
+ /**
+ * Gets called when the browser is not supported.
+ * The default implementation shows the fallback input field and adds
+ * a text.
+ */
+ fallback: function fallback() {
+ // This code should pass in IE7... :(
+ var messageElement;
+ this.element.className = "".concat(this.element.className, " dz-browser-not-supported");
+
+ var _iterator = options_createForOfIteratorHelper(this.element.getElementsByTagName("div"), true),
+ _step;
+
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var child = _step.value;
+
+ if (/(^| )dz-message($| )/.test(child.className)) {
+ messageElement = child;
+ child.className = "dz-message"; // Removes the 'dz-default' class
+
+ break;
+ }
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+
+ if (!messageElement) {
+ messageElement = Dropzone.createElement('
');
+ this.element.appendChild(messageElement);
+ }
+
+ var span = messageElement.getElementsByTagName("span")[0];
+
+ if (span) {
+ if (span.textContent != null) {
+ span.textContent = this.options.dictFallbackMessage;
+ } else if (span.innerText != null) {
+ span.innerText = this.options.dictFallbackMessage;
+ }
+ }
+
+ return this.element.appendChild(this.getFallbackForm());
+ },
+
+ /**
+ * Gets called to calculate the thumbnail dimensions.
+ *
+ * It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:
+ *
+ * - `srcWidth` & `srcHeight` (required)
+ * - `trgWidth` & `trgHeight` (required)
+ * - `srcX` & `srcY` (optional, default `0`)
+ * - `trgX` & `trgY` (optional, default `0`)
+ *
+ * Those values are going to be used by `ctx.drawImage()`.
+ */
+ resize: function resize(file, width, height, resizeMethod) {
+ var info = {
+ srcX: 0,
+ srcY: 0,
+ srcWidth: file.width,
+ srcHeight: file.height
+ };
+ var srcRatio = file.width / file.height; // Automatically calculate dimensions if not specified
+
+ if (width == null && height == null) {
+ width = info.srcWidth;
+ height = info.srcHeight;
+ } else if (width == null) {
+ width = height * srcRatio;
+ } else if (height == null) {
+ height = width / srcRatio;
+ } // Make sure images aren't upscaled
+
+
+ width = Math.min(width, info.srcWidth);
+ height = Math.min(height, info.srcHeight);
+ var trgRatio = width / height;
+
+ if (info.srcWidth > width || info.srcHeight > height) {
+ // Image is bigger and needs rescaling
+ if (resizeMethod === "crop") {
+ if (srcRatio > trgRatio) {
+ info.srcHeight = file.height;
+ info.srcWidth = info.srcHeight * trgRatio;
+ } else {
+ info.srcWidth = file.width;
+ info.srcHeight = info.srcWidth / trgRatio;
+ }
+ } else if (resizeMethod === "contain") {
+ // Method 'contain'
+ if (srcRatio > trgRatio) {
+ height = width / srcRatio;
+ } else {
+ width = height * srcRatio;
+ }
+ } else {
+ throw new Error("Unknown resizeMethod '".concat(resizeMethod, "'"));
+ }
+ }
+
+ info.srcX = (file.width - info.srcWidth) / 2;
+ info.srcY = (file.height - info.srcHeight) / 2;
+ info.trgWidth = width;
+ info.trgHeight = height;
+ return info;
+ },
+
+ /**
+ * Can be used to transform the file (for example, resize an image if necessary).
+ *
+ * The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes
+ * images according to those dimensions.
+ *
+ * Gets the `file` as the first parameter, and a `done()` function as the second, that needs
+ * to be invoked with the file when the transformation is done.
+ */
+ transformFile: function transformFile(file, done) {
+ if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) {
+ return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);
+ } else {
+ return done(file);
+ }
+ },
+
+ /**
+ * A string that contains the template used for each dropped
+ * file. Change it to fulfill your needs but make sure to properly
+ * provide all elements.
+ *
+ * If you want to use an actual HTML element instead of providing a String
+ * as a config option, you could create a div with the id `tpl`,
+ * put the template inside it and provide the element like this:
+ *
+ * document
+ * .querySelector('#tpl')
+ * .innerHTML
+ *
+ */
+ previewTemplate: preview_template,
+
+ /*
+ Those functions register themselves to the events on init and handle all
+ the user interface specific stuff. Overwriting them won't break the upload
+ but can break the way it's displayed.
+ You can overwrite them if you don't like the default behavior. If you just
+ want to add an additional event handler, register it on the dropzone object
+ and don't overwrite those options.
+ */
+ // Those are self explanatory and simply concern the DragnDrop.
+ drop: function drop(e) {
+ return this.element.classList.remove("dz-drag-hover");
+ },
+ dragstart: function dragstart(e) {},
+ dragend: function dragend(e) {
+ return this.element.classList.remove("dz-drag-hover");
+ },
+ dragenter: function dragenter(e) {
+ return this.element.classList.add("dz-drag-hover");
+ },
+ dragover: function dragover(e) {
+ return this.element.classList.add("dz-drag-hover");
+ },
+ dragleave: function dragleave(e) {
+ return this.element.classList.remove("dz-drag-hover");
+ },
+ paste: function paste(e) {},
+ // Called whenever there are no files left in the dropzone anymore, and the
+ // dropzone should be displayed as if in the initial state.
+ reset: function reset() {
+ return this.element.classList.remove("dz-started");
+ },
+ // Called when a file is added to the queue
+ // Receives `file`
+ addedfile: function addedfile(file) {
+ var _this = this;
+
+ if (this.element === this.previewsContainer) {
+ this.element.classList.add("dz-started");
+ }
+
+ if (this.previewsContainer && !this.options.disablePreviews) {
+ file.previewElement = Dropzone.createElement(this.options.previewTemplate.trim());
+ file.previewTemplate = file.previewElement; // Backwards compatibility
+
+ this.previewsContainer.appendChild(file.previewElement);
+
+ var _iterator2 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-name]"), true),
+ _step2;
+
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var node = _step2.value;
+ node.textContent = file.name;
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
+
+ var _iterator3 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-size]"), true),
+ _step3;
+
+ try {
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
+ node = _step3.value;
+ node.innerHTML = this.filesize(file.size);
+ }
+ } catch (err) {
+ _iterator3.e(err);
+ } finally {
+ _iterator3.f();
+ }
+
+ if (this.options.addRemoveLinks) {
+ file._removeLink = Dropzone.createElement("".concat(this.options.dictRemoveFile, ""));
+ file.previewElement.appendChild(file._removeLink);
+ }
+
+ var removeFileEvent = function removeFileEvent(e) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (file.status === Dropzone.UPLOADING) {
+ return Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function () {
+ return _this.removeFile(file);
+ });
+ } else {
+ if (_this.options.dictRemoveFileConfirmation) {
+ return Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function () {
+ return _this.removeFile(file);
+ });
+ } else {
+ return _this.removeFile(file);
+ }
+ }
+ };
+
+ var _iterator4 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-remove]"), true),
+ _step4;
+
+ try {
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
+ var removeLink = _step4.value;
+ removeLink.addEventListener("click", removeFileEvent);
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
+ }
+ },
+ // Called whenever a file is removed.
+ removedfile: function removedfile(file) {
+ if (file.previewElement != null && file.previewElement.parentNode != null) {
+ file.previewElement.parentNode.removeChild(file.previewElement);
+ }
+
+ return this._updateMaxFilesReachedClass();
+ },
+ // Called when a thumbnail has been generated
+ // Receives `file` and `dataUrl`
+ thumbnail: function thumbnail(file, dataUrl) {
+ if (file.previewElement) {
+ file.previewElement.classList.remove("dz-file-preview");
+
+ var _iterator5 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-thumbnail]"), true),
+ _step5;
+
+ try {
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
+ var thumbnailElement = _step5.value;
+ thumbnailElement.alt = file.name;
+ thumbnailElement.src = dataUrl;
+ }
+ } catch (err) {
+ _iterator5.e(err);
+ } finally {
+ _iterator5.f();
+ }
+
+ return setTimeout(function () {
+ return file.previewElement.classList.add("dz-image-preview");
+ }, 1);
+ }
+ },
+ // Called whenever an error occurs
+ // Receives `file` and `message`
+ error: function error(file, message) {
+ if (file.previewElement) {
+ file.previewElement.classList.add("dz-error");
+
+ if (typeof message !== "string" && message.error) {
+ message = message.error;
+ }
+
+ var _iterator6 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-errormessage]"), true),
+ _step6;
+
+ try {
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
+ var node = _step6.value;
+ node.textContent = message;
+ }
+ } catch (err) {
+ _iterator6.e(err);
+ } finally {
+ _iterator6.f();
+ }
+ }
+ },
+ errormultiple: function errormultiple() {},
+ // Called when a file gets processed. Since there is a cue, not all added
+ // files are processed immediately.
+ // Receives `file`
+ processing: function processing(file) {
+ if (file.previewElement) {
+ file.previewElement.classList.add("dz-processing");
+
+ if (file._removeLink) {
+ return file._removeLink.innerHTML = this.options.dictCancelUpload;
+ }
+ }
+ },
+ processingmultiple: function processingmultiple() {},
+ // Called whenever the upload progress gets updated.
+ // Receives `file`, `progress` (percentage 0-100) and `bytesSent`.
+ // To get the total number of bytes of the file, use `file.size`
+ uploadprogress: function uploadprogress(file, progress, bytesSent) {
+ if (file.previewElement) {
+ var _iterator7 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll("[data-dz-uploadprogress]"), true),
+ _step7;
+
+ try {
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
+ var node = _step7.value;
+ node.nodeName === "PROGRESS" ? node.value = progress : node.style.width = "".concat(progress, "%");
+ }
+ } catch (err) {
+ _iterator7.e(err);
+ } finally {
+ _iterator7.f();
+ }
+ }
+ },
+ // Called whenever the total upload progress gets updated.
+ // Called with totalUploadProgress (0-100), totalBytes and totalBytesSent
+ totaluploadprogress: function totaluploadprogress() {},
+ // Called just before the file is sent. Gets the `xhr` object as second
+ // parameter, so you can modify it (for example to add a CSRF token) and a
+ // `formData` object to add additional information.
+ sending: function sending() {},
+ sendingmultiple: function sendingmultiple() {},
+ // When the complete upload is finished and successful
+ // Receives `file`
+ success: function success(file) {
+ if (file.previewElement) {
+ return file.previewElement.classList.add("dz-success");
+ }
+ },
+ successmultiple: function successmultiple() {},
+ // When the upload is canceled.
+ canceled: function canceled(file) {
+ return this.emit("error", file, this.options.dictUploadCanceled);
+ },
+ canceledmultiple: function canceledmultiple() {},
+ // When the upload is finished, either with success or an error.
+ // Receives `file`
+ complete: function complete(file) {
+ if (file._removeLink) {
+ file._removeLink.innerHTML = this.options.dictRemoveFile;
+ }
+
+ if (file.previewElement) {
+ return file.previewElement.classList.add("dz-complete");
+ }
+ },
+ completemultiple: function completemultiple() {},
+ maxfilesexceeded: function maxfilesexceeded() {},
+ maxfilesreached: function maxfilesreached() {},
+ queuecomplete: function queuecomplete() {},
+ addedfiles: function addedfiles() {}
+};
+/* harmony default export */ var src_options = (defaultOptions);
+;// CONCATENATED MODULE: ./src/dropzone.js
+function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+function dropzone_createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = dropzone_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
+
+function dropzone_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return dropzone_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return dropzone_arrayLikeToArray(o, minLen); }
+
+function dropzone_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function dropzone_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function dropzone_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function dropzone_createClass(Constructor, protoProps, staticProps) { if (protoProps) dropzone_defineProperties(Constructor.prototype, protoProps); if (staticProps) dropzone_defineProperties(Constructor, staticProps); return Constructor; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+
+
+
+var Dropzone = /*#__PURE__*/function (_Emitter) {
+ _inherits(Dropzone, _Emitter);
+
+ var _super = _createSuper(Dropzone);
+
+ function Dropzone(el, options) {
+ var _this;
+
+ dropzone_classCallCheck(this, Dropzone);
+
+ _this = _super.call(this);
+ var fallback, left;
+ _this.element = el; // For backwards compatibility since the version was in the prototype previously
+
+ _this.version = Dropzone.version;
+ _this.clickableElements = [];
+ _this.listeners = [];
+ _this.files = []; // All files
+
+ if (typeof _this.element === "string") {
+ _this.element = document.querySelector(_this.element);
+ } // Not checking if instance of HTMLElement or Element since IE9 is extremely weird.
+
+
+ if (!_this.element || _this.element.nodeType == null) {
+ throw new Error("Invalid dropzone element.");
+ }
+
+ if (_this.element.dropzone) {
+ throw new Error("Dropzone already attached.");
+ } // Now add this dropzone to the instances.
+
+
+ Dropzone.instances.push(_assertThisInitialized(_this)); // Put the dropzone inside the element itself.
+
+ _this.element.dropzone = _assertThisInitialized(_this);
+ var elementOptions = (left = Dropzone.optionsForElement(_this.element)) != null ? left : {};
+ _this.options = Dropzone.extend({}, src_options, elementOptions, options != null ? options : {});
+ _this.options.previewTemplate = _this.options.previewTemplate.replace(/\n*/g, ""); // If the browser failed, just call the fallback and leave
+
+ if (_this.options.forceFallback || !Dropzone.isBrowserSupported()) {
+ return _possibleConstructorReturn(_this, _this.options.fallback.call(_assertThisInitialized(_this)));
+ } // @options.url = @element.getAttribute "action" unless @options.url?
+
+
+ if (_this.options.url == null) {
+ _this.options.url = _this.element.getAttribute("action");
+ }
+
+ if (!_this.options.url) {
+ throw new Error("No URL provided.");
+ }
+
+ if (_this.options.acceptedFiles && _this.options.acceptedMimeTypes) {
+ throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
+ }
+
+ if (_this.options.uploadMultiple && _this.options.chunking) {
+ throw new Error("You cannot set both: uploadMultiple and chunking.");
+ } // Backwards compatibility
+
+
+ if (_this.options.acceptedMimeTypes) {
+ _this.options.acceptedFiles = _this.options.acceptedMimeTypes;
+ delete _this.options.acceptedMimeTypes;
+ } // Backwards compatibility
+
+
+ if (_this.options.renameFilename != null) {
+ _this.options.renameFile = function (file) {
+ return _this.options.renameFilename.call(_assertThisInitialized(_this), file.name, file);
+ };
+ }
+
+ if (typeof _this.options.method === "string") {
+ _this.options.method = _this.options.method.toUpperCase();
+ }
+
+ if ((fallback = _this.getExistingFallback()) && fallback.parentNode) {
+ // Remove the fallback
+ fallback.parentNode.removeChild(fallback);
+ } // Display previews in the previewsContainer element or the Dropzone element unless explicitly set to false
+
+
+ if (_this.options.previewsContainer !== false) {
+ if (_this.options.previewsContainer) {
+ _this.previewsContainer = Dropzone.getElement(_this.options.previewsContainer, "previewsContainer");
+ } else {
+ _this.previewsContainer = _this.element;
+ }
+ }
+
+ if (_this.options.clickable) {
+ if (_this.options.clickable === true) {
+ _this.clickableElements = [_this.element];
+ } else {
+ _this.clickableElements = Dropzone.getElements(_this.options.clickable, "clickable");
+ }
+ }
+
+ _this.init();
+
+ return _this;
+ } // Returns all files that have been accepted
+
+
+ dropzone_createClass(Dropzone, [{
+ key: "getAcceptedFiles",
+ value: function getAcceptedFiles() {
+ return this.files.filter(function (file) {
+ return file.accepted;
+ }).map(function (file) {
+ return file;
+ });
+ } // Returns all files that have been rejected
+ // Not sure when that's going to be useful, but added for completeness.
+
+ }, {
+ key: "getRejectedFiles",
+ value: function getRejectedFiles() {
+ return this.files.filter(function (file) {
+ return !file.accepted;
+ }).map(function (file) {
+ return file;
+ });
+ }
+ }, {
+ key: "getFilesWithStatus",
+ value: function getFilesWithStatus(status) {
+ return this.files.filter(function (file) {
+ return file.status === status;
+ }).map(function (file) {
+ return file;
+ });
+ } // Returns all files that are in the queue
+
+ }, {
+ key: "getQueuedFiles",
+ value: function getQueuedFiles() {
+ return this.getFilesWithStatus(Dropzone.QUEUED);
+ }
+ }, {
+ key: "getUploadingFiles",
+ value: function getUploadingFiles() {
+ return this.getFilesWithStatus(Dropzone.UPLOADING);
+ }
+ }, {
+ key: "getAddedFiles",
+ value: function getAddedFiles() {
+ return this.getFilesWithStatus(Dropzone.ADDED);
+ } // Files that are either queued or uploading
+
+ }, {
+ key: "getActiveFiles",
+ value: function getActiveFiles() {
+ return this.files.filter(function (file) {
+ return file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED;
+ }).map(function (file) {
+ return file;
+ });
+ } // The function that gets called when Dropzone is initialized. You
+ // can (and should) setup event listeners inside this function.
+
+ }, {
+ key: "init",
+ value: function init() {
+ var _this2 = this;
+
+ // In case it isn't set already
+ if (this.element.tagName === "form") {
+ this.element.setAttribute("enctype", "multipart/form-data");
+ }
+
+ if (this.element.classList.contains("dropzone") && !this.element.querySelector(".dz-message")) {
+ this.element.appendChild(Dropzone.createElement("")));
+ }
+
+ if (this.clickableElements.length) {
+ var setupHiddenFileInput = function setupHiddenFileInput() {
+ if (_this2.hiddenFileInput) {
+ _this2.hiddenFileInput.parentNode.removeChild(_this2.hiddenFileInput);
+ }
+
+ _this2.hiddenFileInput = document.createElement("input");
+
+ _this2.hiddenFileInput.setAttribute("type", "file");
+
+ if (_this2.options.maxFiles === null || _this2.options.maxFiles > 1) {
+ _this2.hiddenFileInput.setAttribute("multiple", "multiple");
+ }
+
+ _this2.hiddenFileInput.className = "dz-hidden-input";
+
+ if (_this2.options.acceptedFiles !== null) {
+ _this2.hiddenFileInput.setAttribute("accept", _this2.options.acceptedFiles);
+ }
+
+ if (_this2.options.capture !== null) {
+ _this2.hiddenFileInput.setAttribute("capture", _this2.options.capture);
+ } // Making sure that no one can "tab" into this field.
+
+
+ _this2.hiddenFileInput.setAttribute("tabindex", "-1"); // Not setting `display="none"` because some browsers don't accept clicks
+ // on elements that aren't displayed.
+
+
+ _this2.hiddenFileInput.style.visibility = "hidden";
+ _this2.hiddenFileInput.style.position = "absolute";
+ _this2.hiddenFileInput.style.top = "0";
+ _this2.hiddenFileInput.style.left = "0";
+ _this2.hiddenFileInput.style.height = "0";
+ _this2.hiddenFileInput.style.width = "0";
+ Dropzone.getElement(_this2.options.hiddenInputContainer, "hiddenInputContainer").appendChild(_this2.hiddenFileInput);
+
+ _this2.hiddenFileInput.addEventListener("change", function () {
+ var files = _this2.hiddenFileInput.files;
+
+ if (files.length) {
+ var _iterator = dropzone_createForOfIteratorHelper(files, true),
+ _step;
+
+ try {
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
+ var file = _step.value;
+
+ _this2.addFile(file);
+ }
+ } catch (err) {
+ _iterator.e(err);
+ } finally {
+ _iterator.f();
+ }
+ }
+
+ _this2.emit("addedfiles", files);
+
+ setupHiddenFileInput();
+ });
+ };
+
+ setupHiddenFileInput();
+ }
+
+ this.URL = window.URL !== null ? window.URL : window.webkitURL; // Setup all event listeners on the Dropzone object itself.
+ // They're not in @setupEventListeners() because they shouldn't be removed
+ // again when the dropzone gets disabled.
+
+ var _iterator2 = dropzone_createForOfIteratorHelper(this.events, true),
+ _step2;
+
+ try {
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
+ var eventName = _step2.value;
+ this.on(eventName, this.options[eventName]);
+ }
+ } catch (err) {
+ _iterator2.e(err);
+ } finally {
+ _iterator2.f();
+ }
+
+ this.on("uploadprogress", function () {
+ return _this2.updateTotalUploadProgress();
+ });
+ this.on("removedfile", function () {
+ return _this2.updateTotalUploadProgress();
+ });
+ this.on("canceled", function (file) {
+ return _this2.emit("complete", file);
+ }); // Emit a `queuecomplete` event if all files finished uploading.
+
+ this.on("complete", function (file) {
+ if (_this2.getAddedFiles().length === 0 && _this2.getUploadingFiles().length === 0 && _this2.getQueuedFiles().length === 0) {
+ // This needs to be deferred so that `queuecomplete` really triggers after `complete`
+ return setTimeout(function () {
+ return _this2.emit("queuecomplete");
+ }, 0);
+ }
+ });
+
+ var containsFiles = function containsFiles(e) {
+ if (e.dataTransfer.types) {
+ // Because e.dataTransfer.types is an Object in
+ // IE, we need to iterate like this instead of
+ // using e.dataTransfer.types.some()
+ for (var i = 0; i < e.dataTransfer.types.length; i++) {
+ if (e.dataTransfer.types[i] === "Files") return true;
+ }
+ }
+
+ return false;
+ };
+
+ var noPropagation = function noPropagation(e) {
+ // If there are no files, we don't want to stop
+ // propagation so we don't interfere with other
+ // drag and drop behaviour.
+ if (!containsFiles(e)) return;
+ e.stopPropagation();
+
+ if (e.preventDefault) {
+ return e.preventDefault();
+ } else {
+ return e.returnValue = false;
+ }
+ }; // Create the listeners
+
+
+ this.listeners = [{
+ element: this.element,
+ events: {
+ dragstart: function dragstart(e) {
+ return _this2.emit("dragstart", e);
+ },
+ dragenter: function dragenter(e) {
+ noPropagation(e);
+ return _this2.emit("dragenter", e);
+ },
+ dragover: function dragover(e) {
+ // Makes it possible to drag files from chrome's download bar
+ // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar
+ // Try is required to prevent bug in Internet Explorer 11 (SCRIPT65535 exception)
+ var efct;
+
+ try {
+ efct = e.dataTransfer.effectAllowed;
+ } catch (error) {}
+
+ e.dataTransfer.dropEffect = "move" === efct || "linkMove" === efct ? "move" : "copy";
+ noPropagation(e);
+ return _this2.emit("dragover", e);
+ },
+ dragleave: function dragleave(e) {
+ return _this2.emit("dragleave", e);
+ },
+ drop: function drop(e) {
+ noPropagation(e);
+ return _this2.drop(e);
+ },
+ dragend: function dragend(e) {
+ return _this2.emit("dragend", e);
+ }
+ } // This is disabled right now, because the browsers don't implement it properly.
+ // "paste": (e) =>
+ // noPropagation e
+ // @paste e
+
+ }];
+ this.clickableElements.forEach(function (clickableElement) {
+ return _this2.listeners.push({
+ element: clickableElement,
+ events: {
+ click: function click(evt) {
+ // Only the actual dropzone or the message element should trigger file selection
+ if (clickableElement !== _this2.element || evt.target === _this2.element || Dropzone.elementInside(evt.target, _this2.element.querySelector(".dz-message"))) {
+ _this2.hiddenFileInput.click(); // Forward the click
+
+ }
+
+ return true;
+ }
+ }
+ });
+ });
+ this.enable();
+ return this.options.init.call(this);
+ } // Not fully tested yet
+
+ }, {
+ key: "destroy",
+ value: function destroy() {
+ this.disable();
+ this.removeAllFiles(true);
+
+ if (this.hiddenFileInput != null ? this.hiddenFileInput.parentNode : undefined) {
+ this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);
+ this.hiddenFileInput = null;
+ }
+
+ delete this.element.dropzone;
+ return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);
+ }
+ }, {
+ key: "updateTotalUploadProgress",
+ value: function updateTotalUploadProgress() {
+ var totalUploadProgress;
+ var totalBytesSent = 0;
+ var totalBytes = 0;
+ var activeFiles = this.getActiveFiles();
+
+ if (activeFiles.length) {
+ var _iterator3 = dropzone_createForOfIteratorHelper(this.getActiveFiles(), true),
+ _step3;
+
+ try {
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
+ var file = _step3.value;
+ totalBytesSent += file.upload.bytesSent;
+ totalBytes += file.upload.total;
+ }
+ } catch (err) {
+ _iterator3.e(err);
+ } finally {
+ _iterator3.f();
+ }
+
+ totalUploadProgress = 100 * totalBytesSent / totalBytes;
+ } else {
+ totalUploadProgress = 100;
+ }
+
+ return this.emit("totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent);
+ } // @options.paramName can be a function taking one parameter rather than a string.
+ // A parameter name for a file is obtained simply by calling this with an index number.
+
+ }, {
+ key: "_getParamName",
+ value: function _getParamName(n) {
+ if (typeof this.options.paramName === "function") {
+ return this.options.paramName(n);
+ } else {
+ return "".concat(this.options.paramName).concat(this.options.uploadMultiple ? "[".concat(n, "]") : "");
+ }
+ } // If @options.renameFile is a function,
+ // the function will be used to rename the file.name before appending it to the formData
+
+ }, {
+ key: "_renameFile",
+ value: function _renameFile(file) {
+ if (typeof this.options.renameFile !== "function") {
+ return file.name;
+ }
+
+ return this.options.renameFile(file);
+ } // Returns a form that can be used as fallback if the browser does not support DragnDrop
+ //
+ // If the dropzone is already a form, only the input field and button are returned. Otherwise a complete form element is provided.
+ // This code has to pass in IE7 :(
+
+ }, {
+ key: "getFallbackForm",
+ value: function getFallbackForm() {
+ var existingFallback, form;
+
+ if (existingFallback = this.getExistingFallback()) {
+ return existingFallback;
+ }
+
+ var fieldsString = '");
+ var fields = Dropzone.createElement(fieldsString);
+
+ if (this.element.tagName !== "FORM") {
+ form = Dropzone.createElement(""));
+ form.appendChild(fields);
+ } else {
+ // Make sure that the enctype and method attributes are set properly
+ this.element.setAttribute("enctype", "multipart/form-data");
+ this.element.setAttribute("method", this.options.method);
+ }
+
+ return form != null ? form : fields;
+ } // Returns the fallback elements if they exist already
+ //
+ // This code has to pass in IE7 :(
+
+ }, {
+ key: "getExistingFallback",
+ value: function getExistingFallback() {
+ var getFallback = function getFallback(elements) {
+ var _iterator4 = dropzone_createForOfIteratorHelper(elements, true),
+ _step4;
+
+ try {
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
+ var el = _step4.value;
+
+ if (/(^| )fallback($| )/.test(el.className)) {
+ return el;
+ }
+ }
+ } catch (err) {
+ _iterator4.e(err);
+ } finally {
+ _iterator4.f();
+ }
+ };
+
+ for (var _i = 0, _arr = ["div", "form"]; _i < _arr.length; _i++) {
+ var tagName = _arr[_i];
+ var fallback;
+
+ if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {
+ return fallback;
+ }
+ }
+ } // Activates all listeners stored in @listeners
+
+ }, {
+ key: "setupEventListeners",
+ value: function setupEventListeners() {
+ return this.listeners.map(function (elementListeners) {
+ return function () {
+ var result = [];
+
+ for (var event in elementListeners.events) {
+ var listener = elementListeners.events[event];
+ result.push(elementListeners.element.addEventListener(event, listener, false));
+ }
+
+ return result;
+ }();
+ });
+ } // Deactivates all listeners stored in @listeners
+
+ }, {
+ key: "removeEventListeners",
+ value: function removeEventListeners() {
+ return this.listeners.map(function (elementListeners) {
+ return function () {
+ var result = [];
+
+ for (var event in elementListeners.events) {
+ var listener = elementListeners.events[event];
+ result.push(elementListeners.element.removeEventListener(event, listener, false));
+ }
+
+ return result;
+ }();
+ });
+ } // Removes all event listeners and cancels all files in the queue or being processed.
+
+ }, {
+ key: "disable",
+ value: function disable() {
+ var _this3 = this;
+
+ this.clickableElements.forEach(function (element) {
+ return element.classList.remove("dz-clickable");
+ });
+ this.removeEventListeners();
+ this.disabled = true;
+ return this.files.map(function (file) {
+ return _this3.cancelUpload(file);
+ });
+ }
+ }, {
+ key: "enable",
+ value: function enable() {
+ delete this.disabled;
+ this.clickableElements.forEach(function (element) {
+ return element.classList.add("dz-clickable");
+ });
+ return this.setupEventListeners();
+ } // Returns a nicely formatted filesize
+
+ }, {
+ key: "filesize",
+ value: function filesize(size) {
+ var selectedSize = 0;
+ var selectedUnit = "b";
+
+ if (size > 0) {
+ var units = ["tb", "gb", "mb", "kb", "b"];
+
+ for (var i = 0; i < units.length; i++) {
+ var unit = units[i];
+ var cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;
+
+ if (size >= cutoff) {
+ selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);
+ selectedUnit = unit;
+ break;
+ }
+ }
+
+ selectedSize = Math.round(10 * selectedSize) / 10; // Cutting of digits
+ }
+
+ return "".concat(selectedSize, " ").concat(this.options.dictFileSizeUnits[selectedUnit]);
+ } // Adds or removes the `dz-max-files-reached` class from the form.
+
+ }, {
+ key: "_updateMaxFilesReachedClass",
+ value: function _updateMaxFilesReachedClass() {
+ if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {
+ if (this.getAcceptedFiles().length === this.options.maxFiles) {
+ this.emit("maxfilesreached", this.files);
+ }
+
+ return this.element.classList.add("dz-max-files-reached");
+ } else {
+ return this.element.classList.remove("dz-max-files-reached");
+ }
+ }
+ }, {
+ key: "drop",
+ value: function drop(e) {
+ if (!e.dataTransfer) {
+ return;
+ }
+
+ this.emit("drop", e); // Convert the FileList to an Array
+ // This is necessary for IE11
+
+ var files = [];
+
+ for (var i = 0; i < e.dataTransfer.files.length; i++) {
+ files[i] = e.dataTransfer.files[i];
+ } // Even if it's a folder, files.length will contain the folders.
+
+
+ if (files.length) {
+ var items = e.dataTransfer.items;
+
+ if (items && items.length && items[0].webkitGetAsEntry != null) {
+ // The browser supports dropping of folders, so handle items instead of files
+ this._addFilesFromItems(items);
+ } else {
+ this.handleFiles(files);
+ }
+ }
+
+ this.emit("addedfiles", files);
+ }
+ }, {
+ key: "paste",
+ value: function paste(e) {
+ if (__guard__(e != null ? e.clipboardData : undefined, function (x) {
+ return x.items;
+ }) == null) {
+ return;
+ }
+
+ this.emit("paste", e);
+ var items = e.clipboardData.items;
+
+ if (items.length) {
+ return this._addFilesFromItems(items);
+ }
+ }
+ }, {
+ key: "handleFiles",
+ value: function handleFiles(files) {
+ var _iterator5 = dropzone_createForOfIteratorHelper(files, true),
+ _step5;
+
+ try {
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
+ var file = _step5.value;
+ this.addFile(file);
+ }
+ } catch (err) {
+ _iterator5.e(err);
+ } finally {
+ _iterator5.f();
+ }
+ } // When a folder is dropped (or files are pasted), items must be handled
+ // instead of files.
+
+ }, {
+ key: "_addFilesFromItems",
+ value: function _addFilesFromItems(items) {
+ var _this4 = this;
+
+ return function () {
+ var result = [];
+
+ var _iterator6 = dropzone_createForOfIteratorHelper(items, true),
+ _step6;
+
+ try {
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
+ var item = _step6.value;
+ var entry;
+
+ if (item.webkitGetAsEntry != null && (entry = item.webkitGetAsEntry())) {
+ if (entry.isFile) {
+ result.push(_this4.addFile(item.getAsFile()));
+ } else if (entry.isDirectory) {
+ // Append all files from that directory to files
+ result.push(_this4._addFilesFromDirectory(entry, entry.name));
+ } else {
+ result.push(undefined);
+ }
+ } else if (item.getAsFile != null) {
+ if (item.kind == null || item.kind === "file") {
+ result.push(_this4.addFile(item.getAsFile()));
+ } else {
+ result.push(undefined);
+ }
+ } else {
+ result.push(undefined);
+ }
+ }
+ } catch (err) {
+ _iterator6.e(err);
+ } finally {
+ _iterator6.f();
+ }
+
+ return result;
+ }();
+ } // Goes through the directory, and adds each file it finds recursively
+
+ }, {
+ key: "_addFilesFromDirectory",
+ value: function _addFilesFromDirectory(directory, path) {
+ var _this5 = this;
+
+ var dirReader = directory.createReader();
+
+ var errorHandler = function errorHandler(error) {
+ return __guardMethod__(console, "log", function (o) {
+ return o.log(error);
+ });
+ };
+
+ var readEntries = function readEntries() {
+ return dirReader.readEntries(function (entries) {
+ if (entries.length > 0) {
+ var _iterator7 = dropzone_createForOfIteratorHelper(entries, true),
+ _step7;
+
+ try {
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
+ var entry = _step7.value;
+
+ if (entry.isFile) {
+ entry.file(function (file) {
+ if (_this5.options.ignoreHiddenFiles && file.name.substring(0, 1) === ".") {
+ return;
+ }
+
+ file.fullPath = "".concat(path, "/").concat(file.name);
+ return _this5.addFile(file);
+ });
+ } else if (entry.isDirectory) {
+ _this5._addFilesFromDirectory(entry, "".concat(path, "/").concat(entry.name));
+ }
+ } // Recursively call readEntries() again, since browser only handle
+ // the first 100 entries.
+ // See: https://developer.mozilla.org/en-US/docs/Web/API/DirectoryReader#readEntries
+
+ } catch (err) {
+ _iterator7.e(err);
+ } finally {
+ _iterator7.f();
+ }
+
+ readEntries();
+ }
+
+ return null;
+ }, errorHandler);
+ };
+
+ return readEntries();
+ } // If `done()` is called without argument the file is accepted
+ // If you call it with an error message, the file is rejected
+ // (This allows for asynchronous validation)
+ //
+ // This function checks the filesize, and if the file.type passes the
+ // `acceptedFiles` check.
+
+ }, {
+ key: "accept",
+ value: function accept(file, done) {
+ if (this.options.maxFilesize && file.size > this.options.maxFilesize * 1024 * 1024) {
+ done(this.options.dictFileTooBig.replace("{{filesize}}", Math.round(file.size / 1024 / 10.24) / 100).replace("{{maxFilesize}}", this.options.maxFilesize));
+ } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {
+ done(this.options.dictInvalidFileType);
+ } else if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {
+ done(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}", this.options.maxFiles));
+ this.emit("maxfilesexceeded", file);
+ } else {
+ this.options.accept.call(this, file, done);
+ }
+ }
+ }, {
+ key: "addFile",
+ value: function addFile(file) {
+ var _this6 = this;
+
+ file.upload = {
+ uuid: Dropzone.uuidv4(),
+ progress: 0,
+ // Setting the total upload size to file.size for the beginning
+ // It's actual different than the size to be transmitted.
+ total: file.size,
+ bytesSent: 0,
+ filename: this._renameFile(file) // Not setting chunking information here, because the acutal data — and
+ // thus the chunks — might change if `options.transformFile` is set
+ // and does something to the data.
+
+ };
+ this.files.push(file);
+ file.status = Dropzone.ADDED;
+ this.emit("addedfile", file);
+
+ this._enqueueThumbnail(file);
+
+ this.accept(file, function (error) {
+ if (error) {
+ file.accepted = false;
+
+ _this6._errorProcessing([file], error); // Will set the file.status
+
+ } else {
+ file.accepted = true;
+
+ if (_this6.options.autoQueue) {
+ _this6.enqueueFile(file);
+ } // Will set .accepted = true
+
+ }
+
+ _this6._updateMaxFilesReachedClass();
+ });
+ } // Wrapper for enqueueFile
+
+ }, {
+ key: "enqueueFiles",
+ value: function enqueueFiles(files) {
+ var _iterator8 = dropzone_createForOfIteratorHelper(files, true),
+ _step8;
+
+ try {
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
+ var file = _step8.value;
+ this.enqueueFile(file);
+ }
+ } catch (err) {
+ _iterator8.e(err);
+ } finally {
+ _iterator8.f();
+ }
+
+ return null;
+ }
+ }, {
+ key: "enqueueFile",
+ value: function enqueueFile(file) {
+ var _this7 = this;
+
+ if (file.status === Dropzone.ADDED && file.accepted === true) {
+ file.status = Dropzone.QUEUED;
+
+ if (this.options.autoProcessQueue) {
+ return setTimeout(function () {
+ return _this7.processQueue();
+ }, 0); // Deferring the call
+ }
+ } else {
+ throw new Error("This file can't be queued because it has already been processed or was rejected.");
+ }
+ }
+ }, {
+ key: "_enqueueThumbnail",
+ value: function _enqueueThumbnail(file) {
+ var _this8 = this;
+
+ if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {
+ this._thumbnailQueue.push(file);
+
+ return setTimeout(function () {
+ return _this8._processThumbnailQueue();
+ }, 0); // Deferring the call
+ }
+ }
+ }, {
+ key: "_processThumbnailQueue",
+ value: function _processThumbnailQueue() {
+ var _this9 = this;
+
+ if (this._processingThumbnail || this._thumbnailQueue.length === 0) {
+ return;
+ }
+
+ this._processingThumbnail = true;
+
+ var file = this._thumbnailQueue.shift();
+
+ return this.createThumbnail(file, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, true, function (dataUrl) {
+ _this9.emit("thumbnail", file, dataUrl);
+
+ _this9._processingThumbnail = false;
+ return _this9._processThumbnailQueue();
+ });
+ } // Can be called by the user to remove a file
+
+ }, {
+ key: "removeFile",
+ value: function removeFile(file) {
+ if (file.status === Dropzone.UPLOADING) {
+ this.cancelUpload(file);
+ }
+
+ this.files = without(this.files, file);
+ this.emit("removedfile", file);
+
+ if (this.files.length === 0) {
+ return this.emit("reset");
+ }
+ } // Removes all files that aren't currently processed from the list
+
+ }, {
+ key: "removeAllFiles",
+ value: function removeAllFiles(cancelIfNecessary) {
+ // Create a copy of files since removeFile() changes the @files array.
+ if (cancelIfNecessary == null) {
+ cancelIfNecessary = false;
+ }
+
+ var _iterator9 = dropzone_createForOfIteratorHelper(this.files.slice(), true),
+ _step9;
+
+ try {
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
+ var file = _step9.value;
+
+ if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {
+ this.removeFile(file);
+ }
+ }
+ } catch (err) {
+ _iterator9.e(err);
+ } finally {
+ _iterator9.f();
+ }
+
+ return null;
+ } // Resizes an image before it gets sent to the server. This function is the default behavior of
+ // `options.transformFile` if `resizeWidth` or `resizeHeight` are set. The callback is invoked with
+ // the resized blob.
+
+ }, {
+ key: "resizeImage",
+ value: function resizeImage(file, width, height, resizeMethod, callback) {
+ var _this10 = this;
+
+ return this.createThumbnail(file, width, height, resizeMethod, true, function (dataUrl, canvas) {
+ if (canvas == null) {
+ // The image has not been resized
+ return callback(file);
+ } else {
+ var resizeMimeType = _this10.options.resizeMimeType;
+
+ if (resizeMimeType == null) {
+ resizeMimeType = file.type;
+ }
+
+ var resizedDataURL = canvas.toDataURL(resizeMimeType, _this10.options.resizeQuality);
+
+ if (resizeMimeType === "image/jpeg" || resizeMimeType === "image/jpg") {
+ // Now add the original EXIF information
+ resizedDataURL = ExifRestore.restore(file.dataURL, resizedDataURL);
+ }
+
+ return callback(Dropzone.dataURItoBlob(resizedDataURL));
+ }
+ });
+ }
+ }, {
+ key: "createThumbnail",
+ value: function createThumbnail(file, width, height, resizeMethod, fixOrientation, callback) {
+ var _this11 = this;
+
+ var fileReader = new FileReader();
+
+ fileReader.onload = function () {
+ file.dataURL = fileReader.result; // Don't bother creating a thumbnail for SVG images since they're vector
+
+ if (file.type === "image/svg+xml") {
+ if (callback != null) {
+ callback(fileReader.result);
+ }
+
+ return;
+ }
+
+ _this11.createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback);
+ };
+
+ fileReader.readAsDataURL(file);
+ } // `mockFile` needs to have these attributes:
+ //
+ // { name: 'name', size: 12345, imageUrl: '' }
+ //
+ // `callback` will be invoked when the image has been downloaded and displayed.
+ // `crossOrigin` will be added to the `img` tag when accessing the file.
+
+ }, {
+ key: "displayExistingFile",
+ value: function displayExistingFile(mockFile, imageUrl, callback, crossOrigin) {
+ var _this12 = this;
+
+ var resizeThumbnail = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
+ this.emit("addedfile", mockFile);
+ this.emit("complete", mockFile);
+
+ if (!resizeThumbnail) {
+ this.emit("thumbnail", mockFile, imageUrl);
+ if (callback) callback();
+ } else {
+ var onDone = function onDone(thumbnail) {
+ _this12.emit("thumbnail", mockFile, thumbnail);
+
+ if (callback) callback();
+ };
+
+ mockFile.dataURL = imageUrl;
+ this.createThumbnailFromUrl(mockFile, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.resizeMethod, this.options.fixOrientation, onDone, crossOrigin);
+ }
+ }
+ }, {
+ key: "createThumbnailFromUrl",
+ value: function createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback, crossOrigin) {
+ var _this13 = this;
+
+ // Not using `new Image` here because of a bug in latest Chrome versions.
+ // See https://github.com/enyo/dropzone/pull/226
+ var img = document.createElement("img");
+
+ if (crossOrigin) {
+ img.crossOrigin = crossOrigin;
+ } // fixOrientation is not needed anymore with browsers handling imageOrientation
+
+
+ fixOrientation = getComputedStyle(document.body)["imageOrientation"] == "from-image" ? false : fixOrientation;
+
+ img.onload = function () {
+ var loadExif = function loadExif(callback) {
+ return callback(1);
+ };
+
+ if (typeof EXIF !== "undefined" && EXIF !== null && fixOrientation) {
+ loadExif = function loadExif(callback) {
+ return EXIF.getData(img, function () {
+ return callback(EXIF.getTag(this, "Orientation"));
+ });
+ };
+ }
+
+ return loadExif(function (orientation) {
+ file.width = img.width;
+ file.height = img.height;
+
+ var resizeInfo = _this13.options.resize.call(_this13, file, width, height, resizeMethod);
+
+ var canvas = document.createElement("canvas");
+ var ctx = canvas.getContext("2d");
+ canvas.width = resizeInfo.trgWidth;
+ canvas.height = resizeInfo.trgHeight;
+
+ if (orientation > 4) {
+ canvas.width = resizeInfo.trgHeight;
+ canvas.height = resizeInfo.trgWidth;
+ }
+
+ switch (orientation) {
+ case 2:
+ // horizontal flip
+ ctx.translate(canvas.width, 0);
+ ctx.scale(-1, 1);
+ break;
+
+ case 3:
+ // 180° rotate left
+ ctx.translate(canvas.width, canvas.height);
+ ctx.rotate(Math.PI);
+ break;
+
+ case 4:
+ // vertical flip
+ ctx.translate(0, canvas.height);
+ ctx.scale(1, -1);
+ break;
+
+ case 5:
+ // vertical flip + 90 rotate right
+ ctx.rotate(0.5 * Math.PI);
+ ctx.scale(1, -1);
+ break;
+
+ case 6:
+ // 90° rotate right
+ ctx.rotate(0.5 * Math.PI);
+ ctx.translate(0, -canvas.width);
+ break;
+
+ case 7:
+ // horizontal flip + 90 rotate right
+ ctx.rotate(0.5 * Math.PI);
+ ctx.translate(canvas.height, -canvas.width);
+ ctx.scale(-1, 1);
+ break;
+
+ case 8:
+ // 90° rotate left
+ ctx.rotate(-0.5 * Math.PI);
+ ctx.translate(-canvas.height, 0);
+ break;
+ } // This is a bugfix for iOS' scaling bug.
+
+
+ drawImageIOSFix(ctx, img, resizeInfo.srcX != null ? resizeInfo.srcX : 0, resizeInfo.srcY != null ? resizeInfo.srcY : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, resizeInfo.trgX != null ? resizeInfo.trgX : 0, resizeInfo.trgY != null ? resizeInfo.trgY : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);
+ var thumbnail = canvas.toDataURL("image/png");
+
+ if (callback != null) {
+ return callback(thumbnail, canvas);
+ }
+ });
+ };
+
+ if (callback != null) {
+ img.onerror = callback;
+ }
+
+ return img.src = file.dataURL;
+ } // Goes through the queue and processes files if there aren't too many already.
+
+ }, {
+ key: "processQueue",
+ value: function processQueue() {
+ var parallelUploads = this.options.parallelUploads;
+ var processingLength = this.getUploadingFiles().length;
+ var i = processingLength; // There are already at least as many files uploading than should be
+
+ if (processingLength >= parallelUploads) {
+ return;
+ }
+
+ var queuedFiles = this.getQueuedFiles();
+
+ if (!(queuedFiles.length > 0)) {
+ return;
+ }
+
+ if (this.options.uploadMultiple) {
+ // The files should be uploaded in one request
+ return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
+ } else {
+ while (i < parallelUploads) {
+ if (!queuedFiles.length) {
+ return;
+ } // Nothing left to process
+
+
+ this.processFile(queuedFiles.shift());
+ i++;
+ }
+ }
+ } // Wrapper for `processFiles`
+
+ }, {
+ key: "processFile",
+ value: function processFile(file) {
+ return this.processFiles([file]);
+ } // Loads the file, then calls finishedLoading()
+
+ }, {
+ key: "processFiles",
+ value: function processFiles(files) {
+ var _iterator10 = dropzone_createForOfIteratorHelper(files, true),
+ _step10;
+
+ try {
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
+ var file = _step10.value;
+ file.processing = true; // Backwards compatibility
+
+ file.status = Dropzone.UPLOADING;
+ this.emit("processing", file);
+ }
+ } catch (err) {
+ _iterator10.e(err);
+ } finally {
+ _iterator10.f();
+ }
+
+ if (this.options.uploadMultiple) {
+ this.emit("processingmultiple", files);
+ }
+
+ return this.uploadFiles(files);
+ }
+ }, {
+ key: "_getFilesWithXhr",
+ value: function _getFilesWithXhr(xhr) {
+ var files;
+ return files = this.files.filter(function (file) {
+ return file.xhr === xhr;
+ }).map(function (file) {
+ return file;
+ });
+ } // Cancels the file upload and sets the status to CANCELED
+ // **if** the file is actually being uploaded.
+ // If it's still in the queue, the file is being removed from it and the status
+ // set to CANCELED.
+
+ }, {
+ key: "cancelUpload",
+ value: function cancelUpload(file) {
+ if (file.status === Dropzone.UPLOADING) {
+ var groupedFiles = this._getFilesWithXhr(file.xhr);
+
+ var _iterator11 = dropzone_createForOfIteratorHelper(groupedFiles, true),
+ _step11;
+
+ try {
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
+ var groupedFile = _step11.value;
+ groupedFile.status = Dropzone.CANCELED;
+ }
+ } catch (err) {
+ _iterator11.e(err);
+ } finally {
+ _iterator11.f();
+ }
+
+ if (typeof file.xhr !== "undefined") {
+ file.xhr.abort();
+ }
+
+ var _iterator12 = dropzone_createForOfIteratorHelper(groupedFiles, true),
+ _step12;
+
+ try {
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
+ var _groupedFile = _step12.value;
+ this.emit("canceled", _groupedFile);
+ }
+ } catch (err) {
+ _iterator12.e(err);
+ } finally {
+ _iterator12.f();
+ }
+
+ if (this.options.uploadMultiple) {
+ this.emit("canceledmultiple", groupedFiles);
+ }
+ } else if (file.status === Dropzone.ADDED || file.status === Dropzone.QUEUED) {
+ file.status = Dropzone.CANCELED;
+ this.emit("canceled", file);
+
+ if (this.options.uploadMultiple) {
+ this.emit("canceledmultiple", [file]);
+ }
+ }
+
+ if (this.options.autoProcessQueue) {
+ return this.processQueue();
+ }
+ }
+ }, {
+ key: "resolveOption",
+ value: function resolveOption(option) {
+ if (typeof option === "function") {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ return option.apply(this, args);
+ }
+
+ return option;
+ }
+ }, {
+ key: "uploadFile",
+ value: function uploadFile(file) {
+ return this.uploadFiles([file]);
+ }
+ }, {
+ key: "uploadFiles",
+ value: function uploadFiles(files) {
+ var _this14 = this;
+
+ this._transformFiles(files, function (transformedFiles) {
+ if (_this14.options.chunking) {
+ // Chunking is not allowed to be used with `uploadMultiple` so we know
+ // that there is only __one__file.
+ var transformedFile = transformedFiles[0];
+ files[0].upload.chunked = _this14.options.chunking && (_this14.options.forceChunking || transformedFile.size > _this14.options.chunkSize);
+ files[0].upload.totalChunkCount = Math.ceil(transformedFile.size / _this14.options.chunkSize);
+ }
+
+ if (files[0].upload.chunked) {
+ // This file should be sent in chunks!
+ // If the chunking option is set, we **know** that there can only be **one** file, since
+ // uploadMultiple is not allowed with this option.
+ var file = files[0];
+ var _transformedFile = transformedFiles[0];
+ var startedChunkCount = 0;
+ file.upload.chunks = [];
+
+ var handleNextChunk = function handleNextChunk() {
+ var chunkIndex = 0; // Find the next item in file.upload.chunks that is not defined yet.
+
+ while (file.upload.chunks[chunkIndex] !== undefined) {
+ chunkIndex++;
+ } // This means, that all chunks have already been started.
+
+
+ if (chunkIndex >= file.upload.totalChunkCount) return;
+ startedChunkCount++;
+ var start = chunkIndex * _this14.options.chunkSize;
+ var end = Math.min(start + _this14.options.chunkSize, _transformedFile.size);
+ var dataBlock = {
+ name: _this14._getParamName(0),
+ data: _transformedFile.webkitSlice ? _transformedFile.webkitSlice(start, end) : _transformedFile.slice(start, end),
+ filename: file.upload.filename,
+ chunkIndex: chunkIndex
+ };
+ file.upload.chunks[chunkIndex] = {
+ file: file,
+ index: chunkIndex,
+ dataBlock: dataBlock,
+ // In case we want to retry.
+ status: Dropzone.UPLOADING,
+ progress: 0,
+ retries: 0 // The number of times this block has been retried.
+
+ };
+
+ _this14._uploadData(files, [dataBlock]);
+ };
+
+ file.upload.finishedChunkUpload = function (chunk, response) {
+ var allFinished = true;
+ chunk.status = Dropzone.SUCCESS; // Clear the data from the chunk
+
+ chunk.dataBlock = null; // Leaving this reference to xhr intact here will cause memory leaks in some browsers
+
+ chunk.xhr = null;
+
+ for (var i = 0; i < file.upload.totalChunkCount; i++) {
+ if (file.upload.chunks[i] === undefined) {
+ return handleNextChunk();
+ }
+
+ if (file.upload.chunks[i].status !== Dropzone.SUCCESS) {
+ allFinished = false;
+ }
+ }
+
+ if (allFinished) {
+ _this14.options.chunksUploaded(file, function () {
+ _this14._finished(files, response, null);
+ });
+ }
+ };
+
+ if (_this14.options.parallelChunkUploads) {
+ for (var i = 0; i < file.upload.totalChunkCount; i++) {
+ handleNextChunk();
+ }
+ } else {
+ handleNextChunk();
+ }
+ } else {
+ var dataBlocks = [];
+
+ for (var _i2 = 0; _i2 < files.length; _i2++) {
+ dataBlocks[_i2] = {
+ name: _this14._getParamName(_i2),
+ data: transformedFiles[_i2],
+ filename: files[_i2].upload.filename
+ };
+ }
+
+ _this14._uploadData(files, dataBlocks);
+ }
+ });
+ } /// Returns the right chunk for given file and xhr
+
+ }, {
+ key: "_getChunk",
+ value: function _getChunk(file, xhr) {
+ for (var i = 0; i < file.upload.totalChunkCount; i++) {
+ if (file.upload.chunks[i] !== undefined && file.upload.chunks[i].xhr === xhr) {
+ return file.upload.chunks[i];
+ }
+ }
+ } // This function actually uploads the file(s) to the server.
+ // If dataBlocks contains the actual data to upload (meaning, that this could either be transformed
+ // files, or individual chunks for chunked upload).
+
+ }, {
+ key: "_uploadData",
+ value: function _uploadData(files, dataBlocks) {
+ var _this15 = this;
+
+ var xhr = new XMLHttpRequest(); // Put the xhr object in the file objects to be able to reference it later.
+
+ var _iterator13 = dropzone_createForOfIteratorHelper(files, true),
+ _step13;
+
+ try {
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
+ var file = _step13.value;
+ file.xhr = xhr;
+ }
+ } catch (err) {
+ _iterator13.e(err);
+ } finally {
+ _iterator13.f();
+ }
+
+ if (files[0].upload.chunked) {
+ // Put the xhr object in the right chunk object, so it can be associated later, and found with _getChunk
+ files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr = xhr;
+ }
+
+ var method = this.resolveOption(this.options.method, files);
+ var url = this.resolveOption(this.options.url, files);
+ xhr.open(method, url, true); // Setting the timeout after open because of IE11 issue: https://gitlab.com/meno/dropzone/issues/8
+
+ var timeout = this.resolveOption(this.options.timeout, files);
+ if (timeout) xhr.timeout = this.resolveOption(this.options.timeout, files); // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
+
+ xhr.withCredentials = !!this.options.withCredentials;
+
+ xhr.onload = function (e) {
+ _this15._finishedUploading(files, xhr, e);
+ };
+
+ xhr.ontimeout = function () {
+ _this15._handleUploadError(files, xhr, "Request timedout after ".concat(_this15.options.timeout / 1000, " seconds"));
+ };
+
+ xhr.onerror = function () {
+ _this15._handleUploadError(files, xhr);
+ }; // Some browsers do not have the .upload property
+
+
+ var progressObj = xhr.upload != null ? xhr.upload : xhr;
+
+ progressObj.onprogress = function (e) {
+ return _this15._updateFilesUploadProgress(files, xhr, e);
+ };
+
+ var headers = {
+ Accept: "application/json",
+ "Cache-Control": "no-cache",
+ "X-Requested-With": "XMLHttpRequest"
+ };
+
+ if (this.options.headers) {
+ Dropzone.extend(headers, this.options.headers);
+ }
+
+ for (var headerName in headers) {
+ var headerValue = headers[headerName];
+
+ if (headerValue) {
+ xhr.setRequestHeader(headerName, headerValue);
+ }
+ }
+
+ var formData = new FormData(); // Adding all @options parameters
+
+ if (this.options.params) {
+ var additionalParams = this.options.params;
+
+ if (typeof additionalParams === "function") {
+ additionalParams = additionalParams.call(this, files, xhr, files[0].upload.chunked ? this._getChunk(files[0], xhr) : null);
+ }
+
+ for (var key in additionalParams) {
+ var value = additionalParams[key];
+
+ if (Array.isArray(value)) {
+ // The additional parameter contains an array,
+ // so lets iterate over it to attach each value
+ // individually.
+ for (var i = 0; i < value.length; i++) {
+ formData.append(key, value[i]);
+ }
+ } else {
+ formData.append(key, value);
+ }
+ }
+ } // Let the user add additional data if necessary
+
+
+ var _iterator14 = dropzone_createForOfIteratorHelper(files, true),
+ _step14;
+
+ try {
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
+ var _file = _step14.value;
+ this.emit("sending", _file, xhr, formData);
+ }
+ } catch (err) {
+ _iterator14.e(err);
+ } finally {
+ _iterator14.f();
+ }
+
+ if (this.options.uploadMultiple) {
+ this.emit("sendingmultiple", files, xhr, formData);
+ }
+
+ this._addFormElementData(formData); // Finally add the files
+ // Has to be last because some servers (eg: S3) expect the file to be the last parameter
+
+
+ for (var _i3 = 0; _i3 < dataBlocks.length; _i3++) {
+ var dataBlock = dataBlocks[_i3];
+ formData.append(dataBlock.name, dataBlock.data, dataBlock.filename);
+ }
+
+ this.submitRequest(xhr, formData, files);
+ } // Transforms all files with this.options.transformFile and invokes done with the transformed files when done.
+
+ }, {
+ key: "_transformFiles",
+ value: function _transformFiles(files, done) {
+ var _this16 = this;
+
+ var transformedFiles = []; // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.
+
+ var doneCounter = 0;
+
+ var _loop = function _loop(i) {
+ _this16.options.transformFile.call(_this16, files[i], function (transformedFile) {
+ transformedFiles[i] = transformedFile;
+
+ if (++doneCounter === files.length) {
+ done(transformedFiles);
+ }
+ });
+ };
+
+ for (var i = 0; i < files.length; i++) {
+ _loop(i);
+ }
+ } // Takes care of adding other input elements of the form to the AJAX request
+
+ }, {
+ key: "_addFormElementData",
+ value: function _addFormElementData(formData) {
+ // Take care of other input elements
+ if (this.element.tagName === "FORM") {
+ var _iterator15 = dropzone_createForOfIteratorHelper(this.element.querySelectorAll("input, textarea, select, button"), true),
+ _step15;
+
+ try {
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
+ var input = _step15.value;
+ var inputName = input.getAttribute("name");
+ var inputType = input.getAttribute("type");
+ if (inputType) inputType = inputType.toLowerCase(); // If the input doesn't have a name, we can't use it.
+
+ if (typeof inputName === "undefined" || inputName === null) continue;
+
+ if (input.tagName === "SELECT" && input.hasAttribute("multiple")) {
+ // Possibly multiple values
+ var _iterator16 = dropzone_createForOfIteratorHelper(input.options, true),
+ _step16;
+
+ try {
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
+ var option = _step16.value;
+
+ if (option.selected) {
+ formData.append(inputName, option.value);
+ }
+ }
+ } catch (err) {
+ _iterator16.e(err);
+ } finally {
+ _iterator16.f();
+ }
+ } else if (!inputType || inputType !== "checkbox" && inputType !== "radio" || input.checked) {
+ formData.append(inputName, input.value);
+ }
+ }
+ } catch (err) {
+ _iterator15.e(err);
+ } finally {
+ _iterator15.f();
+ }
+ }
+ } // Invoked when there is new progress information about given files.
+ // If e is not provided, it is assumed that the upload is finished.
+
+ }, {
+ key: "_updateFilesUploadProgress",
+ value: function _updateFilesUploadProgress(files, xhr, e) {
+ if (!files[0].upload.chunked) {
+ // Handle file uploads without chunking
+ var _iterator17 = dropzone_createForOfIteratorHelper(files, true),
+ _step17;
+
+ try {
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
+ var file = _step17.value;
+
+ if (file.upload.total && file.upload.bytesSent && file.upload.bytesSent == file.upload.total) {
+ // If both, the `total` and `bytesSent` have already been set, and
+ // they are equal (meaning progress is at 100%), we can skip this
+ // file, since an upload progress shouldn't go down.
+ continue;
+ }
+
+ if (e) {
+ file.upload.progress = 100 * e.loaded / e.total;
+ file.upload.total = e.total;
+ file.upload.bytesSent = e.loaded;
+ } else {
+ // No event, so we're at 100%
+ file.upload.progress = 100;
+ file.upload.bytesSent = file.upload.total;
+ }
+
+ this.emit("uploadprogress", file, file.upload.progress, file.upload.bytesSent);
+ }
+ } catch (err) {
+ _iterator17.e(err);
+ } finally {
+ _iterator17.f();
+ }
+ } else {
+ // Handle chunked file uploads
+ // Chunked upload is not compatible with uploading multiple files in one
+ // request, so we know there's only one file.
+ var _file2 = files[0]; // Since this is a chunked upload, we need to update the appropriate chunk
+ // progress.
+
+ var chunk = this._getChunk(_file2, xhr);
+
+ if (e) {
+ chunk.progress = 100 * e.loaded / e.total;
+ chunk.total = e.total;
+ chunk.bytesSent = e.loaded;
+ } else {
+ // No event, so we're at 100%
+ chunk.progress = 100;
+ chunk.bytesSent = chunk.total;
+ } // Now tally the *file* upload progress from its individual chunks
+
+
+ _file2.upload.progress = 0;
+ _file2.upload.total = 0;
+ _file2.upload.bytesSent = 0;
+
+ for (var i = 0; i < _file2.upload.totalChunkCount; i++) {
+ if (_file2.upload.chunks[i] && typeof _file2.upload.chunks[i].progress !== "undefined") {
+ _file2.upload.progress += _file2.upload.chunks[i].progress;
+ _file2.upload.total += _file2.upload.chunks[i].total;
+ _file2.upload.bytesSent += _file2.upload.chunks[i].bytesSent;
+ }
+ } // Since the process is a percentage, we need to divide by the amount of
+ // chunks we've used.
+
+
+ _file2.upload.progress = _file2.upload.progress / _file2.upload.totalChunkCount;
+ this.emit("uploadprogress", _file2, _file2.upload.progress, _file2.upload.bytesSent);
+ }
+ }
+ }, {
+ key: "_finishedUploading",
+ value: function _finishedUploading(files, xhr, e) {
+ var response;
+
+ if (files[0].status === Dropzone.CANCELED) {
+ return;
+ }
+
+ if (xhr.readyState !== 4) {
+ return;
+ }
+
+ if (xhr.responseType !== "arraybuffer" && xhr.responseType !== "blob") {
+ response = xhr.responseText;
+
+ if (xhr.getResponseHeader("content-type") && ~xhr.getResponseHeader("content-type").indexOf("application/json")) {
+ try {
+ response = JSON.parse(response);
+ } catch (error) {
+ e = error;
+ response = "Invalid JSON response from server.";
+ }
+ }
+ }
+
+ this._updateFilesUploadProgress(files, xhr);
+
+ if (!(200 <= xhr.status && xhr.status < 300)) {
+ this._handleUploadError(files, xhr, response);
+ } else {
+ if (files[0].upload.chunked) {
+ files[0].upload.finishedChunkUpload(this._getChunk(files[0], xhr), response);
+ } else {
+ this._finished(files, response, e);
+ }
+ }
+ }
+ }, {
+ key: "_handleUploadError",
+ value: function _handleUploadError(files, xhr, response) {
+ if (files[0].status === Dropzone.CANCELED) {
+ return;
+ }
+
+ if (files[0].upload.chunked && this.options.retryChunks) {
+ var chunk = this._getChunk(files[0], xhr);
+
+ if (chunk.retries++ < this.options.retryChunksLimit) {
+ this._uploadData(files, [chunk.dataBlock]);
+
+ return;
+ } else {
+ console.warn("Retried this chunk too often. Giving up.");
+ }
+ }
+
+ this._errorProcessing(files, response || this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
+ }
+ }, {
+ key: "submitRequest",
+ value: function submitRequest(xhr, formData, files) {
+ if (xhr.readyState != 1) {
+ console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");
+ return;
+ }
+
+ xhr.send(formData);
+ } // Called internally when processing is finished.
+ // Individual callbacks have to be called in the appropriate sections.
+
+ }, {
+ key: "_finished",
+ value: function _finished(files, responseText, e) {
+ var _iterator18 = dropzone_createForOfIteratorHelper(files, true),
+ _step18;
+
+ try {
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
+ var file = _step18.value;
+ file.status = Dropzone.SUCCESS;
+ this.emit("success", file, responseText, e);
+ this.emit("complete", file);
+ }
+ } catch (err) {
+ _iterator18.e(err);
+ } finally {
+ _iterator18.f();
+ }
+
+ if (this.options.uploadMultiple) {
+ this.emit("successmultiple", files, responseText, e);
+ this.emit("completemultiple", files);
+ }
+
+ if (this.options.autoProcessQueue) {
+ return this.processQueue();
+ }
+ } // Called internally when processing is finished.
+ // Individual callbacks have to be called in the appropriate sections.
+
+ }, {
+ key: "_errorProcessing",
+ value: function _errorProcessing(files, message, xhr) {
+ var _iterator19 = dropzone_createForOfIteratorHelper(files, true),
+ _step19;
+
+ try {
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
+ var file = _step19.value;
+ file.status = Dropzone.ERROR;
+ this.emit("error", file, message, xhr);
+ this.emit("complete", file);
+ }
+ } catch (err) {
+ _iterator19.e(err);
+ } finally {
+ _iterator19.f();
+ }
+
+ if (this.options.uploadMultiple) {
+ this.emit("errormultiple", files, message, xhr);
+ this.emit("completemultiple", files);
+ }
+
+ if (this.options.autoProcessQueue) {
+ return this.processQueue();
+ }
+ }
+ }], [{
+ key: "initClass",
+ value: function initClass() {
+ // Exposing the emitter class, mainly for tests
+ this.prototype.Emitter = Emitter;
+ /*
+ This is a list of all available events you can register on a dropzone object.
+ You can register an event handler like this:
+ dropzone.on("dragEnter", function() { });
+ */
+
+ this.prototype.events = ["drop", "dragstart", "dragend", "dragenter", "dragover", "dragleave", "addedfile", "addedfiles", "removedfile", "thumbnail", "error", "errormultiple", "processing", "processingmultiple", "uploadprogress", "totaluploadprogress", "sending", "sendingmultiple", "success", "successmultiple", "canceled", "canceledmultiple", "complete", "completemultiple", "reset", "maxfilesexceeded", "maxfilesreached", "queuecomplete"];
+ this.prototype._thumbnailQueue = [];
+ this.prototype._processingThumbnail = false;
+ } // global utility
+
+ }, {
+ key: "extend",
+ value: function extend(target) {
+ for (var _len2 = arguments.length, objects = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ objects[_key2 - 1] = arguments[_key2];
+ }
+
+ for (var _i4 = 0, _objects = objects; _i4 < _objects.length; _i4++) {
+ var object = _objects[_i4];
+
+ for (var key in object) {
+ var val = object[key];
+ target[key] = val;
+ }
+ }
+
+ return target;
+ }
+ }, {
+ key: "uuidv4",
+ value: function uuidv4() {
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
+ var r = Math.random() * 16 | 0,
+ v = c === "x" ? r : r & 0x3 | 0x8;
+ return v.toString(16);
+ });
+ }
+ }]);
+
+ return Dropzone;
+}(Emitter);
+
+
+Dropzone.initClass();
+Dropzone.version = "5.9.2"; // This is a map of options for your different dropzones. Add configurations
+// to this object for your different dropzone elemens.
+//
+// Example:
+//
+// Dropzone.options.myDropzoneElementId = { maxFilesize: 1 };
+//
+// To disable autoDiscover for a specific element, you can set `false` as an option:
+//
+// Dropzone.options.myDisabledElementId = false;
+//
+// And in html:
+//
+//
+
+Dropzone.options = {}; // Returns the options for an element or undefined if none available.
+
+Dropzone.optionsForElement = function (element) {
+ // Get the `Dropzone.options.elementId` for this element if it exists
+ if (element.getAttribute("id")) {
+ return Dropzone.options[camelize(element.getAttribute("id"))];
+ } else {
+ return undefined;
+ }
+}; // Holds a list of all dropzone instances
+
+
+Dropzone.instances = []; // Returns the dropzone for given element if any
+
+Dropzone.forElement = function (element) {
+ if (typeof element === "string") {
+ element = document.querySelector(element);
+ }
+
+ if ((element != null ? element.dropzone : undefined) == null) {
+ throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");
+ }
+
+ return element.dropzone;
+}; // Set to false if you don't want Dropzone to automatically find and attach to .dropzone elements.
+
+
+Dropzone.autoDiscover = true; // Looks for all .dropzone elements and creates a dropzone for them
+
+Dropzone.discover = function () {
+ var dropzones;
+
+ if (document.querySelectorAll) {
+ dropzones = document.querySelectorAll(".dropzone");
+ } else {
+ dropzones = []; // IE :(
+
+ var checkElements = function checkElements(elements) {
+ return function () {
+ var result = [];
+
+ var _iterator20 = dropzone_createForOfIteratorHelper(elements, true),
+ _step20;
+
+ try {
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
+ var el = _step20.value;
+
+ if (/(^| )dropzone($| )/.test(el.className)) {
+ result.push(dropzones.push(el));
+ } else {
+ result.push(undefined);
+ }
+ }
+ } catch (err) {
+ _iterator20.e(err);
+ } finally {
+ _iterator20.f();
+ }
+
+ return result;
+ }();
+ };
+
+ checkElements(document.getElementsByTagName("div"));
+ checkElements(document.getElementsByTagName("form"));
+ }
+
+ return function () {
+ var result = [];
+
+ var _iterator21 = dropzone_createForOfIteratorHelper(dropzones, true),
+ _step21;
+
+ try {
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
+ var dropzone = _step21.value;
+
+ // Create a dropzone unless auto discover has been disabled for specific element
+ if (Dropzone.optionsForElement(dropzone) !== false) {
+ result.push(new Dropzone(dropzone));
+ } else {
+ result.push(undefined);
+ }
+ }
+ } catch (err) {
+ _iterator21.e(err);
+ } finally {
+ _iterator21.f();
+ }
+
+ return result;
+ }();
+}; // Some browsers support drag and drog functionality, but not correctly.
+//
+// So I created a blocklist of userAgents. Yes, yes. Browser sniffing, I know.
+// But what to do when browsers *theoretically* support an API, but crash
+// when using it.
+//
+// This is a list of regular expressions tested against navigator.userAgent
+//
+// ** It should only be used on browser that *do* support the API, but
+// incorrectly **
+
+
+Dropzone.blockedBrowsers = [// The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.
+/opera.*(Macintosh|Windows Phone).*version\/12/i]; // Checks if the browser is supported
+
+Dropzone.isBrowserSupported = function () {
+ var capableBrowser = true;
+
+ if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {
+ if (!("classList" in document.createElement("a"))) {
+ capableBrowser = false;
+ } else {
+ if (Dropzone.blacklistedBrowsers !== undefined) {
+ // Since this has been renamed, this makes sure we don't break older
+ // configuration.
+ Dropzone.blockedBrowsers = Dropzone.blacklistedBrowsers;
+ } // The browser supports the API, but may be blocked.
+
+
+ var _iterator22 = dropzone_createForOfIteratorHelper(Dropzone.blockedBrowsers, true),
+ _step22;
+
+ try {
+ for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
+ var regex = _step22.value;
+
+ if (regex.test(navigator.userAgent)) {
+ capableBrowser = false;
+ continue;
+ }
+ }
+ } catch (err) {
+ _iterator22.e(err);
+ } finally {
+ _iterator22.f();
+ }
+ }
+ } else {
+ capableBrowser = false;
+ }
+
+ return capableBrowser;
+};
+
+Dropzone.dataURItoBlob = function (dataURI) {
+ // convert base64 to raw binary data held in a string
+ // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
+ var byteString = atob(dataURI.split(",")[1]); // separate out the mime component
+
+ var mimeString = dataURI.split(",")[0].split(":")[1].split(";")[0]; // write the bytes of the string to an ArrayBuffer
+
+ var ab = new ArrayBuffer(byteString.length);
+ var ia = new Uint8Array(ab);
+
+ for (var i = 0, end = byteString.length, asc = 0 <= end; asc ? i <= end : i >= end; asc ? i++ : i--) {
+ ia[i] = byteString.charCodeAt(i);
+ } // write the ArrayBuffer to a blob
+
+
+ return new Blob([ab], {
+ type: mimeString
+ });
+}; // Returns an array without the rejected item
+
+
+var without = function without(list, rejectedItem) {
+ return list.filter(function (item) {
+ return item !== rejectedItem;
+ }).map(function (item) {
+ return item;
+ });
+}; // abc-def_ghi -> abcDefGhi
+
+
+var camelize = function camelize(str) {
+ return str.replace(/[\-_](\w)/g, function (match) {
+ return match.charAt(1).toUpperCase();
+ });
+}; // Creates an element from string
+
+
+Dropzone.createElement = function (string) {
+ var div = document.createElement("div");
+ div.innerHTML = string;
+ return div.childNodes[0];
+}; // Tests if given element is inside (or simply is) the container
+
+
+Dropzone.elementInside = function (element, container) {
+ if (element === container) {
+ return true;
+ } // Coffeescript doesn't support do/while loops
+
+
+ while (element = element.parentNode) {
+ if (element === container) {
+ return true;
+ }
+ }
+
+ return false;
+};
+
+Dropzone.getElement = function (el, name) {
+ var element;
+
+ if (typeof el === "string") {
+ element = document.querySelector(el);
+ } else if (el.nodeType != null) {
+ element = el;
+ }
+
+ if (element == null) {
+ throw new Error("Invalid `".concat(name, "` option provided. Please provide a CSS selector or a plain HTML element."));
+ }
+
+ return element;
+};
+
+Dropzone.getElements = function (els, name) {
+ var el, elements;
+
+ if (els instanceof Array) {
+ elements = [];
+
+ try {
+ var _iterator23 = dropzone_createForOfIteratorHelper(els, true),
+ _step23;
+
+ try {
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
+ el = _step23.value;
+ elements.push(this.getElement(el, name));
+ }
+ } catch (err) {
+ _iterator23.e(err);
+ } finally {
+ _iterator23.f();
+ }
+ } catch (e) {
+ elements = null;
+ }
+ } else if (typeof els === "string") {
+ elements = [];
+
+ var _iterator24 = dropzone_createForOfIteratorHelper(document.querySelectorAll(els), true),
+ _step24;
+
+ try {
+ for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
+ el = _step24.value;
+ elements.push(el);
+ }
+ } catch (err) {
+ _iterator24.e(err);
+ } finally {
+ _iterator24.f();
+ }
+ } else if (els.nodeType != null) {
+ elements = [els];
+ }
+
+ if (elements == null || !elements.length) {
+ throw new Error("Invalid `".concat(name, "` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));
+ }
+
+ return elements;
+}; // Asks the user the question and calls accepted or rejected accordingly
+//
+// The default implementation just uses `window.confirm` and then calls the
+// appropriate callback.
+
+
+Dropzone.confirm = function (question, accepted, rejected) {
+ if (window.confirm(question)) {
+ return accepted();
+ } else if (rejected != null) {
+ return rejected();
+ }
+}; // Validates the mime type like this:
+//
+// https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept
+
+
+Dropzone.isValidFile = function (file, acceptedFiles) {
+ if (!acceptedFiles) {
+ return true;
+ } // If there are no accepted mime types, it's OK
+
+
+ acceptedFiles = acceptedFiles.split(",");
+ var mimeType = file.type;
+ var baseMimeType = mimeType.replace(/\/.*$/, "");
+
+ var _iterator25 = dropzone_createForOfIteratorHelper(acceptedFiles, true),
+ _step25;
+
+ try {
+ for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) {
+ var validType = _step25.value;
+ validType = validType.trim();
+
+ if (validType.charAt(0) === ".") {
+ if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {
+ return true;
+ }
+ } else if (/\/\*$/.test(validType)) {
+ // This is something like a image/* mime type
+ if (baseMimeType === validType.replace(/\/.*$/, "")) {
+ return true;
+ }
+ } else {
+ if (mimeType === validType) {
+ return true;
+ }
+ }
+ }
+ } catch (err) {
+ _iterator25.e(err);
+ } finally {
+ _iterator25.f();
+ }
+
+ return false;
+}; // Augment jQuery
+
+
+if (typeof jQuery !== "undefined" && jQuery !== null) {
+ jQuery.fn.dropzone = function (options) {
+ return this.each(function () {
+ return new Dropzone(this, options);
+ });
+ };
+} // Dropzone file status codes
+
+
+Dropzone.ADDED = "added";
+Dropzone.QUEUED = "queued"; // For backwards compatibility. Now, if a file is accepted, it's either queued
+// or uploading.
+
+Dropzone.ACCEPTED = Dropzone.QUEUED;
+Dropzone.UPLOADING = "uploading";
+Dropzone.PROCESSING = Dropzone.UPLOADING; // alias
+
+Dropzone.CANCELED = "canceled";
+Dropzone.ERROR = "error";
+Dropzone.SUCCESS = "success";
+/*
+
+ Bugfix for iOS 6 and 7
+ Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios
+ based on the work of https://github.com/stomita/ios-imagefile-megapixel
+
+ */
+// Detecting vertical squash in loaded image.
+// Fixes a bug which squash image vertically while drawing into canvas for some images.
+// This is a bug in iOS6 devices. This function from https://github.com/stomita/ios-imagefile-megapixel
+
+var detectVerticalSquash = function detectVerticalSquash(img) {
+ var iw = img.naturalWidth;
+ var ih = img.naturalHeight;
+ var canvas = document.createElement("canvas");
+ canvas.width = 1;
+ canvas.height = ih;
+ var ctx = canvas.getContext("2d");
+ ctx.drawImage(img, 0, 0);
+
+ var _ctx$getImageData = ctx.getImageData(1, 0, 1, ih),
+ data = _ctx$getImageData.data; // search image edge pixel position in case it is squashed vertically.
+
+
+ var sy = 0;
+ var ey = ih;
+ var py = ih;
+
+ while (py > sy) {
+ var alpha = data[(py - 1) * 4 + 3];
+
+ if (alpha === 0) {
+ ey = py;
+ } else {
+ sy = py;
+ }
+
+ py = ey + sy >> 1;
+ }
+
+ var ratio = py / ih;
+
+ if (ratio === 0) {
+ return 1;
+ } else {
+ return ratio;
+ }
+}; // A replacement for context.drawImage
+// (args are for source and destination).
+
+
+var drawImageIOSFix = function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {
+ var vertSquashRatio = detectVerticalSquash(img);
+ return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);
+}; // Based on MinifyJpeg
+// Source: http://www.perry.cz/files/ExifRestorer.js
+// http://elicon.blog57.fc2.com/blog-entry-206.html
+
+
+var ExifRestore = /*#__PURE__*/function () {
+ function ExifRestore() {
+ dropzone_classCallCheck(this, ExifRestore);
+ }
+
+ dropzone_createClass(ExifRestore, null, [{
+ key: "initClass",
+ value: function initClass() {
+ this.KEY_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ }
+ }, {
+ key: "encode64",
+ value: function encode64(input) {
+ var output = "";
+ var chr1 = undefined;
+ var chr2 = undefined;
+ var chr3 = "";
+ var enc1 = undefined;
+ var enc2 = undefined;
+ var enc3 = undefined;
+ var enc4 = "";
+ var i = 0;
+
+ while (true) {
+ chr1 = input[i++];
+ chr2 = input[i++];
+ chr3 = input[i++];
+ enc1 = chr1 >> 2;
+ enc2 = (chr1 & 3) << 4 | chr2 >> 4;
+ enc3 = (chr2 & 15) << 2 | chr3 >> 6;
+ enc4 = chr3 & 63;
+
+ if (isNaN(chr2)) {
+ enc3 = enc4 = 64;
+ } else if (isNaN(chr3)) {
+ enc4 = 64;
+ }
+
+ output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4);
+ chr1 = chr2 = chr3 = "";
+ enc1 = enc2 = enc3 = enc4 = "";
+
+ if (!(i < input.length)) {
+ break;
+ }
+ }
+
+ return output;
+ }
+ }, {
+ key: "restore",
+ value: function restore(origFileBase64, resizedFileBase64) {
+ if (!origFileBase64.match("data:image/jpeg;base64,")) {
+ return resizedFileBase64;
+ }
+
+ var rawImage = this.decode64(origFileBase64.replace("data:image/jpeg;base64,", ""));
+ var segments = this.slice2Segments(rawImage);
+ var image = this.exifManipulation(resizedFileBase64, segments);
+ return "data:image/jpeg;base64,".concat(this.encode64(image));
+ }
+ }, {
+ key: "exifManipulation",
+ value: function exifManipulation(resizedFileBase64, segments) {
+ var exifArray = this.getExifArray(segments);
+ var newImageArray = this.insertExif(resizedFileBase64, exifArray);
+ var aBuffer = new Uint8Array(newImageArray);
+ return aBuffer;
+ }
+ }, {
+ key: "getExifArray",
+ value: function getExifArray(segments) {
+ var seg = undefined;
+ var x = 0;
+
+ while (x < segments.length) {
+ seg = segments[x];
+
+ if (seg[0] === 255 & seg[1] === 225) {
+ return seg;
+ }
+
+ x++;
+ }
+
+ return [];
+ }
+ }, {
+ key: "insertExif",
+ value: function insertExif(resizedFileBase64, exifArray) {
+ var imageData = resizedFileBase64.replace("data:image/jpeg;base64,", "");
+ var buf = this.decode64(imageData);
+ var separatePoint = buf.indexOf(255, 3);
+ var mae = buf.slice(0, separatePoint);
+ var ato = buf.slice(separatePoint);
+ var array = mae;
+ array = array.concat(exifArray);
+ array = array.concat(ato);
+ return array;
+ }
+ }, {
+ key: "slice2Segments",
+ value: function slice2Segments(rawImageArray) {
+ var head = 0;
+ var segments = [];
+
+ while (true) {
+ var length;
+
+ if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) {
+ break;
+ }
+
+ if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) {
+ head += 2;
+ } else {
+ length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3];
+ var endPoint = head + length + 2;
+ var seg = rawImageArray.slice(head, endPoint);
+ segments.push(seg);
+ head = endPoint;
+ }
+
+ if (head > rawImageArray.length) {
+ break;
+ }
+ }
+
+ return segments;
+ }
+ }, {
+ key: "decode64",
+ value: function decode64(input) {
+ var output = "";
+ var chr1 = undefined;
+ var chr2 = undefined;
+ var chr3 = "";
+ var enc1 = undefined;
+ var enc2 = undefined;
+ var enc3 = undefined;
+ var enc4 = "";
+ var i = 0;
+ var buf = []; // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
+
+ var base64test = /[^A-Za-z0-9\+\/\=]/g;
+
+ if (base64test.exec(input)) {
+ console.warn("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.");
+ }
+
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+
+ while (true) {
+ enc1 = this.KEY_STR.indexOf(input.charAt(i++));
+ enc2 = this.KEY_STR.indexOf(input.charAt(i++));
+ enc3 = this.KEY_STR.indexOf(input.charAt(i++));
+ enc4 = this.KEY_STR.indexOf(input.charAt(i++));
+ chr1 = enc1 << 2 | enc2 >> 4;
+ chr2 = (enc2 & 15) << 4 | enc3 >> 2;
+ chr3 = (enc3 & 3) << 6 | enc4;
+ buf.push(chr1);
+
+ if (enc3 !== 64) {
+ buf.push(chr2);
+ }
+
+ if (enc4 !== 64) {
+ buf.push(chr3);
+ }
+
+ chr1 = chr2 = chr3 = "";
+ enc1 = enc2 = enc3 = enc4 = "";
+
+ if (!(i < input.length)) {
+ break;
+ }
+ }
+
+ return buf;
+ }
+ }]);
+
+ return ExifRestore;
+}();
+
+ExifRestore.initClass();
+/*
+ * contentloaded.js
+ *
+ * Author: Diego Perini (diego.perini at gmail.com)
+ * Summary: cross-browser wrapper for DOMContentLoaded
+ * Updated: 20101020
+ * License: MIT
+ * Version: 1.2
+ *
+ * URL:
+ * http://javascript.nwbox.com/ContentLoaded/
+ * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
+ */
+// @win window reference
+// @fn function reference
+
+var contentLoaded = function contentLoaded(win, fn) {
+ var done = false;
+ var top = true;
+ var doc = win.document;
+ var root = doc.documentElement;
+ var add = doc.addEventListener ? "addEventListener" : "attachEvent";
+ var rem = doc.addEventListener ? "removeEventListener" : "detachEvent";
+ var pre = doc.addEventListener ? "" : "on";
+
+ var init = function init(e) {
+ if (e.type === "readystatechange" && doc.readyState !== "complete") {
+ return;
+ }
+
+ (e.type === "load" ? win : doc)[rem](pre + e.type, init, false);
+
+ if (!done && (done = true)) {
+ return fn.call(win, e.type || e);
+ }
+ };
+
+ var poll = function poll() {
+ try {
+ root.doScroll("left");
+ } catch (e) {
+ setTimeout(poll, 50);
+ return;
+ }
+
+ return init("poll");
+ };
+
+ if (doc.readyState !== "complete") {
+ if (doc.createEventObject && root.doScroll) {
+ try {
+ top = !win.frameElement;
+ } catch (error) {}
+
+ if (top) {
+ poll();
+ }
+ }
+
+ doc[add](pre + "DOMContentLoaded", init, false);
+ doc[add](pre + "readystatechange", init, false);
+ return win[add](pre + "load", init, false);
+ }
+}; // As a single function to be able to write tests.
+
+
+Dropzone._autoDiscoverFunction = function () {
+ if (Dropzone.autoDiscover) {
+ return Dropzone.discover();
+ }
+};
+
+contentLoaded(window, Dropzone._autoDiscoverFunction);
+
+function __guard__(value, transform) {
+ return typeof value !== "undefined" && value !== null ? transform(value) : undefined;
+}
+
+function __guardMethod__(obj, methodName, transform) {
+ if (typeof obj !== "undefined" && obj !== null && typeof obj[methodName] === "function") {
+ return transform(obj, methodName);
+ } else {
+ return undefined;
+ }
+}
+
+
+;// CONCATENATED MODULE: ./tool/dropzone.dist.js
+ /// Make Dropzone a global variable.
+
+window.Dropzone = Dropzone;
+/* harmony default export */ var dropzone_dist = (Dropzone);
+
+}();
+/******/ return __webpack_exports__;
+/******/ })()
+;
+});
+},{}],108:[function(require,module,exports){
+/*
+attributes
+*/"use strict"
+
+var $ = require("./base")
+
+var trim = require("mout/string/trim"),
+ forEach = require("mout/array/forEach"),
+ filter = require("mout/array/filter"),
+ indexOf = require("mout/array/indexOf")
+
+// attributes
+
+$.implement({
+
+ setAttribute: function(name, value){
+ return this.forEach(function(node){
+ node.setAttribute(name, value)
+ })
+ },
+
+ getAttribute: function(name){
+ var attr = this[0].getAttributeNode(name)
+ return (attr && attr.specified) ? attr.value : null
+ },
+
+ hasAttribute: function(name){
+ var node = this[0]
+ if (node.hasAttribute) return node.hasAttribute(name)
+ var attr = node.getAttributeNode(name)
+ return !!(attr && attr.specified)
+ },
+
+ removeAttribute: function(name){
+ return this.forEach(function(node){
+ var attr = node.getAttributeNode(name)
+ if (attr) node.removeAttributeNode(attr)
+ })
+ }
+
+})
+
+var accessors = {}
+
+forEach(["type", "value", "name", "href", "title", "id"], function(name){
+
+ accessors[name] = function(value){
+ return (value !== undefined) ? this.forEach(function(node){
+ node[name] = value
+ }) : this[0][name]
+ }
+
+})
+
+// booleans
+
+forEach(["checked", "disabled", "selected"], function(name){
+
+ accessors[name] = function(value){
+ return (value !== undefined) ? this.forEach(function(node){
+ node[name] = !!value
+ }) : !!this[0][name]
+ }
+
+})
+
+// className
+
+var classes = function(className){
+ var classNames = trim(className).replace(/\s+/g, " ").split(" "),
+ uniques = {}
+
+ return filter(classNames, function(className){
+ if (className !== "" && !uniques[className]) return uniques[className] = className
+ }).sort()
+}
+
+accessors.className = function(className){
+ return (className !== undefined) ? this.forEach(function(node){
+ node.className = classes(className).join(" ")
+ }) : classes(this[0].className).join(" ")
+}
+
+// attribute
+
+$.implement({
+
+ attribute: function(name, value){
+ var accessor = accessors[name]
+ if (accessor) return accessor.call(this, value)
+ if (value != null) return this.setAttribute(name, value)
+ if (value === null) return this.removeAttribute(name)
+ if (value === undefined) return this.getAttribute(name)
+ }
+
+})
+
+$.implement(accessors)
+
+// shortcuts
+
+$.implement({
+
+ check: function(){
+ return this.checked(true)
+ },
+
+ uncheck: function(){
+ return this.checked(false)
+ },
+
+ disable: function(){
+ return this.disabled(true)
+ },
+
+ enable: function(){
+ return this.disabled(false)
+ },
+
+ select: function(){
+ return this.selected(true)
+ },
+
+ deselect: function(){
+ return this.selected(false)
+ }
+
+})
+
+// classNames, has / add / remove Class
+
+$.implement({
+
+ classNames: function(){
+ return classes(this[0].className)
+ },
+
+ hasClass: function(className){
+ return indexOf(this.classNames(), className) > -1
+ },
+
+ addClass: function(className){
+ return this.forEach(function(node){
+ var nodeClassName = node.className
+ var classNames = classes(nodeClassName + " " + className).join(" ")
+ if (nodeClassName !== classNames) node.className = classNames
+ })
+ },
+
+ removeClass: function(className){
+ return this.forEach(function(node){
+ var classNames = classes(node.className)
+ forEach(classes(className), function(className){
+ var index = indexOf(classNames, className)
+ if (index > -1) classNames.splice(index, 1)
+ })
+ node.className = classNames.join(" ")
+ })
+ },
+
+ toggleClass: function(className, force){
+ var add = force !== undefined ? force : !this.hasClass(className)
+ if (add)
+ this.addClass(className)
+ else
+ this.removeClass(className)
+ return !!add
+ }
+
+})
+
+// toString
+
+$.prototype.toString = function(){
+ var tag = this.tag(),
+ id = this.id(),
+ classes = this.classNames()
+
+ var str = tag
+ if (id) str += '#' + id
+ if (classes.length) str += '.' + classes.join(".")
+ return str
+}
+
+var textProperty = (document.createElement('div').textContent == null) ? 'innerText' : 'textContent'
+
+// tag, html, text, data
+
+$.implement({
+
+ tag: function(){
+ return this[0].tagName.toLowerCase()
+ },
+
+ html: function(html){
+ return (html !== undefined) ? this.forEach(function(node){
+ node.innerHTML = html
+ }) : this[0].innerHTML
+ },
+
+ text: function(text){
+ return (text !== undefined) ? this.forEach(function(node){
+ node[textProperty] = text
+ }) : this[0][textProperty]
+ },
+
+ data: function(key, value){
+ switch(value) {
+ case undefined: return this.getAttribute("data-" + key)
+ case null: return this.removeAttribute("data-" + key)
+ default: return this.setAttribute("data-" + key, value)
+ }
+ }
+
+})
+
+module.exports = $
+
+},{"./base":109,"mout/array/filter":116,"mout/array/forEach":117,"mout/array/indexOf":118,"mout/string/trim":135}],109:[function(require,module,exports){
+/*
+elements
+*/"use strict"
+
+var prime = require("prime")
+
+var forEach = require("mout/array/forEach"),
+ map = require("mout/array/map"),
+ filter = require("mout/array/filter"),
+ every = require("mout/array/every"),
+ some = require("mout/array/some")
+
+// uniqueID
+
+var index = 0,
+ __dc = document.__counter,
+ counter = document.__counter = (__dc ? parseInt(__dc, 36) + 1 : 0).toString(36),
+ key = "uid:" + counter
+
+var uniqueID = function(n){
+ if (n === window) return "window"
+ if (n === document) return "document"
+ if (n === document.documentElement) return "html"
+ return n[key] || (n[key] = (index++).toString(36))
+}
+
+var instances = {}
+
+// elements prime
+
+var $ = prime({constructor: function $(n, context){
+
+ if (n == null) return (this && this.constructor === $) ? new Elements : null
+
+ var self, uid
+
+ if (n.constructor !== Elements){
+
+ self = new Elements
+
+ if (typeof n === "string"){
+ if (!self.search) return null
+ self[self.length++] = context || document
+ return self.search(n)
+ }
+
+ if (n.nodeType || n === window){
+
+ self[self.length++] = n
+
+ } else if (n.length){
+
+ // this could be an array, or any object with a length attribute,
+ // including another instance of elements from another interface.
+
+ var uniques = {}
+
+ for (var i = 0, l = n.length; i < l; i++){ // perform elements flattening
+ var nodes = $(n[i], context)
+ if (nodes && nodes.length) for (var j = 0, k = nodes.length; j < k; j++){
+ var node = nodes[j]
+ uid = uniqueID(node)
+ if (!uniques[uid]){
+ self[self.length++] = node
+ uniques[uid] = true
+ }
+ }
+ }
+
+ }
+
+ } else {
+ self = n
+ }
+
+ if (!self.length) return null
+
+ // when length is 1 always use the same elements instance
+
+ if (self.length === 1){
+ uid = uniqueID(self[0])
+ return instances[uid] || (instances[uid] = self)
+ }
+
+ return self
+
+}})
+
+var Elements = prime({
+
+ inherits: $,
+
+ constructor: function Elements(){
+ this.length = 0
+ },
+
+ unlink: function(){
+ return this.map(function(node){
+ delete instances[uniqueID(node)]
+ return node
+ })
+ },
+
+ // methods
+
+ forEach: function(method, context){
+ forEach(this, method, context)
+ return this
+ },
+
+ map: function(method, context){
+ return map(this, method, context)
+ },
+
+ filter: function(method, context){
+ return filter(this, method, context)
+ },
+
+ every: function(method, context){
+ return every(this, method, context)
+ },
+
+ some: function(method, context){
+ return some(this, method, context)
+ }
+
+})
+
+module.exports = $
+
+},{"mout/array/every":115,"mout/array/filter":116,"mout/array/forEach":117,"mout/array/map":119,"mout/array/some":120,"prime":301}],110:[function(require,module,exports){
+/*
+delegation
+*/"use strict"
+
+var Map = require("prime/map")
+
+var $ = require("./events")
+ require('./traversal')
+
+$.implement({
+
+ delegate: function(event, selector, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node)
+
+ var delegation = self._delegation || (self._delegation = {}),
+ events = delegation[event] || (delegation[event] = {}),
+ map = (events[selector] || (events[selector] = new Map))
+
+ if (map.get(handle)) return
+
+ var action = function(e){
+ var target = $(e.target || e.srcElement),
+ match = target.matches(selector) ? target : target.parent(selector)
+
+ var res
+
+ if (match) res = handle.call(self, e, match)
+
+ return res
+ }
+
+ map.set(handle, action)
+
+ self.on(event, action, useCapture)
+
+ })
+
+ },
+
+ undelegate: function(event, selector, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node), delegation, events, map
+
+ if (!(delegation = self._delegation) || !(events = delegation[event]) || !(map = events[selector])) return;
+
+ var action = map.get(handle)
+
+ if (action){
+ self.off(event, action, useCapture)
+ map.remove(action)
+
+ // if there are no more handles in a given selector, delete it
+ if (!map.count()) delete events[selector]
+ // var evc = evd = 0, x
+ var e1 = true, e2 = true, x
+ for (x in events){
+ e1 = false
+ break
+ }
+ // if no more selectors in a given event type, delete it
+ if (e1) delete delegation[event]
+ for (x in delegation){
+ e2 = false
+ break
+ }
+ // if there are no more delegation events in the element, delete the _delegation object
+ if (e2) delete self._delegation
+ }
+
+ })
+
+ }
+
+})
+
+module.exports = $
+
+},{"./events":112,"./traversal":136,"prime/map":302}],111:[function(require,module,exports){
+/*
+domready
+*/"use strict"
+
+var $ = require("./events")
+
+var readystatechange = 'onreadystatechange' in document,
+ shouldPoll = false,
+ loaded = false,
+ readys = [],
+ checks = [],
+ ready = null,
+ timer = null,
+ test = document.createElement('div'),
+ doc = $(document),
+ win = $(window)
+
+var domready = function(){
+
+ if (timer) timer = clearTimeout(timer)
+
+ if (!loaded){
+
+ if (readystatechange) doc.off('readystatechange', check)
+ doc.off('DOMContentLoaded', domready)
+ win.off('load', domready)
+
+ loaded = true
+
+ for (var i = 0; ready = readys[i++];) ready()
+ }
+
+ return loaded
+
+}
+
+var check = function(){
+ for (var i = checks.length; i--;) if (checks[i]()) return domready()
+ return false
+}
+
+var poll = function(){
+ clearTimeout(timer)
+ if (!check()) timer = setTimeout(poll, 1e3 / 60)
+}
+
+if (document.readyState){ // use readyState if available
+
+ var complete = function(){
+ return !!(/loaded|complete/).test(document.readyState)
+ }
+
+ checks.push(complete)
+
+ if (!complete()){ // unless dom is already loaded
+ if (readystatechange) doc.on('readystatechange', check) // onreadystatechange event
+ else shouldPoll = true //or poll readyState check
+ } else { // dom is already loaded
+ domready()
+ }
+
+}
+
+if (test.doScroll){ // also use doScroll if available (doscroll comes before readyState "complete")
+
+ // LEGAL DEPT:
+ // doScroll technique discovered by, owned by, and copyrighted to Diego Perini http://javascript.nwbox.com/IEContentLoaded/
+
+ // testElement.doScroll() throws when the DOM is not ready, only in the top window
+
+ var scrolls = function(){
+ try {
+ test.doScroll()
+ return true
+ } catch (e){}
+ return false
+ }
+
+ // If doScroll works already, it can't be used to determine domready
+ // e.g. in an iframe
+
+ if (!scrolls()){
+ checks.push(scrolls)
+ shouldPoll = true
+ }
+
+}
+
+if (shouldPoll) poll()
+
+// make sure that domready fires before load, also if not onreadystatechange and doScroll and DOMContentLoaded load will fire
+doc.on('DOMContentLoaded', domready)
+win.on('load', domready)
+
+module.exports = function(ready){
+ (loaded) ? ready() : readys.push(ready)
+ return null
+}
+
+},{"./events":112}],112:[function(require,module,exports){
+/*
+events
+*/"use strict"
+
+var Emitter = require("prime/emitter")
+
+var $ = require("./base")
+
+var html = document.documentElement
+
+var addEventListener = html.addEventListener ? function(node, event, handle, useCapture){
+ node.addEventListener(event, handle, useCapture || false)
+ return handle
+} : function(node, event, handle){
+ node.attachEvent('on' + event, handle)
+ return handle
+}
+
+var removeEventListener = html.removeEventListener ? function(node, event, handle, useCapture){
+ node.removeEventListener(event, handle, useCapture || false)
+} : function(node, event, handle){
+ node.detachEvent("on" + event, handle)
+}
+
+$.implement({
+
+ on: function(event, handle, useCapture){
+
+ return this.forEach(function(node){
+ var self = $(node)
+
+ var internalEvent = event + (useCapture ? ":capture" : "")
+
+ Emitter.prototype.on.call(self, internalEvent, handle)
+
+ var domListeners = self._domListeners || (self._domListeners = {})
+ if (!domListeners[internalEvent]) domListeners[internalEvent] = addEventListener(node, event, function(e){
+ Emitter.prototype.emit.call(self, internalEvent, e || window.event, Emitter.EMIT_SYNC)
+ }, useCapture)
+ })
+ },
+
+ off: function(event, handle, useCapture){
+
+ return this.forEach(function(node){
+
+ var self = $(node)
+
+ var internalEvent = event + (useCapture ? ":capture" : "")
+
+ var domListeners = self._domListeners, domEvent, listeners = self._listeners, events
+
+ if (domListeners && (domEvent = domListeners[internalEvent]) && listeners && (events = listeners[internalEvent])){
+
+ Emitter.prototype.off.call(self, internalEvent, handle)
+
+ if (!self._listeners || !self._listeners[event]){
+ removeEventListener(node, event, domEvent)
+ delete domListeners[event]
+
+ for (var l in domListeners) return
+ delete self._domListeners
+ }
+
+ }
+ })
+ },
+
+ emit: function(){
+ var args = arguments
+ return this.forEach(function(node){
+ Emitter.prototype.emit.apply($(node), args)
+ })
+ }
+
+})
+
+module.exports = $
+
+},{"./base":109,"prime/emitter":300}],113:[function(require,module,exports){
+/*
+elements
+*/"use strict"
+
+var $ = require("./base")
+ require("./attributes")
+ require("./events")
+ require("./insertion")
+ require("./traversal")
+ require("./delegation")
+
+module.exports = $
+
+},{"./attributes":108,"./base":109,"./delegation":110,"./events":112,"./insertion":114,"./traversal":136}],114:[function(require,module,exports){
+/*
+insertion
+*/"use strict"
+
+var $ = require("./base")
+
+// base insertion
+
+$.implement({
+
+ appendChild: function(child){
+ this[0].appendChild($(child)[0])
+ return this
+ },
+
+ insertBefore: function(child, ref){
+ this[0].insertBefore($(child)[0], $(ref)[0])
+ return this
+ },
+
+ removeChild: function(child){
+ this[0].removeChild($(child)[0])
+ return this
+ },
+
+ replaceChild: function(child, ref){
+ this[0].replaceChild($(child)[0], $(ref)[0])
+ return this
+ }
+
+})
+
+// before, after, bottom, top
+
+$.implement({
+
+ before: function(element){
+ element = $(element)[0]
+ var parent = element.parentNode
+ if (parent) this.forEach(function(node){
+ parent.insertBefore(node, element)
+ })
+ return this
+ },
+
+ after: function(element){
+ element = $(element)[0]
+ var parent = element.parentNode
+ if (parent) this.forEach(function(node){
+ parent.insertBefore(node, element.nextSibling)
+ })
+ return this
+ },
+
+ bottom: function(element){
+ element = $(element)[0]
+ return this.forEach(function(node){
+ element.appendChild(node)
+ })
+ },
+
+ top: function(element){
+ element = $(element)[0]
+ return this.forEach(function(node){
+ element.insertBefore(node, element.firstChild)
+ })
+ }
+
+})
+
+// insert, replace
+
+$.implement({
+
+ insert: $.prototype.bottom,
+
+ remove: function(){
+ return this.forEach(function(node){
+ var parent = node.parentNode
+ if (parent) parent.removeChild(node)
+ })
+ },
+
+ replace: function(element){
+ element = $(element)[0]
+ element.parentNode.replaceChild(this[0], element)
+ return this
+ }
+
+})
+
+module.exports = $
+
+},{"./base":109}],115:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array every
+ */
+ function every(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = true;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (!callback(arr[i], i, arr) ) {
+ result = false;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = every;
+
+
+},{"../function/makeIterator_":122}],116:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array filter
+ */
+ function filter(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null) {
+ return results;
+ }
+
+ var i = -1, len = arr.length, value;
+ while (++i < len) {
+ value = arr[i];
+ if (callback(value, i, arr)) {
+ results.push(value);
+ }
+ }
+
+ return results;
+ }
+
+ module.exports = filter;
+
+
+
+},{"../function/makeIterator_":122}],117:[function(require,module,exports){
+arguments[4][81][0].apply(exports,arguments)
+},{"dup":81}],118:[function(require,module,exports){
+arguments[4][82][0].apply(exports,arguments)
+},{"dup":82}],119:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array map
+ */
+ function map(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null){
+ return results;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ results[i] = callback(arr[i], i, arr);
+ }
+
+ return results;
+ }
+
+ module.exports = map;
+
+
+},{"../function/makeIterator_":122}],120:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array some
+ */
+ function some(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = false;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback(arr[i], i, arr) ) {
+ result = true;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = some;
+
+
+},{"../function/makeIterator_":122}],121:[function(require,module,exports){
+
+
+ /**
+ * Returns the first argument provided to it.
+ */
+ function identity(val){
+ return val;
+ }
+
+ module.exports = identity;
+
+
+
+},{}],122:[function(require,module,exports){
+var identity = require('./identity');
+var prop = require('./prop');
+var deepMatches = require('../object/deepMatches');
+
+ /**
+ * Converts argument into a valid iterator.
+ * Used internally on most array/object/collection methods that receives a
+ * callback/iterator providing a shortcut syntax.
+ */
+ function makeIterator(src, thisObj){
+ if (src == null) {
+ return identity;
+ }
+ switch(typeof src) {
+ case 'function':
+ // function is the first to improve perf (most common case)
+ // also avoid using `Function#call` if not needed, which boosts
+ // perf a lot in some cases
+ return (typeof thisObj !== 'undefined')? function(val, i, arr){
+ return src.call(thisObj, val, i, arr);
+ } : src;
+ case 'object':
+ return function(val){
+ return deepMatches(val, src);
+ };
+ case 'string':
+ case 'number':
+ return prop(src);
+ }
+ }
+
+ module.exports = makeIterator;
+
+
+
+},{"../object/deepMatches":128,"./identity":121,"./prop":123}],123:[function(require,module,exports){
+
+
+ /**
+ * Returns a function that gets a property of the passed object
+ */
+ function prop(name){
+ return function(obj){
+ return obj[name];
+ };
+ }
+
+ module.exports = prop;
+
+
+
+},{}],124:[function(require,module,exports){
+arguments[4][85][0].apply(exports,arguments)
+},{"./isKind":125,"dup":85}],125:[function(require,module,exports){
+arguments[4][87][0].apply(exports,arguments)
+},{"./kindOf":126,"dup":87}],126:[function(require,module,exports){
+arguments[4][90][0].apply(exports,arguments)
+},{"dup":90}],127:[function(require,module,exports){
+arguments[4][91][0].apply(exports,arguments)
+},{"dup":91}],128:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var isArray = require('../lang/isArray');
+
+ function containsMatch(array, pattern) {
+ var i = -1, length = array.length;
+ while (++i < length) {
+ if (deepMatches(array[i], pattern)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function matchArray(target, pattern) {
+ var i = -1, patternLength = pattern.length;
+ while (++i < patternLength) {
+ if (!containsMatch(target, pattern[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function matchObject(target, pattern) {
+ var result = true;
+ forOwn(pattern, function(val, key) {
+ if (!deepMatches(target[key], val)) {
+ // Return false to break out of forOwn early
+ return (result = false);
+ }
+ });
+
+ return result;
+ }
+
+ /**
+ * Recursively check if the objects match.
+ */
+ function deepMatches(target, pattern){
+ if (target && typeof target === 'object') {
+ if (isArray(target) && isArray(pattern)) {
+ return matchArray(target, pattern);
+ } else {
+ return matchObject(target, pattern);
+ }
+ } else {
+ return target === pattern;
+ }
+ }
+
+ module.exports = deepMatches;
+
+
+
+},{"../lang/isArray":124,"./forOwn":130}],129:[function(require,module,exports){
+arguments[4][92][0].apply(exports,arguments)
+},{"./hasOwn":131,"dup":92}],130:[function(require,module,exports){
+arguments[4][93][0].apply(exports,arguments)
+},{"./forIn":129,"./hasOwn":131,"dup":93}],131:[function(require,module,exports){
+arguments[4][94][0].apply(exports,arguments)
+},{"dup":94}],132:[function(require,module,exports){
+arguments[4][96][0].apply(exports,arguments)
+},{"dup":96}],133:[function(require,module,exports){
+arguments[4][97][0].apply(exports,arguments)
+},{"../lang/toString":127,"./WHITE_SPACES":132,"dup":97}],134:[function(require,module,exports){
+arguments[4][98][0].apply(exports,arguments)
+},{"../lang/toString":127,"./WHITE_SPACES":132,"dup":98}],135:[function(require,module,exports){
+arguments[4][99][0].apply(exports,arguments)
+},{"../lang/toString":127,"./WHITE_SPACES":132,"./ltrim":133,"./rtrim":134,"dup":99}],136:[function(require,module,exports){
+/*
+traversal
+*/"use strict"
+
+var map = require("mout/array/map")
+
+var slick = require("slick")
+
+var $ = require("./base")
+
+var gen = function(combinator, expression){
+ return map(slick.parse(expression || "*"), function(part){
+ return combinator + " " + part
+ }).join(", ")
+}
+
+var push_ = Array.prototype.push
+
+$.implement({
+
+ search: function(expression){
+ if (this.length === 1) return $(slick.search(expression, this[0], new $))
+
+ var buffer = []
+ for (var i = 0, node; node = this[i]; i++) push_.apply(buffer, slick.search(expression, node))
+ buffer = $(buffer)
+ return buffer && buffer.sort()
+ },
+
+ find: function(expression){
+ if (this.length === 1) return $(slick.find(expression, this[0]))
+
+ for (var i = 0, node; node = this[i]; i++) {
+ var found = slick.find(expression, node)
+ if (found) return $(found)
+ }
+
+ return null
+ },
+
+ sort: function(){
+ return slick.sort(this)
+ },
+
+ matches: function(expression){
+ return slick.matches(this[0], expression)
+ },
+
+ contains: function(node){
+ return slick.contains(this[0], node)
+ },
+
+ nextSiblings: function(expression){
+ return this.search(gen('~', expression))
+ },
+
+ nextSibling: function(expression){
+ return this.find(gen('+', expression))
+ },
+
+ previousSiblings: function(expression){
+ return this.search(gen('!~', expression))
+ },
+
+ previousSibling: function(expression){
+ return this.find(gen('!+', expression))
+ },
+
+ children: function(expression){
+ return this.search(gen('>', expression))
+ },
+
+ firstChild: function(expression){
+ return this.find(gen('^', expression))
+ },
+
+ lastChild: function(expression){
+ return this.find(gen('!^', expression))
+ },
+
+ parent: function(expression){
+ var buffer = []
+ loop: for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){
+ if (!expression || slick.matches(node, expression)){
+ buffer.push(node)
+ break loop
+ break
+ }
+ }
+ return $(buffer)
+ },
+
+ parents: function(expression){
+ var buffer = []
+ for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){
+ if (!expression || slick.matches(node, expression)) buffer.push(node)
+ }
+ return $(buffer)
+ }
+
+})
+
+module.exports = $
+
+},{"./base":109,"mout/array/map":119,"slick":314}],137:[function(require,module,exports){
+/*
+zen
+*/"use strict"
+
+var forEach = require("mout/array/forEach"),
+ map = require("mout/array/map")
+
+var parse = require("slick/parser")
+
+var $ = require("./base")
+
+module.exports = function(expression, doc){
+
+ return $(map(parse(expression), function(expression){
+
+ var previous, result
+
+ forEach(expression, function(part, i){
+
+ var node = (doc || document).createElement(part.tag)
+
+ if (part.id) node.id = part.id
+
+ if (part.classList) node.className = part.classList.join(" ")
+
+ if (part.attributes) forEach(part.attributes, function(attribute){
+ node.setAttribute(attribute.name, attribute.value || "")
+ })
+
+ if (part.pseudos) forEach(part.pseudos, function(pseudo){
+ var n = $(node), method = n[pseudo.name]
+ if (method) method.call(n, pseudo.value)
+ })
+
+ if (i === 0){
+
+ result = node
+
+ } else if (part.combinator === " "){
+
+ previous.appendChild(node)
+
+ } else if (part.combinator === "+"){
+ var parentNode = previous.parentNode
+ if (parentNode) parentNode.appendChild(node)
+ }
+
+ previous = node
+
+ })
+
+ return result
+
+ }))
+
+}
+
+},{"./base":109,"mout/array/forEach":117,"mout/array/map":119,"slick/parser":315}],138:[function(require,module,exports){
+/* .- 3
+.-.-..-..-.-|-._.
+' ' '`-'`-' ' ' '
+*/"use strict"
+
+// color and timer
+var color = require("./lib/color"),
+ frame = require("./lib/frame")
+
+// if we're in a browser we need ./browser, otherwise ./fx
+var moofx = (typeof document !== "undefined") ? require("./lib/browser") : require("./lib/fx")
+
+moofx.requestFrame = function(callback){
+ frame.request(callback)
+ return this
+}
+
+moofx.cancelFrame = function(callback){
+ frame.cancel(callback)
+ return this
+}
+
+moofx.color = color
+
+// and export moofx
+
+module.exports = moofx
+
+},{"./lib/browser":139,"./lib/color":140,"./lib/frame":141,"./lib/fx":142}],139:[function(require,module,exports){
+(function (global){(function (){
+/*
+MooFx
+*/"use strict"
+
+// requires
+
+var color = require("./color"),
+ frame = require("./frame")
+
+var cancelFrame = frame.cancel,
+ requestFrame = frame.request
+
+var prime = require("prime")
+
+var camelize = require("prime/string/camelize"),
+ clean = require("prime/string/clean"),
+ capitalize = require("prime/string/capitalize"),
+ hyphenateString = require("prime/string/hyphenate")
+
+var map = require("prime/array/map"),
+ forEach = require("prime/array/forEach"),
+ indexOf = require("prime/array/indexOf")
+
+var elements = require("elements")
+
+var fx = require("./fx")
+
+// util
+
+var matchString = function(s, r){
+ return String.prototype.match.call(s, r);
+}
+
+var hyphenated = {}
+var hyphenate = function(self){
+ return hyphenated[self] || (hyphenated[self] = hyphenateString(self))
+}
+
+var round = function(n){
+ return Math.round(n * 1e3) / 1e3
+}
+
+// compute > node > property
+
+var compute = global.getComputedStyle ? function(node){
+ var cts = getComputedStyle(node, null)
+ return function(property){
+ return cts ? cts.getPropertyValue(hyphenate(property)) : ""
+ }
+} : /*(css3)?*/function(node){
+ var cts = node.currentStyle
+ return function(property){
+ return cts ? cts[camelize(property)] : ""
+ }
+}/*:null*/
+
+// pixel ratio retriever
+
+var test = document.createElement("div")
+
+var cssText = "border:none;margin:none;padding:none;visibility:hidden;position:absolute;height:0;";
+
+// returns the amount of pixels that takes to make one of the unit
+
+var pixelRatio = function(element, u){
+ var parent = element.parentNode, ratio = 1
+ if (parent){
+ test.style.cssText = cssText + ("width:100" + u + ";")
+ parent.appendChild(test)
+ ratio = test.offsetWidth / 100
+ parent.removeChild(test)
+ }
+ return ratio
+}
+
+// mirror 4 values
+
+var mirror4 = function(values){
+ var length = values.length
+ if (length === 1) values.push(values[0], values[0], values[0])
+ else if (length === 2) values.push(values[0], values[1])
+ else if (length === 3) values.push(values[1])
+ return values
+}
+
+// regular expressions strings
+
+var sLength = "([-.\\d]+)(%|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vm)",
+ sLengthNum = sLength + "?",
+ sBorderStyle = "none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit"
+
+// regular expressions
+
+var rgLength = RegExp(sLength, "g"),
+ rLengthNum = RegExp(sLengthNum),
+ rgLengthNum = RegExp(sLengthNum, "g"),
+ rBorderStyle = RegExp(sBorderStyle)
+
+// normalize > css
+
+var parseString = function(value){
+ return (value == null) ? "" : value + ""
+}
+
+var parseOpacity = function(value, normalize){
+ if (value == null || value === "") return normalize ? "1" : ""
+ return (isFinite((value = +value))) ? (value < 0 ? "0" : value + "") : "1"
+}
+
+try {test.style.color = "rgba(0,0,0,0.5)"} catch(e){}
+var rgba = /^rgba/.test(test.style.color)
+
+var parseColor = function(value, normalize){
+ var black = "rgba(0,0,0,1)", c
+ if (!value || !(c = color(value, true))) return normalize ? black : ""
+ if (normalize) return "rgba(" + c + ")"
+
+ var alpha = c[3]
+ if (alpha === 0) return "transparent"
+ return (!rgba || alpha === 1) ? "rgb(" + c.slice(0, 3) + ")" : "rgba(" + c + ")"
+}
+
+var parseLength = function(value, normalize){
+ if (value == null || value === "") return normalize ? "0px" : ""
+ var match = matchString(value, rLengthNum)
+ return match ? match[1] + (match[2] || "px") : value // cannot be parsed. probably "auto"
+}
+
+var parseBorderStyle = function(value, normalize){
+ if (value == null || value === "") return normalize ? "none" : ""
+ var match = value.match(rBorderStyle)
+ return match ? value : normalize ? "none" : ""
+}
+
+var parseBorder = function(value, normalize){
+ var normalized = "0px none rgba(0,0,0,1)"
+ if (value == null || value === "") return normalize ? normalized : ""
+ if (value === 0 || value === "none") return normalize ? normalized : value + ""
+
+ var c
+ value = value.replace(color.x, function(match){
+ c = match
+ return ""
+ })
+
+ var s = value.match(rBorderStyle),
+ l = value.match(rgLengthNum)
+
+ return clean([
+ parseLength(l ? l[0] : "", normalize),
+ parseBorderStyle(s ? s[0] : "", normalize),
+ parseColor(c, normalize)
+ ].join(" "))
+}
+
+var parseShort4 = function(value, normalize){
+ if (value == null || value === "") return normalize ? "0px 0px 0px 0px" : ""
+ return clean(mirror4(map(clean(value).split(" "), function(v){
+ return parseLength(v, normalize)
+ })).join(" "))
+}
+
+var parseShadow = function(value, normalize, len){
+ var transparent = "rgba(0,0,0,0)",
+ normalized = (len === 3) ? transparent + " 0px 0px 0px" : transparent + " 0px 0px 0px 0px"
+
+ if (value == null || value === "") return normalize ? normalized : ""
+ if (value === "none") return normalize ? normalized : value
+
+ var colors = [], value = clean(value).replace(color.x, function(match){
+ colors.push(match)
+ return ""
+ })
+
+ return map(value.split(","), function(shadow, i){
+
+ var c = parseColor(colors[i], normalize),
+ inset = /inset/.test(shadow),
+ lengths = shadow.match(rgLengthNum) || ["0px"]
+
+ lengths = map(lengths, function(m){
+ return parseLength(m, normalize)
+ })
+
+ while (lengths.length < len) lengths.push("0px")
+
+ var ret = inset ? ["inset", c] : [c]
+
+ return ret.concat(lengths).join(" ")
+
+ }).join(", ")
+}
+
+var parse = function(value, normalize){
+ if (value == null || value === "") return "" // cant normalize "" || null
+ return value.replace(color.x, function(match){
+ return parseColor(match, normalize)
+ }).replace(rgLength, function(match){
+ return parseLength(match, normalize)
+ })
+}
+
+// get && set
+
+var getters = {}, setters = {}, parsers = {}, aliases = {}
+
+var getter = function(key){
+ return getters[key] || (getters[key] = (function(){
+ var alias = aliases[key] || key,
+ parser = parsers[key] || parse
+
+ return function(){
+ return parser(compute(this)(alias), true)
+ }
+
+ }()))
+}
+
+var setter = function(key){
+ return setters[key] || (setters[key] = (function(){
+
+ var alias = aliases[key] || key,
+ parser = parsers[key] || parse
+
+ return function(value){
+ this.style[alias] = parser(value, false)
+ }
+
+ }()))
+}
+
+// parsers
+
+var trbl = ["Top", "Right", "Bottom", "Left"], tlbl = ["TopLeft", "TopRight", "BottomRight", "BottomLeft"]
+
+forEach(trbl, function(d){
+ var bd = "border" + d
+ forEach([ "margin" + d, "padding" + d, bd + "Width", d.toLowerCase()], function(n){
+ parsers[n] = parseLength
+ })
+ parsers[bd + "Color"] = parseColor
+ parsers[bd + "Style"] = parseBorderStyle
+
+ // borderDIR
+ parsers[bd] = parseBorder
+ getters[bd] = function(){
+ return [
+ getter(bd + "Width").call(this),
+ getter(bd + "Style").call(this),
+ getter(bd + "Color").call(this)
+ ].join(" ")
+ }
+})
+
+forEach(tlbl, function(d){
+ parsers["border" + d + "Radius"] = parseLength
+})
+
+parsers.color = parsers.backgroundColor = parseColor
+parsers.width = parsers.height = parsers.minWidth = parsers.minHeight = parsers.maxWidth = parsers.maxHeight = parsers.fontSize = parsers.backgroundSize = parseLength
+
+// margin + padding
+
+forEach(["margin", "padding"], function(name){
+ parsers[name] = parseShort4
+ getters[name] = function(){
+ return map(trbl, function(d){
+ return getter(name + d).call(this)
+ }, this).join(" ")
+ }
+})
+
+// borders
+
+// borderDIRWidth, borderDIRStyle, borderDIRColor
+
+parsers.borderWidth = parseShort4
+
+parsers.borderStyle = function(value, normalize){
+ if (value == null || value === "") return normalize ? mirror4(["none"]).join(" ") : ""
+ value = clean(value).split(" ")
+ return clean(mirror4(map(value, function(v){
+ parseBorderStyle(v, normalize)
+ })).join(" "))
+}
+
+parsers.borderColor = function(value, normalize){
+ if (!value || !(value = matchString(value, color.x))) return normalize ? mirror4(["rgba(0,0,0,1)"]).join(" ") : ""
+ return clean(mirror4(map(value, function(v){
+ return parseColor(v, normalize)
+ })).join(" "))
+}
+
+forEach(["Width", "Style", "Color"], function(name){
+ getters["border" + name] = function(){
+ return map(trbl, function(d){
+ return getter("border" + d + name).call(this)
+ }, this).join(" ")
+ }
+})
+
+// borderRadius
+
+parsers.borderRadius = parseShort4
+
+getters.borderRadius = function(){
+ return map(tlbl, function(d){
+ return getter("border" + d + "Radius").call(this)
+ }, this).join(" ")
+}
+
+// border
+
+parsers.border = parseBorder
+
+getters.border = function(){
+ var pvalue
+ for (var i = 0; i < trbl.length; i++){
+ var value = getter("border" + trbl[i]).call(this)
+ if (pvalue && value !== pvalue) return null
+ pvalue = value
+ }
+ return pvalue
+}
+
+// zIndex
+
+parsers.zIndex = parseString
+
+// opacity
+
+parsers.opacity = parseOpacity
+
+/*(css3)?*/
+
+var filterName = (test.style.MsFilter != null && "MsFilter") || (test.style.filter != null && "filter")
+
+if (filterName && test.style.opacity == null){
+
+ var matchOp = /alpha\(opacity=([\d.]+)\)/i
+
+ setters.opacity = function(value){
+ value = ((value = parseOpacity(value)) === "1") ? "" : "alpha(opacity=" + Math.round(value * 100) + ")"
+ var filter = compute(this)(filterName)
+ return this.style[filterName] = matchOp.test(filter) ? filter.replace(matchOp, value) : filter + " " + value
+ }
+
+ getters.opacity = function(){
+ var match = compute(this)(filterName).match(matchOp)
+ return (!match ? 1 : match[1] / 100) + ""
+ }
+
+}/*:*/
+
+var parseBoxShadow = parsers.boxShadow = function(value, normalize){
+ return parseShadow(value, normalize, 4)
+}
+
+var parseTextShadow = parsers.textShadow = function(value, normalize){
+ return parseShadow(value, normalize, 3)
+}
+
+// Aliases
+
+forEach(['Webkit', "Moz", "ms", "O", null], function(prefix){
+ forEach([
+ "transition", "transform", "transformOrigin", "transformStyle", "perspective", "perspectiveOrigin", "backfaceVisibility"
+ ], function(style){
+ var cc = prefix ? prefix + capitalize(style) : style
+ if (prefix === "ms") hyphenated[cc] = "-ms-" + hyphenate(style)
+ if (test.style[cc] != null) aliases[style] = cc
+ })
+})
+
+var transitionName = aliases.transition,
+ transformName = aliases.transform
+
+// manually disable css3 transitions in Opera, because they do not work properly.
+
+if (transitionName === "OTransition") transitionName = null
+
+
+// this takes care of matrix decomposition on browsers that support only 2d transforms but no CSS3 transitions.
+// basically, IE9 (and Opera as well, since we disabled CSS3 transitions manually)
+
+var parseTransform2d, Transform2d
+
+/*(css3)?*/
+
+if (!transitionName && transformName) (function(){
+
+ var unmatrix = require("./unmatrix2d")
+
+ var v = "\\s*([-\\d\\w.]+)\\s*"
+
+ var rMatrix = RegExp("matrix\\(" + [v, v, v, v, v, v] + "\\)")
+
+ var decomposeMatrix = function(matrix){
+
+ var d = unmatrix.apply(null, matrix.match(rMatrix).slice(1)) || [[0, 0], 0, 0, [0, 0]]
+
+ return [
+
+ "translate(" + map(d[0], function(v){return round(v) + "px"}) + ")",
+ "rotate(" + round(d[1] * 180 / Math.PI) + "deg)",
+ "skewX(" + round(d[2] * 180 / Math.PI) + "deg)",
+ "scale(" + map(d[3], round) + ")"
+
+ ].join(" ")
+
+ }
+
+ var def0px = function(value){return value || "0px"},
+ def1 = function(value){return value || "1"},
+ def0deg = function(value){return value || "0deg"}
+
+ var transforms = {
+
+ translate: function(value){
+ if (!value) value = "0px,0px"
+ var values = value.split(",")
+ if (!values[1]) values[1] = "0px"
+ return map(values, clean) + ""
+ },
+ translateX: def0px,
+ translateY: def0px,
+ scale: function(value){
+ if (!value) value = "1,1"
+ var values = value.split(",")
+ if (!values[1]) values[1] = values[0]
+ return map(values, clean) + ""
+ },
+ scaleX: def1,
+ scaleY: def1,
+ rotate: def0deg,
+ skewX: def0deg,
+ skewY: def0deg
+
+ }
+
+ Transform2d = prime({
+
+ constructor: function(transform){
+
+ var names = this.names = []
+ var values = this.values = []
+
+ transform.replace(/(\w+)\(([-.\d\s\w,]+)\)/g, function(match, name, value){
+ names.push(name)
+ values.push(value)
+ })
+
+ },
+
+ identity: function(){
+ var functions = []
+ forEach(this.names, function(name){
+ var fn = transforms[name]
+ if (fn) functions.push(name + "(" + fn() + ")")
+ })
+ return functions.join(" ")
+ },
+
+ sameType: function(transformObject){
+ return this.names.toString() === transformObject.names.toString()
+ },
+
+ // this is, basically, cheating.
+ // retrieving the matrix value from the dom, rather than calculating it
+
+ decompose: function(){
+ var transform = this.toString()
+
+ test.style.cssText = cssText + hyphenate(transformName) + ":" + transform + ";"
+ document.body.appendChild(test)
+ var m = compute(test)(transformName)
+ if (!m || m === "none") m = "matrix(1, 0, 0, 1, 0, 0)"
+ document.body.removeChild(test)
+ return decomposeMatrix(m)
+ }
+
+ })
+
+ Transform2d.prototype.toString = function(clean){
+ var values = this.values, functions = []
+ forEach(this.names, function(name, i){
+ var fn = transforms[name]
+ if (!fn) return
+ var value = fn(values[i])
+ if (!clean || value !== fn()) functions.push(name + "(" + value + ")")
+ })
+ return functions.length ? functions.join(" ") : "none"
+ }
+
+ Transform2d.union = function(from, to){
+
+ if (from === to) return // nothing to do
+
+ var fromMap, toMap
+
+ if (from === "none"){
+
+ toMap = new Transform2d(to)
+ to = toMap.toString()
+ from = toMap.identity()
+ fromMap = new Transform2d(from)
+
+ } else if (to === "none"){
+
+ fromMap = new Transform2d(from)
+ from = fromMap.toString()
+ to = fromMap.identity()
+ toMap = new Transform2d(to)
+
+ } else {
+
+ fromMap = new Transform2d(from)
+ from = fromMap.toString()
+ toMap = new Transform2d(to)
+ to = toMap.toString()
+
+ }
+
+ if (from === to) return // nothing to do
+
+ if (!fromMap.sameType(toMap)){
+
+ from = fromMap.decompose()
+ to = toMap.decompose()
+
+ }
+
+ if (from === to) return // nothing to do
+
+ return [from, to]
+
+ }
+
+ // this parser makes sure it never gets "matrix"
+
+ parseTransform2d = parsers.transform = function(transform){
+ if (!transform || transform === "none") return "none"
+ return new Transform2d(rMatrix.test(transform) ? decomposeMatrix(transform) : transform).toString(true)
+ }
+
+ // this getter makes sure we read from the dom only the first time
+ // this way we save the actual transform and not "matrix"
+ // setting matrix() will use parseTransform2d as well, thus setting the decomposed matrix
+
+ getters.transform = function(){
+ var s = this.style
+ return s[transformName] || (s[transformName] = parseTransform2d(compute(this)(transformName)))
+ }
+
+
+})()/*:*/
+
+// tries to match from and to values
+
+var prepare = function(node, property, to){
+
+ var parser = parsers[property] || parse,
+ from = getter(property).call(node), // "normalized" by the getter
+ to = parser(to, true) // normalize parsed property
+
+ if (from === to) return
+
+ if (parser === parseLength || parser === parseBorder || parser === parseShort4){
+
+ var toAll = to.match(rgLength), i = 0 // this should always match something
+
+ if (toAll) from = from.replace(rgLength, function(fromFull, fromValue, fromUnit){
+
+ var toFull = toAll[i++],
+ toMatched = toFull.match(rLengthNum),
+ toUnit = toMatched[2]
+
+ if (fromUnit !== toUnit){
+ var fromPixels = (fromUnit === "px") ? fromValue : pixelRatio(node, fromUnit) * fromValue
+ return round(fromPixels / pixelRatio(node, toUnit)) + toUnit
+ }
+
+ return fromFull
+
+ })
+
+ if (i > 0) setter(property).call(node, from)
+
+ }/*(css3)?*/else if (parser === parseTransform2d){ // IE9/Opera
+
+ return Transform2d.union(from, to)
+
+ }/*:*/
+
+ return (from !== to) ? [from, to] : null
+
+}
+
+// BrowserAnimation
+
+var BrowserAnimation = prime({
+
+ inherits: fx,
+
+ constructor: function BrowserAnimation(node, property){
+
+ var _getter = getter(property),
+ _setter = setter(property)
+
+ this.get = function(){
+ return _getter.call(node)
+ }
+
+ this.set = function(value){
+ return _setter.call(node, value)
+ }
+
+ BrowserAnimation.parent.constructor.call(this, this.set)
+
+ this.node = node
+ this.property = property
+
+ }
+
+})
+
+var JSAnimation
+
+/*(css3)?*/
+
+JSAnimation = prime({
+
+ inherits: BrowserAnimation,
+
+ constructor: function JSAnimation(){
+ return JSAnimation.parent.constructor.apply(this, arguments)
+ },
+
+ start: function(to){
+
+ this.stop()
+
+ if (this.duration === 0){
+ this.cancel(to)
+ return this
+ }
+
+ var fromTo = prepare(this.node, this.property, to)
+
+ if (!fromTo){
+ this.cancel(to)
+ return this
+ }
+
+ JSAnimation.parent.start.apply(this, fromTo)
+
+ if (!this.cancelStep) return this
+
+ // the animation would have started but we need additional checks
+
+ var parser = parsers[this.property] || parse
+
+ // complex interpolations JSAnimation can't handle
+ // even CSS3 animation gracefully fail with some of those edge cases
+ // other "simple" properties, such as `border` can have different templates
+ // because of string properties like "solid" and "dashed"
+
+ if ((parser === parseBoxShadow || parser === parseTextShadow || parser === parse) &&
+ (this.templateFrom !== this.templateTo)){
+ this.cancelStep()
+ delete this.cancelStep
+ this.cancel(to)
+ }
+
+ return this
+ },
+
+ parseEquation: function(equation){
+ if (typeof equation === "string") return JSAnimation.parent.parseEquation.call(this, equation)
+ }
+
+
+})/*:*/
+
+// CSSAnimation
+
+var remove3 = function(value, a, b, c){
+ var index = indexOf(a, value)
+ if (index !== -1){
+ a.splice(index, 1)
+ b.splice(index, 1)
+ c.splice(index, 1)
+ }
+}
+
+var CSSAnimation = prime({
+
+ inherits: BrowserAnimation,
+
+ constructor: function CSSAnimation(node, property){
+ CSSAnimation.parent.constructor.call(this, node, property)
+
+ this.hproperty = hyphenate(aliases[property] || property)
+
+ var self = this
+
+ this.bSetTransitionCSS = function(time){
+ self.setTransitionCSS(time)
+ }
+
+ this.bSetStyleCSS = function(time){
+ self.setStyleCSS(time)
+ }
+
+ this.bComplete = function(){
+ self.complete()
+ }
+ },
+
+ start: function(to){
+
+ this.stop()
+
+ if (this.duration === 0){
+ this.cancel(to)
+ return this
+ }
+
+ var fromTo = prepare(this.node, this.property, to)
+
+ if (!fromTo){
+ this.cancel(to)
+ return this
+ }
+
+ this.to = fromTo[1]
+ // setting transition styles immediately will make good browsers behave weirdly
+ // because DOM changes are always deferred, so we requestFrame
+ this.cancelSetTransitionCSS = requestFrame(this.bSetTransitionCSS)
+
+ return this
+ },
+
+ setTransitionCSS: function(time){
+ delete this.cancelSetTransitionCSS
+ this.resetCSS(true)
+ // firefox flickers if we set css for transition as well as styles at the same time
+ // so, other than deferring transition styles we defer actual styles as well on a requestFrame
+ this.cancelSetStyleCSS = requestFrame(this.bSetStyleCSS)
+ },
+
+ setStyleCSS: function(time){
+ delete this.cancelSetStyleCSS
+ var duration = this.duration
+ // we use setTimeout instead of transitionEnd because some browsers (looking at you foxy)
+ // incorrectly set event.propertyName, so we cannot check which animation we are canceling
+ this.cancelComplete = setTimeout(this.bComplete, duration)
+ this.endTime = time + duration
+ this.set(this.to)
+ },
+
+ complete: function(){
+ delete this.cancelComplete
+ this.resetCSS()
+ this.callback(this.endTime)
+ },
+
+ stop: function(hard){
+ if (this.cancelExit){
+ this.cancelExit()
+ delete this.cancelExit
+ } else if (this.cancelSetTransitionCSS){
+ // if cancelSetTransitionCSS is set, means nothing is set yet
+ this.cancelSetTransitionCSS() //so we cancel and we're good
+ delete this.cancelSetTransitionCSS
+ } else if (this.cancelSetStyleCSS){
+ // if cancelSetStyleCSS is set, means transition css has been set, but no actual styles.
+ this.cancelSetStyleCSS()
+ delete this.cancelSetStyleCSS
+ // if its a hard stop (and not another start on top of the current animation)
+ // we need to reset the transition CSS
+ if (hard) this.resetCSS()
+ } else if (this.cancelComplete){
+ // if cancelComplete is set, means style and transition css have been set, not yet completed.
+ clearTimeout(this.cancelComplete)
+ delete this.cancelComplete
+ // if its a hard stop (and not another start on top of the current animation)
+ // we need to reset the transition CSS set the current animation styles
+ if (hard){
+ this.resetCSS()
+ this.set(this.get())
+ }
+ }
+ return this
+ },
+
+ resetCSS: function(inclusive){
+ var rules = compute(this.node),
+ properties = (rules(transitionName + "Property").replace(/\s+/g, "") || "all").split(","),
+ durations = (rules(transitionName + "Duration").replace(/\s+/g, "") || "0s").split(","),
+ equations = (rules(transitionName + "TimingFunction").replace(/\s+/g, "") || "ease").match(/cubic-bezier\([\d-.,]+\)|([a-z-]+)/g)
+
+ remove3("all", properties, durations, equations)
+ remove3(this.hproperty, properties, durations, equations)
+
+ if (inclusive){
+ properties.push(this.hproperty)
+ durations.push(this.duration + "ms")
+ equations.push("cubic-bezier(" + this.equation + ")")
+ }
+
+ var nodeStyle = this.node.style
+
+ nodeStyle[transitionName + "Property"] = properties
+ nodeStyle[transitionName + "Duration"] = durations
+ nodeStyle[transitionName + "TimingFunction"] = equations
+ },
+
+ parseEquation: function(equation){
+ if (typeof equation === "string") return CSSAnimation.parent.parseEquation.call(this, equation, true)
+ }
+
+})
+
+// elements methods
+
+var BaseAnimation = transitionName ? CSSAnimation : JSAnimation
+
+var moofx = function(x, y){
+ return (typeof x === "function") ? fx(x) : elements(x, y)
+}
+
+elements.implement({
+
+ // {properties}, options or
+ // property, value options
+ animate: function(A, B, C){
+
+ var styles = A, options = B
+
+ if (typeof A === "string"){
+ styles = {}
+ styles[A] = B
+ options = C
+ }
+
+ if (options == null) options = {}
+
+ var type = typeof options
+
+ options = type === "function" ? {
+ callback: options
+ } : (type === "string" || type === "number") ? {
+ duration: options
+ } : options
+
+ var callback = options.callback || function(){},
+ completed = 0,
+ length = 0
+
+ options.callback = function(t){
+ if (++completed === length) callback(t)
+ }
+
+ for (var property in styles){
+
+ var value = styles[property],
+ property = camelize(property)
+
+ this.forEach(function(node){
+ length++
+ var self = elements(node), anims = self._animations || (self._animations = {})
+ var anim = anims[property] || (anims[property] = new BaseAnimation(node, property))
+ anim.setOptions(options).start(value)
+ })
+ }
+
+ return this
+
+ },
+
+ // {properties} or
+ // property, value
+ style: function(A, B){
+
+ var styles = A
+
+ if (typeof A === "string"){
+ styles = {}
+ styles[A] = B
+ }
+
+ for (var property in styles){
+ var value = styles[property],
+ set = setter(property = camelize(property))
+
+ this.forEach(function(node){
+ var self = elements(node), anims = self._animations, anim
+ if (anims && (anim = anims[property])) anim.stop(true)
+ set.call(node, value)
+ })
+ }
+
+ return this
+
+ },
+
+ compute: function(property){
+
+ property = camelize(property)
+ var node = this[0]
+
+ // return default matrix for transform, instead of parsed (for consistency)
+
+ if (property === "transform" && parseTransform2d) return compute(node)(transformName)
+
+ var value = getter(property).call(node)
+
+ // unit conversion to `px`
+
+ return (value != null) ? value.replace(rgLength, function(match, value, unit){
+ return (unit === "px") ? match : pixelRatio(node, unit) * value + "px"
+ }) : ''
+
+ }
+
+})
+
+moofx.parse = function(property, value, normalize){
+ return (parsers[camelize(property)] || parse)(value, normalize)
+}
+
+module.exports = moofx
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"./color":140,"./frame":141,"./fx":142,"./unmatrix2d":143,"elements":144,"prime":151,"prime/array/forEach":147,"prime/array/indexOf":148,"prime/array/map":149,"prime/string/camelize":158,"prime/string/capitalize":159,"prime/string/clean":160,"prime/string/hyphenate":161}],140:[function(require,module,exports){
+/*
+color
+*/"use strict"
+
+var colors = {
+ maroon : "#800000",
+ red : "#ff0000",
+ orange : "#ffA500",
+ yellow : "#ffff00",
+ olive : "#808000",
+ purple : "#800080",
+ fuchsia : "#ff00ff",
+ white : "#ffffff",
+ lime : "#00ff00",
+ green : "#008000",
+ navy : "#000080",
+ blue : "#0000ff",
+ aqua : "#00ffff",
+ teal : "#008080",
+ black : "#000000",
+ silver : "#c0c0c0",
+ gray : "#808080",
+ transparent : "#0000"
+}
+
+var RGBtoRGB = function(r, g, b, a){
+ if (a == null || a === "") a = 1
+ r = parseFloat(r)
+ g = parseFloat(g)
+ b = parseFloat(b)
+ a = parseFloat(a)
+ if (!(r <= 255 && r >= 0 && g <= 255 && g >= 0 && b <= 255 && b >= 0 && a <= 1 && a >= 0)) return null
+
+ return [Math.round(r), Math.round(g), Math.round(b), a]
+}
+
+var HEXtoRGB = function(hex){
+ if (hex.length === 3) hex += "f"
+ if (hex.length === 4){
+ var h0 = hex.charAt(0),
+ h1 = hex.charAt(1),
+ h2 = hex.charAt(2),
+ h3 = hex.charAt(3)
+
+ hex = h0 + h0 + h1 + h1 + h2 + h2 + h3 + h3
+ }
+ if (hex.length === 6) hex += "ff"
+ var rgb = []
+ for (var i = 0, l = hex.length; i < l; i += 2) rgb.push(parseInt(hex.substr(i, 2), 16) / (i === 6 ? 255 : 1))
+ return rgb
+}
+
+// HSL to RGB conversion from:
+// http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
+// thank you!
+
+var HUEtoRGB = function(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
+}
+
+var HSLtoRGB = function(h, s, l, a){
+ var r, b, g
+ if (a == null || a === "") a = 1
+ h = parseFloat(h) / 360
+ s = parseFloat(s) / 100
+ l = parseFloat(l) / 100
+ a = parseFloat(a) / 1
+ if (h > 1 || h < 0 || s > 1 || s < 0 || l > 1 || l < 0 || a > 1 || a < 0) return null
+ if (s === 0){
+ r = b = g = l
+ } else {
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s
+ var p = 2 * l - q
+ r = HUEtoRGB(p, q, h + 1 / 3)
+ g = HUEtoRGB(p, q, h)
+ b = HUEtoRGB(p, q, h - 1 / 3)
+ }
+ return [r * 255, g * 255, b * 255, a]
+}
+
+var keys = []
+for (var c in colors) keys.push(c)
+
+var shex = "(?:#([a-f0-9]{3,8}))",
+ sval = "\\s*([.\\d%]+)\\s*",
+ sop = "(?:,\\s*([.\\d]+)\\s*)?",
+ slist = "\\(" + [sval, sval, sval] + sop + "\\)",
+ srgb = "(?:rgb)a?",
+ shsl = "(?:hsl)a?",
+ skeys = "(" + keys.join("|") + ")"
+
+
+var xhex = RegExp(shex, "i"),
+ xrgb = RegExp(srgb + slist, "i"),
+ xhsl = RegExp(shsl + slist, "i")
+
+var color = function(input, array){
+ if (input == null) return null
+ input = (input + "").replace(/\s+/, "")
+
+ var match = colors[input]
+ if (match){
+ return color(match, array)
+ } else if (match = input.match(xhex)){
+ input = HEXtoRGB(match[1])
+ } else if (match = input.match(xrgb)){
+ input = match.slice(1)
+ } else if (match = input.match(xhsl)){
+ input = HSLtoRGB.apply(null, match.slice(1))
+ } else return null
+
+ if (!(input && (input = RGBtoRGB.apply(null, input)))) return null
+ if (array) return input
+ if (input[3] === 1) input.splice(3, 1)
+ return "rgb" + (input.length === 4 ? "a" : "") + "(" + input + ")"
+}
+
+color.x = RegExp([skeys, shex, srgb + slist, shsl + slist].join("|"), "gi")
+
+module.exports = color
+
+},{}],141:[function(require,module,exports){
+(function (global){(function (){
+/*
+requestFrame / cancelFrame
+*/"use strict"
+
+var indexOf = require("prime/array/indexOf")
+
+var requestFrame = global.requestAnimationFrame ||
+ global.webkitRequestAnimationFrame ||
+ global.mozRequestAnimationFrame ||
+ global.oRequestAnimationFrame ||
+ global.msRequestAnimationFrame ||
+ function(callback){
+ return setTimeout(function(){
+ callback()
+ }, 1e3 / 60)
+ }
+
+var callbacks = []
+
+var iterator = function(time){
+ var split = callbacks.splice(0, callbacks.length)
+ for (var i = 0, l = split.length; i < l; i++) split[i](time || (time = +(new Date)))
+}
+
+var cancel = function(callback){
+ var io = indexOf(callbacks, callback)
+ if (io > -1) callbacks.splice(io, 1)
+}
+
+var request = function(callback){
+ var i = callbacks.push(callback)
+ if (i === 1) requestFrame(iterator)
+ return function(){
+ cancel(callback)
+ }
+}
+
+exports.request = request
+exports.cancel = cancel
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"prime/array/indexOf":148}],142:[function(require,module,exports){
+/*
+fx
+*/"use strict"
+
+var prime = require("prime"),
+ requestFrame = require("./frame").request,
+ bezier = require("cubic-bezier")
+
+var map = require("prime/array/map")
+
+var sDuration = "([\\d.]+)(s|ms)?",
+ sCubicBezier = "cubic-bezier\\(([-.\\d]+),([-.\\d]+),([-.\\d]+),([-.\\d]+)\\)"
+
+var rDuration = RegExp(sDuration),
+ rCubicBezier = RegExp(sCubicBezier),
+ rgCubicBezier = RegExp(sCubicBezier, "g")
+
+ // equations collection
+
+var equations = {
+ "default" : "cubic-bezier(0.25, 0.1, 0.25, 1.0)",
+ "linear" : "cubic-bezier(0, 0, 1, 1)",
+ "ease-in" : "cubic-bezier(0.42, 0, 1.0, 1.0)",
+ "ease-out" : "cubic-bezier(0, 0, 0.58, 1.0)",
+ "ease-in-out" : "cubic-bezier(0.42, 0, 0.58, 1.0)"
+}
+
+equations.ease = equations["default"]
+
+var compute = function(from, to, delta){
+ return (to - from) * delta + from
+}
+
+var divide = function(string){
+ var numbers = []
+ var template = (string + "").replace(/[-.\d]+/g, function(number){
+ numbers.push(+number)
+ return "@"
+ })
+ return [numbers, template]
+}
+
+var Fx = prime({
+
+ constructor: function Fx(render, options){
+
+ // set options
+
+ this.setOptions(options)
+
+ // renderer
+
+ this.render = render || function(){}
+
+ // bound functions
+
+ var self = this
+
+ this.bStep = function(t){
+ return self.step(t)
+ }
+
+ this.bExit = function(time){
+ self.exit(time)
+ }
+
+ },
+
+ setOptions: function(options){
+ if (options == null) options = {}
+
+ if (!(this.duration = this.parseDuration(options.duration || "500ms"))) throw new Error("invalid duration")
+ if (!(this.equation = this.parseEquation(options.equation || "default"))) throw new Error("invalid equation")
+ this.callback = options.callback || function(){}
+
+ return this
+ },
+
+ parseDuration: function(duration){
+ if (duration = (duration + "").match(rDuration)){
+ var time = +duration[1],
+ unit = duration[2] || "ms"
+
+ if (unit === "s") return time * 1e3
+ if (unit === "ms") return time
+ }
+ },
+
+ parseEquation: function(equation, array){
+ var type = typeof equation
+
+ if (type === "function"){ // function
+ return equation
+ } else if (type === "string"){ // cubic-bezier string
+ equation = equations[equation] || equation
+ var match = equation.replace(/\s+/g, "").match(rCubicBezier)
+ if (match){
+ equation = map(match.slice(1), function(v){return +v})
+ if (array) return equation
+ if (equation.toString() === "0,0,1,1") return function(x){return x}
+ type = "object"
+ }
+ }
+
+ if (type === "object"){ // array
+ return bezier(equation[0], equation[1], equation[2], equation[3], 1e3 / 60 / this.duration / 4)
+ }
+ },
+
+ cancel: function(to){
+ this.to = to
+ this.cancelExit = requestFrame(this.bExit)
+ },
+
+ exit: function(time){
+ this.render(this.to)
+ delete this.cancelExit
+ this.callback(time)
+ },
+
+ start: function(from, to){
+
+ this.stop()
+
+ if (this.duration === 0){
+ this.cancel(to)
+ return this
+ }
+
+ this.isArray = false
+ this.isNumber = false
+
+ var fromType = typeof from,
+ toType = typeof to
+
+ if (fromType === "object" && toType === "object"){
+ this.isArray = true
+ } else if (fromType === "number" && toType === "number"){
+ this.isNumber = true
+ }
+
+ var from_ = divide(from),
+ to_ = divide(to)
+
+ this.from = from_[0]
+ this.to = to_[0]
+ this.templateFrom = from_[1]
+ this.templateTo = to_[1]
+
+ if (this.from.length !== this.to.length || this.from.toString() === this.to.toString()){
+ this.cancel(to)
+ return this
+ }
+
+ delete this.time
+ this.length = this.from.length
+ this.cancelStep = requestFrame(this.bStep)
+
+ return this
+
+ },
+
+ stop: function(){
+
+ if (this.cancelExit){
+ this.cancelExit()
+ delete this.cancelExit
+ } else if (this.cancelStep){
+ this.cancelStep()
+ delete this.cancelStep
+ }
+
+ return this
+ },
+
+ step: function(now){
+
+ this.time || (this.time = now)
+
+ var factor = (now - this.time) / this.duration
+
+ if (factor > 1) factor = 1
+
+ var delta = this.equation(factor),
+ from = this.from,
+ to = this.to,
+ tpl = this.templateTo
+
+ for (var i = 0, l = this.length; i < l; i++){
+ var f = from[i], t = to[i]
+ tpl = tpl.replace("@", t !== f ? compute(f, t, delta) : t)
+ }
+
+ this.render(this.isArray ? tpl.split(",") : this.isNumber ? +tpl : tpl, factor)
+
+ if (factor !== 1){
+ this.cancelStep = requestFrame(this.bStep)
+ } else {
+ delete this.cancelStep
+ this.callback(now)
+ }
+
+ }
+
+})
+
+var fx = function(render){
+
+ var ffx = new Fx(render)
+
+ return {
+
+ start: function(from, to, options){
+ var type = typeof options
+ ffx.setOptions((type === "function") ? {
+ callback: options
+ } : (type === "string" || type === "number") ? {
+ duration: options
+ } : options).start(from, to)
+ return this
+ },
+
+ stop: function(){
+ ffx.stop()
+ return this
+ }
+
+ }
+
+}
+
+fx.prototype = Fx.prototype
+
+module.exports = fx
+
+},{"./frame":141,"cubic-bezier":105,"prime":151,"prime/array/map":149}],143:[function(require,module,exports){
+/*
+Unmatrix 2d
+ - a crude implementation of the slightly bugged pseudo code in http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition
+*/"use strict"
+
+// returns the length of the passed vector
+
+var length = function(a){
+ return Math.sqrt(a[0] * a[0] + a[1] * a[1])
+}
+
+// normalizes the length of the passed point to 1
+
+var normalize = function(a){
+ var l = length(a)
+ return l ? [a[0] / l, a[1] / l] : [0, 0]
+}
+
+// returns the dot product of the passed points
+
+var dot = function(a, b){
+ return a[0] * b[0] + a[1] * b[1]
+}
+
+// returns the principal value of the arc tangent of
+// y/x, using the signs of both arguments to determine
+// the quadrant of the return value
+
+var atan2 = Math.atan2
+
+var combine = function(a, b, ascl, bscl){
+ return [
+ (ascl * a[0]) + (bscl * b[0]),
+ (ascl * a[1]) + (bscl * b[1])
+ ]
+}
+
+module.exports = function(a, b, c, d, tx, ty){
+
+ // Make sure the matrix is invertible
+
+ if ((a * d - b * c) === 0) return false
+
+ // Take care of translation
+
+ var translate = [tx, ty]
+
+ // Put the components into a 2x2 matrix
+
+ var m = [[a, b], [c, d]]
+
+ // Compute X scale factor and normalize first row.
+
+ var scale = [length(m[0])]
+ m[0] = normalize(m[0])
+
+ // Compute shear factor and make 2nd row orthogonal to 1st.
+
+ var skew = dot(m[0], m[1])
+ m[1] = combine(m[1], m[0], 1, -skew)
+
+ // Now, compute Y scale and normalize 2nd row.
+
+ scale[1] = length(m[1])
+ // m[1] = normalize(m[1]) //
+ skew /= scale[1]
+
+ // Now, get the rotation out
+
+ var rotate = atan2(m[0][1], m[0][0])
+
+ return [translate, rotate, skew, scale]
+
+}
+
+},{}],144:[function(require,module,exports){
+(function (global){(function (){
+/*
+elements
+*/"use strict"
+
+var prime = require("prime"),
+ forEach = require("prime/array/forEach"),
+ map = require("prime/array/map"),
+ filter = require("prime/array/filter"),
+ every = require("prime/array/every"),
+ some = require("prime/array/some")
+
+// uniqueID
+
+var uniqueIndex = 0
+var uniqueID = function(n){
+ return (n === global) ? "global" : n.uniqueNumber || (n.uniqueNumber = "n:" + (uniqueIndex++).toString(36))
+}
+
+var instances = {}
+
+// elements prime
+
+var $ = prime({constructor: function $(n, context){
+
+ if (n == null) return (this && this.constructor === $) ? new elements : null
+
+ var self = n
+
+ if (n.constructor !== elements){
+
+ self = new elements
+
+ var uid
+
+ if (typeof n === "string"){
+ if (!self.search) return null
+ self[self.length++] = context || document
+ return self.search(n)
+ }
+
+ if (n.nodeType || n === global){
+
+ self[self.length++] = n
+
+ } else if (n.length){
+
+ // this could be an array, or any object with a length attribute,
+ // including another instance of elements from another interface.
+
+ var uniques = {}
+
+ for (var i = 0, l = n.length; i < l; i++){ // perform elements flattening
+ var nodes = $(n[i], context)
+ if (nodes && nodes.length) for (var j = 0, k = nodes.length; j < k; j++){
+ var node = nodes[j]
+ uid = uniqueID(node)
+ if (!uniques[uid]){
+ self[self.length++] = node
+ uniques[uid] = true
+ }
+ }
+ }
+
+ }
+
+ }
+
+ if (!self.length) return null
+
+ // when length is 1 always use the same elements instance
+
+ if (self.length === 1){
+ uid = uniqueID(self[0])
+ return instances[uid] || (instances[uid] = self)
+ }
+
+ return self
+
+}})
+
+var elements = prime({
+
+ inherits: $,
+
+ constructor: function elements(){
+ this.length = 0
+ },
+
+ unlink: function(){
+ return this.map(function(node, i){
+ delete instances[uniqueID(node)]
+ return node
+ })
+ },
+
+ // straight es5 prototypes (or emulated methods)
+
+ forEach: function(method, context){
+ return forEach(this, method, context);
+ },
+
+ map: function(method, context){
+ return map(this, method, context);
+ },
+
+ filter: function(method, context){
+ return filter(this, method, context);
+ },
+
+ every: function(method, context){
+ return every(this, method, context);
+ },
+
+ some: function(method, context){
+ return some(this, method, context);
+ }
+
+})
+
+module.exports = $
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"prime":151,"prime/array/every":145,"prime/array/filter":146,"prime/array/forEach":147,"prime/array/map":149,"prime/array/some":150}],145:[function(require,module,exports){
+/*
+array:every
+*/"use strict"
+
+var every = function(self, method, context){
+ for (var i = 0, l = self.length >>> 0; i < l; i++){
+ if (!method.call(context, self[i], i, self)) return false
+ }
+ return true
+}
+
+module.exports = every
+
+},{}],146:[function(require,module,exports){
+/*
+array:filter
+*/"use strict"
+
+var filter = function(self, method, context){
+ var results = []
+ for (var i = 0, l = self.length >>> 0; i < l; i++) {
+ var value = self[i]
+ if (method.call(context, value, i, self)) results.push(value)
+ }
+ return results
+}
+
+module.exports = filter
+
+},{}],147:[function(require,module,exports){
+/*
+array:forEach
+*/"use strict"
+
+var forEach = function(self, method, context){
+ for (var i = 0, l = self.length >>> 0; i < l; i++){
+ if (method.call(context, self[i], i, self) === false) break
+ }
+ return self
+}
+
+module.exports = forEach
+
+},{}],148:[function(require,module,exports){
+/*
+array:indexOf
+*/"use strict"
+
+var indexOf = function(self, item, from){
+ for (var l = self.length >>> 0, i = (from < 0) ? Math.max(0, l + from) : from || 0; i < l; i++){
+ if (self[i] === item) return i
+ }
+ return -1
+}
+
+module.exports = indexOf
+
+},{}],149:[function(require,module,exports){
+/*
+array:map
+*/"use strict"
+
+var map = function(self, method, context){
+ var length = self.length >>> 0, results = Array(length)
+ for (var i = 0, l = length; i < l; i++){
+ results[i] = method.call(context, self[i], i, self)
+ }
+ return results
+}
+
+module.exports = map
+
+},{}],150:[function(require,module,exports){
+/*
+array:some
+*/"use strict"
+
+var some = function(self, method, context){
+ for (var i = 0, l = self.length >>> 0; i < l; i++){
+ if (method.call(context, self[i], i, self)) return true
+ }
+ return false
+}
+
+module.exports = some
+
+},{}],151:[function(require,module,exports){
+/*
+prime
+ - prototypal inheritance
+*/"use strict"
+
+var hasOwn = require("./object/hasOwn"),
+ forIn = require("./object/forIn"),
+ mixIn = require("./object/mixIn"),
+ filter = require("./object/filter"),
+ create = require("./object/create"),
+ type = require("./type")
+
+var defineProperty = Object.defineProperty,
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor
+
+try {
+ defineProperty({}, "~", {})
+ getOwnPropertyDescriptor({}, "~")
+} catch (e){
+ defineProperty = null
+ getOwnPropertyDescriptor = null
+}
+
+var define = function(value, key, from){
+ defineProperty(this, key, getOwnPropertyDescriptor(from, key) || {
+ writable: true,
+ enumerable: true,
+ configurable: true,
+ value: value
+ })
+}
+
+var copy = function(value, key){
+ this[key] = value
+}
+
+var implement = function(proto){
+ forIn(proto, defineProperty ? define : copy, this.prototype)
+ return this
+}
+
+var verbs = /^constructor|inherits|mixin$/
+
+var prime = function(proto){
+
+ if (type(proto) === "function") proto = {constructor: proto}
+
+ var superprime = proto.inherits
+
+ // if our nice proto object has no own constructor property
+ // then we proceed using a ghosting constructor that all it does is
+ // call the parent's constructor if it has a superprime, else an empty constructor
+ // proto.constructor becomes the effective constructor
+ var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){
+ return superprime.apply(this, arguments)
+ } : function(){}
+
+ if (superprime){
+
+ mixIn(constructor, superprime)
+
+ var superproto = superprime.prototype
+ // inherit from superprime
+ var cproto = constructor.prototype = create(superproto)
+
+ // setting constructor.parent to superprime.prototype
+ // because it's the shortest possible absolute reference
+ constructor.parent = superproto
+ cproto.constructor = constructor
+ }
+
+ if (!constructor.implement) constructor.implement = implement
+
+ var mixins = proto.mixin
+ if (mixins){
+ if (type(mixins) !== "array") mixins = [mixins]
+ for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype))
+ }
+
+ // implement proto and return constructor
+ return constructor.implement(filter(proto, function(value, key){
+ return !key.match(verbs)
+ }))
+
+}
+
+module.exports = prime
+
+},{"./object/create":152,"./object/filter":153,"./object/forIn":154,"./object/hasOwn":156,"./object/mixIn":157,"./type":163}],152:[function(require,module,exports){
+/*
+object:create
+*/"use strict"
+
+var create = function(self){
+ var constructor = function(){}
+ constructor.prototype = self
+ return new constructor
+}
+
+module.exports = create
+
+},{}],153:[function(require,module,exports){
+/*
+object:filter
+*/"use strict"
+
+var forIn = require("./forIn")
+
+var filter = function(self, method, context){
+ var results = {}
+ forIn(self, function(value, key){
+ if (method.call(context, value, key, self)) results[key] = value
+ })
+ return results
+}
+
+module.exports = filter
+
+},{"./forIn":154}],154:[function(require,module,exports){
+/*
+object:forIn
+*/"use strict"
+
+var has = require("./hasOwn")
+
+var forIn = function(self, method, context){
+ for (var key in self) if (method.call(context, self[key], key, self) === false) break
+ return self
+}
+
+if (!({valueOf: 0}).propertyIsEnumerable("valueOf")){ // fix for stupid IE enumeration bug
+
+ var buggy = "constructor,toString,valueOf,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString".split(",")
+ var proto = Object.prototype
+
+ forIn = function(self, method, context){
+ for (var key in self) if (method.call(context, self[key], key, self) === false) return self
+ for (var i = 0; key = buggy[i]; i++){
+ var value = self[key]
+ if ((value !== proto[key] || has(self, key)) && method.call(context, value, key, self) === false) break
+ }
+ return self
+ }
+
+}
+
+module.exports = forIn
+
+},{"./hasOwn":156}],155:[function(require,module,exports){
+/*
+object:forOwn
+*/"use strict"
+
+var forIn = require("./forIn"),
+ hasOwn = require("./hasOwn")
+
+var forOwn = function(self, method, context){
+ forIn(self, function(value, key){
+ if (hasOwn(self, key)) return method.call(context, value, key, self)
+ })
+ return self
+}
+
+module.exports = forOwn
+
+},{"./forIn":154,"./hasOwn":156}],156:[function(require,module,exports){
+/*
+object:hasOwn
+*/"use strict"
+
+var hasOwnProperty = Object.hasOwnProperty
+
+var hasOwn = function(self, key){
+ return hasOwnProperty.call(self, key)
+}
+
+module.exports = hasOwn
+
+},{}],157:[function(require,module,exports){
+/*
+object:mixIn
+*/"use strict"
+
+var forOwn = require("./forOwn")
+
+var copy = function(value, key){
+ this[key] = value
+}
+
+var mixIn = function(self){
+ for (var i = 1, l = arguments.length; i < l; i++) forOwn(arguments[i], copy, self)
+ return self
+}
+
+module.exports = mixIn
+
+},{"./forOwn":155}],158:[function(require,module,exports){
+/*
+string:camelize
+*/"use strict"
+
+var camelize = function(self){
+ return (self + "").replace(/-\D/g, function(match){
+ return match.charAt(1).toUpperCase()
+ })
+}
+
+module.exports = camelize
+
+},{}],159:[function(require,module,exports){
+/*
+string:capitalize
+*/"use strict"
+
+var capitalize = function(self){
+ return (self + "").replace(/\b[a-z]/g, function(match){
+ return match.toUpperCase()
+ })
+}
+
+module.exports = capitalize
+
+},{}],160:[function(require,module,exports){
+/*
+string:clean
+*/"use strict"
+
+var trim = require("./trim")
+
+var clean = function(self){
+ return trim((self + "").replace(/\s+/g, " "))
+}
+
+module.exports = clean
+
+},{"./trim":162}],161:[function(require,module,exports){
+/*
+string:hyphenate
+*/"use strict"
+
+var hyphenate = function(self){
+ return (self + "").replace(/[A-Z]/g, function(match){
+ return '-' + match.toLowerCase()
+ })
+}
+
+module.exports = hyphenate
+
+},{}],162:[function(require,module,exports){
+/*
+string:trim
+*/"use strict"
+
+var trim = function(self){
+ return (self + "").replace(/^\s+|\s+$/g, "")
+}
+
+module.exports = trim
+
+},{}],163:[function(require,module,exports){
+/*
+type
+*/"use strict"
+
+var toString = Object.prototype.toString,
+ types = /number|object|array|string|function|date|regexp|boolean/
+
+var type = function(object){
+ if (object == null) return "null"
+ var string = toString.call(object).slice(8, -1).toLowerCase()
+ if (string === "number" && isNaN(object)) return "null"
+ if (types.test(string)) return string
+ return "object"
+}
+
+module.exports = type
+
+},{}],164:[function(require,module,exports){
+
+
+ /**
+ * Appends an array to the end of another.
+ * The first array will be modified.
+ */
+ function append(arr1, arr2) {
+ if (arr2 == null) {
+ return arr1;
+ }
+
+ var pad = arr1.length,
+ i = -1,
+ len = arr2.length;
+ while (++i < len) {
+ arr1[pad + i] = arr2[i];
+ }
+ return arr1;
+ }
+ module.exports = append;
+
+
+},{}],165:[function(require,module,exports){
+var indexOf = require('./indexOf');
+
+ /**
+ * Combines an array with all the items of another.
+ * Does not allow duplicates and is case and type sensitive.
+ */
+ function combine(arr1, arr2) {
+ if (arr2 == null) {
+ return arr1;
+ }
+
+ var i = -1, len = arr2.length;
+ while (++i < len) {
+ if (indexOf(arr1, arr2[i]) === -1) {
+ arr1.push(arr2[i]);
+ }
+ }
+
+ return arr1;
+ }
+ module.exports = combine;
+
+
+},{"./indexOf":175}],166:[function(require,module,exports){
+var indexOf = require('./indexOf');
+
+ /**
+ * If array contains values.
+ */
+ function contains(arr, val) {
+ return indexOf(arr, val) !== -1;
+ }
+ module.exports = contains;
+
+
+},{"./indexOf":175}],167:[function(require,module,exports){
+var unique = require('./unique');
+var filter = require('./filter');
+var some = require('./some');
+var contains = require('./contains');
+var slice = require('./slice');
+
+
+ /**
+ * Return a new Array with elements that aren't present in the other Arrays.
+ */
+ function difference(arr) {
+ var arrs = slice(arguments, 1),
+ result = filter(unique(arr), function(needle){
+ return !some(arrs, function(haystack){
+ return contains(haystack, needle);
+ });
+ });
+ return result;
+ }
+
+ module.exports = difference;
+
+
+
+},{"./contains":166,"./filter":170,"./slice":183,"./some":184,"./unique":186}],168:[function(require,module,exports){
+var is = require('../lang/is');
+var isArray = require('../lang/isArray');
+var every = require('./every');
+
+ /**
+ * Compares if both arrays have the same elements
+ */
+ function equals(a, b, callback){
+ callback = callback || is;
+
+ if (!isArray(a) || !isArray(b)) {
+ return callback(a, b);
+ }
+
+ if (a.length !== b.length) {
+ return false;
+ }
+
+ return every(a, makeCompare(callback), b);
+ }
+
+ function makeCompare(callback) {
+ return function(value, i) {
+ return i in this && callback(value, this[i]);
+ };
+ }
+
+ module.exports = equals;
+
+
+
+},{"../lang/is":202,"../lang/isArray":203,"./every":169}],169:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array every
+ */
+ function every(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = true;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (!callback(arr[i], i, arr) ) {
+ result = false;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = every;
+
+
+},{"../function/makeIterator_":195}],170:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array filter
+ */
+ function filter(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null) {
+ return results;
+ }
+
+ var i = -1, len = arr.length, value;
+ while (++i < len) {
+ value = arr[i];
+ if (callback(value, i, arr)) {
+ results.push(value);
+ }
+ }
+
+ return results;
+ }
+
+ module.exports = filter;
+
+
+
+},{"../function/makeIterator_":195}],171:[function(require,module,exports){
+var findIndex = require('./findIndex');
+
+ /**
+ * Returns first item that matches criteria
+ */
+ function find(arr, iterator, thisObj){
+ var idx = findIndex(arr, iterator, thisObj);
+ return idx >= 0? arr[idx] : void(0);
+ }
+
+ module.exports = find;
+
+
+
+},{"./findIndex":172}],172:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Returns the index of the first item that matches criteria
+ */
+ function findIndex(arr, iterator, thisObj){
+ iterator = makeIterator(iterator, thisObj);
+ if (arr == null) {
+ return -1;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ if (iterator(arr[i], i, arr)) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ module.exports = findIndex;
+
+
+},{"../function/makeIterator_":195}],173:[function(require,module,exports){
+var isArray = require('../lang/isArray');
+var append = require('./append');
+
+ /*
+ * Helper function to flatten to a destination array.
+ * Used to remove the need to create intermediate arrays while flattening.
+ */
+ function flattenTo(arr, result, level) {
+ if (level === 0) {
+ append(result, arr);
+ return result;
+ }
+
+ var value,
+ i = -1,
+ len = arr.length;
+ while (++i < len) {
+ value = arr[i];
+ if (isArray(value)) {
+ flattenTo(value, result, level - 1);
+ } else {
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Recursively flattens an array.
+ * A new array containing all the elements is returned.
+ * If level is specified, it will only flatten up to that level.
+ */
+ function flatten(arr, level) {
+ if (arr == null) {
+ return [];
+ }
+
+ level = level == null ? -1 : level;
+ return flattenTo(arr, [], level);
+ }
+
+ module.exports = flatten;
+
+
+
+
+},{"../lang/isArray":203,"./append":164}],174:[function(require,module,exports){
+
+
+ /**
+ * Array forEach
+ */
+ function forEach(arr, callback, thisObj) {
+ if (arr == null) {
+ return;
+ }
+ var i = -1,
+ len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback.call(thisObj, arr[i], i, arr) === false ) {
+ break;
+ }
+ }
+ }
+
+ module.exports = forEach;
+
+
+
+},{}],175:[function(require,module,exports){
+
+
+ /**
+ * Array.indexOf
+ */
+ function indexOf(arr, item, fromIndex) {
+ fromIndex = fromIndex || 0;
+ if (arr == null) {
+ return -1;
+ }
+
+ var len = arr.length,
+ i = fromIndex < 0 ? len + fromIndex : fromIndex;
+ while (i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if (arr[i] === item) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ module.exports = indexOf;
+
+
+},{}],176:[function(require,module,exports){
+var difference = require('./difference');
+var slice = require('./slice');
+
+ /**
+ * Insert item into array if not already present.
+ */
+ function insert(arr, rest_items) {
+ var diff = difference(slice(arguments, 1), arr);
+ if (diff.length) {
+ Array.prototype.push.apply(arr, diff);
+ }
+ return arr.length;
+ }
+ module.exports = insert;
+
+
+},{"./difference":167,"./slice":183}],177:[function(require,module,exports){
+var unique = require('./unique');
+var filter = require('./filter');
+var every = require('./every');
+var contains = require('./contains');
+var slice = require('./slice');
+
+
+ /**
+ * Return a new Array with elements common to all Arrays.
+ * - based on underscore.js implementation
+ */
+ function intersection(arr) {
+ var arrs = slice(arguments, 1),
+ result = filter(unique(arr), function(needle){
+ return every(arrs, function(haystack){
+ return contains(haystack, needle);
+ });
+ });
+ return result;
+ }
+
+ module.exports = intersection;
+
+
+
+},{"./contains":166,"./every":169,"./filter":170,"./slice":183,"./unique":186}],178:[function(require,module,exports){
+var slice = require('./slice');
+
+ /**
+ * Call `methodName` on each item of the array passing custom arguments if
+ * needed.
+ */
+ function invoke(arr, methodName, var_args){
+ if (arr == null) {
+ return arr;
+ }
+
+ var args = slice(arguments, 2);
+ var i = -1, len = arr.length, value;
+ while (++i < len) {
+ value = arr[i];
+ value[methodName].apply(value, args);
+ }
+
+ return arr;
+ }
+
+ module.exports = invoke;
+
+
+},{"./slice":183}],179:[function(require,module,exports){
+
+
+ /**
+ * Returns last element of array.
+ */
+ function last(arr){
+ if (arr == null || arr.length < 1) {
+ return undefined;
+ }
+
+ return arr[arr.length - 1];
+ }
+
+ module.exports = last;
+
+
+
+},{}],180:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array map
+ */
+ function map(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var results = [];
+ if (arr == null){
+ return results;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ results[i] = callback(arr[i], i, arr);
+ }
+
+ return results;
+ }
+
+ module.exports = map;
+
+
+},{"../function/makeIterator_":195}],181:[function(require,module,exports){
+var indexOf = require('./indexOf');
+
+ /**
+ * Remove a single item from the array.
+ * (it won't remove duplicates, just a single item)
+ */
+ function remove(arr, item){
+ var idx = indexOf(arr, item);
+ if (idx !== -1) arr.splice(idx, 1);
+ }
+
+ module.exports = remove;
+
+
+},{"./indexOf":175}],182:[function(require,module,exports){
+var indexOf = require('./indexOf');
+
+ /**
+ * Remove all instances of an item from array.
+ */
+ function removeAll(arr, item){
+ var idx = indexOf(arr, item);
+ while (idx !== -1) {
+ arr.splice(idx, 1);
+ idx = indexOf(arr, item, idx);
+ }
+ }
+
+ module.exports = removeAll;
+
+
+},{"./indexOf":175}],183:[function(require,module,exports){
+
+
+ /**
+ * Create slice of source array or array-like object
+ */
+ function slice(arr, start, end){
+ var len = arr.length;
+
+ if (start == null) {
+ start = 0;
+ } else if (start < 0) {
+ start = Math.max(len + start, 0);
+ } else {
+ start = Math.min(start, len);
+ }
+
+ if (end == null) {
+ end = len;
+ } else if (end < 0) {
+ end = Math.max(len + end, 0);
+ } else {
+ end = Math.min(end, len);
+ }
+
+ var result = [];
+ while (start < end) {
+ result.push(arr[start++]);
+ }
+
+ return result;
+ }
+
+ module.exports = slice;
+
+
+
+},{}],184:[function(require,module,exports){
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Array some
+ */
+ function some(arr, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = false;
+ if (arr == null) {
+ return result;
+ }
+
+ var i = -1, len = arr.length;
+ while (++i < len) {
+ // we iterate over sparse items since there is no way to make it
+ // work properly on IE 7-8. see #64
+ if ( callback(arr[i], i, arr) ) {
+ result = true;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ module.exports = some;
+
+
+},{"../function/makeIterator_":195}],185:[function(require,module,exports){
+
+
+ /**
+ * Split array into a fixed number of segments.
+ */
+ function split(array, segments) {
+ segments = segments || 2;
+ var results = [];
+ if (array == null) {
+ return results;
+ }
+
+ var minLength = Math.floor(array.length / segments),
+ remainder = array.length % segments,
+ i = 0,
+ len = array.length,
+ segmentIndex = 0,
+ segmentLength;
+
+ while (i < len) {
+ segmentLength = minLength;
+ if (segmentIndex < remainder) {
+ segmentLength++;
+ }
+
+ results.push(array.slice(i, i + segmentLength));
+
+ segmentIndex++;
+ i += segmentLength;
+ }
+
+ return results;
+ }
+ module.exports = split;
+
+
+},{}],186:[function(require,module,exports){
+var filter = require('./filter');
+
+ /**
+ * @return {array} Array of unique items
+ */
+ function unique(arr, compare){
+ compare = compare || isEqual;
+ return filter(arr, function(item, i, arr){
+ var n = arr.length;
+ while (++i < n) {
+ if ( compare(item, arr[i]) ) {
+ return false;
+ }
+ }
+ return true;
+ });
+ }
+
+ function isEqual(a, b){
+ return a === b;
+ }
+
+ module.exports = unique;
+
+
+
+},{"./filter":170}],187:[function(require,module,exports){
+var make = require('./make_');
+var arrContains = require('../array/contains');
+var objContains = require('../object/contains');
+
+ /**
+ */
+ module.exports = make(arrContains, objContains);
+
+
+
+},{"../array/contains":166,"../object/contains":224,"./make_":190}],188:[function(require,module,exports){
+var make = require('./make_');
+var arrFind = require('../array/find');
+var objFind = require('../object/find');
+
+ /**
+ * Find value that returns true on iterator check.
+ */
+ module.exports = make(arrFind, objFind);
+
+
+
+},{"../array/find":171,"../object/find":230,"./make_":190}],189:[function(require,module,exports){
+var make = require('./make_');
+var arrForEach = require('../array/forEach');
+var objForEach = require('../object/forOwn');
+
+ /**
+ */
+ module.exports = make(arrForEach, objForEach);
+
+
+
+},{"../array/forEach":174,"../object/forOwn":232,"./make_":190}],190:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * internal method used to create other collection modules.
+ */
+ function makeCollectionMethod(arrMethod, objMethod, defaultReturn) {
+ return function(){
+ var args = slice(arguments);
+ if (args[0] == null) {
+ return defaultReturn;
+ }
+ // array-like is treated as array
+ return (typeof args[0].length === 'number')? arrMethod.apply(null, args) : objMethod.apply(null, args);
+ };
+ }
+
+ module.exports = makeCollectionMethod;
+
+
+
+},{"../array/slice":183}],191:[function(require,module,exports){
+var isArray = require('../lang/isArray');
+var objSize = require('../object/size');
+
+ /**
+ * Get collection size
+ */
+ function size(list) {
+ if (!list) {
+ return 0;
+ }
+ if (isArray(list)) {
+ return list.length;
+ }
+ return objSize(list);
+ }
+
+ module.exports = size;
+
+
+
+},{"../lang/isArray":203,"../object/size":242}],192:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection.
+ * @param {Function} fn Function.
+ * @param {object} context Execution context.
+ * @param {rest} args Arguments (0...n arguments).
+ * @return {Function} Wrapped Function.
+ */
+ function bind(fn, context, args){
+ var argsArr = slice(arguments, 2); //curried args
+ return function(){
+ return fn.apply(context, argsArr.concat(slice(arguments)));
+ };
+ }
+
+ module.exports = bind;
+
+
+
+},{"../array/slice":183}],193:[function(require,module,exports){
+
+
+ /**
+ * Debounce callback execution
+ */
+ function debounce(fn, threshold, isAsap){
+ var timeout, result;
+ function debounced(){
+ var args = arguments, context = this;
+ function delayed(){
+ if (! isAsap) {
+ result = fn.apply(context, args);
+ }
+ timeout = null;
+ }
+ if (timeout) {
+ clearTimeout(timeout);
+ } else if (isAsap) {
+ result = fn.apply(context, args);
+ }
+ timeout = setTimeout(delayed, threshold);
+ return result;
+ }
+ debounced.cancel = function(){
+ clearTimeout(timeout);
+ };
+ return debounced;
+ }
+
+ module.exports = debounce;
+
+
+
+},{}],194:[function(require,module,exports){
+
+
+ /**
+ * Returns the first argument provided to it.
+ */
+ function identity(val){
+ return val;
+ }
+
+ module.exports = identity;
+
+
+
+},{}],195:[function(require,module,exports){
+var identity = require('./identity');
+var prop = require('./prop');
+var deepMatches = require('../object/deepMatches');
+
+ /**
+ * Converts argument into a valid iterator.
+ * Used internally on most array/object/collection methods that receives a
+ * callback/iterator providing a shortcut syntax.
+ */
+ function makeIterator(src, thisObj){
+ if (src == null) {
+ return identity;
+ }
+ switch(typeof src) {
+ case 'function':
+ // function is the first to improve perf (most common case)
+ // also avoid using `Function#call` if not needed, which boosts
+ // perf a lot in some cases
+ return (typeof thisObj !== 'undefined')? function(val, i, arr){
+ return src.call(thisObj, val, i, arr);
+ } : src;
+ case 'object':
+ return function(val){
+ return deepMatches(val, src);
+ };
+ case 'string':
+ case 'number':
+ return prop(src);
+ }
+ }
+
+ module.exports = makeIterator;
+
+
+
+},{"../object/deepMatches":226,"./identity":194,"./prop":196}],196:[function(require,module,exports){
+
+
+ /**
+ * Returns a function that gets a property of the passed object
+ */
+ function prop(name){
+ return function(obj){
+ return obj[name];
+ };
+ }
+
+ module.exports = prop;
+
+
+
+},{}],197:[function(require,module,exports){
+
+
+ /**
+ * Returns a function that will execute a list of functions in sequence
+ * passing the same arguments to each one. (useful for batch processing
+ * items during a forEach loop)
+ */
+ function series(){
+ var fns = arguments;
+ return function(){
+ var i = 0,
+ n = fns.length;
+ while (i < n) {
+ fns[i].apply(this, arguments);
+ i += 1;
+ }
+ };
+ }
+
+ module.exports = series;
+
+
+
+},{}],198:[function(require,module,exports){
+
+
+ // Reference to the global context (works on ES3 and ES5-strict mode)
+ //jshint -W061, -W064
+ module.exports = Function('return this')();
+
+
+
+},{}],199:[function(require,module,exports){
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+var mixIn = require('../object/mixIn');
+
+ /**
+ * Clone native types.
+ */
+ function clone(val){
+ switch (kindOf(val)) {
+ case 'Object':
+ return cloneObject(val);
+ case 'Array':
+ return cloneArray(val);
+ case 'RegExp':
+ return cloneRegExp(val);
+ case 'Date':
+ return cloneDate(val);
+ default:
+ return val;
+ }
+ }
+
+ function cloneObject(source) {
+ if (isPlainObject(source)) {
+ return mixIn({}, source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneRegExp(r) {
+ var flags = '';
+ flags += r.multiline ? 'm' : '';
+ flags += r.global ? 'g' : '';
+ flags += r.ignoreCase ? 'i' : '';
+ return new RegExp(r.source, flags);
+ }
+
+ function cloneDate(date) {
+ return new Date(+date);
+ }
+
+ function cloneArray(arr) {
+ return arr.slice();
+ }
+
+ module.exports = clone;
+
+
+
+},{"../object/mixIn":238,"./isPlainObject":209,"./kindOf":212}],200:[function(require,module,exports){
+var clone = require('./clone');
+var forOwn = require('../object/forOwn');
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+
+ /**
+ * Recursively clone native types.
+ */
+ function deepClone(val, instanceClone) {
+ switch ( kindOf(val) ) {
+ case 'Object':
+ return cloneObject(val, instanceClone);
+ case 'Array':
+ return cloneArray(val, instanceClone);
+ default:
+ return clone(val);
+ }
+ }
+
+ function cloneObject(source, instanceClone) {
+ if (isPlainObject(source)) {
+ var out = {};
+ forOwn(source, function(val, key) {
+ this[key] = deepClone(val, instanceClone);
+ }, out);
+ return out;
+ } else if (instanceClone) {
+ return instanceClone(source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneArray(arr, instanceClone) {
+ var out = [],
+ i = -1,
+ n = arr.length,
+ val;
+ while (++i < n) {
+ out[i] = deepClone(arr[i], instanceClone);
+ }
+ return out;
+ }
+
+ module.exports = deepClone;
+
+
+
+
+},{"../object/forOwn":232,"./clone":199,"./isPlainObject":209,"./kindOf":212}],201:[function(require,module,exports){
+var is = require('./is');
+var isObject = require('./isObject');
+var isArray = require('./isArray');
+var objEquals = require('../object/equals');
+var arrEquals = require('../array/equals');
+
+ /**
+ * Recursively checks for same properties and values.
+ */
+ function deepEquals(a, b, callback){
+ callback = callback || is;
+
+ var bothObjects = isObject(a) && isObject(b);
+ var bothArrays = !bothObjects && isArray(a) && isArray(b);
+
+ if (!bothObjects && !bothArrays) {
+ return callback(a, b);
+ }
+
+ function compare(a, b){
+ return deepEquals(a, b, callback);
+ }
+
+ var method = bothObjects ? objEquals : arrEquals;
+ return method(a, b, compare);
+ }
+
+ module.exports = deepEquals;
+
+
+
+},{"../array/equals":168,"../object/equals":227,"./is":202,"./isArray":203,"./isObject":208}],202:[function(require,module,exports){
+
+
+ /**
+ * Check if both arguments are egal.
+ */
+ function is(x, y){
+ // implementation borrowed from harmony:egal spec
+ if (x === y) {
+ // 0 === -0, but they are not identical
+ return x !== 0 || 1 / x === 1 / y;
+ }
+
+ // NaN !== NaN, but they are identical.
+ // NaNs are the only non-reflexive value, i.e., if x !== x,
+ // then x is a NaN.
+ // isNaN is broken: it converts its argument to number, so
+ // isNaN("foo") => true
+ return x !== x && y !== y;
+ }
+
+ module.exports = is;
+
+
+
+},{}],203:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ var isArray = Array.isArray || function (val) {
+ return isKind(val, 'Array');
+ };
+ module.exports = isArray;
+
+
+},{"./isKind":206}],204:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isBoolean(val) {
+ return isKind(val, 'Boolean');
+ }
+ module.exports = isBoolean;
+
+
+},{"./isKind":206}],205:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isFunction(val) {
+ return isKind(val, 'Function');
+ }
+ module.exports = isFunction;
+
+
+},{"./isKind":206}],206:[function(require,module,exports){
+var kindOf = require('./kindOf');
+ /**
+ * Check if value is from a specific "kind".
+ */
+ function isKind(val, kind){
+ return kindOf(val) === kind;
+ }
+ module.exports = isKind;
+
+
+},{"./kindOf":212}],207:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isNumber(val) {
+ return isKind(val, 'Number');
+ }
+ module.exports = isNumber;
+
+
+},{"./isKind":206}],208:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isObject(val) {
+ return isKind(val, 'Object');
+ }
+ module.exports = isObject;
+
+
+},{"./isKind":206}],209:[function(require,module,exports){
+
+
+ /**
+ * Checks if the value is created by the `Object` constructor.
+ */
+ function isPlainObject(value) {
+ return (!!value && typeof value === 'object' &&
+ value.constructor === Object);
+ }
+
+ module.exports = isPlainObject;
+
+
+
+},{}],210:[function(require,module,exports){
+
+
+ /**
+ * Checks if the object is a primitive
+ */
+ function isPrimitive(value) {
+ // Using switch fallthrough because it's simple to read and is
+ // generally fast: http://jsperf.com/testing-value-is-primitive/5
+ switch (typeof value) {
+ case "string":
+ case "number":
+ case "boolean":
+ return true;
+ }
+
+ return value == null;
+ }
+
+ module.exports = isPrimitive;
+
+
+
+},{}],211:[function(require,module,exports){
+var isKind = require('./isKind');
+ /**
+ */
+ function isString(val) {
+ return isKind(val, 'String');
+ }
+ module.exports = isString;
+
+
+},{"./isKind":206}],212:[function(require,module,exports){
+
+ /**
+ * Gets the "kind" of value. (e.g. "String", "Number", etc)
+ */
+ function kindOf(val) {
+ return Object.prototype.toString.call(val).slice(8, -1);
+ }
+ module.exports = kindOf;
+
+
+},{}],213:[function(require,module,exports){
+var kindOf = require('./kindOf');
+var GLOBAL = require('./GLOBAL');
+
+ /**
+ * Convert array-like object into array
+ */
+ function toArray(val){
+ var ret = [],
+ kind = kindOf(val),
+ n;
+
+ if (val != null) {
+ if ( val.length == null || kind === 'String' || kind === 'Function' || kind === 'RegExp' || val === GLOBAL ) {
+ //string, regexp, function have .length but user probably just want
+ //to wrap value into an array..
+ ret[ret.length] = val;
+ } else {
+ //window returns true on isObject in IE7 and may have length
+ //property. `typeof NodeList` returns `function` on Safari so
+ //we can't use it (#58)
+ n = val.length;
+ while (n--) {
+ ret[n] = val[n];
+ }
+ }
+ }
+ return ret;
+ }
+ module.exports = toArray;
+
+
+},{"./GLOBAL":198,"./kindOf":212}],214:[function(require,module,exports){
+var isArray = require('./isArray');
+
+ /**
+ * covert value into number if numeric
+ */
+ function toNumber(val){
+ // numberic values should come first because of -0
+ if (typeof val === 'number') return val;
+ // we want all falsy values (besides -0) to return zero to avoid
+ // headaches
+ if (!val) return 0;
+ if (typeof val === 'string') return parseFloat(val);
+ // arrays are edge cases. `Number([4]) === 4`
+ if (isArray(val)) return NaN;
+ return Number(val);
+ }
+
+ module.exports = toNumber;
+
+
+
+},{"./isArray":203}],215:[function(require,module,exports){
+
+
+ /**
+ * Typecast a value to a String, using an empty string value for null or
+ * undefined.
+ */
+ function toString(val){
+ return val == null ? '' : val.toString();
+ }
+
+ module.exports = toString;
+
+
+
+},{}],216:[function(require,module,exports){
+
+ /**
+ * Clamps value inside range.
+ */
+ function clamp(val, min, max){
+ return val < min? min : (val > max? max : val);
+ }
+ module.exports = clamp;
+
+
+},{}],217:[function(require,module,exports){
+
+ /**
+ * Linear interpolation.
+ * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE
+ */
+ function lerp(ratio, start, end){
+ return start + (end - start) * ratio;
+ }
+
+ module.exports = lerp;
+
+
+},{}],218:[function(require,module,exports){
+var lerp = require('./lerp');
+var norm = require('./norm');
+ /**
+ * Maps a number from one scale to another.
+ * @example map(3, 0, 4, -1, 1) -> 0.5
+ */
+ function map(val, min1, max1, min2, max2){
+ return lerp( norm(val, min1, max1), min2, max2 );
+ }
+ module.exports = map;
+
+
+},{"./lerp":217,"./norm":219}],219:[function(require,module,exports){
+
+ /**
+ * Gets normalized ratio of value inside range.
+ */
+ function norm(val, min, max){
+ if (val < min || val > max) {
+ throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max);
+ }
+
+ return val === max ? 1 : (val - min) / (max - min);
+ }
+ module.exports = norm;
+
+
+},{}],220:[function(require,module,exports){
+/**
+ * @constant Maximum 32-bit signed integer value. (2^31 - 1)
+ */
+
+ module.exports = 2147483647;
+
+
+},{}],221:[function(require,module,exports){
+/**
+ * @constant Minimum 32-bit signed integer value (-2^31).
+ */
+
+ module.exports = -2147483648;
+
+
+},{}],222:[function(require,module,exports){
+var toNumber = require('../lang/toNumber');
+ /**
+ * Enforce a specific amount of decimal digits and also fix floating
+ * point rounding issues.
+ */
+ function enforcePrecision(val, nDecimalDigits){
+ val = toNumber(val);
+ var pow = Math.pow(10, nDecimalDigits);
+ return +(Math.round(val * pow) / pow).toFixed(nDecimalDigits);
+ }
+ module.exports = enforcePrecision;
+
+
+},{"../lang/toNumber":214}],223:[function(require,module,exports){
+
+
+ /**
+ * "Convert" value into an 32-bit integer.
+ * Works like `Math.floor` if val > 0 and `Math.ceil` if val < 0.
+ * IMPORTANT: val will wrap at 2^31 and -2^31.
+ * Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7
+ */
+ function toInt(val){
+ // we do not use lang/toNumber because of perf and also because it
+ // doesn't break the functionality
+ return ~~val;
+ }
+
+ module.exports = toInt;
+
+
+
+},{}],224:[function(require,module,exports){
+var some = require('./some');
+
+ /**
+ * Check if object contains value
+ */
+ function contains(obj, needle) {
+ return some(obj, function(val) {
+ return (val === needle);
+ });
+ }
+ module.exports = contains;
+
+
+
+},{"./some":243}],225:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var isPlainObject = require('../lang/isPlainObject');
+
+ /**
+ * Deeply copy missing properties in the target from the defaults.
+ */
+ function deepFillIn(target, defaults){
+ var i = 0,
+ n = arguments.length,
+ obj;
+
+ while(++i < n) {
+ obj = arguments[i];
+ if (obj) {
+ // jshint loopfunc: true
+ forOwn(obj, function(newValue, key) {
+ var curValue = target[key];
+ if (curValue == null) {
+ target[key] = newValue;
+ } else if (isPlainObject(curValue) &&
+ isPlainObject(newValue)) {
+ deepFillIn(curValue, newValue);
+ }
+ });
+ }
+ }
+
+ return target;
+ }
+
+ module.exports = deepFillIn;
+
+
+
+},{"../lang/isPlainObject":209,"./forOwn":232}],226:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var isArray = require('../lang/isArray');
+
+ function containsMatch(array, pattern) {
+ var i = -1, length = array.length;
+ while (++i < length) {
+ if (deepMatches(array[i], pattern)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ function matchArray(target, pattern) {
+ var i = -1, patternLength = pattern.length;
+ while (++i < patternLength) {
+ if (!containsMatch(target, pattern[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function matchObject(target, pattern) {
+ var result = true;
+ forOwn(pattern, function(val, key) {
+ if (!deepMatches(target[key], val)) {
+ // Return false to break out of forOwn early
+ return (result = false);
+ }
+ });
+
+ return result;
+ }
+
+ /**
+ * Recursively check if the objects match.
+ */
+ function deepMatches(target, pattern){
+ if (target && typeof target === 'object' &&
+ pattern && typeof pattern === 'object') {
+ if (isArray(target) && isArray(pattern)) {
+ return matchArray(target, pattern);
+ } else {
+ return matchObject(target, pattern);
+ }
+ } else {
+ return target === pattern;
+ }
+ }
+
+ module.exports = deepMatches;
+
+
+
+},{"../lang/isArray":203,"./forOwn":232}],227:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var every = require('./every');
+var isObject = require('../lang/isObject');
+var is = require('../lang/is');
+
+ // Makes a function to compare the object values from the specified compare
+ // operation callback.
+ function makeCompare(callback) {
+ return function(value, key) {
+ return hasOwn(this, key) && callback(value, this[key]);
+ };
+ }
+
+ function checkProperties(value, key) {
+ return hasOwn(this, key);
+ }
+
+ /**
+ * Checks if two objects have the same keys and values.
+ */
+ function equals(a, b, callback) {
+ callback = callback || is;
+
+ if (!isObject(a) || !isObject(b)) {
+ return callback(a, b);
+ }
+
+ return (every(a, makeCompare(callback), b) &&
+ every(b, checkProperties, a));
+ }
+
+ module.exports = equals;
+
+
+},{"../lang/is":202,"../lang/isObject":208,"./every":228,"./hasOwn":235}],228:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Object every
+ */
+ function every(obj, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = true;
+ forOwn(obj, function(val, key) {
+ // we consider any falsy values as "false" on purpose so shorthand
+ // syntax can be used to check property existence
+ if (!callback(val, key, obj)) {
+ result = false;
+ return false; // break
+ }
+ });
+ return result;
+ }
+
+ module.exports = every;
+
+
+
+},{"../function/makeIterator_":195,"./forOwn":232}],229:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Creates a new object with all the properties where the callback returns
+ * true.
+ */
+ function filterValues(obj, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var output = {};
+ forOwn(obj, function(value, key, obj) {
+ if (callback(value, key, obj)) {
+ output[key] = value;
+ }
+ });
+
+ return output;
+ }
+ module.exports = filterValues;
+
+
+},{"../function/makeIterator_":195,"./forOwn":232}],230:[function(require,module,exports){
+var some = require('./some');
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Returns first item that matches criteria
+ */
+ function find(obj, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result;
+ some(obj, function(value, key, obj) {
+ if (callback(value, key, obj)) {
+ result = value;
+ return true; //break
+ }
+ });
+ return result;
+ }
+
+ module.exports = find;
+
+
+
+},{"../function/makeIterator_":195,"./some":243}],231:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+
+ var _hasDontEnumBug,
+ _dontEnums;
+
+ function checkDontEnum(){
+ _dontEnums = [
+ 'toString',
+ 'toLocaleString',
+ 'valueOf',
+ 'hasOwnProperty',
+ 'isPrototypeOf',
+ 'propertyIsEnumerable',
+ 'constructor'
+ ];
+
+ _hasDontEnumBug = true;
+
+ for (var key in {'toString': null}) {
+ _hasDontEnumBug = false;
+ }
+ }
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forIn(obj, fn, thisObj){
+ var key, i = 0;
+ // no need to check if argument is a real object that way we can use
+ // it for arrays, functions, date, etc.
+
+ //post-pone check till needed
+ if (_hasDontEnumBug == null) checkDontEnum();
+
+ for (key in obj) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+
+
+ if (_hasDontEnumBug) {
+ var ctor = obj.constructor,
+ isProto = !!ctor && obj === ctor.prototype;
+
+ while (key = _dontEnums[i++]) {
+ // For constructor, if it is a prototype object the constructor
+ // is always non-enumerable unless defined otherwise (and
+ // enumerated above). For non-prototype objects, it will have
+ // to be defined on this object, since it cannot be defined on
+ // any prototype objects.
+ //
+ // For other [[DontEnum]] properties, check if the value is
+ // different than Object prototype value.
+ if (
+ (key !== 'constructor' ||
+ (!isProto && hasOwn(obj, key))) &&
+ obj[key] !== Object.prototype[key]
+ ) {
+ if (exec(fn, obj, key, thisObj) === false) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ function exec(fn, obj, key, thisObj){
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+
+ module.exports = forIn;
+
+
+
+},{"./hasOwn":235}],232:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var forIn = require('./forIn');
+
+ /**
+ * Similar to Array/forEach but works over object properties and fixes Don't
+ * Enum bug on IE.
+ * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+ */
+ function forOwn(obj, fn, thisObj){
+ forIn(obj, function(val, key){
+ if (hasOwn(obj, key)) {
+ return fn.call(thisObj, obj[key], key, obj);
+ }
+ });
+ }
+
+ module.exports = forOwn;
+
+
+
+},{"./forIn":231,"./hasOwn":235}],233:[function(require,module,exports){
+var isPrimitive = require('../lang/isPrimitive');
+
+ /**
+ * get "nested" object property
+ */
+ function get(obj, prop){
+ if (!obj) return;
+ var parts = prop.split('.'),
+ last = parts.pop();
+ while (prop = parts.shift()) {
+ obj = obj[prop];
+ if (obj == null) return;
+ }
+
+ return obj[last];
+ }
+
+ module.exports = get;
+
+
+
+},{"../lang/isPrimitive":210}],234:[function(require,module,exports){
+var get = require('./get');
+
+ var UNDEF;
+
+ /**
+ * Check if object has nested property.
+ */
+ function has(obj, prop){
+ return get(obj, prop) !== UNDEF;
+ }
+
+ module.exports = has;
+
+
+
+
+},{"./get":233}],235:[function(require,module,exports){
+
+
+ /**
+ * Safer Object.hasOwnProperty
+ */
+ function hasOwn(obj, prop){
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ }
+
+ module.exports = hasOwn;
+
+
+
+},{}],236:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Get object keys
+ */
+ var keys = Object.keys || function (obj) {
+ var keys = [];
+ forOwn(obj, function(val, key){
+ keys.push(key);
+ });
+ return keys;
+ };
+
+ module.exports = keys;
+
+
+
+},{"./forOwn":232}],237:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var deepClone = require('../lang/deepClone');
+var isObject = require('../lang/isObject');
+
+ /**
+ * Deep merge objects.
+ */
+ function merge() {
+ var i = 1,
+ key, val, obj, target;
+
+ // make sure we don't modify source element and it's properties
+ // objects are passed by reference
+ target = deepClone( arguments[0] );
+
+ while (obj = arguments[i++]) {
+ for (key in obj) {
+ if ( ! hasOwn(obj, key) ) {
+ continue;
+ }
+
+ val = obj[key];
+
+ if ( isObject(val) && isObject(target[key]) ){
+ // inception, deep merge objects
+ target[key] = merge(target[key], val);
+ } else {
+ // make sure arrays, regexp, date, objects are cloned
+ target[key] = deepClone(val);
+ }
+
+ }
+ }
+
+ return target;
+ }
+
+ module.exports = merge;
+
+
+
+},{"../lang/deepClone":200,"../lang/isObject":208,"./hasOwn":235}],238:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Combine properties from all the objects into first one.
+ * - This method affects target object in place, if you want to create a new Object pass an empty object as first param.
+ * @param {object} target Target Object
+ * @param {...object} objects Objects to be combined (0...n objects).
+ * @return {object} Target Object.
+ */
+ function mixIn(target, objects){
+ var i = 0,
+ n = arguments.length,
+ obj;
+ while(++i < n){
+ obj = arguments[i];
+ if (obj != null) {
+ forOwn(obj, copyProp, target);
+ }
+ }
+ return target;
+ }
+
+ function copyProp(val, key){
+ this[key] = val;
+ }
+
+ module.exports = mixIn;
+
+
+},{"./forOwn":232}],239:[function(require,module,exports){
+var forEach = require('../array/forEach');
+
+ /**
+ * Create nested object if non-existent
+ */
+ function namespace(obj, path){
+ if (!path) return obj;
+ forEach(path.split('.'), function(key){
+ if (!obj[key]) {
+ obj[key] = {};
+ }
+ obj = obj[key];
+ });
+ return obj;
+ }
+
+ module.exports = namespace;
+
+
+
+},{"../array/forEach":174}],240:[function(require,module,exports){
+var slice = require('../array/slice');
+var contains = require('../array/contains');
+
+ /**
+ * Return a copy of the object, filtered to only contain properties except the blacklisted keys.
+ */
+ function omit(obj, var_keys){
+ var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
+ out = {};
+
+ for (var property in obj) {
+ if (obj.hasOwnProperty(property) && !contains(keys, property)) {
+ out[property] = obj[property];
+ }
+ }
+ return out;
+ }
+
+ module.exports = omit;
+
+
+
+},{"../array/contains":166,"../array/slice":183}],241:[function(require,module,exports){
+var namespace = require('./namespace');
+
+ /**
+ * set "nested" object property
+ */
+ function set(obj, prop, val){
+ var parts = (/^(.+)\.(.+)$/).exec(prop);
+ if (parts){
+ namespace(obj, parts[1])[parts[2]] = val;
+ } else {
+ obj[prop] = val;
+ }
+ }
+
+ module.exports = set;
+
+
+
+},{"./namespace":239}],242:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Get object size
+ */
+ function size(obj) {
+ var count = 0;
+ forOwn(obj, function(){
+ count++;
+ });
+ return count;
+ }
+
+ module.exports = size;
+
+
+
+},{"./forOwn":232}],243:[function(require,module,exports){
+var forOwn = require('./forOwn');
+var makeIterator = require('../function/makeIterator_');
+
+ /**
+ * Object some
+ */
+ function some(obj, callback, thisObj) {
+ callback = makeIterator(callback, thisObj);
+ var result = false;
+ forOwn(obj, function(val, key) {
+ if (callback(val, key, obj)) {
+ result = true;
+ return false; // break
+ }
+ });
+ return result;
+ }
+
+ module.exports = some;
+
+
+
+},{"../function/makeIterator_":195,"./forOwn":232}],244:[function(require,module,exports){
+var has = require('./has');
+
+ /**
+ * Unset object property.
+ */
+ function unset(obj, prop){
+ if (has(obj, prop)) {
+ var parts = prop.split('.'),
+ last = parts.pop();
+ while (prop = parts.shift()) {
+ obj = obj[prop];
+ }
+ return (delete obj[last]);
+
+ } else {
+ // if property doesn't exist treat as deleted
+ return true;
+ }
+ }
+
+ module.exports = unset;
+
+
+
+},{"./has":234}],245:[function(require,module,exports){
+var forOwn = require('./forOwn');
+
+ /**
+ * Get object values
+ */
+ function values(obj) {
+ var vals = [];
+ forOwn(obj, function(val, key){
+ vals.push(val);
+ });
+ return vals;
+ }
+
+ module.exports = values;
+
+
+
+},{"./forOwn":232}],246:[function(require,module,exports){
+var forOwn = require('../object/forOwn');
+var isArray = require('../lang/isArray');
+var forEach = require('../array/forEach');
+
+ /**
+ * Encode object into a query string.
+ */
+ function encode(obj){
+ var query = [],
+ arrValues, reg;
+ forOwn(obj, function (val, key) {
+ if (isArray(val)) {
+ arrValues = key + '=';
+ reg = new RegExp('&'+key+'+=$');
+ forEach(val, function (aValue) {
+ arrValues += encodeURIComponent(aValue) + '&' + key + '=';
+ });
+ query.push(arrValues.replace(reg, ''));
+ } else {
+ query.push(key + '=' + encodeURIComponent(val));
+ }
+ });
+ return (query.length) ? '?' + query.join('&') : '';
+ }
+
+ module.exports = encode;
+
+
+},{"../array/forEach":174,"../lang/isArray":203,"../object/forOwn":232}],247:[function(require,module,exports){
+var typecast = require('../string/typecast');
+var getQuery = require('./getQuery');
+
+ /**
+ * Get query parameter value.
+ */
+ function getParam(url, param, shouldTypecast){
+ var regexp = new RegExp('(\\?|&)'+ param + '=([^&]*)'), //matches `?param=value` or `¶m=value`, value = $2
+ result = regexp.exec( getQuery(url) ),
+ val = (result && result[2])? result[2] : null;
+ return shouldTypecast === false? val : typecast(val);
+ }
+
+ module.exports = getParam;
+
+
+},{"../string/typecast":273,"./getQuery":248}],248:[function(require,module,exports){
+
+
+ /**
+ * Gets full query as string with all special chars decoded.
+ */
+ function getQuery(url) {
+ // url = url.replace(/#.*\?/, '?'); //removes hash (to avoid getting hash query)
+ var queryString = /\?[a-zA-Z0-9\=\&\%\$\-\_\.\+\!\*\'\(\)\,]+/.exec(url); //valid chars according to: http://www.ietf.org/rfc/rfc1738.txt
+ return (queryString)? decodeURIComponent(queryString[0].replace(/\+/g,' ')) : '';
+ }
+
+ module.exports = getQuery;
+
+
+},{}],249:[function(require,module,exports){
+
+
+ /**
+ * Set query string parameter value
+ */
+ function setParam(url, paramName, value){
+ url = url || '';
+
+ var re = new RegExp('(\\?|&)'+ paramName +'=[^&]*' );
+ var param = paramName +'='+ encodeURIComponent( value );
+
+ if ( re.test(url) ) {
+ return url.replace(re, '$1'+ param);
+ } else {
+ if (url.indexOf('?') === -1) {
+ url += '?';
+ }
+ if (url.indexOf('=') !== -1) {
+ url += '&';
+ }
+ return url + param;
+ }
+
+ }
+
+ module.exports = setParam;
+
+
+
+},{}],250:[function(require,module,exports){
+var randInt = require('./randInt');
+var isArray = require('../lang/isArray');
+
+ /**
+ * Returns a random element from the supplied arguments
+ * or from the array (if single argument is an array).
+ */
+ function choice(items) {
+ var target = (arguments.length === 1 && isArray(items))? items : arguments;
+ return target[ randInt(0, target.length - 1) ];
+ }
+
+ module.exports = choice;
+
+
+
+},{"../lang/isArray":203,"./randInt":254}],251:[function(require,module,exports){
+var randHex = require('./randHex');
+var choice = require('./choice');
+
+ /**
+ * Returns pseudo-random guid (UUID v4)
+ * IMPORTANT: it's not totally "safe" since randHex/choice uses Math.random
+ * by default and sequences can be predicted in some cases. See the
+ * "random/random" documentation for more info about it and how to replace
+ * the default PRNG.
+ */
+ function guid() {
+ return (
+ randHex(8)+'-'+
+ randHex(4)+'-'+
+ // v4 UUID always contain "4" at this position to specify it was
+ // randomly generated
+ '4' + randHex(3) +'-'+
+ // v4 UUID always contain chars [a,b,8,9] at this position
+ choice(8, 9, 'a', 'b') + randHex(3)+'-'+
+ randHex(12)
+ );
+ }
+ module.exports = guid;
+
+
+},{"./choice":250,"./randHex":253}],252:[function(require,module,exports){
+var random = require('./random');
+var MIN_INT = require('../number/MIN_INT');
+var MAX_INT = require('../number/MAX_INT');
+
+ /**
+ * Returns random number inside range
+ */
+ function rand(min, max){
+ min = min == null? MIN_INT : min;
+ max = max == null? MAX_INT : max;
+ return min + (max - min) * random();
+ }
+
+ module.exports = rand;
+
+
+},{"../number/MAX_INT":220,"../number/MIN_INT":221,"./random":255}],253:[function(require,module,exports){
+var choice = require('./choice');
+
+ var _chars = '0123456789abcdef'.split('');
+
+ /**
+ * Returns a random hexadecimal string
+ */
+ function randHex(size){
+ size = size && size > 0? size : 6;
+ var str = '';
+ while (size--) {
+ str += choice(_chars);
+ }
+ return str;
+ }
+
+ module.exports = randHex;
+
+
+
+},{"./choice":250}],254:[function(require,module,exports){
+var MIN_INT = require('../number/MIN_INT');
+var MAX_INT = require('../number/MAX_INT');
+var rand = require('./rand');
+
+ /**
+ * Gets random integer inside range or snap to min/max values.
+ */
+ function randInt(min, max){
+ min = min == null? MIN_INT : ~~min;
+ max = max == null? MAX_INT : ~~max;
+ // can't be max + 0.5 otherwise it will round up if `rand`
+ // returns `max` causing it to overflow range.
+ // -0.5 and + 0.49 are required to avoid bias caused by rounding
+ return Math.round( rand(min - 0.5, max + 0.499999999999) );
+ }
+
+ module.exports = randInt;
+
+
+},{"../number/MAX_INT":220,"../number/MIN_INT":221,"./rand":252}],255:[function(require,module,exports){
+
+
+ /**
+ * Just a wrapper to Math.random. No methods inside mout/random should call
+ * Math.random() directly so we can inject the pseudo-random number
+ * generator if needed (ie. in case we need a seeded random or a better
+ * algorithm than the native one)
+ */
+ function random(){
+ return random.get();
+ }
+
+ // we expose the method so it can be swapped if needed
+ random.get = Math.random;
+
+ module.exports = random;
+
+
+
+},{}],256:[function(require,module,exports){
+
+ /**
+ * Contains all Unicode white-spaces. Taken from
+ * http://en.wikipedia.org/wiki/Whitespace_character.
+ */
+ module.exports = [
+ ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E',
+ '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006',
+ '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F',
+ '\u205F', '\u3000'
+ ];
+
+
+},{}],257:[function(require,module,exports){
+var toString = require('../lang/toString');
+
+ /**
+ * Searches for a given substring
+ */
+ function contains(str, substring, fromIndex){
+ str = toString(str);
+ substring = toString(substring);
+ return str.indexOf(substring, fromIndex) !== -1;
+ }
+
+ module.exports = contains;
+
+
+
+},{"../lang/toString":215}],258:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * Checks if string ends with specified suffix.
+ */
+ function endsWith(str, suffix) {
+ str = toString(str);
+ suffix = toString(suffix);
+
+ return str.indexOf(suffix, str.length - suffix.length) !== -1;
+ }
+
+ module.exports = endsWith;
+
+
+},{"../lang/toString":215}],259:[function(require,module,exports){
+var toString = require('../lang/toString');
+
+ /**
+ * Escapes a string for insertion into HTML.
+ */
+ function escapeHtml(str){
+ str = toString(str)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/'/g, ''')
+ .replace(/"/g, '"');
+ return str;
+ }
+
+ module.exports = escapeHtml;
+
+
+
+},{"../lang/toString":215}],260:[function(require,module,exports){
+var toString = require('../lang/toString');
+
+ /**
+ * Escape string into unicode sequences
+ */
+ function escapeUnicode(str, shouldEscapePrintable){
+ str = toString(str);
+ return str.replace(/[\s\S]/g, function(ch){
+ // skip printable ASCII chars if we should not escape them
+ if (!shouldEscapePrintable && (/[\x20-\x7E]/).test(ch)) {
+ return ch;
+ }
+ // we use "000" and slice(-4) for brevity, need to pad zeros,
+ // unicode escape always have 4 chars after "\u"
+ return '\\u'+ ('000'+ ch.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+ module.exports = escapeUnicode;
+
+
+
+},{"../lang/toString":215}],261:[function(require,module,exports){
+var toString = require('../lang/toString');
+var get = require('../object/get');
+
+ var stache = /\{\{([^\}]+)\}\}/g; //mustache-like
+
+ /**
+ * String interpolation
+ */
+ function interpolate(template, replacements, syntax){
+ template = toString(template);
+ var replaceFn = function(match, prop){
+ return toString( get(replacements, prop) );
+ };
+ return template.replace(syntax || stache, replaceFn);
+ }
+
+ module.exports = interpolate;
+
+
+
+},{"../lang/toString":215,"../object/get":233}],262:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * "Safer" String.toLowerCase()
+ */
+ function lowerCase(str){
+ str = toString(str);
+ return str.toLowerCase();
+ }
+
+ module.exports = lowerCase;
+
+
+},{"../lang/toString":215}],263:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from beginning of string.
+ */
+ function ltrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var start = 0,
+ len = str.length,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && start < len) {
+ found = false;
+ i = -1;
+ c = str.charAt(start);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ start++;
+ break;
+ }
+ }
+ }
+
+ return (start >= len) ? '' : str.substr(start, len);
+ }
+
+ module.exports = ltrim;
+
+
+},{"../lang/toString":215,"./WHITE_SPACES":256}],264:[function(require,module,exports){
+var toString = require('../lang/toString');
+var lowerCase = require('./lowerCase');
+var upperCase = require('./upperCase');
+ /**
+ * UPPERCASE first char of each word.
+ */
+ function properCase(str){
+ str = toString(str);
+ return lowerCase(str).replace(/^\w|\s\w/g, upperCase);
+ }
+
+ module.exports = properCase;
+
+
+},{"../lang/toString":215,"./lowerCase":262,"./upperCase":276}],265:[function(require,module,exports){
+var toString = require('../lang/toString');
+ // This pattern is generated by the _build/pattern-removeNonWord.js script
+ var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;
+
+ /**
+ * Remove non-word chars.
+ */
+ function removeNonWord(str){
+ str = toString(str);
+ return str.replace(PATTERN, '');
+ }
+
+ module.exports = removeNonWord;
+
+
+},{"../lang/toString":215}],266:[function(require,module,exports){
+var toString = require('../lang/toString');
+var toInt = require('../number/toInt');
+
+ /**
+ * Repeat string n times
+ */
+ function repeat(str, n){
+ var result = '';
+ str = toString(str);
+ n = toInt(n);
+ if (n < 1) {
+ return '';
+ }
+ while (n > 0) {
+ if (n % 2) {
+ result += str;
+ }
+ n = Math.floor(n / 2);
+ str += str;
+ }
+ return result;
+ }
+
+ module.exports = repeat;
+
+
+
+},{"../lang/toString":215,"../number/toInt":223}],267:[function(require,module,exports){
+var toString = require('../lang/toString');
+var toArray = require('../lang/toArray');
+
+ /**
+ * Replace string(s) with the replacement(s) in the source.
+ */
+ function replace(str, search, replacements) {
+ str = toString(str);
+ search = toArray(search);
+ replacements = toArray(replacements);
+
+ var searchLength = search.length,
+ replacementsLength = replacements.length;
+
+ if (replacementsLength !== 1 && searchLength !== replacementsLength) {
+ throw new Error('Unequal number of searches and replacements');
+ }
+
+ var i = -1;
+ while (++i < searchLength) {
+ // Use the first replacement for all searches if only one
+ // replacement is provided
+ str = str.replace(
+ search[i],
+ replacements[(replacementsLength === 1) ? 0 : i]);
+ }
+
+ return str;
+ }
+
+ module.exports = replace;
+
+
+
+},{"../lang/toArray":213,"../lang/toString":215}],268:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * Replaces all accented chars with regular ones
+ */
+ function replaceAccents(str){
+ str = toString(str);
+
+ // verifies if the String has accents and replace them
+ if (str.search(/[\xC0-\xFF]/g) > -1) {
+ str = str
+ .replace(/[\xC0-\xC5]/g, "A")
+ .replace(/[\xC6]/g, "AE")
+ .replace(/[\xC7]/g, "C")
+ .replace(/[\xC8-\xCB]/g, "E")
+ .replace(/[\xCC-\xCF]/g, "I")
+ .replace(/[\xD0]/g, "D")
+ .replace(/[\xD1]/g, "N")
+ .replace(/[\xD2-\xD6\xD8]/g, "O")
+ .replace(/[\xD9-\xDC]/g, "U")
+ .replace(/[\xDD]/g, "Y")
+ .replace(/[\xDE]/g, "P")
+ .replace(/[\xE0-\xE5]/g, "a")
+ .replace(/[\xE6]/g, "ae")
+ .replace(/[\xE7]/g, "c")
+ .replace(/[\xE8-\xEB]/g, "e")
+ .replace(/[\xEC-\xEF]/g, "i")
+ .replace(/[\xF1]/g, "n")
+ .replace(/[\xF2-\xF6\xF8]/g, "o")
+ .replace(/[\xF9-\xFC]/g, "u")
+ .replace(/[\xFE]/g, "p")
+ .replace(/[\xFD\xFF]/g, "y");
+ }
+ return str;
+ }
+ module.exports = replaceAccents;
+
+
+},{"../lang/toString":215}],269:[function(require,module,exports){
+var toString = require('../lang/toString');
+var repeat = require('./repeat');
+
+ /**
+ * Pad string with `char` if its' length is smaller than `minLen`
+ */
+ function rpad(str, minLen, ch) {
+ str = toString(str);
+ ch = ch || ' ';
+ return (str.length < minLen)? str + repeat(ch, minLen - str.length) : str;
+ }
+
+ module.exports = rpad;
+
+
+
+},{"../lang/toString":215,"./repeat":266}],270:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+ /**
+ * Remove chars from end of string.
+ */
+ function rtrim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+
+ var end = str.length - 1,
+ charLen = chars.length,
+ found = true,
+ i, c;
+
+ while (found && end >= 0) {
+ found = false;
+ i = -1;
+ c = str.charAt(end);
+
+ while (++i < charLen) {
+ if (c === chars[i]) {
+ found = true;
+ end--;
+ break;
+ }
+ }
+ }
+
+ return (end >= 0) ? str.substring(0, end + 1) : '';
+ }
+
+ module.exports = rtrim;
+
+
+},{"../lang/toString":215,"./WHITE_SPACES":256}],271:[function(require,module,exports){
+var toString = require('../lang/toString');
+var replaceAccents = require('./replaceAccents');
+var removeNonWord = require('./removeNonWord');
+var trim = require('./trim');
+ /**
+ * Convert to lower case, remove accents, remove non-word chars and
+ * replace spaces with the specified delimeter.
+ * Does not split camelCase text.
+ */
+ function slugify(str, delimeter){
+ str = toString(str);
+
+ if (delimeter == null) {
+ delimeter = "-";
+ }
+ str = replaceAccents(str);
+ str = removeNonWord(str);
+ str = trim(str) //should come after removeNonWord
+ .replace(/ +/g, delimeter) //replace spaces with delimeter
+ .toLowerCase();
+ return str;
+ }
+ module.exports = slugify;
+
+
+},{"../lang/toString":215,"./removeNonWord":265,"./replaceAccents":268,"./trim":272}],272:[function(require,module,exports){
+var toString = require('../lang/toString');
+var WHITE_SPACES = require('./WHITE_SPACES');
+var ltrim = require('./ltrim');
+var rtrim = require('./rtrim');
+ /**
+ * Remove white-spaces from beginning and end of string.
+ */
+ function trim(str, chars) {
+ str = toString(str);
+ chars = chars || WHITE_SPACES;
+ return ltrim(rtrim(str, chars), chars);
+ }
+
+ module.exports = trim;
+
+
+},{"../lang/toString":215,"./WHITE_SPACES":256,"./ltrim":263,"./rtrim":270}],273:[function(require,module,exports){
+
+
+ var UNDEF;
+
+ /**
+ * Parses string and convert it into a native value.
+ */
+ function typecast(val) {
+ var r;
+ if ( val === null || val === 'null' ) {
+ r = null;
+ } else if ( val === 'true' ) {
+ r = true;
+ } else if ( val === 'false' ) {
+ r = false;
+ } else if ( val === UNDEF || val === 'undefined' ) {
+ r = UNDEF;
+ } else if ( val === '' || isNaN(val) ) {
+ //isNaN('') returns false
+ r = val;
+ } else {
+ //parseFloat(null || '') returns NaN
+ r = parseFloat(val);
+ }
+ return r;
+ }
+
+ module.exports = typecast;
+
+
+},{}],274:[function(require,module,exports){
+var toString = require('../lang/toString');
+
+ /**
+ * Unescapes HTML special chars
+ */
+ function unescapeHtml(str){
+ str = toString(str)
+ .replace(/&/g , '&')
+ .replace(/</g , '<')
+ .replace(/>/g , '>')
+ .replace(/*39;/g , "'")
+ .replace(/"/g, '"');
+ return str;
+ }
+
+ module.exports = unescapeHtml;
+
+
+
+},{"../lang/toString":215}],275:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * Replaces hyphens with spaces. (only hyphens between word chars)
+ */
+ function unhyphenate(str){
+ str = toString(str);
+ return str.replace(/(\w)(-)(\w)/g, '$1 $3');
+ }
+ module.exports = unhyphenate;
+
+
+},{"../lang/toString":215}],276:[function(require,module,exports){
+var toString = require('../lang/toString');
+ /**
+ * "Safer" String.toUpperCase()
+ */
+ function upperCase(str){
+ str = toString(str);
+ return str.toUpperCase();
+ }
+ module.exports = upperCase;
+
+
+},{"../lang/toString":215}],277:[function(require,module,exports){
+
+
+ /**
+ * Create slice of source array or array-like object
+ */
+ function slice(arr, start, end){
+ var len = arr.length;
+
+ if (start == null) {
+ start = 0;
+ } else if (start < 0) {
+ start = Math.max(len + start, 0);
+ } else {
+ start = Math.min(start, len);
+ }
+
+ if (end == null) {
+ end = len;
+ } else if (end < 0) {
+ end = Math.max(len + end, 0);
+ } else {
+ end = Math.min(end, len);
+ }
+
+ var result = [];
+ while (start < end) {
+ result.push(arr[start++]);
+ }
+
+ return result;
+ }
+
+ module.exports = slice;
+
+
+
+},{}],278:[function(require,module,exports){
+var slice = require('../array/slice');
+
+ /**
+ * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection.
+ * @param {Function} fn Function.
+ * @param {object} context Execution context.
+ * @param {rest} args Arguments (0...n arguments).
+ * @return {Function} Wrapped Function.
+ */
+ function bind(fn, context, args){
+ var argsArr = slice(arguments, 2); //curried args
+ return function(){
+ return fn.apply(context, argsArr.concat(slice(arguments)));
+ };
+ }
+
+ module.exports = bind;
+
+
+
+},{"../array/slice":277}],279:[function(require,module,exports){
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+var mixIn = require('../object/mixIn');
+
+ /**
+ * Clone native types.
+ */
+ function clone(val){
+ switch (kindOf(val)) {
+ case 'Object':
+ return cloneObject(val);
+ case 'Array':
+ return cloneArray(val);
+ case 'RegExp':
+ return cloneRegExp(val);
+ case 'Date':
+ return cloneDate(val);
+ default:
+ return val;
+ }
+ }
+
+ function cloneObject(source) {
+ if (isPlainObject(source)) {
+ return mixIn({}, source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneRegExp(r) {
+ var flags = '';
+ flags += r.multiline ? 'm' : '';
+ flags += r.global ? 'g' : '';
+ flags += r.ignorecase ? 'i' : '';
+ return new RegExp(r.source, flags);
+ }
+
+ function cloneDate(date) {
+ return new Date(+date);
+ }
+
+ function cloneArray(arr) {
+ return arr.slice();
+ }
+
+ module.exports = clone;
+
+
+
+},{"../object/mixIn":289,"./isPlainObject":283,"./kindOf":284}],280:[function(require,module,exports){
+var clone = require('./clone');
+var forOwn = require('../object/forOwn');
+var kindOf = require('./kindOf');
+var isPlainObject = require('./isPlainObject');
+
+ /**
+ * Recursively clone native types.
+ */
+ function deepClone(val, instanceClone) {
+ switch ( kindOf(val) ) {
+ case 'Object':
+ return cloneObject(val, instanceClone);
+ case 'Array':
+ return cloneArray(val, instanceClone);
+ default:
+ return clone(val);
+ }
+ }
+
+ function cloneObject(source, instanceClone) {
+ if (isPlainObject(source)) {
+ var out = {};
+ forOwn(source, function(val, key) {
+ this[key] = deepClone(val, instanceClone);
+ }, out);
+ return out;
+ } else if (instanceClone) {
+ return instanceClone(source);
+ } else {
+ return source;
+ }
+ }
+
+ function cloneArray(arr, instanceClone) {
+ var out = [],
+ i = -1,
+ n = arr.length,
+ val;
+ while (++i < n) {
+ out[i] = deepClone(arr[i], instanceClone);
+ }
+ return out;
+ }
+
+ module.exports = deepClone;
+
+
+
+
+},{"../object/forOwn":286,"./clone":279,"./isPlainObject":283,"./kindOf":284}],281:[function(require,module,exports){
+arguments[4][87][0].apply(exports,arguments)
+},{"./kindOf":284,"dup":87}],282:[function(require,module,exports){
+arguments[4][88][0].apply(exports,arguments)
+},{"./isKind":281,"dup":88}],283:[function(require,module,exports){
+
+
+ /**
+ * Checks if the value is created by the `Object` constructor.
+ */
+ function isPlainObject(value) {
+ return (!!value && typeof value === 'object' &&
+ value.constructor === Object);
+ }
+
+ module.exports = isPlainObject;
+
+
+
+},{}],284:[function(require,module,exports){
+arguments[4][90][0].apply(exports,arguments)
+},{"dup":90}],285:[function(require,module,exports){
+arguments[4][92][0].apply(exports,arguments)
+},{"./hasOwn":287,"dup":92}],286:[function(require,module,exports){
+arguments[4][93][0].apply(exports,arguments)
+},{"./forIn":285,"./hasOwn":287,"dup":93}],287:[function(require,module,exports){
+arguments[4][94][0].apply(exports,arguments)
+},{"dup":94}],288:[function(require,module,exports){
+var hasOwn = require('./hasOwn');
+var deepClone = require('../lang/deepClone');
+var isObject = require('../lang/isObject');
+
+ /**
+ * Deep merge objects.
+ */
+ function merge() {
+ var i = 1,
+ key, val, obj, target;
+
+ // make sure we don't modify source element and it's properties
+ // objects are passed by reference
+ target = deepClone( arguments[0] );
+
+ while (obj = arguments[i++]) {
+ for (key in obj) {
+ if ( ! hasOwn(obj, key) ) {
+ continue;
+ }
+
+ val = obj[key];
+
+ if ( isObject(val) && isObject(target[key]) ){
+ // inception, deep merge objects
+ target[key] = merge(target[key], val);
+ } else {
+ // make sure arrays, regexp, date, objects are cloned
+ target[key] = deepClone(val);
+ }
+
+ }
+ }
+
+ return target;
+ }
+
+ module.exports = merge;
+
+
+
+},{"../lang/deepClone":280,"../lang/isObject":282,"./hasOwn":287}],289:[function(require,module,exports){
+arguments[4][95][0].apply(exports,arguments)
+},{"./forOwn":286,"dup":95}],290:[function(require,module,exports){
+arguments[4][104][0].apply(exports,arguments)
+},{"dup":104,"mout/lang/createObject":291,"mout/lang/kindOf":292,"mout/object/hasOwn":295,"mout/object/mixIn":296}],291:[function(require,module,exports){
+arguments[4][84][0].apply(exports,arguments)
+},{"../object/mixIn":296,"dup":84}],292:[function(require,module,exports){
+arguments[4][90][0].apply(exports,arguments)
+},{"dup":90}],293:[function(require,module,exports){
+arguments[4][92][0].apply(exports,arguments)
+},{"./hasOwn":295,"dup":92}],294:[function(require,module,exports){
+arguments[4][93][0].apply(exports,arguments)
+},{"./forIn":293,"./hasOwn":295,"dup":93}],295:[function(require,module,exports){
+arguments[4][94][0].apply(exports,arguments)
+},{"dup":94}],296:[function(require,module,exports){
+arguments[4][95][0].apply(exports,arguments)
+},{"./forOwn":294,"dup":95}],297:[function(require,module,exports){
+"use strict";
+
+// credits to @cpojer's Class.Binds, released under the MIT license
+// https://github.com/cpojer/mootools-class-extras/blob/master/Source/Class.Binds.js
+
+var prime = require("prime")
+var bind = require("mout/function/bind")
+
+var bound = prime({
+
+ bound: function(name){
+ var bound = this._bound || (this._bound = {})
+ return bound[name] || (bound[name] = bind(this[name], this))
+ }
+
+})
+
+module.exports = bound
+
+},{"mout/function/bind":278,"prime":290}],298:[function(require,module,exports){
+"use strict";
+
+var prime = require("prime")
+var merge = require("mout/object/merge")
+
+var Options = prime({
+
+ setOptions: function(options){
+ var args = [{}, this.options]
+ args.push.apply(args, arguments)
+ this.options = merge.apply(null, args)
+ return this
+ }
+
+})
+
+module.exports = Options
+
+},{"mout/object/merge":288,"prime":290}],299:[function(require,module,exports){
+(function (process,global,setImmediate){(function (){
+/*
+defer
+*/"use strict"
+
+var kindOf = require("mout/lang/kindOf"),
+ now = require("mout/time/now"),
+ forEach = require("mout/array/forEach"),
+ indexOf = require("mout/array/indexOf")
+
+var callbacks = {
+ timeout: {},
+ frame: [],
+ immediate: []
+}
+
+var push = function(collection, callback, context, defer){
+
+ var iterator = function(){
+ iterate(collection)
+ }
+
+ if (!collection.length) defer(iterator)
+
+ var entry = {
+ callback: callback,
+ context: context
+ }
+
+ collection.push(entry)
+
+ return function(){
+ var io = indexOf(collection, entry)
+ if (io > -1) collection.splice(io, 1)
+ }
+}
+
+var iterate = function(collection){
+ var time = now()
+
+ forEach(collection.splice(0), function(entry) {
+ entry.callback.call(entry.context, time)
+ })
+}
+
+var defer = function(callback, argument, context){
+ return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument)
+}
+
+if (global.process && process.nextTick){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, process.nextTick)
+ }
+
+} else if (global.setImmediate){
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, setImmediate)
+ }
+
+} else if (global.postMessage && global.addEventListener){
+
+ addEventListener("message", function(event){
+ if (event.source === global && event.data === "@deferred"){
+ event.stopPropagation()
+ iterate(callbacks.immediate)
+ }
+ }, true)
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(){
+ postMessage("@deferred", "*")
+ })
+ }
+
+} else {
+
+ defer.immediate = function(callback, context){
+ return push(callbacks.immediate, callback, context, function(iterator){
+ setTimeout(iterator, 0)
+ })
+ }
+
+}
+
+var requestAnimationFrame = global.requestAnimationFrame ||
+ global.webkitRequestAnimationFrame ||
+ global.mozRequestAnimationFrame ||
+ global.oRequestAnimationFrame ||
+ global.msRequestAnimationFrame ||
+ function(callback) {
+ setTimeout(callback, 1e3 / 60)
+ }
+
+defer.frame = function(callback, context){
+ return push(callbacks.frame, callback, context, requestAnimationFrame)
+}
+
+var clear
+
+defer.timeout = function(callback, ms, context){
+ var ct = callbacks.timeout
+
+ if (!clear) clear = defer.immediate(function(){
+ clear = null
+ callbacks.timeout = {}
+ })
+
+ return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){
+ setTimeout(iterator, ms)
+ })
+}
+
+module.exports = defer
+
+}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
+
+},{"_process":1,"mout/array/forEach":303,"mout/array/indexOf":304,"mout/lang/kindOf":306,"mout/time/now":311,"timers":2}],300:[function(require,module,exports){
+/*
+Emitter
+*/"use strict"
+
+var indexOf = require("mout/array/indexOf"),
+ forEach = require("mout/array/forEach")
+
+var prime = require("./index"),
+ defer = require("./defer")
+
+var slice = Array.prototype.slice;
+
+var Emitter = prime({
+
+ constructor: function(stoppable){
+ this._stoppable = stoppable
+ },
+
+ on: function(event, fn){
+ var listeners = this._listeners || (this._listeners = {}),
+ events = listeners[event] || (listeners[event] = [])
+
+ if (indexOf(events, fn) === -1) events.push(fn)
+
+ return this
+ },
+
+ off: function(event, fn){
+ var listeners = this._listeners, events
+ if (listeners && (events = listeners[event])){
+
+ var io = indexOf(events, fn)
+ if (io > -1) events.splice(io, 1)
+ if (!events.length) delete listeners[event];
+ for (var l in listeners) return this
+ delete this._listeners
+ }
+ return this
+ },
+
+ emit: function(event){
+ var self = this,
+ args = slice.call(arguments, 1)
+
+ var emit = function(){
+ var listeners = self._listeners, events
+ if (listeners && (events = listeners[event])){
+ forEach(events.slice(0), function(event){
+ var result = event.apply(self, args)
+ if (self._stoppable) return result
+ })
+ }
+ }
+
+ if (args[args.length - 1] === Emitter.EMIT_SYNC){
+ args.pop()
+ emit()
+ } else {
+ defer(emit)
+ }
+
+ return this
+ }
+
+})
+
+Emitter.EMIT_SYNC = {}
+
+module.exports = Emitter
+
+},{"./defer":299,"./index":301,"mout/array/forEach":303,"mout/array/indexOf":304}],301:[function(require,module,exports){
+/*
+prime
+ - prototypal inheritance
+*/"use strict"
+
+var hasOwn = require("mout/object/hasOwn"),
+ mixIn = require("mout/object/mixIn"),
+ create = require("mout/lang/createObject"),
+ kindOf = require("mout/lang/kindOf")
+
+var hasDescriptors = true
+
+try {
+ Object.defineProperty({}, "~", {})
+ Object.getOwnPropertyDescriptor({}, "~")
+} catch (e){
+ hasDescriptors = false
+}
+
+// we only need to be able to implement "toString" and "valueOf" in IE < 9
+var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"),
+ buggy = ["toString", "valueOf"]
+
+var verbs = /^constructor|inherits|mixin$/
+
+var implement = function(proto){
+ var prototype = this.prototype
+
+ for (var key in proto){
+ if (key.match(verbs)) continue
+ if (hasDescriptors){
+ var descriptor = Object.getOwnPropertyDescriptor(proto, key)
+ if (descriptor){
+ Object.defineProperty(prototype, key, descriptor)
+ continue
+ }
+ }
+ prototype[key] = proto[key]
+ }
+
+ if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){
+ var value = proto[key]
+ if (value !== Object.prototype[key]) prototype[key] = value
+ }
+
+ return this
+}
+
+var prime = function(proto){
+
+ if (kindOf(proto) === "Function") proto = {constructor: proto}
+
+ var superprime = proto.inherits
+
+ // if our nice proto object has no own constructor property
+ // then we proceed using a ghosting constructor that all it does is
+ // call the parent's constructor if it has a superprime, else an empty constructor
+ // proto.constructor becomes the effective constructor
+ var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){
+ return superprime.apply(this, arguments)
+ } : function(){}
+
+ if (superprime){
+
+ mixIn(constructor, superprime)
+
+ var superproto = superprime.prototype
+ // inherit from superprime
+ var cproto = constructor.prototype = create(superproto)
+
+ // setting constructor.parent to superprime.prototype
+ // because it's the shortest possible absolute reference
+ constructor.parent = superproto
+ cproto.constructor = constructor
+ }
+
+ if (!constructor.implement) constructor.implement = implement
+
+ var mixins = proto.mixin
+ if (mixins){
+ if (kindOf(mixins) !== "Array") mixins = [mixins]
+ for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype))
+ }
+
+ // implement proto and return constructor
+ return constructor.implement(proto)
+
+}
+
+module.exports = prime
+
+},{"mout/lang/createObject":305,"mout/lang/kindOf":306,"mout/object/hasOwn":309,"mout/object/mixIn":310}],302:[function(require,module,exports){
+/*
+Map
+*/"use strict"
+
+var indexOf = require("mout/array/indexOf")
+
+var prime = require("./index")
+
+var Map = prime({
+
+ constructor: function Map(){
+ this.length = 0
+ this._values = []
+ this._keys = []
+ },
+
+ set: function(key, value){
+ var index = indexOf(this._keys, key)
+
+ if (index === -1){
+ this._keys.push(key)
+ this._values.push(value)
+ this.length++
+ } else {
+ this._values[index] = value
+ }
+
+ return this
+ },
+
+ get: function(key){
+ var index = indexOf(this._keys, key)
+ return (index === -1) ? null : this._values[index]
+ },
+
+ count: function(){
+ return this.length
+ },
+
+ forEach: function(method, context){
+ for (var i = 0, l = this.length; i < l; i++){
+ if (method.call(context, this._values[i], this._keys[i], this) === false) break
+ }
+ return this
+ },
+
+ map: function(method, context){
+ var results = new Map
+ this.forEach(function(value, key){
+ results.set(key, method.call(context, value, key, this))
+ }, this)
+ return results
+ },
+
+ filter: function(method, context){
+ var results = new Map
+ this.forEach(function(value, key){
+ if (method.call(context, value, key, this)) results.set(key, value)
+ }, this)
+ return results
+ },
+
+ every: function(method, context){
+ var every = true
+ this.forEach(function(value, key){
+ if (!method.call(context, value, key, this)) return (every = false)
+ }, this)
+ return every
+ },
+
+ some: function(method, context){
+ var some = false
+ this.forEach(function(value, key){
+ if (method.call(context, value, key, this)) return !(some = true)
+ }, this)
+ return some
+ },
+
+ indexOf: function(value){
+ var index = indexOf(this._values, value)
+ return (index > -1) ? this._keys[index] : null
+ },
+
+ remove: function(value){
+ var index = indexOf(this._values, value)
+
+ if (index !== -1){
+ this._values.splice(index, 1)
+ this.length--
+ return this._keys.splice(index, 1)[0]
+ }
+
+ return null
+ },
+
+ unset: function(key){
+ var index = indexOf(this._keys, key)
+
+ if (index !== -1){
+ this._keys.splice(index, 1)
+ this.length--
+ return this._values.splice(index, 1)[0]
+ }
+
+ return null
+ },
+
+ keys: function(){
+ return this._keys.slice()
+ },
+
+ values: function(){
+ return this._values.slice()
+ }
+
+})
+
+var map = function(){
+ return new Map
+}
+
+map.prototype = Map.prototype
+
+module.exports = map
+
+},{"./index":301,"mout/array/indexOf":304}],303:[function(require,module,exports){
+arguments[4][81][0].apply(exports,arguments)
+},{"dup":81}],304:[function(require,module,exports){
+arguments[4][82][0].apply(exports,arguments)
+},{"dup":82}],305:[function(require,module,exports){
+arguments[4][84][0].apply(exports,arguments)
+},{"../object/mixIn":310,"dup":84}],306:[function(require,module,exports){
+arguments[4][90][0].apply(exports,arguments)
+},{"dup":90}],307:[function(require,module,exports){
+arguments[4][92][0].apply(exports,arguments)
+},{"./hasOwn":309,"dup":92}],308:[function(require,module,exports){
+arguments[4][93][0].apply(exports,arguments)
+},{"./forIn":307,"./hasOwn":309,"dup":93}],309:[function(require,module,exports){
+arguments[4][94][0].apply(exports,arguments)
+},{"dup":94}],310:[function(require,module,exports){
+arguments[4][95][0].apply(exports,arguments)
+},{"./forOwn":308,"dup":95}],311:[function(require,module,exports){
+arguments[4][101][0].apply(exports,arguments)
+},{"dup":101}],312:[function(require,module,exports){
+/**
+ * sifter.js
+ * Copyright (c) 2013 Brian Reavis & contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
+ * file except in compliance with the License. You may obtain a copy of the License at:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ * ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ *
+ * @author Brian Reavis
+ */
+
+(function(root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory();
+ } else {
+ root.Sifter = factory();
+ }
+}(this, function() {
+
+ /**
+ * Textually searches arrays and hashes of objects
+ * by property (or multiple properties). Designed
+ * specifically for autocomplete.
+ *
+ * @constructor
+ * @param {array|object} items
+ * @param {object} items
+ */
+ var Sifter = function(items, settings) {
+ this.items = items;
+ this.settings = settings || {diacritics: true};
+ };
+
+ /**
+ * Splits a search string into an array of individual
+ * regexps to be used to match results.
+ *
+ * @param {string} query
+ * @returns {array}
+ */
+ Sifter.prototype.tokenize = function(query) {
+ query = trim(String(query || '').toLowerCase());
+ if (!query || !query.length) return [];
+
+ var i, n, regex, letter;
+ var tokens = [];
+ var words = query.split(/ +/);
+
+ for (i = 0, n = words.length; i < n; i++) {
+ regex = escape_regex(words[i]);
+ if (this.settings.diacritics) {
+ for (letter in DIACRITICS) {
+ if (DIACRITICS.hasOwnProperty(letter)) {
+ regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);
+ }
+ }
+ }
+ tokens.push({
+ string : words[i],
+ regex : new RegExp(regex, 'i')
+ });
+ }
+
+ return tokens;
+ };
+
+ /**
+ * Iterates over arrays and hashes.
+ *
+ * ```
+ * this.iterator(this.items, function(item, id) {
+ * // invoked for each item
+ * });
+ * ```
+ *
+ * @param {array|object} object
+ */
+ Sifter.prototype.iterator = function(object, callback) {
+ var iterator;
+ if (is_array(object)) {
+ iterator = Array.prototype.forEach || function(callback) {
+ for (var i = 0, n = this.length; i < n; i++) {
+ callback(this[i], i, this);
+ }
+ };
+ } else {
+ iterator = function(callback) {
+ for (var key in this) {
+ if (this.hasOwnProperty(key)) {
+ callback(this[key], key, this);
+ }
+ }
+ };
+ }
+
+ iterator.apply(object, [callback]);
+ };
+
+ /**
+ * Returns a function to be used to score individual results.
+ *
+ * Good matches will have a higher score than poor matches.
+ * If an item is not a match, 0 will be returned by the function.
+ *
+ * @param {object|string} search
+ * @param {object} options (optional)
+ * @returns {function}
+ */
+ Sifter.prototype.getScoreFunction = function(search, options) {
+ var self, fields, tokens, token_count, nesting;
+
+ self = this;
+ search = self.prepareSearch(search, options);
+ tokens = search.tokens;
+ fields = search.options.fields;
+ token_count = tokens.length;
+ nesting = search.options.nesting;
+
+ /**
+ * Calculates how close of a match the
+ * given value is against a search token.
+ *
+ * @param {mixed} value
+ * @param {object} token
+ * @return {number}
+ */
+ var scoreValue = function(value, token) {
+ var score, pos;
+
+ if (!value) return 0;
+ value = String(value || '');
+ pos = value.search(token.regex);
+ if (pos === -1) return 0;
+ score = token.string.length / value.length;
+ if (pos === 0) score += 0.5;
+ return score;
+ };
+
+ /**
+ * Calculates the score of an object
+ * against the search query.
+ *
+ * @param {object} token
+ * @param {object} data
+ * @return {number}
+ */
+ var scoreObject = (function() {
+ var field_count = fields.length;
+ if (!field_count) {
+ return function() { return 0; };
+ }
+ if (field_count === 1) {
+ return function(token, data) {
+ return scoreValue(getattr(data, fields[0], nesting), token);
+ };
+ }
+ return function(token, data) {
+ for (var i = 0, sum = 0; i < field_count; i++) {
+ sum += scoreValue(getattr(data, fields[i], nesting), token);
+ }
+ return sum / field_count;
+ };
+ })();
+
+ if (!token_count) {
+ return function() { return 0; };
+ }
+ if (token_count === 1) {
+ return function(data) {
+ return scoreObject(tokens[0], data);
+ };
+ }
+
+ if (search.options.conjunction === 'and') {
+ return function(data) {
+ var score;
+ for (var i = 0, sum = 0; i < token_count; i++) {
+ score = scoreObject(tokens[i], data);
+ if (score <= 0) return 0;
+ sum += score;
+ }
+ return sum / token_count;
+ };
+ } else {
+ return function(data) {
+ for (var i = 0, sum = 0; i < token_count; i++) {
+ sum += scoreObject(tokens[i], data);
+ }
+ return sum / token_count;
+ };
+ }
+ };
+
+ /**
+ * Returns a function that can be used to compare two
+ * results, for sorting purposes. If no sorting should
+ * be performed, `null` will be returned.
+ *
+ * @param {string|object} search
+ * @param {object} options
+ * @return function(a,b)
+ */
+ Sifter.prototype.getSortFunction = function(search, options) {
+ var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
+
+ self = this;
+ search = self.prepareSearch(search, options);
+ sort = (!search.query && options.sort_empty) || options.sort;
+
+ /**
+ * Fetches the specified sort field value
+ * from a search result item.
+ *
+ * @param {string} name
+ * @param {object} result
+ * @return {mixed}
+ */
+ get_field = function(name, result) {
+ if (name === '$score') return result.score;
+ return getattr(self.items[result.id], name, options.nesting);
+ };
+
+ // parse options
+ fields = [];
+ if (sort) {
+ for (i = 0, n = sort.length; i < n; i++) {
+ if (search.query || sort[i].field !== '$score') {
+ fields.push(sort[i]);
+ }
+ }
+ }
+
+ // the "$score" field is implied to be the primary
+ // sort field, unless it's manually specified
+ if (search.query) {
+ implicit_score = true;
+ for (i = 0, n = fields.length; i < n; i++) {
+ if (fields[i].field === '$score') {
+ implicit_score = false;
+ break;
+ }
+ }
+ if (implicit_score) {
+ fields.unshift({field: '$score', direction: 'desc'});
+ }
+ } else {
+ for (i = 0, n = fields.length; i < n; i++) {
+ if (fields[i].field === '$score') {
+ fields.splice(i, 1);
+ break;
+ }
+ }
+ }
+
+ multipliers = [];
+ for (i = 0, n = fields.length; i < n; i++) {
+ multipliers.push(fields[i].direction === 'desc' ? -1 : 1);
+ }
+
+ // build function
+ fields_count = fields.length;
+ if (!fields_count) {
+ return null;
+ } else if (fields_count === 1) {
+ field = fields[0].field;
+ multiplier = multipliers[0];
+ return function(a, b) {
+ return multiplier * cmp(
+ get_field(field, a),
+ get_field(field, b)
+ );
+ };
+ } else {
+ return function(a, b) {
+ var i, result, a_value, b_value, field;
+ for (i = 0; i < fields_count; i++) {
+ field = fields[i].field;
+ result = multipliers[i] * cmp(
+ get_field(field, a),
+ get_field(field, b)
+ );
+ if (result) return result;
+ }
+ return 0;
+ };
+ }
+ };
+
+ /**
+ * Parses a search query and returns an object
+ * with tokens and fields ready to be populated
+ * with results.
+ *
+ * @param {string} query
+ * @param {object} options
+ * @returns {object}
+ */
+ Sifter.prototype.prepareSearch = function(query, options) {
+ if (typeof query === 'object') return query;
+
+ options = extend({}, options);
+
+ var option_fields = options.fields;
+ var option_sort = options.sort;
+ var option_sort_empty = options.sort_empty;
+
+ if (option_fields && !is_array(option_fields)) options.fields = [option_fields];
+ if (option_sort && !is_array(option_sort)) options.sort = [option_sort];
+ if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];
+
+ return {
+ options : options,
+ query : String(query || '').toLowerCase(),
+ tokens : this.tokenize(query),
+ total : 0,
+ items : []
+ };
+ };
+
+ /**
+ * Searches through all items and returns a sorted array of matches.
+ *
+ * The `options` parameter can contain:
+ *
+ * - fields {string|array}
+ * - sort {array}
+ * - score {function}
+ * - filter {bool}
+ * - limit {integer}
+ *
+ * Returns an object containing:
+ *
+ * - options {object}
+ * - query {string}
+ * - tokens {array}
+ * - total {int}
+ * - items {array}
+ *
+ * @param {string} query
+ * @param {object} options
+ * @returns {object}
+ */
+ Sifter.prototype.search = function(query, options) {
+ var self = this, value, score, search, calculateScore;
+ var fn_sort;
+ var fn_score;
+
+ search = this.prepareSearch(query, options);
+ options = search.options;
+ query = search.query;
+
+ // generate result scoring function
+ fn_score = options.score || self.getScoreFunction(search);
+
+ // perform search and sort
+ if (query.length) {
+ self.iterator(self.items, function(item, id) {
+ score = fn_score(item);
+ if (options.filter === false || score > 0) {
+ search.items.push({'score': score, 'id': id});
+ }
+ });
+ } else {
+ self.iterator(self.items, function(item, id) {
+ search.items.push({'score': 1, 'id': id});
+ });
+ }
+
+ fn_sort = self.getSortFunction(search, options);
+ if (fn_sort) search.items.sort(fn_sort);
+
+ // apply limits
+ search.total = search.items.length;
+ if (typeof options.limit === 'number') {
+ search.items = search.items.slice(0, options.limit);
+ }
+
+ return search;
+ };
+
+ // utilities
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ var cmp = function(a, b) {
+ if (typeof a === 'number' && typeof b === 'number') {
+ return a > b ? 1 : (a < b ? -1 : 0);
+ }
+ a = asciifold(String(a || ''));
+ b = asciifold(String(b || ''));
+ if (a > b) return 1;
+ if (b > a) return -1;
+ return 0;
+ };
+
+ var extend = function(a, b) {
+ var i, n, k, object;
+ for (i = 1, n = arguments.length; i < n; i++) {
+ object = arguments[i];
+ if (!object) continue;
+ for (k in object) {
+ if (object.hasOwnProperty(k)) {
+ a[k] = object[k];
+ }
+ }
+ }
+ return a;
+ };
+
+ /**
+ * A property getter resolving dot-notation
+ * @param {Object} obj The root object to fetch property on
+ * @param {String} name The optionally dotted property name to fetch
+ * @param {Boolean} nesting Handle nesting or not
+ * @return {Object} The resolved property value
+ */
+ var getattr = function(obj, name, nesting) {
+ if (!obj || !name) return;
+ if (!nesting) return obj[name];
+ var names = name.split(".");
+ while(names.length && (obj = obj[names.shift()]));
+ return obj;
+ };
+
+ var trim = function(str) {
+ return (str + '').replace(/^\s+|\s+$|/g, '');
+ };
+
+ var escape_regex = function(str) {
+ return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
+ };
+
+ var is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) {
+ return Object.prototype.toString.call(object) === '[object Array]';
+ };
+
+ var DIACRITICS = {
+ 'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',
+ 'b': '[b␢βΒB฿𐌁ᛒ]',
+ 'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄCc]',
+ 'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅDdð]',
+ 'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇEeɘǝƏƐε]',
+ 'f': '[fƑƒḞḟ]',
+ 'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',
+ 'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',
+ 'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪIi]',
+ 'j': '[jȷĴĵɈɉʝɟʲ]',
+ 'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',
+ 'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟLl]',
+ 'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴNnŊŋ]',
+ 'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',
+ 'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',
+ 'q': '[qꝖꝗʠɊɋꝘꝙq̃]',
+ 'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',
+ 's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',
+ 't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',
+ 'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',
+ 'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',
+ 'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',
+ 'x': '[xẌẍẊẋχ]',
+ 'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',
+ 'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'
+ };
+
+ var asciifold = (function() {
+ var i, n, k, chunk;
+ var foreignletters = '';
+ var lookup = {};
+ for (k in DIACRITICS) {
+ if (DIACRITICS.hasOwnProperty(k)) {
+ chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);
+ foreignletters += chunk;
+ for (i = 0, n = chunk.length; i < n; i++) {
+ lookup[chunk.charAt(i)] = k;
+ }
+ }
+ }
+ var regexp = new RegExp('[' + foreignletters + ']', 'g');
+ return function(str) {
+ return str.replace(regexp, function(foreignletter) {
+ return lookup[foreignletter];
+ }).toLowerCase();
+ };
+ })();
+
+
+ // export
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ return Sifter;
+}));
+
+
+},{}],313:[function(require,module,exports){
+/*
+Slick Finder
+*/"use strict"
+
+// Notable changes from Slick.Finder 1.0.x
+
+// faster bottom -> up expression matching
+// prefers mental sanity over *obsessive compulsive* milliseconds savings
+// uses prototypes instead of objects
+// tries to use matchesSelector smartly, whenever available
+// can populate objects as well as arrays
+// lots of stuff is broken or not implemented
+
+var parse = require("./parser")
+
+// utilities
+
+var index = 0,
+ counter = document.__counter = (parseInt(document.__counter || -1, 36) + 1).toString(36),
+ key = "uid:" + counter
+
+var uniqueID = function(n, xml){
+ if (n === window) return "window"
+ if (n === document) return "document"
+ if (n === document.documentElement) return "html"
+
+ if (xml) {
+ var uid = n.getAttribute(key)
+ if (!uid) {
+ uid = (index++).toString(36)
+ n.setAttribute(key, uid)
+ }
+ return uid
+ } else {
+ return n[key] || (n[key] = (index++).toString(36))
+ }
+}
+
+var uniqueIDXML = function(n) {
+ return uniqueID(n, true)
+}
+
+var isArray = Array.isArray || function(object){
+ return Object.prototype.toString.call(object) === "[object Array]"
+}
+
+// tests
+
+var uniqueIndex = 0;
+
+var HAS = {
+
+ GET_ELEMENT_BY_ID: function(test, id){
+ id = "slick_" + (uniqueIndex++);
+ // checks if the document has getElementById, and it works
+ test.innerHTML = ''
+ return !!this.getElementById(id)
+ },
+
+ QUERY_SELECTOR: function(test){
+ // this supposedly fixes a webkit bug with matchesSelector / querySelector & nth-child
+ test.innerHTML = '_'
+
+ // checks if the document has querySelectorAll, and it works
+ test.innerHTML = ''
+
+ return test.querySelectorAll('.MiX').length === 1
+ },
+
+ EXPANDOS: function(test, id){
+ id = "slick_" + (uniqueIndex++);
+ // checks if the document has elements that support expandos
+ test._custom_property_ = id
+ return test._custom_property_ === id
+ },
+
+ // TODO: use this ?
+
+ // CHECKED_QUERY_SELECTOR: function(test){
+ //
+ // // checks if the document supports the checked query selector
+ // test.innerHTML = ''
+ // return test.querySelectorAll(':checked').length === 1
+ // },
+
+ // TODO: use this ?
+
+ // EMPTY_ATTRIBUTE_QUERY_SELECTOR: function(test){
+ //
+ // // checks if the document supports the empty attribute query selector
+ // test.innerHTML = ''
+ // return test.querySelectorAll('[class*=""]').length === 1
+ // },
+
+ MATCHES_SELECTOR: function(test){
+
+ test.className = "MiX"
+
+ // checks if the document has matchesSelector, and we can use it.
+
+ var matches = test.matchesSelector || test.mozMatchesSelector || test.webkitMatchesSelector
+
+ // if matchesSelector trows errors on incorrect syntax we can use it
+ if (matches) try {
+ matches.call(test, ':slick')
+ } catch(e){
+ // just as a safety precaution, also test if it works on mixedcase (like querySelectorAll)
+ return matches.call(test, ".MiX") ? matches : false
+ }
+
+ return false
+ },
+
+ GET_ELEMENTS_BY_CLASS_NAME: function(test){
+ test.innerHTML = ''
+ if (test.getElementsByClassName('b').length !== 1) return false
+
+ test.firstChild.className = 'b'
+ if (test.getElementsByClassName('b').length !== 2) return false
+
+ // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one
+ test.innerHTML = ''
+ if (test.getElementsByClassName('a').length !== 2) return false
+
+ // tests passed
+ return true
+ },
+
+ // no need to know
+
+ // GET_ELEMENT_BY_ID_NOT_NAME: function(test, id){
+ // test.innerHTML = ''
+ // return this.getElementById(id) !== test.firstChild
+ // },
+
+ // this is always checked for and fixed
+
+ // STAR_GET_ELEMENTS_BY_TAG_NAME: function(test){
+ //
+ // // IE returns comment nodes for getElementsByTagName('*') for some documents
+ // test.appendChild(this.createComment(''))
+ // if (test.getElementsByTagName('*').length > 0) return false
+ //
+ // // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents
+ // test.innerHTML = 'foo'
+ // if (test.getElementsByTagName('*').length) return false
+ //
+ // // tests passed
+ // return true
+ // },
+
+ // this is always checked for and fixed
+
+ // STAR_QUERY_SELECTOR: function(test){
+ //
+ // // returns closed nodes (EG:"") for querySelector('*') for some documents
+ // test.innerHTML = 'foo'
+ // return !!(test.querySelectorAll('*').length)
+ // },
+
+ GET_ATTRIBUTE: function(test){
+ // tests for working getAttribute implementation
+ var shout = "fus ro dah"
+ test.innerHTML = ''
+ return test.firstChild.getAttribute('class') === shout
+ }
+
+}
+
+// Finder
+
+var Finder = function Finder(document){
+
+ this.document = document
+ var root = this.root = document.documentElement
+ this.tested = {}
+
+ // uniqueID
+
+ this.uniqueID = this.has("EXPANDOS") ? uniqueID : uniqueIDXML
+
+ // getAttribute
+
+ this.getAttribute = (this.has("GET_ATTRIBUTE")) ? function(node, name){
+
+ return node.getAttribute(name)
+
+ } : function(node, name){
+
+ node = node.getAttributeNode(name)
+ return (node && node.specified) ? node.value : null
+
+ }
+
+ // hasAttribute
+
+ this.hasAttribute = (root.hasAttribute) ? function(node, attribute){
+
+ return node.hasAttribute(attribute)
+
+ } : function(node, attribute) {
+
+ node = node.getAttributeNode(attribute)
+ return !!(node && node.specified)
+
+ }
+
+ // contains
+
+ this.contains = (document.contains && root.contains) ? function(context, node){
+
+ return context.contains(node)
+
+ } : (root.compareDocumentPosition) ? function(context, node){
+
+ return context === node || !!(context.compareDocumentPosition(node) & 16)
+
+ } : function(context, node){
+
+ do {
+ if (node === context) return true
+ } while ((node = node.parentNode))
+
+ return false
+ }
+
+ // sort
+ // credits to Sizzle (http://sizzlejs.com/)
+
+ this.sorter = (root.compareDocumentPosition) ? function(a, b){
+
+ if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0
+ return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1
+
+ } : ('sourceIndex' in root) ? function(a, b){
+
+ if (!a.sourceIndex || !b.sourceIndex) return 0
+ return a.sourceIndex - b.sourceIndex
+
+ } : (document.createRange) ? function(a, b){
+
+ if (!a.ownerDocument || !b.ownerDocument) return 0
+ var aRange = a.ownerDocument.createRange(),
+ bRange = b.ownerDocument.createRange()
+
+ aRange.setStart(a, 0)
+ aRange.setEnd(a, 0)
+ bRange.setStart(b, 0)
+ bRange.setEnd(b, 0)
+ return aRange.compareBoundaryPoints(Range.START_TO_END, bRange)
+
+ } : null
+
+ this.failed = {}
+
+ var nativeMatches = this.has("MATCHES_SELECTOR")
+
+ if (nativeMatches) this.matchesSelector = function(node, expression){
+
+ if (this.failed[expression]) return null
+
+ try {
+ return nativeMatches.call(node, expression)
+ } catch(e){
+ if (slick.debug) console.warn("matchesSelector failed on " + expression)
+ this.failed[expression] = true
+ return null
+ }
+
+ }
+
+ if (this.has("QUERY_SELECTOR")){
+
+ this.querySelectorAll = function(node, expression){
+
+ if (this.failed[expression]) return true
+
+ var result, _id, _expression, _combinator, _node
+
+
+ // non-document rooted QSA
+ // credits to Andrew Dupont
+
+ if (node !== this.document){
+
+ _combinator = expression[0].combinator
+
+ _id = node.getAttribute("id")
+ _expression = expression
+
+ if (!_id){
+ _node = node
+ _id = "__slick__"
+ _node.setAttribute("id", _id)
+ }
+
+ expression = "#" + _id + " " + _expression
+
+
+ // these combinators need a parentNode due to how querySelectorAll works, which is:
+ // finding all the elements that match the given selector
+ // then filtering by the ones that have the specified element as an ancestor
+ if (_combinator.indexOf("~") > -1 || _combinator.indexOf("+") > -1){
+
+ node = node.parentNode
+ if (!node) result = true
+ // if node has no parentNode, we return "true" as if it failed, without polluting the failed cache
+
+ }
+
+ }
+
+ if (!result) try {
+ result = node.querySelectorAll(expression.toString())
+ } catch(e){
+ if (slick.debug) console.warn("querySelectorAll failed on " + (_expression || expression))
+ result = this.failed[_expression || expression] = true
+ }
+
+ if (_node) _node.removeAttribute("id")
+
+ return result
+
+ }
+
+ }
+
+}
+
+Finder.prototype.has = function(FEATURE){
+
+ var tested = this.tested,
+ testedFEATURE = tested[FEATURE]
+
+ if (testedFEATURE != null) return testedFEATURE
+
+ var root = this.root,
+ document = this.document,
+ testNode = document.createElement("div")
+
+ testNode.setAttribute("style", "display: none;")
+
+ root.appendChild(testNode)
+
+ var TEST = HAS[FEATURE], result = false
+
+ if (TEST) try {
+ result = TEST.call(document, testNode)
+ } catch(e){}
+
+ if (slick.debug && !result) console.warn("document has no " + FEATURE)
+
+ root.removeChild(testNode)
+
+ return tested[FEATURE] = result
+
+}
+
+var combinators = {
+
+ " ": function(node, part, push){
+
+ var item, items
+
+ var noId = !part.id, noTag = !part.tag, noClass = !part.classes
+
+ if (part.id && node.getElementById && this.has("GET_ELEMENT_BY_ID")){
+ item = node.getElementById(part.id)
+
+ // return only if id is found, else keep checking
+ // might be a tad slower on non-existing ids, but less insane
+
+ if (item && item.getAttribute('id') === part.id){
+ items = [item]
+ noId = true
+ // if tag is star, no need to check it in match()
+ if (part.tag === "*") noTag = true
+ }
+ }
+
+ if (!items){
+
+ if (part.classes && node.getElementsByClassName && this.has("GET_ELEMENTS_BY_CLASS_NAME")){
+ items = node.getElementsByClassName(part.classList)
+ noClass = true
+ // if tag is star, no need to check it in match()
+ if (part.tag === "*") noTag = true
+ } else {
+ items = node.getElementsByTagName(part.tag)
+ // if tag is star, need to check it in match because it could select junk, boho
+ if (part.tag !== "*") noTag = true
+ }
+
+ if (!items || !items.length) return false
+
+ }
+
+ for (var i = 0; item = items[i++];)
+ if ((noTag && noId && noClass && !part.attributes && !part.pseudos) || this.match(item, part, noTag, noId, noClass))
+ push(item)
+
+ return true
+
+ },
+
+ ">": function(node, part, push){ // direct children
+ if ((node = node.firstChild)) do {
+ if (node.nodeType == 1 && this.match(node, part)) push(node)
+ } while ((node = node.nextSibling))
+ },
+
+ "+": function(node, part, push){ // next sibling
+ while ((node = node.nextSibling)) if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ break
+ }
+ },
+
+ "^": function(node, part, push){ // first child
+ node = node.firstChild
+ if (node){
+ if (node.nodeType === 1){
+ if (this.match(node, part)) push(node)
+ } else {
+ combinators['+'].call(this, node, part, push)
+ }
+ }
+ },
+
+ "~": function(node, part, push){ // next siblings
+ while ((node = node.nextSibling)){
+ if (node.nodeType === 1 && this.match(node, part)) push(node)
+ }
+ },
+
+ "++": function(node, part, push){ // next sibling and previous sibling
+ combinators['+'].call(this, node, part, push)
+ combinators['!+'].call(this, node, part, push)
+ },
+
+ "~~": function(node, part, push){ // next siblings and previous siblings
+ combinators['~'].call(this, node, part, push)
+ combinators['!~'].call(this, node, part, push)
+ },
+
+ "!": function(node, part, push){ // all parent nodes up to document
+ while ((node = node.parentNode)) if (node !== this.document && this.match(node, part)) push(node)
+ },
+
+ "!>": function(node, part, push){ // direct parent (one level)
+ node = node.parentNode
+ if (node !== this.document && this.match(node, part)) push(node)
+ },
+
+ "!+": function(node, part, push){ // previous sibling
+ while ((node = node.previousSibling)) if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ break
+ }
+ },
+
+ "!^": function(node, part, push){ // last child
+ node = node.lastChild
+ if (node){
+ if (node.nodeType == 1){
+ if (this.match(node, part)) push(node)
+ } else {
+ combinators['!+'].call(this, node, part, push)
+ }
+ }
+ },
+
+ "!~": function(node, part, push){ // previous siblings
+ while ((node = node.previousSibling)){
+ if (node.nodeType === 1 && this.match(node, part)) push(node)
+ }
+ }
+
+}
+
+Finder.prototype.search = function(context, expression, found){
+
+ if (!context) context = this.document
+ else if (!context.nodeType && context.document) context = context.document
+
+ var expressions = parse(expression)
+
+ // no expressions were parsed. todo: is this really necessary?
+ if (!expressions || !expressions.length) throw new Error("invalid expression")
+
+ if (!found) found = []
+
+ var uniques, push = isArray(found) ? function(node){
+ found[found.length] = node
+ } : function(node){
+ found[found.length++] = node
+ }
+
+ // if there is more than one expression we need to check for duplicates when we push to found
+ // this simply saves the old push and wraps it around an uid dupe check.
+ if (expressions.length > 1){
+ uniques = {}
+ var plush = push
+ push = function(node){
+ var uid = uniqueID(node)
+ if (!uniques[uid]){
+ uniques[uid] = true
+ plush(node)
+ }
+ }
+ }
+
+ // walker
+
+ var node, nodes, part
+
+ main: for (var i = 0; expression = expressions[i++];){
+
+ // querySelector
+
+ // TODO: more functional tests
+
+ // if there is querySelectorAll (and the expression does not fail) use it.
+ if (!slick.noQSA && this.querySelectorAll){
+
+ nodes = this.querySelectorAll(context, expression)
+ if (nodes !== true){
+ if (nodes && nodes.length) for (var j = 0; node = nodes[j++];) if (node.nodeName > '@'){
+ push(node)
+ }
+ continue main
+ }
+ }
+
+ // if there is only one part in the expression we don't need to check each part for duplicates.
+ // todo: this might be too naive. while solid, there can be expression sequences that do not
+ // produce duplicates. "body div" for instance, can never give you each div more than once.
+ // "body div a" on the other hand might.
+ if (expression.length === 1){
+
+ part = expression[0]
+ combinators[part.combinator].call(this, context, part, push)
+
+ } else {
+
+ var cs = [context], c, f, u, p = function(node){
+ var uid = uniqueID(node)
+ if (!u[uid]){
+ u[uid] = true
+ f[f.length] = node
+ }
+ }
+
+ // loop the expression parts
+ for (var j = 0; part = expression[j++];){
+ f = []; u = {}
+ // loop the contexts
+ for (var k = 0; c = cs[k++];) combinators[part.combinator].call(this, c, part, p)
+ // nothing was found, the expression failed, continue to the next expression.
+ if (!f.length) continue main
+ cs = f // set the contexts for future parts (if any)
+ }
+
+ if (i === 0) found = f // first expression. directly set found.
+ else for (var l = 0; l < f.length; l++) push(f[l]) // any other expression needs to push to found.
+ }
+
+ }
+
+ if (uniques && found && found.length > 1) this.sort(found)
+
+ return found
+
+}
+
+Finder.prototype.sort = function(nodes){
+ return this.sorter ? Array.prototype.sort.call(nodes, this.sorter) : nodes
+}
+
+// TODO: most of these pseudo selectors include and qsa doesnt. fixme.
+
+var pseudos = {
+
+
+ // TODO: returns different results than qsa empty.
+
+ 'empty': function(){
+ return !(this && this.nodeType === 1) && !(this.innerText || this.textContent || '').length
+ },
+
+ 'not': function(expression){
+ return !slick.matches(this, expression)
+ },
+
+ 'contains': function(text){
+ return (this.innerText || this.textContent || '').indexOf(text) > -1
+ },
+
+ 'first-child': function(){
+ var node = this
+ while ((node = node.previousSibling)) if (node.nodeType == 1) return false
+ return true
+ },
+
+ 'last-child': function(){
+ var node = this
+ while ((node = node.nextSibling)) if (node.nodeType == 1) return false
+ return true
+ },
+
+ 'only-child': function(){
+ var prev = this
+ while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false
+
+ var next = this
+ while ((next = next.nextSibling)) if (next.nodeType == 1) return false
+
+ return true
+ },
+
+ 'first-of-type': function(){
+ var node = this, nodeName = node.nodeName
+ while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false
+ return true
+ },
+
+ 'last-of-type': function(){
+ var node = this, nodeName = node.nodeName
+ while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false
+ return true
+ },
+
+ 'only-of-type': function(){
+ var prev = this, nodeName = this.nodeName
+ while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false
+ var next = this
+ while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false
+ return true
+ },
+
+ 'enabled': function(){
+ return !this.disabled
+ },
+
+ 'disabled': function(){
+ return this.disabled
+ },
+
+ 'checked': function(){
+ return this.checked || this.selected
+ },
+
+ 'selected': function(){
+ return this.selected
+ },
+
+ 'focus': function(){
+ var doc = this.ownerDocument
+ return doc.activeElement === this && (this.href || this.type || slick.hasAttribute(this, 'tabindex'))
+ },
+
+ 'root': function(){
+ return (this === this.ownerDocument.documentElement)
+ }
+
+}
+
+Finder.prototype.match = function(node, bit, noTag, noId, noClass){
+
+ // TODO: more functional tests ?
+
+ if (!slick.noQSA && this.matchesSelector){
+ var matches = this.matchesSelector(node, bit)
+ if (matches !== null) return matches
+ }
+
+ // normal matching
+
+ if (!noTag && bit.tag){
+
+ var nodeName = node.nodeName.toLowerCase()
+ if (bit.tag === "*"){
+ if (nodeName < "@") return false
+ } else if (nodeName != bit.tag){
+ return false
+ }
+
+ }
+
+ if (!noId && bit.id && node.getAttribute('id') !== bit.id) return false
+
+ var i, part
+
+ if (!noClass && bit.classes){
+
+ var className = this.getAttribute(node, "class")
+ if (!className) return false
+
+ for (part in bit.classes) if (!RegExp('(^|\\s)' + bit.classes[part] + '(\\s|$)').test(className)) return false
+ }
+
+ var name, value
+
+ if (bit.attributes) for (i = 0; part = bit.attributes[i++];){
+
+ var operator = part.operator,
+ escaped = part.escapedValue
+
+ name = part.name
+ value = part.value
+
+ if (!operator){
+
+ if (!this.hasAttribute(node, name)) return false
+
+ } else {
+
+ var actual = this.getAttribute(node, name)
+ if (actual == null) return false
+
+ switch (operator){
+ case '^=' : if (!RegExp( '^' + escaped ).test(actual)) return false; break
+ case '$=' : if (!RegExp( escaped + '$' ).test(actual)) return false; break
+ case '~=' : if (!RegExp('(^|\\s)' + escaped + '(\\s|$)').test(actual)) return false; break
+ case '|=' : if (!RegExp( '^' + escaped + '(-|$)' ).test(actual)) return false; break
+
+ case '=' : if (actual !== value) return false; break
+ case '*=' : if (actual.indexOf(value) === -1) return false; break
+ default : return false
+ }
+
+ }
+ }
+
+ if (bit.pseudos) for (i = 0; part = bit.pseudos[i++];){
+
+ name = part.name
+ value = part.value
+
+ if (pseudos[name]) return pseudos[name].call(node, value)
+
+ if (value != null){
+ if (this.getAttribute(node, name) !== value) return false
+ } else {
+ if (!this.hasAttribute(node, name)) return false
+ }
+
+ }
+
+ return true
+
+}
+
+Finder.prototype.matches = function(node, expression){
+
+ var expressions = parse(expression)
+
+ if (expressions.length === 1 && expressions[0].length === 1){ // simplest match
+ return this.match(node, expressions[0][0])
+ }
+
+ // TODO: more functional tests ?
+
+ if (!slick.noQSA && this.matchesSelector){
+ var matches = this.matchesSelector(node, expressions)
+ if (matches !== null) return matches
+ }
+
+ var nodes = this.search(this.document, expression, {length: 0})
+
+ for (var i = 0, res; res = nodes[i++];) if (node === res) return true
+ return false
+
+}
+
+var finders = {}
+
+var finder = function(context){
+ var doc = context || document
+ if (doc.ownerDocument) doc = doc.ownerDocument
+ else if (doc.document) doc = doc.document
+
+ if (doc.nodeType !== 9) throw new TypeError("invalid document")
+
+ var uid = uniqueID(doc)
+ return finders[uid] || (finders[uid] = new Finder(doc))
+}
+
+// ... API ...
+
+var slick = function(expression, context){
+ return slick.search(expression, context)
+}
+
+slick.search = function(expression, context, found){
+ return finder(context).search(context, expression, found)
+}
+
+slick.find = function(expression, context){
+ return finder(context).search(context, expression)[0] || null
+}
+
+slick.getAttribute = function(node, name){
+ return finder(node).getAttribute(node, name)
+}
+
+slick.hasAttribute = function(node, name){
+ return finder(node).hasAttribute(node, name)
+}
+
+slick.contains = function(context, node){
+ return finder(context).contains(context, node)
+}
+
+slick.matches = function(node, expression){
+ return finder(node).matches(node, expression)
+}
+
+slick.sort = function(nodes){
+ if (nodes && nodes.length > 1) finder(nodes[0]).sort(nodes)
+ return nodes
+}
+
+slick.parse = parse;
+
+// slick.debug = true
+// slick.noQSA = true
+
+module.exports = slick
+
+},{"./parser":315}],314:[function(require,module,exports){
+(function (global){(function (){
+/*
+slick
+*/"use strict"
+
+module.exports = "document" in global ? require("./finder") : { parse: require("./parser") }
+
+}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+
+},{"./finder":313,"./parser":315}],315:[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* ( + ) \\s* # Combinator \n\
+ | ( \\s+ ) # CombinatorChildren \n\
+ | ( + | \\* ) # Tag \n\
+ | \\# ( + ) # ID \n\
+ | \\. ( + ) # ClassName \n\
+ | # Attribute \n\
+ \\[ \
+ \\s* (+) (?: \
+ \\s* ([*^$!~|]?=) (?: \
+ \\s* (?:\
+ ([\"']?)(.*?)\\9 \
+ )\
+ ) \
+ )? \\s* \
+ \\](?!\\]) \n\
+ | :+ ( + )(?:\
+ \\( (?:\
+ (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\
+ ) \\)\
+ )?\
+ )"
+*/
+"^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)"
+ .replace(//, '[' + escape(">+~`!@$%^&={}\\;") + ']')
+ .replace(//g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])')
+ .replace(//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
+
+},{}],316:[function(require,module,exports){
+/**!
+ * Sortable
+ * @author RubaXa
+ * @license MIT
+ */
+
+
+(function (factory) {
+ "use strict";
+
+ if (typeof define === "function" && define.amd) {
+ define(factory);
+ }
+ else if (typeof module != "undefined" && typeof module.exports != "undefined") {
+ module.exports = factory();
+ }
+ else if (typeof Package !== "undefined") {
+ Sortable = factory(); // export for Meteor.js
+ }
+ else {
+ /* jshint sub:true */
+ window["Sortable"] = factory();
+ }
+})(function () {
+ "use strict";
+
+ if (typeof window == "undefined" || typeof window.document == "undefined") {
+ return function() {
+ throw new Error( "Sortable.js requires a window with a document" );
+ }
+ }
+
+ var dragEl,
+ parentEl,
+ ghostEl,
+ cloneEl,
+ rootEl,
+ nextEl,
+
+ scrollEl,
+ scrollParentEl,
+
+ lastEl,
+ lastCSS,
+ lastParentCSS,
+
+ oldIndex,
+ newIndex,
+
+ activeGroup,
+ autoScroll = {},
+
+ tapEvt,
+ touchEvt,
+
+ moved,
+
+ /** @const */
+ RSPACE = /\s+/g,
+
+ expando = 'Sortable' + (new Date).getTime(),
+
+ win = window,
+ document = win.document,
+ parseInt = win.parseInt,
+
+ supportDraggable = !!('draggable' in document.createElement('div')),
+ supportCssPointerEvents = (function (el) {
+ el = document.createElement('x');
+ el.style.cssText = 'pointer-events:auto';
+ return el.style.pointerEvents === 'auto';
+ })(),
+
+ _silent = false,
+
+ abs = Math.abs,
+ slice = [].slice,
+
+ touchDragOverListeners = [],
+
+ _autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
+ if (rootEl && options.scroll) {
+ var el,
+ rect,
+ sens = options.scrollSensitivity,
+ speed = options.scrollSpeed,
+
+ x = evt.clientX,
+ y = evt.clientY,
+
+ winWidth = window.innerWidth,
+ winHeight = window.innerHeight,
+
+ vx,
+ vy
+ ;
+
+ // Delect scrollEl
+ if (scrollParentEl !== rootEl) {
+ scrollEl = options.scroll;
+ scrollParentEl = rootEl;
+
+ if (scrollEl === true) {
+ scrollEl = rootEl;
+
+ do {
+ if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
+ (scrollEl.offsetHeight < scrollEl.scrollHeight)
+ ) {
+ break;
+ }
+ /* jshint boss:true */
+ } while (scrollEl = scrollEl.parentNode);
+ }
+ }
+
+ if (scrollEl) {
+ el = scrollEl;
+ rect = scrollEl.getBoundingClientRect();
+ vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
+ vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
+ }
+
+
+ if (!(vx || vy)) {
+ vx = (winWidth - x <= sens) - (x <= sens);
+ vy = (winHeight - y <= sens) - (y <= sens);
+
+ /* jshint expr:true */
+ (vx || vy) && (el = win);
+ }
+
+
+ if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
+ autoScroll.el = el;
+ autoScroll.vx = vx;
+ autoScroll.vy = vy;
+
+ clearInterval(autoScroll.pid);
+
+ if (el) {
+ autoScroll.pid = setInterval(function () {
+ if (el === win) {
+ win.scrollTo(win.pageXOffset + vx * speed, win.pageYOffset + vy * speed);
+ } else {
+ vy && (el.scrollTop += vy * speed);
+ vx && (el.scrollLeft += vx * speed);
+ }
+ }, 24);
+ }
+ }
+ }
+ }, 30),
+
+ _prepareGroup = function (options) {
+ var group = options.group;
+
+ if (!group || typeof group != 'object') {
+ group = options.group = {name: group};
+ }
+
+ ['pull', 'put'].forEach(function (key) {
+ if (!(key in group)) {
+ group[key] = true;
+ }
+ });
+
+ options.groups = ' ' + group.name + (group.put.join ? ' ' + group.put.join(' ') : '') + ' ';
+ }
+ ;
+
+
+
+ /**
+ * @class Sortable
+ * @param {HTMLElement} el
+ * @param {Object} [options]
+ */
+ function Sortable(el, options) {
+ if (!(el && el.nodeType && el.nodeType === 1)) {
+ throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
+ }
+
+ this.el = el; // root element
+ this.options = options = _extend({}, options);
+
+
+ // Export instance
+ el[expando] = this;
+
+
+ // Default options
+ var defaults = {
+ group: Math.random(),
+ sort: true,
+ disabled: false,
+ store: null,
+ handle: null,
+ scroll: true,
+ scrollSensitivity: 30,
+ scrollSpeed: 10,
+ draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
+ ghostClass: 'sortable-ghost',
+ chosenClass: 'sortable-chosen',
+ ignore: 'a, img',
+ filter: null,
+ animation: 0,
+ setData: function (dataTransfer, dragEl) {
+ dataTransfer.setData('Text', dragEl.textContent);
+ },
+ dropBubble: false,
+ dragoverBubble: false,
+ dataIdAttr: 'data-id',
+ delay: 0,
+ forceFallback: false,
+ fallbackClass: 'sortable-fallback',
+ fallbackOnBody: false
+ };
+
+
+ // Set default options
+ for (var name in defaults) {
+ !(name in options) && (options[name] = defaults[name]);
+ }
+
+ _prepareGroup(options);
+
+ // Bind all private methods
+ for (var fn in this) {
+ if (fn.charAt(0) === '_') {
+ this[fn] = this[fn].bind(this);
+ }
+ }
+
+ // Setup drag mode
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
+
+ // Bind events
+ _on(el, 'mousedown', this._onTapStart);
+ _on(el, 'touchstart', this._onTapStart);
+
+ if (this.nativeDraggable) {
+ _on(el, 'dragover', this);
+ _on(el, 'dragenter', this);
+ }
+
+ touchDragOverListeners.push(this._onDragOver);
+
+ // Restore sorting
+ options.store && this.sort(options.store.get(this));
+ }
+
+
+ Sortable.prototype = /** @lends Sortable.prototype */ {
+ constructor: Sortable,
+
+ _onTapStart: function (/** Event|TouchEvent */evt) {
+ var _this = this,
+ el = this.el,
+ options = this.options,
+ type = evt.type,
+ touch = evt.touches && evt.touches[0],
+ target = (touch || evt).target,
+ originalTarget = target,
+ filter = options.filter;
+
+
+ if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
+ return; // only left button or enabled
+ }
+
+ target = _closest(target, options.draggable, el);
+
+ if (!target) {
+ return;
+ }
+
+ // get the index of the dragged element within its parent
+ oldIndex = _index(target, options.draggable);
+
+ // Check filter
+ if (typeof filter === 'function') {
+ if (filter.call(this, evt, target, this)) {
+ _dispatchEvent(_this, originalTarget, 'filter', target, el, oldIndex);
+ evt.preventDefault();
+ return; // cancel dnd
+ }
+ }
+ else if (filter) {
+ filter = filter.split(',').some(function (criteria) {
+ criteria = _closest(originalTarget, criteria.trim(), el);
+
+ if (criteria) {
+ _dispatchEvent(_this, criteria, 'filter', target, el, oldIndex);
+ return true;
+ }
+ });
+
+ if (filter) {
+ evt.preventDefault();
+ return; // cancel dnd
+ }
+ }
+
+
+ if (options.handle && !_closest(originalTarget, options.handle, el)) {
+ return;
+ }
+
+
+ // Prepare `dragstart`
+ this._prepareDragStart(evt, touch, target);
+ },
+
+ _prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target) {
+ var _this = this,
+ el = _this.el,
+ options = _this.options,
+ ownerDocument = el.ownerDocument,
+ dragStartFn;
+
+ if (target && !dragEl && (target.parentNode === el)) {
+ tapEvt = evt;
+
+ rootEl = el;
+ dragEl = target;
+ parentEl = dragEl.parentNode;
+ nextEl = dragEl.nextSibling;
+ activeGroup = options.group;
+
+ dragStartFn = function () {
+ // Delayed drag has been triggered
+ // we can re-enable the events: touchmove/mousemove
+ _this._disableDelayedDrag();
+
+ // Make the element draggable
+ dragEl.draggable = true;
+
+ // Chosen item
+ _toggleClass(dragEl, _this.options.chosenClass, true);
+
+ // Bind the events: dragstart/dragend
+ _this._triggerDragStart(touch);
+ };
+
+ // Disable "draggable"
+ options.ignore.split(',').forEach(function (criteria) {
+ _find(dragEl, criteria.trim(), _disableDraggable);
+ });
+
+ _on(ownerDocument, 'mouseup', _this._onDrop);
+ _on(ownerDocument, 'touchend', _this._onDrop);
+ _on(ownerDocument, 'touchcancel', _this._onDrop);
+
+ if (options.delay) {
+ // If the user moves the pointer or let go the click or touch
+ // before the delay has been reached:
+ // disable the delayed drag
+ _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
+ _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
+ _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
+ _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
+ _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
+
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
+ } else {
+ dragStartFn();
+ }
+ }
+ },
+
+ _disableDelayedDrag: function () {
+ var ownerDocument = this.el.ownerDocument;
+
+ clearTimeout(this._dragStartTimer);
+ _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
+ _off(ownerDocument, 'touchend', this._disableDelayedDrag);
+ _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
+ _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
+ _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
+ },
+
+ _triggerDragStart: function (/** Touch */touch) {
+ if (touch) {
+ // Touch device support
+ tapEvt = {
+ target: dragEl,
+ clientX: touch.clientX,
+ clientY: touch.clientY
+ };
+
+ this._onDragStart(tapEvt, 'touch');
+ }
+ else if (!this.nativeDraggable) {
+ this._onDragStart(tapEvt, true);
+ }
+ else {
+ _on(dragEl, 'dragend', this);
+ _on(rootEl, 'dragstart', this._onDragStart);
+ }
+
+ try {
+ if (document.selection) {
+ document.selection.empty();
+ } else {
+ window.getSelection().removeAllRanges();
+ }
+ } catch (err) {
+ }
+ },
+
+ _dragStarted: function () {
+ if (rootEl && dragEl) {
+ // Apply effect
+ _toggleClass(dragEl, this.options.ghostClass, true);
+
+ Sortable.active = this;
+
+ // Drag start event
+ _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
+ }
+ },
+
+ _emulateDragOver: function () {
+ if (touchEvt) {
+ if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
+ return;
+ }
+
+ this._lastX = touchEvt.clientX;
+ this._lastY = touchEvt.clientY;
+
+ if (!supportCssPointerEvents) {
+ _css(ghostEl, 'display', 'none');
+ }
+
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
+ parent = target,
+ groupName = ' ' + this.options.group.name + '',
+ i = touchDragOverListeners.length;
+
+ if (parent) {
+ do {
+ if (parent[expando] && parent[expando].options.groups.indexOf(groupName) > -1) {
+ while (i--) {
+ touchDragOverListeners[i]({
+ clientX: touchEvt.clientX,
+ clientY: touchEvt.clientY,
+ target: target,
+ rootEl: parent
+ });
+ }
+
+ break;
+ }
+
+ target = parent; // store last element
+ }
+ /* jshint boss:true */
+ while (parent = parent.parentNode);
+ }
+
+ if (!supportCssPointerEvents) {
+ _css(ghostEl, 'display', '');
+ }
+ }
+ },
+
+
+ _onTouchMove: function (/**TouchEvent*/evt) {
+ if (tapEvt) {
+ // only set the status to dragging, when we are actually dragging
+ if (!Sortable.active) {
+ this._dragStarted();
+ }
+
+ // as well as creating the ghost element on the document body
+ this._appendGhost();
+
+ var touch = evt.touches ? evt.touches[0] : evt,
+ dx = touch.clientX - tapEvt.clientX,
+ dy = touch.clientY - tapEvt.clientY,
+ translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
+
+ moved = true;
+ touchEvt = touch;
+
+ _css(ghostEl, 'webkitTransform', translate3d);
+ _css(ghostEl, 'mozTransform', translate3d);
+ _css(ghostEl, 'msTransform', translate3d);
+ _css(ghostEl, 'transform', translate3d);
+
+ evt.preventDefault();
+ }
+ },
+
+ _appendGhost: function () {
+ if (!ghostEl) {
+ var rect = dragEl.getBoundingClientRect(),
+ css = _css(dragEl),
+ options = this.options,
+ ghostRect;
+
+ ghostEl = dragEl.cloneNode(true);
+
+ _toggleClass(ghostEl, options.ghostClass, false);
+ _toggleClass(ghostEl, options.fallbackClass, true);
+
+ _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
+ _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
+ _css(ghostEl, 'width', rect.width);
+ _css(ghostEl, 'height', rect.height);
+ _css(ghostEl, 'opacity', '0.8');
+ _css(ghostEl, 'position', 'fixed');
+ _css(ghostEl, 'zIndex', '100000');
+ _css(ghostEl, 'pointerEvents', 'none');
+
+ options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
+
+ // Fixing dimensions.
+ ghostRect = ghostEl.getBoundingClientRect();
+ _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
+ _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
+ }
+ },
+
+ _onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
+ var dataTransfer = evt.dataTransfer,
+ options = this.options;
+
+ this._offUpEvents();
+
+ if (activeGroup.pull == 'clone') {
+ cloneEl = dragEl.cloneNode(true);
+ _css(cloneEl, 'display', 'none');
+ rootEl.insertBefore(cloneEl, dragEl);
+ }
+
+ if (useFallback) {
+
+ if (useFallback === 'touch') {
+ // Bind touch events
+ _on(document, 'touchmove', this._onTouchMove);
+ _on(document, 'touchend', this._onDrop);
+ _on(document, 'touchcancel', this._onDrop);
+ } else {
+ // Old brwoser
+ _on(document, 'mousemove', this._onTouchMove);
+ _on(document, 'mouseup', this._onDrop);
+ }
+
+ this._loopId = setInterval(this._emulateDragOver, 50);
+ }
+ else {
+ if (dataTransfer) {
+ dataTransfer.effectAllowed = 'move';
+ options.setData && options.setData.call(this, dataTransfer, dragEl);
+ }
+
+ _on(document, 'drop', this);
+ setTimeout(this._dragStarted, 0);
+ }
+ },
+
+ _onDragOver: function (/**Event*/evt) {
+ var el = this.el,
+ target,
+ dragRect,
+ revert,
+ options = this.options,
+ group = options.group,
+ groupPut = group.put,
+ isOwner = (activeGroup === group),
+ canSort = options.sort;
+
+ if (evt.preventDefault !== void 0) {
+ evt.preventDefault();
+ !options.dragoverBubble && evt.stopPropagation();
+ }
+
+ moved = true;
+
+ _dispatchEvent(this, rootEl, 'over', dragEl, rootEl, evt, evt.target); // Gantry 5
+ if (activeGroup && !options.disabled &&
+ (isOwner
+ ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
+ : activeGroup.pull && groupPut && (
+ (activeGroup.name === group.name) || // by Name
+ (groupPut.indexOf && ~groupPut.indexOf(activeGroup.name)) // by Array
+ )
+ ) &&
+ (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
+ ) {
+ // Smart auto-scrolling
+ _autoScroll(evt, options, this.el);
+
+ if (_silent) {
+ return;
+ }
+
+ target = _closest(evt.target, options.draggable, el);
+ dragRect = dragEl.getBoundingClientRect();
+
+ if (revert) {
+ _cloneHide(true);
+
+ if (cloneEl || nextEl) {
+ rootEl.insertBefore(dragEl, cloneEl || nextEl);
+ }
+ else if (!canSort) {
+ rootEl.appendChild(dragEl);
+ }
+
+ return;
+ }
+
+
+ if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
+ (el === evt.target) && (target = _ghostIsLast(el, evt))
+ ) {
+
+ if (target) {
+ if (target.animated) {
+ return;
+ }
+
+ targetRect = target.getBoundingClientRect();
+ }
+
+ _cloneHide(isOwner);
+
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect) !== false) {
+ if (!dragEl.contains(el)) {
+ el.appendChild(dragEl);
+ parentEl = el; // actualization
+ }
+
+ this._animate(dragRect, dragEl);
+ target && this._animate(targetRect, target);
+ }
+ }
+ else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
+ if (lastEl !== target) {
+ lastEl = target;
+ lastCSS = _css(target);
+ lastParentCSS = _css(target.parentNode);
+ }
+
+
+ var targetRect = target.getBoundingClientRect(),
+ width = targetRect.right - targetRect.left,
+ height = targetRect.bottom - targetRect.top,
+ floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
+ || (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
+ isWide = (target.offsetWidth > dragEl.offsetWidth),
+ isLong = (target.offsetHeight > dragEl.offsetHeight),
+ halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
+ nextSibling = target.nextElementSibling,
+ moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect),
+ after
+ ;
+
+ if (moveVector !== false) {
+ _silent = true;
+ setTimeout(_unsilent, 30);
+
+ _cloneHide(isOwner);
+
+ if (moveVector === 1 || moveVector === -1) {
+ after = (moveVector === 1);
+ }
+ else if (floating) {
+ var elTop = dragEl.offsetTop,
+ tgTop = target.offsetTop;
+
+ if (elTop === tgTop) {
+ after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
+ } else {
+ after = tgTop > elTop;
+ }
+ } else {
+ after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
+ }
+
+ if (!dragEl.contains(el)) {
+ if (after && !nextSibling) {
+ el.appendChild(dragEl);
+ } else {
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
+ }
+ }
+
+ parentEl = dragEl.parentNode; // actualization
+
+ this._animate(dragRect, dragEl);
+ this._animate(targetRect, target);
+ }
+ }
+ }
+ },
+
+ _animate: function (prevRect, target) {
+ var ms = this.options.animation;
+
+ if (ms) {
+ var currentRect = target.getBoundingClientRect();
+
+ _css(target, 'transition', 'none');
+ _css(target, 'transform', 'translate3d('
+ + (prevRect.left - currentRect.left) + 'px,'
+ + (prevRect.top - currentRect.top) + 'px,0)'
+ );
+
+ target.offsetWidth; // repaint
+
+ _css(target, 'transition', 'all ' + ms + 'ms');
+ _css(target, 'transform', 'translate3d(0,0,0)');
+
+ clearTimeout(target.animated);
+ target.animated = setTimeout(function () {
+ _css(target, 'transition', '');
+ _css(target, 'transform', '');
+ target.animated = false;
+ }, ms);
+ }
+ },
+
+ _offUpEvents: function () {
+ var ownerDocument = this.el.ownerDocument;
+
+ _off(document, 'touchmove', this._onTouchMove);
+ _off(ownerDocument, 'mouseup', this._onDrop);
+ _off(ownerDocument, 'touchend', this._onDrop);
+ _off(ownerDocument, 'touchcancel', this._onDrop);
+ },
+
+ _onDrop: function (/**Event*/evt) {
+ var el = this.el,
+ options = this.options;
+
+ clearInterval(this._loopId);
+ clearInterval(autoScroll.pid);
+ clearTimeout(this._dragStartTimer);
+
+ // Unbind events
+ _off(document, 'mousemove', this._onTouchMove);
+
+ if (this.nativeDraggable) {
+ _off(document, 'drop', this);
+ _off(el, 'dragstart', this._onDragStart);
+ }
+
+ this._offUpEvents();
+
+ if (evt) {
+ if (moved) {
+ evt.preventDefault();
+ !options.dropBubble && evt.stopPropagation();
+ }
+
+ ghostEl && ghostEl.parentNode.removeChild(ghostEl);
+
+ if (dragEl) {
+ if (this.nativeDraggable) {
+ _off(dragEl, 'dragend', this);
+ }
+
+ _disableDraggable(dragEl);
+
+ // Remove class's
+ _toggleClass(dragEl, this.options.ghostClass, false);
+ _toggleClass(dragEl, this.options.chosenClass, false);
+
+ if (rootEl !== parentEl) {
+ newIndex = _index(dragEl, options.draggable);
+
+ if (newIndex >= 0) {
+ // drag from one list and drop into another
+ _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
+ _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
+
+ // Add event
+ _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
+
+ // Remove event
+ _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
+ }
+ }
+ else {
+ // Remove clone
+ cloneEl && cloneEl.parentNode.removeChild(cloneEl);
+
+ if (dragEl.nextSibling !== nextEl) {
+ // Get the index of the dragged element within its parent
+ newIndex = _index(dragEl, options.draggable);
+
+ if (newIndex >= 0) {
+ // drag & drop within the same list
+ _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
+ _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
+ }
+ }
+ }
+
+ if (Sortable.active) {
+ if (newIndex === null || newIndex === -1) {
+ newIndex = oldIndex;
+ }
+
+ this.originalEvent = evt; // Gantry 5
+ _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
+
+ // Save sorting
+ this.save();
+ }
+ }
+
+ }
+ this._nulling();
+ },
+
+ _nulling: function() {
+ // Nulling
+ rootEl =
+ dragEl =
+ parentEl =
+ ghostEl =
+ nextEl =
+ cloneEl =
+
+ scrollEl =
+ scrollParentEl =
+
+ tapEvt =
+ touchEvt =
+
+ moved =
+ newIndex =
+
+ lastEl =
+ lastCSS =
+
+ activeGroup =
+ Sortable.active = null;
+ },
+
+ handleEvent: function (/**Event*/evt) {
+ var type = evt.type;
+
+ if (type === 'dragover' || type === 'dragenter') {
+ if (dragEl) {
+ this._onDragOver(evt);
+ _globalDragOver(evt);
+ }
+ }
+ else if (type === 'drop' || type === 'dragend') {
+ this._onDrop(evt);
+ }
+ },
+
+
+ /**
+ * Serializes the item into an array of string.
+ * @returns {String[]}
+ */
+ toArray: function () {
+ var order = [],
+ el,
+ children = this.el.children,
+ i = 0,
+ n = children.length,
+ options = this.options;
+
+ for (; i < n; i++) {
+ el = children[i];
+ if (_closest(el, options.draggable, this.el)) {
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
+ }
+ }
+
+ return order;
+ },
+
+
+ /**
+ * Sorts the elements according to the array.
+ * @param {String[]} order order of the items
+ */
+ sort: function (order) {
+ var items = {}, rootEl = this.el;
+
+ this.toArray().forEach(function (id, i) {
+ var el = rootEl.children[i];
+
+ if (_closest(el, this.options.draggable, rootEl)) {
+ items[id] = el;
+ }
+ }, this);
+
+ order.forEach(function (id) {
+ if (items[id]) {
+ rootEl.removeChild(items[id]);
+ rootEl.appendChild(items[id]);
+ }
+ });
+ },
+
+
+ /**
+ * Save the current sorting
+ */
+ save: function () {
+ var store = this.options.store;
+ store && store.set(this);
+ },
+
+
+ /**
+ * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
+ * @param {HTMLElement} el
+ * @param {String} [selector] default: `options.draggable`
+ * @returns {HTMLElement|null}
+ */
+ closest: function (el, selector) {
+ return _closest(el, selector || this.options.draggable, this.el);
+ },
+
+
+ /**
+ * Set/get option
+ * @param {string} name
+ * @param {*} [value]
+ * @returns {*}
+ */
+ option: function (name, value) {
+ var options = this.options;
+
+ if (value === void 0) {
+ return options[name];
+ } else {
+ options[name] = value;
+
+ if (name === 'group') {
+ _prepareGroup(options);
+ }
+ }
+ },
+
+
+ /**
+ * Destroy
+ */
+ destroy: function () {
+ var el = this.el;
+
+ el[expando] = null;
+
+ _off(el, 'mousedown', this._onTapStart);
+ _off(el, 'touchstart', this._onTapStart);
+
+ if (this.nativeDraggable) {
+ _off(el, 'dragover', this);
+ _off(el, 'dragenter', this);
+ }
+
+ // Remove draggable attributes
+ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
+ el.removeAttribute('draggable');
+ });
+
+ touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
+
+ this._onDrop();
+
+ this.el = el = null;
+ }
+ };
+
+
+ function _cloneHide(state) {
+ if (cloneEl && (cloneEl.state !== state)) {
+ _css(cloneEl, 'display', state ? 'none' : '');
+ !state && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl);
+ cloneEl.state = state;
+ }
+ }
+
+
+ function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
+ if (el) {
+ ctx = ctx || document;
+
+ do {
+ if (
+ (selector === '>*' && el.parentNode === ctx)
+ || _matches(el, selector)
+ ) {
+ return el;
+ }
+ }
+ while (el !== ctx && (el = el.parentNode));
+ }
+
+ return null;
+ }
+
+
+ function _globalDragOver(/**Event*/evt) {
+ if (evt.dataTransfer) {
+ evt.dataTransfer.dropEffect = 'move';
+ }
+ evt.preventDefault();
+ }
+
+
+ function _on(el, event, fn) {
+ el.addEventListener(event, fn, false);
+ }
+
+
+ function _off(el, event, fn) {
+ el.removeEventListener(event, fn, false);
+ }
+
+
+ function _toggleClass(el, name, state) {
+ if (el) {
+ if (el.classList) {
+ el.classList[state ? 'add' : 'remove'](name);
+ }
+ else {
+ var className = (' ' + el.className + ' ').replace(RSPACE, ' ').replace(' ' + name + ' ', ' ');
+ el.className = (className + (state ? ' ' + name : '')).replace(RSPACE, ' ');
+ }
+ }
+ }
+
+
+ function _css(el, prop, val) {
+ var style = el && el.style;
+
+ if (style) {
+ if (val === void 0) {
+ if (document.defaultView && document.defaultView.getComputedStyle) {
+ val = document.defaultView.getComputedStyle(el, '');
+ }
+ else if (el.currentStyle) {
+ val = el.currentStyle;
+ }
+
+ return prop === void 0 ? val : val[prop];
+ }
+ else {
+ if (!(prop in style)) {
+ prop = '-webkit-' + prop;
+ }
+
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
+ }
+ }
+ }
+
+
+ function _find(ctx, tagName, iterator) {
+ if (ctx) {
+ var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
+
+ if (iterator) {
+ for (; i < n; i++) {
+ iterator(list[i], i);
+ }
+ }
+
+ return list;
+ }
+
+ return [];
+ }
+
+
+
+ function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
+ var evt = document.createEvent('Event'),
+ options = (sortable || rootEl[expando]).options,
+ onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
+
+ evt.initEvent(name, true, true);
+
+ evt.to = rootEl;
+ evt.from = fromEl || rootEl;
+ evt.item = targetEl || rootEl;
+ evt.clone = cloneEl;
+
+ evt.oldIndex = startIndex;
+ evt.newIndex = newIndex;
+
+ rootEl.dispatchEvent(evt);
+
+ if (options[onName]) {
+ options[onName].call(sortable, evt);
+ }
+ }
+
+
+ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect) {
+ var evt,
+ sortable = fromEl[expando],
+ onMoveFn = sortable.options.onMove,
+ retVal;
+
+ evt = document.createEvent('Event');
+ evt.initEvent('move', true, true);
+
+ evt.to = toEl;
+ evt.from = fromEl;
+ evt.dragged = dragEl;
+ evt.draggedRect = dragRect;
+ evt.related = targetEl || toEl;
+ evt.relatedRect = targetRect || toEl.getBoundingClientRect();
+
+ fromEl.dispatchEvent(evt);
+
+ if (onMoveFn) {
+ retVal = onMoveFn.call(sortable, evt);
+ }
+
+ return retVal;
+ }
+
+
+ function _disableDraggable(el) {
+ el.draggable = false;
+ }
+
+
+ function _unsilent() {
+ _silent = false;
+ }
+
+
+ /** @returns {HTMLElement|false} */
+ function _ghostIsLast(el, evt) {
+ var lastEl = el.lastElementChild,
+ rect = lastEl.getBoundingClientRect();
+
+ // return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - rect.right > 5)) && lastEl; // min delta // Gantry 5
+ return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - (rect.right + rect.width) > 5)) && lastEl; // min delta
+ }
+
+
+ /**
+ * Generate id
+ * @param {HTMLElement} el
+ * @returns {String}
+ * @private
+ */
+ function _generateId(el) {
+ var str = el.tagName + el.className + el.src + el.href + el.textContent,
+ i = str.length,
+ sum = 0;
+
+ while (i--) {
+ sum += str.charCodeAt(i);
+ }
+
+ return sum.toString(36);
+ }
+
+ /**
+ * Returns the index of an element within its parent for a selected set of
+ * elements
+ * @param {HTMLElement} el
+ * @param {selector} selector
+ * @return {number}
+ */
+ function _index(el, selector) {
+ var index = 0;
+
+ if (!el || !el.parentNode) {
+ return -1;
+ }
+
+ while (el && (el = el.previousElementSibling)) {
+ if (el.nodeName.toUpperCase() !== 'TEMPLATE'
+ && _matches(el, selector)) {
+ index++;
+ }
+ }
+
+ return index;
+ }
+
+ function _matches(/**HTMLElement*/el, /**String*/selector) {
+ if (el) {
+ selector = selector.split('.');
+
+ var tag = selector.shift().toUpperCase(),
+ re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
+
+ return (
+ (tag === '' || el.nodeName.toUpperCase() == tag) &&
+ (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
+ );
+ }
+
+ return false;
+ }
+
+ function _throttle(callback, ms) {
+ var args, _this;
+
+ return function () {
+ if (args === void 0) {
+ args = arguments;
+ _this = this;
+
+ setTimeout(function () {
+ if (args.length === 1) {
+ callback.call(_this, args[0]);
+ } else {
+ callback.apply(_this, args);
+ }
+
+ args = void 0;
+ }, ms);
+ }
+ };
+ }
+
+ function _extend(dst, src) {
+ if (dst && src) {
+ for (var key in src) {
+ if (src.hasOwnProperty(key)) {
+ dst[key] = src[key];
+ }
+ }
+ }
+
+ return dst;
+ }
+
+
+ // Export utils
+ Sortable.utils = {
+ on: _on,
+ off: _off,
+ css: _css,
+ find: _find,
+ is: function (el, selector) {
+ return !!_closest(el, selector, el);
+ },
+ extend: _extend,
+ throttle: _throttle,
+ closest: _closest,
+ toggleClass: _toggleClass,
+ index: _index
+ };
+
+
+ /**
+ * Create sortable instance
+ * @param {HTMLElement} el
+ * @param {Object} [options]
+ */
+ Sortable.create = function (el, options) {
+ return new Sortable(el, options);
+ };
+
+
+ // Export
+ Sortable.version = '1.4.2';
+ return Sortable;
+});
+
+},{}],317:[function(require,module,exports){
+/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?d():setTimeout(f,25)},function(){e()})}f()}),e=null,f=new Promise(function(a,d){e=setTimeout(d,b.f)});Promise.race([f,d]).then(function(){e&&(clearTimeout(e),e=null);b.g(b.a)},function(){b.j(b.a)})};function Q(a,b,c,d,e,f,g){this.v=a;this.B=b;this.c=c;this.a=d;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.m=this.j=this.h=this.g=null;this.g=new M(this.c,this.s);this.h=new M(this.c,this.s);this.j=new M(this.c,this.s);this.m=new M(this.c,this.s);a=new G(this.a.c+",serif",J(this.a));a=O(a);this.g.a.style.cssText=a;a=new G(this.a.c+",sans-serif",J(this.a));a=O(a);this.h.a.style.cssText=a;a=new G("serif",J(this.a));a=O(a);this.j.a.style.cssText=a;a=new G("sans-serif",J(this.a));a=
+O(a);this.m.a.style.cssText=a;N(this.g);N(this.h);N(this.j);N(this.m)}var R={D:"serif",C:"sans-serif"},S=null;function T(){if(null===S){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);S=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return S}Q.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.m.a.offsetWidth;this.A=q();U(this)};
+function la(a,b,c){for(var d in R)if(R.hasOwnProperty(d)&&b===a.f[R[d]]&&c===a.f[R[d]])return!0;return!1}function U(a){var b=a.g.a.offsetWidth,c=a.h.a.offsetWidth,d;(d=b===a.f.serif&&c===a.f["sans-serif"])||(d=T()&&la(a,b,c));d?q()-a.A>=a.w?T()&&la(a,b,c)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):ma(a):V(a,a.v)}function ma(a){setTimeout(p(function(){U(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.m.a);b(this.a)},a),0)};function W(a,b,c){this.c=a;this.a=b;this.f=0;this.m=this.j=!1;this.s=c}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,J(a).toString(),"active")],[b.a.c("wf",a.c,J(a).toString(),"loading"),b.a.c("wf",a.c,J(a).toString(),"inactive")]);K(b,"fontactive",a);this.m=!0;na(this)};
+W.prototype.h=function(a){var b=this.a;if(b.g){var c=y(b.f,b.a.c("wf",a.c,J(a).toString(),"active")),d=[],e=[b.a.c("wf",a.c,J(a).toString(),"loading")];c||d.push(b.a.c("wf",a.c,J(a).toString(),"inactive"));w(b.f,d,e)}K(b,"fontinactive",a);na(this)};function na(a){0==--a.f&&a.j&&(a.m?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),K(a,"active")):L(a.a))};function oa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}oa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;pa(this,new ha(this.c,a),a)};
+function qa(a,b,c,d,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,m=d||null||{};if(0===c.length&&f)L(b.a);else{b.f+=c.length;f&&(b.j=f);var h,l=[];for(h=0;h= winPos.bottom) {\n\
+ \t\t\tplace[0] = 'top';\n\
+ \t\t}\n\
+ \t\tswitch (place[1]) {\n\
+ \t\t\tcase 'left':\n\
+ \t\t\t\tif (target.right - this.width <= winPos.left) {\n\
+ \t\t\t\t\tplace[1] = 'right';\n\
+ \t\t\t\t}\n\
+ \t\t\t\tbreak;\n\
+ \t\t\tcase 'right':\n\
+ \t\t\t\tif (target.left + this.width >= winPos.right) {\n\
+ \t\t\t\t\tplace[1] = 'left';\n\
+ \t\t\t\t}\n\
+ \t\t\t\tbreak;\n\
+ \t\t\tdefault:\n\
+ \t\t\t\tif (target.left + target.width / 2 + this.width / 2 >= winPos.right) {\n\
+ \t\t\t\t\tplace[1] = 'left';\n\
+ \t\t\t\t} else if (target.right - target.width / 2 - this.width / 2 <= winPos.left) {\n\
+ \t\t\t\t\tplace[1] = 'right';\n\
+ \t\t\t\t}\n\
+ \t\t}\n\
+ \t} else {\n\
+ \t\tif (target.left - this.width - spacing <= winPos.left) {\n\
+ \t\t\tplace[0] = 'right';\n\
+ \t\t} else if (target.right + this.width + spacing >= winPos.right) {\n\
+ \t\t\tplace[0] = 'left';\n\
+ \t\t}\n\
+ \t\tswitch (place[1]) {\n\
+ \t\t\tcase 'top':\n\
+ \t\t\t\tif (target.bottom - this.height <= winPos.top) {\n\
+ \t\t\t\t\tplace[1] = 'bottom';\n\
+ \t\t\t\t}\n\
+ \t\t\t\tbreak;\n\
+ \t\t\tcase 'bottom':\n\
+ \t\t\t\tif (target.top + this.height >= winPos.bottom) {\n\
+ \t\t\t\t\tplace[1] = 'top';\n\
+ \t\t\t\t}\n\
+ \t\t\t\tbreak;\n\
+ \t\t\tdefault:\n\
+ \t\t\t\tif (target.top + target.height / 2 + this.height / 2 >= winPos.bottom) {\n\
+ \t\t\t\t\tplace[1] = 'top';\n\
+ \t\t\t\t} else if (target.bottom - target.height / 2 - this.height / 2 <= winPos.top) {\n\
+ \t\t\t\t\tplace[1] = 'bottom';\n\
+ \t\t\t\t}\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \treturn place.join('-');\n\
+ };\n\
+ \n\
+ /**\n\
+ * Position the element to an element or a specific coordinates.\n\
+ *\n\
+ * @param {Integer|Element} x\n\
+ * @param {Integer} y\n\
+ *\n\
+ * @return {Tooltip}\n\
+ */\n\
+ Tooltip.prototype.position = function (x, y) {\n\
+ \tif (this.attachedTo) {\n\
+ \t\tx = this.attachedTo;\n\
+ \t}\n\
+ \tif (x == null && this._p) {\n\
+ \t\tx = this._p[0];\n\
+ \t\ty = this._p[1];\n\
+ \t} else {\n\
+ \t\tthis._p = arguments;\n\
+ \t}\n\
+ \tvar target = typeof x === 'number' ? {\n\
+ \t\tleft: 0|x,\n\
+ \t\tright: 0|x,\n\
+ \t\ttop: 0|y,\n\
+ \t\tbottom: 0|y,\n\
+ \t\twidth: 0,\n\
+ \t\theight: 0\n\
+ \t} : position(x);\n\
+ \tvar spacing = Number(this.spacing), offset = Number(this.offset);\n\
+ \tvar newPlace = this._pickPlace(target);\n\
+ \n\
+ \t// Add/Change place class when necessary\n\
+ \tif (newPlace !== this.curPlace) {\n\
+ \t\tif (this.curPlace) {\n\
+ \t\t\tthis.classes.remove(this.curPlace);\n\
+ \t\t}\n\
+ \t\tthis.classes.add(newPlace);\n\
+ \t\tthis.curPlace = newPlace;\n\
+ \t}\n\
+ \n\
+ \t// Position the tip\n\
+ \tvar top, left;\n\
+ \tswitch (this.curPlace) {\n\
+ \t\tcase 'top':\n\
+ \t\t\ttop = target.top - this.height - spacing;\n\
+ \t\t\tleft = target.left + target.width / 2 - this.width / 2;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'top-left':\n\
+ \t\t\ttop = target.top - this.height - spacing;\n\
+ \t\t\tleft = target.right - this.width - offset;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'top-right':\n\
+ \t\t\ttop = target.top - this.height - spacing;\n\
+ \t\t\tleft = target.left + offset;\n\
+ \t\t\tbreak;\n\
+ \n\
+ \t\tcase 'bottom':\n\
+ \t\t\ttop = target.bottom + spacing;\n\
+ \t\t\tleft = target.left + target.width / 2 - this.width / 2;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'bottom-left':\n\
+ \t\t\ttop = target.bottom + spacing;\n\
+ \t\t\tleft = target.right - this.width - offset;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'bottom-right':\n\
+ \t\t\ttop = target.bottom + spacing;\n\
+ \t\t\tleft = target.left + offset;\n\
+ \t\t\tbreak;\n\
+ \n\
+ \t\tcase 'left':\n\
+ \t\t\ttop = target.top + target.height / 2 - this.height / 2;\n\
+ \t\t\tleft = target.left - this.width - spacing;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'left-top':\n\
+ \t\t\ttop = target.bottom - this.height;\n\
+ \t\t\tleft = target.left - this.width - spacing;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'left-bottom':\n\
+ \t\t\ttop = target.top;\n\
+ \t\t\tleft = target.left - this.width - spacing;\n\
+ \t\t\tbreak;\n\
+ \n\
+ \t\tcase 'right':\n\
+ \t\t\ttop = target.top + target.height / 2 - this.height / 2;\n\
+ \t\t\tleft = target.right + spacing;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'right-top':\n\
+ \t\t\ttop = target.bottom - this.height;\n\
+ \t\t\tleft = target.right + spacing;\n\
+ \t\t\tbreak;\n\
+ \t\tcase 'right-bottom':\n\
+ \t\t\ttop = target.top;\n\
+ \t\t\tleft = target.right + spacing;\n\
+ \t\t\tbreak;\n\
+ \t}\n\
+ \n\
+ \t// Set tip position & class\n\
+ \tthis.element.style.top = Math.round(top) + 'px';\n\
+ \tthis.element.style.left = Math.round(left) + 'px';\n\
+ \n\
+ \treturn this;\n\
+ };\n\
+ \n\
+ /**\n\
+ * Show the tooltip.\n\
+ *\n\
+ * @param {Integer|Element} x\n\
+ * @param {Integer} y\n\
+ *\n\
+ * @return {Tooltip}\n\
+ */\n\
+ Tooltip.prototype.show = function (x, y) {\n\
+ \tx = this.attachedTo ? this.attachedTo : x;\n\
+ \n\
+ \t// Clear potential ongoing animation\n\
+ \tclearTimeout(this.aIndex);\n\
+ \n\
+ \t// Position the element when requested\n\
+ \tif (x != null) {\n\
+ \t\tthis.position(x, y);\n\
+ \t}\n\
+ \n\
+ \t// Stop here if tip is already visible\n\
+ \tif (this.hidden) {\n\
+ \t\tthis.hidden = 0;\n\
+ \t\twindow.document.body.appendChild(this.element);\n\
+ \t}\n\
+ \n\
+ \t// Make tooltip aware of window resize\n\
+ \tif (this.attachedTo) {\n\
+ \t\tthis._aware();\n\
+ \t}\n\
+ \n\
+ \t// Trigger layout and kick in the transition\n\
+ \tif (this.options.inClass) {\n\
+ \t\tif (this.options.effectClass) {\n\
+ \t\t\tvoid this.element.clientHeight;\n\
+ \t\t}\n\
+ \t\tthis.classes.add(this.options.inClass);\n\
+ \t}\n\
+ \n\
+ \treturn this;\n\
+ };\n\
+ \n\
+ /**\n\
+ * Hide the tooltip.\n\
+ *\n\
+ * @return {Tooltip}\n\
+ */\n\
+ Tooltip.prototype.hide = function () {\n\
+ \tif (this.hidden) {\n\
+ \t\treturn;\n\
+ \t}\n\
+ \n\
+ \tvar self = this;\n\
+ \tvar duration = 0;\n\
+ \n\
+ \t// Remove .in class and calculate transition duration if any\n\
+ \tif (this.options.inClass) {\n\
+ \t\tthis.classes.remove(this.options.inClass);\n\
+ \t\tif (this.options.effectClass) {\n\
+ \t\t\tduration = transitionDuration(this.element);\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \t// Remove tip from window resize awareness\n\
+ \tif (this.attachedTo) {\n\
+ \t\tthis._unaware();\n\
+ \t}\n\
+ \n\
+ \t// Remove the tip from the DOM when transition is done\n\
+ \tclearTimeout(this.aIndex);\n\
+ \tthis.aIndex = setTimeout(function () {\n\
+ \t\tself.aIndex = 0;\n\
+ \t\twindow.document.body.removeChild(self.element);\n\
+ \t\tself.hidden = 1;\n\
+ \t}, duration);\n\
+ \n\
+ \treturn this;\n\
+ };\n\
+ \n\
+ Tooltip.prototype.toggle = function (x, y) {\n\
+ \treturn this[this.hidden ? 'show' : 'hide'](x, y);\n\
+ };\n\
+ \n\
+ Tooltip.prototype.destroy = function () {\n\
+ \tclearTimeout(this.aIndex);\n\
+ \tthis._unaware();\n\
+ \tif (!this.hidden) {\n\
+ \t\twindow.document.body.removeChild(this.element);\n\
+ \t}\n\
+ \tthis.element = this.options = null;\n\
+ };\n\
+ \n\
+ /**\n\
+ * Make the tip window resize aware.\n\
+ *\n\
+ * @return {Void}\n\
+ */\n\
+ Tooltip.prototype._aware = function () {\n\
+ \tvar index = indexOf(Tooltip.winAware, this);\n\
+ \tif (!~index) {\n\
+ \t\tTooltip.winAware.push(this);\n\
+ \t}\n\
+ };\n\
+ \n\
+ /**\n\
+ * Remove the window resize awareness.\n\
+ *\n\
+ * @return {Void}\n\
+ */\n\
+ Tooltip.prototype._unaware = function () {\n\
+ \tvar index = indexOf(Tooltip.winAware, this);\n\
+ \tif (~index) {\n\
+ \t\tTooltip.winAware.splice(index, 1);\n\
+ \t}\n\
+ };\n\
+ \n\
+ /**\n\
+ * Handles repositioning of tooltips on window resize.\n\
+ *\n\
+ * @return {Void}\n\
+ */\n\
+ Tooltip.reposition = (function () {\n\
+ \tvar rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {\n\
+ \t\treturn setTimeout(fn, 17);\n\
+ \t};\n\
+ \tvar rIndex;\n\
+ \n\
+ \tfunction requestReposition() {\n\
+ \t\tif (rIndex || !Tooltip.winAware.length) {\n\
+ \t\t\treturn;\n\
+ \t\t}\n\
+ \t\trIndex = rAF(reposition, 17);\n\
+ \t}\n\
+ \n\
+ \tfunction reposition() {\n\
+ \t\trIndex = 0;\n\
+ \t\tvar tip;\n\
+ \t\tfor (var i = 0, l = Tooltip.winAware.length; i < l; i++) {\n\
+ \t\t\ttip = Tooltip.winAware[i];\n\
+ \t\t\ttip.position();\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \treturn requestReposition;\n\
+ }());\n\
+ Tooltip.winAware = [];\n\
+ \n\
+ // Bind winAware repositioning to window resize event\n\
+ evt.bind(window, 'resize', Tooltip.reposition);\n\
+ evt.bind(window, 'scroll', Tooltip.reposition);\n\
+ \n\
+ /**\n\
+ * Array with dynamic class types.\n\
+ *\n\
+ * @type {Array}\n\
+ */\n\
+ Tooltip.classTypes = ['type', 'effect'];\n\
+ \n\
+ /**\n\
+ * Default options for Tooltip constructor.\n\
+ *\n\
+ * @type {Object}\n\
+ */\n\
+ Tooltip.defaults = {\n\
+ \tbaseClass: 'tooltip', // Base tooltip class name.\n\
+ \ttypeClass: null, // Type tooltip class name.\n\
+ \teffectClass: null, // Effect tooltip class name.\n\
+ \tinClass: 'in', // Class used to transition stuff in.\n\
+ \tplace: 'top', // Default place.\n\
+ \tspacing: null, // Gap between target and tooltip.\n\
+ \toffset: null, // Horizontal offset to align arrow\n\
+ \tauto: 0 // Whether to automatically adjust place to fit into window.\n\
+ };//# sourceURL=darsain-tooltip/index.js"
+ ));
+ fakeRequire.register("darsain-event/index.js", Function("exports, fakeRequire, module",
+ "'use strict';\n\
+ \n\
+ /**\n\
+ * Bind `el` event `type` to `fn`.\n\
+ *\n\
+ * @param {Element} el\n\
+ * @param {String} type\n\
+ * @param {Function} fn\n\
+ * @param {Boolean} capture\n\
+ *\n\
+ * @return {Function}\n\
+ */\n\
+ exports.bind = window.addEventListener ? function (el, type, fn, capture) {\n\
+ \tel.addEventListener(type, fn, capture || false);\n\
+ \treturn fn;\n\
+ } : function (el, type, fn) {\n\
+ \tvar fnid = type + fn;\n\
+ \tel[fnid] = el[fnid] || function () {\n\
+ \t\tvar event = window.event;\n\
+ \t\tevent.target = event.srcElement;\n\
+ \t\tevent.preventDefault = function () {\n\
+ \t\t\tevent.returnValue = false;\n\
+ \t\t};\n\
+ \t\tevent.stopPropagation = function () {\n\
+ \t\t\tevent.cancelBubble = true;\n\
+ \t\t};\n\
+ \t\tfn.call(el, event);\n\
+ \t};\n\
+ \tel.attachEvent('on' + type, el[fnid]);\n\
+ \treturn fn;\n\
+ };\n\
+ \n\
+ /**\n\
+ * Unbind `el` event `type`'s callback `fn`.\n\
+ *\n\
+ * @param {Element} el\n\
+ * @param {String} type\n\
+ * @param {Function} fn\n\
+ * @param {Boolean} capture\n\
+ *\n\
+ * @return {Function}\n\
+ */\n\
+ exports.unbind = window.removeEventListener ? function (el, type, fn, capture) {\n\
+ \tel.removeEventListener(type, fn, capture || false);\n\
+ \treturn fn;\n\
+ } : function (el, type, fn) {\n\
+ \tvar fnid = type + fn;\n\
+ \tel.detachEvent('on' + type, el[fnid]);\n\
+ \ttry {\n\
+ \t\tdelete el[fnid];\n\
+ \t} catch (err) {\n\
+ \t\t// can't delete window object properties\n\
+ \t\tel[fnid] = undefined;\n\
+ \t}\n\
+ \treturn fn;\n\
+ };//# sourceURL=darsain-event/index.js"
+ ));
+ fakeRequire.register("component-indexof/index.js", Function("exports, fakeRequire, module",
+ "module.exports = function(arr, obj){\n\
+ if (arr.indexOf) return arr.indexOf(obj);\n\
+ for (var i = 0; i < arr.length; ++i) {\n\
+ if (arr[i] === obj) return i;\n\
+ }\n\
+ return -1;\n\
+ };//# sourceURL=component-indexof/index.js"
+ ));
+ fakeRequire.register("code42day-dataset/index.js", Function("exports, fakeRequire, module",
+ "module.exports=dataset;\n\
+ \n\
+ /*global document*/\n\
+ \n\
+ \n\
+ // replace namesLikeThis with names-like-this\n\
+ function toDashed(name) {\n\
+ return name.replace(/([A-Z])/g, function(u) {\n\
+ return \"-\" + u.toLowerCase();\n\
+ });\n\
+ }\n\
+ \n\
+ var fn;\n\
+ \n\
+ if (document.head.dataset) {\n\
+ fn = {\n\
+ set: function(node, attr, value) {\n\
+ if (!node.dataset) return;\
+ node.dataset[attr] = value;\n\
+ },\n\
+ get: function(node, attr) {\n\
+ return node.dataset && node.dataset[attr];\n\
+ }\n\
+ };\n\
+ } else {\n\
+ fn = {\n\
+ set: function(node, attr, value) {\n\
+ node.setAttribute('data-' + toDashed(attr), value);\n\
+ },\n\
+ get: function(node, attr) {\n\
+ return node.getAttribute('data-' + toDashed(attr));\n\
+ }\n\
+ };\n\
+ }\n\
+ \n\
+ function dataset(node, attr, value) {\n\
+ var self = {\n\
+ set: set,\n\
+ get: get\n\
+ };\n\
+ \n\
+ function set(attr, value) {\n\
+ fn.set(node, attr, value);\n\
+ return self;\n\
+ }\n\
+ \n\
+ function get(attr) {\n\
+ return fn.get(node, attr);\n\
+ }\n\
+ \n\
+ if (arguments.length === 3) {\n\
+ return set(attr, value);\n\
+ }\n\
+ if (arguments.length == 2) {\n\
+ return get(attr);\n\
+ }\n\
+ \n\
+ return self;\n\
+ }//# sourceURL=code42day-dataset/index.js"
+ ));
+ fakeRequire.register("tooltips/index.js", Function("exports, fakeRequire, module",
+ "'use strict';\n\
+ \n\
+ /**\n\
+ * Dependencies.\n\
+ */\n\
+ var evt = fakeRequire('event');\n\
+ var indexOf = fakeRequire('indexof');\n\
+ var Tooltip = fakeRequire('tooltip');\n\
+ var dataset = fakeRequire('dataset');\n\
+ \n\
+ /**\n\
+ * Transport.\n\
+ */\n\
+ module.exports = Tooltips;\n\
+ \n\
+ /**\n\
+ * Globals.\n\
+ */\n\
+ var MObserver = window.MutationObserver || window.WebkitMutationObserver;\n\
+ \n\
+ /**\n\
+ * Prototypal inheritance.\n\
+ *\n\
+ * @param {Object} o\n\
+ *\n\
+ * @return {Object}\n\
+ */\n\
+ var objectCreate = Object.create || (function () {\n\
+ \tfunction F() {}\n\
+ \treturn function (o) {\n\
+ \t\tF.prototype = o;\n\
+ \t\treturn new F();\n\
+ \t};\n\
+ })();\n\
+ \n\
+ /**\n\
+ * Poor man's shallow object extend.\n\
+ *\n\
+ * @param {Object} a\n\
+ * @param {Object} b\n\
+ *\n\
+ * @return {Object}\n\
+ */\n\
+ function extend(a, b) {\n\
+ \tfor (var key in b) {\n\
+ \t\ta[key] = b[key];\n\
+ \t}\n\
+ \treturn a;\n\
+ }\n\
+ \n\
+ /**\n\
+ * Capitalize the first letter of a string.\n\
+ *\n\
+ * @param {String} string\n\
+ *\n\
+ * @return {String}\n\
+ */\n\
+ function ucFirst(string) {\n\
+ \treturn string.charAt(0).toUpperCase() + string.slice(1);\n\
+ }\n\
+ \n\
+ /**\n\
+ * Tooltips constructor.\n\
+ *\n\
+ * @param {Element} container\n\
+ * @param {Object} options\n\
+ *\n\
+ * @return {Tooltips}\n\
+ */\n\
+ function Tooltips(container, options) {\n\
+ \tif (!(this instanceof Tooltips)) {\n\
+ \t\treturn new Tooltips(container, options);\n\
+ \t}\n\
+ \n\
+ \tvar self = this;\n\
+ \tvar observer, TID;\n\
+ \n\
+ \t/**\n\
+ \t * Show tooltip attached to an element.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.show = function (element) {\n\
+ \t\treturn callTooltipMethod(element, 'show');\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Hide tooltip attached to an element.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.hide = function (element) {\n\
+ \t\treturn callTooltipMethod(element, 'hide');\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Toggle tooltip attached to an element.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.toggle = function (element) {\n\
+ \t\treturn callTooltipMethod(element, 'toggle');\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Retrieve tooltip attached to an element and call it's method.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t * @param {String} method\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tfunction callTooltipMethod(element, method) {\n\
+ \t\tvar tip = self.get(element);\n\
+ \t\tif (tip) {\n\
+ \t\t\ttip[method]();\n\
+ \t\t}\n\
+ \t\treturn self;\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Return a tooltip attached to an element. Tooltip is created if it doesn't exist yet.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Tooltip}\n\
+ \t */\n\
+ \tself.get = function (element) {\n\
+ \t\tvar tip = !!element && (element[TID] || createTip(element));\n\
+ \t\tif (tip && !element[TID]) {\n\
+ \t\t\telement[TID] = tip;\n\
+ \t\t}\n\
+ \t\treturn tip;\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Add element(s) to Tooltips instance.\n\
+ \t *\n\
+ \t * @param {[type]} element Can be element, or container containing elements to be added.\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.add = function (element) {\n\
+ \t\tif (!element || element.nodeType !== 1) {\n\
+ \t\t\treturn self;\n\
+ \t\t}\n\
+ \t\tif (dataset(element).get(options.key)) {\n\
+ \t\t\tbindElement(element);\n\
+ \t\t} else if (element.children) {\n\
+ \t\t\tbindElements(element.querySelectorAll(self.selector));\n\
+ \t\t}\n\
+ \t\treturn self;\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Remove element(s) from Tooltips instance.\n\
+ \t *\n\
+ \t * @param {Element} element Can be element, or container containing elements to be removed.\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.remove = function (element) {\n\
+ \t\tif (!element || element.nodeType !== 1) {\n\
+ \t\t\treturn self;\n\
+ \t\t}\n\
+ \t\tif (dataset(element).get(options.key)) {\n\
+ \t\t\tunbindElement(element);\n\
+ \t\t} else if (element.children) {\n\
+ \t\t\tunbindElements(element.querySelectorAll(self.selector));\n\
+ \t\t}\n\
+ \t\treturn self;\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Reload Tooltips instance.\n\
+ \t *\n\
+ \t * Unbinds current tooltipped elements, than selects the\n\
+ \t * data-key elements from container and binds them again.\n\
+ \t *\n\
+ \t * @return {Tooltips}\n\
+ \t */\n\
+ \tself.reload = function () {\n\
+ \t\t// Unbind old elements\n\
+ \t\tunbindElements(self.elements);\n\
+ \t\t// Bind new elements\n\
+ \t\tbindElements(self.container.querySelectorAll(self.selector));\n\
+ \t\treturn self;\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Destroy Tooltips instance.\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tself.destroy = function () {\n\
+ \t\tunbindElements(this.elements);\n\
+ \t\tif (observer) {\n\
+ \t\t\tobserver.disconnect();\n\
+ \t\t}\n\
+ \t\tthis.container = this.elements = this.options = observer = null;\n\
+ \t};\n\
+ \n\
+ \t/**\n\
+ \t * Create a tip from element data attributes.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Tooltip}\n\
+ \t */\n\
+ \tfunction createTip(element) {\n\
+ \t\tvar data = dataset(element);\n\
+ \t\tvar content = data.get(options.key);\n\
+ \t\tif (!content) {\n\
+ \t\t\treturn false;\n\
+ \t\t}\n\
+ \t\tvar tipOptions = objectCreate(options.tooltip);\n\
+ \t\tvar keyData;\n\
+ \t\tfor (var key in Tooltip.defaults) {\n\
+ \t\t\tkeyData = data.get(options.key + ucFirst(key.replace(/Class$/, '')));\n\
+ \t\t\tif (!keyData) {\n\
+ \t\t\t\tcontinue;\n\
+ \t\t\t}\n\
+ \t\t\ttipOptions[key] = keyData;\n\
+ \t\t}\n\
+ \t\treturn new Tooltip(content, tipOptions).attach(element);\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Bind Tooltips events to Array/NodeList of elements.\n\
+ \t *\n\
+ \t * @param {Array} elements\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction bindElements(elements) {\n\
+ \t\tfor (var i = 0, l = elements.length; i < l; i++) {\n\
+ \t\t\tbindElement(elements[i]);\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Bind Tooltips events to element.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction bindElement(element) {\n\
+ \t\tif (element[TID] || ~indexOf(self.elements, element)) {\n\
+ \t\t\treturn;\n\
+ \t\t}\n\
+ \t\tevt.bind(element, options.showOn, eventHandler);\n\
+ \t\tevt.bind(element, options.hideOn, eventHandler);\n\
+ \t\tself.elements.push(element);\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Unbind Tooltips events from Array/NodeList of elements.\n\
+ \t *\n\
+ \t * @param {Array} elements\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction unbindElements(elements) {\n\
+ \t\tif (self.elements === elements) {\n\
+ \t\t\telements = elements.slice();\n\
+ \t\t}\n\
+ \t\tfor (var i = 0, l = elements.length; i < l; i++) {\n\
+ \t\t\tunbindElement(elements[i]);\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Unbind Tooltips events from element.\n\
+ \t *\n\
+ \t * @param {Element} element\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction unbindElement(element) {\n\
+ \t\tvar index = indexOf(self.elements, element);\n\
+ \t\tif (!~index) {\n\
+ \t\t\treturn;\n\
+ \t\t}\n\
+ \t\tif (element[TID]) {\n\
+ \t\t\telement[TID].destroy();\n\
+ \t\t\tdelete element[TID];\n\
+ \t\t}\n\
+ \t\tevt.unbind(element, options.showOn, eventHandler);\n\
+ \t\tevt.unbind(element, options.hideOn, eventHandler);\n\
+ \t\tself.elements.splice(index, 1);\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Tooltips events handler.\n\
+ \t *\n\
+ \t * @param {Event} event\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction eventHandler(event) {\n\
+ \t\t/*jshint validthis:true */\n\
+ \t\tif (options.showOn === options.hideOn) {\n\
+ \t\t\tself.toggle(this);\n\
+ \t\t} else {\n\
+ \t\t\tself[event.type === options.showOn ? 'show' : 'hide'](this);\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \t/**\n\
+ \t * Mutations handler.\n\
+ \t *\n\
+ \t * @param {Array} mutations\n\
+ \t *\n\
+ \t * @return {Void}\n\
+ \t */\n\
+ \tfunction mutationsHandler(mutations) {\n\
+ \t\tvar added, removed, i, l;\n\
+ \t\tfor (var m = 0, ml = mutations.length; m < ml; m++) {\n\
+ \t\t\tadded = mutations[m].addedNodes;\n\
+ \t\t\tremoved = mutations[m].removedNodes;\n\
+ \t\t\tfor (i = 0, l = added.length; i < l; i++) {\n\
+ \t\t\t\tself.add(added[i]);\n\
+ \t\t\t}\n\
+ \t\t\tfor (i = 0, l = removed.length; i < l; i++) {\n\
+ \t\t\t\tself.remove(removed[i]);\n\
+ \t\t\t}\n\
+ \t\t\tif (mutations[m].type == 'attributes' && mutations[m].attributeName == 'data-title'){\n\
+ \t\t\t\tif (!self.get(mutations[m])) { self.add(mutations[m].target); }\n\
+ \t\t\t\tself.get(mutations[m].target).content(dataset(mutations[m].target).get('title'));\n\
+ \t\t\t}\n\
+ \t\t}\n\
+ \t}\n\
+ \n\
+ \t// Construct\n\
+ \t(function () {\n\
+ \t\tself.container = container;\n\
+ \t\tself.options = options = extend(objectCreate(Tooltips.defaults), options);\n\
+ \t\tself.ID = TID = options.key + Math.random().toString(36).slice(2);\n\
+ \t\tself.elements = [];\n\
+ \n\
+ \t\t// Create tips selector\n\
+ \t\tself.selector = '[data-' + options.key + ']';\n\
+ \n\
+ \t\t// Load tips\n\
+ \t\tself.reload();\n\
+ \n\
+ \t\t// Create mutations observer\n\
+ \t\tif (options.observe && MObserver) {\n\
+ \t\t\tobserver = new MObserver(mutationsHandler);\n\
+ \t\t\tobserver.observe(self.container, {\n\
+ \t\t\t\tchildList: true,\n\
+ \t\t\t\tsubtree: true,\n\
+ \t\t\t\tattributes: true\n\
+ \t\t\t});\n\
+ \t\t}\n\
+ \t}());\n\
+ }\n\
+ \n\
+ /**\n\
+ * Expose Tooltip.\n\
+ */\n\
+ Tooltips.Tooltip = Tooltip;\n\
+ \n\
+ /**\n\
+ * Default Tooltips options.\n\
+ *\n\
+ * @type {Object}\n\
+ */\n\
+ Tooltips.defaults = {\n\
+ \ttooltip: {}, // Options for individual Tooltip instances.\n\
+ \tkey: 'tooltip', // Tooltips data attribute key.\n\
+ \tshowOn: 'mouseenter', // Show tooltip event.\n\
+ \thideOn: 'mouseleave', // Hide tooltip event.\n\
+ \tobserve: 0 // Enable mutation observer (used only when supported).\n\
+ };//# sourceURL=tooltips/index.js"
+ ));
+
+
+
+
+
+
+
+
+
+
+ fakeRequire.alias("darsain-tooltip/index.js", "tooltips/deps/tooltip/index.js");
+ fakeRequire.alias("darsain-tooltip/index.js", "tooltip/index.js");
+ fakeRequire.alias("darsain-event/index.js", "darsain-tooltip/deps/event/index.js");
+
+ fakeRequire.alias("darsain-position/index.js", "darsain-tooltip/deps/position/index.js");
+
+ fakeRequire.alias("component-classes/index.js", "darsain-tooltip/deps/classes/index.js");
+ fakeRequire.alias("component-indexof/index.js", "component-classes/deps/indexof/index.js");
+
+ fakeRequire.alias("component-indexof/index.js", "darsain-tooltip/deps/indexof/index.js");
+
+ fakeRequire.alias("darsain-event/index.js", "tooltips/deps/event/index.js");
+ fakeRequire.alias("darsain-event/index.js", "event/index.js");
+
+ fakeRequire.alias("component-indexof/index.js", "tooltips/deps/indexof/index.js");
+ fakeRequire.alias("component-indexof/index.js", "indexof/index.js");
+
+ fakeRequire.alias("code42day-dataset/index.js", "tooltips/deps/dataset/index.js");
+ fakeRequire.alias("code42day-dataset/index.js", "dataset/index.js");
+ if (typeof exports == "object") {
+ module.exports = fakeRequire("tooltips");
+ } else if (typeof define == "function" && define.amd) {
+ define(function(){ return fakeRequire("tooltips"); });
+ } else {
+ this["Tooltips"] = fakeRequire("tooltips");
+ }})();
+
+},{}]},{},[32])
+
+//# sourceMappingURL=main.js.map