import{v as p,ao as i,fm as u,fw as o,co as m,cu as g}from"./app-k0jcl5PQ.js";import{s as h,T as l}from"./BxQFOoIR.chunk.js";const T={getTagActionProps:(t,e,r)=>r?{onClick:n=>{e&&e();const a=t?t(n):null;if(a)return p.trigger(a)}}:{getAppLink:n=>t?t(n):null,onClick:e}};function f(t){var e;switch((e=t.tagType)==null?void 0:e.toLowerCase()){case u.Pedagogy:return 0;case u.Skill:return 1;default:return 2}}function x(t){if(!t.tags)return i.jsx(i.Fragment,{});const e=[...t.tags].sort((r,n)=>f(r)-f(n));return i.jsx("div",{className:`${h.tagList} ${t.className}`,children:e.map(r=>{const n=typeof t.getAppLink=="function"?t.getAppLink(r):null,a=typeof t.onRemove=="function"?()=>t.onRemove(r):null,s=typeof t.onClick=="function"?()=>t.onClick(r):null;return i.jsx(l,{tag:r,appLink:n,themeColours:t.themeColours,onRemove:a,onClick:s},r.id||r.name)})})}function y(t){const{page:e,totalPages:r}=t,n=o.isNumber(e)&&e>0&&e<r&&e+1,a=o.isNumber(e)&&e>1&&e-1,s={};if(n&&n<=r&&(s.next=n.toString()),a&&(s.previous=a.toString()),!m.isEmpty(s))return s}const d={isEmpty(t){return t&&!(t.data&&t.data.length)},length(t){return t&&t.data&&t.data.length},at(t,e){if(!(!t||!t.data||!t.data.length||e>t.data.length))return t.data[e]},get(t,e){if(!(!t||!t.data||!t.data.length))return t.data.find(r=>r.id&&r.id.toString()===e)},flattenCollections(t){if(!t||!t.length)return;let e=[];return t.forEach(r=>{e=[...e,...r.data]}),e},getNextCursor(t){return t.pagination&&t.pagination.cursors&&t.pagination.cursors.next},convertLegacyPaginatedCollection(t){if(t)return{data:t.data,pagination:{cursors:y(t.pagination),limit:t.pagination.pageSize}}},hasData(t){return!d.isEmpty(t)}};function C(t){return g.isVideo(t)?t:g.isClip(t)?t._parentVideo:null}function P(t){const e=d.hasData,r=C(t);return r?e(r.productionCompanies)||e(r.producers)||e(r.distributors)||e(r.directors):!1}export{x as T,T as a,P as h};
//# sourceMappingURL=DWt5Ov1e.chunk.js.map
