"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.depNodeVersionCompare=void 0;const r=require("./isLocalDependency"),n=e(require("semver")),t=require("../../install-targets/TargetManager"),o=require("../../../common/message"),i=e(require("../../../log"));function a(e,r){return e&&!r?1:!e&&r?-1:0}function s(e){var r;return null===(r=n.default.parse(e))||void 0===r?void 0:r.build.join("")}exports.depNodeVersionCompare=function(e,u){const c=s(e.version),d=s(u.version);return function(e,r,n,a){if(!e&&!n)return;if(t.targetManager.hasTarget()){const i=t.targetManager.getTargetName();if(e&&e!==i)throw new Error((0,o.format)(o.Messages.Target.InvalidTargetError,{targetName:e,version:`${r.name}@${r.version}`,defaultTarget:i}));if(n&&n!==i)throw new Error((0,o.format)(o.Messages.Target.InvalidTargetError,{targetName:n,version:`${a.name}@${a.version}`,defaultTarget:i}))}else e&&n&&e!==n&&i.default.warn("",`Found two targets: "${e}" in ${r.name}@${r.version}, ${n} in ${a.name}@${a.version} while conflict version resolve, please check whether the configuration is correct.`)}(c,e,d,u),(0,r.isLocalDependency)(e.pinnedSpec)&&(0,r.isLocalDependency)(u.pinnedSpec)?n.default.eq(e.version,u.version)?a(c,d):n.default.gtr(e.version,u.version)?1:-1:(0,r.isLocalDependency)(u.pinnedSpec)?-1:(0,r.isLocalDependency)(e.pinnedSpec)?1:n.default.eq(e.version,u.version)?a(c,d):n.default.gtr(e.version,u.version)?1:-1};