diff --git a/js/jquery.plupload.queue/jquery.plupload.queue.js b/js/jquery.plupload.queue/jquery.plupload.queue.js index 93ab3aa10..94622c07a 100644 --- a/js/jquery.plupload.queue/jquery.plupload.queue.js +++ b/js/jquery.plupload.queue/jquery.plupload.queue.js @@ -1,8 +1,8 @@ /** * jquery.plupload.queue.js * - * Copyright 2009, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing diff --git a/js/jquery.plupload.queue/jquery.plupload.queue.min.js b/js/jquery.plupload.queue/jquery.plupload.queue.min.js index 4a78590f9..420511408 100644 --- a/js/jquery.plupload.queue/jquery.plupload.queue.min.js +++ b/js/jquery.plupload.queue/jquery.plupload.queue.min.js @@ -1 +1 @@ -;(function(e){function n(e){return plupload.translate(e)||e}function r(t,r){r.contents().each(function(t,n){n=e(n),n.is(".plupload")||n.remove()}),r.prepend('
'+'
'+'
'+'
'+'
'+n("Select files")+"
"+'
'+n("Add files to the upload queue and click the start button.")+"
"+"
"+"
"+'
'+'
'+'
'+n("Filename")+"
"+'
 
'+'
'+n("Status")+"
"+'
'+n("Size")+"
"+'
 
'+"
"+'
    '+'"+"
    "+"
    "+"
    "+''+"
    ")}var t={};e.fn.pluploadQueue=function(i){return i?(this.each(function(){function f(t){var n;t.status==plupload.DONE&&(n="plupload_done"),t.status==plupload.FAILED&&(n="plupload_failed"),t.status==plupload.QUEUED&&(n="plupload_delete"),t.status==plupload.UPLOADING&&(n="plupload_uploading");var r=e("#"+t.id).attr("class",n).find("a").css("display","block");t.hint&&r.attr("title",t.hint)}function l(){e("span.plupload_total_status",o).html(s.total.percent+"%"),e("div.plupload_progress_bar",o).css("width",s.total.percent+"%"),e("span.plupload_upload_status",o).html(plupload.sprintf(n("Uploaded %d/%d files"),s.total.uploaded,s.files.length))}function c(){var t=e("ul.plupload_filelist",o).html(""),r=0,i;e.each(s.files,function(n,o){i="",o.status==plupload.DONE&&(o.target_name&&(i+=''),i+='',i+='',r++,e("#"+u+"_count").val(r)),t.append('
  • '+'
    '+o.name+"
    "+'
    '+'
    '+o.percent+"%
    "+'
    '+plupload.formatSize(o.size)+"
    "+'
     
    '+i+"
  • "),f(o),e("#"+o.id+".plupload_delete a").click(function(t){e("#"+o.id).remove(),s.removeFile(o),t.preventDefault()})}),e("span.plupload_total_file_size",o).html(plupload.formatSize(s.total.size)),s.total.queued===0?e("span.plupload_add_text",o).html(n("Add Files")):e("span.plupload_add_text",o).html(plupload.sprintf(n("%d files queued"),s.total.queued)),e("a.plupload_start",o).toggleClass("plupload_disabled",s.files.length==s.total.uploaded+s.total.failed),t[0].scrollTop=t[0].scrollHeight,l(),!s.files.length&&s.features.dragdrop&&s.settings.dragdrop&&e("#"+u+"_filelist").append('
  • '+n("Drag files here.")+"
  • ")}function h(){delete t[u],s.destroy(),o.html(a),s=o=a=null}var s,o,u,a;o=e(this),u=o.attr("id"),u||(u=plupload.guid(),o.attr("id",u)),a=o.html(),r(u,o),i=e.extend({dragdrop:!0,browse_button:u+"_browse",container:u},i),i.dragdrop&&(i.drop_element=u+"_filelist"),s=new plupload.Uploader(i),t[u]=s,s.bind("UploadFile",function(t,n){e("#"+n.id).addClass("plupload_current_file")}),s.bind("Init",function(t,n){!i.unique_names&&i.rename&&o.on("click","#"+u+"_filelist div.plupload_file_name span",function(n){var r=e(n.target),i,s,o,u="";i=t.getFile(r.parents("li")[0].id),o=i.name,s=/^(.+)(\.[^.]+)$/.exec(o),s&&(o=s[1],u=s[2]),r.hide().after(''),r.next().val(o).focus().blur(function(){r.show().next().remove()}).keydown(function(t){var n=e(this);t.keyCode==13&&(t.preventDefault(),i.name=n.val()+u,r.html(i.name),n.blur())})}),e("#"+u+"_container").attr("title","Using runtime: "+n.runtime),e("a.plupload_start",o).click(function(t){e(this).hasClass("plupload_disabled")||s.start(),t.preventDefault()}),e("a.plupload_stop",o).click(function(e){e.preventDefault(),s.stop()}),e("a.plupload_start",o).addClass("plupload_disabled")}),s.bind("Error",function(t,r){var i=r.file,s;i&&(s=r.message,r.details&&(s+=" ("+r.details+")"),r.code==plupload.FILE_SIZE_ERROR&&alert(n("Error: File too large:")+" "+i.name),r.code==plupload.FILE_EXTENSION_ERROR&&alert(n("Error: Invalid file extension:")+" "+i.name),i.hint=s,e("#"+i.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",s)),r.code===plupload.INIT_ERROR&&setTimeout(function(){h()},1)}),s.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&e("#"+u+"_filelist").append('
  • '+n("Drag files here.")+"
  • ")}),s.init(),s.bind("StateChanged",function(){s.state===plupload.STARTED?(e("li.plupload_delete a,div.plupload_buttons",o).hide(),s.disableBrowse(!0),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",o).css("display","block"),e("span.plupload_upload_status",o).html("Uploaded "+s.total.uploaded+"/"+s.files.length+" files"),i.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",o).show()):(c(),e("a.plupload_stop,div.plupload_progress",o).hide(),e("a.plupload_delete",o).css("display","block"),i.multiple_queues&&s.total.uploaded+s.total.failed==s.files.length&&(e(".plupload_buttons,.plupload_upload_status",o).css("display","inline"),s.disableBrowse(!1),e(".plupload_start",o).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",o).hide()))}),s.bind("FilesAdded",c),s.bind("FilesRemoved",function(){var t=e("#"+u+"_filelist").scrollTop();c(),e("#"+u+"_filelist").scrollTop(t)}),s.bind("FileUploaded",function(e,t){f(t)}),s.bind("UploadProgress",function(t,n){e("#"+n.id+" div.plupload_file_status",o).html(n.percent+"%"),f(n),l()}),i.setup&&i.setup(s)}),this):t[e(this[0]).attr("id")]}})(jQuery); \ No newline at end of file +!function(e){function t(e){return plupload.translate(e)||e}function i(i,n){n.contents().each(function(t,i){i=e(i),i.is(".plupload")||i.remove()}),n.prepend('
    '+'
    '+'
    '+'
    '+'
    '+t("Select files")+"
    "+'
    '+t("Add files to the upload queue and click the start button.")+"
    "+"
    "+"
    "+'
    '+'
    '+'
    '+t("Filename")+"
    "+'
     
    '+'
    '+t("Status")+"
    "+'
    '+t("Size")+"
    "+'
     
    '+"
    "+'
      '+'"+"
      "+"
      "+"
      "+''+"
      ")}var n={};e.fn.pluploadQueue=function(r){return r?(this.each(function(){function o(t){var i;t.status==plupload.DONE&&(i="plupload_done"),t.status==plupload.FAILED&&(i="plupload_failed"),t.status==plupload.QUEUED&&(i="plupload_delete"),t.status==plupload.UPLOADING&&(i="plupload_uploading");var n=e("#"+t.id).attr("class",i).find("a").css("display","block");t.hint&&n.attr("title",t.hint)}function s(){e("span.plupload_total_status",c).html(u.total.percent+"%"),e("div.plupload_progress_bar",c).css("width",u.total.percent+"%"),e("span.plupload_upload_status",c).html(plupload.sprintf(t("Uploaded %d/%d files"),u.total.uploaded,u.files.length))}function a(){var i,n=e("ul.plupload_filelist",c).html(""),r=0;e.each(u.files,function(t,s){i="",s.status==plupload.DONE&&(s.target_name&&(i+=''),i+='',i+='',r++,e("#"+d+"_count").val(r)),n.append('
    • '+'
      '+s.name+"
      "+'
      '+'
      '+s.percent+"%
      "+'
      '+plupload.formatSize(s.size)+"
      "+'
       
      '+i+"
    • "),o(s),e("#"+s.id+".plupload_delete a").click(function(t){e("#"+s.id).remove(),u.removeFile(s),t.preventDefault()})}),e("span.plupload_total_file_size",c).html(plupload.formatSize(u.total.size)),0===u.total.queued?e("span.plupload_add_text",c).html(t("Add Files")):e("span.plupload_add_text",c).html(plupload.sprintf(t("%d files queued"),u.total.queued)),e("a.plupload_start",c).toggleClass("plupload_disabled",u.files.length==u.total.uploaded+u.total.failed),n[0].scrollTop=n[0].scrollHeight,s(),!u.files.length&&u.features.dragdrop&&u.settings.dragdrop&&e("#"+d+"_filelist").append('
    • '+t("Drag files here.")+"
    • ")}function l(){delete n[d],u.destroy(),c.html(p),u=c=p=null}var u,c,d,p;c=e(this),d=c.attr("id"),d||(d=plupload.guid(),c.attr("id",d)),p=c.html(),i(d,c),r=e.extend({dragdrop:!0,browse_button:d+"_browse",container:d},r),r.dragdrop&&(r.drop_element=d+"_filelist"),u=new plupload.Uploader(r),n[d]=u,u.bind("UploadFile",function(t,i){e("#"+i.id).addClass("plupload_current_file")}),u.bind("Init",function(t,i){!r.unique_names&&r.rename&&c.on("click","#"+d+"_filelist div.plupload_file_name span",function(i){var n,r,o,s=e(i.target),a="";n=t.getFile(s.parents("li")[0].id),o=n.name,r=/^(.+)(\.[^.]+)$/.exec(o),r&&(o=r[1],a=r[2]),s.hide().after(''),s.next().val(o).focus().blur(function(){s.show().next().remove()}).keydown(function(t){var i=e(this);13==t.keyCode&&(t.preventDefault(),n.name=i.val()+a,s.html(n.name),i.blur())})}),e("#"+d+"_container").attr("title","Using runtime: "+i.runtime),e("a.plupload_start",c).click(function(t){e(this).hasClass("plupload_disabled")||u.start(),t.preventDefault()}),e("a.plupload_stop",c).click(function(e){e.preventDefault(),u.stop()}),e("a.plupload_start",c).addClass("plupload_disabled")}),u.bind("Error",function(i,n){var r,o=n.file;o&&(r=n.message,n.details&&(r+=" ("+n.details+")"),n.code==plupload.FILE_SIZE_ERROR&&alert(t("Error: File too large:")+" "+o.name),n.code==plupload.FILE_EXTENSION_ERROR&&alert(t("Error: Invalid file extension:")+" "+o.name),o.hint=r,e("#"+o.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",r)),n.code===plupload.INIT_ERROR&&setTimeout(function(){l()},1)}),u.bind("PostInit",function(i){i.settings.dragdrop&&i.features.dragdrop&&e("#"+d+"_filelist").append('
    • '+t("Drag files here.")+"
    • ")}),u.init(),u.bind("StateChanged",function(){u.state===plupload.STARTED?(e("li.plupload_delete a,div.plupload_buttons",c).hide(),u.disableBrowse(!0),e("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",c).css("display","block"),e("span.plupload_upload_status",c).html("Uploaded "+u.total.uploaded+"/"+u.files.length+" files"),r.multiple_queues&&e("span.plupload_total_status,span.plupload_total_file_size",c).show()):(a(),e("a.plupload_stop,div.plupload_progress",c).hide(),e("a.plupload_delete",c).css("display","block"),r.multiple_queues&&u.total.uploaded+u.total.failed==u.files.length&&(e(".plupload_buttons,.plupload_upload_status",c).css("display","inline"),u.disableBrowse(!1),e(".plupload_start",c).addClass("plupload_disabled"),e("span.plupload_total_status,span.plupload_total_file_size",c).hide()))}),u.bind("FilesAdded",a),u.bind("FilesRemoved",function(){var t=e("#"+d+"_filelist").scrollTop();a(),e("#"+d+"_filelist").scrollTop(t)}),u.bind("FileUploaded",function(e,t){o(t)}),u.bind("UploadProgress",function(t,i){e("#"+i.id+" div.plupload_file_status",c).html(i.percent+"%"),o(i),s()}),r.setup&&r.setup(u)}),this):n[e(this[0]).attr("id")]}}(jQuery); \ No newline at end of file diff --git a/js/jquery.ui.plupload/jquery.ui.plupload.js b/js/jquery.ui.plupload/jquery.ui.plupload.js index 0ed5030f9..7035b3aac 100644 --- a/js/jquery.ui.plupload/jquery.ui.plupload.js +++ b/js/jquery.ui.plupload/jquery.ui.plupload.js @@ -1,8 +1,8 @@ /** * jquery.ui.plupload.js * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -1068,6 +1068,7 @@ $.widget("ui.plupload", { width: self.options.thumb_width, height: self.options.thumb_height, crop: true, + fit: true, preserveHeaders: false, swf_url: plupload.resolveUrl(self.options.flash_swf_url), xap_url: plupload.resolveUrl(self.options.silverlight_xap_url) diff --git a/js/jquery.ui.plupload/jquery.ui.plupload.min.js b/js/jquery.ui.plupload/jquery.ui.plupload.min.js index 32024be06..fceb0c439 100644 --- a/js/jquery.ui.plupload/jquery.ui.plupload.min.js +++ b/js/jquery.ui.plupload/jquery.ui.plupload.min.js @@ -1 +1 @@ -;(function(e,t,n,r){function s(e){return n.translate(e)||e}function o(e){e.id=e.attr("id"),e.html('
      '+s("Select files")+"
      "+'
      '+s("Add files to the upload queue and click the start button.")+"
      "+'
      '+'"+'"+"
      "+"
      "+"
      "+''+""+'"+'"+'"+''+""+"
      '+s("Filename")+"'+s("Status")+"'+s("Size")+" 
      "+'
      '+'
      '+s("Drag files here.")+"
      "+'
      '+'
       
      '+"
      "+''+""+'"+''+''+''+""+""+"
      "+''+"
      ")}var i={};r.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",filters:{},buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},thumb_width:100,thumb_height:60,multiple_queues:!0,dragdrop:!0,autostart:!1,sortable:!1,rename:!1},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=n.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),o(this.element),this.container=r(".plupload_container",this.element).attr("id",e+"_container"),this.content=r(".plupload_content",this.element),r.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=r(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=r(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=r(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=r(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=r("#"+e+"_view_thumbs"),this.list_switcher=r("#"+e+"_view_list"),r.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=r(".plupload_progress_container",this.container),r.ui.progressbar&&this.progressbar.progressbar(),this.counter=r(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e=this,t=this.id,o,u={container:t+"_buttons",browse_button:t+"_browse",required_features:{},filters:{}};r(".plupload_buttons",this.element).attr("id",t+"_buttons"),e.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),u.drop_element=this.id+"_dropbox"),this.filelist.on("click",function(t){r(t.target).hasClass("plupload_action_icon")&&(e.removeFile(r(t.target).closest(".plupload_file").attr("id")),t.preventDefault())}),e.options.views.thumbs&&(u.required_features.display_media=!0),e.options.max_file_count&&(u.filters.max_file_count=e.options.max_file_count),o=this.uploader=i[t]=new n.Uploader(r.extend(this.options,u)),this.options=o.getOption(),n.addFileFilter("max_file_count",function(t,n,r){t<=this.files.length-(this.total.uploaded+this.total.failed)?(e.browse_button.button("disable"),this.disableBrowse(),this.trigger("Error",{code:e.FILE_COUNT_ERROR,message:s("File count error."),file:n}),r(!1)):r(!0)}),o.bind("Error",function(t,r){var i,o="";i=""+r.message+"";switch(r.code){case n.FILE_EXTENSION_ERROR:o=n.sprintf(s("File: %s"),r.file.name);break;case n.FILE_SIZE_ERROR:o=n.sprintf(s("File: %s, size: %d, max file size: %d"),r.file.name,n.formatSize(r.file.size),n.formatSize(n.parseSize(t.getOption("filters").max_file_size)));break;case n.FILE_DUPLICATE_ERROR:o=n.sprintf(s("%s already present in the queue."),r.file.name);break;case e.FILE_COUNT_ERROR:o=n.sprintf(s("Upload element accepts only %d file(s) at a time. Extra files were stripped."),t.getOption("filters").max_file_count||0);break;case n.IMAGE_FORMAT_ERROR:o=s("Image format either wrong or not supported.");break;case n.IMAGE_MEMORY_ERROR:o=s("Runtime ran out of available memory.");break;case n.HTTP_ERROR:o=s("Upload URL might be wrong or doesn't exist.")}i+="
      "+o+"",e._trigger("error",null,{up:t,error:r}),r.code===n.INIT_ERROR?setTimeout(function(){e.destroy()},1):e.notify("error",i)}),o.bind("PostInit",function(t){e.options.buttons.browse?e.browse_button.button("enable"):(e.browse_button.button("disable").hide(),t.disableBrowse(!0)),e.options.buttons.start||e.start_button.button("disable").hide(),e.options.buttons.stop||e.stop_button.button("disable").hide(),!e.options.unique_names&&e.options.rename&&e._enableRenaming(),e.options.dragdrop&&t.features.dragdrop&&e.filelist.parent().addClass("plupload_dropbox"),e._enableViewSwitcher(),e.start_button.click(function(t){r(this).button("option","disabled")||e.start(),t.preventDefault()}),e.stop_button.click(function(t){e.stop(),t.preventDefault()}),e._trigger("ready",null,{up:t})}),o.init(),o.bind("FileFiltered",function(t,n){e._addFiles(n)}),o.bind("FilesAdded",function(t,n){e._trigger("selected",null,{up:t,files:n}),e.options.sortable&&r.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e.options.autostart&&setTimeout(function(){e.start()},10)}),o.bind("FilesRemoved",function(t,n){r.ui.sortable&&e.options.sortable&&r("tbody",e.filelist).sortable("destroy"),r.each(n,function(e,t){r("#"+t.id).toggle("highlight",function(){r(this).remove()})}),t.files.length&&e.options.sortable&&r.ui.sortable&&e._enableSortingList(),e._trigger("updatelist",null,{filelist:e.filelist}),e._trigger("removed",null,{up:t,files:n})}),o.bind("QueueChanged",function(){e._handleState()}),o.bind("StateChanged",function(t){e._handleState(),n.STARTED===t.state?e._trigger("started",null,{up:this.uploader}):n.STOPPED===t.state&&e._trigger("stopped",null,{up:this.uploader})}),o.bind("UploadFile",function(t,n){e._handleFileStatus(n)}),o.bind("FileUploaded",function(t,n,r){e._handleFileStatus(n),e._trigger("uploaded",null,{up:t,file:n,result:r})}),o.bind("UploadProgress",function(t,n){e._handleFileStatus(n),e._updateTotalProgress(),e._trigger("progress",null,{up:t,file:n})}),o.bind("UploadComplete",function(t,n){e._addFormFields(),e._trigger("complete",null,{up:t,files:n})})},_setOption:function(e,t){var n=this;e=="buttons"&&typeof t=="object"&&(t=r.extend(n.options.buttons,t),t.browse?(n.browse_button.button("enable").show(),n.uploader.disableBrowse(!1)):(n.browse_button.button("disable").hide(),n.uploader.disableBrowse(!0)),t.start?n.start_button.button("enable").show():n.start_button.button("disable").hide(),t.stop?n.start_button.button("enable").show():n.stop_button.button("disable").hide()),n.uploader.setOption(e,t)},start:function(){this.uploader.start()},stop:function(){this.uploader.stop()},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return typeof e=="number"?t=this.uploader.files[e]:t=this.uploader.getFile(e),t},getFiles:function(){return this.uploader.files},removeFile:function(e){n.typeOf(e)==="string"&&(e=this.getFile(e)),this.uploader.removeFile(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var n=r('
      '+'

      '+t+"

      "+"
      ");n.addClass("ui-state-"+(e==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(e==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){n.remove()}).end(),r(".plupload_header",this.container).append(n)},destroy:function(){this.uploader.destroy(),r(".plupload_button",this.element).unbind(),r.ui.button&&r(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),r.ui.progressbar&&this.progressbar.progressbar("destroy"),r.ui.sortable&&this.options.sortable&&r("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",r.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader,t=e.files.length-(e.total.uploaded+e.total.failed),i=e.getOption("filters").max_file_count||0;n.STARTED===e.state?(r([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),this.start_button.button("disable"),this.options.multiple_queues||(this.browse_button.button("disable"),e.disableBrowse()),r(".plupload_upload_status",this.element).html(n.sprintf(s("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),r(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):n.STOPPED===e.state&&(r([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),t?this.start_button.button("enable"):this.start_button.button("disable"),this.options.multiple_queues&&r(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"),this.options.multiple_queues&&i&&i>t&&(this.browse_button.button("enable"),e.disableBrowse(!1)),this._updateTotalProgress()),e.total.queued===0?r(".ui-button-text",this.browse_button).html(s("Add Files")):r(".ui-button-text",this.browse_button).html(n.sprintf(s("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t=r("#"+e.id),i,s;if(!t.length)return;switch(e.status){case n.DONE:i="plupload_done",s="plupload_action_icon ui-icon ui-icon-circle-check";break;case n.FAILED:i="ui-state-error plupload_failed",s="plupload_action_icon ui-icon ui-icon-alert";break;case n.QUEUED:i="plupload_delete",s="plupload_action_icon ui-icon ui-icon-circle-minus";break;case n.UPLOADING:i="ui-state-highlight plupload_uploading",s="plupload_action_icon ui-icon ui-icon-circle-arrow-w";var o=r(".plupload_scroll",this.container),u=o.scrollTop(),a=o.height(),f=t.position().top+t.height();a
      {ext}
      {percent}
      {name}
      {size}
      ',n.typeOf(e)!=="array"&&(e=[e]),r.each(e,function(e,r){var o=r.name.match(/\.([^.]+)$/),u=o&&o[1].toLowerCase()||"none";s+=i.replace(/\{(\w+)\}/g,function(e,i){switch(i){case"thumb_width":case"thumb_height":return t.options[i];case"size":return n.formatSize(r.size);case"ext":return u;default:return r[i]||""}})}),t.filelist.append(s)},_addFormFields:function(){var e=this;r(".plupload_file_fields",this.filelist).html(""),n.each(this.uploader.files,function(t,i){var s="",o=e.id+"_"+i;t.target_name&&(s+=''),s+='',s+='',r("#"+t.id).find(".plupload_file_fields").html(s)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&r.cookie&&r.cookie("plupload_ui_view",e,{expires:7,path:"/"}),n.ua.browser==="IE"&&n.ua.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+(e==="list"?132:102)+")"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e=this,t,i=r(".plupload_view_switch",this.container),s,o;n.each(["list","thumbs"],function(t){e.options.views[t]||i.find('[for="'+e.id+"_view_"+t+'"], #'+e.id+"_view_"+t).remove()}),s=i.find(".plupload_button"),s.length===1?(i.hide(),t=s.eq(0).data("view"),this._viewChanged(t)):r.ui.button&&s.length>1?(this.options.views.remember&&r.cookie&&(t=r.cookie("plupload_ui_view")),~n.inArray(t,["list","thumbs"])||(t=this.options.views.active),i.show().buttonset().find(".ui-button").click(function(n){t=r(this).data("view"),e._viewChanged(t),n.preventDefault()}),o=i.find('[for="'+e.id+"_view_"+t+'"]'),o.length&&o.trigger("click")):(i.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var n=r(t.target),i,s,o,u,a="";if(!n.hasClass("plupload_file_name_wrapper"))return;s=e.uploader.getFile(n.closest(".plupload_file")[0].id),u=s.name,o=/^(.+)(\.[^.]+)$/.exec(u),o&&(u=o[1],a=o[2]),i=r('').width(n.width()).insertAfter(n.hide()),i.val(u).blur(function(){n.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=r(this);r.inArray(e.keyCode,[13,27])!==-1&&(e.preventDefault(),e.keyCode===13&&(s.name=t.val()+a,n.html(s.name)),t.blur())})[0].focus()})},_enableSortingList:function(){var e=this;if(r(".plupload_file",this.filelist).length<2)return;r("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];r.each(r(this).sortable("toArray"),function(n,r){t[t.length]=e.uploader.getFile(r)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}})}})})(window,document,plupload,jQuery); \ No newline at end of file +!function(e,t,i,n){function r(e){return i.translate(e)||e}function o(e){e.id=e.attr("id"),e.html('
      '+r("Select files")+"
      "+'
      '+r("Add files to the upload queue and click the start button.")+"
      "+'
      '+'"+'"+"
      "+"
      "+"
      "+''+""+'"+'"+'"+''+""+"
      '+r("Filename")+"'+r("Status")+"'+r("Size")+" 
      "+'
      '+'
      '+r("Drag files here.")+"
      "+'
      '+'
       
      '+"
      "+''+""+'"+''+''+''+""+""+"
      "+''+"
      ")}var s={};n.widget("ui.plupload",{widgetEventPrefix:"",contents_bak:"",options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",filters:{},buttons:{browse:!0,start:!0,stop:!0},views:{list:!0,thumbs:!1,active:"list",remember:!0},thumb_width:100,thumb_height:60,multiple_queues:!0,dragdrop:!0,autostart:!1,sortable:!1,rename:!1},FILE_COUNT_ERROR:-9001,_create:function(){var e=this.element.attr("id");e||(e=i.guid(),this.element.attr("id",e)),this.id=e,this.contents_bak=this.element.html(),o(this.element),this.container=n(".plupload_container",this.element).attr("id",e+"_container"),this.content=n(".plupload_content",this.element),n.fn.resizable&&this.container.resizable({handles:"s",minHeight:300}),this.filelist=n(".plupload_filelist_content",this.container).attr({id:e+"_filelist",unselectable:"on"}),this.browse_button=n(".plupload_add",this.container).attr("id",e+"_browse"),this.start_button=n(".plupload_start",this.container).attr("id",e+"_start"),this.stop_button=n(".plupload_stop",this.container).attr("id",e+"_stop"),this.thumbs_switcher=n("#"+e+"_view_thumbs"),this.list_switcher=n("#"+e+"_view_list"),n.ui.button&&(this.browse_button.button({icons:{primary:"ui-icon-circle-plus"},disabled:!0}),this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:!0}),this.stop_button.button({icons:{primary:"ui-icon-circle-close"}}),this.list_switcher.button({text:!1,icons:{secondary:"ui-icon-grip-dotted-horizontal"}}),this.thumbs_switcher.button({text:!1,icons:{secondary:"ui-icon-image"}})),this.progressbar=n(".plupload_progress_container",this.container),n.ui.progressbar&&this.progressbar.progressbar(),this.counter=n(".plupload_count",this.element).attr({id:e+"_count",name:e+"_count"}),this._initUploader()},_initUploader:function(){var e,t=this,o=this.id,a={container:o+"_buttons",browse_button:o+"_browse",required_features:{},filters:{}};n(".plupload_buttons",this.element).attr("id",o+"_buttons"),t.options.dragdrop&&(this.filelist.parent().attr("id",this.id+"_dropbox"),a.drop_element=this.id+"_dropbox"),this.filelist.on("click",function(e){n(e.target).hasClass("plupload_action_icon")&&(t.removeFile(n(e.target).closest(".plupload_file").attr("id")),e.preventDefault())}),t.options.views.thumbs&&(a.required_features.display_media=!0),t.options.max_file_count&&(a.filters.max_file_count=t.options.max_file_count),e=this.uploader=s[o]=new i.Uploader(n.extend(this.options,a)),this.options=e.getOption(),i.addFileFilter("max_file_count",function(e,i,n){e<=this.files.length-(this.total.uploaded+this.total.failed)?(t.browse_button.button("disable"),this.disableBrowse(),this.trigger("Error",{code:t.FILE_COUNT_ERROR,message:r("File count error."),file:i}),n(!1)):n(!0)}),e.bind("Error",function(e,n){var o,s="";switch(o=""+n.message+"",n.code){case i.FILE_EXTENSION_ERROR:s=i.sprintf(r("File: %s"),n.file.name);break;case i.FILE_SIZE_ERROR:s=i.sprintf(r("File: %s, size: %d, max file size: %d"),n.file.name,i.formatSize(n.file.size),i.formatSize(i.parseSize(e.getOption("filters").max_file_size)));break;case i.FILE_DUPLICATE_ERROR:s=i.sprintf(r("%s already present in the queue."),n.file.name);break;case t.FILE_COUNT_ERROR:s=i.sprintf(r("Upload element accepts only %d file(s) at a time. Extra files were stripped."),e.getOption("filters").max_file_count||0);break;case i.IMAGE_FORMAT_ERROR:s=r("Image format either wrong or not supported.");break;case i.IMAGE_MEMORY_ERROR:s=r("Runtime ran out of available memory.");break;case i.HTTP_ERROR:s=r("Upload URL might be wrong or doesn't exist.")}o+="
      "+s+"",t._trigger("error",null,{up:e,error:n}),n.code===i.INIT_ERROR?setTimeout(function(){t.destroy()},1):t.notify("error",o)}),e.bind("PostInit",function(e){t.options.buttons.browse?t.browse_button.button("enable"):(t.browse_button.button("disable").hide(),e.disableBrowse(!0)),t.options.buttons.start||t.start_button.button("disable").hide(),t.options.buttons.stop||t.stop_button.button("disable").hide(),!t.options.unique_names&&t.options.rename&&t._enableRenaming(),t.options.dragdrop&&e.features.dragdrop&&t.filelist.parent().addClass("plupload_dropbox"),t._enableViewSwitcher(),t.start_button.click(function(e){n(this).button("option","disabled")||t.start(),e.preventDefault()}),t.stop_button.click(function(e){t.stop(),e.preventDefault()}),t._trigger("ready",null,{up:e})}),e.init(),e.bind("FileFiltered",function(e,i){t._addFiles(i)}),e.bind("FilesAdded",function(e,i){t._trigger("selected",null,{up:e,files:i}),t.options.sortable&&n.ui.sortable&&t._enableSortingList(),t._trigger("updatelist",null,{filelist:t.filelist}),t.options.autostart&&setTimeout(function(){t.start()},10)}),e.bind("FilesRemoved",function(e,i){n.ui.sortable&&t.options.sortable&&n("tbody",t.filelist).sortable("destroy"),n.each(i,function(e,t){n("#"+t.id).toggle("highlight",function(){n(this).remove()})}),e.files.length&&t.options.sortable&&n.ui.sortable&&t._enableSortingList(),t._trigger("updatelist",null,{filelist:t.filelist}),t._trigger("removed",null,{up:e,files:i})}),e.bind("QueueChanged",function(){t._handleState()}),e.bind("StateChanged",function(e){t._handleState(),i.STARTED===e.state?t._trigger("started",null,{up:this.uploader}):i.STOPPED===e.state&&t._trigger("stopped",null,{up:this.uploader})}),e.bind("UploadFile",function(e,i){t._handleFileStatus(i)}),e.bind("FileUploaded",function(e,i,n){t._handleFileStatus(i),t._trigger("uploaded",null,{up:e,file:i,result:n})}),e.bind("UploadProgress",function(e,i){t._handleFileStatus(i),t._updateTotalProgress(),t._trigger("progress",null,{up:e,file:i})}),e.bind("UploadComplete",function(e,i){t._addFormFields(),t._trigger("complete",null,{up:e,files:i})})},_setOption:function(e,t){var i=this;"buttons"==e&&"object"==typeof t&&(t=n.extend(i.options.buttons,t),t.browse?(i.browse_button.button("enable").show(),i.uploader.disableBrowse(!1)):(i.browse_button.button("disable").hide(),i.uploader.disableBrowse(!0)),t.start?i.start_button.button("enable").show():i.start_button.button("disable").hide(),t.stop?i.start_button.button("enable").show():i.stop_button.button("disable").hide()),i.uploader.setOption(e,t)},start:function(){this.uploader.start()},stop:function(){this.uploader.stop()},enable:function(){this.browse_button.button("enable"),this.uploader.disableBrowse(!1)},disable:function(){this.browse_button.button("disable"),this.uploader.disableBrowse(!0)},getFile:function(e){var t;return t="number"==typeof e?this.uploader.files[e]:this.uploader.getFile(e)},getFiles:function(){return this.uploader.files},removeFile:function(e){"string"===i.typeOf(e)&&(e=this.getFile(e)),this.uploader.removeFile(e)},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},notify:function(e,t){var i=n('
      '+'

      '+t+"

      "+"
      ");i.addClass("ui-state-"+("error"===e?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+("error"===e?"alert":"info")).end().find(".plupload_message_close").click(function(){i.remove()}).end(),n(".plupload_header",this.container).append(i)},destroy:function(){this.uploader.destroy(),n(".plupload_button",this.element).unbind(),n.ui.button&&n(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy"),n.ui.progressbar&&this.progressbar.progressbar("destroy"),n.ui.sortable&&this.options.sortable&&n("tbody",this.filelist).sortable("destroy"),this.element.empty().html(this.contents_bak),this.contents_bak="",n.Widget.prototype.destroy.apply(this)},_handleState:function(){var e=this.uploader,t=e.files.length-(e.total.uploaded+e.total.failed),o=e.getOption("filters").max_file_count||0;i.STARTED===e.state?(n([]).add(this.stop_button).add(".plupload_started").removeClass("plupload_hidden"),this.start_button.button("disable"),this.options.multiple_queues||(this.browse_button.button("disable"),e.disableBrowse()),n(".plupload_upload_status",this.element).html(i.sprintf(r("Uploaded %d/%d files"),e.total.uploaded,e.files.length)),n(".plupload_header_content",this.element).addClass("plupload_header_content_bw")):i.STOPPED===e.state&&(n([]).add(this.stop_button).add(".plupload_started").addClass("plupload_hidden"),t?this.start_button.button("enable"):this.start_button.button("disable"),this.options.multiple_queues&&n(".plupload_header_content",this.element).removeClass("plupload_header_content_bw"),this.options.multiple_queues&&o&&o>t&&(this.browse_button.button("enable"),e.disableBrowse(!1)),this._updateTotalProgress()),0===e.total.queued?n(".ui-button-text",this.browse_button).html(r("Add Files")):n(".ui-button-text",this.browse_button).html(i.sprintf(r("%d files queued"),e.total.queued)),e.refresh()},_handleFileStatus:function(e){var t,r,o=n("#"+e.id);if(o.length){switch(e.status){case i.DONE:t="plupload_done",r="plupload_action_icon ui-icon ui-icon-circle-check";break;case i.FAILED:t="ui-state-error plupload_failed",r="plupload_action_icon ui-icon ui-icon-alert";break;case i.QUEUED:t="plupload_delete",r="plupload_action_icon ui-icon ui-icon-circle-minus";break;case i.UPLOADING:t="ui-state-highlight plupload_uploading",r="plupload_action_icon ui-icon ui-icon-circle-arrow-w";var s=n(".plupload_scroll",this.container),a=s.scrollTop(),u=s.height(),l=o.position().top+o.height();l>u&&s.scrollTop(a+l-u),o.find(".plupload_file_percent").html(e.percent+"%").end().find(".plupload_file_progress").css("width",e.percent+"%").end().find(".plupload_file_size").html(i.formatSize(e.size))}t+=" ui-state-default plupload_file",o.attr("class",t).find(".plupload_action_icon").attr("class",r)}},_updateTotalProgress:function(){var e=this.uploader;this.filelist[0].scrollTop=this.filelist[0].scrollHeight,this.progressbar.progressbar("value",e.total.percent),this.element.find(".plupload_total_status").html(e.total.percent+"%").end().find(".plupload_total_file_size").html(i.formatSize(e.total.size)).end().find(".plupload_upload_status").html(i.sprintf(r("Uploaded %d/%d files"),e.total.uploaded,e.files.length))},_displayThumbs:function(){function e(e,t,i){var n;e.on(t,function(){clearTimeout(n),n=setTimeout(function(){clearTimeout(n),i()},300)})}function t(){if(!u||!l){var e=n(".plupload_file:eq(0)",d.filelist);u=e.outerWidth(!0),l=e.outerHeight(!0)}var t=d.content.width(),i=d.content.height();c=Math.floor(t/u),p=c*(Math.ceil(i/l)+1)}function r(){var e=Math.floor(d.content.scrollTop()/l)*c;h=n(".plupload_file .plupload_file_thumb",d.filelist).slice(e,e+p).filter(".plupload_thumb_toload").get()}function o(){function i(){"thumbs"===d.view_mode&&(t(),r(),a())}n.fn.resizable&&e(d.container,"resize",i),e(d.window,"resize",i),e(d.content,"scroll",i),d.element.on("viewchanged selected",i),i()}function s(e,t){var r=new i.Image;r.onload=function(){var t=n("#"+e.id+" .plupload_file_thumb",d.filelist);this.embed(t[0],{width:d.options.thumb_width,height:d.options.thumb_height,crop:!0,fit:!0,preserveHeaders:!1,swf_url:i.resolveUrl(d.options.flash_swf_url),xap_url:i.resolveUrl(d.options.silverlight_xap_url)})},r.bind("embedded error",function(i){n("#"+e.id,d.filelist).find(".plupload_file_thumb").removeClass("plupload_thumb_loading").addClass("plupload_thumb_"+i.type),this.destroy(),setTimeout(t,1)}),n("#"+e.id,d.filelist).find(".plupload_file_thumb").removeClass("plupload_thumb_toload").addClass("plupload_thumb_loading"),r.load(e.getSource())}function a(){"thumbs"!==d.view_mode||f||(r(),h.length&&(f=!0,s(d.getFile(n(h.shift()).closest(".plupload_file").attr("id")),function(){f=!1,a()})))}var u,l,c,d=this,p=0,h=[],f=!1;this.options.views.thumbs&&this.element.on("selected",function m(){d.element.off("selected",m),o()})},_addFiles:function(e){var t,r=this,o="";t='
    • {ext}
      {percent}
      {name}
      {size}
    • ',"array"!==i.typeOf(e)&&(e=[e]),n.each(e,function(e,n){var s=n.name.match(/\.([^.]+)$/),a=s&&s[1].toLowerCase()||"none";o+=t.replace(/\{(\w+)\}/g,function(e,t){switch(t){case"thumb_width":case"thumb_height":return r.options[t];case"size":return i.formatSize(n.size);case"ext":return a;default:return n[t]||""}})}),r.filelist.append(o)},_addFormFields:function(){var e=this;n(".plupload_file_fields",this.filelist).html(""),i.each(this.uploader.files,function(t,r){var o="",s=e.id+"_"+r;t.target_name&&(o+=''),o+='',o+='',n("#"+t.id).find(".plupload_file_fields").html(o)}),this.counter.val(this.uploader.files.length)},_viewChanged:function(e){this.options.views.remember&&n.cookie&&n.cookie("plupload_ui_view",e,{expires:7,path:"/"}),"IE"===i.ua.browser&&i.ua.version<7&&this.content.attr("style",'height:expression(document.getElementById("'+this.id+"_container"+'").clientHeight - '+("list"===e?132:102)+")"),this.container.removeClass("plupload_view_list plupload_view_thumbs").addClass("plupload_view_"+e),this.view_mode=e,this._trigger("viewchanged",null,{view:e})},_enableViewSwitcher:function(){var e,t,r,o=this,s=n(".plupload_view_switch",this.container);i.each(["list","thumbs"],function(e){o.options.views[e]||s.find('[for="'+o.id+"_view_"+e+'"], #'+o.id+"_view_"+e).remove()}),t=s.find(".plupload_button"),1===t.length?(s.hide(),e=t.eq(0).data("view"),this._viewChanged(e)):n.ui.button&&t.length>1?(this.options.views.remember&&n.cookie&&(e=n.cookie("plupload_ui_view")),~i.inArray(e,["list","thumbs"])||(e=this.options.views.active),s.show().buttonset().find(".ui-button").click(function(t){e=n(this).data("view"),o._viewChanged(e),t.preventDefault()}),r=s.find('[for="'+o.id+"_view_"+e+'"]'),r.length&&r.trigger("click")):(s.show(),this._viewChanged(this.options.views.active)),this.options.views.thumbs&&this._displayThumbs()},_enableRenaming:function(){var e=this;this.filelist.dblclick(function(t){var i,r,o,s,a=n(t.target),u="";a.hasClass("plupload_file_name_wrapper")&&(r=e.uploader.getFile(a.closest(".plupload_file")[0].id),s=r.name,o=/^(.+)(\.[^.]+)$/.exec(s),o&&(s=o[1],u=o[2]),i=n('').width(a.width()).insertAfter(a.hide()),i.val(s).blur(function(){a.show().parent().scrollLeft(0).end().next().remove()}).keydown(function(e){var t=n(this);-1!==n.inArray(e.keyCode,[13,27])&&(e.preventDefault(),13===e.keyCode&&(r.name=t.val()+u,a.html(r.name)),t.blur())})[0].focus())})},_enableSortingList:function(){var e=this;n(".plupload_file",this.filelist).length<2||(n("tbody",this.filelist).sortable("destroy"),this.filelist.sortable({items:".plupload_delete",cancel:"object, .plupload_clearer",stop:function(){var t=[];n.each(n(this).sortable("toArray"),function(i,n){t[t.length]=e.uploader.getFile(n)}),t.unshift(t.length),t.unshift(0),Array.prototype.splice.apply(e.uploader.files,t)}}))}})}(window,document,plupload,jQuery); \ No newline at end of file diff --git a/js/plupload.dev.js b/js/plupload.dev.js index cc7725346..72f8ae819 100644 --- a/js/plupload.dev.js +++ b/js/plupload.dev.js @@ -1,14 +1,14 @@ /** * Plupload - multi-runtime File Uploader - * v3.0-beta1 + * v3.1.0 * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * - * Date: 2016-08-24 + * Date: 2017-03-07 */ ;var MXI_DEBUG = true; /** @@ -124,7 +124,7 @@ exports.defined = defined; exports.require = require; - expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/core/utils/Mime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/FileReader","plupload","moxie/file/File","moxie/file/FileDrop","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","plupload/FileUploader","moxie/runtime/Transporter","moxie/image/Image","plupload/ImageResizer","plupload/File","plupload/Uploader","moxie/runtime/html5/image/ResizerCanvas","moxie/runtime/html5/image/ResizerWebGL"]); + expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/core/utils/Mime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/FileReader","plupload","plupload/core/Collection","moxie/file/File","moxie/file/FileDrop","plupload/core/ArrCollection","plupload/core/Optionable","plupload/core/Queueable","plupload/core/Stats","plupload/core/Queue","plupload/QueueUpload","plupload/QueueResize","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","plupload/ChunkUploader","plupload/FileUploader","moxie/runtime/Transporter","moxie/image/Image","plupload/ImageResizer","plupload/File","plupload/Uploader","moxie/runtime/html5/image/ResizerCanvas"]); load('../src/moxie/src/javascript/core/utils/Basic.js'); load('../src/moxie/src/javascript/core/I18n.js'); @@ -145,6 +145,7 @@ load('../src/core/Collection.js'); load('../src/moxie/src/javascript/file/File.js'); load('../src/moxie/src/javascript/file/FileDrop.js'); + load('../src/core/ArrCollection.js'); load('../src/core/Optionable.js'); load('../src/core/Queueable.js'); load('../src/core/Stats.js'); @@ -175,7 +176,6 @@ load('../src/moxie/src/javascript/runtime/html5/image/PNG.js'); load('../src/moxie/src/javascript/runtime/html5/image/ImageInfo.js'); load('../src/moxie/src/javascript/runtime/html5/image/ResizerCanvas.js'); - load('../src/moxie/src/javascript/runtime/html5/image/ResizerWebGL.js'); load('../src/moxie/src/javascript/runtime/html5/image/Image.js'); load('../src/moxie/src/javascript/runtime/flash/Runtime.js'); load('../src/moxie/src/javascript/runtime/flash/file/Blob.js'); @@ -203,4 +203,4 @@ writeScripts(); })(this); -// $hash: 8611d36a03b190377b8abdcfe5d0b432 \ No newline at end of file +// $hash: 711c8d43de34dbad707151a4b4de710a \ No newline at end of file diff --git a/js/plupload.js b/js/plupload.js index 2df347f27..11423223b 100644 --- a/js/plupload.js +++ b/js/plupload.js @@ -1,16 +1,31 @@ /** * Plupload - multi-runtime File Uploader - * v3.0-beta1 + * v3.1.0 * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * - * Date: 2016-08-24 + * Date: 2017-03-07 */ ;var MXI_DEBUG = true; +;(function (global, factory) { + var extract = function() { + var ctx = {}; + factory.apply(ctx, arguments); + return ctx.plupload; + }; + + if (typeof define === "function" && define.amd) { + define("plupload", [], extract); + } else if (typeof module === "object" && module.exports) { + module.exports = extract(); + } else { + global.plupload = extract(); + } +}(this || window, function() { /** * Compiled inline version. (Library mode) */ @@ -135,7 +150,7 @@ define('moxie/core/utils/Basic', [], function() { // the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8 return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); } - + /** Extends the specified object with another object(s). @@ -146,7 +161,7 @@ define('moxie/core/utils/Basic', [], function() { @return {Object} Same as target, the extended object. */ function extend() { - return merge(false, arguments); + return merge(false, false, arguments); } @@ -160,24 +175,65 @@ define('moxie/core/utils/Basic', [], function() { @return {Object} Same as target, the extended object. */ function extendIf() { - return merge(true, arguments); + return merge(true, false, arguments); + } + + + function extendImmutable() { + return merge(false, true, arguments); + } + + + function extendImmutableIf() { + return merge(true, true, arguments); + } + + + function clone(value) { + switch (typeOf(value)) { + case 'array': + return merge(false, true, [[], value]); + + case 'object': + return merge(false, true, [{}, value]); + + default: + return value; + } } + function shallowCopy(obj) { + switch (typeOf(obj)) { + case 'array': + return Array.prototype.slice.call(obj); + + case 'object': + return extend({}, obj); + } + return obj; + } + - function merge(strict, args) { + function merge(strict, immutable, args) { var undef; var target = args[0]; each(args, function(arg, i) { if (i > 0) { each(arg, function(value, key) { + var isComplex = inArray(typeOf(value), ['array', 'object']) !== -1; + if (value === undef || strict && target[key] === undef) { return true; } - if (typeOf(target[key]) === typeOf(value) && inArray(typeOf(value), ['array', 'object']) !== -1) { - merge(strict, [target[key], value]); + if (isComplex && immutable) { + value = shallowCopy(value); + } + + if (typeOf(target[key]) === typeOf(value) && isComplex) { + merge(strict, immutable, [target[key], value]); } else { target[key] = value; } @@ -191,7 +247,7 @@ define('moxie/core/utils/Basic', [], function() { /** A way to inherit one `class` from another in a consisstent way (more or less) - + @method inherit @static @since >1.4.1 @@ -210,16 +266,25 @@ define('moxie/core/utils/Basic', [], function() { // give child `class` a place to define its own methods function ctor() { this.constructor = child; + + if (MXI_DEBUG) { + var getCtorName = function(fn) { + var m = fn.toString().match(/^function\s([^\(\s]+)/); + return m ? m[1] : false; + }; + + this.ctorName = getCtorName(child); + } } ctor.prototype = parent.prototype; child.prototype = new ctor(); // keep a way to reference parent methods - child.__parent__ = parent.prototype; + child.super = parent.prototype; return child; } - + /** Executes the callback function for each item in array/object. If you return false in the callback it will break the loop. @@ -261,7 +326,7 @@ define('moxie/core/utils/Basic', [], function() { /** Checks if object is empty. - + @method isEmptyObj @static @param {Object} o Object to check. @@ -318,7 +383,7 @@ define('moxie/core/utils/Basic', [], function() { /** Recieve an array of functions (usually async) to call in parallel, each function - receives a callback as first argument that it should call, when it completes. After + receives a callback as first argument that it should call, when it completes. After everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the process and invoke main callback immediately. @@ -336,7 +401,7 @@ define('moxie/core/utils/Basic', [], function() { if (error) { return cb(error); } - + var args = [].slice.call(arguments); args.shift(); // strip error - undefined or not @@ -346,15 +411,15 @@ define('moxie/core/utils/Basic', [], function() { if (count === num) { cbArgs.unshift(null); cb.apply(this, cbArgs); - } + } }); }); } - - + + /** Find an element in array and return it's index if present, otherwise return -1. - + @method inArray @static @param {Mixed} needle Element to find @@ -366,7 +431,7 @@ define('moxie/core/utils/Basic', [], function() { if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(array, needle); } - + for (var i = 0, length = array.length; i < length; i++) { if (array[i] === needle) { return i; @@ -400,7 +465,7 @@ define('moxie/core/utils/Basic', [], function() { for (var i in needles) { if (inArray(needles[i], array) === -1) { diff.push(needles[i]); - } + } } return diff.length ? diff : false; } @@ -424,11 +489,11 @@ define('moxie/core/utils/Basic', [], function() { }); return result.length ? result : null; } - - + + /** Forces anything into an array. - + @method toArray @static @param {Object} obj Object with length field. @@ -443,14 +508,14 @@ define('moxie/core/utils/Basic', [], function() { return arr; } - - + + /** Generates an unique ID. The only way a user would be able to get the same ID is if the two persons - at the same exact millisecond manage to get the same 5 random numbers between 0-65535; it also uses - a counter so each ID is guaranteed to be unique for the given page. It is more probable for the earth + at the same exact millisecond manage to get the same 5 random numbers between 0-65535; it also uses + a counter so each ID is guaranteed to be unique for the given page. It is more probable for the earth to be hit with an asteroid. - + @method guid @static @param {String} prefix to prepend (by default 'o' will be prepended). @@ -459,22 +524,22 @@ define('moxie/core/utils/Basic', [], function() { */ var guid = (function() { var counter = 0; - + return function(prefix) { var guid = new Date().getTime().toString(32), i; for (i = 0; i < 5; i++) { guid += Math.floor(Math.random() * 65535).toString(32); } - + return (prefix || 'o_') + guid + (counter++).toString(32); }; }()); - + /** Trims white spaces around the string - + @method trim @static @param {String} str @@ -490,7 +555,7 @@ define('moxie/core/utils/Basic', [], function() { /** Parses the specified size string into a byte value. For example 10kb becomes 10240. - + @method parseSizeStr @static @param {String/Number} size String to parse or number to just pass through. @@ -500,7 +565,7 @@ define('moxie/core/utils/Basic', [], function() { if (typeof(size) !== 'string') { return size; } - + var muls = { t: 1099511627776, g: 1073741824, @@ -512,7 +577,7 @@ define('moxie/core/utils/Basic', [], function() { size = /^([0-9\.]+)([tmgk]?)$/.exec(size.toLowerCase().replace(/[^0-9\.tmkg]/g, '')); mul = size[2]; size = +size[1]; - + if (muls.hasOwnProperty(mul)) { size *= muls[mul]; } @@ -529,27 +594,46 @@ define('moxie/core/utils/Basic', [], function() { function sprintf(str) { var args = [].slice.call(arguments, 1); - return str.replace(/%[a-z]/g, function() { + return str.replace(/%([a-z])/g, function($0, $1) { var value = args.shift(); - return typeOf(value) !== 'undefined' ? value : ''; + + switch ($1) { + case 's': + return value + ''; + + case 'd': + return parseInt(value, 10); + + case 'f': + return parseFloat(value); + + case 'c': + return ''; + + default: + return value; + } }); } - - - + + + function delay(cb, timeout) { var self = this; setTimeout(function() { cb.call(self); }, timeout || 1); } - + return { guid: guid, typeOf: typeOf, extend: extend, extendIf: extendIf, + extendImmutable: extendImmutable, + extendImmutableIf: extendImmutableIf, + clone: clone, inherit: inherit, each: each, isEmptyObj: isEmptyObj, @@ -649,7 +733,7 @@ define("moxie/core/I18n", [ define("moxie/core/utils/Env", [ "moxie/core/utils/Basic" ], function(Basic) { - + /** * UAParser.js v0.7.7 * Lightweight JavaScript-based User-Agent string parser @@ -852,7 +936,7 @@ define("moxie/core/utils/Env", [ var regexes = { browser : [[ - + // Presto based /(opera\smini)\/([\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet @@ -1241,7 +1325,7 @@ define("moxie/core/utils/Env", [ du.onload = function() { caps.use_data_uri = (du.width === 1 && du.height === 1); }; - + setTimeout(function() { du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="; }, 1); @@ -1282,14 +1366,14 @@ define("moxie/core/utils/Env", [ can: can, uaParser: UAParser, - + browser: uaResult.browser.name, version: uaResult.browser.version, os: uaResult.os.name, // everybody intuitively types it in a lowercase for some reason osVersion: uaResult.os.version, verComp: version_compare, - + swf_url: "../flash/Moxie.swf", xap_url: "../silverlight/Moxie.xap", global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent" @@ -1306,20 +1390,14 @@ define("moxie/core/utils/Env", [ }; Env.log = function() { - + function logObj(data) { // TODO: this should recursively print out the object in a pretty way console.appendChild(document.createTextNode(data + "\n")); } - var data = arguments[0]; - - if (Basic.typeOf(data) === 'string') { - data = Basic.sprintf.apply(this, arguments); - } - if (window && window.console && window.console.log) { - window.console.log(data); + window.console.log.apply(window.console, arguments); } else if (document) { var console = document.getElementById('moxie-console'); if (!console) { @@ -1329,11 +1407,15 @@ define("moxie/core/utils/Env", [ document.body.appendChild(console); } - if (Basic.inArray(Basic.typeOf(data), ['object', 'array']) !== -1) { + var data = arguments[0]; + if (Basic.typeOf(data) === 'string') { + data = Basic.sprintf.apply(this, arguments); + } else if (Basic.inArray(Basic.typeOf(data), ['object', 'array']) !== -1) { logObj(data); - } else { - console.appendChild(document.createTextNode(data + "\n")); + return; } + + console.appendChild(document.createTextNode(data + "\n")); } }; } @@ -1709,7 +1791,9 @@ define('moxie/core/utils/Events', [ * Contributing: http://www.plupload.com/contributing */ -define('moxie/core/utils/Url', [], function() { +define('moxie/core/utils/Url', [ + 'moxie/core/utils/Basic' +], function(Basic) { /** Parse url into separate components and fill in absent parts with parts from current url, based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js @@ -1728,24 +1812,36 @@ define('moxie/core/utils/Url', [], function() { https: 443 } , uri = {} - , regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/ + , regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/ , m = regex.exec(url || '') + , isRelative + , isSchemeLess = /^\/\/\w/.test(url) ; - + + switch (Basic.typeOf(currentUrl)) { + case 'undefined': + currentUrl = parseUrl(document.location.href, false); + break; + + case 'string': + currentUrl = parseUrl(currentUrl, false); + break; + } + while (i--) { if (m[i]) { uri[key[i]] = m[i]; } } - // when url is relative, we set the origin and the path ourselves - if (!uri.scheme) { - // come up with defaults - if (!currentUrl || typeof(currentUrl) === 'string') { - currentUrl = parseUrl(currentUrl || document.location.href); - } + isRelative = !isSchemeLess && !uri.scheme; + if (isSchemeLess || isRelative) { uri.scheme = currentUrl.scheme; + } + + // when url is relative, we set the origin and the path ourselves + if (isRelative) { uri.host = currentUrl.host; uri.port = currentUrl.port; @@ -1766,8 +1862,8 @@ define('moxie/core/utils/Url', [], function() { if (!uri.port) { uri.port = ports[uri.scheme] || 80; - } - + } + uri.port = parseInt(uri.port, 10); if (!uri.path) { @@ -1809,11 +1905,11 @@ define('moxie/core/utils/Url', [], function() { function origin(url) { return [url.scheme, url.host, url.port].join('/'); } - + if (typeof url === 'string') { url = parseUrl(url); - } - + } + return origin(parseUrl()) === origin(url); }; @@ -2015,7 +2111,7 @@ define('moxie/core/EventTarget', [ @class moxie/core/EventTarget @constructor EventTarget */ - function EventTarget() { + function EventTarget() { /** Unique id of the event dispatcher, usually overriden by children @@ -2027,7 +2123,7 @@ define('moxie/core/EventTarget', [ Basic.extend(EventTarget.prototype, { - + /** Can be called from within a child in order to acquire uniqie id in automated manner @@ -2055,9 +2151,9 @@ define('moxie/core/EventTarget', [ if (!this.hasOwnProperty('uid')) { this.uid = Basic.guid('uid_'); } - + type = Basic.trim(type); - + if (/\s/.test(type)) { // multiple event types were passed for one handler Basic.each(type.split(/\s+/), function(type) { @@ -2065,31 +2161,37 @@ define('moxie/core/EventTarget', [ }); return; } - + type = type.toLowerCase(); priority = parseInt(priority, 10) || 0; - + list = eventpool[this.uid] && eventpool[this.uid][type] || []; list.push({fn : fn, priority : priority, scope : scope || this}); - + if (!eventpool[this.uid]) { eventpool[this.uid] = {}; } eventpool[this.uid][type] = list; }, - + /** Check if any handlers were registered to the specified event @method hasEventListener - @param {String} type Type or basically a name of the event to check + @param {String} [type] Type or basically a name of the event to check @return {Mixed} Returns a handler if it was found and false, if - not */ hasEventListener: function(type) { - var list = type ? eventpool[this.uid] && eventpool[this.uid][type] : eventpool[this.uid]; + var list; + if (type) { + type = type.toLowerCase(); + list = eventpool[this.uid] && eventpool[this.uid][type]; + } else { + list = eventpool[this.uid]; + } return list ? list : false; }, - + /** Unregister the handler from the event, or if former was not specified - unregister all handlers @@ -2127,7 +2229,7 @@ define('moxie/core/EventTarget', [ // delete event list if it has become empty if (!list.length) { delete eventpool[this.uid][type]; - + // and object specific entry in a hash if it has no more listeners attached if (Basic.isEmptyObj(eventpool[this.uid])) { delete eventpool[this.uid]; @@ -2135,7 +2237,7 @@ define('moxie/core/EventTarget', [ } } }, - + /** Remove all event handlers from the object @@ -2146,7 +2248,7 @@ define('moxie/core/EventTarget', [ delete eventpool[this.uid]; } }, - + /** Dispatch the event @@ -2157,7 +2259,7 @@ define('moxie/core/EventTarget', [ */ dispatchEvent: function(type) { var uid, list, args, tmpEvt, evt = {}, result = true, undef; - + if (Basic.typeOf(type) !== 'string') { // we can't use original object directly (because of Silverlight) tmpEvt = type; @@ -2174,7 +2276,7 @@ define('moxie/core/EventTarget', [ throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR); } } - + // check if event is meant to be dispatched on an object having specific uid if (type.indexOf('::') !== -1) { (function(arr) { @@ -2184,24 +2286,24 @@ define('moxie/core/EventTarget', [ } else { uid = this.uid; } - + type = type.toLowerCase(); - + list = eventpool[uid] && eventpool[uid][type]; if (list) { // sort event list by prority list.sort(function(a, b) { return b.priority - a.priority; }); - + args = [].slice.call(arguments); - + // first argument will be pseudo-event object args.shift(); evt.type = type; args.unshift(evt); if (MXI_DEBUG && Env.debug.events) { - Env.log("Event '%s' fired on %u", evt.type, uid); + Env.log("%cEvent '%s' fired on %s", 'color: #999;', evt.type, (this.ctorName ? this.ctorName + '::' : '') + uid); } // Dispatch event to all listeners @@ -2248,7 +2350,7 @@ define('moxie/core/EventTarget', [ return fn.apply(this, arguments); }, priority, scope); }, - + /** Alias for addEventListener @@ -2258,7 +2360,7 @@ define('moxie/core/EventTarget', [ bind: function() { this.addEventListener.apply(this, arguments); }, - + /** Alias for removeEventListener @@ -2268,7 +2370,7 @@ define('moxie/core/EventTarget', [ unbind: function() { this.removeEventListener.apply(this, arguments); }, - + /** Alias for removeAllEventListeners @@ -2278,7 +2380,7 @@ define('moxie/core/EventTarget', [ unbindAll: function() { this.removeAllEventListeners.apply(this, arguments); }, - + /** Alias for dispatchEvent @@ -2288,7 +2390,7 @@ define('moxie/core/EventTarget', [ trigger: function() { return this.dispatchEvent.apply(this, arguments); }, - + /** Handle properties of on[event] type. @@ -2310,15 +2412,15 @@ define('moxie/core/EventTarget', [ Basic.each(dispatches, function(prop) { prop = 'on' + prop.toLowerCase(prop); if (Basic.typeOf(self[prop]) === 'undefined') { - self[prop] = null; + self[prop] = null; } }); } - + }); - EventTarget.instance = new EventTarget(); + EventTarget.instance = new EventTarget(); return EventTarget; }); @@ -3027,7 +3129,7 @@ define("moxie/core/utils/Mime", [ // convert extensions to mime types list for (i = 0; i < filters.length; i++) { - ext = filters[i].extensions.split(/\s*,\s*/); + ext = filters[i].extensions.toLowerCase().split(/\s*,\s*/); for (ii = 0; ii < ext.length; ii++) { @@ -3037,13 +3139,12 @@ define("moxie/core/utils/Mime", [ } type = self.mimes[ext[ii]]; - if (type && Basic.inArray(type, mimes) === -1) { - mimes.push(type); - } // future browsers should filter by extension, finally if (addMissingExtensions && /^\w+$/.test(ext[ii])) { mimes.push('.' + ext[ii]); + } else if (type && Basic.inArray(type, mimes) === -1) { + mimes.push(type); } else if (!type) { // if we have no type in our map, then accept all return []; @@ -3058,6 +3159,8 @@ define("moxie/core/utils/Mime", [ var self = this, exts = []; Basic.each(mimes, function(mime) { + mime = mime.toLowerCase(); + if (mime === '*') { exts = []; return false; @@ -3095,9 +3198,6 @@ define("moxie/core/utils/Mime", [ title: I18n.translate('Files'), extensions: exts.length ? exts.join(',') : '*' }); - - // save original mimes string - accept.mimes = mimes; return accept; }, @@ -3198,6 +3298,7 @@ define('moxie/runtime/RuntimeClient', [ // jailbreak ... setTimeout(function() { runtime.clients++; + comp.ruid = runtime.uid; // this will be triggered on component comp.trigger('RuntimeInit', runtime); }, 1); @@ -3244,6 +3345,7 @@ define('moxie/runtime/RuntimeClient', [ if (ruid) { runtime = Runtime.getRuntime(ruid); if (runtime) { + comp.ruid = ruid; runtime.clients++; return runtime; } else { @@ -4333,8 +4435,8 @@ define('moxie/file/FileReader', [ /** * plupload.js * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -4370,11 +4472,10 @@ define('plupload', [ * Plupload version will be replaced on build. * * @property VERSION - * @for Plupload * @static * @final */ - VERSION: '3.0-beta1', + VERSION: '3.1.0', /** * The state of the queue before it has started and after it has finished @@ -4557,6 +4658,10 @@ define('plupload', [ */ typeOf: Basic.typeOf, + + inherit: Basic.inherit, + + /** * Extends the specified object with another object. * @@ -4568,6 +4673,9 @@ define('plupload', [ */ extend: Basic.extend, + + extendImmutable: Basic.extendImmutable, + /** Extends the specified object with another object(s), but only if the property exists in the target. @@ -4595,7 +4703,7 @@ define('plupload', [ /** Recieve an array of functions (usually async) to call in parallel, each function - receives a callback as first argument that it should call, when it completes. After + receives a callback as first argument that it should call, when it completes. After everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the process and invoke main callback immediately. @@ -4622,7 +4730,7 @@ define('plupload', [ /** * Get array of DOM Elements by their ids. - * + * * @method get * @param {String} id Identifier of the DOM Element * @return {Array} @@ -4631,13 +4739,13 @@ define('plupload', [ var els = [], el; - if (plupload.typeOf(ids) !== 'array') { + if (Basic.typeOf(ids) !== 'array') { ids = [ids]; } var i = ids.length; while (i--) { - el = plupload.get(ids[i]); + el = Dom.get(ids[i]); if (el) { els.push(el); } @@ -4891,7 +4999,7 @@ define('plupload', [ buildUrl: function(url, items) { var query = ''; - plupload.each(items, function(value, name) { + Basic.each(items, function(value, name) { query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value); }); @@ -4917,32 +5025,32 @@ define('plupload', [ size = parseInt(size, 10); if (isNaN(size)) { - return plupload.translate('N/A'); + return I18n.translate('N/A'); } var boundary = Math.pow(1024, 4); // TB if (size > boundary) { - return round(size / boundary, 1) + " " + plupload.translate('tb'); + return round(size / boundary, 1) + " " + I18n.translate('tb'); } // GB if (size > (boundary /= 1024)) { - return round(size / boundary, 1) + " " + plupload.translate('gb'); + return round(size / boundary, 1) + " " + I18n.translate('gb'); } // MB if (size > (boundary /= 1024)) { - return round(size / boundary, 1) + " " + plupload.translate('mb'); + return round(size / boundary, 1) + " " + I18n.translate('mb'); } // KB if (size > 1024) { - return Math.round(size / 1024) + " " + plupload.translate('kb'); + return Math.round(size / 1024) + " " + I18n.translate('kb'); } - return size + " " + plupload.translate('b'); + return size + " " + I18n.translate('b'); }, /** @@ -4971,15 +5079,17 @@ define('plupload', [ /** Parent object for all event dispatching components and objects - @class plupload/EventTarget - @constructor EventTarget + @class plupload.EventTarget + @private + @constructor */ EventTarget: EventTarget, /** Common set of methods and properties for every runtime instance - @class plupload/Runtime + @class plupload.Runtime + @private @param {Object} options @param {String} type Sanitized name of the runtime @@ -4994,7 +5104,8 @@ define('plupload', [ converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory with _FileReader_ or uploaded to a server through _XMLHttpRequest_. - @class plupload/FileInput + @class plupload.FileInput + @private @constructor @extends EventTarget @uses RuntimeClient @@ -5004,7 +5115,7 @@ define('plupload', [ @param {String} [options.file='file'] Name of the file field (not the filename). @param {Boolean} [options.multiple=false] Enable selection of multiple files. @param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time). - @param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode + @param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode for _browse\_button_. @param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support. */ @@ -5014,8 +5125,9 @@ define('plupload', [ Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader) interface. Where possible uses native FileReader, where - not falls back to shims. - @class plupload/FileReader - @constructor FileReader + @class plupload.FileReader + @private + @constructor @extends EventTarget @uses RuntimeClient */ @@ -5029,8 +5141,8 @@ define('plupload', [ /** * Collection.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -5041,7 +5153,7 @@ define('plupload', [ Helper collection class - in a way a mix of object and array @contsructor -@class plupload/core/Collection +@class plupload.core.Collection @private */ define('plupload/core/Collection', [ @@ -5443,13 +5555,13 @@ define('moxie/file/FileDrop', [ return FileDrop; }); -// Included from: src/core/Optionable.js +// Included from: src/core/ArrCollection.js /** - * Optionable.js + * ArrCollection.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -5458,69 +5570,227 @@ define('moxie/file/FileDrop', [ /** @contsructor -@class plupload/core/Optionable +@class plupload.core.ArrCollection @private -@since 3.0 */ -define('plupload/core/Optionable', [ - 'moxie/core/utils/Basic', - 'moxie/core/EventTarget' -], function(Basic, EventTarget) { - - var dispatches = [ - - 'OptionChanged' - ]; - - return (function(Parent) { - Basic.inherit(Optionable, Parent); +define('plupload/core/ArrCollection', [ + 'moxie/core/utils/Basic' +], function(Basic) { - /** - * @class Optionable - * @constructor - * @extends EventTarget - */ - function Optionable() { - Parent.apply(this, arguments); - - this.uid = Basic.guid(); - this._options = {}; - } + var ArrCollection = function() { + var _registry = []; + Basic.extend(this, { - Basic.extend(Optionable.prototype, { + count: function() { + return _registry.length; + }, - uid: Basic.guid(), + hasKey: function(key) { + return this.getIdx(key) > -1; + }, - /** - * Set the value for the specified option(s). - * - * @method setOption - * @since 2.1 - * @param {String|Object} option Name of the option to change or the set of key/value pairs - * @param {Mixed} [value] Value for the option (is ignored, if first argument is object) - */ - setOption: function(option, value) { - var self = this; - var oldValue; + get: function(key) { + var idx = this.getIdx(key); + return idx > -1 ? _registry[idx] : null; + }, - if (typeof(option) === 'object') { - Basic.each(option, function(value, option) { - self.setOption(option, value); - }); - return; + getIdx: function(key) { + for (var i = 0, length = _registry.length; i < length; i++) { + if (_registry[i].uid === key) { + return i; + } } + return -1; + }, - oldValue = self._options[option]; - self._options[option] = value; + getByIdx: function(idx) { + return _registry[idx] + }, - self.trigger('OptionChanged', option, value, oldValue); + first: function() { + return _registry[0]; + }, + + last: function() { + return _registry[_registry.length - 1]; + }, + + add: function(obj) { + obj = arguments[1] || obj; // make it compatible with Collection.add() + + var idx = this.getIdx(obj.uid); + if (idx > -1) { + _registry[idx] = obj; + return idx; + } + + _registry.push(obj); + return _registry.length - 1; + }, + + remove: function(key) { + return !!this.extract(key); + }, + + splice: function(start, length) { + start = Basic.typeOf(start) === 'undefinded' ? 0 : Math.max(start, 0); + length = Basic.typeOf(length) !== 'undefinded' && start + length < _registry.length ? length : _registry.length - start; + + return _registry.splice(start, length); + }, + + extract: function(key) { + var idx = this.getIdx(key); + if (idx > -1) { + return _registry.splice(idx, 1); + } + return null; + }, + + shift: function() { + return _registry.shift(); + }, + + update: function(key, obj) { + var idx = this.getIdx(key); + if (idx > -1) { + _registry[idx] = obj; + return true; + } + return false; + }, + + each: function(cb) { + Basic.each(_registry, cb); + }, + + combineWith: function() { + return Array.prototype.concat.apply(this.toArray(), arguments); + }, + + sort: function(cb) { + _registry.sort(cb || function(a, b) { + return a.priority - b.priority; + }); + }, + + clear: function() { + _registry = []; + }, + + toObject: function() { + var obj = {}; + for (var i = 0, length = _registry.length; i < length; i++) { + obj[_registry[i].uid] = _registry[i]; + } + return obj; + }, + + toArray: function() { + return Array.prototype.slice.call(_registry); + } + }); + }; + + return ArrCollection; +}); + +// Included from: src/core/Optionable.js + +/** + * Optionable.js + * + * Copyright 2017, Ephox + * Released under AGPLv3 License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + */ + + +/** +@contsructor +@class plupload.core.Optionable +@private +@since 3.0 +*/ +define('plupload/core/Optionable', [ + 'moxie/core/utils/Basic', + 'moxie/core/EventTarget' +], function(Basic, EventTarget) { + + var dispatches = [ + /** + * Dispatched when option is being changed. + * + * @event OptionChanged + * @param {Object} event + * @param {String} name Name of the option being changed + * @param {Mixed} value + * @param {Mixed} oldValue + */ + 'OptionChanged' + ]; + + return (function(Parent) { + + /** + * @class Optionable + * @constructor + * @extends EventTarget + */ + function Optionable() { + Parent.apply(this, arguments); + + this._options = {}; + } + + Basic.inherit(Optionable, Parent); + + Basic.extend(Optionable.prototype, { + /** + * Set the value for the specified option(s). + * + * @method setOption + * @since 2.1 + * @param {String|Object} option Name of the option to change or the set of key/value pairs + * @param {Mixed} [value] Value for the option (is ignored, if first argument is object) + * @param {Boolean} [mustBeDefined] if truthy, any option that is not in defaults will be ignored + */ + setOption: function(option, value, mustBeDefined) { + var self = this; + var oldValue; + + if (typeof(option) === 'object') { + mustBeDefined = value; + Basic.each(option, function(value, option) { + self.setOption(option, value, mustBeDefined); + }); + return; + } + + if (mustBeDefined && !self._options.hasOwnProperty(option)) { + return; + } + + oldValue = Basic.clone(self._options[option]); + + //! basically if an option is of type object extend it rather than replace + if (Basic.typeOf(value) === 'object' && Basic.typeOf(self._options[option]) === 'object') { + // having some options as objects was a bad idea, prefixes is the way + Basic.extend(self._options[option], value); + } else { + self._options[option] = value; + } + + self.trigger('OptionChanged', option, value, oldValue); }, /** * Get the value for the specified option or the whole configuration, if not specified. - * + * * @method getOption * @since 2.1 * @param {String} [option] Name of the option to get @@ -5530,21 +5800,28 @@ define('plupload/core/Optionable', [ if (!option) { return this._options; } - return this._options[option]; + + var value = this._options[option]; + if (Basic.inArray(Basic.typeOf(value), ['array', 'object']) > -1) { + return Basic.extendImmutable({}, value); + } else { + return value; + } }, /** - Set many options as once. - - @method setOptions - @param {Object} options - */ - setOptions: function(options) { + * Set many options as once. + * + * @method setOptions + * @param {Object} options + * @param {Boolean} [mustBeDefined] if truthy, any option that is not in defaults will be ignored + */ + setOptions: function(options, mustBeDefined) { if (typeof(options) !== 'object') { return; } - this.setOption(options); + this.setOption(options, mustBeDefined); }, @@ -5557,7 +5834,7 @@ define('plupload/core/Optionable', [ getOptions: function() { return this.getOption(); } - }); + }); return Optionable; @@ -5570,8 +5847,8 @@ define('plupload/core/Optionable', [ /** * Queueable.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License.se. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -5582,20 +5859,32 @@ define('plupload/core/Optionable', [ Every queue item must have properties, implement methods and fire events defined in this class @contsructor -@class plupload/core/Queueable +@class plupload.core.Queueable @private @decorator @extends EventTarget */ define('plupload/core/Queueable', [ + 'moxie/core/utils/Env', 'moxie/core/utils/Basic', 'plupload/core/Optionable' -], function(Basic, Optionable) { +], function(Env, Basic, Optionable) { var dispatches = [ + /** + * Dispatched every time the state of queue changes + * + * @event statechanged + * @param {Object} event + * @param {Number} state New state + * @param {Number} prevState Previous state + */ + 'statechanged', + + /** * Dispatched when the item is put on pending list - * + * * @event queued * @param {Object} event */ @@ -5604,7 +5893,7 @@ define('plupload/core/Queueable', [ /** * Dispatched as soon as activity starts - * + * * @event started * @param {Object} event */ @@ -5614,12 +5903,15 @@ define('plupload/core/Queueable', [ 'paused', + 'resumed', + + 'stopped', /** * Dispatched as the activity progresses - * + * * @event * @param {Object} event * @param {Number} event.percent @@ -5635,97 +5927,247 @@ define('plupload/core/Queueable', [ 'done', - 'processed' + 'processed', + + 'destroy' ]; return (function(Parent) { - Basic.inherit(Queueable, Parent); - function Queueable() { Parent.apply(this, arguments); - } + /** + Unique identifier + @property uid + @type {String} + */ + this.uid = Basic.guid(); - Queueable.IDLE = 0; - Queueable.PROCESSING = 1; - Queueable.PAUSED = 2; - Queueable.RESUMED = 3; - Queueable.DONE = 4; - Queueable.FAILED = 5; - Queueable.DESTROYED = 8; + this.state = Queueable.IDLE; + this.processed = 0; - Basic.extend(Queueable.prototype, { + this.total = 0; + + this.percent = 0; + + this.retries = 0; + + /** + * Can be 0-Infinity - item with higher priority will have well... higher priority + * @property [priority=0] + * @type {Number} + */ + this.priority = 0; + + this.startedTimestamp = 0; + + /** + * Set when item becomes Queueable.DONE or Queueable.FAILED. + * Used to calculate proper processedPerSec for the queue stats. + * @property processedTimestamp + * @type {Number} + */ + this.processedTimestamp = 0; + + if (MXI_DEBUG) { + this.bind('StateChanged', function(e, state, oldState) { + var self = this; - uid: Basic.guid(), + var stateToString = function(code) { + switch (code) { + case Queueable.IDLE: + return 'IDLE'; - state: Queueable.IDLE, + case Queueable.PROCESSING: + return 'PROCESSING'; - processed: 0, + case Queueable.PAUSED: + return 'PAUSED'; - total: 0, + case Queueable.RESUMED: + return 'RESUMED'; - percent: 0, + case Queueable.DONE: + return 'DONE'; - retries: 0, + case Queueable.FAILED: + return 'FAILED'; + case Queueable.DESTROYED: + return 'DESTROYED'; + } + }; + + var indent = function() { + switch (self.ctorName) { + case 'File': + return "\t".repeat(2); + + case 'QueueUpload': + case 'QueueResize': + return "\t"; + + case 'FileUploader': + return "\t".repeat(3); + + case 'ChunkUploader': + return "\t".repeat(4); + + default: + return "\t"; + } + }; + + Env.log("StateChanged:" + indent() + self.ctorName + '::' + self.uid + ' (' + stateToString(oldState) + ' to ' + stateToString(state) + ')'); + }, 999); + } + } + + Queueable.IDLE = 1; + Queueable.PROCESSING = 2; + Queueable.PAUSED = 6; + Queueable.RESUMED = 7; + Queueable.DONE = 5; + Queueable.FAILED = 4; + Queueable.DESTROYED = 8; + + Basic.inherit(Queueable, Parent); + + Basic.extend(Queueable.prototype, { start: function() { - this.state = Queueable.PROCESSING; - this.trigger('started'); + var prevState = this.state; + + if (this.state === Queueable.PROCESSING) { + return false; + } + + if (!this.startedTimestamp) { + this.startedTimestamp = +new Date(); + } + + if (this.state === Queueable.IDLE) { + this.state = Queueable.PROCESSING; + this.trigger('statechanged', this.state, prevState); + this.pause(); + Basic.delay.call(this, function() { + if (this.trigger('beforestart')) { + this.resume(); + } + }); + return false; + } else { + this.state = Queueable.PROCESSING; + this.trigger('statechanged', this.state, prevState); + this.trigger('started'); + } + + return true; }, pause: function() { + var prevState = this.state; + + if (this.state !== Queueable.PROCESSING) { + return false; + } + this.processed = this.percent = 0; // by default reset all progress this.loaded = this.processed; // for backward compatibility this.state = Queueable.PAUSED; + this.trigger('statechanged', this.state, prevState); this.trigger('paused'); + return true; + }, + + + resume: function() { + var prevState = this.state; + + if (this.state !== Queueable.PAUSED && this.state !== Queueable.RESUMED) { + return false; + } + + this.state = Queueable.RESUMED; + this.trigger('statechanged', this.state, prevState); + this.trigger('resumed'); + return true; }, stop: function() { + var prevState = this.state; + + if (this.state === Queueable.IDLE) { + return false; + } + this.processed = this.percent = 0; this.loaded = this.processed; // for backward compatibility + this.startedTimestamp = 0; + this.state = Queueable.IDLE; + this.trigger('statechanged', this.state, prevState); this.trigger('stopped'); + return true; }, done: function(result) { + var prevState = this.state; + + if (this.state === Queueable.DONE) { + return false; + } + this.processed = this.total; this.loaded = this.processed; // for backward compatibility this.percent = 100; + this.processedTimestamp = +new Date(); + this.state = Queueable.DONE; + this.trigger('statechanged', this.state, prevState); this.trigger('done', result); this.trigger('processed'); + return true; }, failed: function(result) { + var prevState = this.state; + + if (this.state === Queueable.FAILED) { + return false; + } + this.processed = this.percent = 0; // reset the progress this.loaded = this.processed; // for backward compatibility + this.processedTimestamp = +new Date(); + this.state = Queueable.FAILED; + this.trigger('statechanged', this.state, prevState); this.trigger('failed', result); this.trigger('processed'); + return true; }, progress: function(processed, total) { - this.processed = processed; - this.loaded = this.processed; // for backward compatibility - if (total) { - this.total = total; + this.total = total; // is this even required? } - this.percent = Math.min(Math.ceil(this.processed / this.total * 100), 100); + this.processed = Math.min(processed, this.total); + this.loaded = this.processed; // for backward compatibility + this.percent = Math.ceil(this.processed / this.total * 100); this.trigger({ type: 'progress', @@ -5736,13 +6178,17 @@ define('plupload/core/Queueable', [ destroy: function() { - if (self.state === Queueable.DESTROYED) { - return; // already destroyed + var prevState = this.state; + + if (this.state === Queueable.DESTROYED) { + return false; // already destroyed } this.state = Queueable.DESTROYED; + this.trigger('statechanged', this.state, prevState); this.trigger('destroy'); this.unbindAll(); + return true; } }); @@ -5755,7 +6201,7 @@ define('plupload/core/Queueable', [ // Included from: src/core/Stats.js /** -@class plupload/core/Stats +@class plupload.core.Stats @constructor @private */ @@ -5825,6 +6271,13 @@ define('plupload/core/Stats', [], function() { */ self.queued = 0; + /** + * Number of items currently paused. + * + * @property paused + * @type Number + */ + self.paused = 0; /** * Number of items being processed. @@ -5884,7 +6337,7 @@ define('plupload/core/Stats', [], function() { self.failed = self.queued = self.processing = - self.paused = + self.paused = self.percent = self.bytesPerSec = // deprecated self.processedPerSec = 0; @@ -5897,8 +6350,8 @@ define('plupload/core/Stats', [], function() { /** * Queue.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -5907,50 +6360,68 @@ define('plupload/core/Stats', [], function() { /** @contsructor -@class plupload/core/Queue +@class plupload.core.Queue @private */ define('plupload/core/Queue', [ 'moxie/core/utils/Basic', - 'plupload/core/Collection', - 'plupload/core/Optionable', + 'plupload/core/ArrCollection', 'plupload/core/Queueable', 'plupload/core/Stats' -], function(Basic, Collection, Optionable, Queueable, Stats) { +], function(Basic, ArrCollection, Queueable, Stats) { var dispatches = [ /** * Dispatched as soon as activity starts - * + * * @event started * @param {Object} event */ 'Started', - 'StateChanged', - /** - * Dispatched as the activity progresses - * - * @event + * Dispatched as activity progresses + * + * @event progress * @param {Object} event - * @param {Number} event.percent - * @param {Number} event.processed - * @param {Number} event.total + * @param {Number} processed + * @param {Number} total + * @param {plupload.core.Stats} stats */ 'Progress', - /** - * + * Dispatched when activity is paused + * + * @event paused + * @param {Object} event */ 'Paused', - + /** + * Dispatched when there's no more items in processing + * + * @event done + * @param {Object} event + */ 'Done', - 'Stopped' + /** + * Dispatched as soon as activity ends + * + * @event stopped + * @param {Object} event + */ + 'Stopped', + + /** + * Dispatched when queue is destroyed + * + * @event destroy + * @param {Object} event + */ + 'Destroy' ]; /** @@ -5960,7 +6431,7 @@ define('plupload/core/Queue', [ */ return (function(Parent) { Basic.inherit(Queue, Parent); - + function Queue(options) { Parent.apply(this, arguments); @@ -5970,15 +6441,7 @@ define('plupload/core/Queue', [ @type {Collection} @private */ - this._queue = new Collection(); - - /** - * @property state - * @type {Number} - * @default Queue.IDLE - * @readOnly - */ - this.state = Queue.IDLE; + this._queue = new ArrCollection(); /** @@ -5989,22 +6452,14 @@ define('plupload/core/Queue', [ this.stats = new Stats(); - this._options = Basic.extend({ + this._options = Basic.extend({}, this._options, { max_slots: 1, max_retries: 0, auto_start: false, - finish_active: false, - pause_before_start: true + finish_active: false }, options); } - - Queue.STOPPED = 1; - Queue.STARTED = 2; - Queue.PAUSED = 3; - Queue.DESTROYED = 8; - - Basic.extend(Queue.prototype, { /** @@ -6019,63 +6474,54 @@ define('plupload/core/Queue', [ /** * Start the queue - * + * * @method start */ start: function() { - var self = this; - var prevState = self.state; + var prevState = this.state; - if (self.state === Queue.STARTED) { + if (this.state === Queueable.PROCESSING) { return false; } - self.state = Queue.STARTED; - self.trigger('StateChanged', self.state, prevState); + if (!this.startedTimestamp) { + this.startedTimestamp = +new Date(); + } - self._startTime = new Date(); + this.state = Queueable.PROCESSING; + this.trigger('statechanged', this.state, prevState); + this.trigger('started'); - processNext.call(self); - return true; + return processNext.call(this); }, pause: function() { - var self = this; - var prevState = self.state; + if (!Queue.super.pause.call(this)) { + return false; + } - this._queue.each(function(item) { - if (Basic.inArray(item.state, [Queueable.PROCESSING, Queueable.RESUMED]) !== -1) { - self.pauseItem(item); - } + this.forEachItem(function(item) { + item.pause(); }); - - self.state = Queue.PAUSED; - this.trigger('StateChanged', self.state, prevState); - self.trigger('Paused'); }, /** * Stop the queue. If `finish_active=true` the queue will wait until active items are done, before * stopping. - * + * * @method stop */ stop: function() { - var self = this; - var prevState = self.state; + if (!Queue.super.stop.call(this) || this.getOption('finish_active')) { + return false; + } - if (self.getOption('finish_active')) { - return; - } else if (self.stats.processing || self.stats.paused) { - self._queue.each(function(item) { - self.stopItem(item.uid); + if (this.isActive()) { + this.forEachItem(function(item) { + item.stop(); }); } - - self.state = Queue.STOPPED; - self.trigger('StateChanged', self.state, prevState); - self.trigger('Stopped'); }, @@ -6083,6 +6529,7 @@ define('plupload/core/Queue', [ this._queue.each(cb); }, + getItem: function(uid) { return this._queue.get(uid); }, @@ -6090,15 +6537,47 @@ define('plupload/core/Queue', [ /** * Add instance of Queueable to the queue. If `auto_start=true` queue will start as well. - * + * * @method addItem * @param {Queueable} item */ addItem: function(item) { var self = this; + item.bind('Started', function() { + if (self.calcStats()) { + Basic.delay.call(self, processNext); + } + }); + + item.bind('Resumed',function() { + self.start(); + }); + + item.bind('Paused', function() { + if (self.calcStats()) { + Basic.delay.call(self, function() { + if (!processNext.call(self) && !self.stats.processing) { + self.pause(); + } + }); + } + }); + + item.bind('Processed Stopped', function() { + if (self.calcStats()) { + Basic.delay.call(self, function() { + if (!processNext.call(self) && !(this.stats.processing || this.stats.paused)) { + self.stop(); + } + }); + } + }); + item.bind('Progress', function() { - calcStats.call(self); + if (self.calcStats()) { + self.trigger('Progress', self.stats.processed, self.stats.total, self.stats); + } }); item.bind('Failed', function() { @@ -6108,18 +6587,12 @@ define('plupload/core/Queue', [ } }); - item.bind('Processed', function() { - self.stats.processing--; - calcStats.call(self); - processNext.call(self); - }, 0, this); - this._queue.add(item.uid, item); - calcStats.call(this); + this.calcStats(); item.trigger('Queued'); - if (self.getOption('auto_start')) { - this.start(); + if (self.getOption('auto_start') || self.state === Queueable.PAUSED) { + Basic.delay.call(this, this.start); } }, @@ -6133,16 +6606,10 @@ define('plupload/core/Queue', [ */ extractItem: function(uid) { var item = this._queue.get(uid); - if (item) { this.stopItem(item.uid); - - if (this.state === Queue.STARTED) { - processNext.call(this); - } - this._queue.remove(uid); - calcStats.call(this); + this.calcStats(); } return item; }, @@ -6152,64 +6619,58 @@ define('plupload/core/Queue', [ * * @method removeItem * @param {String} uid + * @returns {Boolean} Result of the operation */ removeItem: function(uid) { var item = this.extractItem(uid); if (item) { item.destroy(); + return true; } + return false; }, stopItem: function(uid) { var item = this._queue.get(uid); if (item) { - if (item.state === Queueable.PROCESSING) { - this.stats.processing--; - } - item.stop(); + return item.stop(); } else { return false; } - - if (!this.stats.processing && !this.stats.paused) { - this.stop(); - } - return true; }, pauseItem: function(uid) { var item = this._queue.get(uid); if (item) { - if (item.state === Queueable.PROCESSING) { - this.stats.processing--; - } - this.stats.paused++; - item.pause(); + return item.pause(); } else { return false; } - - if (!this.stats.processing) { - this.pause(); - } - - return true; }, resumeItem: function(uid) { var item = this._queue.get(uid); - if (item && item.state === Queueable.PAUSED) { - item.state = Queueable.RESUMED; // mark the item to be picked up on next iteration - this.stats.paused--; + if (item) { + Basic.delay.call(this, function() { + this.start(); // start() will know if it needs to restart the queue + }); + return item.resume(); } else { return false; } + }, - this.start(); - return true; + + splice: function(start, length) { + return this._queue.splice(start, length); + }, + + + isActive: function() { + return this.stats && (this.stats.processing || this.stats.paused); }, @@ -6219,18 +6680,14 @@ define('plupload/core/Queue', [ toArray: function() { - var arr = []; - this.forEachItem(function(item) { - arr.push(item); - }); - return arr; + return this._queue.toArray(); }, clear: function() { var self = this; - if (self.state !== Queue.STOPPED) { + if (self.state !== Queueable.IDLE) { // stop the active queue first self.bindOnce('Stopped', function() { self.clear(); @@ -6243,114 +6700,131 @@ define('plupload/core/Queue', [ }, + calcStats: function() { + var self = this; + var stats = self.stats; + var processed = 0; + var processedDuringThisSession = 0; + + if (!stats) { + return false; // maybe queue is destroyed + } + + stats.reset(); + + self.forEachItem(function(item) { + switch (item.state) { + case Queueable.DONE: + stats.done++; + stats.uploaded = stats.done; // for backward compatibility + break; + + case Queueable.FAILED: + stats.failed++; + break; + + case Queueable.PROCESSING: + stats.processing++; + break; + + case Queueable.PAUSED: + stats.paused++; + break; + + default: + stats.queued++; + } + + processed += item.processed; + + if (!item.processedTimestamp || item.processedTimestamp > self.startedTimestamp) { + processedDuringThisSession += processed; + } + + stats.processedPerSec = Math.ceil(processedDuringThisSession / ((+new Date() - self.startedTimestamp || 1) / 1000.0)); + + stats.processed = processed; + stats.total += item.total; + if (stats.total) { + stats.percent = Math.ceil(stats.processed / stats.total * 100); + } + }); + + // enable properties inherited from Queueable + + /* TODO: this is good but it currently conflicts with deprecated total property in Uploader + self.processed = stats.processed; + self.total = stats.total; + */ + self.percent = stats.percent; + + // for backward compatibility + stats.loaded = stats.processed; + stats.size = stats.total; + stats.bytesPerSec = stats.processedPerSec; + + return true; + }, + + destroy: function() { var self = this; - var prevState = self.state; - if (self.state === Queue.DESTROYED) { - return; // already destroyed + if (self.state === Queueable.DESTROYED) { + return false; // already destroyed } - if (self.state !== Queue.STOPPED) { + if (self.state !== Queueable.IDLE) { // stop the active queue first self.bindOnce('Stopped', function() { - self.destroy(); + Basic.delay.call(self, self.destroy); }); return self.stop(); } else { - self.trigger('Destroy'); - self.clear(); - - self.state = Queue.DESTROYED; - self.trigger('StateChanged', self.state, prevState); - - self.unbindAll(); - self._queue = self.stats = self._startTime = null; + Queue.super.destroy.call(this); + self._queue = self.stats = null; } + return true; } }); - - function getCandidate() { + /** + * Returns another Queueable.IDLE or Queueable.RESUMED item, or null. + */ + function getNextIdleItem() { var nextItem; - this._queue.each(function(item) { + this.forEachItem(function(item) { if (item.state === Queueable.IDLE || item.state === Queueable.RESUMED) { nextItem = item; return false; } }); - return nextItem; + return nextItem ? nextItem : null; } function processNext() { - var self = this; var item; - while (self.stats.processing < self.getOption('max_slots')) { - item = getCandidate.call(self); - if (item) { - if (self.getOption('pause_before_start') && item.state === Queueable.IDLE) { - self.pauseItem(item.uid); - - if (item.trigger('BeforeStart')) { - // if nothing has seized the item, continue - self.resumeItem(item.uid); - } - } else { - self.stats.processing++; - item.start(self.getOptions()); - } - } else if (!self.stats.processing) { // we ran out of pending and active items too, so we are done - self.stop(); - return self.trigger('Done'); - } + if (this.state !== Queueable.PROCESSING && this.state !== Queueable.PAUSED) { + return false; } - } - - - function calcStats() { - var self = this; - self.stats.reset(); - - self.forEachItem(function(item) { - self.stats.processed += item.processed; - self.stats.total += item.total; - - switch (item.status) { - case Queueable.DONE: - self.stats.done++; - self.stats.uploaded = self.stats.done; // for backward compatibility - break; - - case Queueable.FAILED: - self.stats.failed++; - break; - - default: - self.stats.queued++; - } - - if (self._startTime) { - self.stats.processedPerSec = Math.ceil(self.stats.processed / ((+new Date() - self._startTime || 1) / 1000.0)); - self.stats.bytesPerSec = self.stats.processedPerSec; // for backward compatibility - } - if (self.stats.total) { - self.stats.percent = Math.ceil(self.stats.processed / self.stats.total * 100); + if (this.stats.processing < this.getOption('max_slots')) { + item = getNextIdleItem.call(this); + if (item) { + item.setOptions(this.getOptions()); + return item.start(); } - }); - - // for backward compatibility - self.stats.loaded = self.stats.processed; - self.stats.size = self.stats.total; + } + return false; } return Queue; - }(Optionable)); + }(Queueable)); }); // Included from: src/QueueUpload.js @@ -6358,8 +6832,8 @@ define('plupload/core/Queue', [ /** * QueueUpload.js * - * Copyright 2016, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -6367,20 +6841,19 @@ define('plupload/core/Queue', [ /** - @contsructor - @class plupload/QueueUpload + @class plupload.QueueUpload + @extends plupload.core.Queue + @constructor @private + @final + @since 3.0 + @param {Object} options */ define('plupload/QueueUpload', [ 'moxie/core/utils/Basic', 'plupload/core/Queue' ], function(Basic, Queue) { - /** - * @class QueueUpload - * @constructor - * @extends Queue - */ return (function(Parent) { Basic.inherit(QueueUpload, Parent); @@ -6391,7 +6864,6 @@ define('plupload/QueueUpload', [ max_retries: 0, auto_start: false, finish_active: false, - pause_before_start: true, url: false, chunk_size: 0, multipart: true, @@ -6408,11 +6880,8 @@ define('plupload/QueueUpload', [ if (option == 'max_upload_slots') { option = 'max_slots'; } - if (!this._options.hasOwnProperty(option)) { - return; - } } - QueueUpload.prototype.setOption.apply(this, arguments); + QueueUpload.prototype.setOption.call(this, option, value, true); }; this.setOptions(options); @@ -6427,8 +6896,8 @@ define('plupload/QueueUpload', [ /** * QueueResize.js * - * Copyright 2016, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -6436,20 +6905,19 @@ define('plupload/QueueUpload', [ /** - @contsructor - @class plupload/QueueResize + @class plupload.QueueResize + @extends plupload.core.Queue + @constructor @private - */ + @final + @since 3.0 + @param {Object} options +*/ define('plupload/QueueResize', [ 'moxie/core/utils/Basic', 'plupload/core/Queue' ], function(Basic, Queue) { - /** - * @class QueueResize - * @constructor - * @extends Queue - */ return (function(Parent) { Basic.inherit(QueueResize, Parent); @@ -6460,7 +6928,6 @@ define('plupload/QueueResize', [ max_retries: 0, auto_start: false, finish_active: false, - pause_before_start: true, resize: {} }); @@ -6469,11 +6936,8 @@ define('plupload/QueueResize', [ if (option == 'max_resize_slots') { option = 'max_slots'; } - if (!this._options.hasOwnProperty(option)) { - return; - } } - QueueResize.prototype.setOption.apply(this, arguments); + QueueResize.prototype.setOption.call(this, option, value, true); }; @@ -6807,7 +7271,7 @@ define("moxie/xhr/XMLHttpRequest", [ function XMLHttpRequestUpload() { this.uid = Basic.guid('uid_'); } - + XMLHttpRequestUpload.prototype = EventTarget.instance; /** @@ -6834,10 +7298,10 @@ define("moxie/xhr/XMLHttpRequest", [ 'loadend' // readystatechange (for historical reasons) - ]; - + ]; + var NATIVE = 1, RUNTIME = 2; - + function XMLHttpRequest() { var self = this, // this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible @@ -6903,7 +7367,7 @@ define("moxie/xhr/XMLHttpRequest", [ /** Returns the response type. Can be set to change the response type. Values are: the empty string (default), "arraybuffer", "blob", "document", "json", and "text". - + @property responseType @type String */ @@ -6911,7 +7375,7 @@ define("moxie/xhr/XMLHttpRequest", [ /** Returns the document response entity body. - + Throws an "InvalidStateError" exception if responseType is not the empty string or "document". @property responseXML @@ -6921,7 +7385,7 @@ define("moxie/xhr/XMLHttpRequest", [ /** Returns the text response entity body. - + Throws an "InvalidStateError" exception if responseType is not the empty string or "text". @property responseText @@ -6932,7 +7396,7 @@ define("moxie/xhr/XMLHttpRequest", [ /** Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body). Can become: ArrayBuffer, Blob, Document, JSON, Text - + @property response @type Mixed */ @@ -6969,7 +7433,7 @@ define("moxie/xhr/XMLHttpRequest", [ _responseHeadersBag ; - + Basic.extend(this, props, { /** Unique id of the component @@ -6978,7 +7442,7 @@ define("moxie/xhr/XMLHttpRequest", [ @type String */ uid: Basic.guid('uid_'), - + /** Target for Upload events @@ -6986,7 +7450,7 @@ define("moxie/xhr/XMLHttpRequest", [ @type XMLHttpRequestUpload */ upload: new XMLHttpRequestUpload(), - + /** Sets the request method, request URL, synchronous flag, request username, and request password. @@ -7014,12 +7478,12 @@ define("moxie/xhr/XMLHttpRequest", [ */ open: function(method, url, async, user, password) { var urlp; - + // first two arguments are required if (!method || !url) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } - + // 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); @@ -7029,8 +7493,8 @@ define("moxie/xhr/XMLHttpRequest", [ if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) { _method = method.toUpperCase(); } - - + + // 4 - allowing these methods poses a security risk if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) { throw new x.DOMException(x.DOMException.SECURITY_ERR); @@ -7038,15 +7502,15 @@ define("moxie/xhr/XMLHttpRequest", [ // 5 url = Encode.utf8_encode(url); - + // 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError". urlp = Url.parseUrl(url); _same_origin_flag = Url.hasSameOrigin(urlp); - + // 7 - manually build up absolute url _url = Url.resolveUrl(url); - + // 9-10, 12-13 if ((user || password) && !_same_origin_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); @@ -7054,16 +7518,16 @@ define("moxie/xhr/XMLHttpRequest", [ _user = user || urlp.user; _password = password || urlp.pass; - + // 11 _async = async || true; - + if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } - + // 14 - terminate abort() - + // 15 - terminate send() // 18 @@ -7074,11 +7538,11 @@ define("moxie/xhr/XMLHttpRequest", [ // 19 _p('readyState', XMLHttpRequest.OPENED); - + // 20 this.dispatchEvent('readystatechange'); }, - + /** Appends an header to the list of author request headers, or if header is already in the list of author request headers, combines its value with value. @@ -7086,7 +7550,7 @@ define("moxie/xhr/XMLHttpRequest", [ Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set. Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value is not a valid HTTP header field value. - + @method setRequestHeader @param {String} header @param {String|Number} value @@ -7115,7 +7579,7 @@ define("moxie/xhr/XMLHttpRequest", [ "user-agent", "via" ]; - + // 1-2 if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); @@ -7133,7 +7597,7 @@ define("moxie/xhr/XMLHttpRequest", [ }*/ header = Basic.trim(header).toLowerCase(); - + // setting of proxy-* and sec-* headers is prohibited by spec if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) { return false; @@ -7142,7 +7606,7 @@ define("moxie/xhr/XMLHttpRequest", [ // camelize // browsers lowercase header names (at least for custom ones) // header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); }); - + if (!_headers[header]) { _headers[header] = value; } else { @@ -7152,6 +7616,18 @@ define("moxie/xhr/XMLHttpRequest", [ return true; }, + /** + * Test if the specified header is already set on this request. + * Returns a header value or boolean false if it's not yet set. + * + * @method hasRequestHeader + * @param {String} header Name of the header to test + * @return {Boolean|String} + */ + hasRequestHeader: function(header) { + return header && _headers[header.toLowerCase()] || false; + }, + /** Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2. @@ -7163,7 +7639,7 @@ define("moxie/xhr/XMLHttpRequest", [ }, /** - Returns the header field value from the response of which the field name matches header, + Returns the header field value from the response of which the field name matches header, unless the field name is Set-Cookie or Set-Cookie2. @method getResponseHeader @@ -7198,7 +7674,7 @@ define("moxie/xhr/XMLHttpRequest", [ } return null; }, - + /** Sets the Content-Type header for the response to mime. Throws an "InvalidStateError" exception if the state is LOADING or DONE. @@ -7209,7 +7685,7 @@ define("moxie/xhr/XMLHttpRequest", [ */ overrideMimeType: function(mime) { var matches, charset; - + // 1 if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); @@ -7233,7 +7709,7 @@ define("moxie/xhr/XMLHttpRequest", [ _finalMime = mime; _finalCharset = charset; }, - + /** Initiates the request. The optional argument provides the request entity body. The argument is ignored if request method is GET or HEAD. @@ -7244,7 +7720,7 @@ define("moxie/xhr/XMLHttpRequest", [ @param {Blob|Document|String|FormData} [data] Request entity body @param {Object} [options] Set of requirements and pre-requisities for runtime initialization */ - send: function(data, options) { + send: function(data, options) { if (Basic.typeOf(options) === 'string') { _options = { ruid: options }; } else if (!options) { @@ -7252,19 +7728,19 @@ define("moxie/xhr/XMLHttpRequest", [ } else { _options = options; } - + // 1-2 if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } - - // 3 + + // 3 // sending Blob if (data instanceof Blob) { _options.ruid = data.ruid; _mimeType = data.type || 'application/octet-stream'; } - + // FormData else if (data instanceof FormData) { if (data.hasBlob()) { @@ -7273,12 +7749,12 @@ define("moxie/xhr/XMLHttpRequest", [ _mimeType = blob.type || 'application/octet-stream'; } } - + // DOMString else if (typeof data === 'string') { _encoding = 'UTF-8'; _mimeType = 'text/plain;charset=UTF-8'; - + // data should be converted to Unicode and encoded as UTF-8 data = Encode.utf8_encode(data); } @@ -7309,10 +7785,10 @@ define("moxie/xhr/XMLHttpRequest", [ // 8.5 - Return the send() method call, but continue running the steps in this algorithm. _doXHR.call(this, data); }, - + /** Cancels any network activity. - + @method abort */ abort: function() { @@ -7519,18 +7995,18 @@ define("moxie/xhr/XMLHttpRequest", [ } } } - + /* function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) { // TODO: http://tools.ietf.org/html/rfc3490#section-4.1 return str.toLowerCase(); } */ - - + + function _doXHR(data) { var self = this; - + _start_time = new Date().getTime(); _xhr = new RuntimeTarget(); @@ -7550,12 +8026,12 @@ define("moxie/xhr/XMLHttpRequest", [ self.dispatchEvent('readystatechange'); self.dispatchEvent(e); - + if (_upload_events_flag) { self.upload.dispatchEvent(e); } }); - + _xhr.bind('Progress', function(e) { if (_p('readyState') !== XMLHttpRequest.LOADING) { _p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example) @@ -7563,7 +8039,7 @@ define("moxie/xhr/XMLHttpRequest", [ } self.dispatchEvent(e); }); - + _xhr.bind('UploadProgress', function(e) { if (_upload_events_flag) { self.upload.dispatchEvent({ @@ -7574,12 +8050,12 @@ define("moxie/xhr/XMLHttpRequest", [ }); } }); - + _xhr.bind('Load', function(e) { _p('readyState', XMLHttpRequest.DONE); _p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0)); _p('statusText', httpCode[_p('status')] || ""); - + _p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType'))); if (!!~Basic.inArray(_p('responseType'), ['text', ''])) { @@ -7591,7 +8067,7 @@ define("moxie/xhr/XMLHttpRequest", [ _responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders'); self.dispatchEvent('readystatechange'); - + if (_p('status') > 0) { // status 0 usually means that server is unreachable if (_upload_events_flag) { self.upload.dispatchEvent(e); @@ -7608,7 +8084,7 @@ define("moxie/xhr/XMLHttpRequest", [ self.dispatchEvent(e); loadEnd(); }); - + _xhr.bind('Error', function(e) { _error_flag = true; _p('readyState', XMLHttpRequest.DONE); @@ -7653,7 +8129,7 @@ define("moxie/xhr/XMLHttpRequest", [ if (!_same_origin_flag) { _options.required_caps.do_cors = true; } - + if (_options.ruid) { // we do not need to wait if we can connect directly exec(_xhr.connectRuntime(_options)); @@ -7667,8 +8143,8 @@ define("moxie/xhr/XMLHttpRequest", [ _xhr.connectRuntime(_options); } } - - + + function _reset() { _p('responseText', ""); _p('responseXML', null); @@ -7684,7 +8160,7 @@ define("moxie/xhr/XMLHttpRequest", [ XMLHttpRequest.HEADERS_RECEIVED = 2; XMLHttpRequest.LOADING = 3; XMLHttpRequest.DONE = 4; - + XMLHttpRequest.prototype = EventTarget.instance; return XMLHttpRequest; @@ -7695,54 +8171,55 @@ define("moxie/xhr/XMLHttpRequest", [ /** * ChunkUploader.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** - * @class plupload/ChunkUploader - * @constructor - * @private + * @class plupload.ChunkUploader + * @extends plupload.core.Queueable + * @constructor + * @private * @final * @constructor - * @extends plupload/core/Queueable */ define('plupload/ChunkUploader', [ - 'plupload', + 'moxie/core/utils/Basic', 'plupload/core/Collection', 'plupload/core/Queueable', 'moxie/xhr/XMLHttpRequest', 'moxie/xhr/FormData' -], function(plupload, Collection, Queueable, XMLHttpRequest, FormData) { +], function(Basic, Collection, Queueable, XMLHttpRequest, FormData) { - - function ChunkUploader(blob, options) { + function ChunkUploader(blob) { var _xhr; - var _blob = blob; Queueable.call(this); - this.setOptions(options); - - plupload.extend(this, { + this._options = { + file_data_name: 'file', + headers: false, + http_method: 'POST', + multipart: true, + params: {}, + send_file_name: true, + url: false + }; - uid: plupload.guid(), + Basic.extend(this, { - start: function(options) { + start: function() { var self = this; var url; var formData; - var _options; + var options = self._options; - if (options) { - this.setOptions(options); + if (this.state === Queueable.PROCESSING) { + return false; } - _options = this.getOptions(); - - ChunkUploader.prototype.start.call(this); _xhr = new XMLHttpRequest(); @@ -7754,12 +8231,12 @@ define('plupload/ChunkUploader', [ _xhr.onload = function() { var result = { - response: _xhr.responseText, - status: _xhr.status, - responseHeaders: _xhr.getAllResponseHeaders() + response: this.responseText, + status: this.status, + responseHeaders: this.getAllResponseHeaders() }; - if (_xhr.status >= 400) { // assume error + if (this.status >= 400) { // assume error return self.failed(result); } @@ -7771,51 +8248,75 @@ define('plupload/ChunkUploader', [ }; _xhr.onloadend = function() { - _xhr = null; + // we do not need _xhr anymore, so destroy it + setTimeout(function() { // we detach to sustain reference until all handlers are done + if (_xhr) { + _xhr.destroy(); + _xhr = null; + } + }, 1); }; + try { + url = options.multipart ? options.url : buildUrl(options.url, options.params); + _xhr.open(options.http_method, url, true); - url = _options.multipart ? _options.url : buildUrl(_options.url, _options.params); - _xhr.open(_options.http_method, url, true); + // headers must be set after request is already opened, otherwise INVALID_STATE_ERR exception will raise + if (!Basic.isEmptyObj(options.headers)) { + Basic.each(options.headers, function(val, key) { + _xhr.setRequestHeader(key, val); + }); + } - // headers must be set after request is already opened, otherwise INVALID_STATE_ERR exception will raise - if (!plupload.isEmptyObj(_options.headers)) { - plupload.each(_options.headers, function(val, key) { - _xhr.setRequestHeader(key, val); - }); - } + if (options.multipart) { + formData = new FormData(); - if (_options.multipart) { - formData = new FormData(); + if (!Basic.isEmptyObj(options.params)) { + Basic.each(options.params, function(val, key) { + formData.append(key, val); + }); + } - if (!plupload.isEmptyObj(_options.params)) { - plupload.each(_options.params, function(val, key) { - formData.append(key, val); - }); - } + formData.append(options.file_data_name, blob); - formData.append(_options.file_data_name, _blob); + _xhr.send(formData); + } else { // if no multipart, send as binary stream + if (Basic.isEmptyObj(options.headers) || !_xhr.hasRequestHeader('content-type')) { + _xhr.setRequestHeader('content-type', 'application/octet-stream'); // binary stream header + } - _xhr.send(formData); - } else { // if no multipart, send as binary stream - if (plupload.isEmptyObj(_options.headers) || !_options.headers['content-type']) { - _xhr.setRequestHeader('content-type', 'application/octet-stream'); // binary stream header + _xhr.send(blob); } - _xhr.send(_blob); + ChunkUploader.prototype.start.call(this) + } catch(ex) { + self.failed(); } }, stop: function() { - ChunkUploader.prototype.stop.call(this); - if (_xhr) { _xhr.abort(); + _xhr.destroy(); _xhr = null; } + ChunkUploader.prototype.stop.call(this); + }, + + setOption: function(option, value) { + ChunkUploader.prototype.setOption.call(this, option, value, true); + }, + + setOptions: function(options) { + ChunkUploader.prototype.setOption.call(this, options, true); + }, + + destroy: function() { + this.stop(); + ChunkUploader.prototype.destroy.call(this); } }); @@ -7832,7 +8333,7 @@ define('plupload/ChunkUploader', [ function buildUrl(url, items) { var query = ''; - plupload.each(items, function(value, name) { + Basic.each(items, function(value, name) { query += (query ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value); }); @@ -7845,7 +8346,7 @@ define('plupload/ChunkUploader', [ } - ChunkUploader.prototype = new Queueable(); + Basic.inherit(ChunkUploader, Queueable); return ChunkUploader; }); @@ -7855,74 +8356,64 @@ define('plupload/ChunkUploader', [ /** * FileUploader.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License.se. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** - * @class plupload/FileUploader - * @constructor + * @class plupload.FileUploader + * @extends plupload.core.Queueable + * @constructor * @since 3.0 * @final - * @extends plupload/core/Queueable */ define('plupload/FileUploader', [ - 'plupload', + 'moxie/core/utils/Basic', 'plupload/core/Collection', 'plupload/core/Queueable', 'plupload/ChunkUploader' -], function(plupload, Collection, Queueable, ChunkUploader) { +], function(Basic, Collection, Queueable, ChunkUploader) { - function FileUploader(fileRef, queue) { - var _file = fileRef; + function FileUploader(file, queue) { var _chunks = new Collection(); var _totalChunks = 1; Queueable.call(this); this._options = { - url: false, chunk_size: 0, - multipart: true, - http_method: 'POST', params: {}, - headers: false, - file_data_name: 'file', send_file_name: true, stop_on_fail: true }; - plupload.extend(this, { - - /** - Unique identifier - - @property uid - @type {String} - */ - uid: plupload.guid(), - + Basic.extend(this, { /** - When send_file_name is set to true, will be sent with the request as `name` param. + When send_file_name is set to true, will be sent with the request as `name` param. Can be used on server-side to override original file name. @property name @type {String} */ - name: _file.name, + name: file.name, - start: function(options) { + start: function() { var self = this; + var prevState = this.state; var up; - this.setOptions(options); + if (this.state === Queueable.PROCESSING) { + return false; + } - FileUploader.prototype.start.call(self); + if (this.state === Queueable.IDLE && !FileUploader.prototype.start.call(self)) { + return false; + } // send additional 'name' parameter only if required or explicitly requested if (self._options.send_file_name) { @@ -7930,10 +8421,10 @@ define('plupload/FileUploader', [ } if (self._options.chunk_size) { - _totalChunks = Math.ceil(_file.size / self._options.chunk_size); - self.uploadChunk(false, false, true); + _totalChunks = Math.ceil(file.size / self._options.chunk_size); + self.uploadChunk(false, true); } else { - up = new ChunkUploader(_file, self._options); + up = new ChunkUploader(file); up.bind('progress', function(e) { self.progress(e.loaded, e.total); @@ -7947,53 +8438,58 @@ define('plupload/FileUploader', [ self.failed(result); }); + up.setOptions(self._options); + queue.addItem(up); } + + this.state = Queueable.PROCESSING; + this.trigger('statechanged', this.state, prevState); + this.trigger('started'); + return true; }, - uploadChunk: function(seq, options, dontStop) { + uploadChunk: function(seq, dontStop) { var self = this; var chunkSize = this.getOption('chunk_size'); var up; var chunk = {}; var _options; - if (options) { - // chunk_size cannot be changed on the fly - delete options.chunk_size; - plupload.extend(this._options, options); - } - chunk.seq = parseInt(seq, 10) || getNextChunk(); chunk.start = chunk.seq * chunkSize; - chunk.end = Math.min(chunk.start + chunkSize, _file.size); - chunk.total = _file.size; + chunk.end = Math.min(chunk.start + chunkSize, file.size); + chunk.total = file.size; // do not proceed for weird chunks - if (chunk.start < 0 || chunk.start >= _file.size) { + if (chunk.start < 0 || chunk.start >= file.size) { return false; } - _options = plupload.extend({}, this.getOptions(), { + _options = Basic.extendImmutable({}, this.getOptions(), { params: { - chunk: seq, + chunk: chunk.seq, chunks: _totalChunks } }); - up = new ChunkUploader(_file.slice(chunk.start, chunk.end, _file.type), _options); + up = new ChunkUploader(file.slice(chunk.start, chunk.end, file.type)); + + /*up.bind('beforestart', function(e) { + self.trigger('beforechunkupload', file, this.getOption('params'), blob) + });*/ up.bind('progress', function(e) { - self.progress(calcProcessed() + e.loaded, _file.size); + self.progress(calcProcessed() + e.loaded, file.size); }); up.bind('failed', function(e, result) { - _chunks.add(chunk.seq, plupload.extend({ + _chunks.add(chunk.seq, Basic.extend({ state: Queueable.FAILED }, chunk)); - self.trigger('chunkuploadfailed', plupload.extend({}, chunk, result)); + self.trigger('chunkuploadfailed', Basic.extendImmutable({}, chunk, result)); if (_options.stop_on_fail) { self.failed(result); @@ -8001,17 +8497,18 @@ define('plupload/FileUploader', [ }); up.bind('done', function(e, result) { - _chunks.add(chunk.seq, plupload.extend({ + _chunks.add(chunk.seq, Basic.extend({ state: Queueable.DONE }, chunk)); - self.trigger('chunkuploaded', plupload.extend({}, chunk, result)); + self.trigger('chunkuploaded', Basic.extendImmutable({}, chunk, result)); - if (calcProcessed() >= _file.size) { + if (calcProcessed() >= file.size) { + self.progress(file.size, file.size); self.done(result); // obviously we are done } else if (dontStop) { - plupload.delay(function() { - self.uploadChunk(getNextChunk(), false, dontStop); + Basic.delay(function() { + self.uploadChunk(getNextChunk(), dontStop); }); } }); @@ -8020,32 +8517,25 @@ define('plupload/FileUploader', [ this.destroy(); }); + up.setOptions(_options); - _chunks.add(chunk.seq, plupload.extend({ + _chunks.add(chunk.seq, Basic.extend({ state: Queueable.PROCESSING }, chunk)); + queue.addItem(up); // enqueue even more chunks if slots available if (dontStop && queue.countSpareSlots()) { - self.uploadChunk(getNextChunk(), false, dontStop); + self.uploadChunk(getNextChunk(), dontStop); } return true; }, - - setOption: function(option, value) { - if (typeof(option) !== 'object' && !this._options.hasOwnProperty(option)) { - return; - } - FileUploader.prototype.setOption.apply(this, arguments); - }, - - destroy: function() { FileUploader.prototype.destroy.call(this); - queue = _file = null; + _chunks.clear(); } }); @@ -8074,7 +8564,7 @@ define('plupload/FileUploader', [ } - FileUploader.prototype = new Queueable(); + Basic.inherit(FileUploader, Queueable); return FileUploader; }); @@ -8433,7 +8923,7 @@ define("moxie/image/Image", [ height: self.height }; - options = Basic.extendIf({ + var opts = Basic.extendIf({ width: self.width, height: self.height, type: self.type || 'image/jpeg', @@ -8459,34 +8949,34 @@ define("moxie/image/Image", [ orientation = (self.meta && self.meta.tiff && self.meta.tiff.Orientation) || 1; if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation - var tmp = options.width; - options.width = options.height; - options.height = tmp; + var tmp = opts.width; + opts.width = opts.height; + opts.height = tmp; } - if (options.crop) { - scale = Math.max(options.width/self.width, options.height/self.height); + if (opts.crop) { + scale = Math.max(opts.width/self.width, opts.height/self.height); if (options.fit) { // first scale it up or down to fit the original image - srcRect.width = Math.min(Math.ceil(options.width/scale), self.width); - srcRect.height = Math.min(Math.ceil(options.height/scale), self.height); + srcRect.width = Math.min(Math.ceil(opts.width/scale), self.width); + srcRect.height = Math.min(Math.ceil(opts.height/scale), self.height); // recalculate the scale for adapted dimensions - scale = options.width/srcRect.width; + scale = opts.width/srcRect.width; } else { - srcRect.width = Math.min(options.width, self.width); - srcRect.height = Math.min(options.height, self.height); + srcRect.width = Math.min(opts.width, self.width); + srcRect.height = Math.min(opts.height, self.height); // now we do not need to scale it any further scale = 1; } - if (typeof(options.crop) === 'boolean') { - options.crop = 'cc'; + if (typeof(opts.crop) === 'boolean') { + opts.crop = 'cc'; } - switch (options.crop.toLowerCase()) { + switch (opts.crop.toLowerCase().replace(/_/, '-')) { case 'rb': case 'right-bottom': srcRect.x = self.width - srcRect.width; @@ -8544,16 +9034,16 @@ define("moxie/image/Image", [ default: srcRect.x = Math.floor((self.width - srcRect.width) / 2); srcRect.y = Math.floor((self.height - srcRect.height) / 2); - } + } // original image might be smaller than requested crop, so - avoid negative values srcRect.x = Math.max(srcRect.x, 0); srcRect.y = Math.max(srcRect.y, 0); } else { - scale = Math.min(options.width/self.width, options.height/self.height); + scale = Math.min(opts.width/self.width, opts.height/self.height); } - this.exec('Image', 'resize', srcRect, scale, options); + this.exec('Image', 'resize', srcRect, scale, opts); } catch(ex) { // for now simply trigger error event self.trigger('error', ex.code); @@ -8565,14 +9055,8 @@ define("moxie/image/Image", [ @method downsize @deprecated use resize() - @param {Object} opts - @param {Number} opts.width Resulting width - @param {Number} [opts.height=width] Resulting height (optional, if not supplied will default to width) - @param {Boolean} [opts.crop=false] Whether to crop the image to exact dimensions - @param {Boolean} [opts.preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize) - @param {String} [opts.resample=false] Resampling algorithm to use for resizing */ - downsize: function(opts) { + downsize: function(options) { var defaults = { width: this.width, height: this.height, @@ -8581,10 +9065,10 @@ define("moxie/image/Image", [ crop: false, preserveHeaders: true, resample: 'default' - }; + }, opts; - if (typeof(opts) === 'object') { - opts = Basic.extend(defaults, opts); + if (typeof(options) === 'object') { + opts = Basic.extend(defaults, options); } else { // for backward compatibility opts = Basic.extend(defaults, { @@ -8614,9 +9098,7 @@ define("moxie/image/Image", [ if (!Env.can('create_canvas')) { throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR); } - - var runtime = this.connectRuntime(this.ruid); - return runtime.exec.call(this, 'Image', 'getAsCanvas'); + return this.exec('Image', 'getAsCanvas'); }, /** @@ -8672,24 +9154,24 @@ define("moxie/image/Image", [ @method embed @param {DOMElement} el DOM element to insert the image object into - @param {Object} [opts] - @param {Number} [opts.width] The width of an embed (defaults to the image width) - @param {Number} [opts.height] The height of an embed (defaults to the image height) - @param {String} [type="image/jpeg"] Mime type - @param {Number} [quality=90] Quality of an embed, if mime type is image/jpeg - @param {Boolean} [crop=false] Whether to crop an embed to the specified dimensions + @param {Object} [options] + @param {Number} [options.width] The width of an embed (defaults to the image width) + @param {Number} [options.height] The height of an embed (defaults to the image height) + @param {String} [options.type="image/jpeg"] Mime type + @param {Number} [options.quality=90] Quality of an embed, if mime type is image/jpeg + @param {Boolean} [options.crop=false] Whether to crop an embed to the specified dimensions */ - embed: function(el, opts) { + embed: function(el, options) { var self = this , runtime // this has to be outside of all the closures to contain proper runtime ; - opts = Basic.extend({ + var opts = Basic.extend({ width: this.width, height: this.height, type: this.type || 'image/jpeg', quality: 90 - }, opts || {}); + }, options); function render(type, quality) { @@ -8779,7 +9261,7 @@ define("moxie/image/Image", [ }); imgCopy.bind("Load", function() { - imgCopy.downsize(opts); + this.downsize(opts); }); // if embedded thumb data is available and dimensions are big enough, use it @@ -8806,6 +9288,10 @@ define("moxie/image/Image", [ this.getRuntime().exec.call(this, 'Image', 'destroy'); this.disconnectRuntime(); } + if (this.meta && this.meta.thumb) { + // thumb is blob, make sure we destroy it first + this.meta.thumb.data.destroy(); + } this.unbindAll(); } }); @@ -8815,27 +9301,34 @@ define("moxie/image/Image", [ this.handleEventProps(dispatches); this.bind('Load Resize', function() { - _updateInfo.call(this); + return _updateInfo.call(this); // if operation fails (e.g. image is neither PNG nor JPEG) cancel all pending events }, 999); function _updateInfo(info) { - if (!info) { - info = this.exec('Image', 'getInfo'); - } + try { + if (!info) { + info = this.exec('Image', 'getInfo'); + } + + this.size = info.size; + this.width = info.width; + this.height = info.height; + this.type = info.type; + this.meta = info.meta; - this.size = info.size; - this.width = info.width; - this.height = info.height; - this.type = info.type; - this.meta = info.meta; + // update file name, only if empty + if (this.name === '') { + this.name = info.name; + } - // update file name, only if empty - if (this.name === '') { - this.name = info.name; + return true; + } catch(ex) { + this.trigger('error', ex.code); + return false; } } - + function _load(src) { var srcType = Basic.typeOf(src); @@ -8969,16 +9462,21 @@ define("moxie/image/Image", [ /** * ImageResizer.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** -@class plupload/ImageResizer -@constructor + @class plupload.ImageResizer + @extends plupload.core.Queueable + @constructor + @private + @final + @since 3.0 + @param {plupload.File} fileRef */ define("plupload/ImageResizer", [ 'plupload', @@ -8986,12 +9484,7 @@ define("plupload/ImageResizer", [ 'moxie/image/Image' ], function(plupload, Queueable, mxiImage) { - /** - Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data. - @class plupload/Image - @constructor - */ function ImageResizer(fileRef) { Queueable.call(this); @@ -9044,7 +9537,10 @@ define("plupload/ImageResizer", [ }; } - ImageResizer.prototype = new Queueable(); + plupload.inherit(ImageResizer, Queueable); + + // ImageResizer is only included for builds with Image manipulation support, so we add plupload.Image here manually + plupload.Image = mxiImage; return ImageResizer; }); @@ -9054,19 +9550,19 @@ define("plupload/ImageResizer", [ /** * File.js * - * Copyright 2015, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License.se. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** - * @class plupload/File + * @class plupload.File + * @extends plupload.core.Queueable * @constructor * @since 3.0 * @final - * @extends plupload/core/Queueable */ define('plupload/File', [ 'plupload', @@ -9075,13 +9571,10 @@ define('plupload/File', [ 'plupload/ImageResizer' ], function(plupload, Queueable, FileUploader, ImageResizer) { - - function File(fileRef, queueUpload, queueResize) { - var _file = fileRef; - var _uid = plupload.guid(); - + function File(file, queueUpload, queueResize) { Queueable.call(this); + plupload.extend(this, { /** * For backward compatibility @@ -9090,15 +9583,8 @@ define('plupload/File', [ * @type {String} * @deprecated */ - id: _uid, + id: this.uid, - /** - Unique identifier - - @property uid - @type {String} - */ - uid: _uid, /** When send_file_name is set to true, will be sent with the request as `name` param. @@ -9107,7 +9593,7 @@ define('plupload/File', [ @property name @type {String} */ - name: _file.name, + name: file.name, /** @property target_name @@ -9122,7 +9608,7 @@ define('plupload/File', [ * @property type * @type String */ - type: _file.type, + type: file.type, /** * File size in bytes (may change after client-side manupilation). @@ -9130,7 +9616,7 @@ define('plupload/File', [ * @property size * @type Number */ - size: _file.size, + size: file.size, /** * Original file size in bytes. @@ -9138,23 +9624,25 @@ define('plupload/File', [ * @property origSize * @type Number */ - origSize: _file.size, + origSize: file.size, + start: function() { + var prevState = this.state; - start: function(options) { - var self = this; - - if (options) { - this.setOptions(options); + if (this.state === Queueable.PROCESSING) { + return false; } - if (!plupload.isEmptyObj(options.resize) && isImage(this.type) && runtimeCan(_file, 'send_binary_string')) { + this.state = Queueable.PROCESSING; + this.trigger('statechanged', this.state, prevState); + this.trigger('started'); + + if (!plupload.isEmptyObj(this._options.resize) && isImage(this.type) && runtimeCan(file, 'send_binary_string')) { this.resizeAndUpload(); } else { this.upload(); } - - File.prototype.start.call(self); + return true; }, /** @@ -9164,7 +9652,7 @@ define('plupload/File', [ * @returns {moxie.file.File} */ getSource: function() { - return _file; + return file; }, /** @@ -9183,18 +9671,18 @@ define('plupload/File', [ resizeAndUpload: function() { var self = this; - var rszr = new ImageResizer(_file); + var rszr = new ImageResizer(file); rszr.bind('progress', function(e) { self.progress(e.loaded, e.total); }); rszr.bind('done', function(e, file) { - _file = file; + file = file; self.upload(); }); - rszr.bind('failed', function(e, result) { + rszr.bind('failed', function() { self.upload(); }); @@ -9204,7 +9692,23 @@ define('plupload/File', [ upload: function() { var self = this; - var up = new FileUploader(_file, queueUpload); + var up = new FileUploader(file, queueUpload); + + up.bind('beforestart', function() { + return self.trigger('beforeupload'); + }); + + up.bind('paused', function() { + self.pause(); + }); + + up.bind('resumed', function() { + this.start(); + }); + + up.bind('started', function() { + self.trigger('startupload'); + }); up.bind('progress', function(e) { self.progress(e.loaded, e.total); @@ -9218,14 +9722,16 @@ define('plupload/File', [ self.failed(result); }); - up.start(self.getOptions()); + up.setOptions(self.getOptions()); + + up.start(); }, destroy: function() { File.prototype.destroy.call(this); - _file = null; + file = null; } }); } @@ -9247,7 +9753,7 @@ define('plupload/File', [ } - File.prototype = new Queueable(); + plupload.inherit(File, Queueable); return File; }); @@ -9257,8 +9763,8 @@ define('plupload/File', [ /** * Uploader.js * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing @@ -9266,15 +9772,14 @@ define('plupload/File', [ /** -@class plupload/Uploader +@class plupload.Uploader +@extends plupload.core.Queue +@constructor @public @final -@constructor -@extends plupload/core/Queue @param {Object} settings For detailed information about each option check documentation. @param {String|DOMElement} settings.browse_button id of the DOM element or DOM element itself to use as file dialog trigger. - @param {String} settings.url URL of the server-side upload handler. @param {Number|String} [settings.chunk_size=0] Chunk size in bytes to slice the file into. Shorcuts with b, kb, mb, gb, tb suffixes also supported. `e.g. 204800 or "204800b" or "200kb"`. By default - disabled. @param {Boolean} [settings.send_chunk_number=true] Whether to send chunks and chunk numbers, or total and offset bytes. @param {String|DOMElement} [settings.container] id of the DOM element or DOM element itself that will be used to wrap uploader structures. Defaults to immediate parent of the `browse_button` element. @@ -9286,21 +9791,27 @@ define('plupload/File', [ @param {Boolean} [settings.filters.prevent_duplicates=false] Do not let duplicates into the queue. Dispatches `plupload.FILE_DUPLICATE_ERROR`. @param {String} [settings.flash_swf_url] URL of the Flash swf. @param {Object} [settings.headers] Custom headers to send with the upload. Hash of name/value pairs. + @param {String} [settings.http_method="POST"] HTTP method to use during upload (only PUT or POST allowed). @param {Number} [settings.max_retries=0] How many times to retry the chunk or file, before triggering Error event. @param {Boolean} [settings.multipart=true] Whether to send file and additional parameters as Multipart formated message. - @param {Object} [settings.params] Hash of key/value pairs to send with every file upload. - @param {String} [settings.http_method="POST"] HTTP method to use during upload (only PUT or POST allowed). @param {Boolean} [settings.multi_selection=true] Enable ability to select multiple files at once in file dialog. + @param {Object} [settings.params] Hash of key/value pairs to send with every file upload. @param {String|Object} [settings.required_features] Either comma-separated list or hash of required features that chosen runtime should absolutely possess. - @param {Object} [settings.resize] Enable resizng of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}` - @param {Number} [settings.resize.width] If image is bigger, it will be resized. - @param {Number} [settings.resize.height] If image is bigger, it will be resized. - @param {Number} [settings.resize.quality=90] Compression quality for jpegs (1-100). - @param {Boolean} [settings.resize.crop=false] Whether to crop images to exact dimensions. By default they will be resized proportionally. - @param {String} [settings.runtimes="html5,flash,silverlight,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails. + @param {Object} [settings.resize] Enable resizing of images on client-side. Applies to `image/jpeg` and `image/png` only. `e.g. {width : 200, height : 200, quality : 90, crop: true}` + @param {Number} settings.resize.width Resulting width + @param {Number} [settings.resize.height=width] Resulting height (optional, if not supplied will default to width) + @param {String} [settings.resize.type='image/jpeg'] MIME type of the resulting image + @param {Number} [settings.resize.quality=90] In the case of JPEG, controls the quality of resulting image + @param {Boolean} [settings.resize.crop='cc'] If not falsy, image will be cropped, by default from center + @param {Boolean} [settings.resize.fit=true] In case of crop whether to upscale the image to fit the exact dimensions + @param {Boolean} [settings.resize.preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize) + @param {String} [settings.resize.resample='default'] Resampling algorithm to use during resize + @param {Boolean} [settings.resize.multipass=true] Whether to scale the image in steps (results in better quality) + @param {String} [settings.runtimes="html5,flash,silverlight,html4"] Comma separated list of runtimes, that Plupload will try in turn, moving to the next if previous fails. + @param {Boolean} [settings.send_file_name=true] Whether to send file name as additional argument - 'name' (required for chunked uploads and some other cases where file name cannot be sent via normal ways). @param {String} [settings.silverlight_xap_url] URL of the Silverlight xap. @param {Boolean} [settings.unique_names=false] If true will generate unique filenames for uploaded files. - @param {Boolean} [settings.send_file_name=true] Whether to send file name as additional argument - 'name' (required for chunked uploads and some other cases where file name cannot be sent via normal ways). + @param {String} settings.url URL of the server-side upload handler. */ /** @@ -9484,64 +9995,59 @@ define('plupload/Uploader', [ function Uploader(options) { - var _uid = plupload.guid(); var _fileInputs = []; var _fileDrops = []; var _queueUpload, _queueResize; var _initialized = false; var _disabled = false; - var _options = plupload.extend({ - runtimes: Runtime.order, - multi_selection: true, - flash_swf_url: 'js/Moxie.swf', - silverlight_xap_url: 'js/Moxie.xap', - filters: { - mime_types: '*', - prevent_duplicates: false, - max_file_size: 0 - }, - // headers: false, // Plupload had a required feature with the same name, comment it to avoid confusion - max_upload_slots: 1, - max_resize_slots: 1, - multipart: true, - multipart_params: {}, // deprecated, use - params, - // @since 3 - params: {}, - // @since 2.3 - http_method: 'POST', - file_data_name: 'file', - chunk_size: 0, - send_file_name: true, - send_chunk_number: true, // whether to send chunks and chunk numbers, instead of total and offset bytes - max_retries: 0, - resize: false, - backward_compatibility: true - }, - options - ); - - // Normalize the list of required capabilities - _options.required_features = normalizeCaps(plupload.extend({}, _options)); + var _options = normalizeOptions(plupload.extend({ + backward_compatibility: true, + chunk_size: 0, + file_data_name: 'file', + filters: { + mime_types: '*', + prevent_duplicates: false, + max_file_size: 0 + }, + flash_swf_url: 'js/Moxie.swf', + // @since 2.3 + http_method: 'POST', + // headers: false, // Plupload had a required feature with the same name, comment it to avoid confusion + max_resize_slots: 1, + max_retries: 0, + max_upload_slots: 1, + multipart: true, + multipart_params: {}, // deprecated, use - params, + multi_selection: true, + // @since 3 + params: {}, + resize: false, + runtimes: Runtime.order, + send_chunk_number: true, // whether to send chunks and chunk numbers, instead of total and offset bytes + send_file_name: true, + silverlight_xap_url: 'js/Moxie.xap', - // Come up with the list of capabilities that can affect default mode in a multi-mode runtimes - _options.preferred_caps = normalizeCaps(plupload.extend({}, _options, { - required_features: true - })); + // during normalization, these should be processed last + required_features: false, + preferred_caps: false + }, options)); Queue.call(this); + // Add public methods plupload.extend(this, { + _options: _options, + /** * Unique id for the Uploader instance. * * @property id * @type String */ - id: _uid, - uid: _uid, // mOxie uses this to differentiate between event targets + id: this.uid, /** * Current state of the total uploading progress. This one can either be plupload.STARTED or plupload.STOPPED. @@ -9570,7 +10076,7 @@ define('plupload/Uploader', [ * @type Object * @deprecated Use `getOption()/setOption()` */ - settings : {}, + settings : _options, /** * Current runtime name @@ -9595,7 +10101,6 @@ define('plupload/Uploader', [ * * @property total * @deprecated use stats - * @type plupload.QueueProgress */ total: this.stats, @@ -9645,7 +10150,7 @@ define('plupload/Uploader', [ initControls.call(self, function(initialized) { var runtime; var initOpt = self.getOption('init'); - var queueOpts = plupload.extend({}, self.getOption(), { auto_start: true }); + var queueOpts = plupload.extendImmutable({}, self.getOption(), { auto_start: true }); if (typeof(initOpt) == "function") { initOpt(self); @@ -9706,7 +10211,7 @@ define('plupload/Uploader', [ } if (typeof(option) !== 'object') { - value = normalizeOption(option, value, _options); + value = normalizeOption(option, value, this._options); // queues will take in only appropriate options if (_queueUpload) { @@ -9748,9 +10253,7 @@ define('plupload/Uploader', [ * @method stop */ stop: function() { - Uploader.prototype.stop.call(this); - - if (this.state != plupload.STOPPED) { + if (Uploader.prototype.stop.call(this) && this.state != plupload.STOPPED) { this.trigger('CancelUpload'); } }, @@ -9788,7 +10291,7 @@ define('plupload/Uploader', [ /** * Adds file to the queue programmatically. Can be native file, instance of Plupload.File, - * instance of mOxie.File, input[type="file"] element, or array of these. Fires FilesAdded, + * instance of mOxie.File, input[type="file"] element, or array of these. Fires FilesAdded, * if any files were added to the queue. Otherwise nothing happens. * * @method addFile @@ -9804,11 +10307,11 @@ define('plupload/Uploader', [ function bindListeners(fileUp) { - fileUp.bind('beforestart', function(e) { + fileUp.bind('beforeupload', function(e) { return self.trigger('BeforeUpload', e.target); }); - fileUp.bind('started', function() { + fileUp.bind('startupload', function() { self.trigger('UploadFile', this); }); @@ -9885,7 +10388,7 @@ define('plupload/Uploader', [ }); }); } - // mxiBlob + // mxiBlob else if (file instanceof mxiBlob) { resolveFile(file.getSource()); file.destroy(); @@ -9943,27 +10446,10 @@ define('plupload/Uploader', [ * @param {Number} length (Optional) Length of items to remove */ splice: function(start, length) { - var self = this; var i = 0; - var removed = []; var shouldRestart = plupload.STARTED == this.state; - start === undef ? 0 : Math.max(start, 0); - var end = length === undef ? this.count() : Math.min(start + length, this.count()); - - this.forEachItem(function(item) { - if (i < start) { - return true; // continue - } - if (i > end) { - return false; // finish here - } - - self.extractItem(item.uid); // extracts but not destroys (we still need to fire FilesRemoved with these) - removed.push(item); - i++; - }); - + var removed = Queue.prototype.splice.apply(this, arguments); if (removed.length) { this.trigger("FilesRemoved", removed); @@ -10068,10 +10554,6 @@ define('plupload/Uploader', [ } - // normalize options - this.setOptions(_options); - - function getRUID() { var ctrl = _fileInputs[0] || _fileDrops[0]; if (ctrl) { @@ -10089,7 +10571,7 @@ define('plupload/Uploader', [ this.bind('BeforeUpload', onBeforeUpload); - this.bind('Done', function(up) { + this.bind('Stopped', function(up) { up.trigger('UploadComplete'); }); @@ -10349,6 +10831,13 @@ define('plupload/Uploader', [ return caps; } + function normalizeOptions(options) { + plupload.each(options, function(value, option) { + options[option] = normalizeOption(option, value, options); + }); + return options; + } + /** Normalize an option. @@ -10357,7 +10846,7 @@ define('plupload/Uploader', [ @param {String} option Name of the option to normalize @param {Mixed} value - @param {Object} options The whole set of options, that might be modified during normalization (see max_file_size or unique_names) + @param {Object} options The whole set of options, that might be modified during normalization (see max_file_size or unique_names)! */ function normalizeOption(option, value, options) { switch (option) { @@ -10394,7 +10883,8 @@ define('plupload/Uploader', [ value.mime_types = Mime.mimes2extList(value.mime_types); } - value.mime_types.regexp = (function(filters) { + // generate and cache regular expression for filtering file extensions + options.re_ext_filter = (function(filters) { var extensionsRegExp = []; plupload.each(filters, function(filter) { @@ -10452,6 +10942,16 @@ define('plupload/Uploader', [ } break; + case 'required_features': + // Normalize the list of required capabilities + return normalizeCaps(plupload.extend({}, options)); + + case 'preferred_caps': + // Come up with the list of capabilities that can affect default mode in a multi-mode runtimes + return normalizeCaps(plupload.extend({}, options, { + required_features: true + })); + // options that require reinitialisation case 'container': case 'browse_button': @@ -10501,7 +11001,7 @@ define('plupload/Uploader', [ addFileFilter('mime_types', function(filters, file, cb) { - if (filters.length && !filters.regexp.test(file.name)) { + if (filters.length && !this.getOption('re_ext_filter').test(file.name)) { this.trigger('Error', { code: plupload.FILE_EXTENSION_ERROR, message: plupload.translate('File extension error.'), @@ -10534,12 +11034,12 @@ define('plupload/Uploader', [ addFileFilter('prevent_duplicates', function(value, file, cb) { + var self = this; if (value) { - var ii = this.files.length; - while (ii--) { + this.forEachItem(function(item) { // Compare by name and size (size might be 0 or undefined, but still equivalent for both) - if (file.name === this.files[ii].name && file.size === this.files[ii].size) { - this.trigger('Error', { + if (file.name === item.name && file.size === item.size) { + self.trigger('Error', { code: plupload.FILE_DUPLICATE_ERROR, message: plupload.translate('Duplicate file error.'), file: file @@ -10547,7 +11047,7 @@ define('plupload/Uploader', [ cb(false); return; } - } + }); } cb(true); }); @@ -10555,7 +11055,7 @@ define('plupload/Uploader', [ Uploader.addFileFilter = addFileFilter; - Uploader.prototype = new Queue(); + plupload.inherit(Uploader, Queue); // for backward compatibility plupload.addFileFilter = addFileFilter; @@ -10784,7 +11284,7 @@ define("moxie/runtime/html5/file/FileInput", [ _options = options; // figure out accept string - mimes = _options.accept.mimes || Mime.extList2mimes(_options.accept, I.can('filter_by_extension')); + mimes = Mime.extList2mimes(_options.accept, I.can('filter_by_extension')); shimContainer = I.getShimContainer(); @@ -12941,219 +13441,6 @@ define("moxie/runtime/html5/image/ResizerCanvas", [], function() { }); -// Included from: src/moxie/src/javascript/runtime/html5/image/ResizerWebGL.js - -/** - * ResizerWebGL.js - * - * Released under LGPL License. - * Copyright (c) 1999-2015 Ephox Corp. All rights reserved - * - * License: http://www.tinymce.com/license - * Contributing: http://www.tinymce.com/contributing - */ - -/** - * Resizes image/canvas using Webgl - */ -define("moxie/runtime/html5/image/ResizerWebGL", [], function() { - - function scale(image, ratio) { - var dW = Math.floor(image.width * ratio); - var dH = Math.floor(image.height * ratio); - var canvas = document.createElement('canvas'); - canvas.width = dW; - canvas.height = dH; - - _drawImage(canvas, image, ratio, ratio); - image = null; // just in case - - return canvas; - } - - var shaders = { - bilinear: { - VERTEX_SHADER: '\ - attribute vec2 a_dest_xy;\ - \ - uniform vec2 u_wh;\ - uniform vec2 u_ratio;\ - \ - varying vec2 a_xy;\ - varying vec2 b_xy;\ - varying vec2 c_xy;\ - varying vec2 d_xy;\ - \ - varying float xx0;\ - varying float x1x;\ - varying float yy0;\ - varying float y1y;\ - \ - void main() {\ - vec2 xy = a_dest_xy / u_ratio - 1.0;\ - float x = xy.x;\ - float y = xy.y;\ - float offset = 0.5;\ - \ - float x0 = x - offset;\ - float x1 = x + offset;\ - float y0 = y - offset;\ - float y1 = y + offset;\ - \ - a_xy = vec2(x0, y0) / u_wh;\ - b_xy = vec2(x1, y0) / u_wh;\ - c_xy = vec2(x1, y1) / u_wh;\ - d_xy = vec2(x0, y1) / u_wh;\ - \ - xx0 = (x - x0) / (x1 - x0);\ - x1x = (x1 - x) / (x1 - x0);\ - yy0 = (y - y0) / (y1 - y0);\ - y1y = (y1 - y) / (y1 - y0);\ - \ - gl_Position = vec4(((xy / u_wh) * 2.0 - 1.0) * vec2(1, -1), 0, 1);\ - }\ - ', - - FRAGMENT_SHADER: '\ - precision mediump float;\ - \ - uniform sampler2D u_image;\ - \ - varying vec2 a_xy;\ - varying vec2 b_xy;\ - varying vec2 c_xy;\ - varying vec2 d_xy;\ - \ - varying float xx0;\ - varying float x1x;\ - varying float yy0;\ - varying float y1y;\ - \ - void main() {\ - vec4 a = texture2D(u_image, a_xy);\ - vec4 b = texture2D(u_image, b_xy);\ - vec4 c = texture2D(u_image, c_xy);\ - vec4 d = texture2D(u_image, d_xy);\ - \ - vec4 ab = b * xx0 + a * x1x;\ - vec4 dc = c * xx0 + d * x1x;\ - vec4 abdc = dc * yy0 + ab * y1y;\ - \ - gl_FragColor = abdc;\ - }\ - ' - } - }; - - - function _drawImage(canvas, image, wRatio, hRatio) { - var gl = _get3dContext(canvas); - if (!gl) { - throw "Your environment doesn't support WebGL."; - } - - // we need a gap around the edges to avoid a black frame - wRatio = canvas.width / (image.width + 2); - hRatio = canvas.height / (image.height + 2); - - var program = _createProgram(gl); - gl.useProgram(program); - - _loadFloatBuffer(gl, program, "a_dest_xy", [ - 0, 0, - canvas.width, 0, - 0, canvas.height, - 0, canvas.height, - canvas.width, 0, - canvas.width, canvas.height - ]); - - // load the texture - var texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - - // without this we won't be able to process images of arbitrary dimensions - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - - - var uResolution = gl.getUniformLocation(program, "u_wh"); - gl.uniform2f(uResolution, image.width, image.height); - - var uRatio = gl.getUniformLocation(program, "u_ratio"); - gl.uniform2f(uRatio, wRatio, hRatio); - - - // lets draw... - gl.drawArrays(gl.TRIANGLES, 0, 6); - } - - - function _get3dContext(canvas) { - var gl = null; - try { - gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); - } - catch(e) {} - - if (!gl) { // it seems that sometimes it doesn't throw exception, but still fails to get context - gl = null; - } - return gl; - } - - - function _loadFloatBuffer(gl, program, attrName, bufferData) { - var attr = gl.getAttribLocation(program, attrName); - var buffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(bufferData), gl.STATIC_DRAW); - gl.enableVertexAttribArray(attr); - gl.vertexAttribPointer(attr, 2, gl.FLOAT, false, 0, 0); - } - - - function _createProgram(gl) { - var program = gl.createProgram(); - - for (var type in shaders.bilinear) { - gl.attachShader(program, _loadShader(gl, shaders.bilinear[type], type)); - } - - gl.linkProgram(program); - if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - var err = gl.getProgramInfoLog(program); - gl.deleteProgram(program); - throw "Cannot create a program: " + err; - } - return program; - } - - - function _loadShader(gl, source, type) { - var shader = gl.createShader(gl[type]); - gl.shaderSource(shader, source); - gl.compileShader(shader); - - if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { - var err = gl.getShaderInfoLog(shader); - gl.deleteShader(shader); - throw "Cannot compile a " + type + " shader: " + err; - } - return shader; - } - - - return { - scale: scale - }; - -}); - // Included from: src/moxie/src/javascript/runtime/html5/image/Image.js /** @@ -13179,11 +13466,10 @@ define("moxie/runtime/html5/image/Image", [ "moxie/file/File", "moxie/runtime/html5/image/ImageInfo", "moxie/runtime/html5/image/ResizerCanvas", - "moxie/runtime/html5/image/ResizerWebGL", "moxie/core/utils/Mime", "moxie/core/utils/Env" -], function(extensions, Basic, x, Encode, Blob, File, ImageInfo, ResizerCanvas, ResizerWebGL, Mime, Env) { - +], function(extensions, Basic, x, Encode, Blob, File, ImageInfo, ResizerCanvas, Mime, Env) { + function HTML5Image() { var me = this , _img, _imgInfo, _canvas, _binStr, _blob @@ -13193,7 +13479,7 @@ define("moxie/runtime/html5/image/Image", [ Basic.extend(this, { loadFromBlob: function(blob) { - var comp = this, I = comp.getRuntime() + var I = this.getRuntime() , asBinary = arguments.length > 1 ? arguments[1] : true ; @@ -13212,7 +13498,7 @@ define("moxie/runtime/html5/image/Image", [ if (asBinary) { _binStr = _toBinary(dataUrl); } - _preload.call(comp, dataUrl); + _preload.call(this, dataUrl); }); } }, @@ -13236,6 +13522,7 @@ define("moxie/runtime/html5/image/Image", [ _imgInfo = new ImageInfo(_binStr); } + // this stuff below is definitely having fun with itself info = { width: _getImg().width || 0, height: _getImg().height || 0, @@ -13248,7 +13535,7 @@ define("moxie/runtime/html5/image/Image", [ if (_preserveHeaders) { info.meta = _imgInfo && _imgInfo.meta || this.meta || {}; - // store thumbnail data as blob + // if data was taken from ImageInfo it will be a binary string, so we convert it to blob if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) { info.meta.thumb.data = new Blob(null, { type: 'image/jpeg', @@ -13275,7 +13562,7 @@ define("moxie/runtime/html5/image/Image", [ // rotate if required, according to orientation tag if (!_preserveHeaders) { var orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1; - _rotateToOrientaion(_canvas.width, _canvas.height, orientation); + _canvas = _rotateToOrientaion(_canvas, orientation); } this.width = _canvas.width; @@ -13454,14 +13741,14 @@ define("moxie/runtime/html5/image/Image", [ if (window.FileReader) { fr = new FileReader(); fr.onload = function() { - callback(this.result); + callback.call(comp, this.result); }; fr.onerror = function() { comp.trigger('error', x.ImageError.WRONG_FORMAT); }; fr.readAsDataURL(file); } else { - return callback(file.getAsDataURL()); + return callback.call(this, file.getAsDataURL()); } } @@ -13470,10 +13757,19 @@ define("moxie/runtime/html5/image/Image", [ * Orientation value is from EXIF tag * @author Shinichi Tomita */ - function _rotateToOrientaion(width, height, orientation) { + function _rotateToOrientaion(img, orientation) { + var RADIANS = Math.PI/180; + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + var width = img.width; + var height = img.height; + if (Basic.inArray(orientation, [5,6,7,8]) > -1) { - _canvas.width = height; - _canvas.height = width; + canvas.width = height; + canvas.height = width; + } else { + canvas.width = width; + canvas.height = height; } /** @@ -13486,8 +13782,6 @@ define("moxie/runtime/html5/image/Image", [ 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom. 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom. */ - - var ctx = _canvas.getContext('2d'); switch (orientation) { case 2: // horizontal flip @@ -13497,7 +13791,7 @@ define("moxie/runtime/html5/image/Image", [ case 3: // 180 rotate left ctx.translate(width, height); - ctx.rotate(Math.PI); + ctx.rotate(180 * RADIANS); break; case 4: // vertical flip @@ -13506,26 +13800,29 @@ define("moxie/runtime/html5/image/Image", [ break; case 5: // vertical flip + 90 rotate right - ctx.rotate(0.5 * Math.PI); + ctx.rotate(90 * RADIANS); ctx.scale(1, -1); break; case 6: // 90 rotate right - ctx.rotate(0.5 * Math.PI); + ctx.rotate(90 * RADIANS); ctx.translate(0, -height); break; case 7: // horizontal flip + 90 rotate right - ctx.rotate(0.5 * Math.PI); + ctx.rotate(90 * RADIANS); ctx.translate(width, -height); ctx.scale(-1, 1); break; case 8: // 90 rotate left - ctx.rotate(-0.5 * Math.PI); + ctx.rotate(-90 * RADIANS); ctx.translate(-width, 0); break; } + + ctx.drawImage(img, 0, 0, width, height); + return canvas; } @@ -13535,11 +13832,6 @@ define("moxie/runtime/html5/image/Image", [ _imgInfo = null; } - // Memory issue for IE/Edge. They Keep a reference to image (because of the onload event) and the object not been collected by GC. - if (_img) { - _img.src = ''; - } - _binStr = _img = _canvas = _blob = null; _modified = false; } @@ -14277,7 +14569,7 @@ define("moxie/runtime/flash/image/Image", [ , info = self.shimExec.call(this, 'Image', 'getInfo') ; - if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) { + if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) { info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data); } return info; @@ -14824,7 +15116,7 @@ define("moxie/runtime/silverlight/image/Image", [ }); // save thumb data as blob - if (info.meta && info.meta.thumb && !(info.meta.thumb.data instanceof Blob)) { + if (info.meta && info.meta.thumb && info.meta.thumb.data && !(self.meta.thumb.data instanceof Blob)) { info.meta.thumb.data = new Blob(self.uid, info.meta.thumb.data); } } @@ -15106,7 +15398,7 @@ define("moxie/runtime/html4/file/FileInput", [ // figure out accept string _options = options; - _mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension')); + _mimes = Mime.extList2mimes(options.accept, I.can('filter_by_extension')); shimContainer = I.getShimContainer(); @@ -15515,5 +15807,6 @@ define("moxie/runtime/html4/image/Image", [ return (extensions.Image = Image); }); -expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/core/utils/Mime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/FileReader","plupload","moxie/file/File","moxie/file/FileDrop","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","plupload/FileUploader","moxie/runtime/Transporter","moxie/image/Image","plupload/ImageResizer","plupload/File","plupload/Uploader","moxie/runtime/html5/image/ResizerCanvas","moxie/runtime/html5/image/ResizerWebGL"]); -})(this); \ No newline at end of file +expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/core/utils/Mime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/FileReader","plupload","moxie/file/File","moxie/file/FileDrop","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","plupload/FileUploader","moxie/runtime/Transporter","moxie/image/Image","plupload/File","plupload/Uploader","moxie/runtime/html5/image/ResizerCanvas"]); +})(this); +})); \ No newline at end of file diff --git a/js/plupload.min.js b/js/plupload.min.js index a07e130df..9730842ce 100644 --- a/js/plupload.min.js +++ b/js/plupload.min.js @@ -1,17 +1,17 @@ /** * Plupload - multi-runtime File Uploader - * v3.0-beta1 + * v3.1.0 * - * Copyright 2013, Moxiecode Systems AB - * Released under GPL License. + * Copyright 2017, Ephox + * Released under AGPLv3 License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * - * Date: 2016-08-24 + * Date: 2017-03-07 */ -!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r0&&o(n,function(n,o){return!!(n===r||t&&a[o]===r)||void(e(a[o])===e(n)&&c(e(n),["array","object"])!==-1?i(t,[a[o],n]):a[o]=n)})}),a}function r(e,t){function n(){this.constructor=e}for(var i in t)({}).hasOwnProperty.call(t,i)&&(e[i]=t[i]);return n.prototype=t.prototype,e.prototype=new n,e.__parent__=t.prototype,e}function o(e,t){var n,i,r,o;if(e){try{n=e.length}catch(e){n=o}if(n===o||"number"!=typeof n){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;rt[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return o<=0;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return o<0;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",h="architecture",p="console",f="mobile",m="tablet",g={has:function(e,t){return t.toLowerCase().indexOf(e.toLowerCase())!==-1},lowerize:function(e){return e.toLowerCase()}},y={rgx:function(){for(var t,n=0,a,s,u,c,l,d,h=arguments;n0?2==c.length?typeof c[1]==i?t[c[0]]=c[1].call(this,d):t[c[0]]=c[1]:3==c.length?typeof c[1]!==i||c[1].exec&&c[1].test?t[c[0]]=d?d.replace(c[1],c[2]):e:t[c[0]]=d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a=9)},use_data_uri_of:function(e){return t.use_data_uri&&e<33e3||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r=(new n).getResult(),o={can:i,uaParser:n,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),i(d,[l],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(h,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(e){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(p,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,c=/\/[^\/]*\.[^\/]*$/.test(c)?c.replace(/\/[^\/]+$/,"/"):c.replace(/\/?$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i="object"==typeof t?t:e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(f,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e,n){this.code=e,this.name=t(i,e),this.message=this.name+(n||": RuntimeError "+this.code)}var i={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(m,[l,f,u],function(e,t,n){function i(){this.uid=n.guid()}var r={};return n.extend(i.prototype,{init:function(){this.uid||(this.uid=n.guid("uid_"))},addEventListener:function(e,t,i,o){var a=this,s;return this.hasOwnProperty("uid")||(this.uid=n.guid("uid_")),e=n.trim(e),/\s/.test(e)?void n.each(e.split(/\s+/),function(e){a.addEventListener(e,t,i,o)}):(e=e.toLowerCase(),i=parseInt(i,10)||0,s=r[this.uid]&&r[this.uid][e]||[],s.push({fn:t,priority:i,scope:o||this}),r[this.uid]||(r[this.uid]={}),void(r[this.uid][e]=s))},hasEventListener:function(e){var t=e?r[this.uid]&&r[this.uid][e]:r[this.uid];return!!t&&t},removeEventListener:function(e,t){var i=this,o,a;if(e=e.toLowerCase(),/\s/.test(e))return void n.each(e.split(/\s+/),function(e){i.removeEventListener(e,t)});if(o=r[this.uid]&&r[this.uid][e]){if(t){for(a=o.length-1;a>=0;a--)if(o[a].fn===t){o.splice(a,1);break}}else o=[];o.length||(delete r[this.uid][e],n.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var i,o,a,s,u={},c=!0,l;if("string"!==n.typeOf(e)){if(s=e,"string"!==n.typeOf(s.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(e.indexOf("::")!==-1?!function(t){i=t[0],e=t[1]}(e.split("::")):i=this.uid,e=e.toLowerCase(),o=r[i]&&r[i][e]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=e,a.unshift(u);var d=[];n.each(o,function(e){a[0].target=e.scope,u.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&n.inSeries(d,function(e){c=!e})}return c},bindOnce:function(e,t,n,i){var r=this;r.bind.call(this,e,function n(){return r.unbind(e,n),t.apply(this,arguments)},n,i)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===n.typeOf(this[t])&&this[t].apply(this,arguments)}),n.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===n.typeOf(t[e])&&(t[e]=null)})}}),i.instance=new i,i}),i(g,[l,u,d,m],function(e,t,n,i){function r(e,i,o,s,u){var c=this,l,d=t.guid(i+"_"),h=u||"browser";e=e||{},a[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(h=r.getMode(s,e.preferred_caps,h)),l=function(){var e={};return{exec:function(t,n,i,r){if(l[n]&&(e[t]||(e[t]={context:this,instance:new l[n]}),e[t].instance[i]))return e[t].instance[i].apply(this,r)},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var n=this;t.each(e,function(e,i){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),n.removeInstance(i)})}}}(),t.extend(this,{initialized:!1,uid:d,type:i,mode:r.getMode(s,e.required_caps,h),shimid:d+"_container",clients:0,options:e,can:function(e,n){var i=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(n)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var a in e)if(!this.can(a,e[a],i))return!1;return!0}return"function"===t.typeOf(i[e])?i[e].call(this,n):n===i[e]},getShimContainer:function(){var e,i=n.get(this.shimid);return i||(e=n.get(this.options.container)||document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,t.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(i),e=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=n.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete a[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},a={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return!!a[e]&&a[e]},r.addConstructor=function(e,t){t.prototype=i.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var n={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){n[e]=!0}),n)},r.can=function(e,t){var n,i=r.getConstructor(e),o;return!!i&&(n=new i({required_caps:t}),o=n.mode,n.destroy(),!!o)},r.thatCan=function(e,t){var n=(t||r.order).split(/\s*,\s*/);for(var i in n)if(r.can(n[i],e))return n[i];return null},r.getMode=function(e,n,i){var r=null;if("undefined"===t.typeOf(i)&&(i="browser"),n&&!t.isEmptyObj(e)){if(t.each(n,function(n,i){if(e.hasOwnProperty(i)){var o=e[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return t.inArray(i,r)!==-1?i:r[0];if(r===!1)return!1}return i},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),i(y,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n>16&255,o=d>>8&255,a=255&d,64==c?m[p++]=String.fromCharCode(r):64==l?m[p++]=String.fromCharCode(r,o):m[p++]=String.fromCharCode(r,o,a);while(h>18&63,u=d>>12&63,c=d>>6&63,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(h":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:n.toArray,inArray:n.inArray,addI18n:e.addI18n,translate:e.translate,sprintf:n.sprintf,isEmptyObj:n.isEmptyObj,hasClass:i.hasClass,addClass:i.addClass,removeClass:i.removeClass,getStyle:i.getStyle,addEvent:r.addEvent,removeEvent:r.removeEvent,removeAllEvents:r.removeAllEvents,cleanName:function(e){var t,n;for(n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e=parseInt(e,10),isNaN(e))return plupload.translate("N/A");var n=Math.pow(1024,4);return e>n?t(e/n,1)+" "+plupload.translate("tb"):e>(n/=1024)?t(e/n,1)+" "+plupload.translate("gb"):e>(n/=1024)?t(e/n,1)+" "+plupload.translate("mb"):e>1024?Math.round(e/1024)+" "+plupload.translate("kb"):e+" "+plupload.translate("b")},resolveUrl:o.resolveUrl,parseSize:n.parseSizeStr,delay:n.delay,EventTarget:a,Runtime:s,FileInput:u,FileReader:c}}),i(R,[u],function(e){var t=function(){function n(){var e;for(e in i);return i[e]}var i={},r=0,o;e.extend(this,{count:function(){return r},hasKey:function(e){return i.hasOwnProperty(e)},get:function(e){return i[e]},first:function(){for(var e in i)return i[e]},last:function(){return o},toObject:function(){return i},add:function(t,n){var a=this;return"object"!=typeof t||n?i.hasOwnProperty(t)?a.update.apply(a,arguments):(i[t]=o=n,void r++):e.each(t,function(e,t){a.add(t,e)})},remove:function(e){if(this.hasKey(e)){var t=i[e];delete i[e],r--,o===t&&(o=n())}},extract:function(e){var t=this.get(e);return this.remove(e),t},shift:function(){var e=this,t,n;for(n in i)return t=i[n],e.remove(n),t},update:function(e,t){i[e]=t},each:function(t){e.each(i,t)},combineWith:function(){var n=new t;return n.add(i),e.each(arguments,function(e){e instanceof t&&n.add(e.toObject())}),n},clear:function(){i={},o=null,r=0}})};return t}),i(O,[u,y,E],function(e,t,n){function i(i,r){r||(r={}),n.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var a=this.type.split("/")[0];o=e.guid((""!==a?a:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(I,[c,d,f,u,l,O,v,m,y],function(e,t,n,i,r,o,a,s,u){function c(n){var r=this,o;"string"==typeof n&&(n={drop_zone:n}),o={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},o,n):o,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=u.mimes2extList(n.accept)),a.call(r),i.extend(r,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){r.bind("RuntimeInit",function(e,t){r.ruid=t.uid,t.exec.call(r,"FileDrop","init",n),r.dispatchEvent("ready")}),r.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=s.instance,c}),i(A,[u,m],function(e,t){var n=["OptionChanged"];return function(t){function n(){t.apply(this,arguments),this.uid=e.guid(),this._options={}}return e.inherit(n,t),e.extend(n.prototype,{uid:e.guid(),setOption:function(t,n){var i=this,r;return"object"==typeof t?void e.each(t,function(e,t){i.setOption(t,e)}):(r=i._options[t],i._options[t]=n,void i.trigger("OptionChanged",t,n,r))},getOption:function(e){return e?this._options[e]:this._options},setOptions:function(e){"object"==typeof e&&this.setOption(e)},getOptions:function(){return this.getOption()}}),n}(t)}),i(S,[u,A],function(e,t){var n=["queued","started","paused","stopped","progress","failed","done","processed"];return function(t){function n(){t.apply(this,arguments)}return e.inherit(n,t),n.IDLE=0,n.PROCESSING=1,n.PAUSED=2,n.RESUMED=3,n.DONE=4,n.FAILED=5,n.DESTROYED=8,e.extend(n.prototype,{uid:e.guid(),state:n.IDLE,processed:0,total:0,percent:0,retries:0,start:function(){this.state=n.PROCESSING,this.trigger("started")},pause:function(){this.processed=this.percent=0,this.loaded=this.processed,this.state=n.PAUSED,this.trigger("paused")},stop:function(){this.processed=this.percent=0,this.loaded=this.processed,this.state=n.IDLE,this.trigger("stopped")},done:function(e){this.processed=this.total,this.loaded=this.processed,this.percent=100,this.state=n.DONE,this.trigger("done",e),this.trigger("processed")},failed:function(e){this.processed=this.percent=0,this.loaded=this.processed,this.state=n.FAILED,this.trigger("failed",e),this.trigger("processed")},progress:function(e,t){this.processed=e,this.loaded=this.processed,t&&(this.total=t),this.percent=Math.min(Math.ceil(this.processed/this.total*100),100),this.trigger({type:"progress",loaded:this.processed,total:this.total})},destroy:function(){self.state!==n.DESTROYED&&(this.state=n.DESTROYED,this.trigger("destroy"),this.unbindAll())}}),n}(t)}),i(T,[],function(){return function(){var e=this;e.size=0,e.total=0,e.loaded=0,e.uploaded=0,e.done=0,e.failed=0,e.queued=0,e.processing=0,e.paused=0,e.percent=0,e.bytesPerSec=0,e.processedPerSec=0,e.reset=function(){e.size=e.total=e.loaded=e.processed=e.uploaded=e.done=e.failed=e.queued=e.processing=e.paused=e.percent=e.bytesPerSec=e.processedPerSec=0}}}),i(D,[u,R,A,S,T],function(e,t,n,i,r){var o=["Started","StateChanged","Progress","Paused","Done","Stopped"];return function(n){function o(i){n.apply(this,arguments),this._queue=new t,this.state=o.IDLE,this.stats=new r,this._options=e.extend({max_slots:1,max_retries:0,auto_start:!1,finish_active:!1,pause_before_start:!0},i)}function a(){var e;return this._queue.each(function(t){if(t.state===i.IDLE||t.state===i.RESUMED)return e=t,!1}),e}function s(){for(var e=this,t;e.stats.processing0?(T&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),z.bind("Abort",function(e){s.dispatchEvent(e),i()}),z.bind("Error",function(e){N=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(z,"XMLHttpRequest","send",{url:w,method:E,async:_,user:x,password:R,headers:b,mimeType:I,encoding:O,responseType:s.responseType,withCredentials:s.withCredentials,options:U},t)}var s=this;L=(new Date).getTime(),z=new a,"string"==typeof U.required_caps&&(U.required_caps=o.parseCaps(U.required_caps)),U.required_caps=e.extend({},U.required_caps,{return_response_type:s.responseType}),t instanceof c&&(U.required_caps.send_multipart=!0),e.isEmptyObj(b)||(U.required_caps.send_custom_headers=!0),C||(U.required_caps.do_cors=!0),U.ruid?r(z.connectRuntime(U)):(z.bind("RuntimeInit",function(e,t){r(t)}),z.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),z.connectRuntime(U))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),L=M=null}var y=this,v={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},_=!0,w,E,b={},x,R,O=null,I=null,A=!1,S=!1,T=!1,D=!1,N=!1,C=!1,L,M,F=null,P=null,U={},z,k="",H;e.extend(this,v,{uid:e.guid("uid_"),upload:new h,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(E=o.toUpperCase()),~e.inArray(E,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),C=r.hasSameOrigin(l),w=r.resolveUrl(a),(u||c)&&!C)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(x=u||l.user,R=c||l.pass,_=s||!0,_===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);A=!_,S=!1,b={},g.call(this),n("readyState",p.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||S)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),!~e.inArray(r,a)&&!/^(proxy\-|sec\-)/.test(r)&&(b[r]?b[r]+=", "+o:b[r]=o,!0)},getAllResponseHeaders:function(){return k||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:k&&""!==k&&(H||(H={},e.each(k.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),H[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),H.hasOwnProperty(t))?H[t].header+": "+H[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,P=o},send:function(n,r){if(U="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==p.OPENED||S)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)U.ruid=n.ruid,I=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();U.ruid=o.ruid,I=o.type||"application/octet-stream"}}else"string"==typeof n&&(O="UTF-8",I="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=U.required_caps&&U.required_caps.send_browser_cookies&&!C),T=!A&&this.upload.hasEventListener(),N=!1,D=!n,A||(S=!0),u.call(this,n)},abort:function(){if(N=!0,A=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),S=!1,!z)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);z.getRuntime().exec.call(z,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){z&&("function"===e.typeOf(z.destroy)&&z.destroy(),z=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(m.concat(["readystatechange"])),this.upload.handleEventProps(m)}var f={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};h.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,y=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(U,[x,R,S,P,F],function(e,t,n,i,r){function o(t,a){function s(t,n){var i="";return e.each(n,function(e,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),i&&(t+=(t.indexOf("?")>0?"&":"?")+i),t}var u,c=t;n.call(this),this.setOptions(a),e.extend(this,{uid:e.guid(),start:function(t){var n=this,a,l,d;t&&this.setOptions(t),d=this.getOptions(),o.prototype.start.call(this),u=new i,u.upload&&(u.upload.onprogress=function(e){n.progress(e.loaded,e.total)}),u.onload=function(){var e={response:u.responseText,status:u.status,responseHeaders:u.getAllResponseHeaders()};return u.status>=400?n.failed(e):void n.done(e)},u.onerror=function(){n.failed()},u.onloadend=function(){u=null},a=d.multipart?d.url:s(d.url,d.params),u.open(d.http_method,a,!0),e.isEmptyObj(d.headers)||e.each(d.headers,function(e,t){u.setRequestHeader(t,e)}),d.multipart?(l=new r,e.isEmptyObj(d.params)||e.each(d.params,function(e,t){l.append(t,e)}),l.append(d.file_data_name,c),u.send(l)):(!e.isEmptyObj(d.headers)&&d.headers["content-type"]||u.setRequestHeader("content-type","application/octet-stream"),u.send(c))},stop:function(){o.prototype.stop.call(this),u&&(u.abort(),u=null)}})}return o.prototype=new n,o}),i(z,[x,R,S,U],function(e,t,n,i){function r(o,a){function s(){var e=0;return l.each(function(t){t.state===n.DONE&&(e+=t.end-t.start)}),e}function u(){for(var e=0;e=c.size)&&(g=e.extend({},this.getOptions(),{params:{chunk:t,chunks:d}}),f=new i(c.slice(m.start,m.end,c.type),g),f.bind("progress",function(e){h.progress(s()+e.loaded,c.size)}),f.bind("failed",function(t,i){l.add(m.seq,e.extend({state:n.FAILED},m)),h.trigger("chunkuploadfailed",e.extend({},m,i)),g.stop_on_fail&&h.failed(i)}),f.bind("done",function(t,i){l.add(m.seq,e.extend({state:n.DONE},m)),h.trigger("chunkuploaded",e.extend({},m,i)),s()>=c.size?h.done(i):o&&e.delay(function(){h.uploadChunk(u(),!1,o)})}),f.bind("processed",function(){this.destroy()}),l.add(m.seq,e.extend({state:n.PROCESSING},m)),a.addItem(f),o&&a.countSpareSlots()&&h.uploadChunk(u(),!1,o),!0)},setOption:function(e,t){("object"==typeof e||this._options.hasOwnProperty(e))&&r.prototype.setOption.apply(this,arguments)},destroy:function(){r.prototype.destroy.call(this),a=c=null}})}return r.prototype=new n,r}),i(k,[u,w,v,m],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,di&&(h=i),n=t.btoa(c.substr(d,h)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,h;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),h=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(H,[u,d,f,M,P,g,v,k,l,m,E,O,w],function(e,t,n,i,r,o,a,s,u,c,l,d,h){function p(){function i(e){e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(e.inArray(i,["blob","file"])!==-1)c.call(this,new d(null,t),arguments[1]);else if("string"===i)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):y.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(e){this.trigger("error",e.code)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)||n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function y(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var i=this,r,o,a={x:0,y:0,width:i.width,height:i.height};t=e.extendIf({width:i.width,height:i.height,type:i.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!i.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(i.width>p.MAX_RESIZE_WIDTH||i.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(r=i.meta&&i.meta.tiff&&i.meta.tiff.Orientation||1,e.inArray(r,[5,6,7,8])!==-1){var s=t.width;t.width=t.height,t.height=s}if(t.crop){switch(o=Math.max(t.width/i.width,t.height/i.height),t.fit?(a.width=Math.min(Math.ceil(t.width/o),i.width),a.height=Math.min(Math.ceil(t.height/o),i.height),o=t.width/a.width):(a.width=Math.min(t.width,i.width),a.height=Math.min(t.height,i.height),o=1),"boolean"==typeof t.crop&&(t.crop="cc"),t.crop.toLowerCase()){case"rb":case"right-bottom":a.x=i.width-a.width,a.y=i.height-a.height;break;case"cb":case"center-bottom":a.x=Math.floor((i.width-a.width)/2),a.y=i.height-a.height;break;case"lb":case"left-bottom":a.x=0,a.y=i.height-a.height;break;case"lt":case"left-top":a.x=0,a.y=0;break;case"ct":case"center-top":a.x=Math.floor((i.width-a.width)/2),a.y=0;break;case"rt":case"right-top":a.x=i.width-a.width,a.y=0;break;case"rc":case"right-center":case"right-middle":a.x=i.width-a.width,a.y=Math.floor((i.height-a.height)/2);break;case"lc":case"left-center":case"left-middle":a.x=0,a.y=Math.floor((i.height-a.height)/2);break;case"cc":case"center-center":case"center-middle":default:a.x=Math.floor((i.width-a.width)/2),a.y=Math.floor((i.height-a.height)/2)}a.x=Math.max(a.x,0),a.y=Math.max(a.y,0)}else o=Math.min(t.width/i.width,t.height/i.height);this.exec("Image","resize",a,o,t)}catch(e){i.trigger("error",e.code)}},downsize:function(t){var n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};t="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(t)},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR); -return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return h.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return i.appendChild(l),l=null,o.destroy(),void a.trigger("embedded")}var d=o.getAsDataURL(t,r);if(!d)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))i.innerHTML='',o.destroy(),a.trigger("embedded");else{var p=new s;p.bind("TransportingComplete",function(){c=a.connectRuntime(this.result.ruid),a.bind("Embedded",function(){e.extend(c.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),c=null},999),c.exec.call(a,"ImageView","display",this.result.uid,width,height),o.destroy()}),p.transport(h.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i})}}var a=this,c;r=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r||{});try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT;var l=new p;return l.bind("Resize",function(){o.call(this,r.type,r.quality)}),l.bind("Load",function(){l.downsize(r)}),this.meta.thumb&&this.meta.thumb.width>=r.width&&this.meta.thumb.height>=r.height?l.load(this.meta.thumb.data):l.clone(this,!1),l}catch(e){this.trigger("error",e.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(f),this.bind("Load Resize",function(){i.call(this)},999)}var f=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=8192,p.MAX_RESIZE_HEIGHT=8192,p.prototype=c.instance,p}),i(q,[x,S,H],function(e,t,n){function i(e){t.call(this),this._options={width:0,height:0,type:"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},this.setOption=function(e,t){("object"==typeof e||this._options.hasOwnProperty(e))&&i.prototype.setOption.apply(this,arguments)},this.start=function(t){var i=this,r;t&&this.setOptions(t.resize),r=new n,r.bind("load",function(){this.resize(i.getOptions())}),r.bind("resize",function(){i.done(this.getAsBlob(i.getOption("type"),i.getOption("quality"))),this.destroy()}),r.bind("error",function(){i.failed(),this.destroy()}),r.load(e)}}return i.prototype=new t,i}),i(B,[x,S,z,q],function(e,t,n,i){function r(s,u,c){var l=s,d=e.guid();t.call(this),e.extend(this,{id:d,uid:d,name:l.name,target_name:null,type:l.type,size:l.size,origSize:l.size,start:function(t){var n=this;t&&this.setOptions(t),!e.isEmptyObj(t.resize)&&o(this.type)&&a(l,"send_binary_string")?this.resizeAndUpload():this.upload(),r.prototype.start.call(n)},getSource:function(){return l},getNative:function(){return this.getFile().getSource()},resizeAndUpload:function(){var e=this,t=new i(l);t.bind("progress",function(t){e.progress(t.loaded,t.total)}),t.bind("done",function(t,n){l=n,e.upload()}),t.bind("failed",function(t,n){e.upload()}),c.addItem(t)},upload:function(){var e=this,t=new n(l,u);t.bind("progress",function(t){e.progress(t.loaded,t.total)}),t.bind("done",function(t,n){e.done(n)}),t.bind("failed",function(t,n){e.failed(n)}),t.start(e.getOptions())},destroy:function(){r.prototype.destroy.call(this),l=null}})}function o(t){return e.inArray(t,["image/jpeg","image/png"])>-1}function a(t,n){if(t.ruid){var i=e.Runtime.getInfo(t.ruid);if(i)return i.can(n)}return!1}return r.prototype=new t,r}),i(G,[x,R,y,E,O,_,I,g,D,N,C,B],function(e,t,n,i,r,o,a,s,u,c,l,d){function h(t){function n(){var e=x[0]||R[0];return!!e&&e.getRuntime().uid}function m(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()},this,999),this.bind("BeforeUpload",_),this.bind("Done",function(e){e.trigger("UploadComplete")}),this.bind("Error",w),this.bind("Destroy",E)}function g(t){var n=this,i=0,r=[],u={runtime_order:n.getOption("runtimes"),required_caps:n.getOption("required_features"),preferred_caps:n.getOption("preferred_caps"),swf_url:n.getOption("flash_swf_url"),xap_url:n.getOption("silverlight_xap_url")};e.each(n.getOption("runtimes").split(/\s*,\s*/),function(e){n.getOption(e)&&(u[e]=n.getOption(e))}),n.getOption("browse_button")&&e.each(n.getOption("browse_button"),function(t){r.push(function(r){var a=new o(e.extend({},u,{accept:n.getOption("filters").mime_types,name:n.getOption("file_data_name"),multiple:n.getOption("multi_selection"),container:n.getOption("container"),browse_button:t}));a.onready=function(){var t=s.getInfo(this.ruid);e.extend(n.features,{chunks:t.can("slice_blob"),multipart:t.can("send_multipart"),multi_selection:t.can("select_multiple")}),i++,x.push(this),r()},a.onchange=function(){n.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(i){S||(n.getOption("browse_button_hover")&&("mouseenter"===i.type?e.addClass(t,n.getOption("browse_button_hover")):"mouseleave"===i.type&&e.removeClass(t,n.getOption("browse_button_hover"))),n.getOption("browse_button_active")&&("mousedown"===i.type?e.addClass(t,n.getOption("browse_button_active")):"mouseup"===i.type&&e.removeClass(t,n.getOption("browse_button_active"))))}),a.bind("mousedown",function(){n.trigger("Browse")}),a.bind("error runtimeerror",function(){a=null,r()}),a.init()})}),n.getOption("drop_element")&&e.each(n.getOption("drop_element"),function(t){r.push(function(r){var o=new a(e.extend({},u,{drop_zone:t}));o.onready=function(){var t=s.getInfo(this.ruid);e.extend(n.features,{chunks:t.can("slice_blob"),multipart:t.can("send_multipart"),dragdrop:t.can("drag_and_drop")}),i++,R.push(this),r()},o.ondrop=function(){n.addFile(this.files)},o.bind("error runtimeerror",function(){o=null,r()}),o.init()})}),e.inParallel(r,function(){"function"==typeof t&&t(i)})}function _(e,t){if(e.getOption("unique_names")){var n=t.name.match(/\.([^.]+)$/),i="part";n&&(i=n[1]),t.target_name=t.id+"."+i}}function w(t,n){n.code===e.INIT_ERROR?t.destroy():n.code===e.HTTP_ERROR&&t.state==e.STARTED&&t.trigger("CancelUpload")}function E(t){t.forEachItem(function(e){e.destroy()}),x.length&&(e.each(x,function(e){e.destroy()}),x=[]),R.length&&(e.each(R,function(e){e.destroy()}),R=[]),A=!1,O&&O.destroy(),I&&I.destroy(),T=O=I=null}var b=e.guid(),x=[],R=[],O,I,A=!1,S=!1,T=e.extend({runtimes:s.order,multi_selection:!0,flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:"*",prevent_duplicates:!1,max_file_size:0},max_upload_slots:1,max_resize_slots:1,multipart:!0,multipart_params:{},params:{},http_method:"POST",file_data_name:"file",chunk_size:0,send_file_name:!0,send_chunk_number:!0,max_retries:0,resize:!1,backward_compatibility:!0},t);T.required_features=p(e.extend({},T)),T.preferred_caps=p(e.extend({},T,{required_features:!0})),u.call(this),e.extend(this,{id:b,uid:b,state:e.STOPPED,features:{},settings:{},runtime:null,files:[],total:this.stats,init:function(){var t=this,i,r;return i=t.getOption("preinit"),"function"==typeof i?i(t):e.each(i,function(e,n){t.bind(n,e)}),m.call(t),e.each(["container","browse_button","drop_element"],function(n){if(null===t.getOption(n))return r={code:e.INIT_ERROR,message:e.sprintf(e.translate("%s specified, but cannot be found."),n)},!1}),r?t.trigger("Error",r):t.getOption("browse_button")||t.getOption("drop_element")?void g.call(t,function(i){var r,o=t.getOption("init"),a=e.extend({},t.getOption(),{auto_start:!0});"function"==typeof o?o(t):e.each(o,function(e,n){t.bind(n,e)}),i?(A=!0,r=s.getInfo(n()),O=new c(a),I=new l(a),t.trigger("Init",{ruid:r.uid,runtime:t.runtime=r.type}),t.trigger("PostInit")):t.trigger("Error",{code:e.INIT_ERROR,message:e.translate("Init error.")})}):t.trigger("Error",{code:e.INIT_ERROR,message:e.translate("You must specify either browse_button or drop_element.")})},setOption:function(t,n){return A&&e.inArray(t,["container","browse_button","drop_element","runtimes","multi_selection","flash_swf_url","silverlight_xap_url"])>-1?this.trigger("Error",{code:e.OPTION_ERROR,message:e.sprintf(e.translate("%s option cannot be changed.")),option:t}):("object"!=typeof t&&(n=f(t,n,T),O&&O.setOption(t,n),I&&I.setOption(t,n)),void h.prototype.setOption.call(this,t,n))},refresh:function(){x.length&&e.each(x,function(e){e.trigger("Refresh")}),R.length&&e.each(R,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},stop:function(){h.prototype.stop.call(this),this.state!=e.STOPPED&&this.trigger("CancelUpload")},disableBrowse:function(){S=arguments[0]===v||arguments[0],x.length&&e.each(x,function(e){e.disable(S)}),this.trigger("DisableBrowse",S)},getFile:function(e){return this.getItem(e)},addFile:function(t,o){function a(t){t.bind("beforestart",function(e){return c.trigger("BeforeUpload",e.target)}),t.bind("started",function(){c.trigger("UploadFile",this)}),t.bind("progress",function(){c.trigger("UploadProgress",this)}),t.bind("done",function(e,t){c.trigger("FileUploaded",this,t)}),t.bind("failed",function(t,n){c.trigger("Error",e.extend({code:e.HTTP_ERROR,message:e.translate("HTTP Error."),file:this},n))})}function s(t,n){var i=[];e.each(c.getOption("filters"),function(e,n){y[n]&&i.push(function(i){y[n].call(c,e,t,function(e){i(!e)})})}),e.inParallel(i,n)}function u(t){var n=e.typeOf(t);if(t instanceof r){if(!t.ruid&&!t.isDetached()){if(!h)return!1;t.ruid=h,t.connectRuntime(h)}l.push(function(n){s(t,function(i){var r;i||(r=new d(t,O,I),o&&(r.name=o),a(r),c.addItem(r),p.push(r),c.trigger("FileFiltered",r)),e.delay(n)})})}else t instanceof i?(u(t.getSource()),t.destroy()):e.inArray(n,["file","blob"])!==-1?u(new r(null,t)):"node"===n&&"filelist"===e.typeOf(t.files)?e.each(t.files,u):"array"===n&&(o=null,e.each(t,u))}var c=this,l=[],h,p=[];h=n(),u(t),l.length&&e.inParallel(l,function(){p.length&&c.trigger("FilesAdded",p)})},removeFile:function(e){var t=this.extractItem("string"==typeof e?e:e.uid);t&&(this.trigger("FilesRemoved",[t]),t.destroy())},splice:function(t,n){var i=this,r=0,o=[],a=e.STARTED==this.state;t===v?0:Math.max(t,0);var s=n===v?this.count():Math.min(t+n,this.count());if(this.forEachItem(function(e){return rs)&&(i.extractItem(e.uid),o.push(e),void r++)}),o.length){for(this.trigger("FilesRemoved",o),a&&this.stop(),r=0;r0&&(r.slice_blob=!0),e.isEmptyObj(t.resize)&&t.multipart!==!1||(r.send_binary_string=!0),t.http_method&&(r.use_http_method=t.http_method),e.each(t,function(e,t){n(t,!!e,!0)})),r}function f(t,i,r){switch(t){case"chunk_size":(i=e.parseSize(i))&&(r.send_file_name=!0);break;case"headers":var o={};return"object"==typeof i&&e.each(i,function(e,t){o[t.toLowerCase()]=e}),o;case"http_method":return"PUT"===i.toUpperCase()?"PUT":"POST";case"filters":return"array"===e.typeOf(i)&&(i={mime_types:i}),i.mime_types&&("string"===e.typeOf(i.mime_types)&&(i.mime_types=n.mimes2extList(i.mime_types)),i.mime_types.regexp=function(t){var n=[];return e.each(t,function(t){e.each(t.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?n.push("\\.*"):n.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+n.join("|")+")$","i")}(i.mime_types)),i;case"max_file_size":r&&!r.filters&&(r.filters={}),r.filters.max_file_size=i;break;case"multipart":i||(r.send_file_name=!0);break;case"multipart_params":r.params=r.multipart_params=i;break;case"resize":return!!i&&e.extend({preserve_headers:!0,crop:!1},i);case"prevent_duplicates":r&&!r.filters&&(r.filters={}),r.filters.prevent_duplicates=!!i;break;case"unique_names":i&&(r.send_file_name=!0);break;case"container":case"browse_button":case"drop_element":return"container"===t?e.get(i):e.getAll(i)}return i}function m(e,t){y[e]=t}function g(e,t){var n,i;return n=new h(e),i=s.thatCan(n.getOption("required_features"),t||e.runtimes),n.destroy(),i}var y={},v;return m("mime_types",function(t,n,i){t.length&&!t.regexp.test(n.name)?(this.trigger("Error",{code:e.FILE_EXTENSION_ERROR,message:e.translate("File extension error."),file:n}),i(!1)):i(!0)}),m("max_file_size",function(t,n,i){var r;t=e.parseSize(t),n.size!==r&&t&&n.size>t?(this.trigger("Error",{code:e.FILE_SIZE_ERROR,message:e.translate("File size error."),file:n}),i(!1)):i(!0)}),m("prevent_duplicates",function(t,n,i){if(t)for(var r=this.files.length;r--;)if(n.name===this.files[r].name&&n.size===this.files[r].size)return this.trigger("Error",{code:e.FILE_DUPLICATE_ERROR,message:e.translate("Duplicate file error."),file:n}),void i(!1);i(!0)}),h.addFileFilter=m,h.prototype=new u,e.addFileFilter=m,e.predictRuntime=g,h}),i(j,[u,f,g,l],function(e,t,n,i){function o(t){var o=this,u=n.capTest,c=n.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!s.Image},display_media:u((i.can("create_canvas")||i.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.verComp(i.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===i.browser&&i.verComp(i.version,28,"<")||"IE"===i.browser&&i.verComp(i.version,10,"<")||"Safari"===i.browser&&i.verComp(i.version,7,"<")||"Firefox"===i.browser&&i.verComp(i.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return!("json"!==e||!window.JSON)||i.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===i.browser&&i.verComp(i.version,21,">=")||"Firefox"===i.browser&&i.verComp(i.version,42,">="))},select_multiple:function(){return o.can("select_file")&&!("Safari"===i.browser&&"Windows"===i.os)&&!("iOS"===i.os&&i.verComp(i.osVersion,"7.0.0",">")&&i.verComp(i.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===i.browser&&i.verComp(i.version,4,">=")||"Opera"===i.browser&&i.verComp(i.version,12,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||!!~e.inArray(i.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);n.call(this,t,arguments[1]||a,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html5",s={};return n.addConstructor(a,o),s}),i(X,[j,E],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(i){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(V,[j,O,u,d,h,y,l],function(e,t,n,i,r,o,a){function s(){var e,s;n.extend(this,{init:function(u){var c=this,l=c.getRuntime(),d,h,p,f,m,g;e=u,p=e.accept.mimes||o.extList2mimes(e.accept,l.can("filter_by_extension")),h=l.getShimContainer(),h.innerHTML='",d=i.get(l.uid),n.extend(d.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),f=i.get(e.browse_button),s=i.getStyle(f,"z-index")||"auto",l.can("summon_file_dialog")&&("static"===i.getStyle(f,"position")&&(f.style.position="relative"),r.addEvent(f,"click",function(e){var t=i.get(l.uid);t&&!t.disabled&&t.click(),e.preventDefault()},c.uid),c.bind("Refresh",function(){m=parseInt(s,10)||1,i.get(e.browse_button).style.zIndex=m,this.getRuntime().getShimContainer().style.zIndex=m-1})),g=l.can("summon_file_dialog")?f:h,r.addEvent(g,"mouseover",function(){c.trigger("mouseenter")},c.uid),r.addEvent(g,"mouseout",function(){c.trigger("mouseleave")},c.uid),r.addEvent(g,"mousedown",function(){c.trigger("mousedown")},c.uid),r.addEvent(i.get(e.container),"mouseup",function(){c.trigger("mouseup")},c.uid),d.onchange=function i(r){if(c.files=[],n.each(this.files,function(n){var i="";return!(!e.directory||"."!=n.name)||(n.webkitRelativePath&&(i="/"+n.webkitRelativePath.replace(/^\//,"")),n=new t(l.uid,n),n.relativePath=i,void c.files.push(n))}),"IE"!==a.browser&&"IEMobile"!==a.browser)this.value="";else{var o=this.cloneNode(!0);this.parentNode.replaceChild(o,this),o.onchange=i}c.files.length&&c.trigger("change")},c.trigger({type:"ready",async:!0}),h=null},setOption:function(e,t){var n=this.getRuntime(),r=i.get(n.uid);switch(e){case"accept":if(t){var a=t.mimes||o.extList2mimes(t,n.can("filter_by_extension"));r.setAttribute("accept",a.join(","))}else r.removeAttribute("accept");break;case"directory":t&&n.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&n.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t=this.getRuntime(),n;(n=i.get(t.uid))&&(n.disabled=!!e)},destroy:function(){var t=this.getRuntime(),n=t.getShim(),o=t.getShimContainer(),a=e&&i.get(e.container),u=e&&i.get(e.browse_button);a&&r.removeAllEvents(a,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=s),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),n.removeInstance(this.uid),e=o=a=u=n=null}})}return e.FileInput=s}),i(W,[j,O,u,d,h,y],function(e,t,n,i,r,o){function a(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=n.toArray(e.dataTransfer.types||[]);return n.inArray("Files",t)!==-1||n.inArray("public.file-url",t)!==-1||n.inArray("application/x-moz-file",t)!==-1}function a(e,n){if(u(e)){var i=new t(g,e);i.relativePath=n||"",p.push(i)}}function s(e){for(var t=[],i=0;i=")&&u.verComp(u.version,7,"<"),h="Android Browser"===u.browser,m=!1;if(f=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=c(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||h)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return void e.call(s,n,r);if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function e(){switch(p.readyState){case 1:break;case 2:break;case 3:var t,r;try{i.hasSameOrigin(n.url)&&(t=p.getResponseHeader("Content-Length")||0),p.responseText&&(r=p.responseText.length)}catch(e){t=r=0}s.trigger({type:"progress",lengthComputable:!!t,total:parseInt(t,10),loaded:r});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&("json"!==n.responseType||u.can("return_response_type","json")?p.responseType=n.responseType:p.responseType="text"),m?p.sendAsBinary?p.sendAsBinary(r):!function(){for(var e=new Uint8Array(r.length),t=0;t0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+i)),e+r.byteLength),this.clear(),t=o.buffer,n=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){n=t=null}})}function i(t){function n(e,n,i){i=3===arguments.length?i:t.length-n-1,t=t.substr(0,n)+e+t.substr(i+n)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){n(String.fromCharCode(t),e,1)},SEGMENT:function(e,i,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,i);case 3:n(null!==r?r:"",e,i);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var n,i,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(i=this.littleEndian?0:-8*(t-1),r=0,n=0;rthis.length())throw new Error("You are trying to write outside the source boundaries.");for(i=this.littleEndian?0:-8*(n-1),r=0;r>Math.abs(i+8*r)&255)},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,n){for(var i=[],r=0;r=65488&&s<=65495)a+=2;else{if(65498===s||65497===s)break;u=o.SHORT(a+2)+2,s>=65505&&s<=65519&&r.push({hex:s,name:"APP"+(15&s),start:a,length:u,segment:o.SEGMENT(a,u)}),a+=u}return o.clear(),{headers:r,restore:function(t){var n,i,o;for(o=new e(t),a=65504==o.SHORT(2)?4+o.SHORT(4):2,i=0,n=r.length;i=n.length));i++);},purge:function(){this.headers=r=[]}}}}),i(Z,[u,J,f],function(e,n,i){function r(o){function a(n,r){var o=this,a,s,u,c,h,p,f,m,g=[],y={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},_={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(a=o.SHORT(n),s=0;s4&&(f=o.LONG(f)+d.tiffHeader),f+p*h>=this.length())throw new i.ImageError(i.ImageError.INVALID_META_ERR);"ASCII"!==c?(g=o.asArray(c,f,h),m=1==h?g[0]:g,l.hasOwnProperty(u)&&"object"!=typeof m?y[u]=l[u][m]:y[u]=m):y[u]=e.trim(o.STRING(f,h).replace(/\0$/,""))}return y}function s(e,t,n){var i,r,o,a=0;if("string"==typeof t){var s=c[e.toLowerCase()];for(var u in s)if(s[u]===t){t=u;break}}i=d[e.toLowerCase()+"IFD"],r=this.SHORT(i);for(var l=0;l=65472&&n<=65475)return t+=5,{height:e.SHORT(t),width:e.SHORT(t+=2)};i=e.SHORT(t+=2),t+=i-2}return null}function s(){var e=d.thumb(),t,n;return e&&(t=new i(e),n=a(t),t.clear(),n)?(n.data=e,n):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),h=l=d=c=null)}var c,l,d,h;if(c=new i(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o);try{d=new r(l.get("app1")[0])}catch(e){}h=a.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:h&&h.width||0,height:h&&h.height||0,setExif:function(t,n){return!!d&&("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),void l.set("app1",d.SEGMENT()))},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:s()})}return o}),i(ee,[f,u,J],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:s.LONG(t),height:s.LONG(t+=4)}):null}function o(){s&&(s.clear(),i=l=u=c=s=null)}function a(e){var t,n,i,r;return t=s.LONG(e),n=s.STRING(e+=4,4),i=e+=4,r=s.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l;s=new n(i),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n2)&&(i=i<.5?.5:2,a=!0);var s=t(n,i);return a?e(s,o/s.width):s}function t(e,t){var n=e.width,i=e.height,r=Math.floor(n*t),o=Math.floor(i*t),a=document.createElement("canvas");return a.width=r,a.height=o,a.getContext("2d").drawImage(e,0,0,n,i,0,0,r,o),e=null,a}return{scale:e}}),i(ie,[],function(){function e(e,n){var i=Math.floor(e.width*n),r=Math.floor(e.height*n),o=document.createElement("canvas");return o.width=i,o.height=r,t(o,e,n,n),e=null,o}function t(e,t,o,a){var s=n(e);if(!s)throw"Your environment doesn't support WebGL.";o=e.width/(t.width+2),a=e.height/(t.height+2);var u=r(s);s.useProgram(u),i(s,u,"a_dest_xy",[0,0,e.width,0,0,e.height,0,e.height,e.width,0,e.width,e.height]);var c=s.createTexture();s.bindTexture(s.TEXTURE_2D,c),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t);var l=s.getUniformLocation(u,"u_wh");s.uniform2f(l,t.width,t.height);var d=s.getUniformLocation(u,"u_ratio");s.uniform2f(d,o,a),s.drawArrays(s.TRIANGLES,0,6)}function n(e){var t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(e){}return t||(t=null),t}function i(e,t,n,i){var r=e.getAttribLocation(t,n),o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0)}function r(e){var t=e.createProgram();for(var n in a.bilinear)e.attachShader(t,o(e,a.bilinear[n],n));if(e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){var i=e.getProgramInfoLog(t);throw e.deleteProgram(t),"Cannot create a program: "+i}return t}function o(e,t,n){var i=e.createShader(e[n]);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var r=e.getShaderInfoLog(i);throw e.deleteShader(i),"Cannot compile a "+n+" shader: "+r}return i}var a={bilinear:{VERTEX_SHADER:" attribute vec2 a_dest_xy; uniform vec2 u_wh; uniform vec2 u_ratio; varying vec2 a_xy; varying vec2 b_xy; varying vec2 c_xy; varying vec2 d_xy; varying float xx0; varying float x1x; varying float yy0; varying float y1y; void main() { vec2 xy = a_dest_xy / u_ratio - 1.0; float x = xy.x; float y = xy.y; float offset = 0.5; float x0 = x - offset; float x1 = x + offset; float y0 = y - offset; float y1 = y + offset; a_xy = vec2(x0, y0) / u_wh; b_xy = vec2(x1, y0) / u_wh; c_xy = vec2(x1, y1) / u_wh; d_xy = vec2(x0, y1) / u_wh; xx0 = (x - x0) / (x1 - x0); x1x = (x1 - x) / (x1 - x0); yy0 = (y - y0) / (y1 - y0); y1y = (y1 - y) / (y1 - y0); gl_Position = vec4(((xy / u_wh) * 2.0 - 1.0) * vec2(1, -1), 0, 1); } ",FRAGMENT_SHADER:" precision mediump float; uniform sampler2D u_image; varying vec2 a_xy; varying vec2 b_xy; varying vec2 c_xy; varying vec2 d_xy; varying float xx0; varying float x1x; varying float yy0; varying float y1y; void main() { vec4 a = texture2D(u_image, a_xy); vec4 b = texture2D(u_image, b_xy); vec4 c = texture2D(u_image, c_xy); vec4 d = texture2D(u_image, d_xy); vec4 ab = b * xx0 + a * x1x; vec4 dc = c * xx0 + d * x1x; vec4 abdc = dc * yy0 + ab * y1y; gl_FragColor = abdc; } "}};return{scale:e}}),i(re,[j,u,f,w,E,O,te,ne,ie,y,l],function(e,t,n,i,r,o,a,s,u,c,l){function d(){function e(){if(!_&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return _||y}function u(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(_=document.createElement("canvas"),_.width=t.width,_.height=t.height,_.getContext("2d").drawImage(t,0,0),_)}function l(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function h(e){var t=this;y=new Image,y.onerror=function(){m.call(this),t.trigger("error",n.ImageError.WRONG_FORMAT)},y.onload=function(){t.trigger("load")},y.src="data:"==e.substr(0,5)?e:d(e,E.type)}function p(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",n.ImageError.WRONG_FORMAT)},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function f(e,n,i){t.inArray(i,[5,6,7,8])>-1&&(_.width=n,_.height=e);var r=_.getContext("2d");switch(i){case 2:r.translate(e,0),r.scale(-1,1);break;case 3:r.translate(e,n),r.rotate(Math.PI);break;case 4:r.translate(0,n),r.scale(1,-1);break;case 5:r.rotate(.5*Math.PI),r.scale(1,-1);break;case 6:r.rotate(.5*Math.PI),r.translate(0,-n);break;case 7:r.rotate(.5*Math.PI),r.translate(e,-n),r.scale(-1,1);break;case 8:r.rotate(-.5*Math.PI),r.translate(-e,0)}}function m(){v&&(v.purge(),v=null),y&&(y.src=""),w=y=_=E=null,b=!1}var g=this,y,v,_,w,E,b=!1,x=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=!(arguments.length>1)||arguments[1];if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return E=e,e.isDetached()?(w=e.getSource(),void h.call(this,w)):void p.call(this,e.getSource(),function(e){r&&(w=l(e)),h.call(t,e)})},loadFromImage:function(e,t){this.meta=e.meta,E=new o(null,{name:e.name,size:e.size,type:e.type}),h.call(this,t?w=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!v&&w&&t.can("access_image_binary")&&(v=new a(w)),n={width:e().width||0,height:e().height||0,type:E.type||c.getFileMime(E.name),size:w&&w.length||E.size||0,name:E.name||"",meta:null},x&&(n.meta=v&&v.meta||this.meta||{},!n.meta||!n.meta.thumb||n.meta.thumb.data instanceof r||(n.meta.thumb.data=new r(null,{type:"image/jpeg",data:n.meta.thumb.data}))),n},resize:function(t,n,i){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),_=s.scale(r,n),x=i.preserveHeaders,!x){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;f(_.width,_.height,o)}this.width=_.width,this.height=_.height,b=!0,this.trigger("Resize")},getAsCanvas:function(){return _||(_=u()),_.id=this.uid+"_canvas",_},getAsBlob:function(e,t){return e!==this.type?(b=!0,new o(null,{name:E.name||"",type:e,data:g.getAsDataURL(e,t)})):new o(null,{name:E.name||"",type:e,data:g.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!b)return y.src;if(u(),"image/jpeg"!==e)return _.toDataURL("image/png");try{return _.toDataURL("image/jpeg",t/100)}catch(e){return _.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!b)return w||(w=l(g.getAsDataURL(e,t))),w;if("image/jpeg"!==e)w=l(g.getAsDataURL(e,t));else{var n;t||(t=90),u();try{n=_.toDataURL("image/jpeg",t/100)}catch(e){n=_.toDataURL("image/jpeg")}w=l(n),v&&(w=v.stripHeaders(w),x&&(v.meta&&v.meta.exif&&v.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),w=v.writeHeaders(w)),v.purge(),v=null)}return b=!1,w},destroy:function(){g=null,m.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=d}),i(oe,[u,l,d,f,g],function(e,t,n,i,o){function a(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(t){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function s(e){var i=n.get(e);i&&"OBJECT"==i.nodeName&&("IE"===t.browser?(i.style.display="none",function t(){4==i.readyState?u(e):setTimeout(t,10)}()):i.parentNode.removeChild(i))}function u(e){var t=n.get(e);if(t){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode.removeChild(t)}}function c(u){var c=this,h;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return!("json"!==t||!window.JSON)||(!e.arrayDiff(t,["","text","document"])||"browser"===c.mode)},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===c.mode},stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),a()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='',"IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,h=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){s(c.uid),e.call(c),clearTimeout(h),u=h=e=c=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),i(ae,[oe,E],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return n<0?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),i<0?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(se,[oe,O,u],function(e,t,n){var i={init:function(e){var i=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(i,"FileInput","getFiles");i.files=[],n.each(e,function(e){i.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=i}),i(ue,[oe,w],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i=this;return i.result="","readAsDataURL"===e&&(i.result="data:"+(t.type||"")+";base64,"),i.bind("Progress",function(t,r){r&&(i.result+=n(r,e))},999),i.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=i}),i(ce,[oe,w],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(le,[oe,E],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(de,[oe,u,E,O,M,ce,F,k,le],function(e,t,n,i,r,o,a,s,u){var c={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new s;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof a){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var h=i.getBlob();h.isDetached()?u(h,function(e){h.destroy(),o(d,e)}):o(d,h)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=c}),i(he,[oe,u,k,E,M],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof i||(t.meta.thumb.data=new i(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(pe,[u,l,d,f,g],function(e,t,n,i,o){function a(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(n){var c=navigator.plugins["Silverlight Plug-In"];if(c){for(i=c.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u',d=setTimeout(function(){l&&!l.initialized&&l.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(l),clearTimeout(d),s=d=e=l=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,s),c}),i(fe,[pe,u,ae],function(e,t,n){return e.Blob=t.extend({},n)}),i(me,[pe,O,u],function(e,t,n){function i(e){for(var t="",n=0;n=")||"Opera"===i.browser&&i.verComp(i.version,12,">=")||"IE"===i.browser&&i.verComp(i.version,10,">=")||!!~e.inArray(i.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),s)}var a="html4",s={};return n.addConstructor(a,o),s}),i(xe,[be,O,u,d,h,y,l],function(e,t,n,i,r,o,a){function s(){function e(){var o=this,l=o.getRuntime(),d,h,p,f,m,g;g=n.guid("uid_"),d=l.getShimContainer(),s&&(p=i.get(s+"_form"),p&&n.extend(p.style,{top:"100%"})),f=document.createElement("form"),f.setAttribute("id",g+"_form"),f.setAttribute("method","post"),f.setAttribute("enctype","multipart/form-data"),f.setAttribute("encoding","multipart/form-data"),n.extend(f.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("accept",u.join(",")),n.extend(m.style,{fontSize:"999px",opacity:0}),f.appendChild(m),d.appendChild(f),n.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===a.browser&&a.verComp(a.version,10,"<")&&n.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var n;if(this.value){if(this.files){if(n=this.files[0],0===n.size)return void f.parentNode.removeChild(f)}else n={name:this.value};n=new t(l.uid,n),this.onchange=function(){},e.call(o),o.files=[n],m.setAttribute("id",n.uid),f.setAttribute("id",n.uid+"_form"),o.trigger("change"),m=f=null}},l.can("summon_file_dialog")&&(h=i.get(c.browse_button),r.removeEvent(h,"click",o.uid),r.addEvent(h,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},o.uid)),s=g,d=p=h=null}var s,u=[],c,l;n.extend(this,{init:function(t){var n=this,a=n.getRuntime(),s;c=t,u=t.accept.mimes||o.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,o,u;e=i.get(t.browse_button),l=i.getStyle(e,"z-index")||"auto",a.can("summon_file_dialog")&&("static"===i.getStyle(e,"position")&&(e.style.position="relative"),n.bind("Refresh",function(){o=parseInt(l,10)||1,i.get(c.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),u=a.can("summon_file_dialog")?e:s,r.addEvent(u,"mouseover",function(){n.trigger("mouseenter")},n.uid),r.addEvent(u,"mouseout",function(){n.trigger("mouseleave")},n.uid),r.addEvent(u,"mousedown",function(){n.trigger("mousedown")},n.uid),r.addEvent(i.get(t.container),"mouseup",function(){n.trigger("mouseup")},n.uid),e=null}(),e.call(this),s=null,n.trigger({type:"ready",async:!0})},setOption:function(e,t){var n=this.getRuntime(),r;"accept"==e&&(u=t.mimes||o.extList2mimes(t,n.can("filter_by_extension"))),r=i.get(s),r&&r.setAttribute("accept",u.join(","))},disable:function(e){var t;(t=i.get(s))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),n=e.getShimContainer(),o=c&&i.get(c.container),a=c&&i.get(c.browse_button);o&&r.removeAllEvents(o,this.uid),a&&(r.removeAllEvents(a,this.uid),a.style.zIndex=l),n&&(r.removeAllEvents(n,this.uid),n.innerHTML=""),t.removeInstance(this.uid),s=u=c=n=o=a=t=null}})}return e.FileInput=s}),i(Re,[be,Y],function(e,t){return e.FileReader=t}),i(Oe,[be,u,d,p,f,h,E,F],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,h){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),f.trigger({type:"progress", -loaded:c.length,total:c.length}),_&&f.trigger({type:"uploadprogress",loaded:_.size||1025,total:_.size||1025}))}catch(t){if(!i.hasSameOrigin(d.url))return void e.call(f,function(){f.trigger("error")});u=404}e.call(f,function(){f.trigger("load")})},f.uid)}var f=this,m=f.getRuntime(),g,y,v,_;if(u=c=null,h instanceof s&&h.hasBlob()){if(_=h.getBlob(),g=_.uid,v=n.get(g),y=n.get(g+"_form"),!y)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),y=document.createElement("form"),y.setAttribute("id",g+"_form"),y.setAttribute("method",d.method),y.setAttribute("enctype","multipart/form-data"),y.setAttribute("encoding","multipart/form-data"),m.getShimContainer().appendChild(y);y.setAttribute("target",g+"_iframe"),h instanceof s&&h.each(function(e,n){if(e instanceof a)v&&v.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),v?y.insertBefore(i,v):y.appendChild(i)}}),y.setAttribute("action",d.url),p(),y.submit(),f.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*]*>/,"").replace(/<\/pre>\s*$/,""))}catch(e){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(Ie,[be,re],function(e,t){return e.Image=t}),a([u,c,l,d,h,p,f,m,g,y,v,_,w,E,b,x,O,I,L,F,P,z,k,H,q,B,G,ne,ie])}(this); \ No newline at end of file +!function(e,t){var i=function(){var e={};return t.apply(e,arguments),e.plupload};"function"==typeof define&&define.amd?define("plupload",[],i):"object"==typeof module&&module.exports?module.exports=i():e.plupload=i()}(this||window,function(){!function(e,t){"use strict";function i(e,t){for(var i,n=[],r=0;r0&&c(n,function(n,u){var c=-1!==p(e(n),["array","object"]);return n===r||t&&o[u]===r?!0:(c&&i&&(n=s(n)),e(o[u])===e(n)&&c?a(t,i,[o[u],n]):o[u]=n,void 0)})}),o}function u(e,t){function i(){this.constructor=e}for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.super=t.prototype,e}function c(e,t){var i,n,r,o;if(e){try{i=e.length}catch(s){i=o}if(i===o||"number"!=typeof i){for(n in e)if(e.hasOwnProperty(n)&&t(e[n],n)===!1)return}else for(r=0;i>r;r++)if(t(e[r],r)===!1)return}}function l(t){var i;if(!t||"object"!==e(t))return!0;for(i in t)return!1;return!0}function d(t,i){function n(r){"function"===e(t[r])&&t[r](function(e){++ri;i++)if(t[i]===e)return i}return-1}function m(t,i){var n=[];"array"!==e(t)&&(t=[t]),"array"!==e(i)&&(i=[i]);for(var r in t)-1===p(t[r],i)&&n.push(t[r]);return n.length?n:!1}function f(e,t){var i=[];return c(e,function(e){-1!==p(e,t)&&i.push(e)}),i.length?i:null}function g(e){var t,i=[];for(t=0;ti;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}();return{guid:E,typeOf:e,extend:t,extendIf:i,extendImmutable:n,extendImmutableIf:r,clone:o,inherit:u,each:c,isEmptyObj:l,inSeries:d,inParallel:h,inArray:p,arrayDiff:m,arrayIntersect:f,toArray:g,trim:x,sprintf:y,parseSizeStr:v,delay:_}}),n("moxie/core/I18n",["moxie/core/utils/Basic"],function(e){var t={};return{addI18n:function(i){return e.extend(t,i)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),n("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(e){function t(e,t,i){var n=0,r=0,o=0,s={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},a=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?s[e]||-7:parseInt(e,10):0};for(e=a(e),t=a(t),r=Math.max(e.length,t.length),n=0;r>n;n++)if(e[n]!=t[n]){if(e[n]=u(e[n]),t[n]=u(t[n]),e[n]t[n]){o=1;break}}if(!i)return o;switch(i){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var i=function(e){var t="",i="?",n="function",r="undefined",o="object",s="name",a="version",u={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},c={rgx:function(){for(var t,i,s,a,u,c,l,d=0,h=arguments;d0?2==u.length?t[u[0]]=typeof u[1]==n?u[1].call(this,l):u[1]:3==u.length?t[u[0]]=typeof u[1]!==n||u[1].exec&&u[1].test?l?l.replace(u[1],u[2]):e:l?u[1].call(this,l,u[2]):e:4==u.length&&(t[u[0]]=l?u[3].call(this,l.replace(u[1],u[2])):e):t[u]=l?l:e;break}if(c)break}return t},str:function(t,n){for(var r in n)if(typeof n[r]===o&&n[r].length>0){for(var s=0;s=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(i){var n=[].slice.call(arguments);return n.shift(),"function"===e.typeOf(t[i])?t[i].apply(this,n):!!t[i]}}(),r=(new i).getResult(),o={can:n,uaParser:i,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return o.OS=o.os,o}),n("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},i=function(e,t){if(!e.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(e.className)},n=function(e,t){i(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(i,function(e,t,i){return" "===t&&" "===i?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},s=function(t,i){function n(e){var t,i,n=0,r=0;return e&&(i=e.getBoundingClientRect(),t="CSS1Compat"===c.compatMode?c.documentElement:c.body,n=i.left+t.scrollLeft,r=i.top+t.scrollTop),{x:n,y:r}}var r,o,s,a=0,u=0,c=document;if(t=t,i=i||c.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!c.documentMode||c.documentMode<8))return o=n(t),s=n(i),{x:o.x-s.x,y:o.y-s.y};for(r=t;r&&r!=i&&r.nodeType;)a+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)a-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;return{x:a,y:u}},a=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:i,addClass:n,removeClass:r,getStyle:o,getPos:s,getSize:a}}),n("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(e){function t(){this.returnValue=!1}function i(){this.cancelBubble=!0}var n={},r="moxie_"+e.guid(),o=function(o,s,a,u){var c,l;s=s.toLowerCase(),o.addEventListener?(c=a,o.addEventListener(s,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=i,a(e)},o.attachEvent("on"+s,c)),o[r]||(o[r]=e.guid()),n.hasOwnProperty(o[r])||(n[o[r]]={}),l=n[o[r]],l.hasOwnProperty(s)||(l[s]=[]),l[s].push({func:c,orig:a,key:u})},s=function(t,i,o){var s,a;if(i=i.toLowerCase(),t[r]&&n[t[r]]&&n[t[r]][i]){s=n[t[r]][i];for(var u=s.length-1;u>=0&&(s[u].orig!==o&&s[u].key!==o||(t.removeEventListener?t.removeEventListener(i,s[u].func,!1):t.detachEvent&&t.detachEvent("on"+i,s[u].func),s[u].orig=null,s[u].func=null,s.splice(u,1),o===a));u--);if(s.length||delete n[t[r]][i],e.isEmptyObj(n[t[r]])){delete n[t[r]];try{delete t[r]}catch(c){t[r]=a}}}},a=function(t,i){t&&t[r]&&e.each(n[t[r]],function(e,n){s(t,n,i)})};return{addEvent:o,removeEvent:s,removeAllEvents:a}}),n("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(e){var t=function(i,n){var r,o=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],s=o.length,a={http:80,https:443},u={},c=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,l=c.exec(i||""),d=/^\/\/\w/.test(i);switch(e.typeOf(n)){case"undefined":n=t(document.location.href,!1);break;case"string":n=t(n,!1)}for(;s--;)l[s]&&(u[o[s]]=l[s]);if(r=!d&&!u.scheme,(d||r)&&(u.scheme=n.scheme),r){u.host=n.host,u.port=n.port;var h="";/^[^\/]/.test(u.path)&&(h=n.path,h=/\/[^\/]*\.[^\/]*$/.test(h)?h.replace(/\/[^\/]+$/,"/"):h.replace(/\/?$/,"/")),u.path=h+(u.path||"")}return u.port||(u.port=a[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(e){var i={http:80,https:443},n="object"==typeof e?e:t(e);return n.scheme+"://"+n.host+(n.port!==i[n.scheme]?":"+n.port:"")+n.path+(n.query?n.query:"")},n=function(e){function i(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof e&&(e=t(e)),i(t())===i(e)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:n}}),n("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(e){function t(e,t){var i;for(i in e)if(e[i]===t)return i;return null}return{RuntimeError:function(){function i(e,i){this.code=e,this.name=t(n,e),this.message=this.name+(i||": RuntimeError "+this.code)}var n={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(i,n),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": ImageError "+this.code}var n={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return e.extend(i,n),i.prototype=Error.prototype,i}(),FileException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": FileException "+this.code}var n={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(i,n),i.prototype=Error.prototype,i}(),DOMException:function(){function i(e){this.code=e,this.name=t(n,e),this.message=this.name+": DOMException "+this.code}var n={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(i,n),i.prototype=Error.prototype,i}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),n("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(e,t,i){function n(){this.uid=i.guid()}var r={};return i.extend(n.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(e,t,n,o){var s,a=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),e=i.trim(e),/\s/.test(e)?(i.each(e.split(/\s+/),function(e){a.addEventListener(e,t,n,o)}),void 0):(e=e.toLowerCase(),n=parseInt(n,10)||0,s=r[this.uid]&&r[this.uid][e]||[],s.push({fn:t,priority:n,scope:o||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][e]=s,void 0)},hasEventListener:function(e){var t;return e?(e=e.toLowerCase(),t=r[this.uid]&&r[this.uid][e]):t=r[this.uid],t?t:!1},removeEventListener:function(e,t){var n,o,s=this;if(e=e.toLowerCase(),/\s/.test(e))return i.each(e.split(/\s+/),function(e){s.removeEventListener(e,t)}),void 0;if(n=r[this.uid]&&r[this.uid][e]){if(t){for(o=n.length-1;o>=0;o--)if(n[o].fn===t){n.splice(o,1);break}}else n=[];n.length||(delete r[this.uid][e],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(e){var n,o,s,a,u,c={},l=!0;if("string"!==i.typeOf(e)){if(a=e,"string"!==i.typeOf(a.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=a.type,a.total!==u&&a.loaded!==u&&(c.total=a.total,c.loaded=a.loaded),c.async=a.async||!1}if(-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]){o.sort(function(e,t){return t.priority-e.priority}),s=[].slice.call(arguments),s.shift(),c.type=e,s.unshift(c);var d=[];i.each(o,function(e){s[0].target=e.scope,c.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,s)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,s)===!1)})}),d.length&&i.inSeries(d,function(e){l=!e})}return l},bindOnce:function(e,t,i,n){var r=this;r.bind.call(this,e,function o(){return r.unbind(e,o),t.apply(this,arguments)},i,n)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(e){var t=this;this.bind(e.join(" "),function(e){var t="on"+e.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)}),i.each(e,function(e){e="on"+e.toLowerCase(e),"undefined"===i.typeOf(t[e])&&(t[e]=null)})}}),n.instance=new n,n}),n("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(e,t,i,n){function r(e,n,o,a,u){var c,l=this,d=t.guid(n+"_"),h=u||"browser";e=e||{},s[d]=this,o=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},o),e.preferred_caps&&(h=r.getMode(a,e.preferred_caps,h)),c=function(){var e={};return{exec:function(t,i,n,r){return c[i]&&(e[t]||(e[t]={context:this,instance:new c[i]}),e[t].instance[n])?e[t].instance[n].apply(this,r):void 0},removeInstance:function(t){delete e[t]},removeAllInstances:function(){var i=this;t.each(e,function(e,n){"function"===t.typeOf(e.instance.destroy)&&e.instance.destroy.call(e.context),i.removeInstance(n)})}}}(),t.extend(this,{initialized:!1,uid:d,type:n,mode:r.getMode(a,e.required_caps,h),shimid:d+"_container",clients:0,options:e,can:function(e,i){var n=arguments[2]||o;if("string"===t.typeOf(e)&&"undefined"===t.typeOf(i)&&(e=r.parseCaps(e)),"object"===t.typeOf(e)){for(var s in e)if(!this.can(s,e[s],n))return!1;return!0}return"function"===t.typeOf(n[e])?n[e].call(this,i):i===n[e]},getShimContainer:function(){var e,n=i.get(this.shimid);return n||(e=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),e.appendChild(n),e=null),n},getShim:function(){return c},shimExec:function(e,t){var i=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,e,t,i)},exec:function(e,t){var i=[].slice.call(arguments,2);return l[e]&&l[e][t]?l[e][t].apply(this,i):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var e=i.get(this.shimid);e&&e.parentNode.removeChild(e),c&&c.removeAllInstances(),this.unbindAll(),delete s[this.uid],this.uid=null,d=l=c=e=null}}}),this.mode&&e.required_caps&&!this.can(e.required_caps)&&(this.mode=!1)}var o={},s={};return r.order="html5,flash,silverlight,html4",r.getRuntime=function(e){return s[e]?s[e]:!1},r.addConstructor=function(e,t){t.prototype=n.instance,o[e]=t},r.getConstructor=function(e){return o[e]||null},r.getInfo=function(e){var t=r.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},r.parseCaps=function(e){var i={};return"string"!==t.typeOf(e)?e||{}:(t.each(e.split(","),function(e){i[e]=!0}),i)},r.can=function(e,t){var i,n,o=r.getConstructor(e);return o?(i=new o({required_caps:t}),n=i.mode,i.destroy(),!!n):!1},r.thatCan=function(e,t){var i=(t||r.order).split(/\s*,\s*/);for(var n in i)if(r.can(i[n],e))return i[n];return null},r.getMode=function(e,i,n){var r=null;if("undefined"===t.typeOf(n)&&(n="browser"),i&&!t.isEmptyObj(e)){if(t.each(i,function(i,n){if(e.hasOwnProperty(n)){var o=e[n](i);if("string"==typeof o&&(o=[o]),r){if(!(r=t.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==t.inArray(n,r)?n:r[0];if(r===!1)return!1}return n},r.capTrue=function(){return!0},r.capFalse=function(){return!1},r.capTest=function(e){return function(){return!!e}},r}),n("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(e,t){var i="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",n={mimes:{},extensions:{},addMimeType:function(e){var t,i,n,r=e.split(/,/);for(t=0;t>16,r=255&l>>8,o=255&l,f[p++]=64==u?String.fromCharCode(n):64==c?String.fromCharCode(n,r):String.fromCharCode(n,r,o);while(h>18,a=63&l>>12,u=63&l>>6,c=63&l,f[p++]=d.charAt(s)+d.charAt(a)+d.charAt(u)+d.charAt(c);while(h":"gt","&":"amp",'"':"quot","'":"#39"},i=/[<>&\"\']/g;return e?(""+e).replace(i,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:i.toArray,inArray:i.inArray,addI18n:e.addI18n,translate:e.translate,sprintf:i.sprintf,isEmptyObj:i.isEmptyObj,hasClass:n.hasClass,addClass:n.addClass,removeClass:n.removeClass,getStyle:n.getStyle,addEvent:r.addEvent,removeEvent:r.removeEvent,removeAllEvents:r.removeAllEvents,cleanName:function(e){var t,i;for(i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t0?"&":"?")+n),e},formatSize:function(t){function i(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(t=parseInt(t,10),isNaN(t))return e.translate("N/A");var n=Math.pow(1024,4);return t>n?i(t/n,1)+" "+e.translate("tb"):t>(n/=1024)?i(t/n,1)+" "+e.translate("gb"):t>(n/=1024)?i(t/n,1)+" "+e.translate("mb"):t>1024?Math.round(t/1024)+" "+e.translate("kb"):t+" "+e.translate("b")},resolveUrl:o.resolveUrl,parseSize:i.parseSizeStr,delay:i.delay,EventTarget:s,Runtime:a,FileInput:u,FileReader:c}}),n("plupload/core/Collection",["moxie/core/utils/Basic"],function(e){var t=function(){function i(){var e;for(e in r);return r[e]}var n,r={},o=0;e.extend(this,{count:function(){return o},hasKey:function(e){return r.hasOwnProperty(e)},get:function(e){return r[e]},first:function(){for(var e in r)return r[e]},last:function(){return n},toObject:function(){return r},add:function(t,i){var s=this;return"object"!=typeof t||i?r.hasOwnProperty(t)?s.update.apply(s,arguments):(r[t]=n=i,o++,void 0):e.each(t,function(e,t){s.add(t,e)})},remove:function(e){if(this.hasKey(e)){var t=r[e];delete r[e],o--,n===t&&(n=i())}},extract:function(e){var t=this.get(e);return this.remove(e),t},shift:function(){var e,t,i=this;for(t in r)return e=r[t],i.remove(t),e},update:function(e,t){r[e]=t},each:function(t){e.each(r,t)},combineWith:function(){var i=new t;return i.add(r),e.each(arguments,function(e){e instanceof t&&i.add(e.toObject())}),i},clear:function(){r={},n=null,o=0}})};return t}),n("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(e,t,i){function n(n,r){r||(r={}),i.apply(this,arguments),this.type||(this.type=t.getFileMime(r.name));var o;if(r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else if(this.type){var s=this.type.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[this.type]&&(o+="."+t.extensions[this.type][0])}e.extend(this,{name:o||e.guid("file_"),relativePath:"",lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return n.prototype=i.prototype,n}),n("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(e,t,i,n,r,o,s,a,u){function c(i){var r,o=this;"string"==typeof i&&(i={drop_zone:i}),r={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},i="object"==typeof i?n.extend({},r,i):r,i.container=t.get(i.drop_zone)||document.body,"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative"),"string"==typeof i.accept&&(i.accept=u.mimes2extList(i.accept)),s.call(o),n.extend(o,{uid:n.guid("uid_"),ruid:null,files:null,init:function(){o.bind("RuntimeInit",function(e,t){o.ruid=t.uid,t.exec.call(o,"FileDrop","init",i),o.dispatchEvent("ready")}),o.connectRuntime(i)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null,this.unbindAll()}}),this.handleEventProps(l)}var l=["ready","dragenter","dragleave","drop","error"];return c.prototype=a.instance,c}),n("plupload/core/ArrCollection",["moxie/core/utils/Basic"],function(e){var t=function(){var t=[];e.extend(this,{count:function(){return t.length},hasKey:function(e){return this.getIdx(e)>-1},get:function(e){var i=this.getIdx(e);return i>-1?t[i]:null},getIdx:function(e){for(var i=0,n=t.length;n>i;i++)if(t[i].uid===e)return i;return-1},getByIdx:function(e){return t[e]},first:function(){return t[0]},last:function(){return t[t.length-1]},add:function(e){e=arguments[1]||e;var i=this.getIdx(e.uid);return i>-1?(t[i]=e,i):(t.push(e),t.length-1)},remove:function(e){return!!this.extract(e)},splice:function(i,n){return i="undefinded"===e.typeOf(i)?0:Math.max(i,0),n="undefinded"!==e.typeOf(n)&&i+n-1?t.splice(i,1):null},shift:function(){return t.shift()},update:function(e,i){var n=this.getIdx(e);return n>-1?(t[n]=i,!0):!1},each:function(i){e.each(t,i)},combineWith:function(){return Array.prototype.concat.apply(this.toArray(),arguments)},sort:function(e){t.sort(e||function(e,t){return e.priority-t.priority})},clear:function(){t=[]},toObject:function(){for(var e={},i=0,n=t.length;n>i;i++)e[t[i].uid]=t[i];return e},toArray:function(){return Array.prototype.slice.call(t)}})};return t}),n("plupload/core/Optionable",["moxie/core/utils/Basic","moxie/core/EventTarget"],function(e,t){return function(t){function i(){t.apply(this,arguments),this._options={}}return e.inherit(i,t),e.extend(i.prototype,{setOption:function(t,i,n){var r,o=this;return"object"==typeof t?(n=i,e.each(t,function(e,t){o.setOption(t,e,n)}),void 0):((!n||o._options.hasOwnProperty(t))&&(r=e.clone(o._options[t]),"object"===e.typeOf(i)&&"object"===e.typeOf(o._options[t])?e.extend(o._options[t],i):o._options[t]=i,o.trigger("OptionChanged",t,i,r)),void 0)},getOption:function(t){if(!t)return this._options;var i=this._options[t];return e.inArray(e.typeOf(i),["array","object"])>-1?e.extendImmutable({},i):i},setOptions:function(e,t){"object"==typeof e&&this.setOption(e,t)},getOptions:function(){return this.getOption()}}),i}(t)}),n("plupload/core/Queueable",["moxie/core/utils/Env","moxie/core/utils/Basic","plupload/core/Optionable"],function(e,t,i){return function(e){function i(){e.apply(this,arguments),this.uid=t.guid(),this.state=i.IDLE,this.processed=0,this.total=0,this.percent=0,this.retries=0,this.priority=0,this.startedTimestamp=0,this.processedTimestamp=0}return i.IDLE=1,i.PROCESSING=2,i.PAUSED=6,i.RESUMED=7,i.DONE=5,i.FAILED=4,i.DESTROYED=8,t.inherit(i,e),t.extend(i.prototype,{start:function(){var e=this.state;return this.state===i.PROCESSING?!1:(this.startedTimestamp||(this.startedTimestamp=+new Date),this.state===i.IDLE?(this.state=i.PROCESSING,this.trigger("statechanged",this.state,e),this.pause(),t.delay.call(this,function(){this.trigger("beforestart")&&this.resume()}),!1):(this.state=i.PROCESSING,this.trigger("statechanged",this.state,e),this.trigger("started"),!0))},pause:function(){var e=this.state;return this.state!==i.PROCESSING?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.state=i.PAUSED,this.trigger("statechanged",this.state,e),this.trigger("paused"),!0)},resume:function(){var e=this.state;return this.state!==i.PAUSED&&this.state!==i.RESUMED?!1:(this.state=i.RESUMED,this.trigger("statechanged",this.state,e),this.trigger("resumed"),!0)},stop:function(){var e=this.state;return this.state===i.IDLE?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.startedTimestamp=0,this.state=i.IDLE,this.trigger("statechanged",this.state,e),this.trigger("stopped"),!0)},done:function(e){var t=this.state;return this.state===i.DONE?!1:(this.processed=this.total,this.loaded=this.processed,this.percent=100,this.processedTimestamp=+new Date,this.state=i.DONE,this.trigger("statechanged",this.state,t),this.trigger("done",e),this.trigger("processed"),!0)},failed:function(e){var t=this.state;return this.state===i.FAILED?!1:(this.processed=this.percent=0,this.loaded=this.processed,this.processedTimestamp=+new Date,this.state=i.FAILED,this.trigger("statechanged",this.state,t),this.trigger("failed",e),this.trigger("processed"),!0)},progress:function(e,t){t&&(this.total=t),this.processed=Math.min(e,this.total),this.loaded=this.processed,this.percent=Math.ceil(100*(this.processed/this.total)),this.trigger({type:"progress",loaded:this.processed,total:this.total})},destroy:function(){var e=this.state;return this.state===i.DESTROYED?!1:(this.state=i.DESTROYED,this.trigger("statechanged",this.state,e),this.trigger("destroy"),this.unbindAll(),!0)}}),i}(i)}),n("plupload/core/Stats",[],function(){return function(){var e=this;e.size=0,e.total=0,e.loaded=0,e.uploaded=0,e.done=0,e.failed=0,e.queued=0,e.paused=0,e.processing=0,e.paused=0,e.percent=0,e.bytesPerSec=0,e.processedPerSec=0,e.reset=function(){e.size=e.total=e.loaded=e.processed=e.uploaded=e.done=e.failed=e.queued=e.processing=e.paused=e.percent=e.bytesPerSec=e.processedPerSec=0}}}),n("plupload/core/Queue",["moxie/core/utils/Basic","plupload/core/ArrCollection","plupload/core/Queueable","plupload/core/Stats"],function(e,t,i,n){return function(r){function o(i){r.apply(this,arguments),this._queue=new t,this.stats=new n,this._options=e.extend({},this._options,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1},i)}function s(){var e;return this.forEachItem(function(t){return t.state===i.IDLE||t.state===i.RESUMED?(e=t,!1):void 0}),e?e:null}function a(){var e;return this.state!==i.PROCESSING&&this.state!==i.PAUSED?!1:this.stats.processinge.startedTimestamp)&&(r+=n),t.processedPerSec=Math.ceil(r/((+new Date-e.startedTimestamp||1)/1e3)),t.processed=n,t.total+=o.total,t.total&&(t.percent=Math.ceil(100*(t.processed/t.total)))}),e.percent=t.percent,t.loaded=t.processed,t.size=t.total,t.bytesPerSec=t.processedPerSec,!0):!1},destroy:function(){var t=this;return t.state===i.DESTROYED?!1:t.state!==i.IDLE?(t.bindOnce("Stopped",function(){e.delay.call(t,t.destroy)}),t.stop()):(t.clear(),o.super.destroy.call(this),t._queue=t.stats=null,!0)}}),o}(i)}),n("plupload/QueueUpload",["moxie/core/utils/Basic","plupload/core/Queue"],function(e,t){return function(i){function n(e){t.call(this,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1,url:!1,chunk_size:0,multipart:!0,http_method:"POST",params:{},headers:!1,file_data_name:"file",send_file_name:!0,stop_on_fail:!0}),this.setOption=function(e,t){"object"!=typeof e&&"max_upload_slots"==e&&(e="max_slots"),n.prototype.setOption.call(this,e,t,!0)},this.setOptions(e)}return e.inherit(n,i),n}(t)}),n("plupload/QueueResize",["moxie/core/utils/Basic","plupload/core/Queue"],function(e,t){return function(i){function n(e){t.call(this,{max_slots:1,max_retries:0,auto_start:!1,finish_active:!1,resize:{}}),this.setOption=function(e,t){"object"!=typeof e&&"max_resize_slots"==e&&(e="max_slots"),n.prototype.setOption.call(this,e,t,!0)},this.setOptions(e)}return e.inherit(n,i),n}(t)}),n("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i){function n(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return n.prototype=i.instance,n}),n("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(e,t,i){return function(){function n(e,t){if(!t.isDetached()){var n=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),n}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var o="",s=0,a=r.length;a>s;s++)o+=String.fromCharCode(r[s]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return n.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return n.call(this,"readAsDataURL",e)},readAsText:function(e){return n.call(this,"readAsText",e)}})}}),n("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(e,t,i){function n(){var e,n=[];t.extend(this,{append:function(r,o){var s=this,a=t.typeOf(o);o instanceof i?e={name:r,value:o}:"array"===a?(r+="[]",t.each(o,function(e){s.append(r,e)})):"object"===a?t.each(o,function(e,t){s.append(r+"["+t+"]",e)}):"null"===a||"undefined"===a||"number"===a&&isNaN(o)?s.append(r,"false"):n.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(i){t.each(n,function(e){i(e.value,e.name)}),e&&i(e.value,e.name)},destroy:function(){e=null,n=[]}})}return n}),n("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(e,t,i,n,r,o,s,a,u,c,l,d){function h(){this.uid=e.guid("uid_")}function p(){function i(e,t){return I.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?I[e]:O[e]:(l.can("define_property")?I[e]=t:O[e]=t,void 0):void 0}function u(t){function n(){b&&(b.destroy(),b=null),a.dispatchEvent("loadend"),a=null}function r(r){b.bind("LoadStart",function(e){i("readyState",p.LOADING),a.dispatchEvent("readystatechange"),a.dispatchEvent(e),L&&a.upload.dispatchEvent(e)}),b.bind("Progress",function(e){i("readyState")!==p.LOADING&&(i("readyState",p.LOADING),a.dispatchEvent("readystatechange")),a.dispatchEvent(e)}),b.bind("UploadProgress",function(e){L&&a.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),b.bind("Load",function(t){i("readyState",p.DONE),i("status",Number(r.exec.call(b,"XMLHttpRequest","getStatus")||0)),i("statusText",m[i("status")]||""),i("response",r.exec.call(b,"XMLHttpRequest","getResponse",i("responseType"))),~e.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response")),k=r.exec.call(b,"XMLHttpRequest","getAllResponseHeaders"),a.dispatchEvent("readystatechange"),i("status")>0?(L&&a.upload.dispatchEvent(t),a.dispatchEvent(t)):(M=!0,a.dispatchEvent("error")),n()}),b.bind("Abort",function(e){a.dispatchEvent(e),n()}),b.bind("Error",function(e){M=!0,i("readyState",p.DONE),a.dispatchEvent("readystatechange"),F=!0,a.dispatchEvent(e),n()}),r.exec.call(b,"XMLHttpRequest","send",{url:x,method:v,async:S,user:y,password:_,headers:A,mimeType:D,encoding:T,responseType:a.responseType,withCredentials:a.withCredentials,options:U},t)}var a=this;E=(new Date).getTime(),b=new s,"string"==typeof U.required_caps&&(U.required_caps=o.parseCaps(U.required_caps)),U.required_caps=e.extend({},U.required_caps,{return_response_type:a.responseType}),t instanceof c&&(U.required_caps.send_multipart=!0),e.isEmptyObj(A)||(U.required_caps.send_custom_headers=!0),P||(U.required_caps.do_cors=!0),U.ruid?r(b.connectRuntime(U)):(b.bind("RuntimeInit",function(e,t){r(t)}),b.bind("RuntimeError",function(e,t){a.dispatchEvent("RuntimeError",t)}),b.connectRuntime(U))}function g(){i("responseText",""),i("responseXML",null),i("response",null),i("status",0),i("statusText",""),E=w=null}var x,v,y,_,E,w,b,R,O=this,I={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},S=!0,A={},T=null,D=null,C=!1,N=!1,L=!1,F=!1,M=!1,P=!1,B=null,z=null,U={},k="";e.extend(this,I,{uid:e.guid("uid_"),upload:new h,open:function(o,s,a,u,c){var l;if(!o||!s)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||n.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(v=o.toUpperCase()),~e.inArray(v,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(s=n.utf8_encode(s),l=r.parseUrl(s),P=r.hasSameOrigin(l),x=r.resolveUrl(s),(u||c)&&!P)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(y=u||l.user,_=c||l.pass,S=a||!0,S===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);C=!S,N=!1,A={},g.call(this),i("readyState",p.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var s=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(i("readyState")!==p.OPENED||N)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||n.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,s)||/^(proxy\-|sec\-)/.test(r)?!1:(A[r]?A[r]+=", "+o:A[r]=o,!0)},hasRequestHeader:function(e){return e&&A[e.toLowerCase()]||!1},getAllResponseHeaders:function(){return k||""},getResponseHeader:function(t){return t=t.toLowerCase(),M||~e.inArray(t,["set-cookie","set-cookie2"])?null:k&&""!==k&&(R||(R={},e.each(k.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=e.trim(i[0]),R[i[0].toLowerCase()]={header:i[0],value:e.trim(i[1])})})),R.hasOwnProperty(t))?R[t].header+": "+R[t].value:null},overrideMimeType:function(n){var r,o;if(~e.inArray(i("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n=e.trim(n.toLowerCase()),/;/.test(n)&&(r=n.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(n=r[1],r[2]&&(o=r[2])),!d.mimes[n])throw new t.DOMException(t.DOMException.SYNTAX_ERR);B=n,z=o},send:function(i,r){if(U="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.readyState!==p.OPENED||N)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof a)U.ruid=i.ruid,D=i.type||"application/octet-stream";else if(i instanceof c){if(i.hasBlob()){var o=i.getBlob();U.ruid=o.ruid,D=o.type||"application/octet-stream"}}else"string"==typeof i&&(T="UTF-8",D="text/plain;charset=UTF-8",i=n.utf8_encode(i));this.withCredentials||(this.withCredentials=U.required_caps&&U.required_caps.send_browser_cookies&&!P),L=!C&&this.upload.hasEventListener(),M=!1,F=!i,C||(N=!0),u.call(this,i)},abort:function(){if(M=!0,C=!1,~e.inArray(i("readyState"),[p.UNSENT,p.OPENED,p.DONE]))i("readyState",p.UNSENT);else{if(i("readyState",p.DONE),N=!1,!b)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);b.getRuntime().exec.call(b,"XMLHttpRequest","abort",F),F=!0}},destroy:function(){b&&("function"===e.typeOf(b.destroy)&&b.destroy(),b=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(f.concat(["readystatechange"])),this.upload.handleEventProps(f)}var m={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};h.prototype=i.instance;var f=["loadstart","progress","abort","error","load","timeout","loadend"];return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=i.instance,p}),n("plupload/ChunkUploader",["moxie/core/utils/Basic","plupload/core/Collection","plupload/core/Queueable","moxie/xhr/XMLHttpRequest","moxie/xhr/FormData"],function(e,t,i,n,r){function o(t){function s(t,i){var n="";return e.each(i,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(t+=(t.indexOf("?")>0?"&":"?")+n),t}var a;i.call(this),this._options={file_data_name:"file",headers:!1,http_method:"POST",multipart:!0,params:{},send_file_name:!0,url:!1},e.extend(this,{start:function(){var u,c,l=this,d=l._options;if(this.state===i.PROCESSING)return!1;a=new n,a.upload&&(a.upload.onprogress=function(e){l.progress(e.loaded,e.total)}),a.onload=function(){var e={response:this.responseText,status:this.status,responseHeaders:this.getAllResponseHeaders()};return this.status>=400?l.failed(e):(l.done(e),void 0)},a.onerror=function(){l.failed()},a.onloadend=function(){setTimeout(function(){a&&(a.destroy(),a=null)},1)};try{u=d.multipart?d.url:s(d.url,d.params),a.open(d.http_method,u,!0),e.isEmptyObj(d.headers)||e.each(d.headers,function(e,t){a.setRequestHeader(t,e)}),d.multipart?(c=new r,e.isEmptyObj(d.params)||e.each(d.params,function(e,t){c.append(t,e)}),c.append(d.file_data_name,t),a.send(c)):((e.isEmptyObj(d.headers)||!a.hasRequestHeader("content-type"))&&a.setRequestHeader("content-type","application/octet-stream"),a.send(t)),o.prototype.start.call(this)}catch(h){l.failed()}},stop:function(){a&&(a.abort(),a.destroy(),a=null),o.prototype.stop.call(this)},setOption:function(e,t){o.prototype.setOption.call(this,e,t,!0)},setOptions:function(e){o.prototype.setOption.call(this,e,!0)},destroy:function(){this.stop(),o.prototype.destroy.call(this)}})}return e.inherit(o,i),o}),n("plupload/FileUploader",["moxie/core/utils/Basic","plupload/core/Collection","plupload/core/Queueable","plupload/ChunkUploader"],function(e,t,i,n){function r(o,s){function a(){var e=0;return c.each(function(t){t.state===i.DONE&&(e+=t.end-t.start)}),e}function u(){for(var e=0;l>e&&c.hasKey(e);)e++;return e}var c=new t,l=1;i.call(this),this._options={chunk_size:0,params:{},send_file_name:!0,stop_on_fail:!0},e.extend(this,{name:o.name,start:function(){var e,t=this,a=this.state;return this.state===i.PROCESSING?!1:this.state!==i.IDLE||r.prototype.start.call(t)?(t._options.send_file_name&&(t._options.params.name=t.target_name||t.name),t._options.chunk_size?(l=Math.ceil(o.size/t._options.chunk_size),t.uploadChunk(!1,!0)):(e=new n(o),e.bind("progress",function(e){t.progress(e.loaded,e.total)}),e.bind("done",function(e,i){t.done(i)}),e.bind("failed",function(e,i){t.failed(i)}),e.setOptions(t._options),s.addItem(e)),this.state=i.PROCESSING,this.trigger("statechanged",this.state,a),this.trigger("started"),!0):!1},uploadChunk:function(t,r){var d,h,p=this,m=this.getOption("chunk_size"),f={};return f.seq=parseInt(t,10)||u(),f.start=f.seq*m,f.end=Math.min(f.start+m,o.size),f.total=o.size,f.start<0||f.start>=o.size?!1:(h=e.extendImmutable({},this.getOptions(),{params:{chunk:f.seq,chunks:l}}),d=new n(o.slice(f.start,f.end,o.type)),d.bind("progress",function(e){p.progress(a()+e.loaded,o.size)}),d.bind("failed",function(t,n){c.add(f.seq,e.extend({state:i.FAILED},f)),p.trigger("chunkuploadfailed",e.extendImmutable({},f,n)),h.stop_on_fail&&p.failed(n)}),d.bind("done",function(t,n){c.add(f.seq,e.extend({state:i.DONE},f)),p.trigger("chunkuploaded",e.extendImmutable({},f,n)),a()>=o.size?(p.progress(o.size,o.size),p.done(n)):r&&e.delay(function(){p.uploadChunk(u(),r)})}),d.bind("processed",function(){this.destroy()}),d.setOptions(h),c.add(f.seq,e.extend({state:i.PROCESSING},f)),s.addItem(d),r&&s.countSpareSlots()&&p.uploadChunk(u(),r),!0)},destroy:function(){r.prototype.destroy.call(this),c.clear()}})}return e.inherit(r,i),r}),n("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(e,t,i,n){function r(){function n(){l=d=0,c=this.result=null}function o(t,i){var n=this;u=i,n.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(n.state,[r.IDLE,r.DONE])&&s.call(n)},999),n.bind("TransportingComplete",function(){d=l,n.state=r.DONE,c=null,n.result=u.exec.call(n,"Transporter","getAsBlob",t||"")},999),n.state=r.BUSY,n.trigger("TransportingStarted"),s.call(n)}function s(){var e,i=this,n=l-d;h>n&&(h=n),e=t.btoa(c.substr(d,h)),u.exec.call(i,"Transporter","receive",e,l)}var a,u,c,l,d,h;i.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,i,r){var s=this;if(r=e.extend({chunk_size:204798},r),(a=r.chunk_size%3)&&(r.chunk_size+=3-a),h=r.chunk_size,n.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(s,i,this.connectRuntime(r));else{var u=function(e,t){s.unbind("RuntimeInit",u),o.call(s,i,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),n.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),n.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=n.instance,r}),n("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(e,t,i,n,r,o,s,a,u,c,l,d,h){function p(){function n(e){try{return e||(e=this.exec("Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name),!0 +}catch(t){return this.trigger("error",t.code),!1}}function c(t){var n=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);f.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(n,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===n)"data:"===t.substr(0,5)?c.call(this,new l(null,{data:t}),arguments[1]):x.apply(this,arguments);else{if("node"!==n||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r.code)}}function f(t,i){var n=this.connectRuntime(t.ruid);this.ruid=n.uid,n.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(i)?!0:i)}function g(t,i){function n(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){n(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=o.parseCaps(i.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):n(this.connectRuntime(t.ruid))}function x(e,t){var i,n=this;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}s.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){c.apply(this,arguments)},resize:function(t){var n,r,o=this,s={x:0,y:0,width:o.width,height:o.height},a=e.extendIf({width:o.width,height:o.height,type:o.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t);try{if(!o.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(o.width>p.MAX_RESIZE_WIDTH||o.height>p.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if(n=o.meta&&o.meta.tiff&&o.meta.tiff.Orientation||1,-1!==e.inArray(n,[5,6,7,8])){var u=a.width;a.width=a.height,a.height=u}if(a.crop){switch(r=Math.max(a.width/o.width,a.height/o.height),t.fit?(s.width=Math.min(Math.ceil(a.width/r),o.width),s.height=Math.min(Math.ceil(a.height/r),o.height),r=a.width/s.width):(s.width=Math.min(a.width,o.width),s.height=Math.min(a.height,o.height),r=1),"boolean"==typeof a.crop&&(a.crop="cc"),a.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":s.x=o.width-s.width,s.y=o.height-s.height;break;case"cb":case"center-bottom":s.x=Math.floor((o.width-s.width)/2),s.y=o.height-s.height;break;case"lb":case"left-bottom":s.x=0,s.y=o.height-s.height;break;case"lt":case"left-top":s.x=0,s.y=0;break;case"ct":case"center-top":s.x=Math.floor((o.width-s.width)/2),s.y=0;break;case"rt":case"right-top":s.x=o.width-s.width,s.y=0;break;case"rc":case"right-center":case"right-middle":s.x=o.width-s.width,s.y=Math.floor((o.height-s.height)/2);break;case"lc":case"left-center":case"left-middle":s.x=0,s.y=Math.floor((o.height-s.height)/2);break;case"cc":case"center-center":case"center-middle":default:s.x=Math.floor((o.width-s.width)/2),s.y=Math.floor((o.height-s.height)/2)}s.x=Math.max(s.x,0),s.y=Math.max(s.y,0)}else r=Math.min(a.width/o.width,a.height/o.height);this.exec("Image","resize",s,r,a)}catch(c){o.trigger("error",c.code)}},downsize:function(t){var i,n={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?e.extend(n,t):e.extend(n,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]}),this.resize(i)},crop:function(e,t,i){this.downsize(e,t,!0,i)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",e||"image/jpeg",t||90)},getAsDataURL:function(e,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",e||"image/jpeg",t||90)},getAsBinaryString:function(e,t){var i=this.getAsDataURL(e,t);return h.atob(i.substring(i.indexOf("base64,")+7))},embed:function(n,r){function o(t,r){var o=this;if(u.can("create_canvas")){var l=o.getAsCanvas();if(l)return n.appendChild(l),l=null,o.destroy(),c.trigger("embedded"),void 0}var d=o.getAsDataURL(t,r);if(!d)throw new i.ImageError(i.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",d.length))n.innerHTML='',o.destroy(),c.trigger("embedded");else{var p=new a;p.bind("TransportingComplete",function(){s=c.connectRuntime(this.result.ruid),c.bind("Embedded",function(){e.extend(s.getShimContainer().style,{top:"0px",left:"0px",width:o.width+"px",height:o.height+"px"}),s=null},999),s.exec.call(c,"ImageView","display",this.result.uid,width,height),o.destroy()}),p.transport(h.atob(d.substring(d.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:n})}}var s,c=this,l=e.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},r);try{if(!(n=t.get(n)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT;var d=new p;return d.bind("Resize",function(){o.call(this,l.type,l.quality)}),d.bind("Load",function(){this.downsize(l)}),this.meta.thumb&&this.meta.thumb.width>=l.width&&this.meta.thumb.height>=l.height?d.load(this.meta.thumb.data):d.clone(this,!1),d}catch(m){this.trigger("error",m.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy(),this.unbindAll()}}),this.handleEventProps(m),this.bind("Load Resize",function(){return n.call(this)},999)}var m=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=8192,p.MAX_RESIZE_HEIGHT=8192,p.prototype=c.instance,p}),n("plupload/ImageResizer",["plupload","plupload/core/Queueable","moxie/image/Image"],function(e,t,i){function n(e){t.call(this),this._options={width:0,height:0,type:"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},this.setOption=function(e){("object"==typeof e||this._options.hasOwnProperty(e))&&n.prototype.setOption.apply(this,arguments)},this.start=function(t){var n,r=this;t&&this.setOptions(t.resize),n=new i,n.bind("load",function(){this.resize(r.getOptions())}),n.bind("resize",function(){r.done(this.getAsBlob(r.getOption("type"),r.getOption("quality"))),this.destroy()}),n.bind("error",function(){r.failed(),this.destroy()}),n.load(e)}}return e.inherit(n,t),e.Image=i,n}),n("plupload/File",["plupload","plupload/core/Queueable","plupload/FileUploader","plupload/ImageResizer"],function(e,t,i,n){function r(a,u,c){t.call(this),e.extend(this,{id:this.uid,name:a.name,target_name:null,type:a.type,size:a.size,origSize:a.size,start:function(){var i=this.state;return this.state===t.PROCESSING?!1:(this.state=t.PROCESSING,this.trigger("statechanged",this.state,i),this.trigger("started"),!e.isEmptyObj(this._options.resize)&&o(this.type)&&s(a,"send_binary_string")?this.resizeAndUpload():this.upload(),!0)},getSource:function(){return a},getNative:function(){return this.getFile().getSource()},resizeAndUpload:function(){var e=this,t=new n(a);t.bind("progress",function(t){e.progress(t.loaded,t.total)}),t.bind("done",function(t,i){i=i,e.upload()}),t.bind("failed",function(){e.upload()}),c.addItem(t)},upload:function(){var e=this,t=new i(a,u);t.bind("beforestart",function(){return e.trigger("beforeupload")}),t.bind("paused",function(){e.pause()}),t.bind("resumed",function(){this.start()}),t.bind("started",function(){e.trigger("startupload")}),t.bind("progress",function(t){e.progress(t.loaded,t.total)}),t.bind("done",function(t,i){e.done(i)}),t.bind("failed",function(t,i){e.failed(i)}),t.setOptions(e.getOptions()),t.start()},destroy:function(){r.prototype.destroy.call(this),a=null}})}function o(t){return e.inArray(t,["image/jpeg","image/png"])>-1}function s(t,i){if(t.ruid){var n=e.Runtime.getInfo(t.ruid);if(n)return n.can(i)}return!1}return e.inherit(r,t),r}),n("plupload/Uploader",["plupload","plupload/core/Collection","moxie/core/utils/Mime","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/file/FileDrop","moxie/runtime/Runtime","plupload/core/Queue","plupload/QueueUpload","plupload/QueueResize","plupload/File"],function(e,t,i,n,r,o,s,a,u,c,l,d){function h(t){function i(){var e=R[0]||O[0];return e?e.getRuntime().uid:!1}function p(){this.bind("FilesAdded FilesRemoved",function(e){e.trigger("QueueChanged"),e.refresh()},this,999),this.bind("BeforeUpload",x),this.bind("Stopped",function(e){e.trigger("UploadComplete")}),this.bind("Error",_),this.bind("Destroy",E)}function g(t){var i=this,n=0,r=[],u={runtime_order:i.getOption("runtimes"),required_caps:i.getOption("required_features"),preferred_caps:i.getOption("preferred_caps"),swf_url:i.getOption("flash_swf_url"),xap_url:i.getOption("silverlight_xap_url")};e.each(i.getOption("runtimes").split(/\s*,\s*/),function(e){i.getOption(e)&&(u[e]=i.getOption(e))}),i.getOption("browse_button")&&e.each(i.getOption("browse_button"),function(t){r.push(function(r){var s=new o(e.extend({},u,{accept:i.getOption("filters").mime_types,name:i.getOption("file_data_name"),multiple:i.getOption("multi_selection"),container:i.getOption("container"),browse_button:t}));s.onready=function(){var t=a.getInfo(this.ruid);e.extend(i.features,{chunks:t.can("slice_blob"),multipart:t.can("send_multipart"),multi_selection:t.can("select_multiple")}),n++,R.push(this),r()},s.onchange=function(){i.addFile(this.files)},s.bind("mouseenter mouseleave mousedown mouseup",function(n){S||(i.getOption("browse_button_hover")&&("mouseenter"===n.type?e.addClass(t,i.getOption("browse_button_hover")):"mouseleave"===n.type&&e.removeClass(t,i.getOption("browse_button_hover"))),i.getOption("browse_button_active")&&("mousedown"===n.type?e.addClass(t,i.getOption("browse_button_active")):"mouseup"===n.type&&e.removeClass(t,i.getOption("browse_button_active"))))}),s.bind("mousedown",function(){i.trigger("Browse")}),s.bind("error runtimeerror",function(){s=null,r()}),s.init()})}),i.getOption("drop_element")&&e.each(i.getOption("drop_element"),function(t){r.push(function(r){var o=new s(e.extend({},u,{drop_zone:t}));o.onready=function(){var t=a.getInfo(this.ruid);e.extend(i.features,{chunks:t.can("slice_blob"),multipart:t.can("send_multipart"),dragdrop:t.can("drag_and_drop")}),n++,O.push(this),r()},o.ondrop=function(){i.addFile(this.files)},o.bind("error runtimeerror",function(){o=null,r()}),o.init()})}),e.inParallel(r,function(){"function"==typeof t&&t(n)})}function x(e,t){if(e.getOption("unique_names")){var i=t.name.match(/\.([^.]+)$/),n="part";i&&(n=i[1]),t.target_name=t.id+"."+n}}function _(t,i){i.code===e.INIT_ERROR?t.destroy():i.code===e.HTTP_ERROR&&t.state==e.STARTED&&t.trigger("CancelUpload")}function E(t){t.forEachItem(function(e){e.destroy()}),R.length&&(e.each(R,function(e){e.destroy()}),R=[]),O.length&&(e.each(O,function(e){e.destroy()}),O=[]),I=!1,w&&w.destroy(),b&&b.destroy(),A=w=b=null}var w,b,R=[],O=[],I=!1,S=!1,A=m(e.extend({backward_compatibility:!0,chunk_size:0,file_data_name:"file",filters:{mime_types:"*",prevent_duplicates:!1,max_file_size:0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_resize_slots:1,max_retries:0,max_upload_slots:1,multipart:!0,multipart_params:{},multi_selection:!0,params:{},resize:!1,runtimes:a.order,send_chunk_number:!0,send_file_name:!0,silverlight_xap_url:"js/Moxie.xap",required_features:!1,preferred_caps:!1},t));u.call(this),e.extend(this,{_options:A,id:this.uid,state:e.STOPPED,features:{},settings:A,runtime:null,files:[],total:this.stats,init:function(){var t,n,r=this;return t=r.getOption("preinit"),"function"==typeof t?t(r):e.each(t,function(e,t){r.bind(t,e)}),p.call(r),e.each(["container","browse_button","drop_element"],function(t){return null===r.getOption(t)?(n={code:e.INIT_ERROR,message:e.sprintf(e.translate("%s specified, but cannot be found."),t)},!1):void 0}),n?r.trigger("Error",n):r.getOption("browse_button")||r.getOption("drop_element")?(g.call(r,function(t){var n,o=r.getOption("init"),s=e.extendImmutable({},r.getOption(),{auto_start:!0});"function"==typeof o?o(r):e.each(o,function(e,t){r.bind(t,e)}),t?(I=!0,n=a.getInfo(i()),w=new c(s),b=new l(s),r.trigger("Init",{ruid:n.uid,runtime:r.runtime=n.type}),r.trigger("PostInit")):r.trigger("Error",{code:e.INIT_ERROR,message:e.translate("Init error.")})}),void 0):r.trigger("Error",{code:e.INIT_ERROR,message:e.translate("You must specify either browse_button or drop_element.")})},setOption:function(t,i){return I&&e.inArray(t,["container","browse_button","drop_element","runtimes","multi_selection","flash_swf_url","silverlight_xap_url"])>-1?this.trigger("Error",{code:e.OPTION_ERROR,message:e.sprintf(e.translate("%s option cannot be changed.")),option:t}):("object"!=typeof t&&(i=f(t,i,this._options),w&&w.setOption(t,i),b&&b.setOption(t,i)),h.prototype.setOption.call(this,t,i),void 0)},refresh:function(){R.length&&e.each(R,function(e){e.trigger("Refresh")}),O.length&&e.each(O,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},stop:function(){h.prototype.stop.call(this)&&this.state!=e.STOPPED&&this.trigger("CancelUpload")},disableBrowse:function(){S=arguments[0]!==v?arguments[0]:!0,R.length&&e.each(R,function(e){e.disable(S)}),this.trigger("DisableBrowse",S)},getFile:function(e){return this.getItem(e)},addFile:function(t,o){function s(t){t.bind("beforeupload",function(e){return l.trigger("BeforeUpload",e.target)}),t.bind("startupload",function(){l.trigger("UploadFile",this)}),t.bind("progress",function(){l.trigger("UploadProgress",this)}),t.bind("done",function(e,t){l.trigger("FileUploaded",this,t)}),t.bind("failed",function(t,i){l.trigger("Error",e.extend({code:e.HTTP_ERROR,message:e.translate("HTTP Error."),file:this},i))})}function a(t,i){var n=[];e.each(l.getOption("filters"),function(e,i){y[i]&&n.push(function(n){y[i].call(l,e,t,function(e){n(!e)})})}),e.inParallel(n,i)}function u(t){var i=e.typeOf(t);if(t instanceof r){if(!t.ruid&&!t.isDetached()){if(!c)return!1;t.ruid=c,t.connectRuntime(c)}h.push(function(i){a(t,function(n){var r;n||(r=new d(t,w,b),o&&(r.name=o),s(r),l.addItem(r),p.push(r),l.trigger("FileFiltered",r)),e.delay(i)})})}else t instanceof n?(u(t.getSource()),t.destroy()):-1!==e.inArray(i,["file","blob"])?u(new r(null,t)):"node"===i&&"filelist"===e.typeOf(t.files)?e.each(t.files,u):"array"===i&&(o=null,e.each(t,u))}var c,l=this,h=[],p=[];c=i(),u(t),h.length&&e.inParallel(h,function(){p.length&&l.trigger("FilesAdded",p)})},removeFile:function(e){var t=this.extractItem("string"==typeof e?e:e.uid);t&&(this.trigger("FilesRemoved",[t]),t.destroy())},splice:function(){var t=0,i=e.STARTED==this.state,n=u.prototype.splice.apply(this,arguments);if(n.length){for(this.trigger("FilesRemoved",n),i&&this.stop(),t=0;t0&&(r.slice_blob=!0),e.isEmptyObj(t.resize)&&t.multipart!==!1||(r.send_binary_string=!0),t.http_method&&(r.use_http_method=t.http_method),e.each(t,function(e,t){i(t,!!e,!0)})),r}function m(t){return e.each(t,function(e,i){t[i]=f(i,e,t)}),t}function f(t,n,r){switch(t){case"chunk_size":(n=e.parseSize(n))&&(r.send_file_name=!0);break;case"headers":var o={};return"object"==typeof n&&e.each(n,function(e,t){o[t.toLowerCase()]=e}),o;case"http_method":return"PUT"===n.toUpperCase()?"PUT":"POST";case"filters":return"array"===e.typeOf(n)&&(n={mime_types:n}),n.mime_types&&("string"===e.typeOf(n.mime_types)&&(n.mime_types=i.mimes2extList(n.mime_types)),r.re_ext_filter=function(t){var i=[];return e.each(t,function(t){e.each(t.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?i.push("\\.*"):i.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+i.join("|")+")$","i")}(n.mime_types)),n;case"max_file_size":r&&!r.filters&&(r.filters={}),r.filters.max_file_size=n;break;case"multipart":n||(r.send_file_name=!0);break;case"multipart_params":r.params=r.multipart_params=n;break;case"resize":return n?e.extend({preserve_headers:!0,crop:!1},n):!1;case"prevent_duplicates":r&&!r.filters&&(r.filters={}),r.filters.prevent_duplicates=!!n;break;case"unique_names":n&&(r.send_file_name=!0);break;case"required_features":return p(e.extend({},r));case"preferred_caps":return p(e.extend({},r,{required_features:!0}));case"container":case"browse_button":case"drop_element":return"container"===t?e.get(n):e.getAll(n)}return n}function g(e,t){y[e]=t}function x(e,t){var i,n;return i=new h(e),n=a.thatCan(i.getOption("required_features"),t||e.runtimes),i.destroy(),n}var v,y={};return g("mime_types",function(t,i,n){t.length&&!this.getOption("re_ext_filter").test(i.name)?(this.trigger("Error",{code:e.FILE_EXTENSION_ERROR,message:e.translate("File extension error."),file:i}),n(!1)):n(!0)}),g("max_file_size",function(t,i,n){var r;t=e.parseSize(t),i.size!==r&&t&&i.size>t?(this.trigger("Error",{code:e.FILE_SIZE_ERROR,message:e.translate("File size error."),file:i}),n(!1)):n(!0)}),g("prevent_duplicates",function(t,i,n){var r=this;t&&this.forEachItem(function(t){return i.name===t.name&&i.size===t.size?(r.trigger("Error",{code:e.FILE_DUPLICATE_ERROR,message:e.translate("Duplicate file error."),file:i}),n(!1),void 0):void 0}),n(!0)}),h.addFileFilter=g,e.inherit(h,u),e.addFileFilter=g,e.predictRuntime=x,h}),n("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue,l=e.extend({access_binary:u(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!a.Image},display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:u(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:u(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==n.browser||n.verComp(n.version,9,">"))}()),filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<"))}()),return_response_headers:c,return_response_type:function(e){return"json"===e&&window.JSON?!0:n.can("return_response_type",e)},return_status_code:c,report_upload_progress:u(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&n.can("create_canvas")},select_file:function(){return n.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===n.browser&&n.verComp(n.version,21,">=")||"Firefox"===n.browser&&n.verComp(n.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===n.browser&&"Windows"===n.os||"iOS"===n.os&&n.verComp(n.osVersion,"7.0.0",">")&&n.verComp(n.osVersion,"8.0.0","<"))},send_binary_string:u(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:u(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:u(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari","Edge"]))},upload_filesize:c,use_http_method:c},arguments[2]);i.call(this,t,arguments[1]||s,l),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),a)}var s="html5",a={};return i.addConstructor(s,o),a}),n("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(e,t){function i(){function e(e,t,i){var n;if(!window.File.prototype.slice)return(n=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?n.call(e,t,i):null;try{return e.slice(),e.slice(t,i)}catch(r){return e.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=i}),n("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,s){function a(){var e,a;i.extend(this,{init:function(u){var c,l,d,h,p,m,f=this,g=f.getRuntime();e=u,d=o.extList2mimes(e.accept,g.can("filter_by_extension")),l=g.getShimContainer(),l.innerHTML='",c=n.get(g.uid),i.extend(c.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),h=n.get(e.browse_button),a=n.getStyle(h,"z-index")||"auto",g.can("summon_file_dialog")&&("static"===n.getStyle(h,"position")&&(h.style.position="relative"),r.addEvent(h,"click",function(e){var t=n.get(g.uid);t&&!t.disabled&&t.click(),e.preventDefault()},f.uid),f.bind("Refresh",function(){p=parseInt(a,10)||1,n.get(e.browse_button).style.zIndex=p,this.getRuntime().getShimContainer().style.zIndex=p-1})),m=g.can("summon_file_dialog")?h:l,r.addEvent(m,"mouseover",function(){f.trigger("mouseenter")},f.uid),r.addEvent(m,"mouseout",function(){f.trigger("mouseleave")},f.uid),r.addEvent(m,"mousedown",function(){f.trigger("mousedown")},f.uid),r.addEvent(n.get(e.container),"mouseup",function(){f.trigger("mouseup")},f.uid),c.onchange=function x(){if(f.files=[],i.each(this.files,function(i){var n="";return e.directory&&"."==i.name?!0:(i.webkitRelativePath&&(n="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(g.uid,i),i.relativePath=n,f.files.push(i),void 0)}),"IE"!==s.browser&&"IEMobile"!==s.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=x}f.files.length&&f.trigger("change")},f.trigger({type:"ready",async:!0}),l=null},setOption:function(e,t){var i=this.getRuntime(),r=n.get(i.uid);switch(e){case"accept":if(t){var s=t.mimes||o.extList2mimes(t,i.can("filter_by_extension"));r.setAttribute("accept",s.join(","))}else r.removeAttribute("accept");break;case"directory":t&&i.can("select_folder")?(r.setAttribute("directory",""),r.setAttribute("webkitdirectory","")):(r.removeAttribute("directory"),r.removeAttribute("webkitdirectory"));break;case"multiple":t&&i.can("select_multiple")?r.setAttribute("multiple",""):r.removeAttribute("multiple")}},disable:function(e){var t,i=this.getRuntime();(t=n.get(i.uid))&&(t.disabled=!!e)},destroy:function(){var t=this.getRuntime(),i=t.getShim(),o=t.getShimContainer(),s=e&&n.get(e.container),u=e&&n.get(e.browse_button);s&&r.removeAllEvents(s,this.uid),u&&(r.removeAllEvents(u,this.uid),u.style.zIndex=a),o&&(r.removeAllEvents(o,this.uid),o.innerHTML=""),i.removeInstance(this.uid),e=o=s=u=i=null}})}return e.FileInput=a}),n("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(e,t,i,n,r,o){function s(){function e(e){if(!e.dataTransfer||!e.dataTransfer.types)return!1;var t=i.toArray(e.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function s(e,i){if(u(e)){var n=new t(m,e);n.relativePath=i||"",f.push(n)}}function a(e){for(var t=[],n=0;n=")&&u.verComp(u.version,7,"<"),m="Android Browser"===u.browser,f=!1;if(p=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),h=c(),h.open(i.method,i.url,i.async,i.user,i.password),r instanceof o)r.isDetached()&&(f=!0),r=r.getSource();else if(r instanceof s){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(a,r),f=!0;else if((l||m)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(a,i,r),void 0;if(r instanceof s){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}h.upload?(i.withCredentials&&(h.withCredentials=!0),h.addEventListener("load",function(e){a.trigger(e)}),h.addEventListener("error",function(e){a.trigger(e)}),h.addEventListener("progress",function(e){a.trigger(e)}),h.upload.addEventListener("progress",function(e){a.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):h.onreadystatechange=function(){switch(h.readyState){case 1:break;case 2:break;case 3:var e,t;try{n.hasSameOrigin(i.url)&&(e=h.getResponseHeader("Content-Length")||0),h.responseText&&(t=h.responseText.length)}catch(r){e=t=0}a.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:h.onreadystatechange=function(){},0===h.status?a.trigger("error"):a.trigger("load")}},t.isEmptyObj(i.headers)||t.each(i.headers,function(e,t){h.setRequestHeader(t,e)}),""!==i.responseType&&"responseType"in h&&(h.responseType="json"!==i.responseType||u.can("return_response_type","json")?i.responseType:"text"),f?h.sendAsBinary?h.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t0&&o.set(new Uint8Array(t.slice(0,e)),0),o.set(new Uint8Array(r),e),o.set(new Uint8Array(t.slice(e+n)),e+r.byteLength),this.clear(),t=o.buffer,i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function n(t){function i(e,i,n){n=3===arguments.length?n:t.length-i-1,t=t.substr(0,i)+e+t.substr(n+i)}e.extend(this,{readByteAt:function(e){return t.charCodeAt(e)},writeByteAt:function(e,t){i(String.fromCharCode(t),e,1)},SEGMENT:function(e,n,r){switch(arguments.length){case 1:return t.substr(e);case 2:return t.substr(e,n);case 3:i(null!==r?r:"",e,n);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return e.extend(t.prototype,{littleEndian:!1,read:function(e,t){var i,n,r;if(e+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(n=this.littleEndian?0:-8*(t-1),r=0,i=0;t>r;r++)i|=this.readByteAt(e+r)<this.length())throw new Error("You are trying to write outside the source boundaries.");for(n=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(e+r,255&t>>Math.abs(n+8*r))},BYTE:function(e){return this.read(e,1)},SHORT:function(e){return this.read(e,2)},LONG:function(e){return this.read(e,4)},SLONG:function(e){var t=this.read(e,4);return t>2147483647?t-4294967296:t},CHAR:function(e){return String.fromCharCode(this.read(e,1))},STRING:function(e,t){return this.asArray("CHAR",e,t).join("")},asArray:function(e,t,i){for(var n=[],r=0;i>r;r++)n[r]=this[e](t+r);return n}}),t}),n("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,t){return function i(n){var r,o,s,a=[],u=0;if(r=new e(n),65496!==r.SHORT(0))throw r.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(o=2;o<=r.length();)if(s=r.SHORT(o),s>=65488&&65495>=s)o+=2;else{if(65498===s||65497===s)break;u=r.SHORT(o+2)+2,s>=65505&&65519>=s&&a.push({hex:s,name:"APP"+(15&s),start:o,length:u,segment:r.SEGMENT(o,u)}),o+=u}return r.clear(),{headers:a,restore:function(t){var i,n,r;for(r=new e(t),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,i=a.length;i>n;n++)r.SEGMENT(o,0,a[n].segment),o+=a[n].length;return t=r.SEGMENT(),r.clear(),t},strip:function(t){var n,r,o,s;for(o=new i(t),r=o.headers,o.purge(),n=new e(t),s=r.length;s--;)n.SEGMENT(r[s].start,r[s].length,"");return t=n.SEGMENT(),n.clear(),t},get:function(e){for(var t=[],i=0,n=a.length;n>i;i++)a[i].name===e.toUpperCase()&&t.push(a[i].segment);return t},set:function(e,t){var i,n,r,o=[];for("string"==typeof t?o.push(t):o=t,i=n=0,r=a.length;r>i&&(a[i].name===e.toUpperCase()&&(a[i].segment=o[n],a[i].length=o[n].length,n++),!(n>=o.length));i++);},purge:function(){this.headers=a=[]}}}}),n("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(e,i,n){function r(o){function s(i,r){var o,s,a,u,c,h,p,m,f=this,g=[],x={},v={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},y={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(o=f.SHORT(i),s=0;o>s;s++)if(g=[],p=i+2+12*s,a=r[f.SHORT(p)],a!==t){if(u=v[f.SHORT(p+=2)],c=f.LONG(p+=2),h=y[u],!h)throw new n.ImageError(n.ImageError.INVALID_META_ERR);if(p+=4,h*c>4&&(p=f.LONG(p)+d.tiffHeader),p+h*c>=this.length())throw new n.ImageError(n.ImageError.INVALID_META_ERR);"ASCII"!==u?(g=f.asArray(u,p,c),m=1==c?g[0]:g,x[a]=l.hasOwnProperty(a)&&"object"!=typeof m?l[a][m]:m):x[a]=e.trim(f.STRING(p,c).replace(/\0$/,""))}return x}function a(e,t,i){var n,r,o,s=0;if("string"==typeof t){var a=c[e.toLowerCase()];for(var u in a)if(a[u]===t){t=u;break}}n=d[e.toLowerCase()+"IFD"],r=this.SHORT(n);for(var l=0;r>l;l++)if(o=n+12*l+2,this.SHORT(o)==t){s=o+8;break}if(!s)return!1;try{this.write(s,i,4)}catch(h){return!1}return!0}var u,c,l,d,h,p;if(i.call(this,o),c={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},d={tiffHeader:10},h=d.tiffHeader,u={clear:this.clear},e.extend(this,{read:function(){try{return r.prototype.read.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},write:function(){try{return r.prototype.write.apply(this,arguments)}catch(e){throw new n.ImageError(n.ImageError.INVALID_META_ERR)}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(e){return this.LONG(e)/this.LONG(e+4)},SRATIONAL:function(e){return this.SLONG(e)/this.SLONG(e+4)},ASCII:function(e){return this.CHAR(e)},TIFF:function(){return p||null},EXIF:function(){var t=null;if(d.exifIFD){try{t=s.call(this,d.exifIFD,c.exif)}catch(i){return null}if(t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n=65472&&65475>=t)return n+=5,{height:e.SHORT(n),width:e.SHORT(n+=2)};i=e.SHORT(n+=2),n+=i-2}return null}function a(){var e,t,i=d.thumb();return i&&(e=new n(i),t=s(e),e.clear(),t)?(t.data=i,t):null}function u(){d&&l&&c&&(d.clear(),l.purge(),c.clear(),h=l=d=c=null)}var c,l,d,h;if(c=new n(o),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new i(o);try{d=new r(l.get("app1")[0])}catch(p){}h=s.call(this),e.extend(this,{type:"image/jpeg",size:c.length(),width:h&&h.width||0,height:h&&h.height||0,setExif:function(t,i){return d?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,i),l.set("app1",d.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):l.restore(o)},stripHeaders:function(e){return l.strip(e)},purge:function(){u.call(this)}}),d&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS(),thumb:a()})}return o}),n("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(e,t,i){function n(n){function r(){var e,t;return e=s.call(this,8),"IHDR"==e.type?(t=e.start,{width:a.LONG(t),height:a.LONG(t+=4)}):null}function o(){a&&(a.clear(),n=l=u=c=a=null)}function s(e){var t,i,n,r;return t=a.LONG(e),i=a.STRING(e+=4,4),n=e+=4,r=a.LONG(e+t),{length:t,type:i,start:n,CRC:r}}var a,u,c,l;a=new i(n),function(){var t=0,i=0,n=[35152,20039,3338,6666];for(i=0;in||n>2)&&(n=.5>n?.5:2,s=!0);var a=t(i,n);return s?e(a,o/a.width):a}function t(e,t){var i=e.width,n=e.height,r=Math.floor(i*t),o=Math.floor(n*t),s=document.createElement("canvas");return s.width=r,s.height=o,s.getContext("2d").drawImage(e,0,0,i,n,0,0,r,o),e=null,s}return{scale:e}}),n("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,s,a,u){function c(){function e(){if(!v&&!g)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return v||g}function c(){var t=e();return"canvas"==t.nodeName.toLowerCase()?t:(v=document.createElement("canvas"),v.width=t.width,v.height=t.height,v.getContext("2d").drawImage(t,0,0),v)}function l(e){return n.atob(e.substring(e.indexOf("base64,")+7))}function d(e,t){return"data:"+(t||"")+";base64,"+n.btoa(e)}function h(e){var t=this;g=new Image,g.onerror=function(){f.call(this),t.trigger("error",i.ImageError.WRONG_FORMAT)},g.onload=function(){t.trigger("load")},g.src="data:"==e.substr(0,5)?e:d(e,_.type)}function p(e,t){var n,r=this;return window.FileReader?(n=new FileReader,n.onload=function(){t.call(r,this.result)},n.onerror=function(){r.trigger("error",i.ImageError.WRONG_FORMAT)},n.readAsDataURL(e),void 0):t.call(this,e.getAsDataURL())}function m(e,i){var n=Math.PI/180,r=document.createElement("canvas"),o=r.getContext("2d"),s=e.width,a=e.height;switch(t.inArray(i,[5,6,7,8])>-1?(r.width=a,r.height=s):(r.width=s,r.height=a),i){case 2:o.translate(s,0),o.scale(-1,1);break;case 3:o.translate(s,a),o.rotate(180*n);break;case 4:o.translate(0,a),o.scale(1,-1);break;case 5:o.rotate(90*n),o.scale(1,-1);break;case 6:o.rotate(90*n),o.translate(0,-a);break;case 7:o.rotate(90*n),o.translate(s,-a),o.scale(-1,1);break;case 8:o.rotate(-90*n),o.translate(-s,0)}return o.drawImage(e,0,0,s,a),r}function f(){x&&(x.purge(),x=null),y=g=v=_=null,w=!1}var g,x,v,y,_,E=this,w=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this.getRuntime(),n=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return _=e,e.isDetached()?(y=e.getSource(),h.call(this,y),void 0):(p.call(this,e.getSource(),function(e){n&&(y=l(e)),h.call(this,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,_=new o(null,{name:e.name,size:e.size,type:e.type}),h.call(this,t?y=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t,i=this.getRuntime();return!x&&y&&i.can("access_image_binary")&&(x=new s(y)),t={width:e().width||0,height:e().height||0,type:_.type||u.getFileMime(_.name),size:y&&y.length||_.size||0,name:_.name||"",meta:null},b&&(t.meta=x&&x.meta||this.meta||{},!t.meta||!t.meta.thumb||t.meta.thumb.data instanceof r||(t.meta.thumb.data=new r(null,{type:"image/jpeg",data:t.meta.thumb.data}))),t},resize:function(t,i,n){var r=document.createElement("canvas");if(r.width=t.width,r.height=t.height,r.getContext("2d").drawImage(e(),t.x,t.y,t.width,t.height,0,0,r.width,r.height),v=a.scale(r,i),b=n.preserveHeaders,!b){var o=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1;v=m(v,o)}this.width=v.width,this.height=v.height,w=!0,this.trigger("Resize")},getAsCanvas:function(){return v||(v=c()),v.id=this.uid+"_canvas",v},getAsBlob:function(e,t){return e!==this.type?(w=!0,new o(null,{name:_.name||"",type:e,data:E.getAsDataURL(e,t)})):new o(null,{name:_.name||"",type:e,data:E.getAsBinaryString(e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!w)return g.src;if(c(),"image/jpeg"!==e)return v.toDataURL("image/png");try{return v.toDataURL("image/jpeg",t/100)}catch(i){return v.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!w)return y||(y=l(E.getAsDataURL(e,t))),y;if("image/jpeg"!==e)y=l(E.getAsDataURL(e,t));else{var i;t||(t=90),c();try{i=v.toDataURL("image/jpeg",t/100)}catch(n){i=v.toDataURL("image/jpeg")}y=l(i),x&&(y=x.stripHeaders(y),b&&(x.meta&&x.meta.exif&&x.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),y=x.writeHeaders(y)),x.purge(),x=null)}return w=!1,y},destroy:function(){E=null,f.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),n("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function s(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(e){var n=i.get(e);n&&"OBJECT"==n.nodeName&&("IE"===t.browser?(n.style.display="none",function r(){4==n.readyState?u(e):setTimeout(r,10)}()):n.parentNode.removeChild(n))}function u(e){var t=i.get(e);if(t){for(var n in t)"function"==typeof t[n]&&(t[n]=null);t.parentNode.removeChild(t)}}function c(u){var c,h=this;u=e.extend({swf_url:t.swf_url},u),o.call(this,u,l,{access_binary:function(e){return e&&"browser"===h.mode},access_image_binary:function(e){return e&&"browser"===h.mode},display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===h.mode},resize_image:o.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===h.mode},return_status_code:function(t){return"browser"===h.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:function(e){return e&&"browser"===h.mode},send_browser_cookies:function(e){return e&&"browser"===h.mode},send_custom_headers:function(e){return e&&"browser"===h.mode},send_multipart:o.capTrue,slice_blob:function(e){return e&&"browser"===h.mode},stream_upload:function(e){return e&&"browser"===h.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===h.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},slice_blob:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),s()<11.3&&(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(e,t){var i=[].slice.call(arguments,2);return h.getShim().exec(this.uid,e,t,i)},init:function(){var i,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),i=''+''+''+''+"","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=i,r=o=null):o.innerHTML=i,c=setTimeout(function(){h&&!h.initialized&&h.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){a(h.uid),e.call(h),clearTimeout(c),u=c=e=h=null}}(this.destroy)},d)}var l="flash",d={};return o.addConstructor(l,c),d}),n("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={slice:function(e,i,n,r){var o=this.getRuntime();return 0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),e=o.shimExec.call(this,"Blob","slice",i,n,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=i}),n("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){var n={init:function(e){var n=this,r=this.getRuntime();this.bind("Change",function(){var e=r.shimExec.call(n,"FileInput","getFiles");n.files=[],i.each(e,function(e){n.files.push(new t(r.uid,e))})},999),this.getRuntime().shimExec.call(this,"FileInput","init",{accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=n}),n("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n=this;return n.result="","readAsDataURL"===e&&(n.result="data:"+(t.type||"")+";base64,"),n.bind("Progress",function(t,r){r&&(n.result+=i(r,e))},999),n.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return e.FileReader=n}),n("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(e,t){function i(e,i){switch(i){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var n={read:function(e,t){var n,r=this.getRuntime();return(n=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(n="data:"+(t.type||"")+";base64,"+n),i(n,e,t.type)):null}};return e.FileReaderSync=n}),n("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(e,t){var i={getAsBlob:function(e){var i=this.getRuntime(),n=i.shimExec.call(this,"Transporter","getAsBlob",e);return n?new t(i.uid,n):null}};return e.Transporter=i}),n("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(e,t,i,n,r,o,s,a){var u={send:function(e,n){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,n)}function o(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),n=null,r()}function u(e,t){var i=new a;i.bind("TransportingComplete",function(){t(this.result)}),i.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),n instanceof s){var d;if(n.each(function(e,t){e instanceof i?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),n.hasBlob()){var h=n.getBlob();h.isDetached()?u(h,function(e){h.destroy(),o(d,e)}):o(d,h)}else n=null,r()}else n instanceof i?n.isDetached()?u(n,function(e){n.destroy(),n=e.uid,r()}):(n=n.uid,r()):r()},getResponse:function(e){var i,o,s=this.getRuntime();if(o=s.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new n(s.uid,o),"blob"===e)return o;try{if(i=new r,~t.inArray(e,["","text"]))return i.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(i.readAsText(o))}finally{o.destroy()}}return null},abort:function(){var e=this.getRuntime();e.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=u}),n("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(e,t,i,n,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(n,"Image","loadFromBlob",e.uid),n=r=null}var n=this,r=n.getRuntime();if(e.isDetached()){var o=new i;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getInfo:function(){var e=this.getRuntime(),t=e.shimExec.call(this,"Image","getInfo");return t.meta&&t.meta.thumb&&t.meta.thumb.data&&!(e.meta.thumb.data instanceof n)&&(t.meta.thumb.data=new n(e.uid,t.meta.thumb.data)),t},getAsBlob:function(e,t){var i=this.getRuntime(),r=i.shimExec.call(this,"Image","getAsBlob",e,t);return r?new n(i.uid,r):null},getAsDataURL:function(){var e,t=this.getRuntime(),i=t.Image.getAsBlob.apply(this,arguments);return i?(e=new r,e.readAsDataURL(i)):null}};return e.Image=o}),n("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(e,t,i,n,o){function s(e){var t,i,n,r,o,s=!1,a=null,u=0;try{try{a=new ActiveXObject("AgControl.AgControl"),a.IsVersionSupported(e)&&(s=!0),a=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(t=l.description,"1.0.30226.2"===t&&(t="2.0.30226.2"),i=t.split(".");i.length>3;)i.pop();for(;i.length<4;)i.push(0);for(n=e.split(".");n.length>4;)n.pop();do r=parseInt(n[u],10),o=parseInt(i[u],10),u++;while(u=r&&!isNaN(r)&&(s=!0)}}}catch(d){s=!1}return s}function a(a){var l,d=this;a=e.extend({xap_url:t.xap_url},a),o.call(this,a,u,{access_binary:o.capTrue,access_image_binary:o.capTrue,display_media:o.capTest(r("moxie/image/Image")),do_cors:o.capTrue,drag_and_drop:!1,report_upload_progress:o.capTrue,resize_image:o.capTrue,return_response_headers:function(e){return e&&"client"===d.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===d.mode||!e.arrayDiff(t,[200,404])},select_file:o.capTrue,select_multiple:o.capTrue,send_binary_string:o.capTrue,send_browser_cookies:function(e){return e&&"browser"===d.mode},send_custom_headers:function(e){return e&&"client"===d.mode},send_multipart:o.capTrue,slice_blob:o.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:o.capTrue,use_http_method:function(t){return"client"===d.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),s("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(e,t){var i=[].slice.call(arguments,2);return d.getShim().exec(this.uid,e,t,i)},init:function(){var e;e=this.getShimContainer(),e.innerHTML=''+''+''+''+''+''+"",l=setTimeout(function(){d&&!d.initialized&&d.trigger("Error",new n.RuntimeError(n.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(d),clearTimeout(l),a=l=e=d=null}}(this.destroy)},c)}var u="silverlight",c={};return o.addConstructor(u,a),c}),n("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(e,t,i){return e.Blob=t.extend({},i)}),n("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Basic"],function(e,t,i){function n(e){for(var t="",i=0;ii;i++)t=a.keys[i],s=a[t],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),r.meta[e][t]=s)}),r.meta&&r.meta.thumb&&r.meta.thumb.data&&!(e.meta.thumb.data instanceof i)&&(r.meta.thumb.data=new i(e.uid,r.meta.thumb.data))),r.width=parseInt(o.width,10),r.height=parseInt(o.height,10),r.size=parseInt(o.size,10),r.type=o.type,r.name=o.name,r},resize:function(e,t,i){this.getRuntime().shimExec.call(this,"Image","resize",e.x,e.y,e.width,e.height,t,i.preserveHeaders,i.resample)}})}),n("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(e,t,i,n){function o(t){var o=this,u=i.capTest,c=i.capTrue;i.call(this,t,s,{access_binary:u(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:u((n.can("create_canvas")||n.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:u(function(){return!("Chrome"===n.browser&&n.verComp(n.version,28,"<")||"IE"===n.browser&&n.verComp(n.version,10,"<")||"Safari"===n.browser&&n.verComp(n.version,7,"<")||"Firefox"===n.browser&&n.verComp(n.version,37,"<")) +}()),resize_image:function(){return a.Image&&o.can("access_binary")&&n.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return n.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&("Firefox"===n.browser&&n.verComp(n.version,4,">=")||"Opera"===n.browser&&n.verComp(n.version,12,">=")||"IE"===n.browser&&n.verComp(n.version,10,">=")||!!~e.inArray(n.browser,["Chrome","Safari"]))},upload_filesize:c,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(o),e=o=null}}(this.destroy)}),e.extend(this.getShim(),a)}var s="html4",a={};return i.addConstructor(s,o),a}),n("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(e,t,i,n,r,o,s){function a(){function e(){var o,c,d,h,p,m,f=this,g=f.getRuntime();m=i.guid("uid_"),o=g.getShimContainer(),a&&(d=n.get(a+"_form"),d&&i.extend(d.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",m+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),i.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=document.createElement("input"),p.setAttribute("id",m),p.setAttribute("type","file"),p.setAttribute("accept",l.join(",")),i.extend(p.style,{fontSize:"999px",opacity:0}),h.appendChild(p),o.appendChild(h),i.extend(p.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===s.browser&&s.verComp(s.version,10,"<")&&i.extend(p.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),p.onchange=function(){var i;if(this.value){if(this.files){if(i=this.files[0],0===i.size)return h.parentNode.removeChild(h),void 0}else i={name:this.value};i=new t(g.uid,i),this.onchange=function(){},e.call(f),f.files=[i],p.setAttribute("id",i.uid),h.setAttribute("id",i.uid+"_form"),f.trigger("change"),p=h=null}},g.can("summon_file_dialog")&&(c=n.get(u.browse_button),r.removeEvent(c,"click",f.uid),r.addEvent(c,"click",function(e){p&&!p.disabled&&p.click(),e.preventDefault()},f.uid)),a=m,o=d=c=null}var a,u,c,l=[];i.extend(this,{init:function(t){var i,s=this,a=s.getRuntime();u=t,l=o.extList2mimes(t.accept,a.can("filter_by_extension")),i=a.getShimContainer(),function(){var e,o,l;e=n.get(t.browse_button),c=n.getStyle(e,"z-index")||"auto",a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),s.bind("Refresh",function(){o=parseInt(c,10)||1,n.get(u.browse_button).style.zIndex=o,this.getRuntime().getShimContainer().style.zIndex=o-1})),l=a.can("summon_file_dialog")?e:i,r.addEvent(l,"mouseover",function(){s.trigger("mouseenter")},s.uid),r.addEvent(l,"mouseout",function(){s.trigger("mouseleave")},s.uid),r.addEvent(l,"mousedown",function(){s.trigger("mousedown")},s.uid),r.addEvent(n.get(t.container),"mouseup",function(){s.trigger("mouseup")},s.uid),e=null}(),e.call(this),i=null,s.trigger({type:"ready",async:!0})},setOption:function(e,t){var i,r=this.getRuntime();"accept"==e&&(l=t.mimes||o.extList2mimes(t,r.can("filter_by_extension"))),i=n.get(a),i&&i.setAttribute("accept",l.join(","))},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),i=e.getShimContainer(),o=u&&n.get(u.container),s=u&&n.get(u.browse_button);o&&r.removeAllEvents(o,this.uid),s&&(r.removeAllEvents(s,this.uid),s.style.zIndex=c),i&&(r.removeAllEvents(i,this.uid),i.innerHTML=""),t.removeInstance(this.uid),a=l=u=i=o=s=t=null}})}return e.FileInput=a}),n("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(e,t){return e.FileReader=t}),n("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(e,t,i,n,r,o,s,a){function u(){function e(e){var t,n,r,s,a=this,u=!1;if(l){if(t=l.id.replace(/_iframe$/,""),n=i.get(t+"_form")){for(r=n.getElementsByTagName("input"),s=r.length;s--;)switch(r[s].getAttribute("type")){case"hidden":r[s].parentNode.removeChild(r[s]);break;case"file":u=!0}r=[],u||n.parentNode.removeChild(n),n=null}setTimeout(function(){o.removeEvent(l,"load",a.uid),l.parentNode&&l.parentNode.removeChild(l);var t=a.getRuntime().getShimContainer();t.children.length||t.parentNode.removeChild(t),t=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,h){function p(){var i=y.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='',l=r.firstChild,i.appendChild(l),o.addEvent(l,"load",function(){var i;try{i=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?u=i.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(i.body.innerHTML),v.trigger({type:"progress",loaded:c.length,total:c.length}),x&&v.trigger({type:"uploadprogress",loaded:x.size||1025,total:x.size||1025}))}catch(r){if(!n.hasSameOrigin(d.url))return e.call(v,function(){v.trigger("error")}),void 0;u=404}e.call(v,function(){v.trigger("load")})},v.uid)}var m,f,g,x,v=this,y=v.getRuntime();if(u=c=null,h instanceof a&&h.hasBlob()){if(x=h.getBlob(),m=x.uid,g=i.get(m),f=i.get(m+"_form"),!f)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else m=t.guid("uid_"),f=document.createElement("form"),f.setAttribute("id",m+"_form"),f.setAttribute("method",d.method),f.setAttribute("enctype","multipart/form-data"),f.setAttribute("encoding","multipart/form-data"),y.getShimContainer().appendChild(f);f.setAttribute("target",m+"_iframe"),h instanceof a&&h.each(function(e,i){if(e instanceof s)g&&g.setAttribute("name",i);else{var n=document.createElement("input");t.extend(n,{type:"hidden",name:i,value:e}),g?f.insertBefore(n,g):f.appendChild(n)}}),f.setAttribute("action",d.url),p(),f.submit(),v.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),n("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(e,t){return e.Image=t}),s(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/core/utils/Mime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/FileReader","plupload","moxie/file/File","moxie/file/FileDrop","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","plupload/FileUploader","moxie/runtime/Transporter","moxie/image/Image","plupload/File","plupload/Uploader","moxie/runtime/html5/image/ResizerCanvas"])}(this)}); \ No newline at end of file