import{r,h as l,H as o}from"./p-dfbe004d.js";import{s as n}from"./p-ea78c070.js";import{c as u}from"./p-f56cd460.js";import"./p-35c4916d.js";import"./p-10aa7556.js";import"./p-1c2e2695.js";const e=r=>{var l;return((null===(l=null==r?void 0:r.line_items)||void 0===l?void 0:l.data)||[]).map((({price:r})=>{var l;return null===(l=null==r?void 0:r.product)||void 0===l?void 0:l.id}))},s=r=>{var l,o,n,u;return(null===(o=null===(l=null==r?void 0:r.discount)||void 0===l?void 0:l.coupon)||void 0===o?void 0:o.id)?[null===(u=null===(n=null==r?void 0:r.discount)||void 0===n?void 0:n.coupon)||void 0===u?void 0:u.id]:[]},t=(r,l,o)=>{switch(o){case"all":return l.filter((l=>r.some((r=>l==r)))).length===l.length;case"any":return r.filter((r=>l.some((l=>r==l)))).length>=1;case"none":return 0===r.filter((r=>l.some((l=>r==l)))).length;case"exist":return r.length>=1;case"not_exist":return 0===r.length;default:return!1}},i=(r,l,o)=>{switch(o){case"==":return r===l;case"!=":return r!==l;case">":return r>l;case"<":return r<l;case"<=":return r<=l;case">=":return r>=l}return!1},c=class{constructor(l){r(this,l)}render(){var r,c;return r=this.rule_groups,c={checkout:u(),processor:null==n?void 0:n.id},(r||[]).some((({rules:r})=>((r,{checkout:l,processor:o})=>r.map((r=>{var n,u;const c=Array.isArray(null==r?void 0:r.value)?(null==r?void 0:r.value).map((r=>(null==r?void 0:r.value)||r)):null==r?void 0:r.value;switch(null==r?void 0:r.condition){case"total":return i(parseFloat(l.total_amount),parseFloat(c),null==r?void 0:r.operator);case"products":return t(e(l),c,null==r?void 0:r.operator);case"coupons":return t(s(l),c,null==r?void 0:r.operator);case"shipping_country":return t([null===(n=null==l?void 0:l.shipping_address)||void 0===n?void 0:n.country],c,null==r?void 0:r.operator);case"billing_country":return t([null===(u=null==l?void 0:l.billing_address)||void 0===u?void 0:u.country],c,null==r?void 0:r.operator);case"processors":return t([o],c,null==r?void 0:r.operator);default:return!1}})).every((r=>r)))(r,c)))?l(o,null,l("slot",null)):null}};c.style=":host{display:block}";export{c as sc_conditional_form}