uploadcare-rails 0.6.1 → 1.0.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +1 -1
- data/Rakefile +13 -8
- data/app/assets/javascripts/uploadcare-0.17.0.js +8248 -0
- data/app/assets/javascripts/uploadcare-0.17.0.min.js +17 -0
- data/app/assets/javascripts/uploadcare.js +1 -1
- data/config/initializers/uploadcare.rb +27 -0
- data/config/uploadcare_defaults.yml +12 -0
- data/lib/generators/templates/uploadcare_config_template.yml +56 -0
- data/lib/generators/uploadcare_config_generator.rb +9 -0
- data/lib/tasks/uploadcare_rails_tasks.rake +4 -0
- data/lib/uploadcare-rails.rb +6 -2
- data/lib/uploadcare/rails/action_view_include_tags.rb +36 -0
- data/lib/uploadcare/rails/action_view_uploader_tags.rb +75 -0
- data/lib/uploadcare/rails/active_record_has_file.rb +46 -0
- data/lib/uploadcare/rails/active_record_has_group.rb +43 -0
- data/lib/uploadcare/rails/engine.rb +17 -11
- data/lib/uploadcare/rails/file.rb +17 -20
- data/lib/uploadcare/rails/group.rb +27 -0
- data/lib/uploadcare/rails/settings.rb +63 -50
- data/lib/uploadcare/rails/version.rb +1 -1
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/javascripts/post_with_collections.js +2 -0
- data/spec/dummy/app/assets/javascripts/posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/post_with_collections.css +4 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/post_with_collections_controller.rb +58 -0
- data/spec/dummy/app/controllers/posts_controller.rb +58 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/post_with_collections_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +3 -0
- data/spec/dummy/app/models/post_with_collection.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +16 -0
- data/spec/dummy/app/views/post_with_collections/_form.html.erb +25 -0
- data/spec/dummy/app/views/post_with_collections/edit.html.erb +6 -0
- data/spec/dummy/app/views/post_with_collections/index.html.erb +29 -0
- data/spec/dummy/app/views/post_with_collections/new.html.erb +5 -0
- data/spec/dummy/app/views/post_with_collections/show.html.erb +14 -0
- data/spec/dummy/app/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +37 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +15 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +61 -0
- data/spec/dummy/config/uploadcare.yml +56 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20131119080328_create_posts.rb +10 -0
- data/spec/dummy/db/migrate/20131220083857_create_post_with_collections.rb +10 -0
- data/spec/dummy/db/schema.rb +30 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +9900 -0
- data/spec/dummy/log/test.log +1976 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/65C/2B0/uc.file.123213.store +1 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1004cb216c6a15b26aa9c52095902ee6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1930f1dc4fdf14493b9e0803644ae54a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/371bf96e99717688ed7313a0c53f4212 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/510da110ae528e2d22533be39ff696c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6fc757c2c8329244ca95d6909865bbc2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/883a8569a0105010b3a20e0b3dbdf927 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/95f1667ad97500a482296c32c98e0fa0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c5ee0ee454770d592be595422c5f89b8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e41598315cab1b953e63b62bc36ee2f6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/restart.txt +0 -0
- data/spec/helpers/form_helpers_has_file_spec.rb +30 -0
- data/spec/helpers/form_helpers_has_group_spec.rb +30 -0
- data/spec/helpers/form_helpers_spec.rb +33 -0
- data/spec/helpers/include_tags_spec.rb +42 -0
- data/spec/helpers/uploader_tags_spec.rb +15 -0
- data/spec/models/file.rb +25 -0
- data/spec/models/group.rb +36 -0
- data/spec/models/has_file_spec.rb +31 -0
- data/spec/models/has_group_spec.rb +31 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/uploadcare_rails_settings_spec.rb +50 -0
- metadata +290 -51
- data/README.md +0 -104
- data/app/assets/javascripts/uploadcare-0.8.js +0 -22865
- data/lib/uploadcare/rails/action_view.rb +0 -49
- data/lib/uploadcare/rails/active_record.rb +0 -61
- data/lib/uploadcare/rails/simple_form.rb +0 -9
@@ -0,0 +1,17 @@
|
|
1
|
+
/*
|
2
|
+
* Uploadcare (0.17.0)
|
3
|
+
* Date: 2013-12-25 16:02:02 +0400
|
4
|
+
* Rev: becd92d456
|
5
|
+
*/
|
6
|
+
(function(uploadcare,SCRIPT_BASE){(function(){window.uploadcare||(window.uploadcare={});uploadcare.namespace=function(path,fn){var first,part,parts,rest,target,_i,_len;parts=path.split(".");first=parts[0];rest=parts.slice(1);if(first==="uploadcare"){target=uploadcare}else{window[first]||(window[first]={});target=window[first]}for(_i=0,_len=rest.length;_i<_len;_i++){part=rest[_i];target[part]||(target[part]={});target=target[part]}return fn(target)};uploadcare.expose=function(key,value){var last,part,parts,source,target,_i,_len;parts=key.split(".");last=parts.pop();target=window.uploadcare;source=uploadcare;for(_i=0,_len=parts.length;_i<_len;_i++){part=parts[_i];target[part]||(target[part]={});target=target[part];source=source!=null?source[part]:void 0}return target[last]=value||source[last]}}).call(this);
|
7
|
+
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
|
8
|
+
*/
|
9
|
+
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e){return this}if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n){return !n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n)){for(i in n){x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i])}}return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2]){return r.find(e)}this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++){if(null!=(o=arguments[l])){for(i in o){e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r))}}}return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body){return setTimeout(x.ready)}x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return !isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e)){return !1}try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf")){return !1}}catch(r){return !1}if(x.support.ownLast){for(n in e){return v.call(e,n)}}for(n in e){}return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e){return !1}return !0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e){return null}"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n){return null}try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++){if(r=t.apply(e[i],n),r===!1){break}}}else{for(i in e){if(r=t.apply(e[i],n),r===!1){break}}}}else{if(a){for(;o>i;i++){if(r=t.call(e[i],i,e[i]),r===!1){break}}}else{for(i in e){if(r=t.call(e[i],i,e[i]),r===!1){break}}}}return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m){return m.call(t,e,n)}for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++){if(n in t&&t[n]===e){return n}}}return -1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r){for(;r>o;o++){e[i++]=n[o]}}else{while(n[o]!==t){e[i++]=n[o++]}}return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++){r=!!t(e[o],o),n!==r&&i.push(e[o])}return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a){for(;o>i;i++){r=t(e[i],i,n),null!=r&&(s[s.length]=r)}}else{for(i in e){r=t(e[i],i,n),null!=r&&(s[s.length]=r)}}return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r){x.access(e,n,l,r[l],!0,a,s)}}else{if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n)){for(;u>l;l++){n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)))}}}return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t){a[o]=e.style[o],e.style[o]=t[o]}i=n.apply(e,r||[]);for(o in t){e.style[o]=a[o]}return i}}),x.ready.promise=function(t){if(!n){if(n=x.Deferred(),"complete"===a.readyState){setTimeout(x.ready)}else{if(a.addEventListener){a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1)}else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}}}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++){if(this[t]===e){return t}}return -1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]){}e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e){return n}if(1!==(l=t.nodeType)&&9!==l){return[]}if(h&&!i){if(o=Z.exec(e)){if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode){return n}if(a.id===s){return n.push(a),n}}else{if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s){return n.push(a),n}}}else{if(o[2]){return M.apply(n,t.getElementsByTagName(e)),n}if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName){return M.apply(n,t.getElementsByClassName(s)),n}}}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--){c[u]=m+yt(c[u])}y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x){try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return !!e(t)}catch(n){return !1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--){o.attrHandle[n[r]]=t}}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r){return r}if(n){while(n=n.nextSibling){if(n===t){return -1}}}return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--){n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++]){1===n.nodeType&&r.push(n)}return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t){while(t=t.parentNode){if(t===e){return !0}}}return !1},A=d.compareDocumentPosition?function(e,t){if(e===t){return S=!0,0}var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t){return S=!0,0}if(!o||!a){return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0}if(o===a){return pt(e,t)}r=e;while(r=r.parentNode){s.unshift(r)}r=t;while(r=r.parentNode){l.unshift(r)}while(s[i]===l[i]){i++}return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t))){try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType){return n}}catch(i){}}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++]){t===e[o]&&(i=n.push(o))}while(i--){e.splice(n[i],1)}}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent){return e.textContent}for(e=e.firstChild;e;e=e.nextSibling){n+=a(e)}}else{if(3===i||4===i){return e.nodeValue}}}else{for(;t=e[r];r++){n+=a(t)}}return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return !0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return !!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g]){if(s?p.nodeName.toLowerCase()===y:1===p.nodeType){return !1}}h=g="only"===e&&!h&&"nextSibling"}return !0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop()){if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}}else{if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T){f=u[1]}else{while(p=++d&&p&&p[g]||(f=d=0)||h.pop()){if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t)){break}}}}return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--){i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--){(o=a[s])&&(e[s]=!(t[s]=o))}}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do{if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-")}}while((t=t.parentNode)&&1===t.nodeType);return !1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType){return !1}}return !0},parent:function(e){return !o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2){e.push(n)}return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2){e.push(n)}return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;){e.push(r)}return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;){e.push(r)}return e})}},o.pseudos.nth=o.pseudos.eq;for(n in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0}){o.pseudos[n]=ft(n)}for(n in {submit:!0,reset:!0}){o.pseudos[n]=dt(n)}function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c){return t?0:c.slice(0)}s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter){!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length))}if(!n){break}}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++){r+=e[t].value}return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r]){if(1===t.nodeType||o){return e(t,n,i)}}}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r]){if((1===t.nodeType||o)&&e(t,n,s)){return !0}}}else{while(t=t[r]){if(1===t.nodeType||o){if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i){return l===!0}}else{if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0){return !0}}}}}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--){if(!e[i](t,n,r)){return !1}}return !0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++){(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s))}return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--){(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}}if(o){if(i||e){if(i){u=[],c=y.length;while(c--){(p=y[c])&&u.push(m[c]=p)}i(null,y=[],u,l)}c=y.length;while(c--){(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}}else{y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)}})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return !a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++){if(n=o.relative[e[l].type]){f=[vt(bt(f),n)]}else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++){if(o.relative[e[r].type]){break}}return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||0.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++]){if(m(h,l,c)){p.push(h);break}}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++]){m(x,y,l,c)}if(s){if(v>0){while(b--){x[b]||y[b]||(y[b]=q.call(p))}}y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--){o=Tt(t[n]),o[b]?r.push(o):i.push(o)}o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++){at(e,t[r],n)}return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t){return n}e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type]){break}if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e){return M.apply(n,i),n}break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++){if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1){l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return !l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return !u},fireWith:function(e,t){return !l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return !!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1){for(s=Array(r),l=Array(r),u=Array(r);r>t;t++){n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i}}return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length){return t}s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in {submit:!0,change:!0,focusin:!0}){d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1}d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t)){break}return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n){return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--){delete r[t[i]]}if(n?!I(r):!x.isEmptyObject(r)){return}}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType){return !1}var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return !t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++){i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]))}x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else{r=t}}return r}function I(e){var t;for(t in e){if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t){return !1}}return !0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--){r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l))}return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e)){return this.each(function(t){x(this).addClass(e.call(this,t,this.className))})}if(l){for(t=(e||"").match(T)||[];s>a;a++){if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++]){0>r.indexOf(" "+i+" ")&&(r+=i+" ")}n.className=x.trim(r)}}}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e)){return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))})}if(l){for(t=(e||"").match(T)||[];s>a;a++){if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++]){while(r.indexOf(" "+i+" ")>=0){r=r.replace(" "+i+" "," ")}}n.className=e?x.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++]){o.hasClass(t)?o.removeClass(t):o.addClass(t)}}else{(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")}})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++){if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0){return !0}}return !1},val:function(e){var n,r,i,o=this[0];if(arguments.length){return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set" in r&&r.set(this,o,"value")!==t||(this.value=o))})}if(o){return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get" in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++){if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o){return t}a.push(t)}}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--){r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0)}return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s){return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get" in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set" in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType){while(n=o[i++]){r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)}}},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s){return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set" in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get" in o&&null!==(i=o.get(e,n))?i:e[n]}},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return !0}function ot(){return !1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--){s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0)}e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--){if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--){a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a))}l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else{for(d in c){x.event.remove(e,d+t[u],n,r,!0)}}}x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode){h.push(u),f=u}f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped()){n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault()}if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped()){(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type)){for(;u!=this;u=u.parentNode||this){if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++){i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i)}o.length&&s.push({elem:u,handlers:o})}}}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando]){return e}var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--){n=r[t],e[n]=o[n]}return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus){try{return this.focus(),!1}catch(e){}}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e){this.on(a,n,r,e[a],o)}return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1){i=ot}else{if(!i){return this}}return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj){return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this}if("object"==typeof e){for(o in e){this.off(o,n,e[o])}return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e){return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++){if(x.contains(r[t],this)){return !0}}}))}for(t=0;i>t;t++){x.find(e,r[t],n)}return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++){if(x.contains(this,n[t])){return !0}}})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return !!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++){for(n=this[r];n&&n!==t;n=n.parentNode){if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}}}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do{e=e[t]}while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r))){1===o.nodeType&&i.push(o),o=o[n]}return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling){1===e.nodeType&&e!==t&&n.push(e)}return n}});function ft(e,t,n){if(x.isFunction(t)){return x.grep(e,function(e,r){return !!t.call(e,r,e)!==n})}if(t.nodeType){return x.grep(e,function(e){return e===t!==n})}if("string"==typeof t){if(st.test(t)){return x.filter(t,e,n)}t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement){while(t.length){n.createElement(t.pop())}}return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++){t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n))}return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild){e.removeChild(e.firstChild)}e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t){return 1===n.nodeType?n.innerHTML.replace(gt,""):t}if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++){n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e)}n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h)){return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)})}if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++){i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u)}if(o){for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++){i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")))}}l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++){x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s){for(r=0,i=s[n].length;i>r;r++){x.event.add(t,n,s[n][r])}}}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events){x.removeEvent(t,r,i.handle)}t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++){n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get())}return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s){for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++){!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n))}}return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e))){for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a){r[a]&&Ot(i,r[a])}}if(t){if(n){for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++){Mt(i,r[a])}}else{Mt(e,o)}}return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++){if(o=e[h],o||0===o){if("object"===x.type(o)){x.merge(d,o.nodeType?[o]:o)}else{if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--){s=s.lastChild}if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--){x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild){s.removeChild(s.firstChild)}s=f.lastChild}else{d.push(t.createTextNode(o))}}}}s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++]){if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++]){kt.test(o.type||"")&&n.push(o)}}}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++){if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events){for(r in a.events){f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle)}}u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e)){return this.each(function(t){x(this).wrapAll(e.call(this,t))})}if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType){e=e.firstChild}return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e){return t}var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--){if(t=en[i]+n,t in e){return t}}return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++){r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))))}for(a=0;s>a;a++){r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"))}return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++){a[n[s]]=x.css(e,n[s],!1,o)}return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t){return s&&"get" in s&&(o=s.get(e,!1,i))!==t?o:u[n]}if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set" in s&&(r=s.set(e,r,i))===t))){try{u[n]=r}catch(c){}}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get" in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2){"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)))}return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i)){return i}r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?0.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return !x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++){i[e+Zt[r]+t]=o[r]||o[r-2]||o[0]}return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e)){x.each(e,function(){o(this.name,this.value)})}else{for(r in e){gn(r,e[r],n,o)}}return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t)){x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)})}else{if(n||"object"!==x.type(t)){r(e,t)}else{for(i in t){gn(e+"["+i+"]",t[i],n,r)}}}}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n)){while(r=o[i++]){"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n){n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i])}return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn){return Sn.apply(this,arguments)}var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a)){c[t[1].toLowerCase()]=t[2]}}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e){if(2>b){for(t in e){m[t]=[m[t],e[t]]}}else{C.always(e[C.status])}}return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b){return C}l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers){C.setRequestHeader(i,p.headers[i])}if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b)){return C.abort()}w="abort";for(i in {success:1,error:1,complete:1}){C[i](p[i])}if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b)){throw N}k(-1,N)}}else{k(-1,"No Transport")}function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0]){u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"))}if(o){for(s in l){if(l[s]&&l[s].test(o)){u.unshift(s);break}}}if(u[0] in r){a=u[0]}else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1]){for(a in e.converters){u[a.toLowerCase()]=e.converters[a]}}o=c.shift();while(o){if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift()){if("*"===o){o=l}else{if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a){for(i in u){if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}}}if(a!==!0){if(a&&e["throws"]){t=a(t)}else{try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}}}}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn){Pn[e](t,!0)}};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return !this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials" in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields){for(s in n.xhrFields){l[s]=n.xhrFields[s]}}n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i){l.setRequestHeader(s,i[s])}}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState)){if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i){4!==l.readyState&&l.abort()}else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do{s=s||".5",a/=s,x.style(n.elem,e,a+o)}while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++){if(r=i[o].call(n,t,e)){return r}}}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i){return !1}var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++){u.tweens[a].run(o)}return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i){return this}for(i=!0;r>n;n++){u.tweens[n].run(1)}return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++){if(r=Gn[o].call(u,e,c,u.opts)){return r}}return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e){if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand" in a){o=a.expand(o),delete e[r];for(n in o){n in e||(e[n]=o[n],t[n]=i)}}else{t[r]=i}}}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++){n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)}},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height" in t||"width" in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show")){continue}c[r]=d&&d[r]||x.style(e,r)}}if(!x.isEmptyObject(c)){d?"hidden" in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c){x.style(e,t,c[t])}});for(r in c){a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n){a[n]&&a[n].stop&&i(a[n])}else{for(n in a){a[n]&&a[n].stop&&Jn.test(n)&&i(a[n])}}for(n=o.length;n--;){o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1))}(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;){o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1))}for(t=0;a>t;t++){r[t]&&r[t].finish&&r[t].finish.call(this)}delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t){n=Zt[i],r["margin"+n]=r["padding"+n]=e}return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return 0.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++){e=n[r],e()||n[r]!==e||n.splice(r--,1)}n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length){return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)})}var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s){return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o}},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using" in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position")){e=e.offsetParent}return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);!function($){function rewriteSelector(context,name,argPos){var original=context[name];if(!original){return}context[name]=function(){arguments[argPos]=arguments[argPos].replace(/@([\w\u00c0-\uFFFF\-]+)/g,'[role~="$1"]');return original.apply(context,arguments)};$.extend(context[name],original)}rewriteSelector($,"find",0);rewriteSelector($,"multiFilter",0);rewriteSelector($.find,"matchesSelector",1);rewriteSelector($.find,"matches",0);function parse(roleString,without){var role,result=[],roles=$.trim(roleString).split(/\s+/);for(var i=0;i<roles.length;i++){role=roles[i];if(!~$.inArray(role,result)&&(!without||!~$.inArray(role,without))){result.push(role)}}return result}$.extend($.fn,{roles:function(){return parse(this.attr("role"))},hasRole:function(roleName){var roles=parse(roleName);for(var i=0;i<roles.length;i++){if(!this.is("@"+roles[i])){return false}}return true},addRole:function(roleName){if(this.hasRole(roleName)){return this}return this.each(function(_,element){var $el=$(element);$el.attr("role",parse($el.attr("role")+" "+roleName).join(" "))})},removeRole:function(roleName){if(!this.hasRole(roleName)){return this}return this.each(function(_,element){var $el=$(element);$el.attr("role",parse($el.attr("role"),parse(roleName)).join(" "))})},toggleRole:function(roleName){var roles=parse(roleName);for(var i=0;i<roles.length;i++){this[this.hasRole(roles[i])?"removeRole":"addRole"].call(this,roles[i])}return this}})}(jQuery);if(window.XDomainRequest){jQuery.ajaxTransport(function(s){if(s.crossDomain&&s.async){if(s.timeout){s.xdrTimeout=s.timeout;delete s.timeout}var xdr;return{send:function(_,complete){function callback(status,statusText,responses,responseHeaders){xdr.onload=xdr.onerror=xdr.ontimeout=jQuery.noop;xdr=undefined;complete(status,statusText,responses,responseHeaders)}xdr=new XDomainRequest();xdr.onload=function(){callback(200,"OK",{text:xdr.responseText},"Content-Type: "+xdr.contentType)};xdr.onerror=function(){callback(404,"Not Found")};xdr.onprogress=function(){};xdr.ontimeout=function(){callback(0,"timeout")};xdr.timeout=s.xdrTimeout||Number.MAX_VALUE;xdr.open(s.type,s.url.replace(/^https?:/,""));xdr.send((s.hasContent&&s.data)||null)},abort:function(){if(xdr){xdr.onerror=jQuery.noop;xdr.abort()}}}}})}(function($){function nearestFinder(targets){this.targets=targets;this.last=null;this.update()}nearestFinder.prototype={update:function(){var rows={};this.targets.each(function(i){var offset=$(this).offset();if(!(offset.top in rows)){rows[offset.top]=[]}rows[offset.top].push([offset.left+this.offsetWidth/2,this])});this.rows=rows},find:function(x,y){var minDistance=Infinity;var rows=this.rows;var nearestRow,top,nearest;for(top in rows){var distance=Math.abs(top-y);if(distance<minDistance){minDistance=distance;nearestRow=rows[top]}}minDistance=Math.abs(nearestRow[0][0]-x);nearest=nearestRow[0][1];for(var i=1;i<nearestRow.length;i++){var distance=Math.abs(nearestRow[i][0]-x);if(distance<minDistance){minDistance=distance;nearest=nearestRow[i][1]}}return nearest},findNotLast:function(x,y){var nearest=this.find(x,y);if(this.last&&nearest&&this.last==nearest){return null}return this.last=nearest}};$.fn.extend({moveable:function(o){o=$.extend({distance:4,anyButton:false,axis:false,zIndex:1000,start:$.noop,move:$.noop,finish:$.noop,items:null,keepFake:false},o);function fixTouch(e){var touch,s;s=e.originalEvent.touches;if(s&&s.length){touch=s[0]}else{s=e.originalEvent.changedTouches;if(s&&s.length){touch=s[0]}else{return}}e.pageX=touch.pageX;e.pageY=touch.pageY;e.which=1}this.on("mousedown.moveable touchstart.movable",o.items,null,function(eDown){fixTouch(eDown);if(!o.anyButton&&eDown.which!=1){return}eDown.preventDefault();var dragged=false;var $dragged=$(this);var $fake=false;var originalPos=$dragged.position();originalPos.top+=$dragged.offsetParent().scrollTop();originalPos.left+=$dragged.offsetParent().scrollLeft();$(document).on("mousemove.moveable touchmove.movable",function(eMove){fixTouch(eMove);if(!dragged&&(Math.abs(eMove.pageX-eDown.pageX)>o.distance||Math.abs(eMove.pageY-eDown.pageY)>o.distance)){dragged=true;$fake=$dragged.clone().css({position:"absolute",zIndex:o.zIndex,width:$dragged.width()}).appendTo($dragged.offsetParent());o.start({event:eMove,dragged:$dragged,fake:$fake})}if(!dragged){return}eMove.preventDefault();var dx=o.axis=="y"?0:eMove.pageX-eDown.pageX;var dy=o.axis=="x"?0:eMove.pageY-eDown.pageY;$fake.css({left:dx+originalPos.left,top:dy+originalPos.top});o.move({event:eMove,dragged:$dragged,fake:$fake,dx:dx,dy:dy})});$(document).on("mouseup.moveable touchend.movable touchcancel.movable touchleave.movable",function(eUp){fixTouch(eUp);$(document).off("mousemove.moveable touchmove.movable");$(document).off("mouseup.moveable touchend.movable touchcancel.movable touchleave.movable");if(!dragged){return}eUp.preventDefault();var dx=eUp.pageX-eDown.pageX;var dy=eUp.pageY-eDown.pageY;dragged=false;o.finish({event:eUp,dragged:$dragged,fake:$fake,dx:dx,dy:dy});if(!o.keepFake){$fake.remove()}})})},sortable:function(o){var oMovable=$.extend({items:">*"},o);var o=$.extend({checkBounds:function(){return true},start:$.noop,attach:$.noop,move:$.noop,finish:$.noop},o);var finder;var initialNext=false;var parent=this;oMovable.start=function(info){o.start(info);finder=new nearestFinder(parent.find(oMovable.items));initialNext=info.dragged.next()};oMovable.move=function(info){info.nearest=null;if(o.checkBounds(info)){var offset=info.fake.offset();var nearest=finder.findNotLast(offset.left+info.dragged.width()/2,offset.top);info.nearest=$(nearest);if(nearest&&nearest!=info.dragged[0]){if(info.dragged.nextAll().filter(nearest).length>0){info.dragged.insertAfter(nearest)}else{info.dragged.insertBefore(nearest)}o.attach(info);finder.last=null;finder.update()}}else{if(finder.last!==null){finder.last=null;if(initialNext.length){info.dragged.insertBefore(initialNext)}else{info.dragged.parent().append(info.dragged)}o.attach(info);finder.update()}}o.move(info)};oMovable.finish=function(info){var offset=info.fake.offset();info.nearest=null;if(o.checkBounds(info)){info.nearest=$(finder.find(offset.left+info.dragged.width()/2,offset.top))}o.finish(info);finder=null};return this.moveable(oMovable)}})})(jQuery);(function(){uploadcare.jQuery=jQuery;jQuery.noConflict(true)}).call(this);
|
10
|
+
/*!
|
11
|
+
* Pusher JavaScript Library v1.12.2
|
12
|
+
* http://pusherapp.com/
|
13
|
+
*
|
14
|
+
* Copyright 2011, Pusher
|
15
|
+
* Released under the MIT licence.
|
16
|
+
*/
|
17
|
+
(function(){if(Function.prototype.scopedTo===undefined){Function.prototype.scopedTo=function(context,args){var f=this;return function(){return f.apply(context,Array.prototype.slice.call(args||[]).concat(Array.prototype.slice.call(arguments)))}}}var Pusher=function(app_key,options){this.options=options||{};this.key=app_key;this.channels=new Pusher.Channels();this.global_emitter=new Pusher.EventsDispatcher();var self=this;this.checkAppKey();this.connection=new Pusher.Connection(this.key,this.options);this.connection.bind("connected",function(){self.subscribeAll()}).bind("message",function(params){var internal=(params.event.indexOf("pusher_internal:")===0);if(params.channel){var channel;if(channel=self.channel(params.channel)){channel.emit(params.event,params.data)}}if(!internal){self.global_emitter.emit(params.event,params.data)}}).bind("disconnected",function(){self.channels.disconnect()}).bind("error",function(err){Pusher.warn("Error",err)});Pusher.instances.push(this);if(Pusher.isReady){self.connect()}};Pusher.instances=[];Pusher.prototype={channel:function(name){return this.channels.find(name)},connect:function(){this.connection.connect()},disconnect:function(){this.connection.disconnect()},bind:function(event_name,callback){this.global_emitter.bind(event_name,callback);return this},bind_all:function(callback){this.global_emitter.bind_all(callback);return this},subscribeAll:function(){var channel;for(channelName in this.channels.channels){if(this.channels.channels.hasOwnProperty(channelName)){this.subscribe(channelName)}}},subscribe:function(channel_name){var self=this;var channel=this.channels.add(channel_name,this);if(this.connection.state==="connected"){channel.authorize(this.connection.socket_id,this.options,function(err,data){if(err){channel.emit("pusher:subscription_error",data)}else{self.send_event("pusher:subscribe",{channel:channel_name,auth:data.auth,channel_data:data.channel_data})}})}return channel},unsubscribe:function(channel_name){this.channels.remove(channel_name);if(this.connection.state==="connected"){this.send_event("pusher:unsubscribe",{channel:channel_name})}},send_event:function(event_name,data,channel){return this.connection.send_event(event_name,data,channel)},checkAppKey:function(){if(this.key===null||this.key===undefined){Pusher.warn("Warning","You must pass your app key when you instantiate Pusher.")}}};Pusher.Util={extend:function extend(target,extensions){for(var property in extensions){if(extensions[property]&&extensions[property].constructor&&extensions[property].constructor===Object){target[property]=extend(target[property]||{},extensions[property])}else{target[property]=extensions[property]}}return target},stringify:function stringify(){var m=["Pusher"];for(var i=0;i<arguments.length;i++){if(typeof arguments[i]==="string"){m.push(arguments[i])}else{if(window.JSON==undefined){m.push(arguments[i].toString())}else{m.push(JSON.stringify(arguments[i]))}}}return m.join(" : ")},arrayIndexOf:function(array,item){var nativeIndexOf=Array.prototype.indexOf;if(array==null){return -1}if(nativeIndexOf&&array.indexOf===nativeIndexOf){return array.indexOf(item)}for(i=0,l=array.length;i<l;i++){if(array[i]===item){return i}}return -1}};Pusher.debug=function(){if(!Pusher.log){return}Pusher.log(Pusher.Util.stringify.apply(this,arguments))};Pusher.warn=function(){if(window.console&&window.console.warn){window.console.warn(Pusher.Util.stringify.apply(this,arguments))}else{if(!Pusher.log){return}Pusher.log(Pusher.Util.stringify.apply(this,arguments))}};Pusher.VERSION="1.12.2";Pusher.host="ws.pusherapp.com";Pusher.ws_port=80;Pusher.wss_port=443;Pusher.channel_auth_endpoint="/pusher/auth";Pusher.cdn_http="http://js.pusher.com/";Pusher.cdn_https="https://d3dy5gmtp8yhk7.cloudfront.net/";Pusher.dependency_suffix=".min";Pusher.channel_auth_transport="ajax";Pusher.activity_timeout=120000;Pusher.pong_timeout=30000;Pusher.isReady=false;Pusher.ready=function(){Pusher.isReady=true;for(var i=0,l=Pusher.instances.length;i<l;i++){Pusher.instances[i].connect()}};this.Pusher=Pusher}).call(this);(function(){function CallbackRegistry(){this._callbacks={}}CallbackRegistry.prototype.get=function(eventName){return this._callbacks[this._prefix(eventName)]};CallbackRegistry.prototype.add=function(eventName,callback){var prefixedEventName=this._prefix(eventName);this._callbacks[prefixedEventName]=this._callbacks[prefixedEventName]||[];this._callbacks[prefixedEventName].push(callback)};CallbackRegistry.prototype.remove=function(eventName,callback){if(this.get(eventName)){var index=Pusher.Util.arrayIndexOf(this.get(eventName),callback);this._callbacks[this._prefix(eventName)].splice(index,1)}};CallbackRegistry.prototype._prefix=function(eventName){return"_"+eventName};function EventsDispatcher(failThrough){this.callbacks=new CallbackRegistry();this.global_callbacks=[];this.failThrough=failThrough}EventsDispatcher.prototype.bind=function(eventName,callback){this.callbacks.add(eventName,callback);return this};EventsDispatcher.prototype.unbind=function(eventName,callback){this.callbacks.remove(eventName,callback);return this};EventsDispatcher.prototype.emit=function(eventName,data){for(var i=0;i<this.global_callbacks.length;i++){this.global_callbacks[i](eventName,data)}var callbacks=this.callbacks.get(eventName);if(callbacks){for(var i=0;i<callbacks.length;i++){callbacks[i](data)}}else{if(this.failThrough){this.failThrough(eventName,data)}}return this};EventsDispatcher.prototype.bind_all=function(callback){this.global_callbacks.push(callback);return this};this.Pusher.EventsDispatcher=EventsDispatcher}).call(this);(function(){var Pusher=this.Pusher;function capitalize(str){return str.substr(0,1).toUpperCase()+str.substr(1)}function safeCall(method,obj,data){if(obj[method]!==undefined){obj[method](data)}}function Machine(initialState,transitions,stateActions){Pusher.EventsDispatcher.call(this);this.state=undefined;this.errors=[];this.stateActions=stateActions;this.transitions=transitions;this.transition(initialState)}Machine.prototype.transition=function(nextState,data){var prevState=this.state;var stateCallbacks=this.stateActions;if(prevState&&(Pusher.Util.arrayIndexOf(this.transitions[prevState],nextState)==-1)){this.emit("invalid_transition_attempt",{oldState:prevState,newState:nextState});throw new Error("Invalid transition ["+prevState+" to "+nextState+"]")}safeCall(prevState+"Exit",stateCallbacks,data);safeCall(prevState+"To"+capitalize(nextState),stateCallbacks,data);safeCall(nextState+"Pre",stateCallbacks,data);this.state=nextState;this.emit("state_change",{oldState:prevState,newState:nextState});safeCall(nextState+"Post",stateCallbacks,data)};Machine.prototype.is=function(state){return this.state===state};Machine.prototype.isNot=function(state){return this.state!==state};Pusher.Util.extend(Machine.prototype,Pusher.EventsDispatcher.prototype);this.Pusher.Machine=Machine}).call(this);(function(){var NetInfo=function(){var self=this;Pusher.EventsDispatcher.call(this);if(window.addEventListener!==undefined){window.addEventListener("online",function(){self.emit("online",null)},false);window.addEventListener("offline",function(){self.emit("offline",null)},false)}};NetInfo.prototype.isOnLine=function(){if(window.navigator.onLine===undefined){return true}else{return window.navigator.onLine}};Pusher.Util.extend(NetInfo.prototype,Pusher.EventsDispatcher.prototype);this.Pusher.NetInfo=NetInfo}).call(this);(function(){var Pusher=this.Pusher;var machineTransitions={initialized:["waiting","failed"],waiting:["connecting","permanentlyClosed"],connecting:["open","permanentlyClosing","impermanentlyClosing","waiting"],open:["connected","permanentlyClosing","impermanentlyClosing","waiting"],connected:["permanentlyClosing","waiting"],impermanentlyClosing:["waiting","permanentlyClosing"],permanentlyClosing:["permanentlyClosed"],permanentlyClosed:["waiting","failed"],failed:["permanentlyClosed"]};var UNSUCCESSFUL_CONNECTION_ATTEMPT_ADDITIONAL_WAIT=2000;var UNSUCCESSFUL_OPEN_ATTEMPT_ADDITIONAL_TIMEOUT=2000;var UNSUCCESSFUL_CONNECTED_ATTEMPT_ADDITIONAL_TIMEOUT=2000;var MAX_CONNECTION_ATTEMPT_WAIT=5*UNSUCCESSFUL_CONNECTION_ATTEMPT_ADDITIONAL_WAIT;var MAX_OPEN_ATTEMPT_TIMEOUT=5*UNSUCCESSFUL_OPEN_ATTEMPT_ADDITIONAL_TIMEOUT;var MAX_CONNECTED_ATTEMPT_TIMEOUT=5*UNSUCCESSFUL_CONNECTED_ATTEMPT_ADDITIONAL_TIMEOUT;function resetConnectionParameters(connection){connection.connectionWait=0;if(Pusher.TransportType==="flash"){connection.openTimeout=5000}else{connection.openTimeout=2000}connection.connectedTimeout=2000;connection.connectionSecure=connection.compulsorySecure;connection.connectionAttempts=0}function Connection(key,options){var self=this;Pusher.EventsDispatcher.call(this);this.options=Pusher.Util.extend({encrypted:false},options);this.netInfo=new Pusher.NetInfo();this.netInfo.bind("online",function(){if(self._machine.is("waiting")){self._machine.transition("connecting");updateState("connecting")}});this.netInfo.bind("offline",function(){if(self._machine.is("connected")){self.socket.onclose=undefined;self.socket.onmessage=undefined;self.socket.onerror=undefined;self.socket.onopen=undefined;self.socket.close();self.socket=undefined;self._machine.transition("waiting")}});this._machine=new Pusher.Machine("initialized",machineTransitions,{initializedPre:function(){self.compulsorySecure=self.options.encrypted;self.key=key;self.socket=null;self.socket_id=null;self.state="initialized"},waitingPre:function(){if(self.connectionWait>0){self.emit("connecting_in",self.connectionWait)}if(self.netInfo.isOnLine()&&self.connectionAttempts<=4){updateState("connecting")}else{updateState("unavailable")}if(self.netInfo.isOnLine()){self._waitingTimer=setTimeout(function(){self._machine.transition("connecting")},connectionDelay())}},waitingExit:function(){clearTimeout(self._waitingTimer)},connectingPre:function(){if(self.netInfo.isOnLine()===false){self._machine.transition("waiting");updateState("unavailable");return}var url=formatURL(self.key,self.connectionSecure);Pusher.debug("Connecting",url);self.socket=new Pusher.Transport(url);self.socket.onopen=ws_onopen;self.socket.onclose=transitionToWaiting;self.socket.onerror=ws_onError;self._connectingTimer=setTimeout(TransitionToImpermanentlyClosing,self.openTimeout)},connectingExit:function(){clearTimeout(self._connectingTimer);self.socket.onopen=undefined},connectingToWaiting:function(){updateConnectionParameters()},connectingToImpermanentlyClosing:function(){updateConnectionParameters()},openPre:function(){self.socket.onmessage=ws_onMessageOpen;self.socket.onerror=ws_onError;self.socket.onclose=transitionToWaiting;self._openTimer=setTimeout(TransitionToImpermanentlyClosing,self.connectedTimeout)},openExit:function(){clearTimeout(self._openTimer);self.socket.onmessage=undefined},openToWaiting:function(){updateConnectionParameters()},openToImpermanentlyClosing:function(){updateConnectionParameters()},connectedPre:function(socket_id){self.socket_id=socket_id;self.socket.onmessage=ws_onMessageConnected;self.socket.onerror=ws_onError;self.socket.onclose=transitionToWaiting;resetConnectionParameters(self);self.connectedAt=new Date().getTime();resetActivityCheck()},connectedPost:function(){updateState("connected")},connectedExit:function(){stopActivityCheck();updateState("disconnected")},impermanentlyClosingPost:function(){if(self.socket){self.socket.onclose=transitionToWaiting;self.socket.close()}},permanentlyClosingPost:function(){if(self.socket){self.socket.onclose=function(){resetConnectionParameters(self);self._machine.transition("permanentlyClosed")};self.socket.close()}else{resetConnectionParameters(self);self._machine.transition("permanentlyClosed")}},failedPre:function(){updateState("failed");Pusher.debug("WebSockets are not available in this browser.")},permanentlyClosedPost:function(){updateState("disconnected")}});function updateConnectionParameters(){if(self.connectionWait<MAX_CONNECTION_ATTEMPT_WAIT){self.connectionWait+=UNSUCCESSFUL_CONNECTION_ATTEMPT_ADDITIONAL_WAIT}if(self.openTimeout<MAX_OPEN_ATTEMPT_TIMEOUT){self.openTimeout+=UNSUCCESSFUL_OPEN_ATTEMPT_ADDITIONAL_TIMEOUT}if(self.connectedTimeout<MAX_CONNECTED_ATTEMPT_TIMEOUT){self.connectedTimeout+=UNSUCCESSFUL_CONNECTED_ATTEMPT_ADDITIONAL_TIMEOUT}if(self.compulsorySecure!==true){self.connectionSecure=!self.connectionSecure}self.connectionAttempts++}function formatURL(key,isSecure){var port=Pusher.ws_port;var protocol="ws://";if(isSecure||document.location.protocol==="https:"){port=Pusher.wss_port;protocol="wss://"}var flash=(Pusher.TransportType==="flash")?"true":"false";return protocol+Pusher.host+":"+port+"/app/"+key+"?protocol=5&client=js&version="+Pusher.VERSION+"&flash="+flash}function TransitionToImpermanentlyClosing(){self._machine.transition("impermanentlyClosing")}function resetActivityCheck(){if(self._activityTimer){clearTimeout(self._activityTimer)}self._activityTimer=setTimeout(function(){self.send_event("pusher:ping",{});self._activityTimer=setTimeout(function(){self.socket.close()},(self.options.pong_timeout||Pusher.pong_timeout))},(self.options.activity_timeout||Pusher.activity_timeout))}function stopActivityCheck(){if(self._activityTimer){clearTimeout(self._activityTimer)}}function connectionDelay(){var delay=self.connectionWait;if(delay===0){if(self.connectedAt){var t=1000;var connectedFor=new Date().getTime()-self.connectedAt;if(connectedFor<t){delay=t-connectedFor}}}return delay}function ws_onopen(){self._machine.transition("open")}function handleCloseCode(code,message){self.emit("error",{type:"PusherError",data:{code:code,message:message}});if(code===4000){self.compulsorySecure=true;self.connectionSecure=true;self.options.encrypted=true;TransitionToImpermanentlyClosing()}else{if(code<4100){self._machine.transition("permanentlyClosing")}else{if(code<4200){self.connectionWait=1000;self._machine.transition("waiting")}else{if(code<4300){TransitionToImpermanentlyClosing()}else{self._machine.transition("permanentlyClosing")}}}}}function ws_onMessageOpen(event){var params=parseWebSocketEvent(event);if(params!==undefined){if(params.event==="pusher:connection_established"){self._machine.transition("connected",params.data.socket_id)}else{if(params.event==="pusher:error"){handleCloseCode(params.data.code,params.data.message)}}}}function ws_onMessageConnected(event){resetActivityCheck();var params=parseWebSocketEvent(event);if(params!==undefined){Pusher.debug("Event recd",params);switch(params.event){case"pusher:error":self.emit("error",{type:"PusherError",data:params.data});break;case"pusher:ping":self.send_event("pusher:pong",{});break}self.emit("message",params)}}function parseWebSocketEvent(event){try{var params=JSON.parse(event.data);if(typeof params.data==="string"){try{params.data=JSON.parse(params.data)}catch(e){if(!(e instanceof SyntaxError)){throw e}}}return params}catch(e){self.emit("error",{type:"MessageParseError",error:e,data:event.data})}}function transitionToWaiting(){self._machine.transition("waiting")}function ws_onError(error){self.emit("error",{type:"WebSocketError",error:error})}function updateState(newState,data){var prevState=self.state;self.state=newState;if(prevState!==newState){Pusher.debug("State changed",prevState+" -> "+newState);self.emit("state_change",{previous:prevState,current:newState});self.emit(newState,data)}}}Connection.prototype.connect=function(){if(!this._machine.is("failed")&&!Pusher.Transport){this._machine.transition("failed")}else{if(this._machine.is("initialized")){resetConnectionParameters(this);this._machine.transition("waiting")}else{if(this._machine.is("waiting")&&this.netInfo.isOnLine()===true){this._machine.transition("connecting")}else{if(this._machine.is("permanentlyClosed")){resetConnectionParameters(this);this._machine.transition("waiting")}}}}};Connection.prototype.send=function(data){if(this._machine.is("connected")){var self=this;setTimeout(function(){self.socket.send(data)},0);return true}else{return false}};Connection.prototype.send_event=function(event_name,data,channel){var payload={event:event_name,data:data};if(channel){payload.channel=channel}Pusher.debug("Event sent",payload);return this.send(JSON.stringify(payload))};Connection.prototype.disconnect=function(){if(this._machine.is("permanentlyClosed")){return}if(this._machine.is("waiting")||this._machine.is("failed")){this._machine.transition("permanentlyClosed")}else{this._machine.transition("permanentlyClosing")}};Pusher.Util.extend(Connection.prototype,Pusher.EventsDispatcher.prototype);this.Pusher.Connection=Connection}).call(this);(function(){Pusher.Channels=function(){this.channels={}};Pusher.Channels.prototype={add:function(channel_name,pusher){var existing_channel=this.find(channel_name);if(!existing_channel){var channel=Pusher.Channel.factory(channel_name,pusher);this.channels[channel_name]=channel;return channel}else{return existing_channel}},find:function(channel_name){return this.channels[channel_name]},remove:function(channel_name){delete this.channels[channel_name]},disconnect:function(){for(var channel_name in this.channels){this.channels[channel_name].disconnect()}}};Pusher.Channel=function(channel_name,pusher){var self=this;Pusher.EventsDispatcher.call(this,function(event_name,event_data){Pusher.debug("No callbacks on "+channel_name+" for "+event_name)});this.pusher=pusher;this.name=channel_name;this.subscribed=false;this.bind("pusher_internal:subscription_succeeded",function(data){self.onSubscriptionSucceeded(data)})};Pusher.Channel.prototype={init:function(){},disconnect:function(){this.subscribed=false;this.emit("pusher_internal:disconnected")},onSubscriptionSucceeded:function(data){this.subscribed=true;this.emit("pusher:subscription_succeeded")},authorize:function(socketId,options,callback){return callback(false,{})},trigger:function(event,data){return this.pusher.send_event(event,data,this.name)}};Pusher.Util.extend(Pusher.Channel.prototype,Pusher.EventsDispatcher.prototype);Pusher.Channel.PrivateChannel={authorize:function(socketId,options,callback){var self=this;var authorizer=new Pusher.Channel.Authorizer(this,Pusher.channel_auth_transport,options);return authorizer.authorize(socketId,function(err,authData){if(!err){self.emit("pusher_internal:authorized",authData)}callback(err,authData)})}};Pusher.Channel.PresenceChannel={init:function(){this.members=new Members(this)},onSubscriptionSucceeded:function(data){this.subscribed=true}};var Members=function(channel){var self=this;var reset=function(){this._members_map={};this.count=0;this.me=null};reset.call(this);channel.bind("pusher_internal:authorized",function(authorizedData){var channelData=JSON.parse(authorizedData.channel_data);channel.bind("pusher_internal:subscription_succeeded",function(subscriptionData){self._members_map=subscriptionData.presence.hash;self.count=subscriptionData.presence.count;self.me=self.get(channelData.user_id);channel.emit("pusher:subscription_succeeded",self)})});channel.bind("pusher_internal:member_added",function(data){if(self.get(data.user_id)===null){self.count++}self._members_map[data.user_id]=data.user_info;channel.emit("pusher:member_added",self.get(data.user_id))});channel.bind("pusher_internal:member_removed",function(data){var member=self.get(data.user_id);if(member){delete self._members_map[data.user_id];self.count--;channel.emit("pusher:member_removed",member)}});channel.bind("pusher_internal:disconnected",function(){reset.call(self)})};Members.prototype={each:function(callback){for(var i in this._members_map){callback(this.get(i))}},get:function(user_id){if(this._members_map.hasOwnProperty(user_id)){return{id:user_id,info:this._members_map[user_id]}}else{return null}}};Pusher.Channel.factory=function(channel_name,pusher){var channel=new Pusher.Channel(channel_name,pusher);if(channel_name.indexOf("private-")===0){Pusher.Util.extend(channel,Pusher.Channel.PrivateChannel)}else{if(channel_name.indexOf("presence-")===0){Pusher.Util.extend(channel,Pusher.Channel.PrivateChannel);Pusher.Util.extend(channel,Pusher.Channel.PresenceChannel)}}channel.init();return channel}}).call(this);(function(){Pusher.Channel.Authorizer=function(channel,type,options){this.channel=channel;this.type=type;this.authOptions=(options||{}).auth||{}};Pusher.Channel.Authorizer.prototype={composeQuery:function(socketId){var query="&socket_id="+encodeURIComponent(socketId)+"&channel_name="+encodeURIComponent(this.channel.name);for(var i in this.authOptions.params){query+="&"+encodeURIComponent(i)+"="+encodeURIComponent(this.authOptions.params[i])}return query},authorize:function(socketId,callback){return Pusher.authorizers[this.type].call(this,socketId,callback)}};Pusher.auth_callbacks={};Pusher.authorizers={ajax:function(socketId,callback){var self=this,xhr;if(Pusher.XHR){xhr=new Pusher.XHR()}else{xhr=(window.XMLHttpRequest?new window.XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"))}xhr.open("POST",Pusher.channel_auth_endpoint,true);xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var headerName in this.authOptions.headers){xhr.setRequestHeader(headerName,this.authOptions.headers[headerName])}xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){var data,parsed=false;try{data=JSON.parse(xhr.responseText);parsed=true}catch(e){callback(true,"JSON returned from webapp was invalid, yet status code was 200. Data was: "+xhr.responseText)}if(parsed){callback(false,data)}}else{Pusher.warn("Couldn't get auth info from your webapp",xhr.status);callback(true,xhr.status)}}};xhr.send(this.composeQuery(socketId));return xhr},jsonp:function(socketId,callback){if(this.authOptions.headers!==undefined){Pusher.warn("Warn","To send headers with the auth request, you must use AJAX, rather than JSONP.")}var script=document.createElement("script");Pusher.auth_callbacks[this.channel.name]=function(data){callback(false,data)};var callback_name="Pusher.auth_callbacks['"+this.channel.name+"']";script.src=Pusher.channel_auth_endpoint+"?callback="+encodeURIComponent(callback_name)+this.composeQuery(socketId);var head=document.getElementsByTagName("head")[0]||document.documentElement;head.insertBefore(script,head.firstChild)}}}).call(this);var _require=(function(){function handleScriptLoaded(elem,callback){if(document.addEventListener){elem.addEventListener("load",callback,false)}else{elem.attachEvent("onreadystatechange",function(){if(elem.readyState=="loaded"||elem.readyState=="complete"){callback()}})}}function addScript(src,callback){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.setAttribute("src",src);script.setAttribute("type","text/javascript");script.setAttribute("async",true);handleScriptLoaded(script,function(){callback()});head.appendChild(script)}return function(deps,callback){var deps_loaded=0;for(var i=0;i<deps.length;i++){addScript(deps[i],function(){if(deps.length==++deps_loaded){setTimeout(callback,0)}})}}})();(function(){if(!window.WebSocket&&window.MozWebSocket){window.WebSocket=window.MozWebSocket}if(window.WebSocket){Pusher.Transport=window.WebSocket;Pusher.TransportType="native"}var cdn=(document.location.protocol=="http:")?Pusher.cdn_http:Pusher.cdn_https;var root=cdn+Pusher.VERSION;var deps=[];if(!window.JSON){deps.push(root+"/json2"+Pusher.dependency_suffix+".js")}if(!window.WebSocket){window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=true;deps.push(root+"/flashfallback"+Pusher.dependency_suffix+".js")}var initialize=function(){if(window.WebSocket){return function(){Pusher.ready()}}else{return function(){if(window.WebSocket){Pusher.Transport=window.WebSocket;Pusher.TransportType="flash";window.WEB_SOCKET_SWF_LOCATION="https://s3.amazonaws.com/uploadcare-static/WebSocketMainInsecure.swf";WebSocket.__addTask(function(){Pusher.ready()});WebSocket.__initialize()}else{Pusher.Transport=null;Pusher.TransportType="none";Pusher.ready()}}}}();var ondocumentbody=function(callback){var load_body=function(){document.body?callback():setTimeout(load_body,0)};load_body()};var initializeOnDocumentBody=function(){ondocumentbody(initialize)};if(deps.length>0){_require(deps,initializeOnDocumentBody)}else{initializeOnDocumentBody()}})();(function(){}).call(this);(function(){uploadcare.namespace("uploadcare.utils.abilities",function(ns){ns.canFileAPI=!!window.FileList;ns.dragAndDrop=(function(){var el;el=document.createElement("div");return("draggable" in el)||("ondragstart" in el&&"ondrop" in el)})();ns.canvas=(function(){var el;el=document.createElement("canvas");return !!(el.getContext&&el.getContext("2d"))})();return ns.fileDragAndDrop=ns.canFileAPI&&ns.dragAndDrop})}).call(this);(function(){uploadcare.namespace("uploadcare.utils.pusher",function(ns){var hasOwners,pusherInstance,pusherWrapped,pushers,releasePusher,updateConnection;pushers={};ns.getPusher=function(key,owner){if(!(key in pushers)){pushers[key]={instance:null,owners:{}}}if(!pushers[key].owners[owner]){pushers[key].owners[owner]=true}updateConnection(key);return pusherWrapped(key,owner)};releasePusher=function(key,owner){if(!pushers[key].owners[owner]){return}pushers[key].owners[owner]=false;return updateConnection(key)};hasOwners=function(key){var owner;return((function(){var _results;_results=[];for(owner in pushers[key].owners){if(pushers[key].owners[owner]){_results.push(owner)}}return _results})()).length>0};updateConnection=function(key){var instance;instance=pusherInstance(key);if(hasOwners(key)){return instance.connect()}else{return setTimeout((function(){if(!hasOwners(key)){return instance.disconnect()}}),5000)}};pusherInstance=function(key){var _ref;if(((_ref=pushers[key])!=null?_ref.instance:void 0)!=null){return pushers[key].instance}return pushers[key].instance=new Pusher(key)};return pusherWrapped=function(key,owner){var Wrapped;Wrapped=function(){this.owner=owner;this.release=function(){return releasePusher(key,owner)};return this};Wrapped.prototype=pusherInstance(key);return new Wrapped()}})}).call(this);(function(){var $,namespace,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1},__slice=[].slice;namespace=uploadcare.namespace,$=uploadcare.jQuery;namespace("uploadcare.utils",function(utils){utils.Collection=(function(){function Collection(items){var item,_i,_len;if(items==null){items=[]}this.onAdd=$.Callbacks();this.onRemove=$.Callbacks();this.onReplaced=$.Callbacks();this.onSorted=$.Callbacks();this.__items=[];for(_i=0,_len=items.length;_i<_len;_i++){item=items[_i];this.add(item)}}Collection.prototype.add=function(item){this.__items.push(item);return this.onAdd.fire(item)};Collection.prototype.remove=function(item){if(utils.remove(this.__items,item)){return this.onRemove.fire(item)}};Collection.prototype.clear=function(){var item,_i,_len,_ref,_results;_ref=this.get();_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){item=_ref[_i];_results.push(this.remove(item))}return _results};Collection.prototype.replace=function(oldItem,newItem){var i,item,_i,_len,_ref,_results;if(oldItem!==newItem){_ref=this.__items;_results=[];for(i=_i=0,_len=_ref.length;_i<_len;i=++_i){item=_ref[i];if(item===oldItem){_results.push(this.__replace(oldItem,newItem,i))}else{_results.push(void 0)}}return _results}};Collection.prototype.__replace=function(oldItem,newItem,i){this.__items[i]=newItem;return this.onReplaced.fire(oldItem,newItem,i)};Collection.prototype.sort=function(comparator){this.__items.sort(comparator);return this.onSorted.fire()};Collection.prototype.get=function(index){if(index!=null){return this.__items[index]}else{return this.__items.slice(0)}};Collection.prototype.length=function(){return this.__items.length};return Collection})();utils.UniqCollection=(function(_super){__extends(UniqCollection,_super);function UniqCollection(){return UniqCollection.__super__.constructor.apply(this,arguments)}UniqCollection.prototype.add=function(item){if(__indexOf.call(this.__items,item)>=0){return}return UniqCollection.__super__.add.apply(this,arguments)};UniqCollection.prototype.__replace=function(oldItem,newItem,i){if(__indexOf.call(this.__items,newItem)>=0){return this.remove(oldItem)}else{return UniqCollection.__super__.__replace.apply(this,arguments)}};return UniqCollection})(utils.Collection);return utils.CollectionOfPromises=(function(_super){__extends(CollectionOfPromises,_super);function CollectionOfPromises(){this.onAnyDone=$.Callbacks();this.onAnyFail=$.Callbacks();this.onAnyProgress=$.Callbacks();this.onAnyProgress.add(function(item,firstArgument){return $(item).data("lastProgress",firstArgument)});CollectionOfPromises.__super__.constructor.apply(this,arguments)}CollectionOfPromises.prototype.lastProgresses=function(){var item,_i,_len,_ref,_results;_ref=this.__items;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){item=_ref[_i];_results.push($(item).data("lastProgress"))}return _results};CollectionOfPromises.prototype.add=function(item){if(!(item&&item.done&&item.fail&&item.then)){return}CollectionOfPromises.__super__.add.apply(this,arguments);return this.__watchItem(item)};CollectionOfPromises.prototype.__watchItem=function(item){var handler,_this=this;handler=function(callbacks){return function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];if(__indexOf.call(_this.__items,item)>=0){args.unshift(item);return callbacks.fire.apply(callbacks,args)}}};return item.then(handler(this.onAnyDone),handler(this.onAnyFail),handler(this.onAnyProgress))};CollectionOfPromises.prototype.__replace=function(oldItem,newItem,i){if(!(newItem&&newItem.done&&newItem.fail&&newItem.then)){return this.remove(oldItem)}else{CollectionOfPromises.__super__.__replace.apply(this,arguments);return this.__watchItem(newItem)}};return CollectionOfPromises})(utils.UniqCollection)})}).call(this);(function(){var namespace;namespace=uploadcare.namespace;namespace("uploadcare.utils",function(ns){var common,messages;ns.log=function(msg){if(window.console&&console.log){return console.log(msg)}else{}};ns.warn=function(msg){if(window.console&&console.warn){return console.warn(msg)}else{return ns.log("Warning: "+msg)}};messages={};ns.warnOnce=function(msg){if(messages[msg]==null){messages[msg]=true;return ns.warn(msg)}};common={autostore:"You have enabled autostore in the widget, but not on the server.\nTo use autostore, make sure it's enabled in project settings.\n\nhttps://uploadcare.com/accounts/settings/",publicKey:"Global public key not set. Uploads may not work!\nAdd this to the <head> tag to set your key:\n\n<script>\nUPLOADCARE_PUBLIC_KEY = 'your_public_key';\n<\/script>"};return ns.commonWarning=function(name){if(common[name]!=null){return ns.warnOnce(common[name])}}})}).call(this);(function(){var $,namespace,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1};namespace=uploadcare.namespace,$=uploadcare.jQuery;namespace("uploadcare.utils",function(ns){var own;own=Object.prototype.hasOwnProperty;ns.own=function(o,prop){return own.call(o,prop)};ns.uniq=function(arr,cond){var item,result,_i,_len;if(cond==null){cond=function(){return true}}result=[];for(_i=0,_len=arr.length;_i<_len;_i++){item=arr[_i];if(cond(item)&&__indexOf.call(result,item)<0){result.push(item)}}return result};ns.defer=function(fn){return setTimeout(fn,0)};ns.once=function(fn){var called,result;called=false;result=null;return function(){if(!called){result=fn.apply(this,arguments);called=true}return result}};ns.wrapToPromise=function(value){return $.Deferred().resolve(value).promise()};ns.remove=function(array,item){var index;index=$.inArray(item,array);if(index!==-1){array.splice(index,1);return true}else{return false}};ns.then=function(pr,doneFilter,failFilter,progressFilter){var compose,df;df=$.Deferred();compose=function(fn1,fn2){if(fn1&&fn2){return function(){return fn2.call(this,fn1.apply(this,arguments))}}else{return fn1||fn2}};pr.then(compose(doneFilter,df.resolve),compose(failFilter,df.reject),compose(progressFilter,df.notify));return df.promise()};ns.bindAll=function(source,methods){var target;target={};$.each(methods,function(i,method){var fn;fn=source[method];if($.isFunction(fn)){return target[method]=function(){var result;result=fn.apply(source,arguments);if(result===source){return target}else{return result}}}else{return target[method]=fn}});return target};ns.upperCase=function(s){return s.replace(/-/g,"_").toUpperCase()};ns.publicCallbacks=function(callbacks){var result;result=callbacks.add;result.add=callbacks.add;result.remove=callbacks.remove;return result};ns.uuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r,v;r=Math.random()*16|0;v=c==="x"?r:r&3|8;return v.toString(16)})};ns.splitUrlRegex=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?\#]*))?([^?\#]*)\??([^\#]*)\#?(.*)$/;ns.uuidRegex=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i;ns.groupIdRegex=new RegExp(""+ns.uuidRegex.source+"~[0-9]+","i");ns.cdnUrlRegex=new RegExp("^/?("+ns.uuidRegex.source+")(?:/(-/(?:[^/]+/)+)?([^/]*))?$","i");ns.splitCdnUrl=function(url){return ns.cdnUrlRegex.exec(ns.splitUrlRegex.exec(url)[3])};ns.escapeRegExp=function(str){return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")};ns.normalizeUrl=function(url){if(!url.match(/^([a-z][a-z0-9+\-\.]*:)?\/\//i)){url="https://"+url}return url.replace(/\/+$/,"")};ns.fitText=function(text,max){var head,tail;if(text.length>max){head=Math.ceil((max-3)/2);tail=Math.floor((max-3)/2);return text.slice(0,head)+"..."+text.slice(-tail)}else{return text}};ns.fitSizeInCdnLimit=function(objSize){return ns.fitSize(objSize,[1600,1600])};ns.fitSize=function(objSize,boxSize,upscale){var heightRation,widthRatio;if(objSize[0]>boxSize[0]||objSize[1]>boxSize[1]||upscale){widthRatio=boxSize[0]/objSize[0];heightRation=boxSize[1]/objSize[1];if(!boxSize[0]||(boxSize[1]&&widthRatio>heightRation)){return[Math.round(heightRation*objSize[0]),boxSize[1]]}else{return[boxSize[0],Math.round(widthRatio*objSize[1])]}}else{return objSize.slice()}};ns.fileInput=function(container,multiple,fn){var input;container.find("input:file").remove();input=multiple?$('<input type="file" multiple>'):$('<input type="file">');input.css({position:"absolute",top:0,opacity:0,margin:0,padding:0,width:"auto",height:"auto",cursor:container.css("cursor")});container.css({position:"relative",overflow:"hidden"}).append(input);input.on("change",function(e){fn(e);input.remove();return ns.fileInput(container,multiple,fn)});return container.mousemove(function(e){var left,top,width,_ref;_ref=$(this).offset(),left=_ref.left,top=_ref.top;width=input.width();return input.css({left:e.pageX-left-width+10,top:e.pageY-top-10})})};ns.readableFileSize=function(value,onNaN,prefix,postfix){var i,label,labels,_i,_len;if(onNaN==null){onNaN=""}if(prefix==null){prefix=""}if(postfix==null){postfix=""}value=parseInt(value,10);if(isNaN(value)){return onNaN}labels="B KB MB GB TB PB EB ZB YB".split(" ");for(i=_i=0,_len=labels.length;_i<_len;i=++_i){label=labels[i];if(value<512||i===labels.length-1){return""+prefix+value+" "+label+postfix}value=Math.round(value/1024)}};ns.imagePath=function(name){return uploadcare.settings.build().scriptBase+"images/"+name};ns.ajaxDefaults={dataType:"json",crossDomain:true,cache:false};ns.jsonp=function(url,type,data){if($.isPlainObject(type)){data=type;type="GET"}return $.ajax($.extend({url:url,type:type,data:data},ns.ajaxDefaults)).then(function(data){var text;if(data.error){text=data.error.content||data.error;ns.warn("JSONP error: "+text+" while loading "+url);return $.Deferred().reject(text)}else{return data}},function(_,textStatus,errorThrown){var text;text=""+textStatus+" ("+errorThrown+")";ns.warn("JSONP unexpected error: "+text+" while loading "+url);return text})};return ns.plugin=function(fn){return fn(uploadcare)}})}).call(this);(function(){var $,expose,namespace,utils,__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1};expose=uploadcare.expose,namespace=uploadcare.namespace,utils=uploadcare.utils,$=uploadcare.jQuery;namespace("uploadcare.settings",function(ns){var arrayOptions,defaults,flagOptions,intOptions,key,normalize,parseCrop,presets,publicDefaults,str2arr,urlOptions,value,waitForSettingsCb;defaults={live:true,"manual-start":false,locale:null,"locale-pluralize":null,"locale-translations":null,crop:"disabled","preview-step":false,"images-only":false,clearable:false,multiple:false,"multiple-max":0,"multiple-min":1,"path-value":false,tabs:"file url facebook gdrive instagram evernote box skydrive",autostore:false,"public-key":null,"pusher-key":"79ae88bd931ea68464d9","cdn-base":"http://www.ucarecdn.com","url-base":"https://upload.uploadcare.com","social-base":"https://social.uploadcare.com","script-base":typeof SCRIPT_BASE!=="undefined"&&SCRIPT_BASE!==null?SCRIPT_BASE:""};presets={tabs:{all:"file url facebook vk dropbox gdrive instagram evernote box skydrive","default":defaults.tabs}};str2arr=function(value){if(!$.isArray(value)){value=$.trim(value);value=value?value.split(" "):[]}return value};arrayOptions=function(settings,keys){var key,name,preset,presetList,value,_i,_len;for(_i=0,_len=keys.length;_i<_len;_i++){key=keys[_i];value=str2arr(settings[key]);presetList=presets[key];for(name in presetList){if(!__hasProp.call(presetList,name)){continue}preset=presetList[name];if(__indexOf.call(value,name)>=0){value=value.concat(str2arr(preset))}}settings[key]=utils.uniq(value,function(x){return !utils.own(presetList,x)})}return settings};urlOptions=function(settings,keys){var key,_i,_len;for(_i=0,_len=keys.length;_i<_len;_i++){key=keys[_i];if(settings[key]!=null){settings[key]=utils.normalizeUrl(settings[key])}}return settings};flagOptions=function(settings,keys){var key,value,_i,_len;for(_i=0,_len=keys.length;_i<_len;_i++){key=keys[_i];if(!(settings[key]!=null)){continue}value=settings[key];if($.type(value)==="string"){value=$.trim(value).toLowerCase();settings[key]=!(value==="false"||value==="disabled")}else{settings[key]=!!value}}return settings};intOptions=function(settings,keys){var key,_i,_len;for(_i=0,_len=keys.length;_i<_len;_i++){key=keys[_i];if(settings[key]!=null){settings[key]=parseInt(settings[key])}}return settings};parseCrop=function(cropValue){var crop,ratio,reDisabled,reRatio;crop={enabled:true};reDisabled=/^(disabled|false)$/i;reRatio=/^([0-9]+)([x:])([0-9]+)(\s+(upscale|minimum))?$/i;if(cropValue.match(reDisabled)){crop.enabled=false}else{if(ratio=cropValue.toLowerCase().match(reRatio)){crop.preferedSize=[+ratio[1],+ratio[3]];if(ratio[2]==="x"){crop.scale=true}if(ratio[5]){crop.upscale=true;if(ratio[5]==="minimum"){crop.notLess=true}}}}return crop};normalize=function(settings){arrayOptions(settings,["tabs"]);urlOptions(settings,["cdnBase","socialBase","urlBase"]);flagOptions(settings,["autostore","imagesOnly","multiple","clearable","pathValue","previewStep"]);intOptions(settings,["multipleMax","multipleMin"]);if(!$.isPlainObject(settings.crop)){if(settings.multiple){settings.crop={enabled:false}}else{settings.crop=parseCrop($.trim(settings.crop))}}if(settings.crop.enabled||settings.multiple){settings.previewStep=true}return settings};publicDefaults={};for(key in defaults){if(!__hasProp.call(defaults,key)){continue}value=defaults[key];publicDefaults[$.camelCase(key)]=value}expose("defaults",publicDefaults);ns.globals=utils.once(function(){var fallback,values;values={};for(key in defaults){if(!__hasProp.call(defaults,key)){continue}fallback=defaults[key];value=window["UPLOADCARE_"+(utils.upperCase(key))];values[$.camelCase(key)]=value!=null?value:fallback}if(!values.publicKey){utils.commonWarning("publicKey")}return normalize(values)});ns.common=utils.once(function(settings){var result;result=normalize($.extend({},ns.globals(),settings||{}));waitForSettingsCb.fire(result);return result});ns.build=function(settings){return normalize($.extend({},ns.common(),settings||{}))};waitForSettingsCb=$.Callbacks("once memory");ns.waitForSettings=function(settings,fn){return waitForSettingsCb.add(function(common){return fn(normalize($.extend({},common,settings||{})))})};ns.CssCollector=(function(){function CssCollector(){this.urls=[];this.styles=[]}CssCollector.prototype.addUrl=function(url){if(!/^https?:\/\//i.test(url)){throw new Error("Embedded urls should be absolute. "+url)}if(__indexOf.call(this.urls,url)<0){return this.urls.push(url)}};CssCollector.prototype.addStyle=function(style){return this.styles.push(style)};return CssCollector})();return uploadcare.tabsCss=new ns.CssCollector})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.en={ready:"Upload from",uploading:"Uploading... Please wait.",loadingInfo:"Loading info...",errors:{"default":"Error",baddata:"Incorrect value",size:"File too big",upload:"Can’t upload",user:"Upload canceled",info:"Can’t load info",image:"Only images allowed",createGroup:"Can’t create file group",deleted:"File was deleted"},draghere:"Drop a file here",file:{one:"%1 file",other:"%1 files"},buttons:{cancel:"Cancel",remove:"Remove",file:"Computer"},dialog:{done:"Done",showFiles:"Show files",tabs:{file:{drag:"Drop a file here",nodrop:"Upload files from your computer",or:"or",button:"Choose a file from computer",also:"You can also choose it from",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"VK",evernote:"Evernote",box:"Box",skydrive:"SkyDrive",url:"Arbitrary Links"}},url:{title:"Files from the Web",line1:"Grab any file off the web.",line2:"Just provide the link.",input:"Paste your link here...",button:"Upload"},preview:{unknownName:"unknown",change:"Cancel",back:"Back",done:"Add",unknown:{title:"Uploading... Please wait for a preview.",done:"Skip preview and accept"},regular:{title:"Add this file?",line1:"You are about to add the file above.",line2:"Please confirm."},image:{title:"Add this image?",change:"Cancel"},crop:{title:"Crop and add this image",done:"Done"},error:{"default":{title:"Oops!",text:"Something went wrong during the upload.",back:"Please try again"},image:{title:"Only image files are accepted.",text:"Please try again with another file.",back:"Choose image"},size:{title:"The file you selected exceeds the limit.",text:"Please try again with another file."}},multiple:{title:"You’ve chosen %files%",question:"Do you want to add all of these files?",tooManyFiles:"You’ve chosen too many files. %max% is maximum.",tooFewFiles:"You’ve chosen %files%. At least %min% required.",clear:"Remove all",done:"Done"}}},footer:{text:"Uploading, storing and processing files by",link:"Uploadcare.com"}},crop:{error:{title:"Error",text:"Can’t load image"},done:"Done"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.en=function(n){if(n===1){return"one"}return"other"}})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.es={ready:"Subir desde",uploading:"Subiendo... Por favor espere.",loadingInfo:"Cargando Información...",errors:{"default":"Error",baddata:"Valor incorrecto",size:"Demasiado grande",upload:"No se ha podido subir",user:"Subida cancelada",info:"No se pudo cargar la información",image:"Sólo se permiten imagenes"},draghere:"Arrastra los archivos hasta aquí",file:{one:"%1 archivo",other:"%1 archivos"},buttons:{cancel:"Cancelar",remove:"Eliminar",file:"Computadora"},dialog:{tabs:{file:{drag:"Arrastra una archivo aquí",nodrop:"Sube fotos desde tu computadora",or:"o",button:"Elige un archivo desde tu computadora",also:"Tambien puedes seleccionarlo de",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"VK",evernote:"Evernote",url:"Una dirección cualquiera"}},url:{title:"Archivos de la web",line1:"Selecciona cualquier archivo de la web.",line2:"Sólo danos el link.",input:"Copia tu link aquí...",button:"Subir"},preview:{unknownName:"desconocido",change:"Cancelar",back:"Atras",done:"Subir",unknown:{title:"Subiendo. Por favor espera para una vista previa.",done:"Saltar vista previa y aceptar"},regular:{title:"¿Quieres subir este archivo?",line1:"Estás por subir el archivo de arriba.",line2:"Confirma por favor."},image:{title:"¿Quieres subir esta imagen?",change:"Cancelar"},crop:{title:"Cortar y subir esta imagen"},error:{"default":{title:"La subida falló",line1:"Algo salio mal durante la subida.",line2:"Por favor, trata de nuevo."},image:{title:"Sólo imagenes",line1:"Sólo se aceptan archivos de imagenes.",line2:"Por favor, trata de nuevo con otro archivo."},size:{title:"Límite de tamaño",line1:"El archivo que has seleccinado sobrepasa el límite de los 100MB.",line2:"Por favor trata de nuevo con otro archivo."}}}},footer:{text:"Los archivos ha sido subidos, gestionados y procesados por",link:"Uploadcare.com"}},crop:{error:{title:"Error",text:"No se pudo cargar la imangen"},done:"Listo"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.es=function(n){if(n===1){return"one"}return"other"}})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.fr={ready:"Envoi depuis",uploading:"Envoi en cours... Merci de patientier.",loadingInfo:"Chargement des informations...",errors:{"default":"Erreur",baddata:"Valeur incorrecte",size:"Fichier trop volumineux",upload:"Envoi impossible",user:"Envoi annulé",info:"Impossible de charger les informations",image:"Seules les images sont autorisées",createGroup:"Création d'1 groupe impossible",deleted:"Le fichier a été supprimé"},draghere:"Glissez-déposez un fichier ici",file:{one:"%1 fichier",other:"%1 fichiers"},buttons:{cancel:"Annuler",remove:"Supprimer",file:"Ordinateur"},dialog:{done:"Terminer",showFiles:"Voir les fichiers",tabs:{file:{drag:"Glissez-déposez un fichier ici",nodrop:"Envoyez des fichiers depuis votre ordinateur",or:"ou",button:"Choisissez un fichier depuis votre ordinateur",also:"Vous pouvez également le sélectionner depuis",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"VK",evernote:"Evernote",url:"Une adresse web"}},url:{title:"Fichiers depuis le Web",line1:"Prenez n'importe quel fichier depuis un site web.",line2:"Saisissez simplement son adresse.",input:"Collez le lien ici...",button:"Envoi"},preview:{unknownName:"inconnu",change:"Annuler",back:"Retour",done:"Ajouter",unknown:{title:"Envoi en cours... Merci de patientier pour prévisualiser.",done:"Passer la prévisualisation et accepter"},regular:{title:"Ajouter ce fichier ?",line1:"Vous êtes sur le point d'ajouter le fichier ci-dessus.",line2:"Merci de confirmer."},image:{title:"Ajouter cette image ?",change:"Annuler"},crop:{title:"Recadrer et ajouter cette image",done:"Terminer"},error:{"default":{title:"Oups!",text:"Quelque chose n'a pas fonctionné pendant l'envoi.",back:"Merci de bien vouloir recommencer"},image:{title:"Seules les images sont acceptées.",text:"Merci de bien vouloir recommencer avec un autre fichier.",back:"Choisir une image"},size:{title:"Le fichier sélectionné est trop volumineux.",text:"Merci de bien vouloir recommencer avec un autre fichier."}},multiple:{title:"Vous avez choisi %files%",question:"Voulez vous ajouter tous ces fichiers ?",clear:"Tout retirer",done:"Terminer"}}},footer:{text:"Envoi, stockage et traitement des fichiers par",link:"Uploadcare.com"}},crop:{error:{title:"Erreur",text:"Impossible de charger l'image"},done:"Terminer"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.fr=function(n){if(n===1){return"one"}return"other"}})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.lv={ready:"Izvēlieties failu",uploading:"Augšupielādē... Lūdzu, gaidiet.",errors:{"default":"Kļūda",image:"Atļauti tikai attēli"},draghere:"Velciet failus šeit",file:{zero:"%1 failu",one:"%1 fails",other:"%1 faili"},buttons:{cancel:"Atcelt",remove:"Dzēst",file:"Dators"},dialog:{title:"Ielādēt jebko no jebkurienes",poweredby:"Darbināts ar",support:{images:"Attēli",audio:"Audio",video:"Video",documents:"Dokumenti"},tabs:{file:{title:"Mans dators",line1:"Paņemiet jebkuru failu no jūsu datora.",line2:"Izvēlēties ar dialogu vai ievelciet iekšā.",button:"Meklēt failus"},url:{title:"Faili no tīmekļa",line1:"Paņemiet jebkuru failu no tīmekļa.",line2:"Tikai uzrādiet linku.",input:"Ielīmējiet linku šeit...",button:"Ielādēt"}}}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.lv=function(n){if(n===0){return"zero"}if((n%10===1)&&(n%100!==11)){return"one"}return"other"}})}).call(this);(function(){var __indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1};uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.pl={ready:"Prześlij z",uploading:"Przesyłanie... Proszę czekać.",errors:{"default":"Błąd"},draghere:"Upuść plik tutaj",buttons:{cancel:"Anuluj",remove:"Usuń",file:"Komputer"},dialog:{tabs:{file:{title:"Mój komputer"},url:{title:"Pliki z sieci"}}}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.pl=function(n){var _ref,_ref1,_ref2,_ref3;if(n===1){return"one"}if((_ref=n%10,__indexOf.call([2,3,4],_ref)>=0)&&(_ref1=n%100,__indexOf.call([12,13,14],_ref1)<0)){return"few"}if((n!==1)&&((_ref2=n%10,__indexOf.call([2,3,4],_ref2)<0)||(_ref3=n%100,__indexOf.call([12,13,14],_ref3)>=0))){return"many"}return"other"}})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.pt={ready:"Fazer upload de",uploading:"Fazendo upload... Aguarde.",loadingInfo:"Carregando informações...",errors:{"default":"Erro",baddata:"Valor incorreto",size:"Arquivo muito grande",upload:"Não foi possível fazer o upload",user:"Upload cancelado",info:"Não foi possível carregar as informações",image:"Apenas imagens são permitidas",createGroup:"Não foi possível criar o grupo de arquivos",deleted:"O arquivo foi excluído"},draghere:"Arraste um arquivo para cá",file:{one:"%1 arquivo",other:"%1 arquivos"},buttons:{cancel:"Cancelar",remove:"Excluir",file:"Computador"},dialog:{done:"OK",showFiles:"Mostrar arquivos",tabs:{file:{drag:"Arraste um arquivo para cá",nodrop:"Faça upload de arquivos do seu computador",or:"ou",button:"Escolha um arquivo do computador",also:"Você também pode escolher arquivos de",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"VK",evernote:"Evernote",url:"Link da web"}},url:{title:"Arquivos da web",line1:"Faça upload de qualquer arquivo da web.",line2:"Apenas informe o link.",input:"Cole seu link aqui...",button:"Upload"},preview:{unknownName:"desconhecido",change:"Cancelar",back:"Voltar",done:"Adicionar",unknown:{title:"Fazendo upload... Aguarde o preview.",done:"Pular preview e aceitar"},regular:{title:"Adicionar esse arquivo?",line1:"Você está prestes a adicionar o arquivo acima.",line2:"Por favor, confirme."},image:{title:"Adicionar essa imagem?",change:"Cancelar"},crop:{title:"Cortar e adicionar essa imagem",done:"OK"},error:{"default":{title:"Oops!",text:"Alguma coisa deu errado durante o upload.",back:"Por favor, tente novamente"},image:{title:"Apenas arquivos de imagem são aceitos.",text:"Por favor, tente novamente com outro arquivo.",back:"Escolher a imagem"},size:{title:"O arquivo que você escolheu excede o limite.",text:"Por favor, tente novamente com outro arquivo."}},multiple:{title:"Você escolheu",question:"Você quer adicionar todos esses arquivos?",clear:"Excluir todos",done:"OK"}}},footer:{text:"Upload, armazenamento e processamento dos arquivos feito por",link:"Uploadcare.com"}},crop:{error:{title:"Erro",text:"Não foi possível carregar a imagem"},done:"OK"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.pt=function(n){if(n===1){return"one"}return"other"}})}).call(this);(function(){var __indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1};uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.ru={ready:"Выберите файл",uploading:"Идет загрузка",loadingInfo:"Загрузка информации...",errors:{"default":"Ошибка",baddata:"Некорректные данные",size:"Слишком большой файл",upload:"Ошибка при загрузке",user:"Загрузка прервана",info:"Ошибка при загрузке информации",image:"Разрешены только изображения",createGroup:"Не удалось создать группу файлов",deleted:"Файл удалён"},draghere:"Перетащите файл сюда",file:{one:"%1 файл",few:"%1 файла",many:"%1 файлов",other:"%1 файла"},buttons:{cancel:"Отмена",remove:"Удалить",file:"Компьютер"},dialog:{done:"Готово",showFiles:"Показать файлы",tabs:{file:{drag:"Перетащите файл сюда",nodrop:"Загрузка файлов с вашего компьютера",or:"или",button:"Выберите файл с компьютера",also:"Вы также можете загрузить файлы, используя:",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"ВКонтакте",evernote:"Evernote",url:"Произвольную ссылку"}},url:{title:"Файлы с других сайтов",line1:"Загрузите любой файл из сети.",line2:"",input:"Укажите здесь ссылку...",button:"Загрузить"},preview:{unknownName:"неизвестно",change:"Отмена",back:"Назад",done:"Добавить",unknown:{title:"Загрузка... Пожалуйста подождите.",done:"Пропустить предварительный просмотр"},regular:{title:"Загрузить этот файл?",line1:"Вы собираетесь добавить этот файл:",line2:"Пожалуйста, подтвердите."},image:{title:"Добавить это изображение?",change:"Отмена"},crop:{title:"Обрезать и добавить это изображение",done:"Готово"},error:{"default":{title:"Ой!",text:"Что-то пошло не так во время загрузки.",back:"Пожалуйста, попробуйте ещё раз"},image:{title:"Можно загружать только изображения.",text:"Попробуйте загрузить другой файл.",back:"Выберите изображение"},size:{title:"Размер выбранного файла превышает лимит.",text:"Попробуйте загрузить другой файл."}},multiple:{title:"Вы выбрали %files%",question:"Вы хотите добавить все эти файлы?",tooManyFiles:"Вы выбрали слишком много файлов. %max% максимум.",tooFewFiles:"Вы выбрали %files%. Нужно не меньше %min%.",clear:"Удалить все",done:"Готово"}}},footer:{text:"Для загрузки, хранения и обработки файлов используется",link:"Uploadcare.com"}},crop:{error:{title:"Ошибка",text:"Изображение не удалось загрузить"},done:"ОК"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.ru=function(n){var _ref,_ref1,_ref2,_ref3;if((n%10===1)&&(n%100!==11)){return"one"}if((_ref=n%10,__indexOf.call([2,3,4],_ref)>=0)&&(_ref1=n%100,__indexOf.call([12,13,14],_ref1)<0)){return"few"}if((n%10===0)||(_ref2=n%10,__indexOf.call([5,6,7,8,9],_ref2)>=0)||(_ref3=n%100,__indexOf.call([11,12,13,14],_ref3)>=0)){return"many"}return"other"}})}).call(this);(function(){uploadcare.namespace("uploadcare.locale.translations",function(ns){return ns.zh={ready:"上传自",uploading:"上传中...请等待",loadingInfo:"正在读取信息...",errors:{"default":"错误",baddata:"错误数据",size:"文件太大",upload:"无法上传",user:"上传被取消",info:"无法读取信息",image:"只允许图形文件",createGroup:"无法建立文件组",deleted:"文件已被删除"},draghere:"拖放文件到这里",file:{other:"%1 个文件"},buttons:{cancel:"取消",remove:"删除",file:"计算机"},dialog:{done:"完成",showFiles:"显示文件",tabs:{file:{drag:"拖放文件到这里",nodrop:"从你的电脑中上传",or:"或者",button:"从电脑中选取文件",also:"你也可以选自",tabNames:{facebook:"Facebook",dropbox:"Dropbox",gdrive:"Google Drive",instagram:"Instagram",vk:"VK",evernote:"Evernote",url:"任意图片链接"}},url:{title:"来自互联网的文件",line1:"从互联网选取文件",line2:"只需提供链接",input:"将链接拷贝至此...",button:"上传"},preview:{unknownName:"未知",change:"取消",back:"返回",done:"添加",unknown:{title:"上传中...请等待预览",done:"跳过预览,直接接受"},regular:{title:"添加这个文件?",line1:"你将添加上面的文件。",line2:"请确认。"},image:{title:"添加这个图片?",change:"取消"},crop:{title:"剪裁并添加这个图片",done:"完成"},error:{"default":{title:"错误!",text:"上传过程中出错。",back:"请重试"},image:{title:"只允许上传图片文件。",text:"请选择其他文件重新上传。",back:"选择图片"},size:{title:"你选取的文件超过了100MB的上限",text:"请用另一个文件再试一次。"}},multiple:{title:"你已经选择 %files%",question:"你要添加所有文件吗?",tooManyFiles:"你选了太多的文件. 最多可选择%max%. 请删除一些。",clear:"清空",done:"完成"}}},footer:{text:"为您提供文件上传、存储和编辑功能。 Copyright ©",link:"Uploadcare.com"}},crop:{error:{title:"错误",text:"无法读取图片"},done:"完成"}}});uploadcare.namespace("uploadcare.locale.pluralize",function(ns){return ns.zh=function(){return"other"}})}).call(this);(function(){var $,namespace,s,utils;namespace=uploadcare.namespace,utils=uploadcare.utils,s=uploadcare.settings,$=uploadcare.jQuery;namespace("uploadcare.locale",function(ns){var build,defaultLang,defaults,translate,_build;defaultLang="en";defaults={lang:defaultLang,translations:ns.translations[defaultLang],pluralize:ns.pluralize[defaultLang]};_build=function(settings){var lang,pluralize,translations;lang=settings.locale||defaults.lang;translations=$.extend(true,{},ns.translations[lang],settings.localeTranslations);pluralize=$.isFunction(settings.localePluralize)?settings.localePluralize:ns.pluralize[lang];return{lang:lang,translations:translations,pluralize:pluralize}};build=utils.once(function(){return _build(s.build())});ns.rebuild=function(settings){var result;result=_build(s.build(settings));return build=function(){return result}};translate=function(key,node){var path,subkey,_i,_len;path=key.split(".");for(_i=0,_len=path.length;_i<_len;_i++){subkey=path[_i];if(node==null){return null}node=node[subkey]}return node};return ns.t=function(key,n){var locale,value,_ref;locale=build();value=translate(key,locale.translations);if(!(value!=null)&&locale.lang!==defaults.lang){locale=defaults;value=translate(key,locale.translations)}if(n!=null){if(locale.pluralize!=null){value=((_ref=value[locale.pluralize(n)])!=null?_ref.replace("%1",n):void 0)||n}else{value=""}}return value||""}})}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/circle-text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-widget-circle-back" role="uploadcare-circle-back">\n <div class="uploadcare-widget-circle-text" role="uploadcare-circle-text"></div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/crop-widget"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-crop-widget">\n <div class="uploadcare-crop-widget__error">\n <div class="uploadcare-crop-widget__error__title">',(""+t("crop.error.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div class="uploadcare-crop-widget__error__text">',(""+t("crop.error.text")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n </div>\n</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/dialog"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog">\n <div class="uploadcare-dialog-inner-wrap1">\n <div class="uploadcare-dialog-inner-wrap2">\n <div class="uploadcare-dialog-close">×</div>\n <div class="uploadcare-dialog-placeholder"></div>\n </div>\n </div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/panel"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div>\n <div class="uploadcare-dialog-panel">\n <div class="uploadcare-dialog-tabs"></div>\n </div>\n <div class="uploadcare-dialog-footer">\n ',(""+t("dialog.footer.text")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n <a href="https://uploadcare.com/" target="_blank">',(""+t("dialog.footer.link")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</a>\n </div>\n</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/source-tab-base"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div \n class="uploadcare-dialog-source-base-wrap" \n role="uploadcare-dialog-source-base-wrap"\n></div>\n\n<div class="uploadcare-dialog-inner-footer uploadcare-dialog-source-base-footer">\n <div \n class="uploadcare-dialog-button" \n role="uploadcare-dialog-source-base-show-files">',(""+t("dialog.showFiles")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div\n class="uploadcare-dialog-button-success" \n role="uploadcare-dialog-source-base-done">',(""+t("dialog.done")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div \n class="uploadcare-dialog-inner-footer-text"\n role="uploadcare-dialog-source-base-footer-text"\n ></div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/styles"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('\n\n\n\n\n\n.uploadcare-dialog-tab:after,.uploadcare-dialog-tab:hover:after,.uploadcare-dialog-disabled-tab:hover:after{background-image:url("',utils.imagePath("tab-icons.png"),'")}.uploadcare-dialog-selected-tab:after,.uploadcare-dialog-selected-tab:hover:after{background-image:url("',utils.imagePath("tab-icons-active.png"),'")}.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-dialog,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-file,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-url{background-image:url("',utils.imagePath("buttons.png"),'")}.uploadcare-crop-widget .jcrop-vline,.uploadcare-crop-widget .jcrop-hline{background-image:url("',utils.imagePath("crop-border-bg.gif"),'")}.uploadcare-dialog-file-sources:before{background-image:url("',utils.imagePath("arrow.png"),'")}.uploadcare-crop-widget--loading{background-image:url("',utils.imagePath("loading-spinner.gif"),'");background-size:25px 25px}.uploadcare-dpm-file-remove{background-image:url("',utils.imagePath("remove-button.png"),'")}.uploadcare-dpm-file-error:before{background-image:url("',utils.imagePath("error-icon.png"),'")}.uploadcare-dpm-file-name:before{background-image:url("',utils.imagePath("file-icon.png"),'")}.uloadcare-dialog-error-tab-illustration{background-image:url("',utils.imagePath("error-default.png"),'")}.uloadcare-dialog-error-tab-image .uloadcare-dialog-error-tab-illustration{background-image:url("',utils.imagePath("error-image.png"),'")}.uploadcare-dialog{background:url("',utils.imagePath("dialog-overlay.png"),"\");background:rgba(48,48,48,0.95)}.uploadcare-dialog{font-family:\"Helvetica Neue\",Helvetica,Arial,\"Lucida Grande\",sans-serif;position:fixed;left:0;top:0;width:100%;height:100%;z-index:10000;overflow:auto}.uploadcare-dialog *{margin:0;padding:0}.uploadcare-dialog .uploadcare-dialog-panel{margin:0 auto;width:900px;border-radius:8px;-ms-box-shadow:0 1px 2px rgba(0,0,0,0.35);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.35);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.35);-o-box-shadow:0 1px 2px rgba(0,0,0,0.35);box-shadow:0 1px 2px rgba(0,0,0,0.35)}.uploadcare-dialog-inner-wrap1{position:relative;display:table;width:100%;height:100%}.uploadcare-dialog-inner-wrap2{display:table-cell;vertical-align:middle;padding:0 44px}.uploadcare-dialog-close{margin:0;padding:0;border:none;background:none;width:33px;height:33px;line-height:33px;font-size:29.7px;font-weight:bold;color:#1d1d1d;cursor:pointer;position:absolute;right:0;top:4px}.uploadcare-dialog-panel{overflow:hidden;background:#efefef;font-weight:normal}.uploadcare-dialog-panel a{text-decoration:none;border-bottom:1px dotted}.uploadcare-dialog-panel a:link,.uploadcare-dialog-panel a:visited{color:#1a85ad;border-bottom-color:#1a85ad}.uploadcare-dialog-panel a:hover,.uploadcare-dialog-panel a:active{color:#252525;border-bottom-color:#252525}.uploadcare-dialog-tabs{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;width:75px;height:616px;float:left;list-style:none;list-style-type:none;margin:0;padding:0;background:#dee0e1;border-right:1px solid #c5cace}.uploadcare-dialog-tab{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;height:56px;border-bottom:1px solid #c5cace;cursor:pointer;position:relative}.uploadcare-dialog-tab:after{content:'';display:block;position:absolute;width:50px;height:50px;top:50%;left:50%;margin-top:-25px;margin-left:-25px;border:none;opacity:.66}.uploadcare-dialog-tab:hover{background-color:#e5e7e8}.uploadcare-dialog-tab:hover:after{opacity:1}.uploadcare-dialog-selected-tab{margin-right:-1px;border-right:1px solid #efefef}.uploadcare-dialog-selected-tab,.uploadcare-dialog-selected-tab:hover{background-color:#efefef}.uploadcare-dialog-selected-tab:after{opacity:1}.uploadcare-dialog-disabled-tab{cursor:default}.uploadcare-dialog-disabled-tab:hover{background-color:#dee0e1}.uploadcare-dialog-tab-preview:after{display:none}.uploadcare-dialog-tab-file:after{background-position:0 -50px}.uploadcare-dialog-tab-url:after{background-position:0 -100px}.uploadcare-dialog-tab-facebook:after{background-position:0 -150px}.uploadcare-dialog-tab-dropbox:after{background-position:0 -200px}.uploadcare-dialog-tab-gdrive:after{background-position:0 -250px}.uploadcare-dialog-tab-instagram:after{background-position:0 -300px}.uploadcare-dialog-tab-vk:after{background-position:0 -350px}.uploadcare-dialog-tab-evernote:after{background-position:0 -400px}.uploadcare-dialog-tab-box:after{background-position:0 -450px}.uploadcare-dialog-tab-skydrive:after{background-position:0 -500px}.uploadcare-dialog-tabs-panel{position:relative;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;margin-left:75px;padding:22px 25px;height:616px;line-height:22px;font-size:16px;color:black}.uploadcare-dialog-input{-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;width:100%;height:44px;margin-bottom:22px;padding:11px 12.5px;font-family:inherit;font-size:16px;border:1px solid #c5cace;background:white;color:black}.uploadcare-dialog-drop-file{background:white;border:1px dashed #c5cace;border-radius:3px;height:99px;padding-top:77px;text-align:center;color:#545454}.uploadcare-pre{white-space:pre;font-family:monospace;margin:22px auto;padding:22px 25px;background-color:white;border:1px solid #c5cace;border-radius:3px;text-align:left;font-size:15px;line-height:22px}.uploadcare-dialog-footer{font-size:13px;text-align:center;color:#888;margin-top:15px}.uploadcare-dialog .uploadcare-dialog-footer a{color:#c2c2c2;text-decoration:none}.uploadcare-dialog .uploadcare-dialog-footer a:hover{text-decoration:underline}.uploadcare-dialog-title{font-size:25px;line-height:1;margin-bottom:25px}.uploadcare-dialog-title2{font-size:20px;line-height:1;padding-bottom:11px}.uploadcare-dialog-big-title{font-size:40px;font-weight:bold;line-height:1em;margin-bottom:50px}.uploadcare-dialog-label{font-size:15px;line-height:25px;margin-bottom:12.5px}.uploadcare-dialog-large-text{font-size:20px;font-weight:normal;line-height:1.5em}.uploadcare-dialog-large-text .uploadcare-pre{display:inline-block;font-size:18px}.uploadcare-dialog-section{margin-bottom:22px}.uploadcare-dialog-normal-text{font-size:13px;color:#545454}.uploadcare-dialog-button{display:inline-block;font-size:13px;line-height:31px;padding:0 22px;margin-right:.5em;border:solid 1px;border-radius:3px;cursor:pointer;color:#444}.uploadcare-dialog-button,.uploadcare-dialog-button[disabled]:active,.uploadcare-dialog-button.uploadcare-disabled-el:active,.uploadcare-dialog-button[disabled]:hover,.uploadcare-dialog-button.uploadcare-disabled-el:hover{background:#f3f3f3;background:-webkit-linear-gradient(whitesmoke,#f1f1f1);background:-moz-linear-gradient(whitesmoke,#f1f1f1);background:-o-linear-gradient(whitesmoke,#f1f1f1);background:linear-gradient(whitesmoke,#f1f1f1);-ms-box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;-o-box-shadow:none;box-shadow:none;border-color:gainsboro}.uploadcare-dialog-button:hover{background:#f8f8f8;background:-webkit-linear-gradient(#fbfbfb,#f6f6f6);background:-moz-linear-gradient(#fbfbfb,#f6f6f6);background:-o-linear-gradient(#fbfbfb,#f6f6f6);background:linear-gradient(#fbfbfb,#f6f6f6);-ms-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-o-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05)}.uploadcare-dialog-button:active{background:#f3f3f3;background:-webkit-linear-gradient(whitesmoke,#f1f1f1);background:-moz-linear-gradient(whitesmoke,#f1f1f1);background:-o-linear-gradient(whitesmoke,#f1f1f1);background:linear-gradient(whitesmoke,#f1f1f1);-ms-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-o-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 2px rgba(0,0,0,0.05)}.uploadcare-dialog-button[disabled],.uploadcare-dialog-button.uploadcare-disabled-el{cursor:default;opacity:.6}.uploadcare-dialog-button:active,.uploadcare-dialog-button:hover{border-color:#cbcbcb}.uploadcare-dialog-button-success{display:inline-block;font-size:13px;line-height:31px;padding:0 22px;margin-right:.5em;border:solid 1px;border-radius:3px;cursor:pointer;color:white}.uploadcare-dialog-button-success,.uploadcare-dialog-button-success[disabled]:active,.uploadcare-dialog-button-success.uploadcare-disabled-el:active,.uploadcare-dialog-button-success[disabled]:hover,.uploadcare-dialog-button-success.uploadcare-disabled-el:hover{background:#3786eb;background:-webkit-linear-gradient(#3b8df7,#347fdf);background:-moz-linear-gradient(#3b8df7,#347fdf);background:-o-linear-gradient(#3b8df7,#347fdf);background:linear-gradient(#3b8df7,#347fdf);-ms-box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;-o-box-shadow:none;box-shadow:none;border-color:#266fcb}.uploadcare-dialog-button-success:hover{background:#3279d6;background:-webkit-linear-gradient(#3986ea,#2c6dc2);background:-moz-linear-gradient(#3986ea,#2c6dc2);background:-o-linear-gradient(#3986ea,#2c6dc2);background:linear-gradient(#3986ea,#2c6dc2);-ms-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);-o-box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05);box-shadow:inset 0 -1px 3px rgba(0,0,0,0.05)}.uploadcare-dialog-button-success:active{background:#3177d3;background:-webkit-linear-gradient(#3680e1,#2c6fc5);background:-moz-linear-gradient(#3680e1,#2c6fc5);background:-o-linear-gradient(#3680e1,#2c6fc5);background:linear-gradient(#3680e1,#2c6fc5);-ms-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-webkit-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);-o-box-shadow:inset 0 2px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 2px rgba(0,0,0,0.05)}.uploadcare-dialog-button-success[disabled],.uploadcare-dialog-button-success.uploadcare-disabled-el{cursor:default;opacity:.6}.uploadcare-dialog-button-success:active,.uploadcare-dialog-button-success:hover{border-color:#266eca #1f62b7 #1753a1}.uploadcare-dialog-button-success:hover{-ms-box-shadow:inset 0 -1px 3px rgba(22,82,160,0.5);-moz-box-shadow:inset 0 -1px 3px rgba(22,82,160,0.5);-webkit-box-shadow:inset 0 -1px 3px rgba(22,82,160,0.5);-o-box-shadow:inset 0 -1px 3px rgba(22,82,160,0.5);box-shadow:inset 0 -1px 3px rgba(22,82,160,0.5)}.uploadcare-dialog-button-success:active{-ms-box-shadow:inset 0 1px 3px rgba(22,82,160,0.4);-moz-box-shadow:inset 0 1px 3px rgba(22,82,160,0.4);-webkit-box-shadow:inset 0 1px 3px rgba(22,82,160,0.4);-o-box-shadow:inset 0 1px 3px rgba(22,82,160,0.4);box-shadow:inset 0 1px 3px rgba(22,82,160,0.4)}.uploadcare-dialog-big-button{border-radius:100px;font-size:20px;font-weight:normal;letter-spacing:1px;color:white;line-height:64px;border:solid 1px #276fcb;text-shadow:0 -1px #2a7ce5;display:inline-block;padding:0 2em;cursor:pointer;-ms-box-shadow:inset 0 -2px #1f66c1;-moz-box-shadow:inset 0 -2px #1f66c1;-webkit-box-shadow:inset 0 -2px #1f66c1;-o-box-shadow:inset 0 -2px #1f66c1;box-shadow:inset 0 -2px #1f66c1;background:#458dee;background:-webkit-linear-gradient(#4892f6,#4289e6);background:-moz-linear-gradient(#4892f6,#4289e6);background:-o-linear-gradient(#4892f6,#4289e6);background:linear-gradient(#4892f6,#4289e6)}.uploadcare-dialog-big-button:hover{-ms-box-shadow:inset 0 -2px #1652a0;-moz-box-shadow:inset 0 -2px #1652a0;-webkit-box-shadow:inset 0 -2px #1652a0;-o-box-shadow:inset 0 -2px #1652a0;box-shadow:inset 0 -2px #1652a0;background:#3279d6;background:-webkit-linear-gradient(#3986eb,#2c6dc2);background:-moz-linear-gradient(#3986eb,#2c6dc2);background:-o-linear-gradient(#3986eb,#2c6dc2);background:linear-gradient(#3986eb,#2c6dc2)}.uploadcare-dialog-big-button:active{border:none;line-height:66px;-ms-box-shadow:inset 0 2px #2561b9;-moz-box-shadow:inset 0 2px #2561b9;-webkit-box-shadow:inset 0 2px #2561b9;-o-box-shadow:inset 0 2px #2561b9;box-shadow:inset 0 2px #2561b9;background:#2c6ec3;background:-webkit-linear-gradient(#2c6ec3,#2c6ec3);background:-moz-linear-gradient(#2c6ec3,#2c6ec3);background:-o-linear-gradient(#2c6ec3,#2c6ec3);background:linear-gradient(#2c6ec3,#2c6ec3)}.uploadcare-dialog-preview-image-wrap1{width:100%;height:456px;margin-bottom:22px;display:table}.uploadcare-dialog-preview-image-wrap2{display:table-cell;vertical-align:middle}.uploadcare-dialog-preview-image{max-width:100%;max-height:456px;display:block;margin:0 auto}.uploadcare-dialog-inner-footer{background:#fff3be;border-top:1px solid #efe2a9;height:33px;padding:16px 30px;margin:0 -25px -22px}.uploadcare-dialog-inner-footer .uploadcare-dialog-button-success{float:right}.uploadcare-dialog-inner-footer .uploadcare-dialog-button{float:left}.uploadcare-dialog-inner-footer .uploadcare-dialog-button-success,.uploadcare-dialog-inner-footer .uploadcare-dialog-button{width:112.5px;padding:0;text-align:center;margin-right:0}.uploadcare-dialog-inner-footer-text{text-align:center;color:#85732c;font-size:15px;line-height:33px}.uploadcare-dialog-inner-footer-text.uploadcare-error{color:red}.uploadcare-dialog-message-center{text-align:center;padding-top:110px}.uploadcare-dialog-preview-center{text-align:center;padding-top:176px}.uploadcare-dialog-preview-circle{width:66px;height:66px;display:inline-block;margin-bottom:22px}.uloadcare-dialog-error-tab-wrap{height:100%;text-align:center}.uloadcare-dialog-error-tab-wrap:before{vertical-align:middle;display:inline-block;content:'';height:100%}.uloadcare-dialog-error-tab-wrap .uploadcare-dialog-title{margin-bottom:12px}.uloadcare-dialog-error-tab-wrap .uloadcare-dialog-error-tab-illustration,.uloadcare-dialog-error-tab-wrap .uploadcare-dialog-normal-text{margin-bottom:38px}.uloadcare-dialog-error-tab-wrap .uploadcare-dialog-button-success{margin:0}.uloadcare-dialog-error-tab-wrap2{vertical-align:middle;display:inline-block;margin-top:-22px}.uloadcare-dialog-error-tab-illustration{display:inline-block;width:170px;height:120px;background-position:center;background-repeat:no-repeat}.uploadcare-no-draganddrop .uploadcare-if-draganddrop{display:none}.uploadcare-draganddrop .uploadcare-if-no-draganddrop{display:none}.uploadcare-dialog-file-drop-area{width:100%;height:100%;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;background:rgba(255,255,255,0.64);border:dashed 3px #c5cacd;text-align:center;border-radius:3px;padding-top:70px}.uploadcare-dialog-file-drop-area .uploadcare-dialog-big-button{margin-top:11px;margin-bottom:55px}.uploadcare-no-draganddrop .uploadcare-dialog-file-drop-area{border:none;padding-top:73px;background:transparent}.uploadcare-dialog-file-title{font-size:40px;line-height:1;color:#dee0e1;font-weight:bold;margin-bottom:66px;text-shadow:0 1px white}.uploadcare-no-draganddrop .uploadcare-dialog-file-title{text-shadow:none;color:black;margin-top:66px}.uploadcare-dialog-file-or{font-size:13px;color:#8f9498;margin-bottom:44px}.uploadcare-dialog-file-sources{position:relative;display:inline-block;padding:0 80px 0 100px;line-height:2em}.uploadcare-dialog-file-sources:before{background-repeat:no-repeat;content:'';display:block;position:absolute;width:67px;height:44px;padding:0;top:-30px;left:10px}.uploadcare-dialog-file-source{display:inline;font-size:15px;margin-right:.2em;cursor:pointer;font-weight:300;white-space:nowrap}.uploadcare-dialog-file-source:after{content:'\\00B7';color:#b7babc;margin-left:.5em}.uploadcare-dialog-file-source:last-child:after{display:none}.uploadcare-dragging .uploadcare-dialog-file-or,.uploadcare-dragging .uploadcare-dialog-file-sources,.uploadcare-dragging .uploadcare-dialog-file-drop-area .uploadcare-dialog-big-button{display:none}.uploadcare-dragging .uploadcare-dialog-file-drop-area{background-color:#f0f0f0;border-color:#b3b5b6;padding-top:264px}.uploadcare-dragging .uploadcare-dialog-file-title{color:#707478}.uploadcare-dragging.uploadcare-dialog-file-drop-area{background-color:#f2f7fe;border-color:#438ae7}.uploadcare-dragging.uploadcare-dialog-file-drop-area .uploadcare-dialog-file-title{color:#438ae7}.uploadcare-dpm-file-list{height:478px;overflow:auto;margin:0 -25px;padding:0 25px}.uploadcare-dpm-file-item{border-top:1px solid #e3e3e3;border-bottom:1px solid #e3e3e3;margin-bottom:-1px;padding:10px 0;font-size:13px;line-height:1;word-wrap:break-word}.uploadcare-dpm-file-item:last-child{margin-bottom:0}.uploadcare-dpm-file-item:hover,.uploadcare-dpm-file-item.ui-sortable-helper{background:#ececec}.uploadcare-dpm-file-item:hover .uploadcare-dpm-file-remove,.uploadcare-dpm-file-item.ui-sortable-helper .uploadcare-dpm-file-remove{display:inline-block}.uploadcare-dpm-file-item.ui-sortable-helper{cursor:move}.uploadcare-dpm-file-item.uploadcare-dpm-image .uploadcare-dpm-file-preview-wrap{display:inline-block}.uploadcare-dpm-file-item.uploadcare-dpm-image .uploadcare-dpm-file-name{width:60%}.uploadcare-dpm-file-item.uploadcare-dpm-image .uploadcare-dpm-file-name:before{display:none}.uploadcare-dpm-file-item.uploadcare-dpm-uploaded .uploadcare-dpm-file-progressbar-value{background:#8ac54c}.uploadcare-dpm-file-item.uploadcare-dpm-error .uploadcare-dpm-file-error{display:inline-block}.uploadcare-dpm-file-item.uploadcare-dpm-error .uploadcare-dpm-file-size,.uploadcare-dpm-file-item.uploadcare-dpm-error .uploadcare-dpm-file-progressbar-wrap{display:none}.uploadcare-dpm-file-preview-wrap,.uploadcare-dpm-file-name,.uploadcare-dpm-file-size,.uploadcare-dpm-file-progressbar-wrap,.uploadcare-dpm-file-error,.uploadcare-dpm-file-remove-wrap{vertical-align:middle;display:inline-block;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;padding:0 10px}.uploadcare-dpm-file-preview-wrap{text-align:center;width:8%;height:45px;display:none;padding:0;line-height:0}.uploadcare-dpm-file-name,.uploadcare-dpm-file-size,.uploadcare-dpm-file-error{padding-top:4px;padding-bottom:4px}.uploadcare-dpm-file-name:before,.uploadcare-dpm-file-error:before{content:'';display:inline-block;width:20px;height:20px;margin:-3.5px .7em -3.5px 0}.uploadcare-dpm-file-name{width:68%}.uploadcare-dpm-file-name:before{width:16px}.uploadcare-dpm-file-size{width:10%;padding-right:0;text-align:left}.uploadcare-dpm-file-progressbar-wrap{width:14%}.uploadcare-dpm-file-progressbar{width:80px;height:8px;background:#e0e0e0;border-radius:100px}.uploadcare-dpm-file-progressbar-value{height:100%;background:#d6b849;border-radius:100px}.uploadcare-dpm-file-error{width:24%;display:none;color:#f5444b}.uploadcare-dpm-file-remove-wrap{padding:0;padding-right:10px;width:8%;text-align:right;line-height:0}.uploadcare-dpm-file-remove{display:none;width:20px;height:20px;cursor:pointer}.uploadcare-dialog-source-base-wrap{height:616px;margin:-22px -25px;padding:22px 25px;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box}.uploadcare-dialog-multiple .uploadcare-dialog-source-base-wrap{height:550px;margin:-22px -25px 0}.uploadcare-dialog-remote-iframe-wrap{padding:0}.uploadcare-dialog-source-base-footer{display:none}.uploadcare-dialog-multiple .uploadcare-dialog-source-base-footer{display:block}.uploadcare-crop-widget .jcrop-holder{direction:ltr;text-align:left}.uploadcare-crop-widget .jcrop-vline,.uploadcare-crop-widget .jcrop-hline{background-color:white;background-position:top left;background-repeat:repeat;font-size:0;position:absolute}.uploadcare-crop-widget .jcrop-vline{height:100%;width:1px!important}.uploadcare-crop-widget .jcrop-hline{height:1px!important;width:100%}.uploadcare-crop-widget .jcrop-vline.right{right:0}.uploadcare-crop-widget .jcrop-hline.bottom{bottom:0}.uploadcare-crop-widget .jcrop-handle{background-color:#333;border:1px #eee solid;font-size:1px}.uploadcare-crop-widget .jcrop-tracker{height:100%;width:100%;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none}.uploadcare-crop-widget .jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0}.uploadcare-crop-widget .jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px}.uploadcare-crop-widget .jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%}.uploadcare-crop-widget .jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%}.uploadcare-crop-widget .jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0}.uploadcare-crop-widget .jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0}.uploadcare-crop-widget .jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0}.uploadcare-crop-widget .jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px}.uploadcare-crop-widget .jcrop-dragbar.ord-n,.uploadcare-crop-widget .jcrop-dragbar.ord-s{height:7px;width:100%}.uploadcare-crop-widget .jcrop-dragbar.ord-e,.uploadcare-crop-widget .jcrop-dragbar.ord-w{height:100%;width:7px}.uploadcare-crop-widget .jcrop-dragbar.ord-n{margin-top:-4px}.uploadcare-crop-widget .jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px}.uploadcare-crop-widget .jcrop-dragbar.ord-e{margin-right:-4px;right:0}.uploadcare-crop-widget .jcrop-dragbar.ord-w{margin-left:-4px}.uploadcare-crop-widget .jcrop-light .jcrop-vline,.uploadcare-crop-widget .jcrop-light .jcrop-hline{background:#FFF;filter:Alpha(opacity=70)!important;opacity:.70!important}.uploadcare-crop-widget .jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px}.uploadcare-crop-widget .jcrop-dark .jcrop-vline,.uploadcare-crop-widget .jcrop-dark .jcrop-hline{background:#000;filter:Alpha(opacity=70)!important;opacity:.7!important}.uploadcare-crop-widget .jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px}.uploadcare-crop-widget .jcrop-holder img,.uploadcare-crop-widget img.jcrop-preview{max-width:none}.uploadcare-crop-widget{font-family:\"Helvetica Neue\",Helvetica,Arial,\"Lucida Grande\",sans-serif;position:relative}.uploadcare-crop-widget .jcrop-holder{margin:0 auto;-webkit-transform:translateZ(0)}.uploadcare-crop-widget--loading{background-repeat:no-repeat;background-position:center}.uploadcare-crop-widget img{display:block}.uploadcare-crop-widget__error{text-align:center;display:none}.uploadcare-crop-widget--error .uploadcare-crop-widget__error{display:block}.uploadcare-crop-widget__error__title{font-size:20px}.uploadcare-crop-widget__error__text{font-size:15px}.uploadcare-widget{display:inline-block!important;position:relative;vertical-align:middle;padding:0 5px}.uploadcare-widget[data-status=loaded] .uploadcare-widget-button,.uploadcare-widget[data-status=started] .uploadcare-widget-button{display:none}.uploadcare-widget[data-status=started] .uploadcare-widget-buttons .uploadcare-widget-buttons-cancel,.uploadcare-widget[data-status=loaded] .uploadcare-widget-buttons .uploadcare-widget-buttons-remove{display:inline-block}.uploadcare-widget .uploadcare-widget-circle{width:25px;height:25px;top:-1px;float:left;margin-right:1ex}.uploadcare-widget-circle{position:relative}.uploadcare-widget-circle--text .uploadcare-widget-circle-back{position:relative;width:100%;height:100%;border-radius:50%;display:table}.uploadcare-widget-circle--text .uploadcare-widget-circle-text{display:table-cell;vertical-align:middle;text-align:center;font-size:60%;line-height:1}.uploadcare-widget-buttons{position:relative;top:-1px;float:left;overflow:hidden;margin:0;padding:0;list-style:none}.uploadcare-widget-buttons .uploadcare-widget-button{display:inline-block;height:24px;float:left;font-size:11px;color:#8f9295;line-height:25px;width:36px;padding:0 6px;margin:0 3px 1px 0;list-style:none;-ms-box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;border-radius:2px;background:#e1e5e7;cursor:default}.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-dialog,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-file,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-url{background-position:0 0;background-repeat:no-repeat;padding-left:30px}.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-dialog,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-url{background-position:0 -24px}.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-cancel,.uploadcare-widget-buttons .uploadcare-widget-button.uploadcare-widget-buttons-remove{font-size:.9em;display:none;width:auto}.uploadcare-widget-status-text{float:left;overflow:hidden;line-height:25px;height:25px;margin-right:1ex;white-space:nowrap;padding:0 5px}.uploadcare-widget-file-name{cursor:pointer;color:#1a85ad;border-bottom-color:#1a85ad;text-decoration:none;border-bottom:1px dotted}.uploadcare-widget-dragndrop-area{display:none;position:absolute;top:-8px;left:0;width:100%;height:41px;line-height:41px;text-align:center;background-color:#f0f0f0;color:#707478;border:1px dashed #b3b5b6;border-radius:20.5px}.uploadcare-widget.uploadcare-dragging .uploadcare-widget-dragndrop-area{background-color:#f2f7fe;border-color:#438ae7;color:#438ae7}.uploadcare-dragging .uploadcare-widget-dragndrop-area{display:block}.uploadcare-dialog-opened .uploadcare-widget-dragndrop-area{display:none}\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-file"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-file-drop-area" role="uploadcare-drop-area">\n <div class="uploadcare-dialog-file-title uploadcare-if-draganddrop">\n ',(""+t("dialog.tabs.file.drag")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n </div>\n <div class="uploadcare-dialog-file-title uploadcare-if-no-draganddrop">\n ',(""+t("dialog.tabs.file.nodrop")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n </div>\n <div class="uploadcare-dialog-file-or uploadcare-if-draganddrop">\n ',(""+t("dialog.tabs.file.or")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n </div>\n <div class="uploadcare-dialog-big-button" role="uploadcare-dialog-browse-file">\n ',(""+t("dialog.tabs.file.button")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"\n </div>\n ");if(tabs.length>1){__p.push('\n <div class="uploadcare-dialog-file-or">\n ',(""+t("dialog.tabs.file.also")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n </div>\n <div class="uploadcare-dialog-file-sources">\n ');for(var i=0;i<tabs.length;i++){var tab=tabs[i];if(tab=="file"){continue}__p.push('\n <div\n class="uploadcare-dialog-file-source"\n role="uploadcare-dialog-switch-tab"\n data-tab="',(""+tab).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'"\n >',(""+t("dialog.tabs.file.tabNames."+tab)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n ")}__p.push("\n </div>\n ")}__p.push("\n</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-error"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uloadcare-dialog-error-tab-wrap uloadcare-dialog-error-tab-',(""+error).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'">\n <div class="uloadcare-dialog-error-tab-wrap2">\n\n <div class="uloadcare-dialog-error-tab-illustration"></div>\n\n <div class="uploadcare-dialog-title">',(""+t("dialog.tabs.preview.error."+error+".title")||t("dialog.tabs.preview.error.default.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n\n <div class="uploadcare-dialog-normal-text">',(""+t("dialog.tabs.preview.error."+error+".text")||t("dialog.tabs.preview.error.default.text")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n\n <div class="uploadcare-dialog-button-success" \n role="uploadcare-dialog-preview-back">',(""+t("dialog.tabs.preview.error."+error+".back")||t("dialog.tabs.preview.error.default.back")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n\n </div>\n</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-image"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-title">',(""+t("dialog.tabs.preview.image.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n\n<div class="uploadcare-dialog-preview-image-wrap1">\n<div class="uploadcare-dialog-preview-image-wrap2">\n <!-- 1162x684 is 1.5 size of conteiner -->\n <img \n src="',(""+file.originalUrl).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'-/preview/1162x684/"\n title="',(""+(file.name||t("dialog.tabs.preview.unknownName"))).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'" \n alt="',(""+(file.name||t("dialog.tabs.preview.unknownName"))).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'"\n role="uploadcare-dialog-preview-image"\n class="uploadcare-dialog-preview-image"\n />\n</div>\n</div>\n\n<div class="uploadcare-dialog-inner-footer">\n <div \n class="uploadcare-dialog-button" \n role="uploadcare-dialog-preview-back">',(""+t("dialog.tabs.preview.image.change")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div \n class="uploadcare-dialog-button-success" \n role="uploadcare-dialog-preview-done">',(""+t("dialog.tabs.preview.done")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-multiple-file"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div role="uploadcare-dpm-file-item" class="uploadcare-dpm-file-item">\n <div class="uploadcare-dpm-file-preview-wrap" role="uploadcare-dpm-file-preview-wrap">\n </div><!--\n --><div role="uploadcare-dpm-file-name" class="uploadcare-dpm-file-name">\n ',(""+t("dialog.tabs.preview.unknownName")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n </div><!--\n --><div role="uploadcare-dpm-file-size" class="uploadcare-dpm-file-size"></div><!--\n --><div class="uploadcare-dpm-file-progressbar-wrap">\n <div class="uploadcare-dpm-file-progressbar">\n <div \n role="uploadcare-dpm-file-progressbar-value"\n class="uploadcare-dpm-file-progressbar-value"\n ></div>\n </div>\n </div><!--\n --><div role="uploadcare-dpm-file-error" class="uploadcare-dpm-file-error"></div><!--\n --><div class="uploadcare-dpm-file-remove-wrap">\n <div role="uploadcare-dpm-file-remove" class="uploadcare-dpm-file-remove"></div>\n </div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-multiple"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-title" role="uploadcare-dpm-title"></div>\n\n<div role="uploadcare-dpm-file-list" class="uploadcare-dpm-file-list"></div>\n\n<div class="uploadcare-dialog-inner-footer">\n <div \n class="uploadcare-dialog-button" \n role="uploadcare-dialog-preview-back">',(""+t("dialog.tabs.preview.multiple.clear")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div \n class="uploadcare-dialog-button-success" \n role="uploadcare-dialog-preview-done">',(""+t("dialog.tabs.preview.multiple.done")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n <div class="uploadcare-dialog-inner-footer-text" role="uploadcare-dpm-footer-text"></div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-regular"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-title">',(""+t("dialog.tabs.preview.regular.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n\n<div class="uploadcare-dialog-label">\n ',(""+(file.name||t("dialog.tabs.preview.unknownName"))).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"",(""+utils.readableFileSize(file.size,"",", ")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n</div>\n\n<div class="uploadcare-dialog-section uploadcare-dialog-normal-text">\n ',(""+t("dialog.tabs.preview.regular.line1")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"<br/>\n ",(""+t("dialog.tabs.preview.regular.line2")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n</div>\n\n<div \n class="uploadcare-dialog-button-success" \n role="uploadcare-dialog-preview-done">',(""+t("dialog.tabs.preview.done")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n<div \n class="uploadcare-dialog-button" \n role="uploadcare-dialog-preview-back">',(""+t("dialog.tabs.preview.change")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-preview-unknown"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-title">',(""+t("dialog.tabs.preview.unknown.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n\n<div class="uploadcare-dialog-label">\n ',(""+(file.name||t("dialog.tabs.preview.unknownName"))).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"",(""+utils.readableFileSize(file.size,"",", ")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'\n</div>\n\n<div \n class="uploadcare-dialog-button-success"\n role="uploadcare-dialog-preview-done">',(""+t("dialog.tabs.preview.unknown.done")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-url"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-title">',(""+t("dialog.tabs.url.title")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n<div class="uploadcare-dialog-section uploadcare-dialog-normal-text">\n <div>',(""+t("dialog.tabs.url.line1")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n <div>",(""+t("dialog.tabs.url.line2")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'</div>\n</div>\n<form role="uploadcare-dialog-url-form">\n <input type="text" class="uploadcare-dialog-input" role="uploadcare-dialog-url-input" placeholder="',(""+t("dialog.tabs.url.input")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),'">\n <button class="uploadcare-dialog-button" type="submit" role="uploadcare-dialog-url-submit">',(""+t("dialog.tabs.url.button")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</button>\n</form>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/tab-welcome"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-dialog-message-center">\n <div class="uploadcare-dialog-big-title">Hello!</div>\n <div class="uploadcare-dialog-large-text">\n <div>Your <a href="https://uploadcare.com/accounts/settings/">public key</a> is not set.</div>\n <div>Add this to the <head> tag to start uploading files:</div>\n <div class="uploadcare-pre"><script>\nUPLOADCARE_PUBLIC_KEY = \'your_public_key\';\n</script></div>\n </div>\n</div>\n')}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/widget-button"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div\n role="uploadcare-widget-buttons-',name,'"\n class="uploadcare-widget-button uploadcare-widget-buttons-',name,'"\n>',(""+caption).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/widget-file-name"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<span\n role="uploadcare-widget-file-name"\n class="uploadcare-widget-file-name">',(""+utils.fitText(name,16)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</span>,\n",(""+utils.readableFileSize(size)).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"\n")}return __p.join("")}}).call(this);(function(){this.JST||(this.JST={});this.JST["uploadcare/templates/widget"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div class="uploadcare-widget">\n <div role="uploadcare-widget-status"></div>\n <div role="uploadcare-widget-status-text" class="uploadcare-widget-status-text"></div>\n <div role="uploadcare-widget-buttons" class="uploadcare-widget-buttons"></div>\n <div class="uploadcare-widget-dragndrop-area" role="uploadcare-drop-area">',(""+t("draghere")).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/"),"</div>\n</div>\n")}return __p.join("")}}).call(this);(function(){var locale,namespace,utils;namespace=uploadcare.namespace,locale=uploadcare.locale,utils=uploadcare.utils;namespace("uploadcare.templates",function(ns){return ns.tpl=function(key,ctx){var fn;if(ctx==null){ctx={}}fn=JST["uploadcare/templates/"+key];if(fn!=null){ctx.t=locale.t;ctx.utils=utils;return fn(ctx)}else{return""}}})}).call(this);(function(){var $,tpl;$=uploadcare.jQuery;tpl=uploadcare.templates.tpl;uploadcare.settings.waitForSettings(null,function(){var css,style;css=tpl("styles");style=document.createElement("style");style.setAttribute("type","text/css");if(style.styleSheet!=null){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}return $("head").prepend(style)})}).call(this);(function($){$.Jcrop=function(obj,opt){var options=$.extend({},$.Jcrop.defaults),docOffset,lastcurs;function px(n){return Math.round(n)+"px"}function cssClass(cl){return options.baseClass+"-"+cl}function supportsColorFade(){return $.fx.step.hasOwnProperty("backgroundColor")}function getPos(obj){var pos=$(obj).offset();return[pos.left,pos.top]}function mouseAbs(e){return[(e.pageX-docOffset[0]),(e.pageY-docOffset[1])]}function setOptions(opt){if(typeof(opt)!=="object"){opt={}}options=$.extend(options,opt);$.each(["onChange","onSelect","onRelease","onDblClick"],function(i,e){if(typeof(options[e])!=="function"){options[e]=function(){}}})}function startDragMode(mode,pos){docOffset=getPos($img);Tracker.setCursor(mode==="move"?mode:mode+"-resize");if(mode==="move"){return Tracker.activateHandlers(createMover(pos),doneSelect)}var fc=Coords.getFixed();var opp=oppLockCorner(mode);var opc=Coords.getCorner(oppLockCorner(opp));Coords.setPressed(Coords.getCorner(opp));Coords.setCurrent(opc);Tracker.activateHandlers(dragmodeHandler(mode,fc),doneSelect)}function dragmodeHandler(mode,f){return function(pos){if(!options.aspectRatio){switch(mode){case"e":pos[1]=f.y2;break;case"w":pos[1]=f.y2;break;case"n":pos[0]=f.x2;break;case"s":pos[0]=f.x2;break}}else{switch(mode){case"e":pos[1]=f.y+1;break;case"w":pos[1]=f.y+1;break;case"n":pos[0]=f.x+1;break;case"s":pos[0]=f.x+1;break}}Coords.setCurrent(pos);Selection.update()}}function createMover(pos){var lloc=pos;KeyManager.watchKeys();return function(pos){Coords.moveOffset([pos[0]-lloc[0],pos[1]-lloc[1]]);lloc=pos;Selection.update()}}function oppLockCorner(ord){switch(ord){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function createDragger(ord){return function(e){if(options.disabled){return false}if((ord==="move")&&!options.allowMove){return false}docOffset=getPos($img);btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false}}function presize($obj,w,h){var nw=$obj.width(),nh=$obj.height();if((nw>w)&&w>0){nw=w;nh=(w/$obj.width())*$obj.height()}if((nh>h)&&h>0){nh=h;nw=(h/$obj.height())*$obj.width()}xscale=$obj.width()/nw;yscale=$obj.height()/nh;$obj.width(nw).height(nh)}function unscale(c){return{x:c.x*xscale,y:c.y*yscale,x2:c.x2*xscale,y2:c.y2*yscale,w:c.w*xscale,h:c.h*yscale}}function doneSelect(pos){var c=Coords.getFixed();if((c.w>options.minSelect[0])&&(c.h>options.minSelect[1])){Selection.enableHandles();Selection.done()}else{Selection.release()}Tracker.setCursor(options.allowSelect?"crosshair":"default")}function newSelection(e){if(options.disabled){return false}if(!options.allowSelect){return false}btndown=true;docOffset=getPos($img);Selection.disableHandles();Tracker.setCursor("crosshair");var pos=mouseAbs(e);Coords.setPressed(pos);Selection.update();Tracker.activateHandlers(selectDrag,doneSelect);KeyManager.watchKeys();e.stopPropagation();e.preventDefault();return false}function selectDrag(pos){Coords.setCurrent(pos);Selection.update()}function newTracker(){var trk=$("<div></div>").addClass(cssClass("tracker"));trk.css({opacity:0,backgroundColor:"white"});return trk}if(typeof(obj)!=="object"){obj=$(obj)[0]}if(typeof(opt)!=="object"){opt={}}setOptions(opt);var img_css={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0};var $origimg=$(obj),img_mode=true;if(obj.tagName=="IMG"){if($origimg[0].width!=0&&$origimg[0].height!=0){$origimg.width($origimg[0].width);$origimg.height($origimg[0].height)}else{var tempImage=new Image();tempImage.src=$origimg[0].src;$origimg.width(tempImage.width);$origimg.height(tempImage.height)}var $img=$origimg.clone().removeAttr("id").css(img_css).show();$img.width($origimg.width());$img.height($origimg.height());$origimg.after($img).hide()}else{$img=$origimg.css(img_css).show();img_mode=false;if(options.shade===null){options.shade=true}}presize($img,options.boxWidth,options.boxHeight);var boundx=$img.width(),boundy=$img.height(),$div=$("<div />").width(boundx).height(boundy).addClass(cssClass("holder")).css({position:"relative",backgroundColor:options.bgColor}).insertAfter($origimg).append($img);if(options.addClass){$div.addClass(options.addClass)}var $img2=$("<div />"),$img_holder=$("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),$hdl_holder=$("<div />").width("100%").height("100%").css("zIndex",320),$sel=$("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var c=Coords.getFixed();options.onDblClick.call(api,c)}).insertBefore($img).append($img_holder,$hdl_holder);if(img_mode){$img2=$("<img />").attr("src",$img.attr("src")).css(img_css).width(boundx).height(boundy),$img_holder.append($img2)}var bound=options.boundary;var $trk=newTracker().width(boundx+(bound*2)).height(boundy+(bound*2)).css({position:"absolute",top:px(-bound),left:px(-bound),zIndex:290}).mousedown(newSelection);var bgcolor=options.bgColor,bgopacity=options.bgOpacity,xlimit,ylimit,xmin,ymin,xscale,yscale,enabled=true,btndown,animating,shift_down;docOffset=getPos($img);var Touch=(function(){function hasTouchSupport(){var support={},events=["touchstart","touchmove","touchend"],el=document.createElement("div"),i;try{for(i=0;i<events.length;i++){var eventName=events[i];eventName="on"+eventName;var isSupported=(eventName in el);if(!isSupported){el.setAttribute(eventName,"return;");isSupported=typeof el[eventName]=="function"}support[events[i]]=isSupported}return support.touchstart&&support.touchend&&support.touchmove}catch(err){return false}}function detectSupport(){if((options.touchSupport===true)||(options.touchSupport===false)){return options.touchSupport}else{return hasTouchSupport()}}return{createDragger:function(ord){return function(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;if(options.disabled){return false}if((ord==="move")&&!options.allowMove){return false}btndown=true;startDragMode(ord,mouseAbs(e));e.stopPropagation();e.preventDefault();return false}},newSelection:function(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return newSelection(e)},isSupported:hasTouchSupport,support:detectSupport()}}());var Coords=(function(){var x1=0,y1=0,x2=0,y2=0,ox,oy;function setPressed(pos){pos=rebound(pos);x2=x1=pos[0];y2=y1=pos[1]}function setCurrent(pos){pos=rebound(pos);ox=pos[0]-x2;oy=pos[1]-y2;x2=pos[0];y2=pos[1]}function getOffset(){return[ox,oy]}function moveOffset(offset){var ox=offset[0],oy=offset[1];if(0>x1+ox){ox-=ox+x1}if(0>y1+oy){oy-=oy+y1}if(boundy<y2+oy){oy+=boundy-(y2+oy)}if(boundx<x2+ox){ox+=boundx-(x2+ox)}x1+=ox;x2+=ox;y1+=oy;y2+=oy}function getCorner(ord){var c=getFixed();switch(ord){case"ne":return[c.x2,c.y];case"nw":return[c.x,c.y];case"se":return[c.x2,c.y2];case"sw":return[c.x,c.y2]}}function getFixed(){if(!options.aspectRatio){return getRect()}var aspect=options.aspectRatio,min_x=options.minSize[0]/xscale,max_x=options.maxSize[0]/xscale,max_y=options.maxSize[1]/yscale,rw=x2-x1,rh=y2-y1,rwa=Math.abs(rw),rha=Math.abs(rh),real_ratio=rwa/rha,xx,yy,w,h;if(max_x===0){max_x=boundx*10}if(max_y===0){max_y=boundy*10}if(real_ratio<aspect){yy=y2;w=rha*aspect;xx=rw<0?x1-w:w+x1;if(xx<0){xx=0;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1}else{if(xx>boundx){xx=boundx;h=Math.abs((xx-x1)/aspect);yy=rh<0?y1-h:h+y1}}}else{xx=x2;h=rwa/aspect;yy=rh<0?y1-h:y1+h;if(yy<0){yy=0;w=Math.abs((yy-y1)*aspect);xx=rw<0?x1-w:w+x1}else{if(yy>boundy){yy=boundy;w=Math.abs(yy-y1)*aspect;xx=rw<0?x1-w:w+x1}}}if(xx>x1){if(xx-x1<min_x){xx=x1+min_x}else{if(xx-x1>max_x){xx=x1+max_x}}if(yy>y1){yy=y1+(xx-x1)/aspect}else{yy=y1-(xx-x1)/aspect}}else{if(xx<x1){if(x1-xx<min_x){xx=x1-min_x}else{if(x1-xx>max_x){xx=x1-max_x}}if(yy>y1){yy=y1+(x1-xx)/aspect}else{yy=y1-(x1-xx)/aspect}}}if(xx<0){x1-=xx;xx=0}else{if(xx>boundx){x1-=xx-boundx;xx=boundx}}if(yy<0){y1-=yy;yy=0}else{if(yy>boundy){y1-=yy-boundy;yy=boundy}}return makeObj(flipCoords(x1,y1,xx,yy))}function rebound(p){if(p[0]<0){p[0]=0}if(p[1]<0){p[1]=0}if(p[0]>boundx){p[0]=boundx}if(p[1]>boundy){p[1]=boundy}return[p[0],p[1]]}function flipCoords(x1,y1,x2,y2){var xa=x1,xb=x2,ya=y1,yb=y2;if(x2<x1){xa=x2;xb=x1}if(y2<y1){ya=y2;yb=y1}return[xa,ya,xb,yb]}function getRect(){var xsize=x2-x1,ysize=y2-y1,delta;if(xlimit&&(Math.abs(xsize)>xlimit)){x2=(xsize>0)?(x1+xlimit):(x1-xlimit)}if(ylimit&&(Math.abs(ysize)>ylimit)){y2=(ysize>0)?(y1+ylimit):(y1-ylimit)}if(ymin/yscale&&(Math.abs(ysize)<ymin/yscale)){y2=(ysize>0)?(y1+ymin/yscale):(y1-ymin/yscale)}if(xmin/xscale&&(Math.abs(xsize)<xmin/xscale)){x2=(xsize>0)?(x1+xmin/xscale):(x1-xmin/xscale)}if(x1<0){x2-=x1;x1-=x1}if(y1<0){y2-=y1;y1-=y1}if(x2<0){x1-=x2;x2-=x2}if(y2<0){y1-=y2;y2-=y2}if(x2>boundx){delta=x2-boundx;x1-=delta;x2-=delta}if(y2>boundy){delta=y2-boundy;y1-=delta;y2-=delta}if(x1>boundx){delta=x1-boundy;y2-=delta;y1-=delta}if(y1>boundy){delta=y1-boundy;y2-=delta;y1-=delta}return makeObj(flipCoords(x1,y1,x2,y2))}function makeObj(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}return{flipCoords:flipCoords,setPressed:setPressed,setCurrent:setCurrent,getOffset:getOffset,moveOffset:moveOffset,getCorner:getCorner,getFixed:getFixed}}());var Shade=(function(){var enabled=false,holder=$("<div />").css({position:"absolute",zIndex:240,opacity:0}),shades={top:createShade(),left:createShade().height(boundy),right:createShade().height(boundy),bottom:createShade()};function resizeShades(w,h){shades.left.css({height:px(h)});shades.right.css({height:px(h)})}function updateAuto(){return updateShade(Coords.getFixed())}function updateShade(c){shades.top.css({left:px(c.x),width:px(c.w),height:px(c.y)});shades.bottom.css({top:px(c.y2),left:px(c.x),width:px(c.w),height:px(boundy-c.y2)});shades.right.css({left:px(c.x2),width:px(boundx-c.x2)});shades.left.css({width:px(c.x)})}function createShade(){return $("<div />").css({position:"absolute",backgroundColor:options.shadeColor||options.bgColor}).appendTo(holder)}function enableShade(){if(!enabled){enabled=true;holder.insertBefore($img);updateAuto();Selection.setBgOpacity(1,0,1);$img2.hide();setBgColor(options.shadeColor||options.bgColor,1);if(Selection.isAwake()){setOpacity(options.bgOpacity,1)}else{setOpacity(1,1)}}}function setBgColor(color,now){colorChangeMacro(getShades(),color,now)}function disableShade(){if(enabled){holder.remove();$img2.show();enabled=false;if(Selection.isAwake()){Selection.setBgOpacity(options.bgOpacity,1,1)}else{Selection.setBgOpacity(1,1,1);Selection.disableHandles()}colorChangeMacro($div,0,1)}}function setOpacity(opacity,now){if(enabled){if(options.bgFade&&!now){holder.animate({opacity:1-opacity},{queue:false,duration:options.fadeTime})}else{holder.css({opacity:1-opacity})}}}function refreshAll(){options.shade?enableShade():disableShade();if(Selection.isAwake()){setOpacity(options.bgOpacity)}}function getShades(){return holder.children()}return{update:updateAuto,updateRaw:updateShade,getShades:getShades,setBgColor:setBgColor,enable:enableShade,disable:disableShade,resize:resizeShades,refresh:refreshAll,opacity:setOpacity}}());var Selection=(function(){var awake,hdep=370,borders={},handle={},dragbar={},seehandles=false;function insertBorder(type){var jq=$("<div />").css({position:"absolute",opacity:options.borderOpacity}).addClass(cssClass(type));$img_holder.append(jq);return jq}function dragDiv(ord,zi){var jq=$("<div />").mousedown(createDragger(ord)).css({cursor:ord+"-resize",position:"absolute",zIndex:zi}).addClass("ord-"+ord);if(Touch.support){jq.bind("touchstart.jcrop",Touch.createDragger(ord))}$hdl_holder.append(jq);return jq}function insertHandle(ord){var hs=options.handleSize;return dragDiv(ord,hdep++).css({opacity:options.handleOpacity}).width(hs).height(hs).addClass(cssClass("handle"))}function insertDragbar(ord){return dragDiv(ord,hdep++).addClass("jcrop-dragbar")}function createDragbars(li){var i;for(i=0;i<li.length;i++){dragbar[li[i]]=insertDragbar(li[i])}}function createBorders(li){var cl,i;for(i=0;i<li.length;i++){switch(li[i]){case"n":cl="hline";break;case"s":cl="hline bottom";break;case"e":cl="vline right";break;case"w":cl="vline";break}borders[li[i]]=insertBorder(cl)}}function createHandles(li){var i;for(i=0;i<li.length;i++){handle[li[i]]=insertHandle(li[i])}}function moveto(x,y){if(!options.shade){$img2.css({top:px(-y),left:px(-x)})}$sel.css({top:px(y),left:px(x)})}function resize(w,h){$sel.width(Math.round(w)).height(Math.round(h))}function refresh(){var c=Coords.getFixed();Coords.setPressed([c.x,c.y]);Coords.setCurrent([c.x2,c.y2]);updateVisible()}function updateVisible(select){if(awake){return update(select)}}function update(select){var c=Coords.getFixed();resize(c.w,c.h);moveto(c.x,c.y);if(options.shade){Shade.updateRaw(c)}awake||show();if(select){options.onSelect.call(api,unscale(c))}else{options.onChange.call(api,unscale(c))}}function setBgOpacity(opacity,force,now){if(!awake&&!force){return}if(options.bgFade&&!now){$img.animate({opacity:opacity},{queue:false,duration:options.fadeTime})}else{$img.css("opacity",opacity)}}function show(){$sel.show();if(options.shade){Shade.opacity(bgopacity)}else{setBgOpacity(bgopacity,true)}awake=true}function release(){disableHandles();$sel.hide();if(options.shade){Shade.opacity(1)}else{setBgOpacity(1)}awake=false;options.onRelease.call(api)}function showHandles(){if(seehandles){$hdl_holder.show()}}function enableHandles(){seehandles=true;if(options.allowResize){$hdl_holder.show();return true}}function disableHandles(){seehandles=false;$hdl_holder.hide()}function animMode(v){if(v){animating=true;disableHandles()}else{animating=false;enableHandles()}}function done(){animMode(false);refresh()}if(options.dragEdges&&$.isArray(options.createDragbars)){createDragbars(options.createDragbars)}if($.isArray(options.createHandles)){createHandles(options.createHandles)}if(options.drawBorders&&$.isArray(options.createBorders)){createBorders(options.createBorders)}$(document).bind("touchstart.jcrop-ios",function(e){if($(e.currentTarget).hasClass("jcrop-tracker")){e.stopPropagation()}});var $track=newTracker().mousedown(createDragger("move")).css({cursor:"move",position:"absolute",zIndex:360});if(Touch.support){$track.bind("touchstart.jcrop",Touch.createDragger("move"))}$img_holder.append($track);disableHandles();return{updateVisible:updateVisible,update:update,release:release,refresh:refresh,isAwake:function(){return awake},setCursor:function(cursor){$track.css("cursor",cursor)},enableHandles:enableHandles,enableOnly:function(){seehandles=true},showHandles:showHandles,disableHandles:disableHandles,animMode:animMode,setBgOpacity:setBgOpacity,done:done}}());var Tracker=(function(){var onMove=function(){},onDone=function(){},trackDoc=options.trackDocument;function toFront(){$trk.css({zIndex:450});if(Touch.support){$(document).bind("touchmove.jcrop",trackTouchMove).bind("touchend.jcrop",trackTouchEnd)}if(trackDoc){$(document).bind("mousemove.jcrop",trackMove).bind("mouseup.jcrop",trackUp)}}function toBack(){$trk.css({zIndex:290});$(document).unbind(".jcrop")}function trackMove(e){onMove(mouseAbs(e));return false}function trackUp(e){e.preventDefault();e.stopPropagation();if(btndown){btndown=false;onDone(mouseAbs(e));if(Selection.isAwake()){options.onSelect.call(api,unscale(Coords.getFixed()))}toBack();onMove=function(){};onDone=function(){}}return false}function activateHandlers(move,done){btndown=true;onMove=move;onDone=done;toFront();return false}function trackTouchMove(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return trackMove(e)}function trackTouchEnd(e){e.pageX=e.originalEvent.changedTouches[0].pageX;e.pageY=e.originalEvent.changedTouches[0].pageY;return trackUp(e)}function setCursor(t){$trk.css("cursor",t)}if(!trackDoc){$trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp)}$img.before($trk);return{activateHandlers:activateHandlers,setCursor:setCursor}}());var KeyManager=(function(){var $keymgr=$('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),$keywrap=$("<div />").css({position:"absolute",overflow:"hidden"}).append($keymgr);function watchKeys(){if(options.keySupport){$keymgr.show();$keymgr.focus()}}function onBlur(e){$keymgr.hide()}function doNudge(e,x,y){if(options.allowMove){Coords.moveOffset([x,y]);Selection.updateVisible(true)}e.preventDefault();e.stopPropagation()}function parseKey(e){if(e.ctrlKey||e.metaKey){return true}shift_down=e.shiftKey?true:false;var nudge=shift_down?10:1;switch(e.keyCode){case 37:doNudge(e,-nudge,0);break;case 39:doNudge(e,nudge,0);break;case 38:doNudge(e,0,-nudge);break;case 40:doNudge(e,0,nudge);break;case 27:if(options.allowSelect){Selection.release()}break;case 9:return true}return false}if(options.keySupport){$keymgr.keydown(parseKey).blur(onBlur);$keymgr.css({position:"absolute",left:"-20px"});$keywrap.append($keymgr).insertBefore($img)}return{watchKeys:watchKeys}}());function setClass(cname){$div.removeClass().addClass(cssClass("holder")).addClass(cname)}function setSelect(rect){setSelectRaw([rect[0]/xscale,rect[1]/yscale,rect[2]/xscale,rect[3]/yscale]);options.onSelect.call(api,unscale(Coords.getFixed()));Selection.enableHandles()}function setSelectRaw(l){Coords.setPressed([l[0],l[1]]);Coords.setCurrent([l[2],l[3]]);Selection.update()}function tellSelect(){return unscale(Coords.getFixed())}function tellScaled(){return Coords.getFixed()}function setOptionsNew(opt){setOptions(opt);interfaceUpdate()}function disableCrop(){options.disabled=true;Selection.disableHandles();Selection.setCursor("default");Tracker.setCursor("default")}function enableCrop(){options.disabled=false;interfaceUpdate()}function cancelCrop(){Selection.done();Tracker.activateHandlers(null,null)}function destroy(){$div.remove();$origimg.show();$origimg.css("visibility","visible");$(obj).removeData("Jcrop")}function colorChangeMacro($obj,color,now){var mycolor=color||options.bgColor;if(options.bgFade&&supportsColorFade()&&options.fadeTime&&!now){$obj.animate({backgroundColor:mycolor},{queue:false,duration:options.fadeTime})}else{$obj.css("backgroundColor",mycolor)}}function interfaceUpdate(alt){if(options.allowResize){if(alt){Selection.enableOnly()}else{Selection.enableHandles()}}else{Selection.disableHandles()}Tracker.setCursor(options.allowSelect?"crosshair":"default");Selection.setCursor(options.allowMove?"move":"default");if(options.hasOwnProperty("trueSize")){xscale=options.trueSize[0]/boundx;yscale=options.trueSize[1]/boundy}if(options.hasOwnProperty("setSelect")){setSelect(options.setSelect);Selection.done();delete (options.setSelect)}Shade.refresh();if(options.bgColor!=bgcolor){colorChangeMacro(options.shade?Shade.getShades():$div,options.shade?(options.shadeColor||options.bgColor):options.bgColor);bgcolor=options.bgColor}if(bgopacity!=options.bgOpacity){bgopacity=options.bgOpacity;if(options.shade){Shade.refresh()}else{Selection.setBgOpacity(bgopacity)}}xlimit=options.maxSize[0]||0;ylimit=options.maxSize[1]||0;xmin=options.minSize[0]||0;ymin=options.minSize[1]||0;if(options.hasOwnProperty("outerImage")){$img.attr("src",options.outerImage);delete (options.outerImage)}Selection.refresh()}if(Touch.support){$trk.bind("touchstart.jcrop",Touch.newSelection)}$hdl_holder.hide();interfaceUpdate(true);var api={setSelect:setSelect,setOptions:setOptionsNew,tellSelect:tellSelect,tellScaled:tellScaled,setClass:setClass,disable:disableCrop,enable:enableCrop,cancel:cancelCrop,release:Selection.release,destroy:destroy,focus:KeyManager.watchKeys,getBounds:function(){return[boundx*xscale,boundy*yscale]},getWidgetSize:function(){return[boundx,boundy]},getScaleFactor:function(){return[xscale,yscale]},getOptions:function(){return options},ui:{holder:$div,selection:$sel}};$origimg.data("Jcrop",api);return api};$.fn.Jcrop=function(options,callback){var api;this.each(function(){if($(this).data("Jcrop")){if(options==="api"){return $(this).data("Jcrop")}else{$(this).data("Jcrop").setOptions(options)}}else{if(this.tagName=="IMG"){$.Jcrop.Loader(this,function(){$(this).css({display:"block",visibility:"hidden"});api=$.Jcrop(this,options);if($.isFunction(callback)){callback.call(api)}})}else{$(this).css({display:"block",visibility:"hidden"});api=$.Jcrop(this,options);if($.isFunction(callback)){callback.call(api)}}}});return this};$.Jcrop.Loader=function(imgobj,success,error){var $img=$(imgobj),img=$img[0];function completeCheck(){if(img.complete){$img.unbind(".jcloader");if($.isFunction(success)){success.call(img)}}else{window.setTimeout(completeCheck,50)}}$img.bind("load.jcloader",completeCheck).bind("error.jcloader",function(e){$img.unbind(".jcloader");if($.isFunction(error)){error.call(img)}});if(img.complete&&$.isFunction(success)){$img.unbind(".jcloader");success.call(img)}};$.Jcrop.defaults={allowSelect:true,allowMove:true,allowResize:true,trackDocument:true,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:0.6,bgFade:false,borderOpacity:0.4,handleOpacity:0.5,handleSize:7,aspectRatio:0,keySupport:true,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:true,dragEdges:true,fixedSupport:true,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}}(uploadcare.jQuery));(function(){var $,namespace,tpl,utils,_ref;namespace=uploadcare.namespace,$=uploadcare.jQuery,(_ref=uploadcare.templates,tpl=_ref.tpl),utils=uploadcare.utils;namespace("uploadcare.crop",function(ns){return ns.CropWidget=(function(){var IMAGE_CLEARED,LOADING_ERROR,cropModifierRegExp,defaultOptions,prepareOptions;defaultOptions={container:null,scale:false,upscale:false,notLess:false,widgetSize:null,preferedSize:null};LOADING_ERROR="loadingerror";IMAGE_CLEARED="imagecleared";prepareOptions=function(options){var fited,willBe;if(!options.container){throw new Error("options.container must be specified")}if(!options.preferedSize){options.scale=false;options.upscale=false;options.notLess=false}if(options.scale){fited=utils.fitSizeInCdnLimit(options.preferedSize);if(fited[0]!==options.preferedSize[0]){willBe=""+(fited.join("x"))+(options.upscale?"":" or smaller");utils.warnOnce("Specified preferred crop size is bigger than our CDN allows.\nResulting image size will be "+willBe+".");return options.preferedSize=fited}}};function CropWidget(options){this.__options=$.extend({},defaultOptions,options);prepareOptions(this.__options);this.onStateChange=$.Callbacks();this.__buildWidget()}CropWidget.prototype.croppedImageUrl=function(previewUrl,size){var _this=this;return this.croppedImageModifiers(previewUrl,size).then(function(opts){return _this.__url+opts.modifiers})};cropModifierRegExp=/-\/crop\/([0-9]+)x([0-9]+)(\/(center|([0-9]+),([0-9]+)))?\//i;CropWidget.prototype.__parseModifiers=function(modifiers){var raw;if(raw=modifiers!=null?modifiers.match(cropModifierRegExp):void 0){return{width:parseInt(raw[1],10),height:parseInt(raw[2],10),center:raw[4]==="center",left:parseInt(raw[5],10)||void 0,top:parseInt(raw[6],10)||void 0}}};CropWidget.prototype.croppedImageModifiers=function(previewUrl,size,modifiers){var _this=this;return this.croppedImageCoords(previewUrl,size,this.__parseModifiers(modifiers)).then(function(coords){var downscale,notTouched,opts,resized,topLeft,upscale;size=""+coords.width+"x"+coords.height;topLeft=""+coords.left+","+coords.top;opts={crop:$.extend({},coords),modifiers:"-/crop/"+size+"/"+topLeft+"/"};notTouched=coords.width===_this.__originalSize[0]&&coords.height===_this.__originalSize[1];if(notTouched&&!_this.__options.scale){opts.modifiers=""}else{downscale=_this.__options.scale&&coords.width>_this.__options.preferedSize[0];upscale=_this.__options.upscale&&coords.width<_this.__options.preferedSize[0];if(downscale||upscale){resized=_this.__options.preferedSize.slice()}else{resized=utils.fitSizeInCdnLimit([coords.width,coords.height])}if(resized[0]!==coords.width||resized[1]!==coords.height){opts.crop.sw=resized[0],opts.crop.sh=resized[1];resized[0+(resized[0]>resized[1])]="";opts.modifiers+="-/resize/"+(resized.join("x"))+"/"}}return opts})};CropWidget.prototype.croppedImageCoords=function(previewUrl,size,coords){this.__clearImage();this.__calcSizes(size);this.__setImage(previewUrl);this.__initJcrop(coords);return this.__deferred.promise()};CropWidget.prototype.forceDone=function(){if(this.__state==="loaded"){return this.__deferred.resolve(this.getCurrentCoords())}else{throw new Error("not ready")}};CropWidget.prototype.getCurrentCoords=function(){var scaleX,scaleY,_ref1;_ref1=this.__resizedScale,scaleX=_ref1[0],scaleY=_ref1[1];return{left:Math.round(this.__currentCoords.left/scaleX),top:Math.round(this.__currentCoords.top/scaleY),width:Math.round(this.__currentCoords.width/scaleX),height:Math.round(this.__currentCoords.height/scaleY)}};CropWidget.prototype.destroy=function(){this.__clearImage();this.__widgetElement.remove();return this.__widgetElement=null};CropWidget.prototype.__buildWidget=function(){this.container=$(this.__options.container);this.__widgetElement=$(tpl("crop-widget")).appendTo(this.container);return this.__setState("waiting")};CropWidget.prototype.__clearImage=function(){var _ref1,_ref2,_ref3;if((_ref1=this.__jCropApi)!=null){_ref1.destroy()}if((_ref2=this.__img)!=null){_ref2.off().remove()}if((_ref3=this.__deferred)!=null){_ref3.reject(IMAGE_CLEARED)}this.__deferred=$.Deferred();return this.__setState("waiting")};CropWidget.prototype.__setImage=function(__url){var _this=this;this.__url=__url;return this.__img=$("<img/>").css({margin:"0 auto"}).on("error",function(){_this.__setState("error");_this.__deferred.reject(LOADING_ERROR);return _this.__img.remove()}).attr({src:this.__url,width:this.__resizedSize[0],height:this.__resizedSize[1]}).appendTo(this.__widgetElement)};CropWidget.prototype.__calcSizes=function(originalSize){var resizedSize,widgetSize;widgetSize=this.__options.widgetSize||[this.container.width(),this.container.height()];resizedSize=utils.fitSize(originalSize,widgetSize);this.__originalSize=originalSize;this.__resizedSize=resizedSize;return this.__resizedScale=[resizedSize[0]/originalSize[0],resizedSize[1]/originalSize[1]]};CropWidget.prototype.__setState=function(state){var prefix,s;if(this.__state===state){return}this.__state=state;prefix="uploadcare-crop-widget--";this.__widgetElement.removeClass(((function(){var _i,_len,_ref1,_results;_ref1=["error","loading","loaded","waiting"];_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){s=_ref1[_i];_results.push(prefix+s)}return _results})()).join(" ")).addClass(prefix+state);return this.onStateChange.fire(state)};CropWidget.prototype.__initJcrop=function(previousCoords){var done,jCropOptions,left,preferedSize,scaleX,scaleY,top,_ref1,_ref2,_ref3,_this=this;jCropOptions={onSelect:function(coords){return _this.__currentCoords={height:coords.h,width:coords.w,left:coords.x,top:coords.y}}};if(this.__options.preferedSize){jCropOptions.aspectRatio=this.__options.preferedSize[0]/this.__options.preferedSize[1]}if(!previousCoords){previousCoords={center:true};if(this.__options.preferedSize){_ref1=utils.fitSize(this.__options.preferedSize,this.__originalSize,true),previousCoords.width=_ref1[0],previousCoords.height=_ref1[1]}else{_ref2=this.__originalSize,previousCoords.width=_ref2[0],previousCoords.height=_ref2[1]}}if(previousCoords.center){left=(this.__originalSize[0]-previousCoords.width)/2;top=(this.__originalSize[1]-previousCoords.height)/2}else{left=previousCoords.left||0;top=previousCoords.top||0}_ref3=this.__resizedScale,scaleX=_ref3[0],scaleY=_ref3[1];if(this.__options.notLess){preferedSize=utils.fitSize(this.__options.preferedSize,this.__originalSize);jCropOptions.minSize=[Math.ceil(preferedSize[0]*scaleX,Math.ceil(preferedSize[1]*scaleY))]}jCropOptions.setSelect=[left*scaleX,top*scaleY,(previousCoords.width+left)*scaleX,(previousCoords.height+top)*scaleY];this.__setState("loading");done=function(api){_this.__jCropApi=api;return _this.__setState("loaded")};return this.__img.Jcrop(jCropOptions,function(){return done(this)})};return CropWidget})()})}).call(this);(function(){var $,namespace,s,utils,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};namespace=uploadcare.namespace,s=uploadcare.settings,$=uploadcare.jQuery,utils=uploadcare.utils;namespace("uploadcare.files",function(ns){return ns.BaseFile=(function(){function BaseFile(settings){this.settings=settings;this.__resolveApi=__bind(this.__resolveApi,this);this.__rejectApi=__bind(this.__rejectApi,this);this.__extendApi=__bind(this.__extendApi,this);this.__runValidators=__bind(this.__runValidators,this);this.__preview=__bind(this.__preview,this);this.__cancel=__bind(this.__cancel,this);this.__fileInfo=__bind(this.__fileInfo,this);this.__updateInfo=__bind(this.__updateInfo,this);this.__handleFileData=__bind(this.__handleFileData,this);this.__completeUpload=__bind(this.__completeUpload,this);this.fileId=null;this.fileName=null;this.fileSize=null;this.isStored=null;this.cdnUrlModifiers=null;this.isImage=null;this.imageInfo=null;this.onInfoReady=$.Callbacks("once memory");this.__setupValidation();this.__initApi()}BaseFile.prototype.__startUpload=function(){throw new Error("not implemented")};BaseFile.prototype.__completeUpload=function(){var check,timeout,_this=this;timeout=100;return(check=function(){if(_this.apiPromise.state()==="pending"){return _this.__updateInfo().done(function(){setTimeout(check,timeout);return timeout+=50})}})()};BaseFile.prototype.__handleFileData=function(data){this.fileName=data.original_filename;this.fileSize=data.size;this.isImage=data.is_image;this.imageInfo=data.image_info;this.isStored=data.is_stored;if(!this.onInfoReady.fired()){this.onInfoReady.fire(this.__fileInfo())}if(data.is_ready){return this.__resolveApi()}};BaseFile.prototype.__updateInfo=function(){var _this=this;return utils.jsonp(""+this.settings.urlBase+"/info/",{file_id:this.fileId,pub_key:this.settings.publicKey}).fail(function(){return _this.__rejectApi("info")}).done(this.__handleFileData)};BaseFile.prototype.__progressInfo=function(){var _ref;return{state:this.__progressState,uploadProgress:this.__progress,progress:(_ref=this.__progressState)==="ready"||_ref==="error"?1:this.__progress*0.9,incompleteFileInfo:this.__fileInfo()}};BaseFile.prototype.__fileInfo=function(){return{uuid:this.fileId,name:this.fileName,size:this.fileSize,isStored:this.isStored,isImage:this.isImage,originalImageInfo:this.imageInfo,originalUrl:""+this.settings.cdnBase+"/"+this.fileId+"/",cdnUrl:""+this.settings.cdnBase+"/"+this.fileId+"/"+(this.cdnUrlModifiers||""),cdnUrlModifiers:this.cdnUrlModifiers,previewUrl:""+this.settings.cdnBase+"/"+this.fileId+"/",preview:this.apiPromise.preview}};BaseFile.prototype.__cancel=function(){this.__rejectApi("user");return this.__uploadDf.reject()};BaseFile.prototype.__preview=function(selector){var _this=this;utils.warnOnce("'preview' method is deprecated. Use fileInfo.cdnUrl as image source.");return this.apiPromise.done(function(info){var img;img=new Image();img.onload=function(){return $(selector).html($("<div>").css({position:"relative",overflow:"hidden",width:this.width,height:this.height}).append(img))};return img.src=""+info.cdnUrl+"-/preview/1600x1600/"})};BaseFile.prototype.__setupValidation=function(){this.validators=(this.settings.__validators||[]).slice();if(this.settings.imagesOnly){this.validators.push(function(info){if(!info.isImage){throw new Error("image")}})}return this.onInfoReady.add(this.__runValidators)};BaseFile.prototype.__runValidators=function(info){var v,_i,_len,_ref,_results;try{_ref=this.validators;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){v=_ref[_i];_results.push(v(info))}return _results}catch(err){return this.__rejectApi(err.message)}};BaseFile.prototype.__extendApi=function(api){var __then,_this=this;api.cancel=this.__cancel;api.preview=this.__preview;__then=api.then;api.pipe=api.then=function(){return _this.__extendApi(__then.apply(api,arguments))};return api};BaseFile.prototype.__notifyApi=function(){return this.apiDeferred.notify(this.__progressInfo())};BaseFile.prototype.__rejectApi=function(err){this.__progressState="error";this.__notifyApi();return this.apiDeferred.reject(err,this.__fileInfo())};BaseFile.prototype.__resolveApi=function(){this.__progressState="ready";this.__notifyApi();return this.apiDeferred.resolve(this.__fileInfo())};BaseFile.prototype.__initApi=function(){var _this=this;this.apiDeferred=$.Deferred();this.apiPromise=this.__extendApi(this.apiDeferred.promise());this.__progressState="uploading";this.__progress=0;this.__notifyApi();return this.__uploadDf=$.Deferred().done(this.__completeUpload).done(function(){_this.__progressState="uploaded";_this.__progress=1;return _this.__notifyApi()}).progress(function(progress){if(progress>_this.__progress){_this.__progress=progress;return _this.__notifyApi()}}).fail(function(){return _this.__rejectApi("upload")})};BaseFile.prototype.promise=function(){if(!this.__uploadStarted){this.__uploadStarted=true;this.__startUpload()}return this.apiPromise};return BaseFile})()});namespace("uploadcare.utils",function(utils){utils.isFile=function(obj){return obj&&obj.done&&obj.fail&&obj.cancel};return utils.valueToFile=function(value,settings){if(value&&!utils.isFile(value)){value=uploadcare.fileFrom("uploaded",value,settings)}return value}})}).call(this);(function(){var $,namespace,utils,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils;namespace("uploadcare.files",function(ns){return ns.ObjectFile=(function(_super){__extends(ObjectFile,_super);ObjectFile.prototype.MP_MIN_SIZE=25*1024*1024;ObjectFile.prototype.MP_PART_SIZE=5*1024*1024;ObjectFile.prototype.MP_CONCURRENCY=4;function ObjectFile(settings,__file){this.__file=__file;ObjectFile.__super__.constructor.apply(this,arguments);this.fileSize=this.__file.size;this.fileName=this.__file.name||"original";this.fileType=this.__file.type||"application/octet-stream";this.__notifyApi()}ObjectFile.prototype.__startUpload=function(){if(this.fileSize<this.MP_MIN_SIZE){return this.directUpload()}else{return this.multipartUpload()}};ObjectFile.prototype.directUpload=function(){var formData,_this=this;formData=new FormData();formData.append("UPLOADCARE_PUB_KEY",this.settings.publicKey);if(this.settings.autostore){formData.append("UPLOADCARE_STORE","1")}formData.append("file",this.__file);return $.ajax({xhr:function(){var xhr;xhr=$.ajaxSettings.xhr();if(xhr.upload){xhr.upload.addEventListener("progress",function(e){return _this.__uploadDf.notify(e.loaded/_this.fileSize)})}return xhr},crossDomain:true,type:"POST",url:""+this.settings.urlBase+"/base/?jsonerrors=1",xhrFields:{withCredentials:true},headers:{"X-PINGOTHER":"pingpong"},contentType:false,processData:false,data:formData,dataType:"json",error:this.__uploadDf.reject,success:function(data){if(data!=null?data.file:void 0){_this.fileId=data.file;return _this.__uploadDf.resolve()}else{if(_this.settings.autostore&&/autostore/i.test(data.error.content)){utils.commonWarning("autostore")}return _this.__uploadDf.reject()}}})};ObjectFile.prototype.multipartUpload=function(){var _this=this;return this.multipartStart().done(function(data){return _this.uploadParts(data.parts).done(function(){return _this.multipartComplete(data.uuid).done(function(data){_this.fileId=data.uuid;_this.__handleFileData(data);return _this.__completeUpload()}).fail(_this.__uploadDf.reject)}).fail(_this.__uploadDf.reject)}).fail(this.__uploadDf.reject)};ObjectFile.prototype.multipartStart=function(){var data;data={UPLOADCARE_PUB_KEY:this.settings.publicKey,filename:this.fileName,size:this.fileSize,content_type:this.fileType};if(this.settings.autostore){data.UPLOADCARE_STORE="1"}return utils.jsonp(""+this.settings.urlBase+"/multipart/start/?jsonerrors=1","POST",data)};ObjectFile.prototype.uploadParts=function(parts){var blob,blobCount,blobOffset,blobSize,i,progress,requests,updateProgress,_this=this;blobCount=Math.min(parts.length,this.MP_CONCURRENCY);blobSize=Math.max(Math.ceil(this.__file.size/blobCount),this.MP_PART_SIZE);blobOffset=0;progress=[];updateProgress=function(i,loaded){var total,_i,_len;progress[i]=loaded;total=0;for(_i=0,_len=progress.length;_i<_len;_i++){loaded=progress[_i];total+=loaded}return _this.__uploadDf.notify(total/_this.fileSize)};requests=(function(){var _i,_results,_this=this;_results=[];for(i=_i=0;0<=blobCount?_i<blobCount:_i>blobCount;i=0<=blobCount?++_i:--_i){progress.push(0);blob=this.__file.slice(blobOffset,blobOffset+blobSize);blobOffset+=blobSize;_results.push($.ajax({xhr:function(){var xhr;xhr=$.ajaxSettings.xhr();if(xhr.upload){xhr.upload._part=i;xhr.upload.addEventListener("progress",function(e){return updateProgress(e.target._part,e.loaded)})}return xhr},url:parts[i],crossDomain:true,type:"PUT",processData:false,contentType:this.fileType,data:blob}))}return _results}).call(this);return $.when.apply(null,requests)};ObjectFile.prototype.multipartComplete=function(uuid){var data;data={UPLOADCARE_PUB_KEY:this.settings.publicKey,uuid:uuid};return utils.jsonp(""+this.settings.urlBase+"/multipart/complete/?jsonerrors=1","POST",data)};return ObjectFile})(ns.BaseFile)})}).call(this);(function(){var $,namespace,utils,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils;namespace("uploadcare.files",function(ns){return ns.InputFile=(function(_super){__extends(InputFile,_super);function InputFile(settings,__input){this.__input=__input;InputFile.__super__.constructor.apply(this,arguments);this.fileId=utils.uuid();this.fileName=$(this.__input).val().split("\\").pop();this.__notifyApi()}InputFile.prototype.__startUpload=function(){var formParam,iframeId,targetUrl,_this=this;targetUrl=""+this.settings.urlBase+"/iframe/";this.__uploadDf.always(function(){return _this.__cleanUp()});iframeId="uploadcare-iframe-"+this.fileId;this.__iframe=$("<iframe>").attr({id:iframeId,name:iframeId}).css("display","none").appendTo("body").on("load",this.__uploadDf.resolve).on("error",this.__uploadDf.reject);formParam=function(name,value){return $('<input type="hidden">').attr({name:name}).val(value)};$(this.__input).clone(true).insertBefore(this.__input);$(this.__input).attr("name","file");return this.__iframeForm=$("<form>").attr({method:"POST",action:targetUrl,enctype:"multipart/form-data",target:iframeId}).append(formParam("UPLOADCARE_PUB_KEY",this.settings.publicKey)).append(formParam("UPLOADCARE_FILE_ID",this.fileId)).append(this.settings.autostore?formParam("UPLOADCARE_STORE",1):void 0).append(this.__input).css("display","none").appendTo("body").submit()};InputFile.prototype.__cleanUp=function(){var _ref,_ref1;if((_ref=this.__iframe)!=null){_ref.off("load error").remove()}if((_ref1=this.__iframeForm)!=null){_ref1.remove()}this.__iframe=null;return this.__iframeForm=null};return InputFile})(ns.BaseFile)})}).call(this);(function(){var $,namespace,pusher,utils,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils;pusher=uploadcare.utils.pusher;namespace("uploadcare.files",function(ns){var PollWatcher,PusherWatcher;ns.UrlFile=(function(_super){__extends(UrlFile,_super);UrlFile.prototype.allEvents="progress success error fail";function UrlFile(settings,__url){var filename;this.__url=__url;this.__listenWatcher=__bind(this.__listenWatcher,this);UrlFile.__super__.constructor.apply(this,arguments);filename=utils.splitUrlRegex.exec(this.__url)[3].split("/").pop();if(filename){try{this.fileName=decodeURIComponent(filename)}catch(err){this.fileName=filename}}this.__notifyApi()}UrlFile.prototype.setName=function(name){this.__realFileName=name;this.fileName=name;return this.__notifyApi()};UrlFile.prototype.setIsImage=function(isImage){this.isImage=isImage;return this.__notifyApi()};UrlFile.prototype.__startUpload=function(){var data,pollWatcher,pusherWatcher,_this=this;pusherWatcher=new PusherWatcher(this.settings.pusherKey);pollWatcher=new PollWatcher(""+this.settings.urlBase+"/status/");this.__listenWatcher($([pusherWatcher,pollWatcher]));$(pusherWatcher).one(this.allEvents,function(){return pollWatcher.stopWatching()});data={pub_key:this.settings.publicKey,source_url:this.__url,filename:this.__realFileName||""};if(this.settings.autostore){data.store=1}utils.jsonp(""+this.settings.urlBase+"/from_url/",data).fail(function(error){if(_this.settings.autostore&&/autostore/i.test(error)){utils.commonWarning("autostore")}return _this.__uploadDf.reject()}).done(function(data){pusherWatcher.watch(data.token);return pollWatcher.watch(data.token)});return this.__uploadDf.always(function(){$([pusherWatcher,pollWatcher]).off(_this.allEvents);pusherWatcher.stopWatching();return pollWatcher.stopWatching()})};UrlFile.prototype.__listenWatcher=function(watcher){var _this=this;return watcher.on("progress",function(e,data){_this.fileSize=data.total;return _this.__uploadDf.notify(data.done/data.total)}).on("success",function(e,data){$(e.target).trigger("progress",data);_this.fileId=data.uuid;_this.fileName=data.original_filename;return _this.__uploadDf.resolve()}).on("error fail",this.__uploadDf.reject)};return UrlFile})(ns.BaseFile);PusherWatcher=(function(){function PusherWatcher(pusherKey){this.pusher=pusher.getPusher(pusherKey,"url-upload")}PusherWatcher.prototype.watch=function(token){var channel,_this=this;channel=this.pusher.subscribe("task-status-"+token);return channel.bind_all(function(ev,data){return $(_this).trigger(ev,data)})};PusherWatcher.prototype.stopWatching=function(){return this.pusher.release()};return PusherWatcher})();return PollWatcher=(function(){function PollWatcher(poolUrl){this.poolUrl=poolUrl}PollWatcher.prototype.watch=function(token){var bind,_this=this;this.token=token;bind=function(){return _this.__updateStatus().done(function(){if(_this.interval){return _this.interval=setTimeout(bind,250)}})};return this.interval=setTimeout(bind,0)};PollWatcher.prototype.stopWatching=function(){if(this.interval){clearTimeout(this.interval)}return this.interval=null};PollWatcher.prototype.__updateStatus=function(){var _this=this;return utils.jsonp(this.poolUrl,{token:this.token}).fail(function(error){_this.stopWatching();return $(_this).trigger("error")}).done(function(data){return $(_this).trigger(data.status,data)})};return PollWatcher})()})}).call(this);(function(){var $,namespace,utils,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils;namespace("uploadcare.files",function(ns){ns.UploadedFile=(function(_super){__extends(UploadedFile,_super);function UploadedFile(settings,fileIdOrUrl){var cdnUrl;UploadedFile.__super__.constructor.apply(this,arguments);cdnUrl=utils.splitCdnUrl(fileIdOrUrl);if(cdnUrl){this.fileId=cdnUrl[1];if(cdnUrl[2]){this.cdnUrlModifiers=cdnUrl[2]}}else{this.__rejectApi("baddata")}}UploadedFile.prototype.__startUpload=function(){return this.__completeUpload()};return UploadedFile})(ns.BaseFile);ns.ReadyFile=(function(_super){__extends(ReadyFile,_super);function ReadyFile(settings,data){ReadyFile.__super__.constructor.apply(this,arguments);this.fileId=data.uuid;this.__handleFileData(data)}ReadyFile.prototype.__startUpload=function(){return this.__completeUpload()};return ReadyFile})(ns.BaseFile);return ns.DeletedFile=(function(_super){__extends(DeletedFile,_super);function DeletedFile(){DeletedFile.__super__.constructor.apply(this,arguments);this.__rejectApi("deleted")}DeletedFile.prototype.__startUpload=function(){};return DeletedFile})(ns.BaseFile)})}).call(this);(function(){var $,namespace,s,t,utils,_ref,__slice=[].slice,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils,(_ref=uploadcare.locale,t=_ref.t),s=uploadcare.settings;namespace("uploadcare.files",function(ns){ns.FileGroup=(function(){function FileGroup(files,settings){var _this=this;this.settings=s.build(settings);this.__fileColl=new utils.CollectionOfPromises(files);this.__allFilesDf=$.when.apply($,this.__fileColl.get());this.__fileInfosDf=(function(){var file;files=(function(){var _i,_len,_ref1,_results;_ref1=this.__fileColl.get();_results=[];for(_i=0,_len=_ref1.length;_i<_len;_i++){file=_ref1[_i];_results.push(file.then(null,function(err,info){return $.when(info)}))}return _results}).call(_this);return $.when.apply($,files)})();this.__createGroupDf=$.Deferred();this.__initApiDeferred()}FileGroup.prototype.files=function(){return this.__fileColl.get()};FileGroup.prototype.__save=function(){var _this=this;if(!this.__saved){this.__saved=true;return this.__allFilesDf.done(function(){return _this.__createGroup().done(function(groupInfo){_this.__uuid=groupInfo.id;return _this.__buildInfo(function(info){if(_this.settings.imagesOnly&&!info.isImage){return _this.__createGroupDf.reject("image",info)}else{return _this.__createGroupDf.resolve(info)}})}).fail(function(){return _this.__createGroupDf.reject("createGroup")})})}};FileGroup.prototype.promise=function(){this.__save();return this.__apiDf.promise()};FileGroup.prototype.__initApiDeferred=function(){var notify,reject,resolve,_this=this;this.__apiDf=$.Deferred();this.__progressState="uploading";reject=function(err){return _this.__buildInfo(function(info){return _this.__apiDf.reject(err,info)})};resolve=function(info){return _this.__apiDf.resolve(info)};notify=function(){return _this.__apiDf.notify(_this.__progressInfo())};notify();this.__fileColl.onAnyProgress.add(notify);this.__allFilesDf.done(function(){_this.__progressState="uploaded";return notify()}).fail(reject);return this.__createGroupDf.done(function(info){_this.__progressState="ready";notify();return resolve(info)}).fail(reject)};FileGroup.prototype.__progressInfo=function(){var progress,progressInfo,progressInfos,_i,_len;progress=0;progressInfos=this.__fileColl.lastProgresses();for(_i=0,_len=progressInfos.length;_i<_len;_i++){progressInfo=progressInfos[_i];progress+=((progressInfo!=null?progressInfo.progress:void 0)||0)/progressInfos.length}return{state:this.__progressState,uploadProgress:progress,progress:this.__progressState==="ready"?1:progress*0.9}};FileGroup.prototype.__buildInfo=function(cb){var info;info={uuid:this.__uuid,cdnUrl:""+this.settings.cdnBase+"/"+this.__uuid+"/",name:t("file",this.__fileColl.length()),size:0,isImage:true,isStored:true};return this.__fileInfosDf.done(function(){var infos,_i,_info,_len;infos=1<=arguments.length?__slice.call(arguments,0):[];for(_i=0,_len=infos.length;_i<_len;_i++){_info=infos[_i];info.size+=_info.size;if(!_info.isImage){info.isImage=false}if(!_info.isStored){info.isStored=false}}return cb(info)})};FileGroup.prototype.__createGroup=function(){var df,_this=this;df=$.Deferred();if(this.__fileColl.length()){this.__fileInfosDf.done(function(){var info,infos;infos=1<=arguments.length?__slice.call(arguments,0):[];return utils.jsonp(""+_this.settings.urlBase+"/group/","POST",{pub_key:_this.settings.publicKey,files:(function(){var _i,_len,_results;_results=[];for(_i=0,_len=infos.length;_i<_len;_i++){info=infos[_i];_results.push(info.uuid)}return _results})()}).fail(df.reject).done(df.resolve)})}else{df.reject()}return df.promise()};FileGroup.prototype.api=function(){if(!this.__api){this.__api=utils.bindAll(this,["promise","files"])}return this.__api};return FileGroup})();return ns.SavedFileGroup=(function(_super){__extends(SavedFileGroup,_super);function SavedFileGroup(__data,settings){var files;this.__data=__data;files=uploadcare.filesFrom("ready",this.__data.files,settings);SavedFileGroup.__super__.constructor.call(this,files,settings)}SavedFileGroup.prototype.__createGroup=function(){return utils.wrapToPromise(this.__data)};return SavedFileGroup})(ns.FileGroup)});namespace("uploadcare",function(ns){ns.FileGroup=function(filesAndGroups,settings){var file,files,item,_i,_j,_len,_len1,_ref1;if(filesAndGroups==null){filesAndGroups=[]}files=[];for(_i=0,_len=filesAndGroups.length;_i<_len;_i++){item=filesAndGroups[_i];if(utils.isFile(item)){files.push(item)}else{if(utils.isFileGroup(item)){_ref1=item.files();for(_j=0,_len1=_ref1.length;_j<_len1;_j++){file=_ref1[_j];files.push(file)}}}}return new uploadcare.files.FileGroup(files,settings).api()};return ns.loadFileGroup=function(groupIdOrUrl,settings){var df,id;settings=s.build(settings);df=$.Deferred();id=utils.groupIdRegex.exec(groupIdOrUrl);if(id){utils.jsonp(""+settings.urlBase+"/group/info/",{pub_key:settings.publicKey,group_id:id[0]}).fail(df.reject).done(function(data){return df.resolve(new uploadcare.files.SavedFileGroup(data,settings).api())})}else{df.reject()}return df.promise()}});namespace("uploadcare.utils",function(utils){utils.isFileGroup=function(obj){return obj&&obj.files&&obj.promise};utils.valueToGroup=function(value,settings){var files,item,_i,_len;if(value){if($.isArray(value)){for(_i=0,_len=value.length;_i<_len;_i++){item=value[_i];files=utils.valueToFile(item,settings)}value=uploadcare.FileGroup(files,settings)}else{if(!utils.isFileGroup(value)){return uploadcare.loadFileGroup(value,settings)}}}return utils.wrapToPromise(value)};return utils.isFileGroupsEqual=function(group1,group2){var file,files1,files2,i,mismatches;if(group1===group2){return true}else{if(utils.isFileGroup(group1)&&utils.isFileGroup(group2)){files1=group1.files();files2=group2.files();if(files1.length!==files2.length){return false}else{mismatches=(function(){var _i,_len,_results;_results=[];for(i=_i=0,_len=files1.length;_i<_len;i=++_i){file=files1[i];if(file!==files2[i]){_results.push(1)}}return _results})();if(mismatches.length){return false}else{return true}}}else{return false}}}})}).call(this);(function(){var $,f,namespace,s,utils;namespace=uploadcare.namespace,utils=uploadcare.utils,$=uploadcare.jQuery,f=uploadcare.files,s=uploadcare.settings;namespace("uploadcare",function(ns){var converters;ns.fileFrom=function(){return ns.filesFrom.apply(null,arguments)[0]};ns.filesFrom=function(type,data,settings){var file,_i,_len,_ref,_results;settings=s.build(settings||{});_ref=converters[type](settings,data);_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){file=_ref[_i];_results.push(file.promise())}return _results};return converters={event:function(settings,e){var file,files,_i,_len,_results;if(utils.abilities.canFileAPI){files=e.type==="drop"?e.originalEvent.dataTransfer.files:e.target.files;_results=[];for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];_results.push(new f.ObjectFile(settings,file))}return _results}else{return this.input(settings,e.target)}},input:function(settings,input){return[new f.InputFile(settings,input)]},url:function(settings,urls){var url,_i,_len,_results;if(!$.isArray(urls)){urls=[urls]}_results=[];for(_i=0,_len=urls.length;_i<_len;_i++){url=urls[_i];_results.push(new f.UrlFile(settings,url))}return _results},uploaded:function(settings,uuids){var uuid,_i,_len,_results;if(!$.isArray(uuids)){uuids=[uuids]}_results=[];for(_i=0,_len=uuids.length;_i<_len;_i++){uuid=uuids[_i];_results.push(new f.UploadedFile(settings,uuid))}return _results},ready:function(settings,arrayOfFileData){var fileData,_i,_len,_results;if(!$.isArray(arrayOfFileData)){arrayOfFileData=[arrayOfFileData]}_results=[];for(_i=0,_len=arrayOfFileData.length;_i<_len;_i++){fileData=arrayOfFileData[_i];if(fileData){_results.push(new f.ReadyFile(settings,fileData))}else{_results.push(new f.DeletedFile(settings))}}return _results}}})}).call(this);(function(){var $,namespace,s,utils;namespace=uploadcare.namespace,utils=uploadcare.utils,s=uploadcare.settings,$=uploadcare.jQuery;namespace("uploadcare.dragdrop",function(ns){ns.support=utils.abilities.fileDragAndDrop;ns.uploadDrop=function(el,callback,settings){settings=s.build(settings);return ns.receiveDrop(el,function(type,data){var method;method=settings.multiple?"filesFrom":"fileFrom";return callback(uploadcare[method](type,data,settings))})};if(!ns.support){return ns.receiveDrop=function(){}}else{ns.receiveDrop=function(el,callback){ns.watchDragging(el);return $(el).on({dragover:function(e){e.preventDefault();return e.originalEvent.dataTransfer.dropEffect="copy"},drop:function(e){var dt,uris;e.preventDefault();dt=e.originalEvent.dataTransfer;if(dt.files.length){return callback("event",e)}else{uris=dt.getData("text/uri-list");if(uris){uris=uris.replace(/\n$/,"");return callback("url",uris)}}}})};ns.watchDragging=function(el,receiver){var active,changeState,delayedEnter;delayedEnter=false;active=false;changeState=function(newActive){if(active!==newActive){return $(el).toggleClass("uploadcare-dragging",active=newActive)}};return $(receiver||el).on({dragenter:function(){return delayedEnter=setTimeout(function(){delayedEnter=false;return changeState(true)},0)},dragleave:function(){if(!delayedEnter){return changeState(false)}},"drop mouseenter":function(){if(delayedEnter){clearTimeout(delayedEnter)}return setTimeout(function(){return changeState(false)},0)}})};return ns.watchDragging("body",document)}})}).call(this);(function(){var $,abilities,files,namespace,tpl,_ref,_ref1,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,files=uploadcare.files,$=uploadcare.jQuery,(_ref=uploadcare.utils,abilities=_ref.abilities),(_ref1=uploadcare.templates,tpl=_ref1.tpl);namespace("uploadcare.ui.progress",function(ns){ns.Circle=(function(){function Circle(element){if(abilities.canvas){this.renderer=new ns.CanvasRenderer(element)}else{this.renderer=new ns.TextRenderer(element)}this.observed=null}Circle.prototype.listen=function(file,selector){var selectorFn,_this=this;if(selector==null){selector="uploadProgress"}this.reset();selectorFn=selector!=null?function(info){return info[selector]}:function(x){return x};this.observed=file;if(this.observed.state()==="resolved"){this.renderer.setValue(1,true)}else{this.observed.progress(function(progress){if(file===_this.observed){return _this.renderer.setValue(selectorFn(progress))}}).always(function(uploadedFile){if(file===_this.observed){return _this.renderer.setValue(1,false)}})}return this};Circle.prototype.reset=function(filled){if(filled==null){filled=false}this.observed=null;return this.renderer.setValue((filled?1:0),true)};Circle.prototype.setColorTheme=function(theme){return this.renderer.setColorTheme(theme)};return Circle})();ns.BaseRenderer=(function(){function BaseRenderer(el){this.element=$(el);this.element.data("uploadcare-progress-renderer",this);this.element.addClass("uploadcare-widget-circle");this.size=Math.min(this.element.width(),this.element.height())}BaseRenderer.prototype.setColorTheme=function(theme){if($.type(theme)==="string"){theme=this.colorThemes[theme]}return this.colorTheme=$.extend({},this.colorThemes["default"],theme)};BaseRenderer.prototype.setValue=function(value,instant){if(instant==null){instant=false}throw new Error("not implemented")};BaseRenderer.prototype.colorThemes={"default":{back:"#e1e5e7",front:"#d0bf26",center:"#ffffff"},grey:{back:"#c5cacd",front:"#a0a3a5"},darkGrey:{back:"#bfbfbf",front:"#8c8c8c"}};return BaseRenderer})();ns.TextRenderer=(function(_super){__extends(TextRenderer,_super);function TextRenderer(){TextRenderer.__super__.constructor.apply(this,arguments);$.extend(true,this.colorThemes,{"default":{front:"#000"},grey:{front:"#888"},darkGrey:{front:"#555"}});this.element.addClass("uploadcare-widget-circle--text");this.element.html(tpl("circle-text"));this.background=this.element.find("@uploadcare-circle-back");this.text=this.element.find("@uploadcare-circle-text");this.setColorTheme("default")}TextRenderer.prototype.setColorTheme=function(theme){TextRenderer.__super__.setColorTheme.apply(this,arguments);this.background.css("background",this.colorTheme.back);return this.text.css("color",this.colorTheme.front)};TextRenderer.prototype.setValue=function(val){val=Math.round(val*100);return this.text.html(""+val+" %")};return TextRenderer})(ns.BaseRenderer);return ns.CanvasRenderer=(function(_super){__extends(CanvasRenderer,_super);function CanvasRenderer(){CanvasRenderer.__super__.constructor.apply(this,arguments);this.canvasSize=this.size*2;this.setColorTheme("default");this.setValue(0,true);this.canvasEl=$("<canvas>").css({width:this.size,height:this.size}).prop({width:this.canvasSize,height:this.canvasSize});this.canvasCtx=this.canvasEl.get(0).getContext("2d");this.element.addClass("uploadcare-widget-circle--canvas");this.element.html(this.canvasEl);this.__reRender()}CanvasRenderer.prototype.setColorTheme=function(theme){CanvasRenderer.__super__.setColorTheme.apply(this,arguments);return this.__reRender()};CanvasRenderer.prototype.__reRender=function(){var ctx,halfSize,offset;if(this.canvasCtx){ctx=this.canvasCtx;halfSize=this.canvasSize/2;ctx.clearRect(0,0,this.canvasSize,this.canvasSize);ctx.fillStyle=this.colorTheme.back;ctx.beginPath();ctx.arc(halfSize,halfSize,halfSize,0,2*Math.PI);ctx.fill();offset=-Math.PI/2;ctx.fillStyle=this.colorTheme.front;ctx.beginPath();ctx.moveTo(halfSize,halfSize);ctx.arc(halfSize,halfSize,halfSize,offset,2*Math.PI*this.val+offset);ctx.fill();ctx.fillStyle=this.colorTheme.center;ctx.beginPath();ctx.arc(halfSize,halfSize,this.canvasSize/15,0,2*Math.PI);return ctx.fill()}};CanvasRenderer.prototype.__animateValue=function(targetValue){var perStep,_this=this;perStep=targetValue>this.val?0.05:-0.05;return this.__animIntervalId=setInterval(function(){var newValue;newValue=_this.val+perStep;if((perStep>0&&newValue>targetValue)||(perStep<0&&newValue<targetValue)){newValue=targetValue}if(newValue===targetValue){_this.__stopAnimation()}return _this.__setValue(newValue)},25)};CanvasRenderer.prototype.__stopAnimation=function(){if(this.__animIntervalId){clearInterval(this.__animIntervalId);return this.__animIntervalId=null}};CanvasRenderer.prototype.__setValue=function(val){this.val=val;return this.__reRender()};CanvasRenderer.prototype.setValue=function(val,instant){if(instant==null){instant=false}this.__stopAnimation();if(instant){return this.__setValue(val)}else{return this.__animateValue(val)}};return CanvasRenderer})(ns.BaseRenderer)})}).call(this);(function(){var $,namespace,progress,t,tpl,utils,_ref,_ref1,_ref2;namespace=uploadcare.namespace,$=uploadcare.jQuery,utils=uploadcare.utils,(_ref=uploadcare.ui,progress=_ref.progress),(_ref1=uploadcare.locale,t=_ref1.t),(_ref2=uploadcare.templates,tpl=_ref2.tpl);namespace("uploadcare.widget",function(ns){return ns.Template=(function(){function Template(settings,element){this.settings=settings;this.element=element;this.content=$(tpl("widget"));this.element.after(this.content);this.circle=new progress.Circle(this.content.find("@uploadcare-widget-status"));this.statusText=this.content.find("@uploadcare-widget-status-text");this.buttonsContainer=this.content.find("@uploadcare-widget-buttons");this.dropArea=this.content.find("@uploadcare-drop-area");this.labels=[]}Template.prototype.pushLabel=function(label){this.labels.push(this.statusText.text());return this.statusText.text(label)};Template.prototype.popLabel=function(){return this.statusText.text(this.labels.pop())};Template.prototype.addState=function(state){return this.content.addClass("uploadcare-widget-state-"+state)};Template.prototype.removeState=function(state){return this.content.removeClass("uploadcare-widget-state-"+state)};Template.prototype.addButton=function(name,caption){var li;if(caption==null){caption=""}li=$(tpl("widget-button",{name:name,caption:caption}));this.buttonsContainer.append(li);return li};Template.prototype.setStatus=function(status){var form;this.content.attr("data-status",status);form=this.element.closest("@uploadcare-upload-form");return form.trigger(""+status+".uploadcare")};Template.prototype.reset=function(){this.statusText.text(t("ready"));this.circle.reset();this.setStatus("ready");return this.__file=null};Template.prototype.loaded=function(){this.setStatus("loaded");return this.circle.reset(true)};Template.prototype.listen=function(file){var _this=this;this.__file=file;this.circle.listen(file);this.setStatus("started");return file.progress(function(info){if(file===_this.__file){switch(info.state){case"uploading":return _this.statusText.text(t("uploading"));case"uploaded":return _this.statusText.text(t("loadingInfo"))}}})};Template.prototype.error=function(type){this.statusText.text(t("errors."+(type||"default")));return this.setStatus("error")};Template.prototype.setFileInfo=function(info){return this.statusText.html(tpl("widget-file-name",info))};return Template})()})}).call(this);(function(){var $,namespace,t,tpl,_ref,_ref1;namespace=uploadcare.namespace,$=uploadcare.jQuery,(_ref=uploadcare.templates,tpl=_ref.tpl),(_ref1=uploadcare.locale,t=_ref1.t);namespace("uploadcare.widget.tabs",function(ns){return ns.BaseSourceTab=(function(){var CLASS_PREFIX,ROLE_PREFIX;CLASS_PREFIX="uploadcare-dialog-source-base-";ROLE_PREFIX="@"+CLASS_PREFIX;function BaseSourceTab(container,tabButton,dialogApi,settings){var notDisabled,updateFooter,_this=this;this.container=container;this.tabButton=tabButton;this.dialogApi=dialogApi;this.settings=settings;this.container.append(tpl("source-tab-base"));this.wrap=this.container.find(ROLE_PREFIX+"wrap");notDisabled=":not(.uploadcare-disabled-el)";this.container.on("click",ROLE_PREFIX+"show-files"+notDisabled,function(){return _this.dialogApi.switchTab("preview")});this.container.on("click",ROLE_PREFIX+"done"+notDisabled,this.dialogApi.done);updateFooter=function(){var files,footer,tooFewFiles,tooManyFiles;files=_this.dialogApi.fileColl.length();tooManyFiles=_this.settings.multipleMax!==0&&files>_this.settings.multipleMax;tooFewFiles=files<_this.settings.multipleMin;_this.container.find(ROLE_PREFIX+"done").toggleClass("uploadcare-disabled-el",tooManyFiles||tooFewFiles);_this.container.find(ROLE_PREFIX+"show-files").toggleClass("uploadcare-disabled-el",files===0);footer=tooManyFiles?t("dialog.tabs.preview.multiple.tooManyFiles").replace("%max%",_this.settings.multipleMax):files&&tooFewFiles?t("dialog.tabs.preview.multiple.tooFewFiles").replace("%min%",_this.settings.multipleMin):t("dialog.tabs.preview.multiple.title");return _this.container.find(ROLE_PREFIX+"footer-text").toggleClass("uploadcare-error",tooManyFiles).text(footer.replace("%files%",t("file",files)))};updateFooter();this.dialogApi.fileColl.onAdd.add(updateFooter);this.dialogApi.fileColl.onRemove.add(updateFooter)}return BaseSourceTab})()})}).call(this);(function(){var $,dragdrop,namespace,tpl,utils,_ref,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,utils=uploadcare.utils,dragdrop=uploadcare.dragdrop,$=uploadcare.jQuery,(_ref=uploadcare.templates,tpl=_ref.tpl);namespace("uploadcare.widget.tabs",function(ns){return ns.FileTab=(function(_super){__extends(FileTab,_super);function FileTab(){var _this=this;FileTab.__super__.constructor.apply(this,arguments);this.wrap.append(tpl("tab-file",{tabs:this.settings.tabs}));this.wrap.on("click","@uploadcare-dialog-switch-tab",function(e){return _this.dialogApi.switchTab($(e.target).data("tab"))});this.__setupFileButton();this.__initDragNDrop()}FileTab.prototype.__initDragNDrop=function(){var className,dropArea,_this=this;dropArea=this.wrap.find("@uploadcare-drop-area");if(utils.abilities.fileDragAndDrop){dragdrop.receiveDrop(dropArea,function(type,data){_this.dialogApi.addFiles(type,data);return _this.dialogApi.switchTab("preview")});className="draganddrop"}else{className="no-draganddrop"}return this.wrap.addClass("uploadcare-"+className)};FileTab.prototype.__setupFileButton=function(){var fileButton,_this=this;fileButton=this.wrap.find("@uploadcare-dialog-browse-file");return utils.fileInput(fileButton,this.settings.multiple,function(e){_this.dialogApi.addFiles("event",e);return _this.dialogApi.switchTab("preview")})};return FileTab})(ns.BaseSourceTab)})}).call(this);(function(){var $,namespace,t,tpl,_ref,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,$=uploadcare.jQuery,(_ref=uploadcare.templates,tpl=_ref.tpl);t=uploadcare.locale.t;namespace("uploadcare.widget.tabs",function(ns){return ns.UrlTab=(function(_super){var fixUrl,urlRegexp;__extends(UrlTab,_super);urlRegexp=/^[a-z][a-z0-9+\-.]*:?\/\//;fixUrl=function(url){url=$.trim(url);if(urlRegexp.test(url)){return url}else{return"http://"+url}};function UrlTab(){var button,input,_this=this;UrlTab.__super__.constructor.apply(this,arguments);this.wrap.append(tpl("tab-url"));input=this.wrap.find("@uploadcare-dialog-url-input");input.on("change keyup input",function(){return button.prop("disabled",!$.trim(this.value))});button=this.wrap.find("@uploadcare-dialog-url-submit").prop("disabled",true);this.wrap.find("@uploadcare-dialog-url-form").on("submit",function(){var url;if(url=fixUrl(input.val())){_this.dialogApi.addFiles("url",url);input.val("")}return false})}return UrlTab})(ns.BaseSourceTab)})}).call(this);(function(){var $,files,locale,namespace,t,tabsCss,utils,_ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,locale=uploadcare.locale,utils=uploadcare.utils,tabsCss=uploadcare.tabsCss,$=uploadcare.jQuery,(_ref=uploadcare.locale,t=_ref.t),files=uploadcare.files;namespace("uploadcare.widget.tabs",function(ns){return ns.RemoteTabFor=function(service){var RemoteTab;return RemoteTab=(function(_super){__extends(RemoteTab,_super);function RemoteTab(){this.__createIframe=__bind(this.__createIframe,this);var _this=this;RemoteTab.__super__.constructor.apply(this,arguments);this.wrap.addClass("uploadcare-dialog-remote-iframe-wrap");this.dialogApi.onSwitched.add(function(_,switchedToMe){if(switchedToMe){_this.__createIframe()}return _this.__sendMessage({type:"visibility-changed",visible:switchedToMe})})}RemoteTab.prototype.__sendMessage=function(messageObj){var _ref1,_ref2,_ref3;return(_ref1=this.iframe)!=null?(_ref2=_ref1[0])!=null?(_ref3=_ref2.contentWindow)!=null?_ref3.postMessage(JSON.stringify(messageObj),"*"):void 0:void 0:void 0};RemoteTab.prototype.__createIframe=function(){var nos,src,_this=this;if(!this.iframe){src=(""+this.settings.socialBase+"/window/"+service+"?")+$.param({lang:this.settings.locale,public_key:this.settings.publicKey,widget_version:uploadcare.version,images_only:this.settings.imagesOnly});this.iframe=$("<iframe>").attr({src:src,marginheight:0,marginwidth:0,frameborder:0,allowTransparency:"true"}).css({width:"100%",height:"100%",border:0,visibility:"hidden"}).appendTo(this.wrap).on("load",function(){var message,style,url,_i,_j,_len,_len1,_ref1,_ref2;$(this).css("visibility","visible");_ref1=tabsCss.urls;for(_i=0,_len=_ref1.length;_i<_len;_i++){url=_ref1[_i];message=JSON.stringify({url:url,type:"embed-css"});this.contentWindow.postMessage(message,"*")}_ref2=tabsCss.styles;for(_j=0,_len1=_ref2.length;_j<_len1;_j++){style=_ref2[_j];message=JSON.stringify({style:style,type:"embed-css"});this.contentWindow.postMessage(message,"*")}});nos=function(str){return str.toLowerCase().replace(/^https/,"http")};return $(window).on("message",function(_arg){var e,file,goodOrigin,goodSource,message,_ref1,_ref2;e=_arg.originalEvent;goodOrigin=nos(e.origin)===nos(_this.settings.socialBase);goodSource=e.source===((_ref1=_this.iframe)!=null?(_ref2=_ref1[0])!=null?_ref2.contentWindow:void 0:void 0);if(goodOrigin&&goodSource){try{message=JSON.parse(e.data)}catch(_error){}if((message!=null?message.type:void 0)==="file-selected"){file=new files.UrlFile(_this.settings,message.url);if(message.filename){file.setName(message.filename)}if(message.is_image!=null){file.setIsImage(message.is_image)}_this.dialogApi.addFiles([file.promise()]);return _this.__sendMessage({type:"file-selected-received",url:message.url})}}})}};return RemoteTab})(ns.BaseSourceTab)}})}).call(this);(function(){var $,Circle,namespace,_ref,_ref1;namespace=uploadcare.namespace,(_ref=uploadcare.ui,(_ref1=_ref.progress,Circle=_ref1.Circle)),$=uploadcare.jQuery;namespace("uploadcare.widget.tabs",function(ns){return ns.BasePreviewTab=(function(){var PREFIX;PREFIX="@uploadcare-dialog-preview-";function BasePreviewTab(container,tabButton,dialogApi,settings){var notDisabled,_this=this;this.container=container;this.tabButton=tabButton;this.dialogApi=dialogApi;this.settings=settings;this.__initTabButtonCircle();notDisabled=":not(.uploadcare-disabled-el)";this.container.on("click",PREFIX+"back"+notDisabled,function(){return _this.dialogApi.fileColl.clear()});this.container.on("click",PREFIX+"done"+notDisabled,this.dialogApi.done)}BasePreviewTab.prototype.__initTabButtonCircle=function(){var buttonHovered,circle,circleDf,circleEl,size,tabActive,update,updateTheme,_this=this;size=28;circleEl=$("<div>").appendTo(this.tabButton).css({position:"absolute",top:"50%",left:"50%",marginTop:size/-2,marginLeft:size/-2,width:size,height:size});circleDf=$.Deferred();update=function(){var infos,progress,progressInfo,_i,_len;infos=_this.dialogApi.fileColl.lastProgresses();progress=0;for(_i=0,_len=infos.length;_i<_len;_i++){progressInfo=infos[_i];progress+=((progressInfo!=null?progressInfo.progress:void 0)||0)/infos.length}return circleDf.notify({progress:progress})};this.dialogApi.fileColl.onAnyProgress.add(update);this.dialogApi.fileColl.onAdd.add(update);this.dialogApi.fileColl.onRemove.add(update);circle=new Circle(circleEl).listen(circleDf.promise(),"progress");updateTheme=function(){return circle.setColorTheme(tabActive?"default":buttonHovered?"darkGrey":"grey")};tabActive=false;this.dialogApi.onSwitched.add(function(_,switchedToMe){tabActive=switchedToMe;return updateTheme()});buttonHovered=false;return this.tabButton.hover(function(){buttonHovered=true;return updateTheme()},function(){buttonHovered=false;return updateTheme()})};return BasePreviewTab})()})}).call(this);(function(){var $,CropWidget,namespace,progress,t,tpl,utils,_ref,_ref1,_ref2,_ref3,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,utils=uploadcare.utils,(_ref=uploadcare.ui,progress=_ref.progress),(_ref1=uploadcare.templates,tpl=_ref1.tpl),$=uploadcare.jQuery,(_ref2=uploadcare.crop,CropWidget=_ref2.CropWidget),(_ref3=uploadcare.locale,t=_ref3.t);namespace("uploadcare.widget.tabs",function(ns){return ns.PreviewTab=(function(_super){var PREFIX;__extends(PreviewTab,_super);PREFIX="@uploadcare-dialog-preview-";function PreviewTab(){this.__setFile=__bind(this.__setFile,this);var _this=this;PreviewTab.__super__.constructor.apply(this,arguments);$.each(this.dialogApi.fileColl.get(),function(i,file){return _this.__setFile(file)});this.dialogApi.fileColl.onAdd.add(this.__setFile)}PreviewTab.prototype.__setFile=function(file){var ifCur,_this=this;this.file=file;ifCur=function(fn){return function(){if(file===_this.file){return fn.apply(null,arguments)}}};this.file.progress(ifCur(utils.once(function(info){return _this.__setState("unknown",{file:info.incompleteFileInfo})})));this.file.done(ifCur(function(file){var state;state=file.isImage?"image":"regular";return _this.__setState(state,{file:file})}));return this.file.fail(ifCur(function(error,file){return _this.__setState("error",{error:error,file:file})}))};PreviewTab.prototype.__setState=function(state,data){this.container.empty().append(tpl("tab-preview-"+state,data));return this.__afterRender(state)};PreviewTab.prototype.__afterRender=function(state){if(state==="unknown"&&this.settings.crop.enabled){this.__hideDoneButton()}if(state==="image"&&this.settings.crop.enabled){return this.__initCrop()}};PreviewTab.prototype.__hideDoneButton=function(){return this.container.find(PREFIX+"done").hide()};PreviewTab.prototype.__initCrop=function(){var _this=this;return utils.defer(function(){var container,doneButton,img,widget;img=_this.container.find(PREFIX+"image");container=img.parent();doneButton=_this.container.find(PREFIX+"done");widget=new CropWidget($.extend({},_this.settings.crop,{container:container}));doneButton.addClass("uploadcare-disabled-el");widget.onStateChange.add(function(state){if(state==="loaded"){return doneButton.removeClass("uploadcare-disabled-el").click(function(){return widget.forceDone()})}});_this.file.done(function(info){var size;size=[info.originalImageInfo.width,info.originalImageInfo.height];return widget.croppedImageModifiers(img.attr("src"),size,info.cdnUrlModifiers).done(function(opts){return _this.dialogApi.fileColl.replace(_this.file,_this.file.then(function(info){info.cdnUrlModifiers=opts.modifiers;info.cdnUrl=""+_this.settings.cdnBase+"/"+info.uuid+"/"+(opts.modifiers||"");info.crop=opts.crop;return info}))})});img.remove();_this.container.find(".uploadcare-dialog-title").text(t("dialog.tabs.preview.crop.title"));return _this.container.find("@uploadcare-dialog-preview-done").text(t("dialog.tabs.preview.crop.done"))})};return PreviewTab})(ns.BasePreviewTab)})}).call(this);(function(){var $,namespace,progress,t,tpl,utils,_ref,_ref1,_ref2,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,utils=uploadcare.utils,(_ref=uploadcare.ui,progress=_ref.progress),(_ref1=uploadcare.templates,tpl=_ref1.tpl),$=uploadcare.jQuery,(_ref2=uploadcare.locale,t=_ref2.t);namespace("uploadcare.widget.tabs",function(ns){return ns.PreviewTabMultiple=(function(_super){var CLASS_PREFIX,ROLE_PREFIX;__extends(PreviewTabMultiple,_super);CLASS_PREFIX="uploadcare-dpm-";ROLE_PREFIX="@"+CLASS_PREFIX;function PreviewTabMultiple(){this.__fileRemoved=__bind(this.__fileRemoved,this);this.__fileAdded=__bind(this.__fileAdded,this);this.__fileFailed=__bind(this.__fileFailed,this);this.__fileDone=__bind(this.__fileDone,this);this.__fileProgress=__bind(this.__fileProgress,this);this.__updateContainerView=__bind(this.__updateContainerView,this);var _this=this;PreviewTabMultiple.__super__.constructor.apply(this,arguments);this.container.append(tpl("tab-preview-multiple"));this.__fileTpl=$(tpl("tab-preview-multiple-file"));this.fileListEl=this.__find("file-list");this.titleEl=this.__find("title");this.footerTextEl=this.__find("footer-text");this.doneBtnEl=this.container.find("@uploadcare-dialog-preview-done");$.each(this.dialogApi.fileColl.get(),function(i,file){_this.__fileAdded(file);return file.then(function(info){return _this.__fileDone(file,info)},function(info){return _this.__fileFailed(file,info)},function(info){return _this.__fileProgress(file,info)})});this.__updateContainerView();this.dialogApi.fileColl.onAdd.add([this.__fileAdded,this.__updateContainerView]);this.dialogApi.fileColl.onRemove.add([this.__fileRemoved,this.__updateContainerView]);this.dialogApi.fileColl.onAnyProgress.add(this.__fileProgress);this.dialogApi.fileColl.onAnyDone.add(this.__fileDone);this.dialogApi.fileColl.onAnyFail.add(this.__fileFailed);this.__setupSorting()}PreviewTabMultiple.prototype.__setupSorting=function(){var _this=this;return this.fileListEl.sortable({axis:"y",start:function(info){return info.dragged.css("visibility","hidden")},finish:function(info){var elements,index;info.dragged.css("visibility","visible");elements=_this.__find("file-item");index=function(file){return elements.index(_this.__fileToEl(file))};return _this.dialogApi.fileColl.sort(function(a,b){return index(a)-index(b)})}})};PreviewTabMultiple.prototype.__find=function(s,context){if(context==null){context=this.container}return $(ROLE_PREFIX+s,context)};PreviewTabMultiple.prototype.__updateContainerView=function(){var files,footer,tooFewFiles,tooManyFiles;files=this.dialogApi.fileColl.length();tooManyFiles=this.settings.multipleMax!==0&&files>this.settings.multipleMax;tooFewFiles=files<this.settings.multipleMin;this.doneBtnEl.toggleClass("uploadcare-disabled-el",tooManyFiles||tooFewFiles);this.titleEl.text(t("dialog.tabs.preview.multiple.title").replace("%files%",t("file",files)));footer=tooManyFiles?t("dialog.tabs.preview.multiple.tooManyFiles").replace("%max%",this.settings.multipleMax):files&&tooFewFiles?t("dialog.tabs.preview.multiple.tooFewFiles").replace("%min%",this.settings.multipleMin).replace("%files%",t("file",files)):t("dialog.tabs.preview.multiple.question");return this.footerTextEl.toggleClass("uploadcare-error",tooManyFiles||tooFewFiles).text(footer)};PreviewTabMultiple.prototype.__fileProgress=function(file,progressInfo){var fileEl,info;fileEl=this.__fileToEl(file);this.__find("file-progressbar-value",fileEl).css("width",Math.round(progressInfo.progress*100)+"%");info=progressInfo.incompleteFileInfo;this.__find("file-name",fileEl).text(info.name||t("dialog.tabs.preview.unknownName"));return this.__find("file-size",fileEl).text(utils.readableFileSize(info.size,"–"))};PreviewTabMultiple.prototype.__fileDone=function(file,info){var fileEl;fileEl=this.__fileToEl(file);fileEl.addClass(CLASS_PREFIX+"uploaded");if(info.isImage){fileEl.addClass(CLASS_PREFIX+"image");return this.__find("file-preview-wrap",fileEl).html($("<img>").attr({src:""+info.originalUrl+"-/scale_crop/45x45/center/"}))}};PreviewTabMultiple.prototype.__fileFailed=function(file,error,info){var fileEl;fileEl=this.__fileToEl(file);fileEl.addClass(CLASS_PREFIX+"error");return this.__find("file-error",fileEl).text(t("errors."+error))};PreviewTabMultiple.prototype.__fileAdded=function(file){return $(file).data("dmp-el",this.__createFileEl(file))};PreviewTabMultiple.prototype.__fileRemoved=function(file){return this.__fileToEl(file).remove()};PreviewTabMultiple.prototype.__fileToEl=function(file){return $(file).data("dmp-el")};PreviewTabMultiple.prototype.__createFileEl=function(file){var _this=this;return this.__fileTpl.clone().appendTo(this.fileListEl).on("click",ROLE_PREFIX+"file-remove",function(){return _this.dialogApi.fileColl.remove(file)})};return PreviewTabMultiple})(ns.BasePreviewTab)})}).call(this);(function(){var namespace,tpl,_ref;namespace=uploadcare.namespace,(_ref=uploadcare.templates,tpl=_ref.tpl);namespace("uploadcare.widget.tabs",function(ns){return ns.StaticTabWith=function(tplName){var StaticTab;return StaticTab=(function(){function StaticTab(container){this.container=container;this.container.append(tpl("tab-"+tplName))}return StaticTab})()}})}).call(this);(function(){var $,Circle,files,namespace,s,t,tabs,tpl,utils,_ref,_ref1,_ref2,_ref3,_ref4,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};namespace=uploadcare.namespace,utils=uploadcare.utils,(_ref=uploadcare.locale,t=_ref.t),(_ref1=uploadcare.templates,tpl=_ref1.tpl),(_ref2=uploadcare.ui,(_ref3=_ref2.progress,Circle=_ref3.Circle)),files=uploadcare.files,(_ref4=uploadcare.widget,tabs=_ref4.tabs),s=uploadcare.settings,$=uploadcare.jQuery;namespace("uploadcare",function(ns){var Panel,currentDialogPr,openedClass,registeredTabs,_this=this;$(window).on("keydown",function(e){if(ns.isDialogOpened()){if(e.which===27){e.stopImmediatePropagation();return ns.closeDialog()}}});currentDialogPr=null;openedClass="uploadcare-dialog-opened";ns.isDialogOpened=function(){return currentDialogPr!==null};ns.closeDialog=function(){return currentDialogPr!=null?currentDialogPr.reject():void 0};ns.openDialog=function(files,tab,settings){var dialog;ns.closeDialog();$("body").addClass(openedClass);dialog=$(tpl("dialog")).hide().appendTo("body").fadeIn("fast");dialog.on("click",function(e){var showStoppers;if(!$.contains(document.documentElement,e.target)){return}showStoppers=".uploadcare-dialog-panel, a";if($(e.target).is(showStoppers)||$(e.target).parents(showStoppers).length){return}return ns.closeDialog()});currentDialogPr=ns.openPanel(dialog.find(".uploadcare-dialog-placeholder"),files,tab,settings);return currentDialogPr.always(function(){$("body").removeClass(openedClass);currentDialogPr=null;return dialog.fadeOut("fast",function(){return dialog.remove()})})};ns.openPanel=function(placeholder,files,tab,settings){var filter,panel,promise;if($.isPlainObject(tab)){settings=tab;tab=null}if(!files){files=[]}else{if(utils.isFileGroup(files)){files=files.files()}else{if(!$.isArray(files)){files=[files]}}}settings=s.build(settings);panel=new Panel(settings,placeholder,files,tab).publicPromise();filter=function(files){if(settings.multiple){return uploadcare.FileGroup(files,settings)}else{return files[0]}};promise=utils.then(panel,filter,filter);promise.reject=panel.reject;return promise};registeredTabs={};ns.registerTab=function(tabName,constructor){return registeredTabs[tabName]=constructor};ns.registerTab("file",tabs.FileTab);ns.registerTab("url",tabs.UrlTab);ns.registerTab("facebook",tabs.RemoteTabFor("facebook"));ns.registerTab("dropbox",tabs.RemoteTabFor("dropbox"));ns.registerTab("gdrive",tabs.RemoteTabFor("gdrive"));ns.registerTab("instagram",tabs.RemoteTabFor("instagram"));ns.registerTab("vk",tabs.RemoteTabFor("vk"));ns.registerTab("evernote",tabs.RemoteTabFor("evernote"));ns.registerTab("box",tabs.RemoteTabFor("box"));ns.registerTab("skydrive",tabs.RemoteTabFor("skydrive"));ns.registerTab("welcome",tabs.StaticTabWith("welcome"));ns.registerTab("preview",function(tabPanel,tabButton,apiForTab,settings){var tabCls;tabCls=settings.multiple?tabs.PreviewTabMultiple:tabs.PreviewTab;return new tabCls(tabPanel,tabButton,apiForTab,settings)});return Panel=(function(){function Panel(settings,placeholder,files,tab){var _this=this;this.settings=settings;this.switchTab=__bind(this.switchTab,this);this.__closePanel=__bind(this.__closePanel,this);this.__reject=__bind(this.__reject,this);this.__resolve=__bind(this.__resolve,this);this.addFiles=__bind(this.addFiles,this);this.dfd=$.Deferred();this.dfd.always(this.__closePanel);this.content=$(tpl("panel"));this.placeholder=$(placeholder);this.placeholder.replaceWith(this.content);if(this.settings.multiple){this.content.addClass("uploadcare-dialog-multiple")}this.files=new utils.CollectionOfPromises(files);this.files.onRemove.add(function(){if(_this.files.length()===0){return _this.__hideTab("preview")}});this.tabs={};if(this.settings.publicKey){this.__prepareTabs(tab)}else{this.__welcome()}}Panel.prototype.publicPromise=function(){var promise;promise=this.dfd.promise();promise.reject=this.__reject;return promise};Panel.prototype.addFiles=function(files,data){var file,_i,_len;if(data){files=ns.filesFrom(files,data,this.settings)}if(!this.settings.multiple){this.files.clear()}for(_i=0,_len=files.length;_i<_len;_i++){file=files[_i];this.files.add(file)}if(this.settings.previewStep){this.__showTab("preview");if(!this.settings.multiple){return this.switchTab("preview")}}else{return this.__resolve()}};Panel.prototype.apiForTab=function(tabName){var onSwitched;onSwitched=$.Callbacks();this.dfd.progress(function(name){return onSwitched.fire(name,name===tabName)});return{fileColl:this.files,onSwitched:onSwitched,addFiles:this.addFiles,done:this.__resolve,switchTab:this.switchTab}};Panel.prototype.__resolve=function(){return this.dfd.resolve(this.files.get())};Panel.prototype.__reject=function(){return this.dfd.reject(this.files.get())};Panel.prototype.__prepareTabs=function(tab){var tabName,_i,_len,_ref5;this.addTab("preview");_ref5=this.settings.tabs;for(_i=0,_len=_ref5.length;_i<_len;_i++){tabName=_ref5[_i];this.addTab(tabName)}if(this.files.length()){this.__showTab("preview");return this.switchTab("preview")}else{this.__hideTab("preview");return this.switchTab(tab||this.settings.tabs[0])}};Panel.prototype.__closePanel=function(){return this.content.replaceWith(this.placeholder)};Panel.prototype.addTab=function(name){var TabCls,tabButton,tabPanel,_this=this;if(name in this.tabs){return}TabCls=registeredTabs[name];if(!TabCls){throw new Error("No such tab: "+name)}tabPanel=$("<div>").hide().addClass("uploadcare-dialog-tabs-panel").addClass("uploadcare-dialog-tabs-panel-"+name).appendTo(this.content.find(".uploadcare-dialog-panel"));tabButton=$("<div>").addClass("uploadcare-dialog-tab uploadcare-dialog-tab-"+name).attr("title",t("tabs."+name+".title")).on("click",function(){return _this.switchTab(name)}).appendTo(this.content.find(".uploadcare-dialog-tabs"));return this.tabs[name]=new TabCls(tabPanel,tabButton,this.apiForTab(name),this.settings)};Panel.prototype.__addFakeTab=function(name){return $("<div>").addClass("uploadcare-dialog-tab uploadcare-dialog-tab-"+name).addClass("uploadcare-dialog-disabled-tab").attr("title",t("tabs."+name+".title")).appendTo(this.content.find(".uploadcare-dialog-tabs"))};Panel.prototype.switchTab=function(currentTab){this.currentTab=currentTab;this.content.find(".uploadcare-dialog-panel").find(".uploadcare-dialog-selected-tab").removeClass("uploadcare-dialog-selected-tab").end().find(".uploadcare-dialog-tab-"+this.currentTab).addClass("uploadcare-dialog-selected-tab").end().find(".uploadcare-dialog-tabs-panel").hide().filter(".uploadcare-dialog-tabs-panel-"+this.currentTab).show();return this.dfd.notify(this.currentTab)};Panel.prototype.__showTab=function(tab){return this.content.find(".uploadcare-dialog-tab-"+tab).show()};Panel.prototype.__hideTab=function(tab){if(this.currentTab===tab){this.switchTab(this.settings.tabs[0])}return this.content.find(".uploadcare-dialog-tab-"+tab).hide()};Panel.prototype.__welcome=function(){var tabName,_i,_len,_ref5;this.addTab("welcome");_ref5=this.settings.tabs;for(_i=0,_len=_ref5.length;_i<_len;_i++){tabName=_ref5[_i];this.__addFakeTab(tabName)}return this.switchTab("welcome")};return Panel})()})}).call(this);(function(){var $,dragdrop,namespace,s,t,utils,_ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item){return i}}return -1};namespace=uploadcare.namespace,utils=uploadcare.utils,s=uploadcare.settings,$=uploadcare.jQuery,dragdrop=uploadcare.dragdrop,(_ref=uploadcare.locale,t=_ref.t);namespace("uploadcare.widget",function(ns){return ns.BaseWidget=(function(){function BaseWidget(element){this.reloadInfo=__bind(this.reloadInfo,this);this.__setObject=__bind(this.__setObject,this);this.__reset=__bind(this.__reset,this);var _this=this;this.element=$(element);this.settings=s.build(this.element.data());this.validators=this.settings.__validators=[];this.currentObject=null;this.__onUploadComplete=$.Callbacks();this.__onChange=$.Callbacks().add(function(object){return object!=null?object.promise().done(function(info){return _this.__onUploadComplete.fire(info)}):void 0});this.__setupWidget();this.element.on("change.uploadcare",this.reloadInfo);this.__hasValue=false;setTimeout(function(){if(!_this.__hasValue){return _this.reloadInfo()}},0)}BaseWidget.prototype.__setupWidget=function(){var _this=this;this.template=new ns.Template(this.settings,this.element);this.template.addButton("cancel",t("buttons.cancel")).on("click",function(){return _this.__setObject(null)});if(this.settings.clearable){this.template.addButton("remove",t("buttons.remove")).on("click",function(){return _this.__setObject(null)})}if(this.settings.tabs.length>0){if(__indexOf.call(this.settings.tabs,"file")>=0){this.template.addButton("file").on("click",function(){return _this.openDialog("file")})}this.template.addButton("dialog").on("click",function(){return _this.openDialog()})}this.template.content.on("click","@uploadcare-widget-file-name",function(){return _this.openDialog()});dragdrop.receiveDrop(this.template.content,this.__handleDirectSelection);return this.template.reset()};BaseWidget.prototype.__infoToValue=function(info){if(info.cdnUrlModifiers||this.settings.pathValue){return info.cdnUrl}else{return info.uuid}};BaseWidget.prototype.__reset=function(){var object;object=this.currentObject;this.currentObject=null;if(object!=null){if(typeof object.cancel==="function"){object.cancel()}}this.template.reset();return this.element.val("")};BaseWidget.prototype.__setObject=function(newFile){if(newFile!==this.currentObject){this.__reset();if(newFile){this.currentObject=newFile;this.__watchCurrentObject()}return this.__onChange.fire(this.currentObject)}};BaseWidget.prototype.__watchCurrentObject=function(){var object,_this=this;object=this.__currentFile();if(object){this.template.listen(object);return object.done(function(info){if(object===_this.__currentFile()){return _this.__onUploadingDone(info)}}).fail(function(error){if(object===_this.__currentFile()){return _this.__onUploadingFailed(error)}})}};BaseWidget.prototype.__onUploadingDone=function(info){this.element.val(this.__infoToValue(info));this.template.setFileInfo(info);return this.template.loaded()};BaseWidget.prototype.__onUploadingFailed=function(error){this.__setObject(null);return this.template.error(error)};BaseWidget.prototype.__setExternalValue=function(value){return this.__setObject(utils.valueToFile(value,this.settings))};BaseWidget.prototype.value=function(value){if(value!=null){this.__hasValue=true;this.__setExternalValue(value);return this}else{return this.currentObject}};BaseWidget.prototype.reloadInfo=function(){return this.value(this.element.val())};BaseWidget.prototype.openDialog=function(tab){return uploadcare.openDialog(this.currentObject,tab,this.settings).done(this.__setObject)};BaseWidget.prototype.api=function(){if(!this.__api){this.__api=utils.bindAll(this,["openDialog","reloadInfo","value","validators"]);this.__api.onChange=utils.publicCallbacks(this.__onChange);this.__api.onUploadComplete=utils.publicCallbacks(this.__onUploadComplete);this.__api.inputElement=this.element.get(0)}return this.__api};return BaseWidget})()})}).call(this);(function(){var $,files,namespace,utils,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,utils=uploadcare.utils,files=uploadcare.files,$=uploadcare.jQuery;namespace("uploadcare.widget",function(ns){return ns.Widget=(function(_super){__extends(Widget,_super);function Widget(){this.__handleDirectSelection=__bind(this.__handleDirectSelection,this);return Widget.__super__.constructor.apply(this,arguments)}Widget.prototype.__currentFile=function(){return this.currentObject};Widget.prototype.__handleDirectSelection=function(type,data){var file;file=uploadcare.fileFrom(type,data,this.settings);if(this.settings.previewStep){return uploadcare.openDialog(file,this.settings).done(this.__setObject)}else{return this.__setObject(file)}};return Widget})(ns.BaseWidget)})}).call(this);(function(){var $,namespace,t,utils,_ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key)){child[key]=parent[key]}}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor();child.__super__=parent.prototype;return child};namespace=uploadcare.namespace,utils=uploadcare.utils,$=uploadcare.jQuery,(_ref=uploadcare.locale,t=_ref.t);namespace("uploadcare.widget",function(ns){return ns.MultipleWidget=(function(_super){__extends(MultipleWidget,_super);function MultipleWidget(){this.__handleDirectSelection=__bind(this.__handleDirectSelection,this);this.__setObject=__bind(this.__setObject,this);return MultipleWidget.__super__.constructor.apply(this,arguments)}MultipleWidget.prototype.__currentFile=function(){var _ref1;return(_ref1=this.currentObject)!=null?_ref1.promise():void 0};MultipleWidget.prototype.__setObject=function(group){if(!utils.isFileGroupsEqual(this.currentObject,group)){return MultipleWidget.__super__.__setObject.apply(this,arguments)}};MultipleWidget.prototype.__setExternalValue=function(value){var groupPr,_this=this;this.__lastGroupPr=groupPr=utils.valueToGroup(value,this.settings);this.__reset();this.template.setStatus("started");this.template.statusText.text(t("loadingInfo"));return groupPr.done(function(group){if(_this.__lastGroupPr===groupPr){return _this.__setObject(group)}}).fail(function(){if(_this.__lastGroupPr===groupPr){return _this.template.error("createGroup")}})};MultipleWidget.prototype.__onUploadingFailed=function(error){if(error==="createGroup"){this.__setObject(null)}return this.template.error(error)};MultipleWidget.prototype.__handleDirectSelection=function(type,data){var files;files=uploadcare.filesFrom(type,data,this.settings);if(this.settings.previewStep){return uploadcare.openDialog(files,this.settings).done(this.__setObject)}else{return this.__setObject(uploadcare.FileGroup(files,this.settings))}};return MultipleWidget})(ns.BaseWidget)})}).call(this);(function(){var $,namespace,s,utils;utils=uploadcare.utils,namespace=uploadcare.namespace,s=uploadcare.settings,$=uploadcare.jQuery;namespace("uploadcare",function(ns){var cleanup,dataAttr,getSettings,initialize,initializeWidget;dataAttr="uploadcareWidget";ns.initialize=function(container){if(container==null){container="body"}return initialize($(container).find("@uploadcare-uploader"))};getSettings=function(el){return s.build($(el).data())};initialize=function(targets){var target,widget,widgetClass,_i,_len,_results;_results=[];for(_i=0,_len=targets.length;_i<_len;_i++){target=targets[_i];widget=$(target).data(dataAttr);if(widget&&target===widget.element[0]){continue}widgetClass=getSettings(target).multiple?ns.widget.MultipleWidget:ns.widget.Widget;_results.push(initializeWidget($(target),widgetClass))}return _results};ns.Widget=function(target){var el;el=$(target).eq(0);if(!getSettings(el).multiple){return initializeWidget(el,ns.widget.Widget)}else{throw new Error("Widget can't be initialized on this element")}};ns.MultipleWidget=function(target){var el;el=$(target).eq(0);if(getSettings(el).multiple){return initializeWidget(el,ns.widget.MultipleWidget)}else{throw new Error("MultipleWidget can't be initialized on this element")}};initializeWidget=function(el,Widget){var widget;widget=el.data(dataAttr);if(!widget||el[0]!==widget.element[0]){cleanup(el);widget=new Widget(el);el.data(dataAttr,widget);widget.template.content.data(dataAttr,widget.template)}return widget.api()};cleanup=function(el){var template;el.off(".uploadcare");el=el.next(".uploadcare-widget");template=el.data(dataAttr);if(el.length&&(!template||el[0]!==template.content[0])){return el.remove()}};ns.start=function(settings){var live;live=function(){return initialize($("@uploadcare-uploader"))};if(s.common(settings).live){return setInterval(live,100)}else{return live()}};return $(function(){if(!s.globals().manualStart){return ns.start()}})})}).call(this);(function(){var $,canSubmit,cancelEvents,submitPreventionState,submittedForm;$=uploadcare.jQuery;canSubmit=function(form){var notSubmittable;notSubmittable="[data-status=started], [data-status=error]";return !form.find(".uploadcare-widget").is(notSubmittable)};submitPreventionState=function(form,prevent){form.attr("data-uploadcare-submitted",prevent);return form.find(":submit").attr("disabled",prevent)};$(document).on("submit","@uploadcare-upload-form",function(){var form;form=$(this);if(canSubmit(form)){return true}else{submitPreventionState(form,true);return false}});submittedForm="@uploadcare-upload-form[data-uploadcare-submitted]";$(document).on("loaded.uploadcare",submittedForm,function(){return $(this).submit()});cancelEvents="ready.uploadcare error.uploadcare";$(document).on(cancelEvents,submittedForm,function(){var form;form=$(this);if(canSubmit(form)){return submitPreventionState(form,false)}})}).call(this);(function(){var expose,key,__hasProp={}.hasOwnProperty;uploadcare.version="0.17.0";expose=uploadcare.expose;expose("jQuery");expose("globals",uploadcare.settings.globals);expose("start");expose("initialize");expose("fileFrom");expose("filesFrom");expose("FileGroup");expose("loadFileGroup");expose("locales",(function(){var _ref,_results;_ref=uploadcare.locale.translations;_results=[];for(key in _ref){if(!__hasProp.call(_ref,key)){continue}_results.push(key)}return _results})());expose("openDialog");expose("openPanel");expose("registerTab");expose("Circle",uploadcare.ui.progress.Circle);expose("Widget");expose("MultipleWidget");expose("plugin",uploadcare.utils.plugin);expose("tabsCss");expose("dragdrop.support");expose("dragdrop.receiveDrop");expose("dragdrop.uploadDrop");expose("whenReady",function(fn){return fn()})}).call(this)}({},"//ucarecdn.com/widget/0.17.0/uploadcare/"));
|
@@ -1 +1 @@
|
|
1
|
-
// = require ./uploadcare-0.
|
1
|
+
// = require ./uploadcare-0.17.0
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# require "../../lib/generators/uploadcare_config_generator"
|
2
|
+
config_file = "#{Rails.root}/config/uploadcare.yml"
|
3
|
+
|
4
|
+
if File.exists?(config_file)
|
5
|
+
# defaults = YAML.load_file(defaults_file)
|
6
|
+
config = YAML.load_file(config_file)
|
7
|
+
UPLOADCARE_SETTINGS = Uploadcare::Rails::Settings.new config
|
8
|
+
# shortcut for later usage
|
9
|
+
Rails.application.config.uploadcare = UPLOADCARE_SETTINGS
|
10
|
+
else
|
11
|
+
# output warning in red color
|
12
|
+
# use default settings just to boot up
|
13
|
+
puts <<-eos
|
14
|
+
\e[31mWarning: no uploadcare.yml config file found.\e[0m
|
15
|
+
\e[31mwhile we will use default settings please run\e[0m
|
16
|
+
\e[36mrails g uploadcare_config\e[0m
|
17
|
+
\e[31mto set up config file.\e[0m
|
18
|
+
eos
|
19
|
+
|
20
|
+
config = {
|
21
|
+
"defaults" => {"public_key"=>"demopublickey", "private_key"=>"demoprivatekey"},
|
22
|
+
"development" => {"public_key"=>"demopublickey", "private_key"=>"demoprivatekey"},
|
23
|
+
"test" => {"public_key"=>"demopublickey", "private_key"=>"demoprivatekey"},
|
24
|
+
"production" => {"public_key"=>"demopublickey", "private_key"=>"demoprivatekey"}
|
25
|
+
}
|
26
|
+
UPLOADCARE_SETTINGS = Uploadcare::Rails::Settings.new config
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
public_key: "demopublickey" # replace it with your public key
|
3
|
+
private_key: "demoprivatekey" # replace it with your private key
|
4
|
+
|
5
|
+
# Avaliable options are listed at https://uploadcare.com/documentation/widget/#advanced-configuration
|
6
|
+
# please note, that for options marker as Global: N/A - there is no practical meaning
|
7
|
+
# of putting this option here, as it will not have any effect.
|
8
|
+
# But it also will not break anything.
|
9
|
+
|
10
|
+
# for preview step use:
|
11
|
+
# preview_step: false # true or false
|
12
|
+
|
13
|
+
# for clearable option (allows user to remove uploaded file from widget) use:
|
14
|
+
# clearable: false # true or false
|
15
|
+
|
16
|
+
# for setting tabs use tabs option:
|
17
|
+
# tabs: "url file facebook" # etc
|
18
|
+
# read more here: https://uploadcare.com/documentation/widget/#tabs
|
19
|
+
#
|
20
|
+
# Full list of tabs:
|
21
|
+
# |----------------------------------------|
|
22
|
+
# | Code | File Source | Default |
|
23
|
+
# |------------|-----------------|---------|
|
24
|
+
# | url | Any URL | On |
|
25
|
+
# | file | Local disk | On |
|
26
|
+
# | facebook | Facebook | On |
|
27
|
+
# | dropbox | Dropbox | Off |
|
28
|
+
# | gdrive | Google Drive | On |
|
29
|
+
# | box | Box | On |
|
30
|
+
# | skydrive | SkyDrive | On |
|
31
|
+
# | instagram | Instagram | On |
|
32
|
+
# | evernote | Evernote | On |
|
33
|
+
# | vk | VK | Off |
|
34
|
+
# |________________________________________|
|
35
|
+
|
36
|
+
# for locale option use:
|
37
|
+
# locale: "en"
|
38
|
+
|
39
|
+
# for autostore option use:
|
40
|
+
# autostore: true #true or false
|
41
|
+
|
42
|
+
# for manual start (which means you will need to initialize uploaders yourself) use:
|
43
|
+
# manual_start: false # true or false
|
44
|
+
|
45
|
+
# for path value use:
|
46
|
+
# path_value: true # true or false
|
47
|
+
# (important for input values - see https://uploadcare.com/documentation/widget/#input-value)
|
48
|
+
|
49
|
+
development:
|
50
|
+
<<: *defaults
|
51
|
+
|
52
|
+
test:
|
53
|
+
<<: *defaults
|
54
|
+
|
55
|
+
production:
|
56
|
+
<<: *defaults
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class UploadcareConfigGenerator < Rails::Generators::Base
|
2
|
+
desc "This generator creates an uploadcare config file your_app/config/uploadcare.yml"
|
3
|
+
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
def create_config_file
|
7
|
+
copy_file "uploadcare_config_template.yml", "config/uploadcare.yml"#create_file "config/uploadcare.yml", config_template
|
8
|
+
end
|
9
|
+
end
|
data/lib/uploadcare-rails.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Uploadcare::Rails::ActionView
|
2
|
+
module IncludeTags
|
3
|
+
def include_uploadcare_widget_from_cdn options={}
|
4
|
+
settings = {
|
5
|
+
min: true,
|
6
|
+
version: UPLOADCARE_SETTINGS.widget_version
|
7
|
+
}
|
8
|
+
|
9
|
+
settings.merge!(options)
|
10
|
+
|
11
|
+
v = settings[:version]
|
12
|
+
m = settings[:min] ? ".min" : ""
|
13
|
+
url = "https://ucarecdn.com/widget/#{v}/uploadcare/uploadcare-#{v}#{m}.js"
|
14
|
+
|
15
|
+
javascript_include_tag(url)
|
16
|
+
end
|
17
|
+
|
18
|
+
# PENDING due some issues with assets pipeline
|
19
|
+
# def include_uploadcare_widget_from_assets options={}
|
20
|
+
# end
|
21
|
+
|
22
|
+
|
23
|
+
def uploadcare_settings options={}
|
24
|
+
settings = UPLOADCARE_SETTINGS.widget_settings
|
25
|
+
settings.merge!(options)
|
26
|
+
js_settings = String.new
|
27
|
+
settings.each do |k, v|
|
28
|
+
js_settings << "UPLOADCARE_#{k.to_s.underscore.upcase} = \"#{v}\";\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
uc_settings = javascript_tag(js_settings)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
ActionView::Base.send :include, Uploadcare::Rails::ActionView::IncludeTags
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# require "action_view_form_builder"
|
2
|
+
|
3
|
+
module Uploadcare::Rails::ActionView
|
4
|
+
module UploaderTags
|
5
|
+
def uploadcare_uploader_options options
|
6
|
+
options = options.symbolize_keys.deep_merge({
|
7
|
+
:role => "uploadcare-uploader #{options[:role]}".strip,
|
8
|
+
:data => {:path_value => true}
|
9
|
+
})
|
10
|
+
|
11
|
+
# merge uploadcare options into data-attributes
|
12
|
+
# IMPORTANT: custome data-attrs will be overriden by
|
13
|
+
# the uploadcare options in case of collision.
|
14
|
+
if options[:uploadcare]
|
15
|
+
# options[:uploadcare] ||= {}
|
16
|
+
options[:data] = options[:data].merge!(options[:uploadcare])
|
17
|
+
options.tap {|options| options.delete(:uploadcare)}
|
18
|
+
else
|
19
|
+
options
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def uploadcare_uploader_tag name, options = {}
|
24
|
+
options = uploadcare_uploader_options(options)
|
25
|
+
hidden_field_tag(name, nil, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def uploadcare_uploader_field object_name, method, options = {}
|
29
|
+
options = uploadcare_uploader_options(options)
|
30
|
+
hidden_field(object_name, method, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.included(arg)
|
34
|
+
ActionView::Helpers::FormBuilder.send(:include, Uploadcare::Rails::ActionView::FormBuilder)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
module FormBuilder
|
40
|
+
# call uploadcare_uploader field for form object
|
41
|
+
# none of options will be overriden and given as-is
|
42
|
+
def uploadcare_uploader method, options={}
|
43
|
+
@template.uploadcare_uploader_field(@object_name, method, objectify_options(options))
|
44
|
+
end
|
45
|
+
|
46
|
+
# forse-set the data-multiple="false" for uploader
|
47
|
+
def uploadcare_single_uploader_field method, options={}
|
48
|
+
options[:uploadcare] ||= {}
|
49
|
+
options[:uploadcare][:multiple] = false
|
50
|
+
uploadcare_uploader(method, options)
|
51
|
+
end
|
52
|
+
|
53
|
+
# forse-set the data-multiple="true" for uploader
|
54
|
+
def uploadcare_multiple_uploader_field method, options={}
|
55
|
+
options[:uploadcare] ||= {}
|
56
|
+
options[:uploadcare][:multiple] = true
|
57
|
+
uploadcare_uploader(method, options)
|
58
|
+
end
|
59
|
+
|
60
|
+
# smart method to detect wich of - file or group - pesent
|
61
|
+
# and then choose either multiple or single-file upload.
|
62
|
+
# not that this method WILL override custom settings in order
|
63
|
+
# to prevent method collisions
|
64
|
+
def uploadcare_field method, options={}
|
65
|
+
if @object.try(:has_uploadcare_file?) && !@object.try(:as_uploadcare_group?)
|
66
|
+
uploadcare_single_uploader_field(method, options)
|
67
|
+
elsif !@object.try(:has_uploadcare_file?) && @object.try(:has_uploadcare_group?)
|
68
|
+
uploadcare_multiple_uploader_field(method, options)
|
69
|
+
else
|
70
|
+
uploadcare_uploader(method, options)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
ActionView::Base.send :include, Uploadcare::Rails::ActionView::UploaderTags
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "uploadcare/rails/file"
|
2
|
+
|
3
|
+
module Uploadcare
|
4
|
+
module Rails
|
5
|
+
module ActiveRecord
|
6
|
+
def has_uploadcare_file attribute, options={}
|
7
|
+
|
8
|
+
define_method "has_uploadcare_file?" do
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
define_method "has_uploadcare_group?" do
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
# attribute method - return file object
|
17
|
+
# it is not the ::File but ::Rails::File
|
18
|
+
# it has some helpers for rails enviroment
|
19
|
+
# but it also has all the methods of Uploadcare::File so no worries.
|
20
|
+
define_method "#{attribute}" do
|
21
|
+
cdn_url = attributes[attribute.to_s].to_s
|
22
|
+
|
23
|
+
return nil if cdn_url.empty?
|
24
|
+
|
25
|
+
api = UPLOADCARE_SETTINGS.api
|
26
|
+
file = Uploadcare::Rails::File.new api, cdn_url
|
27
|
+
end
|
28
|
+
|
29
|
+
# before saving we checking what it is a actually file cdn url
|
30
|
+
# or uuid. uuid will do.
|
31
|
+
# group url or uuid should raise an erorr
|
32
|
+
before_save "check_#{attribute}_for_uuid"
|
33
|
+
|
34
|
+
define_method "check_#{attribute}_for_uuid" do
|
35
|
+
url = self.attributes[attribute.to_s]
|
36
|
+
unless url.empty?
|
37
|
+
result = Uploadcare::Parser.parse(url)
|
38
|
+
raise "Invalid Uploadcare file uuid" unless result.is_a?(Uploadcare::Parser::File)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
ActiveRecord::Base.extend Uploadcare::Rails::ActiveRecord
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "uploadcare/rails/group"
|
2
|
+
|
3
|
+
module Uploadcare
|
4
|
+
module Rails
|
5
|
+
module ActiveRecord
|
6
|
+
def has_uploadcare_group attribute, options={}
|
7
|
+
|
8
|
+
define_method "has_uploadcare_file?" do
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
define_method "has_uploadcare_group?" do
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
# attribute method - return file object
|
17
|
+
define_method "#{attribute}" do
|
18
|
+
cdn_url = attributes[attribute.to_s].to_s
|
19
|
+
|
20
|
+
return nil if cdn_url.empty?
|
21
|
+
|
22
|
+
api = UPLOADCARE_SETTINGS.api
|
23
|
+
file = Uploadcare::Rails::Group.new api, cdn_url
|
24
|
+
end
|
25
|
+
|
26
|
+
# before saving we checking what it is a actually file cdn url
|
27
|
+
# or uuid. uuid will do.
|
28
|
+
# group url or uuid should raise an erorr
|
29
|
+
before_save "check_#{attribute}_for_uuid"
|
30
|
+
|
31
|
+
define_method "check_#{attribute}_for_uuid" do
|
32
|
+
url = self.attributes[attribute.to_s]
|
33
|
+
unless url.empty?
|
34
|
+
result = Uploadcare::Parser.parse(url)
|
35
|
+
raise "Invalid file uuid" if result.is_a?(Uploadcare::Parser::File)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
ActiveRecord::Base.extend Uploadcare::Rails::ActiveRecord
|
@@ -1,22 +1,28 @@
|
|
1
|
-
require
|
1
|
+
require "rails/engine"
|
2
|
+
require "uploadcare/rails/settings"
|
2
3
|
|
3
4
|
module Uploadcare
|
4
5
|
module Rails
|
5
6
|
class Engine < ::Rails::Engine
|
6
|
-
initializer '
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
initializer 'uploadcare_rails.load' do
|
7
|
+
initializer 'uploadcare-rails.load' do
|
8
|
+
# load actual rails extentions
|
9
|
+
|
10
|
+
# active record extention for stand-alone file models and models has files
|
11
11
|
ActiveSupport.on_load :active_record do
|
12
|
-
require 'uploadcare/rails/
|
12
|
+
require 'uploadcare/rails/active_record_has_file'
|
13
|
+
require 'uploadcare/rails/active_record_has_group'
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
require 'uploadcare/rails/
|
16
|
+
# # JS options, widets from cdn etc
|
17
|
+
ActiveSupport.on_load :action_view do
|
18
|
+
require 'uploadcare/rails/action_view_include_tags'
|
19
|
+
require 'uploadcare/rails/action_view_uploader_tags'
|
20
|
+
|
21
|
+
# # form helpers
|
22
|
+
# require 'uploadcare/rails/form_helpers'
|
23
|
+
# require 'uploadcare/rails/simple_form' if defined?(SimpleForm)
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
21
27
|
end
|
22
|
-
end
|
28
|
+
end
|
@@ -1,28 +1,25 @@
|
|
1
|
+
include ActionView::Helpers::AssetTagHelper
|
2
|
+
|
1
3
|
module Uploadcare
|
2
4
|
module Rails
|
3
|
-
class File
|
4
|
-
|
5
|
-
attr_reader :uuid
|
6
|
-
alias_method :file_id, :uuid
|
5
|
+
class File < Uploadcare::Api::File
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
# override default to string method
|
8
|
+
# instead of string representation of object it will return simple cdn url of a file
|
9
|
+
def to_s
|
10
|
+
cdn_url
|
12
11
|
end
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
# construct image tag for file
|
14
|
+
def image with_operations=true, options={}
|
15
|
+
if with_operations
|
16
|
+
url = cdn_url_with_operations
|
17
|
+
else
|
18
|
+
url = cdn_url
|
19
|
+
end
|
20
|
+
|
21
|
+
image_tag url, options
|
16
22
|
end
|
17
|
-
|
18
|
-
alias_method :public_url, :cdn_url
|
19
|
-
|
20
|
-
def api
|
21
|
-
@file ||= @api.file(@cdn_url)
|
22
|
-
end
|
23
|
-
|
24
|
-
alias_method :info, :api
|
25
|
-
|
26
23
|
end
|
27
24
|
end
|
28
|
-
end
|
25
|
+
end
|