"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFirstPageLink=exports.getItemsByType=exports.isRootItem=void 0;const utils_1=require("../../utils");function isRootItem(e){return"section"===e.type&&""===e.id}function getItemsByType(e){const t=[],s=[],r=[];let i;for(const o of e)switch(o.type){case"group":t.push(o);break;case"tag":s.push(o);break;case"operation":r.push(o);break;case"section":isRootItem(o)&&(i=o)}return{groupItems:t,tagItems:s,operationItems:r,rootItem:i}}function getFirstPageLink(e,t){for(const s of e){if("group"===s.type)return getFirstPageLink(s.items,t);if("tag"===s.type){if(!s.description)return(0,utils_1.normalizePath)(getFirstPageLink(s.items,t));if(s.href)return(0,utils_1.normalizePath)(s.href)}else if("operation"===s.type||"schema"===s.type)return(0,utils_1.normalizePath)(s.href)}return t}exports.isRootItem=isRootItem,exports.getItemsByType=getItemsByType,exports.getFirstPageLink=getFirstPageLink;
//# sourceMappingURL=helpers.js.map