!function(t){"function"==typeof define&&define.amd?define(["jquery","underscore"],t):t(jQuery,_)}(function(t,e){var i=window,n={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)}},o=0,a=function(t,e,i,n,o){this.width=t,this["float"]=i||!1,this.height=n||0,this.nodes=o||[],this.onchange=e||function(){}};a.prototype._fix_collisions=function(t){this._sort_nodes(-1);var i=t,o=Boolean(e.find(this.nodes,function(t){return t.locked}));for(this["float"]||o||(i={x:0,y:t.y,width:this.width,height:t.height});;){var a=e.find(this.nodes,function(e){return e!=t&&n.is_intercepted(e,i)},this);if("undefined"==typeof a)return;this.move_node(a,a.x,t.y+t.height,a.width,a.height,!0)}},a.prototype._sort_nodes=function(t){this.nodes=n.sort(this.nodes,t,this.width)},a.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 i=t.y;i>=t._orig_y;){var o=e.chain(this.nodes).find(function(e){return t!=e&&n.is_intercepted({x:t.x,y:i,width:t.width,height:t.height},e)}).value();o||(t._dirty=!0,t.y=i),--i}},this):e.each(this.nodes,function(t,i){if(!t.locked)for(;t.y>0;){var o=t.y-1,a=0==i;if(i>0){var h=e.chain(this.nodes).first(i).find(function(e){return n.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)},a.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},a.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)},a.prototype.clean_nodes=function(){e.each(this.nodes,function(t){t._dirty=!1})},a.prototype.get_dirty_nodes=function(){return e.filter(this.nodes,function(t){return t._dirty})},a.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=++o,t._dirty=!0,t.auto_position){this._sort_nodes();for(var i=0;;++i){var a=i%this.width,h=Math.floor(i/this.width);if(!(a+t.width>this.width||e.find(this.nodes,function(e){return n.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},a.prototype.remove_node=function(t){t._id=null,this.nodes=e.without(this.nodes,t),this._pack_nodes(),this._notify(t)},a.prototype.can_move_node=function(i,n,o,h,s){var d=Boolean(e.find(this.nodes,function(t){return t.locked}));if(!this.height&&!d)return!0;var r,_=new a(this.width,null,this["float"],0,e.map(this.nodes,function(e){return e==i?r=t.extend({},e):t.extend({},e)}));_.move_node(r,n,o,h,s);var c=!0;return d&&(c&=!Boolean(e.find(_.nodes,function(t){return t!=r&&Boolean(t.locked)&&Boolean(t._dirty)}))),this.height&&(c&=_.get_grid_height()<=this.height),c},a.prototype.can_be_placed_with_respect_to_height=function(i){if(!this.height)return!0;var n=new a(this.width,null,this["float"],0,e.map(this.nodes,function(e){return t.extend({},e)}));return n.add_node(i),n.get_grid_height()<=this.height},a.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},a.prototype.get_grid_height=function(){return e.reduce(this.nodes,function(t,e){return Math.max(t,e.y+e.height)},0)},a.prototype.begin_update=function(t){e.each(this.nodes,function(t){t._orig_y=t.y}),t._updating=!0},a.prototype.end_update=function(){var t=e.find(this.nodes,function(t){return t._updating});t&&(t._updating=!1)};var h=function(i,o){var h,s=this;if(this.container=t(i),this.opts=e.defaults(o||{},{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:o.always_show_resize_handle||!1}),this.container.addClass(this.opts._class),this._styles=n.create_stylesheet(),this._styles._max=0,this.grid=new a(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))}),s._update_styles(i+10)},this.opts["float"],this.opts.height),this.opts.auto){var d=[];this.container.find("."+this.opts.item_class).each(function(e,i){i=t(i),d.push({el:i,i:parseInt(i.attr("data-gs-x"))+parseInt(i.attr("data-gs-y"))*parseInt(i.attr("data-gs-width"))})}),e.chain(d).sortBy(function(t){return t.i}).each(function(t){s._prepare_element(t.el)})}this.set_animation(this.opts.animate),this.placeholder=t('