!function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([,function(e,t,o){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};/*!
 * njBox popover addon
 * nejikrofl@gmail.com
 * Copyright (c) 2017 N.J.
 * MIT license
*/
!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.njBox;e&&e.addAddon("popover",{options:{layout:"fixed",trigger:"click",placement:"bottom",reverse:!0,offset:"10 10",boundary:!0},prototype:{_popover_init:function(){var e=this,t=e.o;e.$,"popover"===t.layout&&(e._g.popover=!0,t.container="body",t.backdrop=e._getPassedOption("backdrop")||!1,t.scrollbar=e._getPassedOption("scrollbar")||"show",t.close=e._getPassedOption("close")||!1,t.autoheight=!1,t.autofocus=e._getPassedOption("autofocus")||!1,t.focusprevious=!1,t.click=!1,t.clickels=!1,t.autoheight=e._getPassedOption("autoheight")||!1,"follow"===t.trigger&&(t.placement=e._getPassedOption("placement")||"right",t.offset="5 5")),e._g.popover&&(e.on("inited",function(){var e=this,t=e.o,o=this._handlers;switch(this.dom.insertInto=this.dom.container,this._g.insertWrap=!1,t.trigger){case"click":o.trigger_click=function(t){var o=this;if(t.originalEvent&&(t=t.originalEvent),!("which"in t&&(1!==t.which||1===t.which&&t.ctrlKey&&t.shiftKey)))switch(t.preventDefault?t.preventDefault():t.returnValue=!1,e.state.status){case"inited":case"hide":e.state.clickedEvent=t,e.state.clickedEl=o,e.state.focused=o,e.show();break;case"show":case"shown":e.hide()}},e._g.els.on("click",o.trigger_click);break;case"hover":o.trigger_mouseenter=function(t){var o=this;t.originalEvent&&(t=t.originalEvent),e.state.clickedEvent=t,e.state.clickedEl=o,e.state.focused=document.activeElement,e.show()},o.trigger_mouseleave=function(t){e.hide()},e._g.els.on("mouseenter",o.trigger_mouseenter).on("mouseleave",o.trigger_mouseleave);break;case"follow":o.trigger_follow_enter=function(t){e._g.followEvent=t,e.show(),e.dom.document.off("mousemove",void 0),e.dom.document.off("mousemove",o.trigger_follow_move).on("mousemove",o.trigger_follow_move)},o.trigger_follow_move=function(t){t.originalEvent&&(t=t.originalEvent),"show"!==e.state.status&&"shown"!==e.state.status||(e._g.followEvent=t,e._p_mouseInRect({e:t,rect:e.state.dimensions.el})?e.position():(e.dom.document.off("mousemove",o.trigger_follow_move),e.hide()))},e._g.els.on("mouseenter",o.trigger_follow_enter)}}),e.on("destroy",function(){var o=this._handlers;switch(t.trigger){case"click":e._g.els.off("click",o.trigger_click);break;case"hover":e._g.els.off("mouseenter",o.trigger_mouseenter).off("mouseleave",o.trigger_mouseleave);break;case"follow":e._g.els.off("mouseenter",o.trigger_follow_enter),e.dom.document.off("mousemove",o.trigger_follow_move)}}),e.on("item_inserted",function(e){e.dom.modalOuter.css("width",e.dom.modalOuter.css("width"))}),e.on("item_ready",function(e){e.dom.modalOuter.css("width","auto").css("left","0px").css("top","0px")}),e.on("position",function(){var e=this,t=this.o,o=this.state,r=t.placement,n=e._getActive().dom.modalOuter;this.state.dimensions.modal=this._getDomSize(n),o.arguments.position.length&&(r=o.arguments.position[0]),r="function"==typeof r?r.call(this,this._getActive().dom.modal[0],this.state.clickedEl||this._g.els[0]):r,r||(r="bottom"),"follow"===t.trigger?r=e._p_getFollowCoords(this._g.followEvent):this._p_isPlacement(r)&&(r=e._p_getCoords(r)),o.coords=r,o.coords&&2===o.coords.length&&n.css("left",o.coords[0]+"px").css("top",o.coords[1]+"px")}),e.on("item_create",function(o){e._g.popover&&o.dom.modalOuter.addClass("njb-outer--popover"),t.class&&o.dom.modalOuter.addClass(t.class),o.toInsert=o.dom.modalOuter}),e.on("item_created",function(e){}),e.on("listeners_added",function(){var e=this,t=this._handlers;t.p_wrap_keydown=t.wrap_keydown,t.p_wrap_close=t.wrap_close,t.p_wrap_ok=t.wrap_ok,t.p_wrap_cancel=t.wrap_cancel,e.dom.container.on("keydown",t.p_wrap_keydown).delegate("[data-njb-close]","click",t.p_wrap_close).delegate("[data-njb-ok]","click",t.p_wrap_ok).delegate("[data-njb-cancel]","click",t.p_wrap_cancel)}),e.on("listeners_removed",function(){var e=this,t=this._handlers;e.dom.container.off("keydown",t.p_wrap_keydown).undelegate("[data-njb-close]","click",t.p_wrap_close).undelegate("[data-njb-ok]","click",t.p_wrap_ok).undelegate("[data-njb-cancel]","click",t.p_wrap_cancel),delete t.p_wrap_keydown,delete t.p_wrap_close,delete t.p_wrap_ok,delete t.p_wrap_cancel}),e.on("clear",function(){if(this._g.popover){var e=this._getActive().dom.modalOuter;e[0].parentNode.removeChild(e[0]),e.css("left","0").css("top","0")}}))},_p_getCoords:function(e){var t,o,r=this.o,n=r.reverse,i=r.boundary,s=this.state.dimensions,a=s.container,c=s.modal;if(o=this._p_getCoordsFromPlacement(e,s),(i||n)&&(t=this._p_getDirtyStatus({coords:o,element:c,container:a})),n&&t&&t[e]){var l=this._p_getOppositeDirection(e);o=this._p_getCoordsFromPlacement(l,s),t=this._p_getDirtyStatus({coords:o,element:c,container:a})}return i&&t&&(o=this._p_fixBounds({coords:o})),o},_p_getFollowCoords:function(e){function t(e){var t=e.slice();return"right"===l?(t[0]+=_[0],t[1]+=_[1]):"left"===l&&(t[0]-=c.width+_[0]),t}var o,r,n=this.o,i=[e.clientX,e.clientY],s=this.state.dimensions,a=s.container,c=s.modal,l=n.placement,d=n.reverse,p=n.boundary,_=this._p_parseCoords(n.offset);return o=t(i),(p||d)&&(r=this._p_getDirtyStatus({coords:o,element:c,container:a})),d&&r&&r[l]&&(l=this._p_getOppositeDirection(l),o=t(i),r=this._p_getDirtyStatus({coords:i,container:a,element:c})),p&&r&&(o=this._p_fixBounds({coords:o})),o},_p_isPlacement:function(e){var t=!1;switch(e){case"left":case"right":case"bottom":case"top":case"center":t=!0}return t},_p_mouseInRect:function(e){var t=e.e,o=e.rect,r=t.clientX,n=t.clientY,i=!1;return r>=o.left&&r<=o.right&&n>=o.top&&n<=o.bottom&&(i=!0),i},_p_getCoordsFromPlacement:function(e,t){var o=this,r=o.o,n=t.clickedEl||t.el;if(!n)return e;var i,s,a=t.modal.width>n.width,c=t.modal.height>n.height,l=o._p_parseCoords(r.offset),d=[];switch(i=a?n.left-(t.modal.width-n.width)/2:n.left+(n.width-t.modal.width)/2,t.container.scrollLeft&&(i+=t.container.scrollLeft),s=c?n.top-(t.modal.height-n.height)/2:n.top+(n.height-t.modal.height)/2,t.container.scrollTop&&(s+=t.container.scrollTop),e){case"center":d[0]=(t.container.width-t.modal.width)/2+t.container.scrollLeft,d[1]=(t.container.height-t.modal.height)/2+t.container.scrollTop;break;case"bottom":d[0]=i,d[1]=n.bottom+l[1]+t.container.scrollTop;break;case"top":d[0]=i,d[1]=n.top-t.modal.height-l[1]+t.container.scrollTop;break;case"left":d[0]=n.left-t.modal.width-l[0],d[1]=s;break;case"right":d[0]=n.right+l[0],d[1]=s}return d},_p_getDirtyStatus:function(e){var t=e.coords,o=e.container,r=e.element,n=!1,i={left:t[0]<=o.left,top:t[1]<=o.top,right:t[0]+r.width>=o.scrollWidth,bottom:t[1]+r.height>=o.scrollHeight};return(i.left||i.top||i.right||i.bottom)&&(n=i),n},_p_getOppositeDirection:function(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top";case"center":return"center"}},_p_fixBounds:function(e){var t=this,o=e.coords,r=t.o;if(!r.boundary)return o;var n=(t._p_parseCoords(r.offset),t.state.dimensions),i=n.container,s=n.modal,a=o.slice(),c=this._p_getDirtyStatus({coords:o,container:i,element:s});return a=function(e){var t=e.dirty,o=e.coords,r=e.container,n=e.element,i=r.scrollWidth-n.width;return t.left&&(o[0]=r.left),t.top&&(o[1]=r.top),t.right&&(o[0]=i),t.bottom&&(o[1]=r.scrollHeight-n.height),o}({dirty:c,coords:a,container:i,element:s})},_p_parseCoords:function(e){var t=[0,0],o=t;if("string"==typeof e)if(/\s/.test(e)){var n=e.split(" ");n[0]=parseFloat(n[0]),n[1]=parseFloat(n[1]),o=n}else o=t;else"object"===(void 0===e?"undefined":r(e))&&2==e.length&&(o=[parseFloat(e[0]),parseFloat(e[1])]);return o}}})}()}]);