/** 
 * Kendo UI v2016.3.1118 (http://www.telerik.com/kendo-ui)                                                                                                                                              
 * Copyright 2016 Telerik AD. All rights reserved.                                                                                                                                                      
 *                                                                                                                                                                                                      
 * Kendo UI commercial licenses may be obtained at                                                                                                                                                      
 * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete                                                                                                                                  
 * If you do not own a commercial license, this file shall be governed by the trial license terms.                                                                                                      
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       

*/
!function(e,define){define("kendo.imagebrowser.min",["kendo.filebrowser.min"],e)}(function(){return function(e,t){function i(e,i){return e!==t&&e.match(/\/$/)||(e=(e||"")+"/"),e+i}function a(e){if(!e)return"";var t=" bytes";return e>=1073741824?(t=" GB",e/=1073741824):e>=1048576?(t=" MB",e/=1048576):e>=1024&&(t=" KB",e/=1024),Math.round(100*e)/100+t}var n,o,s=window.kendo,r=s.ui.FileBrowser,l=e.isPlainObject,d=e.proxy,p=e.extend,c=s.support.browser,u=s.isFunction,f=/(^\/|\/$)/g,m="error",h=".kendoImageBrowser",g="name",_="size",v="type",y={field:v,dir:"asc"},k=s.template('<li class="k-tile-empty"><strong>${text}</strong></li>');p(!0,s.data,{schemas:{imagebrowser:{data:function(e){return e.items||e||[]},model:{id:"name",fields:{name:"name",size:"size",type:"type"}}}}}),p(!0,s.data,{transports:{imagebrowser:s.data.RemoteTransport.extend({init:function(t){s.data.RemoteTransport.fn.init.call(this,e.extend(!0,{},this.options,t))},_call:function(t,i){i.data=e.extend({},i.data,{path:this.options.path()}),u(this.options[t])?this.options[t].call(this,i):s.data.RemoteTransport.fn[t].call(this,i)},read:function(e){this._call("read",e)},create:function(e){this._call("create",e)},destroy:function(e){this._call("destroy",e)},update:function(){},options:{read:{type:"POST"},update:{type:"POST"},create:{type:"POST"},destroy:{type:"POST"}}})}}),n=c.msie&&c.version<8?function(e){return e.offsetTop}:function(t){return t.offsetTop-e(t).height()},o=r.extend({init:function(e,t){var i=this;t=t||{},r.fn.init.call(i,e,t),i.element.addClass("k-imagebrowser")},options:{name:"ImageBrowser",fileTypes:"*.png,*.gif,*.jpg,*.jpeg"},value:function(){var e,t=this,a=t._selectedItem(),n=t.options.transport.imageUrl;if(a&&"f"===a.get(v))return e=i(t.path(),a.get(g)).replace(f,""),n&&(e=u(n)?n(e):s.format(n,encodeURIComponent(e))),e},_fileUpload:function(e){var t,i=this,a=i.options,n=a.fileTypes,o=RegExp(("("+n.split(",").join(")|(")+")").replace(/\*\./g,".*."),"i"),r=e.files[0].name,l=g,d=_;o.test(r)?(e.data={path:i.path()},t=i._createFile(r),t?(t._uploading=!0,i.upload.one("success",function(e){delete t._uploading;var a=i._insertFileToList(t);a.set(l,e.response[i._getFieldName(l)]),a.set(d,e.response[i._getFieldName(d)]),i._tiles=i.listView.items().filter("["+s.attr("type")+"=f]"),i._scroll()})):e.preventDefault()):(e.preventDefault(),i._showMessage(s.format(a.messages.invalidFileType,r,n)))},_content:function(){var t=this;t.list=e('<ul class="k-reset k-floats k-tiles" />').appendTo(t.element).on("scroll"+h,d(t._scroll,t)).on("dblclick"+h,"li",d(t._dblClick,t)),t.listView=new s.ui.ListView(t.list,{dataSource:t.dataSource,template:t._itemTmpl(),editTemplate:t._editTmpl(),selectable:!0,autoBind:!1,dataBinding:function(e){t.toolbar.find(".k-i-delete").parent().addClass("k-state-disabled"),"remove"!==e.action&&"sync"!==e.action||e.preventDefault()},dataBound:function(){t.dataSource.view().length?(t._tiles=this.items().filter("["+s.attr("type")+"=f]"),t._scroll()):this.wrapper.append(k({text:t.options.messages.emptyFolder}))},change:d(t._listViewChange,t)})},_dataSource:function(){var e,t=this,i=t.options,a=i.transport,n=p({},y),o={field:g,dir:"asc"},r={type:a.type||"imagebrowser",sort:[n,o]};l(a)&&(a.path=d(t.path,t),r.transport=a),l(i.schema)?r.schema=i.schema:a.type&&l(s.data.schemas[a.type])&&(e=s.data.schemas[a.type]),t.dataSource&&t._errorHandler?t.dataSource.unbind(m,t._errorHandler):t._errorHandler=d(t._error,t),t.dataSource=s.data.DataSource.create(r).bind(m,t._errorHandler)},_loadImage:function(t){var i=this,a=e(t),n=i.dataSource.getByUid(a.attr(s.attr("uid"))),o=n.get(g),r=i.options.transport.thumbnailUrl,l=e("<img />",{alt:o}),d="?";n._uploading||(l.hide().on("load"+h,function(){e(this).prev().remove().end().addClass("k-image").fadeIn()}),a.find(".k-i-loading").after(l),u(r)?r=r(i.path(),encodeURIComponent(o)):(r.indexOf("?")>=0&&(d="&"),r=r+d+"path="+encodeURIComponent(i.path()+o),n._override&&(r+="&_="+(new Date).getTime(),delete n._override)),l.attr("src",r),t.loaded=!0)},_scroll:function(){var e=this;e.options.transport&&e.options.transport.thumbnailUrl&&(clearTimeout(e._timeout),e._timeout=setTimeout(function(){var t=s._outerHeight(e.list),i=e.list.scrollTop(),a=i+t;e._tiles.each(function(){var t=n(this),o=t+this.offsetHeight;if((t>=i&&t<a||o>=i&&o<a)&&e._loadImage(this),t>a)return!1}),e._tiles=e._tiles.filter(function(){return!this.loaded})},250))},_itemTmpl:function(){var e=this,t='<li class="k-tile" '+s.attr("uid")+'="#=uid#" ';return t+=s.attr("type")+'="${'+v+'}">',t+="#if("+v+' == "d") { #',t+='<div class="k-thumb"><span class="k-icon k-i-folder"></span></div>',t+="#}else{#",t+=e.options.transport&&e.options.transport.thumbnailUrl?'<div class="k-thumb"><span class="k-icon k-i-loading"></span></div>':'<div class="k-thumb"><span class="k-icon k-i-file"></span></div>',t+="#}#",t+="<strong>${"+g+"}</strong>",t+="#if("+v+' == "f") { # <span class="k-filesize">${this.sizeFormatter('+_+")}</span> #}#",t+="</li>",d(s.template(t),{sizeFormatter:a})}}),s.ui.plugin(o)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()});
//# sourceMappingURL=kendo.imagebrowser.min.js.map
