forked from mozilla-b2g/exif-parser
-
Notifications
You must be signed in to change notification settings - Fork 3
/
jpeg.min.js
2 lines (2 loc) · 32.3 KB
/
jpeg.min.js
1
2
"use strict";var BlobView=function(){function a(a){throw Error(a)}function b(a,b,c,d,e,f,g){this.blob=a,this.sliceOffset=b,this.sliceLength=c,this.slice=d,this.viewOffset=e,this.viewLength=f,this.littleEndian=g,this.view=new DataView(d,e,f),this.buffer=d,this.byteLength=f,this.byteOffset=e,this.index=0}return b.get=function(c,d,e,f,g){0>d&&a("negative offset"),0>e&&a("negative length"),d>c.size&&a("offset larger than blob size"),d+e>c.size&&(e=c.size-d);var h=c.slice(d,d+e),i=new FileReader;i.readAsArrayBuffer(h),i.onloadend=function(){var a=null;i.result&&(a=new b(c,d,e,i.result,0,e,g||!1)),f(a,i.error)}},b.prototype={constructor:b,getMore:function(a,c,d){a>=this.sliceOffset&&a+c<=this.sliceOffset+this.sliceLength?d(new b(this.blob,this.sliceOffset,this.sliceLength,this.slice,a-this.sliceOffset,c,this.littleEndian)):b.get(this.blob,a,c,d,this.littleEndian)},littleEndian:function(){this.littleEndian=!0},bigEndian:function(){this.littleEndian=!1},getUint8:function(a){return this.view.getUint8(a)},getInt8:function(a){return this.view.getInt8(a)},getUint16:function(a,b){return this.view.getUint16(a,void 0!==b?b:this.littleEndian)},getInt16:function(a,b){return this.view.getInt16(a,void 0!==b?b:this.littleEndian)},getUint32:function(a,b){return this.view.getUint32(a,void 0!==b?b:this.littleEndian)},getInt32:function(a,b){return this.view.getInt32(a,void 0!==b?b:this.littleEndian)},getFloat32:function(a,b){return this.view.getFloat32(a,void 0!==b?b:this.littleEndian)},getFloat64:function(a,b){return this.view.getFloat64(a,void 0!==b?b:this.littleEndian)},setUint8:function(a,b){return this.view.setUint8(a,b)},setInt8:function(a,b){return this.view.setInt8(a,b)},setUint16:function(a,b,c){return this.view.setUint16(a,b,void 0!==c?c:this.littleEndian)},setInt16:function(a,b,c){return this.view.setInt16(a,b,void 0!==c?c:this.littleEndian)},setUint32:function(a,b,c){return this.view.setUint32(a,b,void 0!==c?c:this.littleEndian)},setInt32:function(a,b,c){return this.view.setInt32(a,b,void 0!==c?c:this.littleEndian)},setFloat32:function(a,b,c){return this.view.setFloat32(a,b,void 0!==c?c:this.littleEndian)},setFloat64:function(a,b,c){return this.view.setFloat64(a,b,void 0!==c?c:this.littleEndian)},readByte:function(){return this.view.getInt8(this.index++)},readUnsignedByte:function(){return this.view.getUint8(this.index++)},readShort:function(a){var b=this.view.getInt16(this.index,void 0!==a?a:this.littleEndian);return this.index+=2,b},readUnsignedShort:function(a){var b=this.view.getUint16(this.index,void 0!==a?a:this.littleEndian);return this.index+=2,b},readInt:function(a){var b=this.view.getInt32(this.index,void 0!==a?a:this.littleEndian);return this.index+=4,b},readUnsignedInt:function(a){var b=this.view.getUint32(this.index,void 0!==a?a:this.littleEndian);return this.index+=4,b},readFloat:function(a){var b=this.view.getFloat32(this.index,void 0!==a?a:this.littleEndian);return this.index+=4,b},readDouble:function(a){var b=this.view.getFloat64(this.index,void 0!==a?a:this.littleEndian);return this.index+=8,b},tell:function(){return this.index},seek:function(b){0>b&&a("negative index"),b>=this.byteLength&&a("index greater than buffer size"),this.index=b},advance:function(b){var c=this.index+b;0>c&&a("advance past beginning of buffer"),c>this.byteLength&&a("advance past end of buffer"),this.index=c},getUnsignedByteArray:function(a,b){return new Uint8Array(this.buffer,a+this.viewOffset,b)},readUnsignedByteArray:function(a){var b=new Uint8Array(this.buffer,this.index+this.viewOffset,a);return this.index+=a,b},getBit:function(a,b){var c=this.view.getUint8(a);return 0!==(c&1<<b)},getUint24:function(a,b){var c,d,e;return(void 0!==b?b:this.littleEndian)?(c=this.view.getUint8(a),d=this.view.getUint8(a+1),e=this.view.getUint8(a+2)):(e=this.view.getUint8(a),d=this.view.getUint8(a+1),c=this.view.getUint8(a+2)),(e<<16)+(d<<8)+c},readUint24:function(a){var b=this.getUint24(this.index,a);return this.index+=3,b},getASCIIText:function(a,b){var c=new Uint8Array(this.buffer,a+this.viewOffset,b);return String.fromCharCode.apply(String,c)},getNullTerminatedASCIIString:function(a){for(var b,c="";a<this.sliceLength&&(b=this.view.getUint8(a),0!==b);)c+=String.fromCharCode(b),a++;return c},readASCIIText:function(a){var b=new Uint8Array(this.buffer,this.index+this.viewOffset,a);return this.index+=a,String.fromCharCode.apply(String,b)},getUTF8Text:function(a,b){function c(){throw new Error("Illegal UTF-8")}for(var d,e,f,g,h,i=a,j=a+b,k="";j>i;){var e=this.view.getUint8(i);128>e?(k+=String.fromCharCode(e),i+=1):194>e?c():224>e?(i+1>=j&&c(),f=this.view.getUint8(i+1),(128>f||f>191)&&c(),d=((31&e)<<6)+(63&f),k+=String.fromCharCode(d),i+=2):240>e?(i+3>=j&&c(),f=this.view.getUint8(i+1),(128>f||f>191)&&c(),g=this.view.getUint8(i+2),(128>g||g>191)&&c(),d=((15&e)<<12)+((63&f)<<6)+(63&g),k+=String.fromCharCode(d),i+=3):245>e?(i+3>=j&&c(),f=this.view.getUint8(i+1),(128>f||f>191)&&c(),g=this.view.getUint8(i+2),(128>g||g>191)&&c(),h=this.view.getUint8(i+3),(128>h||h>191)&&c(),d=((7&e)<<18)+((63&f)<<12)+((63&g)<<6)+(63&h),d-=65536,k+=String.fromCharCode(55296+((1047552&d)>>>10)),k+=String.fromCharCode(56320+(1023&d)),i+=4):c()}return k},readUTF8Text:function(a){try{return this.getUTF8Text(this.index,a)}finally{this.index+=a}},getID3Uint28BE:function(a){var b=127&this.view.getUint8(a),c=127&this.view.getUint8(a+1),d=127&this.view.getUint8(a+2),e=127&this.view.getUint8(a+3);return b<<21|c<<14|d<<7|e},readID3Uint28BE:function(){var a=this.getID3Uint28BE(this.index);return this.index+=4,a},readNullTerminatedLatin1Text:function(a){for(var b="",c=0;a>c;c++){var d=this.view.getUint8(this.index+c);if(0===d){c++;break}b+=String.fromCharCode(d)}return this.index+=c,b},readNullTerminatedUTF8Text:function(a){for(var b=0;a>b&&0!==this.view.getUint8(this.index+b);b++);var c=this.readUTF8Text(b);return a>b&&this.advance(1),c},readNullTerminatedUTF16Text:function(a,b){if(null==b){var c=this.readUnsignedShort();a-=2,b=65279===c?!1:!0}for(var d="",e=0;a>e;e+=2){var f=this.getUint16(this.index+e,b);if(0===f){e+=2;break}d+=String.fromCharCode(f)}return this.index+=e,d}},{get:b.get}}();(function(){var a={1:1,3:2,4:4,5:8,6:1,7:1,8:2,9:4,10:8,11:4,12:8},b={1:{IFD:4,key:"InteroperabilityIndex",type:2},2:{IFD:4,key:"InteroperabilityVersion",type:7},4096:{IFD:4,key:"RelatedImageFileFormat",type:2},4097:{IFD:4,key:"RelatedImageWidth",type:4},4098:{IFD:4,key:"RelatedImageLength",type:4}},c={0:{IFD:3,key:"GPSVersionID",type:1},1:{IFD:3,key:"GPSLatitudeRef",type:2},2:{IFD:3,key:"GPSLatitude",type:5},3:{IFD:3,key:"GPSLongitudeRef",type:2},4:{IFD:3,key:"GPSLongitude",type:5},5:{IFD:3,key:"GPSAltitudeRef",type:1},6:{IFD:3,key:"GPSAltitude",type:5},7:{IFD:3,key:"GPSTimeStamp",type:5},8:{IFD:3,key:"GPSSatellites",type:2},9:{IFD:3,key:"GPSStatus",type:2},10:{IFD:3,key:"GPSMeasureMode",type:2},11:{IFD:3,key:"GPSDOP",type:5},12:{IFD:3,key:"GPSSpeedRef",type:2},13:{IFD:3,key:"GPSSpeed",type:5},14:{IFD:3,key:"GPSTrackRef",type:2},15:{IFD:3,key:"GPSTrack",type:5},16:{IFD:3,key:"GPSImgDirectionRef",type:2},17:{IFD:3,key:"GPSImgDirection",type:5},18:{IFD:3,key:"GPSMapDatum",type:2},19:{IFD:3,key:"GPSDestLatitudeRef",type:2},20:{IFD:3,key:"GPSDestLatitude",type:5},21:{IFD:3,key:"GPSDestLONGitudeRef",type:2},22:{IFD:3,key:"GPSDestLONGitude",type:5},23:{IFD:3,key:"GPSDestBearingRef",type:2},24:{IFD:3,key:"GPSDestBearing",type:5},25:{IFD:3,key:"GPSDestDistanceRef",type:2},26:{IFD:3,key:"GPSDestDistance",type:5},27:{IFD:3,key:"GPSProcessingMethod",type:7},28:{IFD:3,key:"GPSAreaInformation",type:7},29:{IFD:3,key:"GPSDateStamp",type:2},30:{IFD:3,key:"GPSDifferential",type:3},254:{IFD:1,key:"NewSubfileType",type:4},255:{IFD:1,key:"SubfileType",type:3},256:{IFD:1,key:"ImageWidth",type:4},257:{"":1,key:"ImageLength",type:4},258:{IFD:1,key:"BitsPerSample",type:3},259:{IFD:1,key:"Compression",type:3},262:{IFD:1,key:"PhotometricInterpretation",type:3},263:{IFD:1,key:"Threshholding",type:3},264:{IFD:1,key:"CellWidth",type:3},265:{IFD:1,key:"CellLength",type:3},266:{IFD:1,key:"FillOrder",type:3},269:{IFD:1,key:"DocumentName",type:2},270:{IFD:1,key:"ImageDescription",type:2},271:{IFD:1,key:"Make",type:2},272:{IFD:1,key:"Model",type:2},273:{IFD:1,key:"StripOffsets",type:4},274:{IFD:1,key:"Orientation",type:3},277:{IFD:1,key:"SamplesPerPixel",type:3},278:{IFD:1,key:"RowsPerStrip",type:4},279:{IFD:1,key:"StripByteCounts",type:4},282:{IFD:1,key:"XResolution",type:5},283:{IFD:1,key:"YResolution",type:5},284:{IFD:1,key:"PlanarConfiguration",type:3},290:{IFD:1,key:"GrayResponseUnit",type:3},291:{IFD:1,key:"GrayResponseCurve",type:3},292:{IFD:1,key:"T4Options",type:4},293:{IFD:1,key:"T6Options",type:4},296:{IFD:1,key:"ResolutionUnit",type:3},301:{IFD:1,key:"TransferFunction",type:3},305:{IFD:1,key:"Software",type:2},306:{IFD:1,key:"DateTime",type:2},315:{IFD:1,key:"Artist",type:2},316:{IFD:1,key:"HostComputer",type:2},317:{IFD:1,key:"Predictor",type:3},318:{IFD:1,key:"WhitePoint",type:5},319:{IFD:1,key:"PrimaryChromaticities",type:5},320:{IFD:1,key:"ColorMap",type:3},321:{IFD:1,key:"HalftoneHints",type:3},322:{IFD:1,key:"TileWidth",type:3},323:{IFD:1,key:"TileLength",type:3},324:{IFD:1,key:"TileOffsets",type:3},325:{IFD:1,key:"TileByteCounts",type:3},330:{IFD:1,key:"SubIFDs",type:4},332:{IFD:1,key:"InkSet",type:3},333:{IFD:1,key:"InkNames",type:2},334:{IFD:1,key:"NumberOfInks",type:3},336:{IFD:1,key:"DotRange",type:1},337:{IFD:1,key:"TargetPrinter",type:2},338:{IFD:1,key:"ExtraSamples",type:3},339:{IFD:1,key:"SampleFormat",type:3},340:{IFD:1,key:"SMinSampleValue",type:3},341:{IFD:1,key:"SMaxSampleValue",type:3},342:{IFD:1,key:"TransferRange",type:3},343:{IFD:1,key:"ClipPath",type:1},344:{IFD:1,key:"XClipPathUnits",type:8},345:{IFD:1,key:"YClipPathUnits",type:8},346:{IFD:1,key:"Indexed",type:3},347:{IFD:1,key:"JPEGTables",type:7},351:{IFD:1,key:"OPIProxy",type:3},512:{IFD:1,key:"JPEGProc",type:4},513:{IFD:1,key:"JPEGInterchangeFormat",type:4},514:{IFD:1,key:"JPEGInterchangeFormatLength",type:4},515:{IFD:1,key:"JPEGRestartInterval",type:3},517:{IFD:1,key:"JPEGLosslessPredictors",type:3},518:{IFD:1,key:"JPEGPointTransforms",type:3},519:{IFD:1,key:"JPEGQTables",type:4},520:{IFD:1,key:"JPEGDCTables",type:4},521:{IFD:1,key:"JPEGACTables",type:4},529:{IFD:1,key:"YCbCrCoefficients",type:5},530:{IFD:1,key:"YCbCrSubSampling",type:3},531:{IFD:1,key:"YCbCrPositioning",type:3},532:{IFD:1,key:"ReferenceBlackWhite",type:5},700:{IFD:1,key:"XMLPacket",type:1},18246:{IFD:1,key:"Rating",type:3},18249:{IFD:1,key:"RatingPercent",type:3},32781:{IFD:1,key:"ImageID",type:2},33421:{IFD:1,key:"CFARepeatPatternDim",type:3},33422:{IFD:1,key:"CFAPattern",type:1},33423:{IFD:1,key:"BatteryLevel",type:5},33432:{IFD:1,key:"Copyright",type:2},33434:{IFD:2,key:"ExposureTime",type:5},33437:{IFD:2,key:"FNumber",type:5},33723:{IFD:1,key:"IPTCNAA",type:4},34377:{IFD:1,key:"ImageResources",type:1},34665:{IFD:1,key:"ExifTag",type:4},34675:{IFD:1,key:"InterColorProfile",type:7},34850:{IFD:2,key:"ExposureProgram",type:3},34852:{IFD:2,key:"SpectralSensitivity",type:2},34853:{IFD:1,key:"GPSTag",type:4},34855:{IFD:2,key:"ISOSpeedRatings",type:3},34856:{IFD:2,key:"OECF",type:7},34857:{IFD:1,key:"Interlace",type:3},34858:{IFD:1,key:"TimeZoneOffset",type:8},34859:{IFD:1,key:"SelfTimerMode",type:3},34864:{IFD:2,key:"SensitivityType",type:3},34865:{IFD:2,key:"StandardOutputSensitivity",type:4},34866:{IFD:2,key:"RecommendedExposureIndex",type:4},34867:{IFD:2,key:"ISOSpeed",type:4},34868:{IFD:2,key:"ISOSpeedLatitudeyyy",type:4},34869:{IFD:2,key:"ISOSpeedLatitudezzz",type:4},36864:{IFD:2,key:"ExifVersion",type:7},36867:{IFD:2,key:"DateTimeOriginal",type:2},36868:{IFD:2,key:"DateTimeDigitized",type:2},37121:{IFD:2,key:"ComponentsConfiguration",type:7},37122:{IFD:2,key:"CompressedBitsPerPixel",type:5},37377:{IFD:2,key:"ShutterSpeedValue",type:10},37378:{IFD:2,key:"ApertureValue",type:5},37379:{IFD:2,key:"BrightnessValue",type:10},37380:{IFD:2,key:"ExposureBiasValue",type:10},37381:{IFD:2,key:"MaxApertureValue",type:5},37382:{IFD:2,key:"SubjectDistance",type:5},37383:{IFD:2,key:"MeteringMode",type:3},37384:{IFD:2,key:"LightSource",type:3},37385:{IFD:2,key:"Flash",type:3},37386:{IFD:2,key:"FocalLength",type:5},37387:{IFD:1,key:"FlashEnergy",type:5},37388:{IFD:1,key:"SpatialFrequencyResponse",type:7},37389:{IFD:1,key:"Noise",type:7},37390:{IFD:1,key:"FocalPlaneXResolution",type:5},37391:{IFD:1,key:"FocalPlaneYResolution",type:5},37392:{IFD:1,key:"FocalPlaneResolutionUnit",type:3},37393:{IFD:1,key:"ImageNumber",type:4},37394:{IFD:1,key:"SecurityClassification",type:2},37395:{IFD:1,key:"ImageHistory",type:2},37396:{IFD:2,key:"SubjectArea",type:3},37397:{IFD:1,key:"ExposureIndex",type:5},37398:{IFD:1,key:"TIFFEPStandardID",type:1},37399:{IFD:1,key:"SensingMethod",type:3},37500:{IFD:2,key:"MakerNote",type:7},37510:{IFD:2,key:"UserComment",type:2},37520:{IFD:2,key:"SubSecTime",type:2},37521:{IFD:2,key:"SubSecTimeOriginal",type:2},37522:{IFD:2,key:"SubSecTimeDigitized",type:2},40091:{IFD:1,key:"XPTitle",type:1},40092:{IFD:1,key:"XPComment",type:1},40093:{IFD:1,key:"XPAuthor",type:1},40094:{IFD:1,key:"XPKeywords",type:1},40095:{IFD:1,key:"XPSubject",type:1},40960:{IFD:2,key:"FlashpixVersion",type:7},40961:{IFD:2,key:"ColorSpace",type:3},40962:{IFD:2,key:"PixelXDimension",type:4},40963:{IFD:2,key:"PixelYDimension",type:4},40964:{IFD:2,key:"RelatedSoundFile",type:2},40965:{IFD:2,key:"InteroperabilityTag",type:4},41483:{IFD:2,key:"FlashEnergy",type:5},41484:{IFD:2,key:"SpatialFrequencyResponse",type:7},41486:{IFD:2,key:"FocalPlaneXResolution",type:5},41487:{IFD:2,key:"FocalPlaneYResolution",type:5},41488:{IFD:2,key:"FocalPlaneResolutionUnit",type:3},41492:{IFD:2,key:"SubjectLocation",type:3},41493:{IFD:2,key:"ExposureIndex",type:5},41495:{IFD:2,key:"SensingMethod",type:3},41728:{IFD:2,key:"FileSource",type:7},41729:{IFD:2,key:"SceneType",type:7},41730:{IFD:2,key:"CFAPattern",type:7},41985:{IFD:2,key:"CustomRendered",type:3},41986:{IFD:2,key:"ExposureMode",type:3},41987:{IFD:2,key:"WhiteBalance",type:3},41988:{IFD:2,key:"DigitalZoomRatio",type:5},41989:{IFD:2,key:"FocalLengthIn35mmFilm",type:3},41990:{IFD:2,key:"SceneCaptureType",type:3},41991:{IFD:2,key:"GainControl",type:3},41992:{IFD:2,key:"Contrast",type:3},41993:{IFD:2,key:"Saturation",type:3},41994:{IFD:2,key:"Sharpness",type:3},41995:{IFD:2,key:"DeviceSettingDescription",type:7},41996:{IFD:2,key:"SubjectDistanceRange",type:3},42016:{IFD:2,key:"ImageUniqueID",type:2},42032:{IFD:2,key:"CameraOwnerName",type:2},42033:{IFD:2,key:"BodySerialNumber",type:2},42034:{IFD:2,key:"LensSpecification",type:5},42035:{IFD:2,key:"LensMake",type:2},42036:{IFD:2,key:"LensModel",type:2},42037:{IFD:2,key:"LensSerialNumber",type:2},50341:{IFD:1,key:"PrintImageMatching",type:7},50706:{IFD:1,key:"DNGVersion",type:1},50707:{IFD:1,key:"DNGBackwardVersion",type:1},50708:{IFD:1,key:"UniqueCameraModel",type:2},50709:{IFD:1,key:"LocalizedCameraModel",type:1},50710:{IFD:1,key:"CFAPlaneColor",type:1},50711:{IFD:1,key:"CFALayout",type:3},50712:{IFD:1,key:"LinearizationTable",type:3},50713:{IFD:1,key:"BlackLevelRepeatDim",type:3},50714:{IFD:1,key:"BlackLevel",type:5},50715:{IFD:1,key:"BlackLevelDeltaH",type:10},50716:{IFD:1,key:"BlackLevelDeltaV",type:10},50717:{IFD:1,key:"WhiteLevel",type:3},50718:{IFD:1,key:"DefaultScale",type:5},50719:{IFD:1,key:"DefaultCropOrigin",type:3},50720:{IFD:1,key:"DefaultCropSize",type:3},50721:{IFD:1,key:"ColorMatrix1",type:10},50722:{IFD:1,key:"ColorMatrix2",type:10},50723:{IFD:1,key:"CameraCalibration1",type:10},50724:{IFD:1,key:"CameraCalibration2",type:10},50725:{IFD:1,key:"ReductionMatrix1",type:10},50726:{IFD:1,key:"ReductionMatrix2",type:10},50727:{IFD:1,key:"AnalogBalance",type:5},50728:{IFD:1,key:"AsShotNeutral",type:3},50729:{IFD:1,key:"AsShotWhiteXY",type:5},50730:{IFD:1,key:"BaselineExposure",type:10},50731:{IFD:1,key:"BaselineNoise",type:5},50732:{IFD:1,key:"BaselineSharpness",type:5},50733:{IFD:1,key:"BayerGreenSplit",type:4},50734:{IFD:1,key:"LinearResponseLimit",type:5},50735:{IFD:1,key:"CameraSerialNumber",type:2},50736:{IFD:1,key:"LensInfo",type:5},50737:{IFD:1,key:"ChromaBlurRadius",type:5},50738:{IFD:1,key:"AntiAliasStrength",type:5},50739:{IFD:1,key:"ShadowScale",type:10},50740:{IFD:1,key:"DNGPrivateData",type:1},50741:{IFD:1,key:"MakerNoteSafety",type:3},50778:{IFD:1,key:"CalibrationIlluminant1",type:3},50779:{IFD:1,key:"CalibrationIlluminant2",type:3},50780:{IFD:1,key:"BestQualityScale",type:5},50781:{IFD:1,key:"RawDataUniqueID",type:1},50827:{IFD:1,key:"OriginalRawFileName",type:1},50828:{IFD:1,key:"OriginalRawFileData",type:7},50829:{IFD:1,key:"ActiveArea",type:3},50830:{IFD:1,key:"MaskedAreas",type:3},50831:{IFD:1,key:"AsShotICCProfile",type:7},50832:{IFD:1,key:"AsShotPreProfileMatrix",type:10},50833:{IFD:1,key:"CurrentICCProfile",type:7},50834:{IFD:1,key:"CurrentPreProfileMatrix",type:10},50879:{IFD:1,key:"ColorimetricReference",type:3},50931:{IFD:1,key:"CameraCalibrationSignature",type:1},50932:{IFD:1,key:"ProfileCalibrationSignature",type:1},50934:{IFD:1,key:"AsShotProfileName",type:1},50935:{IFD:1,key:"NoiseReductionApplied",type:5},50936:{IFD:1,key:"ProfileName",type:1},50937:{IFD:1,key:"ProfileHueSatMapDims",type:4},50938:{IFD:1,key:"ProfileHueSatMapData1",type:11},50939:{IFD:1,key:"ProfileHueSatMapData2",type:11},50940:{IFD:1,key:"ProfileToneCurve",type:11},50941:{IFD:1,key:"ProfileEmbedPolicy",type:4},50942:{IFD:1,key:"ProfileCopyright",type:1},50964:{IFD:1,key:"ForwardMatrix1",type:10},50965:{IFD:1,key:"ForwardMatrix2",type:10},50966:{IFD:1,key:"PreviewApplicationName",type:1},50967:{IFD:1,key:"PreviewApplicationVersion",type:1},50968:{IFD:1,key:"PreviewSettingsName",type:1},50969:{IFD:1,key:"PreviewSettingsDigest",type:1},50970:{IFD:1,key:"PreviewColorSpace",type:4},50971:{IFD:1,key:"PreviewDateTime",type:2},50972:{IFD:1,key:"RawImageDigest",type:7},50973:{IFD:1,key:"OriginalRawFileDigest",type:7},50974:{IFD:1,key:"SubTileBlockSize",type:4},50975:{IFD:1,key:"RowInterleaveFactor",type:4},50981:{IFD:1,key:"ProfileLookTableDims",type:4},50982:{IFD:1,key:"ProfileLookTableData",type:11},51008:{IFD:1,key:"OpcodeList1",type:7},51009:{IFD:1,key:"OpcodeList2",type:7},51022:{IFD:1,key:"OpcodeList3",type:7},51041:{IFD:1,key:"NoiseProfile",type:12}},d={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}},e={1:0,2:0,3:180,4:180,5:90,6:90,7:270,8:270},f=function(a,b){for(var c={1:6,2:5,3:8,4:7,5:4,6:3,7:2,8:1},d={1:8,2:7,3:6,4:5,5:2,6:1,7:4,8:3},e=Math.abs(Math.ceil(b/90)),f=b>0;e>0;)a=f?c[a]:d[a],e--;return a},g=function(a){var b;return Object.keys(c).forEach(function(d){c[d].key===a&&(b=d)}),b};this.exifSpec={rotateImage:f,orientationDegrees:e,tagsStringValues:d,getTagId:g,tags:c,interOperabilityTags:b,tagTypeSize:a}}).call(this),function(){var a={1:"TEM",2:"RES",192:"SOF0",193:"SOF1",194:"SOF2",195:"SOF3",197:"SOF5",198:"SOF6",199:"SOF7",201:"SOF8",202:"SOF10",203:"SOF11",205:"SOF13",206:"SOF14",207:"SOF15",204:"DAC",196:"DHT",208:"RST0",209:"RST1",210:"RST2",211:"RST3",212:"RST4",213:"RST5",214:"RST6",215:"RST7",216:"SOI",217:"EOI",218:"SOS",219:"DQT",220:"DNL",221:"DRI",222:"DHP",223:"EXP",224:"APP0",225:"APP1",226:"APP2",227:"APP3",228:"APP4",229:"APP5",230:"APP6",231:"APP7",232:"APP8",233:"APP9",234:"APP10",235:"APP11",236:"APP12",237:"APP13",238:"APP14",239:"APP15",240:"JPG0",241:"JPG1",242:"JPG2",243:"JPG3",244:"JPG4",245:"JPG5",246:"JPG6",247:"JPG7",248:"JPG8",249:"JPG9",250:"JPG10",251:"JPG11",252:"JPG12",253:"JPG13",254:"COM"},b={JFIF:{segmentType:"APP1",description:"JPEG File Interchange Format"},JFXX:{segmentType:"APP1",description:"JPEG File Interchange Format Extension segment"},Exif:{segmentType:"APP0",description:"Exchangeable image file format"}},c={};c.segmentTypes=a,c.APPSegmentFormats=b,this.jpegSpec=c}.call(this),function(){var a=function(a,b){var c,d={};return d.version=a.getUint8(b+9).toString(),d.version+=".0"+a.getUint8(b+10),d.units=a.getUint8(b+11),d.XDensity=a.getUint16(b+12),d.YDensity=a.getUint16(b+14),d.XThumbnail=a.getUint8(b+16),d.YThumbnail=a.getUint8(b+17),0!==d.XThumbnail&&0!==d.YThumbnail&&(c=a.blob.slice(b+18,3*d.XThumbnail*d.YThumbnail)),{metaData:d,thumbnailBlob:c}};this.JFIF=this.JFIF||{},this.JFIF.readSegment=a}.call(this),function(){var a={segmentMarker:0,APP1Marker:1,APP1Length:2,TIFFHeader:10,TIFFByteOrder:10,TIFFMagicNumber:12,TIFFFirstIFD:14},b=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a},c=function(a,b){for(var c,d="";;){if(c=String.fromCharCode(a.getUint8(b)),"\x00"===c)return d;d+=c,b++}},d=function(a,b,c,d,f){var g,h=0;if(!Array.isArray(d))throw"Error writting array, the value is not an array: "+d;for(g=0;g<d.length;++g)h+=e(a,b+h,c,d[g],f);return h},e=function(a,b,c,e,f){var g;if(Array.isArray(e))g=d(a,b,c,e,f);else switch(c){case 1:a.setUint8(b,e),g=1;break;case 2:g=i(a,b,e);break;case 3:a.setUint16(b,e,f),g=2;break;case 4:a.setUint32(b,e,f),g=4;break;case 6:a.setInt8(b,e),g=1;break;case 7:a.setUint8(b,e),g=1;break;case 8:a.setInt16(b,e,f),g=2;break;case 9:a.setInt32(b,e,f),g=4;break;case 10:case 5:h(a,b,c,e,f),g=8;break;case 11:a.setFloat32(b,e,f),g=4;break;case 12:a.setFloat64(b,e,f),g=8;break;default:throw"Writting Exif Tag Value: Unkown value type: "+valueType}return g},f=function(a,b,d){var e,f;switch(d){case 1:return a.getUint8(b);case 2:return c(a,b);case 3:return a.getUint16(b);case 4:return a.getUint32(b);case 5:return e=a.getUint32(b),f=a.getUint32(b+4),{numerator:e,denominator:f};case 6:return a.getInt8(b);case 7:return a.getUint8(b);case 8:return a.getInt16(b);case 9:return a.getInt32(b);case 10:return e=a.getInt32(b),f=a.getInt32(b+4),{numerator:e,denominator:f};case 11:return a.getFloat32(b);case 12:return a.getFloat64(b);default:throw"Reading Exif Tag Value: Unkown value type: "+d}},g=function(a,b,c,d,e){var g,h=exifSpec.tagTypeSize[d];if(j(d,e)&&(c=b+a.getUint32(c)),1===e||4>=h*e||2===d)return f(a,c,d);g=[];for(var i=0;e>i;++i)g.push(f(a,c,d)),c+=h;return g},h=function(a,b,c,d,e){return 10===c&&(a.setInt32(b,d.numerator,e),a.setInt32(b+4,d.denominator,e)),5===c&&(a.setUint32(b,d.numerator,e),a.setUint32(b+4,d.denominator,e)),8},i=function(a,b,c){var d;for(d=0;d<c.length;++d)a.setUint8(b+d,c.charCodeAt(d));return a.setUint8(b+c.length,0),c.length+1},j=function(a,b){return b>4||5===a||10===a||12===a},k=function(a,b,c){var d=b+c,e=a.getUint16(d);d+=2;var f,h,i,j,k,l;for(e>0&&(h={}),f=0;e>f;++f)i=a.getUint16(d),j=a.getUint16(d+2),k=a.getUint32(d+4),h[i]={type:j,count:k,value:g(a,b,d+8,j,k),valueOffset:d+8},d+=12;return l=a.getUint32(d),{entries:h,nextIFDOffset:l}},l=function(a,b,c,d,f,g,h){var i,j,k=0,l=0,m=c+2;return Object.keys(g).forEach(function(c){var h=exifSpec.getTagId(c),n=exifSpec.tags[h];n&&h&&n.IFD===f&&(a.setUint16(m,h,!1),a.setUint16(m+2,n.type,!1),i=s(c,g[c]),a.setUint32(m+4,i,!1),1===i?e(a,m+8,n.type,g[c],!1):(a.setUint32(m+8,d-b,!1),j=e(a,d,n.type,g[c],!1),d+=j,k+=j),k+=12,m+=12,l++)}),l&&(a.setUint16(c,l,!1),k+=2),1===f&&(k+=4,h?a.setUint32(m,k+8,!1):a.setUint32(m,0,!1)),k},m=function(a){var b,c={};return Object.keys(a).forEach(function(d){return(b=4===a.IFD?interOperabilityTags.tags[d]:exifSpec.tags[d])?(c[b.key]=a[d].value,void 0):(console.log("Error parsing IFD: Tag "+d+" is not valid"),void 0)}),c},n=function(b,c){var d=b.getUint16(c+a.TIFFByteOrder);if(18761!==d&&19789!==d)throw"TIFF Image parser failed: Invalid byte order in EXIF segment";return d},o=function(a){if(18761===a)return!0;if(19789===a)return!1;throw"TIFF Image parser failed: Invalid byte order in EXIF segment"},p=function(b,c){var d=b.getUint16(c+a.TIFFMagicNumber);if(42!==d)throw"TIFF Image parser failed: Wrong magic number in TIFF header";return!0},q=function(b,c){var d,e,f,g,h,i,j,l,m=c+a.TIFFHeader,q=n(b,c);return b.littleEndian=o(q),p(b,c)?(a.firstIFD=b.getUint32(c+a.TIFFFirstIFD),e=k(b,m,a.firstIFD),e.nextIFDOffset&&(f=k(b,m,e.nextIFDOffset)),f&&f.entries[exifSpec.getTagId("JPEGInterchangeFormat")]&&(j=f.entries[exifSpec.getTagId("JPEGInterchangeFormatLength")].value,l=f.entries[exifSpec.getTagId("JPEGInterchangeFormat")].value,d=b.blob.slice(m+l,m+l+j)),e.entries[exifSpec.getTagId("ExifTag")]&&(g=k(b,m,e.entries[exifSpec.getTagId("ExifTag")].value)),e.entries[exifSpec.getTagId("GPSTag")]&&(h=k(b,m,e.entries[exifSpec.getTagId("GPSTag")].value)),e.entries[exifSpec.getTagId("InteroperabilityTag")]&&(i=k(b,m,e.entries[exifSpec.getTagId("InteroperabilityTag")].value)),{IFD0:e.entries,IFD1:f&&f.entries,EXIFIFD:g&&g.entries,GPSIFD:h&&h.entries,interoperabilityIFD:i&&i.entries,thumbnailBlob:d,byteOrder:q}):void 0},r=function(a,b){var c=exifSpec.getTagId(a),d=exifSpec.tags[c].type,e=0;switch(d){case 1:case 6:case 7:e=1;break;case 2:e=b.length+1;break;case 3:case 8:e=2;break;case 4:case 9:case 11:e=4;break;case 10:case 5:case 12:e=8;break;default:throw"Calculating Exif Tag Value Size: Unkown value type: "+d}return Array.isArray(b)&&(e=b.length*e),e},s=function(a,b){var c=exifSpec.getTagId(a),d=exifSpec.tags[c].type;return Array.isArray(b)?b.length:5===d||10===d?2:2===d&&b.length>4?b.length+1:1},t=function(a){var b,c,d,e,f=!1,g={IFD0Length:0,IFD0LengthDataSection:0,ExifIFDLength:0,ExifIFDLengthDataSection:0,GPSIFDLength:0,GPSIFDLengthDataSection:0,interoperabilityIFDLength:0,interoperabilityLengthDataSection:0},h=12;return Object.keys(a).forEach(function(i){var j=exifSpec.getTagId(i),k=j&&exifSpec.tags[j];k&&(e=r(i,a[i]),4>=e&&(e=0),1===k.IFD&&(g.IFD0Length+=h,g.IFD0LengthDataSection+=e,f=!0),2===k.IFD&&(g.ExifIFDLength+=h,g.ExifIFDLengthDataSection+=e,b=!0),3===k.IFD&&(g.GPSIFDLength+=h,g.GPSIFDLengthDataSection+=e,c=!0),4===k.IFD&&(g.interoperabilityIFDLength+=h,g.interoperabilityLengthDataSection+=e,d=!0))}),g.IFD0Length+=4,b&&!a.ExifTag&&(g.IFD0Length+=12),c&&!a.GPSTag&&(g.IFD0Length+=12),d&&!a.InteroperabilityTag&&(g.IFD0Length+=12),g.IFD0Length+=2,b&&(g.ExifIFDLength+=2),c&&(g.GPSIFDLength+=2),d&&(g.interoperabilityIFDLength+=2),g},u=function(a,b,c){return a.setUint16(b,65505,!1),a.setUint16(b+2,c,!1),a.setUint8(b+4,69),a.setUint8(b+5,120),a.setUint8(b+6,105),a.setUint8(b+7,102),a.setUint8(b+8,0),a.setUint8(b+9,0),10},v=function(a,b){return a.setUint16(b+0,19789,!1),a.setUint16(b+2,42,!1),a.setUint32(b+4,8,!1),8},w=function(a,b,c,d){var e,f,g=0;d=d||{},c&&(d.JPEGInterchangeFormat=0,d.JPEGInterchangeFormatLength=c.size,d.Orientation=a.Orientation);var h=t(d),i=c?h.IFD0Length:0,j=c?h.IFD0LengthDataSection:0,k=t(a),m=k.IFD0Length,n=k.IFD0LengthDataSection,o=k.ExifIFDLength,p=k.ExifIFDLengthDataSection,q=k.GPSIFDLength,r=k.GPSIFDLengthDataSection,s=k.interoperabilityIFDLength;k.interoperabilityLengthDataSection;var w,x,y=[],z=18,A=z+m+i+o+q,B=n+j+p+r,C=A+B,D=c?C+c.size:C,E="Written bytes and segment length don't match. There was a problem creating the segment";e=new ArrayBuffer(C),f=new Blob([e],{type:"image/jpeg"}),BlobView.get(f,0,f.size,function(e){return g+=u(e,g,D-2),w=g,g+=v(e,g),o&&(a.ExifTag=8+m+n+i+j),q&&(a.GPSTag=8+m+n+i+j+o+p),s&&(a.InteroperabilityTag=8+m+n+i+j+o+p+q+r),g+=l(e,w,g,g+m,1,a,o),i&&(d.JPEGInterchangeFormat=C-10,g+=l(e,w,g,g+i,1,d,o)),g+=l(e,w,g,g+o,2,a),g+=l(e,w,g,g+q,3,a),g+=l(e,w,g,g+s,4,a),g!==C?(console.log(E),b(E),void 0):(y.push(e.buffer),d&&c&&y.push(c),x=new Blob(y),b(null,x),void 0)})},x=function(a,b,c){var d=new Image,e=function(a){b(null,a)};c=c||8,d.onload=function(){var a=document.createElement("canvas"),b=a.getContext("2d");a.height=d.height/c,a.width=d.width/c,b.drawImage(d,0,0,d.width,d.height,0,0,a.width,a.height),a.toBlob(e,"image/jpeg"),URL.revokeObjectURL(d.src),d.src=""},d.src=URL.createObjectURL(a)},y=function(a,c){var d=q(a,c),e=d.IFD0;return e=b(e,d.EXIFIFD),e=b(e,d.GPSIFD),{metaData:m(e),thumbnailMetaData:d.IFD1&&m(d.IFD1),thumbnailBlob:d.thumbnailBlob}};this.Exif=this.Exif||{},this.Exif.mergeObjects=b,this.Exif.readSegment=y,this.Exif.createSegment=w,this.Exif.createThumbnail=x}.call(this),function(){var a={SOIMarker:0,segmentMarker:0,segmentType:1,segmentLength:2,segmentFormat:4,firstSegment:2},b={Exif:Exif,JFIF:JFIF},c=function(b,c){return b.getUint8(c+a.segmentMarker)},d=function(b,c){return b.getUint8(c+a.segmentType)},e=function(a,b){var c=jpegSpec.segmentTypes[d(a,b)];return"SOS"===c||0===c.indexOf("RST")?i(a,b)-b:a.getUint16(b+2,!1)+2},f=function(b,c){return b.getNullTerminatedASCIIString(c+a.segmentFormat)},g=function(b){return b.byteLength<2||65496!==b.getUint16(a.SOIMarker)?!1:!0},h=function(a,b){var e=c(a,b),f=d(a,b);return 255===e&&f>0&&255>f?!0:!1},i=function(a,b){b+=2;for(var c,d=0;;){if(b>=a.sliceLength)break;if(c=a.getUint8(b),0!==c&&255===d)break;d=c,b+=1}return b+1},j=function(a,b){var c=d(a,b);return c>=224&&239>=c?!0:!1},k=function(a,c){var d,e=f(a,c);return b[e]?(d=b[e].readSegment(a,c),{format:e,offset:c,metaData:d.metaData,thumbnailMetaData:d.thumbnailMetaData,thumbnailBlob:d.thumbnailBlob}):(console.log("Unkown APP segment format: "+e),void 0)},l=function(a){for(var b,c,d=2,f={};d+4<=a.sliceLength;){if(!h(a,d))throw"Invalid JPEG Segment at offset "+d;if(j(a,d)&&(b=k(a,d),b&&(f[b.format]=b.metaData,f[b.format].segmentOffset=b.offset,f[b.format].segmentLength=e(a,d),f.thumbnailBlob=f.thumbnailBlob||b.thumbnailBlob,f.thumbnailMetaData=f.thumbnailBlob||b.thumbnailMetaData)),c=e(a,d),0>=c)throw"Invalid length in segement at offset: "+d;d+=c}return f},m=function(a,b,c,d){BlobView.get(a,0,b,function(a){g(a)===!1?c("Not a valid JPEG file"):d&&!d(a,2)?c("First segment not valid"):c(null,l(a),a)})},n=function(a,b,c,d){BlobView.get(b,0,b.size,function(b){var e,f,h,i,j;
g(b)===!1?d("Not a valid JPEG file"):(j=l(b),j[c]?(i=j[c],f=b.blob.slice(0,i.segmentOffset),h=b.blob.slice(i.segmentOffset+i.segmentLength,b.sliceLength)):(f=b.blob.slice(0,2),h=b.blob.slice(2,b.sliceLength)),e=new Blob([f,a,h],{type:"image/jpeg"}),d(null,e))})},o=function(a,b,c,d){var e=function(b,d){b?c(b):(d.fileType="JPEG",d.fileSize=a.size,c(null,d))};m(a,b,e,d)},p=function(a,c,d,e,f){var g=function(c,g){var h=function(b,c){n(c,a,e,f)},i=function(a,c){b[e].createSegment(d,h,c,a)},j=function(a,b){i({},b)};if(!b[e])throw"Writting MetaData: Unknown type of MetaData "+e;g[e]&&(d=Exif.mergeObjects(g[e],d)),g.thumbnailMetaData&&g.thumbnailBlob?i(g.thumbnailMetaData,g.thumbnailBlob):b[e].createThumbnail(a,j,16)};m(a,c,g)},q=function(a,b){var c=function(a,c){var d=c&&c.thumbnailMetaData,e=c&&c.thumbnailBlob;c=c&&c.Exif,b(a,c,d,e)};o(a,Math.min(65538,a.size),c)},r=function(a,b,c){p(a,a.size,b,"Exif",c)};this.JPEG=this.JPEG||{},this.JPEG.readMetaData=o,this.JPEG.readExifMetaData=q,this.JPEG.writeExifMetaData=r}.call(this);