"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[2023],{488:function(n,e,i){i.d(e,{i:function(){return c},m:function(){return t},z:function(){return r}});var r=["bif","byr","clp","djf","gnf","isk","jpy","kmf","krw","pyg","rwf","ugx","vnd","vuv","xaf","xag","xau","xba","xbb","xbc","xbd","xdr","xof","xpd","xpf","xpt","xts"],t=function(n,e){return c(e)?n:n/100},c=function(n){var e;return r.includes(null===(e=null==n?void 0:n.toLowerCase)||void 0===e?void 0:e.call(n))}},3309:function(n,e,i){i.d(e,{a:function(){return t},b:function(){return p},c:function(){return a},g:function(){return c},i:function(){return o},p:function(){return d},t:function(){return s}});var r=i(488),t=function(n){if((null==n?void 0:n.amount_off)&&(null==n?void 0:n.currency))return c({amount:n.amount_off,currency:n.currency});if(null==n?void 0:n.percent_off){var e="".concat(0|n.percent_off,"%");
// translators: %s is the discount percentage (e.g. "10%").
return wp.i18n.sprintf(wp.i18n.__("%s off","surecart"),e)}return""},c=function(n){var e=n.amount,i=n.currency,t=function(n,e){return r.z.includes(e)?n:n/100}(e,i);return"".concat(new Intl.NumberFormat(void 0,{style:"currency",currency:i}).format(parseFloat(t.toFixed(2))))},a=function(){var n,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"usd";return null===(n=new Intl.NumberFormat(void 0,{style:"currency",currency:e}).formatToParts().find((function(n){return"currency"===n.type})))||void 0===n?void 0:n.value},s=function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("every","surecart"),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wp.i18n.__("once","surecart"),t=arguments.length>4&&void 0!==arguments[4]&&arguments[4];switch(e){case"day":return"".concat(i," ").concat(wp.i18n.sprintf(t?wp.i18n._n("%d day","%d days",n,"surecart"):wp.i18n._n("day","%d days",n,"surecart"),n));case"week":return"".concat(i," ").concat(wp.i18n.sprintf(t?wp.i18n._n("%d week","%d weeks",n,"surecart"):wp.i18n._n("week","%d weeks",n,"surecart"),n));case"month":return"".concat(i," ").concat(wp.i18n.sprintf(t?wp.i18n._n("%d month","%d months",n,"surecart"):wp.i18n._n("month","%d months",n,"surecart"),n));case"year":return"".concat(i," ").concat(wp.i18n.sprintf(t?wp.i18n._n("%d year","%d years",n,"surecart"):wp.i18n._n("year","%d years",n,"surecart"),n));default:return r}},o=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n)return"";var i=e.showOnce,r=e.labels,t=e.abbreviate,c=(r||{}).interval,a=void 0===c?wp.i18n.__("every","surecart"):c;return"".concat(u(n,a,i?wp.i18n.__("once","surecart"):"",t)," ").concat(l(n,t))},u=function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return n.recurring_interval_count&&n.recurring_interval&&1!==(null==n?void 0:n.recurring_period_count)?r?function(n,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];switch(e){case"day":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d day","%d days",n,"surecart"):wp.i18n._n("day","%d days",n,"surecart"),n));case"week":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d wk","%d wks",n,"surecart"):wp.i18n._n("wk","%d wks",n,"surecart"),n));case"month":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d mo","%d months",n,"surecart"):wp.i18n._n("mo","%d mos",n,"surecart"),n));case"year":return" / ".concat(wp.i18n.sprintf(r?wp.i18n._n("%d yr","%d yrs",n,"surecart"):wp.i18n._n("yr","%d yrs",n,"surecart"),n));default:return i}}(n.recurring_interval_count,n.recurring_interval,i):s(n.recurring_interval_count,n.recurring_interval," ".concat(e),i):""},l=function(n){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(null==n?void 0:n.recurring_period_count)&&1!==(null==n?void 0:n.recurring_period_count)?e?"x ".concat(n.recurring_period_count):" (".concat(wp.i18n.sprintf(wp.i18n._n("%d payment","%d payments",n.recurring_period_count,"surecart"),n.recurring_period_count),")"):""},d=function(n){var e;return n?"".concat(null===(e=null==n?void 0:n.product)||void 0===e?void 0:e.name," ").concat((null==n?void 0:n.name)?"— ".concat(n.name):""):""},p=function(n){switch(n){case"invalid":return wp.i18n.__("Not valid","surecart");case"expired":return wp.i18n.__("Expired","surecart");case"gone":return wp.i18n.__("Not available","surecart");case"less_than_min_subtotal_amount":return wp.i18n.__("Minimum not met","surecart");case"greater_than_max_subtotal_amount":return wp.i18n.__("Order amount exceeds limit","surecart");case"not_applicable":return wp.i18n.__("Product(s) not eligible","surecart");case"not_applicable_to_customer":return wp.i18n.__("Not eligible","surecart");case"":return"";default:return wp.i18n.__("Not redeemable","surecart")}}},2023:function(n,e,i){i.r(e),i.d(e,{sc_price_choice_container:function(){return s}});var r=i(3029),t=i(2901),c=i(7364),a=i(3309),s=function(){return(0,t.A)((function n(e){(0,r.A)(this,n),(0,c.r)(this,e),this.scChange=(0,c.c)(this,"scChange",7),this.price=void 0,this.loading=!1,this.label=void 0,this.showLabel=!0,this.showPrice=!0,this.showControl=!1,this.description=void 0,this.type=void 0,this.required=!1,this.checked=!1,this.priceData=void 0}),[{key:"handlePriceChange",value:function(){this.priceData="string"==typeof this.price?JSON.parse(this.price):this.price}},{key:"componentWillLoad",value:function(){this.handlePriceChange()}},{key:"renderPrice",value:function(){var n;return(0,c.h)(c.F,null,null===(n=this.priceData)||void 0===n?void 0:n.display_amount,(0,a.i)(this.priceData,{showOnce:!0,abbreviate:!0,labels:{interval:"/",period:/** translators: used as in time period: "for 3 months" */
wp.i18n.__("for","surecart")}}))}},{key:"render",value:function(){var n,e,i,r,t,s,o,u,l,d,p,h,_=this;return this.loading?(0,c.h)("sc-choice-container",{showControl:this.showControl,name:"loading",disabled:!0},(0,c.h)("div",{class:"price-choice"},(0,c.h)("sc-skeleton",{style:{width:"60px",display:"inline-block"}}),(0,c.h)("sc-skeleton",{style:{width:"80px",display:"inline-block"}}))):(0,c.h)("sc-choice-container",{value:null===(n=this.priceData)||void 0===n?void 0:n.id,type:this.type,showControl:this.showControl,checked:this.checked,onScChange:function(){return _.scChange.emit()},required:this.required},(0,c.h)("div",{class:"price-choice"},this.showLabel&&(0,c.h)("div",{class:"price-choice__title"},(0,c.h)("div",{class:"price-choice__name"},this.label||this.priceData.name),!!this.description&&(0,c.h)("div",{class:"price-choice__description"},this.description)),this.showPrice&&(0,c.h)("div",{class:"price-choice__details"},(0,c.h)("div",{class:"price-choice__price"},(null===(e=this.priceData)||void 0===e?void 0:e.ad_hoc)?wp.i18n.__("Custom Amount","surecart"):(0,c.h)(c.F,null,null===(i=this.priceData)||void 0===i?void 0:i.display_amount,(null===(r=this.priceData)||void 0===r?void 0:r.recurring_period_count)&&1<=(null===(t=this.priceData)||void 0===t?void 0:t.recurring_period_count)&&(0,c.h)("sc-visually-hidden",null," ",wp.i18n.__("This is a repeating price. Payment will happen","surecart")," ",(0,a.i)(this.priceData,{showOnce:!0,abbreviate:!1,labels:{interval:wp.i18n.__("every","surecart"),period:/** translators: used as in time period: "for 3 months" */
wp.i18n.__("for","surecart")}})),(0,c.h)("span",{"aria-hidden":"true"},(0,a.i)(this.priceData,{showOnce:!0,abbreviate:!0,labels:{interval:"/",period:/** translators: used as in time period: "for 3 months" */
wp.i18n.__("for","surecart")}})))),!!(null===(s=this.priceData)||void 0===s?void 0:s.trial_duration_days)&&(0,c.h)(c.F,null,(0,c.h)("sc-visually-hidden",null,wp.i18n.sprintf(wp.i18n.__("You have a %d-day trial before payment becomes necessary.","surecart"),null===(o=this.priceData)||void 0===o?void 0:o.trial_duration_days)),(0,c.h)("div",{class:"price-choice__trial","aria-hidden":"true"},wp.i18n.sprintf(wp.i18n._n("Starting in %s day","Starting in %s days",this.priceData.trial_duration_days,"surecart"),this.priceData.trial_duration_days))),!!(null===(u=this.priceData)||void 0===u?void 0:u.setup_fee_enabled)&&(null===(l=this.priceData)||void 0===l?void 0:l.setup_fee_amount)&&(0,c.h)("div",{class:"price-choice__setup-fee"},(0,c.h)("sc-visually-hidden",null,wp.i18n.__("This payment plan has","surecart")," "),null===(d=this.priceData)||void 0===d?void 0:d.setup_fee_display_amount," ",(null===(p=this.priceData)||void 0===p?void 0:p.setup_fee_name)||((null===(h=this.priceData)||void 0===h?void 0:h.setup_fee_amount)<0?wp.i18n.__("Discount","surecart"):wp.i18n.__("Setup Fee","surecart"))))))}}],[{key:"watchers",get:function(){return{price:["handlePriceChange"]}}}])}();s.style=":host {\n  display: block;\n  min-width: 0;\n  width: 100%;\n}\n\nsc-choice-container {\n  container-type: inline-size;\n}\n\n.price-choice {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  line-height: var(--sc-line-height-dense);\n  gap: var(--sc-spacing-small);\n}\n.price-choice__name {\n  display: inline-block;\n  font-size: var(--sc-price-choice-name-size, var(--sc-input-label-font-size-medium));\n  font-weight: var(--sc-price-choice-name-font-weight, var(--sc-font-weight-bold));\n  text-transform: var(--sc-price-choice-text-transform, var(--sc-input-label-text-transform, none));\n}\n.price-choice > *:not(:first-child):last-child {\n  text-align: right;\n}\n.price-choice__details {\n  flex: 1 0 50%;\n  display: grid;\n  gap: var(--sc-spacing-xxx-small);\n}\n.price-choice__trial, .price-choice__setup-fee, .price-choice__price {\n  font-size: var(--sc-font-size-small);\n  opacity: 0.8;\n}\n.price-choice__price {\n  font-weight: var(--sc-price-choice-price-font-weight, var(--sc-font-weight-normal));\n}\n\n@container (max-width: 325px) {\n  .price-choice {\n    flex-direction: column;\n    align-items: flex-start;\n    gap: var(--sc-spacing-xx-small);\n  }\n  .price-choice > *:not(:first-child):last-child {\n    text-align: initial;\n  }\n}"}}]);