{"version":3,"sources":["webpack:///./node_modules/@ionic/core/dist/esm-es5/ion-img.entry.js"],"names":["Img","hostRef","_this","this","onLoad","ionImgDidLoad","emit","onError","ionError","ionImgWillLoad","prototype","srcChanged","addIO","componentDidLoad","undefined","src","window","removeIO","io","IntersectionObserver","data","isIntersecting","load","observe","el","setTimeout","loadError","loadSrc","disconnect","render","class","decoding","alt","Object","defineProperty","get","enumerable","configurable"],"mappings":"gHAAA,+DAEIA,GAFJ,UAEyB,WACrB,SAASA,EAAIC,GACT,IAAIC,EAAQC,KACZ,eAAiBA,KAAMF,GACvBE,KAAKC,OAAS,WACVF,EAAMG,cAAcC,QAExBH,KAAKI,QAAU,WACXL,EAAMM,SAASF,QAEnBH,KAAKM,eAAiB,eAAYN,KAAM,iBAAkB,GAC1DA,KAAKE,cAAgB,eAAYF,KAAM,gBAAiB,GACxDA,KAAKK,SAAW,eAAYL,KAAM,WAAY,GAgElD,OA9DAH,EAAIU,UAAUC,WAAa,WACvBR,KAAKS,SAETZ,EAAIU,UAAUG,iBAAmB,WAC7BV,KAAKS,SAETZ,EAAIU,UAAUE,MAAQ,WAClB,IAAIV,EAAQC,UACKW,IAAbX,KAAKY,MAGL,yBAA0BC,QAC1Bb,KAAKc,WACLd,KAAKe,GAAK,IAAIC,sBAAqB,SAAUC,GAIrCA,EAAK,GAAGC,iBACRnB,EAAMoB,OACNpB,EAAMe,eAGdd,KAAKe,GAAGK,QAAQpB,KAAKqB,KAIrBC,YAAW,WAAc,OAAOvB,EAAMoB,SAAW,OAGzDtB,EAAIU,UAAUY,KAAO,WACjBnB,KAAKuB,UAAYvB,KAAKI,QACtBJ,KAAKwB,QAAUxB,KAAKY,IACpBZ,KAAKM,eAAeH,QAExBN,EAAIU,UAAUO,SAAW,WACjBd,KAAKe,KACLf,KAAKe,GAAGU,aACRzB,KAAKe,QAAKJ,IAGlBd,EAAIU,UAAUmB,OAAS,WACnB,OAAQ,cAAD,CAAG,OAAM,CAAEC,MAAO,eAAW3B,OAAS,eAAE,MAAO,CAAE4B,SAAU,QAAShB,IAAKZ,KAAKwB,QAASK,IAAK7B,KAAK6B,IAAK5B,OAAQD,KAAKC,OAAQG,QAASJ,KAAKuB,cAEpJO,OAAOC,eAAelC,EAAIU,UAAW,KAAM,CACvCyB,IAAK,WAAc,OAAO,eAAWhC,OACrCiC,YAAY,EACZC,cAAc,IAElBJ,OAAOC,eAAelC,EAAK,WAAY,CACnCmC,IAAK,WACD,MAAO,CACH,IAAO,CAAC,gBAGhBC,YAAY,EACZC,cAAc,IAElBJ,OAAOC,eAAelC,EAAK,QAAS,CAChCmC,IAAK,WAAc,MAAO,kMAC1BC,YAAY,EACZC,cAAc,IAEXrC,EA5Ea","file":"js/chunk-2d0e5812.47070a9a.js","sourcesContent":["import { r as registerInstance, d as createEvent, h, c as getIonMode, H as Host, e as getElement } from './core-feeeff0d.js';\nimport './config-3c7f3790.js';\nvar Img = /** @class */ (function () {\n function Img(hostRef) {\n var _this = this;\n registerInstance(this, hostRef);\n this.onLoad = function () {\n _this.ionImgDidLoad.emit();\n };\n this.onError = function () {\n _this.ionError.emit();\n };\n this.ionImgWillLoad = createEvent(this, \"ionImgWillLoad\", 7);\n this.ionImgDidLoad = createEvent(this, \"ionImgDidLoad\", 7);\n this.ionError = createEvent(this, \"ionError\", 7);\n }\n Img.prototype.srcChanged = function () {\n this.addIO();\n };\n Img.prototype.componentDidLoad = function () {\n this.addIO();\n };\n Img.prototype.addIO = function () {\n var _this = this;\n if (this.src === undefined) {\n return;\n }\n if ('IntersectionObserver' in window) {\n this.removeIO();\n this.io = new IntersectionObserver(function (data) {\n // because there will only ever be one instance\n // of the element we are observing\n // we can just use data[0]\n if (data[0].isIntersecting) {\n _this.load();\n _this.removeIO();\n }\n });\n this.io.observe(this.el);\n }\n else {\n // fall back to setTimeout for Safari and IE\n setTimeout(function () { return _this.load(); }, 200);\n }\n };\n Img.prototype.load = function () {\n this.loadError = this.onError;\n this.loadSrc = this.src;\n this.ionImgWillLoad.emit();\n };\n Img.prototype.removeIO = function () {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n };\n Img.prototype.render = function () {\n return (h(Host, { class: getIonMode(this) }, h(\"img\", { decoding: \"async\", src: this.loadSrc, alt: this.alt, onLoad: this.onLoad, onError: this.loadError })));\n };\n Object.defineProperty(Img.prototype, \"el\", {\n get: function () { return getElement(this); },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Img, \"watchers\", {\n get: function () {\n return {\n \"src\": [\"srcChanged\"]\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Img, \"style\", {\n get: function () { return \":host{-o-object-fit:contain;object-fit:contain}:host,img{display:block}img{width:100%;height:100%;-o-object-fit:inherit;object-fit:inherit;-o-object-position:inherit;object-position:inherit}\"; },\n enumerable: true,\n configurable: true\n });\n return Img;\n}());\nexport { Img as ion_img };\n"],"sourceRoot":""}