ext_yarn 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83cc35630010098b94decbe78105ebd7c7ea45233b1cae389e3ad95a67dd42f9
4
- data.tar.gz: 373e3e344dfd77fd7e55ec55f3163048a7bc57bf97f269ddcf5d3b5def0de36d
3
+ metadata.gz: e58e8a46f8a67f11dd4bb0dd9577fe5e5779505492e530df4eb805f035493ce7
4
+ data.tar.gz: 15453be1468392f82b15b0cfba29b22b3da041c61dd59bf1a88086ec74202150
5
5
  SHA512:
6
- metadata.gz: e0b02160f5fbb700fe454e8e1528eb3464d64aa28fa1b4b9ed9310c49e54a241e6c4e04199908e8b50c8cd198b82d14b1c84b6f3eff7f589f863695b4e9d420b
7
- data.tar.gz: c7d87d098a89033aa28507664e2bde3e2966bd9d5fcb39f645c07fe39410fab8052fd8d9f7fcc6d9860a55acfb9fdd66f657e72c6e2b562f75333f02951044e4
6
+ metadata.gz: 6dcfabdba59d3a3e30cdbbbffed8c2ffed501cadd0e9f3851ad5e92f78b7da0ef5fe2db9e628b6af347814b186b337830f212c645a16cb56253250a36e0e2bda
7
+ data.tar.gz: ce2d6273fd60caa2bfdd11f3d32cb9b13cdb9a83964b591902ea24a74509be6a48362db12bc84a4acb77fb9dc95c91078b2d91a86cfbc9eee2b55d3c8feca2c7
@@ -1,3 +1,3 @@
1
1
  module ExtYarn
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
data/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "jquery-pjax": "defunkt/jquery-pjax",
16
16
  "jquery-touch-events": "benmajor/jQuery-Touch-Events",
17
17
  "jquery-ui": "^1.12.1",
18
- "jquery-ui-touch-punch-zoom-fork": "Kocik/jquery-ui-touch-punch-zoom-fork",
18
+ "jquery-ui-touch-punch": "^0.2.3",
19
19
  "jquery-ujs": "rails/jquery-ujs",
20
20
  "jquery.iframe-transport": "cmlenz/jquery-iframe-transport",
21
21
  "js-cookie": "^2.2.0",
@@ -17,7 +17,7 @@
17
17
  "font-awesome-sass@^4.7.0",
18
18
  "jquery-pjax@defunkt/jquery-pjax",
19
19
  "jquery-touch-events@benmajor/jQuery-Touch-Events",
20
- "jquery-ui-touch-punch-zoom-fork@Kocik/jquery-ui-touch-punch-zoom-fork",
20
+ "jquery-ui-touch-punch@^0.2.3",
21
21
  "jquery-ui@^1.12.1",
22
22
  "jquery-ujs@rails/jquery-ujs",
23
23
  "jquery.iframe-transport@cmlenz/jquery-iframe-transport",
@@ -35,8 +35,8 @@
35
35
  "signature_pad@^2.3"
36
36
  ],
