{"version":3,"sources":["../src/index.js"],"names":["BMP","scan","MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;AAAA,OAAOA,GAAP,MAAgB,QAAhB;AACA,SAASC,IAAT,QAAqB,aAArB;AAEA,IAAMC,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAOJ,IAAI,CAACI,KAAD,EAAQ,CAAR,EAAW,CAAX,EAAcA,KAAK,CAACC,MAAN,CAAaC,KAA3B,EAAkCF,KAAK,CAACC,MAAN,CAAaE,MAA/C,EAAuD,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAZ;AACA,QAAMG,KAAK,GAAG,KAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AACA,QAAMI,IAAI,GAAG,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAb;AACA,QAAMK,KAAK,GAAG,KAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAd;AAEA,SAAKL,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BK,KAA9B;AACA,SAAKV,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BI,IAA9B;AACA,SAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BG,KAA9B;AACA,SAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BC,GAA9B;AACD,GAdU,CAAJ,CAcJN,MAdH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,EAA0BQ,IAA9B;AAAA,CAApB;;AAEA,gBAAe;AAAA;;AAAA,SAAO;AACpBQ,IAAAA,IAAI,sBAAKnB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBoB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAErB,SADD;AAETsB,MAAAA,aAAa,EAAErB;AAFN,KAHS;AAQpBsB,IAAAA,QAAQ,8CACLvB,SADK,EACOiB,MADP,8BAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBO,IAAAA,QAAQ,8CACLxB,SADK,EACOkB,MADP,8BAELjB,gBAFK,EAEciB,MAFd;AAbY,GAAP;AAAA,CAAf","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"}