"use strict";var e=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},t=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AttachmentUploader=void 0;const n=t(require("node-fetch")),r=require("../../../registry"),o=require("../../../proxy"),i=require("../../../handleResponseError");exports.AttachmentUploader=class{uploadPackage(t,a,s){return e(this,void 0,void 0,(function*(){const e=a.name.replace("/","%2f"),u=yield(0,n.default)(s.concat(e),{headers:{command:"publish",version:"v1","user-agent":(0,r.getUserAgent)(),Authorization:yield t.getAuthorization(s),"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(a),method:"PUT",agent:(0,o.getProxyAgent)(s)});return u.ok||(yield(0,i.handleResponseError)(u,"Publish")),u.json()}))}};