37
37
  "lockfileEntries": {
38
- "actioncable@^5.2.1": "https://registry.yarnpkg.com/actioncable/-/actioncable-5.2.1.tgz#615428a8a302cec55117d9049f0fd7952011c962",
39
- "activestorage@^5.2.1": "https://registry.yarnpkg.com/activestorage/-/activestorage-5.2.1.tgz#b4be57fbedc25c6c361802707fc5e8884766f6a1",
38
+ "actioncable@^5.2.1": "https://registry.yarnpkg.com/actioncable/-/actioncable-5.2.2.tgz#0ec83195fd363c4d91a2fc19f78e77350aa5caac",
39
+ "activestorage@^5.2.1": "https://registry.yarnpkg.com/activestorage/-/activestorage-5.2.2.tgz#035c03f247467c13cd659584833502433099f8f4",
40
40
  "bootstrap-sass@^3.3.7": "https://registry.yarnpkg.com/bootstrap-sass/-/bootstrap-sass-3.3.7.tgz#6596c7ab40f6637393323ab0bc80d064fc630498",
41
41
  "bootstrap@^3.3": "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71",
42
42
  "bootswatch-sass@file:vendor/bootswatch-sass": "",
@@ -51,7 +51,7 @@
51
51
  "font-awesome-sass@^4.7.0": "https://registry.yarnpkg.com/font-awesome-sass/-/font-awesome-sass-4.7.0.tgz#4eda693e915009ce00b228e0964dc5eca9bc34e1",
52
52
  "jquery-pjax@defunkt/jquery-pjax": "https://codeload.github.com/defunkt/jquery-pjax/tar.gz/153262eda33e31119eabb97cd5f14365580a3b35",
53
53
  "jquery-touch-events@benmajor/jQuery-Touch-Events": "https://codeload.github.com/benmajor/jQuery-Touch-Events/tar.gz/05c3931d207069e324aaf908ca87f12257310392",
54
- "jquery-ui-touch-punch-zoom-fork@Kocik/jquery-ui-touch-punch-zoom-fork": "https://codeload.github.com/Kocik/jquery-ui-touch-punch-zoom-fork/tar.gz/ce01648d495f732a01519b1e4304f754be31f322",
54
+ "jquery-ui-touch-punch@^0.2.3": "https://registry.yarnpkg.com/jquery-ui-touch-punch/-/jquery-ui-touch-punch-0.2.3.tgz#eed82242733ba243f46b3e87c1841b308191da68",
55
55
  "jquery-ui@^1.12.1": "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51",
56
56
  "jquery-ujs@rails/jquery-ujs": "https://codeload.github.com/rails/jquery-ujs/tar.gz/9e805c90c8cfc57b39967052e1e9013ccb318cf8",
57
57
  "jquery.iframe-transport@cmlenz/jquery-iframe-transport": "https://codeload.github.com/cmlenz/jquery-iframe-transport/tar.gz/f9a5446f5f8a9d7bc4659ea9c49349b1f585316b",
@@ -70,7 +70,7 @@
70
70
  "moment@^2.22.2": "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66",
71
71
  "nprogress@rstacruz/nprogress": "https://codeload.github.com/rstacruz/nprogress/tar.gz/a0ab16ccdaca501d8d9881a4da1d691f4e6c4dda",
72
72
  "pako@^1.0.7": "https://registry.yarnpkg.com/pako/-/pako-1.0.7.tgz#2473439021b57f1516c82f58be7275ad8ef1bb27",
73
- "rails-ujs@^5.2.1": "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.1.tgz#2869c6d54fdfefac3aaa257f4efe211d8f5a7169",
73
+ "rails-ujs@^5.2.1": "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.2.tgz#ab01dd087a323975637b50e93e7afcc0f9068568",
74
74
  "roboto-fontface@^0.8.0": "https://registry.yarnpkg.com/roboto-fontface/-/roboto-fontface-0.8.0.tgz#031a83c8f79932801a57d83bf743f37250163499",
75
75
  "signature_pad@^2.3": "https://registry.yarnpkg.com/signature_pad/-/signature_pad-2.3.2.tgz#ca7230021c89cedeead27b33d8d16ff254e5f04a",
76
76
  "spark-md5@^3.0.0": "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.0.tgz#3722227c54e2faf24b1dc6d933cc144e6f71bfef"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "actioncable",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "WebSocket framework for Ruby on Rails.",
5
5
  "main": "lib/assets/compiled/action_cable.js",
6
6
  "files": [
@@ -1 +1,939 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ActiveStorage=e():t.ActiveStorage=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,r){"use strict";function n(t){var e=a(document.head,'meta[name="'+t+'"]');if(e)return e.getAttribute("content")}function i(t,e){return"string"==typeof t&&(e=t,t=document),o(t.querySelectorAll(e))}function a(t,e){return"string"==typeof t&&(e=t,t=document),t.querySelector(e)}function u(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.disabled,i=r.bubbles,a=r.cancelable,u=r.detail,o=document.createEvent("Event");o.initEvent(e,i||!0,a||!0),o.detail=u||{};try{t.disabled=!1,t.dispatchEvent(o)}finally{t.disabled=n}return o}function o(t){return Array.isArray(t)?t:Array.from?Array.from(t):[].slice.call(t)}e.d=n,e.c=i,e.b=a,e.a=u,e.e=o},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(t&&"function"==typeof t[e]){for(var r=arguments.length,n=Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return t[e].apply(t,n)}}r.d(e,"a",function(){return c});var a=r(6),u=r(8),o=r(9),s=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=0,c=function(){function t(e,r,i){n(this,t),this.id=++f,this.file=e,this.url=r,this.delegate=i}return s(t,[{key:"create",value:function(t){var e=this;a.a.create(this.file,function(r,n){if(r)return void t(r);var a=new u.a(e.file,n,e.url);i(e.delegate,"directUploadWillCreateBlobWithXHR",a.xhr),a.create(function(r){if(r)t(r);else{var n=new o.a(a);i(e.delegate,"directUploadWillStoreFileWithXHR",n.xhr),n.create(function(e){e?t(e):t(null,a.toJSON())})}})})}}]),t}()},function(t,e,r){"use strict";function n(){window.ActiveStorage&&Object(i.a)()}Object.defineProperty(e,"__esModule",{value:!0});var i=r(3),a=r(1);r.d(e,"start",function(){return i.a}),r.d(e,"DirectUpload",function(){return a.a}),setTimeout(n,1)},function(t,e,r){"use strict";function n(){d||(d=!0,document.addEventListener("submit",i),document.addEventListener("ajax:before",a))}function i(t){u(t)}function a(t){"FORM"==t.target.tagName&&u(t)}function u(t){var e=t.target;if(e.hasAttribute(l))return void t.preventDefault();var r=new c.a(e),n=r.inputs;n.length&&(t.preventDefault(),e.setAttribute(l,""),n.forEach(s),r.start(function(t){e.removeAttribute(l),t?n.forEach(f):o(e)}))}function o(t){var e=Object(h.b)(t,"input[type=submit]");if(e){var r=e,n=r.disabled;e.disabled=!1,e.focus(),e.click(),e.disabled=n}else e=document.createElement("input"),e.type="submit",e.style.display="none",t.appendChild(e),e.click(),t.removeChild(e)}function s(t){t.disabled=!0}function f(t){t.disabled=!1}e.a=n;var c=r(4),h=r(0),l="data-direct-uploads-processing",d=!1},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return s});var i=r(5),a=r(0),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o="input[type=file][data-direct-upload-url]:not([disabled])",s=function(){function t(e){n(this,t),this.form=e,this.inputs=Object(a.c)(e,o).filter(function(t){return t.files.length})}return u(t,[{key:"start",value:function(t){var e=this,r=this.createDirectUploadControllers();this.dispatch("start"),function n(){var i=r.shift();i?i.start(function(r){r?(t(r),e.dispatch("end")):n()}):(t(),e.dispatch("end"))}()}},{key:"createDirectUploadControllers",value:function(){var t=[];return this.inputs.forEach(function(e){Object(a.e)(e.files).forEach(function(r){var n=new i.a(e,r);t.push(n)})}),t}},{key:"dispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object(a.a)(this.form,"direct-uploads:"+t,{detail:e})}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return o});var i=r(1),a=r(0),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(e,r){n(this,t),this.input=e,this.file=r,this.directUpload=new i.a(this.file,this.url,this),this.dispatch("initialize")}return u(t,[{key:"start",value:function(t){var e=this,r=document.createElement("input");r.type="hidden",r.name=this.input.name,this.input.insertAdjacentElement("beforebegin",r),this.dispatch("start"),this.directUpload.create(function(n,i){n?(r.parentNode.removeChild(r),e.dispatchError(n)):r.value=i.signed_id,e.dispatch("end"),t(n)})}},{key:"uploadRequestDidProgress",value:function(t){var e=t.loaded/t.total*100;e&&this.dispatch("progress",{progress:e})}},{key:"dispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.file=this.file,e.id=this.directUpload.id,Object(a.a)(this.input,"direct-upload:"+t,{detail:e})}},{key:"dispatchError",value:function(t){this.dispatch("error",{error:t}).defaultPrevented||alert(t)}},{key:"directUploadWillCreateBlobWithXHR",value:function(t){this.dispatch("before-blob-request",{xhr:t})}},{key:"directUploadWillStoreFileWithXHR",value:function(t){var e=this;this.dispatch("before-storage-request",{xhr:t}),t.upload.addEventListener("progress",function(t){return e.uploadRequestDidProgress(t)})}},{key:"url",get:function(){return this.input.getAttribute("data-direct-upload-url")}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return s});var i=r(7),a=r.n(i),u=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,s=function(){function t(e){n(this,t),this.file=e,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}return u(t,null,[{key:"create",value:function(e,r){new t(e).create(r)}}]),u(t,[{key:"create",value:function(t){var e=this;this.callback=t,this.md5Buffer=new a.a.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",function(t){return e.fileReaderDidLoad(t)}),this.fileReader.addEventListener("error",function(t){return e.fileReaderDidError(t)}),this.readNextChunk()}},{key:"fileReaderDidLoad",value:function(t){if(this.md5Buffer.append(t.target.result),!this.readNextChunk()){var e=this.md5Buffer.end(!0),r=btoa(e);this.callback(null,r)}}},{key:"fileReaderDidError",value:function(t){this.callback("Error reading "+this.file.name)}},{key:"readNextChunk",value:function(){if(this.chunkIndex<this.chunkCount||0==this.chunkIndex&&0==this.chunkCount){var t=this.chunkIndex*this.chunkSize,e=Math.min(t+this.chunkSize,this.file.size),r=o.call(this.file,t,e);return this.fileReader.readAsArrayBuffer(r),this.chunkIndex++,!0}return!1}}]),t}()},function(t,e,r){!function(e){t.exports=e()}(function(t){"use strict";function e(t,e){var r=t[0],n=t[1],i=t[2],a=t[3];r+=(n&i|~n&a)+e[0]-680876936|0,r=(r<<7|r>>>25)+n|0,a+=(r&n|~r&i)+e[1]-389564586|0,a=(a<<12|a>>>20)+r|0,i+=(a&r|~a&n)+e[2]+606105819|0,i=(i<<17|i>>>15)+a|0,n+=(i&a|~i&r)+e[3]-1044525330|0,n=(n<<22|n>>>10)+i|0,r+=(n&i|~n&a)+e[4]-176418897|0,r=(r<<7|r>>>25)+n|0,a+=(r&n|~r&i)+e[5]+1200080426|0,a=(a<<12|a>>>20)+r|0,i+=(a&r|~a&n)+e[6]-1473231341|0,i=(i<<17|i>>>15)+a|0,n+=(i&a|~i&r)+e[7]-45705983|0,n=(n<<22|n>>>10)+i|0,r+=(n&i|~n&a)+e[8]+1770035416|0,r=(r<<7|r>>>25)+n|0,a+=(r&n|~r&i)+e[9]-1958414417|0,a=(a<<12|a>>>20)+r|0,i+=(a&r|~a&n)+e[10]-42063|0,i=(i<<17|i>>>15)+a|0,n+=(i&a|~i&r)+e[11]-1990404162|0,n=(n<<22|n>>>10)+i|0,r+=(n&i|~n&a)+e[12]+1804603682|0,r=(r<<7|r>>>25)+n|0,a+=(r&n|~r&i)+e[13]-40341101|0,a=(a<<12|a>>>20)+r|0,i+=(a&r|~a&n)+e[14]-1502002290|0,i=(i<<17|i>>>15)+a|0,n+=(i&a|~i&r)+e[15]+1236535329|0,n=(n<<22|n>>>10)+i|0,r+=(n&a|i&~a)+e[1]-165796510|0,r=(r<<5|r>>>27)+n|0,a+=(r&i|n&~i)+e[6]-1069501632|0,a=(a<<9|a>>>23)+r|0,i+=(a&n|r&~n)+e[11]+643717713|0,i=(i<<14|i>>>18)+a|0,n+=(i&r|a&~r)+e[0]-373897302|0,n=(n<<20|n>>>12)+i|0,r+=(n&a|i&~a)+e[5]-701558691|0,r=(r<<5|r>>>27)+n|0,a+=(r&i|n&~i)+e[10]+38016083|0,a=(a<<9|a>>>23)+r|0,i+=(a&n|r&~n)+e[15]-660478335|0,i=(i<<14|i>>>18)+a|0,n+=(i&r|a&~r)+e[4]-405537848|0,n=(n<<20|n>>>12)+i|0,r+=(n&a|i&~a)+e[9]+568446438|0,r=(r<<5|r>>>27)+n|0,a+=(r&i|n&~i)+e[14]-1019803690|0,a=(a<<9|a>>>23)+r|0,i+=(a&n|r&~n)+e[3]-187363961|0,i=(i<<14|i>>>18)+a|0,n+=(i&r|a&~r)+e[8]+1163531501|0,n=(n<<20|n>>>12)+i|0,r+=(n&a|i&~a)+e[13]-1444681467|0,r=(r<<5|r>>>27)+n|0,a+=(r&i|n&~i)+e[2]-51403784|0,a=(a<<9|a>>>23)+r|0,i+=(a&n|r&~n)+e[7]+1735328473|0,i=(i<<14|i>>>18)+a|0,n+=(i&r|a&~r)+e[12]-1926607734|0,n=(n<<20|n>>>12)+i|0,r+=(n^i^a)+e[5]-378558|0,r=(r<<4|r>>>28)+n|0,a+=(r^n^i)+e[8]-2022574463|0,a=(a<<11|a>>>21)+r|0,i+=(a^r^n)+e[11]+1839030562|0,i=(i<<16|i>>>16)+a|0,n+=(i^a^r)+e[14]-35309556|0,n=(n<<23|n>>>9)+i|0,r+=(n^i^a)+e[1]-1530992060|0,r=(r<<4|r>>>28)+n|0,a+=(r^n^i)+e[4]+1272893353|0,a=(a<<11|a>>>21)+r|0,i+=(a^r^n)+e[7]-155497632|0,i=(i<<16|i>>>16)+a|0,n+=(i^a^r)+e[10]-1094730640|0,n=(n<<23|n>>>9)+i|0,r+=(n^i^a)+e[13]+681279174|0,r=(r<<4|r>>>28)+n|0,a+=(r^n^i)+e[0]-358537222|0,a=(a<<11|a>>>21)+r|0,i+=(a^r^n)+e[3]-722521979|0,i=(i<<16|i>>>16)+a|0,n+=(i^a^r)+e[6]+76029189|0,n=(n<<23|n>>>9)+i|0,r+=(n^i^a)+e[9]-640364487|0,r=(r<<4|r>>>28)+n|0,a+=(r^n^i)+e[12]-421815835|0,a=(a<<11|a>>>21)+r|0,i+=(a^r^n)+e[15]+530742520|0,i=(i<<16|i>>>16)+a|0,n+=(i^a^r)+e[2]-995338651|0,n=(n<<23|n>>>9)+i|0,r+=(i^(n|~a))+e[0]-198630844|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+e[7]+1126891415|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+e[14]-1416354905|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+e[5]-57434055|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+e[12]+1700485571|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+e[3]-1894986606|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+e[10]-1051523|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+e[1]-2054922799|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+e[8]+1873313359|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+e[15]-30611744|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+e[6]-1560198380|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+e[13]+1309151649|0,n=(n<<21|n>>>11)+i|0,r+=(i^(n|~a))+e[4]-145523070|0,r=(r<<6|r>>>26)+n|0,a+=(n^(r|~i))+e[11]-1120210379|0,a=(a<<10|a>>>22)+r|0,i+=(r^(a|~n))+e[2]+718787259|0,i=(i<<15|i>>>17)+a|0,n+=(a^(i|~r))+e[9]-343485551|0,n=(n<<21|n>>>11)+i|0,t[0]=r+t[0]|0,t[1]=n+t[1]|0,t[2]=i+t[2]|0,t[3]=a+t[3]|0}function r(t){var e,r=[];for(e=0;e<64;e+=4)r[e>>2]=t.charCodeAt(e)+(t.charCodeAt(e+1)<<8)+(t.charCodeAt(e+2)<<16)+(t.charCodeAt(e+3)<<24);return r}function n(t){var e,r=[];for(e=0;e<64;e+=4)r[e>>2]=t[e]+(t[e+1]<<8)+(t[e+2]<<16)+(t[e+3]<<24);return r}function i(t){var n,i,a,u,o,s,f=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=f;n+=64)e(c,r(t.substring(n-64,n)));for(t=t.substring(n-64),i=t.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<i;n+=1)a[n>>2]|=t.charCodeAt(n)<<(n%4<<3);if(a[n>>2]|=128<<(n%4<<3),n>55)for(e(c,a),n=0;n<16;n+=1)a[n]=0;return u=8*f,u=u.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(u[2],16),s=parseInt(u[1],16)||0,a[14]=o,a[15]=s,e(c,a),c}function a(t){var r,i,a,u,o,s,f=t.length,c=[1732584193,-271733879,-1732584194,271733878];for(r=64;r<=f;r+=64)e(c,n(t.subarray(r-64,r)));for(t=r-64<f?t.subarray(r-64):new Uint8Array(0),i=t.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<i;r+=1)a[r>>2]|=t[r]<<(r%4<<3);if(a[r>>2]|=128<<(r%4<<3),r>55)for(e(c,a),r=0;r<16;r+=1)a[r]=0;return u=8*f,u=u.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(u[2],16),s=parseInt(u[1],16)||0,a[14]=o,a[15]=s,e(c,a),c}function u(t){var e,r="";for(e=0;e<4;e+=1)r+=p[t>>8*e+4&15]+p[t>>8*e&15];return r}function o(t){var e;for(e=0;e<t.length;e+=1)t[e]=u(t[e]);return t.join("")}function s(t){return/[\u0080-\uFFFF]/.test(t)&&(t=unescape(encodeURIComponent(t))),t}function f(t,e){var r,n=t.length,i=new ArrayBuffer(n),a=new Uint8Array(i);for(r=0;r<n;r+=1)a[r]=t.charCodeAt(r);return e?a:i}function c(t){return String.fromCharCode.apply(null,new Uint8Array(t))}function h(t,e,r){var n=new Uint8Array(t.byteLength+e.byteLength);return n.set(new Uint8Array(t)),n.set(new Uint8Array(e),t.byteLength),r?n:n.buffer}function l(t){var e,r=[],n=t.length;for(e=0;e<n-1;e+=2)r.push(parseInt(t.substr(e,2),16));return String.fromCharCode.apply(String,r)}function d(){this.reset()}var p=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];return"5d41402abc4b2a76b9719d911017c592"!==o(i("hello"))&&function(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r},"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(t,e){return t=0|t||0,t<0?Math.max(t+e,0):Math.min(t,e)}ArrayBuffer.prototype.slice=function(r,n){var i,a,u,o,s=this.byteLength,f=e(r,s),c=s;return n!==t&&(c=e(n,s)),f>c?new ArrayBuffer(0):(i=c-f,a=new ArrayBuffer(i),u=new Uint8Array(a),o=new Uint8Array(this,f,i),u.set(o),a)}}(),d.prototype.append=function(t){return this.appendBinary(s(t)),this},d.prototype.appendBinary=function(t){this._buff+=t,this._length+=t.length;var n,i=this._buff.length;for(n=64;n<=i;n+=64)e(this._hash,r(this._buff.substring(n-64,n)));return this._buff=this._buff.substring(n-64),this},d.prototype.end=function(t){var e,r,n=this._buff,i=n.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<i;e+=1)a[e>>2]|=n.charCodeAt(e)<<(e%4<<3);return this._finish(a,i),r=o(this._hash),t&&(r=l(r)),this.reset(),r},d.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}},d.prototype.setState=function(t){return this._buff=t.buff,this._length=t.length,this._hash=t.hash,this},d.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},d.prototype._finish=function(t,r){var n,i,a,u=r;if(t[u>>2]|=128<<(u%4<<3),u>55)for(e(this._hash,t),u=0;u<16;u+=1)t[u]=0;n=8*this._length,n=n.toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(n[2],16),a=parseInt(n[1],16)||0,t[14]=i,t[15]=a,e(this._hash,t)},d.hash=function(t,e){return d.hashBinary(s(t),e)},d.hashBinary=function(t,e){var r=i(t),n=o(r);return e?l(n):n},d.ArrayBuffer=function(){this.reset()},d.ArrayBuffer.prototype.append=function(t){var r,i=h(this._buff.buffer,t,!0),a=i.length;for(this._length+=t.byteLength,r=64;r<=a;r+=64)e(this._hash,n(i.subarray(r-64,r)));return this._buff=r-64<a?new Uint8Array(i.buffer.slice(r-64)):new Uint8Array(0),this},d.ArrayBuffer.prototype.end=function(t){var e,r,n=this._buff,i=n.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(e=0;e<i;e+=1)a[e>>2]|=n[e]<<(e%4<<3);return this._finish(a,i),r=o(this._hash),t&&(r=l(r)),this.reset(),r},d.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.ArrayBuffer.prototype.getState=function(){var t=d.prototype.getState.call(this);return t.buff=c(t.buff),t},d.ArrayBuffer.prototype.setState=function(t){return t.buff=f(t.buff,!0),d.prototype.setState.call(this,t)},d.ArrayBuffer.prototype.destroy=d.prototype.destroy,d.ArrayBuffer.prototype._finish=d.prototype._finish,d.ArrayBuffer.hash=function(t,e){var r=a(new Uint8Array(t)),n=o(r);return e?l(n):n},d})},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return u});var i=r(0),a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),u=function(){function t(e,r,a){var u=this;n(this,t),this.file=e,this.attributes={filename:e.name,content_type:e.type,byte_size:e.size,checksum:r},this.xhr=new XMLHttpRequest,this.xhr.open("POST",a,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),this.xhr.setRequestHeader("X-CSRF-Token",Object(i.d)("csrf-token")),this.xhr.addEventListener("load",function(t){return u.requestDidLoad(t)}),this.xhr.addEventListener("error",function(t){return u.requestDidError(t)})}return a(t,[{key:"create",value:function(t){this.callback=t,this.xhr.send(JSON.stringify({blob:this.attributes}))}},{key:"requestDidLoad",value:function(t){if(this.status>=200&&this.status<300){var e=this.response,r=e.direct_upload;delete e.direct_upload,this.attributes=e,this.directUploadData=r,this.callback(null,this.toJSON())}else this.requestDidError(t)}},{key:"requestDidError",value:function(t){this.callback('Error creating Blob for "'+this.file.name+'". Status: '+this.status)}},{key:"toJSON",value:function(){var t={};for(var e in this.attributes)t[e]=this.attributes[e];return t}},{key:"status",get:function(){return this.xhr.status}},{key:"response",get:function(){var t=this.xhr,e=t.responseType,r=t.response;return"json"==e?r:JSON.parse(r)}}]),t}()},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}r.d(e,"a",function(){return a});var i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=function(){function t(e){var r=this;n(this,t),this.blob=e,this.file=e.file;var i=e.directUploadData,a=i.url,u=i.headers;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",a,!0),this.xhr.responseType="text";for(var o in u)this.xhr.setRequestHeader(o,u[o]);this.xhr.addEventListener("load",function(t){return r.requestDidLoad(t)}),this.xhr.addEventListener("error",function(t){return r.requestDidError(t)})}return i(t,[{key:"create",value:function(t){this.callback=t,this.xhr.send(this.file.slice())}},{key:"requestDidLoad",value:function(t){var e=this.xhr,r=e.status,n=e.response;r>=200&&r<300?this.callback(null,n):this.requestDidError(t)}},{key:"requestDidError",value:function(t){this.callback('Error storing "'+this.file.name+'". Status: '+this.xhr.status)}}]),t}()}])});
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define([ "exports" ], factory) : factory(global.ActiveStorage = {});
3
+ })(this, function(exports) {
4
+ "use strict";
5
+ function createCommonjsModule(fn, module) {
6
+ return module = {
7
+ exports: {}
8
+ }, fn(module, module.exports), module.exports;
9
+ }
10
+ var sparkMd5 = createCommonjsModule(function(module, exports) {
11
+ (function(factory) {
12
+ {
13
+ module.exports = factory();
14
+ }
15
+ })(function(undefined) {
16
+ var hex_chr = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" ];
17
+ function md5cycle(x, k) {
18
+ var a = x[0], b = x[1], c = x[2], d = x[3];
19
+ a += (b & c | ~b & d) + k[0] - 680876936 | 0;
20
+ a = (a << 7 | a >>> 25) + b | 0;
21
+ d += (a & b | ~a & c) + k[1] - 389564586 | 0;
22
+ d = (d << 12 | d >>> 20) + a | 0;
23
+ c += (d & a | ~d & b) + k[2] + 606105819 | 0;
24
+ c = (c << 17 | c >>> 15) + d | 0;
25
+ b += (c & d | ~c & a) + k[3] - 1044525330 | 0;
26
+ b = (b << 22 | b >>> 10) + c | 0;
27
+ a += (b & c | ~b & d) + k[4] - 176418897 | 0;
28
+ a = (a << 7 | a >>> 25) + b | 0;
29
+ d += (a & b | ~a & c) + k[5] + 1200080426 | 0;
30
+ d = (d << 12 | d >>> 20) + a | 0;
31
+ c += (d & a | ~d & b) + k[6] - 1473231341 | 0;
32
+ c = (c << 17 | c >>> 15) + d | 0;
33
+ b += (c & d | ~c & a) + k[7] - 45705983 | 0;
34
+ b = (b << 22 | b >>> 10) + c | 0;
35
+ a += (b & c | ~b & d) + k[8] + 1770035416 | 0;
36
+ a = (a << 7 | a >>> 25) + b | 0;
37
+ d += (a & b | ~a & c) + k[9] - 1958414417 | 0;
38
+ d = (d << 12 | d >>> 20) + a | 0;
39
+ c += (d & a | ~d & b) + k[10] - 42063 | 0;
40
+ c = (c << 17 | c >>> 15) + d | 0;
41
+ b += (c & d | ~c & a) + k[11] - 1990404162 | 0;
42
+ b = (b << 22 | b >>> 10) + c | 0;
43
+ a += (b & c | ~b & d) + k[12] + 1804603682 | 0;
44
+ a = (a << 7 | a >>> 25) + b | 0;
45
+ d += (a & b | ~a & c) + k[13] - 40341101 | 0;
46
+ d = (d << 12 | d >>> 20) + a | 0;
47
+ c += (d & a | ~d & b) + k[14] - 1502002290 | 0;
48
+ c = (c << 17 | c >>> 15) + d | 0;
49
+ b += (c & d | ~c & a) + k[15] + 1236535329 | 0;
50
+ b = (b << 22 | b >>> 10) + c | 0;
51
+ a += (b & d | c & ~d) + k[1] - 165796510 | 0;
52
+ a = (a << 5 | a >>> 27) + b | 0;
53
+ d += (a & c | b & ~c) + k[6] - 1069501632 | 0;
54
+ d = (d << 9 | d >>> 23) + a | 0;
55
+ c += (d & b | a & ~b) + k[11] + 643717713 | 0;
56
+ c = (c << 14 | c >>> 18) + d | 0;
57
+ b += (c & a | d & ~a) + k[0] - 373897302 | 0;
58
+ b = (b << 20 | b >>> 12) + c | 0;
59
+ a += (b & d | c & ~d) + k[5] - 701558691 | 0;
60
+ a = (a << 5 | a >>> 27) + b | 0;
61
+ d += (a & c | b & ~c) + k[10] + 38016083 | 0;
62
+ d = (d << 9 | d >>> 23) + a | 0;
63
+ c += (d & b | a & ~b) + k[15] - 660478335 | 0;
64
+ c = (c << 14 | c >>> 18) + d | 0;
65
+ b += (c & a | d & ~a) + k[4] - 405537848 | 0;
66
+ b = (b << 20 | b >>> 12) + c | 0;
67
+ a += (b & d | c & ~d) + k[9] + 568446438 | 0;
68
+ a = (a << 5 | a >>> 27) + b | 0;
69
+ d += (a & c | b & ~c) + k[14] - 1019803690 | 0;
70
+ d = (d << 9 | d >>> 23) + a | 0;
71
+ c += (d & b | a & ~b) + k[3] - 187363961 | 0;
72
+ c = (c << 14 | c >>> 18) + d | 0;
73
+ b += (c & a | d & ~a) + k[8] + 1163531501 | 0;
74
+ b = (b << 20 | b >>> 12) + c | 0;
75
+ a += (b & d | c & ~d) + k[13] - 1444681467 | 0;
76
+ a = (a << 5 | a >>> 27) + b | 0;
77
+ d += (a & c | b & ~c) + k[2] - 51403784 | 0;
78
+ d = (d << 9 | d >>> 23) + a | 0;
79
+ c += (d & b | a & ~b) + k[7] + 1735328473 | 0;
80
+ c = (c << 14 | c >>> 18) + d | 0;
81
+ b += (c & a | d & ~a) + k[12] - 1926607734 | 0;
82
+ b = (b << 20 | b >>> 12) + c | 0;
83
+ a += (b ^ c ^ d) + k[5] - 378558 | 0;
84
+ a = (a << 4 | a >>> 28) + b | 0;
85
+ d += (a ^ b ^ c) + k[8] - 2022574463 | 0;
86
+ d = (d << 11 | d >>> 21) + a | 0;
87
+ c += (d ^ a ^ b) + k[11] + 1839030562 | 0;
88
+ c = (c << 16 | c >>> 16) + d | 0;
89
+ b += (c ^ d ^ a) + k[14] - 35309556 | 0;
90
+ b = (b << 23 | b >>> 9) + c | 0;
91
+ a += (b ^ c ^ d) + k[1] - 1530992060 | 0;
92
+ a = (a << 4 | a >>> 28) + b | 0;
93
+ d += (a ^ b ^ c) + k[4] + 1272893353 | 0;
94
+ d = (d << 11 | d >>> 21) + a | 0;
95
+ c += (d ^ a ^ b) + k[7] - 155497632 | 0;
96
+ c = (c << 16 | c >>> 16) + d | 0;
97
+ b += (c ^ d ^ a) + k[10] - 1094730640 | 0;
98
+ b = (b << 23 | b >>> 9) + c | 0;
99
+ a += (b ^ c ^ d) + k[13] + 681279174 | 0;
100
+ a = (a << 4 | a >>> 28) + b | 0;
101
+ d += (a ^ b ^ c) + k[0] - 358537222 | 0;
102
+ d = (d << 11 | d >>> 21) + a | 0;
103
+ c += (d ^ a ^ b) + k[3] - 722521979 | 0;
104
+ c = (c << 16 | c >>> 16) + d | 0;
105
+ b += (c ^ d ^ a) + k[6] + 76029189 | 0;
106
+ b = (b << 23 | b >>> 9) + c | 0;
107
+ a += (b ^ c ^ d) + k[9] - 640364487 | 0;
108
+ a = (a << 4 | a >>> 28) + b | 0;
109
+ d += (a ^ b ^ c) + k[12] - 421815835 | 0;
110
+ d = (d << 11 | d >>> 21) + a | 0;
111
+ c += (d ^ a ^ b) + k[15] + 530742520 | 0;
112
+ c = (c << 16 | c >>> 16) + d | 0;
113
+ b += (c ^ d ^ a) + k[2] - 995338651 | 0;
114
+ b = (b << 23 | b >>> 9) + c | 0;
115
+ a += (c ^ (b | ~d)) + k[0] - 198630844 | 0;
116
+ a = (a << 6 | a >>> 26) + b | 0;
117
+ d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0;
118
+ d = (d << 10 | d >>> 22) + a | 0;
119
+ c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0;
120
+ c = (c << 15 | c >>> 17) + d | 0;
121
+ b += (d ^ (c | ~a)) + k[5] - 57434055 | 0;
122
+ b = (b << 21 | b >>> 11) + c | 0;
123
+ a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0;
124
+ a = (a << 6 | a >>> 26) + b | 0;
125
+ d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0;
126
+ d = (d << 10 | d >>> 22) + a | 0;
127
+ c += (a ^ (d | ~b)) + k[10] - 1051523 | 0;
128
+ c = (c << 15 | c >>> 17) + d | 0;
129
+ b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0;
130
+ b = (b << 21 | b >>> 11) + c | 0;
131
+ a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0;
132
+ a = (a << 6 | a >>> 26) + b | 0;
133
+ d += (b ^ (a | ~c)) + k[15] - 30611744 | 0;
134
+ d = (d << 10 | d >>> 22) + a | 0;
135
+ c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0;
136
+ c = (c << 15 | c >>> 17) + d | 0;
137
+ b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0;
138
+ b = (b << 21 | b >>> 11) + c | 0;
139
+ a += (c ^ (b | ~d)) + k[4] - 145523070 | 0;
140
+ a = (a << 6 | a >>> 26) + b | 0;
141
+ d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0;
142
+ d = (d << 10 | d >>> 22) + a | 0;
143
+ c += (a ^ (d | ~b)) + k[2] + 718787259 | 0;
144
+ c = (c << 15 | c >>> 17) + d | 0;
145
+ b += (d ^ (c | ~a)) + k[9] - 343485551 | 0;
146
+ b = (b << 21 | b >>> 11) + c | 0;
147
+ x[0] = a + x[0] | 0;
148
+ x[1] = b + x[1] | 0;
149
+ x[2] = c + x[2] | 0;
150
+ x[3] = d + x[3] | 0;
151
+ }
152
+ function md5blk(s) {
153
+ var md5blks = [], i;
154
+ for (i = 0; i < 64; i += 4) {
155
+ md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
156
+ }
157
+ return md5blks;
158
+ }
159
+ function md5blk_array(a) {
160
+ var md5blks = [], i;
161
+ for (i = 0; i < 64; i += 4) {
162
+ md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24);
163
+ }
164
+ return md5blks;
165
+ }
166
+ function md51(s) {
167
+ var n = s.length, state = [ 1732584193, -271733879, -1732584194, 271733878 ], i, length, tail, tmp, lo, hi;
168
+ for (i = 64; i <= n; i += 64) {
169
+ md5cycle(state, md5blk(s.substring(i - 64, i)));
170
+ }
171
+ s = s.substring(i - 64);
172
+ length = s.length;
173
+ tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
174
+ for (i = 0; i < length; i += 1) {
175
+ tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3);
176
+ }
177
+ tail[i >> 2] |= 128 << (i % 4 << 3);
178
+ if (i > 55) {
179
+ md5cycle(state, tail);
180
+ for (i = 0; i < 16; i += 1) {
181
+ tail[i] = 0;
182
+ }
183
+ }
184
+ tmp = n * 8;
185
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
186
+ lo = parseInt(tmp[2], 16);
187
+ hi = parseInt(tmp[1], 16) || 0;
188
+ tail[14] = lo;
189
+ tail[15] = hi;
190
+ md5cycle(state, tail);
191
+ return state;
192
+ }
193
+ function md51_array(a) {
194
+ var n = a.length, state = [ 1732584193, -271733879, -1732584194, 271733878 ], i, length, tail, tmp, lo, hi;
195
+ for (i = 64; i <= n; i += 64) {
196
+ md5cycle(state, md5blk_array(a.subarray(i - 64, i)));
197
+ }
198
+ a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0);
199
+ length = a.length;
200
+ tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
201
+ for (i = 0; i < length; i += 1) {
202
+ tail[i >> 2] |= a[i] << (i % 4 << 3);
203
+ }
204
+ tail[i >> 2] |= 128 << (i % 4 << 3);
205
+ if (i > 55) {
206
+ md5cycle(state, tail);
207
+ for (i = 0; i < 16; i += 1) {
208
+ tail[i] = 0;
209
+ }
210
+ }
211
+ tmp = n * 8;
212
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
213
+ lo = parseInt(tmp[2], 16);
214
+ hi = parseInt(tmp[1], 16) || 0;
215
+ tail[14] = lo;
216
+ tail[15] = hi;
217
+ md5cycle(state, tail);
218
+ return state;
219
+ }
220
+ function rhex(n) {
221
+ var s = "", j;
222
+ for (j = 0; j < 4; j += 1) {
223
+ s += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15];
224
+ }
225
+ return s;
226
+ }
227
+ function hex(x) {
228
+ var i;
229
+ for (i = 0; i < x.length; i += 1) {
230
+ x[i] = rhex(x[i]);
231
+ }
232
+ return x.join("");
233
+ }
234
+ if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") ;
235
+ if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) {
236
+ (function() {
237
+ function clamp(val, length) {
238
+ val = val | 0 || 0;
239
+ if (val < 0) {
240
+ return Math.max(val + length, 0);
241
+ }
242
+ return Math.min(val, length);
243
+ }
244
+ ArrayBuffer.prototype.slice = function(from, to) {
245
+ var length = this.byteLength, begin = clamp(from, length), end = length, num, target, targetArray, sourceArray;
246
+ if (to !== undefined) {
247
+ end = clamp(to, length);
248
+ }
249
+ if (begin > end) {
250
+ return new ArrayBuffer(0);
251
+ }
252
+ num = end - begin;
253
+ target = new ArrayBuffer(num);
254
+ targetArray = new Uint8Array(target);
255
+ sourceArray = new Uint8Array(this, begin, num);
256
+ targetArray.set(sourceArray);
257
+ return target;
258
+ };
259
+ })();
260
+ }
261
+ function toUtf8(str) {
262
+ if (/[\u0080-\uFFFF]/.test(str)) {
263
+ str = unescape(encodeURIComponent(str));
264
+ }
265
+ return str;
266
+ }
267
+ function utf8Str2ArrayBuffer(str, returnUInt8Array) {
268
+ var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i;
269
+ for (i = 0; i < length; i += 1) {
270
+ arr[i] = str.charCodeAt(i);
271
+ }
272
+ return returnUInt8Array ? arr : buff;
273
+ }
274
+ function arrayBuffer2Utf8Str(buff) {
275
+ return String.fromCharCode.apply(null, new Uint8Array(buff));
276
+ }
277
+ function concatenateArrayBuffers(first, second, returnUInt8Array) {
278
+ var result = new Uint8Array(first.byteLength + second.byteLength);
279
+ result.set(new Uint8Array(first));
280
+ result.set(new Uint8Array(second), first.byteLength);
281
+ return returnUInt8Array ? result : result.buffer;
282
+ }
283
+ function hexToBinaryString(hex) {
284
+ var bytes = [], length = hex.length, x;
285
+ for (x = 0; x < length - 1; x += 2) {
286
+ bytes.push(parseInt(hex.substr(x, 2), 16));
287
+ }
288
+ return String.fromCharCode.apply(String, bytes);
289
+ }
290
+ function SparkMD5() {
291
+ this.reset();
292
+ }
293
+ SparkMD5.prototype.append = function(str) {
294
+ this.appendBinary(toUtf8(str));
295
+ return this;
296
+ };
297
+ SparkMD5.prototype.appendBinary = function(contents) {
298
+ this._buff += contents;
299
+ this._length += contents.length;
300
+ var length = this._buff.length, i;
301
+ for (i = 64; i <= length; i += 64) {
302
+ md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)));
303
+ }
304
+ this._buff = this._buff.substring(i - 64);
305
+ return this;
306
+ };
307
+ SparkMD5.prototype.end = function(raw) {
308
+ var buff = this._buff, length = buff.length, i, tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], ret;
309
+ for (i = 0; i < length; i += 1) {
310
+ tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3);
311
+ }
312
+ this._finish(tail, length);
313
+ ret = hex(this._hash);
314
+ if (raw) {
315
+ ret = hexToBinaryString(ret);
316
+ }
317
+ this.reset();
318
+ return ret;
319
+ };
320
+ SparkMD5.prototype.reset = function() {
321
+ this._buff = "";
322
+ this._length = 0;
323
+ this._hash = [ 1732584193, -271733879, -1732584194, 271733878 ];
324
+ return this;
325
+ };
326
+ SparkMD5.prototype.getState = function() {
327
+ return {
328
+ buff: this._buff,
329
+ length: this._length,
330
+ hash: this._hash
331
+ };
332
+ };
333
+ SparkMD5.prototype.setState = function(state) {
334
+ this._buff = state.buff;
335
+ this._length = state.length;
336
+ this._hash = state.hash;
337
+ return this;
338
+ };
339
+ SparkMD5.prototype.destroy = function() {
340
+ delete this._hash;
341
+ delete this._buff;
342
+ delete this._length;
343
+ };
344
+ SparkMD5.prototype._finish = function(tail, length) {
345
+ var i = length, tmp, lo, hi;
346
+ tail[i >> 2] |= 128 << (i % 4 << 3);
347
+ if (i > 55) {
348
+ md5cycle(this._hash, tail);
349
+ for (i = 0; i < 16; i += 1) {
350
+ tail[i] = 0;
351
+ }
352
+ }
353
+ tmp = this._length * 8;
354
+ tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/);
355
+ lo = parseInt(tmp[2], 16);
356
+ hi = parseInt(tmp[1], 16) || 0;
357
+ tail[14] = lo;
358
+ tail[15] = hi;
359
+ md5cycle(this._hash, tail);
360
+ };
361
+ SparkMD5.hash = function(str, raw) {
362
+ return SparkMD5.hashBinary(toUtf8(str), raw);
363
+ };
364
+ SparkMD5.hashBinary = function(content, raw) {
365
+ var hash = md51(content), ret = hex(hash);
366
+ return raw ? hexToBinaryString(ret) : ret;
367
+ };
368
+ SparkMD5.ArrayBuffer = function() {
369
+ this.reset();
370
+ };
371
+ SparkMD5.ArrayBuffer.prototype.append = function(arr) {
372
+ var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i;
373
+ this._length += arr.byteLength;
374
+ for (i = 64; i <= length; i += 64) {
375
+ md5cycle(this._hash, md5blk_array(buff.subarray(i - 64, i)));
376
+ }
377
+ this._buff = i - 64 < length ? new Uint8Array(buff.buffer.slice(i - 64)) : new Uint8Array(0);
378
+ return this;
379
+ };
380
+ SparkMD5.ArrayBuffer.prototype.end = function(raw) {
381
+ var buff = this._buff, length = buff.length, tail = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], i, ret;
382
+ for (i = 0; i < length; i += 1) {
383
+ tail[i >> 2] |= buff[i] << (i % 4 << 3);
384
+ }
385
+ this._finish(tail, length);
386
+ ret = hex(this._hash);
387
+ if (raw) {
388
+ ret = hexToBinaryString(ret);
389
+ }
390
+ this.reset();
391
+ return ret;
392
+ };
393
+ SparkMD5.ArrayBuffer.prototype.reset = function() {
394
+ this._buff = new Uint8Array(0);
395
+ this._length = 0;
396
+ this._hash = [ 1732584193, -271733879, -1732584194, 271733878 ];
397
+ return this;
398
+ };
399
+ SparkMD5.ArrayBuffer.prototype.getState = function() {
400
+ var state = SparkMD5.prototype.getState.call(this);
401
+ state.buff = arrayBuffer2Utf8Str(state.buff);
402
+ return state;
403
+ };
404
+ SparkMD5.ArrayBuffer.prototype.setState = function(state) {
405
+ state.buff = utf8Str2ArrayBuffer(state.buff, true);
406
+ return SparkMD5.prototype.setState.call(this, state);
407
+ };
408
+ SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy;
409
+ SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish;
410
+ SparkMD5.ArrayBuffer.hash = function(arr, raw) {
411
+ var hash = md51_array(new Uint8Array(arr)), ret = hex(hash);
412
+ return raw ? hexToBinaryString(ret) : ret;
413
+ };
414
+ return SparkMD5;
415
+ });
416
+ });
417
+ var classCallCheck = function(instance, Constructor) {
418
+ if (!(instance instanceof Constructor)) {
419
+ throw new TypeError("Cannot call a class as a function");
420
+ }
421
+ };
422
+ var createClass = function() {
423
+ function defineProperties(target, props) {
424
+ for (var i = 0; i < props.length; i++) {
425
+ var descriptor = props[i];
426
+ descriptor.enumerable = descriptor.enumerable || false;
427
+ descriptor.configurable = true;
428
+ if ("value" in descriptor) descriptor.writable = true;
429
+ Object.defineProperty(target, descriptor.key, descriptor);
430
+ }
431
+ }
432
+ return function(Constructor, protoProps, staticProps) {
433
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
434
+ if (staticProps) defineProperties(Constructor, staticProps);
435
+ return Constructor;
436
+ };
437
+ }();
438
+ var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
439
+ var FileChecksum = function() {
440
+ createClass(FileChecksum, null, [ {
441
+ key: "create",
442
+ value: function create(file, callback) {
443
+ var instance = new FileChecksum(file);
444
+ instance.create(callback);
445
+ }
446
+ } ]);
447
+ function FileChecksum(file) {
448
+ classCallCheck(this, FileChecksum);
449
+ this.file = file;
450
+ this.chunkSize = 2097152;
451
+ this.chunkCount = Math.ceil(this.file.size / this.chunkSize);
452
+ this.chunkIndex = 0;
453
+ }
454
+ createClass(FileChecksum, [ {
455
+ key: "create",
456
+ value: function create(callback) {
457
+ var _this = this;
458
+ this.callback = callback;
459
+ this.md5Buffer = new sparkMd5.ArrayBuffer();
460
+ this.fileReader = new FileReader();
461
+ this.fileReader.addEventListener("load", function(event) {
462
+ return _this.fileReaderDidLoad(event);
463
+ });
464
+ this.fileReader.addEventListener("error", function(event) {
465
+ return _this.fileReaderDidError(event);
466
+ });
467
+ this.readNextChunk();
468
+ }
469
+ }, {
470
+ key: "fileReaderDidLoad",
471
+ value: function fileReaderDidLoad(event) {
472
+ this.md5Buffer.append(event.target.result);
473
+ if (!this.readNextChunk()) {
474
+ var binaryDigest = this.md5Buffer.end(true);
475
+ var base64digest = btoa(binaryDigest);
476
+ this.callback(null, base64digest);
477
+ }
478
+ }
479
+ }, {
480
+ key: "fileReaderDidError",
481
+ value: function fileReaderDidError(event) {
482
+ this.callback("Error reading " + this.file.name);
483
+ }
484
+ }, {
485
+ key: "readNextChunk",
486
+ value: function readNextChunk() {
487
+ if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) {
488
+ var start = this.chunkIndex * this.chunkSize;
489
+ var end = Math.min(start + this.chunkSize, this.file.size);
490
+ var bytes = fileSlice.call(this.file, start, end);
491
+ this.fileReader.readAsArrayBuffer(bytes);
492
+ this.chunkIndex++;
493
+ return true;
494
+ } else {
495
+ return false;
496
+ }
497
+ }
498
+ } ]);
499
+ return FileChecksum;
500
+ }();
501
+ function getMetaValue(name) {
502
+ var element = findElement(document.head, 'meta[name="' + name + '"]');
503
+ if (element) {
504
+ return element.getAttribute("content");
505
+ }
506
+ }
507
+ function findElements(root, selector) {
508
+ if (typeof root == "string") {
509
+ selector = root;
510
+ root = document;
511
+ }
512
+ var elements = root.querySelectorAll(selector);
513
+ return toArray$1(elements);
514
+ }
515
+ function findElement(root, selector) {
516
+ if (typeof root == "string") {
517
+ selector = root;
518
+ root = document;
519
+ }
520
+ return root.querySelector(selector);
521
+ }
522
+ function dispatchEvent(element, type) {
523
+ var eventInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
524
+ var disabled = element.disabled;
525
+ var bubbles = eventInit.bubbles, cancelable = eventInit.cancelable, detail = eventInit.detail;
526
+ var event = document.createEvent("Event");
527
+ event.initEvent(type, bubbles || true, cancelable || true);
528
+ event.detail = detail || {};
529
+ try {
530
+ element.disabled = false;
531
+ element.dispatchEvent(event);
532
+ } finally {
533
+ element.disabled = disabled;
534
+ }
535
+ return event;
536
+ }
537
+ function toArray$1(value) {
538
+ if (Array.isArray(value)) {
539
+ return value;
540
+ } else if (Array.from) {
541
+ return Array.from(value);
542
+ } else {
543
+ return [].slice.call(value);
544
+ }
545
+ }
546
+ var BlobRecord = function() {
547
+ function BlobRecord(file, checksum, url) {
548
+ var _this = this;
549
+ classCallCheck(this, BlobRecord);
550
+ this.file = file;
551
+ this.attributes = {
552
+ filename: file.name,
553
+ content_type: file.type,
554
+ byte_size: file.size,
555
+ checksum: checksum
556
+ };
557
+ this.xhr = new XMLHttpRequest();
558
+ this.xhr.open("POST", url, true);
559
+ this.xhr.responseType = "json";
560
+ this.xhr.setRequestHeader("Content-Type", "application/json");
561
+ this.xhr.setRequestHeader("Accept", "application/json");
562
+ this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
563
+ this.xhr.setRequestHeader("X-CSRF-Token", getMetaValue("csrf-token"));
564
+ this.xhr.addEventListener("load", function(event) {
565
+ return _this.requestDidLoad(event);
566
+ });
567
+ this.xhr.addEventListener("error", function(event) {
568
+ return _this.requestDidError(event);
569
+ });
570
+ }
571
+ createClass(BlobRecord, [ {
572
+ key: "create",
573
+ value: function create(callback) {
574
+ this.callback = callback;
575
+ this.xhr.send(JSON.stringify({
576
+ blob: this.attributes
577
+ }));
578
+ }
579
+ }, {
580
+ key: "requestDidLoad",
581
+ value: function requestDidLoad(event) {
582
+ if (this.status >= 200 && this.status < 300) {
583
+ var response = this.response;
584
+ var direct_upload = response.direct_upload;
585
+ delete response.direct_upload;
586
+ this.attributes = response;
587
+ this.directUploadData = direct_upload;
588
+ this.callback(null, this.toJSON());
589
+ } else {
590
+ this.requestDidError(event);
591
+ }
592
+ }
593
+ }, {
594
+ key: "requestDidError",
595
+ value: function requestDidError(event) {
596
+ this.callback('Error creating Blob for "' + this.file.name + '". Status: ' + this.status);
597
+ }
598
+ }, {
599
+ key: "toJSON",
600
+ value: function toJSON() {
601
+ var result = {};
602
+ for (var key in this.attributes) {
603
+ result[key] = this.attributes[key];
604
+ }
605
+ return result;
606
+ }
607
+ }, {
608
+ key: "status",
609
+ get: function get$$1() {
610
+ return this.xhr.status;
611
+ }
612
+ }, {
613
+ key: "response",
614
+ get: function get$$1() {
615
+ var _xhr = this.xhr, responseType = _xhr.responseType, response = _xhr.response;
616
+ if (responseType == "json") {
617
+ return response;
618
+ } else {
619
+ return JSON.parse(response);
620
+ }
621
+ }
622
+ } ]);
623
+ return BlobRecord;
624
+ }();
625
+ var BlobUpload = function() {
626
+ function BlobUpload(blob) {
627
+ var _this = this;
628
+ classCallCheck(this, BlobUpload);
629
+ this.blob = blob;
630
+ this.file = blob.file;
631
+ var _blob$directUploadDat = blob.directUploadData, url = _blob$directUploadDat.url, headers = _blob$directUploadDat.headers;
632
+ this.xhr = new XMLHttpRequest();
633
+ this.xhr.open("PUT", url, true);
634
+ this.xhr.responseType = "text";
635
+ for (var key in headers) {
636
+ this.xhr.setRequestHeader(key, headers[key]);
637
+ }
638
+ this.xhr.addEventListener("load", function(event) {
639
+ return _this.requestDidLoad(event);
640
+ });
641
+ this.xhr.addEventListener("error", function(event) {
642
+ return _this.requestDidError(event);
643
+ });
644
+ }
645
+ createClass(BlobUpload, [ {
646
+ key: "create",
647
+ value: function create(callback) {
648
+ this.callback = callback;
649
+ this.xhr.send(this.file.slice());
650
+ }
651
+ }, {
652
+ key: "requestDidLoad",
653
+ value: function requestDidLoad(event) {
654
+ var _xhr = this.xhr, status = _xhr.status, response = _xhr.response;
655
+ if (status >= 200 && status < 300) {
656
+ this.callback(null, response);
657
+ } else {
658
+ this.requestDidError(event);
659
+ }
660
+ }
661
+ }, {
662
+ key: "requestDidError",
663
+ value: function requestDidError(event) {
664
+ this.callback('Error storing "' + this.file.name + '". Status: ' + this.xhr.status);
665
+ }
666
+ } ]);
667
+ return BlobUpload;
668
+ }();
669
+ var id = 0;
670
+ var DirectUpload = function() {
671
+ function DirectUpload(file, url, delegate) {
672
+ classCallCheck(this, DirectUpload);
673
+ this.id = ++id;
674
+ this.file = file;
675
+ this.url = url;
676
+ this.delegate = delegate;
677
+ }
678
+ createClass(DirectUpload, [ {
679
+ key: "create",
680
+ value: function create(callback) {
681
+ var _this = this;
682
+ FileChecksum.create(this.file, function(error, checksum) {
683
+ if (error) {
684
+ callback(error);
685
+ return;
686
+ }
687
+ var blob = new BlobRecord(_this.file, checksum, _this.url);
688
+ notify(_this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr);
689
+ blob.create(function(error) {
690
+ if (error) {
691
+ callback(error);
692
+ } else {
693
+ var upload = new BlobUpload(blob);
694
+ notify(_this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr);
695
+ upload.create(function(error) {
696
+ if (error) {
697
+ callback(error);
698
+ } else {
699
+ callback(null, blob.toJSON());
700
+ }
701
+ });
702
+ }
703
+ });
704
+ });
705
+ }
706
+ } ]);
707
+ return DirectUpload;
708
+ }();
709
+ function notify(object, methodName) {
710
+ if (object && typeof object[methodName] == "function") {
711
+ for (var _len = arguments.length, messages = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
712
+ messages[_key - 2] = arguments[_key];
713
+ }
714
+ return object[methodName].apply(object, messages);
715
+ }
716
+ }
717
+ var DirectUploadController = function() {
718
+ function DirectUploadController(input, file) {
719
+ classCallCheck(this, DirectUploadController);
720
+ this.input = input;
721
+ this.file = file;
722
+ this.directUpload = new DirectUpload(this.file, this.url, this);
723
+ this.dispatch("initialize");
724
+ }
725
+ createClass(DirectUploadController, [ {
726
+ key: "start",
727
+ value: function start(callback) {
728
+ var _this = this;
729
+ var hiddenInput = document.createElement("input");
730
+ hiddenInput.type = "hidden";
731
+ hiddenInput.name = this.input.name;
732
+ this.input.insertAdjacentElement("beforebegin", hiddenInput);
733
+ this.dispatch("start");
734
+ this.directUpload.create(function(error, attributes) {
735
+ if (error) {
736
+ hiddenInput.parentNode.removeChild(hiddenInput);
737
+ _this.dispatchError(error);
738
+ } else {
739
+ hiddenInput.value = attributes.signed_id;
740
+ }
741
+ _this.dispatch("end");
742
+ callback(error);
743
+ });
744
+ }
745
+ }, {
746
+ key: "uploadRequestDidProgress",
747
+ value: function uploadRequestDidProgress(event) {
748
+ var progress = event.loaded / event.total * 100;
749
+ if (progress) {
750
+ this.dispatch("progress", {
751
+ progress: progress
752
+ });
753
+ }
754
+ }
755
+ }, {
756
+ key: "dispatch",
757
+ value: function dispatch(name) {
758
+ var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
759
+ detail.file = this.file;
760
+ detail.id = this.directUpload.id;
761
+ return dispatchEvent(this.input, "direct-upload:" + name, {
762
+ detail: detail
763
+ });
764
+ }
765
+ }, {
766
+ key: "dispatchError",
767
+ value: function dispatchError(error) {
768
+ var event = this.dispatch("error", {
769
+ error: error
770
+ });
771
+ if (!event.defaultPrevented) {
772
+ alert(error);
773
+ }
774
+ }
775
+ }, {
776
+ key: "directUploadWillCreateBlobWithXHR",
777
+ value: function directUploadWillCreateBlobWithXHR(xhr) {
778
+ this.dispatch("before-blob-request", {
779
+ xhr: xhr
780
+ });
781
+ }
782
+ }, {
783
+ key: "directUploadWillStoreFileWithXHR",
784
+ value: function directUploadWillStoreFileWithXHR(xhr) {
785
+ var _this2 = this;
786
+ this.dispatch("before-storage-request", {
787
+ xhr: xhr
788
+ });
789
+ xhr.upload.addEventListener("progress", function(event) {
790
+ return _this2.uploadRequestDidProgress(event);
791
+ });
792
+ }
793
+ }, {
794
+ key: "url",
795
+ get: function get$$1() {
796
+ return this.input.getAttribute("data-direct-upload-url");
797
+ }
798
+ } ]);
799
+ return DirectUploadController;
800
+ }();
801
+ var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])";
802
+ var DirectUploadsController = function() {
803
+ function DirectUploadsController(form) {
804
+ classCallCheck(this, DirectUploadsController);
805
+ this.form = form;
806
+ this.inputs = findElements(form, inputSelector).filter(function(input) {
807
+ return input.files.length;
808
+ });
809
+ }
810
+ createClass(DirectUploadsController, [ {
811
+ key: "start",
812
+ value: function start(callback) {
813
+ var _this = this;
814
+ var controllers = this.createDirectUploadControllers();
815
+ var startNextController = function startNextController() {
816
+ var controller = controllers.shift();
817
+ if (controller) {
818
+ controller.start(function(error) {
819
+ if (error) {
820
+ callback(error);
821
+ _this.dispatch("end");
822
+ } else {
823
+ startNextController();
824
+ }
825
+ });
826
+ } else {
827
+ callback();
828
+ _this.dispatch("end");
829
+ }
830
+ };
831
+ this.dispatch("start");
832
+ startNextController();
833
+ }
834
+ }, {
835
+ key: "createDirectUploadControllers",
836
+ value: function createDirectUploadControllers() {
837
+ var controllers = [];
838
+ this.inputs.forEach(function(input) {
839
+ toArray$1(input.files).forEach(function(file) {
840
+ var controller = new DirectUploadController(input, file);
841
+ controllers.push(controller);
842
+ });
843
+ });
844
+ return controllers;
845
+ }
846
+ }, {
847
+ key: "dispatch",
848
+ value: function dispatch(name) {
849
+ var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
850
+ return dispatchEvent(this.form, "direct-uploads:" + name, {
851
+ detail: detail
852
+ });
853
+ }
854
+ } ]);
855
+ return DirectUploadsController;
856
+ }();
857
+ var processingAttribute = "data-direct-uploads-processing";
858
+ var submitButtonsByForm = new WeakMap();
859
+ var started = false;
860
+ function start() {
861
+ if (!started) {
862
+ started = true;
863
+ document.addEventListener("click", didClick, true);
864
+ document.addEventListener("submit", didSubmitForm);
865
+ document.addEventListener("ajax:before", didSubmitRemoteElement);
866
+ }
867
+ }
868
+ function didClick(event) {
869
+ var target = event.target;
870
+ if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) {
871
+ submitButtonsByForm.set(target.form, target);
872
+ }
873
+ }
874
+ function didSubmitForm(event) {
875
+ handleFormSubmissionEvent(event);
876
+ }
877
+ function didSubmitRemoteElement(event) {
878
+ if (event.target.tagName == "FORM") {
879
+ handleFormSubmissionEvent(event);
880
+ }
881
+ }
882
+ function handleFormSubmissionEvent(event) {
883
+ var form = event.target;
884
+ if (form.hasAttribute(processingAttribute)) {
885
+ event.preventDefault();
886
+ return;
887
+ }
888
+ var controller = new DirectUploadsController(form);
889
+ var inputs = controller.inputs;
890
+ if (inputs.length) {
891
+ event.preventDefault();
892
+ form.setAttribute(processingAttribute, "");
893
+ inputs.forEach(disable);
894
+ controller.start(function(error) {
895
+ form.removeAttribute(processingAttribute);
896
+ if (error) {
897
+ inputs.forEach(enable);
898
+ } else {
899
+ submitForm(form);
900
+ }
901
+ });
902
+ }
903
+ }
904
+ function submitForm(form) {
905
+ var button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]");
906
+ if (button) {
907
+ var _button = button, disabled = _button.disabled;
908
+ button.disabled = false;
909
+ button.focus();
910
+ button.click();
911
+ button.disabled = disabled;
912
+ } else {
913
+ button = document.createElement("input");
914
+ button.type = "submit";
915
+ button.style.display = "none";
916
+ form.appendChild(button);
917
+ button.click();
918
+ form.removeChild(button);
919
+ }
920
+ submitButtonsByForm.delete(form);
921
+ }
922
+ function disable(input) {
923
+ input.disabled = true;
924
+ }
925
+ function enable(input) {
926
+ input.disabled = false;
927
+ }
928
+ function autostart() {
929
+ if (window.ActiveStorage) {
930
+ start();
931
+ }
932
+ }
933
+ setTimeout(autostart, 1);
934
+ exports.start = start;
935
+ exports.DirectUpload = DirectUpload;
936
+ Object.defineProperty(exports, "__esModule", {
937
+ value: true
938
+ });
939
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "activestorage",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Attach cloud and local files in Rails applications",
5
5
  "main": "app/assets/javascripts/activestorage.js",
