import merge from"deepmerge";import{isObject}from"@redocly/theme";import{isMergeableObject}from"../utils";export function isSameMime(e,r){return!(!e||!r)&&normalizeMimeType(e)===normalizeMimeType(r)}export function normalizeMimeType(e){if(!e)return;const r=e.split(";")[0].toLowerCase(),[t,n]=r.split("/");if(void 0===n)return t;return`${t}/${n.split("+").pop()}`}export function unescapeServerVariables(e){const r=new RegExp("%7B","g"),t=new RegExp("%7D","g");return e.replace(r,"{").replace(t,"}").replace("///","//").replace("./",".")}export function arrayMergeStrategy(e,r){if(!e.length||!hasObjectOrArray(e))return r;const t=e.filter((e=>Object.keys(e).length>0));return r.forEach((function(r,n){isMergeableObject(r)?t[n]=merge(e[n],r,{arrayMerge:arrayMergeStrategy}):Array.isArray(r)?t.push(r):t[n]=r})),t}const hasObjectOrArray=e=>e.some((e=>isObject(e)&&Object.keys(e).length>0));export function isEmptyObject(e){return!!e&&0===Object.keys(e).length}export const cryptoLib="undefined"!=typeof window&&(window.crypto||window.msCrypto)||void 0;export function deepClone(e){if("object"!=typeof e||null===e)return e;const r=Array.isArray(e)?[]:{};for(const t in e){const n=e[t];r[t]=deepClone(n)}return r}
//# sourceMappingURL=utils.js.map