tauricon.js 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["tauri"] = factory();
  8. else
  9. root["tauri"] = factory();
  10. })(this, function() {
  11. return /******/ (() => { // webpackBootstrap
  12. /******/ "use strict";
  13. /******/ var __webpack_modules__ = ({
  14. /***/ "./node_modules/imagemin/index.js":
  15. /*!****************************************!*\
  16. !*** ./node_modules/imagemin/index.js ***!
  17. \****************************************/
  18. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  19. __webpack_require__.r(__webpack_exports__);
  20. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  21. /* harmony export */ "default": () => (/* binding */ imagemin)
  22. /* harmony export */ });
  23. /* harmony import */ var util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! util */ "util");
  24. /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! path */ "path");
  25. /* harmony import */ var graceful_fs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graceful-fs */ "graceful-fs");
  26. /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fs */ "fs");
  27. /* harmony import */ var file_type__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! file-type */ "./node_modules/imagemin/node_modules/file-type/index.js");
  28. /* harmony import */ var globby__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! globby */ "globby");
  29. /* harmony import */ var p_pipe__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! p-pipe */ "./node_modules/p-pipe/index.js");
  30. /* harmony import */ var replace_ext__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! replace-ext */ "replace-ext");
  31. /* harmony import */ var junk__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! junk */ "junk");
  32. const readFile = (0,util__WEBPACK_IMPORTED_MODULE_0__.promisify)(graceful_fs__WEBPACK_IMPORTED_MODULE_2__.readFile);
  33. const writeFile = (0,util__WEBPACK_IMPORTED_MODULE_0__.promisify)(graceful_fs__WEBPACK_IMPORTED_MODULE_2__.writeFile);
  34. const handleFile = async (sourcePath, {destination, plugins = []}) => {
  35. if (plugins && !Array.isArray(plugins)) {
  36. throw new TypeError('The `plugins` option should be an `Array`');
  37. }
  38. let data = await readFile(sourcePath);
  39. data = await (plugins.length > 0 ? (0,p_pipe__WEBPACK_IMPORTED_MODULE_6__.default)(...plugins)(data) : data);
  40. const {ext} = await file_type__WEBPACK_IMPORTED_MODULE_4__.fromBuffer(data);
  41. let destinationPath = destination ? path__WEBPACK_IMPORTED_MODULE_1__.join(destination, path__WEBPACK_IMPORTED_MODULE_1__.basename(sourcePath)) : undefined;
  42. destinationPath = ext === 'webp' ? replace_ext__WEBPACK_IMPORTED_MODULE_7__(destinationPath, '.webp') : destinationPath;
  43. const returnValue = {
  44. data,
  45. sourcePath,
  46. destinationPath
  47. };
  48. if (!destinationPath) {
  49. return returnValue;
  50. }
  51. await fs__WEBPACK_IMPORTED_MODULE_3__.promises.mkdir(path__WEBPACK_IMPORTED_MODULE_1__.dirname(returnValue.destinationPath), {recursive: true});
  52. await writeFile(returnValue.destinationPath, returnValue.data);
  53. return returnValue;
  54. };
  55. async function imagemin(input, {glob = true, ...options} = {}) {
  56. if (!Array.isArray(input)) {
  57. throw new TypeError(`Expected an \`Array\`, got \`${typeof input}\``);
  58. }
  59. const filePaths = glob ? await globby__WEBPACK_IMPORTED_MODULE_5__(input, {onlyFiles: true}) : input;
  60. return Promise.all(
  61. filePaths
  62. .filter(filePath => junk__WEBPACK_IMPORTED_MODULE_8__.not(path__WEBPACK_IMPORTED_MODULE_1__.basename(filePath)))
  63. .map(async filePath => {
  64. try {
  65. return await handleFile(filePath, options);
  66. } catch (error) {
  67. error.message = `Error occurred when handling file: ${input}\n\n${error.stack}`;
  68. throw error;
  69. }
  70. })
  71. );
  72. }
  73. imagemin.buffer = async (input, {plugins = []} = {}) => {
  74. if (!Buffer.isBuffer(input)) {
  75. throw new TypeError(`Expected a \`Buffer\`, got \`${typeof input}\``);
  76. }
  77. if (plugins.length === 0) {
  78. return input;
  79. }
  80. return (0,p_pipe__WEBPACK_IMPORTED_MODULE_6__.default)(...plugins)(input);
  81. };
  82. /***/ }),
  83. /***/ "./node_modules/imagemin/node_modules/file-type/core.js":
  84. /*!**************************************************************!*\
  85. !*** ./node_modules/imagemin/node_modules/file-type/core.js ***!
  86. \**************************************************************/
  87. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  88. const Token = __webpack_require__(/*! token-types */ "token-types");
  89. const strtok3 = __webpack_require__(/*! strtok3/lib/core */ "strtok3/lib/core");
  90. const {
  91. stringToBytes,
  92. tarHeaderChecksumMatches,
  93. uint32SyncSafeToken
  94. } = __webpack_require__(/*! ./util */ "./node_modules/imagemin/node_modules/file-type/util.js");
  95. const supported = __webpack_require__(/*! ./supported */ "./node_modules/imagemin/node_modules/file-type/supported.js");
  96. const minimumBytes = 4100; // A fair amount of file-types are detectable within this range
  97. async function fromStream(stream) {
  98. const tokenizer = await strtok3.fromStream(stream);
  99. try {
  100. return await fromTokenizer(tokenizer);
  101. } finally {
  102. await tokenizer.close();
  103. }
  104. }
  105. async function fromBuffer(input) {
  106. if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) {
  107. throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``);
  108. }
  109. const buffer = input instanceof Buffer ? input : Buffer.from(input);
  110. if (!(buffer && buffer.length > 1)) {
  111. return;
  112. }
  113. const tokenizer = strtok3.fromBuffer(buffer);
  114. return fromTokenizer(tokenizer);
  115. }
  116. function _check(buffer, headers, options) {
  117. options = {
  118. offset: 0,
  119. ...options
  120. };
  121. for (const [index, header] of headers.entries()) {
  122. // If a bitmask is set
  123. if (options.mask) {
  124. // If header doesn't equal `buf` with bits masked off
  125. if (header !== (options.mask[index] & buffer[index + options.offset])) {
  126. return false;
  127. }
  128. } else if (header !== buffer[index + options.offset]) {
  129. return false;
  130. }
  131. }
  132. return true;
  133. }
  134. async function _checkSequence(sequence, tokenizer, ignoreBytes) {
  135. const buffer = Buffer.alloc(minimumBytes);
  136. await tokenizer.ignore(ignoreBytes);
  137. await tokenizer.peekBuffer(buffer, {mayBeLess: true});
  138. return buffer.includes(Buffer.from(sequence));
  139. }
  140. async function fromTokenizer(tokenizer) {
  141. try {
  142. return _fromTokenizer(tokenizer);
  143. } catch (error) {
  144. if (!(error instanceof strtok3.EndOfStreamError)) {
  145. throw error;
  146. }
  147. }
  148. }
  149. async function _fromTokenizer(tokenizer) {
  150. let buffer = Buffer.alloc(minimumBytes);
  151. const bytesRead = 12;
  152. const check = (header, options) => _check(buffer, header, options);
  153. const checkString = (header, options) => check(stringToBytes(header), options);
  154. const checkSequence = (sequence, ignoreBytes) => _checkSequence(sequence, tokenizer, ignoreBytes);
  155. // Keep reading until EOF if the file size is unknown.
  156. if (!tokenizer.fileInfo.size) {
  157. tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER;
  158. }
  159. await tokenizer.peekBuffer(buffer, {length: bytesRead, mayBeLess: true});
  160. // -- 2-byte signatures --
  161. if (check([0x42, 0x4D])) {
  162. return {
  163. ext: 'bmp',
  164. mime: 'image/bmp'
  165. };
  166. }
  167. if (check([0x0B, 0x77])) {
  168. return {
  169. ext: 'ac3',
  170. mime: 'audio/vnd.dolby.dd-raw'
  171. };
  172. }
  173. if (check([0x78, 0x01])) {
  174. return {
  175. ext: 'dmg',
  176. mime: 'application/x-apple-diskimage'
  177. };
  178. }
  179. if (check([0x4D, 0x5A])) {
  180. return {
  181. ext: 'exe',
  182. mime: 'application/x-msdownload'
  183. };
  184. }
  185. if (check([0x25, 0x21])) {
  186. await tokenizer.peekBuffer(buffer, {length: 24, mayBeLess: true});
  187. if (checkString('PS-Adobe-', {offset: 2}) &&
  188. checkString(' EPSF-', {offset: 14})) {
  189. return {
  190. ext: 'eps',
  191. mime: 'application/eps'
  192. };
  193. }
  194. return {
  195. ext: 'ps',
  196. mime: 'application/postscript'
  197. };
  198. }
  199. if (
  200. check([0x1F, 0xA0]) ||
  201. check([0x1F, 0x9D])
  202. ) {
  203. return {
  204. ext: 'Z',
  205. mime: 'application/x-compress'
  206. };
  207. }
  208. // -- 3-byte signatures --
  209. if (check([0xFF, 0xD8, 0xFF])) {
  210. return {
  211. ext: 'jpg',
  212. mime: 'image/jpeg'
  213. };
  214. }
  215. if (check([0x49, 0x49, 0xBC])) {
  216. return {
  217. ext: 'jxr',
  218. mime: 'image/vnd.ms-photo'
  219. };
  220. }
  221. if (check([0x1F, 0x8B, 0x8])) {
  222. return {
  223. ext: 'gz',
  224. mime: 'application/gzip'
  225. };
  226. }
  227. if (check([0x42, 0x5A, 0x68])) {
  228. return {
  229. ext: 'bz2',
  230. mime: 'application/x-bzip2'
  231. };
  232. }
  233. if (checkString('ID3')) {
  234. await tokenizer.ignore(6); // Skip ID3 header until the header size
  235. const id3HeaderLen = await tokenizer.readToken(uint32SyncSafeToken);
  236. if (tokenizer.position + id3HeaderLen > tokenizer.fileInfo.size) {
  237. // Guess file type based on ID3 header for backward compatibility
  238. return {
  239. ext: 'mp3',
  240. mime: 'audio/mpeg'
  241. };
  242. }
  243. await tokenizer.ignore(id3HeaderLen);
  244. return fromTokenizer(tokenizer); // Skip ID3 header, recursion
  245. }
  246. // Musepack, SV7
  247. if (checkString('MP+')) {
  248. return {
  249. ext: 'mpc',
  250. mime: 'audio/x-musepack'
  251. };
  252. }
  253. if (
  254. (buffer[0] === 0x43 || buffer[0] === 0x46) &&
  255. check([0x57, 0x53], {offset: 1})
  256. ) {
  257. return {
  258. ext: 'swf',
  259. mime: 'application/x-shockwave-flash'
  260. };
  261. }
  262. // -- 4-byte signatures --
  263. if (check([0x47, 0x49, 0x46])) {
  264. return {
  265. ext: 'gif',
  266. mime: 'image/gif'
  267. };
  268. }
  269. if (checkString('FLIF')) {
  270. return {
  271. ext: 'flif',
  272. mime: 'image/flif'
  273. };
  274. }
  275. if (checkString('8BPS')) {
  276. return {
  277. ext: 'psd',
  278. mime: 'image/vnd.adobe.photoshop'
  279. };
  280. }
  281. if (checkString('WEBP', {offset: 8})) {
  282. return {
  283. ext: 'webp',
  284. mime: 'image/webp'
  285. };
  286. }
  287. // Musepack, SV8
  288. if (checkString('MPCK')) {
  289. return {
  290. ext: 'mpc',
  291. mime: 'audio/x-musepack'
  292. };
  293. }
  294. if (checkString('FORM')) {
  295. return {
  296. ext: 'aif',
  297. mime: 'audio/aiff'
  298. };
  299. }
  300. if (checkString('icns', {offset: 0})) {
  301. return {
  302. ext: 'icns',
  303. mime: 'image/icns'
  304. };
  305. }
  306. // Zip-based file formats
  307. // Need to be before the `zip` check
  308. if (check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature
  309. try {
  310. while (tokenizer.position + 30 < tokenizer.fileInfo.size) {
  311. await tokenizer.readBuffer(buffer, {length: 30});
  312. // https://en.wikipedia.org/wiki/Zip_(file_format)#File_headers
  313. const zipHeader = {
  314. compressedSize: buffer.readUInt32LE(18),
  315. uncompressedSize: buffer.readUInt32LE(22),
  316. filenameLength: buffer.readUInt16LE(26),
  317. extraFieldLength: buffer.readUInt16LE(28)
  318. };
  319. zipHeader.filename = await tokenizer.readToken(new Token.StringType(zipHeader.filenameLength, 'utf-8'));
  320. await tokenizer.ignore(zipHeader.extraFieldLength);
  321. // Assumes signed `.xpi` from addons.mozilla.org
  322. if (zipHeader.filename === 'META-INF/mozilla.rsa') {
  323. return {
  324. ext: 'xpi',
  325. mime: 'application/x-xpinstall'
  326. };
  327. }
  328. if (zipHeader.filename.endsWith('.rels') || zipHeader.filename.endsWith('.xml')) {
  329. const type = zipHeader.filename.split('/')[0];
  330. switch (type) {
  331. case '_rels':
  332. break;
  333. case 'word':
  334. return {
  335. ext: 'docx',
  336. mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  337. };
  338. case 'ppt':
  339. return {
  340. ext: 'pptx',
  341. mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
  342. };
  343. case 'xl':
  344. return {
  345. ext: 'xlsx',
  346. mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  347. };
  348. default:
  349. break;
  350. }
  351. }
  352. if (zipHeader.filename.startsWith('xl/')) {
  353. return {
  354. ext: 'xlsx',
  355. mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  356. };
  357. }
  358. // The docx, xlsx and pptx file types extend the Office Open XML file format:
  359. // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
  360. // We look for:
  361. // - one entry named '[Content_Types].xml' or '_rels/.rels',
  362. // - one entry indicating specific type of file.
  363. // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it.
  364. if (zipHeader.filename === 'mimetype' && zipHeader.compressedSize === zipHeader.uncompressedSize) {
  365. const mimeType = await tokenizer.readToken(new Token.StringType(zipHeader.compressedSize, 'utf-8'));
  366. switch (mimeType) {
  367. case 'application/epub+zip':
  368. return {
  369. ext: 'epub',
  370. mime: 'application/epub+zip'
  371. };
  372. case 'application/vnd.oasis.opendocument.text':
  373. return {
  374. ext: 'odt',
  375. mime: 'application/vnd.oasis.opendocument.text'
  376. };
  377. case 'application/vnd.oasis.opendocument.spreadsheet':
  378. return {
  379. ext: 'ods',
  380. mime: 'application/vnd.oasis.opendocument.spreadsheet'
  381. };
  382. case 'application/vnd.oasis.opendocument.presentation':
  383. return {
  384. ext: 'odp',
  385. mime: 'application/vnd.oasis.opendocument.presentation'
  386. };
  387. default:
  388. }
  389. }
  390. // Try to find next header manually when current one is corrupted
  391. if (zipHeader.compressedSize === 0) {
  392. let nextHeaderIndex = -1;
  393. while (nextHeaderIndex < 0 && (tokenizer.position < tokenizer.fileInfo.size)) {
  394. await tokenizer.peekBuffer(buffer, {mayBeLess: true});
  395. nextHeaderIndex = buffer.indexOf('504B0304', 0, 'hex');
  396. // Move position to the next header if found, skip the whole buffer otherwise
  397. await tokenizer.ignore(nextHeaderIndex >= 0 ? nextHeaderIndex : buffer.length);
  398. }
  399. } else {
  400. await tokenizer.ignore(zipHeader.compressedSize);
  401. }
  402. }
  403. } catch (error) {
  404. if (!(error instanceof strtok3.EndOfStreamError)) {
  405. throw error;
  406. }
  407. }
  408. return {
  409. ext: 'zip',
  410. mime: 'application/zip'
  411. };
  412. }
  413. if (checkString('OggS')) {
  414. // This is an OGG container
  415. await tokenizer.ignore(28);
  416. const type = Buffer.alloc(8);
  417. await tokenizer.readBuffer(type);
  418. // Needs to be before `ogg` check
  419. if (_check(type, [0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])) {
  420. return {
  421. ext: 'opus',
  422. mime: 'audio/opus'
  423. };
  424. }
  425. // If ' theora' in header.
  426. if (_check(type, [0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61])) {
  427. return {
  428. ext: 'ogv',
  429. mime: 'video/ogg'
  430. };
  431. }
  432. // If '\x01video' in header.
  433. if (_check(type, [0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00])) {
  434. return {
  435. ext: 'ogm',
  436. mime: 'video/ogg'
  437. };
  438. }
  439. // If ' FLAC' in header https://xiph.org/flac/faq.html
  440. if (_check(type, [0x7F, 0x46, 0x4C, 0x41, 0x43])) {
  441. return {
  442. ext: 'oga',
  443. mime: 'audio/ogg'
  444. };
  445. }
  446. // 'Speex ' in header https://en.wikipedia.org/wiki/Speex
  447. if (_check(type, [0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20])) {
  448. return {
  449. ext: 'spx',
  450. mime: 'audio/ogg'
  451. };
  452. }
  453. // If '\x01vorbis' in header
  454. if (_check(type, [0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73])) {
  455. return {
  456. ext: 'ogg',
  457. mime: 'audio/ogg'
  458. };
  459. }
  460. // Default OGG container https://www.iana.org/assignments/media-types/application/ogg
  461. return {
  462. ext: 'ogx',
  463. mime: 'application/ogg'
  464. };
  465. }
  466. if (
  467. check([0x50, 0x4B]) &&
  468. (buffer[2] === 0x3 || buffer[2] === 0x5 || buffer[2] === 0x7) &&
  469. (buffer[3] === 0x4 || buffer[3] === 0x6 || buffer[3] === 0x8)
  470. ) {
  471. return {
  472. ext: 'zip',
  473. mime: 'application/zip'
  474. };
  475. }
  476. //
  477. // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format)
  478. // It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box.
  479. // `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters.
  480. // Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character).
  481. if (
  482. checkString('ftyp', {offset: 4}) &&
  483. (buffer[8] & 0x60) !== 0x00 // Brand major, first character ASCII?
  484. ) {
  485. // They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect.
  486. // For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension.
  487. const brandMajor = buffer.toString('binary', 8, 12).replace('\0', ' ').trim();
  488. switch (brandMajor) {
  489. case 'avif':
  490. return {ext: 'avif', mime: 'image/avif'};
  491. case 'mif1':
  492. return {ext: 'heic', mime: 'image/heif'};
  493. case 'msf1':
  494. return {ext: 'heic', mime: 'image/heif-sequence'};
  495. case 'heic':
  496. case 'heix':
  497. return {ext: 'heic', mime: 'image/heic'};
  498. case 'hevc':
  499. case 'hevx':
  500. return {ext: 'heic', mime: 'image/heic-sequence'};
  501. case 'qt':
  502. return {ext: 'mov', mime: 'video/quicktime'};
  503. case 'M4V':
  504. case 'M4VH':
  505. case 'M4VP':
  506. return {ext: 'm4v', mime: 'video/x-m4v'};
  507. case 'M4P':
  508. return {ext: 'm4p', mime: 'video/mp4'};
  509. case 'M4B':
  510. return {ext: 'm4b', mime: 'audio/mp4'};
  511. case 'M4A':
  512. return {ext: 'm4a', mime: 'audio/x-m4a'};
  513. case 'F4V':
  514. return {ext: 'f4v', mime: 'video/mp4'};
  515. case 'F4P':
  516. return {ext: 'f4p', mime: 'video/mp4'};
  517. case 'F4A':
  518. return {ext: 'f4a', mime: 'audio/mp4'};
  519. case 'F4B':
  520. return {ext: 'f4b', mime: 'audio/mp4'};
  521. case 'crx':
  522. return {ext: 'cr3', mime: 'image/x-canon-cr3'};
  523. default:
  524. if (brandMajor.startsWith('3g')) {
  525. if (brandMajor.startsWith('3g2')) {
  526. return {ext: '3g2', mime: 'video/3gpp2'};
  527. }
  528. return {ext: '3gp', mime: 'video/3gpp'};
  529. }
  530. return {ext: 'mp4', mime: 'video/mp4'};
  531. }
  532. }
  533. if (checkString('MThd')) {
  534. return {
  535. ext: 'mid',
  536. mime: 'audio/midi'
  537. };
  538. }
  539. if (
  540. checkString('wOFF') &&
  541. (
  542. check([0x00, 0x01, 0x00, 0x00], {offset: 4}) ||
  543. checkString('OTTO', {offset: 4})
  544. )
  545. ) {
  546. return {
  547. ext: 'woff',
  548. mime: 'font/woff'
  549. };
  550. }
  551. if (
  552. checkString('wOF2') &&
  553. (
  554. check([0x00, 0x01, 0x00, 0x00], {offset: 4}) ||
  555. checkString('OTTO', {offset: 4})
  556. )
  557. ) {
  558. return {
  559. ext: 'woff2',
  560. mime: 'font/woff2'
  561. };
  562. }
  563. if (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) {
  564. return {
  565. ext: 'pcap',
  566. mime: 'application/vnd.tcpdump.pcap'
  567. };
  568. }
  569. // Sony DSD Stream File (DSF)
  570. if (checkString('DSD ')) {
  571. return {
  572. ext: 'dsf',
  573. mime: 'audio/x-dsf' // Non-standard
  574. };
  575. }
  576. if (checkString('LZIP')) {
  577. return {
  578. ext: 'lz',
  579. mime: 'application/x-lzip'
  580. };
  581. }
  582. if (checkString('fLaC')) {
  583. return {
  584. ext: 'flac',
  585. mime: 'audio/x-flac'
  586. };
  587. }
  588. if (check([0x42, 0x50, 0x47, 0xFB])) {
  589. return {
  590. ext: 'bpg',
  591. mime: 'image/bpg'
  592. };
  593. }
  594. if (checkString('wvpk')) {
  595. return {
  596. ext: 'wv',
  597. mime: 'audio/wavpack'
  598. };
  599. }
  600. if (checkString('%PDF')) {
  601. // Check if this is an Adobe Illustrator file
  602. const isAiFile = await checkSequence('Adobe Illustrator', 1350);
  603. if (isAiFile) {
  604. return {
  605. ext: 'ai',
  606. mime: 'application/postscript'
  607. };
  608. }
  609. // Assume this is just a normal PDF
  610. return {
  611. ext: 'pdf',
  612. mime: 'application/pdf'
  613. };
  614. }
  615. if (check([0x00, 0x61, 0x73, 0x6D])) {
  616. return {
  617. ext: 'wasm',
  618. mime: 'application/wasm'
  619. };
  620. }
  621. // TIFF, little-endian type
  622. if (check([0x49, 0x49, 0x2A, 0x0])) {
  623. if (checkString('CR', {offset: 8})) {
  624. return {
  625. ext: 'cr2',
  626. mime: 'image/x-canon-cr2'
  627. };
  628. }
  629. if (check([0x1C, 0x00, 0xFE, 0x00], {offset: 8}) || check([0x1F, 0x00, 0x0B, 0x00], {offset: 8})) {
  630. return {
  631. ext: 'nef',
  632. mime: 'image/x-nikon-nef'
  633. };
  634. }
  635. if (
  636. check([0x08, 0x00, 0x00, 0x00], {offset: 4}) &&
  637. (check([0x2D, 0x00, 0xFE, 0x00], {offset: 8}) ||
  638. check([0x27, 0x00, 0xFE, 0x00], {offset: 8}))
  639. ) {
  640. return {
  641. ext: 'dng',
  642. mime: 'image/x-adobe-dng'
  643. };
  644. }
  645. buffer = Buffer.alloc(24);
  646. await tokenizer.peekBuffer(buffer);
  647. if (
  648. (check([0x10, 0xFB, 0x86, 0x01], {offset: 4}) || check([0x08, 0x00, 0x00, 0x00], {offset: 4})) &&
  649. // This pattern differentiates ARW from other TIFF-ish file types:
  650. check([0x00, 0xFE, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x01], {offset: 9})
  651. ) {
  652. return {
  653. ext: 'arw',
  654. mime: 'image/x-sony-arw'
  655. };
  656. }
  657. return {
  658. ext: 'tif',
  659. mime: 'image/tiff'
  660. };
  661. }
  662. // TIFF, big-endian type
  663. if (check([0x4D, 0x4D, 0x0, 0x2A])) {
  664. return {
  665. ext: 'tif',
  666. mime: 'image/tiff'
  667. };
  668. }
  669. if (checkString('MAC ')) {
  670. return {
  671. ext: 'ape',
  672. mime: 'audio/ape'
  673. };
  674. }
  675. // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska
  676. if (check([0x1A, 0x45, 0xDF, 0xA3])) { // Root element: EBML
  677. async function readField() {
  678. const msb = await tokenizer.peekNumber(Token.UINT8);
  679. let mask = 0x80;
  680. let ic = 0; // 0 = A, 1 = B, 2 = C, 3 = D
  681. while ((msb & mask) === 0) {
  682. ++ic;
  683. mask >>= 1;
  684. }
  685. const id = Buffer.alloc(ic + 1);
  686. await tokenizer.readBuffer(id);
  687. return id;
  688. }
  689. async function readElement() {
  690. const id = await readField();
  691. const lenField = await readField();
  692. lenField[0] ^= 0x80 >> (lenField.length - 1);
  693. const nrLen = Math.min(6, lenField.length); // JavaScript can max read 6 bytes integer
  694. return {
  695. id: id.readUIntBE(0, id.length),
  696. len: lenField.readUIntBE(lenField.length - nrLen, nrLen)
  697. };
  698. }
  699. async function readChildren(level, children) {
  700. while (children > 0) {
  701. const e = await readElement();
  702. if (e.id === 0x4282) {
  703. return tokenizer.readToken(new Token.StringType(e.len, 'utf-8')); // Return DocType
  704. }
  705. await tokenizer.ignore(e.len); // ignore payload
  706. --children;
  707. }
  708. }
  709. const re = await readElement();
  710. const docType = await readChildren(1, re.len);
  711. switch (docType) {
  712. case 'webm':
  713. return {
  714. ext: 'webm',
  715. mime: 'video/webm'
  716. };
  717. case 'matroska':
  718. return {
  719. ext: 'mkv',
  720. mime: 'video/x-matroska'
  721. };
  722. default:
  723. return;
  724. }
  725. }
  726. // RIFF file format which might be AVI, WAV, QCP, etc
  727. if (check([0x52, 0x49, 0x46, 0x46])) {
  728. if (check([0x41, 0x56, 0x49], {offset: 8})) {
  729. return {
  730. ext: 'avi',
  731. mime: 'video/vnd.avi'
  732. };
  733. }
  734. if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) {
  735. return {
  736. ext: 'wav',
  737. mime: 'audio/vnd.wave'
  738. };
  739. }
  740. // QLCM, QCP file
  741. if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) {
  742. return {
  743. ext: 'qcp',
  744. mime: 'audio/qcelp'
  745. };
  746. }
  747. }
  748. if (checkString('SQLi')) {
  749. return {
  750. ext: 'sqlite',
  751. mime: 'application/x-sqlite3'
  752. };
  753. }
  754. if (check([0x4E, 0x45, 0x53, 0x1A])) {
  755. return {
  756. ext: 'nes',
  757. mime: 'application/x-nintendo-nes-rom'
  758. };
  759. }
  760. if (checkString('Cr24')) {
  761. return {
  762. ext: 'crx',
  763. mime: 'application/x-google-chrome-extension'
  764. };
  765. }
  766. if (
  767. checkString('MSCF') ||
  768. checkString('ISc(')
  769. ) {
  770. return {
  771. ext: 'cab',
  772. mime: 'application/vnd.ms-cab-compressed'
  773. };
  774. }
  775. if (check([0xED, 0xAB, 0xEE, 0xDB])) {
  776. return {
  777. ext: 'rpm',
  778. mime: 'application/x-rpm'
  779. };
  780. }
  781. if (check([0xC5, 0xD0, 0xD3, 0xC6])) {
  782. return {
  783. ext: 'eps',
  784. mime: 'application/eps'
  785. };
  786. }
  787. // -- 5-byte signatures --
  788. if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
  789. return {
  790. ext: 'otf',
  791. mime: 'font/otf'
  792. };
  793. }
  794. if (checkString('#!AMR')) {
  795. return {
  796. ext: 'amr',
  797. mime: 'audio/amr'
  798. };
  799. }
  800. if (checkString('{\\rtf')) {
  801. return {
  802. ext: 'rtf',
  803. mime: 'application/rtf'
  804. };
  805. }
  806. if (check([0x46, 0x4C, 0x56, 0x01])) {
  807. return {
  808. ext: 'flv',
  809. mime: 'video/x-flv'
  810. };
  811. }
  812. if (checkString('IMPM')) {
  813. return {
  814. ext: 'it',
  815. mime: 'audio/x-it'
  816. };
  817. }
  818. if (
  819. checkString('-lh0-', {offset: 2}) ||
  820. checkString('-lh1-', {offset: 2}) ||
  821. checkString('-lh2-', {offset: 2}) ||
  822. checkString('-lh3-', {offset: 2}) ||
  823. checkString('-lh4-', {offset: 2}) ||
  824. checkString('-lh5-', {offset: 2}) ||
  825. checkString('-lh6-', {offset: 2}) ||
  826. checkString('-lh7-', {offset: 2}) ||
  827. checkString('-lzs-', {offset: 2}) ||
  828. checkString('-lz4-', {offset: 2}) ||
  829. checkString('-lz5-', {offset: 2}) ||
  830. checkString('-lhd-', {offset: 2})
  831. ) {
  832. return {
  833. ext: 'lzh',
  834. mime: 'application/x-lzh-compressed'
  835. };
  836. }
  837. // MPEG program stream (PS or MPEG-PS)
  838. if (check([0x00, 0x00, 0x01, 0xBA])) {
  839. // MPEG-PS, MPEG-1 Part 1
  840. if (check([0x21], {offset: 4, mask: [0xF1]})) {
  841. return {
  842. ext: 'mpg', // May also be .ps, .mpeg
  843. mime: 'video/MP1S'
  844. };
  845. }
  846. // MPEG-PS, MPEG-2 Part 1
  847. if (check([0x44], {offset: 4, mask: [0xC4]})) {
  848. return {
  849. ext: 'mpg', // May also be .mpg, .m2p, .vob or .sub
  850. mime: 'video/MP2P'
  851. };
  852. }
  853. }
  854. // -- 6-byte signatures --
  855. if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {
  856. return {
  857. ext: 'xz',
  858. mime: 'application/x-xz'
  859. };
  860. }
  861. if (checkString('<?xml ')) {
  862. return {
  863. ext: 'xml',
  864. mime: 'application/xml'
  865. };
  866. }
  867. if (checkString('BEGIN:')) {
  868. return {
  869. ext: 'ics',
  870. mime: 'text/calendar'
  871. };
  872. }
  873. if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
  874. return {
  875. ext: '7z',
  876. mime: 'application/x-7z-compressed'
  877. };
  878. }
  879. if (
  880. check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) &&
  881. (buffer[6] === 0x0 || buffer[6] === 0x1)
  882. ) {
  883. return {
  884. ext: 'rar',
  885. mime: 'application/x-rar-compressed'
  886. };
  887. }
  888. // -- 7-byte signatures --
  889. if (checkString('BLENDER')) {
  890. return {
  891. ext: 'blend',
  892. mime: 'application/x-blender'
  893. };
  894. }
  895. if (checkString('!<arch>')) {
  896. await tokenizer.ignore(8);
  897. const str = await tokenizer.readToken(new Token.StringType(13, 'ascii'));
  898. if (str === 'debian-binary') {
  899. return {
  900. ext: 'deb',
  901. mime: 'application/x-deb'
  902. };
  903. }
  904. return {
  905. ext: 'ar',
  906. mime: 'application/x-unix-archive'
  907. };
  908. }
  909. // -- 8-byte signatures --
  910. if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) {
  911. // APNG format (https://wiki.mozilla.org/APNG_Specification)
  912. // 1. Find the first IDAT (image data) chunk (49 44 41 54)
  913. // 2. Check if there is an "acTL" chunk before the IDAT one (61 63 54 4C)
  914. // Offset calculated as follows:
  915. // - 8 bytes: PNG signature
  916. // - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk
  917. await tokenizer.ignore(8); // ignore PNG signature
  918. async function readChunkHeader() {
  919. return {
  920. length: await tokenizer.readToken(Token.INT32_BE),
  921. type: await tokenizer.readToken(new Token.StringType(4, 'binary'))
  922. };
  923. }
  924. do {
  925. const chunk = await readChunkHeader();
  926. switch (chunk.type) {
  927. case 'IDAT':
  928. return {
  929. ext: 'png',
  930. mime: 'image/png'
  931. };
  932. case 'acTL':
  933. return {
  934. ext: 'apng',
  935. mime: 'image/apng'
  936. };
  937. default:
  938. await tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC
  939. }
  940. } while (tokenizer.position < tokenizer.fileInfo.size);
  941. return {
  942. ext: 'png',
  943. mime: 'image/png'
  944. };
  945. }
  946. if (check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) {
  947. return {
  948. ext: 'arrow',
  949. mime: 'application/x-apache-arrow'
  950. };
  951. }
  952. if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) {
  953. return {
  954. ext: 'glb',
  955. mime: 'model/gltf-binary'
  956. };
  957. }
  958. // `mov` format variants
  959. if (
  960. check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // `free`
  961. check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // `mdat` MJPEG
  962. check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // `moov`
  963. check([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide`
  964. ) {
  965. return {
  966. ext: 'mov',
  967. mime: 'video/quicktime'
  968. };
  969. }
  970. // -- 9-byte signatures --
  971. if (check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) {
  972. return {
  973. ext: 'orf',
  974. mime: 'image/x-olympus-orf'
  975. };
  976. }
  977. // -- 12-byte signatures --
  978. if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {
  979. return {
  980. ext: 'rw2',
  981. mime: 'image/x-panasonic-rw2'
  982. };
  983. }
  984. // ASF_Header_Object first 80 bytes
  985. if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) {
  986. async function readHeader() {
  987. const guid = Buffer.alloc(16);
  988. await tokenizer.readBuffer(guid);
  989. return {
  990. id: guid,
  991. size: await tokenizer.readToken(Token.UINT64_LE)
  992. };
  993. }
  994. await tokenizer.ignore(30);
  995. // Search for header should be in first 1KB of file.
  996. while (tokenizer.position + 24 < tokenizer.fileInfo.size) {
  997. const header = await readHeader();
  998. let payload = header.size - 24;
  999. if (_check(header.id, [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65])) {
  1000. // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365)
  1001. const typeId = Buffer.alloc(16);
  1002. payload -= await tokenizer.readBuffer(typeId);
  1003. if (_check(typeId, [0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {
  1004. // Found audio:
  1005. return {
  1006. ext: 'wma',
  1007. mime: 'audio/x-ms-wma'
  1008. };
  1009. }
  1010. if (_check(typeId, [0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {
  1011. // Found video:
  1012. return {
  1013. ext: 'wmv',
  1014. mime: 'video/x-ms-asf'
  1015. };
  1016. }
  1017. break;
  1018. }
  1019. await tokenizer.ignore(payload);
  1020. }
  1021. // Default to ASF generic extension
  1022. return {
  1023. ext: 'asf',
  1024. mime: 'application/vnd.ms-asf'
  1025. };
  1026. }
  1027. if (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) {
  1028. return {
  1029. ext: 'ktx',
  1030. mime: 'image/ktx'
  1031. };
  1032. }
  1033. if ((check([0x7E, 0x10, 0x04]) || check([0x7E, 0x18, 0x04])) && check([0x30, 0x4D, 0x49, 0x45], {offset: 4})) {
  1034. return {
  1035. ext: 'mie',
  1036. mime: 'application/x-mie'
  1037. };
  1038. }
  1039. if (check([0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], {offset: 2})) {
  1040. return {
  1041. ext: 'shp',
  1042. mime: 'application/x-esri-shape'
  1043. };
  1044. }
  1045. if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {
  1046. // JPEG-2000 family
  1047. await tokenizer.ignore(20);
  1048. const type = await tokenizer.readToken(new Token.StringType(4, 'ascii'));
  1049. switch (type) {
  1050. case 'jp2 ':
  1051. return {
  1052. ext: 'jp2',
  1053. mime: 'image/jp2'
  1054. };
  1055. case 'jpx ':
  1056. return {
  1057. ext: 'jpx',
  1058. mime: 'image/jpx'
  1059. };
  1060. case 'jpm ':
  1061. return {
  1062. ext: 'jpm',
  1063. mime: 'image/jpm'
  1064. };
  1065. case 'mjp2':
  1066. return {
  1067. ext: 'mj2',
  1068. mime: 'image/mj2'
  1069. };
  1070. default:
  1071. return;
  1072. }
  1073. }
  1074. // -- Unsafe signatures --
  1075. if (
  1076. check([0x0, 0x0, 0x1, 0xBA]) ||
  1077. check([0x0, 0x0, 0x1, 0xB3])
  1078. ) {
  1079. return {
  1080. ext: 'mpg',
  1081. mime: 'video/mpeg'
  1082. };
  1083. }
  1084. if (check([0x00, 0x01, 0x00, 0x00, 0x00])) {
  1085. return {
  1086. ext: 'ttf',
  1087. mime: 'font/ttf'
  1088. };
  1089. }
  1090. if (check([0x00, 0x00, 0x01, 0x00])) {
  1091. return {
  1092. ext: 'ico',
  1093. mime: 'image/x-icon'
  1094. };
  1095. }
  1096. if (check([0x00, 0x00, 0x02, 0x00])) {
  1097. return {
  1098. ext: 'cur',
  1099. mime: 'image/x-icon'
  1100. };
  1101. }
  1102. // Increase sample size from 12 to 256.
  1103. await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});
  1104. // `raf` is here just to keep all the raw image detectors together.
  1105. if (checkString('FUJIFILMCCD-RAW')) {
  1106. return {
  1107. ext: 'raf',
  1108. mime: 'image/x-fujifilm-raf'
  1109. };
  1110. }
  1111. if (checkString('Extended Module:')) {
  1112. return {
  1113. ext: 'xm',
  1114. mime: 'audio/x-xm'
  1115. };
  1116. }
  1117. if (checkString('Creative Voice File')) {
  1118. return {
  1119. ext: 'voc',
  1120. mime: 'audio/x-voc'
  1121. };
  1122. }
  1123. if (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR
  1124. const jsonSize = buffer.readUInt32LE(12);
  1125. if (jsonSize > 12 && jsonSize < 240 && buffer.length >= jsonSize + 16) {
  1126. try {
  1127. const header = buffer.slice(16, jsonSize + 16).toString();
  1128. const json = JSON.parse(header);
  1129. // Check if Pickle is ASAR
  1130. if (json.files) { // Final check, assuring Pickle/ASAR format
  1131. return {
  1132. ext: 'asar',
  1133. mime: 'application/x-asar'
  1134. };
  1135. }
  1136. } catch (_) {
  1137. }
  1138. }
  1139. }
  1140. if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E])) {
  1141. return {
  1142. ext: 'msi',
  1143. mime: 'application/x-msi'
  1144. };
  1145. }
  1146. if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) {
  1147. return {
  1148. ext: 'mxf',
  1149. mime: 'application/mxf'
  1150. };
  1151. }
  1152. if (checkString('SCRM', {offset: 44})) {
  1153. return {
  1154. ext: 's3m',
  1155. mime: 'audio/x-s3m'
  1156. };
  1157. }
  1158. if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) {
  1159. return {
  1160. ext: 'mts',
  1161. mime: 'video/mp2t'
  1162. };
  1163. }
  1164. if (check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {offset: 60})) {
  1165. return {
  1166. ext: 'mobi',
  1167. mime: 'application/x-mobipocket-ebook'
  1168. };
  1169. }
  1170. if (check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) {
  1171. return {
  1172. ext: 'dcm',
  1173. mime: 'application/dicom'
  1174. };
  1175. }
  1176. if (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) {
  1177. return {
  1178. ext: 'lnk',
  1179. mime: 'application/x.ms.shortcut' // Invented by us
  1180. };
  1181. }
  1182. if (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) {
  1183. return {
  1184. ext: 'alias',
  1185. mime: 'application/x.apple.alias' // Invented by us
  1186. };
  1187. }
  1188. if (
  1189. check([0x4C, 0x50], {offset: 34}) &&
  1190. (
  1191. check([0x00, 0x00, 0x01], {offset: 8}) ||
  1192. check([0x01, 0x00, 0x02], {offset: 8}) ||
  1193. check([0x02, 0x00, 0x02], {offset: 8})
  1194. )
  1195. ) {
  1196. return {
  1197. ext: 'eot',
  1198. mime: 'application/vnd.ms-fontobject'
  1199. };
  1200. }
  1201. if (check([0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D])) {
  1202. return {
  1203. ext: 'indd',
  1204. mime: 'application/x-indesign'
  1205. };
  1206. }
  1207. // Increase sample size from 256 to 512
  1208. await tokenizer.peekBuffer(buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true});
  1209. // Requires a buffer size of 512 bytes
  1210. if (tarHeaderChecksumMatches(buffer)) {
  1211. return {
  1212. ext: 'tar',
  1213. mime: 'application/x-tar'
  1214. };
  1215. }
  1216. if (check([0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00])) {
  1217. return {
  1218. ext: 'skp',
  1219. mime: 'application/vnd.sketchup.skp'
  1220. };
  1221. }
  1222. if (checkString('-----BEGIN PGP MESSAGE-----')) {
  1223. return {
  1224. ext: 'pgp',
  1225. mime: 'application/pgp-encrypted'
  1226. };
  1227. }
  1228. // Check for MPEG header at different starting offsets
  1229. for (let start = 0; start < 2 && start < (buffer.length - 16); start++) {
  1230. // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
  1231. if (buffer.length >= start + 2 && check([0xFF, 0xE0], {offset: start, mask: [0xFF, 0xE0]})) {
  1232. if (check([0x10], {offset: start + 1, mask: [0x16]})) {
  1233. // Check for (ADTS) MPEG-2
  1234. if (check([0x08], {offset: start + 1, mask: [0x08]})) {
  1235. return {
  1236. ext: 'aac',
  1237. mime: 'audio/aac'
  1238. };
  1239. }
  1240. // Must be (ADTS) MPEG-4
  1241. return {
  1242. ext: 'aac',
  1243. mime: 'audio/aac'
  1244. };
  1245. }
  1246. // MPEG 1 or 2 Layer 3 header
  1247. // Check for MPEG layer 3
  1248. if (check([0x02], {offset: start + 1, mask: [0x06]})) {
  1249. return {
  1250. ext: 'mp3',
  1251. mime: 'audio/mpeg'
  1252. };
  1253. }
  1254. // Check for MPEG layer 2
  1255. if (check([0x04], {offset: start + 1, mask: [0x06]})) {
  1256. return {
  1257. ext: 'mp2',
  1258. mime: 'audio/mpeg'
  1259. };
  1260. }
  1261. // Check for MPEG layer 1
  1262. if (check([0x06], {offset: start + 1, mask: [0x06]})) {
  1263. return {
  1264. ext: 'mp1',
  1265. mime: 'audio/mpeg'
  1266. };
  1267. }
  1268. }
  1269. }
  1270. }
  1271. const stream = readableStream => new Promise((resolve, reject) => {
  1272. // Using `eval` to work around issues when bundling with Webpack
  1273. const stream = eval('require')('stream'); // eslint-disable-line no-eval
  1274. readableStream.on('error', reject);
  1275. readableStream.once('readable', async () => {
  1276. // Set up output stream
  1277. const pass = new stream.PassThrough();
  1278. let outputStream;
  1279. if (stream.pipeline) {
  1280. outputStream = stream.pipeline(readableStream, pass, () => {
  1281. });
  1282. } else {
  1283. outputStream = readableStream.pipe(pass);
  1284. }
  1285. // Read the input stream and detect the filetype
  1286. const chunk = readableStream.read(minimumBytes) || readableStream.read() || Buffer.alloc(0);
  1287. try {
  1288. const fileType = await fromBuffer(chunk);
  1289. pass.fileType = fileType;
  1290. } catch (error) {
  1291. reject(error);
  1292. }
  1293. resolve(outputStream);
  1294. });
  1295. });
  1296. const fileType = {
  1297. fromStream,
  1298. fromTokenizer,
  1299. fromBuffer,
  1300. stream
  1301. };
  1302. Object.defineProperty(fileType, 'extensions', {
  1303. get() {
  1304. return new Set(supported.extensions);
  1305. }
  1306. });
  1307. Object.defineProperty(fileType, 'mimeTypes', {
  1308. get() {
  1309. return new Set(supported.mimeTypes);
  1310. }
  1311. });
  1312. module.exports = fileType;
  1313. /***/ }),
  1314. /***/ "./node_modules/imagemin/node_modules/file-type/index.js":
  1315. /*!***************************************************************!*\
  1316. !*** ./node_modules/imagemin/node_modules/file-type/index.js ***!
  1317. \***************************************************************/
  1318. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1319. const strtok3 = __webpack_require__(/*! strtok3 */ "strtok3");
  1320. const core = __webpack_require__(/*! ./core */ "./node_modules/imagemin/node_modules/file-type/core.js");
  1321. async function fromFile(path) {
  1322. const tokenizer = await strtok3.fromFile(path);
  1323. try {
  1324. return await core.fromTokenizer(tokenizer);
  1325. } finally {
  1326. await tokenizer.close();
  1327. }
  1328. }
  1329. const fileType = {
  1330. fromFile
  1331. };
  1332. Object.assign(fileType, core);
  1333. Object.defineProperty(fileType, 'extensions', {
  1334. get() {
  1335. return core.extensions;
  1336. }
  1337. });
  1338. Object.defineProperty(fileType, 'mimeTypes', {
  1339. get() {
  1340. return core.mimeTypes;
  1341. }
  1342. });
  1343. module.exports = fileType;
  1344. /***/ }),
  1345. /***/ "./node_modules/imagemin/node_modules/file-type/supported.js":
  1346. /*!*******************************************************************!*\
  1347. !*** ./node_modules/imagemin/node_modules/file-type/supported.js ***!
  1348. \*******************************************************************/
  1349. /***/ ((module) => {
  1350. module.exports = {
  1351. extensions: [
  1352. 'jpg',
  1353. 'png',
  1354. 'apng',
  1355. 'gif',
  1356. 'webp',
  1357. 'flif',
  1358. 'cr2',
  1359. 'cr3',
  1360. 'orf',
  1361. 'arw',
  1362. 'dng',
  1363. 'nef',
  1364. 'rw2',
  1365. 'raf',
  1366. 'tif',
  1367. 'bmp',
  1368. 'icns',
  1369. 'jxr',
  1370. 'psd',
  1371. 'indd',
  1372. 'zip',
  1373. 'tar',
  1374. 'rar',
  1375. 'gz',
  1376. 'bz2',
  1377. '7z',
  1378. 'dmg',
  1379. 'mp4',
  1380. 'mid',
  1381. 'mkv',
  1382. 'webm',
  1383. 'mov',
  1384. 'avi',
  1385. 'mpg',
  1386. 'mp2',
  1387. 'mp3',
  1388. 'm4a',
  1389. 'oga',
  1390. 'ogg',
  1391. 'ogv',
  1392. 'opus',
  1393. 'flac',
  1394. 'wav',
  1395. 'spx',
  1396. 'amr',
  1397. 'pdf',
  1398. 'epub',
  1399. 'exe',
  1400. 'swf',
  1401. 'rtf',
  1402. 'wasm',
  1403. 'woff',
  1404. 'woff2',
  1405. 'eot',
  1406. 'ttf',
  1407. 'otf',
  1408. 'ico',
  1409. 'flv',
  1410. 'ps',
  1411. 'xz',
  1412. 'sqlite',
  1413. 'nes',
  1414. 'crx',
  1415. 'xpi',
  1416. 'cab',
  1417. 'deb',
  1418. 'ar',
  1419. 'rpm',
  1420. 'Z',
  1421. 'lz',
  1422. 'msi',
  1423. 'mxf',
  1424. 'mts',
  1425. 'blend',
  1426. 'bpg',
  1427. 'docx',
  1428. 'pptx',
  1429. 'xlsx',
  1430. '3gp',
  1431. '3g2',
  1432. 'jp2',
  1433. 'jpm',
  1434. 'jpx',
  1435. 'mj2',
  1436. 'aif',
  1437. 'qcp',
  1438. 'odt',
  1439. 'ods',
  1440. 'odp',
  1441. 'xml',
  1442. 'mobi',
  1443. 'heic',
  1444. 'cur',
  1445. 'ktx',
  1446. 'ape',
  1447. 'wv',
  1448. 'wmv',
  1449. 'wma',
  1450. 'dcm',
  1451. 'ics',
  1452. 'glb',
  1453. 'pcap',
  1454. 'dsf',
  1455. 'lnk',
  1456. 'alias',
  1457. 'voc',
  1458. 'ac3',
  1459. 'm4v',
  1460. 'm4p',
  1461. 'm4b',
  1462. 'f4v',
  1463. 'f4p',
  1464. 'f4b',
  1465. 'f4a',
  1466. 'mie',
  1467. 'asf',
  1468. 'ogm',
  1469. 'ogx',
  1470. 'mpc',
  1471. 'arrow',
  1472. 'shp',
  1473. 'aac',
  1474. 'mp1',
  1475. 'it',
  1476. 's3m',
  1477. 'xm',
  1478. 'ai',
  1479. 'skp',
  1480. 'avif',
  1481. 'eps',
  1482. 'lzh',
  1483. 'pgp',
  1484. 'asar'
  1485. ],
  1486. mimeTypes: [
  1487. 'image/jpeg',
  1488. 'image/png',
  1489. 'image/gif',
  1490. 'image/webp',
  1491. 'image/flif',
  1492. 'image/x-canon-cr2',
  1493. 'image/x-canon-cr3',
  1494. 'image/tiff',
  1495. 'image/bmp',
  1496. 'image/vnd.ms-photo',
  1497. 'image/vnd.adobe.photoshop',
  1498. 'application/x-indesign',
  1499. 'application/epub+zip',
  1500. 'application/x-xpinstall',
  1501. 'application/vnd.oasis.opendocument.text',
  1502. 'application/vnd.oasis.opendocument.spreadsheet',
  1503. 'application/vnd.oasis.opendocument.presentation',
  1504. 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
  1505. 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
  1506. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
  1507. 'application/zip',
  1508. 'application/x-tar',
  1509. 'application/x-rar-compressed',
  1510. 'application/gzip',
  1511. 'application/x-bzip2',
  1512. 'application/x-7z-compressed',
  1513. 'application/x-apple-diskimage',
  1514. 'application/x-apache-arrow',
  1515. 'video/mp4',
  1516. 'audio/midi',
  1517. 'video/x-matroska',
  1518. 'video/webm',
  1519. 'video/quicktime',
  1520. 'video/vnd.avi',
  1521. 'audio/vnd.wave',
  1522. 'audio/qcelp',
  1523. 'audio/x-ms-wma',
  1524. 'video/x-ms-asf',
  1525. 'application/vnd.ms-asf',
  1526. 'video/mpeg',
  1527. 'video/3gpp',
  1528. 'audio/mpeg',
  1529. 'audio/mp4', // RFC 4337
  1530. 'audio/opus',
  1531. 'video/ogg',
  1532. 'audio/ogg',
  1533. 'application/ogg',
  1534. 'audio/x-flac',
  1535. 'audio/ape',
  1536. 'audio/wavpack',
  1537. 'audio/amr',
  1538. 'application/pdf',
  1539. 'application/x-msdownload',
  1540. 'application/x-shockwave-flash',
  1541. 'application/rtf',
  1542. 'application/wasm',
  1543. 'font/woff',
  1544. 'font/woff2',
  1545. 'application/vnd.ms-fontobject',
  1546. 'font/ttf',
  1547. 'font/otf',
  1548. 'image/x-icon',
  1549. 'video/x-flv',
  1550. 'application/postscript',
  1551. 'application/eps',
  1552. 'application/x-xz',
  1553. 'application/x-sqlite3',
  1554. 'application/x-nintendo-nes-rom',
  1555. 'application/x-google-chrome-extension',
  1556. 'application/vnd.ms-cab-compressed',
  1557. 'application/x-deb',
  1558. 'application/x-unix-archive',
  1559. 'application/x-rpm',
  1560. 'application/x-compress',
  1561. 'application/x-lzip',
  1562. 'application/x-msi',
  1563. 'application/x-mie',
  1564. 'application/mxf',
  1565. 'video/mp2t',
  1566. 'application/x-blender',
  1567. 'image/bpg',
  1568. 'image/jp2',
  1569. 'image/jpx',
  1570. 'image/jpm',
  1571. 'image/mj2',
  1572. 'audio/aiff',
  1573. 'application/xml',
  1574. 'application/x-mobipocket-ebook',
  1575. 'image/heif',
  1576. 'image/heif-sequence',
  1577. 'image/heic',
  1578. 'image/heic-sequence',
  1579. 'image/icns',
  1580. 'image/ktx',
  1581. 'application/dicom',
  1582. 'audio/x-musepack',
  1583. 'text/calendar',
  1584. 'model/gltf-binary',
  1585. 'application/vnd.tcpdump.pcap',
  1586. 'audio/x-dsf', // Non-standard
  1587. 'application/x.ms.shortcut', // Invented by us
  1588. 'application/x.apple.alias', // Invented by us
  1589. 'audio/x-voc',
  1590. 'audio/vnd.dolby.dd-raw',
  1591. 'audio/x-m4a',
  1592. 'image/apng',
  1593. 'image/x-olympus-orf',
  1594. 'image/x-sony-arw',
  1595. 'image/x-adobe-dng',
  1596. 'image/x-nikon-nef',
  1597. 'image/x-panasonic-rw2',
  1598. 'image/x-fujifilm-raf',
  1599. 'video/x-m4v',
  1600. 'video/3gpp2',
  1601. 'application/x-esri-shape',
  1602. 'audio/aac',
  1603. 'audio/x-it',
  1604. 'audio/x-s3m',
  1605. 'audio/x-xm',
  1606. 'video/MP1S',
  1607. 'video/MP2P',
  1608. 'application/vnd.sketchup.skp',
  1609. 'image/avif',
  1610. 'application/x-lzh-compressed',
  1611. 'application/pgp-encrypted',
  1612. 'application/x-asar'
  1613. ]
  1614. };
  1615. /***/ }),
  1616. /***/ "./node_modules/imagemin/node_modules/file-type/util.js":
  1617. /*!**************************************************************!*\
  1618. !*** ./node_modules/imagemin/node_modules/file-type/util.js ***!
  1619. \**************************************************************/
  1620. /***/ ((__unused_webpack_module, exports) => {
  1621. exports.stringToBytes = string => [...string].map(character => character.charCodeAt(0));
  1622. exports.tarHeaderChecksumMatches = buffer => { // Does not check if checksum field characters are valid
  1623. if (buffer.length < 512) { // `tar` header size, cannot compute checksum without it
  1624. return false;
  1625. }
  1626. const readSum = parseInt(buffer.toString('utf8', 148, 154).replace(/\0.*$/, '').trim(), 8); // Read sum in header
  1627. if (isNaN(readSum)) {
  1628. return false;
  1629. }
  1630. const MASK_8TH_BIT = 0x80;
  1631. let sum = 256; // Initialize sum, with 256 as sum of 8 spaces in checksum field
  1632. let signedBitSum = 0; // Initialize signed bit sum
  1633. for (let i = 0; i < 148; i++) {
  1634. const byte = buffer[i];
  1635. sum += byte;
  1636. signedBitSum += byte & MASK_8TH_BIT; // Add signed bit to signed bit sum
  1637. }
  1638. // Skip checksum field
  1639. for (let i = 156; i < 512; i++) {
  1640. const byte = buffer[i];
  1641. sum += byte;
  1642. signedBitSum += byte & MASK_8TH_BIT; // Add signed bit to signed bit sum
  1643. }
  1644. // Some implementations compute checksum incorrectly using signed bytes
  1645. return (
  1646. // Checksum in header equals the sum we calculated
  1647. readSum === sum ||
  1648. // Checksum in header equals sum we calculated plus signed-to-unsigned delta
  1649. readSum === (sum - (signedBitSum << 1))
  1650. );
  1651. };
  1652. /**
  1653. ID3 UINT32 sync-safe tokenizer token.
  1654. 28 bits (representing up to 256MB) integer, the msb is 0 to avoid "false syncsignals".
  1655. */
  1656. exports.uint32SyncSafeToken = {
  1657. get: (buffer, offset) => {
  1658. return (buffer[offset + 3] & 0x7F) | ((buffer[offset + 2]) << 7) | ((buffer[offset + 1]) << 14) | ((buffer[offset]) << 21);
  1659. },
  1660. len: 4
  1661. };
  1662. /***/ }),
  1663. /***/ "./node_modules/is-png/index.js":
  1664. /*!**************************************!*\
  1665. !*** ./node_modules/is-png/index.js ***!
  1666. \**************************************/
  1667. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1668. __webpack_require__.r(__webpack_exports__);
  1669. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1670. /* harmony export */ "default": () => (/* binding */ isPng)
  1671. /* harmony export */ });
  1672. function isPng(buffer) {
  1673. if (!buffer || buffer.length < 8) {
  1674. return false;
  1675. }
  1676. return (
  1677. buffer[0] === 0x89 &&
  1678. buffer[1] === 0x50 &&
  1679. buffer[2] === 0x4E &&
  1680. buffer[3] === 0x47 &&
  1681. buffer[4] === 0x0D &&
  1682. buffer[5] === 0x0A &&
  1683. buffer[6] === 0x1A &&
  1684. buffer[7] === 0x0A
  1685. );
  1686. }
  1687. /***/ }),
  1688. /***/ "./node_modules/p-pipe/index.js":
  1689. /*!**************************************!*\
  1690. !*** ./node_modules/p-pipe/index.js ***!
  1691. \**************************************/
  1692. /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
  1693. __webpack_require__.r(__webpack_exports__);
  1694. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1695. /* harmony export */ "default": () => (/* binding */ pPipe)
  1696. /* harmony export */ });
  1697. function pPipe(...functions) {
  1698. if (functions.length === 0) {
  1699. throw new Error('Expected at least one argument');
  1700. }
  1701. return async input => {
  1702. let currentValue = input;
  1703. for (const function_ of functions) {
  1704. currentValue = await function_(currentValue); // eslint-disable-line no-await-in-loop
  1705. }
  1706. return currentValue;
  1707. };
  1708. }
  1709. /***/ }),
  1710. /***/ "./src/api/tauricon.ts":
  1711. /*!*****************************!*\
  1712. !*** ./src/api/tauricon.ts ***!
  1713. \*****************************/
  1714. /***/ (function(module, exports, __webpack_require__) {
  1715. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  1716. // SPDX-License-Identifier: Apache-2.0
  1717. // SPDX-License-Identifier: MIT
  1718. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  1719. if (k2 === undefined) k2 = k;
  1720. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  1721. }) : (function(o, m, k, k2) {
  1722. if (k2 === undefined) k2 = k;
  1723. o[k2] = m[k];
  1724. }));
  1725. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  1726. Object.defineProperty(o, "default", { enumerable: true, value: v });
  1727. }) : function(o, v) {
  1728. o["default"] = v;
  1729. });
  1730. var __importStar = (this && this.__importStar) || function (mod) {
  1731. if (mod && mod.__esModule) return mod;
  1732. var result = {};
  1733. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  1734. __setModuleDefault(result, mod);
  1735. return result;
  1736. };
  1737. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  1738. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  1739. return new (P || (P = Promise))(function (resolve, reject) {
  1740. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1741. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1742. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  1743. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1744. });
  1745. };
  1746. var __generator = (this && this.__generator) || function (thisArg, body) {
  1747. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  1748. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  1749. function verb(n) { return function (v) { return step([n, v]); }; }
  1750. function step(op) {
  1751. if (f) throw new TypeError("Generator is already executing.");
  1752. while (_) try {
  1753. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  1754. if (y = 0, t) op = [op[0] & 2, t.value];
  1755. switch (op[0]) {
  1756. case 0: case 1: t = op; break;
  1757. case 4: _.label++; return { value: op[1], done: false };
  1758. case 5: _.label++; y = op[1]; op = [0]; continue;
  1759. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  1760. default:
  1761. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  1762. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  1763. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  1764. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  1765. if (t[2]) _.ops.pop();
  1766. _.trys.pop(); continue;
  1767. }
  1768. op = body.call(thisArg, _);
  1769. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  1770. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  1771. }
  1772. };
  1773. var __importDefault = (this && this.__importDefault) || function (mod) {
  1774. return (mod && mod.__esModule) ? mod : { "default": mod };
  1775. };
  1776. Object.defineProperty(exports, "__esModule", ({ value: true }));
  1777. /* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call */
  1778. /**
  1779. * This is a module that takes an original image and resizes
  1780. * it to common icon sizes and will put them in a folder.
  1781. * It will retain transparency and can make special file
  1782. * types. You can control the settings.
  1783. *
  1784. * @module tauricon
  1785. * @exports tauricon
  1786. * @author Daniel Thompson-Yvetot
  1787. * @license MIT
  1788. */
  1789. var fs_extra_1 = __webpack_require__(/*! fs-extra */ "fs-extra");
  1790. var imagemin_1 = __importDefault(__webpack_require__(/*! imagemin */ "./node_modules/imagemin/index.js"));
  1791. var imagemin_optipng_1 = __importDefault(__webpack_require__(/*! imagemin-optipng */ "imagemin-optipng"));
  1792. var imagemin_zopfli_1 = __importDefault(__webpack_require__(/*! imagemin-zopfli */ "imagemin-zopfli"));
  1793. var is_png_1 = __importDefault(__webpack_require__(/*! is-png */ "./node_modules/is-png/index.js"));
  1794. var path_1 = __importDefault(__webpack_require__(/*! path */ "path"));
  1795. var png2icons = __importStar(__webpack_require__(/*! png2icons */ "png2icons"));
  1796. var read_chunk_1 = __importDefault(__webpack_require__(/*! read-chunk */ "read-chunk"));
  1797. var sharp_1 = __importDefault(__webpack_require__(/*! sharp */ "sharp"));
  1798. var app_paths_1 = __webpack_require__(/*! ../helpers/app-paths */ "./src/helpers/app-paths.ts");
  1799. var logger_1 = __importDefault(__webpack_require__(/*! ../helpers/logger */ "./src/helpers/logger.ts"));
  1800. var settings = __importStar(__webpack_require__(/*! ../helpers/tauricon.config */ "./src/helpers/tauricon.config.ts"));
  1801. var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
  1802. var package_json_1 = __webpack_require__(/*! ../../package.json */ "./package.json");
  1803. var log = logger_1.default('app:spawn');
  1804. var warn = logger_1.default('app:spawn', chalk_1.default.red);
  1805. var image = false;
  1806. var spinnerInterval = null;
  1807. var exists = function (file) {
  1808. return __awaiter(this, void 0, void 0, function () {
  1809. var err_1;
  1810. return __generator(this, function (_a) {
  1811. switch (_a.label) {
  1812. case 0:
  1813. _a.trys.push([0, 2, , 3]);
  1814. return [4 /*yield*/, fs_extra_1.access(file)];
  1815. case 1:
  1816. _a.sent();
  1817. return [2 /*return*/, true];
  1818. case 2:
  1819. err_1 = _a.sent();
  1820. return [2 /*return*/, false];
  1821. case 3: return [2 /*return*/];
  1822. }
  1823. });
  1824. });
  1825. };
  1826. /**
  1827. * This is the first call that attempts to memoize the sharp(src).
  1828. * If the source image cannot be found or if it is not a png, it
  1829. * is a failsafe that will exit or throw.
  1830. *
  1831. * @param {string} src - a folder to target
  1832. * @exits {error} if not a png, if not an image
  1833. */
  1834. var checkSrc = function (src) { return __awaiter(void 0, void 0, void 0, function () {
  1835. var srcExists, buffer, meta, stats;
  1836. return __generator(this, function (_a) {
  1837. switch (_a.label) {
  1838. case 0:
  1839. if (!(image !== false)) return [3 /*break*/, 1];
  1840. return [2 /*return*/, image];
  1841. case 1: return [4 /*yield*/, exists(src)];
  1842. case 2:
  1843. srcExists = _a.sent();
  1844. if (!!srcExists) return [3 /*break*/, 3];
  1845. image = false;
  1846. if (spinnerInterval)
  1847. clearInterval(spinnerInterval);
  1848. warn('[ERROR] Source image for tauricon not found');
  1849. process.exit(1);
  1850. return [3 /*break*/, 8];
  1851. case 3: return [4 /*yield*/, read_chunk_1.default(src, 0, 8)];
  1852. case 4:
  1853. buffer = _a.sent();
  1854. if (!is_png_1.default(buffer)) return [3 /*break*/, 7];
  1855. image = sharp_1.default(src);
  1856. return [4 /*yield*/, image.metadata()];
  1857. case 5:
  1858. meta = _a.sent();
  1859. if (!meta.hasAlpha || meta.channels !== 4) {
  1860. if (spinnerInterval)
  1861. clearInterval(spinnerInterval);
  1862. warn('[ERROR] Source png for tauricon is not transparent');
  1863. process.exit(1);
  1864. }
  1865. return [4 /*yield*/, image.stats()];
  1866. case 6:
  1867. stats = _a.sent();
  1868. if (stats.isOpaque) {
  1869. if (spinnerInterval)
  1870. clearInterval(spinnerInterval);
  1871. warn('[ERROR] Source png for tauricon could not be detected as transparent');
  1872. process.exit(1);
  1873. }
  1874. return [2 /*return*/, image];
  1875. case 7:
  1876. image = false;
  1877. if (spinnerInterval)
  1878. clearInterval(spinnerInterval);
  1879. warn('[ERROR] Source image for tauricon is not a png');
  1880. process.exit(1);
  1881. _a.label = 8;
  1882. case 8: return [2 /*return*/];
  1883. }
  1884. });
  1885. }); };
  1886. /**
  1887. * Sort the folders in the current job for unique folders.
  1888. *
  1889. * @param {object} options - a subset of the settings
  1890. * @returns {array} folders
  1891. */
  1892. // TODO: proper type of options and folders
  1893. var uniqueFolders = function (options) {
  1894. var folders = [];
  1895. for (var type in options) {
  1896. var option = options[String(type)];
  1897. if (option.folder) {
  1898. folders.push(option.folder);
  1899. }
  1900. }
  1901. // TODO: is compare argument required?
  1902. // eslint-disable-next-line @typescript-eslint/require-array-sort-compare
  1903. folders = folders.sort().filter(function (x, i, a) { return !i || x !== a[i - 1]; });
  1904. return folders;
  1905. };
  1906. /**
  1907. * Turn a hex color (like #212342) into r,g,b values
  1908. *
  1909. * @param {string} hex - hex colour
  1910. * @returns {array} r,g,b
  1911. */
  1912. var hexToRgb = function (hex) {
  1913. // https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
  1914. // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
  1915. var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  1916. hex = hex.replace(shorthandRegex, function (m, r, g, b) {
  1917. return r + r + g + g + b + b;
  1918. });
  1919. var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  1920. return result
  1921. ? {
  1922. r: parseInt(result[1], 16),
  1923. g: parseInt(result[2], 16),
  1924. b: parseInt(result[3], 16)
  1925. }
  1926. : undefined;
  1927. };
  1928. /**
  1929. * validate image and directory
  1930. */
  1931. var validate = function (src, target) { return __awaiter(void 0, void 0, void 0, function () {
  1932. var res;
  1933. return __generator(this, function (_a) {
  1934. switch (_a.label) {
  1935. case 0:
  1936. if (!(target !== undefined)) return [3 /*break*/, 2];
  1937. return [4 /*yield*/, fs_extra_1.ensureDir(target)];
  1938. case 1:
  1939. _a.sent();
  1940. _a.label = 2;
  1941. case 2: return [4 /*yield*/, checkSrc(src)];
  1942. case 3:
  1943. res = _a.sent();
  1944. return [2 /*return*/, res];
  1945. }
  1946. });
  1947. }); };
  1948. // TODO: should take end param?
  1949. /**
  1950. * Log progress in the command line
  1951. *
  1952. * @param {boolean} end
  1953. */
  1954. var progress = function (msg) {
  1955. process.stdout.write(" " + msg + " \r");
  1956. };
  1957. /**
  1958. * Create a spinner on the command line
  1959. *
  1960. * @example
  1961. *
  1962. * const spinnerInterval = spinner()
  1963. * // later
  1964. * clearInterval(spinnerInterval)
  1965. */
  1966. var spinner = function () {
  1967. if ('CI' in process.env || process.argv.some(function (arg) { return arg === '--ci'; })) {
  1968. return null;
  1969. }
  1970. return setInterval(function () {
  1971. process.stdout.write('/ \r');
  1972. setTimeout(function () {
  1973. process.stdout.write('- \r');
  1974. setTimeout(function () {
  1975. process.stdout.write('\\ \r');
  1976. setTimeout(function () {
  1977. process.stdout.write('| \r');
  1978. }, 100);
  1979. }, 100);
  1980. }, 100);
  1981. }, 500);
  1982. };
  1983. var tauricon = (exports.tauricon = {
  1984. validate: function (src, target) {
  1985. return __awaiter(this, void 0, void 0, function () {
  1986. return __generator(this, function (_a) {
  1987. switch (_a.label) {
  1988. case 0: return [4 /*yield*/, validate(src, target)];
  1989. case 1:
  1990. _a.sent();
  1991. return [2 /*return*/, typeof image === 'object'];
  1992. }
  1993. });
  1994. });
  1995. },
  1996. version: function () {
  1997. return package_json_1.version;
  1998. },
  1999. make: function (src, target, strategy,
  2000. // TODO: proper type for options
  2001. options) {
  2002. if (target === void 0) { target = path_1.default.resolve(app_paths_1.tauriDir, 'icons'); }
  2003. return __awaiter(this, void 0, void 0, function () {
  2004. return __generator(this, function (_a) {
  2005. switch (_a.label) {
  2006. case 0:
  2007. if (!src) {
  2008. src = path_1.default.resolve(app_paths_1.appDir, 'app-icon.png');
  2009. }
  2010. spinnerInterval = spinner();
  2011. options = options || settings.options.tauri;
  2012. progress("Building Tauri icns and ico from \"" + src + "\"");
  2013. return [4 /*yield*/, this.validate(src, target)];
  2014. case 1:
  2015. _a.sent();
  2016. return [4 /*yield*/, this.icns(src, target, options, strategy)];
  2017. case 2:
  2018. _a.sent();
  2019. progress('Building Tauri png icons');
  2020. return [4 /*yield*/, this.build(src, target, options)];
  2021. case 3:
  2022. _a.sent();
  2023. if (!strategy) return [3 /*break*/, 5];
  2024. progress("Minifying assets with " + strategy);
  2025. return [4 /*yield*/, this.minify(target, options, strategy, 'batch')];
  2026. case 4:
  2027. _a.sent();
  2028. return [3 /*break*/, 6];
  2029. case 5:
  2030. log('no minify strategy');
  2031. _a.label = 6;
  2032. case 6:
  2033. progress('Tauricon Finished');
  2034. if (spinnerInterval)
  2035. clearInterval(spinnerInterval);
  2036. return [2 /*return*/, true];
  2037. }
  2038. });
  2039. });
  2040. },
  2041. /**
  2042. * Creates a set of images according to the subset of options it knows about.
  2043. *
  2044. * @param {string} src - image location
  2045. * @param {string} target - where to drop the images
  2046. * @param {object} options - js object that defines path and sizes
  2047. */
  2048. build: function (src, target,
  2049. // TODO: proper type for options
  2050. options) {
  2051. return __awaiter(this, void 0, void 0, function () {
  2052. var sharpSrc, buildify2, output, folders, n, folder, _a, _b, _i, optionKey, option, _c, _d, _e, sizeKey, size, dest, pvar;
  2053. return __generator(this, function (_f) {
  2054. switch (_f.label) {
  2055. case 0: return [4 /*yield*/, this.validate(src, target)];
  2056. case 1:
  2057. _f.sent();
  2058. sharpSrc = sharp_1.default(src) // creates the image object
  2059. ;
  2060. buildify2 = function (pvar) {
  2061. return __awaiter(this, void 0, void 0, function () {
  2062. var pngImage, rgb, err_2;
  2063. return __generator(this, function (_a) {
  2064. switch (_a.label) {
  2065. case 0:
  2066. _a.trys.push([0, 2, , 3]);
  2067. pngImage = sharpSrc.resize(pvar[1], pvar[1]);
  2068. if (pvar[2]) {
  2069. rgb = hexToRgb(options.background_color) || {
  2070. r: undefined,
  2071. g: undefined,
  2072. b: undefined
  2073. };
  2074. pngImage.flatten({
  2075. background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 }
  2076. });
  2077. }
  2078. pngImage.png();
  2079. return [4 /*yield*/, pngImage.toFile(pvar[0])];
  2080. case 1:
  2081. _a.sent();
  2082. return [3 /*break*/, 3];
  2083. case 2:
  2084. err_2 = _a.sent();
  2085. warn(err_2);
  2086. return [3 /*break*/, 3];
  2087. case 3: return [2 /*return*/];
  2088. }
  2089. });
  2090. });
  2091. };
  2092. folders = uniqueFolders(options);
  2093. // eslint-disable-next-line @typescript-eslint/no-for-in-array
  2094. for (n in folders) {
  2095. folder = folders[Number(n)];
  2096. // make the folders first
  2097. // TODO: should this be ensureDirSync?
  2098. // eslint-disable-next-line @typescript-eslint/no-floating-promises
  2099. fs_extra_1.ensureDir("" + target + path_1.default.sep + folder);
  2100. }
  2101. _a = [];
  2102. for (_b in options)
  2103. _a.push(_b);
  2104. _i = 0;
  2105. _f.label = 2;
  2106. case 2:
  2107. if (!(_i < _a.length)) return [3 /*break*/, 7];
  2108. optionKey = _a[_i];
  2109. option = options[String(optionKey)];
  2110. _c = [];
  2111. for (_d in option.sizes)
  2112. _c.push(_d);
  2113. _e = 0;
  2114. _f.label = 3;
  2115. case 3:
  2116. if (!(_e < _c.length)) return [3 /*break*/, 6];
  2117. sizeKey = _c[_e];
  2118. size = option.sizes[String(sizeKey)];
  2119. if (!!option.splash) return [3 /*break*/, 5];
  2120. dest = target + "/" + option.folder;
  2121. if (option.infix === true) {
  2122. output = "" + dest + path_1.default.sep + option.prefix + size + "x" + size + option.suffix;
  2123. }
  2124. else {
  2125. output = "" + dest + path_1.default.sep + option.prefix + option.suffix;
  2126. }
  2127. pvar = [
  2128. output,
  2129. size,
  2130. option.background
  2131. ];
  2132. return [4 /*yield*/, buildify2(pvar)];
  2133. case 4:
  2134. _f.sent();
  2135. _f.label = 5;
  2136. case 5:
  2137. _e++;
  2138. return [3 /*break*/, 3];
  2139. case 6:
  2140. _i++;
  2141. return [3 /*break*/, 2];
  2142. case 7: return [2 /*return*/];
  2143. }
  2144. });
  2145. });
  2146. },
  2147. /**
  2148. * Creates a set of splash images (COMING SOON!!!)
  2149. *
  2150. * @param {string} src - icon location
  2151. * @param {string} splashSrc - splashscreen location
  2152. * @param {string} target - where to drop the images
  2153. * @param {object} options - js object that defines path and sizes
  2154. */
  2155. splash: function (src, splashSrc, target,
  2156. // TODO: proper type for options
  2157. options) {
  2158. return __awaiter(this, void 0, void 0, function () {
  2159. var output, block, rgb, sharpSrc, data, _a, _b, _i, optionKey, option, _c, _d, _e, sizeKey, size, dest, pvar, sharpData;
  2160. return __generator(this, function (_f) {
  2161. switch (_f.label) {
  2162. case 0:
  2163. block = false;
  2164. rgb = hexToRgb(options.background_color) || {
  2165. r: undefined,
  2166. g: undefined,
  2167. b: undefined
  2168. };
  2169. if (splashSrc === src) {
  2170. // prevent overlay or pure
  2171. block = true;
  2172. }
  2173. if (!(block || options.splashscreen_type === 'generate')) return [3 /*break*/, 2];
  2174. return [4 /*yield*/, this.validate(src, target)];
  2175. case 1:
  2176. _f.sent();
  2177. if (!image) {
  2178. process.exit(1);
  2179. }
  2180. sharpSrc = sharp_1.default(src);
  2181. sharpSrc
  2182. .extend({
  2183. top: 726,
  2184. bottom: 726,
  2185. left: 726,
  2186. right: 726,
  2187. background: {
  2188. r: rgb.r,
  2189. g: rgb.g,
  2190. b: rgb.b,
  2191. alpha: 1
  2192. }
  2193. })
  2194. .flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } });
  2195. return [3 /*break*/, 3];
  2196. case 2:
  2197. if (options.splashscreen_type === 'overlay') {
  2198. sharpSrc = sharp_1.default(splashSrc)
  2199. .flatten({ background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 } })
  2200. .composite([
  2201. {
  2202. input: src
  2203. // blend: 'multiply' <= future work, maybe just a gag
  2204. }
  2205. ]);
  2206. }
  2207. else if (options.splashscreen_type === 'pure') {
  2208. sharpSrc = sharp_1.default(splashSrc).flatten({
  2209. background: { r: rgb.r, g: rgb.g, b: rgb.b, alpha: 1 }
  2210. });
  2211. }
  2212. else {
  2213. throw new Error("unknown options.splashscreen_type: " + options.splashscreen_type);
  2214. }
  2215. _f.label = 3;
  2216. case 3: return [4 /*yield*/, sharpSrc.toBuffer()];
  2217. case 4:
  2218. data = _f.sent();
  2219. _a = [];
  2220. for (_b in options)
  2221. _a.push(_b);
  2222. _i = 0;
  2223. _f.label = 5;
  2224. case 5:
  2225. if (!(_i < _a.length)) return [3 /*break*/, 11];
  2226. optionKey = _a[_i];
  2227. option = options[String(optionKey)];
  2228. _c = [];
  2229. for (_d in option.sizes)
  2230. _c.push(_d);
  2231. _e = 0;
  2232. _f.label = 6;
  2233. case 6:
  2234. if (!(_e < _c.length)) return [3 /*break*/, 10];
  2235. sizeKey = _c[_e];
  2236. size = option.sizes[String(sizeKey)];
  2237. if (!option.splash) return [3 /*break*/, 9];
  2238. dest = "" + target + path_1.default.sep + option.folder;
  2239. return [4 /*yield*/, fs_extra_1.ensureDir(dest)];
  2240. case 7:
  2241. _f.sent();
  2242. if (option.infix === true) {
  2243. output = "" + dest + path_1.default.sep + option.prefix + size + "x" + size + option.suffix;
  2244. }
  2245. else {
  2246. output = "" + dest + path_1.default.sep + option.prefix + option.suffix;
  2247. }
  2248. pvar = [output, size];
  2249. sharpData = sharp_1.default(data);
  2250. sharpData = sharpData.resize(pvar[1][0], pvar[1][1]);
  2251. return [4 /*yield*/, sharpData.toFile(pvar[0])];
  2252. case 8:
  2253. _f.sent();
  2254. _f.label = 9;
  2255. case 9:
  2256. _e++;
  2257. return [3 /*break*/, 6];
  2258. case 10:
  2259. _i++;
  2260. return [3 /*break*/, 5];
  2261. case 11: return [2 /*return*/];
  2262. }
  2263. });
  2264. });
  2265. },
  2266. /**
  2267. * Minifies a set of images
  2268. *
  2269. * @param {string} target - image location
  2270. * @param {object} options - where to drop the images
  2271. * @param {string} strategy - which minify strategy to use
  2272. * @param {string} mode - singlefile or batch
  2273. */
  2274. minify: function (target,
  2275. // TODO: proper type for options
  2276. options, strategy, mode) {
  2277. return __awaiter(this, void 0, void 0, function () {
  2278. var cmd, minify, minifier, _a, folders, _b, _c, _i, n, folder;
  2279. var _this = this;
  2280. return __generator(this, function (_d) {
  2281. switch (_d.label) {
  2282. case 0:
  2283. minify = settings.options.minify;
  2284. if (!minify.available.find(function (x) { return x === strategy; })) {
  2285. strategy = minify.type;
  2286. }
  2287. switch (strategy) {
  2288. case 'optipng':
  2289. cmd = imagemin_optipng_1.default(minify.optipngOptions);
  2290. break;
  2291. case 'zopfli':
  2292. cmd = imagemin_zopfli_1.default(minify.zopfliOptions);
  2293. break;
  2294. default:
  2295. throw new Error('unknown strategy' + strategy);
  2296. }
  2297. minifier = function (pvar, cmd) { return __awaiter(_this, void 0, void 0, function () {
  2298. return __generator(this, function (_a) {
  2299. switch (_a.label) {
  2300. case 0: return [4 /*yield*/, imagemin_1.default([pvar[0]], {
  2301. destination: pvar[1],
  2302. plugins: [cmd]
  2303. }).catch(function (err) {
  2304. warn(err);
  2305. })];
  2306. case 1:
  2307. _a.sent();
  2308. return [2 /*return*/];
  2309. }
  2310. });
  2311. }); };
  2312. _a = mode;
  2313. switch (_a) {
  2314. case 'singlefile': return [3 /*break*/, 1];
  2315. case 'batch': return [3 /*break*/, 3];
  2316. }
  2317. return [3 /*break*/, 8];
  2318. case 1: return [4 /*yield*/, minifier([target, path_1.default.dirname(target)], cmd)];
  2319. case 2:
  2320. _d.sent();
  2321. return [3 /*break*/, 9];
  2322. case 3:
  2323. folders = uniqueFolders(options);
  2324. _b = [];
  2325. for (_c in folders)
  2326. _b.push(_c);
  2327. _i = 0;
  2328. _d.label = 4;
  2329. case 4:
  2330. if (!(_i < _b.length)) return [3 /*break*/, 7];
  2331. n = _b[_i];
  2332. folder = folders[Number(n)];
  2333. log('batch minify:' + String(folder));
  2334. return [4 /*yield*/, minifier([
  2335. "" + target + path_1.default.sep + folder + path_1.default.sep + "*.png",
  2336. "" + target + path_1.default.sep + folder
  2337. ], cmd)];
  2338. case 5:
  2339. _d.sent();
  2340. _d.label = 6;
  2341. case 6:
  2342. _i++;
  2343. return [3 /*break*/, 4];
  2344. case 7: return [3 /*break*/, 9];
  2345. case 8:
  2346. warn('[ERROR] Minify mode must be one of [ singlefile | batch]');
  2347. process.exit(1);
  2348. _d.label = 9;
  2349. case 9: return [2 /*return*/, 'minified'];
  2350. }
  2351. });
  2352. });
  2353. },
  2354. /**
  2355. * Creates special icns and ico filetypes
  2356. *
  2357. * @param {string} src - image location
  2358. * @param {string} target - where to drop the images
  2359. * @param {object} options
  2360. * @param {string} strategy
  2361. */
  2362. icns: function (src, target,
  2363. // TODO: proper type for options
  2364. options, strategy) {
  2365. return __awaiter(this, void 0, void 0, function () {
  2366. var sharpSrc, buf, out, out2, err_3;
  2367. return __generator(this, function (_a) {
  2368. switch (_a.label) {
  2369. case 0:
  2370. _a.trys.push([0, 3, , 4]);
  2371. if (!image) {
  2372. process.exit(1);
  2373. }
  2374. return [4 /*yield*/, this.validate(src, target)];
  2375. case 1:
  2376. _a.sent();
  2377. sharpSrc = sharp_1.default(src);
  2378. return [4 /*yield*/, sharpSrc.toBuffer()];
  2379. case 2:
  2380. buf = _a.sent();
  2381. out = png2icons.createICNS(buf, png2icons.BICUBIC, 0);
  2382. if (out === null) {
  2383. throw new Error('Failed to create icon.icns');
  2384. }
  2385. fs_extra_1.ensureFileSync(path_1.default.join(target, '/icon.icns'));
  2386. fs_extra_1.writeFileSync(path_1.default.join(target, '/icon.icns'), out);
  2387. out2 = png2icons.createICO(buf, png2icons.BICUBIC, 0, true);
  2388. if (out2 === null) {
  2389. throw new Error('Failed to create icon.ico');
  2390. }
  2391. fs_extra_1.ensureFileSync(path_1.default.join(target, '/icon.ico'));
  2392. fs_extra_1.writeFileSync(path_1.default.join(target, '/icon.ico'), out2);
  2393. return [3 /*break*/, 4];
  2394. case 3:
  2395. err_3 = _a.sent();
  2396. console.error(err_3);
  2397. throw err_3;
  2398. case 4: return [2 /*return*/];
  2399. }
  2400. });
  2401. });
  2402. }
  2403. });
  2404. /* eslint-enable @typescript-eslint/restrict-template-expressions */
  2405. if (true) {
  2406. if ( true && module.exports) {
  2407. exports = module.exports = tauricon;
  2408. }
  2409. exports.tauricon = tauricon;
  2410. }
  2411. /***/ }),
  2412. /***/ "./src/helpers/app-paths.ts":
  2413. /*!**********************************!*\
  2414. !*** ./src/helpers/app-paths.ts ***!
  2415. \**********************************/
  2416. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  2417. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2418. // SPDX-License-Identifier: Apache-2.0
  2419. // SPDX-License-Identifier: MIT
  2420. var __importDefault = (this && this.__importDefault) || function (mod) {
  2421. return (mod && mod.__esModule) ? mod : { "default": mod };
  2422. };
  2423. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2424. exports.resolve = exports.tauriDir = exports.appDir = void 0;
  2425. var fs_1 = __webpack_require__(/*! fs */ "fs");
  2426. var path_1 = __webpack_require__(/*! path */ "path");
  2427. var logger_1 = __importDefault(__webpack_require__(/*! ./logger */ "./src/helpers/logger.ts"));
  2428. var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
  2429. var warn = logger_1.default('tauri', chalk_1.default.red);
  2430. function resolvePath(basePath, dir) {
  2431. return dir && path_1.isAbsolute(dir) ? dir : path_1.resolve(basePath, dir);
  2432. }
  2433. var getAppDir = function () {
  2434. var dir = process.cwd();
  2435. var count = 0;
  2436. // only go up three folders max
  2437. while (dir.length > 0 && !dir.endsWith(path_1.sep) && count <= 2) {
  2438. if (fs_1.existsSync(path_1.join(dir, 'src-tauri', 'tauri.conf.json'))) {
  2439. return dir;
  2440. }
  2441. count++;
  2442. dir = path_1.normalize(path_1.join(dir, '..'));
  2443. }
  2444. warn("Couldn't find recognize the current folder as a part of a Tauri project");
  2445. process.exit(1);
  2446. };
  2447. var appDir = getAppDir();
  2448. exports.appDir = appDir;
  2449. var tauriDir = path_1.resolve(appDir, 'src-tauri');
  2450. exports.tauriDir = tauriDir;
  2451. var resolveDir = {
  2452. app: function (dir) { return resolvePath(appDir, dir); },
  2453. tauri: function (dir) { return resolvePath(tauriDir, dir); }
  2454. };
  2455. exports.resolve = resolveDir;
  2456. /***/ }),
  2457. /***/ "./src/helpers/logger.ts":
  2458. /*!*******************************!*\
  2459. !*** ./src/helpers/logger.ts ***!
  2460. \*******************************/
  2461. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  2462. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2463. // SPDX-License-Identifier: Apache-2.0
  2464. // SPDX-License-Identifier: MIT
  2465. var __importDefault = (this && this.__importDefault) || function (mod) {
  2466. return (mod && mod.__esModule) ? mod : { "default": mod };
  2467. };
  2468. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2469. var chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
  2470. var ms_1 = __importDefault(__webpack_require__(/*! ms */ "ms"));
  2471. var prevTime;
  2472. exports.default = (function (banner, color) {
  2473. if (color === void 0) { color = chalk_1.default.green; }
  2474. return function (msg) {
  2475. var curr = +new Date();
  2476. var diff = curr - (prevTime || curr);
  2477. prevTime = curr;
  2478. if (msg) {
  2479. console.log(
  2480. // TODO: proper typings for color and banner
  2481. // eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
  2482. " " + color(String(banner)) + " " + msg + " " + chalk_1.default.green("+" + ms_1.default(diff)));
  2483. }
  2484. else {
  2485. console.log();
  2486. }
  2487. };
  2488. });
  2489. /***/ }),
  2490. /***/ "./src/helpers/tauricon.config.ts":
  2491. /*!****************************************!*\
  2492. !*** ./src/helpers/tauricon.config.ts ***!
  2493. \****************************************/
  2494. /***/ ((__unused_webpack_module, exports) => {
  2495. // Copyright 2019-2021 Tauri Programme within The Commons Conservancy
  2496. // SPDX-License-Identifier: Apache-2.0
  2497. // SPDX-License-Identifier: MIT
  2498. Object.defineProperty(exports, "__esModule", ({ value: true }));
  2499. exports.options = void 0;
  2500. exports.options = {
  2501. // folder determines in which path to drop the generated file
  2502. // prefix is the first part of the generated file's name
  2503. // infix adds e.g. '44x44' based on the size in sizes to the generated file's name
  2504. // suffix adds a file-ending to the generated file's name
  2505. // sizes determines the pixel width and height to use
  2506. background_color: '#000074',
  2507. theme_color: '#02aa9b',
  2508. sharp: 'kernel: sharp.kernel.lanczos3',
  2509. minify: {
  2510. batch: false,
  2511. overwrite: true,
  2512. available: ['optipng', 'zopfli'],
  2513. type: 'optipng',
  2514. optipngOptions: {
  2515. optimizationLevel: 4,
  2516. paletteReduction: true
  2517. },
  2518. zopfliOptions: {
  2519. transparent: true,
  2520. more: true
  2521. }
  2522. },
  2523. splash_type: 'generate',
  2524. tauri: {
  2525. linux: {
  2526. folder: '.',
  2527. prefix: '',
  2528. infix: true,
  2529. suffix: '.png',
  2530. sizes: [32, 128]
  2531. },
  2532. linux_2x: {
  2533. folder: '.',
  2534. prefix: '128x128@2x',
  2535. infix: false,
  2536. suffix: '.png',
  2537. sizes: [256]
  2538. },
  2539. defaults: {
  2540. folder: '.',
  2541. prefix: 'icon',
  2542. infix: false,
  2543. suffix: '.png',
  2544. sizes: [512]
  2545. },
  2546. appx_logo: {
  2547. folder: '.',
  2548. prefix: 'StoreLogo',
  2549. infix: false,
  2550. suffix: '.png',
  2551. sizes: [50]
  2552. },
  2553. appx_square: {
  2554. folder: '.',
  2555. prefix: 'Square',
  2556. infix: true,
  2557. suffix: 'Logo.png',
  2558. sizes: [30, 44, 71, 89, 107, 142, 150, 284, 310]
  2559. }
  2560. // todo: look at capacitor and cordova for insight into what icons
  2561. // we need for those distribution targets
  2562. }
  2563. };
  2564. /***/ }),
  2565. /***/ "./package.json":
  2566. /*!**********************!*\
  2567. !*** ./package.json ***!
  2568. \**********************/
  2569. /***/ ((module) => {
  2570. module.exports = JSON.parse('{"name":"@tauri-apps/cli","version":"1.0.0-beta.6","description":"Command line interface for building Tauri apps","bin":{"tauri":"./bin/tauri.js"},"files":["bin","dist","scripts"],"funding":{"type":"opencollective","url":"https://opencollective.com/tauri"},"scripts":{"build":"rimraf ./dist && webpack --progress","build-release":"rimraf ./dist && cross-env NODE_ENV=production webpack","test":"jest --runInBand --no-cache --testPathIgnorePatterns=\\"(build|dev)\\"","pretest":"yarn build","prepublishOnly":"yarn build-release","test:local":"jest --runInBand","lint":"eslint --ext ts \\"./src/**/*.ts\\"","lint-fix":"eslint --fix --ext ts \\"./src/**/*.ts\\"","lint:lockfile":"lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn","format":"prettier --write --end-of-line=auto \\"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\\" --ignore-path .gitignore","format:check":"prettier --check --end-of-line=auto \\"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\\" --ignore-path .gitignore"},"repository":{"type":"git","url":"git+https://github.com/tauri-apps/tauri.git"},"contributors":["Tauri Team <team@tauri-apps.org> (https://tauri.studio)"],"license":"Apache-2.0 OR MIT","bugs":{"url":"https://github.com/tauri-apps/tauri/issues"},"homepage":"https://github.com/tauri-apps/tauri#readme","publishConfig":{"access":"public"},"engines":{"node":">= 12.13.0","npm":">= 6.6.0","yarn":">= 1.19.1"},"dependencies":{"@tauri-apps/toml":"2.2.4","chalk":"4.1.1","cross-env":"7.0.3","cross-spawn":"7.0.3","fs-extra":"10.0.0","got":"11.8.2","imagemin":"8.0.0","imagemin-optipng":"8.0.0","imagemin-zopfli":"7.0.0","inquirer":"8.1.1","is-png":"3.0.0","minimist":"1.2.5","ms":"2.1.3","png2icons":"2.0.1","read-chunk":"3.2.0","semver":"7.3.5","sharp":"0.28.3","update-notifier":"5.1.0"},"devDependencies":{"@babel/core":"7.14.6","@babel/preset-env":"7.14.7","@babel/preset-typescript":"7.14.5","@types/cross-spawn":"6.0.2","@types/fs-extra":"9.0.12","@types/imagemin":"7.0.1","@types/imagemin-optipng":"5.2.1","@types/inquirer":"7.3.3","@types/ms":"0.7.31","@types/semver":"7.3.7","@types/sharp":"0.28.4","@typescript-eslint/eslint-plugin":"4.28.3","@typescript-eslint/parser":"4.28.3","babel-jest":"27.0.6","eslint":"7.30.0","eslint-config-prettier":"8.3.0","eslint-config-standard-with-typescript":"20.0.0","eslint-plugin-import":"2.23.4","eslint-plugin-lodash-template":"0.19.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"5.1.0","eslint-plugin-security":"1.4.0","is-running":"2.1.0","jest":"27.0.6","jest-transform-toml":"1.0.0","lockfile-lint":"4.6.2","prettier":"2.3.2","promise":"8.1.0","raw-loader":"4.0.2","rimraf":"3.0.2","toml-loader":"1.0.0","ts-loader":"9.2.3","typescript":"4.3.5","webpack":"5.44.0","webpack-cli":"4.7.2","webpack-node-externals":"3.0.0"},"resolutions":{"**/lodash":"4.17.21","**/hosted-git-info":"4.0.2","**/normalize-url":"6.1.0","**/trim-newlines":"4.0.2"}}');
  2571. /***/ }),
  2572. /***/ "chalk":
  2573. /*!************************!*\
  2574. !*** external "chalk" ***!
  2575. \************************/
  2576. /***/ ((module) => {
  2577. module.exports = require("chalk");;
  2578. /***/ }),
  2579. /***/ "fs":
  2580. /*!*********************!*\
  2581. !*** external "fs" ***!
  2582. \*********************/
  2583. /***/ ((module) => {
  2584. module.exports = require("fs");;
  2585. /***/ }),
  2586. /***/ "fs-extra":
  2587. /*!***************************!*\
  2588. !*** external "fs-extra" ***!
  2589. \***************************/
  2590. /***/ ((module) => {
  2591. module.exports = require("fs-extra");;
  2592. /***/ }),
  2593. /***/ "globby":
  2594. /*!*************************!*\
  2595. !*** external "globby" ***!
  2596. \*************************/
  2597. /***/ ((module) => {
  2598. module.exports = require("globby");;
  2599. /***/ }),
  2600. /***/ "graceful-fs":
  2601. /*!******************************!*\
  2602. !*** external "graceful-fs" ***!
  2603. \******************************/
  2604. /***/ ((module) => {
  2605. module.exports = require("graceful-fs");;
  2606. /***/ }),
  2607. /***/ "imagemin-optipng":
  2608. /*!***********************************!*\
  2609. !*** external "imagemin-optipng" ***!
  2610. \***********************************/
  2611. /***/ ((module) => {
  2612. module.exports = require("imagemin-optipng");;
  2613. /***/ }),
  2614. /***/ "imagemin-zopfli":
  2615. /*!**********************************!*\
  2616. !*** external "imagemin-zopfli" ***!
  2617. \**********************************/
  2618. /***/ ((module) => {
  2619. module.exports = require("imagemin-zopfli");;
  2620. /***/ }),
  2621. /***/ "junk":
  2622. /*!***********************!*\
  2623. !*** external "junk" ***!
  2624. \***********************/
  2625. /***/ ((module) => {
  2626. module.exports = require("junk");;
  2627. /***/ }),
  2628. /***/ "ms":
  2629. /*!*********************!*\
  2630. !*** external "ms" ***!
  2631. \*********************/
  2632. /***/ ((module) => {
  2633. module.exports = require("ms");;
  2634. /***/ }),
  2635. /***/ "path":
  2636. /*!***********************!*\
  2637. !*** external "path" ***!
  2638. \***********************/
  2639. /***/ ((module) => {
  2640. module.exports = require("path");;
  2641. /***/ }),
  2642. /***/ "png2icons":
  2643. /*!****************************!*\
  2644. !*** external "png2icons" ***!
  2645. \****************************/
  2646. /***/ ((module) => {
  2647. module.exports = require("png2icons");;
  2648. /***/ }),
  2649. /***/ "read-chunk":
  2650. /*!*****************************!*\
  2651. !*** external "read-chunk" ***!
  2652. \*****************************/
  2653. /***/ ((module) => {
  2654. module.exports = require("read-chunk");;
  2655. /***/ }),
  2656. /***/ "replace-ext":
  2657. /*!******************************!*\
  2658. !*** external "replace-ext" ***!
  2659. \******************************/
  2660. /***/ ((module) => {
  2661. module.exports = require("replace-ext");;
  2662. /***/ }),
  2663. /***/ "sharp":
  2664. /*!************************!*\
  2665. !*** external "sharp" ***!
  2666. \************************/
  2667. /***/ ((module) => {
  2668. module.exports = require("sharp");;
  2669. /***/ }),
  2670. /***/ "strtok3":
  2671. /*!**************************!*\
  2672. !*** external "strtok3" ***!
  2673. \**************************/
  2674. /***/ ((module) => {
  2675. module.exports = require("strtok3");;
  2676. /***/ }),
  2677. /***/ "strtok3/lib/core":
  2678. /*!***********************************!*\
  2679. !*** external "strtok3/lib/core" ***!
  2680. \***********************************/
  2681. /***/ ((module) => {
  2682. module.exports = require("strtok3/lib/core");;
  2683. /***/ }),
  2684. /***/ "token-types":
  2685. /*!******************************!*\
  2686. !*** external "token-types" ***!
  2687. \******************************/
  2688. /***/ ((module) => {
  2689. module.exports = require("token-types");;
  2690. /***/ }),
  2691. /***/ "util":
  2692. /*!***********************!*\
  2693. !*** external "util" ***!
  2694. \***********************/
  2695. /***/ ((module) => {
  2696. module.exports = require("util");;
  2697. /***/ })
  2698. /******/ });
  2699. /************************************************************************/
  2700. /******/ // The module cache
  2701. /******/ var __webpack_module_cache__ = {};
  2702. /******/
  2703. /******/ // The require function
  2704. /******/ function __webpack_require__(moduleId) {
  2705. /******/ // Check if module is in cache
  2706. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  2707. /******/ if (cachedModule !== undefined) {
  2708. /******/ return cachedModule.exports;
  2709. /******/ }
  2710. /******/ // Create a new module (and put it into the cache)
  2711. /******/ var module = __webpack_module_cache__[moduleId] = {
  2712. /******/ // no module.id needed
  2713. /******/ // no module.loaded needed
  2714. /******/ exports: {}
  2715. /******/ };
  2716. /******/
  2717. /******/ // Execute the module function
  2718. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  2719. /******/
  2720. /******/ // Return the exports of the module
  2721. /******/ return module.exports;
  2722. /******/ }
  2723. /******/
  2724. /************************************************************************/
  2725. /******/ /* webpack/runtime/define property getters */
  2726. /******/ (() => {
  2727. /******/ // define getter functions for harmony exports
  2728. /******/ __webpack_require__.d = (exports, definition) => {
  2729. /******/ for(var key in definition) {
  2730. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  2731. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  2732. /******/ }
  2733. /******/ }
  2734. /******/ };
  2735. /******/ })();
  2736. /******/
  2737. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  2738. /******/ (() => {
  2739. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  2740. /******/ })();
  2741. /******/
  2742. /******/ /* webpack/runtime/make namespace object */
  2743. /******/ (() => {
  2744. /******/ // define __esModule on exports
  2745. /******/ __webpack_require__.r = (exports) => {
  2746. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  2747. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  2748. /******/ }
  2749. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  2750. /******/ };
  2751. /******/ })();
  2752. /******/
  2753. /************************************************************************/
  2754. /******/
  2755. /******/ // startup
  2756. /******/ // Load entry module and return exports
  2757. /******/ // This entry module is referenced by other modules so it can't be inlined
  2758. /******/ var __webpack_exports__ = __webpack_require__("./src/api/tauricon.ts");
  2759. /******/
  2760. /******/ return __webpack_exports__;
  2761. /******/ })()
  2762. ;
  2763. });
  2764. //# sourceMappingURL=tauricon.js.map