6
6
  "files": [
@@ -22,15 +22,19 @@
22
22
  },
23
23
  "devDependencies": {
24
24
  "babel-core": "^6.25.0",
25
- "babel-loader": "^7.1.1",
25
+ "babel-plugin-external-helpers": "^6.22.0",
26
26
  "babel-preset-env": "^1.6.0",
27
27
  "eslint": "^4.3.0",
28
28
  "eslint-plugin-import": "^2.7.0",
29
- "webpack": "^3.4.0"
29
+ "rollup": "^0.58.2",
30
+ "rollup-plugin-babel": "^3.0.4",
31
+ "rollup-plugin-commonjs": "^9.1.0",
32
+ "rollup-plugin-node-resolve": "^3.3.0",
33
+ "rollup-plugin-uglify": "^3.0.0"
30
34
  },
31
35
  "scripts": {
32
36
  "prebuild": "yarn lint",
33
- "build": "webpack -p",
37
+ "build": "rollup --config rollup.config.js",
34
38
  "lint": "eslint app/javascript",
35
39
  "prepublishOnly": "rm -rf src && cp -R app/javascript/activestorage src"
36
40
  }
@@ -1,9 +1,5 @@
1
1
  /*!
2
- * jQuery UI Touch Punch 0.2.3.fork
3
- *
4
- * This is fork with added support for zoomed-in viewport on mobile.
5
- * For more info look here:
6
- * https://github.com/Kocik/jquery-ui-touch-punch-zoom-fork
2
+ * jQuery UI Touch Punch 0.2.3
7
3
  *
8
4
  * Copyright 2011–2014, Dave Furfero
9
5
  * Dual licensed under the MIT or GPL Version 2 licenses.
@@ -52,11 +48,9 @@
52
48
  window, // view
53
49
  1, // detail
54
50
  touch.screenX, // screenX
55
- touch.screenY, // screenY
56
-
57
- //FORK: fix offset while zoomed-in on mobile
58
- touch.clientX + $(window).scrollLeft(), // clientX + scrollLeft
59
- touch.clientY + $(window).scrollTop(), // clientY + scrollTop
51
+ touch.screenY, // screenY
52
+ touch.clientX, // clientX
53
+ touch.clientY, // clientY
60
54
  false, // ctrlKey
61
55
  false, // altKey
62
56
  false, // shiftKey
@@ -183,4 +177,4 @@
183
177
  _mouseDestroy.call(self);
184
178
  };
185
179
 
186
- })(jQuery);
180
+ })(jQuery);
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "jquery-ui-touch-punch",
3
+ "version": "0.2.3",
4
+ "description": "A duck punch for adding touch events to jQuery UI",
5
+ "main": "jquery.ui.touch-punch.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/furf/jquery-ui-touch-punch.git"
12
+ },
13
+ "author": "furf",
14
+ "license": "Dual licensed under the MIT or GPL Version 2 licenses.",
15
+ "bugs": {
16
+ "url": "https://github.com/furf/jquery-ui-touch-punch/issues"
17
+ },
18
+ "homepage": "https://github.com/furf/jquery-ui-touch-punch"
19
+ }
@@ -633,7 +633,10 @@ Released under the MIT license
633
633
 
634
634
  fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
635
635
 
636
- if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null) && !jQuery.rails) {
636
+ if ((typeof jQuery !== "undefined" && jQuery !== null) && (jQuery.ajax != null)) {
637
+ if (jQuery.rails) {
638
+ throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');
639
+ }
637
640
  jQuery.rails = Rails;
638
641
  jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
639
642
  if (!options.crossDomain) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails-ujs",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Ruby on Rails unobtrusive scripting adapter",
5
5
  "main": "lib/assets/compiled/rails-ujs.js",
6
6
  "files": [
data/yarn.lock CHANGED
@@ -3,14 +3,14 @@
3
3
 
4
4
 
5
5
  actioncable@^5.2.1:
6
- version "5.2.1"
7
- resolved "https://registry.yarnpkg.com/actioncable/-/actioncable-5.2.1.tgz#615428a8a302cec55117d9049f0fd7952011c962"
8
- integrity sha512-z/YnsgKYUC0E28Pr8YGaq8sZXNQLTZNa8PAJGmqj5qODiGHTyaCVy/DkP1+xpJtAX/UaHSGHobIemoDY/x5SbQ==
6
+ version "5.2.2"
7
+ resolved "https://registry.yarnpkg.com/actioncable/-/actioncable-5.2.2.tgz#0ec83195fd363c4d91a2fc19f78e77350aa5caac"
8
+ integrity sha512-uZveOQ0OL1z8VwYqA84gMMfLMPHpS/GsnodS8oVh1xTUYeMf1L80gAbTVVVVVj84zUf7lOiIZMaiY0IlXNsgiw==
9
9
 
10
10
  activestorage@^5.2.1:
11
- version "5.2.1"
12
- resolved "https://registry.yarnpkg.com/activestorage/-/activestorage-5.2.1.tgz#b4be57fbedc25c6c361802707fc5e8884766f6a1"
13
- integrity sha512-n3LcwiC3EV5zkVAvay5yprXTBb8vzT2Qef1GCfC8feJTVWEadzNW9zYaOweDpshqzJHx+zdaps6uiHDJQbdCdA==
11
+ version "5.2.2"
12
+ resolved "https://registry.yarnpkg.com/activestorage/-/activestorage-5.2.2.tgz#035c03f247467c13cd659584833502433099f8f4"
13
+ integrity sha512-mFNTTU21Xf67RhYuBB90uPXKlafPtwy8cxXsKny9roKvkluZkLz6ih3s6VkjK+4cL8+aIGVV39RVIzmy1cfxqw==
14
14
  dependencies:
15
15
  spark-md5 "^3.0.0"
16
16
 
@@ -93,9 +93,10 @@ jquery-touch-events@benmajor/jQuery-Touch-Events:
93
93
  version "2.0.0"
94
94
  resolved "https://codeload.github.com/benmajor/jQuery-Touch-Events/tar.gz/05c3931d207069e324aaf908ca87f12257310392"
95
95
 
96
- jquery-ui-touch-punch-zoom-fork@Kocik/jquery-ui-touch-punch-zoom-fork:
97
- version "0.0.0"
98
- resolved "https://codeload.github.com/Kocik/jquery-ui-touch-punch-zoom-fork/tar.gz/ce01648d495f732a01519b1e4304f754be31f322"
96
+ jquery-ui-touch-punch@^0.2.3:
97
+ version "0.2.3"
98
+ resolved "https://registry.yarnpkg.com/jquery-ui-touch-punch/-/jquery-ui-touch-punch-0.2.3.tgz#eed82242733ba243f46b3e87c1841b308191da68"
99
+ integrity sha1-7tgiQnM7okP0az6HwYQbMIGR2mg=
99
100
 
100
101
  jquery-ui@^1.12.1:
101
102
  version "1.12.1"
@@ -164,9 +165,9 @@ pako@^1.0.7:
164
165
  integrity sha512-3HNK5tW4x8o5mO8RuHZp3Ydw9icZXx0RANAOMzlMzx7LVXhMJ4mo3MOBpzyd7r/+RUu8BmndP47LXT+vzjtWcQ==
165
166
 
166
167
  rails-ujs@^5.2.1:
167
- version "5.2.1"
168
- resolved "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.1.tgz#2869c6d54fdfefac3aaa257f4efe211d8f5a7169"
169
- integrity sha512-kOsSdmBATcilfMzBCYgbefQ+5eUG6BAr9rDy+GC09Cvqx0017XBVp1Xu/Ksvwr6r7fHzgNkEUpKnQoOflpNz+A==
168
+ version "5.2.2"
169
+ resolved "https://registry.yarnpkg.com/rails-ujs/-/rails-ujs-5.2.2.tgz#ab01dd087a323975637b50e93e7afcc0f9068568"
170
+ integrity sha512-tJl7MdysGrQEKmwF7BJkz5XwUOkdnI9E7SvSbT39yO7pdFc96D4hWKm6Sb15pU4n5mt4rLPb/6kkyTQujP1k7Q==
170
171
 
171
172
  roboto-fontface@^0.8.0:
172
173
  version "0.8.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ext_yarn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrice Lebel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-06 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets-rails
@@ -251,7 +251,8 @@ files:
251
251
  - vendor/jquery-touch-events/LICENSE
252
252
  - vendor/jquery-touch-events/package.json
253
253
  - vendor/jquery-touch-events/src/jquery.mobile-events.js
254
- - vendor/jquery-ui-touch-punch-zoom-fork/jquery.ui.touch-punch.js
254
+ - vendor/jquery-ui-touch-punch/jquery.ui.touch-punch.js
255
+ - vendor/jquery-ui-touch-punch/package.json
255
256
  - vendor/jquery-ui/LICENSE.txt
256
257
  - vendor/jquery-ui/package.json
257
258
  - vendor/jquery-ui/themes/base/accordion.css