@foxy.io/elements 1.21.3 → 1.21.5

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 (47) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-attribute-form.js +1 -1
  3. package/dist/cdn/foxy-cancellation-form.js +1 -1
  4. package/dist/cdn/foxy-cart-form.js +1 -1
  5. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  6. package/dist/cdn/foxy-coupon-form.js +1 -1
  7. package/dist/cdn/foxy-custom-field-form.js +1 -1
  8. package/dist/cdn/foxy-customer-form.js +1 -1
  9. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  10. package/dist/cdn/foxy-customer-portal.js +1 -1
  11. package/dist/cdn/foxy-customer.js +1 -1
  12. package/dist/cdn/foxy-donation.js +1 -1
  13. package/dist/cdn/foxy-email-template-form.js +1 -1
  14. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  15. package/dist/cdn/foxy-gift-card-form.js +1 -1
  16. package/dist/cdn/foxy-item-form.js +1 -1
  17. package/dist/cdn/foxy-items-form.js +1 -1
  18. package/dist/cdn/foxy-report-form.js +1 -1
  19. package/dist/cdn/foxy-shipment-card.js +1 -1
  20. package/dist/cdn/foxy-sign-in-form.js +1 -1
  21. package/dist/cdn/foxy-subscription-form.js +1 -1
  22. package/dist/cdn/foxy-tax-form.js +1 -1
  23. package/dist/cdn/foxy-template-config-form.js +1 -1
  24. package/dist/cdn/foxy-template-form.js +1 -1
  25. package/dist/cdn/foxy-transaction.js +1 -1
  26. package/dist/cdn/foxy-user-form.js +1 -1
  27. package/dist/cdn/foxy-users-table.js +1 -1
  28. package/dist/cdn/{shared-f621ccee.js → shared-2adb2ad2.js} +1 -1
  29. package/dist/cdn/shared-2d1ef71c.js +1 -0
  30. package/dist/cdn/{shared-ca87cf22.js → shared-31aeab75.js} +1 -1
  31. package/dist/cdn/{shared-c6a01446.js → shared-97d58f8b.js} +1 -1
  32. package/dist/cdn/{shared-454f172e.js → shared-d8bb42a2.js} +1 -1
  33. package/dist/elements/private/Choice/Choice.d.ts +3 -2
  34. package/dist/elements/private/Choice/Choice.js +5 -0
  35. package/dist/elements/private/Choice/Choice.js.map +1 -1
  36. package/dist/elements/private/Choice/machine.js +33 -0
  37. package/dist/elements/private/Choice/machine.js.map +1 -1
  38. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.d.ts +1 -0
  39. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js +8 -0
  40. package/dist/elements/public/AccessRecoveryForm/AccessRecoveryForm.js.map +1 -1
  41. package/dist/elements/public/Donation/Donation.js +3 -3
  42. package/dist/elements/public/Donation/Donation.js.map +1 -1
  43. package/dist/elements/public/SignInForm/SignInForm.d.ts +1 -0
  44. package/dist/elements/public/SignInForm/SignInForm.js +8 -0
  45. package/dist/elements/public/SignInForm/SignInForm.js.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/cdn/shared-be99323d.js +0 -1
