functiongup(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");vart="[\\?&]"+e+"=([^&#]*)",n=newRegExp(t),o=n.exec(window.location.href);returnnull===o?"":o[1]}!function(e,t){"object"==typeofmodule&&"object"==typeofmodule.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)thrownewError("jQuery requires a window with a document");returnt(e)}:t(e)}("undefined"!=typeofwindow?window:this,function(e,t){functionn(e){vart=e.length,n=J.type(e);return"function"===n||J.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeoft&&t>0&&t-1ine}functiono(e,t,n){if(J.isFunction(t))returnJ.grep(e,function(e,o){return!!t.call(e,o,e)!==n});if(t.nodeType)returnJ.grep(e,function(e){returne===t!==n});if("string"==typeoft){if(re.test(t))returnJ.filter(t,e,n);t=J.filter(t,e)}returnJ.grep(e,function(e){returnz.call(t,e)>=0!==n})}functioni(e,t){for(;(e=e[t])&&1!==e.nodeType;);returne}functiona(e){vart=fe[e]={};returnJ.each(e.match(he)||[],function(e,n){t[n]=!0}),t}functions(){Z.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1),J.ready()}functionr(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=J.expando+r.uid++}functionl(e,t,n){varo;if(void0===n&&1===e.nodeType)if(o="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(o),"string"==typeofn){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ye.test(n)?J.parseJSON(n):n}catch(i){}ve.set(e,t,n)}elsen=void0;returnn}functionu(){return!0}functionc(){return!1}functiond(){try{returnZ.activeElement}catch(e){}}functionp(e,t){returnJ.nodeName(e,"table")&&J.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}functionh(e){returne.type=(null!==e.getAttribute("type"))+"/"+e.type,e}functionf(e){vart=Le.exec(e.type);returnt?e.type=t[1]:e.removeAttribute("type"),e}functionm(e,t){for(varn=0,o=e.length;o>n;n++)ge.set(e[n],"globalEval",!t||ge.get(t[n],"globalEval"))}functionb(e,t){varn,o,i,a,s,r,l,u;if(1===t.nodeType){if(ge.hasData(e)&&(a=ge.access(e),s=ge.set(t,a),u=a.events)){deletes.handle,s.events={};for(iinu)for(n=0,o=u[i].length;o>n;n++)J.event.add(t,i,u[i][n])}ve.hasData(e)&&(r=ve.access(e),l=J.extend({},r),ve.set(t,l))}}functiong(e,t){varn=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];returnvoid0===t||t&&J.nodeName(e,t)?J.merge([e],n):n}functionv(e,t){varn=t.nodeName.toLowerCase();"input"===n&&Te.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}functiony(t,n){varo,i=J(n.createElement(t)).appendTo(n.body),a=e.getDefaultComputedStyle&&(o=e.getDefaultComputedStyle(i[0]))?o.display:J.css(i[0],"display");returni.detach(),a}functionw(e){vart=Z,n=Re[e];returnn||(n=y(e,t),"none"!==n&&n||(He=(He||J("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=He[0].contentDocument,t.write(),t.close(),n=y(e,t),He.detach()),Re[e]=n),n}functionx(e,t,n){varo,i,a,s,r=e.style;returnn=n||Be(e),n&&(s=n.getPropertyValue(t)||n[t]),n&&(""!==s||J.contains(e.ownerDocument,e)||(s=J.style(e,t)),Ue.test(s)&&Oe.test(t)&&(o=r.width,i=r.minWidth,a=r.maxWidth,r.minWidth=r.maxWidth=r.width=s,s=n.width,r.width=o,r.minWidth=i,r.maxWidth=a)),void0!==s?s+"":s}functionM(e,t){return{get:function(){returne()?voiddeletethis.get:(this.get=t).apply(this,arguments)}}}functionj(e,t){if(tine)returnt;for(varn=t[0].toUpperCase()+t.slice(1),o=t,i=Ve.length;i--;)if(t=Ve[i]+n,tine)returnt;returno}functionT(e,t,n){varo=Xe.exec(t);returno?Math.max(0,o[1]-(n||0))+(o[2]||"px"):t}functionk(e,t,n,o,i){for(vara=n===(o?"border":"content")?4:"width"===t?1:0,s=0;4>a;a+=2)"margin"===n&&(s+=J.css(e,n+Me[a],!0,i)),o?("content"===n&&(s-=J.css(e,"padding"+Me[a],!0,i)),"margin"!==n&&(s-=J.css(e,"border"+Me[a]+"Width",!0,i))):(s+=J.css(e,"padding"+Me[a],!0,i),"padding"!==n&&(s+=J.css(e,"border"+Me[a]+"Width",!0,i)));returns}functionC(e,t,n){varo=!0,i="width"===t?e.
null==e||e===!0?"true"!==t.attr("data-closable")&&e!==!0?!1:(t.removeClass("basicModalContainer--fadeIn").addClass("basicModalContainer--fadeOut"),setTimeout(function(){returnt.remove()},300),null!=basicModal._lastFocus&&(basicModal._lastFocus.focus(),basicModal._lastFocus=null),!0):!1}},function(e){vart=function(t){varn=this;this.el=e(t),this.pos={start:{x:0,y:0},end:{x:0,y:0}},this.startTime,t.on("touchstart",function(e){n.touchStart(e)}),t.on("touchmove",function(e){n.touchMove(e)}),t.on("touchend",function(e){n.swipeEnd()}),t.on("mousedown",function(e){n.mouseDown(e)})};t.prototype={touchStart:function(e){vart=e.originalEvent.touches[0];this.swipeStart(e,t.pageX,t.pageY)},touchMove:function(e){vart=e.originalEvent.touches[0];this.swipeMove(e,t.pageX,t.pageY)},mouseDown:function(e){vart=this;this.swipeStart(e,e.pageX,e.pageY),this.el.on("mousemove",function(e){t.mouseMove(e)}),this.el.on("mouseup",function(){t.mouseUp()})},mouseMove:function(e){this.swipeMove(e,e.pageX,e.pageY)},mouseUp:function(e){this.swipeEnd(e),this.el.off("mousemove"),this.el.off("mouseup")},swipeStart:function(e,t,n){this.pos.start.x=t,this.pos.start.y=n,this.pos.end.x=t,this.pos.end.y=n,this.startTime=(newDate).getTime(),this.trigger("swipeStart",e)},swipeMove:function(e,t,n){this.pos.end.x=t,this.pos.end.y=n,this.trigger("swipeMove",e)},swipeEnd:function(e){this.trigger("swipeEnd",e)},trigger:function(t,n){varo=this,i=e.Event(t),a=o.pos.start.x-o.pos.end.x,s=o.pos.end.y-o.pos.start.y,r=Math.atan2(s,a),l="up",u=Math.round(Math.sqrt(Math.pow(a,2)+Math.pow(s,2))),c=Math.round(180*r/Math.PI),d=Math.round(u/((newDate).getTime()-o.startTime)*1e3);0>c&&(c=360-Math.abs(c)),45>=c&&c>=0||360>=c&&c>=315?l="left":c>=135&&225>=c?l="right":c>45&&135>c&&(l="down"),i.originalEvent=n,i.swipe={x:a,y:s,direction:l,distance:u,angle:c,speed:d},e(o.el).trigger(i)}},e.fn.swipe=function(){newt(this);returnthis}}(jQuery),album={json:null},album.getID=function(){vare=null,t=function(e){return"0"===e||"f"===e||"s"===e||"r"===e?!0:$.isNumeric(e)};returnphoto.json?e=photo.json.album:album.json&&(e=album.json.id),t(e)===!1&&(e=$(".album:hover, .album.active").attr("data-id")),t(e)===!1&&(e=$(".photo:hover, .photo.active").attr("data-album-id")),t(e)===!0?e:!1},album.load=function(e,t){varn,o,i,a;password.get(e,function(){t||lychee.animate("#content","contentZoomOut"),n=(newDate).getTime(),o={albumID:e,password:password.value},api.post("Album::get",o,function(o){return"Warning: Album private!"===o?(void0!=document.location.hash.replace("#","").split("/")[1]?lychee.setMode("view"):(lychee.content.show(),lychee["goto"]("")),!1):"Warning: Wrong password!"===o?(album.load(e,t),!1):(album.json=o,i=(newDate).getTime()-n,a=i>300?0:300-i,t===!0&&(a=0),visible.albums()||visible.photo()||visible.album()||(a=0),voidsetTimeout(function(){view.album.init(),t||(lychee.animate("#content","contentZoomIn"),header.setMode("album"))},a))})})},album.parse=function(){album.json.title||(album.json.title="Untitled")},album.add=function(){vare;e=function(e){vart,n=e.title;basicModal.close(),t=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},0===n.length&&(n="Untitled"),api.post("Album::add",{title:n},function(e){e===!0&&(e=1),e!==!1&&t(e)?(albums.refresh(),lychee["goto"](e)):lychee.error(null,params,e)})},basicModal.show({body:"<p>Enter a title for the new album: <input class='text' data-name='title' type='text' maxlength='30' placeholder='Title' value='Untitled'></p>",buttons:{action:{title:"Create Album",fn:e},cancel:{title:"Cancel",fn:basicModal.close}}})},album["delete"]=function(e){vart={},n={},o="",i="";returne?(einstanceofArray==!1&&(e=[e]),t.fn=function(){vart;basicModal.close(),t={albumIDs:e.join()},api.post("Album::delete",t,function(n){visible.albums()?e.forEach(function(e){albums.json.num--,view.albums.content["delete"](e),deletealbums.json.albums[e]}):(albums.refresh(),lychee["goto"]("")),n!==!0&&lychee.error(null,t,n)})},"0"===e.toString()?(t.title="Clear Unsorted",n.title="Keep Unsorted",o="<p>Areyousureyouwanttodeleteallphotosfrom'Unsorted'
vart="",n=function(e){vart="";returnt+="\n <div class='divider'>\n <h1>"+e.title+"</h1>\n </div>\n <table>\n ",e.rows.forEach(function(e){varn=e.value;(""===n||null===n||void0===n)&&(n="-"),n="<span class='attr_"+e.title.toLowerCase()+"'>"+n+"</span>",e.editable===!0&&(n+=" "+build.editIcon("edit_"+e.title.toLowerCase())),t+="\n <tr>\n <td>"+e.title+"</td>\n <td>"+n+"</td>\n </tr>\n "}),t+="\n </table>\n "},o=function(e){vart="";returnt+="\n <div class='divider'>\n <h1>"+e.title+"</h1>\n </div>\n <div id='tags'>\n <div class='attr_"+e.title.toLowerCase()+"'>"+e.value+"</div>\n ",e.editable===!0&&(t+=build.editIcon("edit_tags")),t+="\n </div>\n "};returne.forEach(function(e){e.type===sidebar.types.DEFAULT?t+=n(e):e.type===sidebar.types.TAGS&&(t+=o(e))}),t},swipe={obj:null,tolerance:150,offset:0},swipe.start=function(e,t){returne&&(swipe.obj=e),t&&(swipe.tolerance=t),!0},swipe.move=function(e){returnnull===swipe.obj?!1:(swipe.offset=-1*e.x,voidswipe.obj.css({WebkitTransform:"translateX("+swipe.offset+"px)",MozTransform:"translateX("+swipe.offset+"px)",transform:"translateX("+swipe.offset+"px)"}))},swipe.stop=function(e,t,n){e.x<=-swipe.tolerance?t(!0):e.x>=swipe.tolerance?n(!0):null!==swipe.obj&&swipe.obj.css({WebkitTransform:"translateX(0px)",MozTransform:"translateX(0px)",transform:"translateX(0px)"}),swipe.obj=null,swipe.offset=0},upload={},upload.show=function(e,t,n){basicModal.show({body:build.uploadModal(e,t),buttons:{action:{title:"Close","class":"hidden",fn:basicModal.close}},callback:n})},upload.notify=function(e,t){varn;returnt&&""!==t||(t="You can now manage your new photo(s)."),window.webkitNotifications?(0!==window.webkitNotifications.checkPermission()&&window.webkitNotifications.requestPermission(),void(0===window.webkitNotifications.checkPermission()&&e&&(n=window.webkitNotifications.createNotification("",e,t),n.show()))):!1},upload.start={local:function(e){vart=album.getID(),n=!1,o=function(e){functiont(t,n){returne.apply(this,arguments)}returnt.toString=function(){returne.toString()},t}(function(e,i){vara=newFormData,s=newXMLHttpRequest,r=0,l=0,u=function(){window.onbeforeunload=null,$("#upload_files").val(""),n===!1?(basicModal.close(),upload.notify("Upload complete")):($(".basicModal #basicModal__action.hidden").show(),upload.notify("Upload complete","Failed to upload one or more photos.")),albums.refresh(),album.getID()===!1?lychee["goto"]("0"):album.load(t)};if(i.supported===!1){if(null!==i.next)o(e,i.next);else{for(varc=!1,d=0;d<e.length;d++)if(e[d].supported===!0){c=!0;break}c===!1&&setTimeout(u,2e3)}return!1}a.append("function","Photo::add"),a.append("albumID",t),a.append("tags",""),a.append(0,i),s.open("POST",api.path),s.onload=function(){vart=!1,o="";i.ready=!0,200===s.status&&"1"===s.responseText?$(".basicModal .rows .row:nth-child("+(i.num+1)+") .status").html("Finished").addClass("success"):($(".basicModal .rows .row:nth-child("+(i.num+1)+") .status").html("Error").addClass("error"),o="Error:"===s.responseText.substr(0,6)?s.responseText.substr(6)+" Please take a look at the console of your browser for further details.":"Server returned an unknown response. Please take a look at the console of your browser for further details.",$(".basicModal .rows .row:nth-child("+(i.num+1)+") p.notice").html(o).show(),n=!0,lychee.error("Upload failed. Server returned the status code "+s.status+"!",s,s.responseText));for(vara=0;a<e.length;a++)if(e[a].ready===!1){t=!0;break}t===!1&&u()},s.upload.onprogress=function(t){if(t.lengthComputable&&(l=t.loaded/t.total*100|0,l>r&&($(".basicModal .rows .row:nth-child("+(i.num+1)+") .status").html(l+"%"),r=l),l>=100)){varn=0;i.num+1>4&&(n=40*(i.num+1-4)),$(".basicModal .rows").scrollTop(n),$(".basicModal .rows .row:nth-child("+(i.num+1)+") .status").html("Processing"),null!==i.next&&o(e,i.next)}},s.send(a)});if(e.length<=0)return!1;(t===!1||visible.albums()===!0)&&(t=0);for(vari=0;i<e.length;i++)e[i].num=i,e[i].ready=!1,e[i].supported=!0,e[i].next=i<e.length