import"./p-c2e91ee8.js";import{i as n,g as i}from"./p-9ef574c2.js";var o=undefined&&undefined.__awaiter||function(n,i,o,e){function t(n){return n instanceof o?n:new o((function(i){i(n)}))}return new(o||(o=Promise))((function(o,r){function c(n){try{f(e.next(n))}catch(n){r(n)}}function d(n){try{f(e["throw"](n))}catch(n){r(n)}}function f(n){n.done?o(n.value):t(n.value).then(c,d)}f((e=e.apply(n,i||[])).next())}))};function e(e){return{klevuModifierId:"personalisation",modifyAfter:(t,r)=>o(this,void 0,void 0,(function*(){var o,c;const d=Array.from(t);for(const d of t){if(!d.settings){d.settings={}}d.settings.personalisation={enablePersonalisation:true,fields:e===null||e===void 0?void 0:e.fields};let t=[];if((e===null||e===void 0?void 0:e.lastClickedProductIds)||(e===null||e===void 0?void 0:e.lastClickedItemIds)){const n=(o=e.lastClickedItemIds||e.lastClickedProductIds)!==null&&o!==void 0?o:[];t=n.map((n=>({id:n})))}else if(r.klevuFunctionId==="categoryMerchandising"&&((c=r.params)===null||c===void 0?void 0:c.category)){const{category:i}=r.params;t=n.getCategoryPersonalisationIds(i).map((n=>({id:n})))}else{t=n.getLastClickedLatestsFirst(10,true).map((n=>({id:n})))}if(t.length>0){d.settings.context={recentObjects:[{typeOfRecord:i.Product,records:t}]}}}return d}))}}export{e as p};
//# sourceMappingURL=p-008d193b.js.map