"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.makeDeepLink=exports.joinWithSeparator=exports.constructFieldDeepFragment=exports.isSameHash=void 0;const utils_1=require("../../utils"),mediaContent_1=require("../../models/mediaContent");function isSameHash(e,t){return e===t||"#"+e===t||e==="#"+t}function getContentTypeName(e){var t,o,n,i,s,d,r,p,a,l,u,v,c;if(!e.in)return"request"===e.deps.type&&(null===(n=null===(o=null===(t=e.deps.operation)||void 0===t?void 0:t.requestBody)||void 0===o?void 0:o.content)||void 0===n?void 0:n.mediaTypes)?(null===(d=null===(s=null===(i=e.deps.operation)||void 0===i?void 0:i.requestBody)||void 0===s?void 0:s.content)||void 0===d?void 0:d.mediaTypes.length)>1?(null===(p=null===(r=e.deps.operation)||void 0===r?void 0:r.requestBody)||void 0===p?void 0:p.content)&&(0,mediaContent_1.getActiveMediaType)(e.deps.operation.requestBody.content).name:void 0:"response"===e.deps.type&&(null===(l=null===(a=e.deps.response)||void 0===a?void 0:a.content)||void 0===l?void 0:l.mediaTypes)&&(null===(v=null===(u=e.deps.response)||void 0===u?void 0:u.content)||void 0===v?void 0:v.mediaTypes.length)>1?(null===(c=e.deps.response)||void 0===c?void 0:c.content)&&(0,mediaContent_1.getActiveMediaType)(e.deps.response.content).name:void 0}function constructFieldDeepFragment(e){var t,o;if(!e)return"";const n={t:e.deps.type,in:e.in||e.deps.in,c:"response"===e.deps.type?null===(t=e.deps.response)||void 0===t?void 0:t.code:void 0,cb:(null===(o=e.deps.operation)||void 0===o?void 0:o.isCallback)?e.deps.operation.callbackId:void 0,ct:getContentTypeName(e),path:e.fieldFullPath};return utils_1.queryString.stringify(n,{encode:!1,sort:!1})}function joinWithSeparator(e="",t="",o="/"){return e.endsWith(o)&&(e=e.slice(0,-o.length)),t.startsWith(o)&&(t=t.slice(o.length)),e&&t?e+o+t:e+t}function makeDeepLink(e,t){return(`/${e=(0,utils_1.encodeBackSlashes)(e)}#`+joinWithSeparator(e,t)).toLowerCase()}exports.isSameHash=isSameHash,exports.constructFieldDeepFragment=constructFieldDeepFragment,exports.joinWithSeparator=joinWithSeparator,exports.makeDeepLink=makeDeepLink;
//# sourceMappingURL=helpers.js.map