51b72b6a451ef70ae668b3f0bb8f90f5.json
5.54 KB
{"ast":null,"code":"Object.defineProperty(exports,\"__esModule\",{value:true});exports.default=void 0;var dataUriPattern=/^data:/;var ImageUriCache=function(){function ImageUriCache(){}ImageUriCache.has=function has(uri){var entries=ImageUriCache._entries;var isDataUri=dataUriPattern.test(uri);return isDataUri||Boolean(entries[uri]);};ImageUriCache.add=function add(uri){var entries=ImageUriCache._entries;var lastUsedTimestamp=Date.now();if(entries[uri]){entries[uri].lastUsedTimestamp=lastUsedTimestamp;entries[uri].refCount+=1;}else{entries[uri]={lastUsedTimestamp:lastUsedTimestamp,refCount:1};}};ImageUriCache.remove=function remove(uri){var entries=ImageUriCache._entries;if(entries[uri]){entries[uri].refCount-=1;}ImageUriCache._cleanUpIfNeeded();};ImageUriCache._cleanUpIfNeeded=function _cleanUpIfNeeded(){var entries=ImageUriCache._entries;var imageUris=Object.keys(entries);if(imageUris.length+1>ImageUriCache._maximumEntries){var leastRecentlyUsedKey;var leastRecentlyUsedEntry;imageUris.forEach(function(uri){var entry=entries[uri];if((!leastRecentlyUsedEntry||entry.lastUsedTimestamp<leastRecentlyUsedEntry.lastUsedTimestamp)&&entry.refCount===0){leastRecentlyUsedKey=uri;leastRecentlyUsedEntry=entry;}});if(leastRecentlyUsedKey){delete entries[leastRecentlyUsedKey];}}};return ImageUriCache;}();exports.default=ImageUriCache;ImageUriCache._maximumEntries=256;ImageUriCache._entries={};","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-web/dist/exports/Image/ImageUriCache.js"],"names":["dataUriPattern","ImageUriCache","has","uri","entries","_entries","isDataUri","test","Boolean","add","lastUsedTimestamp","Date","now","refCount","remove","_cleanUpIfNeeded","imageUris","Object","keys","length","_maximumEntries","leastRecentlyUsedKey","leastRecentlyUsedEntry","forEach","entry"],"mappings":"gFAQA,GAAIA,CAAAA,cAAc,CAAG,QAArB,CAEA,GAAIC,CAAAA,aAAa,CAEjB,UAAY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M,CAACC,IAAP,CAAYd,OAAZ,CAAhB,CAEA,GAAIY,SAAS,CAACG,MAAV,CAAmB,CAAnB,CAAuBlB,aAAa,CAACmB,eAAzC,CAA0D,CACxD,GAAIC,CAAAA,oBAAJ,CACA,GAAIC,CAAAA,sBAAJ,CACAN,SAAS,CAACO,OAAV,CAAkB,SAAUpB,GAAV,CAAe,CAC/B,GAAIqB,CAAAA,KAAK,CAAGpB,OAAO,CAACD,GAAD,CAAnB,CAEA,GAAI,CAAC,CAACmB,sBAAD,EAA2BE,KAAK,CAACd,iBAAN,CAA0BY,sBAAsB,CAACZ,iBAA7E,GAAmGc,KAAK,CAACX,QAAN,GAAmB,CAA1H,CAA6H,CAC3HQ,oBAAoB,CAAGlB,GAAvB,CACAmB,sBAAsB,CAAGE,KAAzB,CACD,CACF,CAPD,EASA,GAAIH,oBAAJ,CAA0B,CACxB,MAAOjB,CAAAA,OAAO,CAACiB,oBAAD,CAAd,CACD,CACF,CACF,CApBD,CAsBA,MAAOpB,CAAAA,aAAP,CACD,CA1DD,EAFA,C,8BA8DAA,aAAa,CAACmB,eAAd,CAAgC,GAAhC,CACAnB,aAAa,CAACI,QAAd,CAAyB,EAAzB","sourcesContent":["/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\nvar dataUriPattern = /^data:/;\n\nvar ImageUriCache =\n/*#__PURE__*/\nfunction () {\n function ImageUriCache() {}\n\n ImageUriCache.has = function has(uri) {\n var entries = ImageUriCache._entries;\n var isDataUri = dataUriPattern.test(uri);\n return isDataUri || Boolean(entries[uri]);\n };\n\n ImageUriCache.add = function add(uri) {\n var entries = ImageUriCache._entries;\n var lastUsedTimestamp = Date.now();\n\n if (entries[uri]) {\n entries[uri].lastUsedTimestamp = lastUsedTimestamp;\n entries[uri].refCount += 1;\n } else {\n entries[uri] = {\n lastUsedTimestamp: lastUsedTimestamp,\n refCount: 1\n };\n }\n };\n\n ImageUriCache.remove = function remove(uri) {\n var entries = ImageUriCache._entries;\n\n if (entries[uri]) {\n entries[uri].refCount -= 1;\n } // Free up entries when the cache is \"full\"\n\n\n ImageUriCache._cleanUpIfNeeded();\n };\n\n ImageUriCache._cleanUpIfNeeded = function _cleanUpIfNeeded() {\n var entries = ImageUriCache._entries;\n var imageUris = Object.keys(entries);\n\n if (imageUris.length + 1 > ImageUriCache._maximumEntries) {\n var leastRecentlyUsedKey;\n var leastRecentlyUsedEntry;\n imageUris.forEach(function (uri) {\n var entry = entries[uri];\n\n if ((!leastRecentlyUsedEntry || entry.lastUsedTimestamp < leastRecentlyUsedEntry.lastUsedTimestamp) && entry.refCount === 0) {\n leastRecentlyUsedKey = uri;\n leastRecentlyUsedEntry = entry;\n }\n });\n\n if (leastRecentlyUsedKey) {\n delete entries[leastRecentlyUsedKey];\n }\n }\n };\n\n return ImageUriCache;\n}();\n\nImageUriCache._maximumEntries = 256;\nImageUriCache._entries = {};\nexport { ImageUriCache as default };"]},"metadata":{},"sourceType":"script"}