1 |
- {"ast":null,"code":"\"use strict\";\n\nvar _asyncToGenerator = require(\"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js\").default;\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _isArray = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/array/is-array\"));\nvar _slice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/slice\"));\nvar _forEach = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/for-each\"));\nvar _keys = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/keys\"));\nvar _promise = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/promise\"));\nvar _indexOf = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/index-of\"));\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/helpers/defineProperty\"));\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _Xhr = _interopRequireDefault(require(\"./Xhr.weapp\"));\n/* global XMLHttpRequest, Blob */\n\nlet XHR = null;\nif (typeof XMLHttpRequest !== 'undefined') {\n XHR = XMLHttpRequest;\n}\nfunction b64Digit(number) {\n if (number < 26) {\n return String.fromCharCode(65 + number);\n }\n if (number < 52) {\n return String.fromCharCode(97 + (number - 26));\n }\n if (number < 62) {\n return String.fromCharCode(48 + (number - 52));\n }\n if (number === 62) {\n return '+';\n }\n if (number === 63) {\n return '/';\n }\n throw new TypeError('Tried to encode large digit ' + number + ' in base64.');\n}\n\n/**\n * A Parse.File is a local representation of a file that is saved to the Parse\n * cloud.\n *\n * @alias Parse.File\n */\nclass ParseFile {\n /**\n * @param name {String} The file's name. This will be prefixed by a unique\n * value once the file has finished saving. The file name must begin with\n * an alphanumeric character, and consist of alphanumeric characters,\n * periods, spaces, underscores, or dashes.\n * @param data {Array} The data for the file, as either:\n * 1. an Array of byte value Numbers, or\n * 2. an Object like { base64: \"...\" } with a base64-encoded String.\n * 3. an Object like { uri: \"...\" } with a uri String.\n * 4. a File object selected with a file upload control. (3) only works\n * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.\n * For example:\n * <pre>\n * var fileUploadControl = $(\"#profilePhotoFileUpload\")[0];\n * if (fileUploadControl.files.length > 0) {\n * var file = fileUploadControl.files[0];\n * var name = \"photo.jpg\";\n * var parseFile = new Parse.File(name, file);\n * parseFile.save().then(function() {\n * // The file has been saved to Parse.\n * }, function(error) {\n * // The file either could not be read, or could not be saved to Parse.\n * });\n * }</pre>\n * @param type {String} Optional Content-Type header to use for the file. If\n * this is omitted, the content type will be inferred from the name's\n * extension.\n * @param metadata {object} Optional key value pairs to be stored with file object\n * @param tags {object} Optional key value pairs to be stored with file object\n */\n constructor(name, data, type, metadata, tags) {\n (0, _defineProperty2.default)(this, \"_name\", void 0);\n (0, _defineProperty2.default)(this, \"_url\", void 0);\n (0, _defineProperty2.default)(this, \"_source\", void 0);\n (0, _defineProperty2.default)(this, \"_previousSave\", void 0);\n (0, _defineProperty2.default)(this, \"_data\", void 0);\n (0, _defineProperty2.default)(this, \"_requestTask\", void 0);\n (0, _defineProperty2.default)(this, \"_metadata\", void 0);\n (0, _defineProperty2.default)(this, \"_tags\", void 0);\n const specifiedType = type || '';\n this._name = name;\n this._metadata = metadata || {};\n this._tags = tags || {};\n if (data !== undefined) {\n if ((0, _isArray.default)(data)) {\n this._data = ParseFile.encodeBase64(data);\n this._source = {\n format: 'base64',\n base64: this._data,\n type: specifiedType\n };\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n this._source = {\n format: 'file',\n file: data,\n type: specifiedType\n };\n } else if (data && typeof data.uri === 'string' && data.uri !== undefined) {\n this._source = {\n format: 'uri',\n uri: data.uri,\n type: specifiedType\n };\n } else if (data && typeof data.base64 === 'string') {\n var _context, _context2, _context3;\n const base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];\n const dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';\n this._data = base64;\n this._source = {\n format: 'base64',\n base64,\n type: dataType\n };\n } else {\n throw new TypeError('Cannot create a Parse.File with that data.');\n }\n }\n }\n\n /**\n * Return the data for the file, downloading it if not already present.\n * Data is present if initialized with Byte Array, Base64 or Saved with Uri.\n * Data is cleared if saved with File object selected with a file upload control\n *\n * @returns {Promise} Promise that is resolve with base64 data\n */\n getData() {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (_this._data) {\n return _this._data;\n }\n if (!_this._url) {\n throw new Error('Cannot retrieve data for unsaved ParseFile.');\n }\n const controller = _CoreManager.default.getFileController();\n const result = yield controller.download(_this._url, {\n requestTask: task => _this._requestTask = task\n });\n _this._data = result.base64;\n return _this._data;\n })();\n }\n\n /**\n * Gets the name of the file. Before save is called, this is the filename\n * given by the user. After save is called, that name gets prefixed with a\n * unique identifier.\n *\n * @returns {string}\n */\n name() {\n return this._name;\n }\n\n /**\n * Gets the url of the file. It is only available after you save the file or\n * after you get the file from a Parse.Object.\n *\n * @param {object} options An object to specify url options\n * @param {boolean} [options.forceSecure] force the url to be secure\n * @returns {string | undefined}\n */\n url(options) {\n options = options || {};\n if (!this._url) {\n return;\n }\n if (options.forceSecure) {\n return this._url.replace(/^http:\\/\\//i, 'https://');\n } else {\n return this._url;\n }\n }\n\n /**\n * Gets the metadata of the file.\n *\n * @returns {object}\n */\n metadata() {\n return this._metadata;\n }\n\n /**\n * Gets the tags of the file.\n *\n * @returns {object}\n */\n tags() {\n return this._tags;\n }\n\n /**\n * Saves the file to the Parse cloud.\n *\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>progress: In Browser only, callback for upload progress. For example:\n * <pre>\n * let parseFile = new Parse.File(name, file);\n * parseFile.save({\n * progress: (progressValue, loaded, total, { type }) => {\n * if (type === \"upload\" && progressValue !== null) {\n * // Update the UI using progressValue\n * }\n * }\n * });\n * </pre>\n * </ul>\n * @returns {Promise | undefined} Promise that is resolved when the save finishes.\n */\n save(options) {\n options = options || {};\n options.requestTask = task => this._requestTask = task;\n options.metadata = this._metadata;\n options.tags = this._tags;\n const controller = _CoreManager.default.getFileController();\n if (!this._previousSave) {\n if (this._source.format === 'file') {\n this._previousSave = controller.saveFile(this._name, this._source, options).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._data = null;\n this._requestTask = null;\n return this;\n });\n } else if (this._source.format === 'uri') {\n this._previousSave = controller.download(this._source.uri, options).then(result => {\n if (!(result && result.base64)) {\n return {};\n }\n const newSource = {\n format: 'base64',\n base64: result.base64,\n type: result.contentType\n };\n this._data = result.base64;\n this._requestTask = null;\n return controller.saveBase64(this._name, newSource, options);\n }).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._requestTask = null;\n return this;\n });\n } else {\n this._previousSave = controller.saveBase64(this._name, this._source, options).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._requestTask = null;\n return this;\n });\n }\n }\n if (this._previousSave) {\n return this._previousSave;\n }\n }\n\n /**\n * Aborts the request if it has already been sent.\n */\n cancel() {\n if (this._requestTask && typeof this._requestTask.abort === 'function') {\n this._requestTask._aborted = true;\n this._requestTask.abort();\n }\n this._requestTask = null;\n }\n\n /**\n * Deletes the file from the Parse cloud.\n * In Cloud Code and Node only with Master Key.\n *\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <pre>\n * @returns {Promise} Promise that is resolved when the delete finishes.\n */\n destroy() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!this._name) {\n throw new _ParseError.default(_ParseError.default.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');\n }\n const destroyOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('useMasterKey')) {\n destroyOptions.useMasterKey = !!options.useMasterKey;\n }\n const controller = _CoreManager.default.getFileController();\n return controller.deleteFile(this._name, destroyOptions).then(() => {\n this._data = undefined;\n this._requestTask = null;\n return this;\n });\n }\n toJSON() {\n return {\n __type: 'File',\n name: this._name,\n url: this._url\n };\n }\n equals(other) {\n if (this === other) {\n return true;\n }\n // Unsaved Files are never equal, since they will be saved to different URLs\n return other instanceof ParseFile && this.name() === other.name() && this.url() === other.url() && typeof this.url() !== 'undefined';\n }\n\n /**\n * Sets metadata to be saved with file object. Overwrites existing metadata\n *\n * @param {object} metadata Key value pairs to be stored with file object\n */\n setMetadata(metadata) {\n if (metadata && typeof metadata === 'object') {\n var _context4;\n (0, _forEach.default)(_context4 = (0, _keys.default)(metadata)).call(_context4, key => {\n this.addMetadata(key, metadata[key]);\n });\n }\n }\n\n /**\n * Sets metadata to be saved with file object. Adds to existing metadata.\n *\n * @param {string} key key to store the metadata\n * @param {*} value metadata\n */\n addMetadata(key, value) {\n if (typeof key === 'string') {\n this._metadata[key] = value;\n }\n }\n\n /**\n * Sets tags to be saved with file object. Overwrites existing tags\n *\n * @param {object} tags Key value pairs to be stored with file object\n */\n setTags(tags) {\n if (tags && typeof tags === 'object') {\n var _context5;\n (0, _forEach.default)(_context5 = (0, _keys.default)(tags)).call(_context5, key => {\n this.addTag(key, tags[key]);\n });\n }\n }\n\n /**\n * Sets tags to be saved with file object. Adds to existing tags.\n *\n * @param {string} key key to store tags\n * @param {*} value tag\n */\n addTag(key, value) {\n if (typeof key === 'string') {\n this._tags[key] = value;\n }\n }\n static fromJSON(obj) {\n if (obj.__type !== 'File') {\n throw new TypeError('JSON object does not represent a ParseFile');\n }\n const file = new ParseFile(obj.name);\n file._url = obj.url;\n return file;\n }\n static encodeBase64(bytes) {\n const chunks = [];\n chunks.length = Math.ceil(bytes.length / 3);\n for (let i = 0; i < chunks.length; i++) {\n const b1 = bytes[i * 3];\n const b2 = bytes[i * 3 + 1] || 0;\n const b3 = bytes[i * 3 + 2] || 0;\n const has2 = i * 3 + 1 < bytes.length;\n const has3 = i * 3 + 2 < bytes.length;\n chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');\n }\n return chunks.join('');\n }\n}\nconst DefaultController = {\n saveFile: function () {\n var _ref = _asyncToGenerator(function* (name, source, options) {\n if (source.format !== 'file') {\n throw new Error('saveFile can only be used with File-type sources.');\n }\n const base64Data = yield new _promise.default((res, rej) => {\n // eslint-disable-next-line no-undef\n const reader = new FileReader();\n reader.onload = () => res(reader.result);\n reader.onerror = error => rej(error);\n reader.readAsDataURL(source.file);\n });\n // we only want the data after the comma\n // For example: \"data:application/pdf;base64,JVBERi0xLjQKJ...\" we would only want \"JVBERi0xLjQKJ...\"\n const [first, second] = base64Data.split(',');\n // in the event there is no 'data:application/pdf;base64,' at the beginning of the base64 string\n // use the entire string instead\n const data = second ? second : first;\n const newSource = {\n format: 'base64',\n base64: data,\n type: source.type || (source.file ? source.file.type : undefined)\n };\n return yield DefaultController.saveBase64(name, newSource, options);\n });\n return function saveFile(_x, _x2, _x3) {\n return _ref.apply(this, arguments);\n };\n }(),\n saveBase64: function (name, source) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (source.format !== 'base64') {\n throw new Error('saveBase64 can only be used with Base64-type sources.');\n }\n const data = {\n base64: source.base64,\n fileData: {\n metadata: {\n ...options.metadata\n },\n tags: {\n ...options.tags\n }\n }\n };\n delete options.metadata;\n delete options.tags;\n if (source.type) {\n data._ContentType = source.type;\n }\n return _CoreManager.default.getRESTController().request('POST', 'files/' + name, data, options);\n },\n download: function (uri, options) {\n if (XHR) {\n return this.downloadAjax(uri, options);\n } else {\n return _promise.default.reject('Cannot make a request: No definition of XMLHttpRequest was found.');\n }\n },\n downloadAjax: function (uri, options) {\n return new _promise.default((resolve, reject) => {\n const xhr = new XHR();\n xhr.open('GET', uri, true);\n xhr.responseType = 'arraybuffer';\n xhr.onerror = function (e) {\n reject(e);\n };\n xhr.onreadystatechange = function () {\n if (xhr.readyState !== xhr.DONE) {\n return;\n }\n if (!this.response) {\n return resolve({});\n }\n const bytes = new Uint8Array(this.response);\n resolve({\n base64: ParseFile.encodeBase64(bytes),\n contentType: xhr.getResponseHeader('content-type')\n });\n };\n options.requestTask(xhr);\n xhr.send();\n });\n },\n deleteFile: function (name, options) {\n const headers = {\n 'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')\n };\n if (options.useMasterKey) {\n headers['X-Parse-Master-Key'] = _CoreManager.default.get('MASTER_KEY');\n }\n let url = _CoreManager.default.get('SERVER_URL');\n if (url[url.length - 1] !== '/') {\n url += '/';\n }\n url += 'files/' + name;\n return _CoreManager.default.getRESTController().ajax('DELETE', url, '', headers).catch(response => {\n // TODO: return JSON object in server\n if (!response || response === 'SyntaxError: Unexpected end of JSON input') {\n return _promise.default.resolve();\n } else {\n return _CoreManager.default.getRESTController().handleError(response);\n }\n });\n },\n _setXHR(xhr) {\n XHR = xhr;\n },\n _getXHR() {\n return XHR;\n }\n};\n_CoreManager.default.setFileController(DefaultController);\nvar _default = exports.default = ParseFile;\nexports.b64Digit = b64Digit;","map":{"version":3,"names":["_asyncToGenerator","require","default","_Object$defineProperty","_interopRequireDefault","exports","value","_isArray","_slice","_forEach","_keys","_promise","_indexOf","_defineProperty2","_CoreManager","_ParseError","_Xhr","XHR","XMLHttpRequest","b64Digit","number","String","fromCharCode","TypeError","ParseFile","constructor","name","data","type","metadata","tags","specifiedType","_name","_metadata","_tags","undefined","_data","encodeBase64","_source","format","base64","Blob","file","uri","_context","_context2","_context3","split","call","dataType","getData","_this","_url","Error","controller","getFileController","result","download","requestTask","task","_requestTask","url","options","forceSecure","replace","save","_previousSave","saveFile","then","res","newSource","contentType","saveBase64","cancel","abort","_aborted","destroy","arguments","length","FILE_DELETE_UNNAMED_ERROR","destroyOptions","useMasterKey","hasOwnProperty","deleteFile","toJSON","__type","equals","other","setMetadata","_context4","key","addMetadata","setTags","_context5","addTag","fromJSON","obj","bytes","chunks","Math","ceil","i","b1","b2","b3","has2","has3","join","DefaultController","_ref","source","base64Data","rej","reader","FileReader","onload","onerror","error","readAsDataURL","first","second","_x","_x2","_x3","apply","fileData","_ContentType","getRESTController","request","downloadAjax","reject","resolve","xhr","open","responseType","e","onreadystatechange","readyState","DONE","response","Uint8Array","getResponseHeader","send","headers","get","ajax","catch","handleError","_setXHR","_getXHR","setFileController","_default"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/parse/lib/browser/ParseFile.js"],"sourcesContent":["\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _isArray = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/array/is-array\"));\nvar _slice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/slice\"));\nvar _forEach = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/for-each\"));\nvar _keys = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/keys\"));\nvar _promise = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/promise\"));\nvar _indexOf = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/index-of\"));\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/helpers/defineProperty\"));\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _Xhr = _interopRequireDefault(require(\"./Xhr.weapp\"));\n/* global XMLHttpRequest, Blob */\n\nlet XHR = null;\nif (typeof XMLHttpRequest !== 'undefined') {\n XHR = XMLHttpRequest;\n}\nfunction b64Digit(number) {\n if (number < 26) {\n return String.fromCharCode(65 + number);\n }\n if (number < 52) {\n return String.fromCharCode(97 + (number - 26));\n }\n if (number < 62) {\n return String.fromCharCode(48 + (number - 52));\n }\n if (number === 62) {\n return '+';\n }\n if (number === 63) {\n return '/';\n }\n throw new TypeError('Tried to encode large digit ' + number + ' in base64.');\n}\n\n/**\n * A Parse.File is a local representation of a file that is saved to the Parse\n * cloud.\n *\n * @alias Parse.File\n */\nclass ParseFile {\n /**\n * @param name {String} The file's name. This will be prefixed by a unique\n * value once the file has finished saving. The file name must begin with\n * an alphanumeric character, and consist of alphanumeric characters,\n * periods, spaces, underscores, or dashes.\n * @param data {Array} The data for the file, as either:\n * 1. an Array of byte value Numbers, or\n * 2. an Object like { base64: \"...\" } with a base64-encoded String.\n * 3. an Object like { uri: \"...\" } with a uri String.\n * 4. a File object selected with a file upload control. (3) only works\n * in Firefox 3.6+, Safari 6.0.2+, Chrome 7+, and IE 10+.\n * For example:\n * <pre>\n * var fileUploadControl = $(\"#profilePhotoFileUpload\")[0];\n * if (fileUploadControl.files.length > 0) {\n * var file = fileUploadControl.files[0];\n * var name = \"photo.jpg\";\n * var parseFile = new Parse.File(name, file);\n * parseFile.save().then(function() {\n * // The file has been saved to Parse.\n * }, function(error) {\n * // The file either could not be read, or could not be saved to Parse.\n * });\n * }</pre>\n * @param type {String} Optional Content-Type header to use for the file. If\n * this is omitted, the content type will be inferred from the name's\n * extension.\n * @param metadata {object} Optional key value pairs to be stored with file object\n * @param tags {object} Optional key value pairs to be stored with file object\n */\n constructor(name, data, type, metadata, tags) {\n (0, _defineProperty2.default)(this, \"_name\", void 0);\n (0, _defineProperty2.default)(this, \"_url\", void 0);\n (0, _defineProperty2.default)(this, \"_source\", void 0);\n (0, _defineProperty2.default)(this, \"_previousSave\", void 0);\n (0, _defineProperty2.default)(this, \"_data\", void 0);\n (0, _defineProperty2.default)(this, \"_requestTask\", void 0);\n (0, _defineProperty2.default)(this, \"_metadata\", void 0);\n (0, _defineProperty2.default)(this, \"_tags\", void 0);\n const specifiedType = type || '';\n this._name = name;\n this._metadata = metadata || {};\n this._tags = tags || {};\n if (data !== undefined) {\n if ((0, _isArray.default)(data)) {\n this._data = ParseFile.encodeBase64(data);\n this._source = {\n format: 'base64',\n base64: this._data,\n type: specifiedType\n };\n } else if (typeof Blob !== 'undefined' && data instanceof Blob) {\n this._source = {\n format: 'file',\n file: data,\n type: specifiedType\n };\n } else if (data && typeof data.uri === 'string' && data.uri !== undefined) {\n this._source = {\n format: 'uri',\n uri: data.uri,\n type: specifiedType\n };\n } else if (data && typeof data.base64 === 'string') {\n var _context, _context2, _context3;\n const base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];\n const dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';\n this._data = base64;\n this._source = {\n format: 'base64',\n base64,\n type: dataType\n };\n } else {\n throw new TypeError('Cannot create a Parse.File with that data.');\n }\n }\n }\n\n /**\n * Return the data for the file, downloading it if not already present.\n * Data is present if initialized with Byte Array, Base64 or Saved with Uri.\n * Data is cleared if saved with File object selected with a file upload control\n *\n * @returns {Promise} Promise that is resolve with base64 data\n */\n async getData() {\n if (this._data) {\n return this._data;\n }\n if (!this._url) {\n throw new Error('Cannot retrieve data for unsaved ParseFile.');\n }\n const controller = _CoreManager.default.getFileController();\n const result = await controller.download(this._url, {\n requestTask: task => this._requestTask = task\n });\n this._data = result.base64;\n return this._data;\n }\n\n /**\n * Gets the name of the file. Before save is called, this is the filename\n * given by the user. After save is called, that name gets prefixed with a\n * unique identifier.\n *\n * @returns {string}\n */\n name() {\n return this._name;\n }\n\n /**\n * Gets the url of the file. It is only available after you save the file or\n * after you get the file from a Parse.Object.\n *\n * @param {object} options An object to specify url options\n * @param {boolean} [options.forceSecure] force the url to be secure\n * @returns {string | undefined}\n */\n url(options) {\n options = options || {};\n if (!this._url) {\n return;\n }\n if (options.forceSecure) {\n return this._url.replace(/^http:\\/\\//i, 'https://');\n } else {\n return this._url;\n }\n }\n\n /**\n * Gets the metadata of the file.\n *\n * @returns {object}\n */\n metadata() {\n return this._metadata;\n }\n\n /**\n * Gets the tags of the file.\n *\n * @returns {object}\n */\n tags() {\n return this._tags;\n }\n\n /**\n * Saves the file to the Parse cloud.\n *\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>progress: In Browser only, callback for upload progress. For example:\n * <pre>\n * let parseFile = new Parse.File(name, file);\n * parseFile.save({\n * progress: (progressValue, loaded, total, { type }) => {\n * if (type === \"upload\" && progressValue !== null) {\n * // Update the UI using progressValue\n * }\n * }\n * });\n * </pre>\n * </ul>\n * @returns {Promise | undefined} Promise that is resolved when the save finishes.\n */\n save(options) {\n options = options || {};\n options.requestTask = task => this._requestTask = task;\n options.metadata = this._metadata;\n options.tags = this._tags;\n const controller = _CoreManager.default.getFileController();\n if (!this._previousSave) {\n if (this._source.format === 'file') {\n this._previousSave = controller.saveFile(this._name, this._source, options).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._data = null;\n this._requestTask = null;\n return this;\n });\n } else if (this._source.format === 'uri') {\n this._previousSave = controller.download(this._source.uri, options).then(result => {\n if (!(result && result.base64)) {\n return {};\n }\n const newSource = {\n format: 'base64',\n base64: result.base64,\n type: result.contentType\n };\n this._data = result.base64;\n this._requestTask = null;\n return controller.saveBase64(this._name, newSource, options);\n }).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._requestTask = null;\n return this;\n });\n } else {\n this._previousSave = controller.saveBase64(this._name, this._source, options).then(res => {\n this._name = res.name;\n this._url = res.url;\n this._requestTask = null;\n return this;\n });\n }\n }\n if (this._previousSave) {\n return this._previousSave;\n }\n }\n\n /**\n * Aborts the request if it has already been sent.\n */\n cancel() {\n if (this._requestTask && typeof this._requestTask.abort === 'function') {\n this._requestTask._aborted = true;\n this._requestTask.abort();\n }\n this._requestTask = null;\n }\n\n /**\n * Deletes the file from the Parse cloud.\n * In Cloud Code and Node only with Master Key.\n *\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <pre>\n * @returns {Promise} Promise that is resolved when the delete finishes.\n */\n destroy() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!this._name) {\n throw new _ParseError.default(_ParseError.default.FILE_DELETE_UNNAMED_ERROR, 'Cannot delete an unnamed file.');\n }\n const destroyOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('useMasterKey')) {\n destroyOptions.useMasterKey = !!options.useMasterKey;\n }\n const controller = _CoreManager.default.getFileController();\n return controller.deleteFile(this._name, destroyOptions).then(() => {\n this._data = undefined;\n this._requestTask = null;\n return this;\n });\n }\n toJSON() {\n return {\n __type: 'File',\n name: this._name,\n url: this._url\n };\n }\n equals(other) {\n if (this === other) {\n return true;\n }\n // Unsaved Files are never equal, since they will be saved to different URLs\n return other instanceof ParseFile && this.name() === other.name() && this.url() === other.url() && typeof this.url() !== 'undefined';\n }\n\n /**\n * Sets metadata to be saved with file object. Overwrites existing metadata\n *\n * @param {object} metadata Key value pairs to be stored with file object\n */\n setMetadata(metadata) {\n if (metadata && typeof metadata === 'object') {\n var _context4;\n (0, _forEach.default)(_context4 = (0, _keys.default)(metadata)).call(_context4, key => {\n this.addMetadata(key, metadata[key]);\n });\n }\n }\n\n /**\n * Sets metadata to be saved with file object. Adds to existing metadata.\n *\n * @param {string} key key to store the metadata\n * @param {*} value metadata\n */\n addMetadata(key, value) {\n if (typeof key === 'string') {\n this._metadata[key] = value;\n }\n }\n\n /**\n * Sets tags to be saved with file object. Overwrites existing tags\n *\n * @param {object} tags Key value pairs to be stored with file object\n */\n setTags(tags) {\n if (tags && typeof tags === 'object') {\n var _context5;\n (0, _forEach.default)(_context5 = (0, _keys.default)(tags)).call(_context5, key => {\n this.addTag(key, tags[key]);\n });\n }\n }\n\n /**\n * Sets tags to be saved with file object. Adds to existing tags.\n *\n * @param {string} key key to store tags\n * @param {*} value tag\n */\n addTag(key, value) {\n if (typeof key === 'string') {\n this._tags[key] = value;\n }\n }\n static fromJSON(obj) {\n if (obj.__type !== 'File') {\n throw new TypeError('JSON object does not represent a ParseFile');\n }\n const file = new ParseFile(obj.name);\n file._url = obj.url;\n return file;\n }\n static encodeBase64(bytes) {\n const chunks = [];\n chunks.length = Math.ceil(bytes.length / 3);\n for (let i = 0; i < chunks.length; i++) {\n const b1 = bytes[i * 3];\n const b2 = bytes[i * 3 + 1] || 0;\n const b3 = bytes[i * 3 + 2] || 0;\n const has2 = i * 3 + 1 < bytes.length;\n const has3 = i * 3 + 2 < bytes.length;\n chunks[i] = [b64Digit(b1 >> 2 & 0x3f), b64Digit(b1 << 4 & 0x30 | b2 >> 4 & 0x0f), has2 ? b64Digit(b2 << 2 & 0x3c | b3 >> 6 & 0x03) : '=', has3 ? b64Digit(b3 & 0x3f) : '='].join('');\n }\n return chunks.join('');\n }\n}\nconst DefaultController = {\n saveFile: async function (name, source, options) {\n if (source.format !== 'file') {\n throw new Error('saveFile can only be used with File-type sources.');\n }\n const base64Data = await new _promise.default((res, rej) => {\n // eslint-disable-next-line no-undef\n const reader = new FileReader();\n reader.onload = () => res(reader.result);\n reader.onerror = error => rej(error);\n reader.readAsDataURL(source.file);\n });\n // we only want the data after the comma\n // For example: \"data:application/pdf;base64,JVBERi0xLjQKJ...\" we would only want \"JVBERi0xLjQKJ...\"\n const [first, second] = base64Data.split(',');\n // in the event there is no 'data:application/pdf;base64,' at the beginning of the base64 string\n // use the entire string instead\n const data = second ? second : first;\n const newSource = {\n format: 'base64',\n base64: data,\n type: source.type || (source.file ? source.file.type : undefined)\n };\n return await DefaultController.saveBase64(name, newSource, options);\n },\n saveBase64: function (name, source) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (source.format !== 'base64') {\n throw new Error('saveBase64 can only be used with Base64-type sources.');\n }\n const data = {\n base64: source.base64,\n fileData: {\n metadata: {\n ...options.metadata\n },\n tags: {\n ...options.tags\n }\n }\n };\n delete options.metadata;\n delete options.tags;\n if (source.type) {\n data._ContentType = source.type;\n }\n return _CoreManager.default.getRESTController().request('POST', 'files/' + name, data, options);\n },\n download: function (uri, options) {\n if (XHR) {\n return this.downloadAjax(uri, options);\n } else {\n return _promise.default.reject('Cannot make a request: No definition of XMLHttpRequest was found.');\n }\n },\n downloadAjax: function (uri, options) {\n return new _promise.default((resolve, reject) => {\n const xhr = new XHR();\n xhr.open('GET', uri, true);\n xhr.responseType = 'arraybuffer';\n xhr.onerror = function (e) {\n reject(e);\n };\n xhr.onreadystatechange = function () {\n if (xhr.readyState !== xhr.DONE) {\n return;\n }\n if (!this.response) {\n return resolve({});\n }\n const bytes = new Uint8Array(this.response);\n resolve({\n base64: ParseFile.encodeBase64(bytes),\n contentType: xhr.getResponseHeader('content-type')\n });\n };\n options.requestTask(xhr);\n xhr.send();\n });\n },\n deleteFile: function (name, options) {\n const headers = {\n 'X-Parse-Application-ID': _CoreManager.default.get('APPLICATION_ID')\n };\n if (options.useMasterKey) {\n headers['X-Parse-Master-Key'] = _CoreManager.default.get('MASTER_KEY');\n }\n let url = _CoreManager.default.get('SERVER_URL');\n if (url[url.length - 1] !== '/') {\n url += '/';\n }\n url += 'files/' + name;\n return _CoreManager.default.getRESTController().ajax('DELETE', url, '', headers).catch(response => {\n // TODO: return JSON object in server\n if (!response || response === 'SyntaxError: Unexpected end of JSON input') {\n return _promise.default.resolve();\n } else {\n return _CoreManager.default.getRESTController().handleError(response);\n }\n });\n },\n _setXHR(xhr) {\n XHR = xhr;\n },\n _getXHR() {\n return XHR;\n }\n};\n_CoreManager.default.setFileController(DefaultController);\nvar _default = exports.default = ParseFile;\nexports.b64Digit = b64Digit;"],"mappings":"AAAA,YAAY;;AAAC,IAAAA,iBAAA,GAAAC,OAAA,qGAAAC,OAAA;AAEb,IAAIC,sBAAsB,GAAGF,OAAO,CAAC,8DAA8D,CAAC;AACpG,IAAIG,sBAAsB,GAAGH,OAAO,CAAC,sDAAsD,CAAC;AAC5FE,sBAAsB,CAACE,OAAO,EAAE,YAAY,EAAE;EAC5CC,KAAK,EAAE;AACT,CAAC,CAAC;AACFD,OAAO,CAACH,OAAO,GAAG,KAAK,CAAC;AACxB,IAAIK,QAAQ,GAAGH,sBAAsB,CAACH,OAAO,CAAC,sDAAsD,CAAC,CAAC;AACtG,IAAIO,MAAM,GAAGJ,sBAAsB,CAACH,OAAO,CAAC,sDAAsD,CAAC,CAAC;AACpG,IAAIQ,QAAQ,GAAGL,sBAAsB,CAACH,OAAO,CAAC,yDAAyD,CAAC,CAAC;AACzG,IAAIS,KAAK,GAAGN,sBAAsB,CAACH,OAAO,CAAC,mDAAmD,CAAC,CAAC;AAChG,IAAIU,QAAQ,GAAGP,sBAAsB,CAACH,OAAO,CAAC,+CAA+C,CAAC,CAAC;AAC/F,IAAIW,QAAQ,GAAGR,sBAAsB,CAACH,OAAO,CAAC,yDAAyD,CAAC,CAAC;AACzG,IAAIY,gBAAgB,GAAGT,sBAAsB,CAACH,OAAO,CAAC,+CAA+C,CAAC,CAAC;AACvG,IAAIa,YAAY,GAAGV,sBAAsB,CAACH,OAAO,CAAC,eAAe,CAAC,CAAC;AACnE,IAAIc,WAAW,GAAGX,sBAAsB,CAACH,OAAO,CAAC,cAAc,CAAC,CAAC;AACjE,IAAIe,IAAI,GAAGZ,sBAAsB,CAACH,OAAO,CAAC,aAAa,CAAC,CAAC;AACzD;;AAEA,IAAIgB,GAA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