"use strict";var e=this&&this.__awaiter||function(e,r,t,a){return new(t||(t=Promise))((function(n,o){function i(e){try{s(a.next(e))}catch(e){o(e)}}function c(e){try{s(a.throw(e))}catch(e){o(e)}}function s(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(i,c)}s((a=a.apply(e,r||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.readDepNameFromTarball=void 0;const r=require("../../../util"),t=require("./index"),a=require("./readPkgJsonFromTarball"),n=require("../../../common/message");exports.readDepNameFromTarball=function(o){return e(this,void 0,void 0,(function*(){if(!r.FsBlockingUtil.existsSync(o))throw new Error((0,n.format)(n.Messages.Fetcher.LocalArtifact.FetchLocalPackageFailed,{tarballPath:o}));const e=yield(0,t.hspDetect)(o),i=yield(0,a.readPkgJsonFromTarball)(o,e);if(!i)throw new Error(n.Messages.File.ReadOhPkgJson5Failed);return r.PackageUtil.requireNotEmpty(i.name,`The name field in the oh-package.json5 file of ${o}`),i.name}))};