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Ae,IAE9C,EAAK,OAAS,EAAE,IAAI,EAAS,WAAW,IAExC,EAAK,OAAS,EAAE,IAAI,EAAS,WAAW,IAExC,EAAK,MAAQ,EACb,QAAQ,IAAI,GACZ,EAAQ,KAER,QAAQ,IAAI,GAUZ,EAAK,SAAW,EAAE,IAAI,EAAS,aAAa,IAE5C,EAAK,eAAkB,EAAE,IAAI,EAAS,aAAa,IAEnD,EAAK,WAAc,EAAE,IAAI,EAAS,aAAa,IAC/C,EAAK,MAAQ,EACb,QAAQ,IAAI,GACZ,EAAQ,GAKhB,MACE,EAAO,OACT,IAKR,OAAM,GAAO,EAAO,IAAI,IAIpC,oBAAsB,IACX,IAAI,SAAQ,CAAC,EAAS,KACzB,UAAU,cAAa,GAAM,MAAK,IAM9B,GAAI,GAAO,EAAI,OAAQ,CACnB,MAAM,EAAQ,EAAE,IAAI,EAAI,eAAe,IAGvC,IAAI,EAAO,IAFI,EAAE,IAAI,EAAI,2BAA2B,KAChD,EAAE,IAAI,KAAK,MAAM,EAAE,IAAI,EAAI,oBAAoB,KAAK,SAAS,IAC1C,MAAO,IAAI,IAClC,EAAQ,EACZ,KACD,OAAM,GAAO,EAAO,IAAI","file":"/npm/qb-baidu-ai@1.3.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/qb-baidu-ai@1.3.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import {NativeModules} from 'react-native';\nimport _ from 'lodash'\nconst {RNBaiduAi} = NativeModules;\n\n\nexport default class BaiduAi {\n    static releaseCameraModel=()=>{\n        RNBaiduAi.releaseCameraModel();\n    }\n    static authWithAKSK = (ak, sk) => {\n        RNBaiduAi.authWithAKSK(ak, sk).then((res)=>{\n            console.log('init:',res)\n        }).catch(e=>{\n          console.log(e)\n        })\n    }\n//{\"log_id\": 4495601286731991483,\n// \"words_result_num\": 6,\n// \"direction\": 0,\n// \"image_status\": \"normal\",\n// \"words_result\": {\n// \"住址\": {\"location\": {\"width\": 416, \"top\": 427, \"height\": 96, \"left\": 344}, \"words\": \"内蒙古包头市青山区朝阳区3栋155号156号\"},\n// \"出生\": {\"location\": {\"width\": 0, \"top\": 0, \"height\": 0, \"left\": 0}, \"words\": \"19861210\"},\n// \"姓名\": {\"location\": {\"width\": 114, \"top\": 169, \"height\": 53, \"left\": 347}, \"words\": \"唐建\"},\n// \"公民身份号码\": {\"location\": {\"width\": 586, \"top\": 647, \"height\": 41, \"left\": 580}, \"words\": \"150204198612100017\"},\n// \"性别\": {\"location\": {\"width\": 0, \"top\": 0, \"height\": 0, \"left\": 0}, \"words\": \"男\"},\n// \"民族\": {\"location\": {\"width\": 27, \"top\": 263, \"height\": 34, \"left\": 605}, \"words\": \"汉\"}}}\n\n    static scanLicensePlate = async ()=>{\n        let result = ''\n        try{\n            const resp = await RNBaiduAi.scanLicensePlate()\n            console.log('orig',resp)\n            const dataStr = resp?.data||''\n            const data = dataStr?.words_result||JSON.parse(dataStr)?.words_result||''\n            const response ={\n                image:{\n                    data:resp?.base64||resp?.image?.data||'',\n                    filePath:resp?.filePath||resp?.image?.filePath||''\n                },\n                data,\n            }\n            result=response\n        }catch(e){\n            console.log(e)\n            result = { code:'-1', msg:'识别车牌失败！'}\n        }\n        \n        console.log(result)\n        return result\n        \n    }\n\n    static scanIdCard = (isFront) => {\n        return new Promise((resolve, reject) => {\n                RNBaiduAi.scanIdCard(isFront).then(res => {\n                        if (res && res.result) {\n                            const image = _.get(res,'result.image','')\n                            const result = _.get(res,'result.data.words','')\n                            const wordList = _.get(result,'words_result','')?result.words_result:_.get(JSON.parse(result),'words_result','')\n                            let data = {}\n                            if (isFront) {\n                                console.log(wordList)\n\n                                data.address = _.get(wordList,'住址.words','')\n\n                                data.birth = _.get(wordList,'出生.words','')\n\n                                data.name = _.get(wordList,'姓名.words','')\n\n                                data.idNumber = _.get(wordList,'公民身份号码.words','')\n\n                                data.gender = _.get(wordList,'性别.words','')\n\n                                data.ethnic = _.get(wordList,'民族.words','')\n\n                                data.image = image\n                                console.log(data)\n                                resolve(data)\n                            }else {\n                                console.log(res)\n                                // {\"log_id\": 6202171508325979716,\n                                // \"words_result_num\": 3,\n                                // \"direction\": 0,\n                                // \"image_status\": \"normal\",\n                                // \"words_result\": {\n                                // \"签发日期\": {\"location\": {\"width\": 183, \"top\": 553, \"height\": 36, \"left\": 530}, \"words\": \"20171114\"},\n                                // \"签发机关\": {\"location\": {\"width\": 370, \"top\": 457, \"height\": 80, \"left\": 524}, \"words\": \"包头市公安局青山分局\"},\n                                // \"失效日期\": {\"location\": {\"width\": 186, \"top\": 551, \"height\": 34, \"left\": 740}, \"words\": \"20371114\"}}}\n\n                                data.signDate = _.get(wordList,'签发日期.words','')\n\n                                data.issueAuthority =  _.get(wordList,'签发机关.words','')\n\n                                data.expiryDate =  _.get(wordList,'失效日期.words','')\n                                data.image = image\n                                console.log(data)\n                                resolve(data)\n                            }\n\n                            // image:{filePath:xxxxx}\n\n                        }else{\n                          reject('识别失败')\n                        }\n\n                    }\n                ).\n\n                catch(err => reject(err))\n            }\n        )\n    }\n    static scanBankCard = () => {\n        return new Promise((resolve, reject) => {\n            RNBaiduAi.scanBankCard(true).then(res => {\n                // {\"log_id\": 7564347348209730833,\n                // \"result\":\n                // {\"bank_card_number\": \"6230960000 008085669\",\n                // \"bank_card_type\": 1,\n                // \"bank_name\": \"重庆银行\"}}\n                if (res && res.result) {\n                    const image = _.get(res,'result.image','')\n                    const result = _.get(res,'result.data.words.result','')||\n                        _.get(JSON.parse(_.get(res,'result.data.words','')),'result','')\n                    let data = {...result, image: {...image}}\n                    resolve(data)\n                }\n            }).catch(err => reject(err))\n        })\n    }\n}\n"]}