ionic-image-loader-v5
Version:
ionic-image-loader to Ionic 5
16 lines (14 loc) • 22.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common/http"),require("@angular/core"),require("@ionic-native/file/ngx"),require("@ionic-native/ionic-webview/ngx"),require("@ionic/angular"),require("rxjs"),require("rxjs/operators"),require("@ionic-native/file/ngx/index"),require("@ionic-native/ionic-webview/ngx/index"),require("@angular/common")):"function"==typeof define&&define.amd?define("ionic-image-loader-v5",["exports","@angular/common/http","@angular/core","@ionic-native/file/ngx","@ionic-native/ionic-webview/ngx","@ionic/angular","rxjs","rxjs/operators","@ionic-native/file/ngx/index","@ionic-native/ionic-webview/ngx/index","@angular/common"],t):t((e=e||self)["ionic-image-loader-v5"]={},e.ng.common.http,e.ng.core,e.ngx,e.ngx$1,e.angular,e.rxjs,e.rxjs.operators,e.index,e.index$1,e.ng.common)}(this,(function(e,t,i,r,n,o,s,c,a,h,u){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function l(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function p(e,t){var i,r,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}var f=function(){function e(){this.debugMode=!1,this.spinnerEnabled=!0,this.fallbackAsPlaceholder=!1,this.backgroundSize="contain",this.backgroundRepeat="no-repeat",this.display="block",this.width="100%",this.height="100%",this.useImg=!1,this.concurrency=5,this.maxCacheSize=-1,this.maxCacheAge=-1,this.imageReturnType="uri",this.fileNameCachedWithExtension=!0,this.fallbackFileNameCachedExtension=".jpg",this.cacheDirectoryType="cache",this._cacheDirectoryName="image-loader-cache"}return Object.defineProperty(e.prototype,"cacheDirectoryName",{get:function(){return this._cacheDirectoryName},set:function(e){e.replace(/\W/g,""),this._cacheDirectoryName=e},enumerable:!0,configurable:!0}),e.prototype.enableDebugMode=function(){this.debugMode=!0},e.prototype.enableSpinner=function(e){this.spinnerEnabled=e},e.prototype.enableFallbackAsPlaceholder=function(e){this.fallbackAsPlaceholder=e},e.prototype.setCacheDirectoryName=function(e){this.cacheDirectoryName=e},e.prototype.setHeight=function(e){this.height=e},e.prototype.setWidth=function(e){this.width=e},e.prototype.setDisplay=function(e){this.display=e},e.prototype.useImageTag=function(e){this.useImg=e},e.prototype.setBackgroundSize=function(e){this.backgroundSize=e},e.prototype.setBackgroundRepeat=function(e){this.backgroundRepeat=e},e.prototype.setFallbackUrl=function(e){this.fallbackUrl=e},e.prototype.setConcurrency=function(e){this.concurrency=e},e.prototype.setMaximumCacheSize=function(e){this.maxCacheSize=e},e.prototype.setMaximumCacheAge=function(e){this.maxCacheAge=e},e.prototype.setImageReturnType=function(e){this.imageReturnType=e},e.prototype.setSpinnerName=function(e){this.spinnerName=e},e.prototype.setSpinnerColor=function(e){this.spinnerColor=e},e.prototype.setHttpHeaders=function(e){this.httpHeaders=e},e.prototype.setFileTransferOptions=function(e){},e.prototype.setFileNameCachedWithExtension=function(e){this.fileNameCachedWithExtension=e},e.prototype.setFallbackFileNameCachedExtension=function(e){this.fallbackFileNameCachedExtension=e},e.decorators=[{type:i.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=i.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var d=["jpg","png","jpeg","gif","svg","tiff"],g=function(){function e(e,t,i,r,n){var o=this;this.config=e,this.file=t,this.http=i,this.platform=r,this.webview=n,this.isCacheReady=!1,this.isInit=!1,this.initPromise=new Promise((function(e){return o.initPromiseResolve=e})),this.lockSubject=new s.Subject,this.lock$=this.lockSubject.asObservable(),this.concurrency=5,this.queue=[],this.processing=0,this.currentlyProcessing={},this.cacheIndex=[],this.currentCacheSize=0,this.indexed=!1,this.lockedCallsQueue=[],r.is("cordova")?s.fromEvent(document,"deviceready").pipe(c.first()).subscribe((function(e){o.nativeAvailable?o.initCache():(o.isInit=!0,o.initPromiseResolve(),o.throwWarning("You are running on a browser or using livereload, IonicImageLoader will not function, falling back to browser loading."))})):(this.isInit=!0,this.throwWarning("You are running on a browser or using livereload, IonicImageLoader will not function, falling back to browser loading."),this.initPromiseResolve())}return Object.defineProperty(e.prototype,"nativeAvailable",{get:function(){return r.File.installed()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isCacheSpaceExceeded",{get:function(){return this.config.maxCacheSize>-1&&this.currentCacheSize>this.config.maxCacheSize},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isWKWebView",{get:function(){return this.platform.is("ios")&&window.webkit&&window.webkit.messageHandlers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isIonicWKWebView",{get:function(){return this.platform.is("android")&&this.webview||this.platform.is("android")&&"localhost:8080"===location.host||window.LiveReload},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDevServer",{get:function(){return void 0!==window.IonicDevServer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canProcess",{get:function(){return this.queue.length>0&&this.processing<this.concurrency},enumerable:!0,configurable:!0}),e.prototype.ready=function(){return this.initPromise},e.prototype.preload=function(e){return this.getImagePath(e)},e.prototype.getFileCacheDirectory=function(){return"data"===this.config.cacheDirectoryType?this.file.dataDirectory:"external"===this.config.cacheDirectoryType?this.platform.is("android")?this.file.externalDataDirectory:this.file.documentsDirectory:this.file.cacheDirectory},e.prototype.clearImageCache=function(e){return l(this,void 0,void 0,(function(){var t=this;return p(this,(function(i){switch(i.label){case 0:return this.platform.is("cordova")?[4,this.ready()]:[2];case 1:return i.sent(),this.runLocked((function(){return l(t,void 0,void 0,(function(){var t,i,r;return p(this,(function(n){switch(n.label){case 0:t=this.createFileName(e),i=this.getFileCacheDirectory()+this.config.cacheDirectoryName,this.isInit=!1,n.label=1;case 1:return n.trys.push([1,5,,6]),[4,this.file.removeFile(i,t)];case 2:return n.sent(),!this.isWKWebView||this.isIonicWKWebView?[3,4]:[4,this.file.removeFile(this.file.tempDirectory+this.config.cacheDirectoryName,t)];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return r=n.sent(),this.throwError(r),[3,6];case 6:return[2,this.initCache(!0)]}}))}))})),[2]}}))}))},e.prototype.clearCache=function(){return l(this,void 0,void 0,(function(){var e=this;return p(this,(function(t){switch(t.label){case 0:return this.platform.is("cordova")?[4,this.ready()]:[2];case 1:return t.sent(),this.runLocked((function(){return l(e,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.file.removeRecursively(this.getFileCacheDirectory(),this.config.cacheDirectoryName)];case 1:if(t.sent(),this.isWKWebView&&!this.isIonicWKWebView)try{this.file.removeRecursively(this.file.tempDirectory,this.config.cacheDirectoryName)}catch(e){}return[3,3];case 2:return e=t.sent(),this.throwError(e),[3,3];case 3:return[2,this.initCache(!0)]}}))}))})),[2]}}))}))},e.prototype.getImagePath=function(e){return l(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:if("string"!=typeof e||e.length<=0)throw new Error("The image url provided was empty or invalid.");return[4,this.ready()];case 1:if(t.sent(),!this.isCacheReady)return this.throwWarning("The cache system is not running. Images will be loaded by your browser instead."),[2,e];if(this.isImageUrlRelative(e))return[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.getCachedImagePath(e)];case 3:return[2,t.sent()];case 4:return t.sent(),[2,this.addItemToQueue(e)];case 5:return[2]}}))}))},e.prototype.processLockedQueue=function(){return l(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,this.getLockedState()];case 1:return t.sent()?[2]:this.lockedCallsQueue.length>0?[4,this.setLockedState(!0)]:[3,8];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,this.lockedCallsQueue.slice(0,1)[0]()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),console.log("Error running locked function: ",e),[3,6];case 6:return[4,this.setLockedState(!1)];case 7:return t.sent(),[2,this.processLockedQueue()];case 8:return[2]}}))}))},e.prototype.getLockedState=function(){return this.lock$.pipe(c.take(1)).toPromise()},e.prototype.awaitUnlocked=function(){return this.lock$.pipe(c.filter((function(e){return!!e})),c.take(1)).toPromise()},e.prototype.setLockedState=function(e){return l(this,void 0,void 0,(function(){return p(this,(function(t){return this.lockSubject.next(e),[2]}))}))},e.prototype.runLocked=function(e){this.lockedCallsQueue.push(e),this.processLockedQueue()},e.prototype.isImageUrlRelative=function(e){return!/^(https?|file):\/\/\/?/i.test(e)},e.prototype.addItemToQueue=function(e,t,i){var r;return t||i?(t=t||function(){},i=i||function(){}):r=new Promise((function(e,r){t=e,i=r})),this.queue.push({imageUrl:e,resolve:t,reject:i}),this.processQueue(),r},e.prototype.processQueue=function(){return l(this,void 0,void 0,(function(){var e,t,i,r,n,o=this;return p(this,(function(s){switch(s.label){case 0:if(!this.canProcess)return[2];if(this.processing++,e=this.queue.splice(0,1)[0],t=function(){o.processing--,o.processQueue(),void 0===o.currentlyProcessing[e.imageUrl]||o.currentlyInQueue(e.imageUrl)||delete o.currentlyProcessing[e.imageUrl]},i=function(i){e.reject(),o.throwError(i),t()},void 0===this.currentlyProcessing[e.imageUrl])return[3,6];s.label=1;case 1:return s.trys.push([1,4,,5]),[4,this.currentlyProcessing[e.imageUrl]];case 2:return s.sent(),[4,this.getCachedImagePath(e.imageUrl)];case 3:return r=s.sent(),e.resolve(r),t(),[3,5];case 4:return n=s.sent(),i(n),[3,5];case 5:return[2];case 6:return this.currentlyProcessing[e.imageUrl]=l(o,void 0,void 0,(function(){var r,n,o,s,c,a;return p(this,(function(h){switch(h.label){case 0:this.canProcess&&this.processQueue(),r=this.getFileCacheDirectory()+this.config.cacheDirectoryName+"/",n=this.createFileName(e.imageUrl),h.label=1;case 1:return h.trys.push([1,6,,7]),[4,this.http.get(e.imageUrl,{responseType:"blob",headers:this.config.httpHeaders}).toPromise()];case 2:return o=h.sent(),[4,this.file.writeFile(r,n,o,{replace:!0})];case 3:return s=h.sent(),this.isCacheSpaceExceeded&&this.maintainCacheSize(),[4,this.addFileToIndex(s)];case 4:return h.sent(),[4,this.getCachedImagePath(e.imageUrl)];case 5:return c=h.sent(),e.resolve(c),t(),this.maintainCacheSize(),[3,7];case 6:throw a=h.sent(),i(a),a;case 7:return[2]}}))})),[2]}}))}))},e.prototype.currentlyInQueue=function(e){return this.queue.some((function(t){return t.imageUrl===e}))},e.prototype.initCache=function(e){return l(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:this.concurrency=this.config.concurrency,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.createCacheDirectory(e)];case 2:return i.sent(),[4,this.indexCache()];case 3:return i.sent(),this.isCacheReady=!0,[3,5];case 4:return t=i.sent(),this.throwError(t),[3,5];case 5:return this.isInit=!0,this.initPromiseResolve(),[2]}}))}))},e.prototype.addFileToIndex=function(e){return l(this,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:return[4,new Promise((function(t,i){return e.getMetadata(t,i)}))];case 1:return t=i.sent(),this.config.maxCacheAge>-1&&Date.now()-t.modificationTime.getTime()>this.config.maxCacheAge?[2,this.removeFile(e.name)]:(this.currentCacheSize+=t.size,this.cacheIndex.push({name:e.name,modificationTime:t.modificationTime,size:t.size}),[2])}}))}))},e.prototype.indexCache=function(){return l(this,void 0,void 0,(function(){var e,t;return p(this,(function(i){switch(i.label){case 0:this.cacheIndex=[],i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.file.listDir(this.getFileCacheDirectory(),this.config.cacheDirectoryName)];case 2:return e=i.sent(),[4,Promise.all(e.map(this.addFileToIndex.bind(this)))];case 3:return i.sent(),this.cacheIndex=this.cacheIndex.sort((function(e,t){return e>t?-1:e<t?1:0})),this.indexed=!0,[3,5];case 4:return t=i.sent(),this.throwError(t),[3,5];case 5:return[2]}}))}))},e.prototype.maintainCacheSize=function(){return l(this,void 0,void 0,(function(){var e,t=this;return p(this,(function(i){return this.config.maxCacheSize>-1&&this.indexed?[2,(e=function(){return l(t,void 0,void 0,(function(){var t;return p(this,(function(i){switch(i.label){case 0:if(!(this.currentCacheSize>this.config.maxCacheSize))return[3,5];if(void 0===(t=this.cacheIndex.splice(0,1)[0]))return[2,e()];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.removeFile(t.name)];case 2:return i.sent(),[3,4];case 3:return i.sent(),[3,4];case 4:return this.currentCacheSize-=t.size,[2,e()];case 5:return[2]}}))}))})()]:[2]}))}))},e.prototype.removeFile=function(e){return l(this,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return[4,this.file.removeFile(this.getFileCacheDirectory()+this.config.cacheDirectoryName,e)];case 1:if(t.sent(),this.isWKWebView&&!this.isIonicWKWebView)try{return[2,this.file.removeFile(this.file.tempDirectory+this.config.cacheDirectoryName,e)]}catch(e){}return[2]}}))}))},e.prototype.getCachedImagePath=function(e){return l(this,void 0,void 0,(function(){var t,i,r,n,o;return p(this,(function(s){switch(s.label){case 0:return[4,this.ready()];case 1:if(s.sent(),!this.isCacheReady)throw new Error("Cache is not ready");if(this.isDevServer)return[2,e];t=this.createFileName(e),i=this.getFileCacheDirectory()+this.config.cacheDirectoryName,r=this.file.tempDirectory+this.config.cacheDirectoryName,s.label=2;case 2:return s.trys.push([2,12,,13]),[4,this.file.resolveLocalFilesystemUrl(i+"/"+t)];case 3:return n=s.sent(),"base64"!==this.config.imageReturnType?[3,5]:[4,this.file.readAsDataURL(i,t)];case 4:return[2,s.sent().replace("data:null","data:*/*")];case 5:if("uri"!==this.config.imageReturnType)return[2];s.label=6;case 6:if(this.isIonicWKWebView)return[2,this.normalizeUrl(n)];if(!this.isWKWebView)return[2,n.nativeURL];s.label=7;case 7:return s.trys.push([7,9,,11]),[4,this.file.resolveLocalFilesystemUrl(r+"/"+t)];case 8:return o=s.sent(),[2,this.normalizeUrl(o)];case 9:return s.sent(),[4,this.file.copyFile(i,t,r,t)];case 10:return o=s.sent(),[2,this.normalizeUrl(o)];case 11:return[3,13];case 12:throw s.sent(),new Error("File does not exist");case 13:return[2]}}))}))},e.prototype.normalizeUrl=function(e){return Ionic&&"function"==typeof Ionic.normalizeURL?Ionic.normalizeURL(e.nativeURL):this.webview?this.webview.convertFileSrc(e.nativeURL):e.nativeURL},e.prototype.throwError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.debugMode&&(e.unshift("ImageLoader Error: "),console.error.apply(console,e))},e.prototype.throwWarning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.debugMode&&(e.unshift("ImageLoader Warning: "),console.warn.apply(console,e))},e.prototype.cacheDirectoryExists=function(e){return this.file.checkDir(e,this.config.cacheDirectoryName)},e.prototype.createCacheDirectory=function(e){var t,i,r=this;return void 0===e&&(e=!1),t=e?this.file.createDir(this.getFileCacheDirectory(),this.config.cacheDirectoryName,e):this.cacheDirectoryExists(this.getFileCacheDirectory()).catch((function(){return r.file.createDir(r.getFileCacheDirectory(),r.config.cacheDirectoryName,!1)})),i=this.isWKWebView&&!this.isIonicWKWebView?e?this.file.createDir(this.file.tempDirectory,this.config.cacheDirectoryName,e):this.cacheDirectoryExists(this.file.tempDirectory).catch((function(){return r.file.createDir(r.file.tempDirectory,r.config.cacheDirectoryName,!1)})):Promise.resolve(),Promise.all([t,i])},e.prototype.createFileName=function(e){return this.hashString(e).toString()+(this.config.fileNameCachedWithExtension?this.getExtensionFromUrl(e):"")},e.prototype.hashString=function(e){var t=0;if(0===e.length)return t;for(var i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t&=t;return t},e.prototype.getExtensionFromUrl=function(e){var t=e.split(/\#|\?/)[0],i=(t.substr(1+(~-t.lastIndexOf(".")>>>0))||"").toLowerCase();return d.indexOf(i)>=0?i:this.config.fallbackFileNameCachedExtension},e.decorators=[{type:i.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:f},{type:r.File},{type:t.HttpClient},{type:o.Platform},{type:n.WebView}]},e.ngInjectableDef=i.ɵɵdefineInjectable({factory:function(){return new e(i.ɵɵinject(f),i.ɵɵinject(a.File),i.ɵɵinject(t.HttpClient),i.ɵɵinject(o.Platform),i.ɵɵinject(h.WebView))},token:e,providedIn:"root"}),e}();var m={display:"display",height:"height",width:"width",backgroundSize:"background-size",backgroundRepeat:"background-repeat"};var y=function(){function e(e,t,r,n){this._element=e,this.renderer=t,this.imageLoader=r,this.config=n,this.fallbackUrl=this.config.fallbackUrl,this.spinner=this.config.spinnerEnabled,this.fallbackAsPlaceholder=this.config.fallbackAsPlaceholder,this.imgAttributes=[],this.cache=!0,this.width=this.config.width,this.height=this.config.height,this.display=this.config.display,this.backgroundSize=this.config.backgroundSize,this.backgroundRepeat=this.config.backgroundRepeat,this.spinnerName=this.config.spinnerName,this.spinnerColor=this.config.spinnerColor,this.load=new i.EventEmitter,this.isLoading=!0,this._useImg=this.config.useImg}return Object.defineProperty(e.prototype,"useImg",{set:function(e){this._useImg=!1!==e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"noCache",{set:function(e){this.cache=!1!==e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"src",{get:function(){return this._src},set:function(e){this._src=this.processImageUrl(e),this.updateImage(this._src)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.fallbackAsPlaceholder&&this.fallbackUrl&&this.setImage(this.fallbackUrl,!1),this.src||(!this.fallbackAsPlaceholder&&this.fallbackUrl?this.setImage(this.fallbackUrl):this.isLoading=!1)},e.prototype.updateImage=function(e){var t=this;this.imageLoader.getImagePath(e).then((function(e){return t.setImage(e)})).catch((function(i){return t.setImage(t.fallbackUrl||e)}))},e.prototype.processImageUrl=function(e){return!1===this.cache&&(e.indexOf("?")<0?e+="?":e+="&",e+="cache_buster="+Date.now()),e},e.prototype.setImage=function(e,t){var i=this;if(void 0===t&&(t=!0),this.isLoading=!t,this._useImg)this.element||(this.element=this.renderer.createElement("img"),this.renderer.appendChild(this._element.nativeElement,this.element)),this.renderer.setAttribute(this.element,"src",e),this.imgAttributes.forEach((function(e){i.renderer.setAttribute(i.element,e.element,e.value)})),this.fallbackUrl&&!this.imageLoader.nativeAvailable&&this.renderer.listen(this.element,"error",(function(){return i.renderer.setAttribute(i.element,"src",i.fallbackUrl)}));else{for(var r in this.element=this._element.nativeElement,m)this[r]&&this.renderer.setStyle(this.element,m[r],this[r]);this.renderer.setStyle(this.element,"background-image",'url("'+(e||this.fallbackUrl)+'")')}t&&this.load.emit(this)},e.decorators=[{type:i.Component,args:[{selector:"img-loader",template:'\n <ion-spinner\n *ngIf="spinner && isLoading && !fallbackAsPlaceholder"\n [name]="spinnerName"\n [color]="spinnerColor"\n ></ion-spinner>\n <ng-content></ng-content>\n ',styles:["ion-spinner { float: none; margin-left: auto; margin-right: auto; display: block; }"]}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:i.Renderer2},{type:g},{type:f}]},e.propDecorators={fallbackUrl:[{type:i.Input}],spinner:[{type:i.Input}],fallbackAsPlaceholder:[{type:i.Input}],imgAttributes:[{type:i.Input}],cache:[{type:i.Input}],width:[{type:i.Input}],height:[{type:i.Input}],display:[{type:i.Input}],backgroundSize:[{type:i.Input}],backgroundRepeat:[{type:i.Input}],spinnerName:[{type:i.Input}],spinnerColor:[{type:i.Input}],load:[{type:i.Output}],useImg:[{type:i.Input}],noCache:[{type:i.Input}],src:[{type:i.Input}]},e}();var b=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{imports:[o.IonicModule,t.HttpClientModule,u.CommonModule],declarations:[y],exports:[y],providers:[r.File,f,g]}]}],e}();e.ImageLoaderConfigService=f,e.ImageLoaderService=g,e.IonicImageLoaderComponent=y,e.IonicImageLoaderModule=b,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ionic-image-loader-v5.umd.min.js.map