| 1 | {"ast":null,"code":"import speedometer from './speedometer.js';\nimport throttle from './throttle.js';\nimport utils from '../utils.js';\nexport const progressEventReducer = (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n return throttle(e => {\n if (!e || typeof e.loaded !== 'number') {\n return;\n }\n const rawLoaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;\n const progressBytes = Math.max(0, loaded - bytesNotified);\n const rate = _speedometer(progressBytes);\n bytesNotified = Math.max(bytesNotified, loaded);\n const data = {\n loaded,\n total,\n progress: total ? loaded / total : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null,\n [isDownloadStream ? 'download' : 'upload']: true\n };\n listener(data);\n }, freq);\n};\nexport const progressEventDecorator = (total, throttled) => {\n const lengthComputable = total != null;\n return [loaded => throttled[0]({\n lengthComputable,\n total,\n loaded\n }), throttled[1]];\n};\nexport const asyncDecorator = fn => (...args) => utils.asap(() => fn(...args));","map":{"version":3,"names":["speedometer","throttle","utils","progressEventReducer","listener","isDownloadStream","freq","bytesNotified","_speedometer","e","loaded","rawLoaded","total","lengthComputable","undefined","Math","min","progressBytes","max","rate","data","progress","bytes","estimated","event","progressEventDecorator","throttled","asyncDecorator","fn","args","asap"],"sources":["C:/Users/User/Downloads/medora5/frontend/node_modules/axios/lib/helpers/progressEventReducer.js"],"sourcesContent":["import speedometer from './speedometer.js';\nimport throttle from './throttle.js';\nimport utils from '../utils.js';\n\nexport const progressEventReducer = (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle((e) => {\n if (!e || typeof e.loaded !== 'number') {\n return;\n }\n const rawLoaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;\n const progressBytes = Math.max(0, loaded - bytesNotified);\n const rate = _speedometer(progressBytes);\n\n bytesNotified = Math.max(bytesNotified, loaded);\n\n const data = {\n loaded,\n total,\n progress: total ? loaded / total : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null,\n [isDownloadStream ? 'download' : 'upload']: true,\n };\n\n listener(data);\n }, freq);\n};\n\nexport const progressEventDecorator = (total, throttled) => {\n const lengthComputable = total != null;\n\n return [\n (loaded) =>\n throttled[0]({\n lengthComputable,\n total,\n loaded,\n }),\n throttled[1],\n ];\n};\n\nexport const asyncDecorator =\n (fn) =>\n (...args) =>\n utils.asap(() => fn(...args));\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,kBAAkB;AAC1C,OAAOC,QAAQ,MAAM,eAAe;AACpC,OAAOC,KAAK,MAAM,aAAa;AAE/B,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,QAAQ,EAAEC,gBAAgB,EAAEC,IAAI,GAAG,CAAC,KAAK;EAC5E,IAAIC,aAAa,GAAG,CAAC;EACrB,MAAMC,YAAY,GAAGR,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC;EAEzC,OAAOC,QAAQ,CAAEQ,CAAC,IAAK;IACrB,IAAI,CAACA,CAAC,IAAI,OAAOA,CAAC,CAACC,MAAM,KAAK,QAAQ,EAAE;MACtC;IACF;IACA,MAAMC,SAAS,GAAGF,CAAC,CAACC,MAAM;IAC1B,MAAME,KAAK,GAAGH,CAAC,CAACI,gBAAgB,GAAGJ,CAAC,CAACG,KAAK,GAAGE,SAAS;IACtD,MAAMJ,MAAM,GAAGE,KAAK,IAAI,IAAI,GAAGG,IAAI,CAACC,GAAG,CAACL,SAAS,EAAEC,KAAK,CAAC,GAAGD,SAAS;IACrE,MAAMM,aAAa,GAAGF,IAAI,CAACG,GAAG,CAAC,CAAC,EAAER,MAAM,GAAGH,aAAa,CAAC;IACzD,MAAMY,IAAI,GAAGX,YAAY,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