import{L as S,cu as f,cz as T,cA as c,h as x,cB as g,cC as v,M as h}from"./app-k0jcl5PQ.js";import{S as u}from"./Boh3c6zT.chunk.js";import{V as d}from"./BHfFK47N.chunk.js";const m="sharev2.utils",e=S.encloseNamespace(m),y={getPrivateIconAndText:t=>{const{entityTypeId:i,privacy:s,hasStudentExp:r,entity:o,yearGroups:n}=t;if(i===h.Topic||i===h.Series)return{icon:d,text:e(r?"justMySchoolTeachers":"justMySchoolDescription")};if(!Array.isArray(s))switch(s){case u.Public:return{icon:d,text:e("publicDescription")};case u.ProtectedOverrideRestriction:return{icon:d,text:e("clickViewOnly")};case u.Protected:return{icon:c,text:y.getRespectRatingText(o,n,r)};case u.JustMySchoolOverrideRestriction:return{icon:c,text:e(r?"justMySchoolTeachers":"justMySchoolDescription")};case u.JustMySchool:return{icon:c,text:y.getRespectRatingText(o,n,r)};case u.PinCode:return{icon:c,text:e("pinDescription")};case u.PasswordProtected:return{icon:c,text:e("password")};default:return{}}},getIconAndText:t=>{const{linkExpireDate:i,isPasswordProtected:s,status:r}=t;if(!i&&!s)return y.getPrivateIconAndText(t);if(!i)return{icon:c,text:e("password")};const o=x.isToday(i),n=x.diffBetween(i,new Date,"day");if(!s){let l=o?e("expiryToday"):e("expiry",{days:n});return r===g.Expired&&(l=e("expired")),{icon:v,text:l}}let a=o?e("passwordExpiryToday"):e("passwordExpiry",{days:n});return r===g.Expired&&(a=e("passwordExpired")),{icon:c,text:a}},getRespectRatingText(t,i,s){var l;if(!t||!i)return null;if(s)return e("justMySchoolTeachers");if(!f.isVideoType(t))return e("collectionRating");const r=T.getWeightedRestriction((l=t._restrictions)==null?void 0:l.value);if(r&&!r.yearGroup)return e("onlyAdmins");const o=f.getRating(t);let n,a;for(const p of i)(!n||p.value>n.value)&&(n=p),!(r&&p.value<=r.yearGroup)&&(o&&p.rating.value<o.value||(!a||p.value<a.value)&&(a=p));return a?i.length===1?e("clickViewOnly"):a.value===n.value?e("maxYearGroup",{yearGroup:n.name}):e("yearGroupRange",{yearGroup:a.name}):e("onlyStaff")},getShareLinkAccessType(t){return t.isTvContent||t.isClickViewContent?"protected":t.canManageAccess?"owner":"private"}};export{y as S};
//# sourceMappingURL=q-a0Zpry.chunk.js.map
