File: /www/wwwroot/www.waciwang.com/wp-content/plugins/gutenberg/build/scripts/blob/index.js.map
{
"version": 3,
"sources": ["../../../packages/blob/src/index.ts"],
"sourcesContent": ["const cache: Record< string, File > = {};\n\n/**\n * Create a blob URL from a file.\n *\n * @param file The file to create a blob URL for.\n *\n * @return The blob URL.\n */\nexport function createBlobURL( file: File ): string {\n\tconst url = window.URL.createObjectURL( file );\n\n\tcache[ url ] = file;\n\n\treturn url;\n}\n\n/**\n * Retrieve a file based on a blob URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param url The blob URL.\n *\n * @return The file for the blob URL.\n */\nexport function getBlobByURL( url: string ): File | undefined {\n\treturn cache[ url ];\n}\n\n/**\n * Retrieve a blob type based on URL. The file must have been created by\n * `createBlobURL` and not removed by `revokeBlobURL`, otherwise it will return\n * `undefined`.\n *\n * @param url The blob URL.\n *\n * @return The blob type.\n */\nexport function getBlobTypeByURL( url: string ): string | undefined {\n\treturn getBlobByURL( url )?.type.split( '/' )[ 0 ]; // 0: media type , 1: file extension eg ( type: 'image/jpeg' ).\n}\n\n/**\n * Remove the resource and file cache from memory.\n *\n * @param url The blob URL.\n */\nexport function revokeBlobURL( url: string ): void {\n\tif ( cache[ url ] ) {\n\t\twindow.URL.revokeObjectURL( url );\n\t}\n\n\tdelete cache[ url ];\n}\n\n/**\n * Check whether a url is a blob url.\n *\n * @param url The URL.\n *\n * @return Is the url a blob url?\n */\nexport function isBlobURL( url: string | undefined ): boolean {\n\tif ( ! url || ! url.indexOf ) {\n\t\treturn false;\n\t}\n\treturn url.indexOf( 'blob:' ) === 0;\n}\n\n/**\n * Downloads a file, e.g., a text or readable stream, in the browser.\n * Appropriate for downloading smaller file sizes, e.g., < 5 MB.\n *\n * Example usage:\n *\n * ```js\n * \tconst fileContent = JSON.stringify(\n * \t\t{\n * \t\t\t\"title\": \"My Post\",\n * \t\t},\n * \t\tnull,\n * \t\t2\n * \t);\n * \tconst filename = 'file.json';\n *\n * \tdownloadBlob( filename, fileContent, 'application/json' );\n * ```\n *\n * @param filename File name.\n * @param content File content (BufferSource | Blob | string).\n * @param contentType (Optional) File mime type. Default is `''`.\n */\nexport function downloadBlob(\n\tfilename: string,\n\tcontent: BlobPart,\n\tcontentType: string = ''\n): void {\n\tif ( ! filename || ! content ) {\n\t\treturn;\n\t}\n\n\tconst file = new window.Blob( [ content ], { type: contentType } );\n\tconst url = window.URL.createObjectURL( file );\n\tconst anchorElement = document.createElement( 'a' );\n\tanchorElement.href = url;\n\tanchorElement.download = filename;\n\tanchorElement.style.display = 'none';\n\tdocument.body.appendChild( anchorElement );\n\tanchorElement.click();\n\tdocument.body.removeChild( anchorElement );\n\twindow.URL.revokeObjectURL( url );\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,QAAgC,CAAC;AAShC,WAAS,cAAe,MAAqB;AACnD,UAAM,MAAM,OAAO,IAAI,gBAAiB,IAAK;AAE7C,UAAO,GAAI,IAAI;AAEf,WAAO;EACR;AAWO,WAAS,aAAc,KAAgC;AAC7D,WAAO,MAAO,GAAI;EACnB;AAWO,WAAS,iBAAkB,KAAkC;AACnE,WAAO,aAAc,GAAI,GAAG,KAAK,MAAO,GAAI,EAAG,CAAE;EAClD;AAOO,WAAS,cAAe,KAAoB;AAClD,QAAK,MAAO,GAAI,GAAI;AACnB,aAAO,IAAI,gBAAiB,GAAI;IACjC;AAEA,WAAO,MAAO,GAAI;EACnB;AASO,WAAS,UAAW,KAAmC;AAC7D,QAAK,CAAE,OAAO,CAAE,IAAI,SAAU;AAC7B,aAAO;IACR;AACA,WAAO,IAAI,QAAS,OAAQ,MAAM;EACnC;AAyBO,WAAS,aACf,UACA,SACA,cAAsB,IACf;AACP,QAAK,CAAE,YAAY,CAAE,SAAU;AAC9B;IACD;AAEA,UAAM,OAAO,IAAI,OAAO,KAAM,CAAE,OAAQ,GAAG,EAAE,MAAM,YAAY,CAAE;AACjE,UAAM,MAAM,OAAO,IAAI,gBAAiB,IAAK;AAC7C,UAAM,gBAAgB,SAAS,cAAe,GAAI;AAClD,kBAAc,OAAO;AACrB,kBAAc,WAAW;AACzB,kBAAc,MAAM,UAAU;AAC9B,aAAS,KAAK,YAAa,aAAc;AACzC,kBAAc,MAAM;AACpB,aAAS,KAAK,YAAa,aAAc;AACzC,WAAO,IAAI,gBAAiB,GAAI;EACjC;",
"names": []
}