Liferay.Loader.define("segments-web@3.0.77/js/utils/utils.es",["module","exports","require","segments-web$date-fns","./constants.es"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.createNewGroup=function createNewGroup(e){return{conjunctionName:o.CONJUNCTIONS.AND,groupId:generateGroupId(),items:e}},t.generateGroupId=generateGroupId,t.getPluralMessage=function getPluralMessage(e,t,n=0,r){return sub(1===n?e:t,[n],r)},t.getChildGroupIds=function getChildGroupIds(e){let t=[];e.items&&e.items.length&&(t=e.items.reduce(((e,t)=>t.groupId?[...e,t.groupId,...getChildGroupIds(t)]:e),[]));return t},t.getSupportedOperatorsFromType=function getSupportedOperatorsFromType(e,t,n){return e.filter((e=>{const r=t[n];return r&&r.includes(e.name)}))},t.insertAtIndex=function insertAtIndex(e,t,n){return[...t.slice(0,n),e,...t.slice(n,t.length)]},t.objectToFormData=function objectToFormData(e){const t=new FormData;return Object.keys(e).forEach((n=>{t.set(n,e[n])})),t},t.removeAtIndex=function removeAtIndex(e,t){return e.filter(((e,n)=>n!==t))},t.replaceAtIndex=function replaceAtIndex(e,t,n){return Object.assign(t,{[n]:e})},t.sub=sub,t.dateToInternationalHuman=function dateToInternationalHuman(e,t=navigator.language){const n=new Date(e);return new Intl.DateTimeFormat(t,{day:"numeric",month:"long",year:"numeric"}).format(n)},t.jsDatetoYYYYMMDD=function jsDatetoYYYYMMDD(e){return r.default.format(e,"YYYY-MM-DD")};var r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n("segments-web$date-fns")),o=n("./constants.es");const e="group_",u=/({\d+})/g;let a=1;function generateGroupId(){return"".concat(e).concat(a++)}function sub(e,t,n=!0){const r=e.split(u).filter((e=>0!==e.length));for(let e=0;e<t.length;e++){const n=t[e],o="{".concat(e,"}");let u=r.indexOf(o);for(;u>=0;)r.splice(u,1,n),u=r.indexOf(o)}return n?r.join(""):r}}}));
//# sourceMappingURL=utils.es.js.map