@foxy.io/elements 1.53.2 → 1.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/cdn/foxy-address-form.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-api-browser.js +1 -1
  4. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  5. package/dist/cdn/foxy-attribute-form.js +1 -1
  6. package/dist/cdn/foxy-cart-form.js +1 -1
  7. package/dist/cdn/foxy-client-form.js +1 -1
  8. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  10. package/dist/cdn/foxy-coupon-form.js +1 -1
  11. package/dist/cdn/foxy-custom-field-form.js +1 -1
  12. package/dist/cdn/foxy-customer-form.js +1 -1
  13. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  14. package/dist/cdn/foxy-customer-portal.js +11 -11
  15. package/dist/cdn/foxy-customer.js +1 -1
  16. package/dist/cdn/foxy-downloadable-form.js +1 -1
  17. package/dist/cdn/foxy-email-template-form.js +1 -1
  18. package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
  19. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  20. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  21. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  22. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  23. package/dist/cdn/foxy-gift-card-form.js +1 -1
  24. package/dist/cdn/foxy-integration-form.js +1 -1
  25. package/dist/cdn/foxy-item-category-form.js +1 -1
  26. package/dist/cdn/foxy-item-form.js +1 -1
  27. package/dist/cdn/foxy-item-option-form.js +1 -1
  28. package/dist/cdn/foxy-native-integration-form.js +1 -1
  29. package/dist/cdn/foxy-passkey-form.js +1 -1
  30. package/dist/cdn/foxy-payment-method-card.js +1 -1
  31. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  32. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  33. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  34. package/dist/cdn/foxy-payments-api.js +1 -1
  35. package/dist/cdn/foxy-report-form.js +1 -1
  36. package/dist/cdn/foxy-store-form.js +1 -1
  37. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  38. package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
  39. package/dist/cdn/foxy-subscription-form.js +1 -1
  40. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  41. package/dist/cdn/foxy-tax-form.js +1 -1
  42. package/dist/cdn/foxy-template-config-form.js +1 -1
  43. package/dist/cdn/foxy-template-form.js +1 -1
  44. package/dist/cdn/foxy-template-set-form.js +1 -1
  45. package/dist/cdn/foxy-transaction.js +1 -1
  46. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  47. package/dist/cdn/foxy-user-form.js +1 -1
  48. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  49. package/dist/cdn/foxy-users-table.js +1 -1
  50. package/dist/cdn/foxy-webhook-form.js +1 -1
  51. package/dist/cdn/{shared-ad26f72d.js → shared-13fed57b.js} +1 -1
  52. package/dist/cdn/{shared-e44d4a56.js → shared-6418bbb8.js} +1 -1
  53. package/dist/cdn/{shared-842078ca.js → shared-db8913cf.js} +1 -1
  54. package/dist/cdn/translations/payments-api-payment-method-form/en.json +51 -1
  55. package/dist/elements/internal/InternalForm/InternalForm.js +5 -3
  56. package/dist/elements/internal/InternalForm/InternalForm.js.map +1 -1
  57. package/dist/elements/internal/InternalForm/types.d.ts +2 -0
  58. package/dist/elements/internal/InternalForm/types.js.map +1 -1
  59. package/dist/elements/public/PaymentsApi/api/composers/payment_method.js +11 -5
  60. package/dist/elements/public/PaymentsApi/api/composers/payment_method.js.map +1 -1
  61. package/dist/elements/public/PaymentsApi/api/composers/payment_methods.js +1 -0
  62. package/dist/elements/public/PaymentsApi/api/composers/payment_methods.js.map +1 -1
  63. package/dist/elements/public/PaymentsApi/api/composers/payment_preset.js +1 -0
  64. package/dist/elements/public/PaymentsApi/api/composers/payment_preset.js.map +1 -1
  65. package/dist/elements/public/PaymentsApi/api/types.d.ts +3 -0
  66. package/dist/elements/public/PaymentsApi/api/types.js.map +1 -1
  67. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.d.ts +14 -0
  68. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js +197 -16
  69. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js.map +1 -1
  70. package/dist/elements/public/PaymentsApiPaymentPresetForm/PaymentsApiPaymentPresetForm.d.ts +2 -0
  71. package/dist/elements/public/PaymentsApiPaymentPresetForm/PaymentsApiPaymentPresetForm.js +4 -0
  72. package/dist/elements/public/PaymentsApiPaymentPresetForm/PaymentsApiPaymentPresetForm.js.map +1 -1
  73. package/dist/elements/public/ReportForm/utils.js +12 -12
  74. package/dist/elements/public/ReportForm/utils.js.map +1 -1
  75. package/package.json +4 -2
