/* >>> file start: js/front-bundled/dist/videoUploader.js */ /*! For license information please see videoUploader.js.LICENSE.txt */ (()=>{"use strict";const t=function(){return Date.now().toString(36)+Math.random().toString(36).slice(2)};var e=5*Math.pow(1024,2),r=Math.pow(1024,3),n=["FilesAdded","FileUploaded","BeforeUpload","BeforeChunkUpload","ChunkUploaded","UploadComplete","UploadProgress","Error"],o=["avi","mp4","mov","3gp","wmv","mkv","webm"],i=new Promise((function(t){["complete","loaded","interactive"].includes(document.readyState)&&t(),document.addEventListener("DOMContentLoaded",(function(){t()}))}));function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function l(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return l}}(t,e)||f(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(){u=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),l=new M(n||[]);return o(a,"_invoke",{value:C(t,r,l)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",w={};function b(){}function g(){}function E(){}var O={};f(O,l,(function(){return this}));var L=Object.getPrototypeOf,S=L&&L(L(I([])));S&&S!==r&&n.call(S,l)&&(O=S);var j=E.prototype=b.prototype=Object.create(O);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(o,i,l,u){var s=h(t[o],t,i);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==a(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,l,u)}),(function(t){r("throw",t,l,u)})):e.resolve(f).then((function(t){c.value=t,l(c)}),(function(t){return r("throw",t,l,u)}))}u(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function C(e,r,n){var o=d;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var u=P(l,n);if(u){if(u===w)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:v,s.arg===w)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function P(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,P(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),w;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,w;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,w):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,w)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[l];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),R(r),w}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;R(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),w}},e}function s(t,e,r,n,o,i,a){try{var l=t[i](a),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function c(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&void 0!==arguments[0]?arguments[0]:{},o=r.callbacks,i=void 0===o?{}:o,a=r.elements,l=void 0===a?{}:a,u=r.settings,s=void 0===u?{}:u,c=t(),p=E(e,e,Y).call(e,d(d({},e.defaultSettings),s));n.forEach((function(t){var e,r="".concat((e=t).charAt(0).toLowerCase()).concat(e.slice(1));O(f,P)[r]=i[r]||j})),g(f,I,c),g(f,R,p),O(f,G).call(f),O(f,D).call(f,"mimeTypes",(function(t){var r=t.type.startsWith("video"),n=t.name.split(".").at(-1).toLowerCase();return r&&O(f,R).extensions.includes(n)?t:(O(f,z).call(f,{code:e.errorCodes.FILE_EXTENSION_ERROR,message:LJ.ml("video_uploader.errors.file_extension",{filename:t.name,ext:n}),file:t}),null)})),O(f,D).call(f,"maxFileSize",(function(t){var r=t.size;return!r||r&&r1?r.slice(0,1):r).filter(O(f,U));if(n.length){var o=n.map((function(r){return{name:r.name,size:r.size,type:r.type,lastModifiedDate:r.lastModifiedDate,statusCode:e.statusCodes.QUEUED,uploadOffset:0,id:t(),getNative:function(){return r}}}));g(f,C,[].concat(c(O(f,C)),c(o))),O(f,P).filesAdded(f,o),O(f,T).fileInput&&(O(f,T).fileInput.value="")}}}),m(this,F,{writable:!0,value:function(t){var e=t.currentTarget.files;O(f,N).call(f,c(e))}}),m(this,W,{writable:!0,value:function(t){if(!(t instanceof HTMLInputElement)||"file"!==t.type)throw new Error("Incorrect file input node provided");var e=o.map((function(t){return".".concat(t)})).join();O(f,R).multiple?t.setAttribute("multiple",""):t.removeAttribute("multiple"),t.tabIndex=-1,t.setAttribute("accept",e),t.addEventListener("change",O(f,F)),O(f,T).fileInput=t}}),m(this,z,{writable:!0,value:function(t){O(f,P).error(f,t)}}),m(this,G,{writable:!0,value:function(){var t=new XMLHttpRequest;t.responseType="json",t.withCredentials=!1,g(f,A,{xhr:t,availableRetries:2})}}),m(this,H,{writable:!0,value:function(t,r){var n=f,o=t.start,i=O(n,A),a=i.availableRetries,l=i.xhr,u=r.id;a>0?(O(n,A).availableRetries-=1,O(n,Q).call(n,u,{uploadOffset:o}),setTimeout((function(){O(n,V).call(n,r)}),1e3)):(O(n,Q).call(n,u,{uploadOffset:0,statusCode:e.statusCodes.FAILED}),O(n,z).call(n,{code:e.errorCodes.UPLOAD_ERROR,message:LJ.ml("video_uploader.errors.http"),file:r,response:l.response,status:l.status,responseHeaders:l.getAllResponseHeaders()}),O(n,B).call(n))}}),m(this,J,{writable:!0,value:function(t,r){var n=t.blob,o=f,i=t.start,a=t.end,l=O(o,A).xhr,u=r.id,s=r.uploadOffset,c=O(o,R),p=c.endpoint,h=c.method;l.upload.onprogress=function(t){t.total&&(O(o,Q).call(o,u,{uploadOffset:Math.min(i+t.loaded,r.size)}),O(o,P).uploadProgress(o,r))},l.onload=function(){l.status<200||l.status>=400?O(o,H).call(o,t,r):(O(o,P).chunkUploaded(o,r,t,{total:n.size,response:l.response,status:l.status,responseHeaders:l.getAllResponseHeaders()}),a>=r.size?(O(o,Q).call(o,u,{statusCode:e.statusCodes.DONE,uploadOffset:r.size}),O(o,P).fileUploaded(o,r),O(o,B).call(o)):(O(o,Q).call(o,u,{uploadOffset:s+n.size}),O(o,P).uploadProgress(o,r),setTimeout((function(){O(o,V).call(o,r)}))))},l.onerror=function(){O(o,H).call(o,t,r)},l.onabort=function(){O(o,Q).call(o,u,{statusCode:e.statusCodes.STOPPED,uploadOffset:0})},l.open(h,p,!0),l.send(n)}}),m(this,V,{writable:!0,value:function(t){if(t.statusCode===e.statusCodes.UPLOADING&&O(f,x)!==e.statusCodes.STOPPED){var r=O(f,R).chunkSize,n=t.getNative(),o=t.uploadOffset,i=Math.min(o+r,t.size),a={blob:n.slice(o,i),start:o,end:i,number:Math.ceil(o/r)+1};O(f,P).beforeChunkUpload(f,t,a),O(f,J).call(f,a,t)}}}),m(this,B,{writable:!0,value:(i=u().mark((function t(){var r;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=O(f,C).find((function(t){return t.statusCode===e.statusCodes.QUEUED}))){t.next=5;break}return g(f,x,e.statusCodes.DONE),O(f,P).uploadComplete(f,O(f,C)),t.abrupt("return");case 5:O(f,P).beforeUpload(f,r),O(f,G).call(f),O(f,Q).call(f,r.id,{statusCode:e.statusCodes.UPLOADING}),O(f,V).call(f,r);case 9:case"end":return t.stop()}}),t)})),a=function(){var t=this,e=arguments;return new Promise((function(r,n){var o=i.apply(t,e);function a(t){s(o,r,n,a,l,"next",t)}function l(t){s(o,r,n,a,l,"throw",t)}a(void 0)}))},function(){return a.apply(this,arguments)})}),m(this,Q,{writable:!0,value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=O(f,C).find((function(e){return e.id===t}));r&&Object.entries(e).forEach((function(t){var e=l(t,2),n=e[0],o=e[1];r[n]=o}))}}),w(this,"patchSettings",(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=E(e,e,Y).call(e,t);g(f,R,d(d({},O(f,R)),r))})),w(this,"patchFile",(function(t){var e=d({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{});["id","getNative","uploadOffset","statusCode"].forEach((function(t){delete e[t]})),O(f,Q).call(f,t,e)})),w(this,"getId",(function(){return O(f,I)})),w(this,"getSettings",(function(){return d({},O(f,R))})),w(this,"getFiles",(function(){return c(O(f,C))})),w(this,"getElements",(function(){return d({},e[O(f,I)].elements)})),w(this,"bindCallbackToEvent",(function(t,e){O(f,P)[t]=e})),w(this,"addFiles",(function(t){Array.isArray(t)&&t.length&&O(f,N).call(f,t)})),w(this,"removeFile",(function(t){t&&g(f,C,O(f,C).filter((function(e){return e.id!==t})))})),w(this,"removeFiles",(function(t){null!=t&&t.length&&t.forEach((function(t){f.removeFile(t)}))})),w(this,"clear",(function(){O(f,x)!==e.statusCodes.STARTED?(O(f,G).call(f),g(f,C,[])):f.stop()})),w(this,"start",(function(){O(f,x)!==e.statusCodes.STARTED&&(g(f,x,e.statusCodes.STARTED),O(f,B).call(f))})),w(this,"stop",(function(){if(O(f,x)===e.statusCodes.STARTED){var t=O(f,A).xhr;g(f,x,e.statusCodes.STOPPED),t.abort(),f.clear()}}));var p=r.callbacks,h=r.elements,v=void 0===h?{}:h,y=r.settings,b=void 0===y?{}:y;try{O(this,_).call(this,{callbacks:p,settings:b,elements:v})}catch(t){O(this,z).call(this,{code:e.errorCodes.INIT_ERROR,message:t.message})}}));w(X,"defaultSettings",Object.freeze(d({multiple:!1,method:"POST",extensions:o},k))),w(X,"statusCodes",Object.freeze({STOPPED:1,QUEUED:1,STARTED:2,UPLOADING:2,FAILED:4,DONE:5})),w(X,"errorCodes",Object.freeze({INIT_ERROR:100,UPLOAD_ERROR:200,FILE_SIZE_ERROR:300,FILE_EXTENSION_ERROR:301}));var Y={writable:!0,value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.entries(t),r={};return e.forEach((function(t){var e=l(t,2),n=e[0],o=e[1],i=k[n];if(i&&o>i)return r[n]=i,void console.warn("VideoUploader/validateSettings: ".concat(o," is unexpected value for ").concat(n));r[n]=o})),r}};!function(){for(var t,e="LJ.Misc.VideoUploader".split("."),r=window;t=e.shift();)r[t]=r[t]||{},r=r[t]}(),LJ.Misc.VideoUploader=X,i.then((function(){var t=new CustomEvent("VideoUploader:codeReady");window.dispatchEvent(t)}))})(); /* <<< file end: js/front-bundled/dist/videoUploader.js */ //# map link was there [videoUploader.js.map]