{"version":3,"sources":["jsdelivr-header.js","/npm/@capacitor/filesystem@8.1.2/dist/esm/definitions.js","/npm/@capacitor/filesystem@8.1.2/dist/esm/index.js","/npm/@capacitor/filesystem@8.1.2/dist/esm/web.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,uFCNW,yBACX,SAAW,GAaP,EAAqB,UAAI,YASzB,EAAgB,KAAI,OASpB,EAAmB,QAAI,UAQvB,EAAiB,MAAI,QAYrB,EAAoB,SAAI,WAYxB,EAA2B,gBAAI,mBAQ/B,EAAyB,cAAI,iBAO7B,EAA0B,eAAI,mBAO9B,EAAqB,UAAI,WAC5B,CAtFD,CAsFG,oBAAc,kBAAY,KAClB,wBACX,SAAW,GAMP,EAAe,KAAI,OAQnB,EAAgB,MAAI,QAQpB,EAAgB,MAAI,OACvB,CAvBD,CAuBG,mBAAa,iBAAW,KAKf,MAAC,oBAAsB,kBAKtB,mBAAqB,iBCxH5B,WAAa,oBAAe,aAAc,CAC5C,IAAK,IAAM,QAAA,UAAA,MAAA,kBAAA,GAAA,IAAgB,MAAM,GAAM,IAAI,EAAE,kBCDjD,SAAS,QAAQ,GACb,MAAM,EAAQ,EAAK,MAAM,KAAK,QAAQ,GAAkB,MAAT,IACzC,EAAW,GASjB,OARA,EAAM,SAAS,IACE,OAAT,GAAiB,EAAS,OAAS,GAAuC,OAAlC,EAAS,EAAS,OAAS,GACnE,EAAS,MAGT,EAAS,KAAK,EAClB,IAEG,EAAS,KAAK,IACzB,CACA,SAAS,aAAa,EAAQ,GAC1B,EAAS,QAAQ,GACjB,EAAW,QAAQ,GACnB,MAAM,EAAS,EAAO,MAAM,KACtB,EAAS,EAAS,MAAM,KAC9B,OAAO,IAAW,GAAY,EAAO,OAAM,CAAC,EAAO,IAAU,IAAU,EAAO,IAClF,CDhBA,wBCiBO,MAAM,sBAAsB,eAC/B,WAAA,GACI,SAAS,WACT,KAAK,WAAa,EAClB,KAAK,QAAU,OACf,KAAK,WAAa,CAAC,M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GAEP,CAEA,MAAM,SAAkB,KAAK,QAAQ,CACjC,KAAM,EACN,UAAW,KACX,MACJ,IAAK,MAAM,KAAY,QAEb,KAAK,MAAM,CACb,KAAM,GAAG,KAAQ,EAAS,OAC1B,GAAI,GAAG,KAAM,EAAS,OACtB,UAAW,EACX,eACD,GAGH,SACM,KAAK,MAAM,CACb,KAAM,EACN,UAAW,GAGvB,EAEJ,MAAO,CACH,IAAK,EAEb,CACA,cAAA,CAAe,GACX,IACI,OAAO,KAAK,KAAK,KAAS,CAC9B,CACA,MAAO,GACH,OAAO,CACX,CACJ,EAEJ,cAAc,QAAS,E","file":"/npm/@capacitor/filesystem@8.1.2/dist/plugin.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@capacitor/filesystem@8.1.2/dist/plugin.cjs.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 var Directory;\n(function (Directory) {\n    /**\n     * The Documents directory.\n     * On iOS it's the app's documents directory.\n     * Use this directory to store user-generated content.\n     * On Android it's the Public Documents folder, so it's accessible from other apps.\n     * It's not accessible on Android 10 unless the app enables legacy External Storage\n     * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n     * in the `AndroidManifest.xml`.\n     * On Android 11 or newer the app can only access the files/folders the app created.\n     *\n     * @since 1.0.0\n     */\n    Directory[\"Documents\"] = \"DOCUMENTS\";\n    /**\n     * The Data directory.\n     * On iOS it will use the Documents directory.\n     * On Android it's the directory holding application files.\n     * Files will be deleted when the application is uninstalled.\n     *\n     * @since 1.0.0\n     */\n    Directory[\"Data\"] = \"DATA\";\n    /**\n     * The Library directory.\n     * On iOS it will use the Library directory.\n     * On Android it's the directory holding application files.\n     * Files will be deleted when the application is uninstalled.\n     *\n     * @since 1.1.0\n     */\n    Directory[\"Library\"] = \"LIBRARY\";\n    /**\n     * The Cache directory.\n     * Can be deleted in cases of low memory, so use this directory to write app-specific files.\n     * that your app can re-create easily.\n     *\n     * @since 1.0.0\n     */\n    Directory[\"Cache\"] = \"CACHE\";\n    /**\n     * The external directory.\n     * On iOS it will use the Documents directory.\n     * On Android it's the directory on the primary shared/external\n     * storage device where the application can place persistent files it owns.\n     * These files are internal to the applications, and not typically visible\n     * to the user as media.\n     * Files will be deleted when the application is uninstalled.\n     *\n     * @since 1.0.0\n     */\n    Directory[\"External\"] = \"EXTERNAL\";\n    /**\n     * The external storage directory.\n     * On iOS it will use the Documents directory.\n     * On Android it's the primary shared/external storage directory.\n     * It's not accessible on Android 10 unless the app enables legacy External Storage\n     * by adding `android:requestLegacyExternalStorage=\"true\"` in the `application` tag\n     * in the `AndroidManifest.xml`.\n     * It's not accessible on Android 11 or newer.\n     *\n     * @since 1.0.0\n     */\n    Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\n    /**\n     * The external cache directory.\n     * On iOS it will use the Documents directory.\n     * On Android it's the primary shared/external cache.\n     *\n     * @since 7.1.0\n     */\n    Directory[\"ExternalCache\"] = \"EXTERNAL_CACHE\";\n    /**\n     * The Library directory without cloud backup. Used in iOS.\n     * On Android it's the directory holding application files.\n     *\n     * @since 7.1.0\n     */\n    Directory[\"LibraryNoCloud\"] = \"LIBRARY_NO_CLOUD\";\n    /**\n     * A temporary directory for iOS.\n     * On Android it's the directory holding the application cache.\n     *\n     * @since 7.1.0\n     */\n    Directory[\"Temporary\"] = \"TEMPORARY\";\n})(Directory || (Directory = {}));\nexport var Encoding;\n(function (Encoding) {\n    /**\n     * Eight-bit UCS Transformation Format\n     *\n     * @since 1.0.0\n     */\n    Encoding[\"UTF8\"] = \"utf8\";\n    /**\n     * Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the\n     * Unicode character set\n     * This encoding is only supported on Android.\n     *\n     * @since 1.0.0\n     */\n    Encoding[\"ASCII\"] = \"ascii\";\n    /**\n     * Sixteen-bit UCS Transformation Format, byte order identified by an\n     * optional byte-order mark\n     * This encoding is only supported on Android.\n     *\n     * @since 1.0.0\n     */\n    Encoding[\"UTF16\"] = \"utf16\";\n})(Encoding || (Encoding = {}));\n/**\n * @deprecated Use `Directory`.\n * @since 1.0.0\n */\nexport const FilesystemDirectory = Directory;\n/**\n * @deprecated Use `Encoding`.\n * @since 1.0.0\n */\nexport const FilesystemEncoding = Encoding;\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nimport { exposeSynapse } from '@capacitor/synapse';\nconst Filesystem = registerPlugin('Filesystem', {\n    web: () => import('./web').then((m) => new m.FilesystemWeb()),\n});\nexposeSynapse();\nexport * from './definitions';\nexport { Filesystem };\n//# sourceMappingURL=index.js.map","import { WebPlugin, buildRequestInit } from '@capacitor/core';\nimport { Encoding } from './definitions';\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        }\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         * Function that performs a http request to a server and downloads the file to the specified destination\n         *\n         * @deprecated Use the @capacitor/file-transfer plugin instead.\n         * @param options the options for the download operation\n         * @returns a promise that resolves with the download file result\n         */\n        this.downloadFile = async (options) => {\n            var _a, _b;\n            const requestInit = buildRequestInit(options, options.webFetchExtra);\n            const response = await fetch(options.url, requestInit);\n            let blob;\n            if (!options.progress)\n                blob = await response.blob();\n            else if (!(response === null || response === void 0 ? void 0 : response.body))\n                blob = new Blob();\n            else {\n                const reader = response.body.getReader();\n                let bytes = 0;\n                const chunks = [];\n                const contentType = response.headers.get('content-type');\n                const contentLength = parseInt(response.headers.get('content-length') || '0', 10);\n                while (true) {\n                    const { done, value } = await reader.read();\n                    if (done)\n                        break;\n                    chunks.push(value);\n                    bytes += (value === null || value === void 0 ? void 0 : value.length) || 0;\n                    const status = {\n                        url: options.url,\n                        bytes,\n                        contentLength,\n                    };\n                    this.notifyListeners('progress', status);\n                }\n                const allChunks = new Uint8Array(bytes);\n                let position = 0;\n                for (const chunk of chunks) {\n                    if (typeof chunk === 'undefined')\n                        continue;\n                    allChunks.set(chunk, position);\n                    position += chunk.length;\n                }\n                blob = new Blob([allChunks.buffer], { type: contentType || undefined });\n            }\n            const result = await this.writeFile({\n                path: options.path,\n                directory: (_a = options.directory) !== null && _a !== void 0 ? _a : undefined,\n                recursive: (_b = options.recursive) !== null && _b !== void 0 ? _b : false,\n                data: blob,\n            });\n            return { path: result.uri, blob };\n        };\n    }\n    readFileInChunks(_options, _callback) {\n        throw this.unavailable('Method not implemented.');\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 && !(data instanceof Blob)) {\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 instanceof Blob ? data.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 instanceof Blob) {\n                throw Error('The occupied entry contains a Blob object which cannot be appended to.');\n            }\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', [IDBKeyRange.only(path)]);\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            name: entry.path.substring(path.length + 1),\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                let encoding;\n                if (!(file.data instanceof Blob) && !this.isBase64String(file.data)) {\n                    encoding = Encoding.UTF8;\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                    encoding: encoding,\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.name}`,\n                        to: `${to}/${filename.name}`,\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//# sourceMappingURL=web.js.map"]}