@@ -1 +1 @@
1
- import"./shared-515003f6.js";import"./shared-ee48a1ed.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import"./shared-f6c6ce5f.js";import"./shared-a339f79c.js";import{I as e}from"./shared-ad26f72d.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-9b35fe34.js";import{_ as t,B as r,l as i}from"./shared-8f9014ff.js";import{g as s}from"./shared-bab2ea2c.js";import{a as n}from"./shared-887ac0b0.js";import{i as o}from"./shared-53e42a77.js";import{h as a,s as l}from"./shared-ba5c42c7.js";import{c}from"./shared-4e709717.js";import{h as u}from"./shared-c7796413.js";import{s as h}from"./shared-791b4510.js";import"./shared-99c53365.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-ce05e482.js";import"./shared-9a3bf65c.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-a5d6db21.js";import"./foxy-copy-to-clipboard.js";import"./shared-9687ab7b.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-19073761.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./shared-2bb1f0f4.js";import"./shared-5212ef4f.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-0e19bda5.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-7892fd3f.js";import"./shared-8df8e77c.js";import"./shared-d0aed1c1.js";import"./shared-609c9693.js";import"./shared-058530fc.js";function d(e){return Array.isArray?Array.isArray(e):"[object Array]"===A(e)}const f=1/0;function p(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-f?"-0":t}(e)}function m(e){return"string"==typeof e}function g(e){return"number"==typeof e}function _(e){return!0===e||!1===e||function(e){return y(e)&&null!==e}(e)&&"[object Boolean]"==A(e)}function y(e){return"object"==typeof e}function v(e){return null!=e}function x(e){return!e.trim().length}function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const $=e=>`Missing ${e} property in key`,b=e=>`Property 'weight' in key '${e}' must be a positive integer`,C=Object.prototype.hasOwnProperty;class M{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let r=B(e);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function B(e){let t=null,r=null,i=null,s=1,n=null;if(m(e)||d(e))i=e,t=D(e),r=E(e);else{if(!C.call(e,"name"))throw new Error($("name"));const o=e.name;if(i=o,C.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(b(o));t=D(o),r=E(o),n=e.getFn}return{path:t,id:r,weight:s,src:i,getFn:n}}function D(e){return d(e)?e:e.split(".")}function E(e){return d(e)?e.join("."):e}var F={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let r=[],i=!1;const s=(e,t,n)=>{if(v(e))if(t[n]){const o=e[t[n]];if(!v(o))return;if(n===t.length-1&&(m(o)||g(o)||_(o)))r.push(p(o));else if(d(o)){i=!0;for(let e=0,r=o.length;e<r;e+=1)s(o[e],t,n+1)}else t.length&&s(o,t,n+1)}else r.push(e)};return s(e,m(t)?t.split("."):t,0),i?r:r[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const L=/[^ ]+/g;class k{constructor({getFn:e=F.getFn,fieldNormWeight:t=F.fieldNormWeight}={}){this.norm=function(e=1,t=3){const r=new Map,i=Math.pow(10,t);return{get(t){const s=t.match(L).length;if(r.has(s))return r.get(s);const n=1/Math.pow(s,.5*e),o=parseFloat(Math.round(n*i)/i);return r.set(s,o),o},clear(){r.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!v(e)||x(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach(((t,i)=>{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(v(s))if(d(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:r,value:i}=t.pop();if(v(i))if(m(i)&&!x(i)){let t={v:i,i:r,n:this.norm.get(i)};e.push(t)}else d(i)&&i.forEach(((e,r)=>{t.push({nestedArrIndex:r,value:e})}))}r.$[i]=e}else if(m(s)&&!x(s)){let e={v:s,n:this.norm.get(s)};r.$[i]=e}})),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function S(e,t,{getFn:r=F.getFn,fieldNormWeight:i=F.fieldNormWeight}={}){const s=new k({getFn:r,fieldNormWeight:i});return s.setKeys(e.map(B)),s.setSources(t),s.create(),s}function w(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:s=F.distance,ignoreLocation:n=F.ignoreLocation}={}){const o=t/e.length;if(n)return o;const a=Math.abs(i-r);return s?o+a/s:a?1:o}const j=32;function I(e,t,r,{location:i=F.location,distance:s=F.distance,threshold:n=F.threshold,findAllMatches:o=F.findAllMatches,minMatchCharLength:a=F.minMatchCharLength,includeMatches:l=F.includeMatches,ignoreLocation:c=F.ignoreLocation}={}){if(t.length>j)throw new Error(`Pattern length exceeds max of ${j}.`);const u=t.length,h=e.length,d=Math.max(0,Math.min(i,h));let f=n,p=d;const m=a>1||l,g=m?Array(h):[];let _;for(;(_=e.indexOf(t,p))>-1;){let e=w(t,{currentLocation:_,expectedLocation:d,distance:s,ignoreLocation:c});if(f=Math.min(e,f),p=_+u,m){let e=0;for(;e<u;)g[_+e]=1,e+=1}}p=-1;let y=[],v=1,x=u+h;const A=1<<u-1;for(let i=0;i<u;i+=1){let n=0,a=x;for(;n<a;){w(t,{errors:i,currentLocation:d+a,expectedLocation:d,distance:s,ignoreLocation:c})<=f?n=a:x=a,a=Math.floor((x-n)/2+n)}x=a;let l=Math.max(1,d-a+1),_=o?h:Math.min(d+a,h)+u,$=Array(_+2);$[_+1]=(1<<i)-1;for(let n=_;n>=l;n-=1){let o=n-1,a=r[e.charAt(o)];if(m&&(g[o]=+!!a),$[n]=($[n+1]<<1|1)&a,i&&($[n]|=(y[n+1]|y[n])<<1|1|y[n+1]),$[n]&A&&(v=w(t,{errors:i,currentLocation:o,expectedLocation:d,distance:s,ignoreLocation:c}),v<=f)){if(f=v,p=o,p<=d)break;l=Math.max(1,2*d-p)}}if(w(t,{errors:i+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:c})>f)break;y=$}const $={isMatch:p>=0,score:Math.max(.001,v)};if(m){const e=function(e=[],t=F.minMatchCharLength){let r=[],i=-1,s=-1,n=0;for(let o=e.length;n<o;n+=1){let o=e[n];o&&-1===i?i=n:o||-1===i||(s=n-1,s-i+1>=t&&r.push([i,s]),i=-1)}return e[n-1]&&n-i>=t&&r.push([i,n-1]),r}(g,a);e.length?l&&($.indices=e):$.isMatch=!1}return $}function P(e){let t={};for(let r=0,i=e.length;r<i;r+=1){const s=e.charAt(r);t[s]=(t[s]||0)|1<<i-r-1}return t}const V=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class R{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c},e=a?e:e.toLowerCase(),e=l?V(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const u=(e,t)=>{this.chunks.push({pattern:e,alphabet:P(e),startIndex:t})},h=this.pattern.length;if(h>j){let e=0;const t=h%j,r=h-t;for(;e<r;)u(this.pattern.substr(e,j),e),e+=j;if(t){const e=h-j;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:s,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,ignoreLocation:c}=this.options;let u=[],h=0,d=!1;this.chunks.forEach((({pattern:t,alphabet:r,startIndex:f})=>{const{isMatch:p,score:m,indices:g}=I(e,t,r,{location:s+f,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,includeMatches:i,ignoreLocation:c});p&&(d=!0),h+=m,p&&g&&(u=[...u,...g])}));let f={isMatch:d,score:d?h/this.chunks.length:1};return d&&i&&(f.indices=u),f}}class O{constructor(e){this.pattern=e}static isMultiMatch(e){return N(e,this.multiRegex)}static isSingleMatch(e){return N(e,this.singleRegex)}search(){}}function N(e,t){const r=e.match(t);return r?r[1]:null}class W extends O{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){super(e),this._bitapSearch=new R(e,{location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class q extends O{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,r=0;const i=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,r))>-1;)r=t+s,i.push([t,r-1]);const n=!!i.length;return{isMatch:n,score:n?0:1,indices:i}}}const z=[class extends O{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},q,class extends O{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},W],Z=z.length,H=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const T=new Set([W.type,q.type]);class J{constructor(e,{isCaseSensitive:t=F.isCaseSensitive,ignoreDiacritics:r=F.ignoreDiacritics,includeMatches:i=F.includeMatches,minMatchCharLength:s=F.minMatchCharLength,ignoreLocation:n=F.ignoreLocation,findAllMatches:o=F.findAllMatches,location:a=F.location,threshold:l=F.threshold,distance:c=F.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i,minMatchCharLength:s,findAllMatches:o,ignoreLocation:n,location:a,threshold:l,distance:c},e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map((e=>{let r=e.trim().split(H).filter((e=>e&&!!e.trim())),i=[];for(let e=0,s=r.length;e<s;e+=1){const s=r[e];let n=!1,o=-1;for(;!n&&++o<Z;){const e=z[o];let r=e.isMultiMatch(s);r&&(i.push(new e(r,t)),n=!0)}if(!n)for(o=-1;++o<Z;){const e=z[o];let r=e.isSingleMatch(s);if(r){i.push(new e(r,t));break}}}return i}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:i,ignoreDiacritics:s}=this.options;e=i?e:e.toLowerCase(),e=s?V(e):e;let n=0,o=[],a=0;for(let i=0,s=t.length;i<s;i+=1){const s=t[i];o.length=0,n=0;for(let t=0,i=s.length;t<i;t+=1){const i=s[t],{isMatch:l,indices:c,score:u}=i.search(e);if(!l){a=0,n=0,o.length=0;break}if(n+=1,a+=u,r){const e=i.constructor.type;T.has(e)?o=[...o,...c]:o.push(c)}}if(n){let e={isMatch:!0,score:a/n};return r&&(e.indices=o),e}}return{isMatch:!1,score:1}}}const K=[];function U(e,t){for(let r=0,i=K.length;r<i;r+=1){let i=K[r];if(i.condition(e,t))return new i(e,t)}return new R(e,t)}const G="$and",Q="$or",X="$path",Y="$val",ee=e=>!(!e[G]&&!e[Q]),te=e=>({[G]:Object.keys(e).map((t=>({[t]:e[t]})))});function re(e,t,{auto:r=!0}={}){const i=e=>{let s=Object.keys(e);const n=(e=>!!e[X])(e);if(!n&&s.length>1&&!ee(e))return i(te(e));if((e=>!d(e)&&y(e)&&!ee(e))(e)){const i=n?e[X]:s[0],o=n?e[Y]:e[i];if(!m(o))throw new Error((e=>`Invalid value for key ${e}`)(i));const a={keyId:E(i),pattern:o};return r&&(a.searcher=U(o,t)),a}let o={children:[],operator:s[0]};return s.forEach((t=>{const r=e[t];d(r)&&r.forEach((e=>{o.children.push(i(e))}))})),o};return ee(e)||(e=te(e)),i(e)}function ie(e,t){const r=e.matches;t.matches=[],v(r)&&r.forEach((e=>{if(!v(e.indices)||!e.indices.length)return;const{indices:r,value:i}=e;let s={indices:r,value:i};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function se(e,t){t.score=e.score}class ne{constructor(e,t={},r){this.options={...F,...t},this.options.useExtendedSearch,this._keyStore=new M(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof k))throw new Error("Incorrect 'index' type");this._myIndex=t||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){v(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let r=0,i=this._docs.length;r<i;r+=1){const s=this._docs[r];e(s,r)&&(this.removeAt(r),r-=1,i-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:s,sortFn:n,ignoreFieldNorm:o}=this.options;let a=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=F.ignoreFieldNorm}){e.forEach((e=>{let r=1;e.matches.forEach((({key:e,norm:i,score:s})=>{const n=e?e.weight:null;r*=Math.pow(0===s&&n?Number.EPSILON:s,(n||1)*(t?1:i))})),e.score=r}))}(a,{ignoreFieldNorm:o}),s&&a.sort(n),g(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:r=F.includeMatches,includeScore:i=F.includeScore}={}){const s=[];return r&&s.push(ie),i&&s.push(se),e.map((e=>{const{idx:r}=e,i={item:t[r],refIndex:r};return s.length&&s.forEach((t=>{t(e,i)})),i}))}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const t=U(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const{isMatch:n,score:o,indices:a}=t.searchIn(e);n&&i.push({item:e,idx:r,matches:[{score:o,value:e,norm:s,indices:a}]})})),i}_searchLogical(e){const t=re(e,this.options),r=(e,t,i)=>{if(!e.children){const{keyId:r,searcher:s}=e,n=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:s});return n&&n.length?[{idx:i,item:t,matches:n}]:[]}const s=[];for(let n=0,o=e.children.length;n<o;n+=1){const o=e.children[n],a=r(o,t,i);if(a.length)s.push(...a);else if(e.operator===G)return[]}return s},i=this._myIndex.records,s={},n=[];return i.forEach((({$:e,i:i})=>{if(v(e)){let o=r(t,e,i);o.length&&(s[i]||(s[i]={idx:i,item:e,matches:[]},n.push(s[i])),o.forEach((({matches:e})=>{s[i].matches.push(...e)})))}})),n}_searchObjectList(e){const t=U(e,this.options),{keys:r,records:i}=this._myIndex,s=[];return i.forEach((({$:e,i:i})=>{if(!v(e))return;let n=[];r.forEach(((r,i)=>{n.push(...this._findMatches({key:r,value:e[i],searcher:t}))})),n.length&&s.push({idx:i,item:e,matches:n})})),s}_findMatches({key:e,value:t,searcher:r}){if(!v(t))return[];let i=[];if(d(t))t.forEach((({v:t,i:s,n:n})=>{if(!v(t))return;const{isMatch:o,score:a,indices:l}=r.searchIn(t);o&&i.push({score:a,key:e,value:t,idx:s,norm:n,indices:l})}));else{const{v:s,n:n}=t,{isMatch:o,score:a,indices:l}=r.searchIn(s);o&&i.push({score:a,key:e,value:s,norm:n,indices:l})}return i}}ne.version="7.1.0",ne.createIndex=S,ne.parseIndex=function(e,{getFn:t=F.getFn,fieldNormWeight:r=F.fieldNormWeight}={}){const{keys:i,records:s}=e,n=new k({getFn:t,fieldNormWeight:r});return n.setKeys(i),n.setIndexRecords(s),n},ne.config=F,ne.parseQuery=re,function(...e){K.push(...e)}(J);let oe,ae,le,ce,ue,he,de,fe,pe,me,ge,_e,ye,ve,xe,Ae,$e,be,Ce,Me,Be,De,Ee,Fe,Le,ke,Se,we,je,Ie,Pe,Ve=e=>e;const Re=n(e,"payments-api-payment-method-form");class Oe extends Re{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__cardVerificationOptions=[{label:"option_disabled",value:"disabled"},{label:"option_enabled_automatically",value:"enabled_automatically"},{label:"option_enabled_override",value:"enabled_override"}],this.__search=""}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{},__search:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,s;const n=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let o;try{o=JSON.parse(null!==(s=e.additional_fields)&&void 0!==s?s:"{}")}catch(e){o={}}for(const e of n)for(const t of e.fields)if("optional"in t&&!t.optional&&!u(o,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return a(oe||(oe=Ve` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?a(ae||(ae=Ve``)):a(le||(le=Ve` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=s(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=s(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=a(ce||(ce=Ve` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),o(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),o(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),o(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return a(ue||(ue=Ve`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;const t=Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{});return(this.__search?new ne(t,{keys:["1.name"],threshold:.25}).search(this.__search).map((e=>e.item)):t).sort(((e,t)=>e[1].name.localeCompare(t[1].name,"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const i=r.name.charAt(0).toUpperCase(),s=!/\w/.test(i)?"#":i,n=e.find((e=>e.name===s));return n?n.items.push({type:t,helper:r}):e.push({name:s,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?a(de||(de=Ve` <div> <input placeholder="${0}" class="w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" style="padding:var(--lumo-space-xs) calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" type="search" .value="${0}" @input="${0}"> <section data-testid="select-method-list"> ${0} </section> </div> `),this.t("search_placeholder"),this.__search,(e=>{this.__search=e.currentTarget.value}),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>a(fe||(fe=Ve` <p class="font-medium text-tertiary py-m">${0}</p> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> `),e,t.map(((e,r)=>this.__renderPaymentMethodButton(e,r,t.length))))))):a(he||(he=Ve` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e,t;return this.form.type&&["stripe_connect","stripe_v2","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?a(pe||(pe=Ve` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),l(me||(me=Ve`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):a(ge||(ge=Ve` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_auth_only)?a(_e||(_e=Ve` <foxy-internal-switch-control infer="use-auth-only" helper-text-as-tooltip> </foxy-internal-switch-control> `)):"",(null===(t=this.form.helper)||void 0===t?void 0:t.supports_3d_secure)?a(ye||(ye=Ve` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?a(ve||(ve=Ve` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,s,n,c,u,h,d,f,p,m,g,_,y,v;const x=0===t?"":`${e}_`,A=0===t?"":`${e}-`,$=0===t?this.__liveBlocks:this.__testBlocks,b=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return a(xe||(xe=Ve``));if("live"===e&&!(null===(s=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===s?void 0:s.is_active))return a(Ae||(Ae=Ve` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,l($e||($e=Ve`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const C=!0===(null===(c=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===c?void 0:c.is_active)&&("test"===e&&!0===(null===(h=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(f=null===(d=this.__paymentPresetLoader)||void 0===d?void 0:d.data)||void 0===f?void 0:f.is_live));return a(be||(be=Ve` <foxy-internal-summary-control helper-text="${0}" layout="section" label="${0}" infer="${0}"> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} ${0} ${0} ${0} ${0} </foxy-internal-summary-control> ${0} </foxy-internal-summary-control> `),o(C?this.t(`${b}.helper_text_inactive`):void 0),o(C?this.t(`${b}.label_inactive`):void 0),b,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?a(Ce||(Ce=Ve` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,A):"",(null===(m=this.form.helper)||void 0===m?void 0:m.third_party_key_description)?a(Me||(Me=Ve` <foxy-internal-password-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,A):"",(null===(g=this.form.helper)||void 0===g?void 0:g.key_description)?a(Be||(Be=Ve` <foxy-internal-password-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,A):"",$.map((e=>this.__renderBlock(e))),(null===(_=this.form.helper)||void 0===_?void 0:_.supports_card_verification)?a(De||(De=Ve` <foxy-internal-select-control helper-text="${0}" layout="summary-item" infer="${0}card-verification" .options="${0}" .getValue="${0}"> </foxy-internal-select-control> `),this.t(`${b}.${A}card-verification.helper_text_${this.form[`${x}card_verification`]||"disabled"}`),A,this.__cardVerificationOptions,(()=>this.form[`${x}card_verification`]||"disabled")):"",(null===(y=this.form.helper)||void 0===y?void 0:y.supports_card_verification)&&(null===(v=this.form[`${x}card_verification`])||void 0===v?void 0:v.startsWith("enabled_"))?a(Ee||(Ee=Ve` <foxy-internal-summary-control layout="details" class="mt-s" infer="${0}card-verification-config"> ${0} </foxy-internal-summary-control> `),A,["visa","mastercard","american-express","discover","default"].map((e=>{var t;return a(Fe||(Fe=Ve` <foxy-internal-number-control json-template="${0}" json-path="verification_amounts.${0}" property="${0}card_verification_config" layout="summary-item" infer="${0}card-verification-config-verification-amounts-${0}" step="0.01" min="0"> </foxy-internal-number-control> `),o(null===(t=this.form.helper)||void 0===t?void 0:t.card_verification_config),e.replace(/-/g,"_"),x,A,e)}))):"")})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t},r,i){var s,n;const o=Oe.defaultImageSrc,l=null!==(n=null===(s=this.getImageSrc)||void 0===s?void 0:s.call(this,e))&&void 0!==n?n:o;return a(Le||(Le=Ve` <button class="${0}" ?disabled="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" @click="${0}"> <figure class="relative flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <span class="font-medium">${0}&ZeroWidthSpace;</span> ${0} </figcaption> </figure> </button> `),c({"relative w-full block text-left bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict,"rounded-t":0===r,"rounded-b":r===i-1}),!!t.conflict,(()=>this.edit({type:e,helper:t})),c({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),l,(e=>e.currentTarget.src=o),c({"min-w-0 flex-1 grid leading-xs":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?a(ke||(ke=Ve`<span class="text-xs"> ${0}</span>`),this.t("conflict_message",t.conflict)):"")}__renderBlock(e){return a(Se||(Se=Ve`${0}`),e.fields.map((e=>{var t,r,s;if("hidden"===e.type)return;const n=["additional-fields",e.id].join("-").replace(/_/g,"-"),o=()=>{var t,r;try{const s=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(s,e.id))&&void 0!==r?r:s.default_value}catch(t){return e.default_value}},l=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},c=e.options;return a(we||(we=Ve` ${0} `),"checkbox"===e.type?a(je||(je=Ve` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,n,o,l):"select"===e.type?a(Ie||(Ie=Ve` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,n,c.map((({name:e,value:t})=>({label:e,value:t}))),o,l):a(Pe||(Pe=Ve` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(s=e.description)&&void 0!==s?s:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,n,o,l))})))}}customElements.define("foxy-payments-api-payment-method-form",Oe);export{Oe as PaymentsApiPaymentMethodForm};
1
+ import"./shared-515003f6.js";import"./shared-ee48a1ed.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import"./shared-f6c6ce5f.js";import"./shared-a339f79c.js";import{I as e}from"./shared-13fed57b.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-9b35fe34.js";import{_ as t,B as r,l as i}from"./shared-8f9014ff.js";import{g as n}from"./shared-bab2ea2c.js";import{a as s}from"./shared-887ac0b0.js";import{i as o}from"./shared-53e42a77.js";import{h as a,s as c}from"./shared-ba5c42c7.js";import{c as l}from"./shared-4e709717.js";import{h as u}from"./shared-c7796413.js";import{s as d}from"./shared-791b4510.js";import"./shared-99c53365.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-ce05e482.js";import"./shared-9a3bf65c.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-a5d6db21.js";import"./foxy-copy-to-clipboard.js";import"./shared-9687ab7b.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-19073761.js";import"./shared-41c9c53f.js";import"./shared-930e68b7.js";import"./shared-2bb1f0f4.js";import"./shared-5212ef4f.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-0e19bda5.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-7892fd3f.js";import"./shared-8df8e77c.js";import"./shared-d0aed1c1.js";import"./shared-609c9693.js";import"./shared-058530fc.js";function h(e){return Array.isArray?Array.isArray(e):"[object Array]"===$(e)}const p=1/0;function f(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-p?"-0":t}(e)}function m(e){return"string"==typeof e}function y(e){return"number"==typeof e}function _(e){return!0===e||!1===e||function(e){return g(e)&&null!==e}(e)&&"[object Boolean]"==$(e)}function g(e){return"object"==typeof e}function v(e){return null!=e}function x(e){return!e.trim().length}function $(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const A=e=>`Missing ${e} property in key`,b=e=>`Property 'weight' in key '${e}' must be a positive integer`,C=Object.prototype.hasOwnProperty;class M{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let r=k(e);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function k(e){let t=null,r=null,i=null,n=1,s=null;if(m(e)||h(e))i=e,t=B(e),r=E(e);else{if(!C.call(e,"name"))throw new Error(A("name"));const o=e.name;if(i=o,C.call(e,"weight")&&(n=e.weight,n<=0))throw new Error(b(o));t=B(o),r=E(o),s=e.getFn}return{path:t,id:r,weight:n,src:i,getFn:s}}function B(e){return h(e)?e:e.split(".")}function E(e){return h(e)?e.join("."):e}var D={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let r=[],i=!1;const n=(e,t,s)=>{if(v(e))if(t[s]){const o=e[t[s]];if(!v(o))return;if(s===t.length-1&&(m(o)||y(o)||_(o)))r.push(f(o));else if(h(o)){i=!0;for(let e=0,r=o.length;e<r;e+=1)n(o[e],t,s+1)}else t.length&&n(o,t,s+1)}else r.push(e)};return n(e,m(t)?t.split("."):t,0),i?r:r[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const F=/[^ ]+/g;class L{constructor({getFn:e=D.getFn,fieldNormWeight:t=D.fieldNormWeight}={}){this.norm=function(e=1,t=3){const r=new Map,i=Math.pow(10,t);return{get(t){const n=t.match(F).length;if(r.has(n))return r.get(n);const s=1/Math.pow(n,.5*e),o=parseFloat(Math.round(s*i)/i);return r.set(n,o),o},clear(){r.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!v(e)||x(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach(((t,i)=>{let n=t.getFn?t.getFn(e):this.getFn(e,t.path);if(v(n))if(h(n)){let e=[];const t=[{nestedArrIndex:-1,value:n}];for(;t.length;){const{nestedArrIndex:r,value:i}=t.pop();if(v(i))if(m(i)&&!x(i)){let t={v:i,i:r,n:this.norm.get(i)};e.push(t)}else h(i)&&i.forEach(((e,r)=>{t.push({nestedArrIndex:r,value:e})}))}r.$[i]=e}else if(m(n)&&!x(n)){let e={v:n,n:this.norm.get(n)};r.$[i]=e}})),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function w(e,t,{getFn:r=D.getFn,fieldNormWeight:i=D.fieldNormWeight}={}){const n=new L({getFn:r,fieldNormWeight:i});return n.setKeys(e.map(k)),n.setSources(t),n.create(),n}function S(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:n=D.distance,ignoreLocation:s=D.ignoreLocation}={}){const o=t/e.length;if(s)return o;const a=Math.abs(i-r);return n?o+a/n:a?1:o}const j=32;function I(e,t,r,{location:i=D.location,distance:n=D.distance,threshold:s=D.threshold,findAllMatches:o=D.findAllMatches,minMatchCharLength:a=D.minMatchCharLength,includeMatches:c=D.includeMatches,ignoreLocation:l=D.ignoreLocation}={}){if(t.length>j)throw new Error(`Pattern length exceeds max of ${j}.`);const u=t.length,d=e.length,h=Math.max(0,Math.min(i,d));let p=s,f=h;const m=a>1||c,y=m?Array(d):[];let _;for(;(_=e.indexOf(t,f))>-1;){let e=S(t,{currentLocation:_,expectedLocation:h,distance:n,ignoreLocation:l});if(p=Math.min(e,p),f=_+u,m){let e=0;for(;e<u;)y[_+e]=1,e+=1}}f=-1;let g=[],v=1,x=u+d;const $=1<<u-1;for(let i=0;i<u;i+=1){let s=0,a=x;for(;s<a;){S(t,{errors:i,currentLocation:h+a,expectedLocation:h,distance:n,ignoreLocation:l})<=p?s=a:x=a,a=Math.floor((x-s)/2+s)}x=a;let c=Math.max(1,h-a+1),_=o?d:Math.min(h+a,d)+u,A=Array(_+2);A[_+1]=(1<<i)-1;for(let s=_;s>=c;s-=1){let o=s-1,a=r[e.charAt(o)];if(m&&(y[o]=+!!a),A[s]=(A[s+1]<<1|1)&a,i&&(A[s]|=(g[s+1]|g[s])<<1|1|g[s+1]),A[s]&$&&(v=S(t,{errors:i,currentLocation:o,expectedLocation:h,distance:n,ignoreLocation:l}),v<=p)){if(p=v,f=o,f<=h)break;c=Math.max(1,2*h-f)}}if(S(t,{errors:i+1,currentLocation:h,expectedLocation:h,distance:n,ignoreLocation:l})>p)break;g=A}const A={isMatch:f>=0,score:Math.max(.001,v)};if(m){const e=function(e=[],t=D.minMatchCharLength){let r=[],i=-1,n=-1,s=0;for(let o=e.length;s<o;s+=1){let o=e[s];o&&-1===i?i=s:o||-1===i||(n=s-1,n-i+1>=t&&r.push([i,n]),i=-1)}return e[s-1]&&s-i>=t&&r.push([i,s-1]),r}(y,a);e.length?c&&(A.indices=e):A.isMatch=!1}return A}function P(e){let t={};for(let r=0,i=e.length;r<i;r+=1){const n=e.charAt(r);t[n]=(t[n]||0)|1<<i-r-1}return t}const R=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class V{constructor(e,{location:t=D.location,threshold:r=D.threshold,distance:i=D.distance,includeMatches:n=D.includeMatches,findAllMatches:s=D.findAllMatches,minMatchCharLength:o=D.minMatchCharLength,isCaseSensitive:a=D.isCaseSensitive,ignoreDiacritics:c=D.ignoreDiacritics,ignoreLocation:l=D.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:c,ignoreLocation:l},e=a?e:e.toLowerCase(),e=c?R(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const u=(e,t)=>{this.chunks.push({pattern:e,alphabet:P(e),startIndex:t})},d=this.pattern.length;if(d>j){let e=0;const t=d%j,r=d-t;for(;e<r;)u(this.pattern.substr(e,j),e),e+=j;if(t){const e=d-j;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=r?R(e):e,this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:n,distance:s,threshold:o,findAllMatches:a,minMatchCharLength:c,ignoreLocation:l}=this.options;let u=[],d=0,h=!1;this.chunks.forEach((({pattern:t,alphabet:r,startIndex:p})=>{const{isMatch:f,score:m,indices:y}=I(e,t,r,{location:n+p,distance:s,threshold:o,findAllMatches:a,minMatchCharLength:c,includeMatches:i,ignoreLocation:l});f&&(h=!0),d+=m,f&&y&&(u=[...u,...y])}));let p={isMatch:h,score:h?d/this.chunks.length:1};return h&&i&&(p.indices=u),p}}class O{constructor(e){this.pattern=e}static isMultiMatch(e){return N(e,this.multiRegex)}static isSingleMatch(e){return N(e,this.singleRegex)}search(){}}function N(e,t){const r=e.match(t);return r?r[1]:null}class W extends O{constructor(e,{location:t=D.location,threshold:r=D.threshold,distance:i=D.distance,includeMatches:n=D.includeMatches,findAllMatches:s=D.findAllMatches,minMatchCharLength:o=D.minMatchCharLength,isCaseSensitive:a=D.isCaseSensitive,ignoreDiacritics:c=D.ignoreDiacritics,ignoreLocation:l=D.ignoreLocation}={}){super(e),this._bitapSearch=new V(e,{location:t,threshold:r,distance:i,includeMatches:n,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:c,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class q extends O{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,r=0;const i=[],n=this.pattern.length;for(;(t=e.indexOf(this.pattern,r))>-1;)r=t+n,i.push([t,r-1]);const s=!!i.length;return{isMatch:s,score:s?0:1,indices:i}}}const z=[class extends O{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},q,class extends O{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},W],Z=z.length,H=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const K=new Set([W.type,q.type]);class T{constructor(e,{isCaseSensitive:t=D.isCaseSensitive,ignoreDiacritics:r=D.ignoreDiacritics,includeMatches:i=D.includeMatches,minMatchCharLength:n=D.minMatchCharLength,ignoreLocation:s=D.ignoreLocation,findAllMatches:o=D.findAllMatches,location:a=D.location,threshold:c=D.threshold,distance:l=D.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:a,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=r?R(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map((e=>{let r=e.trim().split(H).filter((e=>e&&!!e.trim())),i=[];for(let e=0,n=r.length;e<n;e+=1){const n=r[e];let s=!1,o=-1;for(;!s&&++o<Z;){const e=z[o];let r=e.isMultiMatch(n);r&&(i.push(new e(r,t)),s=!0)}if(!s)for(o=-1;++o<Z;){const e=z[o];let r=e.isSingleMatch(n);if(r){i.push(new e(r,t));break}}}return i}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:i,ignoreDiacritics:n}=this.options;e=i?e:e.toLowerCase(),e=n?R(e):e;let s=0,o=[],a=0;for(let i=0,n=t.length;i<n;i+=1){const n=t[i];o.length=0,s=0;for(let t=0,i=n.length;t<i;t+=1){const i=n[t],{isMatch:c,indices:l,score:u}=i.search(e);if(!c){a=0,s=0,o.length=0;break}if(s+=1,a+=u,r){const e=i.constructor.type;K.has(e)?o=[...o,...l]:o.push(l)}}if(s){let e={isMatch:!0,score:a/s};return r&&(e.indices=o),e}}return{isMatch:!1,score:1}}}const J=[];function U(e,t){for(let r=0,i=J.length;r<i;r+=1){let i=J[r];if(i.condition(e,t))return new i(e,t)}return new V(e,t)}const G="$and",Q="$or",X="$path",Y="$val",ee=e=>!(!e[G]&&!e[Q]),te=e=>({[G]:Object.keys(e).map((t=>({[t]:e[t]})))});function re(e,t,{auto:r=!0}={}){const i=e=>{let n=Object.keys(e);const s=(e=>!!e[X])(e);if(!s&&n.length>1&&!ee(e))return i(te(e));if((e=>!h(e)&&g(e)&&!ee(e))(e)){const i=s?e[X]:n[0],o=s?e[Y]:e[i];if(!m(o))throw new Error((e=>`Invalid value for key ${e}`)(i));const a={keyId:E(i),pattern:o};return r&&(a.searcher=U(o,t)),a}let o={children:[],operator:n[0]};return n.forEach((t=>{const r=e[t];h(r)&&r.forEach((e=>{o.children.push(i(e))}))})),o};return ee(e)||(e=te(e)),i(e)}function ie(e,t){const r=e.matches;t.matches=[],v(r)&&r.forEach((e=>{if(!v(e.indices)||!e.indices.length)return;const{indices:r,value:i}=e;let n={indices:r,value:i};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}))}function ne(e,t){t.score=e.score}class se{constructor(e,t={},r){this.options={...D,...t},this.options.useExtendedSearch,this._keyStore=new M(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof L))throw new Error("Incorrect 'index' type");this._myIndex=t||w(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){v(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let r=0,i=this._docs.length;r<i;r+=1){const n=this._docs[r];e(n,r)&&(this.removeAt(r),r-=1,i-=1,t.push(n))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:n,sortFn:s,ignoreFieldNorm:o}=this.options;let a=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=D.ignoreFieldNorm}){e.forEach((e=>{let r=1;e.matches.forEach((({key:e,norm:i,score:n})=>{const s=e?e.weight:null;r*=Math.pow(0===n&&s?Number.EPSILON:n,(s||1)*(t?1:i))})),e.score=r}))}(a,{ignoreFieldNorm:o}),n&&a.sort(s),y(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:r=D.includeMatches,includeScore:i=D.includeScore}={}){const n=[];return r&&n.push(ie),i&&n.push(ne),e.map((e=>{const{idx:r}=e,i={item:t[r],refIndex:r};return n.length&&n.forEach((t=>{t(e,i)})),i}))}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const t=U(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach((({v:e,i:r,n:n})=>{if(!v(e))return;const{isMatch:s,score:o,indices:a}=t.searchIn(e);s&&i.push({item:e,idx:r,matches:[{score:o,value:e,norm:n,indices:a}]})})),i}_searchLogical(e){const t=re(e,this.options),r=(e,t,i)=>{if(!e.children){const{keyId:r,searcher:n}=e,s=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:n});return s&&s.length?[{idx:i,item:t,matches:s}]:[]}const n=[];for(let s=0,o=e.children.length;s<o;s+=1){const o=e.children[s],a=r(o,t,i);if(a.length)n.push(...a);else if(e.operator===G)return[]}return n},i=this._myIndex.records,n={},s=[];return i.forEach((({$:e,i:i})=>{if(v(e)){let o=r(t,e,i);o.length&&(n[i]||(n[i]={idx:i,item:e,matches:[]},s.push(n[i])),o.forEach((({matches:e})=>{n[i].matches.push(...e)})))}})),s}_searchObjectList(e){const t=U(e,this.options),{keys:r,records:i}=this._myIndex,n=[];return i.forEach((({$:e,i:i})=>{if(!v(e))return;let s=[];r.forEach(((r,i)=>{s.push(...this._findMatches({key:r,value:e[i],searcher:t}))})),s.length&&n.push({idx:i,item:e,matches:s})})),n}_findMatches({key:e,value:t,searcher:r}){if(!v(t))return[];let i=[];if(h(t))t.forEach((({v:t,i:n,n:s})=>{if(!v(t))return;const{isMatch:o,score:a,indices:c}=r.searchIn(t);o&&i.push({score:a,key:e,value:t,idx:n,norm:s,indices:c})}));else{const{v:n,n:s}=t,{isMatch:o,score:a,indices:c}=r.searchIn(n);o&&i.push({score:a,key:e,value:n,norm:s,indices:c})}return i}}se.version="7.1.0",se.createIndex=w,se.parseIndex=function(e,{getFn:t=D.getFn,fieldNormWeight:r=D.fieldNormWeight}={}){const{keys:i,records:n}=e,s=new L({getFn:t,fieldNormWeight:r});return s.setKeys(i),s.setIndexRecords(n),s},se.config=D,se.parseQuery=re,function(...e){J.push(...e)}(T);let oe,ae,ce,le,ue,de,he,pe,fe,me,ye,_e,ge,ve,xe,$e,Ae,be,Ce,Me,ke,Be,Ee,De,Fe,Le,we,Se,je,Ie,Pe,Re,Ve,Oe,Ne,We,qe,ze,Ze,He,Ke,Te=e=>e;const Je=["paypal_platform"],Ue=s(e,"payments-api-payment-method-form");class Ge extends Ue{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.getConnectRedirectUrl=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__cardVerificationOptions=[{label:"option_disabled",value:"disabled"},{label:"option_enabled_automatically",value:"enabled_automatically"},{label:"option_enabled_override",value:"enabled_override"}],this.__search="",this.__connectState="idle",this.__connectKey=""}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},getConnectRedirectUrl:{attribute:!1},store:{},__search:{attribute:!1},__connectState:{attribute:!1},__connectKey:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,n;const s=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let o;try{o=JSON.parse(null!==(n=e.additional_fields)&&void 0!==n?n:"{}")}catch(e){o={}}for(const e of s)for(const t of e.fields)if("optional"in t&&!t.optional&&!u(o,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return a(oe||(oe=Te` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?a(ae||(ae=Te``)):a(ce||(ce=Te` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=n(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=n(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=a(le||(le=Te` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),o(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),o(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),o(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return a(ue||(ue=Te`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;const t=Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{});return(this.__search?new se(t,{keys:["1.name"],threshold:.25}).search(this.__search).map((e=>e.item)):t).sort(((e,t)=>e[1].name.localeCompare(t[1].name,"en"))).reduce(((e,[t,r])=>{if(r.is_deprecated)return e;const i=r.name.charAt(0).toUpperCase(),n=!/\w/.test(i)?"#":i,s=e.find((e=>e.name===n)),o=Je.includes(t)?this.__getConnectChoices(t).map((e=>({type:t,helper:r,choice:e}))):[{type:t,helper:r}];return s?s.items.push(...o):e.push({name:n,items:o}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?a(he||(he=Te` <div> <input placeholder="${0}" class="w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" style="padding:var(--lumo-space-xs) calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" type="search" .value="${0}" @input="${0}"> <section data-testid="select-method-list"> ${0} </section> </div> `),this.t("search_placeholder"),this.__search,(e=>{this.__search=e.currentTarget.value}),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>a(pe||(pe=Te` <p class="font-medium text-tertiary py-m">${0}</p> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> `),e,t.map(((e,r)=>this.__renderPaymentMethodButton(e,r,t.length))))))):a(de||(de=Te` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__redirect(e){window.location.assign(e)}__getConnectChoices(e){return"paypal_platform"===e?[{key:"paypal_platform.ppcp",options:{paypal_product_type:"ppcp"}},{key:"paypal_platform.express_checkout",options:{paypal_product_type:"express_checkout"}}]:[{key:"default"}]}__getReconnectChoice(e){if("paypal_platform"===this.form.type){return{key:`paypal_platform.${e?"reconnect":"reconnect_with_cards"}`,options:{paypal_product_type:"ppcp"}}}return{key:"reconnect"}}async __connect(e,t){var r,i,n,s,o,a,c,l,u,d,h,p;const f=null===(i=null===(r=this.__paymentPresetLoader)||void 0===r?void 0:r.data)||void 0===i?void 0:i._links["fx:connect_gateway"],m=null!==(o=null===(s=null===(n=this.data)||void 0===n?void 0:n._links["fx:connect_gateway"])||void 0===s?void 0:s.href)&&void 0!==o?o:null==f?void 0:f.href;if(m&&this.paymentPreset&&"busy"!==this.__connectState){this.__connectState="busy",this.__connectKey=e.key,this.status=null;try{const r={type:t,final_redirect:null!==(c=null===(a=this.getConnectRedirectUrl)||void 0===a?void 0:a.call(this,this.paymentPreset))&&void 0!==c?c:window.location.href};e.options&&(r.options=e.options);const i=await this._fetch(m,{method:"POST",body:JSON.stringify(r)});if(!i.connection_url)throw new Error("No connection_url in the response.");this.__redirect(i.connection_url)}catch(t){let r="";if(t instanceof Response)try{const e=await t.json();r=null!==(h=null===(d=null===(u=null===(l=null==e?void 0:e._embedded)||void 0===l?void 0:l["fx:errors"])||void 0===u?void 0:u[0])||void 0===d?void 0:d.message)&&void 0!==h?h:""}catch(e){}const i=t instanceof Response&&403===t.status&&"ppcp"===(null===(p=e.options)||void 0===p?void 0:p.paypal_product_type)&&r.includes("'ppcp'");this.status=i?{key:"connect_error_ppcp_unsupported",type:"error"}:r?{key:"connect_error",options:{message:r},type:"error"}:{key:"connect_error_unknown",type:"error"},this.__connectState="idle"}}}__renderConnection(){var e,t,r,i;const n=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data;if(!n)return a(fe||(fe=Te``));const s=n.is_live?"":"test_",o=null===(t=this.data)||void 0===t?void 0:t[`${s}account_id`],c=null!==(i=null===(r=this.data)||void 0===r?void 0:r[`${s}third_party_key`])&&void 0!==i?i:"",l=this.form.type,u=o?[this.__getReconnectChoice(c)]:this.__getConnectChoices(l),d="busy"===this.__connectState,h=this.readonlySelector.matches("connection",!0),p=d||this.disabledSelector.matches("connection",!0);return a(me||(me=Te` <foxy-internal-summary-control infer="connection"> ${0} ${0} </foxy-internal-summary-control> `),o?a(ye||(ye=Te` <p class="font-medium"> <foxy-i18n infer="" key="status_connected" .options="${0}"></foxy-i18n> </p> `),{email:o}):"",(h?[]:u).map((e=>a(_e||(_e=Te` <div class="leading-xs"> <p class="font-medium"> <foxy-i18n infer="" key="${0}.label"></foxy-i18n> </p> <p class="text-s text-secondary"> <foxy-i18n infer="" key="${0}.description"></foxy-i18n> </p> </div> <div> <vaadin-button data-testid="connect-${0}" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> </div> `),e.key,e.key,e.key,p,(()=>this.__connect(e,l)),d&&this.__connectKey===e.key?a(ge||(ge=Te`<foxy-spinner layout="no-label" infer="connect-spinner"></foxy-spinner>`)):a(ve||(ve=Te`<foxy-i18n infer="" key="${0}.button"></foxy-i18n>`),e.key)))))}__renderPaymentMethodConfig(){var e,t;if(this.form.type&&Je.includes(this.form.type))return a(xe||(xe=Te` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> ${0} ${0} `),this.__renderConnection(),super.renderBody());return this.form.type&&["stripe_connect","stripe_v2","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?a($e||($e=Te` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),c(Ae||(Ae=Te`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):a(be||(be=Te` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_auth_only)?a(Ce||(Ce=Te` <foxy-internal-switch-control infer="use-auth-only" helper-text-as-tooltip> </foxy-internal-switch-control> `)):"",(null===(t=this.form.helper)||void 0===t?void 0:t.supports_3d_secure)?a(Me||(Me=Te` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?a(ke||(ke=Te` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,n,s,l,u,d,h,p,f,m,y,_,g,v;const x=0===t?"":`${e}_`,$=0===t?"":`${e}-`,A=0===t?this.__liveBlocks:this.__testBlocks,b=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return a(Be||(Be=Te``));if("live"===e&&!(null===(n=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===n?void 0:n.is_active))return a(Ee||(Ee=Te` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,c(De||(De=Te`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const C=!0===(null===(l=null===(s=this.__storeLoader)||void 0===s?void 0:s.data)||void 0===l?void 0:l.is_active)&&("test"===e&&!0===(null===(d=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===d?void 0:d.is_live)||"live"===e&&!1===(null===(p=null===(h=this.__paymentPresetLoader)||void 0===h?void 0:h.data)||void 0===p?void 0:p.is_live));return a(Fe||(Fe=Te` <foxy-internal-summary-control helper-text="${0}" layout="section" label="${0}" infer="${0}"> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} ${0} ${0} ${0} ${0} </foxy-internal-summary-control> ${0} </foxy-internal-summary-control> `),o(C?this.t(`${b}.helper_text_inactive`):void 0),o(C?this.t(`${b}.label_inactive`):void 0),b,(null===(f=this.form.helper)||void 0===f?void 0:f.id_description)?a(Le||(Le=Te` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,$):"",(null===(m=this.form.helper)||void 0===m?void 0:m.third_party_key_description)?a(we||(we=Te` <foxy-internal-password-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,$):"",(null===(y=this.form.helper)||void 0===y?void 0:y.key_description)?a(Se||(Se=Te` <foxy-internal-password-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,$):"",A.map((e=>this.__renderBlock(e))),(null===(_=this.form.helper)||void 0===_?void 0:_.supports_card_verification)?a(je||(je=Te` <foxy-internal-select-control helper-text="${0}" layout="summary-item" infer="${0}card-verification" .options="${0}" .getValue="${0}"> </foxy-internal-select-control> `),this.t(`${b}.${$}card-verification.helper_text_${this.form[`${x}card_verification`]||"disabled"}`),$,this.__cardVerificationOptions,(()=>this.form[`${x}card_verification`]||"disabled")):"",(null===(g=this.form.helper)||void 0===g?void 0:g.supports_card_verification)&&(null===(v=this.form[`${x}card_verification`])||void 0===v?void 0:v.startsWith("enabled_"))?a(Ie||(Ie=Te` <foxy-internal-summary-control layout="details" class="mt-s" infer="${0}card-verification-config"> ${0} </foxy-internal-summary-control> `),$,["visa","mastercard","american-express","discover","default"].map((e=>{var t;return a(Pe||(Pe=Te` <foxy-internal-number-control json-template="${0}" json-path="verification_amounts.${0}" property="${0}card_verification_config" layout="summary-item" infer="${0}card-verification-config-verification-amounts-${0}" step="0.01" min="0"> </foxy-internal-number-control> `),o(null===(t=this.form.helper)||void 0===t?void 0:t.card_verification_config),e.replace(/-/g,"_"),x,$,e)}))):"")})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t,choice:r},i,n){var s,c;const u=Ge.defaultImageSrc,d=null!==(c=null===(s=this.getImageSrc)||void 0===s?void 0:s.call(this,e))&&void 0!==c?c:u,h="busy"===this.__connectState,p=h&&!!r&&this.__connectKey===r.key,f=!!r&&"default"!==r.key;return a(Re||(Re=Te` <button class="${0}" data-testid="${0}" ?disabled="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" @click="${0}"> <figure class="relative flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <figcaption class="${0}"> <span class="font-medium"> ${0}&ZeroWidthSpace; </span> ${0} </figcaption> </figure> </button> `),l({"relative w-full block text-left bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict,"rounded-t":0===i,"rounded-b":i===n-1}),o(r?`connect-${r.key}`:void 0),!!t.conflict||h,(()=>r?this.__connect(r,e):this.edit({type:e,helper:t})),p?a(Ve||(Ve=Te` <foxy-spinner data-testid="connect-spinner" class="h-m w-m flex items-center justify-center flex-shrink-0" layout="no-label" infer="connect-spinner"> </foxy-spinner> `)):a(Oe||(Oe=Te` <img class="${0}" src="${0}" alt="" @error="${0}"> `),l({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),d,(e=>e.currentTarget.src=u)),l({"min-w-0 flex-1 grid leading-xs":!0,"text-disabled":!!t.conflict}),f?this.t(`connection.${r.key}.label`):t.name,t.conflict?a(Ne||(Ne=Te`<span class="text-xs"> ${0}</span>`),this.t("conflict_message",t.conflict)):r?a(We||(We=Te` <span class="text-xs text-secondary"> ${0} ${0} </span> `),f?this.t(`connection.${r.key}.description`):"",this.t("connection.redirect_notice")):"")}__renderBlock(e){return a(qe||(qe=Te`${0}`),e.fields.map((e=>{var t,r,n;if("hidden"===e.type)return;const s=["additional-fields",e.id].join("-").replace(/_/g,"-"),o=()=>{var t,r;try{const n=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(n,e.id))&&void 0!==r?r:n.default_value}catch(t){return e.default_value}},c=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(d(i,e.id,t))})},l=e.options;return a(ze||(ze=Te` ${0} `),"checkbox"===e.type?a(Ze||(Ze=Te` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,s,o,c):"select"===e.type?a(He||(He=Te` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,s,l.map((({name:e,value:t})=>({label:e,value:t}))),o,c):a(Ke||(Ke=Te` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(n=e.description)&&void 0!==n?n:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,s,o,c))})))}}customElements.define("foxy-payments-api-payment-method-form",Ge);export{Ge as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-01cd4e3c.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-a339f79c.js";import{I as e}from"./shared-ad26f72d.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-8f9014ff.js";import{a as o}from"./shared-887ac0b0.js";import{i as s}from"./shared-53e42a77.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-99c53365.js";import"./shared-0fd68dc0.js";import"./shared-6cdfb858.js";import"./shared-8d8975d5.js";import"./shared-65094878.js";import"./shared-515003f6.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-db623837.js";import"./shared-19073761.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-f6c6ce5f.js";import"./shared-8df8e77c.js";import"./shared-2bb1f0f4.js";import"./shared-5212ef4f.js";import"./shared-9d4fecb9.js";import"./shared-9687ab7b.js";import"./shared-0f92b865.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-bbd07437.js";import"./shared-b2f675d4.js";import"./foxy-nucleon-element.js";import"./shared-c7796413.js";import"./shared-3426159a.js";import"./shared-ee48a1ed.js";import"./shared-ce05e482.js";let a,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e,r;const o=["header:copy-json",super.hiddenSelector.toString()],s=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active);return this.data||o.unshift("payment-methods","fraud-protections"),s||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return i(a||(a=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert wide .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
1
+ import"./shared-01cd4e3c.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-a339f79c.js";import{I as e}from"./shared-13fed57b.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as r,B as t}from"./shared-8f9014ff.js";import{a as o}from"./shared-887ac0b0.js";import{i as s}from"./shared-53e42a77.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-99c53365.js";import"./shared-0fd68dc0.js";import"./shared-6cdfb858.js";import"./shared-8d8975d5.js";import"./shared-65094878.js";import"./shared-515003f6.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-db623837.js";import"./shared-19073761.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-f6c6ce5f.js";import"./shared-8df8e77c.js";import"./shared-2bb1f0f4.js";import"./shared-5212ef4f.js";import"./shared-9d4fecb9.js";import"./shared-9687ab7b.js";import"./shared-0f92b865.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-bbd07437.js";import"./shared-b2f675d4.js";import"./foxy-nucleon-element.js";import"./shared-c7796413.js";import"./shared-3426159a.js";import"./shared-ee48a1ed.js";import"./shared-ce05e482.js";let a,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getConnectRedirectUrl=null,this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},super.properties),{},{getConnectRedirectUrl:{attribute:!1},getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e,r;const o=["header:copy-json",super.hiddenSelector.toString()],s=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active);return this.data||o.unshift("payment-methods","fraud-protections"),s||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return i(a||(a=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert wide .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getConnectRedirectUrl":this.getConnectRedirectUrl,".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
@@ -1 +1 @@
1
- import{L as e}from"./shared-ba5c42c7.js";import{aN as t,aI as a,_ as s,F as n}from"./shared-8f9014ff.js";import{A as r}from"./shared-69c98b7b.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var a;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=t(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=await o(m(l(p))),c=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(m(a.toString()));if(e.push(...s._embedded["fx:payment_methods"]),s._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(a=f._links["fx:payment_gateway"])||void 0===a?void 0:a.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentMethods:n,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${s}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=n.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:w,paymentMethods:await c,base:new URL(d.url).origin});n=JSON.stringify(_),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,fraudProtections:a,base:s}=e,n=new URL(`./payment_presets/${t}/available_fraud_protections`,s),r={minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"",default_value:""},{id:"private_key",name:"Secret Key",type:"text",optional:!0,description:"",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:n.toString()}},values:r}}async function d(e){let a,s;try{const{request:n,fetch:r}=e;if("GET"!==n.method)throw a=405,new Error("Method not allowed. Allowed methods: GET.");const i=t(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(n.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(r(a.toString()));if(e.push(...s._embedded["fx:fraud_protections"]),s._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(n.url).origin});s=JSON.stringify(m),a=200}catch(e){s=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(s,{status:a})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:n,fraudProtection:r,base:o}=e,{_links:i}=r,d=a(r,m),p=l({paymentPresetId:n,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${n}`,o),f=new URL(`./payment_presets/${n}/fraud_protections/${h}`,o);return s(s({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var a,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=t(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(a=h.searchParams.get("offset"))&&void 0!==a?a:"0"),t=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(t));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let a,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=t(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),w=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(s,{status:a})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:n,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=a(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return s(s({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:n})}async function u(e){var a,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=t(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(_)))]);if("GET"===f.method){const e=parseInt(null!==(a=w.searchParams.get("offset"))&&void 0!==a?a:"0"),t=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(t));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),u=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(y)),_.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return c(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=c({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:n}=e,{_links:r}=t,o=a(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,n),d=new URL(`./payment_presets/${i}/payment_methods`,n),m=new URL(`./payment_presets/${i}/fraud_protections`,n),p=new URL(`./payment_presets/${i}/available_payment_methods`,n),h=new URL(`./payment_presets/${i}/available_fraud_protections`,n);return s({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,n;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:n}=e,{_embedded:r,_links:o}=t,i=a(t,g),l=new URL("./payment_presets",n),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",n),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",n),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",n),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",n),w=new URL(o.self.href);return u.search=w.search,s(s({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:n})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});n=JSON.stringify(p),t=200}catch(e){n=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(n,{status:t})}async function S(e){let a,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=t(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(s,{status:a})}async function U(e){let a,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=t(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,w=u.startsWith("H"),_=d(f),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(s,{status:a})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var a,s,r,o,l;if(!(e instanceof n))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(a=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==a?a:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(s=this.hostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===c)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=function(e){const a=[[t(/\/payment_presets\/(.+?)\/payment_methods\/(.+?)/,{presetId:1,methodId:2}),U],[t(/\/payment_presets\/(.+?)\/available_fraud_protections/,{presetId:1}),d],[t(/\/payment_presets\/(.+?)\/available_payment_methods/,{presetId:1}),i],[t(/\/payment_presets\/(.+?)\/fraud_protections\/(.+?)/,{presetId:1,protectionId:2}),y],[t(/\/payment_presets\/(.+?)\/fraud_protections/,{presetId:1}),h],[t(/\/payment_presets\/(.+?)\/payment_methods/,{presetId:1}),u],[t(/\/payment_presets\/(.+?)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[t,s]of a)if(t.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(b),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
1
+ import{L as e}from"./shared-ba5c42c7.js";import{aN as t,aI as a,_ as n,F as s}from"./shared-8f9014ff.js";import{A as r}from"./shared-69c98b7b.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var a;let n,s;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw n=405,new Error("Method not allowed. Allowed methods: GET.");const p=t(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,y=o(m(r)),h=o(m(i)),c=await o(m(l(p))),f=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const n=await o(m(a.toString()));if(e.push(...n._embedded["fx:payment_methods"]),n._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(a=c._links["fx:payment_gateway"])||void 0===a?void 0:a.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:n,paymentMethods:s,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${n}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=s.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await y,paymentGatewaysHelper:await h,paymentPresetId:p,paymentGateway:w,paymentMethods:await f,base:new URL(d.url).origin});s=JSON.stringify(_),n=200}catch(e){s=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(s,{status:n})}function l(e){const{paymentPresetId:t,fraudProtections:a,base:n}=e,s=new URL(`./payment_presets/${t}/available_fraud_protections`,n),r={minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"",default_value:""},{id:"private_key",name:"Secret Key",type:"text",optional:!0,description:"",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:s.toString()}},values:r}}async function d(e){let a,n;try{const{request:s,fetch:r}=e;if("GET"!==s.method)throw a=405,new Error("Method not allowed. Allowed methods: GET.");const i=t(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(s.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(s.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const n=await o(r(a.toString()));if(e.push(...n._embedded["fx:fraud_protections"]),n._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(s.url).origin});n=JSON.stringify(m),a=200}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:s,fraudProtection:r,base:o}=e,{_links:i}=r,d=a(r,m),p=l({paymentPresetId:s,base:o}),y=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,h=new URL(`./payment_presets/${s}`,o),c=new URL(`./payment_presets/${s}/fraud_protections/${y}`,o);return n(n({_links:{self:{href:c.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:h.toString()}}},d),{},{helper:p.values[r.type]})}async function y(e){var a,n;let s,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw s=405,new Error("Method not allowed. Allowed methods: GET, POST.");const y=new URL(d.url),h=t(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(y.pathname).groups.presetId,c=await o(m(l(h)));if("GET"===d.method){const e=parseInt(null!==(a=y.searchParams.get("offset"))&&void 0!==a?a:"0"),t=parseInt(null!==(n=y.searchParams.get("limit"))&&void 0!==n?n:"20"),i=new URL(c._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(t));const l=await o(m(i.toString())),f=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:n,base:s}=e,r=new URL(`/payment_presets/${n}/fraud_protections`,s);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:n,base:s})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:f,paymentPresetId:h,base:new URL(d.url).origin});s=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),n=await o(m(c._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:c._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(n._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:h,base:new URL(d.url).origin});s=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(r,{status:s})}async function h(e){let a,n;try{const{getPaymentMethodSetUrl:s,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=t(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:y}=d.exec(i.url).groups,h=s(m),c=y.substring(0,y.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(h)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",c);const a=await o(l(t.toString())),n=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(n)}let f=await i.text();try{const e=JSON.parse(f);delete e.helper,f=JSON.stringify(e)}catch(e){}const u=l(r(c),{method:i.method,body:"PATCH"===i.method?f:null}),w=await o(u);n="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:y.substring(y.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}const c=["_links"];function f(e){const{paymentPresetId:t,helper:s,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=a(o,c),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),y=new URL(`./payment_presets/${t}/payment_methods/${m}`,r),h=n({self:{href:y.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}},"fx:connect_gateway"in i?{"fx:connect_gateway":i["fx:connect_gateway"]}:{});return n(n({_links:h},l),{},{helper:s})}async function u(e){var a,n,s,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:y,paymentGatewaysUrl:h,request:c,fetch:u}=e;if(!["GET","POST"].includes(c.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(c.url),_=t(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(y(_)))]);if("GET"===c.method){const e=parseInt(null!==(a=w.searchParams.get("offset"))&&void 0!==a?a:"0"),t=parseInt(null!==(n=w.searchParams.get("limit"))&&void 0!==n?n:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(t));const d=null===(s=S._links["fx:payment_gateway"])||void 0===s?void 0:s.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),y=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),h=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:n,hostedPaymentGatewaysHelper:s,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),y=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),h=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),c=n.total_items+(l?1:0),u=n.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(h)),_.searchParams.set("offset",String(y)),g.searchParams.set("limit",String(h)),g.searchParams.set("offset",String(Math.max(0,c-h))),P.searchParams.set("limit",String(h)),P.searchParams.set("offset",String(Math.max(0,y-h))),S.searchParams.set("limit",String(h)),S.searchParams.set("offset",String(Math.min(y+h,Math.max(0,c-h))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=n._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return f(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:s.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:c,offset:y,limit:h}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:y,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(c.url).search,base:new URL(c.url).origin});i=200,l=JSON.stringify(h)}else{const e=await c.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),n=f({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(c.url).origin});i=200,l=JSON.stringify(n)}else{const t=u(h,{method:c.method,body:JSON.stringify(e)}),a=await o(t),n={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(n)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const s=f({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(c.url).origin});i=200,l=JSON.stringify(s)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:s}=e,{_links:r}=t,o=a(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,s),d=new URL(`./payment_presets/${i}/payment_methods`,s),m=new URL(`./payment_presets/${i}/fraud_protections`,s),p=new URL(`./payment_presets/${i}/available_payment_methods`,s),y=new URL(`./payment_presets/${i}/available_fraud_protections`,s);return n({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:connect_gateway":r["fx:connect_gateway"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:y.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,s;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:s}=e,{_embedded:r,_links:o}=t,i=a(t,g),l=new URL("./payment_presets",s),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",s),p=new URL(o.last.href);m.search=p.search;const y=new URL("./payment_presets",s),h=new URL(o.prev.href);y.search=h.search;const c=new URL("./payment_presets",s),f=new URL(o.next.href);c.search=f.search;const u=new URL("./payment_presets",s),w=new URL(o.self.href);return u.search=w.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:y.toString()},next:{href:c.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:s})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});s=JSON.stringify(p),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function S(e){let a,n;try{const{getPaymentMethodSetUrl:s,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=t(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(s(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));n="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}async function U(e){let a,n;try{const{hostedPaymentGatewaysHelperUrl:s,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:y}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw a=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const h=t(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:c,methodId:u}=h.exec(p.url).groups,w=u.startsWith("H"),_=d(c),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(y(s)),S=o(y(r));if("DELETE"===p.method)if(w){const e=i(u.substring(u.indexOf("C")+1));await o(y(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(y(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=y(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);n="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(f({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:c,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=y(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);n="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(f({paymentGateway:a,paymentPresetId:c,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){n=e instanceof Error?e.message:String(e),a=null!=a?a:500}return new Response(n,{status:a})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var a,n,r,o,l;if(!(e instanceof s))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:c,hostedPaymentGatewaysUrl:f,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(a=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==a?a:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===c)return;if(null===f)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const x=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},v=function(e){const a=[[t(/\/payment_presets\/(.+?)\/payment_methods\/(.+?)/,{presetId:1,methodId:2}),U],[t(/\/payment_presets\/(.+?)\/available_fraud_protections/,{presetId:1}),d],[t(/\/payment_presets\/(.+?)\/available_payment_methods/,{presetId:1}),i],[t(/\/payment_presets\/(.+?)\/fraud_protections\/(.+?)/,{presetId:1,protectionId:2}),h],[t(/\/payment_presets\/(.+?)\/fraud_protections/,{presetId:1}),y],[t(/\/payment_presets\/(.+?)\/payment_methods/,{presetId:1}),u],[t(/\/payment_presets\/(.+?)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[t,n]of a)if(t.test(new URL(e.request.url).pathname))return n(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:c,hostedPaymentGatewaysUrl:f,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:x(b),getHostedPaymentGatewayUrl:x(G),getPaymentMethodSetUrl:x(L),getFraudProtectionUrl:x(E),getPaymentGatewayUrl:x(R),request:e.request,fetch:this.__fetch});v&&(e.preventDefault(),e.respondWith(v))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
@@ -1 +1 @@
1
- import{I as e}from"./shared-2bb1f0f4.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{c as a,h as s,s as i}from"./shared-ba5c42c7.js";import{c as n}from"./shared-4e709717.js";import{l as o}from"./shared-d0aed1c1.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import{I as l}from"./shared-ad26f72d.js";import{s as d}from"./shared-af6ccc54.js";import{a as u}from"./shared-887ac0b0.js";import"./shared-5212ef4f.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-9687ab7b.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-99c53365.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-515003f6.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./foxy-copy-to-clipboard.js";import"./shared-19073761.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let h,m,p,c=e=>e;customElements.define("foxy-internal-native-date-control",class extends e{constructor(){super(...arguments),this.format="date",this.__isErrorVisible=!1}static get properties(){return t(t({},super.properties),{},{format:{},__isErrorVisible:{attribute:!1}})}static get styles(){return[super.styles,a(h||(h=c`input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}`))]}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}renderControl(){return s(m||(m=c` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" class="${0}" type="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @blur="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,n({"appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.format,o(this._value),this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(()=>this.__isErrorVisible=!0),(e=>{e.stopPropagation(),this._value=e.target.value}),this.t("clear"),n({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,(()=>{this._value="",this.dispatchEvent(new CustomEvent("clear"))}),i(p||(p=c`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,!this.__isErrorVisible||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}_handleHostClick(e){var t;const r=e.composedPath(),a=new Set(["INPUT","LABEL","BUTTON"]);r.some((e=>a.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}});const _=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function f(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=0===r?_.length-1:r-1,s=e.getFullYear()-(0===r?1:0),i=_[a][0],n=d(s,i),o=_[a][2];return{start:n,end:new Date(new Date(s,o+1).getTime()-1)}}function g(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=_[r][0],s=d(e.getFullYear(),a),i=_[r][2];return{start:s,end:new Date(d(e.getFullYear(),i+1).getTime()-1)}}function v(e=new Date){return{start:d(e.getFullYear(),e.getMonth()-1),end:new Date(d(e.getFullYear(),e.getMonth()).getTime()-1)}}function b(e=new Date){return{start:d(e.getFullYear(),e.getMonth()),end:new Date(d(e.getFullYear(),e.getMonth()+1).getTime()-1)}}function y(e=new Date){return{start:d(e.getFullYear()-1,0),end:new Date(d(e.getFullYear(),0).getTime()-1)}}function x(e=new Date){return{start:d(e.getFullYear(),0),end:new Date(d(e.getFullYear()+1,0).getTime()-1)}}function w(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function $(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function j(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}function S(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}function V(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}let T,D=e=>e;const F=u(l,"report-form");class Y extends F{constructor(){super(...arguments),this.__showRangeTime=!1,this.__rawPresetOptions=[t({value:"0",label:"option_previous_quarter"},f()),t({value:"1",label:"option_previous_month"},v()),t({value:"2",label:"option_previous_year"},y()),t({value:"3",label:"option_this_quarter"},g()),t({value:"4",label:"option_this_month"},b()),t({value:"5",label:"option_this_year"},x()),t({value:"6",label:"option_last_365_days"},w()),t({value:"7",label:"option_last_30_days"},$())],this.__presetOptions=JSON.stringify([...this.__rawPresetOptions,{value:"custom",label:"option_custom"}]),this.__nameOptions=JSON.stringify([{value:"complete",label:"option_complete"},{value:"customers",label:"option_customers"},{value:"customers_ltv",label:"option_customers_ltv"},{value:"transactions",label:"option_transactions"}]),this.__datetimePreciseGetValue=()=>this.__showRangeTime,this.__datetimePreciseSetValue=e=>{this.__showRangeTime=e},this.__datetimeStartGetValue=()=>{const e=this.form.datetime_start;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeStartSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"00:00"}:00`:"00:00:00";this.edit({datetime_start:`${e.split("T")[0]}T${r}`})},this.__datetimeEndGetValue=()=>{const e=this.form.datetime_end;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeEndSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"23:59"}:59`:"23:59:59";this.edit({datetime_end:`${e.split("T")[0]}T${r}`})},this.__presetGetValue=()=>{var e,t;return null!==(t=null===(e=this.__rawPresetOptions.find((e=>{const{datetime_end:t,datetime_start:r}=this.form;return r&&t&&j(e.start)===r&&j(e.end)===t})))||void 0===e?void 0:e.value)&&void 0!==t?t:"custom"},this.__presetSetValue=e=>{const t=this.__rawPresetOptions.find((t=>t.value===e));t&&this.edit({datetime_start:j(t.start),datetime_end:j(t.end)})}}static get properties(){return t(t({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({datetime_start:e})=>!!e||"datetime-start:v8n_required",({datetime_end:e})=>!!e||"datetime-end:v8n_required",({name:e})=>!!e||"name:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.data&&e.unshift("name","preset","datetime-precise","datetime-start","datetime-end"),new r(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data&&e.unshift("preset","datetime-precise"),new r(e.join(" ").trim())}renderBody(){var e;return s(T||(T=D` ${0} <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-select-control helper-text="${0}" options="${0}" layout="summary-item" infer="name"> </foxy-internal-select-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="preset" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-native-date-control format="${0}" infer="datetime-start" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-native-date-control format="${0}" infer="datetime-end" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-switch-control infer="datetime-precise" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.t(`name.helper_text_${null!==(e=this.form.name)&&void 0!==e?e:"none"}`),this.__nameOptions,this.__presetOptions,this.__presetGetValue,this.__presetSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeStartGetValue,this.__datetimeStartSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeEndGetValue,this.__datetimeEndSetValue,this.__datetimePreciseGetValue,this.__datetimePreciseSetValue,super.renderBody())}}customElements.define("foxy-report-form",Y);export{Y as ReportForm};
1
+ import{I as e}from"./shared-2bb1f0f4.js";import{_ as t,B as r}from"./shared-8f9014ff.js";import{c as a,h as s,s as i}from"./shared-ba5c42c7.js";import{c as n}from"./shared-4e709717.js";import{l as o}from"./shared-d0aed1c1.js";import"./shared-f892683b.js";import"./shared-540adfea.js";import"./shared-9d4fecb9.js";import{I as l}from"./shared-13fed57b.js";import{s as d}from"./shared-af6ccc54.js";import{a as u}from"./shared-887ac0b0.js";import"./shared-5212ef4f.js";import"./shared-9b35fe34.js";import"./shared-930e68b7.js";import"./shared-41c9c53f.js";import"./shared-53e42a77.js";import"./shared-2b39e4d4.js";import"./shared-69c98b7b.js";import"./shared-cd96ff03.js";import"./shared-da4f9115.js";import"./shared-9496e995.js";import"./shared-791b4510.js";import"./shared-0e19bda5.js";import"./shared-9687ab7b.js";import"./shared-0fd68dc0.js";import"./shared-8d8975d5.js";import"./shared-99c53365.js";import"./shared-db623837.js";import"./shared-6cdfb858.js";import"./shared-0f92b865.js";import"./shared-a20ef119.js";import"./shared-b5e048f5.js";import"./shared-9a3bf65c.js";import"./shared-7892fd3f.js";import"./shared-a5d6db21.js";import"./shared-a0baefff.js";import"./shared-f8e360e6.js";import"./shared-515003f6.js";import"./shared-609c9693.js";import"./shared-058530fc.js";import"./foxy-copy-to-clipboard.js";import"./shared-19073761.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let h,m,p,c=e=>e;customElements.define("foxy-internal-native-date-control",class extends e{constructor(){super(...arguments),this.format="date",this.__isErrorVisible=!1}static get properties(){return t(t({},super.properties),{},{format:{},__isErrorVisible:{attribute:!1}})}static get styles(){return[super.styles,a(h||(h=c`input::-webkit-contacts-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0}`))]}reportValidity(){this.__isErrorVisible=!0,super.reportValidity()}renderControl(){return s(m||(m=c` <div class="leading-xs"> <div class="flex items-center gap-xs"> <label class="text-m text-body flex-1 whitespace-nowrap" for="input">${0}</label> <input placeholder="${0}" class="${0}" type="${0}" id="input" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @blur="${0}" @input="${0}"> <button aria-label="${0}" class="${0}" style="width:1em;height:1em" ?disabled="${0}" ?hidden="${0}" @click="${0}"> ${0} </button> </div> <div style="max-width:32rem"> <p class="text-xs text-secondary">${0}</p> <p class="text-xs text-error" ?hidden="${0}"> ${0} </p> </div> </div> `),this.label,this.placeholder,n({"appearance-none text-right bg-transparent transition-colors":!0,"text-m rounded-s focus-outline-none":!0,"text-secondary":this.readonly,"text-disabled":this.disabled,"font-medium":!this.readonly}),this.format,o(this._value),this.disabled,this.readonly,(e=>{var t;return"Enter"===e.key&&(null===(t=this.nucleon)||void 0===t?void 0:t.submit())}),(()=>this.__isErrorVisible=!0),(e=>{e.stopPropagation(),this._value=e.target.value}),this.t("clear"),n({"flex-shrink-0 rounded-full transition-colors":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"cursor-pointer text-tertiary hover-text-body":!this.disabled,"cursor-default text-disabled":this.disabled}),this.disabled,this.readonly||!this._value,(()=>{this._value="",this.dispatchEvent(new CustomEvent("clear"))}),i(p||(p=c`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1em; height: 1em; transform: scale(1.25); margin-right: -0.16em"><path d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" /></svg>`)),this.helperText,!this.__isErrorVisible||this.disabled||this.readonly,this._errorMessage)}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}_handleHostClick(e){var t;const r=e.composedPath(),a=new Set(["INPUT","LABEL","BUTTON"]);r.some((e=>a.has(e.tagName)))||(null===(t=this.renderRoot.querySelector("input"))||void 0===t||t.focus(),super._handleHostClick(e))}});const _=[[0,1,2],[3,4,5],[6,7,8],[9,10,11]];function f(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=0===r?_.length-1:r-1,s=e.getFullYear()-(0===r?1:0),i=_[a][0],n=d(s,i,1),o=_[a][2];return{start:n,end:new Date(d(s,o+1,1).getTime()-1)}}function g(e=new Date){const t=e.getMonth(),r=_.findIndex((e=>e.includes(t))),a=_[r][0],s=d(e.getFullYear(),a,1),i=_[r][2];return{start:s,end:new Date(d(e.getFullYear(),i+1,1).getTime()-1)}}function v(e=new Date){return{start:d(e.getFullYear(),e.getMonth()-1,1),end:new Date(d(e.getFullYear(),e.getMonth(),1).getTime()-1)}}function b(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),1),end:new Date(d(e.getFullYear(),e.getMonth()+1,1).getTime()-1)}}function y(e=new Date){return{start:d(e.getFullYear()-1,0,1),end:new Date(d(e.getFullYear(),0,1).getTime()-1)}}function x(e=new Date){return{start:d(e.getFullYear(),0,1),end:new Date(d(e.getFullYear()+1,0,1).getTime()-1)}}function w(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-365),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function $(e=new Date){return{start:d(e.getFullYear(),e.getMonth(),e.getDate()-30),end:new Date(d(e.getFullYear(),e.getMonth(),e.getDate()+1).getTime()-1)}}function j(e){return`${e.getFullYear().toString().padStart(4,"0")}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}`}function S(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}function V(e){var t,r;return null!==(r=null===(t=/^\d{4}-\d{2}-\d{2}/.exec(e))||void 0===t?void 0:t[0])&&void 0!==r?r:""}let T,D=e=>e;const F=u(l,"report-form");class Y extends F{constructor(){super(...arguments),this.__showRangeTime=!1,this.__rawPresetOptions=[t({value:"0",label:"option_previous_quarter"},f()),t({value:"1",label:"option_previous_month"},v()),t({value:"2",label:"option_previous_year"},y()),t({value:"3",label:"option_this_quarter"},g()),t({value:"4",label:"option_this_month"},b()),t({value:"5",label:"option_this_year"},x()),t({value:"6",label:"option_last_365_days"},w()),t({value:"7",label:"option_last_30_days"},$())],this.__presetOptions=JSON.stringify([...this.__rawPresetOptions,{value:"custom",label:"option_custom"}]),this.__nameOptions=JSON.stringify([{value:"complete",label:"option_complete"},{value:"customers",label:"option_customers"},{value:"customers_ltv",label:"option_customers_ltv"},{value:"transactions",label:"option_transactions"}]),this.__datetimePreciseGetValue=()=>this.__showRangeTime,this.__datetimePreciseSetValue=e=>{this.__showRangeTime=e},this.__datetimeStartGetValue=()=>{const e=this.form.datetime_start;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeStartSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"00:00"}:00`:"00:00:00";this.edit({datetime_start:`${e.split("T")[0]}T${r}`})},this.__datetimeEndGetValue=()=>{const e=this.form.datetime_end;return e?this.__showRangeTime||this.data?S(e):V(e):""},this.__datetimeEndSetValue=e=>{var t;const r=this.__showRangeTime?`${null!==(t=e.split("T")[1])&&void 0!==t?t:"23:59"}:59`:"23:59:59";this.edit({datetime_end:`${e.split("T")[0]}T${r}`})},this.__presetGetValue=()=>{var e,t;return null!==(t=null===(e=this.__rawPresetOptions.find((e=>{const{datetime_end:t,datetime_start:r}=this.form;return r&&t&&j(e.start)===r&&j(e.end)===t})))||void 0===e?void 0:e.value)&&void 0!==t?t:"custom"},this.__presetSetValue=e=>{const t=this.__rawPresetOptions.find((t=>t.value===e));t&&this.edit({datetime_start:j(t.start),datetime_end:j(t.end)})}}static get properties(){return t(t({},super.properties),{},{__showRangeTime:{attribute:!1}})}static get v8n(){return[({datetime_start:e})=>!!e||"datetime-start:v8n_required",({datetime_end:e})=>!!e||"datetime-end:v8n_required",({name:e})=>!!e||"name:v8n_required"]}get readonlySelector(){const e=[super.readonlySelector.toString()];return this.data&&e.unshift("name","preset","datetime-precise","datetime-start","datetime-end"),new r(e.join(" ").trim())}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data&&e.unshift("preset","datetime-precise"),new r(e.join(" ").trim())}renderBody(){var e;return s(T||(T=D` ${0} <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-select-control helper-text="${0}" options="${0}" layout="summary-item" infer="name"> </foxy-internal-select-control> <foxy-internal-select-control options="${0}" layout="summary-item" infer="preset" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> <foxy-internal-native-date-control format="${0}" infer="datetime-start" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-native-date-control format="${0}" infer="datetime-end" .getValue="${0}" .setValue="${0}"> </foxy-internal-native-date-control> <foxy-internal-switch-control infer="datetime-precise" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> ${0} `),this.renderHeader(),this.t(`name.helper_text_${null!==(e=this.form.name)&&void 0!==e?e:"none"}`),this.__nameOptions,this.__presetOptions,this.__presetGetValue,this.__presetSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeStartGetValue,this.__datetimeStartSetValue,this.__showRangeTime||this.data?"datetime-local":"date",this.__datetimeEndGetValue,this.__datetimeEndSetValue,this.__datetimePreciseGetValue,this.__datetimePreciseSetValue,super.renderBody())}}customElements.define("foxy-report-form",Y);export{Y as ReportForm};