{"version":3,"sources":["webpack:///./node_modules/@capacitor-community/http/dist/esm/utils.js","webpack:///./node_modules/@capacitor-community/http/dist/esm/cookie.js","webpack:///./node_modules/@capacitor-community/http/dist/esm/request.js","webpack:///./node_modules/@capacitor-community/http/dist/esm/web.js"],"names":["readBlobAsBase64","async","blob","Promise","resolve","reject","reader","FileReader","onload","base64String","result","base64StringWithoutTags","substr","indexOf","onerror","error","readAsDataURL","encode","str","encodeURIComponent","replace","decodeURIComponent","escape","decode","setCookie","key","value","options","encodedKey","encodedValue","expires","path","document","cookie","getCookies","output","map","cookies","split","k","v","trim","entries","Object","push","getCookie","deleteCookie","clearCookies","Date","toUTCString","normalizeHttpHeaders","headers","originalKeys","keys","loweredKeys","toLocaleLowerCase","normalized","reduce","acc","index","buildUrlParams","params","shouldEncode","accumulator","entry","item","Array","isArray","forEach","slice","buildRequestInit","extra","assign","method","type","data","body","includes","URLSearchParams","set","toString","form","FormData","append","Headers","delete","JSON","stringify","request","requestInit","webFetchExtra","urlParams","shouldEncodeUrlParams","url","response","fetch","contentType","get","responseType","ok","json","text","status","post","put","patch","del","super","this","getCookiesMap","clearAllCookies","uploadFile","formData","name","fetchOptions","downloadFile","progress","getReader","bytes","chunks","contentLength","parseInt","done","read","length","notifyListeners","allChunks","Uint8Array","position","chunk","Blob","buffer","undefined"],"mappings":"iLAIO,MAAMA,EAAmBC,MAAOC,GAAS,IAAIC,QAAQ,CAACC,EAASC,KAClE,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAS,KACZ,MAAMC,EAAeH,EAAOI,OACtBC,EAA0BF,EAAaG,OAAOH,EAAaI,QAAQ,KAAO,GAChFT,EAAQO,IAEZL,EAAOQ,QAAWC,GAAUV,EAAOU,GACnCT,EAAOU,cAAcd,KAMZe,EAAUC,GAAQC,mBAAmBD,GAC7CE,QAAQ,uBAAwBC,oBAChCD,QAAQ,QAASE,QAKTC,EAAUL,GAAQA,EAAIE,QAAQ,mBAAoBC,oBClBlDG,EAAY,CAACC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B,MAAQ,aAC9C,MAAMgH,EAAevE,OAAO6B,OAAO7B,OAAO6B,OAAO,GAAI7C,GAAU,CAAEiD,KAAMoC,EAAUvC,OAAQ,SACzF,OAAOmC,KAAKL,KAAKW,IAMrBN,KAAKO,aAAelH,MAAO0B,IACvB,MAAM8D,EAAc,EAAyB9D,EAASA,EAAQ+D,eACxDI,QAAiBC,MAAMpE,EAAQkE,IAAKJ,GAC1C,IAAIvF,EACJ,GAAkB,OAAZyB,QAAgC,IAAZA,OAAqB,EAASA,EAAQyF,SAE3D,GAAmB,OAAbtB,QAAkC,IAAbA,OAAsB,EAASA,EAASlB,KAEnE,CACD,MAAMtE,EAASwF,EAASlB,KAAKyC,YAC7B,IAAIC,EAAQ,EACRC,EAAS,GACb,MAAMvB,EAAcF,EAAS3C,QAAQ8C,IAAI,gBACnCuB,EAAgBC,SAAS3B,EAAS3C,QAAQ8C,IAAI,mBAAqB,IAAK,IAC9E,MAAO,EAAM,CACT,MAAM,KAAEyB,EAAI,MAAEhG,SAAgBpB,EAAOqH,OACrC,GAAID,EACA,MACJH,EAAO3E,KAAKlB,GACZ4F,IAAoB,OAAV5F,QAA4B,IAAVA,OAAmB,EAASA,EAAMkG,SAAW,EACzE,MAAMtB,EAAS,CACX5B,KAAM,WACNmB,IAAKlE,EAAQkE,IACbyB,QACAE,iBAEJZ,KAAKiB,gBAAgB,WAAYvB,GAErC,IAAIwB,EAAY,IAAIC,WAAWT,GAC3BU,EAAW,EACf,IAAK,MAAMC,KAASV,EACK,qBAAVU,IAEXH,EAAU/C,IAAIkD,EAAOD,GACrBA,GAAYC,EAAML,QAEtB1H,EAAO,IAAIgI,KAAK,CAACJ,EAAUK,QAAS,CAAEzD,KAAMsB,QAAeoC,SA7B3DlI,EAAO,IAAIgI,UAFXhI,QAAa4F,EAAS5F,OAiC1B,MAAO,CACHA","file":"js/chunk-2d0c1783.040d33fa.js","sourcesContent":["/**\n * Read in a Blob value and return it as a base64 string\n * @param blob The blob value to convert to a base64 string\n */\nexport const readBlobAsBase64 = async (blob) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n const base64String = reader.result;\n const base64StringWithoutTags = base64String.substr(base64String.indexOf(',') + 1); // remove prefix \"data:application/pdf;base64,\"\n resolve(base64StringWithoutTags);\n };\n reader.onerror = (error) => reject(error);\n reader.readAsDataURL(blob);\n});\n/**\n * Safely web encode a string value (inspired by js-cookie)\n * @param str The string value to encode\n */\nexport const encode = (str) => encodeURIComponent(str)\n .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)\n .replace(/[()]/g, escape);\n/**\n * Safely web decode a string value (inspired by js-cookie)\n * @param str The string value to decode\n */\nexport const decode = (str) => str.replace(/(%[\\dA-F]{2})+/gi, decodeURIComponent);\n//# sourceMappingURL=utils.js.map","import { encode, decode } from './utils';\n/**\n * Set a cookie\n * @param key The key to set\n * @param value The value to set\n * @param options Optional additional parameters\n */\nexport const setCookie = (key, value, options = {}) => {\n // Safely Encoded Key/Value\n const encodedKey = encode(key);\n const encodedValue = encode(value);\n // Clean & sanitize options\n const expires = `; expires=${(options.expires || '').replace('expires=', '')}`; // Default is \"; expires=\"\n const path = (options.path || '/').replace('path=', ''); // Default is \"path=/\"\n document.cookie = `${encodedKey}=${encodedValue || ''}${expires}; path=${path}`;\n};\n/**\n * Gets all HttpCookies\n */\nexport const getCookies = () => {\n const output = [];\n const map = {};\n if (!document.cookie) {\n return output;\n }\n const cookies = document.cookie.split(';') || [];\n for (const cookie of cookies) {\n // Replace first \"=\" with CAP_COOKIE to prevent splitting on additional \"=\"\n let [k, v] = cookie.replace(/=/, 'CAP_COOKIE').split('CAP_COOKIE');\n k = decode(k).trim();\n v = decode(v).trim();\n map[k] = v;\n }\n const entries = Object.entries(map);\n for (const [key, value] of entries) {\n output.push({\n key,\n value,\n });\n }\n return output;\n};\n/**\n * Gets a single HttpCookie given a key\n */\nexport const getCookie = (key) => {\n const cookies = getCookies();\n for (const cookie of cookies) {\n if (cookie.key === key) {\n return cookie;\n }\n }\n return {\n key,\n value: '',\n };\n};\n/**\n * Deletes a cookie given a key\n * @param key The key of the cookie to delete\n */\nexport const deleteCookie = (key) => {\n document.cookie = `${key}=; Max-Age=0`;\n};\n/**\n * Clears out cookies by setting them to expire immediately\n */\nexport const clearCookies = () => {\n const cookies = document.cookie.split(';') || [];\n for (const cookie of cookies) {\n document.cookie = cookie\n .replace(/^ +/, '')\n .replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`);\n }\n};\n//# sourceMappingURL=cookie.js.map","import { readBlobAsBase64 } from './utils';\n/**\n * Normalize an HttpHeaders map by lowercasing all of the values\n * @param headers The HttpHeaders object to normalize\n */\nconst normalizeHttpHeaders = (headers = {}) => {\n const originalKeys = Object.keys(headers);\n const loweredKeys = Object.keys(headers).map(k => k.toLocaleLowerCase());\n const normalized = loweredKeys.reduce((acc, key, index) => {\n acc[key] = headers[originalKeys[index]];\n return acc;\n }, {});\n return normalized;\n};\n/**\n * Builds a string of url parameters that\n * @param params A map of url parameters\n * @param shouldEncode true if you should encodeURIComponent() the values (true by default)\n */\nconst buildUrlParams = (params, shouldEncode = true) => {\n if (!params)\n return null;\n const output = Object.entries(params).reduce((accumulator, entry) => {\n const [key, value] = entry;\n let encodedValue;\n let item;\n if (Array.isArray(value)) {\n item = '';\n value.forEach(str => {\n encodedValue = shouldEncode ? encodeURIComponent(str) : str;\n item += `${key}=${encodedValue}&`;\n });\n // last character will always be \"&\" so slice it off\n item.slice(0, -1);\n }\n else {\n encodedValue = shouldEncode ? encodeURIComponent(value) : value;\n item = `${key}=${encodedValue}`;\n }\n return `${accumulator}&${item}`;\n }, '');\n // Remove initial \"&\" from the reduce\n return output.substr(1);\n};\n/**\n * Build the RequestInit object based on the options passed into the initial request\n * @param options The Http plugin options\n * @param extra Any extra RequestInit values\n */\nexport const buildRequestInit = (options, extra = {}) => {\n const output = Object.assign({ method: options.method || 'GET', headers: options.headers }, extra);\n // Get the content-type\n const headers = normalizeHttpHeaders(options.headers);\n const type = headers['content-type'] || '';\n // If body is already a string, then pass it through as-is.\n if (typeof options.data === 'string') {\n output.body = options.data;\n }\n // Build request initializers based off of content-type\n else if (type.includes('application/x-www-form-urlencoded')) {\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(options.data || {})) {\n params.set(key, value);\n }\n output.body = params.toString();\n }\n else if (type.includes('multipart/form-data')) {\n const form = new FormData();\n if (options.data instanceof FormData) {\n options.data.forEach((value, key) => {\n form.append(key, value);\n });\n }\n else {\n for (let key of Object.keys(options.data)) {\n form.append(key, options.data[key]);\n }\n }\n output.body = form;\n const headers = new Headers(output.headers);\n headers.delete('content-type'); // content-type will be set by `window.fetch` to includy boundary\n output.headers = headers;\n }\n else if (type.includes('application/json') ||\n typeof options.data === 'object') {\n output.body = JSON.stringify(options.data);\n }\n return output;\n};\n/**\n * Perform an Http request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const request = async (options) => {\n const requestInit = buildRequestInit(options, options.webFetchExtra);\n const urlParams = buildUrlParams(options.params, options.shouldEncodeUrlParams);\n const url = urlParams ? `${options.url}?${urlParams}` : options.url;\n const response = await fetch(url, requestInit);\n const contentType = response.headers.get('content-type') || '';\n // Default to 'text' responseType so no parsing happens\n let { responseType = 'text' } = response.ok ? options : {};\n // If the response content-type is json, force the response to be json\n if (contentType.includes('application/json')) {\n responseType = 'json';\n }\n let data;\n switch (responseType) {\n case 'arraybuffer':\n case 'blob':\n const blob = await response.blob();\n data = await readBlobAsBase64(blob);\n break;\n case 'json':\n data = await response.json();\n break;\n case 'document':\n case 'text':\n default:\n data = await response.text();\n }\n // Convert fetch headers to Capacitor HttpHeaders\n const headers = {};\n response.headers.forEach((value, key) => {\n headers[key] = value;\n });\n return {\n data,\n headers,\n status: response.status,\n url: response.url,\n };\n};\n/**\n * Perform an Http GET request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const get = async (options) => request(Object.assign(Object.assign({}, options), { method: 'GET' }));\n/**\n * Perform an Http POST request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const post = async (options) => request(Object.assign(Object.assign({}, options), { method: 'POST' }));\n/**\n * Perform an Http PUT request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const put = async (options) => request(Object.assign(Object.assign({}, options), { method: 'PUT' }));\n/**\n * Perform an Http PATCH request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const patch = async (options) => request(Object.assign(Object.assign({}, options), { method: 'PATCH' }));\n/**\n * Perform an Http DELETE request given a set of options\n * @param options Options to build the HTTP request\n */\nexport const del = async (options) => request(Object.assign(Object.assign({}, options), { method: 'DELETE' }));\n//# sourceMappingURL=request.js.map","import { WebPlugin } from '@capacitor/core';\nimport * as Cookie from './cookie';\nimport * as Request from './request';\nexport class HttpWeb extends WebPlugin {\n constructor() {\n super();\n /**\n * Perform an Http request given a set of options\n * @param options Options to build the HTTP request\n */\n this.request = async (options) => Request.request(options);\n /**\n * Perform an Http GET request given a set of options\n * @param options Options to build the HTTP request\n */\n this.get = async (options) => Request.get(options);\n /**\n * Perform an Http POST request given a set of options\n * @param options Options to build the HTTP request\n */\n this.post = async (options) => Request.post(options);\n /**\n * Perform an Http PUT request given a set of options\n * @param options Options to build the HTTP request\n */\n this.put = async (options) => Request.put(options);\n /**\n * Perform an Http PATCH request given a set of options\n * @param options Options to build the HTTP request\n */\n this.patch = async (options) => Request.patch(options);\n /**\n * Perform an Http DELETE request given a set of options\n * @param options Options to build the HTTP request\n */\n this.del = async (options) => Request.del(options);\n /**\n * Gets all HttpCookies as a Map\n */\n this.getCookiesMap = async (\n // @ts-ignore\n options) => {\n const cookies = Cookie.getCookies();\n const output = {};\n for (const cookie of cookies) {\n output[cookie.key] = cookie.value;\n }\n return output;\n };\n /**\n * Get all HttpCookies as an object with the values as an HttpCookie[]\n */\n this.getCookies = async (options) => {\n // @ts-ignore\n const { url } = options;\n const cookies = Cookie.getCookies();\n return { cookies };\n };\n /**\n * Set a cookie\n * @param key The key to set\n * @param value The value to set\n * @param options Optional additional parameters\n */\n this.setCookie = async (options) => {\n const { key, value, expires = '', path = '' } = options;\n Cookie.setCookie(key, value, { expires, path });\n };\n /**\n * Gets all cookie values unless a key is specified, then return only that value\n * @param key The key of the cookie value to get\n */\n this.getCookie = async (options) => Cookie.getCookie(options.key);\n /**\n * Deletes a cookie given a key\n * @param key The key of the cookie to delete\n */\n this.deleteCookie = async (options) => Cookie.deleteCookie(options.key);\n /**\n * Clears out cookies by setting them to expire immediately\n */\n this.clearCookies = async (\n // @ts-ignore\n options) => Cookie.clearCookies();\n /**\n * Clears out cookies by setting them to expire immediately\n */\n this.clearAllCookies = async () => Cookie.clearCookies();\n /**\n * Uploads a file through a POST request\n * @param options TODO\n */\n this.uploadFile = async (options) => {\n const formData = new FormData();\n formData.append(options.name, options.blob || 'undefined');\n const fetchOptions = Object.assign(Object.assign({}, options), { body: formData, method: 'POST' });\n return this.post(fetchOptions);\n };\n /**\n * Downloads a file\n * @param options TODO\n */\n this.downloadFile = async (options) => {\n const requestInit = Request.buildRequestInit(options, options.webFetchExtra);\n const response = await fetch(options.url, requestInit);\n let blob;\n if (!(options === null || options === void 0 ? void 0 : 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 let 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 type: 'DOWNLOAD',\n url: options.url,\n bytes,\n contentLength,\n };\n this.notifyListeners('progress', status);\n }\n let 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 return {\n blob,\n };\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"sourceRoot":""}