System.register(["../types/nile-file-preview.enums.cjs.js"],function(_export,_context){"use strict";var e,s,t,n,o,a,r,i,l,c;return{setters:[function(_typesNileFilePreviewEnumsCjsJs){e=_typesNileFilePreviewEnumsCjsJs.c;s=_typesNileFilePreviewEnumsCjsJs.b;t=_typesNileFilePreviewEnumsCjsJs.F;}],execute:function execute(){_export("a",n=function n(s){return new Promise(function(t,n){var o=new FileReader();s?o.readAsDataURL(s):n(e.NO_FILE_SELECTED),o.onload=function(){var e=o.result;t(e);},o.onerror=function(s){n(e.UNABLE_TO_GENEARTE_URL);};});}),_export("r",o=function o(e,t,n){t.target&&t.target.dispatchEvent(new CustomEvent(s.NILE_REMOVE,{detail:{value:e,url:n},bubbles:!0,composed:!0}));}),_export("c",a=function a(n,o,_a){o.target&&(o.target.dispatchEvent(new CustomEvent(s.NILE_CANCEL_UPLOAD,{detail:{file:n},bubbles:!0,composed:!0})),_a.state=t.ERROR,_a.errorMessage=e.UPLOAD_CANCEL,_a.requestUpdate());}),_export("f",r=function r(e){var s=e/1e3,t=e/1e6,n=e/1e9;return n>=1?n.toFixed(2)+" GB":t>=1?t.toFixed(2)+" MB":s>=1?s.toFixed(2)+" KB":e+" B";}),_export("g",i=function i(e,s){if(s)return e.name.split(".").pop()||"";return((e.type||"").split("/")[1]||"").toUpperCase();}),_export("t",l=function l(e){("vertical"===e.variant&&e.errorMessage.length>34||"horizontal"===e.variant&&e.errorMessage.length>96)&&(e.isStringTruncated=!0,e.requestUpdate());}),_export("i",c=function c(e){return new Promise(function(s){var t=new Blob([e],{type:e.type}),n=URL.createObjectURL(t),o=new Image();o.onload=function(){URL.revokeObjectURL(n),s(!0);},o.onerror=function(){URL.revokeObjectURL(n),s(!1);},o.src=n;});});}};});
//# sourceMappingURL=nile-file-preview.util.cjs.js.map
