import{r as o,h as r,H as i}from"./p-9add63ef.js";import{s as n}from"./p-49fdface.js";import{c as l}from"./p-73151c01.js";import"./p-2b28ea49.js";import"./p-1282ed4a.js";import"./p-dd24e53c.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-31faf2b8.js";import"./p-610295e2.js";import"./p-e2e1fe1f.js";const e=(o,r)=>(o||[]).some((({rules:o})=>s(o,r)));const s=(o,{checkout:r,processor:i})=>o.map((o=>{var n,l;const e=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 c(parseFloat(r.total_amount),parseFloat(e),o===null||o===void 0?void 0:o.operator);case"products":return v(t(r),e,o===null||o===void 0?void 0:o.operator);case"prices":return v(d(r),e,o===null||o===void 0?void 0:o.operator);case"coupons":return v(u(r),e,o===null||o===void 0?void 0:o.operator);case"shipping_country":return v([(n=r===null||r===void 0?void 0:r.shipping_address)===null||n===void 0?void 0:n.country],e,o===null||o===void 0?void 0:o.operator);case"billing_country":return v([(l=r===null||r===void 0?void 0:r.billing_address)===null||l===void 0?void 0:l.country],e,o===null||o===void 0?void 0:o.operator);case"processors":return v([i],e,o===null||o===void 0?void 0:o.operator);default:return false}})).every((o=>o));const t=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;return(((r=o===null||o===void 0?void 0:o.line_items)===null||r===void 0?void 0:r.data)||[]).map((({price:o})=>o===null||o===void 0?void 0:o.id)).filter(Boolean)};const u=o=>{var r,i,n,l;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)?[(l=(n=o===null||o===void 0?void 0:o.discount)===null||n===void 0?void 0:n.coupon)===null||l===void 0?void 0:l.id]:[]};const v=(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 c=(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 a=":host{display:block}";const p=a;const f=class{constructor(r){o(this,r);this.rule_groups=undefined}render(){let o=e(this.rule_groups,{checkout:l(),processor:n===null||n===void 0?void 0:n.id});if(!o)return null;return r(i,null,r("slot",null))}};f.style=p;export{f as sc_conditional_form};
//# sourceMappingURL=p-683d0f8d.entry.js.map