!function(t,e){var i={is_intercepted:function(t,e){return!(t.x+t.width<=e.x||e.x+e.width<=t.x||t.y+t.height<=e.y||e.y+e.height<=t.y)},sort:function(t,i,n){return n=n||e.chain(t).map(function(t){return t.x+t.width}).max().value(),i=-1!=i?1:-1,e.sortBy(t,function(t){return i*(t.x+t.y*n)})},create_stylesheet:function(){var t=document.createElement("style");return t.appendChild(document.createTextNode("")),document.head.appendChild(t),t.sheet},toBool:function(t){return"boolean"==typeof t?t:"string"==typeof t?(t=t.toLowerCase(),!(""==t||"no"==t||"false"==t||"0"==t)):Boolean(t)}},n=0,o=function(t,e,i,n,o){this.width=t,this["float"]=i||!1,this.height=n||0,this.nodes=o||[],this.onchange=e||function(){}};o.prototype._fix_collisions=function(t){this._sort_nodes(-1);var n=t,o=Boolean(e.find(this.nodes,function(t){return t.locked}));for(this["float"]||o||(n={x:0,y:t.y,width:this.width,height:t.height});;){var a=e.find(this.nodes,function(e){return e!=t&&i.is_intercepted(e,n)},this);if("undefined"==typeof a)return;this.move_node(a,a.x,t.y+t.height,a.width,a.height,!0)}},o.prototype._sort_nodes=function(t){this.nodes=i.sort(this.nodes,t,this.width)},o.prototype._pack_nodes=function(){this._sort_nodes(),this["float"]?e.each(this.nodes,function(t){if(!t._updating&&"undefined"!=typeof t._orig_y&&t.y!=t._orig_y)for(var n=t.y;n>=t._orig_y;){var o=e.chain(this.nodes).find(function(e){return t!=e&&i.is_intercepted({x:t.x,y:n,width:t.width,height:t.height},e)}).value();o||(t._dirty=!0,t.y=n),--n}},this):e.each(this.nodes,function(t,n){if(!t.locked)for(;t.y>0;){var o=t.y-1,a=0==n;if(n>0){var h=e.chain(this.nodes).first(n).find(function(e){return i.is_intercepted({x:t.x,y:o,width:t.width,height:t.height},e)}).value();a="undefined"==typeof h}if(!a)break;t._dirty=t.y!=o,t.y=o}},this)},o.prototype._prepare_node=function(t,i){return t=e.defaults(t||{},{width:1,height:1,x:0,y:0}),t.x=parseInt(""+t.x),t.y=parseInt(""+t.y),t.width=parseInt(""+t.width),t.height=parseInt(""+t.height),t.auto_position=t.auto_position||!1,t.no_resize=t.no_resize||!1,t.no_move=t.no_move||!1,t.width>this.width?t.width=this.width:t.width<1&&(t.width=1),t.height<1&&(t.height=1),t.x<0&&(t.x=0),t.x+t.width>this.width&&(i?t.width=this.width-t.x:t.x=this.width-t.width),t.y<0&&(t.y=0),t},o.prototype._notify=function(){var t=Array.prototype.slice.call(arguments,1).concat(this.get_dirty_nodes());t=t.concat(this.get_dirty_nodes()),this.onchange(t)},o.prototype.clean_nodes=function(){e.each(this.nodes,function(t){t._dirty=!1})},o.prototype.get_dirty_nodes=function(){return e.filter(this.nodes,function(t){return t._dirty})},o.prototype.add_node=function(t){if(t=this._prepare_node(t),"undefined"!=typeof t.max_width&&(t.width=Math.min(t.width,t.max_width)),"undefined"!=typeof t.max_height&&(t.height=Math.min(t.height,t.max_height)),"undefined"!=typeof t.min_width&&(t.width=Math.max(t.width,t.min_width)),"undefined"!=typeof t.min_height&&(t.height=Math.max(t.height,t.min_height)),t._id=++n,t._dirty=!0,t.auto_position){this._sort_nodes();for(var o=0;;++o){var a=o%this.width,h=Math.floor(o/this.width);if(!(a+t.width>this.width||e.find(this.nodes,function(e){return i.is_intercepted({x:a,y:h,width:t.width,height:t.height},e)}))){t.x=a,t.y=h;break}}}return this.nodes.push(t),this._fix_collisions(t),this._pack_nodes(),this._notify(),t},o.prototype.remove_node=function(t){t._id=null,this.nodes=e.without(this.nodes,t),this._pack_nodes(),this._notify(t)},o.prototype.can_move_node=function(t,i,n,a,h){var s=Boolean(e.find(this.nodes,function(t){return t.locked}));if(!this.height&&!s)return!0;var d,r=new o(this.width,null,this["float"],0,e.map(this.nodes,function(e){return e==t?d=$.extend({},e):$.extend({},e)}));r.move_node(d,i,n,a,h);var _=!0;return s&&(_&=!Boolean(e.find(r.nodes,function(t){return t!=d&&Boolean(t.locked)&&Boolean(t._dirty)}))),this.height&&(_&=r.get_grid_height()<=this.height),_},o.prototype.can_be_placed_with_respect_to_height=function(t){if(!this.height)return!0;var i=new o(this.width,null,this["float"],0,e.map(this.nodes,function(t){return $.extend({},t)}));return i.add_node(t),i.get_grid_height()<=this.height},o.prototype.move_node=function(t,e,i,n,o,a){if("number"!=typeof e&&(e=t.x),"number"!=typeof i&&(i=t.y),"number"!=typeof n&&(n=t.width),"number"!=typeof o&&(o=t.height),"undefined"!=typeof t.max_width&&(n=Math.min(n,t.max_width)),"undefined"!=typeof t.max_height&&(o=Math.min(o,t.max_height)),"undefined"!=typeof t.min_width&&(n=Math.max(n,t.min_width)),"undefined"!=typeof t.min_height&&(o=Math.max(o,t.min_height)),t.x==e&&t.y==i&&t.width==n&&t.height==o)return t;var h=t.width!=n;return t._dirty=!0,t.x=e,t.y=i,t.width=n,t.height=o,t=this._prepare_node(t,h),this._fix_collisions(t),a||(this._pack_nodes(),this._notify()),t},o.prototype.get_grid_height=function(){return e.reduce(this.nodes,function(t,e){return Math.max(t,e.y+e.height)},0)},o.prototype.begin_update=function(t){e.each(this.nodes,function(t){t._orig_y=t.y}),t._updating=!0},o.prototype.end_update=function(){var t=e.find(this.nodes,function(t){return t._updating});t&&(t._updating=!1)};var a=function(t,n){var a,h=this;if(this.container=$(t),this.opts=e.defaults(n||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,item_class:"grid-stack-item",placeholder_class:"grid-stack-placeholder",handle:".grid-stack-item-content",cell_height:60,vertical_margin:20,auto:!0,min_width:768,"float":!1,_class:"grid-stack-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,always_show_resize_handle:n.always_show_resize_handle||!1}),this.container.addClass(this.opts._class),this._styles=i.create_stylesheet(),this._styles._max=0,this.grid=new o(this.opts.width,function(t){var i=0;e.each(t,function(t){null==t._id?t.el.remove():(t.el.attr("data-gs-x",t.x).attr("data-gs-y",t.y).attr("data-gs-width",t.width).attr("data-gs-height",t.height),i=Math.max(i,t.y+t.height))}),h._update_styles(i+10)},this.opts["float"],this.opts.height),this.opts.auto){var s=[];this.container.find("."+this.opts.item_class).each(function(t,e){e=$(e),s.push({el:e,i:parseInt(e.attr("data-gs-x"))+parseInt(e.attr("data-gs-y"))*parseInt(e.attr("data-gs-width"))})}),e.chain(s).sortBy(function(t){return t.i}).each(function(t){h._prepare_element(t.el)})}this.set_animation(this.opts.animate),this.placeholder=$('