@@ -1 +1 @@
1
- import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-ca87cf22.js";import"./shared-bc814810.js";import"./shared-45926e43.js";import"./shared-3d241b7f.js";import"./shared-0479553e.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{I as e}from"./shared-e262920d.js";import"./foxy-item-card.js";import{i as t}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{C as i}from"./shared-67546e10.js";import{N as a}from"./shared-dc91f7ae.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{T as s,S as d,a as n}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import"./shared-be99323d.js";import"./shared-9f905d9f.js";import"./shared-f621ccee.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import{P as l}from"./shared-5378bd8c.js";import"./shared-0ce006b9.js";import"./shared-08e27fe9.js";import"./foxy-collection-page.js";import"./shared-a8ced8bf.js";import"./shared-dcdb6ea1.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-94fc438b.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./shared-ed0dee03.js";import"./shared-404aa9cc.js";let c,m=e=>e;customElements.define("foxy-internal-gift-card-code-form-item-control",class extends e{renderControl(){var e,i,a;let s;try{const t=new URL(null!==(a=null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.form._links)||void 0===i?void 0:i["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==a?a:"");t.searchParams.set("zoom","item_options"),s=t.toString()}catch(e){s=void 0}return r(c||(c=m` <foxy-internal-details summary="title" infer="" open> <foxy-item-card infer="item-card" class="p-m" href="${0}"></foxy-item-card> </foxy-internal-details> `),t(s))}});let h,f,u,_,p,g,b,y,v,$=e=>e;const x=i(s(d(n(a,"gift-card-code-form"))));class j extends x{constructor(){super(...arguments),this.templates={}}static get scopedElements(){return{"vaadin-number-field":customElements.get("vaadin-number-field"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-internal-gift-card-code-form-item-control":customElements.get("foxy-internal-gift-card-code-form-item-control"),"foxy-internal-async-details-control":customElements.get("foxy-internal-async-details-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":l}}static get v8n(){return[({code:e})=>!!e||"code_required",({code:e})=>!e||e.length<=50||"code_too_long",({current_balance:e})=>!!e||"current_balance_required",({current_balance:e})=>!e||!isNaN(e)||"current_balance_required"]}render(){var e,t;return r(h||(h=$` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isCodeHidden?null:this.__renderCode(),this.__isCurrentBalanceHidden?null:this.__renderCurrentBalance(),this.__isEndDateHidden?null:this.__renderEndDate(),this.__isLogsControlHidden?null:this.__renderLogsControl(),this.__isCartItemHidden?null:this.__renderCartItem(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isCodeHidden(){return this.hiddenSelector.matches("code",!0)}get __isCurrentBalanceHidden(){return this.hiddenSelector.matches("current-balance",!0)}get __isEndDateHidden(){return this.hiddenSelector.matches("end-date",!0)}get __isLogsControlHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href)}get __isCartItemHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:provisioned_by_transaction_detail_id"])}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderCode(){return r(f||(f=$` <div> ${0} <vaadin-text-field data-testid="code" class="w-full" label="${0}" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("code:before"),this.t("code"),this.__getValidator("code"),this.__getErrorMessage("code"),this.form.code,!this.in("idle")||this.disabledSelector.matches("code",!0),this.readonlySelector.matches("code",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({code:t})}),this.renderTemplateOrSlot("code:after"))}__renderCurrentBalance(){return r(u||(u=$` <div> ${0} <vaadin-number-field data-testid="current-balance" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" prevent-invalid-input has-controls required @keydown="${0}" @change="${0}"> </vaadin-number-field> ${0} </div> `),this.renderTemplateOrSlot("current-balance:before"),this.t("current_balance"),this.__getValidator("current_balance"),this.__getErrorMessage("current_balance"),this.form.current_balance,!this.in("idle")||this.disabledSelector.matches("current-balance",!0),this.readonlySelector.matches("current-balance",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({current_balance:parseFloat(t)})}),this.renderTemplateOrSlot("current-balance:after"))}__renderEndDate(){return r(_||(_=$` <div> ${0} <vaadin-date-picker data-testid="end-date" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.t("end_date"),this.__getValidator("end_date"),this.__getErrorMessage("end_date"),this.form.end_date,!this.in("idle")||this.disabledSelector.matches("end-date",!0),this.readonlySelector.matches("end-date",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({end_date:t})}),this.renderTemplateOrSlot("end-date:after"))}__renderLogsControl(){var e;return r(p||(p=$` <foxy-internal-async-details-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card" open> </foxy-internal-async-details-control> `),t(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href))}__renderCartItem(){return r(g||(g=$` <foxy-internal-gift-card-code-form-item-control infer="cart-item"> </foxy-internal-gift-card-code-form-item-control> `))}__renderTimestamps(){return r(b||(b=$` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),d=this.in("idle");return r(y||(y=$` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!d||s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return r(v||(v=$` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),this.in("busy")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}customElements.define("foxy-gift-card-code-form",j);export{j as GiftCardCodeForm};
1
+ import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-31aeab75.js";import"./shared-bc814810.js";import"./shared-45926e43.js";import"./shared-3d241b7f.js";import"./shared-0479553e.js";import"./foxy-gift-card-code-log-card.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{I as e}from"./shared-e262920d.js";import"./foxy-item-card.js";import{i as t}from"./shared-d3bf9ac0.js";import{h as r}from"./shared-7f33a83a.js";import{C as i}from"./shared-67546e10.js";import{N as a}from"./shared-dc91f7ae.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{T as s,S as d,a as n}from"./shared-2cc638ad.js";import{c as o}from"./shared-4e709717.js";import"./shared-2d1ef71c.js";import"./shared-9f905d9f.js";import"./shared-2adb2ad2.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import{P as l}from"./shared-5378bd8c.js";import"./shared-0ce006b9.js";import"./shared-08e27fe9.js";import"./foxy-collection-page.js";import"./shared-a8ced8bf.js";import"./shared-dcdb6ea1.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-94fc438b.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./shared-ed0dee03.js";import"./shared-404aa9cc.js";let c,m=e=>e;customElements.define("foxy-internal-gift-card-code-form-item-control",class extends e{renderControl(){var e,i,a;let s;try{const t=new URL(null!==(a=null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.form._links)||void 0===i?void 0:i["fx:provisioned_by_transaction_detail_id"].href)&&void 0!==a?a:"");t.searchParams.set("zoom","item_options"),s=t.toString()}catch(e){s=void 0}return r(c||(c=m` <foxy-internal-details summary="title" infer="" open> <foxy-item-card infer="item-card" class="p-m" href="${0}"></foxy-item-card> </foxy-internal-details> `),t(s))}});let h,f,u,_,p,g,b,y,v,$=e=>e;const x=i(s(d(n(a,"gift-card-code-form"))));class j extends x{constructor(){super(...arguments),this.templates={}}static get scopedElements(){return{"vaadin-number-field":customElements.get("vaadin-number-field"),"vaadin-date-picker":customElements.get("vaadin-date-picker"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-button":customElements.get("vaadin-button"),"foxy-internal-gift-card-code-form-item-control":customElements.get("foxy-internal-gift-card-code-form-item-control"),"foxy-internal-async-details-control":customElements.get("foxy-internal-async-details-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":l}}static get v8n(){return[({code:e})=>!!e||"code_required",({code:e})=>!e||e.length<=50||"code_too_long",({current_balance:e})=>!!e||"current_balance_required",({current_balance:e})=>!e||!isNaN(e)||"current_balance_required"]}render(){var e,t;return r(h||(h=$` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isCodeHidden?null:this.__renderCode(),this.__isCurrentBalanceHidden?null:this.__renderCurrentBalance(),this.__isEndDateHidden?null:this.__renderEndDate(),this.__isLogsControlHidden?null:this.__renderLogsControl(),this.__isCartItemHidden?null:this.__renderCartItem(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isCodeHidden(){return this.hiddenSelector.matches("code",!0)}get __isCurrentBalanceHidden(){return this.hiddenSelector.matches("current-balance",!0)}get __isEndDateHidden(){return this.hiddenSelector.matches("end-date",!0)}get __isLogsControlHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href)}get __isCartItemHidden(){var e;return!(null===(e=this.form._links)||void 0===e?void 0:e["fx:provisioned_by_transaction_detail_id"])}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderCode(){return r(f||(f=$` <div> ${0} <vaadin-text-field data-testid="code" class="w-full" label="${0}" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("code:before"),this.t("code"),this.__getValidator("code"),this.__getErrorMessage("code"),this.form.code,!this.in("idle")||this.disabledSelector.matches("code",!0),this.readonlySelector.matches("code",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({code:t})}),this.renderTemplateOrSlot("code:after"))}__renderCurrentBalance(){return r(u||(u=$` <div> ${0} <vaadin-number-field data-testid="current-balance" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" prevent-invalid-input has-controls required @keydown="${0}" @change="${0}"> </vaadin-number-field> ${0} </div> `),this.renderTemplateOrSlot("current-balance:before"),this.t("current_balance"),this.__getValidator("current_balance"),this.__getErrorMessage("current_balance"),this.form.current_balance,!this.in("idle")||this.disabledSelector.matches("current-balance",!0),this.readonlySelector.matches("current-balance",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({current_balance:parseFloat(t)})}),this.renderTemplateOrSlot("current-balance:after"))}__renderEndDate(){return r(_||(_=$` <div> ${0} <vaadin-date-picker data-testid="end-date" class="w-full" label="${0}" min="0" .checkValidity="${0}" .errorMessage="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.t("end_date"),this.__getValidator("end_date"),this.__getErrorMessage("end_date"),this.form.end_date,!this.in("idle")||this.disabledSelector.matches("end-date",!0),this.readonlySelector.matches("end-date",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({end_date:t})}),this.renderTemplateOrSlot("end-date:after"))}__renderLogsControl(){var e;return r(p||(p=$` <foxy-internal-async-details-control infer="logs" first="${0}" limit="5" item="foxy-gift-card-code-log-card" open> </foxy-internal-async-details-control> `),t(null===(e=this.form._links)||void 0===e?void 0:e["fx:gift_card_code_logs"].href))}__renderCartItem(){return r(g||(g=$` <foxy-internal-gift-card-code-form-item-control infer="cart-item"> </foxy-internal-gift-card-code-form-item-control> `))}__renderTimestamps(){return r(b||(b=$` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),a=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||a),d=this.in("idle");return r(y||(y=$` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!d||s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return r(v||(v=$` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),this.in("busy")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}customElements.define("foxy-gift-card-code-form",j);export{j as GiftCardCodeForm};
@@ -1 +1 @@
1
- import"./shared-08156595.js";import"./shared-6cb1015f.js";import"./shared-bc814810.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-gift-card-code-form.js";import"./foxy-copy-to-clipboard.js";import{T as e}from"./shared-d807ae5c.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-7097364f.js";import"./shared-747b6d74.js";import{I as t}from"./shared-a01b5597.js";import"./shared-274c49b0.js";import"./shared-8f8abcd6.js";import{R as i,S as r,T as s,a}from"./shared-2cc638ad.js";import{h as o}from"./shared-7f33a83a.js";import{_ as n}from"./shared-a8ced8bf.js";import{C as l}from"./shared-9f436277.js";import{C as d}from"./shared-67546e10.js";import{N as c}from"./shared-dc91f7ae.js";import{i as m}from"./shared-d3bf9ac0.js";import{c as g}from"./shared-4e709717.js";import{E as f}from"./shared-a2d619b4.js";import{F as u}from"./shared-be99323d.js";import{G as h}from"./shared-d8dc97f0.js";import{P as p}from"./shared-5378bd8c.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-5ea18e60.js";import"./shared-08e27fe9.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-0479553e.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-f3b35364.js";import"./shared-d519a301.js";import"./shared-ca87cf22.js";import"./shared-f621ccee.js";import"./shared-404aa9cc.js";import"./shared-45926e43.js";import"./foxy-collection-page.js";import"./shared-11c2efc8.js";import"./shared-e262920d.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./foxy-gift-card-code-log-card.js";import"./shared-94fc438b.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./foxy-item-card.js";import"./shared-5a4829e3.js";import"./shared-4849ef5b.js";import"./shared-ed0dee03.js";import"./shared-e6f3e9f0.js";import"./shared-bc7f58ef.js";import"./shared-d3bf404a.js";import"./shared-88c4cfec.js";let y,v,x=e=>e;const _=i(t);customElements.define("foxy-internal-gift-card-form-provisioning-control",class extends _{constructor(){super(...arguments),this.__maxBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_max},this.__maxBalanceValueSetter=e=>{var t,i,r,s;const a=null!==(r=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===i?void 0:i.initial_balance_min)&&void 0!==r?r:e;null===(s=this.nucleon)||void 0===s||s.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:a>e?e:a,initial_balance_max:e}})},this.__minBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_min},this.__minBalanceValueSetter=e=>{var t,i,r,s;const a=null!==(r=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==r?r:e;null===(s=this.nucleon)||void 0===s||s.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:a<e?e:a}})},this.__toggleValueGetter=()=>{var e,t;return(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?["allow"]:[]},this.__toggleValueSetter=e=>{var t,i,r,s,a,o,n,l;e.includes("allow")?null===(t=this.nucleon)||void 0===t||t.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(s=null===(r=null===(i=this.nucleon)||void 0===i?void 0:i.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==s?s:0,initial_balance_max:null!==(n=null===(o=null===(a=this.nucleon)||void 0===a?void 0:a.form.provisioning_config)||void 0===o?void 0:o.initial_balance_max)&&void 0!==n?n:0}}):null===(l=this.nucleon)||void 0===l||l.edit({provisioning_config:null})},this.__toggleOptions=[{label:"text",value:"allow"}]}renderControl(){var e,t;return o(y||(y=x` <foxy-internal-checkbox-group-control infer="toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__toggleValueGetter,this.__toggleValueSetter,this.__toggleOptions,(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?o(v||(v=x` <div class="grid grid-cols-2 sm-grid-cols-4 gap-m mt-s"> <foxy-internal-text-control infer="sku" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-integer-control infer="min-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> </div> `),this.__minBalanceValueGetter,this.__minBalanceValueSetter,this.__maxBalanceValueGetter,this.__maxBalanceValueSetter):"")}});let b,$=e=>e;const k=d(r(s(c)));class S extends k{constructor(){super(...arguments),this.itemCategory="",this.giftCard=""}static get scopedElements(){return{"x-checkbox":l}}static get properties(){return n(n({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},giftCard:{type:String,attribute:"gift-card"}})}render(){return o(b||(b=$` <div class="h-full flex items-center"> <x-checkbox data-testid="checkbox" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </x-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{e.detail?(this.edit({item_category_uri:this.itemCategory,gift_card_uri:this.giftCard}),this.submit()):this.delete()}))}}let j,w=e=>e;const C=d(r(s(c)));class T extends C{constructor(){super(...arguments),this.itemCategory="",this.giftCard=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item-content":S}}static get properties(){return n(n({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},giftCard:{type:String,attribute:"gift-card"}})}render(){var e;const t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:gift_card_item_categories"][0],i=t?void 0:this.href,r=t?t._links.self.href:void 0;return o(j||(j=w` <x-category-restrictions-page-item-content item-category="${0}" data-testid="content" gift-card="${0}" parent="${0}" class="h-full" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> <slot></slot> </x-category-restrictions-page-item-content> `),this.itemCategory,this.giftCard,m(i),this.group,m(r),!this.in("idle")||this.disabled,this.readonly)}}let E,O,z,V=e=>e;const q=d(r(s(a(c))));class R extends q{constructor(){super(...arguments),this.giftCardItemCategories="",this.giftCard=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item":T}}static get properties(){return n(n({},super.properties),{},{giftCardItemCategories:{type:String,attribute:"gift-card-item-categories"},giftCard:{type:String,attribute:"gift-card"}})}render(){var e,t,i,r,s;const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:item_categories"])&&void 0!==t?t:[];let n=20;try{const e=parseInt(null!==(i=new URL(this.href).searchParams.get("limit"))&&void 0!==i?i:"");isNaN(e)||(n=e)}catch(e){}return o(E||(E=V` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),new Array(n).fill(0).map(((e,t)=>{const i=a[t];let r;if(i)try{const e=new URL(this.giftCardItemCategories),t=new URL(i._links.self.href).pathname.split("/").pop();e.searchParams.set("item_category_id",t),e.searchParams.set("limit","1"),r=e.toString()}catch(e){}return r?o(z||(z=V` <x-category-restrictions-page-item data-testclass="item" item-category="${0}" gift-card="${0}" class="h-l" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> ${0} </x-category-restrictions-page-item> `),i._links.self.href,this.giftCard,this.group,r,!this.in("idle")||this.disabled,this.readonly,null==i?void 0:i.name):o(O||(O=V`<div class="h-l"></div>`))})),g({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(r=customElements.get("foxy-spinner"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"")}}const N=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let D,P,B,G,L,Q,U,I,J,W,A,M,F,H,K,X,Y,Z,ee,te,ie,re=e=>e;const se=r(s(d(i(a(c,"gift-card-form")))));class ae extends se{constructor(){super(...arguments),this.__codesTableColumns=[{header:e=>o(D||(D=re`<foxy-i18n lang="${0}" key="code" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{const t=!this.in("idle")||this.disabledSelector.matches("codes",!0);return o(P||(P=re` <div class="flex items-center gap-xs"> <vaadin-button theme="tertiary-inline contrast" class="p-0" ?disabled="${0}" @click="${0}"> <span class="font-tnum">${0}</span> </vaadin-button> <foxy-copy-to-clipboard ?disabled="${0}" text="${0}" lang="${0}" ns="${0} copy-to-clipboard"> </foxy-copy-to-clipboard> </div> `),t,(t=>{const i=this.renderRoot.querySelector("#code-dialog"),r=t.currentTarget;i.href=e.data._links.self.href,i.show(r)}),e.data.code,t,e.data.code,e.lang,e.ns)}},{header:e=>o(B||(B=re`<foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>o(G||(G=re` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_created}),e.lang,e.ns)},{hideBelow:"sm",header:e=>o(L||(L=re`<foxy-i18n lang="${0}" key="end_date" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>o(Q||(Q=re` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.end_date}),e.lang,e.ns)},{header:e=>o(U||(U=re`<foxy-i18n lang="${0}" key="current_balance" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{var t;return o(I||(I=re` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:`${e.data.current_balance} ${null===(t=this.data)||void 0===t?void 0:t.currency_code}`,currencyDisplay:this.__currencyDisplay}),e.lang,e.ns)}}],this.__codesTableQuery=null,this.__currencyDisplay="",this.__itemCategories=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"vaadin-button":customElements.get("vaadin-button"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-gift-card-form-provisioning-control":customElements.get("foxy-internal-gift-card-form-provisioning-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-query-builder":customElements.get("foxy-query-builder"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"foxy-pagination":customElements.get("foxy-pagination"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"x-category-restrictions-page":R,"x-frequency-input":u,"x-property-table":p,"x-editable-list":f,"x-group":h}}static get properties(){return n(n({},super.properties),{},{__codesTableQuery:{attribute:!1},__itemCategories:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=50||"name_too_long",e=>{var t;if(null===(t=e.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var t;const i=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_min;return!("number"==typeof i&&i<=0)||"min-balance:v8n_negative"},e=>{var t;const i=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_max;return!("number"==typeof i&&i<=0)||"max-balance:v8n_negative"}]}render(){var e,t;const i=this.hiddenSelector,r=i.matches("name",!0),s=i.matches("currency",!0),a=i.matches("expires",!0);return o(J||(J=re` <div class="relative space-y-l"> ${0} <foxy-internal-gift-card-form-provisioning-control infer="provisioning"> </foxy-internal-gift-card-form-provisioning-control> ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),r&&s&&a?"":o(W||(W=re` <div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m"> ${0} ${0} ${0} </div> `),r?"":o(A||(A=re`<div class="md-col-span-2">${0}</div>`),this.__renderName()),s?"":this.__renderCurrency(),a?"":this.__renderExpires()),i.matches("codes",!0)||!this.data?"":this.__renderCodes(),i.matches("product-restrictions",!0)?"":this.__renderProductRestrictions(),i.matches("category-restrictions",!0)||!this.data?"":this.__renderCategoryRestrictions(),i.matches("timestamps",!0)?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),g({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!this.in("busy")&&!this.in("fail")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:store"].href),i=new URL(t._links["fx:item_categories"].href);return i.searchParams.set("limit","5"),this.__currencyDisplay=t.use_international_currency_symbol?"code":"symbol",this.__itemCategories=i.toString(),e}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){var e;return o(M||(M=re` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" data-testid="name" class="w-full" label="${0}" .checkValidity="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.__getErrorMessage("name"),this.t("gift_card_name_helper_text"),this.t("name"),this.__getValidator("name"),null!==(e=this.form.name)&&void 0!==e?e:"",!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderCurrency(){var e,t;return o(F||(F=re` <div> ${0} <vaadin-combo-box item-label-path="label" item-value-path="value" item-id-path="value" data-testid="currency" class="w-full" label="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("currency:before"),this.t("currency"),!this.in("idle")||this.disabledSelector.matches("currency",!0),this.readonlySelector.matches("currency",!0),null!==(t=null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:"",N.map((e=>({label:`${this.t(`currency_${e}`)} (${e.toUpperCase()})`,value:e}))),(e=>{const t=e.currentTarget;this.edit({currency_code:t.value})}),this.renderTemplateOrSlot("currency:after"))}__renderExpires(){var e;return o(H||(H=re` <div> ${0} <x-frequency-input placeholder="${0}" data-testid="expires" label="${0}" class="w-full" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @change="${0}"> </x-frequency-input> ${0} </div> `),this.renderTemplateOrSlot("expires:before"),this.t("select"),this.t("expires_after"),this.lang,this.ns,!this.in("idle")||this.disabledSelector.matches("expires",!0),this.readonlySelector.matches("expires",!0),null!==(e=this.form.expires_after)&&void 0!==e?e:"",(e=>{const t=e.currentTarget;this.edit({expires_after:t.value})}),this.renderTemplateOrSlot("expires:after"))}__renderCodes(){var e,t,i,r,s;const{disabledSelector:a,readonlySelector:n,hiddenSelector:l,group:d,data:c,lang:m,ns:g}=this,f=!this.in("idle")||a.matches("codes",!0),u=this.__codesTableQuery,h=new URL(c._links["fx:gift_card_codes"].href);new URLSearchParams(null!=u?u:"").forEach(((e,t)=>h.searchParams.set(t,e))),h.searchParams.set("limit","5");const p=null===u?"filter":"clear_filters",y="icons:"+(null===u?"filter-list":"clear");return o(K||(K=re` <div data-testid="codes"> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="generate" parent="${0}" group="${0}" lang="${0}" form="foxy-generate-codes-form" ns="${0}" id="generate-codes-dialog" alert .related="${0}"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" header="code" parent="${0}" group="${0}" lang="${0}" form="foxy-gift-card-code-form" ns="${0}" id="code-dialog"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="import" parent="${0}" group="${0}" lang="${0}" form="foxy-gift-card-codes-form" ns="${0}" id="import-dialog"> </foxy-form-dialog> ${0} <div class="flex items-center justify-between mb-xs space-x-s"> <foxy-i18n class="text-s font-medium text-secondary leading-none flex-1" lang="${0}" key="code_plural" ns="${0}"> </foxy-i18n> <vaadin-button data-testid="codes:generate-button" theme="success tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="generate" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:import-button" theme="contrast tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="import" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:filter-button" theme="contrast ${0} small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="${0}"></iron-icon> </vaadin-button> </div> <foxy-query-builder class="my-s" lang="${0}" ns="${0} ${0}" ?disabled="${0}" ?hidden="${0}" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-table class="px-m mb-s border border-contrast-10 rounded" group="${0}" lang="${0}" ns="${0}" .columns="${0}"> </foxy-table> </foxy-pagination> ${0} </div> `),a.zoom("codes:generate:form").toString(),n.zoom("codes:generate:form").toString(),l.zoom("codes:generate:form").toString(),null!==(e=null==c?void 0:c._links["fx:generate_codes"].href)&&void 0!==e?e:"",d,m,g,[h.toString()],a.zoom("codes:form").toString(),n.zoom("codes:form").toString(),l.zoom("codes:form").toString(),h.toString(),d,m,g,a.zoom("codes:import:form").toString(),n.zoom("codes:import:form").toString(),l.zoom("codes:import:form").toString(),c._links["fx:gift_card_codes"].href,d,m,g,this.renderTemplateOrSlot("codes:before"),m,g,f,(e=>{const t=this.renderRoot.querySelector("#generate-codes-dialog"),i=e.currentTarget;null==t||t.show(i)}),m,g,f,(e=>{const t=this.renderRoot.querySelector("#import-dialog"),i=e.currentTarget;null==t||t.show(i)}),m,g,null===u?"tertiary":"",f,(()=>this.__codesTableQuery=null===u?"":null),m,p,g,y,m,g,null!==(i=null===(t=customElements.get("foxy-query-builder"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",f,null===u,ae.__codesQueryOptions,null!=u?u:"",(e=>{const t=e.currentTarget;this.__codesTableQuery=t.value}),h.toString(),m,g,null!==(s=null===(r=customElements.get("foxy-pagination"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",f,d,m,g,this.__codesTableColumns,this.renderTemplateOrSlot("codes:after"))}__renderProductRestrictions(){var e;const t="product-restrictions",i=!this.in("idle")||this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0),s=null!==(e=this.form.product_code_restrictions)&&void 0!==e?e:"",a=[{header:"allow",items:[]},{header:"block",items:[]}];return s&&s.split(",").forEach((e=>{const t=e.startsWith("-"),i=t?1:0,r=t?e.substring(1):e;a[i].items.push({label:r,value:e})})),o(X||(X=re` <div data-testid="product-restrictions"> ${0} <div class="space-y-s"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="product_restrictions" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> ${0} </div> </x-group> <foxy-i18n class="${0}" lang="${0}" key="gift_card_product_restrictions_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("product-restrictions:before"),i?"text-disabled":"text-secondary",this.lang,this.ns,a.map(((e,t)=>o(Y||(Y=re` <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <x-editable-list data-testid="product-restrictions:${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .items="${0}" @change="${0}"> </x-editable-list> </x-group> `),i?"text-disabled":"text-tertiary",this.lang,e.header,this.ns,e.header,this.lang,this.ns,i,r,e.items,(e=>{const i=[0===t?e.currentTarget.items:a[0].items,1===t?e.currentTarget.items:a[1].items].map((e=>e.map((e=>e.value.replace(/^[\s-]*/,"").trimEnd())))).map((e=>e.filter((e=>!!e)))).map((e=>Array.from(new Set(e)))),r=i[0].concat(i[1].map((e=>`-${e}`))).join(",");this.edit({product_code_restrictions:r})})))),g({"block text-xs leading-s transition-colors":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.renderTemplateOrSlot("product-restrictions:after"))}__renderCategoryRestrictions(){var e,t,i;const r="category-restrictions",s=!this.in("idle")||this.disabledSelector.matches(r,!0),a=this.readonlySelector.matches(r,!0),n=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_item_categories"].href;return o(Z||(Z=re` <div data-testid="category-restrictions"> ${0} <div class="space-y-xs"> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" lang="${0}" key="category_restrictions" ns="${0}"> </foxy-i18n> <x-category-restrictions-page gift-card-item-categories="${0}" data-testid="category-restrictions:page" gift-card="${0}" class="border border-contrast-10 rounded mb-s" group="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}"> </x-category-restrictions-page> </foxy-pagination> <foxy-i18n class="block text-xs leading-s text-secondary" lang="${0}" key="gift_card_category_restrictions_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.__itemCategories,this.lang,this.ns,null!==(i=null===(t=customElements.get("foxy-pagination"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",s,this.lang,this.ns,m(n),this.href,this.group,this.lang,this.ns,s,a,this.lang,this.ns,this.renderTemplateOrSlot(`${r}:after`))}__renderTimestamps(){return o(ee||(ee=re` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||r),a=this.in("busy");return o(te||(te=re` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),a||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return o(ie||(ie=re` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}ae.__codesQueryOptions=[{label:"code",path:"code",type:e.String},{label:"current_balance",path:"current_balance",type:e.Number},{label:"end_date",path:"end_date",type:e.Date},{label:"date_created",path:"date_created",type:e.Date},{label:"date_modified",path:"date_modified",type:e.Date}],customElements.define("foxy-gift-card-form",ae);export{ae as GiftCardForm};
1
+ import"./shared-08156595.js";import"./shared-6cb1015f.js";import"./shared-bc814810.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./foxy-generate-codes-form.js";import"./foxy-gift-card-codes-form.js";import"./foxy-gift-card-code-form.js";import"./foxy-copy-to-clipboard.js";import{T as e}from"./shared-d807ae5c.js";import"./foxy-pagination.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-7097364f.js";import"./shared-747b6d74.js";import{I as t}from"./shared-a01b5597.js";import"./shared-274c49b0.js";import"./shared-8f8abcd6.js";import{R as i,S as r,T as s,a}from"./shared-2cc638ad.js";import{h as o}from"./shared-7f33a83a.js";import{_ as n}from"./shared-a8ced8bf.js";import{C as l}from"./shared-9f436277.js";import{C as d}from"./shared-67546e10.js";import{N as c}from"./shared-dc91f7ae.js";import{i as m}from"./shared-d3bf9ac0.js";import{c as g}from"./shared-4e709717.js";import{E as f}from"./shared-a2d619b4.js";import{F as u}from"./shared-2d1ef71c.js";import{G as h}from"./shared-d8dc97f0.js";import{P as p}from"./shared-5378bd8c.js";import"./shared-be66c2e7.js";import"./shared-0ce006b9.js";import"./shared-5ea18e60.js";import"./shared-08e27fe9.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-0479553e.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-f3b35364.js";import"./shared-d519a301.js";import"./shared-31aeab75.js";import"./shared-2adb2ad2.js";import"./shared-404aa9cc.js";import"./shared-45926e43.js";import"./foxy-collection-page.js";import"./shared-11c2efc8.js";import"./shared-e262920d.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./foxy-gift-card-code-log-card.js";import"./shared-94fc438b.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./foxy-item-card.js";import"./shared-5a4829e3.js";import"./shared-4849ef5b.js";import"./shared-ed0dee03.js";import"./shared-e6f3e9f0.js";import"./shared-bc7f58ef.js";import"./shared-d3bf404a.js";import"./shared-88c4cfec.js";let y,v,x=e=>e;const b=i(t);customElements.define("foxy-internal-gift-card-form-provisioning-control",class extends b{constructor(){super(...arguments),this.__maxBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_max},this.__maxBalanceValueSetter=e=>{var t,i,r,s;const a=null!==(r=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===i?void 0:i.initial_balance_min)&&void 0!==r?r:e;null===(s=this.nucleon)||void 0===s||s.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:a>e?e:a,initial_balance_max:e}})},this.__minBalanceValueGetter=()=>{var e,t;return null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.initial_balance_min},this.__minBalanceValueSetter=e=>{var t,i,r,s;const a=null!==(r=null===(i=null===(t=this.nucleon)||void 0===t?void 0:t.form.provisioning_config)||void 0===i?void 0:i.initial_balance_max)&&void 0!==r?r:e;null===(s=this.nucleon)||void 0===s||s.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:e,initial_balance_max:a<e?e:a}})},this.__toggleValueGetter=()=>{var e,t;return(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?["allow"]:[]},this.__toggleValueSetter=e=>{var t,i,r,s,a,o,n,l;e.includes("allow")?null===(t=this.nucleon)||void 0===t||t.edit({provisioning_config:{allow_autoprovisioning:!0,initial_balance_min:null!==(s=null===(r=null===(i=this.nucleon)||void 0===i?void 0:i.form.provisioning_config)||void 0===r?void 0:r.initial_balance_min)&&void 0!==s?s:0,initial_balance_max:null!==(n=null===(o=null===(a=this.nucleon)||void 0===a?void 0:a.form.provisioning_config)||void 0===o?void 0:o.initial_balance_max)&&void 0!==n?n:0}}):null===(l=this.nucleon)||void 0===l||l.edit({provisioning_config:null})},this.__toggleOptions=[{label:"text",value:"allow"}]}renderControl(){var e,t;return o(y||(y=x` <foxy-internal-checkbox-group-control infer="toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> ${0} `),this.__toggleValueGetter,this.__toggleValueSetter,this.__toggleOptions,(null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.form.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning)?o(v||(v=x` <div class="grid grid-cols-2 sm-grid-cols-4 gap-m mt-s"> <foxy-internal-text-control infer="sku" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-integer-control infer="min-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-balance" .getValue="${0}" .setValue="${0}"> </foxy-internal-integer-control> </div> `),this.__minBalanceValueGetter,this.__minBalanceValueSetter,this.__maxBalanceValueGetter,this.__maxBalanceValueSetter):"")}});let _,$=e=>e;const k=d(r(s(c)));class S extends k{constructor(){super(...arguments),this.itemCategory="",this.giftCard=""}static get scopedElements(){return{"x-checkbox":l}}static get properties(){return n(n({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},giftCard:{type:String,attribute:"gift-card"}})}render(){return o(_||(_=$` <div class="h-full flex items-center"> <x-checkbox data-testid="checkbox" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <slot></slot> </x-checkbox> </div> `),!this.in("idle")||this.disabled,this.readonly,!!this.data,(e=>{e.detail?(this.edit({item_category_uri:this.itemCategory,gift_card_uri:this.giftCard}),this.submit()):this.delete()}))}}let j,w=e=>e;const C=d(r(s(c)));class T extends C{constructor(){super(...arguments),this.itemCategory="",this.giftCard=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item-content":S}}static get properties(){return n(n({},super.properties),{},{itemCategory:{type:String,attribute:"item-category"},giftCard:{type:String,attribute:"gift-card"}})}render(){var e;const t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:gift_card_item_categories"][0],i=t?void 0:this.href,r=t?t._links.self.href:void 0;return o(j||(j=w` <x-category-restrictions-page-item-content item-category="${0}" data-testid="content" gift-card="${0}" parent="${0}" class="h-full" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> <slot></slot> </x-category-restrictions-page-item-content> `),this.itemCategory,this.giftCard,m(i),this.group,m(r),!this.in("idle")||this.disabled,this.readonly)}}let E,O,z,V=e=>e;const q=d(r(s(a(c))));class R extends q{constructor(){super(...arguments),this.giftCardItemCategories="",this.giftCard=""}static get scopedElements(){return{"foxy-spinner":customElements.get("foxy-spinner"),"x-category-restrictions-page-item":T}}static get properties(){return n(n({},super.properties),{},{giftCardItemCategories:{type:String,attribute:"gift-card-item-categories"},giftCard:{type:String,attribute:"gift-card"}})}render(){var e,t,i,r,s;const a=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:item_categories"])&&void 0!==t?t:[];let n=20;try{const e=parseInt(null!==(i=new URL(this.href).searchParams.get("limit"))&&void 0!==i?i:"");isNaN(e)||(n=e)}catch(e){}return o(E||(E=V` <div class="relative"> <div class="relative divide-y divide-contrast-10 ml-m"> ${0} </div> <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" state="${0}" class="m-auto p-m bg-base rounded-t-l rounded-b-l shadow-xs" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),new Array(n).fill(0).map(((e,t)=>{const i=a[t];let r;if(i)try{const e=new URL(this.giftCardItemCategories),t=new URL(i._links.self.href).pathname.split("/").pop();e.searchParams.set("item_category_id",t),e.searchParams.set("limit","1"),r=e.toString()}catch(e){}return r?o(z||(z=V` <x-category-restrictions-page-item data-testclass="item" item-category="${0}" gift-card="${0}" class="h-l" group="${0}" href="${0}" ?disabled="${0}" ?readonly="${0}"> ${0} </x-category-restrictions-page-item> `),i._links.self.href,this.giftCard,this.group,r,!this.in("idle")||this.disabled,this.readonly,null==i?void 0:i.name):o(O||(O=V`<div class="h-l"></div>`))})),g({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(r=customElements.get("foxy-spinner"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"")}}const N=["aed","afn","all","amd","ang","aoa","ars","aud","awg","azn","bam","bbd","bdt","bgn","bhd","bif","bmd","bnd","bob","brl","bsd","btc","btn","bwp","byn","bzd","cad","cdf","chf","clf","clp","cnh","cny","cop","crc","cuc","cup","cve","czk","djf","dkk","dop","dzd","egp","ern","etb","eur","fjd","fkp","gbp","gel","ggp","ghs","gip","gmd","gnf","gtq","gyd","hkd","hnl","hrk","htg","huf","idr","ils","imp","inr","iqd","irr","isk","jep","jmd","jod","jpy","kes","kgs","khr","kmf","kpw","krw","kwd","kyd","kzt","lak","lbp","lkr","lrd","lsl","lyd","mad","mdl","mga","mkd","mmk","mnt","mop","mru","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","omr","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rub","rwf","sar","sbd","scr","sdg","sek","sgd","shp","sll","sos","srd","ssp","std","stn","svc","syp","szl","thb","tjs","tmt","tnd","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vef","ves","vnd","vuv","wst","xaf","xag","xau","xcd","xdr","xof","xpd","xpf","xpt","yer","zar","zmw","zwl"];let D,P,B,G,L,Q,U,I,J,W,A,M,F,H,K,X,Y,Z,ee,te,ie,re=e=>e;const se=r(s(d(i(a(c,"gift-card-form")))));class ae extends se{constructor(){super(...arguments),this.__codesTableColumns=[{header:e=>o(D||(D=re`<foxy-i18n lang="${0}" key="code" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{const t=!this.in("idle")||this.disabledSelector.matches("codes",!0);return o(P||(P=re` <div class="flex items-center gap-xs"> <vaadin-button theme="tertiary-inline contrast" class="p-0" ?disabled="${0}" @click="${0}"> <span class="font-tnum">${0}</span> </vaadin-button> <foxy-copy-to-clipboard ?disabled="${0}" text="${0}" lang="${0}" ns="${0} copy-to-clipboard"> </foxy-copy-to-clipboard> </div> `),t,(t=>{const i=this.renderRoot.querySelector("#code-dialog"),r=t.currentTarget;i.href=e.data._links.self.href,i.show(r)}),e.data.code,t,e.data.code,e.lang,e.ns)}},{header:e=>o(B||(B=re`<foxy-i18n lang="${0}" key="date_created" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>o(G||(G=re` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.date_created}),e.lang,e.ns)},{hideBelow:"sm",header:e=>o(L||(L=re`<foxy-i18n lang="${0}" key="end_date" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>o(Q||(Q=re` <foxy-i18n options="${0}" class="text-tertiary" lang="${0}" key="date" ns="${0}"> </foxy-i18n> `),JSON.stringify({value:e.data.end_date}),e.lang,e.ns)},{header:e=>o(U||(U=re`<foxy-i18n lang="${0}" key="current_balance" ns="${0}"></foxy-i18n>`),e.lang,e.ns),cell:e=>{var t;return o(I||(I=re` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:`${e.data.current_balance} ${null===(t=this.data)||void 0===t?void 0:t.currency_code}`,currencyDisplay:this.__currencyDisplay}),e.lang,e.ns)}}],this.__codesTableQuery=null,this.__currencyDisplay="",this.__itemCategories=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"vaadin-button":customElements.get("vaadin-button"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-gift-card-form-provisioning-control":customElements.get("foxy-internal-gift-card-form-provisioning-control"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-query-builder":customElements.get("foxy-query-builder"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"foxy-pagination":customElements.get("foxy-pagination"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"x-category-restrictions-page":R,"x-frequency-input":u,"x-property-table":p,"x-editable-list":f,"x-group":h}}static get properties(){return n(n({},super.properties),{},{__codesTableQuery:{attribute:!1},__itemCategories:{attribute:!1}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=50||"name_too_long",e=>{var t;if(null===(t=e.provisioning_config)||void 0===t?void 0:t.allow_autoprovisioning){if(!e.sku)return"sku:v8n_required";if(e.sku.length>200)return"sku:v8n_too_long"}return!0},e=>{var t;const i=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_min;return!("number"==typeof i&&i<=0)||"min-balance:v8n_negative"},e=>{var t;const i=null===(t=e.provisioning_config)||void 0===t?void 0:t.initial_balance_max;return!("number"==typeof i&&i<=0)||"max-balance:v8n_negative"}]}render(){var e,t;const i=this.hiddenSelector,r=i.matches("name",!0),s=i.matches("currency",!0),a=i.matches("expires",!0);return o(J||(J=re` <div class="relative space-y-l"> ${0} <foxy-internal-gift-card-form-provisioning-control infer="provisioning"> </foxy-internal-gift-card-form-provisioning-control> ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),r&&s&&a?"":o(W||(W=re` <div class="grid grid-cols-1 sm-grid-cols-3 md-grid-cols-4 gap-m"> ${0} ${0} ${0} </div> `),r?"":o(A||(A=re`<div class="md-col-span-2">${0}</div>`),this.__renderName()),s?"":this.__renderCurrency(),a?"":this.__renderExpires()),i.matches("codes",!0)||!this.data?"":this.__renderCodes(),i.matches("product-restrictions",!0)?"":this.__renderProductRestrictions(),i.matches("category-restrictions",!0)||!this.data?"":this.__renderCategoryRestrictions(),i.matches("timestamps",!0)?"":this.__renderTimestamps(),i.matches("create",!0)||this.data?"":this.__renderCreate(),i.matches("delete",!0)||!this.data?"":this.__renderDelete(),g({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!this.in("busy")&&!this.in("fail")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}async _sendGet(){const e=await super._sendGet(),t=await super._fetch(e._links["fx:store"].href),i=new URL(t._links["fx:item_categories"].href);return i.searchParams.set("limit","5"),this.__currencyDisplay=t.use_international_currency_symbol?"code":"symbol",this.__itemCategories=i.toString(),e}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){var e;return o(M||(M=re` <div> ${0} <vaadin-text-field error-message="${0}" helper-text="${0}" data-testid="name" class="w-full" label="${0}" .checkValidity="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.__getErrorMessage("name"),this.t("gift_card_name_helper_text"),this.t("name"),this.__getValidator("name"),null!==(e=this.form.name)&&void 0!==e?e:"",!this.in("idle")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderCurrency(){var e,t;return o(F||(F=re` <div> ${0} <vaadin-combo-box item-label-path="label" item-value-path="value" item-id-path="value" data-testid="currency" class="w-full" label="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("currency:before"),this.t("currency"),!this.in("idle")||this.disabledSelector.matches("currency",!0),this.readonlySelector.matches("currency",!0),null!==(t=null===(e=this.form.currency_code)||void 0===e?void 0:e.toLowerCase())&&void 0!==t?t:"",N.map((e=>({label:`${this.t(`currency_${e}`)} (${e.toUpperCase()})`,value:e}))),(e=>{const t=e.currentTarget;this.edit({currency_code:t.value})}),this.renderTemplateOrSlot("currency:after"))}__renderExpires(){var e;return o(H||(H=re` <div> ${0} <x-frequency-input placeholder="${0}" data-testid="expires" label="${0}" class="w-full" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .value="${0}" @change="${0}"> </x-frequency-input> ${0} </div> `),this.renderTemplateOrSlot("expires:before"),this.t("select"),this.t("expires_after"),this.lang,this.ns,!this.in("idle")||this.disabledSelector.matches("expires",!0),this.readonlySelector.matches("expires",!0),null!==(e=this.form.expires_after)&&void 0!==e?e:"",(e=>{const t=e.currentTarget;this.edit({expires_after:t.value})}),this.renderTemplateOrSlot("expires:after"))}__renderCodes(){var e,t,i,r,s;const{disabledSelector:a,readonlySelector:n,hiddenSelector:l,group:d,data:c,lang:m,ns:g}=this,f=!this.in("idle")||a.matches("codes",!0),u=this.__codesTableQuery,h=new URL(c._links["fx:gift_card_codes"].href);new URLSearchParams(null!=u?u:"").forEach(((e,t)=>h.searchParams.set(t,e))),h.searchParams.set("limit","5");const p=null===u?"filter":"clear_filters",y="icons:"+(null===u?"filter-list":"clear");return o(K||(K=re` <div data-testid="codes"> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="generate" parent="${0}" group="${0}" lang="${0}" form="foxy-generate-codes-form" ns="${0}" id="generate-codes-dialog" alert .related="${0}"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="${0}" header="code" parent="${0}" group="${0}" lang="${0}" form="foxy-gift-card-code-form" ns="${0}" id="code-dialog"> </foxy-form-dialog> <foxy-form-dialog disabledcontrols="${0}" readonlycontrols="${0}" hiddencontrols="save-button ${0}" header="import" parent="${0}" group="${0}" lang="${0}" form="foxy-gift-card-codes-form" ns="${0}" id="import-dialog"> </foxy-form-dialog> ${0} <div class="flex items-center justify-between mb-xs space-x-s"> <foxy-i18n class="text-s font-medium text-secondary leading-none flex-1" lang="${0}" key="code_plural" ns="${0}"> </foxy-i18n> <vaadin-button data-testid="codes:generate-button" theme="success tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="generate" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:add"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:import-button" theme="contrast tertiary small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="import" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="icons:open-in-browser"></iron-icon> </vaadin-button> <vaadin-button data-testid="codes:filter-button" theme="contrast ${0} small" ?disabled="${0}" @click="${0}"> <foxy-i18n class="text-s" lang="${0}" key="${0}" ns="${0}"></foxy-i18n> <iron-icon class="icon-inline text-s" icon="${0}"></iron-icon> </vaadin-button> </div> <foxy-query-builder class="my-s" lang="${0}" ns="${0} ${0}" ?disabled="${0}" ?hidden="${0}" .options="${0}" .value="${0}" @change="${0}"> </foxy-query-builder> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-table class="px-m mb-s border border-contrast-10 rounded" group="${0}" lang="${0}" ns="${0}" .columns="${0}"> </foxy-table> </foxy-pagination> ${0} </div> `),a.zoom("codes:generate:form").toString(),n.zoom("codes:generate:form").toString(),l.zoom("codes:generate:form").toString(),null!==(e=null==c?void 0:c._links["fx:generate_codes"].href)&&void 0!==e?e:"",d,m,g,[h.toString()],a.zoom("codes:form").toString(),n.zoom("codes:form").toString(),l.zoom("codes:form").toString(),h.toString(),d,m,g,a.zoom("codes:import:form").toString(),n.zoom("codes:import:form").toString(),l.zoom("codes:import:form").toString(),c._links["fx:gift_card_codes"].href,d,m,g,this.renderTemplateOrSlot("codes:before"),m,g,f,(e=>{const t=this.renderRoot.querySelector("#generate-codes-dialog"),i=e.currentTarget;null==t||t.show(i)}),m,g,f,(e=>{const t=this.renderRoot.querySelector("#import-dialog"),i=e.currentTarget;null==t||t.show(i)}),m,g,null===u?"tertiary":"",f,(()=>this.__codesTableQuery=null===u?"":null),m,p,g,y,m,g,null!==(i=null===(t=customElements.get("foxy-query-builder"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",f,null===u,ae.__codesQueryOptions,null!=u?u:"",(e=>{const t=e.currentTarget;this.__codesTableQuery=t.value}),h.toString(),m,g,null!==(s=null===(r=customElements.get("foxy-pagination"))||void 0===r?void 0:r.defaultNS)&&void 0!==s?s:"",f,d,m,g,this.__codesTableColumns,this.renderTemplateOrSlot("codes:after"))}__renderProductRestrictions(){var e;const t="product-restrictions",i=!this.in("idle")||this.disabledSelector.matches(t,!0),r=this.readonlySelector.matches(t,!0),s=null!==(e=this.form.product_code_restrictions)&&void 0!==e?e:"",a=[{header:"allow",items:[]},{header:"block",items:[]}];return s&&s.split(",").forEach((e=>{const t=e.startsWith("-"),i=t?1:0,r=t?e.substring(1):e;a[i].items.push({label:r,value:e})})),o(X||(X=re` <div data-testid="product-restrictions"> ${0} <div class="space-y-s"> <x-group frame> <foxy-i18n class="${0}" slot="header" lang="${0}" key="product_restrictions" ns="${0}"> </foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> ${0} </div> </x-group> <foxy-i18n class="${0}" lang="${0}" key="gift_card_product_restrictions_explainer" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot("product-restrictions:before"),i?"text-disabled":"text-secondary",this.lang,this.ns,a.map(((e,t)=>o(Y||(Y=re` <x-group class="bg-base pt-m"> <foxy-i18n class="${0}" slot="header" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> <x-editable-list data-testid="product-restrictions:${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" .items="${0}" @change="${0}"> </x-editable-list> </x-group> `),i?"text-disabled":"text-tertiary",this.lang,e.header,this.ns,e.header,this.lang,this.ns,i,r,e.items,(e=>{const i=[0===t?e.currentTarget.items:a[0].items,1===t?e.currentTarget.items:a[1].items].map((e=>e.map((e=>e.value.replace(/^[\s-]*/,"").trimEnd())))).map((e=>e.filter((e=>!!e)))).map((e=>Array.from(new Set(e)))),r=i[0].concat(i[1].map((e=>`-${e}`))).join(",");this.edit({product_code_restrictions:r})})))),g({"block text-xs leading-s transition-colors":!0,"text-secondary":!i,"text-disabled":i}),this.lang,this.ns,this.renderTemplateOrSlot("product-restrictions:after"))}__renderCategoryRestrictions(){var e,t,i;const r="category-restrictions",s=!this.in("idle")||this.disabledSelector.matches(r,!0),a=this.readonlySelector.matches(r,!0),n=null===(e=this.data)||void 0===e?void 0:e._links["fx:gift_card_item_categories"].href;return o(Z||(Z=re` <div data-testid="category-restrictions"> ${0} <div class="space-y-xs"> <foxy-pagination first="${0}" lang="${0}" ns="${0} ${0}" ?disabled="${0}"> <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" lang="${0}" key="category_restrictions" ns="${0}"> </foxy-i18n> <x-category-restrictions-page gift-card-item-categories="${0}" data-testid="category-restrictions:page" gift-card="${0}" class="border border-contrast-10 rounded mb-s" group="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}"> </x-category-restrictions-page> </foxy-pagination> <foxy-i18n class="block text-xs leading-s text-secondary" lang="${0}" key="gift_card_category_restrictions_helper_text" ns="${0}"> </foxy-i18n> </div> ${0} </div> `),this.renderTemplateOrSlot(`${r}:before`),this.__itemCategories,this.lang,this.ns,null!==(i=null===(t=customElements.get("foxy-pagination"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"",s,this.lang,this.ns,m(n),this.href,this.group,this.lang,this.ns,s,a,this.lang,this.ns,this.renderTemplateOrSlot(`${r}:after`))}__renderTimestamps(){return o(ee||(ee=re` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),s=e||t||(i||r),a=this.in("busy");return o(te||(te=re` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),a||s||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return o(ie||(ie=re` <div> <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button data-testid="delete" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}ae.__codesQueryOptions=[{label:"code",path:"code",type:e.String},{label:"current_balance",path:"current_balance",type:e.Number},{label:"end_date",path:"end_date",type:e.Date},{label:"date_created",path:"date_created",type:e.Date},{label:"date_modified",path:"date_modified",type:e.Date}],customElements.define("foxy-gift-card-form",ae);export{ae as GiftCardForm};
@@ -1 +1 @@
1
- import"./shared-274c49b0.js";import"./shared-45926e43.js";import"./shared-3dbe9aaa.js";import"./shared-8f8abcd6.js";import{I as t}from"./shared-8c11a711.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-coupon-card.js";import"./shared-c8f5c306.js";import{I as e}from"./shared-a01b5597.js";import"./foxy-discount-builder.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import"./shared-81f9dc9a.js";import"./shared-ca87cf22.js";import{_ as i}from"./shared-a8ced8bf.js";import{s as n}from"./shared-bc7f58ef.js";import{p as s}from"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import{a}from"./shared-2cc638ad.js";import"./shared-bd252323.js";import"./shared-5ea18e60.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-62c088b7.js";import"./shared-2092d86f.js";import"./shared-7097364f.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-67546e10.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-pagination.js";import"./shared-bc814810.js";import"./shared-4e709717.js";import"./shared-e262920d.js";import"./shared-0479553e.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./shared-1433fc29.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./shared-ed0dee03.js";import"./shared-5a4829e3.js";import"./shared-be99323d.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-f621ccee.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./shared-e6f3e9f0.js";import"./shared-5c804971.js";import"./shared-a29b600a.js";import"./foxy-swipe-actions.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-94fc438b.js";import"./shared-38b37888.js";import"./shared-75e78c70.js";let l,c=t=>t;customElements.define("foxy-internal-item-form-line-item-discount-control",class extends e{constructor(){super(...arguments),this.infer="line-item-discount"}renderControl(){var t,e,i,n,s;return o(l||(l=c` <foxy-internal-details summary="title" infer=""> <div class="space-y-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="coupon" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="discount-name"></foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.coupons)&&void 0!==e?e:void 0),(t=>{var e;t.preventDefault();const r=t.detail;null===(e=this.nucleon)||void 0===e||e.edit({discount_name:r.name,discount_type:r.coupon_discount_type,discount_details:r.coupon_discount_details})}),{type:null===(i=this.nucleon)||void 0===i?void 0:i.form.discount_type,name:null===(n=this.nucleon)||void 0===n?void 0:n.form.discount_name,details:null===(s=this.nucleon)||void 0===s?void 0:s.form.discount_details},(t=>{var e;const r=t.currentTarget.parsedValue;null===(e=this.nucleon)||void 0===e||e.edit({discount_name:r.name,discount_type:r.type,discount_details:r.details})}))}});let d,f=t=>t;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format=null}static get properties(){return i(i({},super.properties),{},{format:{type:String}})}renderControl(){var t;let e;return e="unix"===this.format?n(new Date(1e3*(null!==(t=this._value)&&void 0!==t?t:0))):this._value,o(d||(d=f` <vaadin-date-picker error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),r(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,e,(t=>{var e;return"Enter"===t.key&&(null===(e=this.nucleon)||void 0===e?void 0:e.submit())}),(t=>{var e,r;const o=t.currentTarget;"unix"===this.format?this._value=Math.floor((null!==(r=null===(e=s(o.value))||void 0===e?void 0:e.getTime())&&void 0!==r?r:0)/1e3):this._value=o.value}))}});let m,p,u,y=t=>t;customElements.define("foxy-internal-item-form-subscription-control",class extends e{constructor(){super(...arguments),this.infer="subscription"}renderControl(){var t,e,r,i,n;let s;try{const o=null!==(i=null===(r=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links)["fx:subscription"])||void 0===r?void 0:r.href)&&void 0!==i?i:"",n=new URL(o);n.searchParams.set("zoom","last_transaction,transaction_template:items"),s=n.toString()}catch(t){s=null}return o(m||(m=y` <foxy-internal-details summary="title" infer=""> ${0} </foxy-internal-details> `),s?o(p||(p=y` <foxy-form-dialog header="update" infer="form" href="${0}" form="foxy-subscription-form" .related="${0}"> </foxy-form-dialog> <button ?disabled="${0}" @click="${0}"> <foxy-subscription-card class="p-m" infer="card" href="${0}"> </foxy-subscription-card> </button> `),s,(null===(n=this.nucleon)||void 0===n?void 0:n.href)?[this.nucleon.href]:[],this.disabled,(t=>{const e=t.currentTarget;e.previousElementSibling.show(e)}),s):o(u||(u=y` <div class="space-y-m p-m"> <foxy-internal-frequency-control infer="frequency" property="subscription_frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control infer="start" property="subscription_start_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="end" property="subscription_end_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="next" property="subscription_next_transaction_date"> </foxy-internal-date-control> </div> `)))}});let h,x=t=>t;customElements.define("foxy-internal-item-form-inventory-control",class extends e{constructor(){super(...arguments),this.infer="inventory"}renderControl(){var t,e;return o(h||(h=x` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" property="item_category_uri" first="${0}" class="col-span-2" infer="category"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-text-control infer="parent-code"></foxy-internal-text-control> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.itemCategories)&&void 0!==e?e:void 0))}});let b,v=t=>t;customElements.define("foxy-internal-item-form-shipping-control",class extends e{constructor(){super(...arguments),this.infer="shipping"}renderControl(){var t,e;return o(b||(b=v` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="address_name" item-label-path="address_name" first="${0}" class="col-span-2" infer="shipto"> </foxy-internal-async-combo-box-control> <foxy-internal-integer-control infer="width"></foxy-internal-integer-control> <foxy-internal-integer-control infer="height"></foxy-internal-integer-control> <foxy-internal-integer-control infer="length"></foxy-internal-integer-control> <foxy-internal-integer-control infer="weight"></foxy-internal-integer-control> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.customerAddresses)&&void 0!==e?e:void 0))}});let _,j=t=>t;customElements.define("foxy-internal-item-form-cart-control",class extends e{constructor(){super(...arguments),this.infer="cart"}renderControl(){return o(_||(_=j` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-date-control class="col-span-2" infer="expires" format="unix"> </foxy-internal-date-control> <foxy-internal-text-control class="col-span-2" infer="url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="image"></foxy-internal-text-control> <foxy-internal-integer-control infer="quantity-min"></foxy-internal-integer-control> <foxy-internal-integer-control infer="quantity-max"></foxy-internal-integer-control> </div> </foxy-internal-details> `))}});let g,k,$=t=>t;class w extends(a(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.__itemsLink=""}static get properties(){return i(i({},super.properties),{},{customerAddresses:{type:String,attribute:"customer-addresses"},itemCategories:{type:String,attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{type:String}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}renderBody(){var t;return o(g||(g=$` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <div class="grid grid-cols-2 gap-m"> <foxy-internal-number-control infer="price"></foxy-internal-number-control> <foxy-internal-integer-control infer="quantity"></foxy-internal-integer-control> </div> <foxy-internal-item-form-subscription-control></foxy-internal-item-form-subscription-control> <foxy-internal-item-form-line-item-discount-control></foxy-internal-item-form-line-item-discount-control> <foxy-internal-item-form-cart-control></foxy-internal-item-form-cart-control> <foxy-internal-item-form-shipping-control></foxy-internal-item-form-shipping-control> <foxy-internal-item-form-inventory-control></foxy-internal-item-form-inventory-control> ${0} ${0} `),this.data?o(k||(k=$` <foxy-internal-async-details-control infer="discount-details" first="${0}" limit="5" item="foxy-discount-detail-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="coupon-details" first="${0}" limit="5" item="foxy-coupon-detail-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="item-options" first="${0}" limit="5" form="foxy-item-option-form" item="foxy-item-option-card" .related="${0}" .props="${0}"> </foxy-internal-async-details-control> `),this.data._links["fx:discount_details"].href,this.data._links["fx:coupon_details"].href,this.data._links["fx:attributes"].href,this.data._links["fx:item_options"].href,this.__itemOptionRelatedUrls,{"locale-codes":null!==(t=this.localeCodes)&&void 0!==t?t:""}):"",super.renderBody())}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const e=t._links["fx:subscription"].href,r=(await super._fetch(e))._links["fx:transaction_template"].href,o=await super._fetch(r);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const e=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=e._links["fx:items"].href,t}if(t._links["fx:cart"]){const e=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=e._links["fx:items"].href,t}return t}get __itemOptionRelatedUrls(){var t,e;const r=null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{},o=[];return r["fx:subscription"]&&o.push(r["fx:subscription"].href),r["fx:transaction"]&&o.push(r["fx:transaction"].href),r["fx:shipment"]&&o.push(r["fx:shipment"].href),r["fx:cart"]&&o.push(r["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}}customElements.define("foxy-item-form",w);export{w as ItemForm};
1
+ import"./shared-274c49b0.js";import"./shared-45926e43.js";import"./shared-3dbe9aaa.js";import"./shared-8f8abcd6.js";import{I as t}from"./shared-8c11a711.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-coupon-card.js";import"./shared-c8f5c306.js";import{I as e}from"./shared-a01b5597.js";import"./foxy-discount-builder.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import"./shared-81f9dc9a.js";import"./shared-31aeab75.js";import{_ as i}from"./shared-a8ced8bf.js";import{s as n}from"./shared-bc7f58ef.js";import{p as s}from"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import{a}from"./shared-2cc638ad.js";import"./shared-bd252323.js";import"./shared-5ea18e60.js";import"./shared-0ce006b9.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-62c088b7.js";import"./shared-2092d86f.js";import"./shared-7097364f.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-67546e10.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-pagination.js";import"./shared-bc814810.js";import"./shared-4e709717.js";import"./shared-e262920d.js";import"./shared-0479553e.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./shared-1433fc29.js";import"./shared-62d636b5.js";import"./foxy-nucleon-element.js";import"./shared-ed0dee03.js";import"./shared-5a4829e3.js";import"./shared-2d1ef71c.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-2adb2ad2.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./shared-e6f3e9f0.js";import"./shared-5c804971.js";import"./shared-a29b600a.js";import"./foxy-swipe-actions.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./foxy-item-card.js";import"./shared-94fc438b.js";import"./shared-38b37888.js";import"./shared-75e78c70.js";let l,c=t=>t;customElements.define("foxy-internal-item-form-line-item-discount-control",class extends e{constructor(){super(...arguments),this.infer="line-item-discount"}renderControl(){var t,e,i,n,s;return o(l||(l=c` <foxy-internal-details summary="title" infer=""> <div class="space-y-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" first="${0}" infer="coupon" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="discount-name"></foxy-internal-text-control> <foxy-discount-builder infer="discount-builder" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.coupons)&&void 0!==e?e:void 0),(t=>{var e;t.preventDefault();const r=t.detail;null===(e=this.nucleon)||void 0===e||e.edit({discount_name:r.name,discount_type:r.coupon_discount_type,discount_details:r.coupon_discount_details})}),{type:null===(i=this.nucleon)||void 0===i?void 0:i.form.discount_type,name:null===(n=this.nucleon)||void 0===n?void 0:n.form.discount_name,details:null===(s=this.nucleon)||void 0===s?void 0:s.form.discount_details},(t=>{var e;const r=t.currentTarget.parsedValue;null===(e=this.nucleon)||void 0===e||e.edit({discount_name:r.name,discount_type:r.type,discount_details:r.details})}))}});let d,f=t=>t;customElements.define("foxy-internal-date-control",class extends e{constructor(){super(...arguments),this.format=null}static get properties(){return i(i({},super.properties),{},{format:{type:String}})}renderControl(){var t;let e;return e="unix"===this.format?n(new Date(1e3*(null!==(t=this._value)&&void 0!==t?t:0))):this._value,o(d||(d=f` <vaadin-date-picker error-message="${0}" placeholder="${0}" helper-text="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @change="${0}"> </vaadin-date-picker> `),r(this._errorMessage),this.placeholder,this.helperText,this.label,this.disabled,this.readonly,this._checkValidity,e,(t=>{var e;return"Enter"===t.key&&(null===(e=this.nucleon)||void 0===e?void 0:e.submit())}),(t=>{var e,r;const o=t.currentTarget;"unix"===this.format?this._value=Math.floor((null!==(r=null===(e=s(o.value))||void 0===e?void 0:e.getTime())&&void 0!==r?r:0)/1e3):this._value=o.value}))}});let m,p,u,y=t=>t;customElements.define("foxy-internal-item-form-subscription-control",class extends e{constructor(){super(...arguments),this.infer="subscription"}renderControl(){var t,e,r,i,n;let s;try{const o=null!==(i=null===(r=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links)["fx:subscription"])||void 0===r?void 0:r.href)&&void 0!==i?i:"",n=new URL(o);n.searchParams.set("zoom","last_transaction,transaction_template:items"),s=n.toString()}catch(t){s=null}return o(m||(m=y` <foxy-internal-details summary="title" infer=""> ${0} </foxy-internal-details> `),s?o(p||(p=y` <foxy-form-dialog header="update" infer="form" href="${0}" form="foxy-subscription-form" .related="${0}"> </foxy-form-dialog> <button ?disabled="${0}" @click="${0}"> <foxy-subscription-card class="p-m" infer="card" href="${0}"> </foxy-subscription-card> </button> `),s,(null===(n=this.nucleon)||void 0===n?void 0:n.href)?[this.nucleon.href]:[],this.disabled,(t=>{const e=t.currentTarget;e.previousElementSibling.show(e)}),s):o(u||(u=y` <div class="space-y-m p-m"> <foxy-internal-frequency-control infer="frequency" property="subscription_frequency"> </foxy-internal-frequency-control> <foxy-internal-date-control infer="start" property="subscription_start_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="end" property="subscription_end_date"> </foxy-internal-date-control> <foxy-internal-date-control infer="next" property="subscription_next_transaction_date"> </foxy-internal-date-control> </div> `)))}});let h,x=t=>t;customElements.define("foxy-internal-item-form-inventory-control",class extends e{constructor(){super(...arguments),this.infer="inventory"}renderControl(){var t,e;return o(h||(h=x` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="_links.self.href" item-label-path="name" property="item_category_uri" first="${0}" class="col-span-2" infer="category"> </foxy-internal-async-combo-box-control> <foxy-internal-text-control infer="code"></foxy-internal-text-control> <foxy-internal-text-control infer="parent-code"></foxy-internal-text-control> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.itemCategories)&&void 0!==e?e:void 0))}});let b,v=t=>t;customElements.define("foxy-internal-item-form-shipping-control",class extends e{constructor(){super(...arguments),this.infer="shipping"}renderControl(){var t,e;return o(b||(b=v` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-async-combo-box-control item-value-path="address_name" item-label-path="address_name" first="${0}" class="col-span-2" infer="shipto"> </foxy-internal-async-combo-box-control> <foxy-internal-integer-control infer="width"></foxy-internal-integer-control> <foxy-internal-integer-control infer="height"></foxy-internal-integer-control> <foxy-internal-integer-control infer="length"></foxy-internal-integer-control> <foxy-internal-integer-control infer="weight"></foxy-internal-integer-control> </div> </foxy-internal-details> `),r(null!==(e=null===(t=this.nucleon)||void 0===t?void 0:t.customerAddresses)&&void 0!==e?e:void 0))}});let _,j=t=>t;customElements.define("foxy-internal-item-form-cart-control",class extends e{constructor(){super(...arguments),this.infer="cart"}renderControl(){return o(_||(_=j` <foxy-internal-details summary="title" infer=""> <div class="grid grid-cols-2 gap-m p-m"> <foxy-internal-date-control class="col-span-2" infer="expires" format="unix"> </foxy-internal-date-control> <foxy-internal-text-control class="col-span-2" infer="url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="image"></foxy-internal-text-control> <foxy-internal-integer-control infer="quantity-min"></foxy-internal-integer-control> <foxy-internal-integer-control infer="quantity-max"></foxy-internal-integer-control> </div> </foxy-internal-details> `))}});let g,k,$=t=>t;class w extends(a(t,"item-form")){constructor(){super(...arguments),this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.coupons=null,this.__itemsLink=""}static get properties(){return i(i({},super.properties),{},{customerAddresses:{type:String,attribute:"customer-addresses"},itemCategories:{type:String,attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},coupons:{type:String}})}static get v8n(){return[({name:t})=>!!t||"name:v8n_required",({name:t})=>!!t&&t.length<=255||"name:v8n_too_long",({price:t})=>"number"==typeof t&&!isNaN(t)||"price:v8n_required",({price:t})=>"number"==typeof t&&t>=0||"price:v8n_negative",({quantity:t})=>"number"==typeof t&&t>=1||"quantity:v8n_less_than_one"]}renderBody(){var t;return o(g||(g=$` <foxy-internal-text-control infer="name"></foxy-internal-text-control> <div class="grid grid-cols-2 gap-m"> <foxy-internal-number-control infer="price"></foxy-internal-number-control> <foxy-internal-integer-control infer="quantity"></foxy-internal-integer-control> </div> <foxy-internal-item-form-subscription-control></foxy-internal-item-form-subscription-control> <foxy-internal-item-form-line-item-discount-control></foxy-internal-item-form-line-item-discount-control> <foxy-internal-item-form-cart-control></foxy-internal-item-form-cart-control> <foxy-internal-item-form-shipping-control></foxy-internal-item-form-shipping-control> <foxy-internal-item-form-inventory-control></foxy-internal-item-form-inventory-control> ${0} ${0} `),this.data?o(k||(k=$` <foxy-internal-async-details-control infer="discount-details" first="${0}" limit="5" item="foxy-discount-detail-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="coupon-details" first="${0}" limit="5" item="foxy-coupon-detail-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" item="foxy-attribute-card" form="foxy-attribute-form"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="item-options" first="${0}" limit="5" form="foxy-item-option-form" item="foxy-item-option-card" .related="${0}" .props="${0}"> </foxy-internal-async-details-control> `),this.data._links["fx:discount_details"].href,this.data._links["fx:coupon_details"].href,this.data._links["fx:attributes"].href,this.data._links["fx:item_options"].href,this.__itemOptionRelatedUrls,{"locale-codes":null!==(t=this.localeCodes)&&void 0!==t?t:""}):"",super.renderBody())}async _sendGet(){const t=await super._sendGet();if(t._links["fx:subscription"]){const e=t._links["fx:subscription"].href,r=(await super._fetch(e))._links["fx:transaction_template"].href,o=await super._fetch(r);return this.__itemsLink=o._links["fx:items"].href,t}if(t._links["fx:transaction"]){const e=await super._fetch(t._links["fx:transaction"].href);return this.__itemsLink=e._links["fx:items"].href,t}if(t._links["fx:cart"]){const e=await super._fetch(t._links["fx:cart"].href);return this.__itemsLink=e._links["fx:items"].href,t}return t}get __itemOptionRelatedUrls(){var t,e;const r=null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{},o=[];return r["fx:subscription"]&&o.push(r["fx:subscription"].href),r["fx:transaction"]&&o.push(r["fx:transaction"].href),r["fx:shipment"]&&o.push(r["fx:shipment"].href),r["fx:cart"]&&o.push(r["fx:cart"].href),this.__itemsLink&&o.push(this.__itemsLink),o}}customElements.define("foxy-item-form",w);export{w as ItemForm};
@@ -1 +1 @@
1
- import{_ as t}from"./shared-a8ced8bf.js";import"./shared-bc814810.js";import{L as e,c as i,h as s}from"./shared-7f33a83a.js";import{p as r}from"./shared-7097364f.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as a,S as n,x as o}from"./shared-2cc638ad.js";import"./shared-be99323d.js";import"./shared-9f905d9f.js";import{I as c,D as l}from"./shared-f621ccee.js";import{E as h}from"./shared-454f172e.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import"./shared-2092d86f.js";import{s as d}from"./shared-11c2efc8.js";import"./shared-0ce006b9.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-ed0dee03.js";import"./shared-e3ab56d1.js";import"./shared-955db6b4.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,E,I,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,c,l,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,c?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,l?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,e,t>102?s(E||(E=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(I||(I=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,j=t=>t;class L extends S{static get scopedElements(){return{"x-pic":f}}}class A extends S{static get scopedElements(){return{"x-pic":L}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":A}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=j`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=j`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class P extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends P{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":N,"x-i18n":c}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends P{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":l,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{R as Item,K as ItemsForm};
1
+ import{_ as t}from"./shared-a8ced8bf.js";import"./shared-bc814810.js";import{L as e,c as i,h as s}from"./shared-7f33a83a.js";import{p as r}from"./shared-7097364f.js";import"./shared-62c088b7.js";import"./shared-be66c2e7.js";import"./shared-5a4829e3.js";import{w as a,S as n,x as o}from"./shared-2cc638ad.js";import"./shared-2d1ef71c.js";import"./shared-9f905d9f.js";import{I as c,D as l}from"./shared-2adb2ad2.js";import{E as h}from"./shared-d8bb42a2.js";import"./shared-bd252323.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-5ea18e60.js";import"./shared-2092d86f.js";import{s as d}from"./shared-11c2efc8.js";import"./shared-0ce006b9.js";import"./shared-dcdb6ea1.js";import"./shared-4f037e43.js";import"./shared-ed0dee03.js";import"./shared-e3ab56d1.js";import"./shared-955db6b4.js";import"./shared-67546e10.js";import"./shared-d3bf9ac0.js";import"./shared-4e709717.js";import"./shared-404aa9cc.js";import"./shared-08e27fe9.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends e{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return t(t({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,E,I,$,C=t=>t;class S extends(n(e)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return t(t({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,c,l,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,c?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,l?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,e,t>102?s(E||(E=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(I||(I=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,j=t=>t;class L extends S{static get scopedElements(){return{"x-pic":f}}}class A extends S{static get scopedElements(){return{"x-pic":L}}}class N extends(n(e)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":A}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=j`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=j`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class P extends o{static get properties(){return t(t({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends P{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":N,"x-i18n":c}}static get properties(){return t(t({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends P{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":l,"x-item":R}}static get properties(){return t(t({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{R as Item,K as ItemsForm};
@@ -1,4 +1,4 @@
1
- import{C as e}from"./shared-4849ef5b.js";import{D as t,a as i}from"./shared-ca87cf22.js";import{C as a,b as s,a as n}from"./shared-6cb1015f.js";import{h as r,B as d,P as l}from"./shared-0ce006b9.js";import{T as o,E as h,C as m}from"./shared-be66c2e7.js";import{T as _}from"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-88c4cfec.js";import"./shared-bc814810.js";import"./shared-f621ccee.js";import"./shared-3d241b7f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{_ as c}from"./shared-a8ced8bf.js";import"./shared-62c088b7.js";import"./shared-5a4829e3.js";import{h as u,f as p}from"./shared-7f33a83a.js";import{S as g,R as v,T as f,a as b}from"./shared-2cc638ad.js";import{c as y}from"./shared-4e709717.js";import{C as k,a as T}from"./shared-be99323d.js";import"./shared-9f905d9f.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import{G as x}from"./shared-d8dc97f0.js";import{P as $}from"./shared-5378bd8c.js";import{C as D}from"./shared-67546e10.js";import{N as E}from"./shared-dc91f7ae.js";import{i as w}from"./shared-d3bf9ac0.js";import{l as S}from"./shared-f3b35364.js";import"./shared-08e27fe9.js";import"./shared-404aa9cc.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-ed0dee03.js";import"./shared-11c2efc8.js";import"./shared-e3ab56d1.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";
1
+ import{C as e}from"./shared-4849ef5b.js";import{D as t,a as i}from"./shared-31aeab75.js";import{C as a,b as s,a as n}from"./shared-6cb1015f.js";import{h as r,B as d,P as l}from"./shared-0ce006b9.js";import{T as o,E as h,C as m}from"./shared-be66c2e7.js";import{T as _}from"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-88c4cfec.js";import"./shared-bc814810.js";import"./shared-2adb2ad2.js";import"./shared-3d241b7f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{_ as c}from"./shared-a8ced8bf.js";import"./shared-62c088b7.js";import"./shared-5a4829e3.js";import{h as u,f as p}from"./shared-7f33a83a.js";import{S as g,R as v,T as f,a as b}from"./shared-2cc638ad.js";import{c as y}from"./shared-4e709717.js";import{C as k,a as T}from"./shared-2d1ef71c.js";import"./shared-9f905d9f.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import{G as x}from"./shared-d8dc97f0.js";import{P as $}from"./shared-5378bd8c.js";import{C as D}from"./shared-67546e10.js";import{N as E}from"./shared-dc91f7ae.js";import{i as w}from"./shared-d3bf9ac0.js";import{l as S}from"./shared-f3b35364.js";import"./shared-08e27fe9.js";import"./shared-404aa9cc.js";import"./shared-2092d86f.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-ed0dee03.js";import"./shared-11c2efc8.js";import"./shared-e3ab56d1.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2017 Vaadin Ltd.
@@ -1,4 +1,4 @@
1
- import"./foxy-address-card.js";import"./foxy-item-form.js";import"./foxy-item-card.js";import"./shared-7097364f.js";import"./shared-45926e43.js";import"./shared-94fc438b.js";import{_ as s}from"./shared-a8ced8bf.js";import{h as r}from"./shared-7f33a83a.js";import{i as e}from"./shared-d3bf9ac0.js";import{a as t}from"./shared-2cc638ad.js";import{B as i}from"./shared-dcdb6ea1.js";import{I as o}from"./shared-62d636b5.js";import{C as a}from"./shared-67546e10.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-4e709717.js";import"./shared-274c49b0.js";import"./shared-bd252323.js";import"./shared-5ea18e60.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-a01b5597.js";import"./shared-e262920d.js";import"./shared-3dbe9aaa.js";import"./shared-8f8abcd6.js";import"./shared-8c11a711.js";import"./shared-bc814810.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./foxy-discount-detail-card.js";import"./shared-1433fc29.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-nucleon-element.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-ed0dee03.js";import"./shared-5a4829e3.js";import"./shared-be99323d.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-f621ccee.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./foxy-coupon-card.js";import"./shared-c8f5c306.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-81f9dc9a.js";import"./shared-ca87cf22.js";import"./shared-bc7f58ef.js";import"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./shared-5c804971.js";import"./foxy-subscription-form.js";import"./shared-a29b600a.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./shared-38b37888.js";import"./shared-75e78c70.js";let d,c,m=s=>s;const p=a(t(o,"shipment-card"));class n extends p{constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return s(s({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new i(`address:not=full-address ${super.hiddenSelector.toString()}`)}get readonlySelector(){return this.__editable?super.readonlySelector:i.True}renderBody(){var s,t,i;let o;if(this.data)try{const s=new URL(this.data._links["fx:items"].href);s.searchParams.set("zoom","item_options"),o=s.toString()}catch(s){}return r(c||(c=m` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer=""> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-async-details-control infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-async-details-control> </div> `),e(null===(s=this.data)||void 0===s?void 0:s._links["fx:customer_address"].href),null===(t=this.data)||void 0===t?void 0:t.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),e(o),(({html:s,dialog:r,handleFetch:e,handleUpdate:t})=>s(d||(d=m`
1
+ import"./foxy-address-card.js";import"./foxy-item-form.js";import"./foxy-item-card.js";import"./shared-7097364f.js";import"./shared-45926e43.js";import"./shared-94fc438b.js";import{_ as s}from"./shared-a8ced8bf.js";import{h as r}from"./shared-7f33a83a.js";import{i as e}from"./shared-d3bf9ac0.js";import{a as t}from"./shared-2cc638ad.js";import{B as i}from"./shared-dcdb6ea1.js";import{I as o}from"./shared-62d636b5.js";import{C as a}from"./shared-67546e10.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-dc91f7ae.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";import"./shared-4e709717.js";import"./shared-274c49b0.js";import"./shared-bd252323.js";import"./shared-5ea18e60.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-7d4fb1a2.js";import"./shared-a01b5597.js";import"./shared-e262920d.js";import"./shared-3dbe9aaa.js";import"./shared-8f8abcd6.js";import"./shared-8c11a711.js";import"./shared-bc814810.js";import"./shared-3d241b7f.js";import"./shared-9f905d9f.js";import"./foxy-discount-detail-card.js";import"./shared-1433fc29.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-nucleon-element.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-ed0dee03.js";import"./shared-5a4829e3.js";import"./shared-2d1ef71c.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-2adb2ad2.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./foxy-coupon-card.js";import"./shared-c8f5c306.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-81f9dc9a.js";import"./shared-31aeab75.js";import"./shared-bc7f58ef.js";import"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./shared-5c804971.js";import"./foxy-subscription-form.js";import"./shared-a29b600a.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./shared-38b37888.js";import"./shared-75e78c70.js";let d,c,m=s=>s;const p=a(t(o,"shipment-card"));class n extends p{constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return s(s({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get hiddenSelector(){return new i(`address:not=full-address ${super.hiddenSelector.toString()}`)}get readonlySelector(){return this.__editable?super.readonlySelector:i.True}renderBody(){var s,t,i;let o;if(this.data)try{const s=new URL(this.data._links["fx:items"].href);s.searchParams.set("zoom","item_options"),o=s.toString()}catch(s){}return r(c||(c=m` <div class="space-y-m"> <foxy-address-card infer="address" href="${0}"> <div slot="full-address:after" class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} &bull; <foxy-i18n options="${0}" key="price" infer=""> </foxy-i18n> </span> </div> </foxy-address-card> <foxy-internal-async-details-control infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-async-details-control> </div> `),e(null===(s=this.data)||void 0===s?void 0:s._links["fx:customer_address"].href),null===(t=this.data)||void 0===t?void 0:t.shipping_service_description,JSON.stringify({amount:`${null===(i=this.data)||void 0===i?void 0:i.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),e(o),(({html:s,dialog:r,handleFetch:e,handleUpdate:t})=>s(d||(d=m`
2
2
  <foxy-item-form
3
3
  customer-addresses=${0}
4
4
  item-categories=${0}