import{r as o,h as r,H as i}from"./p-e97fde0a.js";import{s as n}from"./p-4cae87fc.js";import{c as s}from"./p-6b5d827f.js";import"./p-03631502.js";import"./p-53e7f7d7.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-4df6e0c5.js";import"./p-30eb50ff.js";const l=(o,r)=>(o||[]).some((({rules:o})=>t(o,r)));const t=(o,{checkout:r,processor:i})=>o.map((o=>{var n,s;const l=Array.isArray(o===null||o===void 0?void 0:o.value)?(o===null||o===void 0?void 0:o.value).map((o=>(o===null||o===void 0?void 0:o.value)||o)):o===null||o===void 0?void 0:o.value;switch(o===null||o===void 0?void 0:o.condition){case"total":return v(parseFloat(r.total_amount),parseFloat(l),o===null||o===void 0?void 0:o.operator);case"products":return u(e(r),l,o===null||o===void 0?void 0:o.operator);case"coupons":return u(d(r),l,o===null||o===void 0?void 0:o.operator);case"shipping_country":return u([(n=r===null||r===void 0?void 0:r.shipping_address)===null||n===void 0?void 0:n.country],l,o===null||o===void 0?void 0:o.operator);case"billing_country":return u([(s=r===null||r===void 0?void 0:r.billing_address)===null||s===void 0?void 0:s.country],l,o===null||o===void 0?void 0:o.operator);case"processors":return u([i],l,o===null||o===void 0?void 0:o.operator);default:return false}})).every((o=>o));const e=o=>{var r;return(((r=o===null||o===void 0?void 0:o.line_items)===null||r===void 0?void 0:r.data)||[]).map((({price:o})=>{var r;return(r=o===null||o===void 0?void 0:o.product)===null||r===void 0?void 0:r.id}))};const d=o=>{var r,i,n,s;return((i=(r=o===null||o===void 0?void 0:o.discount)===null||r===void 0?void 0:r.coupon)===null||i===void 0?void 0:i.id)?[(s=(n=o===null||o===void 0?void 0:o.discount)===null||n===void 0?void 0:n.coupon)===null||s===void 0?void 0:s.id]:[]};const u=(o,r,i)=>{switch(i){case"all":return r.filter((r=>o.some((o=>r==o)))).length===r.length;case"any":return o.filter((o=>r.some((r=>o==r)))).length>=1;case"none":return o.filter((o=>r.some((r=>o==r)))).length===0;case"exist":return o.length>=1;case"not_exist":return o.length===0;default:return false}};const v=(o,r,i)=>{switch(i){case"==":return o===r;case"!=":return o!==r;case">":return o>r;case"<":return o<r;case"<=":return o<=r;case">=":return o>=r}return false};const c=":host{display:block}";const a=c;const p=class{constructor(r){o(this,r);this.rule_groups=undefined}render(){let o=l(this.rule_groups,{checkout:s(),processor:n===null||n===void 0?void 0:n.id});if(!o)return null;return r(i,null,r("slot",null))}};p.style=a;export{p as sc_conditional_form};
//# sourceMappingURL=p-d20ed943.entry.js.map