let t=t=>t?t.includes("/ProductVariant/")?t.split("/ProductVariant/")[1]||"":t:"",e=t=>t?t.includes("/Product/")?t.split("/Product/")[1]||"":t:"",i=({sellingPlansSetting:i,currentVariant:d,product:s,isFromEvent:a=!1})=>{let r={sourceApp:void 0,group:void 0,defaultOptions:void 0};if(!i)return r;if(a&&d?.id){let a,r;if(s&&"baseID"in s&&s.baseID?(a=e(s.baseID),r=Object.keys(i)[0]):a="data"===(r=Object.keys(i)[0])&&i[r]?Object.keys(i[r])[0]:r,a){let e="data"===r?i.data:i[a],s="data"===r?e[a]:e;if(s){let e=t(d.id?.toString()||""),i=t(d.baseID||""),a=Object.keys(s).find(t=>t===d.id?.toString()||t===d.baseID||t===e||t===i||d.id?.toString()===t||d.baseID===t||d.id?.toString().includes(t)||d.baseID?.includes(t)||t.includes(e)||t.includes(i));if(a&&s[a]){let t=s[a];return{sourceApp:t?.sourceApp,group:t?.group,defaultOptions:t?.defaultOption}}}}}return r};export{i as extractSellingPlanSettings};
