| 61164 | componentDidUpdate(s) { |
| 61165 | this.updateParsedContent(s.content) |
| 61166 | } |
| 61167 | render() { |
| 61168 | let { |
| 61169 | content: s, |
| 61170 | contentType: o, |
| 61171 | url: i, |
| 61172 | headers: a = {}, |
| 61173 | getComponent: u, |
| 61174 | } = this.props |
| 61175 | const { parsedContent: _ } = this.state, |
| 61176 | w = u('HighlightCode', !0), |
| 61177 | x = 'response_' + new Date().getTime() |
| 61178 | let C, j |
| 61179 | if ( |
| 61180 | ((i = i || ''), |
| 61181 | (/^application\/octet-stream/i.test(o) || |
| 61182 | (a['Content-Disposition'] && /attachment/i.test(a['Content-Disposition'])) || |
| 61183 | (a['content-disposition'] && /attachment/i.test(a['content-disposition'])) || |
| 61184 | (a['Content-Description'] && /File Transfer/i.test(a['Content-Description'])) || |
| 61185 | (a['content-description'] && /File Transfer/i.test(a['content-description']))) && |
| 61186 | (s.size > 0 || s.length > 0)) |
| 61187 | ) |
| 61188 | if ('Blob' in window) { |
| 61189 | let u = o || 'text/html', |
| 61190 | _ = s instanceof Blob ? s : new Blob([s], { type: u }), |
| 61191 | w = window.URL.createObjectURL(_), |
| 61192 | x = [u, i.substr(i.lastIndexOf('/') + 1), w].join(':'), |
| 61193 | C = a['content-disposition'] || a['Content-Disposition'] |
| 61194 | if (void 0 !== C) { |
| 61195 | let s = (function extractFileNameFromContentDispositionHeader(s) { |
| 61196 | let o |
| 61197 | if ( |
| 61198 | ([ |
| 61199 | /filename\*=[^']+'\w*'"([^"]+)";?/i, |
| 61200 | /filename\*=[^']+'\w*'([^;]+);?/i, |
| 61201 | /filename="([^;]*);?"/i, |
| 61202 | /filename=([^;]*);?/i, |
| 61203 | ].some((i) => ((o = i.exec(s)), null !== o)), |
| 61204 | null !== o && o.length > 1) |
| 61205 | ) |
| 61206 | try { |
| 61207 | return decodeURIComponent(o[1]) |
| 61208 | } catch (s) { |
| 61209 | console.error(s) |
| 61210 | } |
| 61211 | return null |
| 61212 | })(C) |
| 61213 | null !== s && (x = s) |
| 61214 | } |
| 61215 | j = |
| 61216 | lt.navigator && lt.navigator.msSaveOrOpenBlob |
| 61217 | ? Re.createElement( |
| 61218 | 'div', |
| 61219 | null, |
| 61220 | Re.createElement( |
| 61221 | 'a', |
| 61222 | { href: w, onClick: () => lt.navigator.msSaveOrOpenBlob(_, x) }, |
| 61223 | 'Download file' |