/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import a from"./YV3EI5XV.js";export default $arcgis.t(([{m:i}])=>{function w(n,t){let r=[];return n.forEach(e=>{t.has(e.id)&&r.push(e)}),r}function g(n,t,r){if(t<1||n.length<t)return{cards:[],paging:{start:t,num:0,nextStart:-1,total:n.length}};let e=Math.min(t+r,n.length+1),s=e<n.length?e:-1;return{cards:n.slice(t-1,e-1),paging:{start:t,num:e-t,nextStart:s,total:n.length}}}function m(n,t){let r=d(n);return l(r,t)}function l(n,t){let r=[];return t.forEach(e=>{let s=c(e);s&&n.indexOf(s)>=0&&e.relatedSolutions&&(r=r.concat(e.relatedSolutions))}),new Set(r)}function c(n){let t="solutionid-",r=n.typeKeywords.filter(s=>s.startsWith(t)),e=null;return Array.isArray(r)&&r.length>0&&(e=r[0].substring(t.length)),e}function d(n){let t=[];return n.forEach(r=>{let e=c(r);e&&t.push(e)}),t=Array.from(new Set(t)),t}function p(n){let t="solutionversion-",r=(n.typeKeywords||[]).reduce((e,s)=>(s.startsWith(t)&&(e=Number(s.replace(t,""))),e),-1);return isNaN(r)?-1:r}function y(n,t,r){let e,s=r==="asc"?1:-1;switch(t){case"created":e=(a,o)=>s*(a.createdMs<o.createdMs?-1:a.createdMs>o.createdMs?1:0);break;case"numviews":e=(a,o)=>s*(a.numViews<o.numViews?-1:a.numViews>o.numViews?1:0);break;case"title":e=(a,o)=>s*(a.title.toLowerCase()<o.title.toLowerCase()?-1:a.title.toLowerCase()>o.title.toLowerCase()?1:0);break;default:e=()=>0;break}return n.sort(e),n}function u(n){return n.toLowerCase().replace(/\s+/g,"-")}function b(n,t){return n.find(r=>u(r.title)===t||t===r.id)}function C(n,t){let r="solutionid-";return n.find(e=>i(e.typeKeywords,r)===t)}function S(n,t){let r=n.find(e=>t===e.deployCommonId);return u(r.title)}return{a:w,b:g,c:m,d:p,e:y,f:u,g:b,h:C,i:S}},a)