{"version":3,"sources":["./node_modules/@capacitor/filesystem/dist/esm/web.js","./node_modules/@capacitor/device/dist/esm/web.js","./node_modules/@capacitor/filesystem/dist/esm/definitions.js","./node_modules/capacitor-native-biometric/dist/esm/web.js","./node_modules/@capacitor/share/dist/esm/web.js","./node_modules/@capacitor/app/dist/esm/web.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAA8D;AACrB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,4BAA4B,yDAAS;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,wEAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,iCAAiC;AACtF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,kBAAkB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,kBAAkB;AACpE;AACA;AACA;AACA,iCAAiC,KAAK,GAAG,WAAW;AACpD,8CAA8C,6BAA6B;AAC3E;AACA,uCAAuC,6BAA6B;AACpE;AACA;AACA,kCAAkC,wCAAwC;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,cAAc;AAC3B,eAAe,qCAAqC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,+BAA+B,qDAAQ;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iCAAiC,KAAK,GAAG,cAAc;AACvD,+BAA+B,GAAG,GAAG,cAAc;AACnD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+B;;;;;;;;;;;;ACnlBA;AAAA;AAAA;AAA4C;AACrC,wBAAwB,yDAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+B;;;;;;;;;;;;ACxKA;AAAA;AAAA;AAAA;AAAA;AAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,8BAA8B;AACxB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,4BAA4B;AAC7B;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP,uC;;;;;;;;;;;;ACrGA;AAAA;AAAA;AAA4C;AACrC,iCAAiC,yDAAS;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+B;;;;;;;;;;;;ACrBA;AAAA;AAAA;AAA4C;AACrC,uBAAuB,yDAAS;AACvC;AACA;AACA,oBAAoB;AACpB;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,+B;;;;;;;;;;;;ACtBA;AAAA;AAAA;AAA4C;AACrC,qBAAqB,yDAAS;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,+B","file":"web.47c3385cbd2f0c49af38.js","sourcesContent":["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 === '..' &&\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 * Function that performs a http request to a server and downloads the file to the specified destination\n *\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 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', [\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 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","import { WebPlugin } from '@capacitor/core';\nexport class DeviceWeb extends WebPlugin {\n async getId() {\n return {\n identifier: this.getUid(),\n };\n }\n async getInfo() {\n if (typeof navigator === 'undefined' || !navigator.userAgent) {\n throw this.unavailable('Device API not available in this browser');\n }\n const ua = navigator.userAgent;\n const uaFields = this.parseUa(ua);\n return {\n model: uaFields.model,\n platform: 'web',\n operatingSystem: uaFields.operatingSystem,\n osVersion: uaFields.osVersion,\n manufacturer: navigator.vendor,\n isVirtual: false,\n webViewVersion: uaFields.browserVersion,\n };\n }\n async getBatteryInfo() {\n if (typeof navigator === 'undefined' || !navigator.getBattery) {\n throw this.unavailable('Device API not available in this browser');\n }\n let battery = {};\n try {\n battery = await navigator.getBattery();\n }\n catch (e) {\n // Let it fail, we don't care\n }\n return {\n batteryLevel: battery.level,\n isCharging: battery.charging,\n };\n }\n async getLanguageCode() {\n return {\n value: navigator.language.split('-')[0].toLowerCase(),\n };\n }\n async getLanguageTag() {\n return {\n value: navigator.language,\n };\n }\n parseUa(ua) {\n const uaFields = {};\n const start = ua.indexOf('(') + 1;\n let end = ua.indexOf(') AppleWebKit');\n if (ua.indexOf(') Gecko') !== -1) {\n end = ua.indexOf(') Gecko');\n }\n const fields = ua.substring(start, end);\n if (ua.indexOf('Android') !== -1) {\n const tmpFields = fields.replace('; wv', '').split('; ').pop();\n if (tmpFields) {\n uaFields.model = tmpFields.split(' Build')[0];\n }\n uaFields.osVersion = fields.split('; ')[1];\n }\n else {\n uaFields.model = fields.split('; ')[0];\n if (typeof navigator !== 'undefined' && navigator.oscpu) {\n uaFields.osVersion = navigator.oscpu;\n }\n else {\n if (ua.indexOf('Windows') !== -1) {\n uaFields.osVersion = fields;\n }\n else {\n const tmpFields = fields.split('; ').pop();\n if (tmpFields) {\n const lastParts = tmpFields\n .replace(' like Mac OS X', '')\n .split(' ');\n uaFields.osVersion = lastParts[lastParts.length - 1].replace(/_/g, '.');\n }\n }\n }\n }\n if (/android/i.test(ua)) {\n uaFields.operatingSystem = 'android';\n }\n else if (/iPad|iPhone|iPod/.test(ua) && !window.MSStream) {\n uaFields.operatingSystem = 'ios';\n }\n else if (/Win/.test(ua)) {\n uaFields.operatingSystem = 'windows';\n }\n else if (/Mac/i.test(ua)) {\n uaFields.operatingSystem = 'mac';\n }\n else {\n uaFields.operatingSystem = 'unknown';\n }\n // Check for browsers based on non-standard javascript apis, only not user agent\n const isSafari = !!window.ApplePaySession;\n const isChrome = !!window.chrome;\n const isFirefox = /Firefox/.test(ua);\n const isEdge = /Edg/.test(ua);\n const isFirefoxIOS = /FxiOS/.test(ua);\n const isChromeIOS = /CriOS/.test(ua);\n const isEdgeIOS = /EdgiOS/.test(ua);\n // FF and Edge User Agents both end with \"/MAJOR.MINOR\"\n if (isSafari ||\n (isChrome && !isEdge) ||\n isFirefoxIOS ||\n isChromeIOS ||\n isEdgeIOS) {\n // Safari version comes as \"... Version/MAJOR.MINOR ...\"\n // Chrome version comes as \"... Chrome/MAJOR.MINOR ...\"\n // FirefoxIOS version comes as \"... FxiOS/MAJOR.MINOR ...\"\n // ChromeIOS version comes as \"... CriOS/MAJOR.MINOR ...\"\n let searchWord;\n if (isFirefoxIOS) {\n searchWord = 'FxiOS';\n }\n else if (isChromeIOS) {\n searchWord = 'CriOS';\n }\n else if (isEdgeIOS) {\n searchWord = 'EdgiOS';\n }\n else if (isSafari) {\n searchWord = 'Version';\n }\n else {\n searchWord = 'Chrome';\n }\n const words = ua.split(' ');\n for (const word of words) {\n if (word.includes(searchWord)) {\n const version = word.split('/')[1];\n uaFields.browserVersion = version;\n }\n }\n }\n else if (isFirefox || isEdge) {\n const reverseUA = ua.split('').reverse().join('');\n const reverseVersion = reverseUA.split('/')[0];\n const version = reverseVersion.split('').reverse().join('');\n uaFields.browserVersion = version;\n }\n return uaFields;\n }\n getUid() {\n if (typeof window !== 'undefined' && window.localStorage) {\n let uid = window.localStorage.getItem('_capuid');\n if (uid) {\n return uid;\n }\n uid = this.uuid4();\n window.localStorage.setItem('_capuid', uid);\n return uid;\n }\n return this.uuid4();\n }\n uuid4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }\n}\n//# sourceMappingURL=web.js.map","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 accesible 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 accesible 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 accesible on Android 11 or newer.\n *\n * @since 1.0.0\n */\n Directory[\"ExternalStorage\"] = \"EXTERNAL_STORAGE\";\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 { WebPlugin } from \"@capacitor/core\";\nexport class NativeBiometricWeb extends WebPlugin {\n constructor() {\n super();\n }\n isAvailable() {\n throw new Error(\"Method not implemented.\");\n }\n verifyIdentity(_options) {\n throw new Error(\"Method not implemented.\");\n }\n getCredentials(_options) {\n throw new Error(\"Method not implemented.\");\n }\n setCredentials(_options) {\n throw new Error(\"Method not implemented.\");\n }\n deleteCredentials(_options) {\n throw new Error(\"Method not implemented.\");\n }\n}\n//# sourceMappingURL=web.js.map","import { WebPlugin } from '@capacitor/core';\nexport class ShareWeb extends WebPlugin {\n async canShare() {\n if (typeof navigator === 'undefined' || !navigator.share) {\n return { value: false };\n }\n else {\n return { value: true };\n }\n }\n async share(options) {\n if (typeof navigator === 'undefined' || !navigator.share) {\n throw this.unavailable('Share API not available in this browser');\n }\n await navigator.share({\n title: options.title,\n text: options.text,\n url: options.url,\n });\n return {};\n }\n}\n//# sourceMappingURL=web.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppWeb extends WebPlugin {\n constructor() {\n super();\n this.handleVisibilityChange = () => {\n const data = {\n isActive: document.hidden !== true,\n };\n this.notifyListeners('appStateChange', data);\n if (document.hidden) {\n this.notifyListeners('pause', null);\n }\n else {\n this.notifyListeners('resume', null);\n }\n };\n document.addEventListener('visibilitychange', this.handleVisibilityChange, false);\n }\n exitApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getLaunchUrl() {\n return { url: '' };\n }\n async getState() {\n return { isActive: document.hidden !== true };\n }\n async minimizeApp() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"sourceRoot":"webpack:///"}