"use strict";var e=this&&this.__awaiter||function(e,n,r,t){return new(r||(r=Promise))((function(i,s){function o(e){try{u(t.next(e))}catch(e){s(e)}}function a(e){try{u(t.throw(e))}catch(e){s(e)}}function u(e){var n;e.done?i(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(o,a)}u((t=t.apply(e,n||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPinnedVersion=void 0;const r=require("./semverMaxSatisfying"),t=require("../../../common/message"),i=n(require("../../../log")),s=require("./getVersionByDistTags"),o=require("./isStandardTagDependency"),a=require("../../registry/registry");exports.getPinnedVersion=function(n,u,c){return e(this,void 0,void 0,(function*(){const e=Object.keys(c.versions);if(1===e.length&&(c.isFromLockFile||c.registryType===a.RegistryType.local||(0,o.isStandardTagDependency)(u)))return{name:n,pinnedVersion:e[0]};const d=(0,r.semverMaxSatisfying)(e,u)||(0,s.getVersionByDistTags)(u,c);if(null===d){const e=(0,t.format)(t.Messages.Install.NoMatch,{name:n,version:u});throw i.default.error("",e),new Error(e)}return{name:n,pinnedVersion:d}}))};