{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { WebPlugin } from '@capacitor/core';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' && newPosix.length > 0 && newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n } else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return parent !== children && pathsA.every((value, index) => value === pathsB[index]);\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n }\n initDb() {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (_this._db !== undefined) {\n return _this._db;\n }\n if (!('indexedDB' in window)) {\n throw _this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(_this.DB_NAME, _this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n _this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n })();\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default:\n {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', {\n keyPath: 'path'\n });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n dbRequest(cmd, args) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n const readFlag = _this2._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return _this2.initDb().then(conn => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n })();\n }\n dbIndexRequest(indexName, cmd, args) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n const readFlag = _this3._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return _this3.initDb().then(conn => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n })();\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined) fsPath += '/' + directory;\n if (uriPath !== '') fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n clear() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n const conn = yield _this4.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n })();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n readFile(options) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n const path = _this5.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = yield _this5.dbRequest('get', [path]);\n if (entry === undefined) throw Error('File does not exist.');\n return {\n data: entry.content ? entry.content : ''\n };\n })();\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n writeFile(options) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n const path = _this6.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = yield _this6.dbRequest('get', [path]);\n if (occupiedEntry && occupiedEntry.type === 'directory') throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = yield _this6.dbRequest('get', [parentPath]);\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n yield _this6.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive\n });\n }\n }\n if (!encoding) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!_this6.isBase64String(data)) throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: now,\n mtime: now,\n content: data\n };\n yield _this6.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path\n };\n })();\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n appendFile(options) {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n const path = _this7.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = yield _this7.dbRequest('get', [path]);\n if (occupiedEntry && occupiedEntry.type === 'directory') throw Error('The supplied path is a directory.');\n const parentEntry = yield _this7.dbRequest('get', [parentPath]);\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n yield _this7.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true\n });\n }\n }\n if (!encoding && !_this7.isBase64String(data)) throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n } else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data\n };\n yield _this7.dbRequest('put', [pathObj]);\n })();\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n deleteFile(options) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n const path = _this8.getPath(options.directory, options.path);\n const entry = yield _this8.dbRequest('get', [path]);\n if (entry === undefined) throw Error('File does not exist.');\n const entries = yield _this8.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n if (entries.length !== 0) throw Error('Folder is not empty.');\n yield _this8.dbRequest('delete', [path]);\n })();\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n mkdir(options) {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n const path = _this9.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = yield _this9.dbRequest('get', [parentPath]);\n const occupiedEntry = yield _this9.dbRequest('get', [path]);\n if (depth === 1) throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined) throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined) throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n yield _this9.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now\n };\n yield _this9.dbRequest('put', [pathObj]);\n })();\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n rmdir(options) {\n var _this10 = this;\n return _asyncToGenerator(function* () {\n const {\n path,\n directory,\n recursive\n } = options;\n const fullPath = _this10.getPath(directory, path);\n const entry = yield _this10.dbRequest('get', [fullPath]);\n if (entry === undefined) throw Error('Folder does not exist.');\n if (entry.type !== 'directory') throw Error('Requested path is not a directory');\n const readDirResult = yield _this10.readdir({\n path,\n directory\n });\n if (readDirResult.files.length !== 0 && !recursive) throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = yield _this10.stat({\n path: entryPath,\n directory\n });\n if (entryObj.type === 'file') {\n yield _this10.deleteFile({\n path: entryPath,\n directory\n });\n } else {\n yield _this10.rmdir({\n path: entryPath,\n directory,\n recursive\n });\n }\n }\n yield _this10.dbRequest('delete', [fullPath]);\n })();\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n readdir(options) {\n var _this11 = this;\n return _asyncToGenerator(function* () {\n const path = _this11.getPath(options.directory, options.path);\n const entry = yield _this11.dbRequest('get', [path]);\n if (options.path !== '' && entry === undefined) throw Error('Folder does not exist.');\n const entries = yield _this11.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = yield Promise.all(entries.map( /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (e) {\n let subEntry = yield _this11.dbRequest('get', [e]);\n if (subEntry === undefined) {\n subEntry = yield _this11.dbRequest('get', [e + '/']);\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path\n };\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }()));\n return {\n files: files\n };\n })();\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n getUri(options) {\n var _this12 = this;\n return _asyncToGenerator(function* () {\n const path = _this12.getPath(options.directory, options.path);\n let entry = yield _this12.dbRequest('get', [path]);\n if (entry === undefined) {\n entry = yield _this12.dbRequest('get', [path + '/']);\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path\n };\n })();\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n stat(options) {\n var _this13 = this;\n return _asyncToGenerator(function* () {\n const path = _this13.getPath(options.directory, options.path);\n let entry = yield _this13.dbRequest('get', [path]);\n if (entry === undefined) {\n entry = yield _this13.dbRequest('get', [path + '/']);\n }\n if (entry === undefined) throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path\n };\n })();\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n rename(options) {\n var _this14 = this;\n return _asyncToGenerator(function* () {\n yield _this14._copy(options, true);\n return;\n })();\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n copy(options) {\n var _this15 = this;\n return _asyncToGenerator(function* () {\n return _this15._copy(options, false);\n })();\n }\n requestPermissions() {\n return _asyncToGenerator(function* () {\n return {\n publicStorage: 'granted'\n };\n })();\n }\n checkPermissions() {\n return _asyncToGenerator(function* () {\n return {\n publicStorage: 'granted'\n };\n })();\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n _copy(options, doRename = false) {\n var _this16 = this;\n return _asyncToGenerator(function* () {\n let {\n toDirectory\n } = options;\n const {\n to,\n from,\n directory: fromDirectory\n } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = _this16.getPath(fromDirectory, from);\n const toPath = _this16.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = yield _this16.stat({\n path: to,\n directory: toDirectory\n });\n } catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = yield _this16.stat({\n path: toPath,\n directory: toDirectory\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = yield _this16.stat({\n path: from,\n directory: fromDirectory\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (path, ctime, mtime) {\n const fullPath = _this16.getPath(toDirectory, path);\n const entry = yield _this16.dbRequest('get', [fullPath]);\n entry.ctime = ctime;\n entry.mtime = mtime;\n yield _this16.dbRequest('put', [entry]);\n });\n return function updateTime(_x2, _x3, _x4) {\n return _ref2.apply(this, arguments);\n };\n }();\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file':\n {\n // Read the file\n const file = yield _this16.readFile({\n path: from,\n directory: fromDirectory\n });\n // Optionally remove the file\n if (doRename) {\n yield _this16.deleteFile({\n path: from,\n directory: fromDirectory\n });\n }\n // Write the file to the new location\n const writeResult = yield _this16.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n yield updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory':\n {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n yield _this16.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n yield updateTime(to, ctime, fromObj.mtime);\n }\n } catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (yield _this16.readdir({\n path: from,\n directory: fromDirectory\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n yield _this16._copy({\n from: `${from}/${filename}`,\n to: `${to}/${filename}`,\n directory: fromDirectory,\n toDirectory\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n yield _this16.rmdir({\n path: from,\n directory: fromDirectory\n });\n }\n }\n }\n return {\n uri: toPath\n };\n })();\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n } catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;","map":{"version":3,"names":["WebPlugin","resolve","path","posix","split","filter","item","newPosix","forEach","length","pop","push","join","isPathParent","parent","children","pathsA","pathsB","every","value","index","FilesystemWeb","constructor","arguments","DB_VERSION","DB_NAME","_writeCmds","initDb","_this","_asyncToGenerator","_db","undefined","window","unavailable","Promise","reject","request","indexedDB","open","onupgradeneeded","doUpgrade","onsuccess","result","onerror","error","onblocked","console","warn","event","eventTarget","target","db","oldVersion","objectStoreNames","contains","deleteObjectStore","store","createObjectStore","keyPath","createIndex","dbRequest","cmd","args","_this2","readFlag","indexOf","then","conn","tx","transaction","objectStore","req","dbIndexRequest","indexName","_this3","getPath","directory","uriPath","cleanedUriPath","replace","fsPath","clear","_this4","readFile","options","_this5","entry","Error","data","content","writeFile","_this6","encoding","doRecursive","recursive","occupiedEntry","type","parentPath","substr","lastIndexOf","parentEntry","subDirIndex","parentArgPath","mkdir","isBase64String","now","Date","pathObj","folder","size","ctime","mtime","uri","appendFile","_this7","btoa","atob","deleteFile","_this8","entries","IDBKeyRange","only","_this9","depth","match","rmdir","_this10","fullPath","readDirResult","readdir","files","entryPath","name","entryObj","stat","_this11","all","map","_ref","e","subEntry","substring","_x","apply","getUri","_this12","_this13","rename","_this14","_copy","copy","_this15","requestPermissions","publicStorage","checkPermissions","doRename","_this16","toDirectory","to","from","fromDirectory","fromPath","toPath","toObj","toPathComponents","toParentDirectory","fromObj","updateTime","_ref2","_x2","_x3","_x4","file","writeResult","contents","filename","str","err","_debug"],"sources":["C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@capacitor/filesystem/dist/esm/web.js"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\nfunction resolve(path) {\n const posix = path.split('/').filter(item => item !== '.');\n const newPosix = [];\n posix.forEach(item => {\n if (item === '..' &&\n newPosix.length > 0 &&\n newPosix[newPosix.length - 1] !== '..') {\n newPosix.pop();\n }\n else {\n newPosix.push(item);\n }\n });\n return newPosix.join('/');\n}\nfunction isPathParent(parent, children) {\n parent = resolve(parent);\n children = resolve(children);\n const pathsA = parent.split('/');\n const pathsB = children.split('/');\n return (parent !== children &&\n pathsA.every((value, index) => value === pathsB[index]));\n}\nexport class FilesystemWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.DB_VERSION = 1;\n this.DB_NAME = 'Disc';\n this._writeCmds = ['add', 'put', 'delete'];\n }\n async initDb() {\n if (this._db !== undefined) {\n return this._db;\n }\n if (!('indexedDB' in window)) {\n throw this.unavailable(\"This browser doesn't support IndexedDB\");\n }\n return new Promise((resolve, reject) => {\n const request = indexedDB.open(this.DB_NAME, this.DB_VERSION);\n request.onupgradeneeded = FilesystemWeb.doUpgrade;\n request.onsuccess = () => {\n this._db = request.result;\n resolve(request.result);\n };\n request.onerror = () => reject(request.error);\n request.onblocked = () => {\n console.warn('db blocked');\n };\n });\n }\n static doUpgrade(event) {\n const eventTarget = event.target;\n const db = eventTarget.result;\n switch (event.oldVersion) {\n case 0:\n case 1:\n default: {\n if (db.objectStoreNames.contains('FileStorage')) {\n db.deleteObjectStore('FileStorage');\n }\n const store = db.createObjectStore('FileStorage', { keyPath: 'path' });\n store.createIndex('by_folder', 'folder');\n }\n }\n }\n async dbRequest(cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const req = store[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n async dbIndexRequest(indexName, cmd, args) {\n const readFlag = this._writeCmds.indexOf(cmd) !== -1 ? 'readwrite' : 'readonly';\n return this.initDb().then((conn) => {\n return new Promise((resolve, reject) => {\n const tx = conn.transaction(['FileStorage'], readFlag);\n const store = tx.objectStore('FileStorage');\n const index = store.index(indexName);\n const req = index[cmd](...args);\n req.onsuccess = () => resolve(req.result);\n req.onerror = () => reject(req.error);\n });\n });\n }\n getPath(directory, uriPath) {\n const cleanedUriPath = uriPath !== undefined ? uriPath.replace(/^[/]+|[/]+$/g, '') : '';\n let fsPath = '';\n if (directory !== undefined)\n fsPath += '/' + directory;\n if (uriPath !== '')\n fsPath += '/' + cleanedUriPath;\n return fsPath;\n }\n async clear() {\n const conn = await this.initDb();\n const tx = conn.transaction(['FileStorage'], 'readwrite');\n const store = tx.objectStore('FileStorage');\n store.clear();\n }\n /**\n * Read a file from disk\n * @param options options for the file read\n * @return a promise that resolves with the read file data result\n */\n async readFile(options) {\n const path = this.getPath(options.directory, options.path);\n // const encoding = options.encoding;\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n return { data: entry.content ? entry.content : '' };\n }\n /**\n * Write a file to disk in the specified location on device\n * @param options options for the file write\n * @return a promise that resolves with the file write result\n */\n async writeFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const doRecursive = options.recursive;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n }\n if (!encoding) {\n data = data.indexOf(',') >= 0 ? data.split(',')[1] : data;\n if (!this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: now,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n return {\n uri: pathObj.path,\n };\n }\n /**\n * Append to a file on disk in the specified location on device\n * @param options options for the file append\n * @return a promise that resolves with the file write result\n */\n async appendFile(options) {\n const path = this.getPath(options.directory, options.path);\n let data = options.data;\n const encoding = options.encoding;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const now = Date.now();\n let ctime = now;\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (occupiedEntry && occupiedEntry.type === 'directory')\n throw Error('The supplied path is a directory.');\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n if (parentEntry === undefined) {\n const subDirIndex = parentPath.indexOf('/', 1);\n if (subDirIndex !== -1) {\n const parentArgPath = parentPath.substr(subDirIndex);\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: true,\n });\n }\n }\n if (!encoding && !this.isBase64String(data))\n throw Error('The supplied data is not valid base64 content.');\n if (occupiedEntry !== undefined) {\n if (occupiedEntry.content !== undefined && !encoding) {\n data = btoa(atob(occupiedEntry.content) + atob(data));\n }\n else {\n data = occupiedEntry.content + data;\n }\n ctime = occupiedEntry.ctime;\n }\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'file',\n size: data.length,\n ctime: ctime,\n mtime: now,\n content: data,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Delete a file from disk\n * @param options options for the file delete\n * @return a promise that resolves with the deleted file data result\n */\n async deleteFile(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (entry === undefined)\n throw Error('File does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [\n IDBKeyRange.only(path),\n ]);\n if (entries.length !== 0)\n throw Error('Folder is not empty.');\n await this.dbRequest('delete', [path]);\n }\n /**\n * Create a directory.\n * @param options options for the mkdir\n * @return a promise that resolves with the mkdir result\n */\n async mkdir(options) {\n const path = this.getPath(options.directory, options.path);\n const doRecursive = options.recursive;\n const parentPath = path.substr(0, path.lastIndexOf('/'));\n const depth = (path.match(/\\//g) || []).length;\n const parentEntry = (await this.dbRequest('get', [parentPath]));\n const occupiedEntry = (await this.dbRequest('get', [path]));\n if (depth === 1)\n throw Error('Cannot create Root directory');\n if (occupiedEntry !== undefined)\n throw Error('Current directory does already exist.');\n if (!doRecursive && depth !== 2 && parentEntry === undefined)\n throw Error('Parent directory must exist');\n if (doRecursive && depth !== 2 && parentEntry === undefined) {\n const parentArgPath = parentPath.substr(parentPath.indexOf('/', 1));\n await this.mkdir({\n path: parentArgPath,\n directory: options.directory,\n recursive: doRecursive,\n });\n }\n const now = Date.now();\n const pathObj = {\n path: path,\n folder: parentPath,\n type: 'directory',\n size: 0,\n ctime: now,\n mtime: now,\n };\n await this.dbRequest('put', [pathObj]);\n }\n /**\n * Remove a directory\n * @param options the options for the directory remove\n */\n async rmdir(options) {\n const { path, directory, recursive } = options;\n const fullPath = this.getPath(directory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n if (entry === undefined)\n throw Error('Folder does not exist.');\n if (entry.type !== 'directory')\n throw Error('Requested path is not a directory');\n const readDirResult = await this.readdir({ path, directory });\n if (readDirResult.files.length !== 0 && !recursive)\n throw Error('Folder is not empty');\n for (const entry of readDirResult.files) {\n const entryPath = `${path}/${entry.name}`;\n const entryObj = await this.stat({ path: entryPath, directory });\n if (entryObj.type === 'file') {\n await this.deleteFile({ path: entryPath, directory });\n }\n else {\n await this.rmdir({ path: entryPath, directory, recursive });\n }\n }\n await this.dbRequest('delete', [fullPath]);\n }\n /**\n * Return a list of files from the directory (not recursive)\n * @param options the options for the readdir operation\n * @return a promise that resolves with the readdir directory listing result\n */\n async readdir(options) {\n const path = this.getPath(options.directory, options.path);\n const entry = (await this.dbRequest('get', [path]));\n if (options.path !== '' && entry === undefined)\n throw Error('Folder does not exist.');\n const entries = await this.dbIndexRequest('by_folder', 'getAllKeys', [IDBKeyRange.only(path)]);\n const files = await Promise.all(entries.map(async (e) => {\n let subEntry = (await this.dbRequest('get', [e]));\n if (subEntry === undefined) {\n subEntry = (await this.dbRequest('get', [e + '/']));\n }\n return {\n name: e.substring(path.length + 1),\n type: subEntry.type,\n size: subEntry.size,\n ctime: subEntry.ctime,\n mtime: subEntry.mtime,\n uri: subEntry.path,\n };\n }));\n return { files: files };\n }\n /**\n * Return full File URI for a path and directory\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async getUri(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n return {\n uri: (entry === null || entry === void 0 ? void 0 : entry.path) || path,\n };\n }\n /**\n * Return data about a file\n * @param options the options for the stat operation\n * @return a promise that resolves with the file stat result\n */\n async stat(options) {\n const path = this.getPath(options.directory, options.path);\n let entry = (await this.dbRequest('get', [path]));\n if (entry === undefined) {\n entry = (await this.dbRequest('get', [path + '/']));\n }\n if (entry === undefined)\n throw Error('Entry does not exist.');\n return {\n type: entry.type,\n size: entry.size,\n ctime: entry.ctime,\n mtime: entry.mtime,\n uri: entry.path,\n };\n }\n /**\n * Rename a file or directory\n * @param options the options for the rename operation\n * @return a promise that resolves with the rename result\n */\n async rename(options) {\n await this._copy(options, true);\n return;\n }\n /**\n * Copy a file or directory\n * @param options the options for the copy operation\n * @return a promise that resolves with the copy result\n */\n async copy(options) {\n return this._copy(options, false);\n }\n async requestPermissions() {\n return { publicStorage: 'granted' };\n }\n async checkPermissions() {\n return { publicStorage: 'granted' };\n }\n /**\n * Function that can perform a copy or a rename\n * @param options the options for the rename operation\n * @param doRename whether to perform a rename or copy operation\n * @return a promise that resolves with the result\n */\n async _copy(options, doRename = false) {\n let { toDirectory } = options;\n const { to, from, directory: fromDirectory } = options;\n if (!to || !from) {\n throw Error('Both to and from must be provided');\n }\n // If no \"to\" directory is provided, use the \"from\" directory\n if (!toDirectory) {\n toDirectory = fromDirectory;\n }\n const fromPath = this.getPath(fromDirectory, from);\n const toPath = this.getPath(toDirectory, to);\n // Test that the \"to\" and \"from\" locations are different\n if (fromPath === toPath) {\n return {\n uri: toPath,\n };\n }\n if (isPathParent(fromPath, toPath)) {\n throw Error('To path cannot contain the from path');\n }\n // Check the state of the \"to\" location\n let toObj;\n try {\n toObj = await this.stat({\n path: to,\n directory: toDirectory,\n });\n }\n catch (e) {\n // To location does not exist, ensure the directory containing \"to\" location exists and is a directory\n const toPathComponents = to.split('/');\n toPathComponents.pop();\n const toPath = toPathComponents.join('/');\n // Check the containing directory of the \"to\" location exists\n if (toPathComponents.length > 0) {\n const toParentDirectory = await this.stat({\n path: toPath,\n directory: toDirectory,\n });\n if (toParentDirectory.type !== 'directory') {\n throw new Error('Parent directory of the to path is a file');\n }\n }\n }\n // Cannot overwrite a directory\n if (toObj && toObj.type === 'directory') {\n throw new Error('Cannot overwrite a directory with a file');\n }\n // Ensure the \"from\" object exists\n const fromObj = await this.stat({\n path: from,\n directory: fromDirectory,\n });\n // Set the mtime/ctime of the supplied path\n const updateTime = async (path, ctime, mtime) => {\n const fullPath = this.getPath(toDirectory, path);\n const entry = (await this.dbRequest('get', [fullPath]));\n entry.ctime = ctime;\n entry.mtime = mtime;\n await this.dbRequest('put', [entry]);\n };\n const ctime = fromObj.ctime ? fromObj.ctime : Date.now();\n switch (fromObj.type) {\n // The \"from\" object is a file\n case 'file': {\n // Read the file\n const file = await this.readFile({\n path: from,\n directory: fromDirectory,\n });\n // Optionally remove the file\n if (doRename) {\n await this.deleteFile({\n path: from,\n directory: fromDirectory,\n });\n }\n // Write the file to the new location\n const writeResult = await this.writeFile({\n path: to,\n directory: toDirectory,\n data: file.data,\n });\n // Copy the mtime/ctime of a renamed file\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n // Resolve promise\n return writeResult;\n }\n case 'directory': {\n if (toObj) {\n throw Error('Cannot move a directory over an existing object');\n }\n try {\n // Create the to directory\n await this.mkdir({\n path: to,\n directory: toDirectory,\n recursive: false,\n });\n // Copy the mtime/ctime of a renamed directory\n if (doRename) {\n await updateTime(to, ctime, fromObj.mtime);\n }\n }\n catch (e) {\n // ignore\n }\n // Iterate over the contents of the from location\n const contents = (await this.readdir({\n path: from,\n directory: fromDirectory,\n })).files;\n for (const filename of contents) {\n // Move item from the from directory to the to directory\n await this._copy({\n from: `${from}/${filename}`,\n to: `${to}/${filename}`,\n directory: fromDirectory,\n toDirectory,\n }, doRename);\n }\n // Optionally remove the original from directory\n if (doRename) {\n await this.rmdir({\n path: from,\n directory: fromDirectory,\n });\n }\n }\n }\n return {\n uri: toPath,\n };\n }\n isBase64String(str) {\n try {\n return btoa(atob(str)) == str;\n }\n catch (err) {\n return false;\n }\n }\n}\nFilesystemWeb._debug = true;\n"],"mappings":";AAAA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAOA,CAACC,IAAI,EAAE;EACnB,MAAMC,KAAK,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAACC,IAAI,IAAIA,IAAI,KAAK,GAAG,CAAC;EAC1D,MAAMC,QAAQ,GAAG,EAAE;EACnBJ,KAAK,CAACK,OAAO,CAACF,IAAI,IAAI;IAClB,IAAIA,IAAI,KAAK,IAAI,IACbC,QAAQ,CAACE,MAAM,GAAG,CAAC,IACnBF,QAAQ,CAACA,QAAQ,CAACE,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE;MACxCF,QAAQ,CAACG,GAAG,CAAC,CAAC;IAClB,CAAC,MACI;MACDH,QAAQ,CAACI,IAAI,CAACL,IAAI,CAAC;IACvB;EACJ,CAAC,CAAC;EACF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