{"version":3,"sources":["jsdelivr-header.js","/npm/profile-image-analyzer@1.1.2/bundles/src/app/enums/analysisType.enum.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/enums/profileStatus.enum.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/helper/profileAnalyzerHelper.helper.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/models/profileImageAnalysisRequest.model.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/models/azureCredentials.model.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/services/profile-analyzer-api.service.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/profile-image-analyzer.component.ts","/npm/profile-image-analyzer@1.1.2/bundles/src/app/profile-image-analyzer.module.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,snBCLI,EAAA,CACA,cAAU,EACV,WAAA,EACA,mBAAW,EACX,YAAU,EACV,WAAA,EACA,WAAA,E,qBALA,eAAU,gB,IACV,YAAA,a,IACA,oBAAW,qB,IACX,aAAU,c,IACV,YAAU,a,IACV,YAAa,a,uCCNb,EAAY,CACZ,SAAA,EACA,SAAA,E,oBADA,UAAQ,W,IACR,UAAY,W,+KCSZ,EAAA,W,SACC,IAAA,C,OAED,EAAA,UAAA,uB,cAEO,IAAG,GACF,EAAM,IAAG,OACL,OAAK,WACL,KAAS,OAAO,IAAA,KAAA,OAAA,MAAA,KAAA,QAAA,IAAA,KAAA,QAAA,KACnB,GAAA,GACG,EAAc,KAEpB,EACE,EAAA,QAAU,WACV,EAAc,KAChB,EACE,EAAG,IAAG,OAAW,IAAA,gBAAoB,EAC5C,EAED,EAAA,UAAA,gB,iFAMC,OADkB,IAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,EAAA,M,6IAUR,GACV,OAAA,KAAA,gBAAA,KAAA,gBAAA,IAAA,KAAA,gBAAA,I,0JAKY,G,IAED,EACJ,OAAK,GACD,gBACA,EAAM,MACL,MACD,iBACA,EAAM,OACL,MACD,g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AAA,UAAA,GACI,KAAS,WAAA,GACZ,KAAA,gBAAA,E,EAED,EAAA,UAAA,gBAAA,WACI,SAAM,eAAiB,qBAAA,OACvB,E,qBAGJ,SAAK,GACD,EAAM,iB,gCACN,E,EAKK,UAAA,K,SAjJZ,G,yBAGW,C,OACX,C,i+NCEG,G,aDauC,G,ECF3B,W,aACA,C,SACF,a,OACb,S,8LAHe,G","file":"/npm/profile-image-analyzer@1.1.2/bundles/profile-image-analyzer.umd.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/profile-image-analyzer@1.1.2/bundles/profile-image-analyzer.umd.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export enum AnalysisType {\n    FaceDetection,\n    Blurriness,\n    CelebrityDetection,\n    Orientation,\n    Brightness,\n    Moderation,\n    ImageAnalysis\n}\n","export enum ProfileStatus {\n    Accepted = 1,\n    Rejected = 2,\n    ReviewNeeded = 3\n}\n","import { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { AzureCredentials } from '../models';\n\ndeclare var require: any;\nconst Notyf = require('node_modules/profile-image-analyzer/assets/js/notyf');\nconst azure = require('node_modules/profile-image-analyzer/assets/js/azure-storage');\n\n@Injectable()\nexport class ProfileAnalyzerHelper {\n\n    constructor() {\n    }\n\n    validateImageDimension(file: File, _callback) {\n        let img;\n        img = new Image();\n        img.onload = function() {\n            if (this.width >= 50 && this.width <= 3200 && this.height >= 50 && this.height <= 3200) {\n                _callback(true);\n            } else {\n                _callback(null);\n            }\n        };\n        img.onerror = function() {\n            _callback(null);\n        };\n        img.src = window.URL.createObjectURL(file);\n    }\n\n    updatedFileName(file: File) {\n        const fileExtension = this.getExtension(file.type);\n        const fileName = this.createGuid(fileExtension);\n        const blob = new Blob([file]);\n        const newFile = new File([blob], fileName, { type: file.type });\n        return newFile;\n    }\n\n    private getRandomGuid() {\n        return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n    }\n\n    createGuid(extensionType: string) {\n        return this.getRandomGuid() + this.getRandomGuid() + '-' + this.getRandomGuid() + '-' +\n            this.getRandomGuid() + '-' + this.getRandomGuid() + '-' + this.getRandomGuid() + this.getRandomGuid() + this.getRandomGuid() +\n            '.' + extensionType;\n    }\n\n    private getExtension(extensionType: string) {\n        let extensionName: string;\n        switch (extensionType) {\n            case 'image/jpg':\n                extensionName = 'jpg';\n                break;\n            case 'image/jpeg':\n                extensionName = 'jpeg';\n                break;\n            case 'image/png':\n                extensionName = 'png';\n                break;\n            case 'audio/wav':\n                extensionName = 'wav';\n                break;\n            case 'application/json':\n                extensionName = 'json';\n                break;\n        }\n        return extensionName;\n    }\n\n    notifyUser(message: string, type: string) {\n        const notyf = new Notyf({\n            delay: 3000,\n            alertIcon: 'fa fa-exclamation-circle',\n            confirmIcon: 'fa fa-check-circle'\n        });\n        if (type === 'danger') {\n            notyf.alert(message);\n        } else {\n            notyf.confirm(message);\n        }\n        // $.notify(\n        //     { message: message },\n        //     {\n        //         type: type,\n        //         placement: {\n        //             from: 'top',\n        //             align: 'center'\n        //         }\n        //     }\n        // );\n    }\n\n    getFileURL(file: File, azureCredentialInfo: AzureCredentials): string {\n        let fileUrl = '';\n        fileUrl = `${azureCredentialInfo.BlobUrl}/${azureCredentialInfo.ContainerName}/${azureCredentialInfo.BlobPath}/${file.name}`;\n        return fileUrl;\n    }\n\n    uploadFileToAzure(file: File, azureCredentialInfo: AzureCredentials) {\n        let azureStatus: Observable<boolean>;\n        const blobService = azure.createBlobService(azureCredentialInfo.ConnectionString);\n        azureStatus = new Observable((observe) =>\n            blobService.createBlockBlobFromBrowserFile(\n                azureCredentialInfo.ContainerName, `${azureCredentialInfo.BlobPath}/${file.name}`, file, {\n                },\n                (error, result, response) => {\n                    if (error) {\n                        console.log('There was an error uploading your file to azure: ', error);\n                        observe.next(false);\n                        observe.complete();\n                    } else {\n                        observe.next(true);\n                        observe.complete();\n                    }\n                }));\n        return azureStatus;\n    }\n\n    showLoader(message: string = '') {\n        const isLoaderActive = (document.getElementById('loader-container')) ? true : false;\n        if (!isLoaderActive) {\n            const loader = document.createElement('div');\n            loader.id = 'loader-container';\n            loader.setAttribute('style', `height: 100vh; width: 100vw; z-index: 200; position: absolute; top: 0;` +\n                `left: 0; background-color: rgba(238, 238, 238, 0.5);`);\n            const img = document.createElement('img');\n            img.setAttribute('style', 'position: absolute; top: 50%; left: 46%;');\n            img.setAttribute('src', 'node_modules/profile-image-analyzer/assets/image/loader.svg');\n            img.id = 'loader-img';\n            const loadingText = document.createElement('div');\n            loadingText.id = 'loader-text';\n            loadingText.setAttribute('style',\n                'position: absolute; top: 55%; left: 40%; font-size: 1.5rem; font-weight: 700; opacity: 0.5;');\n            loadingText.innerText = message;\n            loader.appendChild(img);\n            loader.appendChild(loadingText);\n            const body = document.getElementsByTagName('body')[0];\n            body.appendChild(loader);\n        } else {\n            document.getElementById('loader-text').innerText = message;\n        }\n    }\n\n    hideLoader() {\n        const loader = document.getElementById('loader-container');\n        if (loader) {\n            document.body.removeChild(loader);\n        }\n    }\n\n\n}\n","export class ProfileImageAnalysisRequest {\n    ImageUrl: string;\n    CheckBrightness: boolean;\n    CheckBlurry: boolean;\n    CheckCelebrity: boolean;\n    CheckForModeration: boolean;\n    CheckFaceOrientation: boolean;\n    CheckCartoonFace: boolean;\n\n    constructor() {\n        this.CheckBrightness = true;\n        this.CheckBlurry = true;\n        this.CheckCelebrity = true;\n        this.CheckForModeration = true;\n        this.CheckFaceOrientation = true;\n        this.CheckCartoonFace = true;\n    }\n}\n","export class AzureCredentials {\n    BlobPath: string;\n    ContainerName: string;\n    BlobUrl: string;\n    ConnectionString: string;\n}\n","import { Injectable } from '@angular/core';\nimport { HttpClient, HttpHeaders } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { ProfileImageAnalysisRequest, ProfileImageAnalysisResponse } from '../models';\n\n@Injectable()\nexport class ProfileAPIService {\n    private apiUrl: string;\n    private headers: HttpHeaders;\n\n    constructor(private http: HttpClient) {\n        this.apiUrl = '//cognitiveintegrator-api-dev.azurewebsites.net/api';\n        this.headers = new HttpHeaders({\n            'Cache-Control': 'no-cache',\n            'Cache-control': 'no-store',\n            'Expires': '0',\n            'Pragma': 'no-cache',\n            'Content-Type': 'application/json'\n        });\n        this.headers.append('Accept', 'application/json');\n    }\n\n    analyzeProfileImage(profileImageAnalysisRequest: ProfileImageAnalysisRequest): Observable<ProfileImageAnalysisResponse> {\n        const url = `${this.apiUrl}/faceimageanalysis/faceanalysis`;\n        return this.http.post<ProfileImageAnalysisResponse>(url, profileImageAnalysisRequest, { headers: this.headers });\n    }\n}\n","import { Component, OnInit } from '@angular/core';\n\nimport { ProfileImageAnalysisRequest, AzureCredentials, ProfileImageAnalysisResponse } from './models/index';\nimport { ProfileAPIService } from './services/index';\nimport { ProfileAnalyzerHelper } from './helper/index';\nimport { ProfileStatus } from './enums/index';\n\n@Component({\n    selector: 'profile-image-analyzer',\n    template: '<link crossorigin=\"anonymous\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\"><link crossorigin=\"anonymous\" href=\"https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css\" rel=\"stylesheet\"><div class=\"mt-2 container-fluid\" id=\"profileModerator\"><div class=\"container\"><div class=\"mx-auto card mb-5 shadow mt-3\"><div class=\"row\"><div class=\"col-12 col-sm-7 pl-1 pl-sm-4 pt-3\"><div class=\"row\" *ngIf=\"file\"><div class=\"col-12 mt-2 ml-4 pr-0\"><div class=\"float-left image\"><div class=\"img\"><img id=\"profileImage\" src=\"\" (dragover)=\"dropOver($event)\" (drop)=\"drop($event)\" alt=\" \" class=\"shadow image-style {{imageBorderStyle}}\"><i class=\"fa image-status-icon {{iconStyle}}\" *ngIf=\"profileImageAnalysisResponse\"></i></div></div><span class=\"remove-btn\" (click)=\"removeInputfile()\" *ngIf=\"file\"><i class=\"fa fa-times-circle-o\" aria-hidden=\"true\"></i></span></div></div><div class=\"row\" [hidden]=\"file\"><div class=\"col-12 mt-2 ml-4 pr-0\"><div class=\"image-style bg-light border image-droparea rounded\" (click)=\"openImagePicker()\" (dragover)=\"dropOver($event)\" (drop)=\"drop($event)\"><div class=\"text-center\"><span><img id=\"fileUploadIcon\" src=\"node_modules/profile-image-analyzer/assets/image/dragdrop.png\"></span><h6 class=\"m-0\">Drop File Here</h6><p class=\"m-0\">OR<h6 class=\"m-0\">Select File Here</h6></div><input id=\"profileImageInput\" type=\"file\" class=\"invisible\"></div></div></div></div><div class=\"col-12 mt-2 col-sm-5 pl-3 pl-md-2 pl-sm-0\"><ul class=\"text-left list-unstyled mr-0 mr-md-3 p-2\"><li><label class=\"checkboxcontainer\">Brightness <input id=\"CheckBrightness\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckBrightness = !profileImageAnalysisRequest.CheckBrightness\" checked><span class=\"checkmark\"></span></label><li><label class=\"checkboxcontainer\">Blurry <input id=\"CheckBlurry\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckBlurry = !profileImageAnalysisRequest.CheckBlurry\" checked><span class=\"checkmark\"></span></label><li><label class=\"checkboxcontainer\">Celebrity Detection <input id=\"CheckCelebrity\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckCelebrity = !profileImageAnalysisRequest.CheckCelebrity\" checked><span class=\"checkmark\"></span></label><li><label class=\"checkboxcontainer\">Moderation <input id=\"CheckForModeration\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckForModeration = !profileImageAnalysisRequest.CheckForModeration\" checked><span class=\"checkmark\"></span></label><li><label class=\"checkboxcontainer\">Cartoon Face <input id=\"CheckCartoonFace\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckCartoonFace = !profileImageAnalysisRequest.CheckCartoonFace\" checked><span class=\"checkmark\"></span></label><li><label class=\"checkboxcontainer\">Face Orientation <input id=\"CheckFaceOrientation\" type=\"checkbox\" (change)=\"profileImageAnalysisRequest.CheckFaceOrientation = !profileImageAnalysisRequest.CheckFaceOrientation\" checked><span class=\"checkmark\"></span></label></ul></div></div><div class=\"row\"><div class=\"mx-auto\"><button (click)=\"analyzeprofileImage()\" [disabled]=\"!file\" class=\"pl-3 btn btn-block mb-2 mr-2 pr-3\">Analyze</button></div></div></div><div class=\"mx-auto card mb-5 shadow\" *ngIf=\"profileImageAnalysisResponse\"><div class=\"p-3\"><h6 class=\"text-center\">Status:-<span class=\"{{statusTextStyle}}\">{{statusText}}</span></h6><div class=\"pl-3\"><div *ngIf=\"profileImageAnalysisResponse.Rejections &&  profileImageAnalysisResponse.Rejections.length > 0\"><h6 class=\"text-left\">Rejection Reasons</h6><ul class=\"text-left pl-4\"><li *ngFor=\"let reason of profileImageAnalysisResponse.Rejections\">{{reason.MoreInfo}}</ul></div><div *ngIf=\"profileImageAnalysisResponse.ReviewRecommendations &&  profileImageAnalysisResponse.ReviewRecommendations.length > 0\"><h6 class=\"text-left\">Recommendations Reasons</h6><ul class=\"text-left pl-4\"><li *ngFor=\"let reason of profileImageAnalysisResponse.ReviewRecommendations\">{{reason.MoreInfo}}</ul></div></div></div></div></div></div>',\n    styles: ['.image-style{background-size:cover;background-position:center center;background-repeat:no-repeat;margin-bottom:10px;height:200px;max-width:350px}.remove-btn i{padding:0;cursor:pointer;padding-left:6px;vertical-align:top;height:100%;padding-top:2px}#profileImageInput{position:absolute;top:0;width:10px}.image-droparea{border:2px dotted gray !important;line-height:60px;cursor:pointer}#fileUploadIcon{height:30px}.credential-inputContainer{position:fixed;max-width:200px;top:60px;right:10px;z-index:50}.credentials-toggleButton{border-radius:25px;width:42px;line-height:1.8rem}#azureCredentialsForm{position:absolute;right:0;top:42px;width:max-content;max-width:250px;background-color:white;border:solid 2px gray;padding:10px;border-radius:5px}.checkboxcontainer{display:block;position:relative;padding-left:35px;/* margin-bottom: 12px; */cursor:pointer;font-size:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.checkboxcontainer input[type=\"checkbox\"]{position:absolute;opacity:0;cursor:pointer}.checkmark{position:absolute;top:5px;left:4px;height:20px;width:20px;background-color:#eee}.checkboxcontainer:hover input ~ .checkmark{background-color:#ccc}.checkboxcontainer input:checked ~ .checkmark{background-color:#2196F3}.checkmark:after{content:\"\";position:absolute;display:none}.checkboxcontainer input:checked ~ .checkmark:after{display:block}.checkboxcontainer .checkmark:after{left:8px;top:5px;width:5px;height:10px;border:solid white;border-width:0 3px 3px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.shadow{box-shadow:0 10px 16px 0 rgba(0, 0, 0, 0.2),0 6px 20px 0 rgba(0, 0, 0, 0.19) !important}.card{max-width:750px}.image-status-icon{position:absolute;top:4px;right:5px}.image-border{border:1px solid #dee2e6;border-width:2px}.image:before{content:\"\";vertical-align:middle}.image .img{display:block;vertical-align:middle;position:relative}.border-accepted{border:1px solid rgba(40, 167, 69, 0.8);box-shadow:0 10px 16px 0 rgba(0, 0, 0, 0.2),0 6px 20px 0 rgba(40, 167, 69, 0.5) !important;border-width:2px}.border-rejected{border:1px solid rgba(220, 53, 69, 0.8);box-shadow:0 10px 16px 0 rgba(0, 0, 0, 0.2),0 6px 20px 0 rgba(220, 53, 69, 0.5) !important;border-width:2px}.border-review{border:1px solid rgba(255, 193, 7, 0.8);box-shadow:0 10px 16px 0 rgba(0, 0, 0, 0.2),0 6px 20px 0 rgba(255, 193, 7, 0.5) !important;border-width:2px}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.fadeIn{-webkit-animation-name:fadeIn;animation-name:fadeIn}@media only screen and (max-width: 768px){.image-style{height:200px;max-width:215px}.checkboxcontainer{font-size:17px}}@media only screen and (max-width: 540px){.checkboxcontainer{font-size:15px}.checkmark{top:3px}}'],\n})\nexport class ProfileImageAnalyzerComponent implements OnInit {\n    file: File;\n    profileImageAnalysisRequest: ProfileImageAnalysisRequest;\n    profileImageAnalysisResponse: ProfileImageAnalysisResponse;\n    azureCredentials: AzureCredentials;\n    profileStatus: any;\n    imageBorderStyle: string;\n    iconStyle: string;\n    statusText: string;\n    statusTextStyle: string;\n\n    constructor(public profileAPIService: ProfileAPIService, public profileAnalyzerHelper: ProfileAnalyzerHelper) {\n        this.profileImageAnalysisRequest = new ProfileImageAnalysisRequest();\n        this.azureCredentials = new AzureCredentials();\n        this.profileStatus = ProfileStatus;\n    }\n\n    ngOnInit() {\n        if (document.getElementById('profileImageInput')) {\n            document.getElementById('profileImageInput').addEventListener('change', this.onFileChange.bind(this));\n        }\n        this.fillAzureCredentials();\n    }\n\n    onFileChange(event) {\n        if (event['target'].files.length > 0 && (event['target'].files[0].type === 'image/png' ||\n            event['target'].files[0].type === 'image/jpg' || event['target'].files[0].type === 'image/jpeg')) {\n            let fileSize: number;\n            fileSize = event['target'].files[0].size;\n            fileSize = fileSize * 0.000001;\n            if (fileSize <= 4) {\n                this.profileAnalyzerHelper.validateImageDimension(event['target'].files[0], (isValid: boolean) => {\n                    if (isValid) {\n                        const file = event['target'].files[0];\n                        this.file = this.profileAnalyzerHelper.updatedFileName(file);\n                        const reader = new FileReader();\n                        reader.onload = function(e) {\n                            document.getElementById('profileImage').setAttribute('src', e.target['result']);\n                        };\n                        reader.readAsDataURL(event['target'].files[0]);\n                        this.clearResponse();\n                    } else {\n                        this.profileAnalyzerHelper.notifyUser('File selected is not in specified dimensions', 'danger');\n                        this.removeInputfile();\n                    }\n                });\n            } else {\n                this.profileAnalyzerHelper.notifyUser('File selected is above specified range', 'danger');\n                this.removeInputfile();\n            }\n        } else {\n            this.profileAnalyzerHelper.notifyUser('Select Valid Image File', 'danger');\n            this.removeInputfile();\n        }\n    }\n\n    removeInputfile() {\n        this.clearResponse();\n        document.getElementById('profileImageInput')['value'] = '';\n        this.file = null;\n    }\n\n    analyzeprofileImage() {\n        this.clearResponse();\n        this.profileImageAnalysisRequest.ImageUrl = this.profileAnalyzerHelper.getFileURL(this.file, this.azureCredentials);\n        this.profileAnalyzerHelper.showLoader('Uploading Image....');\n        this.profileAnalyzerHelper.uploadFileToAzure(this.file, this.azureCredentials).subscribe((status) => {\n            if (status) {\n                this.profileAnalyzerHelper.showLoader('Getting API Response....');\n                this.profileAPIService.analyzeProfileImage(this.profileImageAnalysisRequest).subscribe((response) => {\n                    this.processImageAnalysisResponse(response);\n                },\n                    err => {\n                        this.profileAnalyzerHelper.notifyUser('Something Went Wrong With API', 'danger');\n                    },\n                    () => {\n                        this.profileAnalyzerHelper.hideLoader();\n                    });\n            }\n        });\n    }\n\n\n    processImageAnalysisResponse(response: ProfileImageAnalysisResponse) {\n        this.profileImageAnalysisResponse = new ProfileImageAnalysisResponse();\n        this.profileImageAnalysisResponse = response;\n        switch (this.profileImageAnalysisResponse.Status.toString()) {\n            case ProfileStatus[1].toString():\n                this.imageBorderStyle = 'border-accepted';\n                this.iconStyle = 'fa-check-circle text-success';\n                this.statusText = 'Accepted';\n                this.statusTextStyle = 'text-success';\n                break;\n            case ProfileStatus[2].toString():\n                this.imageBorderStyle = 'border-rejected';\n                this.iconStyle = 'fa-flag text-danger';\n                this.statusText = 'Rejected';\n                this.statusTextStyle = 'text-danger';\n                break;\n            case ProfileStatus[3].toString():\n                this.imageBorderStyle = 'border-review';\n                this.iconStyle = 'fa-exclamation-circle text-warning';\n                this.statusText = 'Review Recommended';\n                this.statusTextStyle = 'text-warning';\n                break;\n        }\n    }\n\n    fillAzureCredentials() {\n        this.azureCredentials.BlobPath = 'cognitive-file';\n        this.azureCredentials.BlobUrl = 'https://cognitiveappdev.blob.core.windows.net';\n        this.azureCredentials.ConnectionString = 'DefaultEndpointsProtocol=https;AccountName=cognitiveappdev;AccountKey=' +\n            '3p/bZmpwGLYeyNLqiYa/GksrLS5IBybdLAA0j04/xXx/nreH88Y56IIKVggAXP3pJXPHwo8uhpjrau5b5bmsMA==;EndpointSuffix=core.windows.net';\n        this.azureCredentials.ContainerName = 'cognitiveappcontainer';\n    }\n\n    clearResponse() {\n        this.profileImageAnalysisResponse = null;\n        this.imageBorderStyle = '';\n        this.iconStyle = '';\n        this.statusText = '';\n        this.statusTextStyle = '';\n    }\n\n    openImagePicker() {\n        document.getElementById('profileImageInput').click();\n    }\n\n    dropOver(event) {\n        event.preventDefault();\n        event.dataTransfer.dropEffect = 'copy';\n    }\n\n    drop(event) {\n        event.preventDefault();\n        const fileEvent = {\n            target: {\n                files: [\n                    event.dataTransfer.files[0]\n                ]\n            }\n        };\n        this.onFileChange(fileEvent);\n    }\n}\n","import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { HttpClientModule } from '@angular/common/http';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { ProfileImageAnalyzerComponent } from './profile-image-analyzer.component';\nimport { ProfileAPIService } from './services/index';\nimport { ProfileAnalyzerHelper } from './helper/index';\n\n\n@NgModule({\n    declarations: [\n        ProfileImageAnalyzerComponent\n    ],\n    imports: [\n        BrowserModule,\n        HttpClientModule,\n        RouterModule,\n        CommonModule,\n        FormsModule\n    ],\n    exports: [ProfileImageAnalyzerComponent],\n    providers: [ProfileAPIService, ProfileAnalyzerHelper],\n    bootstrap: [ProfileImageAnalyzerComponent],\n    schemas: [NO_ERRORS_SCHEMA]\n})\nexport class ProfileImageAnalyzerModule { }\n"]}