@bunnyapp/components 1.8.0-beta.32 → 1.8.0-beta.34

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.
package/dist/cjs/index.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";var n=require("react/jsx-runtime"),e=require("react"),t=require("@ant-design/icons"),i=require("antd"),a=require("@tanstack/react-query"),o=require("graphql-request"),r=require("recoil"),s=require("graphql"),l=require("lodash-es"),u=require("@stripe/react-stripe-js"),d=require("@stripe/stripe-js/pure/index.js"),c=require("styled-components"),p=require("@fortawesome/free-solid-svg-icons"),m=require("@fortawesome/react-fontawesome"),y=require("interweave"),g=require("@pdf-viewer/react"),b=require("pluralize"),h=require("recharts");!function(n,e){void 0===e&&(e={});var t=e.insertAt;if(n&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=n:a.appendChild(document.createTextNode(n))}}(":root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n --bunny-blue-500: #3b82f6;\n --bunny-blue-200: #bfdbfe;\n --bunny-green-600: #059669;\n --bunny-green-200: #a7f3d0;\n --bunny-red-500: #ef4444;\n --bunny-red-200: #fecaca;\n --bunny-orange-500: #f97316;\n --bunny-orange-200: #fed7aa;\n --bunny-yellow-500: #f59e0b;\n --bunny-yellow-200: #fde68a;\n --bunny-purple-500: #8b5cf6;\n --bunny-purple-200: #ddd6fe;\n --bunny-black: #000000;\n}\n.bunny-component-wrapper {\n box-sizing: border-box;\n}\n.bunny-component-wrapper * {\n box-sizing: border-box;\n}\n.hidden {\n display: none;\n}\n.bunny-show-on-hover {\n opacity: 0;\n}\n.bunny-show-on-hover-container:hover .bunny-show-on-hover {\n opacity: 1;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n.bunny-icon-path {\n transition: fill 0.3s;\n}\n.bunny-shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.bunny-shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .bunny-shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .bunny-shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.bunny-shadow,\n.bunny-shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.bunny-fixed {\n position: fixed;\n}\n.bunny-absolute {\n position: absolute;\n}\n.bunny-relative {\n position: relative;\n}\n.bunny-sticky {\n position: sticky;\n}\n.bunny-bottom-0 {\n bottom: 0px;\n}\n.bunny-bottom-4 {\n bottom: 1rem;\n}\n.bunny-left-0 {\n left: 0px;\n}\n.bunny-right-0 {\n right: 0px;\n}\n.bunny-top-0 {\n top: 0px;\n}\n.bunny-col-span-1 {\n grid-column: span 1 / span 1;\n}\n.bunny-col-span-full {\n grid-column: 1 / -1;\n}\n.bunny-m-0 {\n margin: 0px;\n}\n.bunny-m-4 {\n margin: 1rem;\n}\n.-bunny-mx-4 {\n margin-left: -1rem;\n margin-right: -1rem;\n}\n.bunny-mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.bunny-mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.bunny-mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.bunny-my-0 {\n margin-top: 0px;\n margin-bottom: 0px;\n}\n.bunny-my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.bunny-my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.bunny-mb-2 {\n margin-bottom: 0.5rem;\n}\n.bunny-mb-3 {\n margin-bottom: 0.75rem;\n}\n.bunny-mb-4 {\n margin-bottom: 1rem;\n}\n.bunny-mb-8 {\n margin-bottom: 2rem;\n}\n.bunny-ml-auto {\n margin-left: auto;\n}\n.bunny-mt-0 {\n margin-top: 0px;\n}\n.bunny-mt-4 {\n margin-top: 1rem;\n}\n.bunny-mt-5 {\n margin-top: 1.25rem;\n}\n.bunny-box-border {\n box-sizing: border-box;\n}\n.bunny-flex {\n display: flex;\n}\n.bunny-grid {\n display: grid;\n}\n.bunny-contents {\n display: contents;\n}\n.bunny-h-0\\.5 {\n height: 0.125rem;\n}\n.bunny-h-1\\/2 {\n height: 50%;\n}\n.bunny-h-8 {\n height: 2rem;\n}\n.bunny-h-full {\n height: 100%;\n}\n.bunny-min-h-0 {\n min-height: 0px;\n}\n.bunny-min-h-screen {\n min-height: 100vh;\n}\n.bunny-w-0\\.5 {\n width: 0.125rem;\n}\n.bunny-w-1\\/2 {\n width: 50%;\n}\n.bunny-w-4\\/5 {\n width: 80%;\n}\n.bunny-w-full {\n width: 100%;\n}\n.bunny-min-w-0 {\n min-width: 0px;\n}\n.bunny-flex-1 {\n flex: 1 1 0%;\n}\n.bunny-flex-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-shrink {\n flex-shrink: 1;\n}\n.bunny-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-grow {\n flex-grow: 1;\n}\n.bunny-cursor-default {\n cursor: default;\n}\n.bunny-cursor-pointer {\n cursor: pointer;\n}\n.bunny-grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.bunny-grid-rows-\\[0fr\\] {\n grid-template-rows: 0fr;\n}\n.bunny-grid-rows-\\[1fr\\] {\n grid-template-rows: 1fr;\n}\n.bunny-flex-row {\n flex-direction: row;\n}\n.bunny-flex-col {\n flex-direction: column;\n}\n.bunny-flex-wrap {\n flex-wrap: wrap;\n}\n.bunny-items-start {\n align-items: flex-start;\n}\n.bunny-items-end {\n align-items: flex-end;\n}\n.bunny-items-center {\n align-items: center;\n}\n.bunny-justify-end {\n justify-content: flex-end;\n}\n.bunny-justify-center {\n justify-content: center;\n}\n.bunny-justify-between {\n justify-content: space-between;\n}\n.bunny-gap-0 {\n gap: 0px;\n}\n.bunny-gap-1 {\n gap: 0.25rem;\n}\n.bunny-gap-2 {\n gap: 0.5rem;\n}\n.bunny-gap-3 {\n gap: 0.75rem;\n}\n.bunny-gap-4 {\n gap: 1rem;\n}\n.bunny-gap-6 {\n gap: 1.5rem;\n}\n.bunny-gap-8 {\n gap: 2rem;\n}\n.bunny-space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.bunny-overflow-auto {\n overflow: auto;\n}\n.bunny-overflow-hidden {\n overflow: hidden;\n}\n.bunny-overflow-y-auto {\n overflow-y: auto;\n}\n.bunny-overflow-x-clip {\n overflow-x: clip;\n}\n.bunny-text-ellipsis {\n text-overflow: ellipsis;\n}\n.bunny-whitespace-nowrap {\n white-space: nowrap;\n}\n.bunny-text-nowrap {\n text-wrap: nowrap;\n}\n.bunny-rounded {\n border-radius: 0.25rem;\n}\n.bunny-rounded-full {\n border-radius: 9999px;\n}\n.bunny-rounded-lg {\n border-radius: 0.5rem;\n}\n.bunny-rounded-md {\n border-radius: 0.375rem;\n}\n.bunny-border {\n border-width: 1px;\n}\n.bunny-border-2 {\n border-width: 2px;\n}\n.bunny-border-t {\n border-top-width: 1px;\n}\n.bunny-border-solid {\n border-style: solid;\n}\n.bunny-border-none {\n border-style: none;\n}\n.bunny-border-gray-200 {\n --tw-border-opacity: 1;\n border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));\n}\n.bunny-border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.bunny-bg-gray-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-transparent {\n background-color: transparent;\n}\n.bunny-bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bunny-p-0 {\n padding: 0px;\n}\n.bunny-p-1 {\n padding: 0.25rem;\n}\n.bunny-p-2 {\n padding: 0.5rem;\n}\n.bunny-p-4 {\n padding: 1rem;\n}\n.bunny-px-12 {\n padding-left: 3rem;\n padding-right: 3rem;\n}\n.bunny-px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.bunny-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.bunny-px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.bunny-px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.bunny-py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.bunny-py-24 {\n padding-top: 6rem;\n padding-bottom: 6rem;\n}\n.bunny-py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.bunny-py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.bunny-pb-2 {\n padding-bottom: 0.5rem;\n}\n.bunny-pb-4 {\n padding-bottom: 1rem;\n}\n.bunny-pb-6 {\n padding-bottom: 1.5rem;\n}\n.bunny-pb-8 {\n padding-bottom: 2rem;\n}\n.bunny-pl-0 {\n padding-left: 0px;\n}\n.bunny-pl-1 {\n padding-left: 0.25rem;\n}\n.bunny-pl-4 {\n padding-left: 1rem;\n}\n.bunny-pr-4 {\n padding-right: 1rem;\n}\n.bunny-pt-0 {\n padding-top: 0px;\n}\n.bunny-pt-1 {\n padding-top: 0.25rem;\n}\n.bunny-pt-12 {\n padding-top: 3rem;\n}\n.bunny-pt-2 {\n padding-top: 0.5rem;\n}\n.bunny-pt-4 {\n padding-top: 1rem;\n}\n.bunny-pt-5 {\n padding-top: 1.25rem;\n}\n.bunny-pt-6 {\n padding-top: 1.5rem;\n}\n.bunny-pt-8 {\n padding-top: 2rem;\n}\n.bunny-text-left {\n text-align: left;\n}\n.bunny-text-center {\n text-align: center;\n}\n.bunny-text-right {\n text-align: right;\n}\n.bunny-text-start {\n text-align: start;\n}\n.bunny-text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.bunny-text-3xl {\n font-size: 1.875rem;\n line-height: 2.25rem;\n}\n.bunny-text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.bunny-text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.bunny-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-sm\\/5 {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.bunny-text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.bunny-text-xs\\/3 {\n font-size: 0.75rem;\n line-height: 0.75rem;\n}\n.bunny-font-bold {\n font-weight: 700;\n}\n.bunny-font-medium {\n font-weight: 500;\n}\n.bunny-font-normal {\n font-weight: 400;\n}\n.bunny-text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.bunny-text-neutral-400 {\n --tw-text-opacity: 1;\n color: rgb(163 163 163 / var(--tw-text-opacity, 1));\n}\n.bunny-text-neutral-500 {\n --tw-text-opacity: 1;\n color: rgb(115 115 115 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.bunny-text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.bunny-underline {\n text-decoration-line: underline;\n}\n.bunny-shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-transition-\\[grid-template-rows\\] {\n transition-property: grid-template-rows;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-duration-300 {\n transition-duration: 300ms;\n}\n.bunny-ease-in-out {\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n.truncated-text__inner * {\n display: inline;\n white-space: inherit;\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.sticky {\n position: sticky;\n}\n.-top-0\\.5 {\n top: -0.125rem;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-12 {\n width: 3rem;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.gap-8 {\n gap: 2rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-sm {\n border-radius: 0.125rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-b {\n border-bottom-width: 1px;\n}\n.border-t {\n border-top-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-none {\n border-style: none;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.duration-200 {\n transition-duration: 200ms;\n}\n.duration-300 {\n transition-duration: 300ms;\n}\n.hover\\:bg-gray-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n.hover\\:bunny-text-orange-400:hover {\n --tw-text-opacity: 1;\n color: rgb(251 146 60 / var(--tw-text-opacity, 1));\n}\n.bunny-components .ant-upload-select-picture-card {\n margin: 0 !important;\n}\n.bunny-components .ant-upload {\n border-radius: 0.5rem !important;\n}\n.bunny-components .ant-row {\n margin-bottom: 0px;\n}\n.bunny-components .ant-select-disabled .ant-select-selector .ant-select-selection-item {\n color: rgba(0, 0, 0, 0.25) !important;\n}\n.bunny-components .ant-input-number,\n.bunny-components .ant-input,\n.bunny-components .ant-picker,\n.bunny-components .ant-input-affix-wrapper,\n.bunny-components .ant-select-selector {\n font-size: 0.875rem !important;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n color: #232323 !important;\n}\n.bunny-components .ant-input-affix-wrapper {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n.bunny-components .ant-input-group-addon,\n.bunny-components .ant-input-number-group-addon {\n color: #475569 !important;\n}\n.bunny-components .ant-input-number-group-wrapper,\n.bunny-components .ant-input-number-affix-wrapper {\n width: 100%;\n}\n.bunny-components .ant-input-affix-wrapper input {\n border: none !important;\n}\n.bunny-components .ant-form-item {\n margin-bottom: 0;\n}\n.bunny-components .ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.bunny-components .ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.bunny-components .form .ant-form-item-label label {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n box-sizing: border-box;\n}\n.bunny-components .ant-form-item-explain,\n.bunny-components .ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.bunny-components .ant-timeline-item-content {\n font-size: smaller;\n}\n.bunny-components .ant-tree {\n font-size: 0.875rem;\n}\n.bunny-components .ant-tree-treenode {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-draggable-icon {\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-node-content-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-switcher {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-page-header {\n padding-left: 0;\n padding-right: 0;\n padding-top: 0;\n}\n.bunny-components .ant-tag {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 14px;\n font-weight: 500;\n white-space: nowrap;\n padding-inline-start: 0.625rem;\n padding-inline-end: 0.625rem;\n margin: 0;\n}\n.bunny-components .ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.bunny-components .ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.bunny-components .ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.bunny-components .ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.bunny-components .ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.bunny-components .ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.bunny-components .ant-tag-gray {\n color: #6b7280 !important;\n background: #e5e7eb !important;\n}\n.bunny-components .ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.bunny-components .ant-picker {\n width: 100%;\n}\n.bunny-components .ant-input,\n.bunny-components .ant-select,\n.bunny-components .ant-picker {\n height: 32px !important;\n}\n.bunny-components .ant-slider-dot {\n border: 2px solid #f0f0f0;\n}\n.bunny-components .ant-slider-dot-active {\n border-color: #ff5833;\n}\n.bunny-components .ant-slider-mark :last-child {\n transform: translateX(-75%) !important;\n}\n.bunny-components .ant-drawer-content {\n background: #f3f3f9ff;\n}\n.bunny-components .ant-drawer-body,\n.bunny-components .ant-layout {\n background: #f8fafc;\n}\n.bunny-components .vista-link {\n color: #1890ff;\n}\n.bunny-components .vista-link:hover {\n text-decoration: underline;\n cursor: pointer;\n}\n.bunny-components .ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.bunny-components .ant-popconfirm-message-text {\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-title {\n padding: 0;\n text-align: center;\n font-size: 0.875rem !important;\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n}\n.bunny-components .ant-popconfirm-buttons button {\n margin-inline-start: 0 !important;\n}\n.bunny-components .ant-pagination-item {\n display: flex !important;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.bunny-components .ant-btn {\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-weight: normal;\n}\n.bunny-components .ant-btn-default .ant-btn-icon {\n color: #94a3b8;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n.bunny-components .ant-btn-default:hover .ant-btn-icon {\n color: #ff7f5c;\n}\n.bunny-components .ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.bunny-components .ant-btn-primary:disabled {\n background-color: rgba(113, 125, 148, 0.1) !important;\n border-color: rgba(113, 125, 148, 0.1) !important;\n}\n.bunny-components .ant-btn-primary:hover:disabled,\n.bunny-components .ant-btn-primary:disabled {\n background-clip: padding-box;\n}\n.bunny-components .ant-select-arrow .anticon:not(.ant-select-suffix) {\n pointer-events: none;\n}\n.bunny-components .ant-dropdown-menu-items {\n padding-left: 0 !important;\n}\n.bunny-components .ant-dropdown-menu-item-active {\n background-color: transparent !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield input {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused {\n background: white !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield {\n background: #f8f8f8 !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield input {\n background: #f8f8f8 !important;\n}\n.bunny-components .ant-input-steps-hidden .ant-input-number-handler-wrap {\n display: none;\n}\n.bunny-components .ant-layout-header {\n height: 48px;\n}\n.bunny-components .ant-layout-sider-children {\n width: inherit;\n position: fixed;\n}\n.bunny-components .ant-menu-item-group-list {\n display: flex !important;\n flex-direction: column !important;\n align-items: flex-start !important;\n gap: 4px !important;\n}\n.bunny-components .group {\n display: flex;\n flex-direction: row;\n flex-flow: row wrap;\n box-sizing: border-box;\n}\n.bunny-components .select-datepicker {\n animation-duration: 0.35s !important;\n}\n.bunny-components .header-datepicker {\n top: 96px !important;\n animation-duration: 0s !important;\n}\n.bunny-components .ant-picker-header {\n border-bottom: none !important;\n}\n.bunny-components .ant-picker-content thead tr th {\n font-weight: 500;\n}\n.bunny-components .ant-picker-panel-container {\n border-radius: 0.375rem;\n}\n.bunny-components .ant-picker-cell-selected .custom-date-display {\n color: #ffffff;\n background-color: #ff5833;\n}\n.bunny-components .ant-picker-cell-today .custom-date-display {\n border: 1px solid #ff5833;\n}\n.bunny-components .ant-input-number {\n width: 100%;\n}\n.bunny-components .ant-input-number-focused {\n border-color: #ff5833 !important;\n background-color: #ffffff !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused,\n.bunny-components .ant-input-number-focused,\n.bunny-components .ant-picker,\n.bunny-components .ant-input,\n.bunny-components .ant-select-focused .ant-select-selector,\n.bunny-components .ant-select-selector:focus,\n.bunny-components .ant-select-selector:active,\n.bunny-components .ant-select-open .ant-select-selector {\n box-shadow: none !important;\n}\n.bunny-components .ant-select-item-option-selected .ant-select-item-option-state {\n display: none !important;\n}\n.bunny-components .ant-form * input[type='text'].ant-input:not(:disabled),\n.bunny-components .ant-select-selection-item:not(:disabled) {\n color: #232323;\n}\n.bunny-components .ant-tabs-ink-bar {\n display: none !important;\n}\n.bunny-components .ant-tabs-tab.ant-tabs-tab-active {\n border-bottom: 2px solid #ff5833 !important;\n}\n.bunny-components .ant-tabs-tab {\n border-bottom: 2px solid transparent !important;\n padding-bottom: 14px !important;\n}\n.bunny-components .ant-upload-wrapper {\n display: flex;\n}\n.bunny-components .ant-form-item-label > label::after {\n display: none !important;\n}\n.bunny-components .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n border-radius: 8px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n font-size: 14px !important;\n overflow-wrap: break-word;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff5833 !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff5833;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n:root {\n --bunny-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --bunny-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --bunny-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.bunny-signup {\n --bunny-signup-bg: #f8fafc;\n background-color: var(--bunny-signup-bg);\n}\n.bunny-billing-details {\n --bunny-billing-details-bg: var(--row-background);\n --bunny-billing-details-radius: 0.375rem;\n --bunny-billing-details-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n display: flex;\n flex-direction: column;\n background-color: var(--bunny-billing-details-bg);\n border-radius: var(--bunny-billing-details-radius);\n box-shadow: var(--bunny-billing-details-shadow);\n}\n.bunny-billing-details--dark {\n --bunny-billing-details-bg: var(--row-background-dark);\n}\n.bunny-feature-group {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 0;\n box-shadow: var(--bunny-shadow-md);\n overflow: hidden;\n}\n.bunny-plan-features-feature-title-group {\n color: #64748b;\n font-size: 0.75rem;\n font-weight: 500;\n}\n.bunny-plan-picker-grid-cell-divider {\n border-left: 1px solid #e2e8f0;\n}\n.bunny-price-list-card-price-description {\n color: #9ca3af;\n font-size: 0.875rem;\n}\n.bunny-plan-picker-price-list-cards {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 0;\n box-shadow: var(--bunny-shadow-md);\n overflow: hidden;\n}\n.bunny-plan-picker-checkout-bar {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 1rem;\n box-shadow: var(--bunny-shadow-md);\n}\n.bunny-invoice-container {\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type='text'],\n input[type='password'],\n input[type='datetime'],\n input[type='datetime-local'],\n input[type='date'],\n input[type='month'],\n input[type='time'],\n input[type='week'],\n input[type='number'],\n input[type='email'],\n input[type='url'],\n input[type='search'],\n input[type='tel'],\n input[type='color'] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n");const v="rgb(248 250 252)",f="rgb(226 232 240)",x="rgb(148 163 184)",C="rgb(100 116 139)",w="rgb(71 85 105)",j="rgb(229 231 235)",S="#ff6e1c",I=f,L=["READY","NOT_DUE","DUE","UNPAID"],P={MONTHLY:"month",QUARTERLY:"quarter",SEMI_ANNUAL:"six months",ANNUAL:"year"},k="DevAuthAsUser",N=f,F=S,D=[{value:"AF",label:"Afghanistan"},{value:"AL",label:"Albania"},{value:"DZ",label:"Algeria"},{value:"AS",label:"American Samoa"},{value:"AD",label:"Andorra"},{value:"AO",label:"Angola"},{value:"AI",label:"Anguilla"},{value:"AQ",label:"Antarctica"},{value:"AG",label:"Antigua and Barbuda"},{value:"AR",label:"Argentina"},{value:"AM",label:"Armenia"},{value:"AW",label:"Aruba"},{value:"AU",label:"Australia"},{value:"AT",label:"Austria"},{value:"AZ",label:"Azerbaijan"},{value:"BS",label:"Bahamas (the)"},{value:"BH",label:"Bahrain"},{value:"BD",label:"Bangladesh"},{value:"BB",label:"Barbados"},{value:"BY",label:"Belarus"},{value:"BE",label:"Belgium"},{value:"BZ",label:"Belize"},{value:"BJ",label:"Benin"},{value:"BM",label:"Bermuda"},{value:"BT",label:"Bhutan"},{value:"BO",label:"Bolivia (Plurinational State of)"},{value:"BQ",label:"Bonaire, Sint Eustatius and Saba"},{value:"BA",label:"Bosnia and Herzegovina"},{value:"BW",label:"Botswana"},{value:"BV",label:"Bouvet Island"},{value:"BR",label:"Brazil"},{value:"IO",label:"British Indian Ocean Territory (the)"},{value:"BN",label:"Brunei Darussalam"},{value:"BG",label:"Bulgaria"},{value:"BF",label:"Burkina Faso"},{value:"BI",label:"Burundi"},{value:"CV",label:"Cabo Verde"},{value:"KH",label:"Cambodia"},{value:"CM",label:"Cameroon"},{value:"CA",label:"Canada"},{value:"KY",label:"Cayman Islands (the)"},{value:"CF",label:"Central African Republic (the)"},{value:"TD",label:"Chad"},{value:"CL",label:"Chile"},{value:"CN",label:"China"},{value:"CX",label:"Christmas Island"},{value:"CC",label:"Cocos (Keeling) Islands (the)"},{value:"CO",label:"Colombia"},{value:"KM",label:"Comoros (the)"},{value:"CD",label:"Congo (the Democratic Republic of the)"},{value:"CG",label:"Congo (the)"},{value:"CK",label:"Cook Islands (the)"},{value:"CR",label:"Costa Rica"},{value:"HR",label:"Croatia"},{value:"CU",label:"Cuba"},{value:"CW",label:"Curaçao"},{value:"CY",label:"Cyprus"},{value:"CZ",label:"Czechia"},{value:"CI",label:"Côte d'Ivoire"},{value:"DK",label:"Denmark"},{value:"DJ",label:"Djibouti"},{value:"DM",label:"Dominica"},{value:"DO",label:"Dominican Republic (the)"},{value:"EC",label:"Ecuador"},{value:"EG",label:"Egypt"},{value:"SV",label:"El Salvador"},{value:"GQ",label:"Equatorial Guinea"},{value:"ER",label:"Eritrea"},{value:"EE",label:"Estonia"},{value:"SZ",label:"Eswatini"},{value:"ET",label:"Ethiopia"},{value:"FK",label:"Falkland Islands (the) [Malvinas]"},{value:"FO",label:"Faroe Islands (the)"},{value:"FJ",label:"Fiji"},{value:"FI",label:"Finland"},{value:"FR",label:"France"},{value:"GF",label:"French Guiana"},{value:"PF",label:"French Polynesia"},{value:"TF",label:"French Southern Territories (the)"},{value:"GA",label:"Gabon"},{value:"GM",label:"Gambia (the)"},{value:"GE",label:"Georgia"},{value:"DE",label:"Germany"},{value:"GH",label:"Ghana"},{value:"GI",label:"Gibraltar"},{value:"GR",label:"Greece"},{value:"GL",label:"Greenland"},{value:"GD",label:"Grenada"},{value:"GP",label:"Guadeloupe"},{value:"GU",label:"Guam"},{value:"GT",label:"Guatemala"},{value:"GG",label:"Guernsey"},{value:"GN",label:"Guinea"},{value:"GW",label:"Guinea-Bissau"},{value:"GY",label:"Guyana"},{value:"HT",label:"Haiti"},{value:"HM",label:"Heard Island and McDonald Islands"},{value:"VA",label:"Holy See (the)"},{value:"HN",label:"Honduras"},{value:"HK",label:"Hong Kong"},{value:"HU",label:"Hungary"},{value:"IS",label:"Iceland"},{value:"IN",label:"India"},{value:"value",label:"Indonesia"},{value:"IR",label:"Iran (Islamic Republic of)"},{value:"IQ",label:"Iraq"},{value:"IE",label:"Ireland"},{value:"IM",label:"Isle of Man"},{value:"IL",label:"Israel"},{value:"IT",label:"Italy"},{value:"JM",label:"Jamaica"},{value:"JP",label:"Japan"},{value:"JE",label:"Jersey"},{value:"JO",label:"Jordan"},{value:"KZ",label:"Kazakhstan"},{value:"KE",label:"Kenya"},{value:"KI",label:"Kiribati"},{value:"KP",label:"Korea (the Democratic People's Republic of)"},{value:"KR",label:"Korea (the Republic of)"},{value:"KW",label:"Kuwait"},{value:"KG",label:"Kyrgyzstan"},{value:"LA",label:"Lao People's Democratic Republic (the)"},{value:"LV",label:"Latvia"},{value:"LB",label:"Lebanon"},{value:"LS",label:"Lesotho"},{value:"LR",label:"Liberia"},{value:"LY",label:"Libya"},{value:"LI",label:"Liechtenstein"},{value:"LT",label:"Lithuania"},{value:"LU",label:"Luxembourg"},{value:"MO",label:"Macao"},{value:"MG",label:"Madagascar"},{value:"MW",label:"Malawi"},{value:"MY",label:"Malaysia"},{value:"MV",label:"Maldives"},{value:"ML",label:"Mali"},{value:"MT",label:"Malta"},{value:"MH",label:"Marshall Islands (the)"},{value:"MQ",label:"Martinique"},{value:"MR",label:"Mauritania"},{value:"MU",label:"Mauritius"},{value:"YT",label:"Mayotte"},{value:"MX",label:"Mexico"},{value:"FM",label:"Micronesia (Federated States of)"},{value:"MD",label:"Moldova (the Republic of)"},{value:"MC",label:"Monaco"},{value:"MN",label:"Mongolia"},{value:"ME",label:"Montenegro"},{value:"MS",label:"Montserrat"},{value:"MA",label:"Morocco"},{value:"MZ",label:"Mozambique"},{value:"MM",label:"Myanmar"},{value:"NA",label:"Namibia"},{value:"NR",label:"Nauru"},{value:"NP",label:"Nepal"},{value:"NL",label:"Netherlands (the)"},{value:"NC",label:"New Caledonia"},{value:"NZ",label:"New Zealand"},{value:"NI",label:"Nicaragua"},{value:"NE",label:"Niger (the)"},{value:"NG",label:"Nigeria"},{value:"NU",label:"Niue"},{value:"NF",label:"Norfolk Island"},{value:"MP",label:"Northern Mariana Islands (the)"},{value:"NO",label:"Norway"},{value:"OM",label:"Oman"},{value:"PK",label:"Pakistan"},{value:"PW",label:"Palau"},{value:"PS",label:"Palestine, State of"},{value:"PA",label:"Panama"},{value:"PG",label:"Papua New Guinea"},{value:"PY",label:"Paraguay"},{value:"PE",label:"Peru"},{value:"PH",label:"Philippines (the)"},{value:"PN",label:"Pitcairn"},{value:"PL",label:"Poland"},{value:"PT",label:"Portugal"},{value:"PR",label:"Puerto Rico"},{value:"QA",label:"Qatar"},{value:"MK",label:"Republic of North Macedonia"},{value:"RO",label:"Romania"},{value:"RU",label:"Russian Federation (the)"},{value:"RW",label:"Rwanda"},{value:"RE",label:"Réunion"},{value:"BL",label:"Saint Barthélemy"},{value:"SH",label:"Saint Helena, Ascension and Tristan da Cunha"},{value:"KN",label:"Saint Kitts and Nevis"},{value:"LC",label:"Saint Lucia"},{value:"MF",label:"Saint Martin (French part)"},{value:"PM",label:"Saint Pierre and Miquelon"},{value:"VC",label:"Saint Vincent and the Grenadines"},{value:"WS",label:"Samoa"},{value:"SM",label:"San Marino"},{value:"ST",label:"Sao Tome and Principe"},{value:"SA",label:"Saudi Arabia"},{value:"SN",label:"Senegal"},{value:"RS",label:"Serbia"},{value:"SC",label:"Seychelles"},{value:"SL",label:"Sierra Leone"},{value:"SG",label:"Singapore"},{value:"SX",label:"Sint Maarten (Dutch part)"},{value:"SK",label:"Slovakia"},{value:"SI",label:"Slovenia"},{value:"SB",label:"Solomon Islands"},{value:"SO",label:"Somalia"},{value:"ZA",label:"South Africa"},{value:"GS",label:"South Georgia and the South Sandwich Islands"},{value:"SS",label:"South Sudan"},{value:"ES",label:"Spain"},{value:"LK",label:"Sri Lanka"},{value:"SD",label:"Sudan (the)"},{value:"SR",label:"Suriname"},{value:"SJ",label:"Svalbard and Jan Mayen"},{value:"SE",label:"Sweden"},{value:"CH",label:"Switzerland"},{value:"SY",label:"Syrian Arab Republic"},{value:"TW",label:"Taiwan"},{value:"TJ",label:"Tajikistan"},{value:"TZ",label:"Tanzania, United Republic of"},{value:"TH",label:"Thailand"},{value:"TL",label:"Timor-Leste"},{value:"TG",label:"Togo"},{value:"TK",label:"Tokelau"},{value:"TO",label:"Tonga"},{value:"TT",label:"Trinidad and Tobago"},{value:"TN",label:"Tunisia"},{value:"TR",label:"Turkey"},{value:"TM",label:"Turkmenistan"},{value:"TC",label:"Turks and Caicos Islands (the)"},{value:"TV",label:"Tuvalu"},{value:"UG",label:"Uganda"},{value:"UA",label:"Ukraine"},{value:"AE",label:"United Arab Emirates (the)"},{value:"GB",label:"United Kingdom of Great Britain and Northern Ireland (the)"},{value:"UM",label:"United States Minor Outlying Islands (the)"},{value:"US",label:"United States of America (the)"},{value:"UY",label:"Uruguay"},{value:"UZ",label:"Uzbekistan"},{value:"VU",label:"Vanuatu"},{value:"VE",label:"Venezuela (Bolivarian Republic of)"},{value:"VN",label:"Viet Nam"},{value:"VG",label:"Virgin Islands (British)"},{value:"VI",label:"Virgin Islands (U.S.)"},{value:"WF",label:"Wallis and Futuna"},{value:"EH",label:"Western Sahara"},{value:"YE",label:"Yemen"},{value:"ZM",label:"Zambia"},{value:"ZW",label:"Zimbabwe"},{value:"AX",label:"Åland Islands"}];var T;!function(n){n[n.xs=480]="xs",n[n.sm=768]="sm",n[n.md=992]="md",n[n.lg=1200]="lg",n[n.xl=1400]="xl",n[n.xxl=2e3]="xxl"}(T||(T={}));const q=(n=T.sm)=>{const[t,i]=e.useState(()=>window.innerWidth<n);return e.useEffect(()=>{const e=()=>{const e=window.innerWidth<n;i(n=>n!==e?e:n)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n]),t},A=n=>{const t=M();return i=>{var a,o,r,s,l,u,d,c,p,m,y,g,b;if((null===(a=null==i?void 0:i.message)||void 0===a?void 0:a.includes("Token is"))||(null===(r=null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.description)||void 0===r?void 0:r.includes("Token is"))||(null===(u=null===(l=null===(s=null==i?void 0:i.response)||void 0===s?void 0:s[0])||void 0===l?void 0:l.description)||void 0===u?void 0:u.includes("Token is")))null==n||n();else if("string"==typeof i)t(i,null);else if(null===(d=null==i?void 0:i.response)||void 0===d?void 0:d.errors){const n=i.response.errors;for(let e in n){const i=(null===(c=n[e])||void 0===c?void 0:c.message)||n[e];t(i,null)}}else if(null==i?void 0:i.errors){const n=i.errors;for(let e in n){const i=(null===(p=n[e])||void 0===p?void 0:p.message)||n[e];t(i,null)}}else if(Array.isArray(i))for(let n in i){const e=(null===(m=i[n])||void 0===m?void 0:m.message)||i[n];t(e,null)}else(null===(y=null==i?void 0:i.response)||void 0===y?void 0:y.message)?t(i.response.message,null):(null===(g=null==i?void 0:i.response)||void 0===g?void 0:g.error)?t(null===(b=null==i?void 0:i.response)||void 0===b?void 0:b.exception,i.response.error):(null==i?void 0:i.message)?t(i.message):"string"==typeof i||null!==i&&e.isValidElement(i)?t(i):t("Unknown error notification",null)}},M=()=>(e,a,o=30)=>{setTimeout(()=>i.notification.error({description:e,duration:o,icon:n.jsx(t.WarningOutlined,{}),message:a||"Error",placement:"top"}),10)},H=()=>(e,a,o=3)=>{setTimeout(()=>i.notification.success({description:e,duration:o,icon:n.jsx(t.CheckCircleOutlined,{}),message:a||"Success",placement:"bottomRight"}),10)},Q=()=>(n,e,t=10)=>{setTimeout(()=>i.notification.info({description:n,duration:t,message:e||"Info",placement:"top"}),10)},E=({accountId:n,entityId:e,token:t})=>["accountPaymentMethods",...e?[e]:[],...n?[n]:[],...t?[t]:[]],$=({accountId:n,token:e})=>["accountBillingDetails",...n?[n]:[],...e?[e]:[]],_=({accountId:n,token:e})=>["accountContacts",...n?[n]:[],...e?[e]:[]],R=n=>["branding",...n?[n]:[]],B=(n,e)=>["quotes",...n?[n]:[],...e?[e]:[]],U=({id:n,token:e})=>["formattedInvoice",n,...e?[e]:[]],V=({id:n,objectName:e,token:t})=>[e,...n?[n]:[],...t?[t]:[]],O=({id:n,token:e})=>["quote",n,e],Z=({token:n})=>["signupQuote",...n?[n]:[]],K=({id:n,token:e})=>["quoteTaxCalculate",...n?[n]:[],...e?[e]:[]],z=({filterString:n,pluralType:e,token:t})=>n?[e,"list",n,t]:[e,"list",t],G=n=>["currentUser",...n?[n]:[]],Y=({subscriptionId:n,productId:e,token:t})=>["planChangeOptions",...n?[n]:[],...e?[e]:[],...t?[t]:[]],W=n=>["plugins",...n?[n]:[]],X=({entityId:n,token:e})=>["taxationRequiredAccountFields",...n?[n]:[],...e?[e]:[]],J=({filter:n,token:e})=>["transactions",...n?[n]:[],...e?[e]:[]],nn=({priceListId:n,token:e})=>["addonPlans",n,...e?[e]:[]],en=n=>["paymentPlugins",...n?[n]:[]],tn=({subscriptionId:n,token:e})=>["subscriptionChargeHistograms",n,...e?[e]:[]],an=n=>["signupAccount",...n?[n]:[]],on=(n,e)=>["signupPriceList",...n?[n]:[],...e?[e]:[]],rn={quoteAccountSignup:["quoteAccountSignup"]},sn=e.createContext({}),ln={host:"",subdomain:"",apiEndpoint:"/api",graphqlEndpoint:"/graphql",pluginsEndpoint:"/api/plugins"},un="1.8.0-beta.31",dn=()=>async(n,e,t,i)=>{try{return await o((n=>`${n}/graphql`)(e),n,i,(n=>{const e=pn({token:n});return e["x-components-version"]=un,e})(t))}catch(n){throw n}},cn=async({query:n,apiHost:e,token:t,vars:i,isInPreviewMode:a})=>{const{graphqlEndpoint:r}=ln,s={...pn({token:a?void 0:t,componentsVersion:un})};try{return await o(`${e}${r}`,n,i,s)}catch(n){throw n}},pn=({token:n,componentsVersion:e,additionalHeaders:t})=>{const i={"Content-type":"application/json; charset=utf-8"},a=localStorage.getItem(k),o=localStorage.getItem("timeTravelDate");return n&&(i.Authorization=`Bearer ${n}`),e&&(i["x-components-version"]=e),a&&(i[k]=a),o&&(i["X-Bunny-Time-Travel"]=o),t&&Object.assign(i,t),i},mn=e.createContext({}),yn=()=>{const t=e.createContext(null);return[({value:e,children:i})=>n.jsx(t.Provider,{value:e,children:i}),()=>{const n=e.useContext(t);if(null===n)throw new Error("Provider missing");return n}]},[gn,bn]=yn(),[hn,vn]=yn(),fn="Invalid or missing authorization",xn=[fn,'["Not found"]',"This quote is currently unavailable"],Cn=({onUserUnavailable:n,onInvalidOrMissingAuthorization:t,suppressUserUnavailableErrorNotification:i,disableErrorNotifications:a}={})=>{const o=M();return(r,s)=>{var l,u,d,c,p,m,y,g;const b=(null===(l=null==r?void 0:r.response)||void 0===l?void 0:l.errors)||null,h=null!==(p=null===(c=null===(d=null===(u=null==r?void 0:r.response)||void 0===u?void 0:u.errors)||void 0===d?void 0:d[0])||void 0===c?void 0:c.message)&&void 0!==p?p:null==r?void 0:r.message;if((null==h?void 0:h.includes(fn))&&(null==t||t()),(null==h?void 0:h.includes("Contact does not exist within"))&&(null==n||n(),i))return r;if(xn.includes(h))return r;if(a)return r;if((null==r?void 0:r.data)&&s){const n=((n,e)=>{if(!n||!e)return null;const t=n[e];if(!t)return null;const i=t.errors;if(!i)return null;if("string"==typeof i)try{const n=JSON.parse(i);return Array.isArray(n)?n:[n]}catch(n){return[i]}return Array.isArray(i)?i:null})(r.data,s);if(n&&n.length>0){if(xn.some(e=>n.includes(e)))return r;for(const e of n)o(e,null);return r}}if(b)for(let n in b){const e=null===(m=b[n])||void 0===m?void 0:m.message;o(e,null)}else if(null===(y=null==r?void 0:r.response)||void 0===y?void 0:y.error)o(r.response.exception,r.response.error);else if((null==r?void 0:r.constructor)===Array)for(let n in r)o(r[n].message,null);else(null===(g=null==r?void 0:r.response)||void 0===g?void 0:g.message)?o(r.response.message):(null==r?void 0:r.message)?o(r.message):"string"==typeof r||null!==r&&e.isValidElement(r)?o(r):o("Unknown error notification",null)}};async function wn(n,e,t){return await cn({query:s.print(n),vars:t,apiHost:e.apiHost,token:e.token})}var jn,Sn,In="Document",Ln="FragmentDefinition";class Pn extends Error{constructor(n,e,t,i,a,o,r){super(n),this.name="GraphQLError",this.message=n,a&&(this.path=a),e&&(this.nodes=Array.isArray(e)?e:[e]),t&&(this.source=t),i&&(this.positions=i),o&&(this.originalError=o);var s=r;if(!s&&o){var l=o.extensions;l&&"object"==typeof l&&(s=l)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}function kn(n){return new Pn(`Syntax Error: Unexpected token at ${Sn} in ${n}`)}function Nn(n){if(n.lastIndex=Sn,n.test(jn))return jn.slice(Sn,Sn=n.lastIndex)}var Fn=/ +(?=[^\s])/y;function Dn(n){for(var e=n.split("\n"),t="",i=0,a=0,o=e.length-1,r=0;r<e.length;r++)Fn.lastIndex=0,Fn.test(e[r])&&(r&&(!i||Fn.lastIndex<i)&&(i=Fn.lastIndex),a=a||r,o=r);for(var s=a;s<=o;s++)s!==a&&(t+="\n"),t+=e[s].slice(i).replace(/\\"""/g,'"""');return t}function Tn(){for(var n=0|jn.charCodeAt(Sn++);9===n||10===n||13===n||32===n||35===n||44===n||65279===n;n=0|jn.charCodeAt(Sn++))if(35===n)for(;(n=0|jn.charCodeAt(Sn++))&&10!==n&&13!==n;);Sn--}function qn(){for(var n=Sn,e=0|jn.charCodeAt(Sn++);e>=48&&e<=57||e>=65&&e<=90||95===e||e>=97&&e<=122;e=0|jn.charCodeAt(Sn++));if(n===Sn-1)throw kn("Name");var t=jn.slice(n,--Sn);return Tn(),t}function An(){return{kind:"Name",value:qn()}}var Mn=/(?:"""|(?:[\s\S]*?[^\\])""")/y,Hn=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function Qn(n){var e;switch(jn.charCodeAt(Sn)){case 91:Sn++,Tn();for(var t=[];93!==jn.charCodeAt(Sn);)t.push(Qn(n));return Sn++,Tn(),{kind:"ListValue",values:t};case 123:Sn++,Tn();for(var i=[];125!==jn.charCodeAt(Sn);){var a=An();if(58!==jn.charCodeAt(Sn++))throw kn("ObjectField");Tn(),i.push({kind:"ObjectField",name:a,value:Qn(n)})}return Sn++,Tn(),{kind:"ObjectValue",fields:i};case 36:if(n)throw kn("Variable");return Sn++,{kind:"Variable",name:An()};case 34:if(34===jn.charCodeAt(Sn+1)&&34===jn.charCodeAt(Sn+2)){if(Sn+=3,null==(e=Nn(Mn)))throw kn("StringValue");return Tn(),{kind:"StringValue",value:Dn(e.slice(0,-3)),block:!0}}var o,r=Sn;Sn++;var s=!1;for(o=0|jn.charCodeAt(Sn++);92===o&&(Sn++,s=!0)||10!==o&&13!==o&&34!==o&&o;o=0|jn.charCodeAt(Sn++));if(34!==o)throw kn("StringValue");return e=jn.slice(r,Sn),Tn(),{kind:"StringValue",value:s?JSON.parse(e):e.slice(1,-1),block:!1};case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var l,u=Sn++;(l=0|jn.charCodeAt(Sn++))>=48&&l<=57;);var d=jn.slice(u,--Sn);if(46===(l=jn.charCodeAt(Sn))||69===l||101===l){if(null==(e=Nn(Hn)))throw kn("FloatValue");return Tn(),{kind:"FloatValue",value:d+e}}return Tn(),{kind:"IntValue",value:d};case 110:if(117===jn.charCodeAt(Sn+1)&&108===jn.charCodeAt(Sn+2)&&108===jn.charCodeAt(Sn+3))return Sn+=4,Tn(),{kind:"NullValue"};break;case 116:if(114===jn.charCodeAt(Sn+1)&&117===jn.charCodeAt(Sn+2)&&101===jn.charCodeAt(Sn+3))return Sn+=4,Tn(),{kind:"BooleanValue",value:!0};break;case 102:if(97===jn.charCodeAt(Sn+1)&&108===jn.charCodeAt(Sn+2)&&115===jn.charCodeAt(Sn+3)&&101===jn.charCodeAt(Sn+4))return Sn+=5,Tn(),{kind:"BooleanValue",value:!1}}return{kind:"EnumValue",value:qn()}}function En(n){if(40===jn.charCodeAt(Sn)){var e=[];Sn++,Tn();do{var t=An();if(58!==jn.charCodeAt(Sn++))throw kn("Argument");Tn(),e.push({kind:"Argument",name:t,value:Qn(n)})}while(41!==jn.charCodeAt(Sn));return Sn++,Tn(),e}}function $n(n){if(64===jn.charCodeAt(Sn)){var e=[];do{Sn++,e.push({kind:"Directive",name:An(),arguments:En(n)})}while(64===jn.charCodeAt(Sn));return e}}function _n(){for(var n=0;91===jn.charCodeAt(Sn);)n++,Sn++,Tn();var e={kind:"NamedType",name:An()};do{if(33===jn.charCodeAt(Sn)&&(Sn++,Tn(),e={kind:"NonNullType",type:e}),n){if(93!==jn.charCodeAt(Sn++))throw kn("NamedType");Tn(),e={kind:"ListType",type:e}}}while(n--);return e}function Rn(){if(123!==jn.charCodeAt(Sn++))throw kn("SelectionSet");return Tn(),Bn()}function Bn(){var n=[];do{if(46===jn.charCodeAt(Sn)){if(46!==jn.charCodeAt(++Sn)||46!==jn.charCodeAt(++Sn))throw kn("SelectionSet");switch(Sn++,Tn(),jn.charCodeAt(Sn)){case 64:n.push({kind:"InlineFragment",typeCondition:void 0,directives:$n(!1),selectionSet:Rn()});break;case 111:110===jn.charCodeAt(Sn+1)?(Sn+=2,Tn(),n.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:An()},directives:$n(!1),selectionSet:Rn()})):n.push({kind:"FragmentSpread",name:An(),directives:$n(!1)});break;case 123:Sn++,Tn(),n.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:Bn()});break;default:n.push({kind:"FragmentSpread",name:An(),directives:$n(!1)})}}else{var e=An(),t=void 0;58===jn.charCodeAt(Sn)&&(Sn++,Tn(),t=e,e=An());var i=En(!1),a=$n(!1),o=void 0;123===jn.charCodeAt(Sn)&&(Sn++,Tn(),o=Bn()),n.push({kind:"Field",alias:t,name:e,arguments:i,directives:a,selectionSet:o})}}while(125!==jn.charCodeAt(Sn));return Sn++,Tn(),{kind:"SelectionSet",selections:n}}function Un(){if(Tn(),40===jn.charCodeAt(Sn)){var n=[];Sn++,Tn();do{var e=void 0;if(34===jn.charCodeAt(Sn)&&(e=Qn(!0)),36!==jn.charCodeAt(Sn++))throw kn("Variable");var t=An();if(58!==jn.charCodeAt(Sn++))throw kn("VariableDefinition");Tn();var i=_n(),a=void 0;61===jn.charCodeAt(Sn)&&(Sn++,Tn(),a=Qn(!0)),Tn();var o={kind:"VariableDefinition",variable:{kind:"Variable",name:t},type:i,defaultValue:a,directives:$n(!0)};e&&(o.description=e),n.push(o)}while(41!==jn.charCodeAt(Sn));return Sn++,Tn(),n}}function Vn(n){var e=An();if(111!==jn.charCodeAt(Sn++)||110!==jn.charCodeAt(Sn++))throw kn("FragmentDefinition");Tn();var t={kind:"FragmentDefinition",name:e,typeCondition:{kind:"NamedType",name:An()},directives:$n(!1),selectionSet:Rn()};return n&&(t.description=n),t}function On(){var n=[];do{var e=void 0;if(34===jn.charCodeAt(Sn)&&(e=Qn(!0)),123===jn.charCodeAt(Sn)){if(e)throw kn("Document");Sn++,Tn(),n.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:Bn()})}else{var t=qn();switch(t){case"fragment":n.push(Vn(e));break;case"query":case"mutation":case"subscription":var i,a=void 0;40!==(i=jn.charCodeAt(Sn))&&64!==i&&123!==i&&(a=An());var o={kind:"OperationDefinition",operation:t,name:a,variableDefinitions:Un(),directives:$n(!1),selectionSet:Rn()};e&&(o.description=e),n.push(o);break;default:throw kn("Document")}}}while(Sn<jn.length);return n}function Zn(n,e){return jn=n.body?n.body:n,Sn=0,Tn(),e&&e.noLocation?{kind:"Document",definitions:On()}:{kind:"Document",definitions:On(),loc:{start:0,end:jn.length,startToken:void 0,endToken:void 0,source:{body:jn,name:"graphql.web",locationOffset:{line:1,column:1}}}}}var Kn=0,zn=new Set;function Gn(){function n(n,e){var t,i,a=Zn(n).definitions,o=new Set;for(var r of e||[])for(var s of r.definitions)s.kind!==Ln||o.has(s)||(a.push(s),o.add(s));return(t=a[0].kind===Ln)&&a[0].directives&&(a[0].directives=a[0].directives.filter(n=>"_unmask"!==n.name.value)),{kind:In,definitions:a,get loc(){if(!i&&t){var a=n+function(n){try{Kn++;var e="";for(var t of n)if(!zn.has(t)){zn.add(t);var{loc:i}=t;i&&(e+=i.source.body)}return e}finally{0==--Kn&&zn.clear()}}(e||[]);return{start:0,end:a.length,source:{body:a,name:"GraphQLTada",locationOffset:{line:1,column:1}}}}return i},set loc(n){i=n}}}return n.scalar=function(n,e){return e},n.persisted=function(n,e){return{kind:In,definitions:e?e.definitions:[],documentId:n}},n}function Yn(...n){return 2===n.length?n[1]:n[0]}var Wn=Gn();const Xn=Wn("\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n"),Jn=e.createContext({});function ne({children:t,darkMode:i=!1,queryClient:o,apiHost:r,token:s,onTokenExpired:l,configProviderProps:u}){const d=(()=>{const{onUserUnavailable:n,onInvalidOrMissingAuthorization:e,suppressUserUnavailableErrorNotification:t,disableErrorNotifications:i}=vn(),o=Cn({onUserUnavailable:n,onInvalidOrMissingAuthorization:e,suppressUserUnavailableErrorNotification:t,disableErrorNotifications:i}),r=(n,e)=>{o(n,void 0)};return()=>new a.QueryClient({defaultOptions:{queries:{gcTime:Number.POSITIVE_INFINITY,refetchIntervalInBackground:!1,staleTime:6e5,retry:!1,refetchOnWindowFocus:!1}},mutationCache:new a.MutationCache({onError:r}),queryCache:new a.QueryCache({onError:r})})})(),c=e.useMemo(()=>d(),[]);return n.jsx(Jn.Provider,{value:{darkMode:i,apiHost:r,token:s,onTokenExpired:l},children:n.jsx(a.QueryClientProvider,{client:o||c,children:n.jsx(ee,{darkMode:i,configProviderProps:u,children:t})})})}function ee({children:t,darkMode:o,configProviderProps:s}){const{apiHost:l,token:u}=e.useContext(Jn),{data:d}=a.useQuery({queryKey:R(u),queryFn:()=>(async({token:n,apiHost:e})=>await wn(Xn,{apiHost:e,token:n},{}))({token:u,apiHost:l}),staleTime:3e5}),c=null==d?void 0:d.entityBranding,p=q(),m=e.useMemo(()=>{const n=(null==c?void 0:c.brandColor)?"#"+(null==c?void 0:c.brandColor):F;let e="#000000";!p&&(n=>{if(!n)return!1;"#"===(null==n?void 0:n[0])&&(n=n.slice(1));const e=parseInt(n,16);return.2126*(e>>24&255)+.7152*(e>>16&255)+.0722*(e>>8&255)*((255&e)/255)<100})((null==c?void 0:c.accentColor)||"")&&(e="#ffffff");const t=(null==c?void 0:c.topNavImageUrl)||"";return{accentColor:(null==c?void 0:c.accentColor)||N,brandColor:n,secondaryColor:e,topNavImageUrl:t}},[c,p]),y={algorithm:o?i.theme.darkAlgorithm:i.theme.defaultAlgorithm,token:{borderRadius:4,colorPrimary:m.brandColor,colorLink:m.brandColor,colorLinkActive:m.brandColor,colorLinkHover:m.brandColor,fontFamily:'"Inter Variable", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif',colorBorder:I,lineHeight:1,fontSize:14,...o?{}:{colorFillAlter:"rgb(241 245 249)"}},components:{Button:{defaultShadow:"none",boxShadowSecondary:"none",fontWeight:"normal",contentFontSizeLG:14,colorBgContainerDisabled:o?"var(--row-background-dark)":"#eef0f2",borderColorDisabled:o?"var(--row-background-dark)":"#eef0f2"},Drawer:{colorBgElevated:o?"var(--row-background-dark)":v},Divider:{colorSplit:o?x:f},Form:{itemMarginBottom:0,verticalLabelPadding:"4px"}}},g={...y,...s,token:{...y.token,...null==s?void 0:s.token},components:{...y.components,...null==s?void 0:s.components}};return n.jsx(r.RecoilRoot,{children:n.jsx(gn,{value:m,children:n.jsx(i.ConfigProvider,{theme:g,children:n.jsx("div",{className:"bunny-components bunny-contents",children:t})})})})}function te(){const{token:n}=e.useContext(Jn),{overrideToken:t}=e.useContext(mn);return null!=t?t:n}function ie({documentUuid:t,documentType:i}){const{apiHost:o}=e.useContext(Jn),[r,s]=e.useState(void 0),l=te(),{data:u,isLoading:d}=a.useQuery({queryKey:["documentPDF",t],queryFn:()=>(async(n,e,t,i)=>{if(!e)throw new Error("Invoice ID is required to fetch PDF");const a=await fetch(`${n}/api/legacy_documents/${e}?type=${t}`,{headers:pn({token:i})});if(!a.ok)throw new Error("Failed to fetch PDF");return a.blob()})(o,t,i,l),enabled:Boolean(t)});return e.useEffect(()=>{if(u){const n=URL.createObjectURL(u);return s(n),()=>URL.revokeObjectURL(n)}},[u]),d||!r?n.jsx(n.Fragment,{}):n.jsx("iframe",{src:r,style:{border:"none",gridColumn:"1/-1",minHeight:"1000px",minWidth:"780px"},title:"Invoice PDF",width:"100%"})}const ae=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"#1F72CD",stroke:"#D9D9D9"}),n.jsx("path",{"fill-rule":"evenodd",clipRule:"evenodd",d:"M12.5493 17L6 31.4935H13.8405L14.8125 29.1826H17.0342L18.0062 31.4935H26.6364V29.7298L27.4054 31.4935H31.8696L32.6386 29.6925V31.4935H50.587L52.7695 29.2426L54.813 31.4935L64.0317 31.5121L57.4617 24.2872L64.0317 17H54.956L52.8315 19.2093L50.8523 17H31.3268L29.6501 20.7409L27.9341 17H20.11V18.7037L19.2396 17H12.5493ZM39.3516 19.0581H49.6584L52.8108 22.4633L56.0648 19.0581H59.2172L54.4275 24.2852L59.2172 29.452H55.9218L52.7695 26.0073L49.4989 29.452H39.3516V19.0581ZM41.8968 23.1099V21.2114V21.2096H48.328L51.1342 24.2458L48.2036 27.2986H41.8968V25.226H47.5197V23.1099H41.8968ZM14.0664 19.0581H17.8883L22.2324 28.8862V19.0581H26.4191L29.7745 26.1048L32.8668 19.0581H37.0326V29.4581H34.4978L34.4771 21.3087L30.7817 29.4581H28.5142L24.7981 21.3087V29.4581H19.5836L18.595 27.1266H13.254L12.2675 29.4561H9.47358L14.0664 19.0581ZM14.166 24.9712L15.9256 20.8177L17.6832 24.9712H14.166Z",fill:"white"})]}),oe=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2243 35.1715C18.2243 34.882 18.156 34.6314 18.0199 34.4199C17.8835 34.2083 17.7043 34.0468 17.4819 33.9355C17.7043 33.8242 17.8766 33.6597 17.9991 33.4426C18.1214 33.2255 18.1825 32.9806 18.1825 32.7078V32.5575C18.1825 32.2233 18.1186 31.9451 17.9908 31.7223C17.8628 31.4996 17.6833 31.3213 17.4526 31.1878C17.2219 31.0541 16.9451 30.9582 16.6227 30.8995C16.3 30.8411 15.9414 30.812 15.5465 30.812C15.4131 30.812 15.274 30.8147 15.1296 30.8203C14.9848 30.8258 14.8445 30.8328 14.7083 30.8411C14.572 30.8494 14.4468 30.8593 14.3329 30.8704C14.2188 30.8817 14.1256 30.8928 14.0534 30.9037C13.8921 30.9318 13.7781 30.9817 13.7114 31.0541C13.6448 31.1266 13.6113 31.2575 13.6113 31.4467V36.5245C13.6113 36.7139 13.646 36.8447 13.7156 36.917C13.7851 36.9895 13.9032 37.0394 14.0702 37.0673C14.1535 37.084 14.2536 37.0979 14.3704 37.1091C14.4871 37.1202 14.6136 37.1299 14.7499 37.1383C14.8862 37.1466 15.0265 37.1535 15.1711 37.1593C15.3158 37.1646 15.4575 37.1676 15.5966 37.1676C15.9581 37.1676 16.2986 37.1397 16.6185 37.084C16.9381 37.0285 17.2161 36.9295 17.4526 36.7874C17.689 36.6456 17.8766 36.4534 18.0157 36.2113C18.1546 35.969 18.2243 35.6642 18.2243 35.2967V35.1715ZM16.8063 32.7746C16.8063 32.8637 16.7924 32.9487 16.7645 33.0293C16.7366 33.11 16.6909 33.1795 16.627 33.2383C16.5629 33.2966 16.4768 33.3439 16.3684 33.38C16.2599 33.4162 16.1222 33.4343 15.9554 33.4343H15.0213V31.9895C15.049 31.9895 15.0921 31.9883 15.1505 31.9853C15.2089 31.9825 15.27 31.9812 15.3339 31.9812H15.6551C16.0833 31.9812 16.3822 32.0354 16.5518 32.144C16.7214 32.2526 16.8063 32.421 16.8063 32.6492V32.7746ZM16.5935 35.8062C16.7576 35.6782 16.8397 35.4971 16.8397 35.2634V35.1714C16.8397 34.971 16.7756 34.797 16.6478 34.6494C16.5198 34.502 16.289 34.4282 15.9554 34.4282H15.0213V35.9898H15.1671C15.231 35.9898 15.2977 35.9916 15.3673 35.9942C15.4368 35.9969 15.5035 35.9985 15.5676 35.9985H15.7051C16.1333 35.9985 16.4295 35.9343 16.5935 35.8062ZM22.7955 33.9438C22.7955 33.6377 22.7496 33.3772 22.6578 33.1629C22.5662 32.9487 22.4368 32.7732 22.27 32.6367C22.1032 32.5004 21.8988 32.4003 21.6568 32.3362C21.415 32.2722 21.1439 32.2401 20.8436 32.2401C20.5654 32.2401 20.2943 32.2597 20.0303 32.2987C19.766 32.3375 19.556 32.3766 19.4005 32.4154C19.2948 32.4435 19.242 32.5046 19.242 32.5991V33.2756C19.242 33.3314 19.2559 33.3705 19.2837 33.3925C19.3115 33.4149 19.3475 33.4261 19.3922 33.4261H19.4337C19.5006 33.4204 19.5839 33.4135 19.684 33.4051C19.7842 33.3968 19.8968 33.3901 20.022 33.3842C20.1471 33.3788 20.2777 33.3746 20.414 33.3717C20.5501 33.3689 20.6851 33.3675 20.8186 33.3675C21.0131 33.3675 21.1661 33.4038 21.2773 33.4761C21.3885 33.5486 21.4441 33.7045 21.4441 33.9438V34.2445H20.9937C20.2763 34.2445 19.7549 34.3572 19.4296 34.5827C19.1043 34.8081 18.9416 35.1659 18.9416 35.6558V35.7313C18.9416 36.0039 18.982 36.2321 19.0625 36.4158C19.1431 36.5996 19.2503 36.7472 19.3837 36.8587C19.5172 36.9699 19.6686 37.0493 19.8384 37.0964C20.008 37.1438 20.1846 37.1676 20.3681 37.1676C20.6184 37.1676 20.8339 37.1341 21.0145 37.0673C21.1952 37.0005 21.3662 36.9086 21.5276 36.7917V36.9253C21.5276 36.9699 21.5442 37.0089 21.5776 37.0422C21.6111 37.0756 21.6499 37.0923 21.6944 37.0923H22.6287C22.6731 37.0923 22.712 37.0756 22.7455 37.0422C22.7789 37.0089 22.7955 36.9699 22.7955 36.9253V33.9438ZM21.1481 36.0942C21.2619 36.0581 21.3691 36.015 21.4692 35.9648V35.0462H20.9937C20.8491 35.0462 20.7296 35.0587 20.635 35.0837C20.5404 35.1088 20.4653 35.1465 20.4098 35.1966C20.3542 35.2465 20.3152 35.3107 20.2931 35.3886C20.2707 35.4666 20.2596 35.5556 20.2596 35.6558V35.7312C20.2596 35.9092 20.3026 36.0233 20.3889 36.0734C20.4751 36.1235 20.6071 36.1485 20.7852 36.1485C20.913 36.1485 21.0339 36.1306 21.1481 36.0942ZM27.9007 36.917V34.1358C27.9007 33.8744 27.8799 33.6278 27.8381 33.3968C27.7964 33.166 27.7214 32.9653 27.6129 32.7954C27.5045 32.6256 27.3543 32.4905 27.1624 32.3904C26.9707 32.2902 26.7245 32.2401 26.4242 32.2401C26.1572 32.2401 25.9208 32.2723 25.7152 32.3369C25.5094 32.4014 25.2925 32.515 25.0646 32.6776V32.4752C25.0646 32.4305 25.0478 32.3911 25.0145 32.3575C24.9811 32.3238 24.9421 32.3068 24.8976 32.3068H23.9634C23.9187 32.3068 23.8799 32.3235 23.8467 32.357C23.8133 32.3904 23.7966 32.4295 23.7966 32.4739V36.917C23.7966 36.9615 23.8145 37.0019 23.8508 37.038C23.8869 37.0743 23.9272 37.0923 23.9717 37.0923H24.9811C25.0256 37.0923 25.0646 37.0743 25.0978 37.0382C25.1313 37.0021 25.1479 36.9619 25.1479 36.9173V33.6341C25.2925 33.5564 25.4287 33.4925 25.5567 33.4426C25.6845 33.3925 25.8096 33.3675 25.932 33.3675C26.0599 33.3675 26.1642 33.38 26.2449 33.4051C26.3254 33.4301 26.388 33.4731 26.4325 33.5345C26.477 33.5954 26.5076 33.6759 26.5243 33.7757C26.5409 33.8758 26.5494 33.9981 26.5494 34.1425V36.9173C26.5494 36.9619 26.566 37.0021 26.5994 37.0382C26.6327 37.0743 26.6715 37.0923 26.7162 37.0923H27.7255C27.7699 37.0923 27.8102 37.0743 27.8464 37.038C27.8826 37.0019 27.9007 36.9615 27.9007 36.917ZM32.0047 36.1071V36.8502C32.0047 36.9114 31.9907 36.9546 31.963 36.9796C31.9351 37.0047 31.8906 37.0255 31.8294 37.0422C31.7127 37.0701 31.5611 37.0978 31.3749 37.1259C31.1885 37.1535 30.9703 37.1676 30.72 37.1676C30.1305 37.1676 29.6592 36.9867 29.3062 36.6246C28.953 36.2628 28.7765 35.7394 28.7765 35.0546V34.3531C28.7765 33.6682 28.953 33.1448 29.3062 32.7831C29.6592 32.421 30.1305 32.2401 30.72 32.2401C30.9703 32.2401 31.1885 32.254 31.3749 32.2817C31.5611 32.3098 31.7127 32.3375 31.8294 32.3653C31.8906 32.3819 31.9351 32.4029 31.963 32.4279C31.9907 32.453 32.0047 32.4962 32.0047 32.5574V33.3007C32.0047 33.3453 31.9893 33.38 31.9588 33.4051C31.9281 33.4301 31.8906 33.4426 31.8462 33.4426H31.8294C31.6737 33.4261 31.5251 33.4121 31.3832 33.401C31.2413 33.3901 31.0508 33.3842 30.8118 33.3842C30.7172 33.3842 30.6283 33.3996 30.5448 33.4301C30.4613 33.4608 30.3891 33.5137 30.328 33.5888C30.2666 33.6641 30.2181 33.7641 30.1819 33.8895C30.1457 34.0147 30.1277 34.1692 30.1277 34.3531V35.0546C30.1277 35.2382 30.1457 35.3927 30.1819 35.5181C30.2181 35.6433 30.2666 35.7436 30.328 35.8187C30.3891 35.8939 30.4613 35.9468 30.5448 35.9774C30.6283 36.008 30.7172 36.0233 30.8118 36.0233C31.0508 36.0233 31.2413 36.0178 31.3832 36.0067C31.5251 35.9956 31.6737 35.9815 31.8294 35.9649H31.8462C31.8906 35.9649 31.9281 35.9774 31.9588 36.0025C31.9893 36.0276 32.0047 36.0623 32.0047 36.1071ZM36.6346 34.4115C36.6346 34.0773 36.5885 33.7768 36.4966 33.5095C36.4046 33.2423 36.2709 33.0155 36.0954 32.8289C35.9199 32.6424 35.7025 32.4976 35.4436 32.3946C35.1844 32.2918 34.8848 32.2401 34.5449 32.2401C34.2051 32.2401 33.9056 32.2918 33.6465 32.3946C33.3873 32.4976 33.1685 32.6424 32.9903 32.8289C32.8119 33.0155 32.6768 33.2423 32.585 33.5095C32.4928 33.7768 32.4469 34.0773 32.4469 34.4115V34.9961C32.4469 35.3301 32.4928 35.6309 32.585 35.8981C32.6768 36.1653 32.8119 36.3922 32.9903 36.5788C33.1685 36.7654 33.3873 36.91 33.6465 37.013C33.9056 37.1159 34.2051 37.1676 34.5449 37.1676C34.8848 37.1676 35.1844 37.1159 35.4436 37.013C35.7025 36.91 35.9199 36.7654 36.0954 36.5788C36.2709 36.3922 36.4046 36.1653 36.4966 35.8981C36.5885 35.6309 36.6346 35.3301 36.6346 34.9961V34.4115ZM34.5449 36.0233C35.037 36.0233 35.2832 35.6809 35.2832 34.9961V34.4115C35.2832 33.7322 35.037 33.3925 34.5449 33.3925C34.3016 33.3925 34.1164 33.4774 33.9893 33.6472C33.8619 33.8172 33.7984 34.0719 33.7984 34.4115V34.9961C33.7984 35.3357 33.8619 35.5918 33.9893 35.7644C34.1164 35.9371 34.3016 36.0233 34.5449 36.0233ZM41.5976 36.917V34.1358C41.5976 33.8744 41.5765 33.6278 41.5351 33.3968C41.4933 33.166 41.4181 32.9653 41.3095 32.7954C41.2011 32.6256 41.0511 32.4905 40.8593 32.3904C40.6674 32.2902 40.4213 32.2401 40.1211 32.2401C39.8542 32.2401 39.6177 32.2723 39.4119 32.3369C39.2062 32.4014 38.9893 32.515 38.7613 32.6776V32.4752C38.7613 32.4305 38.7447 32.3911 38.7111 32.3575C38.678 32.3238 38.6389 32.3068 38.5945 32.3068H37.6602C37.6157 32.3068 37.5769 32.3235 37.5434 32.357C37.5102 32.3904 37.4934 32.4295 37.4934 32.4739V36.917C37.4934 36.9615 37.5114 37.0019 37.5476 37.038C37.5838 37.0743 37.624 37.0923 37.6687 37.0923H38.678C38.7224 37.0923 38.7613 37.0743 38.7948 37.0382C38.828 37.0021 38.8448 36.9619 38.8448 36.9173V33.6341C38.9893 33.5564 39.1256 33.4925 39.2534 33.4426C39.3815 33.3925 39.5065 33.3675 39.629 33.3675C39.7568 33.3675 39.8611 33.38 39.9416 33.4051C40.0222 33.4301 40.0849 33.4731 40.1294 33.5345C40.1739 33.5954 40.2044 33.6759 40.2212 33.7757C40.2378 33.8758 40.2462 33.9981 40.2462 34.1425V36.9173C40.2462 36.9619 40.2628 37.0021 40.2962 37.0382C40.3296 37.0743 40.3684 37.0923 40.413 37.0923H41.4223C41.4668 37.0923 41.5072 37.0743 41.5434 37.038C41.5794 37.0019 41.5976 36.9615 41.5976 36.917ZM45.2348 36.2893V36.9357C45.2348 37.0295 45.182 37.0848 45.0763 37.1011C44.9483 37.1233 44.8371 37.1398 44.7427 37.1509C44.6481 37.162 44.5395 37.1675 44.4174 37.1675C44.1905 37.1675 43.9901 37.1493 43.816 37.1133C43.6419 37.077 43.4966 37.0061 43.3805 36.9003C43.2646 36.7945 43.1761 36.6483 43.1153 36.4617C43.0547 36.2753 43.0242 36.0347 43.0242 35.7394V33.3175L42.357 33.2088C42.3123 33.1977 42.2721 33.1769 42.2359 33.1462C42.1997 33.1157 42.1817 33.0781 42.1817 33.0335V32.4822C42.1817 32.4378 42.1997 32.3974 42.2359 32.3611C42.2721 32.325 42.3123 32.3068 42.357 32.3068H43.0242V31.622C43.0242 31.5774 43.0409 31.5414 43.0739 31.5134C43.1068 31.4857 43.1458 31.4663 43.1902 31.455L44.2016 31.2798H44.2263C44.2705 31.2798 44.3065 31.2921 44.3343 31.3171C44.3618 31.3423 44.3757 31.3771 44.3757 31.4215V32.3068H45.0597C45.104 32.3068 45.143 32.3237 45.1764 32.3573C45.2099 32.3909 45.2265 32.4305 45.2265 32.4752V33.1573C45.2265 33.2024 45.2099 33.2416 45.1764 33.2752C45.143 33.3089 45.104 33.3257 45.0597 33.3257H44.3757V35.7561C44.3757 35.9231 44.3895 36.0304 44.4174 36.0776C44.4451 36.1249 44.5229 36.1485 44.6507 36.1485H45.0597C45.1764 36.1485 45.2348 36.1955 45.2348 36.2893ZM49.6891 33.9438C49.6891 33.6377 49.6433 33.3772 49.5514 33.1629C49.4597 32.9487 49.3305 32.7732 49.1637 32.6367C48.9969 32.5004 48.7925 32.4003 48.5505 32.3362C48.3087 32.2722 48.0376 32.2401 47.7373 32.2401C47.4589 32.2401 47.188 32.2597 46.924 32.2987C46.6597 32.3375 46.4497 32.3766 46.2942 32.4154C46.1882 32.4435 46.1357 32.5046 46.1357 32.5991V33.2756C46.1357 33.3314 46.1494 33.3705 46.1773 33.3925C46.2052 33.4149 46.2412 33.4261 46.2857 33.4261H46.3274C46.3943 33.4204 46.4776 33.4135 46.5777 33.4051C46.6779 33.3968 46.7905 33.3901 46.9155 33.3842C47.0408 33.3788 47.1714 33.3746 47.3077 33.3717C47.4438 33.3689 47.5788 33.3675 47.7121 33.3675C47.9068 33.3675 48.0598 33.4038 48.171 33.4761C48.2822 33.5486 48.3378 33.7045 48.3378 33.9438V34.2445H47.8874C47.1698 34.2445 46.6486 34.3572 46.3233 34.5827C45.998 34.8081 45.8353 35.1659 45.8353 35.6558V35.7313C45.8353 36.0039 45.8755 36.2321 45.9562 36.4158C46.0366 36.5996 46.144 36.7472 46.2774 36.8587C46.4109 36.9699 46.5623 37.0493 46.7321 37.0964C46.9017 37.1438 47.0782 37.1676 47.2618 37.1676C47.5121 37.1676 47.7274 37.1341 47.9082 37.0673C48.0889 37.0005 48.2597 36.9086 48.4213 36.7917V36.9253C48.4213 36.9699 48.4379 37.0089 48.4713 37.0422C48.5046 37.0756 48.5436 37.0923 48.5881 37.0923H49.5224C49.5668 37.0923 49.6057 37.0756 49.6392 37.0422C49.6724 37.0089 49.6891 36.9699 49.6891 36.9253V33.9438ZM48.0418 36.0942C48.1556 36.0581 48.2628 36.015 48.3629 35.9648V35.0462H47.8874C47.7428 35.0462 47.6233 35.0587 47.5287 35.0837C47.4341 35.1088 47.359 35.1465 47.3035 35.1966C47.2477 35.2465 47.2088 35.3107 47.1868 35.3886C47.1644 35.4666 47.1533 35.5556 47.1533 35.6558V35.7312C47.1533 35.9092 47.1963 36.0233 47.2826 36.0734C47.3688 36.1235 47.5008 36.1485 47.6789 36.1485C47.8067 36.1485 47.9274 36.1306 48.0418 36.0942ZM53.7933 36.8502V36.1071C53.7933 36.0623 53.7779 36.0276 53.7474 36.0025C53.7167 35.9774 53.6793 35.9649 53.6348 35.9649H53.6181C53.4624 35.9815 53.3136 35.9956 53.1718 36.0067C53.0301 36.0178 52.8395 36.0233 52.6005 36.0233C52.5057 36.0233 52.4167 36.008 52.3336 35.9774C52.2501 35.9468 52.1777 35.8939 52.1165 35.8187C52.0554 35.7436 52.0067 35.6433 51.9707 35.5181C51.9343 35.3927 51.9165 35.2382 51.9165 35.0546V34.3531C51.9165 34.1692 51.9343 34.0147 51.9707 33.8895C52.0067 33.7641 52.0554 33.6641 52.1165 33.5888C52.1777 33.5137 52.2501 33.4608 52.3336 33.4301C52.4167 33.3996 52.5057 33.3842 52.6005 33.3842C52.8395 33.3842 53.0301 33.3901 53.1718 33.401C53.3136 33.4121 53.4624 33.4261 53.6181 33.4426H53.6348C53.6793 33.4426 53.7167 33.4301 53.7474 33.4051C53.7779 33.38 53.7933 33.3453 53.7933 33.3007V32.5574C53.7933 32.4962 53.7794 32.453 53.7515 32.4279C53.7235 32.4029 53.6793 32.3819 53.6181 32.3653C53.5014 32.3375 53.3497 32.3098 53.1635 32.2817C52.9771 32.254 52.759 32.2401 52.5087 32.2401C51.9189 32.2401 51.4479 32.421 51.0947 32.7831C50.7415 33.1448 50.565 33.6682 50.565 34.3531V35.0546C50.565 35.7394 50.7415 36.2628 51.0947 36.6246C51.4479 36.9867 51.9189 37.1676 52.5087 37.1676C52.759 37.1676 52.9771 37.1535 53.1635 37.1259C53.3497 37.0978 53.5014 37.0701 53.6181 37.0422C53.6793 37.0255 53.7235 37.0047 53.7515 36.9796C53.7794 36.9546 53.7933 36.9114 53.7933 36.8502ZM57.3884 36.2893V36.9357C57.3884 37.0295 57.3354 37.0848 57.2299 37.1011C57.1019 37.1233 56.9907 37.1398 56.8963 37.1509C56.8016 37.162 56.6931 37.1675 56.571 37.1675C56.3441 37.1675 56.1437 37.1493 55.9696 37.1133C55.7954 37.077 55.6502 37.0061 55.5343 36.9003C55.4183 36.7945 55.3298 36.6483 55.269 36.4617C55.2083 36.2753 55.1778 36.0347 55.1778 35.7394V33.3175L54.5106 33.2088C54.4659 33.1977 54.4257 33.1769 54.3895 33.1462C54.3533 33.1157 54.3353 33.0781 54.3353 33.0335V32.4822C54.3353 32.4378 54.3533 32.3974 54.3895 32.3611C54.4257 32.325 54.4659 32.3068 54.5106 32.3068H55.1778V31.622C55.1778 31.5774 55.1945 31.5414 55.2276 31.5134C55.2605 31.4857 55.2993 31.4663 55.3436 31.455L56.355 31.2798H56.38C56.4241 31.2798 56.4602 31.2921 56.4875 31.3171C56.5154 31.3423 56.5293 31.3771 56.5293 31.4215V32.3068H57.2133C57.2577 32.3068 57.2966 32.3237 57.3301 32.3573C57.3633 32.3909 57.3801 32.4305 57.3801 32.4752V33.1573C57.3801 33.2024 57.3633 33.2416 57.3301 33.2752C57.2966 33.3089 57.2577 33.3257 57.2133 33.3257H56.5293V35.7561C56.5293 35.9231 56.5431 36.0304 56.571 36.0776C56.5987 36.1249 56.6765 36.1485 56.8045 36.1485H57.2133C57.3301 36.1485 57.3884 36.1955 57.3884 36.2893Z",fill:"#005697"}),n.jsx("path",{d:"M52.6187 14.7398H39.0664L37.6881 16.2935L33.2155 21.3349V21.3351L31.8372 22.8886H18.464L19.821 21.3153L20.4633 20.5706L21.8202 18.9973H15.6582C14.5325 18.9973 13.6113 19.943 13.6113 21.0987V25.5326C13.6113 26.6885 14.5325 27.6342 15.6582 27.6342H39.2492C40.3749 27.6342 41.9127 26.9318 42.6665 26.0733L46.235 22.0097L52.6187 14.7398Z",fill:"#005697"}),n.jsx("path",{d:"M55.3418 10C56.4676 10 57.3887 10.9457 57.3887 12.1015V16.5353C57.3887 17.691 56.4676 18.6368 55.3418 18.6368H49.1999L50.5697 17.0753H50.5699L51.2491 16.3012L52.6189 14.7398H39.0667L31.8375 22.8945H18.3813L28.0314 11.9701L28.3966 11.5566C29.153 10.7005 30.6929 10 31.8186 10H55.3418V10Z",fill:"#FBD500"})]}),re=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsxs("g",{"clip-path":"url(#clip0_550_235)",children:[n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26.4382 8C22.3647 8 19.0625 11.3022 19.0625 15.3758V32.6242C19.0625 36.6978 22.3647 40 26.4382 40H43.5153C47.5889 40 50.8911 36.6978 50.8911 32.6242V15.3758C50.8911 11.3022 47.5889 8 43.5153 8H26.4382Z",fill:"#00D632"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40.1482 19.902C38.9333 18.8737 37.3938 18.3084 35.8022 18.3059C34.4908 18.3059 33.1795 18.7405 33.1795 19.9469C33.1795 21.0467 34.347 21.4771 35.7853 22.0072C35.9248 22.0586 36.0668 22.111 36.2105 22.1649C39.0542 23.1241 41.3959 24.3005 41.3959 27.088C41.3959 30.1153 39.0467 32.1835 35.2026 32.4195L34.8542 34.0418C34.7887 34.3448 34.5199 34.5605 34.2098 34.5589H31.7932C31.5955 34.554 31.4102 34.4618 31.2872 34.307C31.1642 34.1521 31.1163 33.9507 31.1563 33.7571L31.531 32.0448C30.08 31.6748 28.7461 30.9441 27.6532 29.9205C27.5265 29.7983 27.4551 29.63 27.4551 29.454C27.4551 29.2781 27.5265 29.1097 27.6532 28.9876L28.9945 27.6763C29.2482 27.4268 29.655 27.4268 29.9086 27.6763C31.1374 28.8485 32.7778 29.4904 34.4758 29.4634C36.2255 29.4634 37.4132 28.7215 37.4132 27.5451C37.4132 26.4815 36.4394 26.1253 34.5914 25.4494C34.3953 25.3776 34.1894 25.3024 33.9738 25.2222C31.5984 24.3755 29.3504 23.1653 29.3504 20.3516C29.3504 17.0958 32.0705 15.5072 35.2776 15.3498L35.6148 13.6975C35.6816 13.3974 35.948 13.1839 36.2555 13.1842H38.6646C38.8609 13.1836 39.0469 13.2714 39.1712 13.4233C39.2955 13.5752 39.3447 13.775 39.3052 13.9673L38.9306 15.8144C40.157 16.2153 41.2935 16.8516 42.2764 17.6877C42.4118 17.8042 42.4925 17.972 42.4989 18.1505C42.5053 18.3291 42.4368 18.5022 42.31 18.6281L41.0587 19.8833C40.8081 20.1298 40.4087 20.138 40.1482 19.902Z",fill:"white"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_550_235",children:n.jsx("rect",{width:"32",height:"32",fill:"white",transform:"translate(19 8)"})})})]}),se=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M18.2466 6.855H27.4811C28.7703 6.855 29.5728 7.90603 29.272 9.20036L24.972 27.6585C24.6682 28.949 23.3782 30 22.0886 30H12.8537C11.5641 30 10.7624 28.949 11.0632 27.6585L15.3654 9.20036C15.6653 7.90603 16.9545 6.855 18.2466 6.855Z",fill:"#ED171F"}),n.jsx("path",{d:"M26.7132 6.855H37.3336C38.6223 6.855 38.0411 7.90603 37.7381 9.20036L33.4385 27.6585C33.1382 28.949 33.2324 30 31.9402 30H21.3206C20.0298 30 19.2303 28.949 19.5336 27.6585L23.8315 9.20036C24.1353 7.90603 25.424 6.855 26.7132 6.855Z",fill:"#082F67"}),n.jsx("path",{d:"M36.9136 6.855H46.1468C47.4368 6.855 48.2384 7.90603 47.9364 9.20036L43.6372 27.6585C43.3351 28.949 42.0455 30 40.7516 30H31.521C30.2288 30 29.4285 28.949 29.7314 27.6585L34.0293 9.20036C34.3318 7.90603 35.621 6.855 36.9136 6.855Z",fill:"#006A65"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.4247 20.4849L37.2994 24.2089H37.6019L37.3681 24.979H37.0656L36.9951 25.218H35.9242L35.9968 24.979H33.82L34.0387 24.2664H34.2587L35.4005 20.4849L35.6286 19.7209H36.7212L36.6071 20.1072C36.6071 20.1072 36.8979 19.8972 37.1741 19.8254C37.4502 19.7528 39.0337 19.7265 39.0337 19.7265L38.799 20.4849H38.4247ZM36.4995 20.4849L36.2103 21.4365C36.2103 21.4365 36.5336 21.2909 36.7112 21.2421C36.8901 21.1958 37.1589 21.1777 37.1589 21.1777L37.3681 20.4849H36.4995ZM36.0669 21.9098L35.7678 22.8994C35.7678 22.8994 36.0984 22.73 36.276 22.6773C36.4549 22.6358 36.7255 22.6021 36.7255 22.6021L36.9377 21.9098H36.0669ZM35.3702 24.2197H36.241L36.4925 23.383H35.6217L35.3702 24.2197Z",fill:"white"}),n.jsx("path",{d:"M38.9076 19.7265H40.0736L40.0866 20.1613C40.0797 20.2343 40.1427 20.2689 40.2776 20.2689H40.5144L40.2979 20.9863H39.6687C39.1224 21.0265 38.9163 20.7918 38.9284 20.5286L38.9076 19.7265Z",fill:"white"}),n.jsx("path",{d:"M39.0602 23.1305H37.9487L38.1397 22.4909H39.4099L39.5918 21.9079H38.3368L38.5525 21.1875H42.0439L41.8252 21.9079H40.6545L40.4713 22.4909H41.6446L41.4514 23.1305H40.1808L39.9561 23.3998H40.4713L40.5962 24.2049C40.6096 24.284 40.6121 24.3363 40.6372 24.3708C40.6631 24.4006 40.8174 24.4145 40.9069 24.4145H41.0633L40.8256 25.198H40.4293C40.368 25.198 40.2772 25.1928 40.1532 25.1863C40.033 25.1759 39.9479 25.1064 39.8684 25.0683C39.7958 25.032 39.6869 24.9439 39.6618 24.7939L39.5374 23.9905L38.9608 24.7831C38.7772 25.032 38.5291 25.2226 38.1108 25.2226H37.3009L37.5131 24.5238H37.8221C37.9116 24.5238 37.9906 24.4888 38.0485 24.4586C38.1082 24.4335 38.1605 24.4037 38.2201 24.3155L39.0602 23.1305Z",fill:"white"}),n.jsx("path",{d:"M26.8864 21.3815H29.8294L29.612 22.0842H28.4348L28.252 22.6818H29.456L29.2365 23.4075H28.0333L27.7416 24.3811C27.7057 24.4892 28.026 24.5043 28.1418 24.5043L28.7451 24.4209L28.5035 25.223H27.1457C27.0389 25.223 26.9555 25.2079 26.8371 25.1811C26.7226 25.1525 26.672 25.1015 26.6214 25.0237C26.5722 24.9438 26.497 24.879 26.548 24.7096L26.9374 23.42H26.2692L26.4909 22.6818H27.1629L27.3414 22.0842H26.672L26.8864 21.3815Z",fill:"white"}),n.jsx("path",{d:"M28.8682 20.1195H30.0752L29.8544 20.8541H28.2052L28.0259 21.0084C27.9498 21.0832 27.923 21.0516 27.8232 21.1057C27.7303 21.1532 27.5337 21.2461 27.28 21.2461H26.7506L26.9658 20.5395H27.1244C27.2588 20.5395 27.35 20.5283 27.3962 20.4985C27.449 20.4656 27.5073 20.3909 27.5751 20.269L27.8777 19.718H29.0786L28.8682 20.1195Z",fill:"white"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.5938 19.7264H31.6223L31.4728 20.2437C31.4728 20.2437 31.7969 19.9848 32.0247 19.8923C32.2511 19.8072 32.7641 19.7311 32.7641 19.7311L34.428 19.7225L33.861 21.6106C33.7659 21.9347 33.6548 22.1439 33.5852 22.239C33.5217 22.3366 33.4482 22.4183 33.3026 22.4974C33.1626 22.5722 33.0351 22.6154 32.9175 22.6275C32.8073 22.6357 32.6388 22.64 32.4046 22.6422H30.8025L30.3501 24.1366C30.3073 24.284 30.2865 24.354 30.3146 24.3937C30.3384 24.43 30.3928 24.4702 30.468 24.4702L31.1746 24.4037L30.9339 25.2226H30.1413C29.8898 25.2226 29.7066 25.2174 29.5778 25.2075C29.4559 25.198 29.3284 25.2075 29.2441 25.1414C29.1694 25.0766 29.0574 24.9918 29.06 24.9041C29.0683 24.8229 29.1011 24.688 29.1534 24.5039L30.5938 19.7264ZM32.7775 21.6344H31.0912L30.9884 21.9749H32.4473C32.6198 21.9533 32.6552 21.9779 32.669 21.9697L32.7775 21.6344ZM31.185 21.3271C31.185 21.3271 31.5139 21.0263 32.0778 20.9286C32.2062 20.9036 33.0083 20.9118 33.0083 20.9118L33.1297 20.5081H31.4305L31.185 21.3271Z",fill:"white"}),n.jsx("path",{d:"M33.5921 22.7747L33.4979 23.2285C33.4559 23.3693 33.4209 23.4778 33.3138 23.5686C33.2027 23.6632 33.0696 23.763 32.7606 23.763L32.191 23.7859L32.1862 24.2998C32.1785 24.4459 32.2178 24.4303 32.2411 24.4541C32.2675 24.4787 32.2904 24.4904 32.3168 24.4986L32.4961 24.4904L33.0415 24.4584L32.8168 25.2078H32.191C31.7524 25.2078 31.4274 25.1983 31.3202 25.1127C31.2156 25.0466 31.2018 24.9619 31.2048 24.8188L31.2441 22.8201H32.242L32.2295 23.2285H32.4702C32.5523 23.2285 32.6063 23.2198 32.6417 23.1986C32.6707 23.1749 32.6936 23.1437 32.7096 23.0932L32.8068 22.7747H33.5921Z",fill:"white"}),n.jsx("path",{d:"M19.3395 12.7519C19.3032 12.9127 18.6632 15.8704 18.6606 15.8722C18.5219 16.4698 18.4238 16.8985 18.0824 17.1721C17.8887 17.3311 17.6623 17.4094 17.4008 17.4094C16.9808 17.4094 16.734 17.2006 16.6921 16.8035L16.6843 16.6678C16.6843 16.6678 16.8122 15.8652 16.814 15.8622C16.814 15.8622 17.486 13.1664 17.6065 12.8116C17.6117 12.7917 17.6143 12.7817 17.6169 12.7714C16.3075 12.783 16.0745 12.7714 16.0594 12.7519C16.052 12.7783 16.017 12.946 16.017 12.946L15.3299 15.9815L15.2703 16.2408L15.1579 17.0826C15.1579 17.3311 15.2072 17.536 15.3044 17.7084C15.6177 18.2564 16.511 18.3377 17.0149 18.3377C17.6662 18.3377 18.2751 18.1985 18.6874 17.9478C19.4026 17.5243 19.591 16.8614 19.7583 16.2754L19.8352 15.975C19.8352 15.975 20.5288 13.1759 20.6473 12.8116C20.6507 12.7917 20.6529 12.7817 20.6576 12.7714C19.709 12.7817 19.4298 12.7714 19.3395 12.7519Z",fill:"white"}),n.jsx("path",{d:"M23.1723 18.3077C22.7073 18.3012 22.5444 18.3012 22.0011 18.3289L21.98 18.2887C22.0279 18.0821 22.0794 17.8785 22.1252 17.6689L22.1917 17.3867C22.2924 16.9464 22.3909 16.4347 22.4026 16.2804C22.4121 16.1862 22.4432 15.952 22.1757 15.952C22.0625 15.952 21.9449 16.0073 21.8265 16.0613C21.7608 16.2955 21.6282 16.9515 21.5672 17.2519C21.432 17.8829 21.4233 17.9542 21.3633 18.2666L21.3244 18.3077C20.8451 18.3012 20.6796 18.3012 20.1286 18.3289L20.1026 18.283C20.1951 17.9079 20.2867 17.5298 20.3749 17.1555C20.6057 16.1395 20.6601 15.7501 20.7245 15.2337L20.7677 15.203C21.3049 15.1278 21.435 15.1131 22.0163 14.9934L22.0655 15.0483L21.9778 15.372C22.0759 15.3141 22.1688 15.2549 22.2704 15.203C22.5444 15.0682 22.8495 15.0284 23.0176 15.0284C23.2713 15.0284 23.5496 15.0997 23.6663 15.394C23.7769 15.6564 23.7039 15.9805 23.5586 16.6175L23.4835 16.9412C23.3344 17.6504 23.3102 17.78 23.2267 18.2666L23.1723 18.3077Z",fill:"white"}),n.jsx("path",{d:"M25.0585 18.3077C24.7793 18.3064 24.5995 18.3012 24.4232 18.3064C24.2486 18.3077 24.0779 18.3168 23.8182 18.3289L23.8026 18.3064L23.7853 18.283C23.8562 18.0142 23.8964 17.92 23.9309 17.8245C23.9664 17.7299 24.001 17.6339 24.0623 17.3612C24.1436 17.006 24.1937 16.7571 24.2296 16.5397C24.2667 16.3284 24.2879 16.1495 24.3143 15.9416L24.3359 15.9252L24.3592 15.9053C24.6371 15.866 24.8147 15.84 24.9945 15.8124C25.1769 15.786 25.3605 15.7501 25.6488 15.6957L25.66 15.7207L25.6678 15.7462C25.6142 15.9662 25.5598 16.1862 25.5075 16.41C25.4561 16.6326 25.4016 16.8513 25.3532 17.073C25.2478 17.541 25.2067 17.7148 25.1816 17.8396C25.1587 17.9589 25.1509 18.0237 25.1095 18.2666L25.0844 18.2887L25.0585 18.3077Z",fill:"white"}),n.jsx("path",{d:"M29.2305 16.7091C29.3935 15.9948 29.2686 15.6607 29.1091 15.4563C28.8658 15.1477 28.4397 15.0479 27.9958 15.0479C27.7301 15.0479 27.0952 15.0751 26.5987 15.5332C26.2443 15.8621 26.0779 16.3107 25.9781 16.7389C25.8782 17.175 25.7628 17.9641 26.4867 18.2567C26.7114 18.3509 27.0313 18.3777 27.2396 18.3777C27.7698 18.3777 28.3135 18.2312 28.7206 17.7982C29.0382 17.446 29.1813 16.923 29.2305 16.7091ZM28.0166 16.6573C27.9911 16.777 27.8865 17.2256 27.7426 17.4161C27.6432 17.5562 27.5252 17.6404 27.3947 17.6404C27.358 17.6404 27.1285 17.6404 27.1242 17.2999C27.1216 17.1322 27.1566 16.9576 27.1985 16.7718C27.3208 16.2307 27.4651 15.7769 27.8329 15.7769C28.1225 15.7769 28.1415 16.1145 28.0166 16.6573Z",fill:"white"}),n.jsx("path",{d:"M40.5855 18.3561C40.0254 18.3509 39.8642 18.3509 39.3465 18.373L39.3115 18.331C39.4532 17.7982 39.595 17.267 39.7199 16.7286C39.8819 16.0298 39.9191 15.7329 39.9736 15.324L40.0155 15.2895C40.5713 15.2095 40.726 15.1875 41.3059 15.0803L41.3241 15.1278C41.2178 15.566 41.1115 16.0047 41.0103 16.4446C40.7964 17.3664 40.7186 17.8349 40.6365 18.3163L40.5855 18.3561Z",fill:"white"}),n.jsx("path",{d:"M40.8523 16.7721C41.0152 16.0612 40.3601 16.7094 40.2551 16.4748C40.0943 16.1092 40.195 15.3671 39.5493 15.1195C39.3017 15.0231 38.7183 15.148 38.2204 15.6031C37.8682 15.9307 37.7005 16.3736 37.6016 16.8015C37.5013 17.2315 37.3864 18.0189 38.1063 18.3015C38.3337 18.3979 38.5424 18.4256 38.7498 18.4173C39.4741 18.378 40.0265 17.2855 40.434 16.852C40.749 16.5098 40.8043 16.9808 40.8523 16.7721ZM39.7442 16.7189C39.717 16.833 39.612 17.2868 39.4681 17.4744C39.373 17.6088 39.1466 17.6939 39.0169 17.6939C38.9802 17.6939 38.7524 17.6939 38.7442 17.3564C38.7425 17.1904 38.7775 17.0158 38.8207 16.8283C38.943 16.2989 39.0874 15.8468 39.4551 15.8468C39.7451 15.8468 39.8687 16.1761 39.7442 16.7189Z",fill:"white"}),n.jsx("path",{d:"M32.4031 18.3077C31.9372 18.3012 31.7795 18.3012 31.2319 18.3289L31.2125 18.2887C31.2587 18.0821 31.3114 17.8785 31.3598 17.6689L31.4251 17.3867C31.5262 16.9464 31.6243 16.4347 31.6355 16.2804C31.6446 16.1862 31.6757 15.952 31.4104 15.952C31.2954 15.952 31.1792 16.0073 31.0599 16.0613C30.9951 16.2955 30.862 16.9515 30.798 17.2519C30.6653 17.8829 30.6563 17.9542 30.5962 18.2666L30.5564 18.3077C30.0776 18.3012 29.9134 18.3012 29.3637 18.3289L29.3386 18.283C29.4302 17.9079 29.5201 17.5298 29.6083 17.1555C29.8386 16.1395 29.8935 15.7501 29.9575 15.2337L30.0007 15.203C30.5378 15.1278 30.6684 15.1131 31.2496 14.9934L31.2954 15.0483L31.2112 15.372C31.3067 15.3141 31.4039 15.2549 31.5029 15.203C31.7751 15.0682 32.0828 15.0284 32.2475 15.0284C32.502 15.0284 32.7808 15.0997 32.9005 15.394C33.0098 15.6564 32.9359 15.9805 32.7894 16.6175L32.7164 16.9412C32.5643 17.6504 32.5409 17.78 32.4605 18.2666L32.4031 18.3077Z",fill:"white"}),n.jsx("path",{d:"M36.9307 14.4822C36.8486 14.8504 36.6096 15.1629 36.3006 15.3137C36.0452 15.4421 35.7344 15.4516 35.4129 15.4516H35.2059L35.2215 15.369C35.2215 15.369 35.6048 13.7048 35.6031 13.71L35.6143 13.6248L35.6212 13.5591L35.7742 13.5751C35.7742 13.5751 36.5616 13.6434 36.5815 13.6456C36.8931 13.764 37.0201 14.0769 36.9307 14.4822ZM36.4276 12.7467C36.4255 12.7467 36.0417 12.7518 36.0417 12.7518C35.0378 12.7631 34.6354 12.7583 34.4703 12.7385C34.4531 12.8119 34.428 12.9424 34.428 12.9424L34.0693 14.6115C34.0693 14.6115 33.2097 18.1565 33.1687 18.3229C34.0447 18.3134 34.4042 18.3134 34.5542 18.3285C34.5883 18.1621 34.7932 17.172 34.7932 17.172C34.7932 17.172 34.9682 16.4447 34.9786 16.4179C34.9786 16.4179 35.0326 16.3436 35.0883 16.3137H35.1683C35.9233 16.3137 36.7781 16.3137 37.4462 15.8206C37.9004 15.4831 38.2138 14.9848 38.3516 14.3802C38.3888 14.2316 38.4147 14.0535 38.4147 13.8772C38.4147 13.6456 38.368 13.4161 38.2323 13.2363C37.8918 12.7583 37.2142 12.7518 36.4276 12.7467Z",fill:"white"}),n.jsx("path",{d:"M45.1748 15.0751L45.1303 15.0254C44.5581 15.1399 44.4535 15.1598 43.9263 15.2293L43.8865 15.2674C43.8848 15.2739 43.8831 15.2842 43.8818 15.2924L43.8792 15.2842C43.4868 16.1913 43.4993 15.9951 43.1791 16.7073C43.1769 16.6736 43.1765 16.6525 43.1756 16.6187L43.0961 15.0751L43.0455 15.0254C42.4466 15.1399 42.4306 15.1598 41.8761 15.2293L41.8316 15.2674C41.8277 15.2877 41.8264 15.3076 41.8234 15.3292L41.8277 15.3374C41.8968 15.6931 41.8809 15.6131 41.9496 16.171C41.982 16.445 42.0243 16.7225 42.0567 16.9926C42.1121 17.4463 42.1423 17.6706 42.208 18.3612C41.835 18.981 41.7447 19.2148 41.3882 19.7584L41.4072 19.8077C41.9496 19.7874 42.0745 19.7874 42.4755 19.7874L42.5641 19.6884C42.8671 19.0354 45.1748 15.0751 45.1748 15.0751Z",fill:"white"}),n.jsx("path",{d:"M25.5693 15.4586C25.8753 15.2447 25.9146 14.9491 25.6553 14.7957C25.3926 14.6414 24.9353 14.6898 24.6259 14.9042C24.3143 15.1151 24.2802 15.4115 24.5399 15.5662C24.8001 15.7171 25.2595 15.673 25.5693 15.4586Z",fill:"white"}),n.jsx("path",{d:"M42.5238 19.7429L42.0727 20.5152C41.93 20.7788 41.6651 20.9771 41.2442 20.9784L40.5255 20.9668L40.7347 20.2706H40.8738C40.9477 20.2706 41.0018 20.2658 41.0432 20.2455C41.0787 20.2343 41.105 20.2062 41.1344 20.1647L41.3993 19.7429H42.5238Z",fill:"white"})]}),le=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M1 10L59 10",stroke:"#D3D3D3",strokeWidth:"7"}),n.jsx("path",{d:"M5 20H34",stroke:"#D3D3D3",strokeWidth:"2",strokeLinecap:"round"}),n.jsx("path",{d:"M5 27H25",stroke:"#D3D3D3",strokeWidth:"2",strokeLinecap:"round"}),n.jsx("rect",{x:"46",y:"21",width:"10",height:"7",rx:"2",fill:"#D9D9D9"})]}),ue=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M16.5247 19.2244C16.5247 12.2923 21.9422 6.67337 28.6257 6.67337C35.309 6.67337 40.7267 12.2923 40.7267 19.2244C40.7267 26.1563 35.309 31.7755 28.6257 31.7755C21.9422 31.7755 16.5247 26.1563 16.5247 19.2244Z",fill:"white"}),n.jsx("path",{d:"M35.9447 18.977C35.9391 15.7623 34.0025 13.0219 31.2728 11.9361V26.0177C34.0025 24.9305 35.9391 22.1925 35.9447 18.977ZM26.0659 26.0146V11.937C23.3393 13.0268 21.4049 15.7642 21.3979 18.977C21.4049 22.1892 23.3393 24.9272 26.0659 26.0146ZM28.6708 7.07501C22.3335 7.07748 17.1989 12.404 17.1981 18.977C17.1989 25.5492 22.3335 30.8749 28.6708 30.8758C35.0083 30.8749 40.1444 25.5492 40.146 18.977C40.1444 12.404 35.0083 7.07748 28.6708 7.07501ZM28.6426 31.9999C21.7077 32.0333 16 26.2067 16 19.1126C16 11.3606 21.7077 5.99835 28.6426 6H31.8932C38.7455 5.99835 45 11.3575 45 19.1126C45 26.2034 38.7455 31.9999 31.8932 31.9999H28.6426Z",fill:"#264B9A"})]}),de=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M0.5 8C0.5 3.85786 3.85786 0.5 8 0.5H52C56.1421 0.5 59.5 3.85786 59.5 8V30C59.5 34.1421 56.1421 37.5 52 37.5H8C3.85786 37.5 0.5 34.1421 0.5 30V8Z",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M9.19232 21.3753C8.69269 21.8265 8.04327 22.0234 7.01615 22.0234H6.58905V16.6315H7.01615C8.04327 16.6315 8.66695 16.8153 9.19232 17.2909C9.74271 17.7809 10.0728 18.539 10.0728 19.3202C10.0728 20.1034 9.74271 20.8859 9.19232 21.3753ZM7.33469 15.2496H5V23.404H7.32208C8.55684 23.404 9.44888 23.1129 10.2316 22.4621C11.1617 21.6921 11.7116 20.5322 11.7116 19.3327C11.7116 16.926 9.91383 15.2496 7.33469 15.2496Z",fill:"#231F20"}),n.jsx("path",{d:"M12.4438 23.404H14.0339V15.2496H12.4438V23.404Z",fill:"#231F20"}),n.jsx("path",{d:"M17.9229 18.379C16.9683 18.0253 16.6881 17.7928 16.6881 17.3521C16.6881 16.8383 17.1875 16.4484 17.8729 16.4484C18.3498 16.4484 18.7411 16.644 19.1556 17.1091L19.9879 16.019C19.3038 15.4209 18.4856 15.1153 17.592 15.1153C16.1491 15.1153 15.0487 16.1171 15.0487 17.4516C15.0487 18.5746 15.5612 19.1496 17.0551 19.6871C17.6774 19.9071 17.9941 20.0533 18.1542 20.1521C18.4717 20.359 18.6312 20.6527 18.6312 20.9952C18.6312 21.6559 18.1058 22.1453 17.3959 22.1453C16.6379 22.1453 16.0266 21.7665 15.6605 21.0585L14.6329 22.0471C15.3656 23.1227 16.2456 23.5996 17.4559 23.5996C19.1087 23.5996 20.2684 22.501 20.2684 20.9228C20.2684 19.6265 19.7324 19.0403 17.9229 18.379Z",fill:"#231F20"}),n.jsx("path",{d:"M20.7702 19.3328C20.7702 21.729 22.652 23.5871 25.0739 23.5871C25.7583 23.5871 26.3445 23.4528 27.0677 23.1129V21.2403C26.4317 21.8766 25.8684 22.1328 25.1475 22.1328C23.5456 22.1328 22.4089 20.9715 22.4089 19.3203C22.4089 17.7552 23.5821 16.5202 25.0739 16.5202C25.8321 16.5202 26.407 16.7909 27.0677 17.4378V15.5665C26.3697 15.2121 25.7957 15.0659 25.1112 15.0659C22.7019 15.0659 20.7702 16.9615 20.7702 19.3328Z",fill:"#231F20"}),n.jsx("path",{d:"M39.6784 20.7265L37.5033 15.2497H35.7663L39.2264 23.6135H40.0824L43.605 15.2497H41.8806L39.6784 20.7265Z",fill:"#231F20"}),n.jsx("path",{d:"M44.3237 23.404H48.8345V22.0234H45.9135V19.8221H48.7263V18.4409H45.9135V16.6315H48.8345V15.2496H44.3237V23.404Z",fill:"#231F20"}),n.jsx("path",{d:"M51.9414 19.0041H51.4762V16.534H51.9658C52.9569 16.534 53.4954 16.949 53.4954 17.7427C53.4954 18.5628 52.9569 19.0041 51.9414 19.0041ZM55.1326 17.6571C55.1326 16.1303 54.0803 15.2496 52.246 15.2496H49.8879V23.404H51.4762V20.1284H51.6841L53.8855 23.404H55.8412L53.2739 19.9684C54.4724 19.7246 55.1326 18.9059 55.1326 17.6571Z",fill:"#231F20"}),n.jsx("path",{d:"M56.0974 15.7753H56.0678V15.5875H56.0989C56.1836 15.5875 56.2281 15.6178 56.2281 15.6797C56.2281 15.7436 56.1831 15.7753 56.0974 15.7753ZM56.4 15.6778C56.4 15.5342 56.3007 15.4558 56.1273 15.4558H55.8967V16.1744H56.0678V15.8958L56.269 16.1744H56.479L56.2425 15.878C56.3434 15.851 56.4 15.7772 56.4 15.6778Z",fill:"#231F20"}),n.jsx("path",{d:"M56.1591 16.3292C55.8843 16.3292 55.6597 16.1 55.6597 15.8148C55.6597 15.5283 55.8823 15.2997 56.1591 15.2997C56.4328 15.2997 56.6554 15.5335 56.6554 15.8148C56.6554 16.0974 56.4328 16.3292 56.1591 16.3292ZM56.1617 15.1871C55.8128 15.1871 55.5354 15.4657 55.5354 15.8135C55.5354 16.1619 55.8159 16.4412 56.1617 16.4412C56.5018 16.4412 56.7808 16.1586 56.7808 15.8135C56.7808 15.4703 56.5018 15.1871 56.1617 15.1871Z",fill:"#231F20"}),n.jsx("path",{d:"M36.2191 19.3183C36.2191 21.7027 34.2863 23.6359 31.9014 23.6359C29.5166 23.6359 27.5835 21.7027 27.5835 19.3183C27.5835 16.9332 29.5166 15 31.9014 15C34.2863 15 36.2191 16.9332 36.2191 19.3183Z",fill:"#F36719"})]}),ce=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.0266 9.91185H35.684C47.003 9.91185 51.3527 16.0977 51.3527 23.9167C51.3527 33.2698 45.273 37.9711 35.684 37.9711H19.0266V9.91185ZM20.6082 11.5944V36.3875H35.6838C44.7786 36.3875 49.7215 32.1316 49.7215 23.9662C49.7215 15.5534 44.3832 11.5944 35.6838 11.5944H20.6082ZM25.0568 24.4115C26.722 24.4115 28.072 23.06 28.072 21.3928C28.072 19.7256 26.722 18.3741 25.0568 18.3741C23.3916 18.3741 22.0417 19.7256 22.0417 21.3928C22.0417 23.06 23.3916 24.4115 25.0568 24.4115ZM22.635 25.6982H27.479V34.309H22.635V25.6982Z",fill:"black"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M44.2351 18.6216H45.6191V22.7785H47.6456C47.1019 15.207 41.1211 13.5244 35.684 13.5244H29.9009V18.6216H30.7412C32.3229 18.6216 33.262 19.6608 33.262 21.3929C33.262 23.1249 32.3229 24.1641 30.7906 24.1641H29.9009V34.309H35.684C44.5317 34.309 47.5468 30.2016 47.6951 24.1641H44.2351V18.6216ZM37.5623 22.7785V24.1641H34.1023V18.6216H37.4634V20.0072H35.4863V20.6505H37.3646V22.0362H35.5357V22.7785H37.5623ZM39.8358 18.6216H41.813L43.4935 24.1641H42.0601L41.7635 23.1249H39.9347L39.6381 24.1641H38.1553L39.8358 18.6216ZM40.3456 21.6898H40.3302V21.7393L40.3456 21.6898ZM40.3456 21.6898H41.3188L40.8739 20.1557H40.8245L40.3456 21.6898ZM29.9009 22.7785V20.0072H30.7412C31.2849 20.0072 31.878 20.1557 31.878 21.3929C31.878 22.63 31.3343 22.7785 30.7412 22.7785H29.9009Z",fill:"#D50072"})]}),pe=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M48 27.522C48 30.5171 45.5611 32.956 42.566 32.956H13V11.434C13 8.43887 15.4389 6 18.434 6H48V27.522Z",fill:"white"}),n.jsx("path",{d:"M38.3728 22.0024H40.6191C40.6833 22.0024 40.833 21.981 40.8972 21.981C41.3251 21.8954 41.6888 21.5104 41.6888 20.9755C41.6888 20.4621 41.3251 20.077 40.8972 19.97C40.833 19.9486 40.7047 19.9486 40.6191 19.9486H38.3728V22.0024Z",fill:"url(#paint0_linear_1_133)"}),n.jsx("path",{d:"M40.3625 7.81844C38.2231 7.81844 36.4688 9.55132 36.4688 11.7121V15.7555H41.967C42.0953 15.7555 42.2451 15.7555 42.3521 15.7769C43.5929 15.8411 44.5128 16.4829 44.5128 17.5953C44.5128 18.4725 43.8924 19.2212 42.7371 19.371V19.4138C43.9994 19.4994 44.9621 20.2054 44.9621 21.2964C44.9621 22.4731 43.8924 23.2433 42.4804 23.2433H36.4474V31.1589H42.1595C44.2989 31.1589 46.0532 29.426 46.0532 27.2653V7.81844H40.3625Z",fill:"url(#paint1_linear_1_133)"}),n.jsx("path",{d:"M41.4107 17.852C41.4107 17.3386 41.047 16.9963 40.6191 16.9321C40.5763 16.9321 40.4693 16.9107 40.4052 16.9107H38.3728V18.7933H40.4052C40.4693 18.7933 40.5977 18.7933 40.6191 18.7719C41.047 18.7078 41.4107 18.3655 41.4107 17.852Z",fill:"url(#paint2_linear_1_133)"}),n.jsx("path",{d:"M18.8405 7.81844C16.7011 7.81844 14.9468 9.55132 14.9468 11.7121V21.3178C16.0379 21.8527 17.1718 22.195 18.3056 22.195C19.6534 22.195 20.3808 21.382 20.3808 20.2695V15.7341H23.7182V20.2481C23.7182 22.0024 22.6272 23.4358 18.9261 23.4358C16.6797 23.4358 14.9254 22.9437 14.9254 22.9437V31.1375H20.6375C22.7769 31.1375 24.5312 29.4046 24.5312 27.2439V7.81844H18.8405Z",fill:"url(#paint3_linear_1_133)"}),n.jsx("path",{d:"M29.6015 7.81844C27.4621 7.81844 25.7079 9.55132 25.7079 11.7121V16.8038C26.692 15.9694 28.4035 15.4346 31.1632 15.5629C32.6394 15.6271 34.2225 16.0336 34.2225 16.0336V17.6809C33.431 17.2744 32.4896 16.9107 31.2702 16.8252C29.1736 16.6754 27.9114 17.7023 27.9114 19.4994C27.9114 21.3178 29.1736 22.3447 31.2702 22.1736C32.4896 22.088 33.431 21.7029 34.2225 21.3178V22.9651C34.2225 22.9651 32.6608 23.3716 31.1632 23.4358C28.4035 23.5642 26.692 23.0293 25.7079 22.195V31.1803H31.42C33.5593 31.1803 35.3136 29.4474 35.3136 27.2867V7.81844H29.6015Z",fill:"url(#paint4_linear_1_133)"}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_1_133",x1:"36.4652",y1:"20.9781",x2:"46.0789",y2:"20.9781",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint1_linear_1_133",x1:"36.465",y1:"19.4793",x2:"46.0794",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint2_linear_1_133",x1:"36.4649",y1:"17.8493",x2:"46.079",y2:"17.8493",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint3_linear_1_133",x1:"14.9423",y1:"19.4793",x2:"24.7049",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#1F286F"}),n.jsx("stop",{offset:"0.4751","stop-color":"#004E94"}),n.jsx("stop",{offset:"0.8261","stop-color":"#0066B1"}),n.jsx("stop",{offset:"1","stop-color":"#006FBC"})]}),n.jsxs("linearGradient",{id:"paint4_linear_1_133",x1:"25.6525",y1:"19.4793",x2:"35.1343",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#6C2C2F"}),n.jsx("stop",{offset:"0.1735","stop-color":"#882730"}),n.jsx("stop",{offset:"0.5731","stop-color":"#BE1833"}),n.jsx("stop",{offset:"0.8585","stop-color":"#DC0436"}),n.jsx("stop",{offset:"1","stop-color":"#E60039"})]})]})]}),me=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{d:"M34.1572 17.6958C34.1572 16.7565 34.9551 16 35.8958 16C36.8366 16 37.6345 16.7648 37.6345 17.6958C37.6345 18.6269 36.8618 19.4166 35.8958 19.4166C34.9299 19.4166 34.1572 18.6518 34.1572 17.6958ZM29 16.2328H32.0238V32.9917H29V16.2328ZM37.4245 21.021H34.3756V32.9917H37.4245V21.021ZM59.3384 26.599C61.6314 25.2024 63.1937 23.1242 63.8068 21.0127H60.7579C59.9599 23.0244 58.1373 24.5374 56.1382 25.1775V16.2328H53.0893V32.9917H56.1382V28.0039C58.4648 28.5775 60.3043 30.5726 60.9342 32.9917H64C63.5296 30.4562 61.7826 28.0787 59.3384 26.6073V26.599ZM42.8253 22.3594C43.6232 21.312 45.1771 20.6968 46.4454 20.6968C48.7972 20.6968 50.7459 22.401 50.7543 24.978V32.9834H47.7053V25.643C47.7053 24.5873 47.2265 23.3653 45.6895 23.3653C43.8752 23.3653 42.8337 24.9614 42.8337 26.8235V33H39.7847V21.0293H42.8337V22.3594H42.8253Z",fill:"black"}),n.jsx("path",{d:"M14.5 34C19.7488 34 24 29.7488 24 24.5C24 19.2513 19.7488 15 14.5 15C9.25125 15 5 19.2513 5 24.5C5 29.7488 9.25125 34 14.5 34Z",fill:"#00D66F"}),n.jsx("path",{d:"M13.8794 19H11C11.5603 21.2993 13.1946 23.2625 15.2412 24.5C13.1868 25.7375 11.5603 27.7007 11 30H13.8794C14.5953 27.8764 16.572 26.0278 19 25.6458V23.3465C16.572 22.9722 14.5953 21.1236 13.8794 19Z",fill:"#011E0F"})]}),ye=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 34.3139C33.1169 36.3704 30.0255 37.6119 26.6475 37.6119C19.1102 37.6119 13 31.4308 13 23.806C13 16.1811 19.1102 10 26.6475 10C30.0255 10 33.1169 11.2415 35.5 13.2981C37.8831 11.2415 40.9745 10 44.3525 10C51.8898 10 58 16.1811 58 23.806C58 31.4308 51.8898 37.6119 44.3525 37.6119C40.9745 37.6119 37.8831 36.3704 35.5 34.3139Z",fill:"#ED0006"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 34.3139C38.4344 31.7816 40.2951 28.0136 40.2951 23.806C40.2951 19.5983 38.4344 15.8303 35.5 13.2981C37.8831 11.2415 40.9745 10 44.3525 10C51.8898 10 58 16.1811 58 23.806C58 31.4308 51.8898 37.6119 44.3525 37.6119C40.9745 37.6119 37.8831 36.3704 35.5 34.3139Z",fill:"#F9A000"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 13.2981C38.4344 15.8304 40.2951 19.5984 40.2951 23.806C40.2951 28.0136 38.4344 31.7816 35.5 34.3138C32.5657 31.7816 30.705 28.0136 30.705 23.806C30.705 19.5984 32.5657 15.8304 35.5 13.2981Z",fill:"#FF5E00"})]}),ge=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"#10298E",stroke:"#D9D9D9"}),n.jsx("path",{d:"M12.7744 16.084C14.4396 16.084 15.6264 16.1801 16.334 16.3701C18.0609 16.8349 18.9248 18.137 18.9248 20.2764C18.9248 20.4518 18.9113 20.714 18.8857 21.0645H14.918C14.918 20.4123 14.8407 19.9748 14.6885 19.752C14.4524 19.4222 13.801 19.2569 12.7344 19.2568C11.6983 19.2568 11.0109 19.3519 10.6758 19.542C10.3409 19.7327 10.1729 20.1477 10.1729 20.7861C10.1729 21.3638 10.3217 21.7443 10.6191 21.9268C10.8324 22.0562 11.1145 22.1325 11.4658 22.1553L12.2656 22.2119C13.9806 22.3259 15.0521 22.4065 15.4795 22.4521C16.8358 22.5891 17.8195 22.9497 18.4297 23.5352C18.9098 23.992 19.1958 24.5898 19.2871 25.3271C19.3405 25.7681 19.3672 26.267 19.3672 26.8213C19.3672 28.0993 19.2457 29.0356 19.002 29.6289C18.5601 30.7174 17.5669 31.4046 16.0225 31.6934C15.3754 31.8154 14.3858 31.8769 13.0547 31.877C10.8322 31.877 9.28274 31.7449 8.4082 31.4785C7.33499 31.1522 6.6276 30.4905 6.28516 29.4951C6.09445 28.941 6.00001 28.0182 6 26.7266H9.96875C9.96875 26.8706 9.96875 26.9808 9.96875 27.0566C9.96876 27.746 10.1668 28.1893 10.5615 28.3867C10.8351 28.5229 11.1654 28.594 11.5537 28.6025H13.0127C13.7572 28.6025 14.2325 28.5649 14.4375 28.4883C14.8023 28.3446 15.0418 28.1131 15.1562 27.793C15.217 27.596 15.247 27.3411 15.2471 27.0293C15.2471 26.3303 14.992 25.9045 14.4834 25.752C14.2928 25.6917 13.4079 25.6075 11.8291 25.501C10.5609 25.4103 9.67998 25.3228 9.18652 25.2383C7.88722 24.9948 7.02094 24.4944 6.58887 23.7344C6.20918 23.0886 6.01956 22.1116 6.01953 20.8047C6.01953 19.8092 6.12198 19.0105 6.32715 18.4102C6.53252 17.8097 6.86368 17.3538 7.32031 17.042C7.98917 16.5635 8.84498 16.2823 9.88672 16.1982C10.7538 16.1225 11.7164 16.084 12.7744 16.084ZM44.2861 16C45.3761 16 46.2079 16.0894 46.7793 16.2676C48.0865 16.6779 48.9639 17.5176 49.4131 18.7871C49.645 19.4533 49.7607 20.4565 49.7607 21.7959C49.7607 23.4063 49.6323 24.564 49.3779 25.2686C48.8682 26.6618 47.8187 27.4648 46.2344 27.6729C46.048 27.7041 45.2548 27.7316 43.8555 27.7539L43.1475 27.7773H40.6045V31.877H36.3389V16H44.2861ZM64 31.877H59.6787L58.8652 29.1328H53.1621L52.3955 31.877H47.9824L52.7441 16H59.1787L64 31.877ZM54.0801 26.04H58.0186L56.0195 19.1572L54.0801 26.04ZM40.6035 24.0947H43.2627C44.1059 24.0643 44.6191 23.9992 44.8037 23.8975C45.0556 23.7585 45.2244 23.4803 45.3086 23.0635C45.3624 22.7859 45.3896 22.3732 45.3896 21.8252C45.3896 21.1539 45.336 20.6561 45.2285 20.3311C45.0751 19.8759 44.7078 19.5988 44.126 19.498C44.011 19.4828 43.7353 19.4746 43.2988 19.4746H40.6035V24.0947Z",fill:"white"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.45 18.2337C32.2095 18.2337 33.7797 19.0456 34.8119 20.3173L35.7314 18.3424C34.2933 16.9808 32.336 16.1413 30.1772 16.1413C26.8159 16.1413 23.9406 18.1748 22.7605 21.0533H20.9674L19.9087 23.3269H22.2154C22.1981 23.5378 22.1869 23.7489 22.1869 23.9643C22.1869 24.2249 22.2004 24.4824 22.2262 24.7369H21.0669L20.0083 27.0113H22.8155C24.0293 29.8169 26.8686 31.7866 30.1772 31.7866C31.8445 31.7866 33.3917 31.2862 34.6727 30.4314V27.644C33.6411 28.8205 32.1322 29.564 30.45 29.564C28.4837 29.564 26.754 28.5484 25.7468 27.0113H31.6253L32.6838 24.7369H24.8819C24.8417 24.4632 24.8202 24.1835 24.8202 23.8986C24.8202 23.706 24.8302 23.5153 24.8486 23.3269H33.3399L34.3985 21.0533H25.583C26.5579 19.3679 28.3721 18.2337 30.45 18.2337",fill:"#FFBE00"})]}),be=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.2505 32.5165H17.0099L13.8299 20.3847C13.679 19.8267 13.3585 19.3333 12.8871 19.1008C11.7106 18.5165 10.4142 18.0514 9 17.8169V17.3498H15.8313C16.7742 17.3498 17.4813 18.0514 17.5991 18.8663L19.2491 27.6173L23.4877 17.3498H27.6104L21.2505 32.5165ZM29.9675 32.5165H25.9626L29.2604 17.3498H33.2653L29.9675 32.5165ZM38.4467 21.5514C38.5646 20.7346 39.2717 20.2675 40.0967 20.2675C41.3931 20.1502 42.8052 20.3848 43.9838 20.9671L44.6909 17.7016C43.5123 17.2345 42.216 17 41.0395 17C37.1524 17 34.3239 19.1008 34.3239 22.0165C34.3239 24.2346 36.3274 25.3992 37.7417 26.1008C39.2717 26.8004 39.861 27.2675 39.7431 27.9671C39.7431 29.0165 38.5646 29.4836 37.3881 29.4836C35.9739 29.4836 34.5596 29.1338 33.2653 28.5494L32.5582 31.8169C33.9724 32.3992 35.5025 32.6338 36.9167 32.6338C41.2752 32.749 43.9838 30.6502 43.9838 27.5C43.9838 23.5329 38.4467 23.3004 38.4467 21.5514ZM58 32.5165L54.82 17.3498H51.4044C50.6972 17.3498 49.9901 17.8169 49.7544 18.5165L43.8659 32.5165H47.9887L48.8116 30.3004H53.8772L54.3486 32.5165H58ZM51.9936 21.4342L53.1701 27.1502H49.8723L51.9936 21.4342Z",fill:"#172B85"})]}),he=Wn("\n fragment CardImage_PaymentMethodFragment on PaymentMethod {\n metadata {\n issuer\n type\n }\n }\n");function ve({paymentMethod:e}){var t,i,a,o;const r=Yn(he,e),s=null===(i=null===(t=null==r?void 0:r.metadata)||void 0===t?void 0:t.issuer)||void 0===i?void 0:i.toLowerCase(),l=null===(o=null===(a=null==r?void 0:r.metadata)||void 0===a?void 0:a.type)||void 0===o?void 0:o.toLowerCase(),u="w-12 h-8";if("cashapp"===l)return n.jsx(re,{className:u});if("link"===l)return n.jsx(me,{className:u});switch(s){case"visa":return n.jsx(be,{className:u});case"mastercard":return n.jsx(ye,{className:u});case"amex":return n.jsx(ae,{className:u});case"jcb":return n.jsx(pe,{className:u});case"diners_club":case"diners":return n.jsx(ue,{className:u});case"discover":return n.jsx(de,{className:u});case"unionpay":case"union_pay":case"china_union_pay":case"china_unionpay":return n.jsx(se,{className:u});case"sepa":return n.jsx(ge,{className:u});case"ideal":return n.jsx(ce,{className:u});case"bancontact":return n.jsx(oe,{className:u});default:return n.jsx(le,{className:u})}}const{Text:fe}=i.Typography,{useToken:xe}=i.theme,Ce=Wn("\n fragment MiniCreditCard_PaymentMethodFragment on PaymentMethod {\n ...CardImage_PaymentMethodFragment\n isDefault\n metadata {\n issuer\n type\n identifier\n }\n state\n failureReason\n id\n }\n ",[he]);function we({className:a,buttons:o,hideDropdownMenu:r=!1,hideDefaultTag:s=!1,onClickRemove:l,paymentMethod:u,onClickSetDefault:d,id:c}){var p,m,y;const{darkMode:g}=e.useContext(Jn),{token:b}=xe(),[h,v]=e.useState(!1),f=Yn(Ce,u),x=e.useMemo(()=>g?"border-slate-700":"border-slate-200",[g]),C=e.useMemo(()=>g?"var(--row-background-alternate)":"bg-slate-50",[g]),w=null==f?void 0:f.isDefault,j="FAILED"===(null==f?void 0:f.state);return n.jsx("div",{className:`bunny-flex bunny-flex-row bunny-justify-between bunny-items-center bunny-p-1 bunny-px-3 bunny-border-solid ${C} bunny-${x} bunny-rounded-md bunny-border ${a}`,id:c,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-gap-4",children:n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2 bunny-space-between bunny-w-full",children:[n.jsx(ve,{paymentMethod:f}),n.jsx(Ie,{issuer:null===(p=null==f?void 0:f.metadata)||void 0===p?void 0:p.issuer}),n.jsx(Se,{type:null===(m=null==f?void 0:f.metadata)||void 0===m?void 0:m.type,identifier:null===(y=null==f?void 0:f.metadata)||void 0===y?void 0:y.identifier}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1",children:[w&&!s&&n.jsx(i.Tag,{bordered:!1,style:{color:b.colorPrimary,backgroundColor:b.colorPrimaryBg},children:"Default"}),j&&n.jsx(je,{failureReason:f.failureReason,forceOpenTooltip:h})]})]})}),o||n.jsx(n.Fragment,{children:!r&&n.jsx(Le,{setDefault:d,remove:l,isDefault:null!=w&&w,id:`credit-card-dropdown-${f.id}`})})]}):n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-items-center justify-between w-full",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx(t.CreditCardOutlined,{}),n.jsx(fe,{className:"bunny-text-slate-400 bunny-text-sm",children:"No payment methods"})]}),n.jsx(i.Button,{disabled:!0,type:"link"}),o]})})}function je({failureReason:e,forceOpenTooltip:t}){const a=n.jsx(i.Tag,{bordered:!1,color:"red",children:"Failed"});return e?n.jsx(i.Tooltip,{title:e,open:t,children:a}):a}const Se=({type:e,identifier:t})=>"link"===e?null:"cashapp"===e?n.jsx(fe,{children:"Cashapp"}):n.jsxs("div",{children:[n.jsx(fe,{className:"relative -top-0.5",children:"****"}),n.jsx(fe,{children:t})]}),Ie=({issuer:e})=>!e||0==e.length||["visa","link","jcb","discover","sepa"].includes(null==e?void 0:e.toLowerCase())?null:n.jsx(fe,{children:l.capitalize(e)}),Le=({setDefault:e,remove:a,isDefault:o,id:r})=>{const{token:s}=xe(),l=[{key:"1",label:"Remove",disabled:!a,onClick:()=>{null==a||a()}},{key:"2",label:"Set as default",onClick:()=>{null==e||e()},disabled:o}];return n.jsx(i.Dropdown,{menu:{items:l},trigger:["click"],children:n.jsx("a",{id:r,children:n.jsx(t.EllipsisOutlined,{style:{fontSize:"20px",color:s.colorPrimary}})})})},Pe=Wn("\n fragment PaymentForm_PaymentMethodsFragment on PaymentMethod {\n ...MiniCreditCard_PaymentMethodFragment\n id\n plugin {\n id\n }\n }\n ",[Ce]),ke=Wn("\n fragment StoredPaymentMethods_PaymentMethodsFragment on PaymentMethod {\n ...MiniCreditCard_PaymentMethodFragment\n id\n plugin {\n id\n }\n }\n ",[Ce]),Ne=Wn("\n query PaymentMethods($accountId: ID) {\n paymentMethods(accountId: $accountId) {\n nodes {\n id\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n type\n }\n isDefault\n ...PaymentForm_PaymentMethodsFragment\n ...StoredPaymentMethods_PaymentMethodsFragment\n }\n }\n }\n ",[Pe,ke]),Fe=({accountId:n,enabled:t=!0})=>{const{apiHost:i}=e.useContext(Jn),o=te(),{data:r,isLoading:s}=a.useQuery({queryKey:E({accountId:n,token:o}),queryFn:()=>(async({apiHost:n,token:e,accountId:t})=>{var i,a,o;const r=await wn(Ne,{apiHost:n,token:e},{accountId:t});return null!==(o=null===(a=null===(i=null==r?void 0:r.paymentMethods)||void 0===i?void 0:i.nodes)||void 0===a?void 0:a.filter(n=>null!==n))&&void 0!==o?o:[]})({apiHost:i,token:o,accountId:n}),staleTime:3e5,enabled:t});return{paymentMethods:r,defaultPaymentMethod:null==r?void 0:r.find(n=>null==n?void 0:n.isDefault),isLoading:s}},De="bunny-gap-2",Te=t=>{const i=e.createContext(null);return[({initialValue:e,children:a})=>n.jsxs(i.Provider,{value:t(e),children:[" ",a," "]}),()=>{const n=e.useContext(i);if(null===n)throw new Error("Provider missing");return n}]},qe={number:"4242424242424242",expiry:"",cvc:""},[Ae,Me]=Te(n=>e.useState(null!=n?n:qe)),He=({method:n="GET",apiHost:e,endpoint:t,body:i,headers:a,token:o})=>{const{apiEndpoint:r}=ln,s=`${e}${r}${t}`,l={...pn({token:o}),...a};return fetch(s,{method:n,headers:l,body:i})},Qe=async({method:n,payload:e,plugin:t,token:i,apiHost:a,componentsVersion:o})=>{var r,s,l,u;const d=null===(s=null===(r=t.components)||void 0===r?void 0:r.backend)||void 0===s?void 0:s[0];if(!(null===(u=null===(l=t.components)||void 0===l?void 0:l.backend)||void 0===u?void 0:u.length))throw new Error("The provided plugin is not invokable");if(!(null==d?void 0:d.access.includes(n)))throw new Error(`Method ${n} is not invokable`);const c=JSON.stringify({guid:t.guid,class:null==d?void 0:d.name,method:n,payload:e}),p=pn({token:i,componentsVersion:o||un}),m=await He({method:"POST",apiHost:a,endpoint:"/plugins/invoke",body:c,token:i,headers:p});if(m.ok)return m.json();const y=await m.json();throw new Error(y.message)},{useToken:Ee}=i.theme,$e=async({quote:n,plugin:e,token:t,apiHost:i,paymentMethodId:a})=>{const o={quote_id:n.id,amount:n.amount,payment_method_id:a},r=await Qe({plugin:e,method:"create_payment_hold",payload:o,token:t,apiHost:i});if("success"!==r.status)throw new Error(r.message||"Unknown error");return r};d.loadStripe.setLoadParameters({advancedFraudSignals:!1});const _e=(n,t)=>{const{apiHost:i}=e.useContext(Jn),a=te(),[o,r]=e.useState(null),s=M(),{token:l}=Ee(),u=e.useMemo(()=>{const n=l.fontFamily;return n.includes("Inter Variable")||"Inter"===n?'var(--font-inter, "Inter Variable", Inter), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif':n.includes(",")?n:`${n}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`},[l.fontFamily]),c=e.useMemo(()=>{const n={variables:{fontFamily:u,fontLineHeight:l.lineHeight.toString(),borderRadius:l.borderRadius.toString()+"px",colorBackground:"white",colorPrimary:l.colorPrimary},rules:{".Input":{fontFamily:u,border:`1px solid ${l.colorBorder}`},".Label":{fontFamily:u},".Text":{fontFamily:u},".Tab":{fontFamily:u},".TabLabel":{fontFamily:u},".Error":{fontFamily:u}}};return{mode:"setup",currency:t,setupFutureUsage:"off_session",appearance:n}},[u,l.lineHeight,l.borderRadius,l.colorPrimary,l.colorBorder,t]);return e.useEffect(()=>{var e,t;n&&"StripePayment"===(null===(t=null===(e=n.components)||void 0===e?void 0:e.frontend)||void 0===t?void 0:t[0].name)&&(async(n,e,t)=>await Qe({plugin:n,method:"retrieve_config",token:t,apiHost:e}))(n,i||"",a).then(({payload:n})=>d.loadStripe(n.publishable_key).then(r)).catch(n=>{console.error("Caught Error in fetching stripe key: ",n),s(n.message,"Unexpected Error fetching key")})},[n,a]),{stripe:o,options:c}},Re=Wn("\n query PaymentPlugins($accountId: ID) {\n paymentPlugins(accountId: $accountId) {\n enabled\n entities\n guid\n hidden\n id\n name\n status\n type\n webhookEnabled\n components\n }\n }\n"),Be=()=>{var n;const{apiHost:t}=e.useContext(Jn),i=te(),{data:o,isFetched:r}=a.useQuery({queryKey:en(i),queryFn:()=>(async({apiHost:n,token:e})=>{const t=await wn(Re,{apiHost:n,token:e},{});return null==t?void 0:t.paymentPlugins})({apiHost:t,token:i}),staleTime:3e5,placeholderData:n=>n});return{paymentPlugins:null!==(n=null==o?void 0:o.filter(n=>{var e,t,i;return"payment"===(null===(e=n.type)||void 0===e?void 0:e.toLowerCase())&&"valid"===(null===(t=n.status)||void 0===t?void 0:t.toLowerCase())&&"manual payment"!==(null===(i=n.name)||void 0===i?void 0:i.toLowerCase())}))&&void 0!==n?n:[],isFetched:r}},[Ue,Ve]=Te(n=>e.useState(n)),[Oe,Ze]=yn();function Ke({children:e,accountId:t}){return n.jsx(Ue,{initialValue:void 0,children:n.jsx(ze,{accountId:t,children:e})})}function ze({children:t,accountId:i}){const{paymentPlugins:a}=Be(),{defaultPaymentMethod:o}=Fe({accountId:i}),[r,s]=Ve(),l=e.useMemo(()=>null==a?void 0:a.find(n=>n.id===r),[a,r]);return e.useEffect(()=>{var n,e;r||s(o?null===(n=o.plugin)||void 0===n?void 0:n.id:null===(e=null==a?void 0:a[0])||void 0===e?void 0:e.id)},[o,a]),n.jsx(Oe,{value:l,children:t})}function Ge({children:e,currencyId:t}){const i=Ze(),{stripe:a,options:o}=_e(i,t);return n.jsx(u.Elements,{options:o,stripe:a,children:e})}const Ye=Wn("\n mutation Checkout(\n $invoiceId: ID\n $quoteId: ID\n $paymentMethodId: ID\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId\n quoteId: $quoteId\n paymentMethodId: $paymentMethodId\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n"),We=async({quoteId:n,invoiceId:e,paymentMethodId:t,paymentMethodData:i,token:a,apiHost:o})=>{const r={quoteId:n,invoiceId:e,paymentMethodId:t};i&&(r.paymentMethodData={...i,metadata:i.metadata});const s=await wn(Ye,{apiHost:o,token:a},r);return null==s?void 0:s.checkout},[Xe,Je]=yn(),nt=Wn("\n fragment getQuoteAmountDue_QuoteFragment on Quote {\n amountDue\n amount\n }\n ",[]),et=n=>{var e;const t=Yn(nt,n);return null!==(e=t.amountDue)&&void 0!==e?e:t.amount};function tt(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var it,at={exports:{}};var ot,rt=(it||(it=1,at.exports=function(){var n=1e3,e=6e4,t=36e5,i="millisecond",a="second",o="minute",r="hour",s="day",l="week",u="month",d="quarter",c="year",p="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(n){var e=["th","st","nd","rd"],t=n%100;return"["+n+(e[(t-20)%10]||e[t]||e[0])+"]"}},h=function(n,e,t){var i=String(n);return!i||i.length>=e?n:""+Array(e+1-i.length).join(t)+n},v={s:h,z:function(n){var e=-n.utcOffset(),t=Math.abs(e),i=Math.floor(t/60),a=t%60;return(e<=0?"+":"-")+h(i,2,"0")+":"+h(a,2,"0")},m:function n(e,t){if(e.date()<t.date())return-n(t,e);var i=12*(t.year()-e.year())+(t.month()-e.month()),a=e.clone().add(i,u),o=t-a<0,r=e.clone().add(i+(o?-1:1),u);return+(-(i+(t-a)/(o?a-r:r-a))||0)},a:function(n){return n<0?Math.ceil(n)||0:Math.floor(n)},p:function(n){return{M:u,y:c,w:l,d:s,D:p,h:r,m:o,s:a,ms:i,Q:d}[n]||String(n||"").toLowerCase().replace(/s$/,"")},u:function(n){return void 0===n}},f="en",x={};x[f]=b;var C="$isDayjsObject",w=function(n){return n instanceof L||!(!n||!n[C])},j=function n(e,t,i){var a;if(!e)return f;if("string"==typeof e){var o=e.toLowerCase();x[o]&&(a=o),t&&(x[o]=t,a=o);var r=e.split("-");if(!a&&r.length>1)return n(r[0])}else{var s=e.name;x[s]=e,a=s}return!i&&a&&(f=a),a||!i&&f},S=function(n,e){if(w(n))return n.clone();var t="object"==typeof e?e:{};return t.date=n,t.args=arguments,new L(t)},I=v;I.l=j,I.i=w,I.w=function(n,e){return S(n,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var L=function(){function b(n){this.$L=j(n.locale,null,!0),this.parse(n),this.$x=this.$x||n.x||{},this[C]=!0}var h=b.prototype;return h.parse=function(n){this.$d=function(n){var e=n.date,t=n.utc;if(null===e)return new Date(NaN);if(I.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(y);if(i){var a=i[2]-1||0,o=(i[7]||"0").substring(0,3);return t?new Date(Date.UTC(i[1],a,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)):new Date(i[1],a,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)}}return new Date(e)}(n),this.init()},h.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},h.$utils=function(){return I},h.isValid=function(){return!(this.$d.toString()===m)},h.isSame=function(n,e){var t=S(n);return this.startOf(e)<=t&&t<=this.endOf(e)},h.isAfter=function(n,e){return S(n)<this.startOf(e)},h.isBefore=function(n,e){return this.endOf(e)<S(n)},h.$g=function(n,e,t){return I.u(n)?this[e]:this.set(t,n)},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(n,e){var t=this,i=!!I.u(e)||e,d=I.p(n),m=function(n,e){var a=I.w(t.$u?Date.UTC(t.$y,e,n):new Date(t.$y,e,n),t);return i?a:a.endOf(s)},y=function(n,e){return I.w(t.toDate()[n].apply(t.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),t)},g=this.$W,b=this.$M,h=this.$D,v="set"+(this.$u?"UTC":"");switch(d){case c:return i?m(1,0):m(31,11);case u:return i?m(1,b):m(0,b+1);case l:var f=this.$locale().weekStart||0,x=(g<f?g+7:g)-f;return m(i?h-x:h+(6-x),b);case s:case p:return y(v+"Hours",0);case r:return y(v+"Minutes",1);case o:return y(v+"Seconds",2);case a:return y(v+"Milliseconds",3);default:return this.clone()}},h.endOf=function(n){return this.startOf(n,!1)},h.$set=function(n,e){var t,l=I.p(n),d="set"+(this.$u?"UTC":""),m=(t={},t[s]=d+"Date",t[p]=d+"Date",t[u]=d+"Month",t[c]=d+"FullYear",t[r]=d+"Hours",t[o]=d+"Minutes",t[a]=d+"Seconds",t[i]=d+"Milliseconds",t)[l],y=l===s?this.$D+(e-this.$W):e;if(l===u||l===c){var g=this.clone().set(p,1);g.$d[m](y),g.init(),this.$d=g.set(p,Math.min(this.$D,g.daysInMonth())).$d}else m&&this.$d[m](y);return this.init(),this},h.set=function(n,e){return this.clone().$set(n,e)},h.get=function(n){return this[I.p(n)]()},h.add=function(i,d){var p,m=this;i=Number(i);var y=I.p(d),g=function(n){var e=S(m);return I.w(e.date(e.date()+Math.round(n*i)),m)};if(y===u)return this.set(u,this.$M+i);if(y===c)return this.set(c,this.$y+i);if(y===s)return g(1);if(y===l)return g(7);var b=(p={},p[o]=e,p[r]=t,p[a]=n,p)[y]||1,h=this.$d.getTime()+i*b;return I.w(h,this)},h.subtract=function(n,e){return this.add(-1*n,e)},h.format=function(n){var e=this,t=this.$locale();if(!this.isValid())return t.invalidDate||m;var i=n||"YYYY-MM-DDTHH:mm:ssZ",a=I.z(this),o=this.$H,r=this.$m,s=this.$M,l=t.weekdays,u=t.months,d=t.meridiem,c=function(n,t,a,o){return n&&(n[t]||n(e,i))||a[t].slice(0,o)},p=function(n){return I.s(o%12||12,n,"0")},y=d||function(n,e,t){var i=n<12?"AM":"PM";return t?i.toLowerCase():i};return i.replace(g,function(n,i){return i||function(n){switch(n){case"YY":return String(e.$y).slice(-2);case"YYYY":return I.s(e.$y,4,"0");case"M":return s+1;case"MM":return I.s(s+1,2,"0");case"MMM":return c(t.monthsShort,s,u,3);case"MMMM":return c(u,s);case"D":return e.$D;case"DD":return I.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return c(t.weekdaysMin,e.$W,l,2);case"ddd":return c(t.weekdaysShort,e.$W,l,3);case"dddd":return l[e.$W];case"H":return String(o);case"HH":return I.s(o,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return y(o,r,!0);case"A":return y(o,r,!1);case"m":return String(r);case"mm":return I.s(r,2,"0");case"s":return String(e.$s);case"ss":return I.s(e.$s,2,"0");case"SSS":return I.s(e.$ms,3,"0");case"Z":return a}return null}(n)||a.replace(":","")})},h.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},h.diff=function(i,p,m){var y,g=this,b=I.p(p),h=S(i),v=(h.utcOffset()-this.utcOffset())*e,f=this-h,x=function(){return I.m(g,h)};switch(b){case c:y=x()/12;break;case u:y=x();break;case d:y=x()/3;break;case l:y=(f-v)/6048e5;break;case s:y=(f-v)/864e5;break;case r:y=f/t;break;case o:y=f/e;break;case a:y=f/n;break;default:y=f}return m?y:I.a(y)},h.daysInMonth=function(){return this.endOf(u).$D},h.$locale=function(){return x[this.$L]},h.locale=function(n,e){if(!n)return this.$L;var t=this.clone(),i=j(n,e,!0);return i&&(t.$L=i),t},h.clone=function(){return I.w(this.$d,this)},h.toDate=function(){return new Date(this.valueOf())},h.toJSON=function(){return this.isValid()?this.toISOString():null},h.toISOString=function(){return this.$d.toISOString()},h.toString=function(){return this.$d.toUTCString()},b}(),P=L.prototype;return S.prototype=P,[["$ms",i],["$s",a],["$m",o],["$H",r],["$W",s],["$M",u],["$y",c],["$D",p]].forEach(function(n){P[n[1]]=function(e){return this.$g(e,n[0],n[1])}}),S.extend=function(n,e){return n.$i||(n(e,L,S),n.$i=!0),S},S.locale=j,S.isDayjs=w,S.unix=function(n){return S(1e3*n)},S.en=x[f],S.Ls=x,S.p={},S}()),at.exports),st=tt(rt),lt={exports:{}};var ut=(ot||(ot=1,lt.exports=function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(e,t,i){var a=t.prototype,o=a.format;i.en.formats=n,a.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,i=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,i,a){var o=a&&a.toUpperCase();return i||t[a]||n[a]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(n,e,t){return e||t.slice(1)})})}(e,void 0===t?{}:t);return o.call(this,i)}}}()),lt.exports),dt=tt(ut);st.extend(dt);const ct=(n,e,t=2)=>{if(0!==n&&!n)return"";const i="string"==typeof n?parseFloat(n):n;if(isNaN(i))return n;const a={minimumFractionDigits:t,maximumFractionDigits:t,style:"currency"};return a.currency=e,i.toLocaleString(navigator.language,a)};var pt;!function(n){n.PAY="PAY",n.APPROVE_HOLD="APPROVE_HOLD",n.CHECKOUT_NO_PAYMENT="CHECKOUT_NO_PAYMENT",n.SAVE="SAVE"}(pt||(pt={}));const[mt,yt]=yn(),gt=Wn("\n fragment PaymentProvider_QuoteFragment on Quote {\n id\n currencyId\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[nt]),bt=Wn("\n fragment PaymentProvider_InvoiceFragment on Invoice {\n id\n currencyId\n amountDue\n }\n ");function ht({children:t,quote:i,invoice:a,paymentHold:o}){var r,s;const l=Yn(gt,i),u=Yn(bt,a),[d,c]=e.useState(!1),[p,m]=e.useState(!1),[y,g]=e.useState(!1),[b,h]=e.useState(!1),[v,f]=e.useState(!1),x=()=>l?et(l):null==u?void 0:u.amountDue;const C=void 0===x()?pt.SAVE:0===x()?pt.CHECKOUT_NO_PAYMENT:o?pt.APPROVE_HOLD:pt.PAY,w=x(),j=(()=>{var n;const e=x(),t=null!==(n=null==l?void 0:l.currencyId)&&void 0!==n?n:null==u?void 0:u.currencyId;return void 0!==e&&void 0!==t?ct(e,t).toString():void 0})();return n.jsx(mt,{value:{quoteId:null!==(r=null==l?void 0:l.id)&&void 0!==r?r:void 0,invoiceId:null!==(s=null==u?void 0:u.id)&&void 0!==s?s:void 0,paymentHold:o,paymentType:C,amountDue:null!=w?w:void 0,formattedAmountDue:j,isPaid:d,setIsPaid:c,isApproved:p,setIsApproved:m,isPaying:y,setIsPaying:g,isApprovingHold:b,setIsApprovingHold:h,isSaving:v,setIsSaving:f},children:t})}const[vt,ft]=yn(),[xt,Ct]=Te((n=!1)=>e.useState(n));const wt=M();function jt({plugin:n,onPaymentHoldSuccess:t,onPaymentHoldError:i}){var a,o,r;const s=null===(r=null===(o=null===(a=null==n?void 0:n.components)||void 0===a?void 0:a.frontend)||void 0===o?void 0:o[0])||void 0===r?void 0:r.name,{approveHold:l,isApprovingHold:u}=function({onApproveHoldSuccess:n,onApproveHoldError:t}){const[i,a]=e.useState(!1),{apiHost:o}=e.useContext(Jn),r=te();return{approveHold:async({plugin:e,quote:i,paymentMethodId:s})=>{try{if(!r)throw new Error("Token couldn't be retrieved");a(!0);const t=await $e({quote:i,plugin:e,token:r,apiHost:o,paymentMethodId:s});if("success"!==t.status)throw new Error(null==t?void 0:t.message);null==n||n(t)}catch(n){console.error(n),null==t||t(n)}finally{a(!1)}},isApprovingHold:i}}({onApproveHoldSuccess:t,onApproveHoldError:i}),{approveHold:d,isApprovingHold:c}=function({onApproveHoldSuccess:n,onApproveHoldError:t}){const[i,a]=e.useState(!1),{apiHost:o}=e.useContext(Jn),r=te();return{approveHold:async({plugin:e,quote:i,paymentMethodId:s})=>{try{if(!r)throw new Error("Token couldn't be retrieved");a(!0);const t=await $e({quote:i,plugin:e,token:r,apiHost:o,paymentMethodId:s});if("success"!==t.status)throw new Error(null==t?void 0:t.message);null==n||n(t)}catch(n){console.error(n),null==t||t(n)}finally{a(!1)}},isApprovingHold:i}}({onApproveHoldSuccess:t,onApproveHoldError:i});return{approveHold:async({quote:e,paymentMethodId:t})=>{if(!s)return wt("plugin name is required");if(!n)return wt("plugin is required");switch(s){case"StripePayment":return void await l({plugin:n,quote:e,paymentMethodId:t});case"DemoPayPayment":return void await d({plugin:n,quote:e,paymentMethodId:t});default:return void wt(`Payment holds are not supported by ${s}`)}},isApprovingHold:u||c}}const St=/\d/,It=n=>St.test(n),Lt=n=>[8,46].includes(n)||(n=>[9,37,38,39,40].includes(n))(n)||(n=>[16,17,18].includes(n))(n),Pt="4242424242424242";function kt({onSaveSuccess:n,onSaveError:t,accountId:i}){const[a,o]=e.useState(!1),{apiHost:r}=e.useContext(Jn),s=te(),l=Ze(),[u,d]=Me();return{save:async()=>{try{!function(){if(u.number!==Pt)throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");if(!(n=>{const e=parseInt(n.substring(0,2),10),t=parseInt(n.substring(2,4),10)+2e3;return!isNaN(e)&&!isNaN(t)&&!(e<1||e>12)})(u.expiry))throw new Error("Invalid expiry date");if((n=>{const e=parseInt(n.substring(0,2),10),t=parseInt(n.substring(2,4),10)+2e3;return new Date(t,e,1)<new Date})(u.expiry))throw new Error("Card is expired");if(3!==u.cvc.length)throw new Error("Invalid CVC")}(),o(!0);const t=await(async(n,e,t,i)=>{const{testCreditCardNumber:a,testCreditCardCvc:o,testCreditCardExpirationDate:r,token:s}=n,l=await Qe({method:"store_payment_method",plugin:e,payload:{test_credit_card_number:a,test_credit_card_cvc:o,test_credit_card_expiration_date:r,account_id:i},token:s,apiHost:t});if("success"!==(null==l?void 0:l.status))throw new Error(null==l?void 0:l.message);return l})({testCreditCardNumber:(e=u.number,e.split("").filter(n=>" "!==n).join("")),testCreditCardCvc:u.cvc.toString(),testCreditCardExpirationDate:u.expiry,token:s},l,r,i),a=t.payload[0].id;if("success"!==t.status)throw new Error(null==t?void 0:t.message);return null==n||n({pluginPaymentResponse:{plugin:l,token:t.token,savePaymentMethod:!0},savedPaymentMethodResponse:{paymentMethodId:a}}),d({number:u.number,expiry:"",cvc:""}),a}catch(n){null==t||t(n)}finally{o(!1)}var e},isSaving:a}}function Nt({onSaveSuccess:n,onSaveError:t,accountId:i}){const[a,o]=e.useState(!1),r=u.useElements(),s=u.useStripe(),{apiHost:l}=e.useContext(Jn),d=te(),c=Ze(),p=async()=>{var n,e;if(!s)throw new Error("Form is not ready");if(!r)throw new Error("Elements couldn't be retrieved");const{error:t}=await r.submit();if(t)throw new Error(t.message);const a=await((n,e,t,i)=>Qe({plugin:n,method:"create_setup_intent",token:t,apiHost:e,payload:{account_id:i}}))(c,l,d,i);if("success"!==a.status)throw new Error(null==a?void 0:a.message);const o=null===(n=null==a?void 0:a.payload)||void 0===n?void 0:n.client_secret;if(!o)throw new Error("Error retrieving client secret");const u=await s.confirmSetup({elements:r,clientSecret:o,redirect:"if_required",confirmParams:{return_url:window.location.href}});if(u.error)throw new Error(u.error.message);const p=null===(e=u.setupIntent.payment_method)||void 0===e?void 0:e.toString();if(!p)throw new Error("Payment method couldn't be retrieved");return p};return{save:async()=>{try{o(!0);const e=await p(),t=await(async({paymentMethodId:n,plugin:e,token:t,apiHost:i,accountId:a})=>{const o=await Qe({plugin:e,method:"store_payment_method",payload:{payment_method_id:n,account_id:a},token:t,apiHost:i});if("success"!==o.status)throw new Error(o.message||"Unknown error");return o})({paymentMethodId:e,plugin:c,token:d,apiHost:l,accountId:i}),a=t.payload[0].id;return null==n||n({pluginPaymentResponse:{savePaymentMethod:!0,plugin:c,token:t.token},savedPaymentMethodResponse:{paymentMethodId:a}}),a}catch(n){null==t||t(n)}finally{o(!1)}},createStripePaymentMethodId:p,isSaving:a}}const Ft=Cn(),Dt=M();function Tt({accountId:n,onSaveSuccess:e,onSaveError:t,invalidatePaymentMethodsQuery:i=!0}){var o,r,s;const l=Ze(),u=a.useQueryClient(),d=te(),c=null!=t?t:Ft,p=null===(s=null===(r=null===(o=null==l?void 0:l.components)||void 0===o?void 0:o.frontend)||void 0===r?void 0:r[0])||void 0===s?void 0:s.name,{save:m,isSaving:y}=kt({accountId:n,onSaveSuccess:t=>{null==e||e(t),i&&u.invalidateQueries({queryKey:E({accountId:n,token:d})})},onSaveError:c}),{save:g,isSaving:b}=Nt({accountId:n,onSaveSuccess:t=>{null==e||e(t),i&&u.invalidateQueries({queryKey:E({accountId:n,token:d})})},onSaveError:c});return{save:async()=>{var n,e,t;return"StripePayment"===p?await g():"DemoPayPayment"===p?await m():void Dt(`Can not find form for plugin ${null===(t=null===(e=null===(n=null==l?void 0:l.components)||void 0===n?void 0:n.frontend)||void 0===e?void 0:e[0])||void 0===t?void 0:t.name}`)},isSaving:y||b}}const[qt,At]=yn(),Mt=M();const Ht=M();const Qt=M();function Et({plugin:n,quoteId:t,invoiceId:i,onPaymentSuccess:o,onPaymentError:r}){var s,l,u;const d=null===(u=null===(l=null===(s=null==n?void 0:n.components)||void 0===s?void 0:s.frontend)||void 0===l?void 0:l[0])||void 0===u?void 0:u.name,{pay:c,isPaying:p}=function({onPaymentSuccess:n,onPaymentError:t,quoteId:i,invoiceId:o,plugin:r}){const s=a.useQueryClient(),{apiHost:l}=e.useContext(Jn),u=At(),d=te(),[c,p]=e.useState(!1);return{pay:async e=>{try{if(p(!0),u){if(!(null==r?void 0:r.id))return void Ht("Plugin ID is required");const t=await u(null==r?void 0:r.id.toString(),e.toString());null==n||n(t)}else{if(!i&&!o)return void Ht("Quote ID or Invoice ID is required");const t=await We({invoiceId:o,quoteId:i,paymentMethodId:e,token:d,apiHost:l});null==n||n(t)}}catch(n){null==t||t(n),s.invalidateQueries({queryKey:E({})})}finally{p(!1)}},isPaying:c}}({onPaymentSuccess:o,onPaymentError:r,quoteId:t,invoiceId:i,plugin:n}),{pay:m,isPaying:y}=function({onPaymentSuccess:n,onPaymentError:t,quoteId:i,invoiceId:a,plugin:o}){const{apiHost:r}=e.useContext(Jn),s=At(),l=te(),[u,d]=e.useState(!1);return{pay:async e=>{try{if(d(!0),s){if(!(null==o?void 0:o.id))return void Mt("Plugin ID is required");const t=await s(null==o?void 0:o.id.toString(),e.toString());null==n||n(t)}else{const t=await We({invoiceId:a,quoteId:i,paymentMethodId:e,token:l,apiHost:r});null==n||n(t)}}catch(n){null==t||t(n)}finally{d(!1)}},isPaying:u}}({onPaymentSuccess:o,onPaymentError:r,quoteId:t,invoiceId:i,plugin:n});return{pay:async n=>{if(!d)return Qt("plugin name is required");switch(d){case"StripePayment":return void await c(n);case"DemoPayPayment":return void await m(n);default:return void Qt(`Payments are not supported by ${d}`)}},isPaying:p||y}}const $t=Cn(),_t=M();const Rt="function"==typeof c?c:c.default,Bt=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{It(n.key)||Lt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"cvc",autoFocus:e,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\D/g,"");t(e)},value:o,maxLength:3,placeholder:a||"CVC"})})},Ut=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{It(n.key)||Lt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"cardNumber",autoFocus:e,maxLength:19,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\s/g,"");t(e)},placeholder:a||"Card Number",value:(s=o,s.replace(/(\d{4})(?=\d)/g,"$1 "))})});var s},Vt=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{It(n.key)||Lt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"expiry",autoFocus:e,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\D/g,"");t(e)},value:(s=o,s.length<=2?s:s.substring(0,2)+"/"+s.substring(2)),maxLength:5,placeholder:a||"MM/YY"})});var s},{Text:Ot}=i.Typography,Zt=()=>{const{darkMode:t}=e.useContext(Jn),[i,a]=Me();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsxs(Kt,{className:"bunny-flex bunny-flex-col bunny-gap-2",darkMode:null!=t&&t,children:[n.jsx(Ut,{onChange:n=>{a(e=>({...e,number:n}))},value:i.number}),n.jsxs("div",{className:"bunny-flex bunny-gap-2",children:[n.jsx(Vt,{onChange:n=>{a(e=>({...e,expiry:n}))},value:i.expiry}),n.jsx(Bt,{onChange:n=>{a(e=>({...e,cvc:n}))},value:i.cvc})]})]}),n.jsx(Ot,{children:"DemoPay is for testing only."})]})},Kt=Rt.div`
1
+ "use strict";var n=require("react/jsx-runtime"),e=require("react"),t=require("@ant-design/icons"),i=require("antd"),a=require("@tanstack/react-query"),o=require("graphql-request"),r=require("@sentry/react"),s=require("recoil"),l=require("graphql"),u=require("lodash-es"),d=require("@stripe/react-stripe-js"),c=require("@stripe/stripe-js/pure/index.js"),p=require("styled-components"),m=require("@fortawesome/free-solid-svg-icons"),y=require("@fortawesome/react-fontawesome"),g=require("interweave"),b=require("@pdf-viewer/react"),h=require("pluralize"),v=require("recharts");function f(n){var e=Object.create(null);return n&&Object.keys(n).forEach(function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return n[t]}})}}),e.default=n,Object.freeze(e)}var x=f(r);!function(n,e){void 0===e&&(e={});var t=e.insertAt;if(n&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===t&&i.firstChild?i.insertBefore(a,i.firstChild):i.appendChild(a),a.styleSheet?a.styleSheet.cssText=n:a.appendChild(document.createTextNode(n))}}(":root {\n --row-background: #ffffff;\n --row-background-alternate: rgba(100, 116, 139, 0.04);\n --row-background-dark: #121212;\n --row-background-alternate-dark: #1e1e1e;\n --bunny-blue-500: #3b82f6;\n --bunny-blue-200: #bfdbfe;\n --bunny-green-600: #059669;\n --bunny-green-200: #a7f3d0;\n --bunny-red-500: #ef4444;\n --bunny-red-200: #fecaca;\n --bunny-orange-500: #f97316;\n --bunny-orange-200: #fed7aa;\n --bunny-yellow-500: #f59e0b;\n --bunny-yellow-200: #fde68a;\n --bunny-purple-500: #8b5cf6;\n --bunny-purple-200: #ddd6fe;\n --bunny-black: #000000;\n}\n.bunny-component-wrapper {\n box-sizing: border-box;\n}\n.bunny-component-wrapper * {\n box-sizing: border-box;\n}\n.hidden {\n display: none;\n}\n.bunny-show-on-hover {\n opacity: 0;\n}\n.bunny-show-on-hover-container:hover .bunny-show-on-hover {\n opacity: 1;\n}\n.has-tooltip:hover .tooltip {\n visibility: visible;\n z-index: 100;\n}\n.pdf-only {\n display: none !important;\n}\n.notes p {\n margin: 0;\n padding: 0;\n padding-bottom: 0.25rem;\n}\n.bunny-icon-path {\n transition: fill 0.3s;\n}\n.bunny-shadow-padding-x {\n padding-right: 1rem;\n padding-left: 1rem;\n}\n.bunny-shadow-padding-xb {\n padding-right: 1rem;\n padding-left: 1rem;\n padding-bottom: 0.5rem;\n}\n.content-container {\n width: 100%;\n margin: 0 auto;\n}\n@media (min-width: 1220px) {\n .content-container {\n width: 1220px !important;\n margin: 0 auto;\n }\n}\n@media (min-width: 768px) {\n .bunny-shadow-padding-x {\n padding-right: 2rem;\n padding-left: 2rem;\n }\n .bunny-shadow-padding-xb {\n padding-right: 2rem;\n padding-left: 2rem;\n padding-bottom: 0.5rem;\n }\n .sm\\:flex {\n display: flex !important;\n }\n .sm\\:hidden {\n display: none !important;\n }\n}\n.bunny-shadow,\n.bunny-shadow-md {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.bunny-fixed {\n position: fixed;\n}\n.bunny-absolute {\n position: absolute;\n}\n.bunny-relative {\n position: relative;\n}\n.bunny-sticky {\n position: sticky;\n}\n.bunny-bottom-0 {\n bottom: 0px;\n}\n.bunny-bottom-4 {\n bottom: 1rem;\n}\n.bunny-left-0 {\n left: 0px;\n}\n.bunny-right-0 {\n right: 0px;\n}\n.bunny-top-0 {\n top: 0px;\n}\n.bunny-col-span-1 {\n grid-column: span 1 / span 1;\n}\n.bunny-col-span-full {\n grid-column: 1 / -1;\n}\n.bunny-m-0 {\n margin: 0px;\n}\n.bunny-m-4 {\n margin: 1rem;\n}\n.-bunny-mx-4 {\n margin-left: -1rem;\n margin-right: -1rem;\n}\n.bunny-mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.bunny-mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.bunny-mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n.bunny-my-0 {\n margin-top: 0px;\n margin-bottom: 0px;\n}\n.bunny-my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.bunny-my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.bunny-mb-2 {\n margin-bottom: 0.5rem;\n}\n.bunny-mb-3 {\n margin-bottom: 0.75rem;\n}\n.bunny-mb-4 {\n margin-bottom: 1rem;\n}\n.bunny-mb-8 {\n margin-bottom: 2rem;\n}\n.bunny-ml-auto {\n margin-left: auto;\n}\n.bunny-mt-0 {\n margin-top: 0px;\n}\n.bunny-mt-4 {\n margin-top: 1rem;\n}\n.bunny-mt-5 {\n margin-top: 1.25rem;\n}\n.bunny-box-border {\n box-sizing: border-box;\n}\n.bunny-flex {\n display: flex;\n}\n.bunny-grid {\n display: grid;\n}\n.bunny-contents {\n display: contents;\n}\n.bunny-h-0\\.5 {\n height: 0.125rem;\n}\n.bunny-h-1\\/2 {\n height: 50%;\n}\n.bunny-h-8 {\n height: 2rem;\n}\n.bunny-h-full {\n height: 100%;\n}\n.bunny-min-h-0 {\n min-height: 0px;\n}\n.bunny-min-h-screen {\n min-height: 100vh;\n}\n.bunny-w-0\\.5 {\n width: 0.125rem;\n}\n.bunny-w-1\\/2 {\n width: 50%;\n}\n.bunny-w-4\\/5 {\n width: 80%;\n}\n.bunny-w-full {\n width: 100%;\n}\n.bunny-min-w-0 {\n min-width: 0px;\n}\n.bunny-flex-1 {\n flex: 1 1 0%;\n}\n.bunny-flex-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-shrink {\n flex-shrink: 1;\n}\n.bunny-shrink-0 {\n flex-shrink: 0;\n}\n.bunny-grow {\n flex-grow: 1;\n}\n.bunny-cursor-default {\n cursor: default;\n}\n.bunny-cursor-pointer {\n cursor: pointer;\n}\n.bunny-grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.bunny-grid-rows-\\[0fr\\] {\n grid-template-rows: 0fr;\n}\n.bunny-grid-rows-\\[1fr\\] {\n grid-template-rows: 1fr;\n}\n.bunny-flex-row {\n flex-direction: row;\n}\n.bunny-flex-col {\n flex-direction: column;\n}\n.bunny-flex-wrap {\n flex-wrap: wrap;\n}\n.bunny-items-start {\n align-items: flex-start;\n}\n.bunny-items-end {\n align-items: flex-end;\n}\n.bunny-items-center {\n align-items: center;\n}\n.bunny-justify-end {\n justify-content: flex-end;\n}\n.bunny-justify-center {\n justify-content: center;\n}\n.bunny-justify-between {\n justify-content: space-between;\n}\n.bunny-gap-0 {\n gap: 0px;\n}\n.bunny-gap-1 {\n gap: 0.25rem;\n}\n.bunny-gap-2 {\n gap: 0.5rem;\n}\n.bunny-gap-3 {\n gap: 0.75rem;\n}\n.bunny-gap-4 {\n gap: 1rem;\n}\n.bunny-gap-6 {\n gap: 1.5rem;\n}\n.bunny-gap-8 {\n gap: 2rem;\n}\n.bunny-space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.bunny-space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.bunny-overflow-auto {\n overflow: auto;\n}\n.bunny-overflow-hidden {\n overflow: hidden;\n}\n.bunny-overflow-y-auto {\n overflow-y: auto;\n}\n.bunny-overflow-x-clip {\n overflow-x: clip;\n}\n.bunny-text-ellipsis {\n text-overflow: ellipsis;\n}\n.bunny-whitespace-nowrap {\n white-space: nowrap;\n}\n.bunny-text-nowrap {\n text-wrap: nowrap;\n}\n.bunny-rounded {\n border-radius: 0.25rem;\n}\n.bunny-rounded-full {\n border-radius: 9999px;\n}\n.bunny-rounded-lg {\n border-radius: 0.5rem;\n}\n.bunny-rounded-md {\n border-radius: 0.375rem;\n}\n.bunny-border {\n border-width: 1px;\n}\n.bunny-border-2 {\n border-width: 2px;\n}\n.bunny-border-t {\n border-top-width: 1px;\n}\n.bunny-border-solid {\n border-style: solid;\n}\n.bunny-border-none {\n border-style: none;\n}\n.bunny-border-gray-200 {\n --tw-border-opacity: 1;\n border-color: rgb(229 231 235 / var(--tw-border-opacity, 1));\n}\n.bunny-border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.bunny-bg-gray-300 {\n --tw-bg-opacity: 1;\n background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bunny-bg-transparent {\n background-color: transparent;\n}\n.bunny-bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bunny-p-0 {\n padding: 0px;\n}\n.bunny-p-1 {\n padding: 0.25rem;\n}\n.bunny-p-2 {\n padding: 0.5rem;\n}\n.bunny-p-4 {\n padding: 1rem;\n}\n.bunny-px-12 {\n padding-left: 3rem;\n padding-right: 3rem;\n}\n.bunny-px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.bunny-px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.bunny-px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.bunny-px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.bunny-py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.bunny-py-24 {\n padding-top: 6rem;\n padding-bottom: 6rem;\n}\n.bunny-py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.bunny-py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.bunny-pb-2 {\n padding-bottom: 0.5rem;\n}\n.bunny-pb-4 {\n padding-bottom: 1rem;\n}\n.bunny-pb-6 {\n padding-bottom: 1.5rem;\n}\n.bunny-pb-8 {\n padding-bottom: 2rem;\n}\n.bunny-pl-0 {\n padding-left: 0px;\n}\n.bunny-pl-1 {\n padding-left: 0.25rem;\n}\n.bunny-pl-4 {\n padding-left: 1rem;\n}\n.bunny-pr-4 {\n padding-right: 1rem;\n}\n.bunny-pt-0 {\n padding-top: 0px;\n}\n.bunny-pt-1 {\n padding-top: 0.25rem;\n}\n.bunny-pt-12 {\n padding-top: 3rem;\n}\n.bunny-pt-2 {\n padding-top: 0.5rem;\n}\n.bunny-pt-4 {\n padding-top: 1rem;\n}\n.bunny-pt-5 {\n padding-top: 1.25rem;\n}\n.bunny-pt-6 {\n padding-top: 1.5rem;\n}\n.bunny-pt-8 {\n padding-top: 2rem;\n}\n.bunny-text-left {\n text-align: left;\n}\n.bunny-text-center {\n text-align: center;\n}\n.bunny-text-right {\n text-align: right;\n}\n.bunny-text-start {\n text-align: start;\n}\n.bunny-text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.bunny-text-3xl {\n font-size: 1.875rem;\n line-height: 2.25rem;\n}\n.bunny-text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.bunny-text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.bunny-text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-sm\\/5 {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.bunny-text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.bunny-text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.bunny-text-xs\\/3 {\n font-size: 0.75rem;\n line-height: 0.75rem;\n}\n.bunny-font-bold {\n font-weight: 700;\n}\n.bunny-font-medium {\n font-weight: 500;\n}\n.bunny-font-normal {\n font-weight: 400;\n}\n.bunny-text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.bunny-text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.bunny-text-neutral-400 {\n --tw-text-opacity: 1;\n color: rgb(163 163 163 / var(--tw-text-opacity, 1));\n}\n.bunny-text-neutral-500 {\n --tw-text-opacity: 1;\n color: rgb(115 115 115 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.bunny-text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.bunny-text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.bunny-text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.bunny-underline {\n text-decoration-line: underline;\n}\n.bunny-shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.bunny-transition-\\[grid-template-rows\\] {\n transition-property: grid-template-rows;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.bunny-duration-300 {\n transition-duration: 300ms;\n}\n.bunny-ease-in-out {\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n}\n.truncated-text__inner * {\n display: inline;\n white-space: inherit;\n}\n.rotate-45,\n.transform {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n}\n.shadow,\n.shadow-lg,\n.shadow-md,\n.shadow-none,\n.shadow-sm,\n.shadow-xl {\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n}\n.container {\n width: 100%;\n}\n@media (min-width: 768px) {\n .container {\n max-width: 768px;\n }\n}\n@media (min-width: 1024px) {\n .container {\n max-width: 1024px;\n }\n}\n@media (min-width: 1280px) {\n .container {\n max-width: 1280px;\n }\n}\n@media (min-width: 1536px) {\n .container {\n max-width: 1536px;\n }\n}\n.visible {\n visibility: visible;\n}\n.fixed {\n position: fixed;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.sticky {\n position: sticky;\n}\n.-top-0\\.5 {\n top: -0.125rem;\n}\n.bottom-0 {\n bottom: 0px;\n}\n.bottom-4 {\n bottom: 1rem;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.z-50 {\n z-index: 50;\n}\n.col-span-2 {\n grid-column: span 2 / span 2;\n}\n.col-span-3 {\n grid-column: span 3 / span 3;\n}\n.col-span-full {\n grid-column: 1 / -1;\n}\n.m-0 {\n margin: 0px;\n}\n.mx-0 {\n margin-left: 0px;\n margin-right: 0px;\n}\n.mx-4 {\n margin-left: 1rem;\n margin-right: 1rem;\n}\n.my-12 {\n margin-top: 3rem;\n margin-bottom: 3rem;\n}\n.my-2 {\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n.my-4 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n.mb-2 {\n margin-bottom: 0.5rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.ml-2 {\n margin-left: 0.5rem;\n}\n.mr-8 {\n margin-right: 2rem;\n}\n.mt-1 {\n margin-top: 0.25rem;\n}\n.mt-2 {\n margin-top: 0.5rem;\n}\n.mt-4 {\n margin-top: 1rem;\n}\n.mt-6 {\n margin-top: 1.5rem;\n}\n.mt-8 {\n margin-top: 2rem;\n}\n.block {\n display: block;\n}\n.flex {\n display: flex;\n}\n.table {\n display: table;\n}\n.grid {\n display: grid;\n}\n.contents {\n display: contents;\n}\n.hidden {\n display: none;\n}\n.h-4 {\n height: 1rem;\n}\n.h-5 {\n height: 1.25rem;\n}\n.h-8 {\n height: 2rem;\n}\n.h-full {\n height: 100%;\n}\n.w-1\\/2 {\n width: 50%;\n}\n.w-1\\/3 {\n width: 33.333333%;\n}\n.w-12 {\n width: 3rem;\n}\n.w-2\\/3 {\n width: 66.666667%;\n}\n.w-4 {\n width: 1rem;\n}\n.w-full {\n width: 100%;\n}\n.max-w-32 {\n max-width: 8rem;\n}\n.flex-1 {\n flex: 1 1 0%;\n}\n.shrink {\n flex-shrink: 1;\n}\n.shrink-0 {\n flex-shrink: 0;\n}\n.flex-grow {\n flex-grow: 1;\n}\n.grow {\n flex-grow: 1;\n}\n.border-collapse {\n border-collapse: collapse;\n}\n.rotate-45 {\n --tw-rotate: 45deg;\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-pointer {\n cursor: pointer;\n}\n.grid-cols-2 {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n}\n.grid-cols-3 {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-end {\n align-items: flex-end;\n}\n.items-center {\n align-items: center;\n}\n.justify-start {\n justify-content: flex-start;\n}\n.justify-end {\n justify-content: flex-end;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-0 {\n gap: 0px;\n}\n.gap-1 {\n gap: 0.25rem;\n}\n.gap-2 {\n gap: 0.5rem;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.gap-6 {\n gap: 1.5rem;\n}\n.gap-8 {\n gap: 2rem;\n}\n.space-y-2 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));\n}\n.space-y-4 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(1rem * var(--tw-space-y-reverse));\n}\n.space-y-8 > :not([hidden]) ~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(2rem * var(--tw-space-y-reverse));\n}\n.overflow-auto {\n overflow: auto;\n}\n.overflow-hidden {\n overflow: hidden;\n}\n.overflow-visible {\n overflow: visible;\n}\n.whitespace-nowrap {\n white-space: nowrap;\n}\n.text-nowrap {\n text-wrap: nowrap;\n}\n.rounded {\n border-radius: 0.25rem;\n}\n.rounded-full {\n border-radius: 9999px;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.rounded-md {\n border-radius: 0.375rem;\n}\n.rounded-sm {\n border-radius: 0.125rem;\n}\n.border {\n border-width: 1px;\n}\n.border-2 {\n border-width: 2px;\n}\n.border-b {\n border-bottom-width: 1px;\n}\n.border-t {\n border-top-width: 1px;\n}\n.border-solid {\n border-style: solid;\n}\n.border-none {\n border-style: none;\n}\n.border-gray-400 {\n --tw-border-opacity: 1;\n border-color: rgb(156 163 175 / var(--tw-border-opacity, 1));\n}\n.border-gray-500 {\n --tw-border-opacity: 1;\n border-color: rgb(107 114 128 / var(--tw-border-opacity, 1));\n}\n.border-slate-200 {\n --tw-border-opacity: 1;\n border-color: rgb(226 232 240 / var(--tw-border-opacity, 1));\n}\n.border-slate-300 {\n --tw-border-opacity: 1;\n border-color: rgb(203 213 225 / var(--tw-border-opacity, 1));\n}\n.border-slate-700 {\n --tw-border-opacity: 1;\n border-color: rgb(51 65 85 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-emerald-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(167 243 208 / var(--tw-bg-opacity, 1));\n}\n.bg-green-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1));\n}\n.bg-orange-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 215 170 / var(--tw-bg-opacity, 1));\n}\n.bg-red-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1));\n}\n.bg-red-500 {\n --tw-bg-opacity: 1;\n background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));\n}\n.bg-slate-50 {\n --tw-bg-opacity: 1;\n background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1));\n}\n.bg-transparent {\n background-color: transparent;\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.bg-yellow-200 {\n --tw-bg-opacity: 1;\n background-color: rgb(254 240 138 / var(--tw-bg-opacity, 1));\n}\n.p-0 {\n padding: 0px;\n}\n.p-1 {\n padding: 0.25rem;\n}\n.p-2 {\n padding: 0.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.p-8 {\n padding: 2rem;\n}\n.px-2 {\n padding-left: 0.5rem;\n padding-right: 0.5rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.px-8 {\n padding-left: 2rem;\n padding-right: 2rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n.py-4 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n.py-6 {\n padding-top: 1.5rem;\n padding-bottom: 1.5rem;\n}\n.pb-2 {\n padding-bottom: 0.5rem;\n}\n.pb-4 {\n padding-bottom: 1rem;\n}\n.pb-6 {\n padding-bottom: 1.5rem;\n}\n.pb-8 {\n padding-bottom: 2rem;\n}\n.pl-0 {\n padding-left: 0px;\n}\n.pl-2 {\n padding-left: 0.5rem;\n}\n.pl-4 {\n padding-left: 1rem;\n}\n.pt-1 {\n padding-top: 0.25rem;\n}\n.pt-12 {\n padding-top: 3rem;\n}\n.pt-2 {\n padding-top: 0.5rem;\n}\n.pt-4 {\n padding-top: 1rem;\n}\n.pt-5 {\n padding-top: 1.25rem;\n}\n.pt-6 {\n padding-top: 1.5rem;\n}\n.pt-8 {\n padding-top: 2rem;\n}\n.text-left {\n text-align: left;\n}\n.text-center {\n text-align: center;\n}\n.text-right {\n text-align: right;\n}\n.align-middle {\n vertical-align: middle;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-base {\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.text-lg {\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.text-xl {\n font-size: 1.25rem;\n line-height: 1.75rem;\n}\n.text-xs {\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-normal {\n font-weight: 400;\n}\n.capitalize {\n text-transform: capitalize;\n}\n.text-emerald-600 {\n --tw-text-opacity: 1;\n color: rgb(5 150 105 / var(--tw-text-opacity, 1));\n}\n.text-emerald-700 {\n --tw-text-opacity: 1;\n color: rgb(4 120 87 / var(--tw-text-opacity, 1));\n}\n.text-gray-600 {\n --tw-text-opacity: 1;\n color: rgb(75 85 99 / var(--tw-text-opacity, 1));\n}\n.text-gray-900 {\n --tw-text-opacity: 1;\n color: rgb(17 24 39 / var(--tw-text-opacity, 1));\n}\n.text-green-600 {\n --tw-text-opacity: 1;\n color: rgb(22 163 74 / var(--tw-text-opacity, 1));\n}\n.text-orange-500 {\n --tw-text-opacity: 1;\n color: rgb(249 115 22 / var(--tw-text-opacity, 1));\n}\n.text-orange-600 {\n --tw-text-opacity: 1;\n color: rgb(234 88 12 / var(--tw-text-opacity, 1));\n}\n.text-red-500 {\n --tw-text-opacity: 1;\n color: rgb(239 68 68 / var(--tw-text-opacity, 1));\n}\n.text-slate-400 {\n --tw-text-opacity: 1;\n color: rgb(148 163 184 / var(--tw-text-opacity, 1));\n}\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\n.text-slate-600 {\n --tw-text-opacity: 1;\n color: rgb(71 85 105 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.text-yellow-500 {\n --tw-text-opacity: 1;\n color: rgb(234 179 8 / var(--tw-text-opacity, 1));\n}\n.underline {\n text-decoration-line: underline;\n}\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-lg {\n --tw-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-none {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-sm {\n --tw-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.shadow-xl {\n --tw-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-\\[margin\\] {\n transition-property: margin;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.duration-200 {\n transition-duration: 200ms;\n}\n.duration-300 {\n transition-duration: 300ms;\n}\n.hover\\:bg-gray-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-100:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-slate-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(226 232 240 / var(--tw-bg-opacity, 1));\n}\n.hover\\:bg-gray-200:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));\n}\n@media (min-width: 768px) {\n .sm\\:flex {\n display: flex;\n }\n .sm\\:hidden {\n display: none;\n }\n}\n.hover\\:bunny-text-orange-400:hover {\n --tw-text-opacity: 1;\n color: rgb(251 146 60 / var(--tw-text-opacity, 1));\n}\n.bunny-components .ant-upload-select-picture-card {\n margin: 0 !important;\n}\n.bunny-components .ant-upload {\n border-radius: 0.5rem !important;\n}\n.bunny-components .ant-row {\n margin-bottom: 0px;\n}\n.bunny-components .ant-select-disabled .ant-select-selector .ant-select-selection-item {\n color: rgba(0, 0, 0, 0.25) !important;\n}\n.bunny-components .ant-input-number,\n.bunny-components .ant-input,\n.bunny-components .ant-picker,\n.bunny-components .ant-input-affix-wrapper,\n.bunny-components .ant-select-selector {\n font-size: 0.875rem !important;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n color: #232323 !important;\n}\n.bunny-components .ant-input-affix-wrapper {\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n}\n.bunny-components .ant-input-group-addon,\n.bunny-components .ant-input-number-group-addon {\n color: #475569 !important;\n}\n.bunny-components .ant-input-number-group-wrapper,\n.bunny-components .ant-input-number-affix-wrapper {\n width: 100%;\n}\n.bunny-components .ant-input-affix-wrapper input {\n border: none !important;\n}\n.bunny-components .ant-form-item {\n margin-bottom: 0;\n}\n.bunny-components .ant-form-item-label {\n text-transform: none !important;\n font-size: 0.75rem;\n padding-bottom: 2px !important;\n}\n.bunny-components .ant-form-item-label > label {\n width: 100%;\n color: #4b5563 !important;\n}\n.bunny-components .form .ant-form-item-label label {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n box-sizing: border-box;\n}\n.bunny-components .ant-form-item-explain,\n.bunny-components .ant-form-item-explain-error {\n font-size: 11px;\n min-height: 11px;\n line-height: 11px;\n padding-top: 2px;\n}\n.bunny-components .ant-timeline-item-content {\n font-size: smaller;\n}\n.bunny-components .ant-tree {\n font-size: 0.875rem;\n}\n.bunny-components .ant-tree-treenode {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-draggable-icon {\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-node-content-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-tree-switcher {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-page-header {\n padding-left: 0;\n padding-right: 0;\n padding-top: 0;\n}\n.bunny-components .ant-tag {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 14px;\n font-weight: 500;\n white-space: nowrap;\n padding-inline-start: 0.625rem;\n padding-inline-end: 0.625rem;\n margin: 0;\n}\n.bunny-components .ant-tag-blue {\n color: #3b82f6 !important;\n background: #bfdbfe !important;\n}\n.bunny-components .ant-tag-green {\n color: #059669 !important;\n background: #a7f3d0 !important;\n}\n.bunny-components .ant-tag-red {\n color: #ef4444 !important;\n background: #fecaca !important;\n}\n.bunny-components .ant-tag-orange {\n color: #f97316 !important;\n background: #fed7aa !important;\n}\n.bunny-components .ant-tag-yellow {\n color: #f59e0b !important;\n background: #fde68a !important;\n}\n.bunny-components .ant-tag-purple {\n color: #8b5cf6 !important;\n background: #ddd6fe !important;\n}\n.bunny-components .ant-tag-gray {\n color: #6b7280 !important;\n background: #e5e7eb !important;\n}\n.bunny-components .ant-tag-black {\n color: white !important;\n background: black !important;\n}\n.bunny-components .ant-picker {\n width: 100%;\n}\n.bunny-components .ant-input,\n.bunny-components .ant-select,\n.bunny-components .ant-picker {\n height: 32px !important;\n}\n.bunny-components .ant-slider-dot {\n border: 2px solid #f0f0f0;\n}\n.bunny-components .ant-slider-dot-active {\n border-color: #ff5833;\n}\n.bunny-components .ant-slider-mark :last-child {\n transform: translateX(-75%) !important;\n}\n.bunny-components .ant-drawer-content {\n background: #f3f3f9ff;\n}\n.bunny-components .ant-drawer-body,\n.bunny-components .ant-layout {\n background: #f8fafc;\n}\n.bunny-components .vista-link {\n color: #1890ff;\n}\n.bunny-components .vista-link:hover {\n text-decoration: underline;\n cursor: pointer;\n}\n.bunny-components .ant-popover-inner-content {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n max-width: 300px;\n}\n.bunny-components .ant-popconfirm-message-text {\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-title {\n padding: 0;\n text-align: center;\n font-size: 0.875rem !important;\n width: 100% !important;\n}\n.bunny-components .ant-popconfirm-buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n}\n.bunny-components .ant-popconfirm-buttons button {\n margin-inline-start: 0 !important;\n}\n.bunny-components .ant-pagination-item {\n display: flex !important;\n align-items: center;\n justify-content: center;\n}\n.bunny-components .ant-btn-primary:disabled {\n background: #eef0f2 !important;\n color: rgba(0, 0, 0, 0.25) !important;\n border: none;\n}\n.bunny-components .ant-btn {\n box-shadow: none;\n text-shadow: none;\n outline: none !important;\n line-height: 1;\n font-weight: normal;\n}\n.bunny-components .ant-btn-default .ant-btn-icon {\n color: #94a3b8;\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n.bunny-components .ant-btn-default:hover .ant-btn-icon {\n color: #ff7f5c;\n}\n.bunny-components .ant-btn-default:disabled {\n border-color: rgba(113, 125, 148, 0.2) !important;\n}\n.bunny-components .ant-btn-primary:disabled {\n background-color: rgba(113, 125, 148, 0.1) !important;\n border-color: rgba(113, 125, 148, 0.1) !important;\n}\n.bunny-components .ant-btn-primary:hover:disabled,\n.bunny-components .ant-btn-primary:disabled {\n background-clip: padding-box;\n}\n.bunny-components .ant-select-arrow .anticon:not(.ant-select-suffix) {\n pointer-events: none;\n}\n.bunny-components .ant-dropdown-menu-items {\n padding-left: 0 !important;\n}\n.bunny-components .ant-dropdown-menu-item-active {\n background-color: transparent !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper.searchfield input {\n background: white !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused {\n background: white !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield {\n background: #f8f8f8 !important;\n}\n.bunny-components .panel .ant-input-affix-wrapper.searchfield input {\n background: #f8f8f8 !important;\n}\n.bunny-components .ant-input-steps-hidden .ant-input-number-handler-wrap {\n display: none;\n}\n.bunny-components .ant-layout-header {\n height: 48px;\n}\n.bunny-components .ant-layout-sider-children {\n width: inherit;\n position: fixed;\n}\n.bunny-components .ant-menu-item-group-list {\n display: flex !important;\n flex-direction: column !important;\n align-items: flex-start !important;\n gap: 4px !important;\n}\n.bunny-components .group {\n display: flex;\n flex-direction: row;\n flex-flow: row wrap;\n box-sizing: border-box;\n}\n.bunny-components .select-datepicker {\n animation-duration: 0.35s !important;\n}\n.bunny-components .header-datepicker {\n top: 96px !important;\n animation-duration: 0s !important;\n}\n.bunny-components .ant-picker-header {\n border-bottom: none !important;\n}\n.bunny-components .ant-picker-content thead tr th {\n font-weight: 500;\n}\n.bunny-components .ant-picker-panel-container {\n border-radius: 0.375rem;\n}\n.bunny-components .ant-picker-cell-selected .custom-date-display {\n color: #ffffff;\n background-color: #ff5833;\n}\n.bunny-components .ant-picker-cell-today .custom-date-display {\n border: 1px solid #ff5833;\n}\n.bunny-components .ant-input-number {\n width: 100%;\n}\n.bunny-components .ant-input-number-focused {\n border-color: #ff5833 !important;\n background-color: #ffffff !important;\n}\n.bunny-components .ant-input-affix-wrapper-focused,\n.bunny-components .ant-input-number-focused,\n.bunny-components .ant-picker,\n.bunny-components .ant-input,\n.bunny-components .ant-select-focused .ant-select-selector,\n.bunny-components .ant-select-selector:focus,\n.bunny-components .ant-select-selector:active,\n.bunny-components .ant-select-open .ant-select-selector {\n box-shadow: none !important;\n}\n.bunny-components .ant-select-item-option-selected .ant-select-item-option-state {\n display: none !important;\n}\n.bunny-components .ant-form * input[type='text'].ant-input:not(:disabled),\n.bunny-components .ant-select-selection-item:not(:disabled) {\n color: #232323;\n}\n.bunny-components .ant-tabs-ink-bar {\n display: none !important;\n}\n.bunny-components .ant-tabs-tab.ant-tabs-tab-active {\n border-bottom: 2px solid #ff5833 !important;\n}\n.bunny-components .ant-tabs-tab {\n border-bottom: 2px solid transparent !important;\n padding-bottom: 14px !important;\n}\n.bunny-components .ant-upload-wrapper {\n display: flex;\n}\n.bunny-components .ant-form-item-label > label::after {\n display: none !important;\n}\n.bunny-components .ant-menu-item {\n display: flex !important;\n align-items: center !important;\n}\n.ant-notification {\n width: min-content;\n}\n.ant-notification-topRight {\n right: 0 !important;\n left: 0 !important;\n margin-left: auto !important;\n margin-right: auto !important;\n}\n.ant-notification-notice-wrapper {\n width: 350px !important;\n overflow: hidden !important;\n}\n.ant-notification-notice {\n padding: 16px !important;\n width: 350px !important;\n border-radius: 8px !important;\n display: flex !important;\n box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.08), 0px 1px 18px rgba(0, 0, 0, 0.08), 0px 3px 5px rgba(0, 0, 0, 0.16) !important;\n}\n.ant-notification-notice-description {\n padding: 0 14px 0 0 !important;\n font-size: 14px !important;\n overflow-wrap: break-word;\n}\n.ant-notification-notice-success {\n background-color: #edfffa !important;\n}\n.ant-notification-notice-error {\n background-color: #fff8f4 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-message {\n color: #ff5833 !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-error .ant-notification-notice-icon {\n color: #ff5833;\n}\n.ant-notification-notice-success .ant-notification-notice-message {\n color: #00b76a !important;\n font-weight: 500 !important;\n}\n.ant-notification-notice-success .ant-notification-notice-icon {\n color: #00b76a !important;\n}\n.ant-notification-notice-message {\n margin-bottom: 0 !important;\n}\n.ant-notification-notice-close {\n top: 16px !important;\n right: 16px !important;\n}\n:root {\n --bunny-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n --bunny-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n --bunny-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);\n}\n.bunny-signup {\n --bunny-signup-bg: #f8fafc;\n background-color: var(--bunny-signup-bg);\n}\n.bunny-billing-details {\n --bunny-billing-details-bg: var(--row-background);\n --bunny-billing-details-radius: 0.375rem;\n --bunny-billing-details-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);\n display: flex;\n flex-direction: column;\n background-color: var(--bunny-billing-details-bg);\n border-radius: var(--bunny-billing-details-radius);\n box-shadow: var(--bunny-billing-details-shadow);\n}\n.bunny-billing-details--dark {\n --bunny-billing-details-bg: var(--row-background-dark);\n}\n.bunny-feature-group {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 0;\n box-shadow: var(--bunny-shadow-md);\n overflow: hidden;\n}\n.bunny-plan-features-feature-title-group {\n color: #64748b;\n font-size: 0.75rem;\n font-weight: 500;\n}\n.bunny-plan-picker-grid-cell-divider {\n border-left: 1px solid #e2e8f0;\n}\n.bunny-price-list-card-price-description {\n color: #9ca3af;\n font-size: 0.875rem;\n}\n.bunny-plan-picker-price-list-cards {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 0;\n box-shadow: var(--bunny-shadow-md);\n overflow: hidden;\n}\n.bunny-plan-picker-checkout-bar {\n background-color: #ffffff;\n border-radius: 0.375rem;\n padding: 1rem;\n box-shadow: var(--bunny-shadow-md);\n}\n.bunny-invoice-container {\n padding: 0;\n box-sizing: border-box !important;\n line-height: 1.15;\n}\n@media only screen and (max-width: 768px) {\n select,\n textarea,\n input[type='text'],\n input[type='password'],\n input[type='datetime'],\n input[type='datetime-local'],\n input[type='date'],\n input[type='month'],\n input[type='time'],\n input[type='week'],\n input[type='number'],\n input[type='email'],\n input[type='url'],\n input[type='search'],\n input[type='tel'],\n input[type='color'] {\n font-size: 16px !important;\n }\n}\n@keyframes App-logo-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n");const C="rgb(248 250 252)",w="rgb(226 232 240)",j="rgb(148 163 184)",S="rgb(100 116 139)",I="rgb(71 85 105)",L="rgb(229 231 235)",P="#ff6e1c",k=w,N=["READY","NOT_DUE","DUE","UNPAID"],F={MONTHLY:"month",QUARTERLY:"quarter",SEMI_ANNUAL:"six months",ANNUAL:"year"},D="DevAuthAsUser",T=w,q=P,A=[{value:"AF",label:"Afghanistan"},{value:"AL",label:"Albania"},{value:"DZ",label:"Algeria"},{value:"AS",label:"American Samoa"},{value:"AD",label:"Andorra"},{value:"AO",label:"Angola"},{value:"AI",label:"Anguilla"},{value:"AQ",label:"Antarctica"},{value:"AG",label:"Antigua and Barbuda"},{value:"AR",label:"Argentina"},{value:"AM",label:"Armenia"},{value:"AW",label:"Aruba"},{value:"AU",label:"Australia"},{value:"AT",label:"Austria"},{value:"AZ",label:"Azerbaijan"},{value:"BS",label:"Bahamas (the)"},{value:"BH",label:"Bahrain"},{value:"BD",label:"Bangladesh"},{value:"BB",label:"Barbados"},{value:"BY",label:"Belarus"},{value:"BE",label:"Belgium"},{value:"BZ",label:"Belize"},{value:"BJ",label:"Benin"},{value:"BM",label:"Bermuda"},{value:"BT",label:"Bhutan"},{value:"BO",label:"Bolivia (Plurinational State of)"},{value:"BQ",label:"Bonaire, Sint Eustatius and Saba"},{value:"BA",label:"Bosnia and Herzegovina"},{value:"BW",label:"Botswana"},{value:"BV",label:"Bouvet Island"},{value:"BR",label:"Brazil"},{value:"IO",label:"British Indian Ocean Territory (the)"},{value:"BN",label:"Brunei Darussalam"},{value:"BG",label:"Bulgaria"},{value:"BF",label:"Burkina Faso"},{value:"BI",label:"Burundi"},{value:"CV",label:"Cabo Verde"},{value:"KH",label:"Cambodia"},{value:"CM",label:"Cameroon"},{value:"CA",label:"Canada"},{value:"KY",label:"Cayman Islands (the)"},{value:"CF",label:"Central African Republic (the)"},{value:"TD",label:"Chad"},{value:"CL",label:"Chile"},{value:"CN",label:"China"},{value:"CX",label:"Christmas Island"},{value:"CC",label:"Cocos (Keeling) Islands (the)"},{value:"CO",label:"Colombia"},{value:"KM",label:"Comoros (the)"},{value:"CD",label:"Congo (the Democratic Republic of the)"},{value:"CG",label:"Congo (the)"},{value:"CK",label:"Cook Islands (the)"},{value:"CR",label:"Costa Rica"},{value:"HR",label:"Croatia"},{value:"CU",label:"Cuba"},{value:"CW",label:"Curaçao"},{value:"CY",label:"Cyprus"},{value:"CZ",label:"Czechia"},{value:"CI",label:"Côte d'Ivoire"},{value:"DK",label:"Denmark"},{value:"DJ",label:"Djibouti"},{value:"DM",label:"Dominica"},{value:"DO",label:"Dominican Republic (the)"},{value:"EC",label:"Ecuador"},{value:"EG",label:"Egypt"},{value:"SV",label:"El Salvador"},{value:"GQ",label:"Equatorial Guinea"},{value:"ER",label:"Eritrea"},{value:"EE",label:"Estonia"},{value:"SZ",label:"Eswatini"},{value:"ET",label:"Ethiopia"},{value:"FK",label:"Falkland Islands (the) [Malvinas]"},{value:"FO",label:"Faroe Islands (the)"},{value:"FJ",label:"Fiji"},{value:"FI",label:"Finland"},{value:"FR",label:"France"},{value:"GF",label:"French Guiana"},{value:"PF",label:"French Polynesia"},{value:"TF",label:"French Southern Territories (the)"},{value:"GA",label:"Gabon"},{value:"GM",label:"Gambia (the)"},{value:"GE",label:"Georgia"},{value:"DE",label:"Germany"},{value:"GH",label:"Ghana"},{value:"GI",label:"Gibraltar"},{value:"GR",label:"Greece"},{value:"GL",label:"Greenland"},{value:"GD",label:"Grenada"},{value:"GP",label:"Guadeloupe"},{value:"GU",label:"Guam"},{value:"GT",label:"Guatemala"},{value:"GG",label:"Guernsey"},{value:"GN",label:"Guinea"},{value:"GW",label:"Guinea-Bissau"},{value:"GY",label:"Guyana"},{value:"HT",label:"Haiti"},{value:"HM",label:"Heard Island and McDonald Islands"},{value:"VA",label:"Holy See (the)"},{value:"HN",label:"Honduras"},{value:"HK",label:"Hong Kong"},{value:"HU",label:"Hungary"},{value:"IS",label:"Iceland"},{value:"IN",label:"India"},{value:"value",label:"Indonesia"},{value:"IR",label:"Iran (Islamic Republic of)"},{value:"IQ",label:"Iraq"},{value:"IE",label:"Ireland"},{value:"IM",label:"Isle of Man"},{value:"IL",label:"Israel"},{value:"IT",label:"Italy"},{value:"JM",label:"Jamaica"},{value:"JP",label:"Japan"},{value:"JE",label:"Jersey"},{value:"JO",label:"Jordan"},{value:"KZ",label:"Kazakhstan"},{value:"KE",label:"Kenya"},{value:"KI",label:"Kiribati"},{value:"KP",label:"Korea (the Democratic People's Republic of)"},{value:"KR",label:"Korea (the Republic of)"},{value:"KW",label:"Kuwait"},{value:"KG",label:"Kyrgyzstan"},{value:"LA",label:"Lao People's Democratic Republic (the)"},{value:"LV",label:"Latvia"},{value:"LB",label:"Lebanon"},{value:"LS",label:"Lesotho"},{value:"LR",label:"Liberia"},{value:"LY",label:"Libya"},{value:"LI",label:"Liechtenstein"},{value:"LT",label:"Lithuania"},{value:"LU",label:"Luxembourg"},{value:"MO",label:"Macao"},{value:"MG",label:"Madagascar"},{value:"MW",label:"Malawi"},{value:"MY",label:"Malaysia"},{value:"MV",label:"Maldives"},{value:"ML",label:"Mali"},{value:"MT",label:"Malta"},{value:"MH",label:"Marshall Islands (the)"},{value:"MQ",label:"Martinique"},{value:"MR",label:"Mauritania"},{value:"MU",label:"Mauritius"},{value:"YT",label:"Mayotte"},{value:"MX",label:"Mexico"},{value:"FM",label:"Micronesia (Federated States of)"},{value:"MD",label:"Moldova (the Republic of)"},{value:"MC",label:"Monaco"},{value:"MN",label:"Mongolia"},{value:"ME",label:"Montenegro"},{value:"MS",label:"Montserrat"},{value:"MA",label:"Morocco"},{value:"MZ",label:"Mozambique"},{value:"MM",label:"Myanmar"},{value:"NA",label:"Namibia"},{value:"NR",label:"Nauru"},{value:"NP",label:"Nepal"},{value:"NL",label:"Netherlands (the)"},{value:"NC",label:"New Caledonia"},{value:"NZ",label:"New Zealand"},{value:"NI",label:"Nicaragua"},{value:"NE",label:"Niger (the)"},{value:"NG",label:"Nigeria"},{value:"NU",label:"Niue"},{value:"NF",label:"Norfolk Island"},{value:"MP",label:"Northern Mariana Islands (the)"},{value:"NO",label:"Norway"},{value:"OM",label:"Oman"},{value:"PK",label:"Pakistan"},{value:"PW",label:"Palau"},{value:"PS",label:"Palestine, State of"},{value:"PA",label:"Panama"},{value:"PG",label:"Papua New Guinea"},{value:"PY",label:"Paraguay"},{value:"PE",label:"Peru"},{value:"PH",label:"Philippines (the)"},{value:"PN",label:"Pitcairn"},{value:"PL",label:"Poland"},{value:"PT",label:"Portugal"},{value:"PR",label:"Puerto Rico"},{value:"QA",label:"Qatar"},{value:"MK",label:"Republic of North Macedonia"},{value:"RO",label:"Romania"},{value:"RU",label:"Russian Federation (the)"},{value:"RW",label:"Rwanda"},{value:"RE",label:"Réunion"},{value:"BL",label:"Saint Barthélemy"},{value:"SH",label:"Saint Helena, Ascension and Tristan da Cunha"},{value:"KN",label:"Saint Kitts and Nevis"},{value:"LC",label:"Saint Lucia"},{value:"MF",label:"Saint Martin (French part)"},{value:"PM",label:"Saint Pierre and Miquelon"},{value:"VC",label:"Saint Vincent and the Grenadines"},{value:"WS",label:"Samoa"},{value:"SM",label:"San Marino"},{value:"ST",label:"Sao Tome and Principe"},{value:"SA",label:"Saudi Arabia"},{value:"SN",label:"Senegal"},{value:"RS",label:"Serbia"},{value:"SC",label:"Seychelles"},{value:"SL",label:"Sierra Leone"},{value:"SG",label:"Singapore"},{value:"SX",label:"Sint Maarten (Dutch part)"},{value:"SK",label:"Slovakia"},{value:"SI",label:"Slovenia"},{value:"SB",label:"Solomon Islands"},{value:"SO",label:"Somalia"},{value:"ZA",label:"South Africa"},{value:"GS",label:"South Georgia and the South Sandwich Islands"},{value:"SS",label:"South Sudan"},{value:"ES",label:"Spain"},{value:"LK",label:"Sri Lanka"},{value:"SD",label:"Sudan (the)"},{value:"SR",label:"Suriname"},{value:"SJ",label:"Svalbard and Jan Mayen"},{value:"SE",label:"Sweden"},{value:"CH",label:"Switzerland"},{value:"SY",label:"Syrian Arab Republic"},{value:"TW",label:"Taiwan"},{value:"TJ",label:"Tajikistan"},{value:"TZ",label:"Tanzania, United Republic of"},{value:"TH",label:"Thailand"},{value:"TL",label:"Timor-Leste"},{value:"TG",label:"Togo"},{value:"TK",label:"Tokelau"},{value:"TO",label:"Tonga"},{value:"TT",label:"Trinidad and Tobago"},{value:"TN",label:"Tunisia"},{value:"TR",label:"Turkey"},{value:"TM",label:"Turkmenistan"},{value:"TC",label:"Turks and Caicos Islands (the)"},{value:"TV",label:"Tuvalu"},{value:"UG",label:"Uganda"},{value:"UA",label:"Ukraine"},{value:"AE",label:"United Arab Emirates (the)"},{value:"GB",label:"United Kingdom of Great Britain and Northern Ireland (the)"},{value:"UM",label:"United States Minor Outlying Islands (the)"},{value:"US",label:"United States of America (the)"},{value:"UY",label:"Uruguay"},{value:"UZ",label:"Uzbekistan"},{value:"VU",label:"Vanuatu"},{value:"VE",label:"Venezuela (Bolivarian Republic of)"},{value:"VN",label:"Viet Nam"},{value:"VG",label:"Virgin Islands (British)"},{value:"VI",label:"Virgin Islands (U.S.)"},{value:"WF",label:"Wallis and Futuna"},{value:"EH",label:"Western Sahara"},{value:"YE",label:"Yemen"},{value:"ZM",label:"Zambia"},{value:"ZW",label:"Zimbabwe"},{value:"AX",label:"Åland Islands"}];var M;!function(n){n[n.xs=480]="xs",n[n.sm=768]="sm",n[n.md=992]="md",n[n.lg=1200]="lg",n[n.xl=1400]="xl",n[n.xxl=2e3]="xxl"}(M||(M={}));const H=(n=M.sm)=>{const[t,i]=e.useState(()=>window.innerWidth<n);return e.useEffect(()=>{const e=()=>{const e=window.innerWidth<n;i(n=>n!==e?e:n)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[n]),t},E=n=>{const t=Q();return i=>{var a,o,r,s,l,u,d,c,p,m,y,g,b;if((null===(a=null==i?void 0:i.message)||void 0===a?void 0:a.includes("Token is"))||(null===(r=null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.description)||void 0===r?void 0:r.includes("Token is"))||(null===(u=null===(l=null===(s=null==i?void 0:i.response)||void 0===s?void 0:s[0])||void 0===l?void 0:l.description)||void 0===u?void 0:u.includes("Token is")))null==n||n();else if("string"==typeof i)t(i,null);else if(null===(d=null==i?void 0:i.response)||void 0===d?void 0:d.errors){const n=i.response.errors;for(let e in n){const i=(null===(c=n[e])||void 0===c?void 0:c.message)||n[e];t(i,null)}}else if(null==i?void 0:i.errors){const n=i.errors;for(let e in n){const i=(null===(p=n[e])||void 0===p?void 0:p.message)||n[e];t(i,null)}}else if(Array.isArray(i))for(let n in i){const e=(null===(m=i[n])||void 0===m?void 0:m.message)||i[n];t(e,null)}else(null===(y=null==i?void 0:i.response)||void 0===y?void 0:y.message)?t(i.response.message,null):(null===(g=null==i?void 0:i.response)||void 0===g?void 0:g.error)?t(null===(b=null==i?void 0:i.response)||void 0===b?void 0:b.exception,i.response.error):(null==i?void 0:i.message)?t(i.message):"string"==typeof i||null!==i&&e.isValidElement(i)?t(i):t("Unknown error notification",null)}},Q=()=>(e,a,o=30)=>{setTimeout(()=>i.notification.error({description:e,duration:o,icon:n.jsx(t.WarningOutlined,{}),message:a||"Error",placement:"top"}),10)},$=()=>(e,a,o=3)=>{setTimeout(()=>i.notification.success({description:e,duration:o,icon:n.jsx(t.CheckCircleOutlined,{}),message:a||"Success",placement:"bottomRight"}),10)},_=()=>(n,e,t=10)=>{setTimeout(()=>i.notification.info({description:n,duration:t,message:e||"Info",placement:"top"}),10)},R=({accountId:n,entityId:e,token:t})=>["accountPaymentMethods",...e?[e]:[],...n?[n]:[],...t?[t]:[]],B=({accountId:n,token:e})=>["accountBillingDetails",...n?[n]:[],...e?[e]:[]],U=({accountId:n,token:e})=>["accountContacts",...n?[n]:[],...e?[e]:[]],V=n=>["branding",...n?[n]:[]],O=(n,e)=>["quotes",...n?[n]:[],...e?[e]:[]],Z=({id:n,token:e})=>["formattedInvoice",n,...e?[e]:[]],z=({id:n,objectName:e,token:t})=>[e,...n?[n]:[],...t?[t]:[]],K=({id:n,token:e})=>["quote",n,e],G=({token:n})=>["signupQuote",...n?[n]:[]],Y=({id:n,token:e})=>["quoteTaxCalculate",...n?[n]:[],...e?[e]:[]],W=({filterString:n,pluralType:e,token:t})=>n?[e,"list",n,t]:[e,"list",t],X=n=>["currentUser",...n?[n]:[]],J=({subscriptionId:n,productId:e,token:t})=>["planChangeOptions",...n?[n]:[],...e?[e]:[],...t?[t]:[]],nn=n=>["plugins",...n?[n]:[]],en=({entityId:n,token:e})=>["taxationRequiredAccountFields",...n?[n]:[],...e?[e]:[]],tn=({filter:n,token:e})=>["transactions",...n?[n]:[],...e?[e]:[]],an=({priceListId:n,token:e})=>["addonPlans",n,...e?[e]:[]],on=n=>["paymentPlugins",...n?[n]:[]],rn=({subscriptionId:n,token:e})=>["subscriptionChargeHistograms",n,...e?[e]:[]],sn=n=>["signupAccount",...n?[n]:[]],ln=(n,e)=>["signupPriceList",...n?[n]:[],...e?[e]:[]],un={quoteAccountSignup:["quoteAccountSignup"]},dn=e.createContext({}),cn={host:"",subdomain:"",apiEndpoint:"/api",graphqlEndpoint:"/graphql",pluginsEndpoint:"/api/plugins"},pn="1.8.0-beta.33",mn=()=>async(n,e,t,i)=>{try{return await o((n=>`${n}/graphql`)(e),n,i,(n=>{const e=gn({token:n});return e["x-components-version"]=pn,e})(t))}catch(n){throw n}},yn=async({query:n,apiHost:e,token:t,vars:i,isInPreviewMode:a})=>{const{graphqlEndpoint:r}=cn,s={...gn({token:a?void 0:t,componentsVersion:pn})};try{return await o(`${e}${r}`,n,i,s)}catch(n){throw n}},gn=({token:n,componentsVersion:e,additionalHeaders:t})=>{const i={"Content-type":"application/json; charset=utf-8"},a=localStorage.getItem(D),o=localStorage.getItem("timeTravelDate");return n&&(i.Authorization=`Bearer ${n}`),e&&(i["x-components-version"]=e),a&&(i[D]=a),o&&(i["X-Bunny-Time-Travel"]=o),t&&Object.assign(i,t),i},bn=e.createContext({}),hn=()=>{const t=e.createContext(null);return[({value:e,children:i})=>n.jsx(t.Provider,{value:e,children:i}),()=>{const n=e.useContext(t);if(null===n)throw new Error("Provider missing");return n}]},[vn,fn]=hn(),[xn,Cn]=hn(),wn="Invalid or missing authorization",jn=[wn,'["Not found"]',"This quote is currently unavailable"],Sn=({onUserUnavailable:n,onInvalidOrMissingAuthorization:t,suppressUserUnavailableErrorNotification:i,disableErrorNotifications:a}={})=>{const o=Q();return(r,s)=>{var l,u,d,c,p,m,y,g;const b=(null===(l=null==r?void 0:r.response)||void 0===l?void 0:l.errors)||null,h=null!==(p=null===(c=null===(d=null===(u=null==r?void 0:r.response)||void 0===u?void 0:u.errors)||void 0===d?void 0:d[0])||void 0===c?void 0:c.message)&&void 0!==p?p:null==r?void 0:r.message;if((null==h?void 0:h.includes(wn))&&(null==t||t()),(null==h?void 0:h.includes("Contact does not exist within"))&&(null==n||n(),i))return r;if(jn.includes(h))return r;if(a)return r;if((null==r?void 0:r.data)&&s){const n=((n,e)=>{if(!n||!e)return null;const t=n[e];if(!t)return null;const i=t.errors;if(!i)return null;if("string"==typeof i)try{const n=JSON.parse(i);return Array.isArray(n)?n:[n]}catch(n){return[i]}return Array.isArray(i)?i:null})(r.data,s);if(n&&n.length>0){if(jn.some(e=>n.includes(e)))return r;for(const e of n)o(e,null);return r}}if(b)for(let n in b){const e=null===(m=b[n])||void 0===m?void 0:m.message;o(e,null)}else if(null===(y=null==r?void 0:r.response)||void 0===y?void 0:y.error)o(r.response.exception,r.response.error);else if((null==r?void 0:r.constructor)===Array)for(let n in r)o(r[n].message,null);else(null===(g=null==r?void 0:r.response)||void 0===g?void 0:g.message)?o(r.response.message):(null==r?void 0:r.message)?o(r.message):"string"==typeof r||null!==r&&e.isValidElement(r)?o(r):o("Unknown error notification",null)}};async function In(n,e,t){return await yn({query:l.print(n),vars:t,apiHost:e.apiHost,token:e.token})}var Ln,Pn,kn="Document",Nn="FragmentDefinition";class Fn extends Error{constructor(n,e,t,i,a,o,r){super(n),this.name="GraphQLError",this.message=n,a&&(this.path=a),e&&(this.nodes=Array.isArray(e)?e:[e]),t&&(this.source=t),i&&(this.positions=i),o&&(this.originalError=o);var s=r;if(!s&&o){var l=o.extensions;l&&"object"==typeof l&&(s=l)}this.extensions=s||{}}toJSON(){return{...this,message:this.message}}toString(){return this.message}get[Symbol.toStringTag](){return"GraphQLError"}}function Dn(n){return new Fn(`Syntax Error: Unexpected token at ${Pn} in ${n}`)}function Tn(n){if(n.lastIndex=Pn,n.test(Ln))return Ln.slice(Pn,Pn=n.lastIndex)}var qn=/ +(?=[^\s])/y;function An(n){for(var e=n.split("\n"),t="",i=0,a=0,o=e.length-1,r=0;r<e.length;r++)qn.lastIndex=0,qn.test(e[r])&&(r&&(!i||qn.lastIndex<i)&&(i=qn.lastIndex),a=a||r,o=r);for(var s=a;s<=o;s++)s!==a&&(t+="\n"),t+=e[s].slice(i).replace(/\\"""/g,'"""');return t}function Mn(){for(var n=0|Ln.charCodeAt(Pn++);9===n||10===n||13===n||32===n||35===n||44===n||65279===n;n=0|Ln.charCodeAt(Pn++))if(35===n)for(;(n=0|Ln.charCodeAt(Pn++))&&10!==n&&13!==n;);Pn--}function Hn(){for(var n=Pn,e=0|Ln.charCodeAt(Pn++);e>=48&&e<=57||e>=65&&e<=90||95===e||e>=97&&e<=122;e=0|Ln.charCodeAt(Pn++));if(n===Pn-1)throw Dn("Name");var t=Ln.slice(n,--Pn);return Mn(),t}function En(){return{kind:"Name",value:Hn()}}var Qn=/(?:"""|(?:[\s\S]*?[^\\])""")/y,$n=/(?:(?:\.\d+)?[eE][+-]?\d+|\.\d+)/y;function _n(n){var e;switch(Ln.charCodeAt(Pn)){case 91:Pn++,Mn();for(var t=[];93!==Ln.charCodeAt(Pn);)t.push(_n(n));return Pn++,Mn(),{kind:"ListValue",values:t};case 123:Pn++,Mn();for(var i=[];125!==Ln.charCodeAt(Pn);){var a=En();if(58!==Ln.charCodeAt(Pn++))throw Dn("ObjectField");Mn(),i.push({kind:"ObjectField",name:a,value:_n(n)})}return Pn++,Mn(),{kind:"ObjectValue",fields:i};case 36:if(n)throw Dn("Variable");return Pn++,{kind:"Variable",name:En()};case 34:if(34===Ln.charCodeAt(Pn+1)&&34===Ln.charCodeAt(Pn+2)){if(Pn+=3,null==(e=Tn(Qn)))throw Dn("StringValue");return Mn(),{kind:"StringValue",value:An(e.slice(0,-3)),block:!0}}var o,r=Pn;Pn++;var s=!1;for(o=0|Ln.charCodeAt(Pn++);92===o&&(Pn++,s=!0)||10!==o&&13!==o&&34!==o&&o;o=0|Ln.charCodeAt(Pn++));if(34!==o)throw Dn("StringValue");return e=Ln.slice(r,Pn),Mn(),{kind:"StringValue",value:s?JSON.parse(e):e.slice(1,-1),block:!1};case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:for(var l,u=Pn++;(l=0|Ln.charCodeAt(Pn++))>=48&&l<=57;);var d=Ln.slice(u,--Pn);if(46===(l=Ln.charCodeAt(Pn))||69===l||101===l){if(null==(e=Tn($n)))throw Dn("FloatValue");return Mn(),{kind:"FloatValue",value:d+e}}return Mn(),{kind:"IntValue",value:d};case 110:if(117===Ln.charCodeAt(Pn+1)&&108===Ln.charCodeAt(Pn+2)&&108===Ln.charCodeAt(Pn+3))return Pn+=4,Mn(),{kind:"NullValue"};break;case 116:if(114===Ln.charCodeAt(Pn+1)&&117===Ln.charCodeAt(Pn+2)&&101===Ln.charCodeAt(Pn+3))return Pn+=4,Mn(),{kind:"BooleanValue",value:!0};break;case 102:if(97===Ln.charCodeAt(Pn+1)&&108===Ln.charCodeAt(Pn+2)&&115===Ln.charCodeAt(Pn+3)&&101===Ln.charCodeAt(Pn+4))return Pn+=5,Mn(),{kind:"BooleanValue",value:!1}}return{kind:"EnumValue",value:Hn()}}function Rn(n){if(40===Ln.charCodeAt(Pn)){var e=[];Pn++,Mn();do{var t=En();if(58!==Ln.charCodeAt(Pn++))throw Dn("Argument");Mn(),e.push({kind:"Argument",name:t,value:_n(n)})}while(41!==Ln.charCodeAt(Pn));return Pn++,Mn(),e}}function Bn(n){if(64===Ln.charCodeAt(Pn)){var e=[];do{Pn++,e.push({kind:"Directive",name:En(),arguments:Rn(n)})}while(64===Ln.charCodeAt(Pn));return e}}function Un(){for(var n=0;91===Ln.charCodeAt(Pn);)n++,Pn++,Mn();var e={kind:"NamedType",name:En()};do{if(33===Ln.charCodeAt(Pn)&&(Pn++,Mn(),e={kind:"NonNullType",type:e}),n){if(93!==Ln.charCodeAt(Pn++))throw Dn("NamedType");Mn(),e={kind:"ListType",type:e}}}while(n--);return e}function Vn(){if(123!==Ln.charCodeAt(Pn++))throw Dn("SelectionSet");return Mn(),On()}function On(){var n=[];do{if(46===Ln.charCodeAt(Pn)){if(46!==Ln.charCodeAt(++Pn)||46!==Ln.charCodeAt(++Pn))throw Dn("SelectionSet");switch(Pn++,Mn(),Ln.charCodeAt(Pn)){case 64:n.push({kind:"InlineFragment",typeCondition:void 0,directives:Bn(!1),selectionSet:Vn()});break;case 111:110===Ln.charCodeAt(Pn+1)?(Pn+=2,Mn(),n.push({kind:"InlineFragment",typeCondition:{kind:"NamedType",name:En()},directives:Bn(!1),selectionSet:Vn()})):n.push({kind:"FragmentSpread",name:En(),directives:Bn(!1)});break;case 123:Pn++,Mn(),n.push({kind:"InlineFragment",typeCondition:void 0,directives:void 0,selectionSet:On()});break;default:n.push({kind:"FragmentSpread",name:En(),directives:Bn(!1)})}}else{var e=En(),t=void 0;58===Ln.charCodeAt(Pn)&&(Pn++,Mn(),t=e,e=En());var i=Rn(!1),a=Bn(!1),o=void 0;123===Ln.charCodeAt(Pn)&&(Pn++,Mn(),o=On()),n.push({kind:"Field",alias:t,name:e,arguments:i,directives:a,selectionSet:o})}}while(125!==Ln.charCodeAt(Pn));return Pn++,Mn(),{kind:"SelectionSet",selections:n}}function Zn(){if(Mn(),40===Ln.charCodeAt(Pn)){var n=[];Pn++,Mn();do{var e=void 0;if(34===Ln.charCodeAt(Pn)&&(e=_n(!0)),36!==Ln.charCodeAt(Pn++))throw Dn("Variable");var t=En();if(58!==Ln.charCodeAt(Pn++))throw Dn("VariableDefinition");Mn();var i=Un(),a=void 0;61===Ln.charCodeAt(Pn)&&(Pn++,Mn(),a=_n(!0)),Mn();var o={kind:"VariableDefinition",variable:{kind:"Variable",name:t},type:i,defaultValue:a,directives:Bn(!0)};e&&(o.description=e),n.push(o)}while(41!==Ln.charCodeAt(Pn));return Pn++,Mn(),n}}function zn(n){var e=En();if(111!==Ln.charCodeAt(Pn++)||110!==Ln.charCodeAt(Pn++))throw Dn("FragmentDefinition");Mn();var t={kind:"FragmentDefinition",name:e,typeCondition:{kind:"NamedType",name:En()},directives:Bn(!1),selectionSet:Vn()};return n&&(t.description=n),t}function Kn(){var n=[];do{var e=void 0;if(34===Ln.charCodeAt(Pn)&&(e=_n(!0)),123===Ln.charCodeAt(Pn)){if(e)throw Dn("Document");Pn++,Mn(),n.push({kind:"OperationDefinition",operation:"query",name:void 0,variableDefinitions:void 0,directives:void 0,selectionSet:On()})}else{var t=Hn();switch(t){case"fragment":n.push(zn(e));break;case"query":case"mutation":case"subscription":var i,a=void 0;40!==(i=Ln.charCodeAt(Pn))&&64!==i&&123!==i&&(a=En());var o={kind:"OperationDefinition",operation:t,name:a,variableDefinitions:Zn(),directives:Bn(!1),selectionSet:Vn()};e&&(o.description=e),n.push(o);break;default:throw Dn("Document")}}}while(Pn<Ln.length);return n}function Gn(n,e){return Ln=n.body?n.body:n,Pn=0,Mn(),e&&e.noLocation?{kind:"Document",definitions:Kn()}:{kind:"Document",definitions:Kn(),loc:{start:0,end:Ln.length,startToken:void 0,endToken:void 0,source:{body:Ln,name:"graphql.web",locationOffset:{line:1,column:1}}}}}var Yn=0,Wn=new Set;function Xn(){function n(n,e){var t,i,a=Gn(n).definitions,o=new Set;for(var r of e||[])for(var s of r.definitions)s.kind!==Nn||o.has(s)||(a.push(s),o.add(s));return(t=a[0].kind===Nn)&&a[0].directives&&(a[0].directives=a[0].directives.filter(n=>"_unmask"!==n.name.value)),{kind:kn,definitions:a,get loc(){if(!i&&t){var a=n+function(n){try{Yn++;var e="";for(var t of n)if(!Wn.has(t)){Wn.add(t);var{loc:i}=t;i&&(e+=i.source.body)}return e}finally{0==--Yn&&Wn.clear()}}(e||[]);return{start:0,end:a.length,source:{body:a,name:"GraphQLTada",locationOffset:{line:1,column:1}}}}return i},set loc(n){i=n}}}return n.scalar=function(n,e){return e},n.persisted=function(n,e){return{kind:kn,definitions:e?e.definitions:[],documentId:n}},n}function Jn(...n){return 2===n.length?n[1]:n[0]}var ne=Xn();const ee=ne("\n query entityBranding {\n entityBranding {\n accentColor\n brandColor\n topNavImageUrl\n }\n }\n"),te=e.createContext({});function ie({children:t,darkMode:i=!1,queryClient:o,apiHost:r,token:s,onTokenExpired:l,configProviderProps:u}){const d=(()=>{const{onUserUnavailable:n,onInvalidOrMissingAuthorization:e,suppressUserUnavailableErrorNotification:t,disableErrorNotifications:i}=Cn(),o=Sn({onUserUnavailable:n,onInvalidOrMissingAuthorization:e,suppressUserUnavailableErrorNotification:t,disableErrorNotifications:i}),r=(n,e)=>{var t,i,a,r,s;if(401===(null===(t=null==n?void 0:n.response)||void 0===t?void 0:t.status))return void o(n,void 0);if("DOMException: Aborted"===n)return;const l=null===(a=null===(i=null==e?void 0:e.mutation)||void 0===i?void 0:i.match(/mutation\s+(\w+)/))||void 0===a?void 0:a[1];"production"===process.env.NODE_ENV&&x.captureException(n,{tags:{errorSource:(null==e?void 0:e.mutation)?"mutation":"query",library:"@bunnyapp/components"},extra:{queryKey:null==e?void 0:e.queryKey,errorType:typeof n,hasResponse:!!(null==n?void 0:n.response),statusCode:null===(r=null==n?void 0:n.response)||void 0===r?void 0:r.status,responseErrors:null===(s=null==n?void 0:n.response)||void 0===s?void 0:s.errors,mutationName:l}}),o(n,l)};return()=>new a.QueryClient({defaultOptions:{queries:{gcTime:Number.POSITIVE_INFINITY,refetchIntervalInBackground:!1,staleTime:6e5,retry:!1,refetchOnWindowFocus:!1}},mutationCache:new a.MutationCache({onError:r}),queryCache:new a.QueryCache({onError:r})})})(),c=e.useMemo(()=>d(),[]);return n.jsx(te.Provider,{value:{darkMode:i,apiHost:r,token:s,onTokenExpired:l},children:n.jsx(a.QueryClientProvider,{client:o||c,children:n.jsx(ae,{darkMode:i,configProviderProps:u,children:t})})})}function ae({children:t,darkMode:o,configProviderProps:r}){const{apiHost:l,token:u}=e.useContext(te),{data:d}=a.useQuery({queryKey:V(u),queryFn:()=>(async({token:n,apiHost:e})=>await In(ee,{apiHost:e,token:n},{}))({token:u,apiHost:l}),staleTime:3e5}),c=null==d?void 0:d.entityBranding,p=H(),m=e.useMemo(()=>{const n=(null==c?void 0:c.brandColor)?"#"+(null==c?void 0:c.brandColor):q;let e="#000000";!p&&(n=>{if(!n)return!1;"#"===(null==n?void 0:n[0])&&(n=n.slice(1));const e=parseInt(n,16);return.2126*(e>>24&255)+.7152*(e>>16&255)+.0722*(e>>8&255)*((255&e)/255)<100})((null==c?void 0:c.accentColor)||"")&&(e="#ffffff");const t=(null==c?void 0:c.topNavImageUrl)||"";return{accentColor:(null==c?void 0:c.accentColor)||T,brandColor:n,secondaryColor:e,topNavImageUrl:t}},[c,p]),y={algorithm:o?i.theme.darkAlgorithm:i.theme.defaultAlgorithm,token:{borderRadius:4,colorPrimary:m.brandColor,colorLink:m.brandColor,colorLinkActive:m.brandColor,colorLinkHover:m.brandColor,fontFamily:'"Inter Variable", Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif',colorBorder:k,lineHeight:1,fontSize:14,...o?{}:{colorFillAlter:"rgb(241 245 249)"}},components:{Button:{defaultShadow:"none",boxShadowSecondary:"none",fontWeight:"normal",contentFontSizeLG:14,colorBgContainerDisabled:o?"var(--row-background-dark)":"#eef0f2",borderColorDisabled:o?"var(--row-background-dark)":"#eef0f2"},Drawer:{colorBgElevated:o?"var(--row-background-dark)":C},Divider:{colorSplit:o?j:w},Form:{itemMarginBottom:0,verticalLabelPadding:"4px"}}},g={...y,...r,token:{...y.token,...null==r?void 0:r.token},components:{...y.components,...null==r?void 0:r.components}};return n.jsx(s.RecoilRoot,{children:n.jsx(vn,{value:m,children:n.jsx(i.ConfigProvider,{theme:g,children:n.jsx("div",{className:"bunny-components bunny-contents",children:t})})})})}function oe(){const{token:n}=e.useContext(te),{overrideToken:t}=e.useContext(bn);return null!=t?t:n}function re({documentUuid:t,documentType:i}){const{apiHost:o}=e.useContext(te),[r,s]=e.useState(void 0),l=oe(),{data:u,isLoading:d}=a.useQuery({queryKey:["documentPDF",t],queryFn:()=>(async(n,e,t,i)=>{if(!e)throw new Error("Invoice ID is required to fetch PDF");const a=await fetch(`${n}/api/legacy_documents/${e}?type=${t}`,{headers:gn({token:i})});if(!a.ok)throw new Error("Failed to fetch PDF");return a.blob()})(o,t,i,l),enabled:Boolean(t)});return e.useEffect(()=>{if(u){const n=URL.createObjectURL(u);return s(n),()=>URL.revokeObjectURL(n)}},[u]),d||!r?n.jsx(n.Fragment,{}):n.jsx("iframe",{src:r,style:{border:"none",gridColumn:"1/-1",minHeight:"1000px",minWidth:"780px"},title:"Invoice PDF",width:"100%"})}const se=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"#1F72CD",stroke:"#D9D9D9"}),n.jsx("path",{"fill-rule":"evenodd",clipRule:"evenodd",d:"M12.5493 17L6 31.4935H13.8405L14.8125 29.1826H17.0342L18.0062 31.4935H26.6364V29.7298L27.4054 31.4935H31.8696L32.6386 29.6925V31.4935H50.587L52.7695 29.2426L54.813 31.4935L64.0317 31.5121L57.4617 24.2872L64.0317 17H54.956L52.8315 19.2093L50.8523 17H31.3268L29.6501 20.7409L27.9341 17H20.11V18.7037L19.2396 17H12.5493ZM39.3516 19.0581H49.6584L52.8108 22.4633L56.0648 19.0581H59.2172L54.4275 24.2852L59.2172 29.452H55.9218L52.7695 26.0073L49.4989 29.452H39.3516V19.0581ZM41.8968 23.1099V21.2114V21.2096H48.328L51.1342 24.2458L48.2036 27.2986H41.8968V25.226H47.5197V23.1099H41.8968ZM14.0664 19.0581H17.8883L22.2324 28.8862V19.0581H26.4191L29.7745 26.1048L32.8668 19.0581H37.0326V29.4581H34.4978L34.4771 21.3087L30.7817 29.4581H28.5142L24.7981 21.3087V29.4581H19.5836L18.595 27.1266H13.254L12.2675 29.4561H9.47358L14.0664 19.0581ZM14.166 24.9712L15.9256 20.8177L17.6832 24.9712H14.166Z",fill:"white"})]}),le=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.2243 35.1715C18.2243 34.882 18.156 34.6314 18.0199 34.4199C17.8835 34.2083 17.7043 34.0468 17.4819 33.9355C17.7043 33.8242 17.8766 33.6597 17.9991 33.4426C18.1214 33.2255 18.1825 32.9806 18.1825 32.7078V32.5575C18.1825 32.2233 18.1186 31.9451 17.9908 31.7223C17.8628 31.4996 17.6833 31.3213 17.4526 31.1878C17.2219 31.0541 16.9451 30.9582 16.6227 30.8995C16.3 30.8411 15.9414 30.812 15.5465 30.812C15.4131 30.812 15.274 30.8147 15.1296 30.8203C14.9848 30.8258 14.8445 30.8328 14.7083 30.8411C14.572 30.8494 14.4468 30.8593 14.3329 30.8704C14.2188 30.8817 14.1256 30.8928 14.0534 30.9037C13.8921 30.9318 13.7781 30.9817 13.7114 31.0541C13.6448 31.1266 13.6113 31.2575 13.6113 31.4467V36.5245C13.6113 36.7139 13.646 36.8447 13.7156 36.917C13.7851 36.9895 13.9032 37.0394 14.0702 37.0673C14.1535 37.084 14.2536 37.0979 14.3704 37.1091C14.4871 37.1202 14.6136 37.1299 14.7499 37.1383C14.8862 37.1466 15.0265 37.1535 15.1711 37.1593C15.3158 37.1646 15.4575 37.1676 15.5966 37.1676C15.9581 37.1676 16.2986 37.1397 16.6185 37.084C16.9381 37.0285 17.2161 36.9295 17.4526 36.7874C17.689 36.6456 17.8766 36.4534 18.0157 36.2113C18.1546 35.969 18.2243 35.6642 18.2243 35.2967V35.1715ZM16.8063 32.7746C16.8063 32.8637 16.7924 32.9487 16.7645 33.0293C16.7366 33.11 16.6909 33.1795 16.627 33.2383C16.5629 33.2966 16.4768 33.3439 16.3684 33.38C16.2599 33.4162 16.1222 33.4343 15.9554 33.4343H15.0213V31.9895C15.049 31.9895 15.0921 31.9883 15.1505 31.9853C15.2089 31.9825 15.27 31.9812 15.3339 31.9812H15.6551C16.0833 31.9812 16.3822 32.0354 16.5518 32.144C16.7214 32.2526 16.8063 32.421 16.8063 32.6492V32.7746ZM16.5935 35.8062C16.7576 35.6782 16.8397 35.4971 16.8397 35.2634V35.1714C16.8397 34.971 16.7756 34.797 16.6478 34.6494C16.5198 34.502 16.289 34.4282 15.9554 34.4282H15.0213V35.9898H15.1671C15.231 35.9898 15.2977 35.9916 15.3673 35.9942C15.4368 35.9969 15.5035 35.9985 15.5676 35.9985H15.7051C16.1333 35.9985 16.4295 35.9343 16.5935 35.8062ZM22.7955 33.9438C22.7955 33.6377 22.7496 33.3772 22.6578 33.1629C22.5662 32.9487 22.4368 32.7732 22.27 32.6367C22.1032 32.5004 21.8988 32.4003 21.6568 32.3362C21.415 32.2722 21.1439 32.2401 20.8436 32.2401C20.5654 32.2401 20.2943 32.2597 20.0303 32.2987C19.766 32.3375 19.556 32.3766 19.4005 32.4154C19.2948 32.4435 19.242 32.5046 19.242 32.5991V33.2756C19.242 33.3314 19.2559 33.3705 19.2837 33.3925C19.3115 33.4149 19.3475 33.4261 19.3922 33.4261H19.4337C19.5006 33.4204 19.5839 33.4135 19.684 33.4051C19.7842 33.3968 19.8968 33.3901 20.022 33.3842C20.1471 33.3788 20.2777 33.3746 20.414 33.3717C20.5501 33.3689 20.6851 33.3675 20.8186 33.3675C21.0131 33.3675 21.1661 33.4038 21.2773 33.4761C21.3885 33.5486 21.4441 33.7045 21.4441 33.9438V34.2445H20.9937C20.2763 34.2445 19.7549 34.3572 19.4296 34.5827C19.1043 34.8081 18.9416 35.1659 18.9416 35.6558V35.7313C18.9416 36.0039 18.982 36.2321 19.0625 36.4158C19.1431 36.5996 19.2503 36.7472 19.3837 36.8587C19.5172 36.9699 19.6686 37.0493 19.8384 37.0964C20.008 37.1438 20.1846 37.1676 20.3681 37.1676C20.6184 37.1676 20.8339 37.1341 21.0145 37.0673C21.1952 37.0005 21.3662 36.9086 21.5276 36.7917V36.9253C21.5276 36.9699 21.5442 37.0089 21.5776 37.0422C21.6111 37.0756 21.6499 37.0923 21.6944 37.0923H22.6287C22.6731 37.0923 22.712 37.0756 22.7455 37.0422C22.7789 37.0089 22.7955 36.9699 22.7955 36.9253V33.9438ZM21.1481 36.0942C21.2619 36.0581 21.3691 36.015 21.4692 35.9648V35.0462H20.9937C20.8491 35.0462 20.7296 35.0587 20.635 35.0837C20.5404 35.1088 20.4653 35.1465 20.4098 35.1966C20.3542 35.2465 20.3152 35.3107 20.2931 35.3886C20.2707 35.4666 20.2596 35.5556 20.2596 35.6558V35.7312C20.2596 35.9092 20.3026 36.0233 20.3889 36.0734C20.4751 36.1235 20.6071 36.1485 20.7852 36.1485C20.913 36.1485 21.0339 36.1306 21.1481 36.0942ZM27.9007 36.917V34.1358C27.9007 33.8744 27.8799 33.6278 27.8381 33.3968C27.7964 33.166 27.7214 32.9653 27.6129 32.7954C27.5045 32.6256 27.3543 32.4905 27.1624 32.3904C26.9707 32.2902 26.7245 32.2401 26.4242 32.2401C26.1572 32.2401 25.9208 32.2723 25.7152 32.3369C25.5094 32.4014 25.2925 32.515 25.0646 32.6776V32.4752C25.0646 32.4305 25.0478 32.3911 25.0145 32.3575C24.9811 32.3238 24.9421 32.3068 24.8976 32.3068H23.9634C23.9187 32.3068 23.8799 32.3235 23.8467 32.357C23.8133 32.3904 23.7966 32.4295 23.7966 32.4739V36.917C23.7966 36.9615 23.8145 37.0019 23.8508 37.038C23.8869 37.0743 23.9272 37.0923 23.9717 37.0923H24.9811C25.0256 37.0923 25.0646 37.0743 25.0978 37.0382C25.1313 37.0021 25.1479 36.9619 25.1479 36.9173V33.6341C25.2925 33.5564 25.4287 33.4925 25.5567 33.4426C25.6845 33.3925 25.8096 33.3675 25.932 33.3675C26.0599 33.3675 26.1642 33.38 26.2449 33.4051C26.3254 33.4301 26.388 33.4731 26.4325 33.5345C26.477 33.5954 26.5076 33.6759 26.5243 33.7757C26.5409 33.8758 26.5494 33.9981 26.5494 34.1425V36.9173C26.5494 36.9619 26.566 37.0021 26.5994 37.0382C26.6327 37.0743 26.6715 37.0923 26.7162 37.0923H27.7255C27.7699 37.0923 27.8102 37.0743 27.8464 37.038C27.8826 37.0019 27.9007 36.9615 27.9007 36.917ZM32.0047 36.1071V36.8502C32.0047 36.9114 31.9907 36.9546 31.963 36.9796C31.9351 37.0047 31.8906 37.0255 31.8294 37.0422C31.7127 37.0701 31.5611 37.0978 31.3749 37.1259C31.1885 37.1535 30.9703 37.1676 30.72 37.1676C30.1305 37.1676 29.6592 36.9867 29.3062 36.6246C28.953 36.2628 28.7765 35.7394 28.7765 35.0546V34.3531C28.7765 33.6682 28.953 33.1448 29.3062 32.7831C29.6592 32.421 30.1305 32.2401 30.72 32.2401C30.9703 32.2401 31.1885 32.254 31.3749 32.2817C31.5611 32.3098 31.7127 32.3375 31.8294 32.3653C31.8906 32.3819 31.9351 32.4029 31.963 32.4279C31.9907 32.453 32.0047 32.4962 32.0047 32.5574V33.3007C32.0047 33.3453 31.9893 33.38 31.9588 33.4051C31.9281 33.4301 31.8906 33.4426 31.8462 33.4426H31.8294C31.6737 33.4261 31.5251 33.4121 31.3832 33.401C31.2413 33.3901 31.0508 33.3842 30.8118 33.3842C30.7172 33.3842 30.6283 33.3996 30.5448 33.4301C30.4613 33.4608 30.3891 33.5137 30.328 33.5888C30.2666 33.6641 30.2181 33.7641 30.1819 33.8895C30.1457 34.0147 30.1277 34.1692 30.1277 34.3531V35.0546C30.1277 35.2382 30.1457 35.3927 30.1819 35.5181C30.2181 35.6433 30.2666 35.7436 30.328 35.8187C30.3891 35.8939 30.4613 35.9468 30.5448 35.9774C30.6283 36.008 30.7172 36.0233 30.8118 36.0233C31.0508 36.0233 31.2413 36.0178 31.3832 36.0067C31.5251 35.9956 31.6737 35.9815 31.8294 35.9649H31.8462C31.8906 35.9649 31.9281 35.9774 31.9588 36.0025C31.9893 36.0276 32.0047 36.0623 32.0047 36.1071ZM36.6346 34.4115C36.6346 34.0773 36.5885 33.7768 36.4966 33.5095C36.4046 33.2423 36.2709 33.0155 36.0954 32.8289C35.9199 32.6424 35.7025 32.4976 35.4436 32.3946C35.1844 32.2918 34.8848 32.2401 34.5449 32.2401C34.2051 32.2401 33.9056 32.2918 33.6465 32.3946C33.3873 32.4976 33.1685 32.6424 32.9903 32.8289C32.8119 33.0155 32.6768 33.2423 32.585 33.5095C32.4928 33.7768 32.4469 34.0773 32.4469 34.4115V34.9961C32.4469 35.3301 32.4928 35.6309 32.585 35.8981C32.6768 36.1653 32.8119 36.3922 32.9903 36.5788C33.1685 36.7654 33.3873 36.91 33.6465 37.013C33.9056 37.1159 34.2051 37.1676 34.5449 37.1676C34.8848 37.1676 35.1844 37.1159 35.4436 37.013C35.7025 36.91 35.9199 36.7654 36.0954 36.5788C36.2709 36.3922 36.4046 36.1653 36.4966 35.8981C36.5885 35.6309 36.6346 35.3301 36.6346 34.9961V34.4115ZM34.5449 36.0233C35.037 36.0233 35.2832 35.6809 35.2832 34.9961V34.4115C35.2832 33.7322 35.037 33.3925 34.5449 33.3925C34.3016 33.3925 34.1164 33.4774 33.9893 33.6472C33.8619 33.8172 33.7984 34.0719 33.7984 34.4115V34.9961C33.7984 35.3357 33.8619 35.5918 33.9893 35.7644C34.1164 35.9371 34.3016 36.0233 34.5449 36.0233ZM41.5976 36.917V34.1358C41.5976 33.8744 41.5765 33.6278 41.5351 33.3968C41.4933 33.166 41.4181 32.9653 41.3095 32.7954C41.2011 32.6256 41.0511 32.4905 40.8593 32.3904C40.6674 32.2902 40.4213 32.2401 40.1211 32.2401C39.8542 32.2401 39.6177 32.2723 39.4119 32.3369C39.2062 32.4014 38.9893 32.515 38.7613 32.6776V32.4752C38.7613 32.4305 38.7447 32.3911 38.7111 32.3575C38.678 32.3238 38.6389 32.3068 38.5945 32.3068H37.6602C37.6157 32.3068 37.5769 32.3235 37.5434 32.357C37.5102 32.3904 37.4934 32.4295 37.4934 32.4739V36.917C37.4934 36.9615 37.5114 37.0019 37.5476 37.038C37.5838 37.0743 37.624 37.0923 37.6687 37.0923H38.678C38.7224 37.0923 38.7613 37.0743 38.7948 37.0382C38.828 37.0021 38.8448 36.9619 38.8448 36.9173V33.6341C38.9893 33.5564 39.1256 33.4925 39.2534 33.4426C39.3815 33.3925 39.5065 33.3675 39.629 33.3675C39.7568 33.3675 39.8611 33.38 39.9416 33.4051C40.0222 33.4301 40.0849 33.4731 40.1294 33.5345C40.1739 33.5954 40.2044 33.6759 40.2212 33.7757C40.2378 33.8758 40.2462 33.9981 40.2462 34.1425V36.9173C40.2462 36.9619 40.2628 37.0021 40.2962 37.0382C40.3296 37.0743 40.3684 37.0923 40.413 37.0923H41.4223C41.4668 37.0923 41.5072 37.0743 41.5434 37.038C41.5794 37.0019 41.5976 36.9615 41.5976 36.917ZM45.2348 36.2893V36.9357C45.2348 37.0295 45.182 37.0848 45.0763 37.1011C44.9483 37.1233 44.8371 37.1398 44.7427 37.1509C44.6481 37.162 44.5395 37.1675 44.4174 37.1675C44.1905 37.1675 43.9901 37.1493 43.816 37.1133C43.6419 37.077 43.4966 37.0061 43.3805 36.9003C43.2646 36.7945 43.1761 36.6483 43.1153 36.4617C43.0547 36.2753 43.0242 36.0347 43.0242 35.7394V33.3175L42.357 33.2088C42.3123 33.1977 42.2721 33.1769 42.2359 33.1462C42.1997 33.1157 42.1817 33.0781 42.1817 33.0335V32.4822C42.1817 32.4378 42.1997 32.3974 42.2359 32.3611C42.2721 32.325 42.3123 32.3068 42.357 32.3068H43.0242V31.622C43.0242 31.5774 43.0409 31.5414 43.0739 31.5134C43.1068 31.4857 43.1458 31.4663 43.1902 31.455L44.2016 31.2798H44.2263C44.2705 31.2798 44.3065 31.2921 44.3343 31.3171C44.3618 31.3423 44.3757 31.3771 44.3757 31.4215V32.3068H45.0597C45.104 32.3068 45.143 32.3237 45.1764 32.3573C45.2099 32.3909 45.2265 32.4305 45.2265 32.4752V33.1573C45.2265 33.2024 45.2099 33.2416 45.1764 33.2752C45.143 33.3089 45.104 33.3257 45.0597 33.3257H44.3757V35.7561C44.3757 35.9231 44.3895 36.0304 44.4174 36.0776C44.4451 36.1249 44.5229 36.1485 44.6507 36.1485H45.0597C45.1764 36.1485 45.2348 36.1955 45.2348 36.2893ZM49.6891 33.9438C49.6891 33.6377 49.6433 33.3772 49.5514 33.1629C49.4597 32.9487 49.3305 32.7732 49.1637 32.6367C48.9969 32.5004 48.7925 32.4003 48.5505 32.3362C48.3087 32.2722 48.0376 32.2401 47.7373 32.2401C47.4589 32.2401 47.188 32.2597 46.924 32.2987C46.6597 32.3375 46.4497 32.3766 46.2942 32.4154C46.1882 32.4435 46.1357 32.5046 46.1357 32.5991V33.2756C46.1357 33.3314 46.1494 33.3705 46.1773 33.3925C46.2052 33.4149 46.2412 33.4261 46.2857 33.4261H46.3274C46.3943 33.4204 46.4776 33.4135 46.5777 33.4051C46.6779 33.3968 46.7905 33.3901 46.9155 33.3842C47.0408 33.3788 47.1714 33.3746 47.3077 33.3717C47.4438 33.3689 47.5788 33.3675 47.7121 33.3675C47.9068 33.3675 48.0598 33.4038 48.171 33.4761C48.2822 33.5486 48.3378 33.7045 48.3378 33.9438V34.2445H47.8874C47.1698 34.2445 46.6486 34.3572 46.3233 34.5827C45.998 34.8081 45.8353 35.1659 45.8353 35.6558V35.7313C45.8353 36.0039 45.8755 36.2321 45.9562 36.4158C46.0366 36.5996 46.144 36.7472 46.2774 36.8587C46.4109 36.9699 46.5623 37.0493 46.7321 37.0964C46.9017 37.1438 47.0782 37.1676 47.2618 37.1676C47.5121 37.1676 47.7274 37.1341 47.9082 37.0673C48.0889 37.0005 48.2597 36.9086 48.4213 36.7917V36.9253C48.4213 36.9699 48.4379 37.0089 48.4713 37.0422C48.5046 37.0756 48.5436 37.0923 48.5881 37.0923H49.5224C49.5668 37.0923 49.6057 37.0756 49.6392 37.0422C49.6724 37.0089 49.6891 36.9699 49.6891 36.9253V33.9438ZM48.0418 36.0942C48.1556 36.0581 48.2628 36.015 48.3629 35.9648V35.0462H47.8874C47.7428 35.0462 47.6233 35.0587 47.5287 35.0837C47.4341 35.1088 47.359 35.1465 47.3035 35.1966C47.2477 35.2465 47.2088 35.3107 47.1868 35.3886C47.1644 35.4666 47.1533 35.5556 47.1533 35.6558V35.7312C47.1533 35.9092 47.1963 36.0233 47.2826 36.0734C47.3688 36.1235 47.5008 36.1485 47.6789 36.1485C47.8067 36.1485 47.9274 36.1306 48.0418 36.0942ZM53.7933 36.8502V36.1071C53.7933 36.0623 53.7779 36.0276 53.7474 36.0025C53.7167 35.9774 53.6793 35.9649 53.6348 35.9649H53.6181C53.4624 35.9815 53.3136 35.9956 53.1718 36.0067C53.0301 36.0178 52.8395 36.0233 52.6005 36.0233C52.5057 36.0233 52.4167 36.008 52.3336 35.9774C52.2501 35.9468 52.1777 35.8939 52.1165 35.8187C52.0554 35.7436 52.0067 35.6433 51.9707 35.5181C51.9343 35.3927 51.9165 35.2382 51.9165 35.0546V34.3531C51.9165 34.1692 51.9343 34.0147 51.9707 33.8895C52.0067 33.7641 52.0554 33.6641 52.1165 33.5888C52.1777 33.5137 52.2501 33.4608 52.3336 33.4301C52.4167 33.3996 52.5057 33.3842 52.6005 33.3842C52.8395 33.3842 53.0301 33.3901 53.1718 33.401C53.3136 33.4121 53.4624 33.4261 53.6181 33.4426H53.6348C53.6793 33.4426 53.7167 33.4301 53.7474 33.4051C53.7779 33.38 53.7933 33.3453 53.7933 33.3007V32.5574C53.7933 32.4962 53.7794 32.453 53.7515 32.4279C53.7235 32.4029 53.6793 32.3819 53.6181 32.3653C53.5014 32.3375 53.3497 32.3098 53.1635 32.2817C52.9771 32.254 52.759 32.2401 52.5087 32.2401C51.9189 32.2401 51.4479 32.421 51.0947 32.7831C50.7415 33.1448 50.565 33.6682 50.565 34.3531V35.0546C50.565 35.7394 50.7415 36.2628 51.0947 36.6246C51.4479 36.9867 51.9189 37.1676 52.5087 37.1676C52.759 37.1676 52.9771 37.1535 53.1635 37.1259C53.3497 37.0978 53.5014 37.0701 53.6181 37.0422C53.6793 37.0255 53.7235 37.0047 53.7515 36.9796C53.7794 36.9546 53.7933 36.9114 53.7933 36.8502ZM57.3884 36.2893V36.9357C57.3884 37.0295 57.3354 37.0848 57.2299 37.1011C57.1019 37.1233 56.9907 37.1398 56.8963 37.1509C56.8016 37.162 56.6931 37.1675 56.571 37.1675C56.3441 37.1675 56.1437 37.1493 55.9696 37.1133C55.7954 37.077 55.6502 37.0061 55.5343 36.9003C55.4183 36.7945 55.3298 36.6483 55.269 36.4617C55.2083 36.2753 55.1778 36.0347 55.1778 35.7394V33.3175L54.5106 33.2088C54.4659 33.1977 54.4257 33.1769 54.3895 33.1462C54.3533 33.1157 54.3353 33.0781 54.3353 33.0335V32.4822C54.3353 32.4378 54.3533 32.3974 54.3895 32.3611C54.4257 32.325 54.4659 32.3068 54.5106 32.3068H55.1778V31.622C55.1778 31.5774 55.1945 31.5414 55.2276 31.5134C55.2605 31.4857 55.2993 31.4663 55.3436 31.455L56.355 31.2798H56.38C56.4241 31.2798 56.4602 31.2921 56.4875 31.3171C56.5154 31.3423 56.5293 31.3771 56.5293 31.4215V32.3068H57.2133C57.2577 32.3068 57.2966 32.3237 57.3301 32.3573C57.3633 32.3909 57.3801 32.4305 57.3801 32.4752V33.1573C57.3801 33.2024 57.3633 33.2416 57.3301 33.2752C57.2966 33.3089 57.2577 33.3257 57.2133 33.3257H56.5293V35.7561C56.5293 35.9231 56.5431 36.0304 56.571 36.0776C56.5987 36.1249 56.6765 36.1485 56.8045 36.1485H57.2133C57.3301 36.1485 57.3884 36.1955 57.3884 36.2893Z",fill:"#005697"}),n.jsx("path",{d:"M52.6187 14.7398H39.0664L37.6881 16.2935L33.2155 21.3349V21.3351L31.8372 22.8886H18.464L19.821 21.3153L20.4633 20.5706L21.8202 18.9973H15.6582C14.5325 18.9973 13.6113 19.943 13.6113 21.0987V25.5326C13.6113 26.6885 14.5325 27.6342 15.6582 27.6342H39.2492C40.3749 27.6342 41.9127 26.9318 42.6665 26.0733L46.235 22.0097L52.6187 14.7398Z",fill:"#005697"}),n.jsx("path",{d:"M55.3418 10C56.4676 10 57.3887 10.9457 57.3887 12.1015V16.5353C57.3887 17.691 56.4676 18.6368 55.3418 18.6368H49.1999L50.5697 17.0753H50.5699L51.2491 16.3012L52.6189 14.7398H39.0667L31.8375 22.8945H18.3813L28.0314 11.9701L28.3966 11.5566C29.153 10.7005 30.6929 10 31.8186 10H55.3418V10Z",fill:"#FBD500"})]}),ue=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsxs("g",{"clip-path":"url(#clip0_550_235)",children:[n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M26.4382 8C22.3647 8 19.0625 11.3022 19.0625 15.3758V32.6242C19.0625 36.6978 22.3647 40 26.4382 40H43.5153C47.5889 40 50.8911 36.6978 50.8911 32.6242V15.3758C50.8911 11.3022 47.5889 8 43.5153 8H26.4382Z",fill:"#00D632"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40.1482 19.902C38.9333 18.8737 37.3938 18.3084 35.8022 18.3059C34.4908 18.3059 33.1795 18.7405 33.1795 19.9469C33.1795 21.0467 34.347 21.4771 35.7853 22.0072C35.9248 22.0586 36.0668 22.111 36.2105 22.1649C39.0542 23.1241 41.3959 24.3005 41.3959 27.088C41.3959 30.1153 39.0467 32.1835 35.2026 32.4195L34.8542 34.0418C34.7887 34.3448 34.5199 34.5605 34.2098 34.5589H31.7932C31.5955 34.554 31.4102 34.4618 31.2872 34.307C31.1642 34.1521 31.1163 33.9507 31.1563 33.7571L31.531 32.0448C30.08 31.6748 28.7461 30.9441 27.6532 29.9205C27.5265 29.7983 27.4551 29.63 27.4551 29.454C27.4551 29.2781 27.5265 29.1097 27.6532 28.9876L28.9945 27.6763C29.2482 27.4268 29.655 27.4268 29.9086 27.6763C31.1374 28.8485 32.7778 29.4904 34.4758 29.4634C36.2255 29.4634 37.4132 28.7215 37.4132 27.5451C37.4132 26.4815 36.4394 26.1253 34.5914 25.4494C34.3953 25.3776 34.1894 25.3024 33.9738 25.2222C31.5984 24.3755 29.3504 23.1653 29.3504 20.3516C29.3504 17.0958 32.0705 15.5072 35.2776 15.3498L35.6148 13.6975C35.6816 13.3974 35.948 13.1839 36.2555 13.1842H38.6646C38.8609 13.1836 39.0469 13.2714 39.1712 13.4233C39.2955 13.5752 39.3447 13.775 39.3052 13.9673L38.9306 15.8144C40.157 16.2153 41.2935 16.8516 42.2764 17.6877C42.4118 17.8042 42.4925 17.972 42.4989 18.1505C42.5053 18.3291 42.4368 18.5022 42.31 18.6281L41.0587 19.8833C40.8081 20.1298 40.4087 20.138 40.1482 19.902Z",fill:"white"})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_550_235",children:n.jsx("rect",{width:"32",height:"32",fill:"white",transform:"translate(19 8)"})})})]}),de=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M18.2466 6.855H27.4811C28.7703 6.855 29.5728 7.90603 29.272 9.20036L24.972 27.6585C24.6682 28.949 23.3782 30 22.0886 30H12.8537C11.5641 30 10.7624 28.949 11.0632 27.6585L15.3654 9.20036C15.6653 7.90603 16.9545 6.855 18.2466 6.855Z",fill:"#ED171F"}),n.jsx("path",{d:"M26.7132 6.855H37.3336C38.6223 6.855 38.0411 7.90603 37.7381 9.20036L33.4385 27.6585C33.1382 28.949 33.2324 30 31.9402 30H21.3206C20.0298 30 19.2303 28.949 19.5336 27.6585L23.8315 9.20036C24.1353 7.90603 25.424 6.855 26.7132 6.855Z",fill:"#082F67"}),n.jsx("path",{d:"M36.9136 6.855H46.1468C47.4368 6.855 48.2384 7.90603 47.9364 9.20036L43.6372 27.6585C43.3351 28.949 42.0455 30 40.7516 30H31.521C30.2288 30 29.4285 28.949 29.7314 27.6585L34.0293 9.20036C34.3318 7.90603 35.621 6.855 36.9136 6.855Z",fill:"#006A65"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M38.4247 20.4849L37.2994 24.2089H37.6019L37.3681 24.979H37.0656L36.9951 25.218H35.9242L35.9968 24.979H33.82L34.0387 24.2664H34.2587L35.4005 20.4849L35.6286 19.7209H36.7212L36.6071 20.1072C36.6071 20.1072 36.8979 19.8972 37.1741 19.8254C37.4502 19.7528 39.0337 19.7265 39.0337 19.7265L38.799 20.4849H38.4247ZM36.4995 20.4849L36.2103 21.4365C36.2103 21.4365 36.5336 21.2909 36.7112 21.2421C36.8901 21.1958 37.1589 21.1777 37.1589 21.1777L37.3681 20.4849H36.4995ZM36.0669 21.9098L35.7678 22.8994C35.7678 22.8994 36.0984 22.73 36.276 22.6773C36.4549 22.6358 36.7255 22.6021 36.7255 22.6021L36.9377 21.9098H36.0669ZM35.3702 24.2197H36.241L36.4925 23.383H35.6217L35.3702 24.2197Z",fill:"white"}),n.jsx("path",{d:"M38.9076 19.7265H40.0736L40.0866 20.1613C40.0797 20.2343 40.1427 20.2689 40.2776 20.2689H40.5144L40.2979 20.9863H39.6687C39.1224 21.0265 38.9163 20.7918 38.9284 20.5286L38.9076 19.7265Z",fill:"white"}),n.jsx("path",{d:"M39.0602 23.1305H37.9487L38.1397 22.4909H39.4099L39.5918 21.9079H38.3368L38.5525 21.1875H42.0439L41.8252 21.9079H40.6545L40.4713 22.4909H41.6446L41.4514 23.1305H40.1808L39.9561 23.3998H40.4713L40.5962 24.2049C40.6096 24.284 40.6121 24.3363 40.6372 24.3708C40.6631 24.4006 40.8174 24.4145 40.9069 24.4145H41.0633L40.8256 25.198H40.4293C40.368 25.198 40.2772 25.1928 40.1532 25.1863C40.033 25.1759 39.9479 25.1064 39.8684 25.0683C39.7958 25.032 39.6869 24.9439 39.6618 24.7939L39.5374 23.9905L38.9608 24.7831C38.7772 25.032 38.5291 25.2226 38.1108 25.2226H37.3009L37.5131 24.5238H37.8221C37.9116 24.5238 37.9906 24.4888 38.0485 24.4586C38.1082 24.4335 38.1605 24.4037 38.2201 24.3155L39.0602 23.1305Z",fill:"white"}),n.jsx("path",{d:"M26.8864 21.3815H29.8294L29.612 22.0842H28.4348L28.252 22.6818H29.456L29.2365 23.4075H28.0333L27.7416 24.3811C27.7057 24.4892 28.026 24.5043 28.1418 24.5043L28.7451 24.4209L28.5035 25.223H27.1457C27.0389 25.223 26.9555 25.2079 26.8371 25.1811C26.7226 25.1525 26.672 25.1015 26.6214 25.0237C26.5722 24.9438 26.497 24.879 26.548 24.7096L26.9374 23.42H26.2692L26.4909 22.6818H27.1629L27.3414 22.0842H26.672L26.8864 21.3815Z",fill:"white"}),n.jsx("path",{d:"M28.8682 20.1195H30.0752L29.8544 20.8541H28.2052L28.0259 21.0084C27.9498 21.0832 27.923 21.0516 27.8232 21.1057C27.7303 21.1532 27.5337 21.2461 27.28 21.2461H26.7506L26.9658 20.5395H27.1244C27.2588 20.5395 27.35 20.5283 27.3962 20.4985C27.449 20.4656 27.5073 20.3909 27.5751 20.269L27.8777 19.718H29.0786L28.8682 20.1195Z",fill:"white"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.5938 19.7264H31.6223L31.4728 20.2437C31.4728 20.2437 31.7969 19.9848 32.0247 19.8923C32.2511 19.8072 32.7641 19.7311 32.7641 19.7311L34.428 19.7225L33.861 21.6106C33.7659 21.9347 33.6548 22.1439 33.5852 22.239C33.5217 22.3366 33.4482 22.4183 33.3026 22.4974C33.1626 22.5722 33.0351 22.6154 32.9175 22.6275C32.8073 22.6357 32.6388 22.64 32.4046 22.6422H30.8025L30.3501 24.1366C30.3073 24.284 30.2865 24.354 30.3146 24.3937C30.3384 24.43 30.3928 24.4702 30.468 24.4702L31.1746 24.4037L30.9339 25.2226H30.1413C29.8898 25.2226 29.7066 25.2174 29.5778 25.2075C29.4559 25.198 29.3284 25.2075 29.2441 25.1414C29.1694 25.0766 29.0574 24.9918 29.06 24.9041C29.0683 24.8229 29.1011 24.688 29.1534 24.5039L30.5938 19.7264ZM32.7775 21.6344H31.0912L30.9884 21.9749H32.4473C32.6198 21.9533 32.6552 21.9779 32.669 21.9697L32.7775 21.6344ZM31.185 21.3271C31.185 21.3271 31.5139 21.0263 32.0778 20.9286C32.2062 20.9036 33.0083 20.9118 33.0083 20.9118L33.1297 20.5081H31.4305L31.185 21.3271Z",fill:"white"}),n.jsx("path",{d:"M33.5921 22.7747L33.4979 23.2285C33.4559 23.3693 33.4209 23.4778 33.3138 23.5686C33.2027 23.6632 33.0696 23.763 32.7606 23.763L32.191 23.7859L32.1862 24.2998C32.1785 24.4459 32.2178 24.4303 32.2411 24.4541C32.2675 24.4787 32.2904 24.4904 32.3168 24.4986L32.4961 24.4904L33.0415 24.4584L32.8168 25.2078H32.191C31.7524 25.2078 31.4274 25.1983 31.3202 25.1127C31.2156 25.0466 31.2018 24.9619 31.2048 24.8188L31.2441 22.8201H32.242L32.2295 23.2285H32.4702C32.5523 23.2285 32.6063 23.2198 32.6417 23.1986C32.6707 23.1749 32.6936 23.1437 32.7096 23.0932L32.8068 22.7747H33.5921Z",fill:"white"}),n.jsx("path",{d:"M19.3395 12.7519C19.3032 12.9127 18.6632 15.8704 18.6606 15.8722C18.5219 16.4698 18.4238 16.8985 18.0824 17.1721C17.8887 17.3311 17.6623 17.4094 17.4008 17.4094C16.9808 17.4094 16.734 17.2006 16.6921 16.8035L16.6843 16.6678C16.6843 16.6678 16.8122 15.8652 16.814 15.8622C16.814 15.8622 17.486 13.1664 17.6065 12.8116C17.6117 12.7917 17.6143 12.7817 17.6169 12.7714C16.3075 12.783 16.0745 12.7714 16.0594 12.7519C16.052 12.7783 16.017 12.946 16.017 12.946L15.3299 15.9815L15.2703 16.2408L15.1579 17.0826C15.1579 17.3311 15.2072 17.536 15.3044 17.7084C15.6177 18.2564 16.511 18.3377 17.0149 18.3377C17.6662 18.3377 18.2751 18.1985 18.6874 17.9478C19.4026 17.5243 19.591 16.8614 19.7583 16.2754L19.8352 15.975C19.8352 15.975 20.5288 13.1759 20.6473 12.8116C20.6507 12.7917 20.6529 12.7817 20.6576 12.7714C19.709 12.7817 19.4298 12.7714 19.3395 12.7519Z",fill:"white"}),n.jsx("path",{d:"M23.1723 18.3077C22.7073 18.3012 22.5444 18.3012 22.0011 18.3289L21.98 18.2887C22.0279 18.0821 22.0794 17.8785 22.1252 17.6689L22.1917 17.3867C22.2924 16.9464 22.3909 16.4347 22.4026 16.2804C22.4121 16.1862 22.4432 15.952 22.1757 15.952C22.0625 15.952 21.9449 16.0073 21.8265 16.0613C21.7608 16.2955 21.6282 16.9515 21.5672 17.2519C21.432 17.8829 21.4233 17.9542 21.3633 18.2666L21.3244 18.3077C20.8451 18.3012 20.6796 18.3012 20.1286 18.3289L20.1026 18.283C20.1951 17.9079 20.2867 17.5298 20.3749 17.1555C20.6057 16.1395 20.6601 15.7501 20.7245 15.2337L20.7677 15.203C21.3049 15.1278 21.435 15.1131 22.0163 14.9934L22.0655 15.0483L21.9778 15.372C22.0759 15.3141 22.1688 15.2549 22.2704 15.203C22.5444 15.0682 22.8495 15.0284 23.0176 15.0284C23.2713 15.0284 23.5496 15.0997 23.6663 15.394C23.7769 15.6564 23.7039 15.9805 23.5586 16.6175L23.4835 16.9412C23.3344 17.6504 23.3102 17.78 23.2267 18.2666L23.1723 18.3077Z",fill:"white"}),n.jsx("path",{d:"M25.0585 18.3077C24.7793 18.3064 24.5995 18.3012 24.4232 18.3064C24.2486 18.3077 24.0779 18.3168 23.8182 18.3289L23.8026 18.3064L23.7853 18.283C23.8562 18.0142 23.8964 17.92 23.9309 17.8245C23.9664 17.7299 24.001 17.6339 24.0623 17.3612C24.1436 17.006 24.1937 16.7571 24.2296 16.5397C24.2667 16.3284 24.2879 16.1495 24.3143 15.9416L24.3359 15.9252L24.3592 15.9053C24.6371 15.866 24.8147 15.84 24.9945 15.8124C25.1769 15.786 25.3605 15.7501 25.6488 15.6957L25.66 15.7207L25.6678 15.7462C25.6142 15.9662 25.5598 16.1862 25.5075 16.41C25.4561 16.6326 25.4016 16.8513 25.3532 17.073C25.2478 17.541 25.2067 17.7148 25.1816 17.8396C25.1587 17.9589 25.1509 18.0237 25.1095 18.2666L25.0844 18.2887L25.0585 18.3077Z",fill:"white"}),n.jsx("path",{d:"M29.2305 16.7091C29.3935 15.9948 29.2686 15.6607 29.1091 15.4563C28.8658 15.1477 28.4397 15.0479 27.9958 15.0479C27.7301 15.0479 27.0952 15.0751 26.5987 15.5332C26.2443 15.8621 26.0779 16.3107 25.9781 16.7389C25.8782 17.175 25.7628 17.9641 26.4867 18.2567C26.7114 18.3509 27.0313 18.3777 27.2396 18.3777C27.7698 18.3777 28.3135 18.2312 28.7206 17.7982C29.0382 17.446 29.1813 16.923 29.2305 16.7091ZM28.0166 16.6573C27.9911 16.777 27.8865 17.2256 27.7426 17.4161C27.6432 17.5562 27.5252 17.6404 27.3947 17.6404C27.358 17.6404 27.1285 17.6404 27.1242 17.2999C27.1216 17.1322 27.1566 16.9576 27.1985 16.7718C27.3208 16.2307 27.4651 15.7769 27.8329 15.7769C28.1225 15.7769 28.1415 16.1145 28.0166 16.6573Z",fill:"white"}),n.jsx("path",{d:"M40.5855 18.3561C40.0254 18.3509 39.8642 18.3509 39.3465 18.373L39.3115 18.331C39.4532 17.7982 39.595 17.267 39.7199 16.7286C39.8819 16.0298 39.9191 15.7329 39.9736 15.324L40.0155 15.2895C40.5713 15.2095 40.726 15.1875 41.3059 15.0803L41.3241 15.1278C41.2178 15.566 41.1115 16.0047 41.0103 16.4446C40.7964 17.3664 40.7186 17.8349 40.6365 18.3163L40.5855 18.3561Z",fill:"white"}),n.jsx("path",{d:"M40.8523 16.7721C41.0152 16.0612 40.3601 16.7094 40.2551 16.4748C40.0943 16.1092 40.195 15.3671 39.5493 15.1195C39.3017 15.0231 38.7183 15.148 38.2204 15.6031C37.8682 15.9307 37.7005 16.3736 37.6016 16.8015C37.5013 17.2315 37.3864 18.0189 38.1063 18.3015C38.3337 18.3979 38.5424 18.4256 38.7498 18.4173C39.4741 18.378 40.0265 17.2855 40.434 16.852C40.749 16.5098 40.8043 16.9808 40.8523 16.7721ZM39.7442 16.7189C39.717 16.833 39.612 17.2868 39.4681 17.4744C39.373 17.6088 39.1466 17.6939 39.0169 17.6939C38.9802 17.6939 38.7524 17.6939 38.7442 17.3564C38.7425 17.1904 38.7775 17.0158 38.8207 16.8283C38.943 16.2989 39.0874 15.8468 39.4551 15.8468C39.7451 15.8468 39.8687 16.1761 39.7442 16.7189Z",fill:"white"}),n.jsx("path",{d:"M32.4031 18.3077C31.9372 18.3012 31.7795 18.3012 31.2319 18.3289L31.2125 18.2887C31.2587 18.0821 31.3114 17.8785 31.3598 17.6689L31.4251 17.3867C31.5262 16.9464 31.6243 16.4347 31.6355 16.2804C31.6446 16.1862 31.6757 15.952 31.4104 15.952C31.2954 15.952 31.1792 16.0073 31.0599 16.0613C30.9951 16.2955 30.862 16.9515 30.798 17.2519C30.6653 17.8829 30.6563 17.9542 30.5962 18.2666L30.5564 18.3077C30.0776 18.3012 29.9134 18.3012 29.3637 18.3289L29.3386 18.283C29.4302 17.9079 29.5201 17.5298 29.6083 17.1555C29.8386 16.1395 29.8935 15.7501 29.9575 15.2337L30.0007 15.203C30.5378 15.1278 30.6684 15.1131 31.2496 14.9934L31.2954 15.0483L31.2112 15.372C31.3067 15.3141 31.4039 15.2549 31.5029 15.203C31.7751 15.0682 32.0828 15.0284 32.2475 15.0284C32.502 15.0284 32.7808 15.0997 32.9005 15.394C33.0098 15.6564 32.9359 15.9805 32.7894 16.6175L32.7164 16.9412C32.5643 17.6504 32.5409 17.78 32.4605 18.2666L32.4031 18.3077Z",fill:"white"}),n.jsx("path",{d:"M36.9307 14.4822C36.8486 14.8504 36.6096 15.1629 36.3006 15.3137C36.0452 15.4421 35.7344 15.4516 35.4129 15.4516H35.2059L35.2215 15.369C35.2215 15.369 35.6048 13.7048 35.6031 13.71L35.6143 13.6248L35.6212 13.5591L35.7742 13.5751C35.7742 13.5751 36.5616 13.6434 36.5815 13.6456C36.8931 13.764 37.0201 14.0769 36.9307 14.4822ZM36.4276 12.7467C36.4255 12.7467 36.0417 12.7518 36.0417 12.7518C35.0378 12.7631 34.6354 12.7583 34.4703 12.7385C34.4531 12.8119 34.428 12.9424 34.428 12.9424L34.0693 14.6115C34.0693 14.6115 33.2097 18.1565 33.1687 18.3229C34.0447 18.3134 34.4042 18.3134 34.5542 18.3285C34.5883 18.1621 34.7932 17.172 34.7932 17.172C34.7932 17.172 34.9682 16.4447 34.9786 16.4179C34.9786 16.4179 35.0326 16.3436 35.0883 16.3137H35.1683C35.9233 16.3137 36.7781 16.3137 37.4462 15.8206C37.9004 15.4831 38.2138 14.9848 38.3516 14.3802C38.3888 14.2316 38.4147 14.0535 38.4147 13.8772C38.4147 13.6456 38.368 13.4161 38.2323 13.2363C37.8918 12.7583 37.2142 12.7518 36.4276 12.7467Z",fill:"white"}),n.jsx("path",{d:"M45.1748 15.0751L45.1303 15.0254C44.5581 15.1399 44.4535 15.1598 43.9263 15.2293L43.8865 15.2674C43.8848 15.2739 43.8831 15.2842 43.8818 15.2924L43.8792 15.2842C43.4868 16.1913 43.4993 15.9951 43.1791 16.7073C43.1769 16.6736 43.1765 16.6525 43.1756 16.6187L43.0961 15.0751L43.0455 15.0254C42.4466 15.1399 42.4306 15.1598 41.8761 15.2293L41.8316 15.2674C41.8277 15.2877 41.8264 15.3076 41.8234 15.3292L41.8277 15.3374C41.8968 15.6931 41.8809 15.6131 41.9496 16.171C41.982 16.445 42.0243 16.7225 42.0567 16.9926C42.1121 17.4463 42.1423 17.6706 42.208 18.3612C41.835 18.981 41.7447 19.2148 41.3882 19.7584L41.4072 19.8077C41.9496 19.7874 42.0745 19.7874 42.4755 19.7874L42.5641 19.6884C42.8671 19.0354 45.1748 15.0751 45.1748 15.0751Z",fill:"white"}),n.jsx("path",{d:"M25.5693 15.4586C25.8753 15.2447 25.9146 14.9491 25.6553 14.7957C25.3926 14.6414 24.9353 14.6898 24.6259 14.9042C24.3143 15.1151 24.2802 15.4115 24.5399 15.5662C24.8001 15.7171 25.2595 15.673 25.5693 15.4586Z",fill:"white"}),n.jsx("path",{d:"M42.5238 19.7429L42.0727 20.5152C41.93 20.7788 41.6651 20.9771 41.2442 20.9784L40.5255 20.9668L40.7347 20.2706H40.8738C40.9477 20.2706 41.0018 20.2658 41.0432 20.2455C41.0787 20.2343 41.105 20.2062 41.1344 20.1647L41.3993 19.7429H42.5238Z",fill:"white"})]}),ce=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M1 10L59 10",stroke:"#D3D3D3",strokeWidth:"7"}),n.jsx("path",{d:"M5 20H34",stroke:"#D3D3D3",strokeWidth:"2",strokeLinecap:"round"}),n.jsx("path",{d:"M5 27H25",stroke:"#D3D3D3",strokeWidth:"2",strokeLinecap:"round"}),n.jsx("rect",{x:"46",y:"21",width:"10",height:"7",rx:"2",fill:"#D9D9D9"})]}),pe=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M16.5247 19.2244C16.5247 12.2923 21.9422 6.67337 28.6257 6.67337C35.309 6.67337 40.7267 12.2923 40.7267 19.2244C40.7267 26.1563 35.309 31.7755 28.6257 31.7755C21.9422 31.7755 16.5247 26.1563 16.5247 19.2244Z",fill:"white"}),n.jsx("path",{d:"M35.9447 18.977C35.9391 15.7623 34.0025 13.0219 31.2728 11.9361V26.0177C34.0025 24.9305 35.9391 22.1925 35.9447 18.977ZM26.0659 26.0146V11.937C23.3393 13.0268 21.4049 15.7642 21.3979 18.977C21.4049 22.1892 23.3393 24.9272 26.0659 26.0146ZM28.6708 7.07501C22.3335 7.07748 17.1989 12.404 17.1981 18.977C17.1989 25.5492 22.3335 30.8749 28.6708 30.8758C35.0083 30.8749 40.1444 25.5492 40.146 18.977C40.1444 12.404 35.0083 7.07748 28.6708 7.07501ZM28.6426 31.9999C21.7077 32.0333 16 26.2067 16 19.1126C16 11.3606 21.7077 5.99835 28.6426 6H31.8932C38.7455 5.99835 45 11.3575 45 19.1126C45 26.2034 38.7455 31.9999 31.8932 31.9999H28.6426Z",fill:"#264B9A"})]}),me=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M0.5 8C0.5 3.85786 3.85786 0.5 8 0.5H52C56.1421 0.5 59.5 3.85786 59.5 8V30C59.5 34.1421 56.1421 37.5 52 37.5H8C3.85786 37.5 0.5 34.1421 0.5 30V8Z",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M9.19232 21.3753C8.69269 21.8265 8.04327 22.0234 7.01615 22.0234H6.58905V16.6315H7.01615C8.04327 16.6315 8.66695 16.8153 9.19232 17.2909C9.74271 17.7809 10.0728 18.539 10.0728 19.3202C10.0728 20.1034 9.74271 20.8859 9.19232 21.3753ZM7.33469 15.2496H5V23.404H7.32208C8.55684 23.404 9.44888 23.1129 10.2316 22.4621C11.1617 21.6921 11.7116 20.5322 11.7116 19.3327C11.7116 16.926 9.91383 15.2496 7.33469 15.2496Z",fill:"#231F20"}),n.jsx("path",{d:"M12.4438 23.404H14.0339V15.2496H12.4438V23.404Z",fill:"#231F20"}),n.jsx("path",{d:"M17.9229 18.379C16.9683 18.0253 16.6881 17.7928 16.6881 17.3521C16.6881 16.8383 17.1875 16.4484 17.8729 16.4484C18.3498 16.4484 18.7411 16.644 19.1556 17.1091L19.9879 16.019C19.3038 15.4209 18.4856 15.1153 17.592 15.1153C16.1491 15.1153 15.0487 16.1171 15.0487 17.4516C15.0487 18.5746 15.5612 19.1496 17.0551 19.6871C17.6774 19.9071 17.9941 20.0533 18.1542 20.1521C18.4717 20.359 18.6312 20.6527 18.6312 20.9952C18.6312 21.6559 18.1058 22.1453 17.3959 22.1453C16.6379 22.1453 16.0266 21.7665 15.6605 21.0585L14.6329 22.0471C15.3656 23.1227 16.2456 23.5996 17.4559 23.5996C19.1087 23.5996 20.2684 22.501 20.2684 20.9228C20.2684 19.6265 19.7324 19.0403 17.9229 18.379Z",fill:"#231F20"}),n.jsx("path",{d:"M20.7702 19.3328C20.7702 21.729 22.652 23.5871 25.0739 23.5871C25.7583 23.5871 26.3445 23.4528 27.0677 23.1129V21.2403C26.4317 21.8766 25.8684 22.1328 25.1475 22.1328C23.5456 22.1328 22.4089 20.9715 22.4089 19.3203C22.4089 17.7552 23.5821 16.5202 25.0739 16.5202C25.8321 16.5202 26.407 16.7909 27.0677 17.4378V15.5665C26.3697 15.2121 25.7957 15.0659 25.1112 15.0659C22.7019 15.0659 20.7702 16.9615 20.7702 19.3328Z",fill:"#231F20"}),n.jsx("path",{d:"M39.6784 20.7265L37.5033 15.2497H35.7663L39.2264 23.6135H40.0824L43.605 15.2497H41.8806L39.6784 20.7265Z",fill:"#231F20"}),n.jsx("path",{d:"M44.3237 23.404H48.8345V22.0234H45.9135V19.8221H48.7263V18.4409H45.9135V16.6315H48.8345V15.2496H44.3237V23.404Z",fill:"#231F20"}),n.jsx("path",{d:"M51.9414 19.0041H51.4762V16.534H51.9658C52.9569 16.534 53.4954 16.949 53.4954 17.7427C53.4954 18.5628 52.9569 19.0041 51.9414 19.0041ZM55.1326 17.6571C55.1326 16.1303 54.0803 15.2496 52.246 15.2496H49.8879V23.404H51.4762V20.1284H51.6841L53.8855 23.404H55.8412L53.2739 19.9684C54.4724 19.7246 55.1326 18.9059 55.1326 17.6571Z",fill:"#231F20"}),n.jsx("path",{d:"M56.0974 15.7753H56.0678V15.5875H56.0989C56.1836 15.5875 56.2281 15.6178 56.2281 15.6797C56.2281 15.7436 56.1831 15.7753 56.0974 15.7753ZM56.4 15.6778C56.4 15.5342 56.3007 15.4558 56.1273 15.4558H55.8967V16.1744H56.0678V15.8958L56.269 16.1744H56.479L56.2425 15.878C56.3434 15.851 56.4 15.7772 56.4 15.6778Z",fill:"#231F20"}),n.jsx("path",{d:"M56.1591 16.3292C55.8843 16.3292 55.6597 16.1 55.6597 15.8148C55.6597 15.5283 55.8823 15.2997 56.1591 15.2997C56.4328 15.2997 56.6554 15.5335 56.6554 15.8148C56.6554 16.0974 56.4328 16.3292 56.1591 16.3292ZM56.1617 15.1871C55.8128 15.1871 55.5354 15.4657 55.5354 15.8135C55.5354 16.1619 55.8159 16.4412 56.1617 16.4412C56.5018 16.4412 56.7808 16.1586 56.7808 15.8135C56.7808 15.4703 56.5018 15.1871 56.1617 15.1871Z",fill:"#231F20"}),n.jsx("path",{d:"M36.2191 19.3183C36.2191 21.7027 34.2863 23.6359 31.9014 23.6359C29.5166 23.6359 27.5835 21.7027 27.5835 19.3183C27.5835 16.9332 29.5166 15 31.9014 15C34.2863 15 36.2191 16.9332 36.2191 19.3183Z",fill:"#F36719"})]}),ye=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.0266 9.91185H35.684C47.003 9.91185 51.3527 16.0977 51.3527 23.9167C51.3527 33.2698 45.273 37.9711 35.684 37.9711H19.0266V9.91185ZM20.6082 11.5944V36.3875H35.6838C44.7786 36.3875 49.7215 32.1316 49.7215 23.9662C49.7215 15.5534 44.3832 11.5944 35.6838 11.5944H20.6082ZM25.0568 24.4115C26.722 24.4115 28.072 23.06 28.072 21.3928C28.072 19.7256 26.722 18.3741 25.0568 18.3741C23.3916 18.3741 22.0417 19.7256 22.0417 21.3928C22.0417 23.06 23.3916 24.4115 25.0568 24.4115ZM22.635 25.6982H27.479V34.309H22.635V25.6982Z",fill:"black"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M44.2351 18.6216H45.6191V22.7785H47.6456C47.1019 15.207 41.1211 13.5244 35.684 13.5244H29.9009V18.6216H30.7412C32.3229 18.6216 33.262 19.6608 33.262 21.3929C33.262 23.1249 32.3229 24.1641 30.7906 24.1641H29.9009V34.309H35.684C44.5317 34.309 47.5468 30.2016 47.6951 24.1641H44.2351V18.6216ZM37.5623 22.7785V24.1641H34.1023V18.6216H37.4634V20.0072H35.4863V20.6505H37.3646V22.0362H35.5357V22.7785H37.5623ZM39.8358 18.6216H41.813L43.4935 24.1641H42.0601L41.7635 23.1249H39.9347L39.6381 24.1641H38.1553L39.8358 18.6216ZM40.3456 21.6898H40.3302V21.7393L40.3456 21.6898ZM40.3456 21.6898H41.3188L40.8739 20.1557H40.8245L40.3456 21.6898ZM29.9009 22.7785V20.0072H30.7412C31.2849 20.0072 31.878 20.1557 31.878 21.3929C31.878 22.63 31.3343 22.7785 30.7412 22.7785H29.9009Z",fill:"#D50072"})]}),ge=({className:e})=>n.jsxs("svg",{className:e,width:"60",height:"38",viewBox:"0 0 60 38",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"59",height:"37",rx:"7.5",fill:"white",stroke:"#D3D3D3"}),n.jsx("path",{d:"M48 27.522C48 30.5171 45.5611 32.956 42.566 32.956H13V11.434C13 8.43887 15.4389 6 18.434 6H48V27.522Z",fill:"white"}),n.jsx("path",{d:"M38.3728 22.0024H40.6191C40.6833 22.0024 40.833 21.981 40.8972 21.981C41.3251 21.8954 41.6888 21.5104 41.6888 20.9755C41.6888 20.4621 41.3251 20.077 40.8972 19.97C40.833 19.9486 40.7047 19.9486 40.6191 19.9486H38.3728V22.0024Z",fill:"url(#paint0_linear_1_133)"}),n.jsx("path",{d:"M40.3625 7.81844C38.2231 7.81844 36.4688 9.55132 36.4688 11.7121V15.7555H41.967C42.0953 15.7555 42.2451 15.7555 42.3521 15.7769C43.5929 15.8411 44.5128 16.4829 44.5128 17.5953C44.5128 18.4725 43.8924 19.2212 42.7371 19.371V19.4138C43.9994 19.4994 44.9621 20.2054 44.9621 21.2964C44.9621 22.4731 43.8924 23.2433 42.4804 23.2433H36.4474V31.1589H42.1595C44.2989 31.1589 46.0532 29.426 46.0532 27.2653V7.81844H40.3625Z",fill:"url(#paint1_linear_1_133)"}),n.jsx("path",{d:"M41.4107 17.852C41.4107 17.3386 41.047 16.9963 40.6191 16.9321C40.5763 16.9321 40.4693 16.9107 40.4052 16.9107H38.3728V18.7933H40.4052C40.4693 18.7933 40.5977 18.7933 40.6191 18.7719C41.047 18.7078 41.4107 18.3655 41.4107 17.852Z",fill:"url(#paint2_linear_1_133)"}),n.jsx("path",{d:"M18.8405 7.81844C16.7011 7.81844 14.9468 9.55132 14.9468 11.7121V21.3178C16.0379 21.8527 17.1718 22.195 18.3056 22.195C19.6534 22.195 20.3808 21.382 20.3808 20.2695V15.7341H23.7182V20.2481C23.7182 22.0024 22.6272 23.4358 18.9261 23.4358C16.6797 23.4358 14.9254 22.9437 14.9254 22.9437V31.1375H20.6375C22.7769 31.1375 24.5312 29.4046 24.5312 27.2439V7.81844H18.8405Z",fill:"url(#paint3_linear_1_133)"}),n.jsx("path",{d:"M29.6015 7.81844C27.4621 7.81844 25.7079 9.55132 25.7079 11.7121V16.8038C26.692 15.9694 28.4035 15.4346 31.1632 15.5629C32.6394 15.6271 34.2225 16.0336 34.2225 16.0336V17.6809C33.431 17.2744 32.4896 16.9107 31.2702 16.8252C29.1736 16.6754 27.9114 17.7023 27.9114 19.4994C27.9114 21.3178 29.1736 22.3447 31.2702 22.1736C32.4896 22.088 33.431 21.7029 34.2225 21.3178V22.9651C34.2225 22.9651 32.6608 23.3716 31.1632 23.4358C28.4035 23.5642 26.692 23.0293 25.7079 22.195V31.1803H31.42C33.5593 31.1803 35.3136 29.4474 35.3136 27.2867V7.81844H29.6015Z",fill:"url(#paint4_linear_1_133)"}),n.jsxs("defs",{children:[n.jsxs("linearGradient",{id:"paint0_linear_1_133",x1:"36.4652",y1:"20.9781",x2:"46.0789",y2:"20.9781",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint1_linear_1_133",x1:"36.465",y1:"19.4793",x2:"46.0794",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint2_linear_1_133",x1:"36.4649",y1:"17.8493",x2:"46.079",y2:"17.8493",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#007940"}),n.jsx("stop",{offset:"0.2285","stop-color":"#00873F"}),n.jsx("stop",{offset:"0.7433","stop-color":"#40A737"}),n.jsx("stop",{offset:"1","stop-color":"#5CB531"})]}),n.jsxs("linearGradient",{id:"paint3_linear_1_133",x1:"14.9423",y1:"19.4793",x2:"24.7049",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#1F286F"}),n.jsx("stop",{offset:"0.4751","stop-color":"#004E94"}),n.jsx("stop",{offset:"0.8261","stop-color":"#0066B1"}),n.jsx("stop",{offset:"1","stop-color":"#006FBC"})]}),n.jsxs("linearGradient",{id:"paint4_linear_1_133",x1:"25.6525",y1:"19.4793",x2:"35.1343",y2:"19.4793",gradientUnits:"userSpaceOnUse",children:[n.jsx("stop",{"stop-color":"#6C2C2F"}),n.jsx("stop",{offset:"0.1735","stop-color":"#882730"}),n.jsx("stop",{offset:"0.5731","stop-color":"#BE1833"}),n.jsx("stop",{offset:"0.8585","stop-color":"#DC0436"}),n.jsx("stop",{offset:"1","stop-color":"#E60039"})]})]})]}),be=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{d:"M34.1572 17.6958C34.1572 16.7565 34.9551 16 35.8958 16C36.8366 16 37.6345 16.7648 37.6345 17.6958C37.6345 18.6269 36.8618 19.4166 35.8958 19.4166C34.9299 19.4166 34.1572 18.6518 34.1572 17.6958ZM29 16.2328H32.0238V32.9917H29V16.2328ZM37.4245 21.021H34.3756V32.9917H37.4245V21.021ZM59.3384 26.599C61.6314 25.2024 63.1937 23.1242 63.8068 21.0127H60.7579C59.9599 23.0244 58.1373 24.5374 56.1382 25.1775V16.2328H53.0893V32.9917H56.1382V28.0039C58.4648 28.5775 60.3043 30.5726 60.9342 32.9917H64C63.5296 30.4562 61.7826 28.0787 59.3384 26.6073V26.599ZM42.8253 22.3594C43.6232 21.312 45.1771 20.6968 46.4454 20.6968C48.7972 20.6968 50.7459 22.401 50.7543 24.978V32.9834H47.7053V25.643C47.7053 24.5873 47.2265 23.3653 45.6895 23.3653C43.8752 23.3653 42.8337 24.9614 42.8337 26.8235V33H39.7847V21.0293H42.8337V22.3594H42.8253Z",fill:"black"}),n.jsx("path",{d:"M14.5 34C19.7488 34 24 29.7488 24 24.5C24 19.2513 19.7488 15 14.5 15C9.25125 15 5 19.2513 5 24.5C5 29.7488 9.25125 34 14.5 34Z",fill:"#00D66F"}),n.jsx("path",{d:"M13.8794 19H11C11.5603 21.2993 13.1946 23.2625 15.2412 24.5C13.1868 25.7375 11.5603 27.7007 11 30H13.8794C14.5953 27.8764 16.572 26.0278 19 25.6458V23.3465C16.572 22.9722 14.5953 21.1236 13.8794 19Z",fill:"#011E0F"})]}),he=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 34.3139C33.1169 36.3704 30.0255 37.6119 26.6475 37.6119C19.1102 37.6119 13 31.4308 13 23.806C13 16.1811 19.1102 10 26.6475 10C30.0255 10 33.1169 11.2415 35.5 13.2981C37.8831 11.2415 40.9745 10 44.3525 10C51.8898 10 58 16.1811 58 23.806C58 31.4308 51.8898 37.6119 44.3525 37.6119C40.9745 37.6119 37.8831 36.3704 35.5 34.3139Z",fill:"#ED0006"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 34.3139C38.4344 31.7816 40.2951 28.0136 40.2951 23.806C40.2951 19.5983 38.4344 15.8303 35.5 13.2981C37.8831 11.2415 40.9745 10 44.3525 10C51.8898 10 58 16.1811 58 23.806C58 31.4308 51.8898 37.6119 44.3525 37.6119C40.9745 37.6119 37.8831 36.3704 35.5 34.3139Z",fill:"#F9A000"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.5 13.2981C38.4344 15.8304 40.2951 19.5984 40.2951 23.806C40.2951 28.0136 38.4344 31.7816 35.5 34.3138C32.5657 31.7816 30.705 28.0136 30.705 23.806C30.705 19.5984 32.5657 15.8304 35.5 13.2981Z",fill:"#FF5E00"})]}),ve=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"#10298E",stroke:"#D9D9D9"}),n.jsx("path",{d:"M12.7744 16.084C14.4396 16.084 15.6264 16.1801 16.334 16.3701C18.0609 16.8349 18.9248 18.137 18.9248 20.2764C18.9248 20.4518 18.9113 20.714 18.8857 21.0645H14.918C14.918 20.4123 14.8407 19.9748 14.6885 19.752C14.4524 19.4222 13.801 19.2569 12.7344 19.2568C11.6983 19.2568 11.0109 19.3519 10.6758 19.542C10.3409 19.7327 10.1729 20.1477 10.1729 20.7861C10.1729 21.3638 10.3217 21.7443 10.6191 21.9268C10.8324 22.0562 11.1145 22.1325 11.4658 22.1553L12.2656 22.2119C13.9806 22.3259 15.0521 22.4065 15.4795 22.4521C16.8358 22.5891 17.8195 22.9497 18.4297 23.5352C18.9098 23.992 19.1958 24.5898 19.2871 25.3271C19.3405 25.7681 19.3672 26.267 19.3672 26.8213C19.3672 28.0993 19.2457 29.0356 19.002 29.6289C18.5601 30.7174 17.5669 31.4046 16.0225 31.6934C15.3754 31.8154 14.3858 31.8769 13.0547 31.877C10.8322 31.877 9.28274 31.7449 8.4082 31.4785C7.33499 31.1522 6.6276 30.4905 6.28516 29.4951C6.09445 28.941 6.00001 28.0182 6 26.7266H9.96875C9.96875 26.8706 9.96875 26.9808 9.96875 27.0566C9.96876 27.746 10.1668 28.1893 10.5615 28.3867C10.8351 28.5229 11.1654 28.594 11.5537 28.6025H13.0127C13.7572 28.6025 14.2325 28.5649 14.4375 28.4883C14.8023 28.3446 15.0418 28.1131 15.1562 27.793C15.217 27.596 15.247 27.3411 15.2471 27.0293C15.2471 26.3303 14.992 25.9045 14.4834 25.752C14.2928 25.6917 13.4079 25.6075 11.8291 25.501C10.5609 25.4103 9.67998 25.3228 9.18652 25.2383C7.88722 24.9948 7.02094 24.4944 6.58887 23.7344C6.20918 23.0886 6.01956 22.1116 6.01953 20.8047C6.01953 19.8092 6.12198 19.0105 6.32715 18.4102C6.53252 17.8097 6.86368 17.3538 7.32031 17.042C7.98917 16.5635 8.84498 16.2823 9.88672 16.1982C10.7538 16.1225 11.7164 16.084 12.7744 16.084ZM44.2861 16C45.3761 16 46.2079 16.0894 46.7793 16.2676C48.0865 16.6779 48.9639 17.5176 49.4131 18.7871C49.645 19.4533 49.7607 20.4565 49.7607 21.7959C49.7607 23.4063 49.6323 24.564 49.3779 25.2686C48.8682 26.6618 47.8187 27.4648 46.2344 27.6729C46.048 27.7041 45.2548 27.7316 43.8555 27.7539L43.1475 27.7773H40.6045V31.877H36.3389V16H44.2861ZM64 31.877H59.6787L58.8652 29.1328H53.1621L52.3955 31.877H47.9824L52.7441 16H59.1787L64 31.877ZM54.0801 26.04H58.0186L56.0195 19.1572L54.0801 26.04ZM40.6035 24.0947H43.2627C44.1059 24.0643 44.6191 23.9992 44.8037 23.8975C45.0556 23.7585 45.2244 23.4803 45.3086 23.0635C45.3624 22.7859 45.3896 22.3732 45.3896 21.8252C45.3896 21.1539 45.336 20.6561 45.2285 20.3311C45.0751 19.8759 44.7078 19.5988 44.126 19.498C44.011 19.4828 43.7353 19.4746 43.2988 19.4746H40.6035V24.0947Z",fill:"white"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M30.45 18.2337C32.2095 18.2337 33.7797 19.0456 34.8119 20.3173L35.7314 18.3424C34.2933 16.9808 32.336 16.1413 30.1772 16.1413C26.8159 16.1413 23.9406 18.1748 22.7605 21.0533H20.9674L19.9087 23.3269H22.2154C22.1981 23.5378 22.1869 23.7489 22.1869 23.9643C22.1869 24.2249 22.2004 24.4824 22.2262 24.7369H21.0669L20.0083 27.0113H22.8155C24.0293 29.8169 26.8686 31.7866 30.1772 31.7866C31.8445 31.7866 33.3917 31.2862 34.6727 30.4314V27.644C33.6411 28.8205 32.1322 29.564 30.45 29.564C28.4837 29.564 26.754 28.5484 25.7468 27.0113H31.6253L32.6838 24.7369H24.8819C24.8417 24.4632 24.8202 24.1835 24.8202 23.8986C24.8202 23.706 24.8302 23.5153 24.8486 23.3269H33.3399L34.3985 21.0533H25.583C26.5579 19.3679 28.3721 18.2337 30.45 18.2337",fill:"#FFBE00"})]}),fe=({className:e})=>n.jsxs("svg",{className:e,width:"70",height:"48",viewBox:"0 0 70 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("rect",{x:"0.5",y:"0.5",width:"69",height:"47",rx:"5.5",fill:"white",stroke:"#D9D9D9"}),n.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M21.2505 32.5165H17.0099L13.8299 20.3847C13.679 19.8267 13.3585 19.3333 12.8871 19.1008C11.7106 18.5165 10.4142 18.0514 9 17.8169V17.3498H15.8313C16.7742 17.3498 17.4813 18.0514 17.5991 18.8663L19.2491 27.6173L23.4877 17.3498H27.6104L21.2505 32.5165ZM29.9675 32.5165H25.9626L29.2604 17.3498H33.2653L29.9675 32.5165ZM38.4467 21.5514C38.5646 20.7346 39.2717 20.2675 40.0967 20.2675C41.3931 20.1502 42.8052 20.3848 43.9838 20.9671L44.6909 17.7016C43.5123 17.2345 42.216 17 41.0395 17C37.1524 17 34.3239 19.1008 34.3239 22.0165C34.3239 24.2346 36.3274 25.3992 37.7417 26.1008C39.2717 26.8004 39.861 27.2675 39.7431 27.9671C39.7431 29.0165 38.5646 29.4836 37.3881 29.4836C35.9739 29.4836 34.5596 29.1338 33.2653 28.5494L32.5582 31.8169C33.9724 32.3992 35.5025 32.6338 36.9167 32.6338C41.2752 32.749 43.9838 30.6502 43.9838 27.5C43.9838 23.5329 38.4467 23.3004 38.4467 21.5514ZM58 32.5165L54.82 17.3498H51.4044C50.6972 17.3498 49.9901 17.8169 49.7544 18.5165L43.8659 32.5165H47.9887L48.8116 30.3004H53.8772L54.3486 32.5165H58ZM51.9936 21.4342L53.1701 27.1502H49.8723L51.9936 21.4342Z",fill:"#172B85"})]}),xe=ne("\n fragment CardImage_PaymentMethodFragment on PaymentMethod {\n metadata {\n issuer\n type\n }\n }\n");function Ce({paymentMethod:e}){var t,i,a,o;const r=Jn(xe,e),s=null===(i=null===(t=null==r?void 0:r.metadata)||void 0===t?void 0:t.issuer)||void 0===i?void 0:i.toLowerCase(),l=null===(o=null===(a=null==r?void 0:r.metadata)||void 0===a?void 0:a.type)||void 0===o?void 0:o.toLowerCase(),u="w-12 h-8";if("cashapp"===l)return n.jsx(ue,{className:u});if("link"===l)return n.jsx(be,{className:u});switch(s){case"visa":return n.jsx(fe,{className:u});case"mastercard":return n.jsx(he,{className:u});case"amex":return n.jsx(se,{className:u});case"jcb":return n.jsx(ge,{className:u});case"diners_club":case"diners":return n.jsx(pe,{className:u});case"discover":return n.jsx(me,{className:u});case"unionpay":case"union_pay":case"china_union_pay":case"china_unionpay":return n.jsx(de,{className:u});case"sepa":return n.jsx(ve,{className:u});case"ideal":return n.jsx(ye,{className:u});case"bancontact":return n.jsx(le,{className:u});default:return n.jsx(ce,{className:u})}}const{Text:we}=i.Typography,{useToken:je}=i.theme,Se=ne("\n fragment MiniCreditCard_PaymentMethodFragment on PaymentMethod {\n ...CardImage_PaymentMethodFragment\n isDefault\n metadata {\n issuer\n type\n identifier\n }\n state\n failureReason\n id\n }\n ",[xe]);function Ie({className:a,buttons:o,hideDropdownMenu:r=!1,hideDefaultTag:s=!1,onClickRemove:l,paymentMethod:u,onClickSetDefault:d,id:c}){var p,m,y;const{darkMode:g}=e.useContext(te),{token:b}=je(),[h,v]=e.useState(!1),f=Jn(Se,u),x=e.useMemo(()=>g?"border-slate-700":"border-slate-200",[g]),C=e.useMemo(()=>g?"var(--row-background-alternate)":"bg-slate-50",[g]),w=null==f?void 0:f.isDefault,j="FAILED"===(null==f?void 0:f.state);return n.jsx("div",{className:`bunny-flex bunny-flex-row bunny-justify-between bunny-items-center bunny-p-1 bunny-px-3 bunny-border-solid ${C} bunny-${x} bunny-rounded-md bunny-border ${a}`,id:c,onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),children:f?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-gap-4",children:n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2 bunny-space-between bunny-w-full",children:[n.jsx(Ce,{paymentMethod:f}),n.jsx(ke,{issuer:null===(p=null==f?void 0:f.metadata)||void 0===p?void 0:p.issuer}),n.jsx(Pe,{type:null===(m=null==f?void 0:f.metadata)||void 0===m?void 0:m.type,identifier:null===(y=null==f?void 0:f.metadata)||void 0===y?void 0:y.identifier}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1",children:[w&&!s&&n.jsx(i.Tag,{bordered:!1,style:{color:b.colorPrimary,backgroundColor:b.colorPrimaryBg},children:"Default"}),j&&n.jsx(Le,{failureReason:f.failureReason,forceOpenTooltip:h})]})]})}),o||n.jsx(n.Fragment,{children:!r&&n.jsx(Ne,{setDefault:d,remove:l,isDefault:null!=w&&w,id:`credit-card-dropdown-${f.id}`})})]}):n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-items-center justify-between w-full",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx(t.CreditCardOutlined,{}),n.jsx(we,{className:"bunny-text-slate-400 bunny-text-sm",children:"No payment methods"})]}),n.jsx(i.Button,{disabled:!0,type:"link"}),o]})})}function Le({failureReason:e,forceOpenTooltip:t}){const a=n.jsx(i.Tag,{bordered:!1,color:"red",children:"Failed"});return e?n.jsx(i.Tooltip,{title:e,open:t,children:a}):a}const Pe=({type:e,identifier:t})=>"link"===e?null:"cashapp"===e?n.jsx(we,{children:"Cashapp"}):n.jsxs("div",{children:[n.jsx(we,{className:"relative -top-0.5",children:"****"}),n.jsx(we,{children:t})]}),ke=({issuer:e})=>!e||0==e.length||["visa","link","jcb","discover","sepa"].includes(null==e?void 0:e.toLowerCase())?null:n.jsx(we,{children:u.capitalize(e)}),Ne=({setDefault:e,remove:a,isDefault:o,id:r})=>{const{token:s}=je(),l=[{key:"1",label:"Remove",disabled:!a,onClick:()=>{null==a||a()}},{key:"2",label:"Set as default",onClick:()=>{null==e||e()},disabled:o}];return n.jsx(i.Dropdown,{menu:{items:l},trigger:["click"],children:n.jsx("a",{id:r,children:n.jsx(t.EllipsisOutlined,{style:{fontSize:"20px",color:s.colorPrimary}})})})},Fe=ne("\n fragment PaymentForm_PaymentMethodsFragment on PaymentMethod {\n ...MiniCreditCard_PaymentMethodFragment\n id\n plugin {\n id\n }\n }\n ",[Se]),De=ne("\n fragment StoredPaymentMethods_PaymentMethodsFragment on PaymentMethod {\n ...MiniCreditCard_PaymentMethodFragment\n id\n plugin {\n id\n }\n }\n ",[Se]),Te=ne("\n query PaymentMethods($accountId: ID) {\n paymentMethods(accountId: $accountId) {\n nodes {\n id\n pluginId\n accountId\n expirationDate\n plugin {\n guid\n id\n }\n state\n metadata {\n issuer\n identifier\n kind\n description\n icon\n type\n }\n isDefault\n ...PaymentForm_PaymentMethodsFragment\n ...StoredPaymentMethods_PaymentMethodsFragment\n }\n }\n }\n ",[Fe,De]),qe=({accountId:n,enabled:t=!0})=>{const{apiHost:i}=e.useContext(te),o=oe(),{data:r,isLoading:s}=a.useQuery({queryKey:R({accountId:n,token:o}),queryFn:()=>(async({apiHost:n,token:e,accountId:t})=>{var i,a,o;const r=await In(Te,{apiHost:n,token:e},{accountId:t});return null!==(o=null===(a=null===(i=null==r?void 0:r.paymentMethods)||void 0===i?void 0:i.nodes)||void 0===a?void 0:a.filter(n=>null!==n))&&void 0!==o?o:[]})({apiHost:i,token:o,accountId:n}),staleTime:3e5,enabled:t});return{paymentMethods:r,defaultPaymentMethod:null==r?void 0:r.find(n=>null==n?void 0:n.isDefault),isLoading:s}},Ae="bunny-gap-2",Me=t=>{const i=e.createContext(null);return[({initialValue:e,children:a})=>n.jsxs(i.Provider,{value:t(e),children:[" ",a," "]}),()=>{const n=e.useContext(i);if(null===n)throw new Error("Provider missing");return n}]},He={number:"4242424242424242",expiry:"",cvc:""},[Ee,Qe]=Me(n=>e.useState(null!=n?n:He)),$e=({method:n="GET",apiHost:e,endpoint:t,body:i,headers:a,token:o})=>{const{apiEndpoint:r}=cn,s=`${e}${r}${t}`,l={...gn({token:o}),...a};return fetch(s,{method:n,headers:l,body:i})},_e=async({method:n,payload:e,plugin:t,token:i,apiHost:a,componentsVersion:o})=>{var r,s,l,u;const d=null===(s=null===(r=t.components)||void 0===r?void 0:r.backend)||void 0===s?void 0:s[0];if(!(null===(u=null===(l=t.components)||void 0===l?void 0:l.backend)||void 0===u?void 0:u.length))throw new Error("The provided plugin is not invokable");if(!(null==d?void 0:d.access.includes(n)))throw new Error(`Method ${n} is not invokable`);const c=JSON.stringify({guid:t.guid,class:null==d?void 0:d.name,method:n,payload:e}),p=gn({token:i,componentsVersion:o||pn}),m=await $e({method:"POST",apiHost:a,endpoint:"/plugins/invoke",body:c,token:i,headers:p});if(m.ok)return m.json();const y=await m.json();throw new Error(y.message)},{useToken:Re}=i.theme,Be=async({quote:n,plugin:e,token:t,apiHost:i,paymentMethodId:a})=>{const o={quote_id:n.id,amount:n.amount,payment_method_id:a},r=await _e({plugin:e,method:"create_payment_hold",payload:o,token:t,apiHost:i});if("success"!==r.status)throw new Error(r.message||"Unknown error");return r};c.loadStripe.setLoadParameters({advancedFraudSignals:!1});const Ue=(n,t)=>{const{apiHost:i}=e.useContext(te),a=oe(),[o,r]=e.useState(null),s=Q(),{token:l}=Re(),u=e.useMemo(()=>{const n=l.fontFamily;return n.includes("Inter Variable")||"Inter"===n?'var(--font-inter, "Inter Variable", Inter), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif':n.includes(",")?n:`${n}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`},[l.fontFamily]),d=e.useMemo(()=>{const n={variables:{fontFamily:u,fontLineHeight:l.lineHeight.toString(),borderRadius:l.borderRadius.toString()+"px",colorBackground:"white",colorPrimary:l.colorPrimary},rules:{".Input":{fontFamily:u,border:`1px solid ${l.colorBorder}`},".Label":{fontFamily:u},".Text":{fontFamily:u},".Tab":{fontFamily:u},".TabLabel":{fontFamily:u},".Error":{fontFamily:u}}};return{mode:"setup",currency:t,setupFutureUsage:"off_session",appearance:n}},[u,l.lineHeight,l.borderRadius,l.colorPrimary,l.colorBorder,t]);return e.useEffect(()=>{var e,t;n&&"StripePayment"===(null===(t=null===(e=n.components)||void 0===e?void 0:e.frontend)||void 0===t?void 0:t[0].name)&&(async(n,e,t)=>await _e({plugin:n,method:"retrieve_config",token:t,apiHost:e}))(n,i||"",a).then(({payload:n})=>c.loadStripe(n.publishable_key).then(r)).catch(n=>{console.error("Caught Error in fetching stripe key: ",n),s(n.message,"Unexpected Error fetching key")})},[n,a]),{stripe:o,options:d}},Ve=ne("\n query PaymentPlugins($accountId: ID) {\n paymentPlugins(accountId: $accountId) {\n enabled\n entities\n guid\n hidden\n id\n name\n status\n type\n webhookEnabled\n components\n }\n }\n"),Oe=()=>{var n;const{apiHost:t}=e.useContext(te),i=oe(),{data:o,isFetched:r}=a.useQuery({queryKey:on(i),queryFn:()=>(async({apiHost:n,token:e})=>{const t=await In(Ve,{apiHost:n,token:e},{});return null==t?void 0:t.paymentPlugins})({apiHost:t,token:i}),staleTime:3e5,placeholderData:n=>n});return{paymentPlugins:null!==(n=null==o?void 0:o.filter(n=>{var e,t,i;return"payment"===(null===(e=n.type)||void 0===e?void 0:e.toLowerCase())&&"valid"===(null===(t=n.status)||void 0===t?void 0:t.toLowerCase())&&"manual payment"!==(null===(i=n.name)||void 0===i?void 0:i.toLowerCase())}))&&void 0!==n?n:[],isFetched:r}},[Ze,ze]=Me(n=>e.useState(n)),[Ke,Ge]=hn();function Ye({children:e,accountId:t}){return n.jsx(Ze,{initialValue:void 0,children:n.jsx(We,{accountId:t,children:e})})}function We({children:t,accountId:i}){const{paymentPlugins:a}=Oe(),{defaultPaymentMethod:o}=qe({accountId:i}),[r,s]=ze(),l=e.useMemo(()=>null==a?void 0:a.find(n=>n.id===r),[a,r]);return e.useEffect(()=>{var n,e;r||s(o?null===(n=o.plugin)||void 0===n?void 0:n.id:null===(e=null==a?void 0:a[0])||void 0===e?void 0:e.id)},[o,a]),n.jsx(Ke,{value:l,children:t})}function Xe({children:e,currencyId:t}){const i=Ge(),{stripe:a,options:o}=Ue(i,t);return n.jsx(d.Elements,{options:o,stripe:a,children:e})}const Je=ne("\n mutation Checkout(\n $invoiceId: ID\n $quoteId: ID\n $paymentMethodId: ID\n $paymentMethodData: CheckoutPaymentMethodAttributes\n ) {\n checkout(\n invoiceId: $invoiceId\n quoteId: $quoteId\n paymentMethodId: $paymentMethodId\n paymentMethodData: $paymentMethodData\n ) {\n invoice {\n id\n state\n amount\n amountDue\n }\n payment {\n id\n state\n amount\n }\n paymentApplication {\n id\n invoiceId\n paymentId\n }\n transaction {\n id\n amount\n }\n }\n }\n"),nt=async({quoteId:n,invoiceId:e,paymentMethodId:t,paymentMethodData:i,token:a,apiHost:o})=>{const r={quoteId:n,invoiceId:e,paymentMethodId:t};i&&(r.paymentMethodData={...i,metadata:i.metadata});const s=await In(Je,{apiHost:o,token:a},r);return null==s?void 0:s.checkout},[et,tt]=hn(),it=ne("\n fragment getQuoteAmountDue_QuoteFragment on Quote {\n amountDue\n amount\n }\n ",[]),at=n=>{var e;const t=Jn(it,n);return null!==(e=t.amountDue)&&void 0!==e?e:t.amount};function ot(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var rt,st={exports:{}};var lt,ut=(rt||(rt=1,st.exports=function(){var n=1e3,e=6e4,t=36e5,i="millisecond",a="second",o="minute",r="hour",s="day",l="week",u="month",d="quarter",c="year",p="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,g=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(n){var e=["th","st","nd","rd"],t=n%100;return"["+n+(e[(t-20)%10]||e[t]||e[0])+"]"}},h=function(n,e,t){var i=String(n);return!i||i.length>=e?n:""+Array(e+1-i.length).join(t)+n},v={s:h,z:function(n){var e=-n.utcOffset(),t=Math.abs(e),i=Math.floor(t/60),a=t%60;return(e<=0?"+":"-")+h(i,2,"0")+":"+h(a,2,"0")},m:function n(e,t){if(e.date()<t.date())return-n(t,e);var i=12*(t.year()-e.year())+(t.month()-e.month()),a=e.clone().add(i,u),o=t-a<0,r=e.clone().add(i+(o?-1:1),u);return+(-(i+(t-a)/(o?a-r:r-a))||0)},a:function(n){return n<0?Math.ceil(n)||0:Math.floor(n)},p:function(n){return{M:u,y:c,w:l,d:s,D:p,h:r,m:o,s:a,ms:i,Q:d}[n]||String(n||"").toLowerCase().replace(/s$/,"")},u:function(n){return void 0===n}},f="en",x={};x[f]=b;var C="$isDayjsObject",w=function(n){return n instanceof L||!(!n||!n[C])},j=function n(e,t,i){var a;if(!e)return f;if("string"==typeof e){var o=e.toLowerCase();x[o]&&(a=o),t&&(x[o]=t,a=o);var r=e.split("-");if(!a&&r.length>1)return n(r[0])}else{var s=e.name;x[s]=e,a=s}return!i&&a&&(f=a),a||!i&&f},S=function(n,e){if(w(n))return n.clone();var t="object"==typeof e?e:{};return t.date=n,t.args=arguments,new L(t)},I=v;I.l=j,I.i=w,I.w=function(n,e){return S(n,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var L=function(){function b(n){this.$L=j(n.locale,null,!0),this.parse(n),this.$x=this.$x||n.x||{},this[C]=!0}var h=b.prototype;return h.parse=function(n){this.$d=function(n){var e=n.date,t=n.utc;if(null===e)return new Date(NaN);if(I.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(y);if(i){var a=i[2]-1||0,o=(i[7]||"0").substring(0,3);return t?new Date(Date.UTC(i[1],a,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)):new Date(i[1],a,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)}}return new Date(e)}(n),this.init()},h.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},h.$utils=function(){return I},h.isValid=function(){return!(this.$d.toString()===m)},h.isSame=function(n,e){var t=S(n);return this.startOf(e)<=t&&t<=this.endOf(e)},h.isAfter=function(n,e){return S(n)<this.startOf(e)},h.isBefore=function(n,e){return this.endOf(e)<S(n)},h.$g=function(n,e,t){return I.u(n)?this[e]:this.set(t,n)},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(n,e){var t=this,i=!!I.u(e)||e,d=I.p(n),m=function(n,e){var a=I.w(t.$u?Date.UTC(t.$y,e,n):new Date(t.$y,e,n),t);return i?a:a.endOf(s)},y=function(n,e){return I.w(t.toDate()[n].apply(t.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),t)},g=this.$W,b=this.$M,h=this.$D,v="set"+(this.$u?"UTC":"");switch(d){case c:return i?m(1,0):m(31,11);case u:return i?m(1,b):m(0,b+1);case l:var f=this.$locale().weekStart||0,x=(g<f?g+7:g)-f;return m(i?h-x:h+(6-x),b);case s:case p:return y(v+"Hours",0);case r:return y(v+"Minutes",1);case o:return y(v+"Seconds",2);case a:return y(v+"Milliseconds",3);default:return this.clone()}},h.endOf=function(n){return this.startOf(n,!1)},h.$set=function(n,e){var t,l=I.p(n),d="set"+(this.$u?"UTC":""),m=(t={},t[s]=d+"Date",t[p]=d+"Date",t[u]=d+"Month",t[c]=d+"FullYear",t[r]=d+"Hours",t[o]=d+"Minutes",t[a]=d+"Seconds",t[i]=d+"Milliseconds",t)[l],y=l===s?this.$D+(e-this.$W):e;if(l===u||l===c){var g=this.clone().set(p,1);g.$d[m](y),g.init(),this.$d=g.set(p,Math.min(this.$D,g.daysInMonth())).$d}else m&&this.$d[m](y);return this.init(),this},h.set=function(n,e){return this.clone().$set(n,e)},h.get=function(n){return this[I.p(n)]()},h.add=function(i,d){var p,m=this;i=Number(i);var y=I.p(d),g=function(n){var e=S(m);return I.w(e.date(e.date()+Math.round(n*i)),m)};if(y===u)return this.set(u,this.$M+i);if(y===c)return this.set(c,this.$y+i);if(y===s)return g(1);if(y===l)return g(7);var b=(p={},p[o]=e,p[r]=t,p[a]=n,p)[y]||1,h=this.$d.getTime()+i*b;return I.w(h,this)},h.subtract=function(n,e){return this.add(-1*n,e)},h.format=function(n){var e=this,t=this.$locale();if(!this.isValid())return t.invalidDate||m;var i=n||"YYYY-MM-DDTHH:mm:ssZ",a=I.z(this),o=this.$H,r=this.$m,s=this.$M,l=t.weekdays,u=t.months,d=t.meridiem,c=function(n,t,a,o){return n&&(n[t]||n(e,i))||a[t].slice(0,o)},p=function(n){return I.s(o%12||12,n,"0")},y=d||function(n,e,t){var i=n<12?"AM":"PM";return t?i.toLowerCase():i};return i.replace(g,function(n,i){return i||function(n){switch(n){case"YY":return String(e.$y).slice(-2);case"YYYY":return I.s(e.$y,4,"0");case"M":return s+1;case"MM":return I.s(s+1,2,"0");case"MMM":return c(t.monthsShort,s,u,3);case"MMMM":return c(u,s);case"D":return e.$D;case"DD":return I.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return c(t.weekdaysMin,e.$W,l,2);case"ddd":return c(t.weekdaysShort,e.$W,l,3);case"dddd":return l[e.$W];case"H":return String(o);case"HH":return I.s(o,2,"0");case"h":return p(1);case"hh":return p(2);case"a":return y(o,r,!0);case"A":return y(o,r,!1);case"m":return String(r);case"mm":return I.s(r,2,"0");case"s":return String(e.$s);case"ss":return I.s(e.$s,2,"0");case"SSS":return I.s(e.$ms,3,"0");case"Z":return a}return null}(n)||a.replace(":","")})},h.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},h.diff=function(i,p,m){var y,g=this,b=I.p(p),h=S(i),v=(h.utcOffset()-this.utcOffset())*e,f=this-h,x=function(){return I.m(g,h)};switch(b){case c:y=x()/12;break;case u:y=x();break;case d:y=x()/3;break;case l:y=(f-v)/6048e5;break;case s:y=(f-v)/864e5;break;case r:y=f/t;break;case o:y=f/e;break;case a:y=f/n;break;default:y=f}return m?y:I.a(y)},h.daysInMonth=function(){return this.endOf(u).$D},h.$locale=function(){return x[this.$L]},h.locale=function(n,e){if(!n)return this.$L;var t=this.clone(),i=j(n,e,!0);return i&&(t.$L=i),t},h.clone=function(){return I.w(this.$d,this)},h.toDate=function(){return new Date(this.valueOf())},h.toJSON=function(){return this.isValid()?this.toISOString():null},h.toISOString=function(){return this.$d.toISOString()},h.toString=function(){return this.$d.toUTCString()},b}(),P=L.prototype;return S.prototype=P,[["$ms",i],["$s",a],["$m",o],["$H",r],["$W",s],["$M",u],["$y",c],["$D",p]].forEach(function(n){P[n[1]]=function(e){return this.$g(e,n[0],n[1])}}),S.extend=function(n,e){return n.$i||(n(e,L,S),n.$i=!0),S},S.locale=j,S.isDayjs=w,S.unix=function(n){return S(1e3*n)},S.en=x[f],S.Ls=x,S.p={},S}()),st.exports),dt=ot(ut),ct={exports:{}};var pt=(lt||(lt=1,ct.exports=function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(e,t,i){var a=t.prototype,o=a.format;i.en.formats=n,a.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,i=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(e,i,a){var o=a&&a.toUpperCase();return i||t[a]||n[a]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(n,e,t){return e||t.slice(1)})})}(e,void 0===t?{}:t);return o.call(this,i)}}}()),ct.exports),mt=ot(pt);dt.extend(mt);const yt=(n,e,t=2)=>{if(0!==n&&!n)return"";const i="string"==typeof n?parseFloat(n):n;if(isNaN(i))return n;const a={minimumFractionDigits:t,maximumFractionDigits:t,style:"currency"};return a.currency=e,i.toLocaleString(navigator.language,a)};var gt;!function(n){n.PAY="PAY",n.APPROVE_HOLD="APPROVE_HOLD",n.CHECKOUT_NO_PAYMENT="CHECKOUT_NO_PAYMENT",n.SAVE="SAVE"}(gt||(gt={}));const[bt,ht]=hn(),vt=ne("\n fragment PaymentProvider_QuoteFragment on Quote {\n id\n currencyId\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[it]),ft=ne("\n fragment PaymentProvider_InvoiceFragment on Invoice {\n id\n currencyId\n amountDue\n }\n ");function xt({children:t,quote:i,invoice:a,paymentHold:o}){var r,s;const l=Jn(vt,i),u=Jn(ft,a),[d,c]=e.useState(!1),[p,m]=e.useState(!1),[y,g]=e.useState(!1),[b,h]=e.useState(!1),[v,f]=e.useState(!1),x=()=>l?at(l):null==u?void 0:u.amountDue;const C=void 0===x()?gt.SAVE:0===x()?gt.CHECKOUT_NO_PAYMENT:o?gt.APPROVE_HOLD:gt.PAY,w=x(),j=(()=>{var n;const e=x(),t=null!==(n=null==l?void 0:l.currencyId)&&void 0!==n?n:null==u?void 0:u.currencyId;return void 0!==e&&void 0!==t?yt(e,t).toString():void 0})();return n.jsx(bt,{value:{quoteId:null!==(r=null==l?void 0:l.id)&&void 0!==r?r:void 0,invoiceId:null!==(s=null==u?void 0:u.id)&&void 0!==s?s:void 0,paymentHold:o,paymentType:C,amountDue:null!=w?w:void 0,formattedAmountDue:j,isPaid:d,setIsPaid:c,isApproved:p,setIsApproved:m,isPaying:y,setIsPaying:g,isApprovingHold:b,setIsApprovingHold:h,isSaving:v,setIsSaving:f},children:t})}const[Ct,wt]=hn(),[jt,St]=Me((n=!1)=>e.useState(n));const It=Q();function Lt({plugin:n,onPaymentHoldSuccess:t,onPaymentHoldError:i}){var a,o,r;const s=null===(r=null===(o=null===(a=null==n?void 0:n.components)||void 0===a?void 0:a.frontend)||void 0===o?void 0:o[0])||void 0===r?void 0:r.name,{approveHold:l,isApprovingHold:u}=function({onApproveHoldSuccess:n,onApproveHoldError:t}){const[i,a]=e.useState(!1),{apiHost:o}=e.useContext(te),r=oe();return{approveHold:async({plugin:e,quote:i,paymentMethodId:s})=>{try{if(!r)throw new Error("Token couldn't be retrieved");a(!0);const t=await Be({quote:i,plugin:e,token:r,apiHost:o,paymentMethodId:s});if("success"!==t.status)throw new Error(null==t?void 0:t.message);null==n||n(t)}catch(n){console.error(n),null==t||t(n)}finally{a(!1)}},isApprovingHold:i}}({onApproveHoldSuccess:t,onApproveHoldError:i}),{approveHold:d,isApprovingHold:c}=function({onApproveHoldSuccess:n,onApproveHoldError:t}){const[i,a]=e.useState(!1),{apiHost:o}=e.useContext(te),r=oe();return{approveHold:async({plugin:e,quote:i,paymentMethodId:s})=>{try{if(!r)throw new Error("Token couldn't be retrieved");a(!0);const t=await Be({quote:i,plugin:e,token:r,apiHost:o,paymentMethodId:s});if("success"!==t.status)throw new Error(null==t?void 0:t.message);null==n||n(t)}catch(n){console.error(n),null==t||t(n)}finally{a(!1)}},isApprovingHold:i}}({onApproveHoldSuccess:t,onApproveHoldError:i});return{approveHold:async({quote:e,paymentMethodId:t})=>{if(!s)return It("plugin name is required");if(!n)return It("plugin is required");switch(s){case"StripePayment":return void await l({plugin:n,quote:e,paymentMethodId:t});case"DemoPayPayment":return void await d({plugin:n,quote:e,paymentMethodId:t});default:return void It(`Payment holds are not supported by ${s}`)}},isApprovingHold:u||c}}const Pt=/\d/,kt=n=>Pt.test(n),Nt=n=>[8,46].includes(n)||(n=>[9,37,38,39,40].includes(n))(n)||(n=>[16,17,18].includes(n))(n),Ft="4242424242424242";function Dt({onSaveSuccess:n,onSaveError:t,accountId:i}){const[a,o]=e.useState(!1),{apiHost:r}=e.useContext(te),s=oe(),l=Ge(),[u,d]=Qe();return{save:async()=>{try{!function(){if(u.number!==Ft)throw new Error("Only the card number 4242 4242 4242 4242 will be accepted.");if(!(n=>{const e=parseInt(n.substring(0,2),10),t=parseInt(n.substring(2,4),10)+2e3;return!isNaN(e)&&!isNaN(t)&&!(e<1||e>12)})(u.expiry))throw new Error("Invalid expiry date");if((n=>{const e=parseInt(n.substring(0,2),10),t=parseInt(n.substring(2,4),10)+2e3;return new Date(t,e,1)<new Date})(u.expiry))throw new Error("Card is expired");if(3!==u.cvc.length)throw new Error("Invalid CVC")}(),o(!0);const t=await(async(n,e,t,i)=>{const{testCreditCardNumber:a,testCreditCardCvc:o,testCreditCardExpirationDate:r,token:s}=n,l=await _e({method:"store_payment_method",plugin:e,payload:{test_credit_card_number:a,test_credit_card_cvc:o,test_credit_card_expiration_date:r,account_id:i},token:s,apiHost:t});if("success"!==(null==l?void 0:l.status))throw new Error(null==l?void 0:l.message);return l})({testCreditCardNumber:(e=u.number,e.split("").filter(n=>" "!==n).join("")),testCreditCardCvc:u.cvc.toString(),testCreditCardExpirationDate:u.expiry,token:s},l,r,i),a=t.payload[0].id;if("success"!==t.status)throw new Error(null==t?void 0:t.message);return null==n||n({pluginPaymentResponse:{plugin:l,token:t.token,savePaymentMethod:!0},savedPaymentMethodResponse:{paymentMethodId:a}}),d({number:u.number,expiry:"",cvc:""}),a}catch(n){null==t||t(n)}finally{o(!1)}var e},isSaving:a}}function Tt({onSaveSuccess:n,onSaveError:t,accountId:i}){const[a,o]=e.useState(!1),r=d.useElements(),s=d.useStripe(),{apiHost:l}=e.useContext(te),u=oe(),c=Ge(),p=async()=>{var n,e;if(!s)throw new Error("Form is not ready");if(!r)throw new Error("Elements couldn't be retrieved");const{error:t}=await r.submit();if(t)throw new Error(t.message);const a=await((n,e,t,i)=>_e({plugin:n,method:"create_setup_intent",token:t,apiHost:e,payload:{account_id:i}}))(c,l,u,i);if("success"!==a.status)throw new Error(null==a?void 0:a.message);const o=null===(n=null==a?void 0:a.payload)||void 0===n?void 0:n.client_secret;if(!o)throw new Error("Error retrieving client secret");const d=await s.confirmSetup({elements:r,clientSecret:o,redirect:"if_required",confirmParams:{return_url:window.location.href}});if(d.error)throw new Error(d.error.message);const p=null===(e=d.setupIntent.payment_method)||void 0===e?void 0:e.toString();if(!p)throw new Error("Payment method couldn't be retrieved");return p};return{save:async()=>{try{o(!0);const e=await p(),t=await(async({paymentMethodId:n,plugin:e,token:t,apiHost:i,accountId:a})=>{const o=await _e({plugin:e,method:"store_payment_method",payload:{payment_method_id:n,account_id:a},token:t,apiHost:i});if("success"!==o.status)throw new Error(o.message||"Unknown error");return o})({paymentMethodId:e,plugin:c,token:u,apiHost:l,accountId:i}),a=t.payload[0].id;return null==n||n({pluginPaymentResponse:{savePaymentMethod:!0,plugin:c,token:t.token},savedPaymentMethodResponse:{paymentMethodId:a}}),a}catch(n){null==t||t(n)}finally{o(!1)}},createStripePaymentMethodId:p,isSaving:a}}const qt=Sn(),At=Q();function Mt({accountId:n,onSaveSuccess:e,onSaveError:t,invalidatePaymentMethodsQuery:i=!0}){var o,r,s;const l=Ge(),u=a.useQueryClient(),d=oe(),c=null!=t?t:qt,p=null===(s=null===(r=null===(o=null==l?void 0:l.components)||void 0===o?void 0:o.frontend)||void 0===r?void 0:r[0])||void 0===s?void 0:s.name,{save:m,isSaving:y}=Dt({accountId:n,onSaveSuccess:t=>{null==e||e(t),i&&u.invalidateQueries({queryKey:R({accountId:n,token:d})})},onSaveError:c}),{save:g,isSaving:b}=Tt({accountId:n,onSaveSuccess:t=>{null==e||e(t),i&&u.invalidateQueries({queryKey:R({accountId:n,token:d})})},onSaveError:c});return{save:async()=>{var n,e,t;return"StripePayment"===p?await g():"DemoPayPayment"===p?await m():void At(`Can not find form for plugin ${null===(t=null===(e=null===(n=null==l?void 0:l.components)||void 0===n?void 0:n.frontend)||void 0===e?void 0:e[0])||void 0===t?void 0:t.name}`)},isSaving:y||b}}const[Ht,Et]=hn(),Qt=Q();const $t=Q();const _t=Q();function Rt({plugin:n,quoteId:t,invoiceId:i,onPaymentSuccess:o,onPaymentError:r}){var s,l,u;const d=null===(u=null===(l=null===(s=null==n?void 0:n.components)||void 0===s?void 0:s.frontend)||void 0===l?void 0:l[0])||void 0===u?void 0:u.name,{pay:c,isPaying:p}=function({onPaymentSuccess:n,onPaymentError:t,quoteId:i,invoiceId:o,plugin:r}){const s=a.useQueryClient(),{apiHost:l}=e.useContext(te),u=Et(),d=oe(),[c,p]=e.useState(!1);return{pay:async e=>{try{if(p(!0),u){if(!(null==r?void 0:r.id))return void $t("Plugin ID is required");const t=await u(null==r?void 0:r.id.toString(),e.toString());null==n||n(t)}else{if(!i&&!o)return void $t("Quote ID or Invoice ID is required");const t=await nt({invoiceId:o,quoteId:i,paymentMethodId:e,token:d,apiHost:l});null==n||n(t)}}catch(n){null==t||t(n),s.invalidateQueries({queryKey:R({})})}finally{p(!1)}},isPaying:c}}({onPaymentSuccess:o,onPaymentError:r,quoteId:t,invoiceId:i,plugin:n}),{pay:m,isPaying:y}=function({onPaymentSuccess:n,onPaymentError:t,quoteId:i,invoiceId:a,plugin:o}){const{apiHost:r}=e.useContext(te),s=Et(),l=oe(),[u,d]=e.useState(!1);return{pay:async e=>{try{if(d(!0),s){if(!(null==o?void 0:o.id))return void Qt("Plugin ID is required");const t=await s(null==o?void 0:o.id.toString(),e.toString());null==n||n(t)}else{const t=await nt({invoiceId:a,quoteId:i,paymentMethodId:e,token:l,apiHost:r});null==n||n(t)}}catch(n){null==t||t(n)}finally{d(!1)}},isPaying:u}}({onPaymentSuccess:o,onPaymentError:r,quoteId:t,invoiceId:i,plugin:n});return{pay:async n=>{if(!d)return _t("plugin name is required");switch(d){case"StripePayment":return void await c(n);case"DemoPayPayment":return void await m(n);default:return void _t(`Payments are not supported by ${d}`)}},isPaying:p||y}}const Bt=Sn(),Ut=Q();const Vt="function"==typeof p?p:p.default,Ot=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{kt(n.key)||Nt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"cvc",autoFocus:e,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\D/g,"");t(e)},value:o,maxLength:3,placeholder:a||"CVC"})})},Zt=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{kt(n.key)||Nt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"cardNumber",autoFocus:e,maxLength:19,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\s/g,"");t(e)},placeholder:a||"Card Number",value:(s=o,s.replace(/(\d{4})(?=\d)/g,"$1 "))})});var s},zt=({autoFocus:e,onChange:t,placeholder:a,value:o})=>{const r=n=>{kt(n.key)||Nt(n.keyCode)||n.preventDefault()};return n.jsx("div",{className:"bunny-grow",children:n.jsx(i.Input,{name:"expiry",autoFocus:e,onKeyDown:r,onKeyUp:r,onChange:n=>{const e=n.target.value.replace(/\D/g,"");t(e)},value:(s=o,s.length<=2?s:s.substring(0,2)+"/"+s.substring(2)),maxLength:5,placeholder:a||"MM/YY"})});var s},{Text:Kt}=i.Typography,Gt=()=>{const{darkMode:t}=e.useContext(te),[i,a]=Qe();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsxs(Yt,{className:"bunny-flex bunny-flex-col bunny-gap-2",darkMode:null!=t&&t,children:[n.jsx(Zt,{onChange:n=>{a(e=>({...e,number:n}))},value:i.number}),n.jsxs("div",{className:"bunny-flex bunny-gap-2",children:[n.jsx(zt,{onChange:n=>{a(e=>({...e,expiry:n}))},value:i.expiry}),n.jsx(Ot,{onChange:n=>{a(e=>({...e,cvc:n}))},value:i.cvc})]})]}),n.jsx(Kt,{children:"DemoPay is for testing only."})]})},Yt=Vt.div`
2
2
  .ant-input {
3
3
  background-color: ${({darkMode:n})=>n?"var(--row-background-dark)":"white"} !important;
4
4
  }
5
5
  .ant-input:not(:focus) {
6
- border-color: ${({darkMode:n})=>n?"rgb(107 114 128)":j} !important;
6
+ border-color: ${({darkMode:n})=>n?"rgb(107 114 128)":L} !important;
7
7
  }
8
- `,zt=()=>{const[t,i]=e.useState(!1),a=e.useRef(!1);return n.jsxs("form",{children:[n.jsx(u.PaymentElement,{options:{layout:{type:"accordion",defaultCollapsed:!1}},onChange:n=>{"ideal"!==n.value.type||a.current||(a.current=!0,i(!0))}}),n.jsx(Gt,{isOpen:t,onClose:()=>i(!1)})]})};function Gt({isOpen:e,onClose:t}){return n.jsx(i.Modal,{open:e,onCancel:t,footer:n.jsx(i.Button,{type:"primary",onClick:t,children:"Ok"}),children:n.jsx("div",{className:"bunny-p-4",children:"iDEAL will charge a 1 cent fee when storing this payment method. You will be refunded later."})})}const[Yt,Wt]=yn();function Xt({open:t,children:i}){const[a,o]=e.useState(t);return e.useEffect(()=>{t&&o(!0)},[t]),n.jsx("div",{className:"bunny-grid bunny-transition-[grid-template-rows] bunny-duration-300 bunny-ease-in-out "+(t?"bunny-grid-rows-[1fr]":"bunny-grid-rows-[0fr]"),onTransitionEnd:()=>{t||o(!1)},children:n.jsx("div",{className:"bunny-overflow-hidden",children:a&&i})})}const Jt=({className:e})=>n.jsxs("svg",{className:e,width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z",stroke:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M1.5 7.5H16.5",stroke:x,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),{useToken:ni}=i.theme,{Text:ei}=i.Typography,ti=()=>{const{paymentPlugins:e}=Be(),[t,i]=Ve(),{isSaving:a,isPaying:o,isApprovingHold:r}=yt();return n.jsx("div",{className:`bunny-flex bunny-flex-col ${De}`,children:null==e?void 0:e.map((e,s)=>n.jsx(ii,{name:e.name,onClick:i,paymentPluginId:e.id,selected:t===e.id,disabled:a||o||r},s))})},ii=({selected:a,paymentPluginId:o,onClick:r,name:s,disabled:l})=>{const{darkMode:u}=e.useContext(Jn),{token:d}=ni(),c=null==s?void 0:s.toLowerCase().includes("ach");null==s||s.toLowerCase().includes("card");return n.jsxs(ai,{$selected:a,$borderColor:d.colorBorder,$borderRadius:d.borderRadius,$selectedBorderColor:d.colorPrimary,$hoverBorderColor:d.colorPrimaryHover,className:`bunny-flex bunny-justify-between bunny-items-center bunny-cursor-pointer bunny-py-2 bunny-border-solid ${u?"var(--row-background-dark)":"bunny-bg-slate-50"} bunny-border`,onClick:()=>!l&&r(o),children:[n.jsxs("div",{className:"bunny-flex bunny-gap-2 bunny-items-center bunny-pl-4",children:[n.jsx(i.Checkbox,{checked:a,className:u?"border-gray-400":""}),n.jsx(ei,{children:s})]}),c?n.jsx(t.BankOutlined,{className:"bunny-pr-4"}):n.jsx(Jt,{className:"bunny-pr-4"})]})},ai=Rt.div`
8
+ `,Wt=()=>{const[t,i]=e.useState(!1),a=e.useRef(!1);return n.jsxs("form",{children:[n.jsx(d.PaymentElement,{options:{layout:{type:"accordion",defaultCollapsed:!1}},onChange:n=>{"ideal"!==n.value.type||a.current||(a.current=!0,i(!0))}}),n.jsx(Xt,{isOpen:t,onClose:()=>i(!1)})]})};function Xt({isOpen:e,onClose:t}){return n.jsx(i.Modal,{open:e,onCancel:t,footer:n.jsx(i.Button,{type:"primary",onClick:t,children:"Ok"}),children:n.jsx("div",{className:"bunny-p-4",children:"iDEAL will charge a 1 cent fee when storing this payment method. You will be refunded later."})})}const[Jt,ni]=hn();function ei({open:t,children:i}){const[a,o]=e.useState(t);return e.useEffect(()=>{t&&o(!0)},[t]),n.jsx("div",{className:"bunny-grid bunny-transition-[grid-template-rows] bunny-duration-300 bunny-ease-in-out "+(t?"bunny-grid-rows-[1fr]":"bunny-grid-rows-[0fr]"),onTransitionEnd:()=>{t||o(!1)},children:n.jsx("div",{className:"bunny-overflow-hidden",children:a&&i})})}const ti=({className:e})=>n.jsxs("svg",{className:e,width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M15 3.75H3C2.17157 3.75 1.5 4.42157 1.5 5.25V12.75C1.5 13.5784 2.17157 14.25 3 14.25H15C15.8284 14.25 16.5 13.5784 16.5 12.75V5.25C16.5 4.42157 15.8284 3.75 15 3.75Z",stroke:j,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M1.5 7.5H16.5",stroke:j,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),{useToken:ii}=i.theme,{Text:ai}=i.Typography,oi=()=>{const{paymentPlugins:e}=Oe(),[t,i]=ze(),{isSaving:a,isPaying:o,isApprovingHold:r}=ht();return n.jsx("div",{className:`bunny-flex bunny-flex-col ${Ae}`,children:null==e?void 0:e.map((e,s)=>n.jsx(ri,{name:e.name,onClick:i,paymentPluginId:e.id,selected:t===e.id,disabled:a||o||r},s))})},ri=({selected:a,paymentPluginId:o,onClick:r,name:s,disabled:l})=>{const{darkMode:u}=e.useContext(te),{token:d}=ii(),c=null==s?void 0:s.toLowerCase().includes("ach");null==s||s.toLowerCase().includes("card");return n.jsxs(si,{$selected:a,$borderColor:d.colorBorder,$borderRadius:d.borderRadius,$selectedBorderColor:d.colorPrimary,$hoverBorderColor:d.colorPrimaryHover,className:`bunny-flex bunny-justify-between bunny-items-center bunny-cursor-pointer bunny-py-2 bunny-border-solid ${u?"var(--row-background-dark)":"bunny-bg-slate-50"} bunny-border`,onClick:()=>!l&&r(o),children:[n.jsxs("div",{className:"bunny-flex bunny-gap-2 bunny-items-center bunny-pl-4",children:[n.jsx(i.Checkbox,{checked:a,className:u?"border-gray-400":""}),n.jsx(ai,{children:s})]}),c?n.jsx(t.BankOutlined,{className:"bunny-pr-4"}):n.jsx(ti,{className:"bunny-pr-4"})]})},si=Vt.div`
9
9
  border-color: ${({$borderColor:n})=>n};
10
10
  border-radius: ${({$borderRadius:n})=>n}px;
11
11
  transition: border 0.3s ease;
@@ -15,7 +15,7 @@
15
15
  &:hover {
16
16
  border-color: ${({$hoverBorderColor:n})=>n};
17
17
  }
18
- `,oi=Cn();const ri=M();const si=e=>{switch(e){case"StripePayment":return n.jsx(zt,{});case"DemoPayPayment":return n.jsx(Zt,{});default:return console.warn("Can not find form for plugin",e),n.jsx(n.Fragment,{})}},li=Object.assign(function(t={}){var a,o;const{footer:r}=t,{showPaymentMethodForm:s,setShowPaymentMethodForm:l}=Wt(),u=Ze(),d=ft(),{paymentMethods:c}=Fe({accountId:d}),{paymentPlugins:p}=Be(),{isPaying:m,isApprovingHold:y}=yt();return e.useEffect(()=>{0===(null==c?void 0:c.length)&&l(!0)},[c]),n.jsxs("div",{className:`bunny-flex bunny-flex-col ${De}`,children:[!s&&n.jsx(i.Button,{onClick:function(){0===(null==p?void 0:p.length)?ri("No payment plugins available","Error adding payment method"):l(!0)},type:"default",className:"bunny-w-full",id:"addPaymentMethod",disabled:m||y,children:"Add payment method"}),n.jsx(Xt,{open:s,children:n.jsxs("div",{className:`bunny-flex bunny-flex-col ${De}`,children:[p.length>1&&n.jsx(ti,{}),u&&n.jsx("div",{className:"bunny-flex bunny-flex-col",children:si(null===(o=null===(a=u.components)||void 0===a?void 0:a.frontend)||void 0===o?void 0:o[0].name)}),r]})})]})},{Cancel:function(){const e=q(),[,t]=Ct(),{isApprovingHold:a,isPaying:o,isSaving:r}=yt();return n.jsx(i.Button,{className:"bunny-w-full",size:e?"large":"middle",onClick:()=>t(!1),disabled:a||o||r,children:"Cancel"})},Save:function({onClickPrecondition:e,buttonTextOverride:t={text:"Save",isProcessingText:"Saving"}}){const a=ft(),o=q(),{onSavePaymentMethod:r}=Je(),[s,l]=Ct(),{text:u,isProcessingText:d}=t,{save:c,isSaving:p}=Tt({accountId:a,onSaveSuccess:n=>{null==r||r(n),l(!1)},onSaveError:oi,invalidatePaymentMethodsQuery:!0}),m=p?d:u;return n.jsx(i.Button,{className:"bunny-w-full",disabled:p,loading:p,onClick:async()=>{e&&!await e()||c()},size:o?"large":"middle",type:"primary",children:m})}}),ui=({handleSetDefault:n,setDefaultPaymentMethodLoading:t,enabled:i=!0})=>{const o=ft(),r=te(),s=a.useQueryClient(),{paymentMethods:l,defaultPaymentMethod:u}=Fe({accountId:o});e.useEffect(()=>{var e;!t&&i&&(null==l?void 0:l.length)&&(null==l?void 0:l.length)>0&&!u&&(n(null===(e=l[0])||void 0===e?void 0:e.id),function(n){let e=s.getQueryData(E({accountId:o,token:r}));if(e){for(const t of e)t.isDefault=t.id===n.id;s.setQueryData(E({accountId:o,token:r}),e)}}(l[0]))},[l,u,n,t,s,o,r])};const di=M();const ci=Wn("\n fragment PaymentForm_QuoteFragment on Quote {\n id\n currencyId\n ...PaymentProvider_QuoteFragment\n }\n ",[gt]),pi=Wn("\n query GetCurrentUserData {\n company {\n name\n }\n currentUser {\n account {\n billingCountry\n currencyId\n id\n }\n authObjectName\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n entityId\n }\n }\n"),mi=n=>{const{apiHost:t}=e.useContext(Jn),{data:i,isLoading:o}=a.useQuery({queryKey:G(n),queryFn:()=>(async({token:n,apiHost:e})=>{var t,i,a,o,r,s,l,u;const d=await wn(pi,{apiHost:e,token:n},{});return{authObjectName:null===(t=null==d?void 0:d.currentUser)||void 0===t?void 0:t.authObjectName,account:null===(i=null==d?void 0:d.currentUser)||void 0===i?void 0:i.account,companyName:null===(a=null==d?void 0:d.company)||void 0===a?void 0:a.name,returnUrl:null===(r=null===(o=null==d?void 0:d.currentUser)||void 0===o?void 0:o.payload)||void 0===r?void 0:r.returnUrl,privacyUrl:null===(s=null==d?void 0:d.currentUser)||void 0===s?void 0:s.privacyUrl,termsUrl:null===(l=null==d?void 0:d.currentUser)||void 0===l?void 0:l.termsUrl,entityId:null===(u=null==d?void 0:d.currentUser)||void 0===u?void 0:u.entityId}})({token:n,apiHost:t}),enabled:Boolean(n)});return{currentUser:i||{},isCurrentUserDataLoading:o}};const yi=Wn("\n fragment PaymentForm_InvoiceFragment on Invoice {\n id\n currencyId\n ...PaymentProvider_InvoiceFragment\n }\n ",[bt]);function gi({currencyId:t,invoice:i,quote:a,paymentHold:o,onPaymentSuccess:r,onPaymentHoldSuccess:s,checkoutPrecondition:l,accountId:u,onSavePaymentMethod:d,onPaymentMethodRemoved:c,onSetDefaultPaymentMethod:p,customCheckoutFunction:m,children:y}){var g;const b=Yn(ci,a),h=Yn(yi,i),{currencyId:v,isCurrencyIdLoading:f}=function({payableCurrencyId:n,accountCurrencyId:t}){var i;const a=te(),{currentUser:o,isCurrentUserDataLoading:r}=mi(a),s=null==o?void 0:o.account,l=null!==(i=null==s?void 0:s.currencyId)&&void 0!==i?i:t,u=e.useMemo(()=>{var e;return null===(e=null!=l?l:n)||void 0===e?void 0:e.toLowerCase()},[l,n]);return{currencyId:u,isCurrencyIdLoading:r}}({payableCurrencyId:null!==(g=null==b?void 0:b.currencyId)&&void 0!==g?g:null==h?void 0:h.currencyId,accountCurrencyId:t});if(!v)return f?null:n.jsx("div",{children:"PaymentForm error: No currency ID found from Quote or Invoice or props."});const x=[[xt,{value:void 0}],[qt,{value:m}],[vt,{value:u}]];return n.jsx(n.Fragment,{children:x.reduceRight((n,[t,i])=>e.createElement(t,i,n),n.jsx(Ke,{accountId:u,children:n.jsx(Ge,{currencyId:v,children:n.jsx(Ae,{children:n.jsx(Xe,{value:{onPaymentSuccess:r,onSetDefaultPaymentMethod:p,onPaymentMethodRemoved:c,onSavePaymentMethod:d,onPaymentHoldSuccess:s,checkoutPrecondition:l},children:n.jsx(ht,{quote:b,invoice:h,paymentHold:o,children:n.jsx(hi,{children:y})})})})})}))})}function bi(e){return n.jsx(gi,{...e,children:({hasPaymentMethods:t,isPaymentMethodDetailsOpen:i,isPayableAvailable:a,amountDue:o})=>{const r=void 0!==o&&o>0&&!i&&t;return void 0!==o&&0===o?n.jsx(vi.CheckoutNoPayment,{disabled:e.disablePayButton}):n.jsxs("div",{className:`bunny-flex bunny-flex-col ${De}`,children:[t&&n.jsx(vi.StoredPaymentMethods,{}),n.jsx(vi.PaymentMethodDetails,{footer:n.jsxs("div",{className:`bunny-flex bunny-w-full ${De}`,children:[n.jsx(vi.PaymentMethodDetails.Cancel,{}),a&&n.jsx(vi.Pay,{disabled:e.disablePayButton}),!a&&n.jsx(vi.PaymentMethodDetails.Save,{})]})}),r&&n.jsx(vi.Pay,{disabled:e.disablePayButton})]})}})}function hi({children:e}){const[t,i]=Ct(),a=ft(),{quoteId:o,invoiceId:r,amountDue:s}=yt(),{paymentMethods:l}=Fe({accountId:a}),{paymentPlugins:u}=Be(),d={hasPaymentMethods:!!((null==l?void 0:l.length)&&(null==l?void 0:l.length)>0),isPaymentMethodDetailsOpen:t,isPayableAvailable:void 0!==o||void 0!==r,amountDue:s,paymentPluginsCount:null==u?void 0:u.length},c="function"==typeof e?e(d):e;return n.jsx(Yt,{value:{showPaymentMethodForm:t,setShowPaymentMethodForm:i},children:n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-w-full",children:c})})}const vi=Object.assign(function(e){return null!=e.children?n.jsx(gi,{...e}):n.jsx(bi,{...e})},{StoredPaymentMethods:function(t={}){const{className:o}=t,r=ft(),{paymentMethods:s,isLoading:l}=Fe({accountId:r}),{paymentPlugins:u}=Be(),{onSetDefaultPaymentMethod:d,onPaymentMethodRemoved:c}=Je(),{setDefaultPaymentMethod:p,loading:m}=function(n,t){const i=ft(),o=te(),{apiHost:r}=e.useContext(Jn),{paymentPlugins:s}=Be(),{paymentMethods:l}=Fe({accountId:i}),u=M(),d=H(),c=a.useQueryClient(),[p,m]=e.useState(!1),y=e.useCallback(async e=>{const a=null==l?void 0:l.find(n=>(null==n?void 0:n.id)===e);if(void 0===a)return void u("Payment method not found","Error setting default payment method");const p=null==s?void 0:s.find(n=>{var e;return String(n.id)===(null===(e=null==a?void 0:a.plugin)||void 0===e?void 0:e.id)});if(p)m(!0),await Qe({plugin:p,method:"assign_default_payment_method",payload:{payment_method_id:a.id,account_id:i},token:o,apiHost:r}).then(()=>{var n;d(`Payment method ${null===(n=null==a?void 0:a.metadata)||void 0===n?void 0:n.identifier} was set as default`,"Success"),null==t||t(),c.invalidateQueries({queryKey:E({token:o,accountId:i})})}).catch(n=>{m(!1),u(n.message,"Error removing payment method")}).finally(()=>{m(!1)});else{const e=null==s?void 0:s.map(n=>{var e,t,i;return null===(i=null===(t=null===(e=n.components)||void 0===e?void 0:e.frontend)||void 0===t?void 0:t[0])||void 0===i?void 0:i.name});null==n||n(`Either the payment method was not found or the plugin was not present. Available plugins: ${null==e?void 0:e.join(", ")}`)}},[s,o,r,c]);return{setDefaultPaymentMethod:y,loading:p}}(n=>{di(n,"Error setting default payment method")},()=>{null==d||d()});ui({handleSetDefault:p,setDefaultPaymentMethodLoading:m,enabled:!!u});const y=function(n,t){const i=a.useQueryClient(),o=M(),r=H(),s=ft(),{paymentPlugins:l}=Be(),u=te(),{apiHost:d}=e.useContext(Jn),c=e.useCallback(async e=>{const a=null==l?void 0:l.find(n=>{var t;return String(n.id)===String(null===(t=null==e?void 0:e.plugin)||void 0===t?void 0:t.id)});if(e&&a)await Qe({plugin:a,method:"remove_payment_method",payload:{payment_method_id:e.id,account_id:s},token:u,apiHost:d}).then(()=>{r("Payment method was removed","Success"),i.invalidateQueries({queryKey:E({token:u,accountId:s})}),null==n||n(e)}).catch(n=>{o(n.message,"Error removing payment method")});else{const n=null==l?void 0:l.map(n=>{var e,t;const i=n.components;return null===(t=null===(e=null==i?void 0:i.frontend)||void 0===e?void 0:e[0])||void 0===t?void 0:t.name});null==t||t(`Either the payment method was not found or the plugin was not present. Available plugins: ${null==n?void 0:n.join(", ")}`)}},[l,u,d,i,n,s,t]);return c}(c,n=>{di(n,"Error removing payment method")});return l?n.jsx(i.Skeleton,{active:!0,className:"bunny-p-4"}):n.jsxs("div",{className:`bunny-relative bunny-flex bunny-flex-col ${De} ${o}`,children:[null==s?void 0:s.map(e=>{const t=Yn(ke,e);return n.jsx(we,{onClickRemove:()=>y(t),onClickSetDefault:()=>p(null==t?void 0:t.id),paymentMethod:t,id:`payment-method-${t.id}`},null==t?void 0:t.id)}),0===(null==s?void 0:s.length)&&n.jsx(we,{})]})},Pay:function(t={}){const{disabled:a,onClickPrecondition:o}=t,r=q(),{onPaymentSuccess:s,onPaymentHoldSuccess:l,onSavePaymentMethod:u,checkoutPrecondition:d}=Je(),c=Ze(),{quoteId:p,invoiceId:m,paymentHold:y,paymentType:g,setIsPaid:b,setIsPaying:h,setIsApprovingHold:v,setIsSaving:f,setIsApproved:x,isApproved:C,isPaid:w}=yt(),j=ft(),{defaultPaymentMethod:S}=Fe({accountId:j}),[I,L]=Ct(),{save:P,isSaving:k}=Tt({accountId:j,onSaveSuccess:n=>{null==u||u(n)},onSaveError:$t,invalidatePaymentMethodsQuery:!0}),{pay:N,isPaying:F}=Et({plugin:c,quoteId:p,invoiceId:m,onPaymentSuccess:n=>{b(!0),L(!1),null==s||s(n)},onPaymentError:n=>$t(n)}),{approveHold:D,isApprovingHold:T}=jt({plugin:c,onPaymentHoldSuccess:async n=>{x(!0),L(!1),null==l||l(n)},onPaymentHoldError:n=>$t(n)}),A=function(n={}){const{isSaving:e,isPaying:t,isApprovingHold:i}=n,{formattedAmountDue:a,paymentType:o,isPaid:r,isApproved:s}=yt();return r?"Paid "+(null!=a?a:""):s?"Approved hold for "+(null!=a?a:""):(e||t||i?o===pt.APPROVE_HOLD?"Approving hold for":"Paying":o===pt.APPROVE_HOLD?"Approve hold for":"Pay")+" "+(null!=a?a:"")}({isSaving:k,isPaying:F,isApprovingHold:T});return e.useEffect(()=>(h(F),()=>h(!1)),[F,h]),e.useEffect(()=>(v(T),()=>v(!1)),[T,v]),e.useEffect(()=>(f(k),()=>f(!1)),[k,f]),n.jsx(i.Button,{className:"bunny-w-full",disabled:F||T||k||a||C||w,loading:F||T||k,onClick:async()=>{o&&!await o()||async function(){if(d&&!await d())return;if(g===pt.APPROVE_HOLD){if(!y)return void _t("Payment hold is undefined");if(I){const n=await P();return n?void await D({quote:{id:y.quoteId,amount:y.amountToHold},paymentMethodId:n}):void console.error("Saved payment method ID is undefined")}return(null==S?void 0:S.id)?void await D({quote:{id:y.quoteId,amount:y.amountToHold},paymentMethodId:S.id}):void _t("Default payment method ID is undefined")}if(g!==pt.PAY);else if(I){const n=await P();n&&await N(n)}else{if(!(null==S?void 0:S.id))return void _t("Default payment method ID is undefined");await N(null==S?void 0:S.id)}}()},size:r?"large":"middle",type:"primary",children:A})},CheckoutNoPayment:function(t={}){const{className:o,disabled:r,onClickPrecondition:s,buttonTextOverride:l={text:"Complete order",isProcessingText:"Processing..."}}=t,{formattedAmountDue:u,quoteId:d}=yt(),c=te(),{apiHost:p}=e.useContext(Jn),m=A(),{onPaymentSuccess:y}=Je(),{mutate:g,isPending:b}=a.useMutation({mutationFn:async()=>{const n=!u||parseFloat(u)>0;if(!d)throw new Error("Quote ID is required");if(n)throw new Error("Payment is required");return await We({quoteId:d,token:c,apiHost:p})},onSuccess:()=>{null==y||y({})},onError:n=>{m(n)}}),h=b?null==l?void 0:l.isProcessingText:null==l?void 0:l.text;return n.jsx("div",{className:o,children:n.jsx(i.Button,{className:"bunny-w-full",loading:b,disabled:b||r,onClick:async()=>{if(s){if(!await s())return}g()},type:"primary",children:h})})},PaymentMethodDetails:li}),fi=(n,e)=>{const t=(n=>async(e,t,i,a,o)=>{const r=await fetch(e,{method:t,body:o,headers:pn({token:a})});return 200!==r.status&&201!==r.status?r.json().then(e=>{if(401!==r.status)throw new Error(null==e?void 0:e.message);console.error("expired token"),null==n||n("expired token")}):i(r)})(e);return(e,i)=>t(e+(n?`?id=${n}`:""),"GET",async n=>{let e=await n.blob(),t=window.URL.createObjectURL(e),i=n.headers.get("content-disposition"),a=document.createElement("a");if(a.href=t,i&&-1!==i.indexOf("attachment")){var o=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(i);null!=o&&o[1]&&a.setAttribute("download",o[1].replace(/['"]/g,""))}a.click()},i)},{Text:xi}=i.Typography;function Ci({onClick:e,title:t}){const{brandColor:i}=bn();return n.jsxs(wi,{brandColor:i,className:"bunny-flex bunny-items-center bunny-gap-2 bunny-p-0 bunny-text-gray-400",onClick:e,children:[n.jsx(m.FontAwesomeIcon,{className:"pt-0.5",icon:p.faArrowLeft}),n.jsx(xi,{className:"bunny-text-sm bunny-text-gray-400 bunny-text-nowrap",children:t||"back"})]})}const wi=c.button.withConfig({shouldForwardProp:n=>!["brandColor"].includes(n)})`
18
+ `,li=Sn();const ui=Q();const di=e=>{switch(e){case"StripePayment":return n.jsx(Wt,{});case"DemoPayPayment":return n.jsx(Gt,{});default:return console.warn("Can not find form for plugin",e),n.jsx(n.Fragment,{})}},ci=Object.assign(function(t={}){var a,o;const{footer:r}=t,{showPaymentMethodForm:s,setShowPaymentMethodForm:l}=ni(),u=Ge(),d=wt(),{paymentMethods:c}=qe({accountId:d}),{paymentPlugins:p}=Oe(),{isPaying:m,isApprovingHold:y}=ht();return e.useEffect(()=>{0===(null==c?void 0:c.length)&&l(!0)},[c]),n.jsxs("div",{className:`bunny-flex bunny-flex-col ${Ae}`,children:[!s&&n.jsx(i.Button,{onClick:function(){0===(null==p?void 0:p.length)?ui("No payment plugins available","Error adding payment method"):l(!0)},type:"default",className:"bunny-w-full",id:"addPaymentMethod",disabled:m||y,children:"Add payment method"}),n.jsx(ei,{open:s,children:n.jsxs("div",{className:`bunny-flex bunny-flex-col ${Ae}`,children:[p.length>1&&n.jsx(oi,{}),u&&n.jsx("div",{className:"bunny-flex bunny-flex-col",children:di(null===(o=null===(a=u.components)||void 0===a?void 0:a.frontend)||void 0===o?void 0:o[0].name)}),r]})})]})},{Cancel:function(){const e=H(),[,t]=St(),{isApprovingHold:a,isPaying:o,isSaving:r}=ht();return n.jsx(i.Button,{className:"bunny-w-full",size:e?"large":"middle",onClick:()=>t(!1),disabled:a||o||r,children:"Cancel"})},Save:function({onClickPrecondition:e,buttonTextOverride:t={text:"Save",isProcessingText:"Saving"}}){const a=wt(),o=H(),{onSavePaymentMethod:r}=tt(),[s,l]=St(),{text:u,isProcessingText:d}=t,{save:c,isSaving:p}=Mt({accountId:a,onSaveSuccess:n=>{null==r||r(n),l(!1)},onSaveError:li,invalidatePaymentMethodsQuery:!0}),m=p?d:u;return n.jsx(i.Button,{className:"bunny-w-full",disabled:p,loading:p,onClick:async()=>{e&&!await e()||c()},size:o?"large":"middle",type:"primary",children:m})}}),pi=({handleSetDefault:n,setDefaultPaymentMethodLoading:t,enabled:i=!0})=>{const o=wt(),r=oe(),s=a.useQueryClient(),{paymentMethods:l,defaultPaymentMethod:u}=qe({accountId:o});e.useEffect(()=>{var e;!t&&i&&(null==l?void 0:l.length)&&(null==l?void 0:l.length)>0&&!u&&(n(null===(e=l[0])||void 0===e?void 0:e.id),function(n){let e=s.getQueryData(R({accountId:o,token:r}));if(e){for(const t of e)t.isDefault=t.id===n.id;s.setQueryData(R({accountId:o,token:r}),e)}}(l[0]))},[l,u,n,t,s,o,r])};const mi=Q();const yi=ne("\n fragment PaymentForm_QuoteFragment on Quote {\n id\n currencyId\n ...PaymentProvider_QuoteFragment\n }\n ",[vt]),gi=ne("\n query GetCurrentUserData {\n company {\n name\n }\n currentUser {\n account {\n billingCountry\n currencyId\n id\n }\n authObjectName\n payload {\n returnUrl\n }\n privacyUrl\n termsUrl\n entityId\n }\n }\n"),bi=n=>{const{apiHost:t}=e.useContext(te),{data:i,isLoading:o}=a.useQuery({queryKey:X(n),queryFn:()=>(async({token:n,apiHost:e})=>{var t,i,a,o,r,s,l,u;const d=await In(gi,{apiHost:e,token:n},{});return{authObjectName:null===(t=null==d?void 0:d.currentUser)||void 0===t?void 0:t.authObjectName,account:null===(i=null==d?void 0:d.currentUser)||void 0===i?void 0:i.account,companyName:null===(a=null==d?void 0:d.company)||void 0===a?void 0:a.name,returnUrl:null===(r=null===(o=null==d?void 0:d.currentUser)||void 0===o?void 0:o.payload)||void 0===r?void 0:r.returnUrl,privacyUrl:null===(s=null==d?void 0:d.currentUser)||void 0===s?void 0:s.privacyUrl,termsUrl:null===(l=null==d?void 0:d.currentUser)||void 0===l?void 0:l.termsUrl,entityId:null===(u=null==d?void 0:d.currentUser)||void 0===u?void 0:u.entityId}})({token:n,apiHost:t}),enabled:Boolean(n)});return{currentUser:i||{},isCurrentUserDataLoading:o}};const hi=ne("\n fragment PaymentForm_InvoiceFragment on Invoice {\n id\n currencyId\n ...PaymentProvider_InvoiceFragment\n }\n ",[ft]);function vi({currencyId:t,invoice:i,quote:a,paymentHold:o,onPaymentSuccess:r,onPaymentHoldSuccess:s,checkoutPrecondition:l,accountId:u,onSavePaymentMethod:d,onPaymentMethodRemoved:c,onSetDefaultPaymentMethod:p,customCheckoutFunction:m,children:y}){var g;const b=Jn(yi,a),h=Jn(hi,i),{currencyId:v,isCurrencyIdLoading:f}=function({payableCurrencyId:n,accountCurrencyId:t}){var i;const a=oe(),{currentUser:o,isCurrentUserDataLoading:r}=bi(a),s=null==o?void 0:o.account,l=null!==(i=null==s?void 0:s.currencyId)&&void 0!==i?i:t,u=e.useMemo(()=>{var e;return null===(e=null!=l?l:n)||void 0===e?void 0:e.toLowerCase()},[l,n]);return{currencyId:u,isCurrencyIdLoading:r}}({payableCurrencyId:null!==(g=null==b?void 0:b.currencyId)&&void 0!==g?g:null==h?void 0:h.currencyId,accountCurrencyId:t});if(!v)return f?null:n.jsx("div",{children:"PaymentForm error: No currency ID found from Quote or Invoice or props."});const x=[[jt,{value:void 0}],[Ht,{value:m}],[Ct,{value:u}]];return n.jsx(n.Fragment,{children:x.reduceRight((n,[t,i])=>e.createElement(t,i,n),n.jsx(Ye,{accountId:u,children:n.jsx(Xe,{currencyId:v,children:n.jsx(Ee,{children:n.jsx(et,{value:{onPaymentSuccess:r,onSetDefaultPaymentMethod:p,onPaymentMethodRemoved:c,onSavePaymentMethod:d,onPaymentHoldSuccess:s,checkoutPrecondition:l},children:n.jsx(xt,{quote:b,invoice:h,paymentHold:o,children:n.jsx(xi,{children:y})})})})})}))})}function fi(e){return n.jsx(vi,{...e,children:({hasPaymentMethods:t,isPaymentMethodDetailsOpen:i,isPayableAvailable:a,amountDue:o})=>{const r=void 0!==o&&o>0&&!i&&t;return void 0!==o&&0===o?n.jsx(Ci.CheckoutNoPayment,{disabled:e.disablePayButton}):n.jsxs("div",{className:`bunny-flex bunny-flex-col ${Ae}`,children:[t&&n.jsx(Ci.StoredPaymentMethods,{}),n.jsx(Ci.PaymentMethodDetails,{footer:n.jsxs("div",{className:`bunny-flex bunny-w-full ${Ae}`,children:[n.jsx(Ci.PaymentMethodDetails.Cancel,{}),a&&n.jsx(Ci.Pay,{disabled:e.disablePayButton}),!a&&n.jsx(Ci.PaymentMethodDetails.Save,{})]})}),r&&n.jsx(Ci.Pay,{disabled:e.disablePayButton})]})}})}function xi({children:e}){const[t,i]=St(),a=wt(),{quoteId:o,invoiceId:r,amountDue:s}=ht(),{paymentMethods:l}=qe({accountId:a}),{paymentPlugins:u}=Oe(),d={hasPaymentMethods:!!((null==l?void 0:l.length)&&(null==l?void 0:l.length)>0),isPaymentMethodDetailsOpen:t,isPayableAvailable:void 0!==o||void 0!==r,amountDue:s,paymentPluginsCount:null==u?void 0:u.length},c="function"==typeof e?e(d):e;return n.jsx(Jt,{value:{showPaymentMethodForm:t,setShowPaymentMethodForm:i},children:n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-w-full",children:c})})}const Ci=Object.assign(function(e){return null!=e.children?n.jsx(vi,{...e}):n.jsx(fi,{...e})},{StoredPaymentMethods:function(t={}){const{className:o}=t,r=wt(),{paymentMethods:s,isLoading:l}=qe({accountId:r}),{paymentPlugins:u}=Oe(),{onSetDefaultPaymentMethod:d,onPaymentMethodRemoved:c}=tt(),{setDefaultPaymentMethod:p,loading:m}=function(n,t){const i=wt(),o=oe(),{apiHost:r}=e.useContext(te),{paymentPlugins:s}=Oe(),{paymentMethods:l}=qe({accountId:i}),u=Q(),d=$(),c=a.useQueryClient(),[p,m]=e.useState(!1),y=e.useCallback(async e=>{const a=null==l?void 0:l.find(n=>(null==n?void 0:n.id)===e);if(void 0===a)return void u("Payment method not found","Error setting default payment method");const p=null==s?void 0:s.find(n=>{var e;return String(n.id)===(null===(e=null==a?void 0:a.plugin)||void 0===e?void 0:e.id)});if(p)m(!0),await _e({plugin:p,method:"assign_default_payment_method",payload:{payment_method_id:a.id,account_id:i},token:o,apiHost:r}).then(()=>{var n;d(`Payment method ${null===(n=null==a?void 0:a.metadata)||void 0===n?void 0:n.identifier} was set as default`,"Success"),null==t||t(),c.invalidateQueries({queryKey:R({token:o,accountId:i})})}).catch(n=>{m(!1),u(n.message,"Error removing payment method")}).finally(()=>{m(!1)});else{const e=null==s?void 0:s.map(n=>{var e,t,i;return null===(i=null===(t=null===(e=n.components)||void 0===e?void 0:e.frontend)||void 0===t?void 0:t[0])||void 0===i?void 0:i.name});null==n||n(`Either the payment method was not found or the plugin was not present. Available plugins: ${null==e?void 0:e.join(", ")}`)}},[s,o,r,c]);return{setDefaultPaymentMethod:y,loading:p}}(n=>{mi(n,"Error setting default payment method")},()=>{null==d||d()});pi({handleSetDefault:p,setDefaultPaymentMethodLoading:m,enabled:!!u});const y=function(n,t){const i=a.useQueryClient(),o=Q(),r=$(),s=wt(),{paymentPlugins:l}=Oe(),u=oe(),{apiHost:d}=e.useContext(te),c=e.useCallback(async e=>{const a=null==l?void 0:l.find(n=>{var t;return String(n.id)===String(null===(t=null==e?void 0:e.plugin)||void 0===t?void 0:t.id)});if(e&&a)await _e({plugin:a,method:"remove_payment_method",payload:{payment_method_id:e.id,account_id:s},token:u,apiHost:d}).then(()=>{r("Payment method was removed","Success"),i.invalidateQueries({queryKey:R({token:u,accountId:s})}),null==n||n(e)}).catch(n=>{o(n.message,"Error removing payment method")});else{const n=null==l?void 0:l.map(n=>{var e,t;const i=n.components;return null===(t=null===(e=null==i?void 0:i.frontend)||void 0===e?void 0:e[0])||void 0===t?void 0:t.name});null==t||t(`Either the payment method was not found or the plugin was not present. Available plugins: ${null==n?void 0:n.join(", ")}`)}},[l,u,d,i,n,s,t]);return c}(c,n=>{mi(n,"Error removing payment method")});return l?n.jsx(i.Skeleton,{active:!0,className:"bunny-p-4"}):n.jsxs("div",{className:`bunny-relative bunny-flex bunny-flex-col ${Ae} ${o}`,children:[null==s?void 0:s.map(e=>{const t=Jn(De,e);return n.jsx(Ie,{onClickRemove:()=>y(t),onClickSetDefault:()=>p(null==t?void 0:t.id),paymentMethod:t,id:`payment-method-${t.id}`},null==t?void 0:t.id)}),0===(null==s?void 0:s.length)&&n.jsx(Ie,{})]})},Pay:function(t={}){const{disabled:a,onClickPrecondition:o}=t,r=H(),{onPaymentSuccess:s,onPaymentHoldSuccess:l,onSavePaymentMethod:u,checkoutPrecondition:d}=tt(),c=Ge(),{quoteId:p,invoiceId:m,paymentHold:y,paymentType:g,setIsPaid:b,setIsPaying:h,setIsApprovingHold:v,setIsSaving:f,setIsApproved:x,isApproved:C,isPaid:w}=ht(),j=wt(),{defaultPaymentMethod:S}=qe({accountId:j}),[I,L]=St(),{save:P,isSaving:k}=Mt({accountId:j,onSaveSuccess:n=>{null==u||u(n)},onSaveError:Bt,invalidatePaymentMethodsQuery:!0}),{pay:N,isPaying:F}=Rt({plugin:c,quoteId:p,invoiceId:m,onPaymentSuccess:n=>{b(!0),L(!1),null==s||s(n)},onPaymentError:n=>Bt(n)}),{approveHold:D,isApprovingHold:T}=Lt({plugin:c,onPaymentHoldSuccess:async n=>{x(!0),L(!1),null==l||l(n)},onPaymentHoldError:n=>Bt(n)}),q=function(n={}){const{isSaving:e,isPaying:t,isApprovingHold:i}=n,{formattedAmountDue:a,paymentType:o,isPaid:r,isApproved:s}=ht();return r?"Paid "+(null!=a?a:""):s?"Approved hold for "+(null!=a?a:""):(e||t||i?o===gt.APPROVE_HOLD?"Approving hold for":"Paying":o===gt.APPROVE_HOLD?"Approve hold for":"Pay")+" "+(null!=a?a:"")}({isSaving:k,isPaying:F,isApprovingHold:T});return e.useEffect(()=>(h(F),()=>h(!1)),[F,h]),e.useEffect(()=>(v(T),()=>v(!1)),[T,v]),e.useEffect(()=>(f(k),()=>f(!1)),[k,f]),n.jsx(i.Button,{className:"bunny-w-full",disabled:F||T||k||a||C||w,loading:F||T||k,onClick:async()=>{o&&!await o()||async function(){if(d&&!await d())return;if(g===gt.APPROVE_HOLD){if(!y)return void Ut("Payment hold is undefined");if(I){const n=await P();return n?void await D({quote:{id:y.quoteId,amount:y.amountToHold},paymentMethodId:n}):void console.error("Saved payment method ID is undefined")}return(null==S?void 0:S.id)?void await D({quote:{id:y.quoteId,amount:y.amountToHold},paymentMethodId:S.id}):void Ut("Default payment method ID is undefined")}if(g!==gt.PAY);else if(I){const n=await P();n&&await N(n)}else{if(!(null==S?void 0:S.id))return void Ut("Default payment method ID is undefined");await N(null==S?void 0:S.id)}}()},size:r?"large":"middle",type:"primary",children:q})},CheckoutNoPayment:function(t={}){const{className:o,disabled:r,onClickPrecondition:s,buttonTextOverride:l={text:"Complete order",isProcessingText:"Processing..."}}=t,{formattedAmountDue:u,quoteId:d}=ht(),c=oe(),{apiHost:p}=e.useContext(te),m=E(),{onPaymentSuccess:y}=tt(),{mutate:g,isPending:b}=a.useMutation({mutationFn:async()=>{const n=!u||parseFloat(u)>0;if(!d)throw new Error("Quote ID is required");if(n)throw new Error("Payment is required");return await nt({quoteId:d,token:c,apiHost:p})},onSuccess:()=>{null==y||y({})},onError:n=>{m(n)}}),h=b?null==l?void 0:l.isProcessingText:null==l?void 0:l.text;return n.jsx("div",{className:o,children:n.jsx(i.Button,{className:"bunny-w-full",loading:b,disabled:b||r,onClick:async()=>{if(s){if(!await s())return}g()},type:"primary",children:h})})},PaymentMethodDetails:ci}),wi=(n,e)=>{const t=(n=>async(e,t,i,a,o)=>{const r=await fetch(e,{method:t,body:o,headers:gn({token:a})});return 200!==r.status&&201!==r.status?r.json().then(e=>{if(401!==r.status)throw new Error(null==e?void 0:e.message);console.error("expired token"),null==n||n("expired token")}):i(r)})(e);return(e,i)=>t(e+(n?`?id=${n}`:""),"GET",async n=>{let e=await n.blob(),t=window.URL.createObjectURL(e),i=n.headers.get("content-disposition"),a=document.createElement("a");if(a.href=t,i&&-1!==i.indexOf("attachment")){var o=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(i);null!=o&&o[1]&&a.setAttribute("download",o[1].replace(/['"]/g,""))}a.click()},i)},{Text:ji}=i.Typography;function Si({onClick:e,title:t}){const{brandColor:i}=fn();return n.jsxs(Ii,{brandColor:i,className:"bunny-flex bunny-items-center bunny-gap-2 bunny-p-0 bunny-text-gray-400",onClick:e,children:[n.jsx(y.FontAwesomeIcon,{className:"pt-0.5",icon:m.faArrowLeft}),n.jsx(ji,{className:"bunny-text-sm bunny-text-gray-400 bunny-text-nowrap",children:t||"back"})]})}const Ii=p.button.withConfig({shouldForwardProp:n=>!["brandColor"].includes(n)})`
19
19
  border: none;
20
20
  cursor: pointer;
21
21
  outline: none;
@@ -25,11 +25,11 @@
25
25
  &:hover {
26
26
  color: ${n=>n.brandColor||"inherit"} !important;
27
27
  }
28
- `;if("undefined"!=typeof window){const n=document.createElement.bind(document);document.createElement=function(e,t){const i=n(e,t);if("div"===e.toLowerCase()){const n=i.attachShadow;i.attachShadow=function(e){var t;const i=n.call(this,e),a=null===(t=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"))||void 0===t?void 0:t.set;if(a)try{Object.defineProperty(i,"innerHTML",{configurable:!0,set:function(n){"string"==typeof n&&n.includes("background-image: url(data:image/webp")||a.call(this,n)},get:function(){return this.innerHTML}})}catch(n){}return i}}return i}}const ji="bunny-flex bunny-h-full bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col",Si=`${ji} bunny-shrink-0 bunny-overflow-hidden bunny-rounded`,Ii=({onFullscreenApiChange:n})=>{const{toggleFullScreen:t}=g.useFullScreenContext(),i=e.useRef(t),a=e.useRef(n);return i.current=t,a.current=n,e.useEffect(()=>{var n;const e={toggleFullScreen:()=>i.current()};return null===(n=a.current)||void 0===n||n.call(a,e),()=>{var n;null===(n=a.current)||void 0===n||n.call(a,null)}},[]),null},Li=({targetUrl:t,onFullscreenApiChange:o})=>{const[r,s]=e.useState(null),l=a.useQueryClient(),{apiHost:u,token:d}=e.useContext(Jn),c=q(),p=e.useMemo(()=>["documentTemplatePreview",t],[t]);e.useEffect(()=>{l.removeQueries({queryKey:p})},[l,p]);const{data:m,isLoading:y}=a.useQuery({queryKey:p,queryFn:async()=>{const n=await He({endpoint:t,apiHost:u,token:d});if(!n.ok)throw new Error("Failed to fetch PDF");return await n.blob()},enabled:!!t});return e.useEffect(()=>{if(m){const n=URL.createObjectURL(m);return s(n),()=>{URL.revokeObjectURL(n)}}},[m]),y?n.jsx("div",{className:"flex items-center justify-center h-96",children:n.jsx(i.Spin,{})}):r?n.jsx("div",{className:c?"bunny-flex bunny-flex-col bunny-w-full bunny-shrink-0 bunny-overflow-hidden bunny-rounded":Si,style:c?{height:"50vh"}:void 0,children:n.jsx(g.RPConfig,{licenseKey:"eyJkYXRhIjoiZXlKMElqb2liM0puWVc1cGVtRjBhVzl1SWl3aVlYWjFJam94TnpneU5ETXhPVGs1TENKa2JTSTZJbUoxYm01NUxtTnZiU0lzSW00aU9pSmhOV1F5TWpKaFpXTTNOelF5TkdFNUlpd2laWGh3SWpveE56WTJORFEzT1RrNUxDSmtiWFFpT2lKM2FXeGtZMkZ5WkNKOSIsInNpZ25hdHVyZSI6ImdJWW5BYWp0WW1aSHV1b1RrTkZCZnRGYjEzUTJOZXZwQXlKRmszdy9STDNUa08rRXZYWlV0MDZxenBrZWdOK1A4TXlkbFY1aityemQvM1VpYlB5SW1VSzAweHZSVk5hS29EOXB0cVpkbjR5SWRRdE1pU1NjZ0J1K1RkM0NXM2FONVNrdlNJVDEyTGpBMnVVYll2RmJ6RFpMci9hODkwa05sT0NQZURoVjMyd0w3R0NrTnV2Z1MyZlk5Mis0L25FdUdvZXBZR0RPN0Ryb3NaOGVlbnJ6b1BsQ044T204eFlMNXJxdUkvS2xLVTVYaGN0allrdzBTR0FlL0pDR1dTN1dLTDAvYmFvbS9GS1ltNU91VmlzcmlDVlc2UXgvbzBnTGE4bUtXLytMb3pNaHdFemdtU2I2S0xERzZpTEVPL0czQ2pYN2p2dTU1NEc4OUx2aW1BaE5BQT09In0=",children:n.jsxs(g.RPProvider,{src:r,children:[n.jsx(Ii,{onFullscreenApiChange:o}),n.jsx("div",{className:c?"bunny-flex bunny-h-full bunny-w-full bunny-flex-1 bunny-flex-col":ji,children:n.jsx(g.RPPages,{})})]})})}):n.jsx(n.Fragment,{})},{useToken:Pi}=i.theme,ki=({html:e,targetUrl:t,onDocumentPreviewFullscreenApiChange:i})=>{const{token:a}=Pi();return t?n.jsx("div",{className:"bunny-flex bunny-h-full bunny-w-full",style:{fontFamily:a.fontFamily},children:n.jsx(Li,{targetUrl:t,onFullscreenApiChange:i})}):n.jsx("div",{style:{fontFamily:a.fontFamily},children:n.jsx(y.Markup,{content:e})})},Ni=Rt.div`
28
+ `;if("undefined"!=typeof window){const n=document.createElement.bind(document);document.createElement=function(e,t){const i=n(e,t);if("div"===e.toLowerCase()){const n=i.attachShadow;i.attachShadow=function(e){var t;const i=n.call(this,e),a=null===(t=Object.getOwnPropertyDescriptor(ShadowRoot.prototype,"innerHTML"))||void 0===t?void 0:t.set;if(a)try{Object.defineProperty(i,"innerHTML",{configurable:!0,set:function(n){"string"==typeof n&&n.includes("background-image: url(data:image/webp")||a.call(this,n)},get:function(){return this.innerHTML}})}catch(n){}return i}}return i}}const Li="bunny-flex bunny-h-full bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col",Pi=`${Li} bunny-shrink-0 bunny-overflow-hidden bunny-rounded`,ki=({onFullscreenApiChange:n})=>{const{toggleFullScreen:t}=b.useFullScreenContext(),i=e.useRef(t),a=e.useRef(n);return i.current=t,a.current=n,e.useEffect(()=>{var n;const e={toggleFullScreen:()=>i.current()};return null===(n=a.current)||void 0===n||n.call(a,e),()=>{var n;null===(n=a.current)||void 0===n||n.call(a,null)}},[]),null},Ni=({targetUrl:t,onFullscreenApiChange:o})=>{const[r,s]=e.useState(null),l=a.useQueryClient(),{apiHost:u,token:d}=e.useContext(te),c=H(),p=e.useMemo(()=>["documentTemplatePreview",t],[t]);e.useEffect(()=>{l.removeQueries({queryKey:p})},[l,p]);const{data:m,isLoading:y}=a.useQuery({queryKey:p,queryFn:async()=>{const n=await $e({endpoint:t,apiHost:u,token:d});if(!n.ok)throw new Error("Failed to fetch PDF");return await n.blob()},enabled:!!t});return e.useEffect(()=>{if(m){const n=URL.createObjectURL(m);return s(n),()=>{URL.revokeObjectURL(n)}}},[m]),y?n.jsx("div",{className:"flex items-center justify-center h-96",children:n.jsx(i.Spin,{})}):r?n.jsx("div",{className:c?"bunny-flex bunny-flex-col bunny-w-full bunny-shrink-0 bunny-overflow-hidden bunny-rounded":Pi,style:c?{height:"50vh"}:void 0,children:n.jsx(b.RPConfig,{licenseKey:"eyJkYXRhIjoiZXlKMElqb2liM0puWVc1cGVtRjBhVzl1SWl3aVlYWjFJam94TnpneU5ETXhPVGs1TENKa2JTSTZJbUoxYm01NUxtTnZiU0lzSW00aU9pSmhOV1F5TWpKaFpXTTNOelF5TkdFNUlpd2laWGh3SWpveE56WTJORFEzT1RrNUxDSmtiWFFpT2lKM2FXeGtZMkZ5WkNKOSIsInNpZ25hdHVyZSI6ImdJWW5BYWp0WW1aSHV1b1RrTkZCZnRGYjEzUTJOZXZwQXlKRmszdy9STDNUa08rRXZYWlV0MDZxenBrZWdOK1A4TXlkbFY1aityemQvM1VpYlB5SW1VSzAweHZSVk5hS29EOXB0cVpkbjR5SWRRdE1pU1NjZ0J1K1RkM0NXM2FONVNrdlNJVDEyTGpBMnVVYll2RmJ6RFpMci9hODkwa05sT0NQZURoVjMyd0w3R0NrTnV2Z1MyZlk5Mis0L25FdUdvZXBZR0RPN0Ryb3NaOGVlbnJ6b1BsQ044T204eFlMNXJxdUkvS2xLVTVYaGN0allrdzBTR0FlL0pDR1dTN1dLTDAvYmFvbS9GS1ltNU91VmlzcmlDVlc2UXgvbzBnTGE4bUtXLytMb3pNaHdFemdtU2I2S0xERzZpTEVPL0czQ2pYN2p2dTU1NEc4OUx2aW1BaE5BQT09In0=",children:n.jsxs(b.RPProvider,{src:r,children:[n.jsx(ki,{onFullscreenApiChange:o}),n.jsx("div",{className:c?"bunny-flex bunny-h-full bunny-w-full bunny-flex-1 bunny-flex-col":Li,children:n.jsx(b.RPPages,{})})]})})}):n.jsx(n.Fragment,{})},{useToken:Fi}=i.theme,Di=({html:e,targetUrl:t,onDocumentPreviewFullscreenApiChange:i})=>{const{token:a}=Fi();return t?n.jsx("div",{className:"bunny-flex bunny-h-full bunny-w-full",style:{fontFamily:a.fontFamily},children:n.jsx(Ni,{targetUrl:t,onFullscreenApiChange:i})}):n.jsx("div",{style:{fontFamily:a.fontFamily},children:n.jsx(g.Markup,{content:e})})},Ti=Vt.div`
29
29
  span {
30
30
  width: 100%;
31
31
  }
32
- `,Fi=({children:a,formattedInvoice:o,html:r,backButtonName:s,onBackButtonClick:l,onDownloadError:u,targetUrl:d,onDocumentPreviewFullscreenApiChange:c})=>{const p=fi(null==o?void 0:o.id,u),{apiHost:m}=e.useContext(Jn),y=te(),{shadow:g,hideDownloadButton:b}=e.useContext(sn),h=q(),v=o&&(!b||l);return n.jsxs("div",{className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col "+(h?"bunny-overflow-hidden":""),children:[v?n.jsxs("div",{className:"bunny-flex bunny-justify-between bunny-items-center bunny-pb-4 "+(h?"bunny-shadow-padding-x":""),id:"acceptance",children:[n.jsx("div",{children:l?n.jsx(Ci,{onClick:l,title:s}):null}),b?null:n.jsx(i.Button,{icon:n.jsx(t.DownloadOutlined,{}),onClick:()=>p(m+"/api/pdf/invoice/"+o.id,y),children:"Download"})]}):null,n.jsxs(Ni,{className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col bunny-gap-4 "+(h?"bunny-overflow-auto":`bunny-py-4 bunny-bg-white ${g||"shadow-md"} bunny-rounded-md`),children:[n.jsx(ki,{html:r,targetUrl:d,onDocumentPreviewFullscreenApiChange:c}),a]})]})};function Di({id:e,invoiceQuoteViewComponent:t,backButtonName:i,onBackButtonClick:a,onInvoiceDownloadError:o,onPaymentSuccess:r,shadow:s="shadow-md",className:l,hideDownloadButton:u=!1,hidePaymentForm:d=!1,onInvoiceLoaded:c,onPaymentMethodSaved:p,onPaymentMethodRemoved:m}){return n.jsx(sn.Provider,{value:{id:e,invoiceQuoteViewComponent:t,backButtonName:i,onBackButtonClick:a,onInvoiceDownloadError:o,onPaymentSuccess:r,shadow:s,className:l,hideDownloadButton:u,onInvoiceLoaded:c},children:n.jsx(Ti,{hidePaymentForm:d,onSavePaymentMethod:p,onPaymentMethodRemoved:m})})}function Ti({hidePaymentForm:t,onSavePaymentMethod:i,onPaymentMethodRemoved:o}){const r=a.useQueryClient(),{id:s,invoiceQuoteViewComponent:l,backButtonName:u,onBackButtonClick:d,onPaymentSuccess:c,className:p}=e.useContext(sn),{apiHost:m}=e.useContext(Jn),{hideDownloadButton:y,onInvoiceLoaded:g}=e.useContext(sn),b=te(),h=H(),{data:v}=a.useQuery({queryKey:U({id:s,token:b}),queryFn:()=>(async({id:n,token:e,apiHost:t})=>{const i={id:n},a=await cn({query:"\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}",token:e,vars:i,apiHost:t});return null==a?void 0:a.formattedInvoice})({id:s,token:b,apiHost:m})}),f=L.includes((null==v?void 0:v.state)||""),x=q(f?T.lg:void 0);return e.useEffect(()=>{v&&(null==g||g(v))},[v]),v?n.jsx("div",{className:"bunny-invoice-container",children:n.jsxs("div",{className:`bunny-flex bunny-gap-6 ${x?"bunny-flex-col bunny-w-full":""} ${p}`,children:[v.isLegacy?n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-w-full",children:n.jsx(ie,{documentUuid:v.uuid,documentType:"invoice"})}):l||n.jsx(Fi,{html:v.html,formattedInvoice:v,backButtonName:u,onBackButtonClick:d}),f&&!t&&n.jsx("div",{className:"bunny-w-full "+(y||v.isLegacy?"":"pt-12"),style:{maxWidth:x?void 0:"350px"},children:n.jsx(vi,{onPaymentSuccess:()=>{r.invalidateQueries({queryKey:J({token:b})}),r.invalidateQueries({queryKey:U({id:s,token:b})}),h("Your invoice has been paid","Payment successful"),null==c||c()},invoice:v,onSavePaymentMethod:n=>{null==i||i(n)},onPaymentMethodRemoved:n=>{null==o||o(n.id)}})})]})}):n.jsx(n.Fragment,{})}const qi=(n,e,t)=>{const i=((n,e,t)=>async(i,a=null,o,r)=>{a=a.replace(/\s+/g," ");const s=pn({token:o}),l=await fetch(e+"/graphql",{method:"post",body:a,headers:s});return 200!==l.status&&201!==l.status?l.json().then(e=>{var i,a,o;if(e.errors)t(e.errors[0].message);else if("Token is expired"===(null===(i=null==e?void 0:e[0])||void 0===i?void 0:i.description))n();else if(null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.description)throw new Error(null===(o=null==e?void 0:e[0])||void 0===o?void 0:o.description)}):l.json().then(n=>i(n,r)).catch(n=>{console.error(n),t(n)})})(n,e,t);return(n,e,t,a,o)=>("object"==typeof e&&(e=JSON.stringify(e)),i(t,`{ "query": "${n}", "variables": ${e} }`,a,o))},Ai=({isVisible:t,setVisible:a,id:o})=>{const{apiHost:r,onTokenExpired:s}=e.useContext(Jn),l=te(),u=qi(()=>{console.log("graphQLMutation navigateOnTokenExpired not yet implemented")},r||"",()=>{console.log("graphQLMutation onError not yet implemented")}),d=A(s),[c,p]=e.useState(0),[m,y]=e.useState("");return e.useEffect(()=>{if(!t)return;const n=setInterval(()=>{u("mutation quotePollSigningUrl($id: ID) {\n quotePollSigningUrl(quoteId: $id) {\n redirectUri\n status\n errors\n infoMessage\n }\n }",{id:o},n=>{n.errors?d(n.errors[0].message):"document.sent"===n.data.quotePollSigningUrl.status&&(a(!1),window.location.href=n.data.quotePollSigningUrl.redirectUri),y(n.data.quotePollSigningUrl.infoMessage||"")},l),p(c+1)},2e3);return()=>clearInterval(n)},[u,c,l,t,a]),n.jsxs(i.Modal,{title:"Uploading quote to Pandadoc",open:t,closable:!1,footer:null,children:[n.jsxs("div",{className:"bunny-py-4 bunny-text-center",children:["This may take a few seconds",".".repeat(c)]}),n.jsx("div",{className:"bunny-text-center",children:m})]})},Mi=({apiHost:n,token:e})=>a.useQuery({queryKey:W(e),queryFn:async()=>await Hi({token:e,apiHost:n}),placeholderData:a.keepPreviousData}),Hi=async({token:n,apiHost:e})=>{const t={...pn({token:n,componentsVersion:un})},i=await He({endpoint:"/plugins",token:n,apiHost:e,headers:t});if(i.ok){return await i.json()}throw await i.json()},Qi=({apiHost:n,token:e})=>(n=>null==n?void 0:n.filter(n=>{var e,t;return"signing"===(null===(e=n.type)||void 0===e?void 0:e.toLowerCase())&&"valid"===(null===(t=n.status)||void 0===t?void 0:t.toLowerCase())}))(Mi({apiHost:n,token:e}).data),Ei=Rt(i.Modal)`
32
+ `,qi=({children:a,formattedInvoice:o,html:r,backButtonName:s,onBackButtonClick:l,onDownloadError:u,targetUrl:d,onDocumentPreviewFullscreenApiChange:c})=>{const p=wi(null==o?void 0:o.id,u),{apiHost:m}=e.useContext(te),y=oe(),{shadow:g,hideDownloadButton:b}=e.useContext(dn),h=H(),v=o&&(!b||l);return n.jsxs("div",{className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col "+(h?"bunny-overflow-hidden":""),children:[v?n.jsxs("div",{className:"bunny-flex bunny-justify-between bunny-items-center bunny-pb-4 "+(h?"bunny-shadow-padding-x":""),id:"acceptance",children:[n.jsx("div",{children:l?n.jsx(Si,{onClick:l,title:s}):null}),b?null:n.jsx(i.Button,{icon:n.jsx(t.DownloadOutlined,{}),onClick:()=>p(m+"/api/pdf/invoice/"+o.id,y),children:"Download"})]}):null,n.jsxs(Ti,{className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col bunny-gap-4 "+(h?"bunny-overflow-auto":`bunny-py-4 bunny-bg-white ${g||"shadow-md"} bunny-rounded-md`),children:[n.jsx(Di,{html:r,targetUrl:d,onDocumentPreviewFullscreenApiChange:c}),a]})]})};function Ai({id:e,invoiceQuoteViewComponent:t,backButtonName:i,onBackButtonClick:a,onInvoiceDownloadError:o,onPaymentSuccess:r,shadow:s="shadow-md",className:l,hideDownloadButton:u=!1,hidePaymentForm:d=!1,onInvoiceLoaded:c,onPaymentMethodSaved:p,onPaymentMethodRemoved:m}){return n.jsx(dn.Provider,{value:{id:e,invoiceQuoteViewComponent:t,backButtonName:i,onBackButtonClick:a,onInvoiceDownloadError:o,onPaymentSuccess:r,shadow:s,className:l,hideDownloadButton:u,onInvoiceLoaded:c},children:n.jsx(Mi,{hidePaymentForm:d,onSavePaymentMethod:p,onPaymentMethodRemoved:m})})}function Mi({hidePaymentForm:t,onSavePaymentMethod:i,onPaymentMethodRemoved:o}){const r=a.useQueryClient(),{id:s,invoiceQuoteViewComponent:l,backButtonName:u,onBackButtonClick:d,onPaymentSuccess:c,className:p}=e.useContext(dn),{apiHost:m}=e.useContext(te),{hideDownloadButton:y,onInvoiceLoaded:g}=e.useContext(dn),b=oe(),h=$(),{data:v}=a.useQuery({queryKey:Z({id:s,token:b}),queryFn:()=>(async({id:n,token:e,apiHost:t})=>{const i={id:n},a=await yn({query:"\nquery FormattedInvoice($id: ID) {\n formattedInvoice(id: $id) {\n amount\n amountDue\n amountPaid\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n createdAt\n credits\n currency\n currencyId\n currencySymbol\n customerBillingCity\n customerBillingContact\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n dueAt\n html\n id\n isLegacy\n netPaymentDays\n number\n payableId\n poNumber\n printedState\n smallUnitAmountDue\n state\n subscriptionEndDate\n subscriptionStartDate\n subtotal\n taxAmount\n taxNumber\n uuid\n vendorName\n formattedLines {\n amount\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n lineText\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListName\n prorationRate\n quantity\n unitOfMeasure\n priceTiers {\n price\n starts\n }\n }\n }\n}",token:e,vars:i,apiHost:t});return null==a?void 0:a.formattedInvoice})({id:s,token:b,apiHost:m})}),f=N.includes((null==v?void 0:v.state)||""),x=H(f?M.lg:void 0);return e.useEffect(()=>{v&&(null==g||g(v))},[v]),v?n.jsx("div",{className:"bunny-invoice-container",children:n.jsxs("div",{className:`bunny-flex bunny-gap-6 ${x?"bunny-flex-col bunny-w-full":""} ${p}`,children:[v.isLegacy?n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-w-full",children:n.jsx(re,{documentUuid:v.uuid,documentType:"invoice"})}):l||n.jsx(qi,{html:v.html,formattedInvoice:v,backButtonName:u,onBackButtonClick:d}),f&&!t&&n.jsx("div",{className:"bunny-w-full "+(y||v.isLegacy?"":"pt-12"),style:{maxWidth:x?void 0:"350px"},children:n.jsx(Ci,{onPaymentSuccess:()=>{r.invalidateQueries({queryKey:tn({token:b})}),r.invalidateQueries({queryKey:Z({id:s,token:b})}),h("Your invoice has been paid","Payment successful"),null==c||c()},invoice:v,onSavePaymentMethod:n=>{null==i||i(n)},onPaymentMethodRemoved:n=>{null==o||o(n.id)}})})]})}):n.jsx(n.Fragment,{})}const Hi=(n,e,t)=>{const i=((n,e,t)=>async(i,a=null,o,r)=>{a=a.replace(/\s+/g," ");const s=gn({token:o}),l=await fetch(e+"/graphql",{method:"post",body:a,headers:s});return 200!==l.status&&201!==l.status?l.json().then(e=>{var i,a,o;if(e.errors)t(e.errors[0].message);else if("Token is expired"===(null===(i=null==e?void 0:e[0])||void 0===i?void 0:i.description))n();else if(null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.description)throw new Error(null===(o=null==e?void 0:e[0])||void 0===o?void 0:o.description)}):l.json().then(n=>i(n,r)).catch(n=>{console.error(n),t(n)})})(n,e,t);return(n,e,t,a,o)=>("object"==typeof e&&(e=JSON.stringify(e)),i(t,`{ "query": "${n}", "variables": ${e} }`,a,o))},Ei=({isVisible:t,setVisible:a,id:o})=>{const{apiHost:r,onTokenExpired:s}=e.useContext(te),l=oe(),u=Hi(()=>{console.log("graphQLMutation navigateOnTokenExpired not yet implemented")},r||"",()=>{console.log("graphQLMutation onError not yet implemented")}),d=E(s),[c,p]=e.useState(0),[m,y]=e.useState("");return e.useEffect(()=>{if(!t)return;const n=setInterval(()=>{u("mutation quotePollSigningUrl($id: ID) {\n quotePollSigningUrl(quoteId: $id) {\n redirectUri\n status\n errors\n infoMessage\n }\n }",{id:o},n=>{n.errors?d(n.errors[0].message):"document.sent"===n.data.quotePollSigningUrl.status&&(a(!1),window.location.href=n.data.quotePollSigningUrl.redirectUri),y(n.data.quotePollSigningUrl.infoMessage||"")},l),p(c+1)},2e3);return()=>clearInterval(n)},[u,c,l,t,a]),n.jsxs(i.Modal,{title:"Uploading quote to Pandadoc",open:t,closable:!1,footer:null,children:[n.jsxs("div",{className:"bunny-py-4 bunny-text-center",children:["This may take a few seconds",".".repeat(c)]}),n.jsx("div",{className:"bunny-text-center",children:m})]})},Qi=({apiHost:n,token:e})=>a.useQuery({queryKey:nn(e),queryFn:async()=>await $i({token:e,apiHost:n}),placeholderData:a.keepPreviousData}),$i=async({token:n,apiHost:e})=>{const t={...gn({token:n,componentsVersion:pn})},i=await $e({endpoint:"/plugins",token:n,apiHost:e,headers:t});if(i.ok){return await i.json()}throw await i.json()},_i=({apiHost:n,token:e})=>(n=>null==n?void 0:n.filter(n=>{var e,t;return"signing"===(null===(e=n.type)||void 0===e?void 0:e.toLowerCase())&&"valid"===(null===(t=n.status)||void 0===t?void 0:t.toLowerCase())}))(Qi({apiHost:n,token:e}).data),Ri=Vt(i.Modal)`
33
33
  .ant-modal-content {
34
34
  border-radius: 0.75rem;
35
35
  overflow: hidden;
@@ -49,13 +49,13 @@
49
49
  padding: 0 1.5rem 1.5rem;
50
50
  margin: 0 !important;
51
51
  }
52
- `,$i=e=>n.jsx(Ei,{closable:!1,...e}),_i=Wn("\n fragment NoSigningPluginsForm_FormattedQuoteFragment on FormattedQuote {\n poNumberRequired\n taxNumberRequired\n taxNumberLabel\n }\n ");function Ri({isVisible:t,formattedQuote:a,form:o}){const r=Yn(_i,a),s=e.useRef(null);(({firstInputRef:n,isVisible:t})=>{e.useEffect(()=>{var e;null===(e=n.current)||void 0===e||e.focus()},[t,n])})({firstInputRef:s,isVisible:t});const{poNumberRequired:l,taxNumberRequired:u,taxNumberLabel:d}=r,c=(n,e)=>n?[{required:!0,message:`${e} is required`}]:[];return n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-2",form:o,layout:"vertical",children:[n.jsx(i.Form.Item,{label:"Your name",name:"name",rules:c(!0,"Your name"),children:n.jsx(i.Input,{autoFocus:!0,ref:s})}),n.jsx(i.Form.Item,{label:"Your job title",name:"title",rules:c(!0,"Your job title"),children:n.jsx(i.Input,{})}),n.jsx(i.Form.Item,{label:"Purchase order number",name:"poNumber",rules:c(null!=l&&l,"Purchase order number"),children:n.jsx(i.Input,{})}),u&&n.jsx(i.Form.Item,{name:"taxNumber",label:d,rules:c(u,null!=d?d:""),children:n.jsx(i.Input,{})})]})}const Bi=Wn("\n fragment AcceptQuoteModal_FormattedQuoteFragment on FormattedQuote {\n ...NoSigningPluginsForm_FormattedQuoteFragment\n }\n ",[_i]),Ui=({acceptBoxVisible:t,formattedQuote:a,sendAccept:o,setAcceptBoxVisible:r,setIsAccepting:s,isSendAcceptPending:l})=>{const u=Yn(Bi,a),{apiHost:d}=e.useContext(Jn),c=te(),p=Qi({apiHost:d,token:c}),[m]=i.Form.useForm();return n.jsx($i,{centered:!0,okText:l?"Accepting...":"Accept",okButtonProps:{loading:l,disabled:l},onCancel:()=>{r(!1),s(!1)},onOk:()=>{m.validateFields().then(n=>{o(n)}).catch(()=>{})},open:t,title:(null==p?void 0:p.length)?"Start signing":"Accept quote",width:400,children:n.jsx(Ri,{isVisible:t,formattedQuote:u,form:m})})},{Title:Vi,Text:Oi}=i.Typography,Zi=H(),Ki=M(),zi=Wn("\n fragment PaymentHoldModal_FormattedQuoteFragment on FormattedQuote {\n quote {\n id\n ...PaymentForm_QuoteFragment\n }\n currency\n amount\n ...NoSigningPluginsForm_FormattedQuoteFragment\n }\n ",[ci,_i]),Gi=({visible:t,setVisible:o,formattedQuote:r,sendAccept:s})=>{const l=Yn(zi,r),u=a.useQueryClient(),{apiHost:d}=e.useContext(Jn),c=te(),p=Qi({apiHost:d,token:c}),m=!(null==p?void 0:p.length),[y]=i.Form.useForm();return n.jsx(Xi,{centered:!0,onCancel:()=>{o(!1)},footer:null,open:t,width:900,className:"bunny-flex bunny-flex-row bunny-gap-4",children:n.jsxs("div",{className:"bunny-flex bunny-flex-row",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-w-1/2",children:[n.jsxs("div",{className:"bunny-mt-5 bunny-mx-4",children:[n.jsx(Vi,{className:"bunny-mt-0",level:5,children:"Pay and sign"}),n.jsxs(Oi,{className:"bunny-bt-2 bunny-text-sm/5 bunny-text-gray-500",children:["To accept this quote, approve a payment hold for"," ",ct(l.amount,l.currency||"null"),". This amount will be charged to your payment method once the quote is signed."]})]}),n.jsx("div",{className:"bunny-p-4 bunny-pb-6",children:m?n.jsx(Ri,{isVisible:t,formattedQuote:l,form:y}):null})]}),n.jsx(Yi,{className:"bunny-m-4"}),n.jsx("div",{className:"bunny-mb-3 bunny-w-1/2 bunny-pt-6",children:n.jsx(vi,{quote:l.quote,paymentHold:{quoteId:l.quote.id,amountToHold:l.amount},onPaymentSuccess:()=>{o(!1)},onPaymentHoldSuccess:()=>{o(!1),Zi(`Approved payment hold for ${ct(l.amount,l.currency||"null")}`),l.quote.id?(u.invalidateQueries({queryKey:O({id:l.quote.id,token:c})}),u.invalidateQueries({queryKey:O({token:c})}),m&&y.validateFields().then(n=>{s(n)}).catch(()=>{})):Ki("Quote ID is required for onPaymentHoldSuccess callback in PaymentForm")},checkoutPrecondition:async()=>{if(!m)return!0;try{return await y.validateFields(),!0}catch(n){return!1}}})})]})})},Yi=c.div`
52
+ `,Bi=e=>n.jsx(Ri,{closable:!1,...e}),Ui=ne("\n fragment NoSigningPluginsForm_FormattedQuoteFragment on FormattedQuote {\n poNumberRequired\n taxNumberRequired\n taxNumberLabel\n }\n ");function Vi({isVisible:t,formattedQuote:a,form:o}){const r=Jn(Ui,a),s=e.useRef(null);(({firstInputRef:n,isVisible:t})=>{e.useEffect(()=>{var e;null===(e=n.current)||void 0===e||e.focus()},[t,n])})({firstInputRef:s,isVisible:t});const{poNumberRequired:l,taxNumberRequired:u,taxNumberLabel:d}=r,c=(n,e)=>n?[{required:!0,message:`${e} is required`}]:[];return n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-2",form:o,layout:"vertical",children:[n.jsx(i.Form.Item,{label:"Your name",name:"name",rules:c(!0,"Your name"),children:n.jsx(i.Input,{autoFocus:!0,ref:s})}),n.jsx(i.Form.Item,{label:"Your job title",name:"title",rules:c(!0,"Your job title"),children:n.jsx(i.Input,{})}),n.jsx(i.Form.Item,{label:"Purchase order number",name:"poNumber",rules:c(null!=l&&l,"Purchase order number"),children:n.jsx(i.Input,{})}),u&&n.jsx(i.Form.Item,{name:"taxNumber",label:d,rules:c(u,null!=d?d:""),children:n.jsx(i.Input,{})})]})}const Oi=ne("\n fragment AcceptQuoteModal_FormattedQuoteFragment on FormattedQuote {\n ...NoSigningPluginsForm_FormattedQuoteFragment\n }\n ",[Ui]),Zi=({acceptBoxVisible:t,formattedQuote:a,sendAccept:o,setAcceptBoxVisible:r,setIsAccepting:s,isSendAcceptPending:l})=>{const u=Jn(Oi,a),{apiHost:d}=e.useContext(te),c=oe(),p=_i({apiHost:d,token:c}),[m]=i.Form.useForm();return n.jsx(Bi,{centered:!0,okText:l?"Accepting...":"Accept",okButtonProps:{loading:l,disabled:l},onCancel:()=>{r(!1),s(!1)},onOk:()=>{m.validateFields().then(n=>{o(n)}).catch(()=>{})},open:t,title:(null==p?void 0:p.length)?"Start signing":"Accept quote",width:400,children:n.jsx(Vi,{isVisible:t,formattedQuote:u,form:m})})},{Title:zi,Text:Ki}=i.Typography,Gi=$(),Yi=Q(),Wi=ne("\n fragment PaymentHoldModal_FormattedQuoteFragment on FormattedQuote {\n quote {\n id\n ...PaymentForm_QuoteFragment\n }\n currency\n amount\n ...NoSigningPluginsForm_FormattedQuoteFragment\n }\n ",[yi,Ui]),Xi=({visible:t,setVisible:o,formattedQuote:r,sendAccept:s})=>{const l=Jn(Wi,r),u=a.useQueryClient(),{apiHost:d}=e.useContext(te),c=oe(),p=_i({apiHost:d,token:c}),m=!(null==p?void 0:p.length),[y]=i.Form.useForm();return n.jsx(ea,{centered:!0,onCancel:()=>{o(!1)},footer:null,open:t,width:900,className:"bunny-flex bunny-flex-row bunny-gap-4",children:n.jsxs("div",{className:"bunny-flex bunny-flex-row",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-w-1/2",children:[n.jsxs("div",{className:"bunny-mt-5 bunny-mx-4",children:[n.jsx(zi,{className:"bunny-mt-0",level:5,children:"Pay and sign"}),n.jsxs(Ki,{className:"bunny-bt-2 bunny-text-sm/5 bunny-text-gray-500",children:["To accept this quote, approve a payment hold for"," ",yt(l.amount,l.currency||"null"),". This amount will be charged to your payment method once the quote is signed."]})]}),n.jsx("div",{className:"bunny-p-4 bunny-pb-6",children:m?n.jsx(Vi,{isVisible:t,formattedQuote:l,form:y}):null})]}),n.jsx(Ji,{className:"bunny-m-4"}),n.jsx("div",{className:"bunny-mb-3 bunny-w-1/2 bunny-pt-6",children:n.jsx(Ci,{quote:l.quote,paymentHold:{quoteId:l.quote.id,amountToHold:l.amount},onPaymentSuccess:()=>{o(!1)},onPaymentHoldSuccess:()=>{o(!1),Gi(`Approved payment hold for ${yt(l.amount,l.currency||"null")}`),l.quote.id?(u.invalidateQueries({queryKey:K({id:l.quote.id,token:c})}),u.invalidateQueries({queryKey:K({token:c})}),m&&y.validateFields().then(n=>{s(n)}).catch(()=>{})):Yi("Quote ID is required for onPaymentHoldSuccess callback in PaymentForm")},checkoutPrecondition:async()=>{if(!m)return!0;try{return await y.validateFields(),!0}catch(n){return!1}}})})]})})},Ji=p.div`
53
53
  width: 1px;
54
54
  min-height: 100%;
55
55
  flex-shrink: 0;
56
56
  background-color: rgba(0, 0, 0, 0.06);
57
57
  align-self: stretch;
58
- `,Wi=c(i.Modal)`
58
+ `,na=p(i.Modal)`
59
59
  .ant-modal-content {
60
60
  border-radius: 0.5rem;
61
61
  overflow: hidden;
@@ -75,7 +75,7 @@
75
75
  padding: 0 1.5rem 1.5rem;
76
76
  margin: 0 !important;
77
77
  }
78
- `,Xi=e=>n.jsx(Wi,{closable:!1,...e}),Ji=({id:a})=>{const o=fi(a),{apiHost:r}=e.useContext(Jn),s=te();return n.jsx(i.Button,{icon:n.jsx(t.DownloadOutlined,{}),onClick:()=>o(r+"/api/pdf/quote",s),children:"Download"})},na={blue:{color:"var(--bunny-blue-500)",background:"var(--bunny-blue-200)"},green:{color:"var(--bunny-green-600)",background:"var(--bunny-green-200)"},red:{color:"var(--bunny-red-500)",background:"var(--bunny-red-200)"},orange:{color:"var(--bunny-orange-500)",background:"var(--bunny-orange-200)"},yellow:{color:"var(--bunny-yellow-500)",background:"var(--bunny-yellow-200)"},purple:{color:"var(--bunny-purple-500)",background:"var(--bunny-purple-200)"},black:{color:"white",background:"var(--bunny-black)"}},ea=({children:e,color:t,className:a,style:o})=>n.jsx(i.Tag,{color:t,style:{...t?na[t]:void 0,...o},className:`bunny-m-0 bunny-rounded-full bunny-border-none bunny-whitespace-nowrap ${a}`,children:e});st.extend(dt);const ta=n=>st(n).format("ll"),ia=Wn("\n fragment PaymentHoldDisplay_PaymentHoldFragment on PaymentHold {\n expiresAt\n paymentMethod {\n metadata {\n identifier\n }\n }\n }\n");function aa({paymentHold:e,currency:t,amount:a}){var o,r,s,l;const u=Yn(ia,e),d=(null===(r=null===(o=u.paymentMethod)||void 0===o?void 0:o.metadata)||void 0===r?void 0:r.identifier)?null===(l=null===(s=u.paymentMethod)||void 0===s?void 0:s.metadata)||void 0===l?void 0:l.identifier:"N/A",c=t?ct(a,t):"N/A",p=u.expiresAt?ta(u.expiresAt):"N/A";return n.jsx(i.Tooltip,{title:`${c} will be charged to ${d} once the quote is accepted.Hold will be released on ${p} if not accepted.`,children:n.jsx(n.Fragment,{children:n.jsxs(ea,{color:"orange",className:"rounded-md",style:{padding:6},children:["Hold of ",c," on ****",d]})})})}const{Text:oa}=i.Typography,ra=({acceptedByName:e,acceptedAt:t})=>n.jsx(oa,{children:`Quote was accepted by ${String(null!=e?e:"")} on ${ta(t)}`}),sa=Wn("\n fragment QuoteButtons_FormattedQuoteFragment on FormattedQuote {\n acceptedAt\n acceptedByName\n currency\n amount\n expiresAt\n state\n }\n "),la=Wn("\n fragment PaymentHoldDisplay_QuoteButtonsFragment on PaymentHold {\n ...PaymentHoldDisplay_PaymentHoldFragment\n }\n ",[ia]);function ua({isAccepted:t,formattedQuote:a,isMobile:o,hideDownloadButton:r,id:s,isAccepting:l,handleClickAccept:u,setPaymentHoldModalVisible:d,shouldDoPaymentHold:c,paymentHoldCompleted:p,paymentHold:m,isSendAcceptPending:y}){const g=Yn(sa,a),b=Yn(la,m),{apiHost:h}=e.useContext(Jn),v=te(),{secondaryColor:f}=bn(),x=(C=null==g?void 0:g.expiresAt,st(C).diff(st(st().format("YYYY-MM-DD")))<0);var C;const w="REJECTED"===(null==g?void 0:g.state),j=Qi({apiHost:h,token:v});return n.jsxs("div",{className:"flex flex-row justify-end items-center gap-4",id:"acceptance",style:{color:f},children:[t&&g.acceptedAt?n.jsx(ra,{acceptedByName:g.acceptedByName,acceptedAt:g.acceptedAt}):null,(!o||!t)&&n.jsxs("div",{className:o?"flex w-full justify-end gap-2":"flex items-center justify-end gap-2",children:[b?n.jsx(aa,{paymentHold:b,currency:g.currency,amount:g.amount}):null,o||r?null:n.jsx(Ji,{id:s}),c&&!p?n.jsx(i.Button,{disabled:x,onClick:()=>d(!0),type:"primary",loading:y,children:"Pay and sign"}):n.jsx(n.Fragment,{children:t||w?null:n.jsx(i.Button,{disabled:x||l,onClick:u,type:"primary",children:x?"Quote is expired":(null==j?void 0:j.length)?"Start signing":"Accept quote"})})]})]})}const da=Wn("\n fragment QuoteAccept_AcceptedQuoteFragment on Quote {\n id\n state\n acceptedAt\n acceptedByName\n acceptedByTitle\n }\n"),ca=Wn("\n mutation QuoteAccept(\n $name: String!\n $title: String!\n $poNumber: String\n $taxNumber: String\n $quoteId: ID\n ) {\n quoteAccept(\n name: $name\n title: $title\n poNumber: $poNumber\n taxNumber: $taxNumber\n quoteId: $quoteId\n ) {\n quote {\n ...QuoteAccept_AcceptedQuoteFragment\n }\n errors\n }\n }\n",[da]),pa=Cn(),ma=({quoteId:n,apiHost:t,token:i,onQuoteAccepted:o})=>{const r=qi(()=>{console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented")},t||"",()=>{console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented")}),s=Qi({apiHost:t,token:i}),l=a.useQueryClient(),u=Q(),[d,c]=e.useState(!1),[p,m]=e.useState(!1),[y,g]=e.useState(!1),{mutate:b,isPending:h}=a.useMutation({mutationFn:async e=>(async({quoteId:n,apiHost:e,token:t,name:i,title:a,poNumber:o,taxNumber:r})=>await wn(ca,{apiHost:e,token:t},{name:i,title:a,poNumber:null!=o?o:null,taxNumber:null!=r?r:null,quoteId:null!=n?n:null}))({quoteId:n,apiHost:t,token:i,...e}),onSuccess:e=>{var t,a;c(!1);const r=Yn(da,null!==(a=null===(t=null==e?void 0:e.quoteAccept)||void 0===t?void 0:t.quote)&&void 0!==a?a:null);null==o||o(r),l.invalidateQueries({queryKey:O({id:n,token:i})})}});return{acceptBoxVisible:d,isAccepting:p,pandadocPollingModalVisible:y,isSendAcceptPending:h,hasSigningPlugins:s?(null==s?void 0:s.length)>0:void 0,sendAccept:b,setAcceptBoxVisible:c,setIsAccepting:m,startAcceptance:()=>{m(!0),(null==s?void 0:s.length)?r("mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n message\n errors\n }\n }",{quoteId:n},n=>{if(n.errors)pa(n.errors[0].message),m(!1);else{const{redirectUri:e,message:t,pluginShortName:i}=n.data.quoteSigningUrlCreate;e?window.location.href=e:"pandadoc"===i?g(!0):t&&(u(t,"Signing Information"),m(!1))}},i):c(!0)},setPandadocPollingModalVisible:g}},ya=Wn("\n fragment useQuotePaymentHold_FormattedQuoteFragment on FormattedQuote {\n quote {\n payToAccept\n currentPaymentHold {\n id\n }\n }\n }\n"),ga=e.createContext({}),ba=Wn("\n query formattedQuote($id: ID) {\n formattedQuote(id: $id) {\n quote {\n documentTemplateId\n documents {\n id\n filename\n size\n date\n url\n }\n firstInvoice {\n id\n state\n }\n payableId\n id\n payToAccept\n currentPaymentHold {\n createdAt\n expiresAt\n id\n updatedAt\n paymentMethod {\n accountId\n createdAt\n expirationDate\n failureCode\n id\n isDefault\n lastSuccess\n paymentType\n pluginId\n state\n updatedAt\n metadata {\n description\n expiration\n icon\n identifier\n issuer\n kind\n }\n }\n ...PaymentHoldDisplay_QuoteButtonsFragment\n }\n }\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n ...useQuotePaymentHold_FormattedQuoteFragment\n ...PaymentHoldModal_FormattedQuoteFragment\n ...AcceptQuoteModal_FormattedQuoteFragment\n ...QuoteButtons_FormattedQuoteFragment\n }\n }\n ",[ya,zi,Bi,sa,la]),ha=M();function va({id:e,invoiceQuoteViewComponent:t,onInvoiceDownloadError:i,onPaymentSuccess:a,shadow:o="shadow-md",className:r,hideDownloadButton:s=!1,onQuoteLoaded:l,onQuoteAccepted:u,onQuoteUnavailableError:d,suppressQuoteUnavailableErrorNotification:c=!1}){return n.jsx(sn.Provider,{value:{id:e,invoiceQuoteViewComponent:t,onInvoiceDownloadError:i,onPaymentSuccess:a,shadow:o,className:r,hideDownloadButton:s,onQuoteUnavailableError:d,suppressQuoteUnavailableErrorNotification:c},children:n.jsx(fa,{onQuoteAccepted:u,onQuoteLoaded:l})})}function fa({onQuoteAccepted:t,onQuoteLoaded:o}){var r,s,l,u,d,c,p;const{apiHost:m}=e.useContext(Jn),y=te(),{className:g,id:b,hideDownloadButton:h,onQuoteUnavailableError:v,suppressQuoteUnavailableErrorNotification:f}=e.useContext(sn),{data:x,isLoading:C,error:w}=a.useQuery({queryKey:O({id:b,token:y}),queryFn:async()=>await(async({token:n,apiHost:e,id:t})=>{const i=await wn(ba,{apiHost:e,token:n},{id:t});return null==i?void 0:i.formattedQuote})({token:y,apiHost:m,id:b}),placeholderData:a.keepPreviousData}),{acceptBoxVisible:j,isAccepting:S,sendAccept:I,setAcceptBoxVisible:L,setIsAccepting:P,startAcceptance:k,pandadocPollingModalVisible:N,setPandadocPollingModalVisible:F,isSendAcceptPending:D}=ma({token:y,apiHost:m,quoteId:b,onQuoteAccepted:t});(({data:n,token:t})=>{const i=a.useQueryClient(),{searchParams:o}=e.useContext(ga),r=o?o.get("event"):null;e.useEffect(()=>{n&&"signing_complete"===r&&(n.state="ACCEPTED",i.setQueryData(O({id:null==n?void 0:n.id,token:t}),n))},[n,r,i,t])})({data:x,token:y});const T=q();e.useEffect(()=>{x&&(null==o||o(x))},[x]),e.useEffect(()=>{var n,e,t;if(w){const i=null===(t=null===(e=null===(n=null==w?void 0:w.response)||void 0===n?void 0:n.errors)||void 0===e?void 0:e[0])||void 0===t?void 0:t.message;(null==i?void 0:i.includes("This quote is currently unavailable"))&&(null==v||v(),f||ha(i,null))}},[w]);const{paymentHoldModalVisible:A,setPaymentHoldModalVisible:M,shouldDoPaymentHold:H,paymentHoldCompleted:Q}=(n=>{var t,i;const[a,o]=e.useState(!1),r=n?Yn(ya,n):void 0;return{paymentHoldModalVisible:a,setPaymentHoldModalVisible:o,shouldDoPaymentHold:!0===(null===(t=null==r?void 0:r.quote)||void 0===t?void 0:t.payToAccept),paymentHoldCompleted:!!(null===(i=null==r?void 0:r.quote)||void 0===i?void 0:i.currentPaymentHold)}})(x),E=null===(r=null==x?void 0:x.quote)||void 0===r?void 0:r.currentPaymentHold;if(!x||C)return n.jsx(n.Fragment,{});const $="ACCEPTED"===x.state,_=null===(s=x.quote)||void 0===s?void 0:s.firstInvoice;return"PAID"===(null==_?void 0:_.state)&&Q?n.jsx(Di,{id:_.id}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-4 ${T?"bunny-w-full bunny-overflow-hidden":""} ${g}`,children:[n.jsx(ua,{isAccepted:$,formattedQuote:x,isMobile:T,hideDownloadButton:h,id:b,isAccepting:S,handleClickAccept:()=>{H&&!Q?M(!0):k()},setPaymentHoldModalVisible:M,shouldDoPaymentHold:H,paymentHoldCompleted:Q,paymentHold:E,isSendAcceptPending:D}),n.jsx(Fi,{html:x.html,targetUrl:(null===(l=null==x?void 0:x.quote)||void 0===l?void 0:l.documentTemplateId)?"/pdf/quote":void 0,children:(null===(d=null===(u=null==x?void 0:x.quote)||void 0===u?void 0:u.documents)||void 0===d?void 0:d.length)&&(null===(p=null===(c=null==x?void 0:x.quote)||void 0===c?void 0:c.documents)||void 0===p?void 0:p.length)>0?n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-items-end",children:x.quote.documents.map((e,t)=>n.jsx(i.Button,{download:e.filename,href:e.url,type:"link",children:e.filename},t))}):null})]}),n.jsx(Ui,{acceptBoxVisible:j,formattedQuote:x,setAcceptBoxVisible:L,setIsAccepting:P,sendAccept:I,isSendAcceptPending:D}),n.jsx(Gi,{visible:A,setVisible:M,formattedQuote:x,sendAccept:I}),n.jsx(Ai,{isVisible:N,setVisible:F,id:b})]})}Wn("\n fragment Quote_PaymentHoldFragment on FormattedQuote {\n quote {\n currentPaymentHold {\n ...PaymentHoldDisplay_QuoteButtonsFragment\n }\n firstInvoice {\n id\n }\n }\n }\n ",[la]),Wn("\n fragment OnQuoteLoadedFragment on FormattedQuote {\n vendorName\n quote {\n id\n }\n }\n ");const xa=e.createContext({}),Ca=n=>`\n query quotes {\n quotes ${n?`(${n})`:""} {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }`;var wa;!function(n){n.INVOICE="INVOICE",n.PAYMENT="PAYMENT",n.REFUND="REFUND",n.WRITE_OFF="WRITE_OFF"}(wa||(wa={}));const ja=n=>`\nquery transactions {\n transactions ${n?`(${n})`:""} {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number dueAt issuedAt isLegacy }\n ...on CreditNote { amount number issuedAt }\n }\n account {\n name\n id\n }\n }\n }\n}`;var Sa;!function(n){n.not_due="not_due",n.due="due",n.unpaid="unpaid",n.paid="paid",n.voided="voided",n.ready="ready",n.failed="failed",n.preparing="preparing",n.unapplied="unapplied",n.partially_applied="partially_applied",n.applied="applied"}(Sa||(Sa={}));var Ia=Sa;const La=({state:t})=>{const{transactionStateRenderer:i}=e.useContext(xa);return i?n.jsx(n.Fragment,{children:i(t)}):n.jsx(ea,{color:Pa(t),children:l.capitalize(l.startCase(t))})},Pa=n=>{switch(n){case Ia.not_due:return"yellow";case Ia.voided:return"black";case Ia.ready:return"orange";case Ia.preparing:return"purple";case Ia.unapplied:case Ia.partially_applied:case Ia.applied:return"blue";case Ia.due:case Ia.unpaid:return"orange";case Ia.failed:return"red";case Ia.paid:return"green";default:return"blue"}},{Text:ka}=i.Typography,Na=({date:e})=>n.jsx(ka,{className:"bunny-text-sm",children:ta(e)}),Fa=({className:e,color:t=w})=>n.jsxs("svg",{className:e,fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M8 11.3333V2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M4 7.33301L8 11.333L12 7.33301",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M12.6654 14H3.33203",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Da=({transaction:t,token:i,apiHost:a})=>{const{darkMode:o}=e.useContext(Jn),{downloadTransactionLink:r}=e.useContext(xa),s=fi(),l=q(),u="INVOICE"===t.kind||void 0!==r,d=r?r(t.transactionableId):`${a}/api/pdf/invoice/${t.transactionableId}`;return u?n.jsx("div",{onClick:n=>{n.stopPropagation(),s(d,i)},children:n.jsx(Fa,{className:""+(l?"":"bunny-show-on-hover"),color:o?"rgb(255 255 255)":w})}):null},Ta=Rt.div.withConfig({shouldForwardProp:n=>!["gridColumn","padding","right"].includes(n)})`
78
+ `,ea=e=>n.jsx(na,{closable:!1,...e}),ta=({id:a})=>{const o=wi(a),{apiHost:r}=e.useContext(te),s=oe();return n.jsx(i.Button,{icon:n.jsx(t.DownloadOutlined,{}),onClick:()=>o(r+"/api/pdf/quote",s),children:"Download"})},ia=(n,e)=>!!n&&n<(n=>(new Date).toLocaleDateString("en-CA",{timeZone:n}))(null!=e?e:void 0),aa=(n,e)=>ia(n,e),oa={blue:{color:"var(--bunny-blue-500)",background:"var(--bunny-blue-200)"},green:{color:"var(--bunny-green-600)",background:"var(--bunny-green-200)"},red:{color:"var(--bunny-red-500)",background:"var(--bunny-red-200)"},orange:{color:"var(--bunny-orange-500)",background:"var(--bunny-orange-200)"},yellow:{color:"var(--bunny-yellow-500)",background:"var(--bunny-yellow-200)"},purple:{color:"var(--bunny-purple-500)",background:"var(--bunny-purple-200)"},black:{color:"white",background:"var(--bunny-black)"}},ra=({children:e,color:t,className:a,style:o})=>n.jsx(i.Tag,{color:t,style:{...t?oa[t]:void 0,...o},className:`bunny-m-0 bunny-rounded-full bunny-border-none bunny-whitespace-nowrap ${a}`,children:e});dt.extend(mt);const sa=n=>dt(n).format("ll"),la=ne("\n fragment PaymentHoldDisplay_PaymentHoldFragment on PaymentHold {\n expiresAt\n paymentMethod {\n metadata {\n identifier\n }\n }\n }\n");function ua({paymentHold:e,currency:t,amount:a}){var o,r,s,l;const u=Jn(la,e),d=(null===(r=null===(o=u.paymentMethod)||void 0===o?void 0:o.metadata)||void 0===r?void 0:r.identifier)?null===(l=null===(s=u.paymentMethod)||void 0===s?void 0:s.metadata)||void 0===l?void 0:l.identifier:"N/A",c=t?yt(a,t):"N/A",p=u.expiresAt?sa(u.expiresAt):"N/A";return n.jsx(i.Tooltip,{title:`${c} will be charged to ${d} once the quote is accepted.Hold will be released on ${p} if not accepted.`,children:n.jsx(n.Fragment,{children:n.jsxs(ra,{color:"orange",className:"rounded-md",style:{padding:6},children:["Hold of ",c," on ****",d]})})})}const{Text:da}=i.Typography,ca=({acceptedByName:e,acceptedAt:t})=>n.jsx(da,{children:`Quote was accepted by ${String(null!=e?e:"")} on ${sa(t)}`}),pa=ne("\n fragment QuoteButtons_FormattedQuoteFragment on FormattedQuote {\n acceptedAt\n acceptedByName\n currency\n amount\n expiresAt\n state\n quote {\n entity {\n tzIdentifier\n }\n }\n }\n "),ma=ne("\n fragment PaymentHoldDisplay_QuoteButtonsFragment on PaymentHold {\n ...PaymentHoldDisplay_PaymentHoldFragment\n }\n ",[la]);function ya({isAccepted:t,formattedQuote:a,isMobile:o,hideDownloadButton:r,id:s,isAccepting:l,handleClickAccept:u,setPaymentHoldModalVisible:d,shouldDoPaymentHold:c,paymentHoldCompleted:p,paymentHold:m,isSendAcceptPending:y}){var g,b;const h=Jn(pa,a),v=Jn(ma,m),{apiHost:f}=e.useContext(te),x=oe(),{secondaryColor:C}=fn(),w=aa(null==h?void 0:h.expiresAt,null===(b=null===(g=null==h?void 0:h.quote)||void 0===g?void 0:g.entity)||void 0===b?void 0:b.tzIdentifier),j="REJECTED"===(null==h?void 0:h.state),S=_i({apiHost:f,token:x});return n.jsxs("div",{className:"flex flex-row justify-end items-center gap-4",id:"acceptance",style:{color:C},children:[t&&h.acceptedAt?n.jsx(ca,{acceptedByName:h.acceptedByName,acceptedAt:h.acceptedAt}):null,(!o||!t)&&n.jsxs("div",{className:o?"flex w-full justify-end gap-2":"flex items-center justify-end gap-2",children:[v?n.jsx(ua,{paymentHold:v,currency:h.currency,amount:h.amount}):null,o||r?null:n.jsx(ta,{id:s}),c&&!p?n.jsx(i.Button,{disabled:w,onClick:()=>d(!0),type:"primary",loading:y,children:"Pay and sign"}):n.jsx(n.Fragment,{children:t||j?null:n.jsx(i.Button,{disabled:w||l,onClick:u,type:"primary",children:w?"Quote is expired":(null==S?void 0:S.length)?"Start signing":"Accept quote"})})]})]})}const ga=ne("\n fragment QuoteAccept_AcceptedQuoteFragment on Quote {\n id\n state\n acceptedAt\n acceptedByName\n acceptedByTitle\n }\n"),ba=ne("\n mutation QuoteAccept(\n $name: String!\n $title: String!\n $poNumber: String\n $taxNumber: String\n $quoteId: ID\n ) {\n quoteAccept(\n name: $name\n title: $title\n poNumber: $poNumber\n taxNumber: $taxNumber\n quoteId: $quoteId\n ) {\n quote {\n ...QuoteAccept_AcceptedQuoteFragment\n }\n errors\n }\n }\n",[ga]),ha=Sn(),va=({quoteId:n,apiHost:t,token:i,onQuoteAccepted:o})=>{const r=Hi(()=>{console.log("navigate in useGraphQLmutation in useSendAcceptQuote is not yet implemented")},t||"",()=>{console.log("onError in useGraphQLmutation in useSendAcceptQuote is not yet implemented")}),s=_i({apiHost:t,token:i}),l=a.useQueryClient(),u=_(),[d,c]=e.useState(!1),[p,m]=e.useState(!1),[y,g]=e.useState(!1),{mutate:b,isPending:h}=a.useMutation({mutationFn:async e=>(async({quoteId:n,apiHost:e,token:t,name:i,title:a,poNumber:o,taxNumber:r})=>await In(ba,{apiHost:e,token:t},{name:i,title:a,poNumber:null!=o?o:null,taxNumber:null!=r?r:null,quoteId:null!=n?n:null}))({quoteId:n,apiHost:t,token:i,...e}),onSuccess:e=>{var t,a;c(!1);const r=Jn(ga,null!==(a=null===(t=null==e?void 0:e.quoteAccept)||void 0===t?void 0:t.quote)&&void 0!==a?a:null);null==o||o(r),l.invalidateQueries({queryKey:K({id:n,token:i})})}});return{acceptBoxVisible:d,isAccepting:p,pandadocPollingModalVisible:y,isSendAcceptPending:h,hasSigningPlugins:s?(null==s?void 0:s.length)>0:void 0,sendAccept:b,setAcceptBoxVisible:c,setIsAccepting:m,startAcceptance:()=>{m(!0),(null==s?void 0:s.length)?r("mutation quoteSigningUrlCreate($quoteId: ID) {\n quoteSigningUrlCreate(quoteId: $quoteId) {\n redirectUri\n pluginClientId\n pluginShortName\n message\n errors\n }\n }",{quoteId:n},n=>{if(n.errors)ha(n.errors[0].message),m(!1);else{const{redirectUri:e,message:t,pluginShortName:i}=n.data.quoteSigningUrlCreate;e?window.location.href=e:"pandadoc"===i?g(!0):t&&(u(t,"Signing Information"),m(!1))}},i):c(!0)},setPandadocPollingModalVisible:g}},fa=ne("\n fragment useQuotePaymentHold_FormattedQuoteFragment on FormattedQuote {\n quote {\n payToAccept\n currentPaymentHold {\n id\n }\n }\n }\n"),xa=e.createContext({}),Ca=ne("\n query formattedQuote($id: ID) {\n formattedQuote(id: $id) {\n quote {\n documentTemplateId\n documents {\n id\n filename\n size\n date\n url\n }\n firstInvoice {\n id\n state\n }\n payableId\n id\n payToAccept\n currentPaymentHold {\n createdAt\n expiresAt\n id\n updatedAt\n paymentMethod {\n accountId\n createdAt\n expirationDate\n failureCode\n id\n isDefault\n lastSuccess\n paymentType\n pluginId\n state\n updatedAt\n metadata {\n description\n expiration\n icon\n identifier\n issuer\n kind\n }\n }\n ...PaymentHoldDisplay_QuoteButtonsFragment\n }\n }\n payableId\n acceptedAt\n acceptedByName\n amount\n amountDue\n amountsByPeriod {\n id\n name\n amount\n }\n billingCity\n billingCountry\n billingState\n billingStreet\n billingZip\n contactName\n currency\n customerBillingCity\n customerBillingCountry\n customerBillingState\n customerBillingStreet\n customerBillingZip\n customerName\n discount\n discountValue\n duration\n endDate\n expiresAt\n html\n formattedLines {\n amount\n amountsByPeriod {\n quantity\n id\n name\n startDate\n endDate\n amount\n amountsByTier {\n id\n tier {\n starts\n ends\n price\n }\n quantity\n amount\n }\n prorationRate\n }\n billingPeriodEnd\n billingPeriodStart\n chargeType\n discount\n frequency\n isRamp\n periods\n planName\n position\n price\n priceDecimals\n priceListChargeId\n priceListChargeName\n priceListId\n priceListName\n priceTiers {\n price\n starts\n }\n pricingModel\n productName\n prorationRate\n quantity\n showProductNameOnLineItem\n taxCode\n trialEndDate\n trialStartDate\n unitOfMeasure\n vatCode\n }\n netPaymentDays\n notes\n number\n poNumberRequired\n salesContactEmail\n sharedAt\n startDate\n state\n subtotal\n taxAmount\n taxNumberLabel\n taxNumberRequired\n vendorName\n ...useQuotePaymentHold_FormattedQuoteFragment\n ...PaymentHoldModal_FormattedQuoteFragment\n ...AcceptQuoteModal_FormattedQuoteFragment\n ...QuoteButtons_FormattedQuoteFragment\n }\n }\n ",[fa,Wi,Oi,pa,ma]),wa=Q();function ja({id:e,invoiceQuoteViewComponent:t,onInvoiceDownloadError:i,onPaymentSuccess:a,shadow:o="shadow-md",className:r,hideDownloadButton:s=!1,onQuoteLoaded:l,onQuoteAccepted:u,onQuoteUnavailableError:d,suppressQuoteUnavailableErrorNotification:c=!1}){return n.jsx(dn.Provider,{value:{id:e,invoiceQuoteViewComponent:t,onInvoiceDownloadError:i,onPaymentSuccess:a,shadow:o,className:r,hideDownloadButton:s,onQuoteUnavailableError:d,suppressQuoteUnavailableErrorNotification:c},children:n.jsx(Sa,{onQuoteAccepted:u,onQuoteLoaded:l})})}function Sa({onQuoteAccepted:t,onQuoteLoaded:o}){var r,s,l,u,d,c,p;const{apiHost:m}=e.useContext(te),y=oe(),{className:g,id:b,hideDownloadButton:h,onQuoteUnavailableError:v,suppressQuoteUnavailableErrorNotification:f}=e.useContext(dn),{data:x,isLoading:C,error:w}=a.useQuery({queryKey:K({id:b,token:y}),queryFn:async()=>await(async({token:n,apiHost:e,id:t})=>{const i=await In(Ca,{apiHost:e,token:n},{id:t});return null==i?void 0:i.formattedQuote})({token:y,apiHost:m,id:b}),placeholderData:a.keepPreviousData}),{acceptBoxVisible:j,isAccepting:S,sendAccept:I,setAcceptBoxVisible:L,setIsAccepting:P,startAcceptance:k,pandadocPollingModalVisible:N,setPandadocPollingModalVisible:F,isSendAcceptPending:D}=va({token:y,apiHost:m,quoteId:b,onQuoteAccepted:t});(({data:n,token:t})=>{const i=a.useQueryClient(),{searchParams:o}=e.useContext(xa),r=o?o.get("event"):null;e.useEffect(()=>{n&&"signing_complete"===r&&(n.state="ACCEPTED",i.setQueryData(K({id:null==n?void 0:n.id,token:t}),n))},[n,r,i,t])})({data:x,token:y});const T=H();e.useEffect(()=>{x&&(null==o||o(x))},[x]),e.useEffect(()=>{var n,e,t;if(w){const i=null===(t=null===(e=null===(n=null==w?void 0:w.response)||void 0===n?void 0:n.errors)||void 0===e?void 0:e[0])||void 0===t?void 0:t.message;(null==i?void 0:i.includes("This quote is currently unavailable"))&&(null==v||v(),f||wa(i,null))}},[w]);const{paymentHoldModalVisible:q,setPaymentHoldModalVisible:A,shouldDoPaymentHold:M,paymentHoldCompleted:E}=(n=>{var t,i;const[a,o]=e.useState(!1),r=n?Jn(fa,n):void 0;return{paymentHoldModalVisible:a,setPaymentHoldModalVisible:o,shouldDoPaymentHold:!0===(null===(t=null==r?void 0:r.quote)||void 0===t?void 0:t.payToAccept),paymentHoldCompleted:!!(null===(i=null==r?void 0:r.quote)||void 0===i?void 0:i.currentPaymentHold)}})(x),Q=null===(r=null==x?void 0:x.quote)||void 0===r?void 0:r.currentPaymentHold;if(!x||C)return n.jsx(n.Fragment,{});const $="ACCEPTED"===x.state,_=null===(s=x.quote)||void 0===s?void 0:s.firstInvoice;return"PAID"===(null==_?void 0:_.state)&&E?n.jsx(Ai,{id:_.id}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-4 ${T?"bunny-w-full bunny-overflow-hidden":""} ${g}`,children:[n.jsx(ya,{isAccepted:$,formattedQuote:x,isMobile:T,hideDownloadButton:h,id:b,isAccepting:S,handleClickAccept:()=>{M&&!E?A(!0):k()},setPaymentHoldModalVisible:A,shouldDoPaymentHold:M,paymentHoldCompleted:E,paymentHold:Q,isSendAcceptPending:D}),n.jsx(qi,{html:x.html,targetUrl:(null===(l=null==x?void 0:x.quote)||void 0===l?void 0:l.documentTemplateId)?"/pdf/quote":void 0,children:(null===(d=null===(u=null==x?void 0:x.quote)||void 0===u?void 0:u.documents)||void 0===d?void 0:d.length)&&(null===(p=null===(c=null==x?void 0:x.quote)||void 0===c?void 0:c.documents)||void 0===p?void 0:p.length)>0?n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-items-end",children:x.quote.documents.map((e,t)=>n.jsx(i.Button,{download:e.filename,href:e.url,type:"link",children:e.filename},t))}):null})]}),n.jsx(Zi,{acceptBoxVisible:j,formattedQuote:x,setAcceptBoxVisible:L,setIsAccepting:P,sendAccept:I,isSendAcceptPending:D}),n.jsx(Xi,{visible:q,setVisible:A,formattedQuote:x,sendAccept:I}),n.jsx(Ei,{isVisible:N,setVisible:F,id:b})]})}ne("\n fragment Quote_PaymentHoldFragment on FormattedQuote {\n quote {\n currentPaymentHold {\n ...PaymentHoldDisplay_QuoteButtonsFragment\n }\n firstInvoice {\n id\n }\n }\n }\n ",[ma]),ne("\n fragment OnQuoteLoadedFragment on FormattedQuote {\n vendorName\n quote {\n id\n }\n }\n ");const Ia=e.createContext({}),La=n=>`\n query quotes {\n quotes ${n?`(${n})`:""} {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n nodes {\n id\n name\n account {\n name\n id\n }\n applicationDate\n state\n createdAt\n expiresAt\n currencyId\n amount\n number\n }\n }\n }`;var Pa;!function(n){n.INVOICE="INVOICE",n.PAYMENT="PAYMENT",n.REFUND="REFUND",n.WRITE_OFF="WRITE_OFF"}(Pa||(Pa={}));const ka=n=>`\nquery transactions {\n transactions ${n?`(${n})`:""} {\n nodes {\n amount\n createdAt\n currencyId\n description\n id\n kind\n state\n transactionableId\n transactionable {\n ...on Payment { amount }\n ...on Invoice { amount number dueAt issuedAt isLegacy }\n ...on CreditNote { amount number issuedAt }\n }\n account {\n name\n id\n }\n }\n }\n}`;var Na;!function(n){n.not_due="not_due",n.due="due",n.unpaid="unpaid",n.paid="paid",n.voided="voided",n.ready="ready",n.failed="failed",n.preparing="preparing",n.unapplied="unapplied",n.partially_applied="partially_applied",n.applied="applied"}(Na||(Na={}));var Fa=Na;const Da=({state:t})=>{const{transactionStateRenderer:i}=e.useContext(Ia);return i?n.jsx(n.Fragment,{children:i(t)}):n.jsx(ra,{color:Ta(t),children:u.capitalize(u.startCase(t))})},Ta=n=>{switch(n){case Fa.not_due:return"yellow";case Fa.voided:return"black";case Fa.ready:return"orange";case Fa.preparing:return"purple";case Fa.unapplied:case Fa.partially_applied:case Fa.applied:return"blue";case Fa.due:case Fa.unpaid:return"orange";case Fa.failed:return"red";case Fa.paid:return"green";default:return"blue"}},{Text:qa}=i.Typography,Aa=({date:e})=>n.jsx(qa,{className:"bunny-text-sm",children:sa(e)}),Ma=({className:e,color:t=I})=>n.jsxs("svg",{className:e,fill:"none",height:"16",viewBox:"0 0 16 16",width:"16",xmlns:"http://www.w3.org/2000/svg",children:[n.jsx("path",{d:"M8 11.3333V2",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M4 7.33301L8 11.333L12 7.33301",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M12.6654 14H3.33203",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ha=({transaction:t,token:i,apiHost:a})=>{const{darkMode:o}=e.useContext(te),{downloadTransactionLink:r}=e.useContext(Ia),s=wi(),l=H(),u="INVOICE"===t.kind||void 0!==r,d=r?r(t.transactionableId):`${a}/api/pdf/invoice/${t.transactionableId}`;return u?n.jsx("div",{onClick:n=>{n.stopPropagation(),s(d,i)},children:n.jsx(Ma,{className:""+(l?"":"bunny-show-on-hover"),color:o?"rgb(255 255 255)":I})}):null},Ea=Vt.div.withConfig({shouldForwardProp:n=>!["gridColumn","padding","right"].includes(n)})`
79
79
  ${n=>n.gridColumn&&`grid-column: ${n.gridColumn};`}
80
80
 
81
81
  display: flex;
@@ -85,26 +85,26 @@
85
85
  text-align: ${n=>n.right?"right":"left"};
86
86
  white-space: nowrap;
87
87
  font-size: 14px;
88
- color: ${w};
88
+ color: ${I};
89
89
 
90
90
  background-color: inherit;
91
91
 
92
92
  padding: 1rem;
93
93
  min-width: 48px;
94
- `,{Text:qa}=i.Typography,Aa=()=>{const{noTransactionsMessage:t}=e.useContext(xa);return n.jsx(qa,{className:"bunny-flex bunny-justify-center bunny-p-4 bunny-text-base",children:t||"There are no transactions"})},{Text:Ma}=i.Typography,Ha=({transaction:e})=>(n=>"INVOICE"===n.kind)(e)?n.jsx(Ma,{className:"bunny-text-slate-400",style:{fontSize:"11px"},children:e.transactionable.number}):n.jsx(n.Fragment,{});function Qa(n,e){return n.kind===wa.PAYMENT?n.createdAt:n.kind!==wa.REFUND&&"dueAt"===e?n.transactionable.dueAt||"":"issuedAt"===e?n.transactionable.issuedAt||"":n.createdAt}const{Text:Ea}=i.Typography,$a=({transactions:t,onTransactionClick:i})=>{const{columns:a,transactionDateType:o}=e.useContext(xa),{apiHost:r,darkMode:s}=e.useContext(Jn),u=te(),d=a.includes("date"),c=a.includes("title"),p=a.includes("accountName"),m=a.includes("download"),y=a.includes("amount"),g=a.includes("state");return 0===(null==t?void 0:t.length)?n.jsx(Aa,{}):n.jsx(n.Fragment,{children:null==t?void 0:t.map((e,t)=>{var a,b;const h=void 0!==i;return n.jsxs("div",{className:`bunny-contents ${h&&"cursor-pointer"} bunny-show-on-hover-container`,onClick:()=>{null==i||i(e)},style:{backgroundColor:t%2==0?`var(--row-background${s?"-dark":""})`:`var(--row-background-alternate${s?"-dark":""})`},children:[!d&&!c&&!g&&!y&&!m&&!p&&n.jsx(Ta,{children:n.jsx(Ea,{children:"No columns selected"})}),d&&n.jsx(Ta,{right:!1,children:n.jsx(Na,{date:Qa(e,o)})}),c&&n.jsx(n.Fragment,{children:n.jsxs(Ta,{right:!1,className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(Ea,{children:l.capitalize(e.kind.toLowerCase())}),n.jsx(Ha,{transaction:e})]})}),p&&n.jsx(Ta,{right:!1,children:n.jsx(Ea,{children:null===(a=e.account)||void 0===a?void 0:a.name})}),!d&&!c&&!p&&n.jsx(Ta,{right:!1}),m&&n.jsx(Ta,{children:n.jsx(Da,{transaction:e,token:u,apiHost:r})}),g?n.jsx(Ta,{right:!1,children:n.jsx(La,{state:e.state})}):null,y&&n.jsx(Ta,{right:!0,children:n.jsx(Ea,{children:ct((null===(b=null==e?void 0:e.transactionable)||void 0===b?void 0:b.amount)||e.amount,e.currencyId)})})]},t)})})},{Text:_a}=i.Typography,Ra=({transactions:t,onTransactionClick:i})=>{const{columns:a,transactionDateType:o}=e.useContext(xa),{apiHost:r,darkMode:s}=e.useContext(Jn),u=te(),d=a.includes("amount"),c=a.includes("date"),p=a.includes("title"),m=a.includes("accountName"),y=a.includes("download"),g=a.includes("state");return 0===(null==t?void 0:t.length)?n.jsx(Aa,{}):n.jsx(n.Fragment,{children:null==t?void 0:t.map((e,t)=>{var a;const b="INVOICE"===e.kind;return n.jsxs("div",{className:`bunny-contents ${b&&"cursor-pointer"} bunny-show-on-hover-container`,onClick:()=>{i(e)},style:{backgroundColor:t%2==0?`var(--row-background${s?"-dark":""})`:`var(--row-background-alternate${s?"-dark":""})`},children:[n.jsx(Ta,{children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(p||g)&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[p&&n.jsxs(n.Fragment,{children:[n.jsx(_a,{children:l.capitalize(e.kind.toLowerCase())}),n.jsx(Ha,{transaction:e})]}),g&&n.jsx(La,{state:e.state})]}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[m&&n.jsx(_a,{children:null===(a=e.account)||void 0===a?void 0:a.name}),m&&c&&n.jsx(_a,{children:"·"}),c&&n.jsx(Na,{date:Qa(e,o)}),c&&d&&n.jsx(_a,{children:"·"}),d&&n.jsx(_a,{children:ct(e.transactionable.amount||e.amount,e.currencyId)})]})]})}),y&&n.jsx(Ta,{right:!0,children:n.jsx(Da,{transaction:e,token:u,apiHost:r})})]},t)})})},{Text:Ba}=i.Typography;function Ua({transactions:a,onSearchValueChanged:o,search:r}){var s,l;const{showSearchBar:u,showTitle:d,title:c,transactionComponent:p,useModal:m,suppressTransactionDisplay:y,className:g,shadow:b,searchBarClassName:h,style:v,onTransactionClick:f,onTransactionDisplayClose:x,kindsToShow:C,filterTransactions:w,sortTransactions:j,hidePaymentForm:S}=e.useContext(xa),{columns:I}=e.useContext(xa),{darkMode:L}=e.useContext(Jn),{secondaryColor:P}=bn(),[k,N]=e.useState(null),[F,D]=e.useState(!1),T=null===(l=null===(s=null==a?void 0:a.filter(n=>!C||C.includes(n.kind)))||void 0===s?void 0:s.filter(w||(()=>!0)))||void 0===l?void 0:l.sort(j||(()=>0)),A=q();function M(n){f&&f(n),y||(N(n),D(!0))}const H=()=>{if(!k)return"";const n=k.kind.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)};function Q(){null==x||x(k),D(!1)}return n.jsxs("div",{style:v,children:[n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-w-full bunny-gap-2 ${A?"bunny-overflow-hidden":""} ${g}`,children:[d||u?n.jsxs("div",{className:`bunny-flex ${A?"bunny-flex-col bunny-gap-1":"bunny-flex-row bunny-items-center"} bunny-justify-between`,children:[d?n.jsx(Ba,{className:"bunny-shrink-0 bunny-font-medium",style:{color:L?void 0:P},children:c}):n.jsx("div",{}),u&&n.jsx("div",{className:""+(A?"bunny-w-full":""),children:n.jsx(i.Input,{className:h||"",onChange:n=>{const e=n.target.value;(""===e||!isNaN(Number(e))&&/^-?\d*\.?\d*$/.test(e))&&o(e)},prefix:n.jsx(t.SearchOutlined,{}),placeholder:"Search by amount",style:{minWidth:"300px"},value:r})})]}):null,n.jsx("div",{className:`bunny-grid bunny-w-full bunny-rounded-md bunny-overflow-auto ${b}`,style:{gridTemplateColumns:(()=>{let n=[];if(A)(I.includes("date")||I.includes("title")||I.includes("state")||I.includes("amount"))&&n.push("auto"),I.includes("download")&&n.push("auto");else{const e=["accountName","date","title"].filter(n=>I.includes(n)).length;0===e||1===e?n.push("3fr"):n.push(...Array(e-1).fill("auto"),"3fr");const t=["download","state","amount"].filter(n=>I.includes(n)).length;n.push(...Array(t).fill("auto"))}return n.join(" ")})(),backgroundColor:`var(--row-background${L?"-dark":""})`},children:A?n.jsx(Ra,{transactions:T,onTransactionClick:M}):n.jsx($a,{transactions:T,onTransactionClick:M})})]}),m?n.jsx(i.Modal,{title:H(),open:F,onOk:Q,onCancel:Q,width:1200,footer:null,children:n.jsx(Di,{id:null==k?void 0:k.transactionableId,hidePaymentForm:S})}):n.jsx(i.Drawer,{title:H(),onClose:Q,open:F,width:1200,children:p||("INVOICE"===(null==k?void 0:k.kind)?n.jsx(Di,{id:k.transactionableId,hidePaymentForm:S}):n.jsxs(i.Card,{className:"bunny-shadow-md",children:[n.jsx(i.Typography.Title,{level:2,className:"bunny-mb-4",children:"Transaction Details"}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Amount:"})," ",n.jsx(i.Typography.Text,{children:ct((null==k?void 0:k.amount)||0,(null==k?void 0:k.currencyId)||"USD")})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Description:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.description})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Kind:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.kind})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"State:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.state})]})]}))})]})}function Va(){const{apiHost:t}=e.useContext(Jn),i=te(),{filter:o}=e.useContext(xa),[r,s]=e.useState(""),l=o||(r?`filter: "quote.id is ${r}"`:""),{data:u}=a.useQuery({queryKey:B(l,i),queryFn:()=>(async({token:n,apiHost:e,filter:t})=>{const i=await cn({query:Ca(t),token:n,vars:{},apiHost:e});return null==i?void 0:i.quotes})({token:i,apiHost:t,filter:l}),placeholderData:a.keepPreviousData});if(void 0===u)return null;const d=u.nodes.filter(n=>"DRAFT"!==n.state).map(n=>{var e,t;return{transactionableId:n.id,state:n.state,amount:n.amount||n.amountDue,kind:"QUOTE",currencyId:n.currencyId,transactionable:{number:n.number},createdAt:n.createdAt,account:{name:null===(e=n.account)||void 0===e?void 0:e.name,id:null===(t=n.account)||void 0===t?void 0:t.id}}});return n.jsx(Ua,{transactions:d,onSearchValueChanged:s,search:r})}const Oa=Wn("\n fragment canApplyCoupons_QuoteFragment on Quote {\n id\n kind\n amountDue\n }\n ",[]),Za=Wn("\n fragment canApplyCoupons_SubscriptionFragment on Subscription {\n id\n state\n charges {\n discountedPrice\n }\n }\n ",[]);function Ka(n,e,t){var i,a;const o=Yn(Oa,n),r=Yn(Za,t),s=(null===(i=null==r?void 0:r.state)||void 0===i?void 0:i.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL")||(null===(a=null==r?void 0:r.state)||void 0===a?void 0:a.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL_EXPIRED"),l=void 0===r;const u=(null==o?void 0:o.kind)===Wn.scalar("QuoteChangeKind","SUBSCRIBE")||(null==o?void 0:o.kind)===Wn.scalar("QuoteChangeKind","ADJUSTMENT")||(null==o?void 0:o.kind)===Wn.scalar("QuoteChangeKind","ACTIVATE");if(0==(null==o?void 0:o.amountDue))return!1;if(u){const n=e&&(s||function(){var n;return 0===(null===(n=null==r?void 0:r.charges)||void 0===n?void 0:n.reduce((n,e)=>n+Number((null==e?void 0:e.discountedPrice)||0),0))}()||l);return n}return!1}const za=Wn("\n fragment CheckoutSummary_QuoteFragment on Quote {\n id\n amountDue\n subtotal\n taxAmount\n currencyId\n payToAccept\n amount\n quoteChanges {\n id\n charges {\n id\n kind\n name\n coupon {\n couponCode\n }\n quantity\n subtotal\n currencyId\n }\n }\n ...canApplyCoupons_QuoteFragment\n }\n ",[Oa]),Ga=Wn("\n fragment SignupPaymentForm_QuoteFragment on Quote {\n ...PaymentForm_QuoteFragment\n payToAccept\n amountDue\n amount\n id\n }\n ",[ci]),Ya=Wn("\n fragment SignupQuote_QuoteFragment on Quote {\n id\n formattedQuote {\n html\n }\n acceptedAt\n acceptedByName\n state\n documentTemplateId\n }\n"),Wa={ACTIVE:"green",TRIAL:"blue",CANCELED:"red",EXPIRED:"gray",TRIAL_EXPIRED:"red",PENDING:"yellow"},Xa=Gn(),Ja=n=>0===n?Xa.scalar("BillingPeriod","ONCE"):1===n?Xa.scalar("BillingPeriod","MONTHLY"):3===n?Xa.scalar("BillingPeriod","QUARTERLY"):6===n?Xa.scalar("BillingPeriod","SEMI_ANNUAL"):12===n?Xa.scalar("BillingPeriod","ANNUAL"):null,no=n=>n===Xa.scalar("BillingPeriod","ONCE")?0:n===Xa.scalar("BillingPeriod","MONTHLY")?1:n===Xa.scalar("BillingPeriod","QUARTERLY")?3:n===Xa.scalar("BillingPeriod","SEMI_ANNUAL")?6:12,{Text:eo}=i.Typography,to=Wn("\n fragment PriceListDisplay_PriceListFragment on PriceList {\n product {\n name\n }\n name\n basePrice\n currencyId\n trialAllowed\n trialLengthDays\n periodMonths\n }\n "),io=Wn("\n fragment PriceListDisplay_QuoteFragment on Quote {\n quoteChanges {\n isTrial\n }\n }\n ");function ao({priceList:e,quote:t}){var i,a,o,r,s;const{enableTrial:l}=$r(),u=Yn(to,e),d=Yn(io,t),c=Ja(null==u?void 0:u.periodMonths),p=c?P[c]:"undefined",m=d?(null!==(a=null===(i=d.quoteChanges)||void 0===i?void 0:i.length)&&void 0!==a?a:0)>0&&!0===(null===(o=d.quoteChanges)||void 0===o?void 0:o.every(n=>n.isTrial)):!(!(null==u?void 0:u.trialAllowed)||!l);return u?n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-0",children:[n.jsxs(eo,{className:"bunny-text-slate-500 bunny-font-bold bunny-text-lg",children:[null===(r=u.product)||void 0===r?void 0:r.name," ",u.name]}),n.jsxs(eo,{className:"bunny-font-bold bunny-text-xl",children:[ct(u.basePrice,u.currencyId)," / ",p]})]}),m?n.jsx("div",{className:"bunny-flex",children:n.jsx(ea,{color:Wa.TRIAL,children:`${null!==(s=u.trialLengthDays)&&void 0!==s?s:"N/A"} day trial`})}):null]}):null}const oo=Wn("\n fragment Signup_QuoteFragment on Quote {\n ...CheckoutSummary_QuoteFragment\n ...PaymentForm_QuoteFragment\n ...SignupPaymentForm_QuoteFragment\n ...SignupQuote_QuoteFragment\n ...PriceListDisplay_QuoteFragment\n state\n id\n accountId\n currencyId\n amountDue\n amount\n payToAccept\n quoteChanges {\n id\n isTrial\n }\n account {\n billingContactId\n }\n }\n ",[za,ci,Ga,Ya,io]),ro=Wn("\n query SignupQuote($id: ID!) {\n quote(id: $id) {\n ...Signup_QuoteFragment\n }\n }\n ",[oo]),so=({tokenOverride:n})=>{const t=te(),i=null!=n?n:t,{apiHost:o}=e.useContext(Jn),r=a.useQueryClient(),s=Z({token:i}),{data:l,refetch:u}=a.useQuery({queryKey:s,queryFn:async()=>{const n=r.getQueryData(s),e=null==n?void 0:n.id;if(!e)return;const t=await(async({id:n,token:e,apiHost:t})=>{const i=await wn(ro,{apiHost:t,token:e},{id:n});return null==i?void 0:i.quote})({id:e,token:i,apiHost:o});return null!=t?t:void 0},enabled:!1,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return{data:l,refetch:u}},[lo,uo]=yn();function co({children:t}){var o;const{apiHost:r}=e.useContext(Jn),s=te(),l=a.useQueryClient(),[,u]=Mr(),d=Qr(),c=i.Form.useWatch("firstName",d),p=i.Form.useWatch("title",d),{data:m}=so({tokenOverride:s}),y=Yn(oo,m),{hasSigningPlugins:g,sendAccept:b,startAcceptance:h}=ma({apiHost:r,token:s,quoteId:null!==(o=null==y?void 0:y.id)&&void 0!==o?o:void 0,onQuoteAccepted:n=>{u(!0),s&&n&&l.setQueryData(Z({token:s}),e=>e?{...e,id:n.id,state:n.state,acceptedAt:n.acceptedAt,acceptedByName:n.acceptedByName,acceptedByTitle:n.acceptedByTitle}:e)}});return n.jsx(lo,{value:{hasSigningPlugins:g,onPaymentHoldSuccess:()=>{g?h():b({name:null!=c?c:"",title:null!=p?p:"",poNumber:null,taxNumber:null})}},children:t})}const po=({color:e})=>n.jsxs("svg",{width:"45",height:"15",viewBox:"0 0 39 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_6_851)",children:[n.jsx("path",{className:"bunny-icon-path",d:"M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z",fill:e})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_6_851",children:n.jsx("rect",{width:"39",height:"13",fill:"white"})})})]}),{Text:mo}=i.Typography,yo=({className:e})=>{const t=te(),{currentUser:i}=mi(t),{privacyUrl:a,termsUrl:o}=i,r=q();return n.jsxs("div",{className:`bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ${r?"bunny-flex-col bunny-gap-2":""} ${e}`,children:[(o||a)&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-3",children:[o&&n.jsx(bo,{className:"bunny-text-xs bunny-text-slate-400",href:o,rel:"noopener noreferrer",target:"_blank",type:"text",children:"Terms"}),a&&n.jsx(bo,{className:"bunny-text-xs bunny-text-slate-400",href:a,rel:"noopener noreferrer",target:"_blank",type:"text",children:"Privacy"})]}),n.jsx(go,{})]})},go=()=>{const[t,i]=e.useState(!1),a=q();return n.jsx("div",{className:"bunny-flex bunny-items-end bunny-justify-end "+(a?"":"grow"),children:n.jsx(ho,{className:"bunny-flex bunny-items-end bunny-justify-end bunny-text-slate-400",href:"https://bunny.com/",rel:"noopener noreferrer",target:"_blank",children:n.jsxs("div",{className:"bunny-flex bunny-items-center",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[n.jsx(mo,{className:"bunny-text-slate-400",children:"Powered by "}),n.jsx("div",{style:{paddingTop:"5px"},children:n.jsx(po,{color:t?S:x})})]})})})},bo=c.a`
95
- color: ${x};
94
+ `,{Text:Qa}=i.Typography,$a=()=>{const{noTransactionsMessage:t}=e.useContext(Ia);return n.jsx(Qa,{className:"bunny-flex bunny-justify-center bunny-p-4 bunny-text-base",children:t||"There are no transactions"})},{Text:_a}=i.Typography,Ra=({transaction:e})=>(n=>"INVOICE"===n.kind)(e)?n.jsx(_a,{className:"bunny-text-slate-400",style:{fontSize:"11px"},children:e.transactionable.number}):n.jsx(n.Fragment,{});function Ba(n,e){return n.kind===Pa.PAYMENT?n.createdAt:n.kind!==Pa.REFUND&&"dueAt"===e?n.transactionable.dueAt||"":"issuedAt"===e?n.transactionable.issuedAt||"":n.createdAt}const{Text:Ua}=i.Typography,Va=({transactions:t,onTransactionClick:i})=>{const{columns:a,transactionDateType:o}=e.useContext(Ia),{apiHost:r,darkMode:s}=e.useContext(te),l=oe(),d=a.includes("date"),c=a.includes("title"),p=a.includes("accountName"),m=a.includes("download"),y=a.includes("amount"),g=a.includes("state");return 0===(null==t?void 0:t.length)?n.jsx($a,{}):n.jsx(n.Fragment,{children:null==t?void 0:t.map((e,t)=>{var a,b;const h=void 0!==i;return n.jsxs("div",{className:`bunny-contents ${h&&"cursor-pointer"} bunny-show-on-hover-container`,onClick:()=>{null==i||i(e)},style:{backgroundColor:t%2==0?`var(--row-background${s?"-dark":""})`:`var(--row-background-alternate${s?"-dark":""})`},children:[!d&&!c&&!g&&!y&&!m&&!p&&n.jsx(Ea,{children:n.jsx(Ua,{children:"No columns selected"})}),d&&n.jsx(Ea,{right:!1,children:n.jsx(Aa,{date:Ba(e,o)})}),c&&n.jsx(n.Fragment,{children:n.jsxs(Ea,{right:!1,className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(Ua,{children:u.capitalize(e.kind.toLowerCase())}),n.jsx(Ra,{transaction:e})]})}),p&&n.jsx(Ea,{right:!1,children:n.jsx(Ua,{children:null===(a=e.account)||void 0===a?void 0:a.name})}),!d&&!c&&!p&&n.jsx(Ea,{right:!1}),m&&n.jsx(Ea,{children:n.jsx(Ha,{transaction:e,token:l,apiHost:r})}),g?n.jsx(Ea,{right:!1,children:n.jsx(Da,{state:e.state})}):null,y&&n.jsx(Ea,{right:!0,children:n.jsx(Ua,{children:yt((null===(b=null==e?void 0:e.transactionable)||void 0===b?void 0:b.amount)||e.amount,e.currencyId)})})]},t)})})},{Text:Oa}=i.Typography,Za=({transactions:t,onTransactionClick:i})=>{const{columns:a,transactionDateType:o}=e.useContext(Ia),{apiHost:r,darkMode:s}=e.useContext(te),l=oe(),d=a.includes("amount"),c=a.includes("date"),p=a.includes("title"),m=a.includes("accountName"),y=a.includes("download"),g=a.includes("state");return 0===(null==t?void 0:t.length)?n.jsx($a,{}):n.jsx(n.Fragment,{children:null==t?void 0:t.map((e,t)=>{var a;const b="INVOICE"===e.kind;return n.jsxs("div",{className:`bunny-contents ${b&&"cursor-pointer"} bunny-show-on-hover-container`,onClick:()=>{i(e)},style:{backgroundColor:t%2==0?`var(--row-background${s?"-dark":""})`:`var(--row-background-alternate${s?"-dark":""})`},children:[n.jsx(Ea,{children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(p||g)&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[p&&n.jsxs(n.Fragment,{children:[n.jsx(Oa,{children:u.capitalize(e.kind.toLowerCase())}),n.jsx(Ra,{transaction:e})]}),g&&n.jsx(Da,{state:e.state})]}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[m&&n.jsx(Oa,{children:null===(a=e.account)||void 0===a?void 0:a.name}),m&&c&&n.jsx(Oa,{children:"·"}),c&&n.jsx(Aa,{date:Ba(e,o)}),c&&d&&n.jsx(Oa,{children:"·"}),d&&n.jsx(Oa,{children:yt(e.transactionable.amount||e.amount,e.currencyId)})]})]})}),y&&n.jsx(Ea,{right:!0,children:n.jsx(Ha,{transaction:e,token:l,apiHost:r})})]},t)})})},{Text:za}=i.Typography;function Ka({transactions:a,onSearchValueChanged:o,search:r}){var s,l;const{showSearchBar:u,showTitle:d,title:c,transactionComponent:p,useModal:m,suppressTransactionDisplay:y,className:g,shadow:b,searchBarClassName:h,style:v,onTransactionClick:f,onTransactionDisplayClose:x,kindsToShow:C,filterTransactions:w,sortTransactions:j,hidePaymentForm:S}=e.useContext(Ia),{columns:I}=e.useContext(Ia),{darkMode:L}=e.useContext(te),{secondaryColor:P}=fn(),[k,N]=e.useState(null),[F,D]=e.useState(!1),T=null===(l=null===(s=null==a?void 0:a.filter(n=>!C||C.includes(n.kind)))||void 0===s?void 0:s.filter(w||(()=>!0)))||void 0===l?void 0:l.sort(j||(()=>0)),q=H();function A(n){f&&f(n),y||(N(n),D(!0))}const M=()=>{if(!k)return"";const n=k.kind.toLowerCase();return n.charAt(0).toUpperCase()+n.slice(1)};function E(){null==x||x(k),D(!1)}return n.jsxs("div",{style:v,children:[n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-w-full bunny-gap-2 ${q?"bunny-overflow-hidden":""} ${g}`,children:[d||u?n.jsxs("div",{className:`bunny-flex ${q?"bunny-flex-col bunny-gap-1":"bunny-flex-row bunny-items-center"} bunny-justify-between`,children:[d?n.jsx(za,{className:"bunny-shrink-0 bunny-font-medium",style:{color:L?void 0:P},children:c}):n.jsx("div",{}),u&&n.jsx("div",{className:""+(q?"bunny-w-full":""),children:n.jsx(i.Input,{className:h||"",onChange:n=>{const e=n.target.value;(""===e||!isNaN(Number(e))&&/^-?\d*\.?\d*$/.test(e))&&o(e)},prefix:n.jsx(t.SearchOutlined,{}),placeholder:"Search by amount",style:{minWidth:"300px"},value:r})})]}):null,n.jsx("div",{className:`bunny-grid bunny-w-full bunny-rounded-md bunny-overflow-auto ${b}`,style:{gridTemplateColumns:(()=>{let n=[];if(q)(I.includes("date")||I.includes("title")||I.includes("state")||I.includes("amount"))&&n.push("auto"),I.includes("download")&&n.push("auto");else{const e=["accountName","date","title"].filter(n=>I.includes(n)).length;0===e||1===e?n.push("3fr"):n.push(...Array(e-1).fill("auto"),"3fr");const t=["download","state","amount"].filter(n=>I.includes(n)).length;n.push(...Array(t).fill("auto"))}return n.join(" ")})(),backgroundColor:`var(--row-background${L?"-dark":""})`},children:q?n.jsx(Za,{transactions:T,onTransactionClick:A}):n.jsx(Va,{transactions:T,onTransactionClick:A})})]}),m?n.jsx(i.Modal,{title:M(),open:F,onOk:E,onCancel:E,width:1200,footer:null,children:n.jsx(Ai,{id:null==k?void 0:k.transactionableId,hidePaymentForm:S})}):n.jsx(i.Drawer,{title:M(),onClose:E,open:F,width:1200,children:p||("INVOICE"===(null==k?void 0:k.kind)?n.jsx(Ai,{id:k.transactionableId,hidePaymentForm:S}):n.jsxs(i.Card,{className:"bunny-shadow-md",children:[n.jsx(i.Typography.Title,{level:2,className:"bunny-mb-4",children:"Transaction Details"}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Amount:"})," ",n.jsx(i.Typography.Text,{children:yt((null==k?void 0:k.amount)||0,(null==k?void 0:k.currencyId)||"USD")})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Description:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.description})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"Kind:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.kind})]}),n.jsxs(i.Typography.Paragraph,{children:[n.jsx("strong",{children:"State:"})," ",n.jsx(i.Typography.Text,{children:null==k?void 0:k.state})]})]}))})]})}function Ga(){const{apiHost:t}=e.useContext(te),i=oe(),{filter:o}=e.useContext(Ia),[r,s]=e.useState(""),l=o||(r?`filter: "quote.id is ${r}"`:""),{data:u}=a.useQuery({queryKey:O(l,i),queryFn:()=>(async({token:n,apiHost:e,filter:t})=>{const i=await yn({query:La(t),token:n,vars:{},apiHost:e});return null==i?void 0:i.quotes})({token:i,apiHost:t,filter:l}),placeholderData:a.keepPreviousData});if(void 0===u)return null;const d=u.nodes.filter(n=>"DRAFT"!==n.state).map(n=>{var e,t;return{transactionableId:n.id,state:n.state,amount:n.amount||n.amountDue,kind:"QUOTE",currencyId:n.currencyId,transactionable:{number:n.number},createdAt:n.createdAt,account:{name:null===(e=n.account)||void 0===e?void 0:e.name,id:null===(t=n.account)||void 0===t?void 0:t.id}}});return n.jsx(Ka,{transactions:d,onSearchValueChanged:s,search:r})}const Ya=ne("\n fragment canApplyCoupons_QuoteFragment on Quote {\n id\n kind\n amountDue\n }\n ",[]),Wa=ne("\n fragment canApplyCoupons_SubscriptionFragment on Subscription {\n id\n state\n charges {\n discountedPrice\n }\n }\n ",[]);function Xa(n,e,t){var i,a;const o=Jn(Ya,n),r=Jn(Wa,t),s=(null===(i=null==r?void 0:r.state)||void 0===i?void 0:i.toUpperCase())===ne.scalar("SubscriptionState","TRIAL")||(null===(a=null==r?void 0:r.state)||void 0===a?void 0:a.toUpperCase())===ne.scalar("SubscriptionState","TRIAL_EXPIRED"),l=void 0===r;const u=(null==o?void 0:o.kind)===ne.scalar("QuoteChangeKind","SUBSCRIBE")||(null==o?void 0:o.kind)===ne.scalar("QuoteChangeKind","ADJUSTMENT")||(null==o?void 0:o.kind)===ne.scalar("QuoteChangeKind","ACTIVATE");if(0==(null==o?void 0:o.amountDue))return!1;if(u){const n=e&&(s||function(){var n;return 0===(null===(n=null==r?void 0:r.charges)||void 0===n?void 0:n.reduce((n,e)=>n+Number((null==e?void 0:e.discountedPrice)||0),0))}()||l);return n}return!1}const Ja=ne("\n fragment CheckoutSummary_QuoteFragment on Quote {\n id\n amountDue\n subtotal\n taxAmount\n currencyId\n payToAccept\n amount\n quoteChanges {\n id\n charges {\n id\n kind\n name\n coupon {\n couponCode\n }\n quantity\n subtotal\n currencyId\n }\n }\n ...canApplyCoupons_QuoteFragment\n }\n ",[Ya]),no=ne("\n fragment SignupPaymentForm_QuoteFragment on Quote {\n ...PaymentForm_QuoteFragment\n payToAccept\n amountDue\n amount\n id\n }\n ",[yi]),eo=ne("\n fragment SignupQuote_QuoteFragment on Quote {\n id\n formattedQuote {\n html\n }\n acceptedAt\n acceptedByName\n state\n documentTemplateId\n }\n"),to={ACTIVE:"green",TRIAL:"blue",CANCELED:"red",EXPIRED:"gray",TRIAL_EXPIRED:"red",PENDING:"yellow"},io=Xn(),ao=n=>0===n?io.scalar("BillingPeriod","ONCE"):1===n?io.scalar("BillingPeriod","MONTHLY"):3===n?io.scalar("BillingPeriod","QUARTERLY"):6===n?io.scalar("BillingPeriod","SEMI_ANNUAL"):12===n?io.scalar("BillingPeriod","ANNUAL"):null,oo=n=>n===io.scalar("BillingPeriod","ONCE")?0:n===io.scalar("BillingPeriod","MONTHLY")?1:n===io.scalar("BillingPeriod","QUARTERLY")?3:n===io.scalar("BillingPeriod","SEMI_ANNUAL")?6:12,{Text:ro}=i.Typography,so=ne("\n fragment PriceListDisplay_PriceListFragment on PriceList {\n product {\n name\n }\n name\n basePrice\n currencyId\n trialAllowed\n trialLengthDays\n periodMonths\n }\n "),lo=ne("\n fragment PriceListDisplay_QuoteFragment on Quote {\n quoteChanges {\n isTrial\n }\n }\n ");function uo({priceList:e,quote:t}){var i,a,o,r,s;const{enableTrial:l}=Vr(),u=Jn(so,e),d=Jn(lo,t),c=ao(null==u?void 0:u.periodMonths),p=c?F[c]:"undefined",m=d?(null!==(a=null===(i=d.quoteChanges)||void 0===i?void 0:i.length)&&void 0!==a?a:0)>0&&!0===(null===(o=d.quoteChanges)||void 0===o?void 0:o.every(n=>n.isTrial)):!(!(null==u?void 0:u.trialAllowed)||!l);return u?n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-0",children:[n.jsxs(ro,{className:"bunny-text-slate-500 bunny-font-bold bunny-text-lg",children:[null===(r=u.product)||void 0===r?void 0:r.name," ",u.name]}),n.jsxs(ro,{className:"bunny-font-bold bunny-text-xl",children:[yt(u.basePrice,u.currencyId)," / ",p]})]}),m?n.jsx("div",{className:"bunny-flex",children:n.jsx(ra,{color:to.TRIAL,children:`${null!==(s=u.trialLengthDays)&&void 0!==s?s:"N/A"} day trial`})}):null]}):null}const co=ne("\n fragment Signup_QuoteFragment on Quote {\n ...CheckoutSummary_QuoteFragment\n ...PaymentForm_QuoteFragment\n ...SignupPaymentForm_QuoteFragment\n ...SignupQuote_QuoteFragment\n ...PriceListDisplay_QuoteFragment\n state\n id\n accountId\n currencyId\n amountDue\n amount\n payToAccept\n quoteChanges {\n id\n isTrial\n }\n account {\n billingContactId\n }\n }\n ",[Ja,yi,no,eo,lo]),po=ne("\n query SignupQuote($id: ID!) {\n quote(id: $id) {\n ...Signup_QuoteFragment\n }\n }\n ",[co]),mo=({tokenOverride:n})=>{const t=oe(),i=null!=n?n:t,{apiHost:o}=e.useContext(te),r=a.useQueryClient(),s=G({token:i}),{data:l,refetch:u}=a.useQuery({queryKey:s,queryFn:async()=>{const n=r.getQueryData(s),e=null==n?void 0:n.id;if(!e)return;const t=await(async({id:n,token:e,apiHost:t})=>{const i=await In(po,{apiHost:t,token:e},{id:n});return null==i?void 0:i.quote})({id:e,token:i,apiHost:o});return null!=t?t:void 0},enabled:!1,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return{data:l,refetch:u}},[yo,go]=hn();function bo({children:t}){var o;const{apiHost:r}=e.useContext(te),s=oe(),l=a.useQueryClient(),[,u]=_r(),d=Br(),c=i.Form.useWatch("firstName",d),p=i.Form.useWatch("title",d),{data:m}=mo({tokenOverride:s}),y=Jn(co,m),{hasSigningPlugins:g,sendAccept:b,startAcceptance:h}=va({apiHost:r,token:s,quoteId:null!==(o=null==y?void 0:y.id)&&void 0!==o?o:void 0,onQuoteAccepted:n=>{u(!0),s&&n&&l.setQueryData(G({token:s}),e=>e?{...e,id:n.id,state:n.state,acceptedAt:n.acceptedAt,acceptedByName:n.acceptedByName,acceptedByTitle:n.acceptedByTitle}:e)}});return n.jsx(yo,{value:{hasSigningPlugins:g,onPaymentHoldSuccess:()=>{g?h():b({name:null!=c?c:"",title:null!=p?p:"",poNumber:null,taxNumber:null})}},children:t})}const ho=({color:e})=>n.jsxs("svg",{width:"45",height:"15",viewBox:"0 0 39 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxs("g",{clipPath:"url(#clip0_6_851)",children:[n.jsx("path",{className:"bunny-icon-path",d:"M14.5898 7.19708C14.5898 9.35053 13.0926 10.325 11.2495 10.325C9.39955 10.325 7.90234 9.35001 7.90234 7.18967V3.26221H10.1125V7.00052C10.1125 7.87719 10.5855 8.27725 11.2495 8.27725C11.9061 8.27725 12.3865 7.87719 12.3865 7.00052V3.26221H14.5898V7.19708Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M31.8943 12.9625H29.4793L31.8523 8.62816L28.9355 3.26221H31.4708L33.0457 6.35524L34.5924 3.26221H37.0075L31.8943 12.9625Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M15.1602 5.96827C15.1602 3.8148 16.6574 2.84033 18.5005 2.84033C20.3504 2.84033 21.8476 3.81533 21.8476 5.97568V10.1473H19.6374V6.16483C19.6374 5.28815 19.1645 4.8881 18.5005 4.8881C17.8439 4.8881 17.3634 5.28815 17.3634 6.16483V10.1473H15.1602V5.96827Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M22.4316 5.96827C22.4316 3.8148 23.9289 2.84033 25.7719 2.84033C27.6219 2.84033 29.1191 3.81533 29.1191 5.97568V10.1473H26.9089V6.16483C26.9089 5.28815 26.4359 4.8881 25.7719 4.8881C25.1154 4.8881 24.6349 5.28815 24.6349 6.16483V10.1473H22.4316V5.96827Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M7.40511 6.68957C7.40511 8.7236 6.02815 10.3227 4.17816 10.3227C3.23907 10.3227 2.61071 9.94378 2.19358 9.40371V10.1404H0.0605469V0.0405273H2.26381V3.91939C2.68041 3.42158 3.28802 3.07069 4.17763 3.07069C6.02759 3.07069 7.40511 4.66981 7.40511 6.68957ZM2.17229 6.69642C2.17229 7.60802 2.77937 8.2744 3.64823 8.2744C4.53783 8.2744 5.13107 7.59372 5.13107 6.69642C5.13107 5.79912 4.53783 5.11844 3.64823 5.11844C2.77937 5.11844 2.17229 5.78482 2.17229 6.69642Z",fill:e}),n.jsx("path",{className:"bunny-icon-path",d:"M38.966 8.94801C38.966 9.76181 38.2668 10.4631 37.4618 10.4631C36.6499 10.4631 35.9434 9.76181 35.9434 8.94801C35.9434 8.14846 36.6494 7.46094 37.4618 7.46094C38.2668 7.46094 38.966 8.14846 38.966 8.94801Z",fill:e})]}),n.jsx("defs",{children:n.jsx("clipPath",{id:"clip0_6_851",children:n.jsx("rect",{width:"39",height:"13",fill:"white"})})})]}),{Text:vo}=i.Typography,fo=({className:e})=>{const t=oe(),{currentUser:i}=bi(t),{privacyUrl:a,termsUrl:o}=i,r=H();return n.jsxs("div",{className:`bunny-flex bunny-items-center bunny-justify-between bunny-shrink-0 ${r?"bunny-flex-col bunny-gap-2":""} ${e}`,children:[(o||a)&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-3",children:[o&&n.jsx(Co,{className:"bunny-text-xs bunny-text-slate-400",href:o,rel:"noopener noreferrer",target:"_blank",type:"text",children:"Terms"}),a&&n.jsx(Co,{className:"bunny-text-xs bunny-text-slate-400",href:a,rel:"noopener noreferrer",target:"_blank",type:"text",children:"Privacy"})]}),n.jsx(xo,{})]})},xo=()=>{const[t,i]=e.useState(!1),a=H();return n.jsx("div",{className:"bunny-flex bunny-items-end bunny-justify-end "+(a?"":"grow"),children:n.jsx(wo,{className:"bunny-flex bunny-items-end bunny-justify-end bunny-text-slate-400",href:"https://bunny.com/",rel:"noopener noreferrer",target:"_blank",children:n.jsxs("div",{className:"bunny-flex bunny-items-center",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[n.jsx(vo,{className:"bunny-text-slate-400",children:"Powered by "}),n.jsx("div",{style:{paddingTop:"5px"},children:n.jsx(ho,{color:t?P:j})})]})})})},Co=p.a`
95
+ color: ${j};
96
96
  transition: color 0.3s;
97
97
  &:hover {
98
- color: ${C};
98
+ color: ${S};
99
99
  }
100
100
  text-decoration: none;
101
- `,ho=c(bo)`
101
+ `,wo=p(Co)`
102
102
  &:hover {
103
- color: ${S} !important;
103
+ color: ${P} !important;
104
104
  }
105
- `,vo=({apiHost:n,token:e})=>{const{data:t}=Mi({apiHost:n,token:e});return Boolean(null==t?void 0:t.some(n=>"taxation"===n.type))},fo=Wn("\n mutation quoteChangeAddCoupon($couponCode: String!, $quoteChangeId: ID!) {\n quoteChangeAddCoupon(couponCode: $couponCode, quoteChangeId: $quoteChangeId) {\n quoteChange {\n id\n }\n }\n }\n"),xo=Wn("\n mutation quoteChangeRemoveCoupon($quoteChangeId: ID!, $couponCode: String!) {\n quoteChangeRemoveCoupon(quoteChangeId: $quoteChangeId, couponCode: $couponCode) {\n quoteChange {\n quote {\n id\n }\n }\n }\n }\n"),Co=n=>`\n query Coupons {\n coupons(filter: ${n?`"${n}"`:"null"}) {\n totalCount\n }\n }\n`,wo=({apiHost:n,token:e,quoteChangeId:t,onCouponAdded:i,onCouponRemoved:o})=>{const{data:r}=a.useQuery({queryKey:["coupons",e],queryFn:()=>(async({token:n,apiHost:e,filter:t})=>{const i=await cn({query:Co(t),token:n,vars:{},apiHost:e});return null==i?void 0:i.coupons})({token:e,apiHost:n,filter:"coupon.active is true"})}),{mutate:s,isPending:l}=a.useMutation({mutationFn:i=>{if(!e)throw new Error("Token is required");if(!t)throw new Error("Quote change ID is required");return(async({quoteChangeId:n,couponCode:e,token:t,apiHost:i})=>{var a;return null===(a=(await wn(fo,{apiHost:i,token:t},{couponCode:e,quoteChangeId:n})).quoteChangeAddCoupon)||void 0===a?void 0:a.quoteChange})({quoteChangeId:t,couponCode:i,apiHost:n,token:e})},onSuccess:()=>{null==i||i()}}),{mutate:u,isPending:d}=a.useMutation({mutationFn:i=>{if(!t)throw new Error("Quote change ID is required");return(async({quoteChangeId:n,couponCode:e,token:t,apiHost:i})=>{var a;return null===(a=(await wn(xo,{apiHost:i,token:t},{couponCode:e,quoteChangeId:n})).quoteChangeRemoveCoupon)||void 0===a?void 0:a.quoteChange})({quoteChangeId:t,couponCode:i,apiHost:n,token:e})},onSuccess:()=>{null==o||o()}});return{addCoupon:s,removeCoupon:u,isAddingCoupon:l,isRemovingCoupon:d,activeCouponsExist:(null==r?void 0:r.totalCount)>0}};function jo({className:e,onAddCoupon:t,isAddingCoupon:a,couponCode:o,setCouponCode:r}){return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-2 ${e}`,children:n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2",children:[n.jsx(i.Input,{value:o,onChange:n=>r(n.target.value),placeholder:"Coupon code",disabled:a,size:"small"}),n.jsx(i.Button,{loading:a,type:"primary",onClick:async function(){t(o)},disabled:0===o.length,children:"Apply"})]})})}const So=Wn("\n fragment CheckoutSummary_PriceListFragment on PriceList {\n product {\n name\n }\n name\n basePrice\n currencyId\n trialAllowed\n charges {\n id\n name\n quantityMin\n basePrice\n featureAddon\n deprecated\n }\n }\n");Wn("\n fragment sortQuoteChangeCharges_QuoteChargeFragment on QuoteCharge {\n kind\n }\n ",[]);const Io=["quote"],Lo=["quoteRecalculateTaxes"];function Po(){return a.useIsMutating({mutationKey:Io})}const ko=Wn("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...Signup_QuoteFragment\n id\n }\n errors\n }\n }\n ",[oo]),No=()=>{const n=a.useQueryClient();return{setSignupQuoteQueryData:(e,t)=>{n.setQueryData(Z({token:t}),e)}}},Fo=()=>{const n=te(),{apiHost:t}=e.useContext(Jn),{setSignupQuoteQueryData:i}=No(),{mutate:o,isPending:r}=a.useMutation({mutationKey:Lo,mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await wn(ko,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:e=>{if(void 0===(null==e?void 0:e.id)||null===(null==e?void 0:e.id))throw new Error("Quote ID is undefined");if(null==n)throw new Error("Token is undefined");i(e,n)}});return{recalculateTaxes:n=>o({quoteId:n}),isRecalculatingTaxes:r}};function Do(e){const{styles:t,...a}=e;return n.jsx(i.Tooltip,{...a,color:"#2F353B",styles:{...t,body:{padding:"16px 16px",...null==t?void 0:t.body}}})}const To=Rt(Do)`
105
+ `,jo=({apiHost:n,token:e})=>{const{data:t}=Qi({apiHost:n,token:e});return Boolean(null==t?void 0:t.some(n=>"taxation"===n.type))},So=ne("\n mutation quoteChangeAddCoupon($couponCode: String!, $quoteChangeId: ID!) {\n quoteChangeAddCoupon(couponCode: $couponCode, quoteChangeId: $quoteChangeId) {\n quoteChange {\n id\n }\n }\n }\n"),Io=ne("\n mutation quoteChangeRemoveCoupon($quoteChangeId: ID!, $couponCode: String!) {\n quoteChangeRemoveCoupon(quoteChangeId: $quoteChangeId, couponCode: $couponCode) {\n quoteChange {\n quote {\n id\n }\n }\n }\n }\n"),Lo=n=>`\n query Coupons {\n coupons(filter: ${n?`"${n}"`:"null"}) {\n totalCount\n }\n }\n`,Po=({apiHost:n,token:e,quoteChangeId:t,onCouponAdded:i,onCouponRemoved:o})=>{const{data:r}=a.useQuery({queryKey:["coupons",e],queryFn:()=>(async({token:n,apiHost:e,filter:t})=>{const i=await yn({query:Lo(t),token:n,vars:{},apiHost:e});return null==i?void 0:i.coupons})({token:e,apiHost:n,filter:"coupon.active is true"})}),{mutate:s,isPending:l}=a.useMutation({mutationFn:i=>{if(!e)throw new Error("Token is required");if(!t)throw new Error("Quote change ID is required");return(async({quoteChangeId:n,couponCode:e,token:t,apiHost:i})=>{var a;return null===(a=(await In(So,{apiHost:i,token:t},{couponCode:e,quoteChangeId:n})).quoteChangeAddCoupon)||void 0===a?void 0:a.quoteChange})({quoteChangeId:t,couponCode:i,apiHost:n,token:e})},onSuccess:()=>{null==i||i()}}),{mutate:u,isPending:d}=a.useMutation({mutationFn:i=>{if(!t)throw new Error("Quote change ID is required");return(async({quoteChangeId:n,couponCode:e,token:t,apiHost:i})=>{var a;return null===(a=(await In(Io,{apiHost:i,token:t},{couponCode:e,quoteChangeId:n})).quoteChangeRemoveCoupon)||void 0===a?void 0:a.quoteChange})({quoteChangeId:t,couponCode:i,apiHost:n,token:e})},onSuccess:()=>{null==o||o()}});return{addCoupon:s,removeCoupon:u,isAddingCoupon:l,isRemovingCoupon:d,activeCouponsExist:(null==r?void 0:r.totalCount)>0}};function ko({className:e,onAddCoupon:t,isAddingCoupon:a,couponCode:o,setCouponCode:r}){return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-2 ${e}`,children:n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2",children:[n.jsx(i.Input,{value:o,onChange:n=>r(n.target.value),placeholder:"Coupon code",disabled:a,size:"small"}),n.jsx(i.Button,{loading:a,type:"primary",onClick:async function(){t(o)},disabled:0===o.length,children:"Apply"})]})})}const No=ne("\n fragment CheckoutSummary_PriceListFragment on PriceList {\n product {\n name\n }\n name\n basePrice\n currencyId\n trialAllowed\n charges {\n id\n name\n quantityMin\n basePrice\n featureAddon\n deprecated\n }\n }\n");ne("\n fragment sortQuoteChangeCharges_QuoteChargeFragment on QuoteCharge {\n kind\n }\n ",[]);const Fo=["quote"],Do=["quoteRecalculateTaxes"];function To(){return a.useIsMutating({mutationKey:Fo})}const qo=ne("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...Signup_QuoteFragment\n id\n }\n errors\n }\n }\n ",[co]),Ao=()=>{const n=a.useQueryClient();return{setSignupQuoteQueryData:(e,t)=>{n.setQueryData(G({token:t}),e)}}},Mo=()=>{const n=oe(),{apiHost:t}=e.useContext(te),{setSignupQuoteQueryData:i}=Ao(),{mutate:o,isPending:r}=a.useMutation({mutationKey:Do,mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await In(qo,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:e=>{if(void 0===(null==e?void 0:e.id)||null===(null==e?void 0:e.id))throw new Error("Quote ID is undefined");if(null==n)throw new Error("Token is undefined");i(e,n)}});return{recalculateTaxes:n=>o({quoteId:n}),isRecalculatingTaxes:r}};function Ho(e){const{styles:t,...a}=e;return n.jsx(i.Tooltip,{...a,color:"#2F353B",styles:{...t,body:{padding:"16px 16px",...null==t?void 0:t.body}}})}const Eo=Vt(Ho)`
106
106
  line-height: 14px;
107
- `;function qo({subtotal:e,taxes:i,amountDue:a,currencyId:o,taxCalculationMessage:r,isEstimated:s}){return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-space-y-2",children:[n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsx("div",{children:"Subtotal"}),n.jsx(Ao,{isEstimated:s,children:ct(e,o)})]}),n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1",children:[n.jsx("span",{children:"Taxes"}),r?n.jsx(Do,{title:r,children:n.jsx(t.InfoCircleOutlined,{className:"bunny-text-neutral-400"})}):null]}),void 0===i?"—":ct(i,o)]})]}),n.jsx(Mo,{}),n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsx("div",{children:"Total"}),n.jsx(Ao,{isEstimated:s,children:null==a?"—":ct(a,o)})]})]})}function Ao({isEstimated:e,children:t}){const i=n.jsx("span",{className:"bunny-cursor-default bunny-text-sm bunny-text-neutral-500",children:"(estimated)"});return n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-end bunny-gap-2",children:[e&&n.jsx(To,{title:"The true amount will be calculated once account details are entered.",overlayInnerStyle:{lineHeight:"14px"},children:i}),n.jsx("div",{children:t})]})}function Mo(){return n.jsx("div",{className:"bunny-my-2",children:n.jsx(i.Divider,{className:"m-0"})})}const{Text:Ho}=i.Typography;function Qo({quote:t,className:i,priceList:a,defaultCouponCode:o}){var r,s,l,u,d,c,p,m;const{enableTrial:y}=$r(),{apiHost:g}=e.useContext(Jn),b=te(),{refetch:h}=so({}),v=H(),{recalculateTaxes:f}=Fo(),x=vo({apiHost:g,token:b}),[C,w]=e.useState(""),j=Yn(So,a),S=Yn(za,t),I=null!==(r=null==S?void 0:S.id)&&void 0!==r?r:void 0,L=null!==(d=null===(u=null===(s=null==S?void 0:S.quoteChanges)||void 0===s?void 0:s[(null===(l=null==S?void 0:S.quoteChanges)||void 0===l?void 0:l.length)-1])||void 0===u?void 0:u.id)&&void 0!==d?d:void 0,P=null!==(c=(null==j?void 0:j.trialAllowed)&&y)&&void 0!==c&&c,{addCoupon:k,removeCoupon:N,isAddingCoupon:F,isRemovingCoupon:D,activeCouponsExist:T}=wo({apiHost:g,token:b,quoteChangeId:L,onCouponAdded:()=>{v("Coupon applied"),h(),I&&x&&f(I),w("")},onCouponRemoved:()=>{v("Coupon removed"),h(),I&&x&&f(I)}});!function({couponCode:n,addCoupon:t}){var i;const a=e.useRef(void 0),o=te(),{data:r}=so({tokenOverride:o}),s=null==r?void 0:r.id,l=null===(i=null==r?void 0:r.quoteChanges)||void 0===i?void 0:i[r.quoteChanges.length-1],u=null==l?void 0:l.id,d="DRAFT"===(null==r?void 0:r.state),c=!0===(null==l?void 0:l.isTrial);e.useEffect(()=>{c||a.current!=n&&n&&s&&u&&d&&(t(n),a.current=n)},[n,s,u,d,c,t])}({couponCode:o,addCoupon:k});const q=S&&Ka(S,T)&&!S.payToAccept,A=S?function(n){var e;return{subtotal:n.subtotal,taxes:n.taxAmount,amountDue:null!==(e=n.amountDue)&&void 0!==e?e:n.amount,currencyId:n.currencyId,isEstimated:!1}}(S):j?function(n,e){var t;const i=null!==(t=n.basePrice)&&void 0!==t?t:0;return{subtotal:i,taxes:void 0,amountDue:e?0:i,currencyId:n.currencyId,taxCalculationMessage:"Taxes will be calculated once account details are filled in.",isEstimated:!0}}(j,P):null;return n.jsxs("div",{className:`${i} bunny-space-y-4`,children:[n.jsxs(Ho,{children:[n.jsxs("div",{className:"bunny-space-y-4",children:[!S&&j&&n.jsx(n.Fragment,{children:null===(p=j.charges)||void 0===p?void 0:p.filter(n=>!n.deprecated&&!n.featureAddon).map(e=>n.jsx(Eo,{charge:{name:e.name,quantity:e.quantityMin,subtotal:e.basePrice,currencyId:j.currencyId}},e.id))}),null===(m=null==S?void 0:S.quoteChanges)||void 0===m?void 0:m.map(e=>{return(t=null==e?void 0:e.charges,[...t].sort((n,e)=>{const t="COUPON"===n.kind,i="COUPON"===e.kind;return t&&!i?1:!t&&i?-1:0})).map(e=>n.jsx(Eo,{charge:e,isRemovingCoupon:D,removeCoupon:N},e.id));var t})]}),n.jsx($o,{}),A&&n.jsx(qo,{...A})]}),q&&n.jsx(jo,{className:"bunny-w-full",onAddCoupon:k,isAddingCoupon:F,couponCode:C,setCouponCode:w})]})}function Eo({charge:e,isRemovingCoupon:t,removeCoupon:i}){var a;const o="COUPON"===e.kind?-1:1;return n.jsxs("div",{className:"bunny-grid bunny-grid-cols-3 bunny-gap-4 bunny-items-center",children:[n.jsx("div",{className:"bunny-col-span-1",children:e.name}),n.jsx("div",{className:"bunny-col-span-1 bunny-text-center",children:(null===(a=e.coupon)||void 0===a?void 0:a.couponCode)?n.jsx("button",{onClick:()=>{var n,a;if(!t){if(!(null===(n=e.coupon)||void 0===n?void 0:n.couponCode))throw new Error("Coupon code not found");null==i||i(null===(a=e.coupon)||void 0===a?void 0:a.couponCode)}},className:"bunny-text-orange-500 hover:bunny-text-orange-400 bunny-cursor-pointer bunny-bg-transparent bunny-border-none",children:"Remove"}):n.jsx("div",{children:e.quantity})}),n.jsx("div",{className:"bunny-col-span-1 bunny-text-right",children:ct(o*(e.subtotal||0),e.currencyId)})]})}const $o=()=>n.jsx("div",{className:"bunny-my-2",children:n.jsx(i.Divider,{className:"m-0"})}),{Text:_o}=i.Typography;function Ro({style:o}){const r=a.useQueryClient(),s=a.useIsFetching({queryKey:an()})>0,l=a.useIsFetching({queryKey:on()})>0,u=a.useIsFetching({queryKey:W()})>0,d=a.useIsFetching({queryKey:R()})>0,c=a.useIsMutating({mutationKey:rn.quoteAccountSignup})>0,p=r.getQueriesData({queryKey:an()}),m=p.some(([,n])=>void 0!==n),y=!m,g=p.some(([,n])=>{var e,t;return void 0!==(null===(t=null===(e=null==n?void 0:n.currentUser)||void 0===e?void 0:e.account)||void 0===t?void 0:t.id)}),[b,h]=e.useState(!1);if(e.useEffect(()=>{b||!m||g||h(!0)},[b,m,g]),b)return null;const v=c?"Loading quote...":"Setting up signup...";return s||y||l||u||d||c&&g?n.jsxs("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:"#f8fafc",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,zIndex:10,...o},children:[n.jsx(i.Spin,{indicator:n.jsx(t.LoadingOutlined,{spin:!0,style:{fontSize:72}})}),n.jsx(_o,{type:"secondary",children:v})]}):null}const Bo=()=>{const{topNavImageUrl:e}=bn();return 0===e.length?null:n.jsx("img",{alt:"Logo",src:e,style:{width:"auto",height:"28px"}})},Uo=Wn("\n mutation QuoteAccountSignup(\n $accountName: String\n $accountCode: String\n $billingContact: ContactAttributes\n $priceListCode: String!\n $billingDetails: BillingDetailsAttributes\n $trial: Boolean\n $payToAccept: Boolean\n $documentTemplateId: ID\n ) {\n quoteAccountSignup(\n priceListCode: $priceListCode\n accountName: $accountName\n accountCode: $accountCode\n billingContact: $billingContact\n billingDetails: $billingDetails\n trial: $trial\n payToAccept: $payToAccept\n documentTemplateId: $documentTemplateId\n ) {\n account {\n id\n }\n quote {\n ...Signup_QuoteFragment\n id\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n }\n ",[oo]);function Vo({priceListCode:n,enableTrial:t,paymentRequiredToAcceptQuote:i,documentTemplateId:o,onQuoteAccountSignupSuccess:r}){const{apiHost:s}=e.useContext(Jn),l=te();return a.useMutation({mutationKey:rn.quoteAccountSignup,mutationFn:({formData:e,accountCode:a})=>(async({token:n,apiHost:e,priceListCode:t,accountName:i,accountCode:a,billingContact:o,billingDetails:r,trial:s,payToAccept:l,documentTemplateId:u})=>{const d=await wn(Uo,{apiHost:e,token:n},{priceListCode:t,accountName:i,accountCode:a,billingContact:o,billingDetails:r,trial:s,payToAccept:l,documentTemplateId:u});return null==d?void 0:d.quoteAccountSignup})({token:l,apiHost:s,priceListCode:n,accountName:a||null==e?void 0:e.accountName,accountCode:a,billingContact:e?{firstName:e.firstName,lastName:e.lastName,email:e.email}:void 0,billingDetails:e?{billingCountry:e.billingCountry,billingState:e.billingState,billingCity:e.billingCity,billingZip:e.billingZip,billingStreet:e.billingStreet,taxNumber:e.taxNumber}:void 0,trial:t,payToAccept:i,documentTemplateId:o}),onSuccess:n=>{var e;if(!(null==n?void 0:n.portalSessionToken))throw new Error("Portal session token is required");if(!(null===(e=null==n?void 0:n.account)||void 0===e?void 0:e.id))throw new Error("Account ID is required");r(n.portalSessionToken,n.account.id,n.quote)}})}const Oo=Wn("\n fragment BillingDetailsSection_AccountFragment on Account {\n id\n name\n billingStreet\n billingCity\n billingState\n billingZip\n billingCountry\n taxNumber\n billingContactId\n secondaryBillingContactIds\n billingContact {\n email\n firstName\n }\n }\n ",[]),Zo=Wn("\n mutation AccountUpdate($id: ID!, $attributes: AccountAttributes!) {\n accountUpdate(id: $id, attributes: $attributes) {\n account {\n ...BillingDetailsSection_AccountFragment\n }\n errors\n }\n }\n ",[Oo]),Ko=async({accountId:n,attributes:e,apiHost:t,token:i})=>{var a;return null===(a=(await wn(Zo,{apiHost:t,token:i},{id:n,attributes:e})).accountUpdate)||void 0===a?void 0:a.account},zo=Wn("\n mutation SignupContactUpdate($id: ID!, $attributes: ContactAttributes!) {\n contactUpdate(id: $id, attributes: $attributes) {\n contact {\n id\n }\n errors\n }\n }\n ");function Go(n){return{name:n.accountName,billingCountry:n.billingCountry,billingState:n.billingState,billingCity:n.billingCity,billingZip:n.billingZip,billingStreet:n.billingStreet,taxNumber:n.taxNumber}}async function Yo(n,{token:e,apiHost:t,accountId:i,billingContactId:a}){a&&await async function({token:n,apiHost:e,contactId:t,attributes:i}){var a;return null===(a=(await wn(zo,{apiHost:e,token:n},{id:t,attributes:i})).contactUpdate)||void 0===a?void 0:a.contact}({token:e,apiHost:t,contactId:a,attributes:{firstName:n.firstName,lastName:n.lastName,email:n.email}}),await Ko({token:e,apiHost:t,accountId:i,attributes:Go(n)})}function Wo({className:e,requiredBillingDetails:t,onBlur:a,disabled:o,extraFieldsToShow:r}){const s=Qr(),l=q(),u=!!(d=t)&&!!(d.billingStreet||d.billingState||d.billingCity||d.billingZip||d.taxNumber);var d;const c=null==r?void 0:r.includes("title");return n.jsx(i.Form,{className:`bunny-flex bunny-flex-col bunny-h-full bunny-w-full ${null!=e?e:""}`,form:s,layout:"vertical",autoComplete:"off",onBlurCapture:a?n=>{const e=n.currentTarget,t=n.relatedTarget;t&&e.contains(t)||a()}:void 0,children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-space-y-2",children:[n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{name:"firstName",rules:[{required:!0,message:"First name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"First name",disabled:o})}),n.jsx(i.Form.Item,{name:"lastName",rules:[{required:!0,message:"Last name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Last name",disabled:o})})]}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{name:"email",rules:[{required:!0,message:"Email is required"},{type:"email",message:"Please enter a valid email"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Email",disabled:o})}),n.jsx(i.Form.Item,{name:"accountName",rules:[{required:!0,message:"Company name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Company name",disabled:o})})]}),c?n.jsx(i.Form.Item,{name:"title",rules:[{required:!0,message:"Job title is required"}],children:n.jsx(i.Input,{placeholder:"Job title",disabled:o})}):null,n.jsx("div",{className:`bunny-flex ${l?"bunny-flex-row bunny-pb-2":"bunny-flex-row"} bunny-gap-4`,children:n.jsx("div",{className:"flex-1 w-1/2",children:n.jsx(i.Form.Item,{name:"billingCountry",rules:[{required:!0,message:"Country is required"}],children:n.jsx(i.Select,{disabled:o,options:D,placeholder:"Select a country",showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})})})}),u&&n.jsxs(n.Fragment,{children:[n.jsx(i.Divider,{className:"bunny-my-4"}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(null==t?void 0:t.billingStreet)?n.jsx(i.Form.Item,{name:"billingStreet",rules:[{required:!0,message:"Street address is required"}],children:n.jsx(i.Input,{placeholder:"Street address",disabled:o})}):null,n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[(null==t?void 0:t.billingCity)?n.jsx(i.Form.Item,{name:"billingCity",className:"bunny-flex-1",rules:[{required:!0,message:"City is required"}],children:n.jsx(i.Input,{placeholder:"City",disabled:o})}):null,(null==t?void 0:t.billingState)?n.jsx(i.Form.Item,{name:"billingState",className:"bunny-flex-1",rules:[{required:!0,message:"State / province is required"}],children:n.jsx(i.Input,{placeholder:"State / province",disabled:o})}):null]}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[(null==t?void 0:t.billingZip)?n.jsx(i.Form.Item,{name:"billingZip",className:"bunny-flex-1",rules:[{required:!0,message:"Postal / ZIP code is required"}],children:n.jsx(i.Input,{placeholder:"Postal / ZIP code",disabled:o})}):null,(null==t?void 0:t.taxNumber)?n.jsx(i.Form.Item,{name:"taxNumber",className:"bunny-flex-1",rules:[{required:!0,message:"Tax number is required"}],children:n.jsx(i.Input,{placeholder:"Tax number",disabled:o})}):null]})]})]})]})})}function Xo(n){return e.useCallback(({defaults:e,fillEmptyOnly:t=!1,validateBillingCountry:i=!1})=>{const a={...e,billingCountry:void 0},o=Object.fromEntries(Object.entries(a).filter(([n,e])=>null!=e));if(t){const e=n.getFieldsValue(!0);n.setFieldsValue(Object.fromEntries(Object.entries(o).filter(([n])=>null==e[n]||""===e[n])))}else n.setFieldsValue(o);if(!i)return;if(!e.billingCountry)return;D.some(n=>n.value===e.billingCountry)&&n.setFieldsValue({billingCountry:e.billingCountry})},[n])}const Jo=Wn("\n fragment ExistingAccountLoadedEffect_AccountFragment on Account {\n id\n code\n name\n billingCountry\n billingState\n billingCity\n billingZip\n billingStreet\n taxNumber\n billingContact {\n firstName\n lastName\n email\n }\n }\n");function nr({account:n,defaultFormValues:t,priceList:i,onSelfServiceBuyDisabled:a,priceListCode:o,paymentRequiredToAcceptQuote:r,documentTemplateId:s,onQuoteAccountSignupSuccess:l}){var u;const d=Qr(),c=Xo(d),p=e.useRef(null),{enableTrial:m}=$r(),{mutate:y}=Vo({priceListCode:o,enableTrial:m,paymentRequiredToAcceptQuote:r,documentTemplateId:s,onQuoteAccountSignupSuccess:l});return e.useEffect(()=>{var e;const o=Yn(Jo,n),r=null!==(e=null==o?void 0:o.id)&&void 0!==e?e:"none";p.current!==r&&(p.current=r,async function(){var n,e,r,s,l,u,p,m,g,b,h,v,f,x,C;if(null==o?void 0:o.id)return c({defaults:{firstName:null!==(e=null===(n=o.billingContact)||void 0===n?void 0:n.firstName)&&void 0!==e?e:void 0,lastName:null!==(s=null===(r=o.billingContact)||void 0===r?void 0:r.lastName)&&void 0!==s?s:void 0,email:null!==(u=null===(l=o.billingContact)||void 0===l?void 0:l.email)&&void 0!==u?u:void 0,accountName:null!==(p=o.name)&&void 0!==p?p:void 0,billingCountry:null!==(m=o.billingCountry)&&void 0!==m?m:void 0,accountBillingCountry:null!==(g=o.billingCountry)&&void 0!==g?g:void 0,billingState:null!==(b=o.billingState)&&void 0!==b?b:void 0,billingCity:null!==(h=o.billingCity)&&void 0!==h?h:void 0,billingZip:null!==(v=o.billingZip)&&void 0!==v?v:void 0,billingStreet:null!==(f=o.billingStreet)&&void 0!==f?f:void 0,taxNumber:null!==(x=o.taxNumber)&&void 0!==x?x:void 0},validateBillingCountry:!0}),t&&c({defaults:t,fillEmptyOnly:!0,validateBillingCountry:!0}),void(o.code&&y({accountCode:o.code}));t&&c({defaults:t,validateBillingCountry:!0});try{await d.validateFields()}catch(n){return}!1!==(null===(C=null==i?void 0:i.plan)||void 0===C?void 0:C.selfServiceBuy)||a()}())},[c,t,d,n,a,l,r,i,o,null===(u=null==i?void 0:i.plan)||void 0===u?void 0:u.selfServiceBuy,y,m,s]),null}const{Title:er}=i.Typography,tr=Wn("\n fragment ExistingAccountForm_AccountFragment on Account {\n ...ExistingAccountLoadedEffect_AccountFragment\n billingContact {\n id\n }\n id\n }\n ",[Jo]);function ir({title:t,className:i,account:o,extraFieldsToShow:r,requiredBillingDetails:s,defaultFormValues:l,priceList:u,onSelfServiceBuyDisabled:d,priceListCode:c,documentTemplateId:p,onQuoteAccountSignupSuccess:m}){var y;const g=Qr(),[b]=Mr(),{paymentRequiredToAcceptQuote:h}=$r(),v=Yn(tr,o),f=b,x=function({form:n,accountId:t,billingContactId:i}){const o=te(),{apiHost:r}=e.useContext(Jn),{mutateAsync:s}=a.useMutation({mutationFn:n=>{if(!t)throw new Error("Account ID is required");return Yo(n,{token:o,apiHost:r,accountId:t,billingContactId:i})}});return async()=>{try{await n.validateFields()}catch(n){return}await s(n.getFieldsValue())}}({form:g,accountId:null==v?void 0:v.id,billingContactId:null===(y=null==v?void 0:v.billingContact)||void 0===y?void 0:y.id});return n.jsxs(n.Fragment,{children:[n.jsx(nr,{account:v,defaultFormValues:l,priceList:u,onSelfServiceBuyDisabled:d,priceListCode:c,paymentRequiredToAcceptQuote:h,documentTemplateId:p,onQuoteAccountSignupSuccess:m}),n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-items-center",children:n.jsx(er,{className:"bunny-m-0",level:3,children:t})}),n.jsx(Wo,{className:i,requiredBillingDetails:s,onBlur:async function(){await x()},disabled:f,extraFieldsToShow:r})]})]})}const ar=Wn("\n fragment SignupForm_AccountFragment on Account {\n ...ExistingAccountForm_AccountFragment\n id\n code\n name\n billingCountry\n billingState\n billingCity\n billingZip\n billingStreet\n taxNumber\n billingContact {\n id\n firstName\n lastName\n email\n }\n }\n ",[tr]),or=Wn("\n query GetCurrentUserAccountForSignup {\n currentUser {\n account {\n id\n ...SignupForm_AccountFragment\n }\n }\n }\n ",[ar]);function rr({onAccountLoaded:n}={}){var t;const i=te(),{apiHost:o}=e.useContext(Jn),{data:r,isLoading:s}=a.useQuery({queryKey:an(i),queryFn:async()=>{var e;const t=await(async({token:n,apiHost:e})=>wn(or,{apiHost:e,token:n},{}))({apiHost:o,token:i});return null==n||n(null===(e=null==t?void 0:t.currentUser)||void 0===e?void 0:e.account),t}});return{account:null===(t=null==r?void 0:r.currentUser)||void 0===t?void 0:t.account,isLoading:s}}function sr({priceListCode:e,documentTemplateId:t}){const a=te(),o=Qr(),{enableTrial:r,paymentRequiredToAcceptQuote:s}=$r(),[,l]=Dr(),[,u]=qr(),{setSignupQuoteQueryData:d}=No(),{account:c}=rr(),p=Yn(ar,c);const{mutateAsync:m,isPending:y}=Vo({priceListCode:e,enableTrial:r,paymentRequiredToAcceptQuote:s,documentTemplateId:t,onQuoteAccountSignupSuccess:function(n,e,t){void 0===(null==p?void 0:p.id)?(l(n),d(t,n)):d(t,a),u(e)}});return n.jsx(i.Button,{className:"bunny-w-full",type:"primary",loading:y,onClick:async function(){try{await o.validateFields()}catch(n){return}void 0===(null==p?void 0:p.id)&&await m({formData:o.getFieldsValue()})},children:"Continue"})}const{Title:lr}=i.Typography;function ur({className:e,extraFieldsToShow:t,requiredBillingDetails:i,defaultFormValues:a,title:o}){const[r]=Mr(),s=r;return n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsx(dr,{defaultFormValues:a}),n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-items-center",children:n.jsx(lr,{className:"bunny-m-0",level:3,children:o})}),n.jsx(Wo,{className:e,requiredBillingDetails:i,disabled:s,extraFieldsToShow:t})]})}function dr({defaultFormValues:n,onValidatedDefaults:t}){const i=Qr(),a=Xo(i),o=e.useRef(!1);return e.useEffect(()=>{if(o.current||!n)return;const e=n;!async function(){o.current=!0,a({defaults:e,validateBillingCountry:!0});try{await i.validateFields()}catch(n){return}null==t||t()}()},[a,n,i,t]),null}const cr=Q();function pr({priceListCode:e,priceList:t,defaultFormValues:i,documentTemplateId:a,requiredBillingDetails:o}){const r=te(),[,s]=Dr(),[,l]=qr(),{paymentRequiredToAcceptQuote:u}=$r(),{hasSigningPlugins:d}=uo(),{setSignupQuoteQueryData:c}=No();const{account:p}=rr(),m=Yn(ar,p),y=!1===d;return n.jsx(n.Fragment,{children:(null==m?void 0:m.id)?n.jsx(ir,{title:"Account details",account:m,priceListCode:e,extraFieldsToShow:!0===y&&u?["title"]:void 0,requiredBillingDetails:o,defaultFormValues:i,priceList:t,documentTemplateId:a,onQuoteAccountSignupSuccess:function(n,e,t){void 0===(null==m?void 0:m.id)?(s(n),c(t,n)):c(t,r),l(e)},onSelfServiceBuyDisabled:function(){cr("Self service purchase is disabled for this plan.")}}):n.jsx(ur,{title:"Create new account",defaultFormValues:i,extraFieldsToShow:!0===y&&u?["title"]:void 0,requiredBillingDetails:o})})}const mr=Wn("\n fragment SignupPaymentForm_PriceListFragment on PriceList {\n currencyId\n }\n "),yr=({quote:e,priceList:t})=>{var i,a;const[,o]=Mr(),{onPaymentHoldSuccess:r}=uo(),s=Qr(),l=Yn(Ga,e),u=Yn(mr,t),d=null==l?void 0:l.payToAccept,c=null!==(a=null!==(i=null==l?void 0:l.amountDue)&&void 0!==i?i:null==l?void 0:l.amount)&&void 0!==a?a:0,p=0===c,m=c>0;const y={quote:null!=l?l:void 0,onPaymentSuccess:function(){o(!0)},currencyId:null==u?void 0:u.currencyId,checkoutPrecondition:async()=>await async function(){try{return await s.validateFields(),!0}catch(n){return!1}}()};return d&&m?n.jsx(vi,{...y,onPaymentHoldSuccess:r,paymentHold:{quoteId:null==l?void 0:l.id,amountToHold:null==l?void 0:l.amountDue}}):d&&p?n.jsx(vi,{...y,children:()=>n.jsx(vi.CheckoutNoPayment,{className:"bunny-px-4 bunny-pt-2"})}):p?n.jsx(vi,{...y,children:()=>n.jsx(vi.CheckoutNoPayment,{className:"bunny-px-4"})}):m?n.jsx(vi,{...y}):null};function gr({left:e,right:t,style:i,className:a}){const o=q();return n.jsxs("div",{className:`bunny-flex bunny-min-h-screen ${o?"bunny-flex-col":"bunny-flex-row"} ${null!=a?a:""}`,style:i,children:[n.jsx("div",{className:"bunny-flex bunny-items-center bunny-flex-col "+(o?"bunny-w-full bunny-h-1/2 bunny-min-h-0":"bunny-w-1/2 bunny-min-h-screen"),children:e}),n.jsx("div",{className:`bunny-flex bunny-flex-col ${o?"bunny-w-full bunny-h-1/2 bunny-min-h-0 bunny-overflow-auto":"bunny-w-1/2 bunny-min-h-screen"} bunny-items-center`,style:{boxShadow:"-5px 0 20px 0 rgba(0, 0, 0, 0.05)"},children:t})]})}const br=()=>n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-flex-shrink-0",style:{width:68,height:68,minWidth:68,minHeight:68,borderRadius:"9999px",backgroundColor:"#dcfce7"},children:n.jsx(m.FontAwesomeIcon,{icon:p.faCheck,style:{color:"#16a34a",fontSize:24}})}),{Text:hr}=i.Typography,vr=({returnUrl:e})=>e?n.jsx(hr,{className:"bunny-text-slate-500 bunny-cursor-pointer bunny-underline",onClick:()=>window.location.href=e,children:"View subscription"}):null;function fr({returnUrl:e,className:t,children:a}){return n.jsx("div",{className:`${null!=t?t:""}`.trim(),children:n.jsx(i.Card,{variant:"borderless",className:`bunny-w-full bunny-pt-2 ${null!=t?t:""}`.trim(),children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-justify-center bunny-gap-4",children:[n.jsx(br,{}),a,n.jsx(vr,{returnUrl:e})]})})})}const{Text:xr,Title:Cr}=i.Typography,wr=({quote:t,currencyId:i,returnUrl:a,className:o})=>{var r,s,l;const{apiHost:u}=e.useContext(Jn),d=te(),c=null!=a?a:function({apiHost:n,token:e}){return e?`${n}/portal/subscriptions?token=${encodeURIComponent(e)}`:""}({apiHost:u,token:d}),p=t,m=null!==(s=null!==(r=null==p?void 0:p.amountDue)&&void 0!==r?r:null==p?void 0:p.amount)&&void 0!==s?s:0,y=!0===(null==p?void 0:p.payToAccept),g="ACCEPTED"===(null==p?void 0:p.state),b=null===(l=null==p?void 0:p.quoteChanges)||void 0===l?void 0:l.some(n=>!0===n.isTrial);return!y&&b?n.jsxs(fr,{returnUrl:c,className:o,children:[n.jsx(Cr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(xr,{className:"bunny-text-slate-500",children:"Trial subscription created"})]}):y&&g&&b?n.jsxs(fr,{returnUrl:c,className:o,children:[n.jsx(Cr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(xr,{className:"bunny-text-slate-500",children:"Quote accepted. Trial subscription created"})]}):y&&g?n.jsxs(fr,{returnUrl:c,className:o,children:[n.jsx(Cr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(xr,{className:"bunny-text-slate-500",children:"Quote accepted. Subscription created"}),i?n.jsx(xr,{className:"bunny-text-slate-500",children:ct(m,i)}):null]}):n.jsxs(fr,{returnUrl:c,className:o,children:[n.jsx(Cr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(xr,{className:"bunny-text-slate-500",children:"Payment successful. Subscription created"})]})},jr=Wn("\n fragment SelfServiceBuyWarning_PriceListFragment on PriceList {\n plan {\n selfServiceBuy\n }\n }\n "),Sr=Wn("\n fragment QuoteAcceptPage_PriceListFragment on PriceList {\n ...CheckoutSummary_PriceListFragment\n }\n ",[So]),Ir=Wn("\n fragment Signup_PriceListFragment on PriceList {\n ...SelfServiceBuyWarning_PriceListFragment\n ...QuoteAcceptPage_PriceListFragment\n ...PriceListDisplay_PriceListFragment\n ...CheckoutSummary_PriceListFragment\n ...SignupPaymentForm_PriceListFragment\n id\n plan {\n selfServiceBuy\n }\n code\n currencyId\n }\n ",[to,jr,Sr,So,mr]),Lr=Wn("\n query PriceList($code: String!) {\n priceList (code: $code) {\n ...Signup_PriceListFragment\n }\n }\n",[Ir]),Pr=()=>{var a,o;const{overrideToken:r}=e.useContext(mn),{data:s}=so({tokenOverride:r}),[l,u]=e.useState(null),d=Yn(Ya,s),c="ACCEPTED"===(null==d?void 0:d.state);return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-h-full",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-end bunny-gap-2",children:[c&&n.jsx(ra,{acceptedByName:null==d?void 0:d.acceptedByName,acceptedAt:null==d?void 0:d.acceptedAt}),l?n.jsx(i.Button,{icon:n.jsx(t.FullscreenOutlined,{}),onClick:()=>l.toggleFullScreen(),children:"Fullscreen"}):null,(null==d?void 0:d.id)?n.jsx(Ji,{id:null==d?void 0:d.id}):null]}),n.jsx(ki,{html:null!==(o=null===(a=null==d?void 0:d.formattedQuote)||void 0===a?void 0:a.html)&&void 0!==o?o:null,targetUrl:(null==d?void 0:d.documentTemplateId)?`/pdf/quote/${null==d?void 0:d.id}`:void 0,onDocumentPreviewFullscreenApiChange:u})]})};function kr({priceListCode:t,defaultFormValues:i,documentTemplateId:o,requiredBillingDetails:r,style:s,defaultCouponCode:l}){const[u]=Mr(),{apiHost:d}=e.useContext(Jn),c=te(),{data:p}=so({tokenOverride:c}),{account:m}=rr(),{data:y}=a.useQuery({queryKey:on(t,c),queryFn:()=>(async({token:n,code:e,apiHost:t})=>{const i=await wn(Lr,{apiHost:t,token:n},{code:e});return null==i?void 0:i.priceList})({token:c,apiHost:d,code:t})}),g=Yn(Ir,y),b=Yn(oo,p),h=void 0!==(null==m?void 0:m.id);return n.jsxs("div",{"data-slot":"signup-root",className:"bunny-signup bunny-relative",style:s,children:[n.jsx(Ro,{style:s}),n.jsx(gr,{left:n.jsxs("div",{className:"bunny-box-border bunny-flex bunny-h-full bunny-min-h-0 bunny-w-4/5 bunny-flex-col bunny-items-start bunny-justify-between bunny-gap-4 bunny-py-24 bunny-overflow-y-auto",children:[n.jsx(Bo,{}),n.jsxs("div",{"data-slot":"signup-summary",className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col bunny-gap-4",children:[n.jsx(ao,{priceList:g,quote:p}),n.jsx(Qo,{quote:b,priceList:g,defaultCouponCode:l}),n.jsx(Pr,{})]}),n.jsx(yo,{})]}),right:n.jsxs("div",{className:"bunny-box-border bunny-flex bunny-h-full bunny-min-h-0 bunny-w-4/5 bunny-flex-col bunny-py-24 bunny-overflow-y-auto",children:[n.jsx(pr,{priceListCode:t,priceList:g,defaultFormValues:i,documentTemplateId:o,requiredBillingDetails:r}),!b&&!h&&n.jsx("div",{className:"bunny-pt-4",children:n.jsx(sr,{priceListCode:t,documentTemplateId:o})}),!u&&b&&n.jsx("div",{className:"bunny-pt-2",children:n.jsx(yr,{quote:b,priceList:g})}),u&&n.jsx(wr,{quote:b,currencyId:null==g?void 0:g.currencyId,className:"bunny-py-4"})]})})]})}function Nr({children:e}){const[t]=Dr(),i=te(),a=t||i;return n.jsx(mn.Provider,{value:{overrideToken:a},children:n.jsx(co,{children:e})})}const[Fr,Dr]=Te(()=>e.useState(void 0)),[Tr,qr]=Te(()=>e.useState(void 0)),[Ar,Mr]=Te(()=>e.useState(!1)),[Hr,Qr]=yn(),[Er,$r]=yn();const[_r,Rr]=yn(),[Br,Ur]=yn(),[Vr,Or]=yn(),[Zr,Kr]=yn(),[zr,Gr]=yn(),[Yr,Wr]=Te(n=>e.useState(n)),Xr=({children:e,message:t})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-w-full",style:{marginTop:"80px"},children:[n.jsx("div",{style:{fontSize:"32px"},children:t}),e]}),Jr=Wn("\n fragment findParentSubscription_SubscriptionFragment on Subscription {\n id\n addonSubscriptions {\n id\n }\n }\n ",[]);const ns=Wn("\n fragment findNonAddonSubscriptions_SubscriptionFragment on Subscription {\n id\n priceList {\n plan {\n addon\n }\n }\n ...findParentSubscription_SubscriptionFragment\n }\n ",[Jr]);function es(n){return n.filter(e=>{var t,i,a,o;const r=Yn(ns,e),s=n.map(n=>Yn(ns,n)),l=void 0!==function(n,e){const t=Yn(Jr,n);return e.find(n=>{var e,i;return null!==(i=null===(e=Yn(Jr,n).addonSubscriptions)||void 0===e?void 0:e.some(n=>n.id===t.id))&&void 0!==i&&i})}(r,s);return(!1===(null===(i=null===(t=null==r?void 0:r.priceList)||void 0===t?void 0:t.plan)||void 0===i?void 0:i.addon)||null===(null===(o=null===(a=null==r?void 0:r.priceList)||void 0===a?void 0:a.plan)||void 0===o?void 0:o.addon))&&!l})}const ts=Wn("\n fragment findAddonSubscriptions_SubscriptionFragment on Subscription {\n id\n addonSubscriptions {\n id\n }\n }\n ",[]);const is=({isLast:e,indentation:t,verticalMargin:i})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-relative",style:{width:`${t}px`},children:[n.jsx("div",{className:"bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto",style:{marginTop:i}}),n.jsx("div",{className:"bunny-bg-gray-300 bunny-h-0.5 bunny-w-1/2 bunny-ml-auto"}),e?n.jsx("div",{className:"bunny-flex-1"}):n.jsx("div",{className:"bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto",style:{marginBottom:i}})]}),as=({children:t,className:i,style:a})=>{const{darkMode:o}=e.useContext(Jn);return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-rounded-md ${i}`,style:{...a,backgroundColor:o?"var(--row-background-dark)":"var(--row-background)"},children:t})},os=n=>(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","EXPIRED")||(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","CANCELED")||(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL_EXPIRED"),rs=n=>(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL"),ss=n=>{var e;return Boolean(null===(e=null==n?void 0:n.priceTiers)||void 0===e?void 0:e.length)},ls=Wn("\n fragment splitSubscriptionsByPriceList_SubscriptionFragment on Subscription {\n id\n state\n evergreen\n startDate\n endDate\n addonSubscriptions {\n id\n startDate\n endDate\n priceList {\n id\n }\n plan {\n id\n }\n }\n chargeReport {\n kind\n startDate\n endDate\n priceList {\n id\n plan {\n id\n name\n selfServiceBuy\n selfServiceCancel\n selfServiceRenew\n addon\n addonPlans {\n id\n }\n }\n product {\n id\n name\n showProductNameOnLineItem\n }\n periodMonths\n name\n }\n }\n charges {\n priceList {\n id\n }\n }\n }\n ",[]);const us=n=>{var t;const i=e.useRef(null),[a,o]=e.useState(!1),r=null===(t=null==n?void 0:n.once)||void 0===t||t;return e.useEffect(()=>{const e=i.current;if(!e)return;const t=new IntersectionObserver(([n])=>{n.isIntersecting?(o(!0),r&&t.disconnect()):r||o(!1)},n);return t.observe(e),()=>t.disconnect()},[r,null==n?void 0:n.root,null==n?void 0:n.rootMargin,null==n?void 0:n.threshold]),[i,a]},ds=Wn("\n fragment SubscriptionCardActions_PriceListChangeOptionsFragment on PriceListChangeOptions {\n priceLists {\n id\n product {\n id\n }\n }\n }\n"),cs=Wn("\n fragment SubscriptionCardActions_SubscriptionFragment on Subscription {\n id\n state\n plan {\n selfServiceCancel\n }\n product {\n id\n }\n priceList {\n plan {\n addon\n }\n }\n }\n ",[]),ps=({priceListChangeOptions:e,subscription:t,isPaymentMethodLoading:a})=>{var o,r,s;const l=Yn(ds,e),u=Yn(cs,t),d=Kr(),c=Or(),p=null!==(r=null===(o=u.plan)||void 0===o?void 0:o.selfServiceCancel)&&void 0!==r&&r,m=null===(s=null==l?void 0:l.priceLists)||void 0===s?void 0:s.filter(n=>{var e,t;return(null===(e=n.product)||void 0===e?void 0:e.id)===(null===(t=u.product)||void 0===t?void 0:t.id)}),y=((null==m?void 0:m.length)||0)>0,g=rs(u.state),b=(null==(h=u.state)?void 0:h.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL_EXPIRED");var h;const v=(n=>(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","ACTIVE")||(null==n?void 0:n.toUpperCase())===Wn.scalar("SubscriptionState","PENDING"))(u.state);return a?null:n.jsxs(n.Fragment,{children:[p&&(g||v)&&n.jsx(i.Popconfirm,{icon:null,onConfirm:()=>d(u.id),title:"Cancel subscription",children:n.jsx(i.Button,{className:"bunny-p-0",type:"link",children:"Cancel subscription"})}),y&&c&&(v||g||b)&&n.jsx(i.Button,{onClick:()=>c(u.id),type:"primary",children:(()=>{var n,e;return g?"Upgrade from trial":b?"Upgrade":!0===(null===(e=null===(n=u.priceList)||void 0===n?void 0:n.plan)||void 0===e?void 0:e.addon)?"Adjust plan":"Change plan"})()}),!y&&g&&n.jsx(i.Tag,{color:"warning",children:"Cannot upgrade"})]})},ms=Wn("\n query priceListChangeOptions($productId: ID!) {\n priceListChangeOptions(productId: $productId) {\n ...SubscriptionCardActions_PriceListChangeOptionsFragment\n }\n }\n ",[ds]),ys=Wn("\n fragment SubscriptionStatusText_SubscriptionFragment on Subscription {\n id\n state\n cancellationDate\n evergreen\n endDate\n trialEndDate\n trialStartDate\n startDate\n trialExpirationAction\n }\n ",[]);function gs({subscription:e}){const t=Yn(ys,e),{cancellationDate:i,state:a,evergreen:o,endDate:r,trialEndDate:s,trialStartDate:l,startDate:u,trialExpirationAction:d}=t,c=null==a?void 0:a.toUpperCase(),p=c===Wn.scalar("SubscriptionState","ACTIVE"),m=c===Wn.scalar("SubscriptionState","PENDING"),y=c===Wn.scalar("SubscriptionState","CANCELED"),g=c===Wn.scalar("SubscriptionState","EXPIRED"),b=c===Wn.scalar("SubscriptionState","TRIAL_EXPIRED"),h=c===Wn.scalar("SubscriptionState","TRIAL");if(i&&(p||m||h))return n.jsxs(ea,{color:"red",children:["Canceled - ends on ",ta(i)]});if(i&&y)return`Canceled on ${ta(i)}`;if(g||b)return`Ended on ${ta(r||s)}`;if(m){if(l)return`Trial starts on ${ta(l)}`;if(u)return`Activates on ${ta(u)}`}if(h)switch(d){case"ACTIVATE":return`Activates on ${ta(u)}`;case"CANCEL":return`Trial expires on ${ta(s)}`}return o&&t.state===Wn.scalar("SubscriptionState","ACTIVE")?`Renews on ${ta(r)}`:`Ends on ${ta(r||s)}`}const{Text:bs}=i.Typography,hs=Wn("\n fragment SubscriptionStatusAndActions_SubscriptionFragment on Subscription {\n id\n accountId\n product {\n id\n }\n ...SubscriptionStatusText_SubscriptionFragment\n ...SubscriptionCardActions_SubscriptionFragment\n }\n ",[ys,cs]);function vs({subscription:t}){var o,r;const s=Yn(hs,t),{apiHost:l}=e.useContext(Jn),u=te(),d=q(),[c,p]=us(),{data:m,isLoading:y}=a.useQuery({queryKey:Y({productId:null===(o=null==s?void 0:s.product)||void 0===o?void 0:o.id,token:u}),queryFn:()=>{var n;if(null===(n=null==s?void 0:s.product)||void 0===n?void 0:n.id)return(async({apiHost:n,productId:e,token:t})=>(await wn(ms,{apiHost:n,token:t},{productId:e})).priceListChangeOptions)({apiHost:l,token:u,productId:s.product.id})},enabled:p&&Boolean(null===(r=s.product)||void 0===r?void 0:r.id)}),{isLoading:g}=Fe({accountId:s.accountId}),b=!d,h=!p||y,v=h&&b,f=h&&!m;return n.jsxs(n.Fragment,{children:[n.jsx("span",{ref:c,className:"bunny-grow",children:v?n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:180}}):n.jsx(bs,{children:n.jsx(gs,{subscription:s})})}),b&&(f?n.jsx(i.Skeleton.Button,{active:!0,size:"default",style:{width:100}}):n.jsx(ps,{priceListChangeOptions:m,subscription:s,isPaymentMethodLoading:g}))]})}const{Text:fs}=i.Typography,xs=Wn("\n fragment SubscriptionCardHeader_SubscriptionFragment on Subscription {\n id\n state\n daysLeftInTrial\n product {\n id\n name\n }\n plan {\n name\n selfServiceBuy\n selfServiceCancel\n }\n priceList {\n plan {\n addon\n }\n deprecated\n }\n ...SubscriptionStatusAndActions_SubscriptionFragment\n }\n ",[hs]),Cs=({subscription:t})=>{var i,a,o,r;const s=Yn(xs,t),{darkMode:u}=e.useContext(Jn),{brandColor:d}=bn(),{subscriptionProductNameStyle:c}=Gr(),p=null==s?void 0:s.daysLeftInTrial,m=rs(s.state);return n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between",style:{backgroundColor:u?"var(--row-background-dark)":""},children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(null===(i=null==s?void 0:s.product)||void 0===i?void 0:i.name)&&n.jsx(fs,{style:{color:d,...c},children:s.product.name}),n.jsxs("div",{className:"bunny-flex bunny-grow bunny-items-center bunny-gap-2",children:[(null===(a=null==s?void 0:s.plan)||void 0===a?void 0:a.name)&&n.jsx(fs,{className:"bunny-text-sm",children:s.plan.name}),n.jsxs(ea,{color:Wa[null===(o=s.state)||void 0===o?void 0:o.toUpperCase()],children:[l.capitalize(s.state.toLowerCase().replace(/_/g," ")),m?` (${null!=p?p:"N/A"} days left)`:""]}),(null===(r=s.priceList)||void 0===r?void 0:r.deprecated)&&n.jsx(ea,{color:"orange",children:"Legacy"})]})]}),n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-6",children:n.jsx(vs,{subscription:s})})]})},ws=Wn("\n fragment filterSubscriptionCharges_SubscriptionChargeFragment on SubscriptionCharge {\n endDate\n }\n ",[]);function js(n){return n.filter(n=>{const e=Yn(ws,n);return!st(e.endDate).isBefore(st(),"day")})}const Ss=Wn("\n fragment sortSubscriptionCharges_SubscriptionChargeFragment on SubscriptionCharge {\n id\n priceListChargeId\n kind\n endDate\n startDate\n isAmendment\n }\n ",[]),Is=n=>n===Wn.scalar("QuoteChangeKind","DISCOUNT");function Ls(n){return[...n].sort((n,e)=>{var t,i,a;const o=Yn(Ss,n),r=Yn(Ss,e);return o.priceListChargeId!==r.priceListChargeId?null!==(a=null===(t=null==o?void 0:o.priceListChargeId)||void 0===t?void 0:t.localeCompare(null!==(i=null==r?void 0:r.priceListChargeId)&&void 0!==i?i:""))&&void 0!==a?a:0:Is(o.kind)&&!Is(r.kind)?1:!Is(o.kind)&&Is(r.kind)?-1:o.endDate.localeCompare(r.endDate)||o.startDate.localeCompare(r.startDate)||(o.isAmendment?1:-1)})}const{Text:Ps}=i.Typography,ks=({columns:e})=>n.jsx(n.Fragment,{children:e.map((e,t)=>n.jsx(Ps,{className:`bunny-text-slate-400 ${e.className}`,children:e.title},t))});var Ns;!function(n){n.USAGE="USAGE",n.ONE_TIME="ONE_TIME",n.RECURRING="RECURRING"}(Ns||(Ns={}));var Fs,Ds=Ns;!function(n){n.ADJUSTMENT="ADJUSTMENT",n.COUPON="COUPON",n.CREDIT="CREDIT",n.DISCOUNT="DISCOUNT",n.FREE_PERIOD_DISCOUNT="FREE_PERIOD_DISCOUNT",n.PRICE_UPDATE="PRICE_UPDATE",n.QUANTITY_UPDATE="QUANTITY_UPDATE",n.REINSTATE="REINSTATE",n.RENEW="RENEW",n.SUBSCRIBE="SUBSCRIBE",n.UNSUBSCRIBE="UNSUBSCRIBE",n.UPDATE="UPDATE",n.ACTIVATE="ACTIVATE"}(Fs||(Fs={}));var Ts,qs=Fs,As={exports:{}};var Ms=(Ts||(Ts=1,As.exports=function(){var n="minute",e=/[+-]\d\d(?::?\d\d)?/g,t=/([+-]|\d\d)/g;return function(i,a,o){var r=a.prototype;o.utc=function(n){return new a({date:n,utc:!0,args:arguments})},r.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),n):t},r.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=r.parse;r.parse=function(n){n.utc&&(this.$u=!0),this.$utils().u(n.$offset)||(this.$offset=n.$offset),s.call(this,n)};var l=r.init;r.init=function(){if(this.$u){var n=this.$d;this.$y=n.getUTCFullYear(),this.$M=n.getUTCMonth(),this.$D=n.getUTCDate(),this.$W=n.getUTCDay(),this.$H=n.getUTCHours(),this.$m=n.getUTCMinutes(),this.$s=n.getUTCSeconds(),this.$ms=n.getUTCMilliseconds()}else l.call(this)};var u=r.utcOffset;r.utcOffset=function(i,a){var o=this.$utils().u;if(o(i))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(n){void 0===n&&(n="");var i=n.match(e);if(!i)return null;var a=(""+i[0]).match(t)||["-",0,0],o=a[0],r=60*+a[1]+ +a[2];return 0===r?0:"+"===o?r:-r}(i),null===i))return this;var r=Math.abs(i)<=16?60*i:i;if(0===r)return this.utc(a);var s=this.clone();if(a)return s.$offset=r,s.$u=!1,s;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(r+l,n)).$offset=r,s.$x.$localOffset=l,s};var d=r.format;r.format=function(n){var e=n||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,e)},r.valueOf=function(){var n=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*n},r.isUTC=function(){return!!this.$u},r.toISOString=function(){return this.toDate().toISOString()},r.toString=function(){return this.toDate().toUTCString()};var c=r.toDate;r.toDate=function(n){return"s"===n&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():c.call(this)};var p=r.diff;r.diff=function(n,e,t){if(n&&this.$u===n.$u)return p.call(this,n,e,t);var i=this.local(),a=o(n).local();return p.call(i,a,e,t)}}}()),As.exports),Hs=tt(Ms);const Qs=Rt(i.Modal)`
107
+ `;function Qo({subtotal:e,taxes:i,amountDue:a,currencyId:o,taxCalculationMessage:r,isEstimated:s}){return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-space-y-2",children:[n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsx("div",{children:"Subtotal"}),n.jsx($o,{isEstimated:s,children:yt(e,o)})]}),n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1",children:[n.jsx("span",{children:"Taxes"}),r?n.jsx(Ho,{title:r,children:n.jsx(t.InfoCircleOutlined,{className:"bunny-text-neutral-400"})}):null]}),void 0===i?"—":yt(i,o)]})]}),n.jsx(_o,{}),n.jsxs("div",{className:"bunny-flex bunny-justify-between",children:[n.jsx("div",{children:"Total"}),n.jsx($o,{isEstimated:s,children:null==a?"—":yt(a,o)})]})]})}function $o({isEstimated:e,children:t}){const i=n.jsx("span",{className:"bunny-cursor-default bunny-text-sm bunny-text-neutral-500",children:"(estimated)"});return n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-end bunny-gap-2",children:[e&&n.jsx(Eo,{title:"The true amount will be calculated once account details are entered.",overlayInnerStyle:{lineHeight:"14px"},children:i}),n.jsx("div",{children:t})]})}function _o(){return n.jsx("div",{className:"bunny-my-2",children:n.jsx(i.Divider,{className:"m-0"})})}const{Text:Ro}=i.Typography;function Bo({quote:t,className:i,priceList:a,defaultCouponCode:o}){var r,s,l,u,d,c,p,m;const{enableTrial:y}=Vr(),{apiHost:g}=e.useContext(te),b=oe(),{refetch:h}=mo({}),v=$(),{recalculateTaxes:f}=Mo(),x=jo({apiHost:g,token:b}),[C,w]=e.useState(""),j=Jn(No,a),S=Jn(Ja,t),I=null!==(r=null==S?void 0:S.id)&&void 0!==r?r:void 0,L=null!==(d=null===(u=null===(s=null==S?void 0:S.quoteChanges)||void 0===s?void 0:s[(null===(l=null==S?void 0:S.quoteChanges)||void 0===l?void 0:l.length)-1])||void 0===u?void 0:u.id)&&void 0!==d?d:void 0,P=null!==(c=(null==j?void 0:j.trialAllowed)&&y)&&void 0!==c&&c,{addCoupon:k,removeCoupon:N,isAddingCoupon:F,isRemovingCoupon:D,activeCouponsExist:T}=Po({apiHost:g,token:b,quoteChangeId:L,onCouponAdded:()=>{v("Coupon applied"),h(),I&&x&&f(I),w("")},onCouponRemoved:()=>{v("Coupon removed"),h(),I&&x&&f(I)}});!function({couponCode:n,addCoupon:t}){var i;const a=e.useRef(void 0),o=oe(),{data:r}=mo({tokenOverride:o}),s=null==r?void 0:r.id,l=null===(i=null==r?void 0:r.quoteChanges)||void 0===i?void 0:i[r.quoteChanges.length-1],u=null==l?void 0:l.id,d="DRAFT"===(null==r?void 0:r.state),c=!0===(null==l?void 0:l.isTrial);e.useEffect(()=>{c||a.current!=n&&n&&s&&u&&d&&(t(n),a.current=n)},[n,s,u,d,c,t])}({couponCode:o,addCoupon:k});const q=S&&Xa(S,T)&&!S.payToAccept,A=S?function(n){var e;return{subtotal:n.subtotal,taxes:n.taxAmount,amountDue:null!==(e=n.amountDue)&&void 0!==e?e:n.amount,currencyId:n.currencyId,isEstimated:!1}}(S):j?function(n,e){var t;const i=null!==(t=n.basePrice)&&void 0!==t?t:0;return{subtotal:i,taxes:void 0,amountDue:e?0:i,currencyId:n.currencyId,taxCalculationMessage:"Taxes will be calculated once account details are filled in.",isEstimated:!0}}(j,P):null;return n.jsxs("div",{className:`${i} bunny-space-y-4`,children:[n.jsxs(Ro,{children:[n.jsxs("div",{className:"bunny-space-y-4",children:[!S&&j&&n.jsx(n.Fragment,{children:null===(p=j.charges)||void 0===p?void 0:p.filter(n=>!n.deprecated&&!n.featureAddon).map(e=>n.jsx(Uo,{charge:{name:e.name,quantity:e.quantityMin,subtotal:e.basePrice,currencyId:j.currencyId}},e.id))}),null===(m=null==S?void 0:S.quoteChanges)||void 0===m?void 0:m.map(e=>{return(t=null==e?void 0:e.charges,[...t].sort((n,e)=>{const t="COUPON"===n.kind,i="COUPON"===e.kind;return t&&!i?1:!t&&i?-1:0})).map(e=>n.jsx(Uo,{charge:e,isRemovingCoupon:D,removeCoupon:N},e.id));var t})]}),n.jsx(Vo,{}),A&&n.jsx(Qo,{...A})]}),q&&n.jsx(ko,{className:"bunny-w-full",onAddCoupon:k,isAddingCoupon:F,couponCode:C,setCouponCode:w})]})}function Uo({charge:e,isRemovingCoupon:t,removeCoupon:i}){var a;const o="COUPON"===e.kind?-1:1;return n.jsxs("div",{className:"bunny-grid bunny-grid-cols-3 bunny-gap-4 bunny-items-center",children:[n.jsx("div",{className:"bunny-col-span-1",children:e.name}),n.jsx("div",{className:"bunny-col-span-1 bunny-text-center",children:(null===(a=e.coupon)||void 0===a?void 0:a.couponCode)?n.jsx("button",{onClick:()=>{var n,a;if(!t){if(!(null===(n=e.coupon)||void 0===n?void 0:n.couponCode))throw new Error("Coupon code not found");null==i||i(null===(a=e.coupon)||void 0===a?void 0:a.couponCode)}},className:"bunny-text-orange-500 hover:bunny-text-orange-400 bunny-cursor-pointer bunny-bg-transparent bunny-border-none",children:"Remove"}):n.jsx("div",{children:e.quantity})}),n.jsx("div",{className:"bunny-col-span-1 bunny-text-right",children:yt(o*(e.subtotal||0),e.currencyId)})]})}const Vo=()=>n.jsx("div",{className:"bunny-my-2",children:n.jsx(i.Divider,{className:"m-0"})}),{Text:Oo}=i.Typography;function Zo({style:o}){const r=a.useQueryClient(),s=a.useIsFetching({queryKey:sn()})>0,l=a.useIsFetching({queryKey:ln()})>0,u=a.useIsFetching({queryKey:nn()})>0,d=a.useIsFetching({queryKey:V()})>0,c=a.useIsMutating({mutationKey:un.quoteAccountSignup})>0,p=r.getQueriesData({queryKey:sn()}),m=p.some(([,n])=>void 0!==n),y=!m,g=p.some(([,n])=>{var e,t;return void 0!==(null===(t=null===(e=null==n?void 0:n.currentUser)||void 0===e?void 0:e.account)||void 0===t?void 0:t.id)}),[b,h]=e.useState(!1);if(e.useEffect(()=>{b||!m||g||h(!0)},[b,m,g]),b)return null;const v=c?"Loading quote...":"Setting up signup...";return s||y||l||u||d||c&&g?n.jsxs("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,backgroundColor:"#f8fafc",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,zIndex:10,...o},children:[n.jsx(i.Spin,{indicator:n.jsx(t.LoadingOutlined,{spin:!0,style:{fontSize:72}})}),n.jsx(Oo,{type:"secondary",children:v})]}):null}const zo=()=>{const{topNavImageUrl:e}=fn();return 0===e.length?null:n.jsx("img",{alt:"Logo",src:e,style:{width:"auto",height:"28px"}})},Ko=ne("\n mutation QuoteAccountSignup(\n $accountName: String\n $accountCode: String\n $billingContact: ContactAttributes\n $priceListCode: String!\n $billingDetails: BillingDetailsAttributes\n $trial: Boolean\n $payToAccept: Boolean\n $documentTemplateId: ID\n ) {\n quoteAccountSignup(\n priceListCode: $priceListCode\n accountName: $accountName\n accountCode: $accountCode\n billingContact: $billingContact\n billingDetails: $billingDetails\n trial: $trial\n payToAccept: $payToAccept\n documentTemplateId: $documentTemplateId\n ) {\n account {\n id\n }\n quote {\n ...Signup_QuoteFragment\n id\n }\n tenant {\n code\n }\n portalSessionToken\n errors\n }\n }\n ",[co]);function Go({priceListCode:n,enableTrial:t,paymentRequiredToAcceptQuote:i,documentTemplateId:o,onQuoteAccountSignupSuccess:r}){const{apiHost:s}=e.useContext(te),l=oe();return a.useMutation({mutationKey:un.quoteAccountSignup,mutationFn:({formData:e,accountCode:a})=>(async({token:n,apiHost:e,priceListCode:t,accountName:i,accountCode:a,billingContact:o,billingDetails:r,trial:s,payToAccept:l,documentTemplateId:u})=>{const d=await In(Ko,{apiHost:e,token:n},{priceListCode:t,accountName:i,accountCode:a,billingContact:o,billingDetails:r,trial:s,payToAccept:l,documentTemplateId:u});return null==d?void 0:d.quoteAccountSignup})({token:l,apiHost:s,priceListCode:n,accountName:a||null==e?void 0:e.accountName,accountCode:a,billingContact:e?{firstName:e.firstName,lastName:e.lastName,email:e.email}:void 0,billingDetails:e?{billingCountry:e.billingCountry,billingState:e.billingState,billingCity:e.billingCity,billingZip:e.billingZip,billingStreet:e.billingStreet,taxNumber:e.taxNumber}:void 0,trial:t,payToAccept:i,documentTemplateId:o}),onSuccess:n=>{var e;if(!(null==n?void 0:n.portalSessionToken))throw new Error("Portal session token is required");if(!(null===(e=null==n?void 0:n.account)||void 0===e?void 0:e.id))throw new Error("Account ID is required");r(n.portalSessionToken,n.account.id,n.quote)}})}const Yo=ne("\n fragment BillingDetailsSection_AccountFragment on Account {\n id\n name\n billingStreet\n billingCity\n billingState\n billingZip\n billingCountry\n taxNumber\n billingContactId\n secondaryBillingContactIds\n billingContact {\n email\n firstName\n }\n }\n ",[]),Wo=ne("\n mutation AccountUpdate($id: ID!, $attributes: AccountAttributes!) {\n accountUpdate(id: $id, attributes: $attributes) {\n account {\n ...BillingDetailsSection_AccountFragment\n }\n errors\n }\n }\n ",[Yo]),Xo=async({accountId:n,attributes:e,apiHost:t,token:i})=>{var a;return null===(a=(await In(Wo,{apiHost:t,token:i},{id:n,attributes:e})).accountUpdate)||void 0===a?void 0:a.account},Jo=ne("\n mutation SignupContactUpdate($id: ID!, $attributes: ContactAttributes!) {\n contactUpdate(id: $id, attributes: $attributes) {\n contact {\n id\n }\n errors\n }\n }\n ");function nr(n){return{name:n.accountName,billingCountry:n.billingCountry,billingState:n.billingState,billingCity:n.billingCity,billingZip:n.billingZip,billingStreet:n.billingStreet,taxNumber:n.taxNumber}}async function er(n,{token:e,apiHost:t,accountId:i,billingContactId:a}){a&&await async function({token:n,apiHost:e,contactId:t,attributes:i}){var a;return null===(a=(await In(Jo,{apiHost:e,token:n},{id:t,attributes:i})).contactUpdate)||void 0===a?void 0:a.contact}({token:e,apiHost:t,contactId:a,attributes:{firstName:n.firstName,lastName:n.lastName,email:n.email}}),await Xo({token:e,apiHost:t,accountId:i,attributes:nr(n)})}function tr({className:e,requiredBillingDetails:t,onBlur:a,disabled:o,extraFieldsToShow:r}){const s=Br(),l=H(),u=!!(d=t)&&!!(d.billingStreet||d.billingState||d.billingCity||d.billingZip||d.taxNumber);var d;const c=null==r?void 0:r.includes("title");return n.jsx(i.Form,{className:`bunny-flex bunny-flex-col bunny-h-full bunny-w-full ${null!=e?e:""}`,form:s,layout:"vertical",autoComplete:"off",onBlurCapture:a?n=>{const e=n.currentTarget,t=n.relatedTarget;t&&e.contains(t)||a()}:void 0,children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-space-y-2",children:[n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{name:"firstName",rules:[{required:!0,message:"First name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"First name",disabled:o})}),n.jsx(i.Form.Item,{name:"lastName",rules:[{required:!0,message:"Last name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Last name",disabled:o})})]}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{name:"email",rules:[{required:!0,message:"Email is required"},{type:"email",message:"Please enter a valid email"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Email",disabled:o})}),n.jsx(i.Form.Item,{name:"accountName",rules:[{required:!0,message:"Company name is required"}],className:"bunny-flex-1",children:n.jsx(i.Input,{placeholder:"Company name",disabled:o})})]}),c?n.jsx(i.Form.Item,{name:"title",rules:[{required:!0,message:"Job title is required"}],children:n.jsx(i.Input,{placeholder:"Job title",disabled:o})}):null,n.jsx("div",{className:`bunny-flex ${l?"bunny-flex-row bunny-pb-2":"bunny-flex-row"} bunny-gap-4`,children:n.jsx("div",{className:"flex-1 w-1/2",children:n.jsx(i.Form.Item,{name:"billingCountry",rules:[{required:!0,message:"Country is required"}],children:n.jsx(i.Select,{disabled:o,options:A,placeholder:"Select a country",showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})})})}),u&&n.jsxs(n.Fragment,{children:[n.jsx(i.Divider,{className:"bunny-my-4"}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(null==t?void 0:t.billingStreet)?n.jsx(i.Form.Item,{name:"billingStreet",rules:[{required:!0,message:"Street address is required"}],children:n.jsx(i.Input,{placeholder:"Street address",disabled:o})}):null,n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[(null==t?void 0:t.billingCity)?n.jsx(i.Form.Item,{name:"billingCity",className:"bunny-flex-1",rules:[{required:!0,message:"City is required"}],children:n.jsx(i.Input,{placeholder:"City",disabled:o})}):null,(null==t?void 0:t.billingState)?n.jsx(i.Form.Item,{name:"billingState",className:"bunny-flex-1",rules:[{required:!0,message:"State / province is required"}],children:n.jsx(i.Input,{placeholder:"State / province",disabled:o})}):null]}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[(null==t?void 0:t.billingZip)?n.jsx(i.Form.Item,{name:"billingZip",className:"bunny-flex-1",rules:[{required:!0,message:"Postal / ZIP code is required"}],children:n.jsx(i.Input,{placeholder:"Postal / ZIP code",disabled:o})}):null,(null==t?void 0:t.taxNumber)?n.jsx(i.Form.Item,{name:"taxNumber",className:"bunny-flex-1",rules:[{required:!0,message:"Tax number is required"}],children:n.jsx(i.Input,{placeholder:"Tax number",disabled:o})}):null]})]})]})]})})}function ir(n){return e.useCallback(({defaults:e,fillEmptyOnly:t=!1,validateBillingCountry:i=!1})=>{const a={...e,billingCountry:void 0},o=Object.fromEntries(Object.entries(a).filter(([n,e])=>null!=e));if(t){const e=n.getFieldsValue(!0);n.setFieldsValue(Object.fromEntries(Object.entries(o).filter(([n])=>null==e[n]||""===e[n])))}else n.setFieldsValue(o);if(!i)return;if(!e.billingCountry)return;A.some(n=>n.value===e.billingCountry)&&n.setFieldsValue({billingCountry:e.billingCountry})},[n])}const ar=ne("\n fragment ExistingAccountLoadedEffect_AccountFragment on Account {\n id\n code\n name\n billingCountry\n billingState\n billingCity\n billingZip\n billingStreet\n taxNumber\n billingContact {\n firstName\n lastName\n email\n }\n }\n");function or({account:n,defaultFormValues:t,priceList:i,onSelfServiceBuyDisabled:a,priceListCode:o,paymentRequiredToAcceptQuote:r,documentTemplateId:s,onQuoteAccountSignupSuccess:l}){var u;const d=Br(),c=ir(d),p=e.useRef(null),{enableTrial:m}=Vr(),{mutate:y}=Go({priceListCode:o,enableTrial:m,paymentRequiredToAcceptQuote:r,documentTemplateId:s,onQuoteAccountSignupSuccess:l});return e.useEffect(()=>{var e;const o=Jn(ar,n),r=null!==(e=null==o?void 0:o.id)&&void 0!==e?e:"none";p.current!==r&&(p.current=r,async function(){var n,e,r,s,l,u,p,m,g,b,h,v,f,x,C;if(null==o?void 0:o.id)return c({defaults:{firstName:null!==(e=null===(n=o.billingContact)||void 0===n?void 0:n.firstName)&&void 0!==e?e:void 0,lastName:null!==(s=null===(r=o.billingContact)||void 0===r?void 0:r.lastName)&&void 0!==s?s:void 0,email:null!==(u=null===(l=o.billingContact)||void 0===l?void 0:l.email)&&void 0!==u?u:void 0,accountName:null!==(p=o.name)&&void 0!==p?p:void 0,billingCountry:null!==(m=o.billingCountry)&&void 0!==m?m:void 0,accountBillingCountry:null!==(g=o.billingCountry)&&void 0!==g?g:void 0,billingState:null!==(b=o.billingState)&&void 0!==b?b:void 0,billingCity:null!==(h=o.billingCity)&&void 0!==h?h:void 0,billingZip:null!==(v=o.billingZip)&&void 0!==v?v:void 0,billingStreet:null!==(f=o.billingStreet)&&void 0!==f?f:void 0,taxNumber:null!==(x=o.taxNumber)&&void 0!==x?x:void 0},validateBillingCountry:!0}),t&&c({defaults:t,fillEmptyOnly:!0,validateBillingCountry:!0}),void(o.code&&y({accountCode:o.code}));t&&c({defaults:t,validateBillingCountry:!0});try{await d.validateFields()}catch(n){return}!1!==(null===(C=null==i?void 0:i.plan)||void 0===C?void 0:C.selfServiceBuy)||a()}())},[c,t,d,n,a,l,r,i,o,null===(u=null==i?void 0:i.plan)||void 0===u?void 0:u.selfServiceBuy,y,m,s]),null}const{Title:rr}=i.Typography,sr=ne("\n fragment ExistingAccountForm_AccountFragment on Account {\n ...ExistingAccountLoadedEffect_AccountFragment\n billingContact {\n id\n }\n id\n }\n ",[ar]);function lr({title:t,className:i,account:o,extraFieldsToShow:r,requiredBillingDetails:s,defaultFormValues:l,priceList:u,onSelfServiceBuyDisabled:d,priceListCode:c,documentTemplateId:p,onQuoteAccountSignupSuccess:m}){var y;const g=Br(),[b]=_r(),{paymentRequiredToAcceptQuote:h}=Vr(),v=Jn(sr,o),f=b,x=function({form:n,accountId:t,billingContactId:i}){const o=oe(),{apiHost:r}=e.useContext(te),{mutateAsync:s}=a.useMutation({mutationFn:n=>{if(!t)throw new Error("Account ID is required");return er(n,{token:o,apiHost:r,accountId:t,billingContactId:i})}});return async()=>{try{await n.validateFields()}catch(n){return}await s(n.getFieldsValue())}}({form:g,accountId:null==v?void 0:v.id,billingContactId:null===(y=null==v?void 0:v.billingContact)||void 0===y?void 0:y.id});return n.jsxs(n.Fragment,{children:[n.jsx(or,{account:v,defaultFormValues:l,priceList:u,onSelfServiceBuyDisabled:d,priceListCode:c,paymentRequiredToAcceptQuote:h,documentTemplateId:p,onQuoteAccountSignupSuccess:m}),n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-items-center",children:n.jsx(rr,{className:"bunny-m-0",level:3,children:t})}),n.jsx(tr,{className:i,requiredBillingDetails:s,onBlur:async function(){await x()},disabled:f,extraFieldsToShow:r})]})]})}const ur=ne("\n fragment SignupForm_AccountFragment on Account {\n ...ExistingAccountForm_AccountFragment\n id\n code\n name\n billingCountry\n billingState\n billingCity\n billingZip\n billingStreet\n taxNumber\n billingContact {\n id\n firstName\n lastName\n email\n }\n }\n ",[sr]),dr=ne("\n query GetCurrentUserAccountForSignup {\n currentUser {\n account {\n id\n ...SignupForm_AccountFragment\n }\n }\n }\n ",[ur]);function cr({onAccountLoaded:n}={}){var t;const i=oe(),{apiHost:o}=e.useContext(te),{data:r,isLoading:s}=a.useQuery({queryKey:sn(i),queryFn:async()=>{var e;const t=await(async({token:n,apiHost:e})=>In(dr,{apiHost:e,token:n},{}))({apiHost:o,token:i});return null==n||n(null===(e=null==t?void 0:t.currentUser)||void 0===e?void 0:e.account),t}});return{account:null===(t=null==r?void 0:r.currentUser)||void 0===t?void 0:t.account,isLoading:s}}function pr({priceListCode:e,documentTemplateId:t}){const a=oe(),o=Br(),{enableTrial:r,paymentRequiredToAcceptQuote:s}=Vr(),[,l]=Hr(),[,u]=Qr(),{setSignupQuoteQueryData:d}=Ao(),{account:c}=cr(),p=Jn(ur,c);const{mutateAsync:m,isPending:y}=Go({priceListCode:e,enableTrial:r,paymentRequiredToAcceptQuote:s,documentTemplateId:t,onQuoteAccountSignupSuccess:function(n,e,t){void 0===(null==p?void 0:p.id)?(l(n),d(t,n)):d(t,a),u(e)}});return n.jsx(i.Button,{className:"bunny-w-full",type:"primary",loading:y,onClick:async function(){try{await o.validateFields()}catch(n){return}void 0===(null==p?void 0:p.id)&&await m({formData:o.getFieldsValue()})},children:"Continue"})}const{Title:mr}=i.Typography;function yr({className:e,extraFieldsToShow:t,requiredBillingDetails:i,defaultFormValues:a,title:o}){const[r]=_r(),s=r;return n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsx(gr,{defaultFormValues:a}),n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-items-center",children:n.jsx(mr,{className:"bunny-m-0",level:3,children:o})}),n.jsx(tr,{className:e,requiredBillingDetails:i,disabled:s,extraFieldsToShow:t})]})}function gr({defaultFormValues:n,onValidatedDefaults:t}){const i=Br(),a=ir(i),o=e.useRef(!1);return e.useEffect(()=>{if(o.current||!n)return;const e=n;!async function(){o.current=!0,a({defaults:e,validateBillingCountry:!0});try{await i.validateFields()}catch(n){return}null==t||t()}()},[a,n,i,t]),null}const br=_();function hr({priceListCode:e,priceList:t,defaultFormValues:i,documentTemplateId:a,requiredBillingDetails:o}){const r=oe(),[,s]=Hr(),[,l]=Qr(),{paymentRequiredToAcceptQuote:u}=Vr(),{hasSigningPlugins:d}=go(),{setSignupQuoteQueryData:c}=Ao();const{account:p}=cr(),m=Jn(ur,p),y=!1===d;return n.jsx(n.Fragment,{children:(null==m?void 0:m.id)?n.jsx(lr,{title:"Account details",account:m,priceListCode:e,extraFieldsToShow:!0===y&&u?["title"]:void 0,requiredBillingDetails:o,defaultFormValues:i,priceList:t,documentTemplateId:a,onQuoteAccountSignupSuccess:function(n,e,t){void 0===(null==m?void 0:m.id)?(s(n),c(t,n)):c(t,r),l(e)},onSelfServiceBuyDisabled:function(){br("Self service purchase is disabled for this plan.")}}):n.jsx(yr,{title:"Create new account",defaultFormValues:i,extraFieldsToShow:!0===y&&u?["title"]:void 0,requiredBillingDetails:o})})}const vr=ne("\n fragment SignupPaymentForm_PriceListFragment on PriceList {\n currencyId\n }\n "),fr=({quote:e,priceList:t})=>{var i,a;const[,o]=_r(),{onPaymentHoldSuccess:r}=go(),s=Br(),l=Jn(no,e),u=Jn(vr,t),d=null==l?void 0:l.payToAccept,c=null!==(a=null!==(i=null==l?void 0:l.amountDue)&&void 0!==i?i:null==l?void 0:l.amount)&&void 0!==a?a:0,p=0===c,m=c>0;const y={quote:null!=l?l:void 0,onPaymentSuccess:function(){o(!0)},currencyId:null==u?void 0:u.currencyId,checkoutPrecondition:async()=>await async function(){try{return await s.validateFields(),!0}catch(n){return!1}}()};return d&&m?n.jsx(Ci,{...y,onPaymentHoldSuccess:r,paymentHold:{quoteId:null==l?void 0:l.id,amountToHold:null==l?void 0:l.amountDue}}):d&&p?n.jsx(Ci,{...y,children:()=>n.jsx(Ci.CheckoutNoPayment,{className:"bunny-px-4 bunny-pt-2"})}):p?n.jsx(Ci,{...y,children:()=>n.jsx(Ci.CheckoutNoPayment,{className:"bunny-px-4"})}):m?n.jsx(Ci,{...y}):null};function xr({left:e,right:t,style:i,className:a}){const o=H();return n.jsxs("div",{className:`bunny-flex bunny-min-h-screen ${o?"bunny-flex-col":"bunny-flex-row"} ${null!=a?a:""}`,style:i,children:[n.jsx("div",{className:"bunny-flex bunny-items-center bunny-flex-col "+(o?"bunny-w-full bunny-h-1/2 bunny-min-h-0":"bunny-w-1/2 bunny-min-h-screen"),children:e}),n.jsx("div",{className:`bunny-flex bunny-flex-col ${o?"bunny-w-full bunny-h-1/2 bunny-min-h-0 bunny-overflow-auto":"bunny-w-1/2 bunny-min-h-screen"} bunny-items-center`,style:{boxShadow:"-5px 0 20px 0 rgba(0, 0, 0, 0.05)"},children:t})]})}const Cr=()=>n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-flex-shrink-0",style:{width:68,height:68,minWidth:68,minHeight:68,borderRadius:"9999px",backgroundColor:"#dcfce7"},children:n.jsx(y.FontAwesomeIcon,{icon:m.faCheck,style:{color:"#16a34a",fontSize:24}})}),{Text:wr}=i.Typography,jr=({returnUrl:e})=>e?n.jsx(wr,{className:"bunny-text-slate-500 bunny-cursor-pointer bunny-underline",onClick:()=>window.location.href=e,children:"View subscription"}):null;function Sr({returnUrl:e,className:t,children:a}){return n.jsx("div",{className:`${null!=t?t:""}`.trim(),children:n.jsx(i.Card,{variant:"borderless",className:`bunny-w-full bunny-pt-2 ${null!=t?t:""}`.trim(),children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-justify-center bunny-gap-4",children:[n.jsx(Cr,{}),a,n.jsx(jr,{returnUrl:e})]})})})}const{Text:Ir,Title:Lr}=i.Typography,Pr=({quote:t,currencyId:i,returnUrl:a,className:o})=>{var r,s,l;const{apiHost:u}=e.useContext(te),d=oe(),c=null!=a?a:function({apiHost:n,token:e}){return e?`${n}/portal/subscriptions?token=${encodeURIComponent(e)}`:""}({apiHost:u,token:d}),p=t,m=null!==(s=null!==(r=null==p?void 0:p.amountDue)&&void 0!==r?r:null==p?void 0:p.amount)&&void 0!==s?s:0,y=!0===(null==p?void 0:p.payToAccept),g="ACCEPTED"===(null==p?void 0:p.state),b=null===(l=null==p?void 0:p.quoteChanges)||void 0===l?void 0:l.some(n=>!0===n.isTrial);return!y&&b?n.jsxs(Sr,{returnUrl:c,className:o,children:[n.jsx(Lr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(Ir,{className:"bunny-text-slate-500",children:"Trial subscription created"})]}):y&&g&&b?n.jsxs(Sr,{returnUrl:c,className:o,children:[n.jsx(Lr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(Ir,{className:"bunny-text-slate-500",children:"Quote accepted. Trial subscription created"})]}):y&&g?n.jsxs(Sr,{returnUrl:c,className:o,children:[n.jsx(Lr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(Ir,{className:"bunny-text-slate-500",children:"Quote accepted. Subscription created"}),i?n.jsx(Ir,{className:"bunny-text-slate-500",children:yt(m,i)}):null]}):n.jsxs(Sr,{returnUrl:c,className:o,children:[n.jsx(Lr,{level:3,className:"bunny-m-0",children:"Signup successful!"}),n.jsx(Ir,{className:"bunny-text-slate-500",children:"Payment successful. Subscription created"})]})},kr=ne("\n fragment SelfServiceBuyWarning_PriceListFragment on PriceList {\n plan {\n selfServiceBuy\n }\n }\n "),Nr=ne("\n fragment QuoteAcceptPage_PriceListFragment on PriceList {\n ...CheckoutSummary_PriceListFragment\n }\n ",[No]),Fr=ne("\n fragment Signup_PriceListFragment on PriceList {\n ...SelfServiceBuyWarning_PriceListFragment\n ...QuoteAcceptPage_PriceListFragment\n ...PriceListDisplay_PriceListFragment\n ...CheckoutSummary_PriceListFragment\n ...SignupPaymentForm_PriceListFragment\n id\n plan {\n selfServiceBuy\n }\n code\n currencyId\n }\n ",[so,kr,Nr,No,vr]),Dr=ne("\n query PriceList($code: String!) {\n priceList (code: $code) {\n ...Signup_PriceListFragment\n }\n }\n",[Fr]),Tr=()=>{var a,o;const{overrideToken:r}=e.useContext(bn),{data:s}=mo({tokenOverride:r}),[l,u]=e.useState(null),d=Jn(eo,s),c="ACCEPTED"===(null==d?void 0:d.state);return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-h-full",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-end bunny-gap-2",children:[c&&n.jsx(ca,{acceptedByName:null==d?void 0:d.acceptedByName,acceptedAt:null==d?void 0:d.acceptedAt}),l?n.jsx(i.Button,{icon:n.jsx(t.FullscreenOutlined,{}),onClick:()=>l.toggleFullScreen(),children:"Fullscreen"}):null,(null==d?void 0:d.id)?n.jsx(ta,{id:null==d?void 0:d.id}):null]}),n.jsx(Di,{html:null!==(o=null===(a=null==d?void 0:d.formattedQuote)||void 0===a?void 0:a.html)&&void 0!==o?o:null,targetUrl:(null==d?void 0:d.documentTemplateId)?`/pdf/quote/${null==d?void 0:d.id}`:void 0,onDocumentPreviewFullscreenApiChange:u})]})};function qr({priceListCode:t,defaultFormValues:i,documentTemplateId:o,requiredBillingDetails:r,style:s,defaultCouponCode:l}){const[u]=_r(),{apiHost:d}=e.useContext(te),c=oe(),{data:p}=mo({tokenOverride:c}),{account:m}=cr(),{data:y}=a.useQuery({queryKey:ln(t,c),queryFn:()=>(async({token:n,code:e,apiHost:t})=>{const i=await In(Dr,{apiHost:t,token:n},{code:e});return null==i?void 0:i.priceList})({token:c,apiHost:d,code:t})}),g=Jn(Fr,y),b=Jn(co,p),h=void 0!==(null==m?void 0:m.id);return n.jsxs("div",{"data-slot":"signup-root",className:"bunny-signup bunny-relative",style:s,children:[n.jsx(Zo,{style:s}),n.jsx(xr,{left:n.jsxs("div",{className:"bunny-box-border bunny-flex bunny-h-full bunny-min-h-0 bunny-w-4/5 bunny-flex-col bunny-items-start bunny-justify-between bunny-gap-4 bunny-py-24 bunny-overflow-y-auto",children:[n.jsx(zo,{}),n.jsxs("div",{"data-slot":"signup-summary",className:"bunny-flex bunny-min-h-0 bunny-w-full bunny-flex-1 bunny-flex-col bunny-gap-4",children:[n.jsx(uo,{priceList:g,quote:p}),n.jsx(Bo,{quote:b,priceList:g,defaultCouponCode:l}),n.jsx(Tr,{})]}),n.jsx(fo,{})]}),right:n.jsxs("div",{className:"bunny-box-border bunny-flex bunny-h-full bunny-min-h-0 bunny-w-4/5 bunny-flex-col bunny-py-24 bunny-overflow-y-auto",children:[n.jsx(hr,{priceListCode:t,priceList:g,defaultFormValues:i,documentTemplateId:o,requiredBillingDetails:r}),!b&&!h&&n.jsx("div",{className:"bunny-pt-4",children:n.jsx(pr,{priceListCode:t,documentTemplateId:o})}),!u&&b&&n.jsx("div",{className:"bunny-pt-2",children:n.jsx(fr,{quote:b,priceList:g})}),u&&n.jsx(Pr,{quote:b,currencyId:null==g?void 0:g.currencyId,className:"bunny-py-4"})]})})]})}function Ar({children:e}){const[t]=Hr(),i=oe(),a=t||i;return n.jsx(bn.Provider,{value:{overrideToken:a},children:n.jsx(bo,{children:e})})}const[Mr,Hr]=Me(()=>e.useState(void 0)),[Er,Qr]=Me(()=>e.useState(void 0)),[$r,_r]=Me(()=>e.useState(!1)),[Rr,Br]=hn(),[Ur,Vr]=hn();const[Or,Zr]=hn(),[zr,Kr]=hn(),[Gr,Yr]=hn(),[Wr,Xr]=hn(),[Jr,ns]=hn(),[es,ts]=Me(n=>e.useState(n)),is=({children:e,message:t})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-w-full",style:{marginTop:"80px"},children:[n.jsx("div",{style:{fontSize:"32px"},children:t}),e]}),as=ne("\n fragment findParentSubscription_SubscriptionFragment on Subscription {\n id\n addonSubscriptions {\n id\n }\n }\n ",[]);const os=ne("\n fragment findNonAddonSubscriptions_SubscriptionFragment on Subscription {\n id\n priceList {\n plan {\n addon\n }\n }\n ...findParentSubscription_SubscriptionFragment\n }\n ",[as]);function rs(n){return n.filter(e=>{var t,i,a,o;const r=Jn(os,e),s=n.map(n=>Jn(os,n)),l=void 0!==function(n,e){const t=Jn(as,n);return e.find(n=>{var e,i;return null!==(i=null===(e=Jn(as,n).addonSubscriptions)||void 0===e?void 0:e.some(n=>n.id===t.id))&&void 0!==i&&i})}(r,s);return(!1===(null===(i=null===(t=null==r?void 0:r.priceList)||void 0===t?void 0:t.plan)||void 0===i?void 0:i.addon)||null===(null===(o=null===(a=null==r?void 0:r.priceList)||void 0===a?void 0:a.plan)||void 0===o?void 0:o.addon))&&!l})}const ss=ne("\n fragment findAddonSubscriptions_SubscriptionFragment on Subscription {\n id\n addonSubscriptions {\n id\n }\n }\n ",[]);const ls=({isLast:e,indentation:t,verticalMargin:i})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-relative",style:{width:`${t}px`},children:[n.jsx("div",{className:"bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto",style:{marginTop:i}}),n.jsx("div",{className:"bunny-bg-gray-300 bunny-h-0.5 bunny-w-1/2 bunny-ml-auto"}),e?n.jsx("div",{className:"bunny-flex-1"}):n.jsx("div",{className:"bunny-flex-1 bunny-bg-gray-300 bunny-w-0.5 bunny-mx-auto",style:{marginBottom:i}})]}),us=({children:t,className:i,style:a})=>{const{darkMode:o}=e.useContext(te);return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-rounded-md ${i}`,style:{...a,backgroundColor:o?"var(--row-background-dark)":"var(--row-background)"},children:t})},ds=n=>(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","EXPIRED")||(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","CANCELED")||(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","TRIAL_EXPIRED"),cs=n=>(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","TRIAL"),ps=n=>{var e;return Boolean(null===(e=null==n?void 0:n.priceTiers)||void 0===e?void 0:e.length)},ms=ne("\n fragment splitSubscriptionsByPriceList_SubscriptionFragment on Subscription {\n id\n state\n evergreen\n startDate\n endDate\n addonSubscriptions {\n id\n startDate\n endDate\n priceList {\n id\n }\n plan {\n id\n }\n }\n chargeReport {\n kind\n startDate\n endDate\n priceList {\n id\n plan {\n id\n name\n selfServiceBuy\n selfServiceCancel\n selfServiceRenew\n addon\n addonPlans {\n id\n }\n }\n product {\n id\n name\n showProductNameOnLineItem\n }\n periodMonths\n name\n }\n }\n charges {\n priceList {\n id\n }\n }\n }\n ",[]);const ys=n=>{var t;const i=e.useRef(null),[a,o]=e.useState(!1),r=null===(t=null==n?void 0:n.once)||void 0===t||t;return e.useEffect(()=>{const e=i.current;if(!e)return;const t=new IntersectionObserver(([n])=>{n.isIntersecting?(o(!0),r&&t.disconnect()):r||o(!1)},n);return t.observe(e),()=>t.disconnect()},[r,null==n?void 0:n.root,null==n?void 0:n.rootMargin,null==n?void 0:n.threshold]),[i,a]},gs=ne("\n fragment SubscriptionCardActions_PriceListChangeOptionsFragment on PriceListChangeOptions {\n priceLists {\n id\n product {\n id\n }\n }\n }\n"),bs=ne("\n fragment SubscriptionCardActions_SubscriptionFragment on Subscription {\n id\n state\n plan {\n selfServiceCancel\n }\n product {\n id\n }\n priceList {\n plan {\n addon\n }\n }\n }\n ",[]),hs=({priceListChangeOptions:e,subscription:t,isPaymentMethodLoading:a})=>{var o,r,s;const l=Jn(gs,e),u=Jn(bs,t),d=Xr(),c=Yr(),p=null!==(r=null===(o=u.plan)||void 0===o?void 0:o.selfServiceCancel)&&void 0!==r&&r,m=null===(s=null==l?void 0:l.priceLists)||void 0===s?void 0:s.filter(n=>{var e,t;return(null===(e=n.product)||void 0===e?void 0:e.id)===(null===(t=u.product)||void 0===t?void 0:t.id)}),y=((null==m?void 0:m.length)||0)>0,g=cs(u.state),b=(null==(h=u.state)?void 0:h.toUpperCase())===ne.scalar("SubscriptionState","TRIAL_EXPIRED");var h;const v=(n=>(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","ACTIVE")||(null==n?void 0:n.toUpperCase())===ne.scalar("SubscriptionState","PENDING"))(u.state);return a?null:n.jsxs(n.Fragment,{children:[p&&(g||v)&&n.jsx(i.Popconfirm,{icon:null,onConfirm:()=>d(u.id),title:"Cancel subscription",children:n.jsx(i.Button,{className:"bunny-p-0",type:"link",children:"Cancel subscription"})}),y&&c&&(v||g||b)&&n.jsx(i.Button,{onClick:()=>c(u.id),type:"primary",children:(()=>{var n,e;return g?"Upgrade from trial":b?"Upgrade":!0===(null===(e=null===(n=u.priceList)||void 0===n?void 0:n.plan)||void 0===e?void 0:e.addon)?"Adjust plan":"Change plan"})()}),!y&&g&&n.jsx(i.Tag,{color:"warning",children:"Cannot upgrade"})]})},vs=ne("\n query priceListChangeOptions($productId: ID!) {\n priceListChangeOptions(productId: $productId) {\n ...SubscriptionCardActions_PriceListChangeOptionsFragment\n }\n }\n ",[gs]),fs=ne("\n fragment SubscriptionStatusText_SubscriptionFragment on Subscription {\n id\n state\n cancellationDate\n evergreen\n endDate\n trialEndDate\n trialStartDate\n startDate\n trialExpirationAction\n }\n ",[]);function xs({subscription:e}){const t=Jn(fs,e),{cancellationDate:i,state:a,evergreen:o,endDate:r,trialEndDate:s,trialStartDate:l,startDate:u,trialExpirationAction:d}=t,c=null==a?void 0:a.toUpperCase(),p=c===ne.scalar("SubscriptionState","ACTIVE"),m=c===ne.scalar("SubscriptionState","PENDING"),y=c===ne.scalar("SubscriptionState","CANCELED"),g=c===ne.scalar("SubscriptionState","EXPIRED"),b=c===ne.scalar("SubscriptionState","TRIAL_EXPIRED"),h=c===ne.scalar("SubscriptionState","TRIAL");if(i&&(p||m||h))return n.jsxs(ra,{color:"red",children:["Canceled - ends on ",sa(i)]});if(i&&y)return`Canceled on ${sa(i)}`;if(g||b)return`Ended on ${sa(r||s)}`;if(m){if(l)return`Trial starts on ${sa(l)}`;if(u)return`Activates on ${sa(u)}`}if(h)switch(d){case"ACTIVATE":return`Activates on ${sa(u)}`;case"CANCEL":return`Trial expires on ${sa(s)}`}return o&&t.state===ne.scalar("SubscriptionState","ACTIVE")?`Renews on ${sa(r)}`:`Ends on ${sa(r||s)}`}const{Text:Cs}=i.Typography,ws=ne("\n fragment SubscriptionStatusAndActions_SubscriptionFragment on Subscription {\n id\n accountId\n product {\n id\n }\n ...SubscriptionStatusText_SubscriptionFragment\n ...SubscriptionCardActions_SubscriptionFragment\n }\n ",[fs,bs]);function js({subscription:t}){var o,r;const s=Jn(ws,t),{apiHost:l}=e.useContext(te),u=oe(),d=H(),[c,p]=ys(),{data:m,isLoading:y}=a.useQuery({queryKey:J({productId:null===(o=null==s?void 0:s.product)||void 0===o?void 0:o.id,token:u}),queryFn:()=>{var n;if(null===(n=null==s?void 0:s.product)||void 0===n?void 0:n.id)return(async({apiHost:n,productId:e,token:t})=>(await In(vs,{apiHost:n,token:t},{productId:e})).priceListChangeOptions)({apiHost:l,token:u,productId:s.product.id})},enabled:p&&Boolean(null===(r=s.product)||void 0===r?void 0:r.id)}),{isLoading:g}=qe({accountId:s.accountId}),b=!d,h=!p||y,v=h&&b,f=h&&!m;return n.jsxs(n.Fragment,{children:[n.jsx("span",{ref:c,className:"bunny-grow",children:v?n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:180}}):n.jsx(Cs,{children:n.jsx(xs,{subscription:s})})}),b&&(f?n.jsx(i.Skeleton.Button,{active:!0,size:"default",style:{width:100}}):n.jsx(hs,{priceListChangeOptions:m,subscription:s,isPaymentMethodLoading:g}))]})}const{Text:Ss}=i.Typography,Is=ne("\n fragment SubscriptionCardHeader_SubscriptionFragment on Subscription {\n id\n state\n daysLeftInTrial\n product {\n id\n name\n }\n plan {\n name\n selfServiceBuy\n selfServiceCancel\n }\n priceList {\n plan {\n addon\n }\n deprecated\n }\n ...SubscriptionStatusAndActions_SubscriptionFragment\n }\n ",[ws]),Ls=({subscription:t})=>{var i,a,o,r;const s=Jn(Is,t),{darkMode:l}=e.useContext(te),{brandColor:d}=fn(),{subscriptionProductNameStyle:c}=ns(),p=null==s?void 0:s.daysLeftInTrial,m=cs(s.state);return n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between",style:{backgroundColor:l?"var(--row-background-dark)":""},children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[(null===(i=null==s?void 0:s.product)||void 0===i?void 0:i.name)&&n.jsx(Ss,{style:{color:d,...c},children:s.product.name}),n.jsxs("div",{className:"bunny-flex bunny-grow bunny-items-center bunny-gap-2",children:[(null===(a=null==s?void 0:s.plan)||void 0===a?void 0:a.name)&&n.jsx(Ss,{className:"bunny-text-sm",children:s.plan.name}),n.jsxs(ra,{color:to[null===(o=s.state)||void 0===o?void 0:o.toUpperCase()],children:[u.capitalize(s.state.toLowerCase().replace(/_/g," ")),m?` (${null!=p?p:"N/A"} days left)`:""]}),(null===(r=s.priceList)||void 0===r?void 0:r.deprecated)&&n.jsx(ra,{color:"orange",children:"Legacy"})]})]}),n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-6",children:n.jsx(js,{subscription:s})})]})},Ps=ne("\n fragment filterSubscriptionCharges_SubscriptionChargeFragment on SubscriptionCharge {\n endDate\n }\n ",[]);function ks(n){return n.filter(n=>{const e=Jn(Ps,n);return!dt(e.endDate).isBefore(dt(),"day")})}const Ns=ne("\n fragment sortSubscriptionCharges_SubscriptionChargeFragment on SubscriptionCharge {\n id\n priceListChargeId\n kind\n endDate\n startDate\n isAmendment\n }\n ",[]),Fs=n=>n===ne.scalar("QuoteChangeKind","DISCOUNT");function Ds(n){return[...n].sort((n,e)=>{var t,i,a;const o=Jn(Ns,n),r=Jn(Ns,e);return o.priceListChargeId!==r.priceListChargeId?null!==(a=null===(t=null==o?void 0:o.priceListChargeId)||void 0===t?void 0:t.localeCompare(null!==(i=null==r?void 0:r.priceListChargeId)&&void 0!==i?i:""))&&void 0!==a?a:0:Fs(o.kind)&&!Fs(r.kind)?1:!Fs(o.kind)&&Fs(r.kind)?-1:o.endDate.localeCompare(r.endDate)||o.startDate.localeCompare(r.startDate)||(o.isAmendment?1:-1)})}const{Text:Ts}=i.Typography,qs=({columns:e})=>n.jsx(n.Fragment,{children:e.map((e,t)=>n.jsx(Ts,{className:`bunny-text-slate-400 ${e.className}`,children:e.title},t))});var As;!function(n){n.USAGE="USAGE",n.ONE_TIME="ONE_TIME",n.RECURRING="RECURRING"}(As||(As={}));var Ms,Hs=As;!function(n){n.ADJUSTMENT="ADJUSTMENT",n.COUPON="COUPON",n.CREDIT="CREDIT",n.DISCOUNT="DISCOUNT",n.FREE_PERIOD_DISCOUNT="FREE_PERIOD_DISCOUNT",n.PRICE_UPDATE="PRICE_UPDATE",n.QUANTITY_UPDATE="QUANTITY_UPDATE",n.REINSTATE="REINSTATE",n.RENEW="RENEW",n.SUBSCRIBE="SUBSCRIBE",n.UNSUBSCRIBE="UNSUBSCRIBE",n.UPDATE="UPDATE",n.ACTIVATE="ACTIVATE"}(Ms||(Ms={}));var Es,Qs=Ms,$s={exports:{}};var _s=(Es||(Es=1,$s.exports=function(){var n="minute",e=/[+-]\d\d(?::?\d\d)?/g,t=/([+-]|\d\d)/g;return function(i,a,o){var r=a.prototype;o.utc=function(n){return new a({date:n,utc:!0,args:arguments})},r.utc=function(e){var t=o(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),n):t},r.local=function(){return o(this.toDate(),{locale:this.$L,utc:!1})};var s=r.parse;r.parse=function(n){n.utc&&(this.$u=!0),this.$utils().u(n.$offset)||(this.$offset=n.$offset),s.call(this,n)};var l=r.init;r.init=function(){if(this.$u){var n=this.$d;this.$y=n.getUTCFullYear(),this.$M=n.getUTCMonth(),this.$D=n.getUTCDate(),this.$W=n.getUTCDay(),this.$H=n.getUTCHours(),this.$m=n.getUTCMinutes(),this.$s=n.getUTCSeconds(),this.$ms=n.getUTCMilliseconds()}else l.call(this)};var u=r.utcOffset;r.utcOffset=function(i,a){var o=this.$utils().u;if(o(i))return this.$u?0:o(this.$offset)?u.call(this):this.$offset;if("string"==typeof i&&(i=function(n){void 0===n&&(n="");var i=n.match(e);if(!i)return null;var a=(""+i[0]).match(t)||["-",0,0],o=a[0],r=60*+a[1]+ +a[2];return 0===r?0:"+"===o?r:-r}(i),null===i))return this;var r=Math.abs(i)<=16?60*i:i;if(0===r)return this.utc(a);var s=this.clone();if(a)return s.$offset=r,s.$u=!1,s;var l=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(r+l,n)).$offset=r,s.$x.$localOffset=l,s};var d=r.format;r.format=function(n){var e=n||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,e)},r.valueOf=function(){var n=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*n},r.isUTC=function(){return!!this.$u},r.toISOString=function(){return this.toDate().toISOString()},r.toString=function(){return this.toDate().toUTCString()};var c=r.toDate;r.toDate=function(n){return"s"===n&&this.$offset?o(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():c.call(this)};var p=r.diff;r.diff=function(n,e,t){if(n&&this.$u===n.$u)return p.call(this,n,e,t);var i=this.local(),a=o(n).local();return p.call(i,a,e,t)}}}()),$s.exports),Rs=ot(_s);const Bs=Vt(i.Modal)`
108
108
  z-index: 2000;
109
109
 
110
110
  .ant-modal-content {
@@ -122,25 +122,25 @@
122
122
  .ant-modal-footer {
123
123
  padding: 0 1.5rem 1.5rem;
124
124
  }
125
- `,Es=t=>{const{children:i,description:a,title:o}=t,r=e.useMemo(()=>l.omit(t,["children","description","hideHeader","title"]),[t]);return n.jsxs(Qs,{...r,destroyOnClose:!0,maskClosable:!1,children:[(a||o)&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-px-6 bunny-py-6",style:{backgroundColor:v},children:[o&&n.jsx("div",{className:"bunny-font-medium",style:{fontSize:"17px"},children:o}),a&&n.jsx("div",{style:{color:C,lineHeight:"150%",width:"75%"},children:a})]}),i]})},{isPlural:$s}=b;st.extend(Hs);const _s=Wn("\n fragment FeatureUsageGraph_SubscriptionChargeFragment on SubscriptionCharge {\n feature {\n name\n }\n startDate\n endDate\n }\n ",[]),Rs=Wn("\n fragment FeatureUsageGraph_HistogramFragment on Histogram {\n dataInterval\n data {\n periodStart\n periodEnd\n intervals {\n intervalStart\n intervalUsage\n }\n intervalsTotal\n }\n }\n ",[]),Bs=({charge:t,featureUsage:i,useAreaChart:a=!1})=>{var o,r;const[s,l]=e.useState(!1),u=Yn(_s,t),d=Yn(Rs,i),c=(null===(o=u.feature)||void 0===o?void 0:o.name)||"",p=$s(c)?c:b(c);if(!d)return null;const m="DAILY"===(y=d.dataInterval)?"MMM DD":"MONTHLY"===y||"QUARTERLY"===y||"SEMIANNUALLY"===y?"MMM":"YYYY";var y;const g=(null!==(r=d.data)&&void 0!==r?r:[]).flatMap(n=>n.intervals.map(n=>({label:st.utc(String(n.intervalStart)).format(m),[p]:n.intervalUsage}))),v=g;return g.some(n=>{const e=n[p];return"number"==typeof e&&e>0})?n.jsxs("div",{className:"bunny-cursor-pointer",onClick:n=>{null==n||n.stopPropagation()},children:[n.jsx("div",{onClick:()=>l(!0),style:{height:20},children:n.jsx(Us,{data:g,featureName:p,height:20,width:120,useAreaChart:a})}),n.jsx(Es,{footer:null,onCancel:()=>{l(!1)},open:s,title:`Usage for period ${st.utc(String(u.startDate)).format("MMM DD, YYYY")} - ${st.utc(String(u.endDate)).format("MMM DD, YYYY")}`,children:n.jsx("div",{className:"bunny-py-4 bunny-px-6",onClick:n=>n.stopPropagation(),children:n.jsx(h.ResponsiveContainer,{width:"100%",height:200,children:n.jsx(Us,{data:v,displayXAxis:!0,featureName:p})})})})]}):"no usage"},Us=({data:e,displayXAxis:t,featureName:i,height:a,width:o,useAreaChart:r})=>{const s="#93c5fd";return r?n.jsxs(Os,{data:e,height:a,style:{overflow:"visible"},width:o,margin:{top:0,right:0,left:0,bottom:0},children:[n.jsx(h.XAxis,{className:"bunny-text-xs",dataKey:"label",interval:"equidistantPreserveStart",axisLine:!1,...t?{}:{tickFormatter:()=>"",tickLine:!1},style:{fill:C},height:t?void 0:1}),n.jsx(h.Tooltip,{cursor:{fill:f},...t?{}:{position:{y:-62}},wrapperStyle:{zIndex:1e3},content:({payload:e,label:t})=>{var a,o;const r=null===(o=null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.value)||void 0===o?void 0:o.toLocaleString();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-rounded bunny-bg-white bunny-p-2 bunny-shadow bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-left bunny-text-sm bunny-font-medium",children:t}),n.jsxs("div",{className:"bunny-text-left bunny-flex bunny-items-center bunny-text-sm",children:[n.jsxs("span",{children:[i,": "]}),n.jsxs("span",{children:[" ",r]})]})]})}}),n.jsx(h.Area,{type:"monotone",dataKey:i,stroke:s,fill:s,fillOpacity:.6})]}):n.jsxs(Vs,{data:e,height:a,style:{overflow:"visible"},width:o,margin:{top:0,right:0,left:0,bottom:0},children:[n.jsx(h.XAxis,{className:"bunny-text-xs",dataKey:"label",interval:"equidistantPreserveStart",...t?{}:{tickFormatter:()=>"",tickLine:!1},style:{fill:C},height:t?void 0:1}),n.jsx(h.Tooltip,{cursor:{fill:f},...t?{}:{position:{y:-62}},wrapperStyle:{zIndex:1e3},content:({payload:e,label:t})=>{var a,o;const r=null===(o=null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.value)||void 0===o?void 0:o.toLocaleString();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-rounded bunny-bg-white bunny-p-2 bunny-shadow bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-left bunny-text-sm bunny-font-medium",children:t}),n.jsxs("div",{className:"bunny-text-left bunny-flex bunny-items-center bunny-text-sm",children:[n.jsxs("span",{children:[i,": "]}),n.jsxs("span",{children:[" ",r]})]})]})}}),n.jsx(h.Bar,{activeBar:n.jsx(h.Rectangle,{fill:s}),dataKey:i,fill:s})]})},Vs=Rt(h.BarChart)`
125
+ `,Us=t=>{const{children:i,description:a,title:o}=t,r=e.useMemo(()=>u.omit(t,["children","description","hideHeader","title"]),[t]);return n.jsxs(Bs,{...r,destroyOnClose:!0,maskClosable:!1,children:[(a||o)&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-px-6 bunny-py-6",style:{backgroundColor:C},children:[o&&n.jsx("div",{className:"bunny-font-medium",style:{fontSize:"17px"},children:o}),a&&n.jsx("div",{style:{color:S,lineHeight:"150%",width:"75%"},children:a})]}),i]})},{isPlural:Vs}=h;dt.extend(Rs);const Os=ne("\n fragment FeatureUsageGraph_SubscriptionChargeFragment on SubscriptionCharge {\n feature {\n name\n }\n startDate\n endDate\n }\n ",[]),Zs=ne("\n fragment FeatureUsageGraph_HistogramFragment on Histogram {\n dataInterval\n data {\n periodStart\n periodEnd\n intervals {\n intervalStart\n intervalUsage\n }\n intervalsTotal\n }\n }\n ",[]),zs=({charge:t,featureUsage:i,useAreaChart:a=!1})=>{var o,r;const[s,l]=e.useState(!1),u=Jn(Os,t),d=Jn(Zs,i),c=(null===(o=u.feature)||void 0===o?void 0:o.name)||"",p=Vs(c)?c:h(c);if(!d)return null;const m="DAILY"===(y=d.dataInterval)?"MMM DD":"MONTHLY"===y||"QUARTERLY"===y||"SEMIANNUALLY"===y?"MMM":"YYYY";var y;const g=(null!==(r=d.data)&&void 0!==r?r:[]).flatMap(n=>n.intervals.map(n=>({label:dt.utc(String(n.intervalStart)).format(m),[p]:n.intervalUsage}))),b=g;return g.some(n=>{const e=n[p];return"number"==typeof e&&e>0})?n.jsxs("div",{className:"bunny-cursor-pointer",onClick:n=>{null==n||n.stopPropagation()},children:[n.jsx("div",{onClick:()=>l(!0),style:{height:20},children:n.jsx(Ks,{data:g,featureName:p,height:20,width:120,useAreaChart:a})}),n.jsx(Us,{footer:null,onCancel:()=>{l(!1)},open:s,title:`Usage for period ${dt.utc(String(u.startDate)).format("MMM DD, YYYY")} - ${dt.utc(String(u.endDate)).format("MMM DD, YYYY")}`,children:n.jsx("div",{className:"bunny-py-4 bunny-px-6",onClick:n=>n.stopPropagation(),children:n.jsx(v.ResponsiveContainer,{width:"100%",height:200,children:n.jsx(Ks,{data:b,displayXAxis:!0,featureName:p})})})})]}):"no usage"},Ks=({data:e,displayXAxis:t,featureName:i,height:a,width:o,useAreaChart:r})=>{const s="#93c5fd";return r?n.jsxs(Ys,{data:e,height:a,style:{overflow:"visible"},width:o,margin:{top:0,right:0,left:0,bottom:0},children:[n.jsx(v.XAxis,{className:"bunny-text-xs",dataKey:"label",interval:"equidistantPreserveStart",axisLine:!1,...t?{}:{tickFormatter:()=>"",tickLine:!1},style:{fill:S},height:t?void 0:1}),n.jsx(v.Tooltip,{cursor:{fill:w},...t?{}:{position:{y:-62}},wrapperStyle:{zIndex:1e3},content:({payload:e,label:t})=>{var a,o;const r=null===(o=null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.value)||void 0===o?void 0:o.toLocaleString();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-rounded bunny-bg-white bunny-p-2 bunny-shadow bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-left bunny-text-sm bunny-font-medium",children:t}),n.jsxs("div",{className:"bunny-text-left bunny-flex bunny-items-center bunny-text-sm",children:[n.jsxs("span",{children:[i,": "]}),n.jsxs("span",{children:[" ",r]})]})]})}}),n.jsx(v.Area,{type:"monotone",dataKey:i,stroke:s,fill:s,fillOpacity:.6})]}):n.jsxs(Gs,{data:e,height:a,style:{overflow:"visible"},width:o,margin:{top:0,right:0,left:0,bottom:0},children:[n.jsx(v.XAxis,{className:"bunny-text-xs",dataKey:"label",interval:"equidistantPreserveStart",...t?{}:{tickFormatter:()=>"",tickLine:!1},style:{fill:S},height:t?void 0:1}),n.jsx(v.Tooltip,{cursor:{fill:w},...t?{}:{position:{y:-62}},wrapperStyle:{zIndex:1e3},content:({payload:e,label:t})=>{var a,o;const r=null===(o=null===(a=null==e?void 0:e[0])||void 0===a?void 0:a.value)||void 0===o?void 0:o.toLocaleString();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-rounded bunny-bg-white bunny-p-2 bunny-shadow bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-left bunny-text-sm bunny-font-medium",children:t}),n.jsxs("div",{className:"bunny-text-left bunny-flex bunny-items-center bunny-text-sm",children:[n.jsxs("span",{children:[i,": "]}),n.jsxs("span",{children:[" ",r]})]})]})}}),n.jsx(v.Bar,{activeBar:n.jsx(v.Rectangle,{fill:s}),dataKey:i,fill:s})]})},Gs=Vt(v.BarChart)`
126
126
  .recharts-surface {
127
127
  overflow: visible;
128
128
  outline: none;
129
129
  }
130
- `,Os=Rt(h.AreaChart)`
130
+ `,Ys=Vt(v.AreaChart)`
131
131
  .recharts-surface {
132
132
  overflow: visible;
133
133
  outline: none;
134
134
  }
135
- `;var Zs;!function(n){n.ONCE="once",n.MONTHLY="monthly",n.ANNUAL="annually",n.SEMI_ANNUAL="semi annually",n.QUARTERLY="quarterly"}(Zs||(Zs={}));var Ks=Zs;const zs=Wn("\n fragment SubscriptionChargeTotal_SubscriptionChargeFragment on SubscriptionCharge {\n billingPeriod\n chargeType\n trial\n kind\n price\n periodPrice\n }\n ",[]),Gs=({charge:e,currencyId:t})=>{var i,a;const o=Yn(zs,e),r=o.billingPeriod&&Ks[o.billingPeriod],s=q(),l=ct(null!==(i=o.price)&&void 0!==i?i:"NaN",t),u=ct(null!==(a=o.periodPrice)&&void 0!==a?a:"NaN",t);return n.jsx("div",{className:"bunny-flex bunny-gap-1 "+(s?"bunny-flex-col":""),children:o.chargeType===Wn.scalar("ChargeType","USAGE")||o.trial?"-":o.kind===Wn.scalar("QuoteChangeKind","DISCOUNT")?`-${l} ${r}`:`${u} ${r}`})},Ys=n=>{switch(n){case"TIERED":return"units in each tier are priced separately";case"VOLUME":return"the highest tier reached prices all units";case"BANDS":return"the quantity indexes to a flat price";case"FLAT":return"the price is a flat rate";default:return""}},Ws=n=>{switch(n){case"TIERED":return"Tiered";case"VOLUME":return"Volume";case"BANDS":return"Bands";case"FLAT":return"Flat";default:return""}},Xs=(n,e=2)=>(e&&e>20&&(e=20),null!=n&&n.toFixed?(isNaN(e)&&(e=2),parseFloat(n.toFixed(e)).toLocaleString(navigator.language,{minimumFractionDigits:e,maximumFractionDigits:e})):n),Js=c(i.Table)`
135
+ `;var Ws;!function(n){n.ONCE="once",n.MONTHLY="monthly",n.ANNUAL="annually",n.SEMI_ANNUAL="semi annually",n.QUARTERLY="quarterly"}(Ws||(Ws={}));var Xs=Ws;const Js=ne("\n fragment SubscriptionChargeTotal_SubscriptionChargeFragment on SubscriptionCharge {\n billingPeriod\n chargeType\n trial\n kind\n price\n periodPrice\n }\n ",[]),nl=({charge:e,currencyId:t})=>{var i,a;const o=Jn(Js,e),r=o.billingPeriod&&Xs[o.billingPeriod],s=H(),l=yt(null!==(i=o.price)&&void 0!==i?i:"NaN",t),u=yt(null!==(a=o.periodPrice)&&void 0!==a?a:"NaN",t);return n.jsx("div",{className:"bunny-flex bunny-gap-1 "+(s?"bunny-flex-col":""),children:o.chargeType===ne.scalar("ChargeType","USAGE")||o.trial?"-":o.kind===ne.scalar("QuoteChangeKind","DISCOUNT")?`-${l} ${r}`:`${u} ${r}`})},el=n=>{switch(n){case"TIERED":return"units in each tier are priced separately";case"VOLUME":return"the highest tier reached prices all units";case"BANDS":return"the quantity indexes to a flat price";case"FLAT":return"the price is a flat rate";default:return""}},tl=n=>{switch(n){case"TIERED":return"Tiered";case"VOLUME":return"Volume";case"BANDS":return"Bands";case"FLAT":return"Flat";default:return""}},il=(n,e=2)=>(e&&e>20&&(e=20),null!=n&&n.toFixed?(isNaN(e)&&(e=2),parseFloat(n.toFixed(e)).toLocaleString(navigator.language,{minimumFractionDigits:e,maximumFractionDigits:e})):n),al=p(i.Table)`
136
136
  .ant-table-cell {
137
137
  border-bottom: none !important;
138
138
  }
139
- `,nl=Wn("\n fragment TieredDisplayDropdown_SubscriptionChargeFragment on SubscriptionCharge {\n priceTiers {\n starts\n price\n }\n }\n ",[]),el=({pricingModel:e,charge:t,currencyId:a,priceDecimals:o,truncatedText:r})=>{const s=Yn(nl,t).priceTiers,l=1===(null==s?void 0:s.length),u=n.jsx("div",{className:"w-full "+(l?"":"underline cursor-pointer"),children:r});return l?u:n.jsx(i.Dropdown,{popupRender:()=>n.jsxs("div",{className:"rounded border border-solid border-slate-200 bg-white overflow-hidden",children:[n.jsxs("div",{className:"bunny-text-gray-400 bunny-p-2",children:[Ws(e)," pricing -"," ",Ys(e)]}),n.jsx(Js,{columns:[{dataIndex:"starts",title:"From # of units",align:"right",render:(e,t,i)=>{const a=null==s?void 0:s[i+1],o=t.starts,r=(null==a?void 0:a.starts)?a.starts-1:"+";return n.jsxs(n.Fragment,{children:[Xs(o,0),"number"==typeof r?" - ":"","number"==typeof r?Xs(r,0):"+"]})}},{dataIndex:"price",title:"Unit price",align:"right",render:e=>n.jsx(n.Fragment,{children:ct(e,a,o)})}],dataSource:null!=s?s:[],rowKey:"starts",pagination:!1,size:"small"})]}),children:u})},tl=Wn("\n fragment getApplicablePriceTier_SubscriptionChargeFragment on SubscriptionCharge {\n priceTiers {\n starts\n price\n }\n pricingModel\n quantity\n }\n ",[]),il=(n,e,t)=>{var i,a,o,r,s;const l=Yn(tl,n);if(!(null===(i=l.priceTiers)||void 0===i?void 0:i.length))return"";let u;if("TIERED"===l.pricingModel?u=l.priceTiers[0]:"VOLUME"===l.pricingModel||"BANDS"===l.pricingModel?(u=l.priceTiers.find((n,e)=>{var t,i,a,o;const r=null===(t=l.priceTiers)||void 0===t?void 0:t[e+1],s=n.starts,u=r?(null!==(i=r.starts)&&void 0!==i?i:0)-1:1/0;return(null!==(a=l.quantity)&&void 0!==a?a:0)>=(null!=s?s:0)&&(null!==(o=l.quantity)&&void 0!==o?o:0)<=u}),u=u||l.priceTiers[0]):u=l.priceTiers[0],!u)return"";const d=l.priceTiers.indexOf(u),c=u.starts,p=l.priceTiers[d+1],m=p?(null!==(a=p.starts)&&void 0!==a?a:0)-1:"∞";return(null===(o=null==l?void 0:l.priceTiers)||void 0===o?void 0:o.length)>1?`${c}-${m}: ${ct(null!==(r=u.price)&&void 0!==r?r:0,e,t)}`:`${ct(null!==(s=u.price)&&void 0!==s?s:0,e,t)}`},al=Wn("\n fragment SubscriptionChargeUnitPrice_SubscriptionChargeFragment on SubscriptionCharge {\n trial\n discountedPrice\n priceDecimals\n kind\n pricingModel\n priceTiers {\n starts\n price\n }\n ...TieredDisplayDropdown_SubscriptionChargeFragment\n ...getApplicablePriceTier_SubscriptionChargeFragment\n }\n ",[nl,tl]),ol=({charge:e,currencyId:t})=>{var i,a,o,r;const s=Yn(al,e),l=s.trial?"-":ct(null!==(i=s.discountedPrice)&&void 0!==i?i:"NaN",t,null!==(a=s.priceDecimals)&&void 0!==a?a:0),u="DISCOUNT"===(d=s.kind)||"FREE_PERIOD_DISCOUNT"===d;var d;return n.jsx(n.Fragment,{children:ss(s)?n.jsx(el,{pricingModel:s.pricingModel,charge:s,currencyId:t,priceDecimals:null!==(o=s.priceDecimals)&&void 0!==o?o:0,truncatedText:`${"PRICE_UPDATE"===s.kind?"new ":""}${il(s,t,null!==(r=s.priceDecimals)&&void 0!==r?r:0)}`}):u?`-${l}`:l})},{Text:rl}=i.Typography,sl=({children:e,className:t,gridColumn:i,right:a,style:o})=>n.jsx(rl,{className:`bunny-flex bunny-items-center bunny-text-sm bunny-whitespace-nowrap ${t}`,style:{gridColumn:i,textAlign:a?"right":"left",justifyContent:a?"flex-end":"flex-start",...o},children:e}),ll=Wn("\n query subscriptionChargeHistograms($id: ID!) {\n subscription(id: $id) {\n chargeReport {\n priceListChargeId\n histogram {\n ...FeatureUsageGraph_HistogramFragment\n }\n }\n }\n }\n ",[Rs]),ul=({subscriptionId:t,priceListChargeId:o,charge:r})=>{var s,l,u;const d=te(),{apiHost:c}=e.useContext(Jn),[p,m]=us(),{data:y,isLoading:g}=a.useQuery({queryKey:tn({subscriptionId:t,token:d}),queryFn:()=>(async({id:n,apiHost:e,token:t})=>await wn(ll,{apiHost:e,token:t},{id:n}))({id:t,apiHost:c,token:d}),enabled:m});if(!m||g)return n.jsx("div",{ref:p,children:n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:120,height:20}})});const b=null===(u=null===(l=null===(s=null==y?void 0:y.subscription)||void 0===s?void 0:s.chargeReport)||void 0===l?void 0:l.find(n=>n.priceListChargeId===o))||void 0===u?void 0:u.histogram;return b?n.jsx(Bs,{charge:r,featureUsage:b,useAreaChart:!0}):null},dl=Wn("\n fragment SubscriptionCardDesktopRow_SubscriptionChargeFragment on SubscriptionCharge {\n isRamp\n priceListChargeId\n trial\n startDate\n endDate\n kind\n chargeType\n quantity\n name\n isAmendment\n ...SubscriptionChargeTotal_SubscriptionChargeFragment\n ...SubscriptionChargeUnitPrice_SubscriptionChargeFragment\n ...FeatureUsageGraph_SubscriptionChargeFragment\n }\n ",[zs,al,_s]),cl=({charge:e,chargeIndex:t,charges:i,currencyId:a,subscriptionId:o})=>{var r,s;const l=Yn(dl,e),u=i.map(n=>Yn(dl,n)),{isRamp:d}=l,c=null==u?void 0:u[t-1],p=`${ta(l.startDate)} - ${ta(l.endDate)}`,m=d&&0===t,y=l.trial,g=l.kind===qs.DISCOUNT,b=(null==c?void 0:c.priceListChargeId)===l.priceListChargeId&&!g&&(!y||(null==c?void 0:c.trial))&&(y||!(null==c?void 0:c.trial));return n.jsxs("div",{className:"bunny-contents",children:[(m||!d)&&n.jsx(sl,{gridColumn:d?"1/-1":"1",children:n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-2 "+(g?"bunny-pl-0":""),children:n.jsx("div",{children:m||!d&&!b?l.name:""})})}),n.jsx(sl,{gridColumn:2,children:n.jsx("div",{children:p})}),n.jsx(sl,{right:!0,children:l.kind===qs.DISCOUNT?"":l.chargeType===Ds.USAGE?l.priceListChargeId&&n.jsx(ul,{subscriptionId:o,priceListChargeId:l.priceListChargeId,charge:l}):l.isAmendment?`+${null===(r=l.quantity)||void 0===r?void 0:r.toLocaleString()}`:null===(s=l.quantity)||void 0===s?void 0:s.toLocaleString()}),n.jsx(sl,{right:!0,children:n.jsx(ol,{charge:l,currencyId:a})}),n.jsx(sl,{right:!0,children:n.jsx(Gs,{charge:l,currencyId:a})})]})},pl=Wn("\n fragment SubscriptionCardDesktop_SubscriptionFragment on Subscription {\n id\n currencyId\n chargeReport {\n ...sortSubscriptionCharges_SubscriptionChargeFragment\n ...filterSubscriptionCharges_SubscriptionChargeFragment\n ...SubscriptionCardDesktopRow_SubscriptionChargeFragment\n }\n ...SubscriptionCardHeader_SubscriptionFragment\n }\n ",[xs,Ss,ws,dl]),ml=[{title:"Charge",width:"minmax(min-content, 26%)"},{title:"Period",width:"minmax(min-content, 20%)"},{className:"text-right",title:"Quantity",width:"minmax(min-content, 18%)"},{className:"text-right",title:"Unit price",width:"minmax(min-content, 18%)"},{className:"text-right",title:"Total",width:"minmax(min-content, 18%)"}],yl=[{title:"Charge",width:"minmax(min-content, 21.6%)"},{title:"Period",width:"minmax(min-content, 21.1%)"},{className:"text-right",title:"Quantity",width:"minmax(min-content, 19.1%)"},{className:"text-right",title:"Unit price",width:"minmax(min-content, 19.1%)"},{className:"text-right",title:"Total",width:"minmax(min-content, 19.1%)"}],gl=({subscription:e,isAddon:t})=>{var a;const o=Yn(pl,e),{shadow:r}=Gr(),s=t?yl:ml,l=Ls(js(null!==(a=null==o?void 0:o.chargeReport)&&void 0!==a?a:[]));return n.jsxs(as,{className:"bunny-p-4 "+(r?`shadow-${r}`:""),children:[n.jsx(Cs,{subscription:o}),n.jsx(i.Divider,{className:"bunny-my-4",style:{gridColumn:"1 / 5",width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid bunny-w-full",style:{gridTemplateColumns:s.map(n=>n.width).join(" "),rowGap:"0.75rem"},children:[n.jsx(ks,{columns:s}),l.map((e,t)=>n.jsx(cl,{charge:e,chargeIndex:t,charges:l,currencyId:o.currencyId,subscriptionId:o.id},t))]})]})},bl=Wn("\n fragment AddonSubscriptionsCards_SubscriptionFragment on Subscription {\n id\n state\n ...SubscriptionCardDesktop_SubscriptionFragment\n ...findAddonSubscriptions_SubscriptionFragment\n }\n ",[pl,ts]);function hl({subscriptions:e,subscription:t,showInactive:i}){const a=Yn(bl,t),o=e.map(n=>Yn(bl,n)),r=function(n,e){var t;const i=null===(t=Yn(ts,n).addonSubscriptions)||void 0===t?void 0:t.map(n=>n.id);return e.filter(n=>{var e;const t=Yn(ts,n);return null!==(e=null==i?void 0:i.includes(t.id))&&void 0!==e&&e})}(a,o);return 0===r.length?null:n.jsx(n.Fragment,{children:r.map((e,t)=>{if(!i&&os(e.state))return null;const a=t===r.length-1;return n.jsxs("div",{className:"bunny-flex bunny-flex-row",children:[n.jsx(is,{isLast:a,indentation:64,verticalMargin:"-1rem"}),n.jsx("div",{className:"bunny-flex-1",children:n.jsx(gl,{subscription:e,isAddon:!0})})]},t)})})}const{Text:vl}=i.Typography,fl=({children:e,className:t,style:i})=>n.jsx(vl,{className:t,style:i,children:e}),xl=Wn("\n fragment SubscriptionCardMobile_SubscriptionFragment on Subscription {\n id\n currencyId\n chargeReport {\n ...sortSubscriptionCharges_SubscriptionChargeFragment\n ...filterSubscriptionCharges_SubscriptionChargeFragment\n ...SubscriptionChargeUnitPrice_SubscriptionChargeFragment\n ...SubscriptionChargeTotal_SubscriptionChargeFragment\n isRamp\n name\n kind\n startDate\n endDate\n quantity\n }\n ...SubscriptionCardHeader_SubscriptionFragment\n }\n ",[Ss,ws,al,xs,zs]),Cl=[{title:"CHARGE"},{className:"text-right",title:"QUANTITY"},{className:"text-right",title:"UNIT PRICE"},{className:"text-right",title:"TOTAL"}],wl=({subscription:t})=>{var a;const o=Yn(xl,t),{darkMode:r}=e.useContext(Jn),{shadow:s}=Gr(),l=r?"var(--row-background-dark)":"var(--row-background)",u=Ls(js(null!==(a=null==o?void 0:o.chargeReport)&&void 0!==a?a:[]));return n.jsxs(as,{className:"bunny-flex bunny-flex-col bunny-p-4 "+(s?`shadow-${s}`:""),children:[n.jsx(Cs,{subscription:o}),n.jsx(i.Divider,{className:"bunny-my-4",style:{gridColumn:"1 / -1",width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid",style:{columnGap:"0.5rem",gridTemplateColumns:"1fr auto auto auto",rowGap:"0.75rem",backgroundColor:l},children:[Cl.map((e,t)=>n.jsx(fl,{className:`bunny-text-slate-400 ${e.className}`,style:{fontSize:"11px"},children:e.title},t)),u.map((e,t)=>{const{isRamp:i}=e,a=`${ta(e.startDate)} - ${ta(e.endDate)}`;return n.jsxs("div",{className:"bunny-contents",children:[(i&&0===t||!i)&&n.jsxs(fl,{className:Cl[0].className,style:{gridColumn:i?"1/-1":"1"},children:[n.jsx("span",{children:e.name}),i?"":` - ${a}`]}),i&&n.jsx(fl,{className:Cl[0].className,children:`- ${a}`}),n.jsx(fl,{className:Cl[1].className,children:e.kind===qs.DISCOUNT?"":e.quantity}),n.jsx(fl,{className:Cl[2].className,children:n.jsx(ol,{charge:e,currencyId:o.currencyId})}),n.jsx(fl,{className:Cl[3].className,children:n.jsx(Gs,{charge:e,currencyId:o.currencyId})})]},t)})]})]})},jl=Wn("\n fragment SubscriptionsList_SubscriptionFragment on Subscription {\n id\n state\n ...splitSubscriptionsByPriceList_SubscriptionFragment\n ...findNonAddonSubscriptions_SubscriptionFragment\n ...SubscriptionCardDesktop_SubscriptionFragment\n ...SubscriptionCardMobile_SubscriptionFragment\n ...AddonSubscriptionsCards_SubscriptionFragment\n }\n ",[ls,ns,pl,xl,bl]),Sl=({showInactive:e,subscriptions:t})=>{const{gap:i}=Gr(),a=function(n){const e=[];return n.forEach(n=>{var t;const i=Yn(ls,n);if(!i.chargeReport)return void e.push(n);const a=new Map;if(i.chargeReport.forEach(n=>{var e;const t=null===(e=n.priceList)||void 0===e?void 0:e.id;t&&(a.has(t)||a.set(t,[]),a.get(t).push(n))}),a.size>1&&i.chargeReport.some(n=>"RENEW"===n.kind)){const o=null===(t=i.chargeReport.reduce((n,e)=>{if(!n)return e;const t=e.endDate,i=n.endDate,a=e.startDate,o=n.startDate;return t>i||t===i&&a>o?e:n},i.chargeReport[0]).priceList)||void 0===t?void 0:t.id;if(!o)return void e.push(n);const r=[];a.forEach((e,t)=>{var a,s,l,u,d,c;const p=null==e?void 0:e[0];if(!p||!e)return;const m=e.reduce((n,e)=>{const t=e.endDate;return n?t>n?t:n:t},e[0].endDate),y=e.reduce((n,e)=>{const t=e.startDate;return n?t<n?t:n:t},e[0].startDate),g=(new Date).toISOString().split("T")[0];let b=i.state;m<g?b=Wn.scalar("SubscriptionState","EXPIRED"):y>g?b=Wn.scalar("SubscriptionState","PENDING"):y<=g&&m>=g&&(b=Wn.scalar("SubscriptionState","ACTIVE"));const h=t===o,v=null===(a=p.priceList)||void 0===a?void 0:a.plan,f=null!==(l=null===(s=null==v?void 0:v.addonPlans)||void 0===s?void 0:s.map(n=>n.id))&&void 0!==l?l:[],x=null===(u=i.addonSubscriptions)||void 0===u?void 0:u.filter(n=>{var e;if(!(null==v?void 0:v.addonPlans)||0===v.addonPlans.length)return!0;const t=null===(e=n.plan)||void 0===e?void 0:e.id;if(!t||!f.includes(t))return!1;const i=n.startDate,a=n.endDate;return i<=m&&a>=y});r.push({...n,priceList:p.priceList,plan:p.priceList.plan,product:p.priceList.product,endDate:m,startDate:y,state:b,evergreen:!!h&&i.evergreen,chargeReport:e,charges:null!==(c=null===(d=i.charges)||void 0===d?void 0:d.filter(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===t}))&&void 0!==c?c:[],addonSubscriptions:x})}),r.sort((n,e)=>{const t=Yn(ls,n),i=Yn(ls,e),a=t.endDate,o=i.endDate,r=t.startDate,s=i.startDate;return a<o?-1:a>o?1:r<s?-1:r>s?1:0}),e.push(...r)}else e.push(n)}),e}(t.map(n=>Yn(jl,n))),o=q(),r=es(a);return n.jsx(n.Fragment,{children:null==r?void 0:r.map((t,r)=>!e&&os(t.state)?null:o?n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-${i}`,children:[n.jsx(wl,{subscription:t}),n.jsx(hl,{subscription:t,subscriptions:a,showInactive:e})]},r):n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-${i}`,children:[n.jsx(gl,{subscription:t}),n.jsx(hl,{subscription:t,subscriptions:a,showInactive:e})]},r))})},Il=Wn("\n fragment SubscriptionsListContainer_SubscriptionFragment on Subscription {\n ...SubscriptionsList_SubscriptionFragment\n }\n ",[jl]),Ll=({companyName:e,showInactive:t=!1,noSubscriptionsComponent:i,subscriptions:a,subscriptionsAreLoading:o})=>{const{gap:r}=Gr(),s=a.map(n=>Yn(Il,n));return o?n.jsx(n.Fragment,{}):n.jsx(n.Fragment,{children:(null==s?void 0:s.length)>0?n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-${r} bunny-shrink`,children:n.jsx(Sl,{showInactive:t,subscriptions:s})}):i||n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-w-full",children:n.jsx(Xr,{message:`You have no subscriptions with ${e} yet`})})})},{Text:Pl}=i.Typography,kl=({description:e,onClose:i,title:a,closeButtonClassName:o})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between bunny-gap-2",children:[n.jsx(Pl,{className:"bunny-text-xl bunny-font-normal",children:a}),i?n.jsx("button",{id:"closePayment",onClick:i,className:o,children:n.jsx(t.CloseOutlined,{})}):null]}),e&&n.jsx("div",{className:"bunny-text-sm bunny-font-medium",children:e})]}),[Nl,Fl]=Te(n=>e.useState(n)),Dl=n=>{const e=te(),{data:t}=a.useQuery({queryKey:V({id:n,objectName:"editingQuote",token:e}),queryFn:()=>{},enabled:!1,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return t},Tl=()=>{const n=te(),e=a.useQueryClient();return{setQuoteQueryData:(t,i)=>{e.setQueryData(V({id:t,objectName:"editingQuote",token:n}),i)}}},ql=n=>`\nquery account {\n account(id: ${n}) {\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n }\n}`,Al=Wn("\n fragment QuoteFields_QuoteFragment on Quote @_unmask {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n startDate\n formattedQuote {\n html\n }\n amountsByPeriod {\n amount\n startDate\n }\n kind\n quoteChanges {\n currencyId\n id\n kind\n charges {\n subtotal\n amountsByPeriod {\n amount\n startDate\n }\n amount\n billingPeriod\n currencyId\n feature {\n unitName\n }\n id\n name\n priceListCharge {\n id\n }\n priceList {\n id\n }\n coupon {\n couponCode\n }\n quantity\n kind\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n }\n }\n "),[Ml,Hl]=yn(),Ql=["US","CA"],El=({account:t,accountId:o})=>{const r=a.useQueryClient(),{apiHost:s}=e.useContext(Jn),l=te(),[u]=i.Form.useForm(),{mutate:d,isPending:c}=a.useMutation({mutationFn:async n=>{const e=await(async({accountId:n,attributes:e,token:t,apiHost:i})=>{var a;const o={id:n,attributes:e},r=await cn({query:"\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account {\n id\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n name\n }\n errors\n }\n }\n",token:t,vars:o,apiHost:i}),s=null===(a=null==r?void 0:r.accountUpdate)||void 0===a?void 0:a.errors;if(s)throw s;return r.accountUpdate})({accountId:o,attributes:n,token:l,apiHost:s});return e},onSuccess:()=>{r.invalidateQueries({queryKey:["getTaxationRequiredAccountFields",l]})}});return n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-4",form:u,initialValues:t,layout:"vertical",onFinish:d,children:[n.jsx(i.Form.Item,{label:"Billing street",name:"billingStreet",children:n.jsx(i.Input,{placeholder:"Street"})}),n.jsx(i.Form.Item,{label:"Billing city",name:"billingCity",children:n.jsx(i.Input,{placeholder:"City"})}),n.jsx($l,{}),n.jsx(i.Form.Item,{label:"Billing country",name:"billingCountry",rules:[{required:!0}],children:n.jsx(i.Select,{options:D,placeholder:"Select a country",showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})}),n.jsx(i.Form.Item,{label:"Billing zip",name:"billingZip",children:n.jsx(i.Input,{placeholder:"Zip"})}),n.jsx(i.Form.Item,{children:n.jsx(i.Button,{className:"bunny-w-full",disabled:c,htmlType:"submit",type:"primary",children:"Submit"})})]})},$l=()=>{const e=i.Form.useWatch("billingCountry"),t=Ql.includes(e);return n.jsx(i.Form.Item,{label:"Billing state",name:"billingState",rules:[{required:t}],children:n.jsx(i.Input,{placeholder:"State"})})},{Text:_l}=i.Typography;function Rl(){return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-px-4 bunny-items-center",children:[n.jsx(i.Spin,{indicator:n.jsx(t.LoadingOutlined,{spin:!0}),size:"small"}),n.jsx(_l,{children:"Finalizing quote..."})]})}const{Text:Bl}=i.Typography,Ul=Wn("\n fragment QuoteCheckout_QuoteFragment on Quote {\n id\n accountId\n amountDue\n amount\n quoteChanges {\n id\n charges {\n kind\n coupon {\n couponCode\n }\n }\n }\n ...QuoteFields_QuoteFragment\n ...canApplyCoupons_QuoteFragment\n ...PaymentForm_QuoteFragment\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[Al,Oa,ci,nt]),Vl=Wn("\n fragment QuoteCheckout_SubscriptionFragment on Subscription {\n id\n ...canApplyCoupons_SubscriptionFragment\n }\n ",[Za]),Ol=H(),Zl=({account:t,onSuccess:o,onFail:r,quote:s,taxationRequiredAccountFields:l,isUpdatingQuote:u,onRecalculateTaxes:d,isRecalculatingTaxes:c})=>{var p,m,y,g,b;const h=Hl(),{apiHost:v}=e.useContext(Jn),f=te(),x=Yn(Ul,s),C=Yn(Vl,h),w=Ur(),j=Rr(),S=q(),I=et(x)>0,L=a.useQueryClient(),{addCoupon:P,removeCoupon:k,isAddingCoupon:N,isRemovingCoupon:F,activeCouponsExist:D}=wo({apiHost:v,token:f,quoteChangeId:null!==(g=null===(y=null===(p=null==x?void 0:x.quoteChanges)||void 0===p?void 0:p[(null===(m=null==x?void 0:x.quoteChanges)||void 0===m?void 0:m.length)-1])||void 0===y?void 0:y.id)&&void 0!==g?g:void 0,onCouponAdded:()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");L.invalidateQueries({queryKey:V({id:null==x?void 0:x.id,objectName:"editingQuote",token:f})}),Ol("Coupon applied"),d(),H("")},onCouponRemoved:()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");L.invalidateQueries({queryKey:V({id:null==x?void 0:x.id,objectName:"editingQuote",token:f})}),Ol("Coupon removed"),d()}}),[T,A]=e.useState(!1),[M,H]=e.useState(""),Q=null===(b=null==x?void 0:x.quoteChanges)||void 0===b?void 0:b.flatMap(n=>{var e;return null===(e=null==n?void 0:n.charges)||void 0===e?void 0:e.filter(n=>"COUPON"===n.kind)}),$=u||c,_=a.useMutation({mutationFn:async()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");if(I)throw new Error("Payment is required");return await We({quoteId:x.id,token:f,apiHost:v})},onSuccess:o,onError:n=>{console.log("error",n),L.invalidateQueries({queryKey:E({})}),r(n)}});return e.useEffect(()=>{L.refetchQueries({queryKey:V({objectName:"editingQuote",id:null==x?void 0:x.id,token:f})})},[]),l?n.jsx(Kl,{setMaxHeight:!1,children:n.jsx(El,{account:t,accountId:x.accountId})}):n.jsx(Kl,{setMaxHeight:!1,children:I?n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full",children:[n.jsx(vi,{onPaymentSuccess:o,quote:x,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id),disablePayButton:$}),$&&n.jsx(Rl,{}),0===(null==Q?void 0:Q.length)?n.jsx(n.Fragment,{children:C&&Ka(x,D,C)&&n.jsx(jo,{className:"bunny-pt-1",onAddCoupon:P,isAddingCoupon:N,couponCode:M,setCouponCode:H})}):n.jsx(i.Button,{type:"link",loading:F,onClick:()=>{null==Q||Q.forEach(n=>{var e;const t=null===(e=null==n?void 0:n.coupon)||void 0===e?void 0:e.couponCode;t&&k(t)})},children:"Remove coupon(s)"})]}):n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4 "+(S?"bunny-shadow-padding-x":""),children:[n.jsx(i.Button,{onClick:async function(){A(!0),_.mutate(),A(!1)},type:"primary",disabled:$,loading:T||$,children:T?"Processing...":"Complete order"}),n.jsx(Bl,{className:"bunny-text-xs bunny-text-slate-500",children:"No payment is required"})]})})},Kl=({children:e,setMaxHeight:t,className:i})=>{const a=q();return n.jsx("div",{className:`bunny-flex bunny-w-full bunny-flex-col bunny-gap-6 ${a?"bunny-shadow-padding-xb":""} ${i}`,style:{...a?t?{maxHeight:"60vh"}:{}:{width:"100%",maxWidth:"400px"}},children:e})},zl=Wn("\n fragment Checkout_QuoteFragment on Quote {\n id\n accountId\n formattedQuote {\n html\n }\n ...QuoteCheckout_QuoteFragment\n }\n ",[Ul]),Gl=({onCancel:o,onSuccess:r,onFail:s,onRecalculateTaxes:l,invoice:u,open:d,quote:c,isUpdatingQuote:p,isRecalculatingTaxes:m})=>{var y,g,b,h,v;const{apiHost:f}=e.useContext(Jn),x=q(),C=te(),w=Ur(),j=Rr(),S=Yn(zl,c),I=vo({apiHost:f,token:C}),{data:L,isLoading:P}=a.useQuery({queryKey:["getTaxationRequiredAccountFields",C],queryFn:()=>(async({apiHost:n,token:e})=>{var t,i;const a=await cn({query:"{\n currentUser {\n taxationRequiredAccountFields\n }\n}",token:e,apiHost:n});return(null===(i=null===(t=null==a?void 0:a.currentUser)||void 0===t?void 0:t.taxationRequiredAccountFields)||void 0===i?void 0:i.length)>0?a.currentUser.taxationRequiredAccountFields:null})({apiHost:f,token:C}),enabled:Boolean(S),staleTime:0}),{data:k,isLoading:N}=a.useQuery({queryKey:["account",null==S?void 0:S.accountId],queryFn:()=>(null==S?void 0:S.accountId)&&(async({id:n,apiHost:e,token:t})=>{const i=await cn({query:ql(n),token:t,apiHost:e});return null==i?void 0:i.account})({id:S.accountId,apiHost:f,token:C}),enabled:Boolean(null==S?void 0:S.accountId)&&((null==L?void 0:L.length)||0)>0});async function F(){if(S){if(!S.id)throw new Error("Quote ID is required");l(S.id)}return{}}const D=Boolean(S)&&d&&I&&!L&&!P&&!p;return a.useQuery({queryKey:K({id:null!==(y=null==S?void 0:S.id)&&void 0!==y?y:void 0,token:C}),queryFn:F,enabled:D,staleTime:0}),!d||P||N?null:n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50\n bunny-overflow-auto bunny-height-full",style:{zIndex:1001},children:n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${x?"bunny-pb-4":"bunny-pb-8"} bunny-content-container`,children:[n.jsx("div",{className:"bunny-flex bunny-justify-end bunny-w-full bunny-pr-4",children:n.jsx(t.CloseOutlined,{className:"bunny-text-base bunny-shadow-padding-xb",onClick:o})}),n.jsxs("div",{className:"bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 "+(x?"bunny-flex-col":"bunny-shadow-padding-xb"),children:[((null==u?void 0:u.html)||(null===(g=null==S?void 0:S.formattedQuote)||void 0===g?void 0:g.html))&&n.jsx(Fi,{html:u?u.html:null!==(h=null===(b=null==S?void 0:S.formattedQuote)||void 0===b?void 0:b.html)&&void 0!==h?h:""}),!x&&((null==u?void 0:u.html)||(null===(v=null==S?void 0:S.formattedQuote)||void 0===v?void 0:v.html))&&n.jsx(i.Divider,{className:"bunny-h-full",type:"vertical"}),u?n.jsx("div",{className:"bunny-w-full bunny-pt-12",children:n.jsx(vi,{onPaymentSuccess:r,invoice:u,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id)})}):S?n.jsx(Zl,{account:k,onFail:n=>{s(n)},onSuccess:r,quote:S,taxationRequiredAccountFields:L,token:C,onRecalculateTaxes:async()=>{D&&await F()},isUpdatingQuote:p,isRecalculatingTaxes:m}):n.jsx(vi,{onPaymentSuccess:r,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id)})]}),n.jsx(yo,{className:"bunny-px-12"})]})})},Yl=Wn("\n fragment QuantityInput_QuoteFragment on Quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n charges {\n id\n priceListCharge {\n id\n }\n }\n subscription {\n charges {\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n ",[]),[Wl,Xl]=Te(n=>e.useState(null!=n&&n)),Jl=Wn("\n fragment QuoteChangeSummarySection_QuoteFragment on Quote {\n id\n currencyId\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[nt]),nu=({openCheckout:e,errorUpdatingQuantity:t})=>{const a=q(),[o]=Fl(),[r]=Xl(),s=Dl(o),l=Yn(Jl,s),u=!o||!l||t||r;return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-end",children:[l&&!u&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-mb-8",children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-text-right bunny-text-xs bunny-mb-2",children:"TOTAL"}),n.jsx("div",{className:"bunny-text-right "+(a?"bunny-text-2xl":"bunny-text-xl"),children:ct(et(l),(null==l?void 0:l.currencyId)||"")})]}),n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-end "+(a?"bunny-w-full":""),children:n.jsx(i.Button,{className:"bunny-w-full",onClick:e,disabled:u,size:a?"large":"middle",type:"primary",loading:r,children:"Proceed to checkout"})})]})},eu=Wn("\n fragment QuantityDrawer_QuoteFragment on Quote {\n id\n ...Checkout_QuoteFragment\n ...QuantityInput_QuoteFragment\n ...QuoteChangeSummarySection_QuoteFragment\n }\n ",[zl,Yl,Jl]),tu=Wn("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuantityDrawer_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[eu]),iu=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;return null===(l=(await wn(tu,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o})).quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},au=Wn("\n mutation QuoteChargeUpdate($quoteChargeId: ID!, $quantity: Int) {\n quoteChargeUpdate(quoteChargeId: $quoteChargeId, quantity: $quantity) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuantityDrawer_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[eu]),ou=Wn("\n mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n quote {\n id\n }\n }\n }\n ",[]),ru=async({id:n,token:e,apiHost:t})=>(await wn(ou,{apiHost:t,token:e},{id:n})).quoteDelete,su=Wn("\n mutation quoteSubscriptionUpdate($subscriptionIds: [ID!]!) {\n quoteSubscriptionUpdate(subscriptionIds: $subscriptionIds) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n ...QuantityDrawer_QuoteFragment\n }\n errors\n }\n }\n ",[eu]),lu=Wn("\n fragment CanShowQuantitiesInput_SubscriptionChargeFragment on SubscriptionCharge {\n id\n pricingModel\n expired\n selfServiceQuantity\n kind\n chargeType\n }\n"),uu=Wn("\n fragment CanShowQuantitiesInput_SubscriptionFragment on Subscription {\n id\n state\n priceList {\n id\n }\n currentCharges {\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n }\n ",[lu]),du=(n,e)=>`${n}-${e}`,cu=({charge:n,subscription:e})=>{const t=Yn(uu,e),i=Yn(lu,n),a="ACTIVE"===(null==t?void 0:t.state),o="PENDING"===(null==t?void 0:t.state),r="TRIAL"===(null==t?void 0:t.state),s="FLAT"===(null==i?void 0:i.pricingModel),l="USAGE"===(null==i?void 0:i.chargeType),u="ONE_TIME"===(null==i?void 0:i.chargeType),d="DISCOUNT"===(null==i?void 0:i.kind)||"FREE_PERIOD_DISCOUNT"===(null==i?void 0:i.kind);return(a||o)&&!d&&!r&&!s&&!l&&!u&&(null==i?void 0:i.selfServiceQuantity)&&!(null==i?void 0:i.expired)},pu=({quoteIsPending:n})=>{const[,t]=Xl(),i=e.useRef(n);return e.useEffect(()=>{i.current!==n&&(t(n),i.current=n)},[n,t]),null},mu=Wn("\n fragment QuantityInput_SubscriptionChargeFragment on SubscriptionCharge {\n id\n quantity\n selfServiceQuantity\n priceListChargeId\n }\n"),yu=Wn("\n fragment QuantityInput_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n chargeReport {\n ...QuantityInput_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ...CanShowQuantitiesInput_SubscriptionFragment\n }\n ",[mu,lu,uu]),gu=({charge:t,subscription:o,setUpdatingChargeQuantityId:r,updatingChargeQuantityId:s,setErrorUpdatingQuantity:u})=>{const d=te(),{apiHost:c}=e.useContext(Jn),[p,m]=Fl(),y=Dl(p),[g,b]=e.useState(),h=Yn(mu,t),v=Yn(yu,o),f=Yn(Yl,y),x=M(),{setQuoteQueryData:C}=Tl(),w=s&&h.priceListChargeId&&v.id&&s!==du(h.priceListChargeId,v.id)||!h.selfServiceQuantity,j=void 0===g?"":g,{mutate:S,isPending:I}=a.useMutation({mutationFn:iu,onSuccess:n=>{var e,t;if(!p)throw new Error("quoteId is required");(null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote)&&C(p,null===(t=null==n?void 0:n.quoteChange)||void 0===t?void 0:t.quote),u(!1)},onError:()=>{u(!0)}}),{mutate:L,isPending:P}=a.useMutation({mutationFn:ru,onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quote)||void 0===e?void 0:e.id;t?(C(t,null),m(void 0)):x("quoteId is required")},onError:()=>{u(!0)}}),{mutate:k,isPending:N}=a.useMutation({mutationFn:n=>(async(n,e,t)=>{var i;return null===(i=(await wn(su,{apiHost:e,token:t},{subscriptionIds:n})).quoteSubscriptionUpdate)||void 0===i?void 0:i.quote})([n],c,d),onSuccess:n=>{var e,t,i,a;if(!(null==n?void 0:n.id))throw new Error("quote id is required");m(null==n?void 0:n.id),C(null==n?void 0:n.id,n);const o=null===(e=null==n?void 0:n.quoteChanges)||void 0===e?void 0:e.find(n=>{var e,t;return(null===(e=null==n?void 0:n.priceList)||void 0===e?void 0:e.id)===(null===(t=v.priceList)||void 0===t?void 0:t.id)}),r=null===(i=null===(t=null==o?void 0:o.subscription)||void 0===t?void 0:t.charges)||void 0===i?void 0:i.find(n=>{var e;return(null===(e=null==n?void 0:n.priceListCharge)||void 0===e?void 0:e.id)===h.priceListChargeId});if(!(null==o?void 0:o.id))throw new Error("quoteChange id is required");if(!(null==r?void 0:r.id))throw new Error("subscriptionCharge id is required");var s;u(!1),S({apiHost:c,quantity:g,quoteChangeId:null==o?void 0:o.id,startDate:(s=st(),"string"==typeof s&&(s=st(s)),s.format("YYYY-MM-DD")),priceListChargeId:null===(a=r.priceListCharge)||void 0===a?void 0:a.id,token:d})},onError:()=>{u(!0)}}),{mutate:F,isPending:D}=a.useMutation({mutationFn:({quoteChargeId:n,quantity:e})=>{if(!n)throw new Error("quoteChargeId is required");return(async(n,e,t,i)=>{var a;return null===(a=(await wn(au,{apiHost:t,token:i},{quoteChargeId:n,quantity:e})).quoteChargeUpdate)||void 0===a?void 0:a.quoteCharge})(n,e,c,d)},onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!p)throw new Error("quoteId is required");t&&C(p,t),u(!1)},onError:()=>{u(!0)}}),T=e.useCallback(l.debounce(n=>{L({id:n,apiHost:c,token:d})},1e3),[]),q=e.useCallback(l.debounce((n,e,t,i,a,o)=>{var r;if(e===t)return u(!0),void x("New quantity cannot be the same as current");if(void 0===o)k(i);else{const t=null===(r=null==a?void 0:a.quoteChanges)||void 0===r?void 0:r.find(n=>{var e,t;return(null===(e=null==n?void 0:n.priceList)||void 0===e?void 0:e.id)===(null===(t=v.priceList)||void 0===t?void 0:t.id)}),i=null==t?void 0:t.charges.find(e=>{var t;return(null===(t=null==e?void 0:e.priceListCharge)||void 0===t?void 0:t.id)===n});i&&F({quoteChargeId:i.id,quantity:e})}},1e3),[]);return n.jsxs(n.Fragment,{children:[n.jsx(i.Input,{className:"bunny-text-right",disabled:w,onChange:n=>{(n=>{var e;q.cancel(),T.cancel();const t=""===n?void 0:isNaN(parseInt(n))?0:parseInt(n);if(b(t),void 0===t)r(void 0),p&&T(p);else{if(!(null==h?void 0:h.priceListChargeId))return void x("Charge ID is not found");r(du(h.priceListChargeId,v.id));const n=null!==(e=h.quantity)&&void 0!==e?e:0;q(h.priceListChargeId,t,n,v.id,f,p)}})(n.target.value)},style:{width:"96px"},value:j}),n.jsx(pu,{quoteIsPending:I||P||N||D})]})},bu=Wn("\n fragment QuantityChangeGridRow_SubscriptionChargeFragment on SubscriptionCharge {\n id\n quantity\n name\n ...QuantityInput_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ",[mu,lu]),hu=Wn("\n fragment QuantityChangeGridRow_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n plan {\n name\n }\n chargeReport {\n ...QuantityChangeGridRow_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ...QuantityInput_SubscriptionFragment\n ...CanShowQuantitiesInput_SubscriptionFragment\n }\n ",[bu,lu,uu,yu]),{Text:vu}=i.Typography,fu=({subscription:e,subscriptionCharge:t,setUpdatingChargeQuantityId:a,updatingChargeQuantityId:o,setErrorUpdatingQuantity:r})=>{var s,l;const u=Yn(hu,e),d=Yn(bu,t);if(!cu({charge:d,subscription:u}))return null;const{brandColor:c}=bn();return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1",children:[n.jsx(vu,{className:"bunny-font-medium bunny-text-sm bunny-col-span-full",style:{color:c},children:null===(s=null==u?void 0:u.plan)||void 0===s?void 0:s.name}),n.jsx(vu,{className:"bunny-text-sm",children:null===(l=d.name)||void 0===l?void 0:l.toUpperCase()})]}),n.jsx(vu,{className:"bunny-flex bunny-items-center bunny-justify-end bunny-font-medium bunny-text-sm bunny-text-gray-900",children:d.quantity}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-justify-center bunny-items-end",children:[n.jsx(gu,{charge:d,subscription:u,setUpdatingChargeQuantityId:a,updatingChargeQuantityId:o,setErrorUpdatingQuantity:r}),n.jsx("div",{})]}),n.jsx(i.Divider,{className:"bunny-col-span-full bunny-my-2"})]})},{Text:xu}=i.Typography,Cu=({children:e,right:t})=>n.jsx(xu,{className:"bunny-font-medium bunny-text-sm bunny-text-slate-600 "+(t?"bunny-text-right":"bunny-text-left"),children:e}),wu=Wn("\n fragment QuantityDrawerDesktop_SubscriptionFragment on Subscription {\n currentCharges {\n chargeType\n ...QuantityChangeGridRow_SubscriptionChargeFragment\n }\n ...QuantityChangeGridRow_SubscriptionFragment\n }\n ",[hu,bu]),ju=({onClose:t,open:a,openCheckout:o,subscriptions:r,setUpdatingChargeQuantityId:s,updatingChargeQuantityId:l})=>{const[u,d]=e.useState(a),[c,p]=e.useState(!1),m=q();return e.useEffect(()=>{let n;return a?d(!0):n=setTimeout(()=>{d(!1)},300),()=>clearTimeout(n)},[a]),u?n.jsxs(i.Drawer,{closeIcon:null,destroyOnHidden:!0,onClose:t,open:a,styles:m?{body:{padding:"1rem",background:v},wrapper:{width:"100vw"}}:{wrapper:{minWidth:"600px"}},title:n.jsx(kl,{description:"Adjust quantities below. The change will take effect immediately after checkout has been completed.",onClose:t,title:"Update quantities",closeButtonClassName:"ant-drawer-close"}),children:[n.jsxs("div",{className:"bunny-grid bunny-pb-2",style:{gridTemplateColumns:"3fr 3fr 2fr",rowGap:"0.25rem",columnGap:"1rem"},children:[n.jsx(Cu,{children:" "}),n.jsx(Cu,{right:!0,children:"CURRENT QUANTITY"}),n.jsx(Cu,{right:!0,children:"NEW QUANTITY"}),n.jsx(i.Divider,{className:"bunny-col-span-full",style:{marginBottom:"8px",marginTop:"20px"}}),r.map((e,t)=>{var i;const a=Yn(wu,e);return n.jsx("div",{className:"bunny-contents",children:null===(i=null==a?void 0:a.currentCharges)||void 0===i?void 0:i.map((e,t)=>"USAGE"===e.chargeType?null:n.jsx(fu,{subscription:a,subscriptionCharge:e,setUpdatingChargeQuantityId:s,updatingChargeQuantityId:l,setErrorUpdatingQuantity:p},t))},t)})]}),n.jsx(nu,{openCheckout:o,errorUpdatingQuantity:c})]}):null},Su=Wn("\n fragment Subscriptions_SubscriptionFragment on Subscription {\n state\n id\n ...SubscriptionsListContainer_SubscriptionFragment\n ...CanShowQuantitiesInput_SubscriptionFragment\n ...QuantityDrawerDesktop_SubscriptionFragment\n }\n ",[Il,uu,wu]);function Iu(n,e){n.invalidateQueries({queryKey:z({pluralType:"subscriptions",token:e})}),n.invalidateQueries({queryKey:z({pluralType:"upgradeSubscriptions",token:e})}),n.invalidateQueries({queryKey:z({pluralType:"hasActiveSubscriptions",token:e})})}const[Lu,Pu]=yn(),ku=Wn("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...QuantityDrawer_QuoteFragment\n id\n }\n errors\n }\n }\n ",[eu]),Nu=()=>{const n=te(),{apiHost:t}=e.useContext(Jn),{setQuoteQueryData:i}=Tl(),{mutate:o,isPending:r}=a.useMutation({mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await wn(ku,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:n=>{if(!(null==n?void 0:n.id))throw new Error("Quote ID is undefined");i(null==n?void 0:n.id,n)}});return{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}},Fu=({subscriptions:t,quantityDrawerOpen:i,setQuantityDrawerOpen:o,handlePortalErrors:r})=>{const s=te(),l=a.useQueryClient(),u=H(),[d,c]=Fl(),[p,m]=e.useState(!1),[y,g]=e.useState(void 0),b=Dl(d),{quoteRecalculateTaxesMutation:h,isRecalculatingTaxes:v}=Pu();return n.jsxs(n.Fragment,{children:[n.jsx(ju,{onClose:()=>{y&&(g(void 0),c(void 0)),o(!1)},open:i,openCheckout:()=>{m(!0)},subscriptions:t,setUpdatingChargeQuantityId:g,updatingChargeQuantityId:y}),n.jsx(Gl,{onCancel:()=>{m(!1)},onSuccess:()=>{o(!1),c(void 0),l.invalidateQueries({queryKey:J({token:s})}),Iu(l,s),u("Your plan has been updated","Payment successful"),m(!1),g(void 0)},onFail:n=>{null==r||r(n)},onRecalculateTaxes:h,open:p,quote:b,token:s,isUpdatingQuote:!1,isRecalculatingTaxes:v})]})},Du=({subscriptions:e,quantityDrawerOpen:t,setQuantityDrawerOpen:i,handlePortalErrors:a})=>{const{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}=Nu();return n.jsx(Nl,{children:n.jsx(Wl,{children:n.jsx(Lu,{value:{quoteRecalculateTaxesMutation:n=>o({quoteId:n}),isRecalculatingTaxes:r},children:n.jsx(Fu,{subscriptions:e,quantityDrawerOpen:t,setQuantityDrawerOpen:i,handlePortalErrors:a})})})})},Tu=Wn("\n query subscriptions {\n subscriptions {\n nodes {\n ...Subscriptions_SubscriptionFragment\n }\n }\n }\n ",[Su]),qu=({showInactive:e,setShowInactive:t})=>{const{secondaryColor:a}=bn();return n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-4",children:n.jsx(Au,{children:n.jsx(i.Checkbox,{checked:e,onChange:n=>t(n.target.checked),style:{color:a},children:"Show inactive"})})})},Au=c.div`
139
+ `,ol=ne("\n fragment TieredDisplayDropdown_SubscriptionChargeFragment on SubscriptionCharge {\n priceTiers {\n starts\n price\n }\n }\n ",[]),rl=({pricingModel:e,charge:t,currencyId:a,priceDecimals:o,truncatedText:r})=>{const s=Jn(ol,t).priceTiers,l=1===(null==s?void 0:s.length),u=n.jsx("div",{className:"w-full "+(l?"":"underline cursor-pointer"),children:r});return l?u:n.jsx(i.Dropdown,{popupRender:()=>n.jsxs("div",{className:"rounded border border-solid border-slate-200 bg-white overflow-hidden",children:[n.jsxs("div",{className:"bunny-text-gray-400 bunny-p-2",children:[tl(e)," pricing -"," ",el(e)]}),n.jsx(al,{columns:[{dataIndex:"starts",title:"From # of units",align:"right",render:(e,t,i)=>{const a=null==s?void 0:s[i+1],o=t.starts,r=(null==a?void 0:a.starts)?a.starts-1:"+";return n.jsxs(n.Fragment,{children:[il(o,0),"number"==typeof r?" - ":"","number"==typeof r?il(r,0):"+"]})}},{dataIndex:"price",title:"Unit price",align:"right",render:e=>n.jsx(n.Fragment,{children:yt(e,a,o)})}],dataSource:null!=s?s:[],rowKey:"starts",pagination:!1,size:"small"})]}),children:u})},sl=ne("\n fragment getApplicablePriceTier_SubscriptionChargeFragment on SubscriptionCharge {\n priceTiers {\n starts\n price\n }\n pricingModel\n quantity\n }\n ",[]),ll=(n,e,t)=>{var i,a,o,r,s;const l=Jn(sl,n);if(!(null===(i=l.priceTiers)||void 0===i?void 0:i.length))return"";let u;if("TIERED"===l.pricingModel?u=l.priceTiers[0]:"VOLUME"===l.pricingModel||"BANDS"===l.pricingModel?(u=l.priceTiers.find((n,e)=>{var t,i,a,o;const r=null===(t=l.priceTiers)||void 0===t?void 0:t[e+1],s=n.starts,u=r?(null!==(i=r.starts)&&void 0!==i?i:0)-1:1/0;return(null!==(a=l.quantity)&&void 0!==a?a:0)>=(null!=s?s:0)&&(null!==(o=l.quantity)&&void 0!==o?o:0)<=u}),u=u||l.priceTiers[0]):u=l.priceTiers[0],!u)return"";const d=l.priceTiers.indexOf(u),c=u.starts,p=l.priceTiers[d+1],m=p?(null!==(a=p.starts)&&void 0!==a?a:0)-1:"∞";return(null===(o=null==l?void 0:l.priceTiers)||void 0===o?void 0:o.length)>1?`${c}-${m}: ${yt(null!==(r=u.price)&&void 0!==r?r:0,e,t)}`:`${yt(null!==(s=u.price)&&void 0!==s?s:0,e,t)}`},ul=ne("\n fragment SubscriptionChargeUnitPrice_SubscriptionChargeFragment on SubscriptionCharge {\n trial\n discountedPrice\n priceDecimals\n kind\n pricingModel\n priceTiers {\n starts\n price\n }\n ...TieredDisplayDropdown_SubscriptionChargeFragment\n ...getApplicablePriceTier_SubscriptionChargeFragment\n }\n ",[ol,sl]),dl=({charge:e,currencyId:t})=>{var i,a,o,r;const s=Jn(ul,e),l=s.trial?"-":yt(null!==(i=s.discountedPrice)&&void 0!==i?i:"NaN",t,null!==(a=s.priceDecimals)&&void 0!==a?a:0),u="DISCOUNT"===(d=s.kind)||"FREE_PERIOD_DISCOUNT"===d;var d;return n.jsx(n.Fragment,{children:ps(s)?n.jsx(rl,{pricingModel:s.pricingModel,charge:s,currencyId:t,priceDecimals:null!==(o=s.priceDecimals)&&void 0!==o?o:0,truncatedText:`${"PRICE_UPDATE"===s.kind?"new ":""}${ll(s,t,null!==(r=s.priceDecimals)&&void 0!==r?r:0)}`}):u?`-${l}`:l})},{Text:cl}=i.Typography,pl=({children:e,className:t,gridColumn:i,right:a,style:o})=>n.jsx(cl,{className:`bunny-flex bunny-items-center bunny-text-sm bunny-whitespace-nowrap ${t}`,style:{gridColumn:i,textAlign:a?"right":"left",justifyContent:a?"flex-end":"flex-start",...o},children:e}),ml=ne("\n query subscriptionChargeHistograms($id: ID!) {\n subscription(id: $id) {\n chargeReport {\n priceListChargeId\n histogram {\n ...FeatureUsageGraph_HistogramFragment\n }\n }\n }\n }\n ",[Zs]),yl=({subscriptionId:t,priceListChargeId:o,charge:r})=>{var s,l,u;const d=oe(),{apiHost:c}=e.useContext(te),[p,m]=ys(),{data:y,isLoading:g}=a.useQuery({queryKey:rn({subscriptionId:t,token:d}),queryFn:()=>(async({id:n,apiHost:e,token:t})=>await In(ml,{apiHost:e,token:t},{id:n}))({id:t,apiHost:c,token:d}),enabled:m});if(!m||g)return n.jsx("div",{ref:p,children:n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:120,height:20}})});const b=null===(u=null===(l=null===(s=null==y?void 0:y.subscription)||void 0===s?void 0:s.chargeReport)||void 0===l?void 0:l.find(n=>n.priceListChargeId===o))||void 0===u?void 0:u.histogram;return b?n.jsx(zs,{charge:r,featureUsage:b,useAreaChart:!0}):null},gl=ne("\n fragment SubscriptionCardDesktopRow_SubscriptionChargeFragment on SubscriptionCharge {\n isRamp\n priceListChargeId\n trial\n startDate\n endDate\n kind\n chargeType\n quantity\n name\n isAmendment\n ...SubscriptionChargeTotal_SubscriptionChargeFragment\n ...SubscriptionChargeUnitPrice_SubscriptionChargeFragment\n ...FeatureUsageGraph_SubscriptionChargeFragment\n }\n ",[Js,ul,Os]),bl=({charge:e,chargeIndex:t,charges:i,currencyId:a,subscriptionId:o})=>{var r,s;const l=Jn(gl,e),u=i.map(n=>Jn(gl,n)),{isRamp:d}=l,c=null==u?void 0:u[t-1],p=`${sa(l.startDate)} - ${sa(l.endDate)}`,m=d&&0===t,y=l.trial,g=l.kind===Qs.DISCOUNT,b=(null==c?void 0:c.priceListChargeId)===l.priceListChargeId&&!g&&(!y||(null==c?void 0:c.trial))&&(y||!(null==c?void 0:c.trial));return n.jsxs("div",{className:"bunny-contents",children:[(m||!d)&&n.jsx(pl,{gridColumn:d?"1/-1":"1",children:n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-2 "+(g?"bunny-pl-0":""),children:n.jsx("div",{children:m||!d&&!b?l.name:""})})}),n.jsx(pl,{gridColumn:2,children:n.jsx("div",{children:p})}),n.jsx(pl,{right:!0,children:l.kind===Qs.DISCOUNT?"":l.chargeType===Hs.USAGE?l.priceListChargeId&&n.jsx(yl,{subscriptionId:o,priceListChargeId:l.priceListChargeId,charge:l}):l.isAmendment?`+${null===(r=l.quantity)||void 0===r?void 0:r.toLocaleString()}`:null===(s=l.quantity)||void 0===s?void 0:s.toLocaleString()}),n.jsx(pl,{right:!0,children:n.jsx(dl,{charge:l,currencyId:a})}),n.jsx(pl,{right:!0,children:n.jsx(nl,{charge:l,currencyId:a})})]})},hl=ne("\n fragment SubscriptionCardDesktop_SubscriptionFragment on Subscription {\n id\n currencyId\n chargeReport {\n ...sortSubscriptionCharges_SubscriptionChargeFragment\n ...filterSubscriptionCharges_SubscriptionChargeFragment\n ...SubscriptionCardDesktopRow_SubscriptionChargeFragment\n }\n ...SubscriptionCardHeader_SubscriptionFragment\n }\n ",[Is,Ns,Ps,gl]),vl=[{title:"Charge",width:"minmax(min-content, 26%)"},{title:"Period",width:"minmax(min-content, 20%)"},{className:"text-right",title:"Quantity",width:"minmax(min-content, 18%)"},{className:"text-right",title:"Unit price",width:"minmax(min-content, 18%)"},{className:"text-right",title:"Total",width:"minmax(min-content, 18%)"}],fl=[{title:"Charge",width:"minmax(min-content, 21.6%)"},{title:"Period",width:"minmax(min-content, 21.1%)"},{className:"text-right",title:"Quantity",width:"minmax(min-content, 19.1%)"},{className:"text-right",title:"Unit price",width:"minmax(min-content, 19.1%)"},{className:"text-right",title:"Total",width:"minmax(min-content, 19.1%)"}],xl=({subscription:e,isAddon:t})=>{var a;const o=Jn(hl,e),{shadow:r}=ns(),s=t?fl:vl,l=Ds(ks(null!==(a=null==o?void 0:o.chargeReport)&&void 0!==a?a:[]));return n.jsxs(us,{className:"bunny-p-4 "+(r?`shadow-${r}`:""),children:[n.jsx(Ls,{subscription:o}),n.jsx(i.Divider,{className:"bunny-my-4",style:{gridColumn:"1 / 5",width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid bunny-w-full",style:{gridTemplateColumns:s.map(n=>n.width).join(" "),rowGap:"0.75rem"},children:[n.jsx(qs,{columns:s}),l.map((e,t)=>n.jsx(bl,{charge:e,chargeIndex:t,charges:l,currencyId:o.currencyId,subscriptionId:o.id},t))]})]})},Cl=ne("\n fragment AddonSubscriptionsCards_SubscriptionFragment on Subscription {\n id\n state\n ...SubscriptionCardDesktop_SubscriptionFragment\n ...findAddonSubscriptions_SubscriptionFragment\n }\n ",[hl,ss]);function wl({subscriptions:e,subscription:t,showInactive:i}){const a=Jn(Cl,t),o=e.map(n=>Jn(Cl,n)),r=function(n,e){var t;const i=null===(t=Jn(ss,n).addonSubscriptions)||void 0===t?void 0:t.map(n=>n.id);return e.filter(n=>{var e;const t=Jn(ss,n);return null!==(e=null==i?void 0:i.includes(t.id))&&void 0!==e&&e})}(a,o);return 0===r.length?null:n.jsx(n.Fragment,{children:r.map((e,t)=>{if(!i&&ds(e.state))return null;const a=t===r.length-1;return n.jsxs("div",{className:"bunny-flex bunny-flex-row",children:[n.jsx(ls,{isLast:a,indentation:64,verticalMargin:"-1rem"}),n.jsx("div",{className:"bunny-flex-1",children:n.jsx(xl,{subscription:e,isAddon:!0})})]},t)})})}const{Text:jl}=i.Typography,Sl=({children:e,className:t,style:i})=>n.jsx(jl,{className:t,style:i,children:e}),Il=ne("\n fragment SubscriptionCardMobile_SubscriptionFragment on Subscription {\n id\n currencyId\n chargeReport {\n ...sortSubscriptionCharges_SubscriptionChargeFragment\n ...filterSubscriptionCharges_SubscriptionChargeFragment\n ...SubscriptionChargeUnitPrice_SubscriptionChargeFragment\n ...SubscriptionChargeTotal_SubscriptionChargeFragment\n isRamp\n name\n kind\n startDate\n endDate\n quantity\n }\n ...SubscriptionCardHeader_SubscriptionFragment\n }\n ",[Ns,Ps,ul,Is,Js]),Ll=[{title:"CHARGE"},{className:"text-right",title:"QUANTITY"},{className:"text-right",title:"UNIT PRICE"},{className:"text-right",title:"TOTAL"}],Pl=({subscription:t})=>{var a;const o=Jn(Il,t),{darkMode:r}=e.useContext(te),{shadow:s}=ns(),l=r?"var(--row-background-dark)":"var(--row-background)",u=Ds(ks(null!==(a=null==o?void 0:o.chargeReport)&&void 0!==a?a:[]));return n.jsxs(us,{className:"bunny-flex bunny-flex-col bunny-p-4 "+(s?`shadow-${s}`:""),children:[n.jsx(Ls,{subscription:o}),n.jsx(i.Divider,{className:"bunny-my-4",style:{gridColumn:"1 / -1",width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid",style:{columnGap:"0.5rem",gridTemplateColumns:"1fr auto auto auto",rowGap:"0.75rem",backgroundColor:l},children:[Ll.map((e,t)=>n.jsx(Sl,{className:`bunny-text-slate-400 ${e.className}`,style:{fontSize:"11px"},children:e.title},t)),u.map((e,t)=>{const{isRamp:i}=e,a=`${sa(e.startDate)} - ${sa(e.endDate)}`;return n.jsxs("div",{className:"bunny-contents",children:[(i&&0===t||!i)&&n.jsxs(Sl,{className:Ll[0].className,style:{gridColumn:i?"1/-1":"1"},children:[n.jsx("span",{children:e.name}),i?"":` - ${a}`]}),i&&n.jsx(Sl,{className:Ll[0].className,children:`- ${a}`}),n.jsx(Sl,{className:Ll[1].className,children:e.kind===Qs.DISCOUNT?"":e.quantity}),n.jsx(Sl,{className:Ll[2].className,children:n.jsx(dl,{charge:e,currencyId:o.currencyId})}),n.jsx(Sl,{className:Ll[3].className,children:n.jsx(nl,{charge:e,currencyId:o.currencyId})})]},t)})]})]})},kl=ne("\n fragment SubscriptionsList_SubscriptionFragment on Subscription {\n id\n state\n ...splitSubscriptionsByPriceList_SubscriptionFragment\n ...findNonAddonSubscriptions_SubscriptionFragment\n ...SubscriptionCardDesktop_SubscriptionFragment\n ...SubscriptionCardMobile_SubscriptionFragment\n ...AddonSubscriptionsCards_SubscriptionFragment\n }\n ",[ms,os,hl,Il,Cl]),Nl=({showInactive:e,subscriptions:t})=>{const{gap:i}=ns(),a=function(n){const e=[];return n.forEach(n=>{var t;const i=Jn(ms,n);if(!i.chargeReport)return void e.push(n);const a=new Map;if(i.chargeReport.forEach(n=>{var e;const t=null===(e=n.priceList)||void 0===e?void 0:e.id;t&&(a.has(t)||a.set(t,[]),a.get(t).push(n))}),a.size>1&&i.chargeReport.some(n=>"RENEW"===n.kind)){const o=null===(t=i.chargeReport.reduce((n,e)=>{if(!n)return e;const t=e.endDate,i=n.endDate,a=e.startDate,o=n.startDate;return t>i||t===i&&a>o?e:n},i.chargeReport[0]).priceList)||void 0===t?void 0:t.id;if(!o)return void e.push(n);const r=[];a.forEach((e,t)=>{var a,s,l,u,d,c;const p=null==e?void 0:e[0];if(!p||!e)return;const m=e.reduce((n,e)=>{const t=e.endDate;return n?t>n?t:n:t},e[0].endDate),y=e.reduce((n,e)=>{const t=e.startDate;return n?t<n?t:n:t},e[0].startDate),g=(new Date).toISOString().split("T")[0];let b=i.state;m<g?b=ne.scalar("SubscriptionState","EXPIRED"):y>g?b=ne.scalar("SubscriptionState","PENDING"):y<=g&&m>=g&&(b=ne.scalar("SubscriptionState","ACTIVE"));const h=t===o,v=null===(a=p.priceList)||void 0===a?void 0:a.plan,f=null!==(l=null===(s=null==v?void 0:v.addonPlans)||void 0===s?void 0:s.map(n=>n.id))&&void 0!==l?l:[],x=null===(u=i.addonSubscriptions)||void 0===u?void 0:u.filter(n=>{var e;if(!(null==v?void 0:v.addonPlans)||0===v.addonPlans.length)return!0;const t=null===(e=n.plan)||void 0===e?void 0:e.id;if(!t||!f.includes(t))return!1;const i=n.startDate,a=n.endDate;return i<=m&&a>=y});r.push({...n,priceList:p.priceList,plan:p.priceList.plan,product:p.priceList.product,endDate:m,startDate:y,state:b,evergreen:!!h&&i.evergreen,chargeReport:e,charges:null!==(c=null===(d=i.charges)||void 0===d?void 0:d.filter(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===t}))&&void 0!==c?c:[],addonSubscriptions:x})}),r.sort((n,e)=>{const t=Jn(ms,n),i=Jn(ms,e),a=t.endDate,o=i.endDate,r=t.startDate,s=i.startDate;return a<o?-1:a>o?1:r<s?-1:r>s?1:0}),e.push(...r)}else e.push(n)}),e}(t.map(n=>Jn(kl,n))),o=H(),r=rs(a);return n.jsx(n.Fragment,{children:null==r?void 0:r.map((t,r)=>!e&&ds(t.state)?null:o?n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-${i}`,children:[n.jsx(Pl,{subscription:t}),n.jsx(wl,{subscription:t,subscriptions:a,showInactive:e})]},r):n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-gap-${i}`,children:[n.jsx(xl,{subscription:t}),n.jsx(wl,{subscription:t,subscriptions:a,showInactive:e})]},r))})},Fl=ne("\n fragment SubscriptionsListContainer_SubscriptionFragment on Subscription {\n ...SubscriptionsList_SubscriptionFragment\n }\n ",[kl]),Dl=({companyName:e,showInactive:t=!1,noSubscriptionsComponent:i,subscriptions:a,subscriptionsAreLoading:o})=>{const{gap:r}=ns(),s=a.map(n=>Jn(Fl,n));return o?n.jsx(n.Fragment,{}):n.jsx(n.Fragment,{children:(null==s?void 0:s.length)>0?n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-${r} bunny-shrink`,children:n.jsx(Nl,{showInactive:t,subscriptions:s})}):i||n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-w-full",children:n.jsx(is,{message:`You have no subscriptions with ${e} yet`})})})},{Text:Tl}=i.Typography,ql=({description:e,onClose:i,title:a,closeButtonClassName:o})=>n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between bunny-gap-2",children:[n.jsx(Tl,{className:"bunny-text-xl bunny-font-normal",children:a}),i?n.jsx("button",{id:"closePayment",onClick:i,className:o,children:n.jsx(t.CloseOutlined,{})}):null]}),e&&n.jsx("div",{className:"bunny-text-sm bunny-font-medium",children:e})]}),[Al,Ml]=Me(n=>e.useState(n)),Hl=n=>{const e=oe(),{data:t}=a.useQuery({queryKey:z({id:n,objectName:"editingQuote",token:e}),queryFn:()=>{},enabled:!1,staleTime:1/0,gcTime:1/0,refetchOnMount:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1});return t},El=()=>{const n=oe(),e=a.useQueryClient();return{setQuoteQueryData:(t,i)=>{e.setQueryData(z({id:t,objectName:"editingQuote",token:n}),i)}}},Ql=n=>`\nquery account {\n account(id: ${n}) {\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n }\n}`,$l=ne("\n fragment QuoteFields_QuoteFragment on Quote @_unmask {\n accountId\n amount\n amountDue\n smallUnitAmountDue\n currencyId\n id\n payableId\n periodAmount\n subtotal\n taxAmount\n startDate\n formattedQuote {\n html\n }\n amountsByPeriod {\n amount\n startDate\n }\n kind\n quoteChanges {\n currencyId\n id\n kind\n charges {\n subtotal\n amountsByPeriod {\n amount\n startDate\n }\n amount\n billingPeriod\n currencyId\n feature {\n unitName\n }\n id\n name\n priceListCharge {\n id\n }\n priceList {\n id\n }\n coupon {\n couponCode\n }\n quantity\n kind\n }\n priceList {\n id\n plan {\n name\n }\n product {\n name\n }\n }\n }\n }\n "),[_l,Rl]=hn(),Bl=["US","CA"],Ul=({account:t,accountId:o})=>{const r=a.useQueryClient(),{apiHost:s}=e.useContext(te),l=oe(),[u]=i.Form.useForm(),{mutate:d,isPending:c}=a.useMutation({mutationFn:async n=>{const e=await(async({accountId:n,attributes:e,token:t,apiHost:i})=>{var a;const o={id:n,attributes:e},r=await yn({query:"\nmutation accountUpdate(\n $id: ID!,\n $attributes: AccountAttributes!) {\n accountUpdate(\n id: $id,\n attributes: $attributes\n ) {\n account {\n id\n billingCountry\n billingState\n billingStreet\n billingCity\n billingZip\n name\n }\n errors\n }\n }\n",token:t,vars:o,apiHost:i}),s=null===(a=null==r?void 0:r.accountUpdate)||void 0===a?void 0:a.errors;if(s)throw s;return r.accountUpdate})({accountId:o,attributes:n,token:l,apiHost:s});return e},onSuccess:()=>{r.invalidateQueries({queryKey:["getTaxationRequiredAccountFields",l]})}});return n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-4",form:u,initialValues:t,layout:"vertical",onFinish:d,children:[n.jsx(i.Form.Item,{label:"Billing street",name:"billingStreet",children:n.jsx(i.Input,{placeholder:"Street"})}),n.jsx(i.Form.Item,{label:"Billing city",name:"billingCity",children:n.jsx(i.Input,{placeholder:"City"})}),n.jsx(Vl,{}),n.jsx(i.Form.Item,{label:"Billing country",name:"billingCountry",rules:[{required:!0}],children:n.jsx(i.Select,{options:A,placeholder:"Select a country",showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})}),n.jsx(i.Form.Item,{label:"Billing zip",name:"billingZip",children:n.jsx(i.Input,{placeholder:"Zip"})}),n.jsx(i.Form.Item,{children:n.jsx(i.Button,{className:"bunny-w-full",disabled:c,htmlType:"submit",type:"primary",children:"Submit"})})]})},Vl=()=>{const e=i.Form.useWatch("billingCountry"),t=Bl.includes(e);return n.jsx(i.Form.Item,{label:"Billing state",name:"billingState",rules:[{required:t}],children:n.jsx(i.Input,{placeholder:"State"})})},{Text:Ol}=i.Typography;function Zl(){return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-px-4 bunny-items-center",children:[n.jsx(i.Spin,{indicator:n.jsx(t.LoadingOutlined,{spin:!0}),size:"small"}),n.jsx(Ol,{children:"Finalizing quote..."})]})}const{Text:zl}=i.Typography,Kl=ne("\n fragment QuoteCheckout_QuoteFragment on Quote {\n id\n accountId\n amountDue\n amount\n quoteChanges {\n id\n charges {\n kind\n coupon {\n couponCode\n }\n }\n }\n ...QuoteFields_QuoteFragment\n ...canApplyCoupons_QuoteFragment\n ...PaymentForm_QuoteFragment\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[$l,Ya,yi,it]),Gl=ne("\n fragment QuoteCheckout_SubscriptionFragment on Subscription {\n id\n ...canApplyCoupons_SubscriptionFragment\n }\n ",[Wa]),Yl=$(),Wl=({account:t,onSuccess:o,onFail:r,quote:s,taxationRequiredAccountFields:l,isUpdatingQuote:u,onRecalculateTaxes:d,isRecalculatingTaxes:c})=>{var p,m,y,g,b;const h=Rl(),{apiHost:v}=e.useContext(te),f=oe(),x=Jn(Kl,s),C=Jn(Gl,h),w=Kr(),j=Zr(),S=H(),I=at(x)>0,L=a.useQueryClient(),{addCoupon:P,removeCoupon:k,isAddingCoupon:N,isRemovingCoupon:F,activeCouponsExist:D}=Po({apiHost:v,token:f,quoteChangeId:null!==(g=null===(y=null===(p=null==x?void 0:x.quoteChanges)||void 0===p?void 0:p[(null===(m=null==x?void 0:x.quoteChanges)||void 0===m?void 0:m.length)-1])||void 0===y?void 0:y.id)&&void 0!==g?g:void 0,onCouponAdded:()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");L.invalidateQueries({queryKey:z({id:null==x?void 0:x.id,objectName:"editingQuote",token:f})}),Yl("Coupon applied"),d(),M("")},onCouponRemoved:()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");L.invalidateQueries({queryKey:z({id:null==x?void 0:x.id,objectName:"editingQuote",token:f})}),Yl("Coupon removed"),d()}}),[T,q]=e.useState(!1),[A,M]=e.useState(""),E=null===(b=null==x?void 0:x.quoteChanges)||void 0===b?void 0:b.flatMap(n=>{var e;return null===(e=null==n?void 0:n.charges)||void 0===e?void 0:e.filter(n=>"COUPON"===n.kind)}),Q=u||c,$=a.useMutation({mutationFn:async()=>{if(!(null==x?void 0:x.id))throw new Error("Quote ID is required");if(I)throw new Error("Payment is required");return await nt({quoteId:x.id,token:f,apiHost:v})},onSuccess:o,onError:n=>{console.log("error",n),L.invalidateQueries({queryKey:R({})}),r(n)}});return e.useEffect(()=>{L.refetchQueries({queryKey:z({objectName:"editingQuote",id:null==x?void 0:x.id,token:f})})},[]),l?n.jsx(Xl,{setMaxHeight:!1,children:n.jsx(Ul,{account:t,accountId:x.accountId})}):n.jsx(Xl,{setMaxHeight:!1,children:I?n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-w-full",children:[n.jsx(Ci,{onPaymentSuccess:o,quote:x,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id),disablePayButton:Q}),Q&&n.jsx(Zl,{}),0===(null==E?void 0:E.length)?n.jsx(n.Fragment,{children:C&&Xa(x,D,C)&&n.jsx(ko,{className:"bunny-pt-1",onAddCoupon:P,isAddingCoupon:N,couponCode:A,setCouponCode:M})}):n.jsx(i.Button,{type:"link",loading:F,onClick:()=>{null==E||E.forEach(n=>{var e;const t=null===(e=null==n?void 0:n.coupon)||void 0===e?void 0:e.couponCode;t&&k(t)})},children:"Remove coupon(s)"})]}):n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-px-4 "+(S?"bunny-shadow-padding-x":""),children:[n.jsx(i.Button,{onClick:async function(){q(!0),$.mutate(),q(!1)},type:"primary",disabled:Q,loading:T||Q,children:T?"Processing...":"Complete order"}),n.jsx(zl,{className:"bunny-text-xs bunny-text-slate-500",children:"No payment is required"})]})})},Xl=({children:e,setMaxHeight:t,className:i})=>{const a=H();return n.jsx("div",{className:`bunny-flex bunny-w-full bunny-flex-col bunny-gap-6 ${a?"bunny-shadow-padding-xb":""} ${i}`,style:{...a?t?{maxHeight:"60vh"}:{}:{width:"100%",maxWidth:"400px"}},children:e})},Jl=ne("\n fragment Checkout_QuoteFragment on Quote {\n id\n accountId\n formattedQuote {\n html\n }\n ...QuoteCheckout_QuoteFragment\n }\n ",[Kl]),nu=({onCancel:o,onSuccess:r,onFail:s,onRecalculateTaxes:l,invoice:u,open:d,quote:c,isUpdatingQuote:p,isRecalculatingTaxes:m})=>{var y,g,b,h,v;const{apiHost:f}=e.useContext(te),x=H(),C=oe(),w=Kr(),j=Zr(),S=Jn(Jl,c),I=jo({apiHost:f,token:C}),{data:L,isLoading:P}=a.useQuery({queryKey:["getTaxationRequiredAccountFields",C],queryFn:()=>(async({apiHost:n,token:e})=>{var t,i;const a=await yn({query:"{\n currentUser {\n taxationRequiredAccountFields\n }\n}",token:e,apiHost:n});return(null===(i=null===(t=null==a?void 0:a.currentUser)||void 0===t?void 0:t.taxationRequiredAccountFields)||void 0===i?void 0:i.length)>0?a.currentUser.taxationRequiredAccountFields:null})({apiHost:f,token:C}),enabled:Boolean(S),staleTime:0}),{data:k,isLoading:N}=a.useQuery({queryKey:["account",null==S?void 0:S.accountId],queryFn:()=>(null==S?void 0:S.accountId)&&(async({id:n,apiHost:e,token:t})=>{const i=await yn({query:Ql(n),token:t,apiHost:e});return null==i?void 0:i.account})({id:S.accountId,apiHost:f,token:C}),enabled:Boolean(null==S?void 0:S.accountId)&&((null==L?void 0:L.length)||0)>0});async function F(){if(S){if(!S.id)throw new Error("Quote ID is required");l(S.id)}return{}}const D=Boolean(S)&&d&&I&&!L&&!P&&!p;return a.useQuery({queryKey:Y({id:null!==(y=null==S?void 0:S.id)&&void 0!==y?y:void 0,token:C}),queryFn:F,enabled:D,staleTime:0}),!d||P||N?null:n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-fixed bunny-top-0 bunny-left-0 bunny-right-0 bunny-bottom-0 bunny-bg-slate-50\n bunny-overflow-auto bunny-height-full",style:{zIndex:1001},children:n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-grow bunny-pt-4 ${x?"bunny-pb-4":"bunny-pb-8"} bunny-content-container`,children:[n.jsx("div",{className:"bunny-flex bunny-justify-end bunny-w-full bunny-pr-4",children:n.jsx(t.CloseOutlined,{className:"bunny-text-base bunny-shadow-padding-xb",onClick:o})}),n.jsxs("div",{className:"bunny-flex bunny-justify-end bunny-pt-4 bunny-gap-4 "+(x?"bunny-flex-col":"bunny-shadow-padding-xb"),children:[((null==u?void 0:u.html)||(null===(g=null==S?void 0:S.formattedQuote)||void 0===g?void 0:g.html))&&n.jsx(qi,{html:u?u.html:null!==(h=null===(b=null==S?void 0:S.formattedQuote)||void 0===b?void 0:b.html)&&void 0!==h?h:""}),!x&&((null==u?void 0:u.html)||(null===(v=null==S?void 0:S.formattedQuote)||void 0===v?void 0:v.html))&&n.jsx(i.Divider,{className:"bunny-h-full",type:"vertical"}),u?n.jsx("div",{className:"bunny-w-full bunny-pt-12",children:n.jsx(Ci,{onPaymentSuccess:r,invoice:u,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id)})}):S?n.jsx(Wl,{account:k,onFail:n=>{s(n)},onSuccess:r,quote:S,taxationRequiredAccountFields:L,token:C,onRecalculateTaxes:async()=>{D&&await F()},isUpdatingQuote:p,isRecalculatingTaxes:m}):n.jsx(Ci,{onPaymentSuccess:r,onSavePaymentMethod:n=>null==w?void 0:w(n.savedPaymentMethodResponse.paymentMethodId),onPaymentMethodRemoved:n=>null==j?void 0:j(n.id)})]}),n.jsx(fo,{className:"bunny-px-12"})]})})},eu=ne("\n fragment QuantityInput_QuoteFragment on Quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n charges {\n id\n priceListCharge {\n id\n }\n }\n subscription {\n charges {\n id\n priceListCharge {\n id\n }\n }\n }\n }\n }\n ",[]),[tu,iu]=Me(n=>e.useState(null!=n&&n)),au=ne("\n fragment QuoteChangeSummarySection_QuoteFragment on Quote {\n id\n currencyId\n ...getQuoteAmountDue_QuoteFragment\n }\n ",[it]),ou=({openCheckout:e,errorUpdatingQuantity:t})=>{const a=H(),[o]=Ml(),[r]=iu(),s=Hl(o),l=Jn(au,s),u=!o||!l||t||r;return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-end",children:[l&&!u&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-mb-8",children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-text-right bunny-text-xs bunny-mb-2",children:"TOTAL"}),n.jsx("div",{className:"bunny-text-right "+(a?"bunny-text-2xl":"bunny-text-xl"),children:yt(at(l),(null==l?void 0:l.currencyId)||"")})]}),n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-end "+(a?"bunny-w-full":""),children:n.jsx(i.Button,{className:"bunny-w-full",onClick:e,disabled:u,size:a?"large":"middle",type:"primary",loading:r,children:"Proceed to checkout"})})]})},ru=ne("\n fragment QuantityDrawer_QuoteFragment on Quote {\n id\n ...Checkout_QuoteFragment\n ...QuantityInput_QuoteFragment\n ...QuoteChangeSummarySection_QuoteFragment\n }\n ",[Jl,eu,au]),su=ne("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuantityDrawer_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[ru]),lu=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;return null===(l=(await In(su,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o})).quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},uu=ne("\n mutation QuoteChargeUpdate($quoteChargeId: ID!, $quantity: Int) {\n quoteChargeUpdate(quoteChargeId: $quoteChargeId, quantity: $quantity) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuantityDrawer_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[ru]),du=ne("\n mutation QuoteDelete($id: ID!) {\n quoteDelete(id: $id) {\n errors\n quote {\n id\n }\n }\n }\n ",[]),cu=async({id:n,token:e,apiHost:t})=>(await In(du,{apiHost:t,token:e},{id:n})).quoteDelete,pu=ne("\n mutation quoteSubscriptionUpdate($subscriptionIds: [ID!]!) {\n quoteSubscriptionUpdate(subscriptionIds: $subscriptionIds) {\n quote {\n id\n quoteChanges {\n id\n priceList {\n id\n }\n subscription {\n charges {\n startDate\n endDate\n id\n priceListCharge {\n id\n }\n }\n }\n }\n ...QuantityDrawer_QuoteFragment\n }\n errors\n }\n }\n ",[ru]),mu=ne("\n fragment CanShowQuantitiesInput_SubscriptionChargeFragment on SubscriptionCharge {\n id\n pricingModel\n expired\n selfServiceQuantity\n kind\n chargeType\n }\n"),yu=ne("\n fragment CanShowQuantitiesInput_SubscriptionFragment on Subscription {\n id\n state\n priceList {\n id\n }\n currentCharges {\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n }\n ",[mu]),gu=(n,e)=>`${n}-${e}`,bu=({charge:n,subscription:e})=>{const t=Jn(yu,e),i=Jn(mu,n),a="ACTIVE"===(null==t?void 0:t.state),o="PENDING"===(null==t?void 0:t.state),r="TRIAL"===(null==t?void 0:t.state),s="FLAT"===(null==i?void 0:i.pricingModel),l="USAGE"===(null==i?void 0:i.chargeType),u="ONE_TIME"===(null==i?void 0:i.chargeType),d="DISCOUNT"===(null==i?void 0:i.kind)||"FREE_PERIOD_DISCOUNT"===(null==i?void 0:i.kind);return(a||o)&&!d&&!r&&!s&&!l&&!u&&(null==i?void 0:i.selfServiceQuantity)&&!(null==i?void 0:i.expired)},hu=({quoteIsPending:n})=>{const[,t]=iu(),i=e.useRef(n);return e.useEffect(()=>{i.current!==n&&(t(n),i.current=n)},[n,t]),null},vu=ne("\n fragment QuantityInput_SubscriptionChargeFragment on SubscriptionCharge {\n id\n quantity\n selfServiceQuantity\n priceListChargeId\n }\n"),fu=ne("\n fragment QuantityInput_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n chargeReport {\n ...QuantityInput_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ...CanShowQuantitiesInput_SubscriptionFragment\n }\n ",[vu,mu,yu]),xu=({charge:t,subscription:o,setUpdatingChargeQuantityId:r,updatingChargeQuantityId:s,setErrorUpdatingQuantity:l})=>{const d=oe(),{apiHost:c}=e.useContext(te),[p,m]=Ml(),y=Hl(p),[g,b]=e.useState(),h=Jn(vu,t),v=Jn(fu,o),f=Jn(eu,y),x=Q(),{setQuoteQueryData:C}=El(),w=s&&h.priceListChargeId&&v.id&&s!==gu(h.priceListChargeId,v.id)||!h.selfServiceQuantity,j=void 0===g?"":g,{mutate:S,isPending:I}=a.useMutation({mutationFn:lu,onSuccess:n=>{var e,t;if(!p)throw new Error("quoteId is required");(null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote)&&C(p,null===(t=null==n?void 0:n.quoteChange)||void 0===t?void 0:t.quote),l(!1)},onError:()=>{l(!0)}}),{mutate:L,isPending:P}=a.useMutation({mutationFn:cu,onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quote)||void 0===e?void 0:e.id;t?(C(t,null),m(void 0)):x("quoteId is required")},onError:()=>{l(!0)}}),{mutate:k,isPending:N}=a.useMutation({mutationFn:n=>(async(n,e,t)=>{var i;return null===(i=(await In(pu,{apiHost:e,token:t},{subscriptionIds:n})).quoteSubscriptionUpdate)||void 0===i?void 0:i.quote})([n],c,d),onSuccess:n=>{var e,t,i,a;if(!(null==n?void 0:n.id))throw new Error("quote id is required");m(null==n?void 0:n.id),C(null==n?void 0:n.id,n);const o=null===(e=null==n?void 0:n.quoteChanges)||void 0===e?void 0:e.find(n=>{var e,t;return(null===(e=null==n?void 0:n.priceList)||void 0===e?void 0:e.id)===(null===(t=v.priceList)||void 0===t?void 0:t.id)}),r=null===(i=null===(t=null==o?void 0:o.subscription)||void 0===t?void 0:t.charges)||void 0===i?void 0:i.find(n=>{var e;return(null===(e=null==n?void 0:n.priceListCharge)||void 0===e?void 0:e.id)===h.priceListChargeId});if(!(null==o?void 0:o.id))throw new Error("quoteChange id is required");if(!(null==r?void 0:r.id))throw new Error("subscriptionCharge id is required");var s;l(!1),S({apiHost:c,quantity:g,quoteChangeId:null==o?void 0:o.id,startDate:(s=dt(),"string"==typeof s&&(s=dt(s)),s.format("YYYY-MM-DD")),priceListChargeId:null===(a=r.priceListCharge)||void 0===a?void 0:a.id,token:d})},onError:()=>{l(!0)}}),{mutate:F,isPending:D}=a.useMutation({mutationFn:({quoteChargeId:n,quantity:e})=>{if(!n)throw new Error("quoteChargeId is required");return(async(n,e,t,i)=>{var a;return null===(a=(await In(uu,{apiHost:t,token:i},{quoteChargeId:n,quantity:e})).quoteChargeUpdate)||void 0===a?void 0:a.quoteCharge})(n,e,c,d)},onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!p)throw new Error("quoteId is required");t&&C(p,t),l(!1)},onError:()=>{l(!0)}}),T=e.useCallback(u.debounce(n=>{L({id:n,apiHost:c,token:d})},1e3),[]),q=e.useCallback(u.debounce((n,e,t,i,a,o)=>{var r;if(e===t)return l(!0),void x("New quantity cannot be the same as current");if(void 0===o)k(i);else{const t=null===(r=null==a?void 0:a.quoteChanges)||void 0===r?void 0:r.find(n=>{var e,t;return(null===(e=null==n?void 0:n.priceList)||void 0===e?void 0:e.id)===(null===(t=v.priceList)||void 0===t?void 0:t.id)}),i=null==t?void 0:t.charges.find(e=>{var t;return(null===(t=null==e?void 0:e.priceListCharge)||void 0===t?void 0:t.id)===n});i&&F({quoteChargeId:i.id,quantity:e})}},1e3),[]);return n.jsxs(n.Fragment,{children:[n.jsx(i.Input,{className:"bunny-text-right",disabled:w,onChange:n=>{(n=>{var e;q.cancel(),T.cancel();const t=""===n?void 0:isNaN(parseInt(n))?0:parseInt(n);if(b(t),void 0===t)r(void 0),p&&T(p);else{if(!(null==h?void 0:h.priceListChargeId))return void x("Charge ID is not found");r(gu(h.priceListChargeId,v.id));const n=null!==(e=h.quantity)&&void 0!==e?e:0;q(h.priceListChargeId,t,n,v.id,f,p)}})(n.target.value)},style:{width:"96px"},value:j}),n.jsx(hu,{quoteIsPending:I||P||N||D})]})},Cu=ne("\n fragment QuantityChangeGridRow_SubscriptionChargeFragment on SubscriptionCharge {\n id\n quantity\n name\n ...QuantityInput_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ",[vu,mu]),wu=ne("\n fragment QuantityChangeGridRow_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n plan {\n name\n }\n chargeReport {\n ...QuantityChangeGridRow_SubscriptionChargeFragment\n ...CanShowQuantitiesInput_SubscriptionChargeFragment\n }\n ...QuantityInput_SubscriptionFragment\n ...CanShowQuantitiesInput_SubscriptionFragment\n }\n ",[Cu,mu,yu,fu]),{Text:ju}=i.Typography,Su=({subscription:e,subscriptionCharge:t,setUpdatingChargeQuantityId:a,updatingChargeQuantityId:o,setErrorUpdatingQuantity:r})=>{var s,l;const u=Jn(wu,e),d=Jn(Cu,t);if(!bu({charge:d,subscription:u}))return null;const{brandColor:c}=fn();return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1",children:[n.jsx(ju,{className:"bunny-font-medium bunny-text-sm bunny-col-span-full",style:{color:c},children:null===(s=null==u?void 0:u.plan)||void 0===s?void 0:s.name}),n.jsx(ju,{className:"bunny-text-sm",children:null===(l=d.name)||void 0===l?void 0:l.toUpperCase()})]}),n.jsx(ju,{className:"bunny-flex bunny-items-center bunny-justify-end bunny-font-medium bunny-text-sm bunny-text-gray-900",children:d.quantity}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-justify-center bunny-items-end",children:[n.jsx(xu,{charge:d,subscription:u,setUpdatingChargeQuantityId:a,updatingChargeQuantityId:o,setErrorUpdatingQuantity:r}),n.jsx("div",{})]}),n.jsx(i.Divider,{className:"bunny-col-span-full bunny-my-2"})]})},{Text:Iu}=i.Typography,Lu=({children:e,right:t})=>n.jsx(Iu,{className:"bunny-font-medium bunny-text-sm bunny-text-slate-600 "+(t?"bunny-text-right":"bunny-text-left"),children:e}),Pu=ne("\n fragment QuantityDrawerDesktop_SubscriptionFragment on Subscription {\n currentCharges {\n chargeType\n ...QuantityChangeGridRow_SubscriptionChargeFragment\n }\n ...QuantityChangeGridRow_SubscriptionFragment\n }\n ",[wu,Cu]),ku=({onClose:t,open:a,openCheckout:o,subscriptions:r,setUpdatingChargeQuantityId:s,updatingChargeQuantityId:l})=>{const[u,d]=e.useState(a),[c,p]=e.useState(!1),m=H();return e.useEffect(()=>{let n;return a?d(!0):n=setTimeout(()=>{d(!1)},300),()=>clearTimeout(n)},[a]),u?n.jsxs(i.Drawer,{closeIcon:null,destroyOnHidden:!0,onClose:t,open:a,styles:m?{body:{padding:"1rem",background:C},wrapper:{width:"100vw"}}:{wrapper:{minWidth:"600px"}},title:n.jsx(ql,{description:"Adjust quantities below. The change will take effect immediately after checkout has been completed.",onClose:t,title:"Update quantities",closeButtonClassName:"ant-drawer-close"}),children:[n.jsxs("div",{className:"bunny-grid bunny-pb-2",style:{gridTemplateColumns:"3fr 3fr 2fr",rowGap:"0.25rem",columnGap:"1rem"},children:[n.jsx(Lu,{children:" "}),n.jsx(Lu,{right:!0,children:"CURRENT QUANTITY"}),n.jsx(Lu,{right:!0,children:"NEW QUANTITY"}),n.jsx(i.Divider,{className:"bunny-col-span-full",style:{marginBottom:"8px",marginTop:"20px"}}),r.map((e,t)=>{var i;const a=Jn(Pu,e);return n.jsx("div",{className:"bunny-contents",children:null===(i=null==a?void 0:a.currentCharges)||void 0===i?void 0:i.map((e,t)=>"USAGE"===e.chargeType?null:n.jsx(Su,{subscription:a,subscriptionCharge:e,setUpdatingChargeQuantityId:s,updatingChargeQuantityId:l,setErrorUpdatingQuantity:p},t))},t)})]}),n.jsx(ou,{openCheckout:o,errorUpdatingQuantity:c})]}):null},Nu=ne("\n fragment Subscriptions_SubscriptionFragment on Subscription {\n state\n id\n ...SubscriptionsListContainer_SubscriptionFragment\n ...CanShowQuantitiesInput_SubscriptionFragment\n ...QuantityDrawerDesktop_SubscriptionFragment\n }\n ",[Fl,yu,Pu]);function Fu(n,e){n.invalidateQueries({queryKey:W({pluralType:"subscriptions",token:e})}),n.invalidateQueries({queryKey:W({pluralType:"upgradeSubscriptions",token:e})}),n.invalidateQueries({queryKey:W({pluralType:"hasActiveSubscriptions",token:e})})}const[Du,Tu]=hn(),qu=ne("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...QuantityDrawer_QuoteFragment\n id\n }\n errors\n }\n }\n ",[ru]),Au=()=>{const n=oe(),{apiHost:t}=e.useContext(te),{setQuoteQueryData:i}=El(),{mutate:o,isPending:r}=a.useMutation({mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await In(qu,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:n=>{if(!(null==n?void 0:n.id))throw new Error("Quote ID is undefined");i(null==n?void 0:n.id,n)}});return{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}},Mu=({subscriptions:t,quantityDrawerOpen:i,setQuantityDrawerOpen:o,handlePortalErrors:r})=>{const s=oe(),l=a.useQueryClient(),u=$(),[d,c]=Ml(),[p,m]=e.useState(!1),[y,g]=e.useState(void 0),b=Hl(d),{quoteRecalculateTaxesMutation:h,isRecalculatingTaxes:v}=Tu();return n.jsxs(n.Fragment,{children:[n.jsx(ku,{onClose:()=>{y&&(g(void 0),c(void 0)),o(!1)},open:i,openCheckout:()=>{m(!0)},subscriptions:t,setUpdatingChargeQuantityId:g,updatingChargeQuantityId:y}),n.jsx(nu,{onCancel:()=>{m(!1)},onSuccess:()=>{o(!1),c(void 0),l.invalidateQueries({queryKey:tn({token:s})}),Fu(l,s),u("Your plan has been updated","Payment successful"),m(!1),g(void 0)},onFail:n=>{null==r||r(n)},onRecalculateTaxes:h,open:p,quote:b,token:s,isUpdatingQuote:!1,isRecalculatingTaxes:v})]})},Hu=({subscriptions:e,quantityDrawerOpen:t,setQuantityDrawerOpen:i,handlePortalErrors:a})=>{const{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}=Au();return n.jsx(Al,{children:n.jsx(tu,{children:n.jsx(Du,{value:{quoteRecalculateTaxesMutation:n=>o({quoteId:n}),isRecalculatingTaxes:r},children:n.jsx(Mu,{subscriptions:e,quantityDrawerOpen:t,setQuantityDrawerOpen:i,handlePortalErrors:a})})})})},Eu=ne("\n query subscriptions {\n subscriptions {\n nodes {\n ...Subscriptions_SubscriptionFragment\n }\n }\n }\n ",[Nu]),Qu=({showInactive:e,setShowInactive:t})=>{const{secondaryColor:a}=fn();return n.jsx("div",{className:"bunny-flex bunny-items-center bunny-gap-4",children:n.jsx($u,{children:n.jsx(i.Checkbox,{checked:e,onChange:n=>t(n.target.checked),style:{color:a},children:"Show inactive"})})})},$u=p.div`
140
140
  .ant-checkbox-wrapper span {
141
141
  padding-inline-end: 0 !important;
142
142
  }
143
- `,Mu=()=>n.jsxs(as,{className:"bunny-p-4 shadow-md",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:140}}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:80}}),n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:72,borderRadius:4}})]})]}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-3",children:[n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:100}}),n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:80}})]})]}),n.jsx(i.Divider,{className:"bunny-my-4",style:{width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid bunny-w-full",style:{gridTemplateColumns:"minmax(min-content, 26%) minmax(min-content, 20%) minmax(min-content, 18%) minmax(min-content, 18%) minmax(min-content, 18%)",rowGap:"0.75rem"},children:[Array.from({length:5}).map((e,t)=>n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:"60%"}},t)),Array.from({length:2}).map((e,t)=>Array.from({length:5}).map((e,a)=>n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:0===a?"80%":"60%"}},`${t}-${a}`)))]})]}),Hu=({className:e})=>n.jsx("div",{className:e,children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsx(Mu,{}),n.jsx(Mu,{})]})}),Qu=({setQuantityDrawerOpen:e})=>n.jsx(i.Button,{onClick:()=>{e(!0)},type:"default",children:"Change quantities"}),Eu=({inactiveSwitchVisible:e,showInactive:t,setShowInactive:i,setQuantityDrawerOpen:a,subscriptions:o})=>{const r=q(),s=(({subscriptions:n})=>null==n?void 0:n.some(n=>{var e;if(!n)return!1;const t=Yn(uu,n);return null===(e=null==t?void 0:t.currentCharges)||void 0===e?void 0:e.some(e=>cu({charge:e,subscription:n}))}))({subscriptions:o});return n.jsxs(n.Fragment,{children:[!r&&e&&n.jsx(qu,{showInactive:t,setShowInactive:i}),n.jsx("div",{className:"bunny-flex bunny-grow bunny-gap-2 "+(r?"bunny-flex-col":"bunny-justify-end"),children:s&&n.jsx(Qu,{setQuantityDrawerOpen:a})})]})},$u=e.createContext({}),[_u,Ru]=yn();Wn("\n fragment useSelectedPriceListQuoteChange_QuoteFragment on Quote {\n quoteChanges {\n id\n }\n }\n");const Bu=Wn("\n fragment useSelectedPriceListQuoteChange_QuoteChangeFragment on QuoteChange {\n id\n priceList {\n id\n }\n kind\n }\n");function Uu({quoteChanges:n,selectedPriceListId:t}){return e.useMemo(()=>null==n?void 0:n.find(n=>{var e;const i=Yn(Bu,n);return(null===(e=null==i?void 0:i.priceList)||void 0===e?void 0:e.id)===t&&((null==(a=i)?void 0:a.kind)===Xa.scalar("QuoteChangeKind","UPDATE")||(null==a?void 0:a.kind)===Xa.scalar("QuoteChangeKind","SUBSCRIBE")||(null==a?void 0:a.kind)===Xa.scalar("QuoteChangeKind","ACTIVATE"));var a}),[n,t])}const Vu=Wn("\n fragment useChargeCRUD_QuoteFragment on Quote {\n id\n startDate\n quoteChanges {\n subscriptionId\n charges {\n id\n quantity\n priceListCharge {\n id\n }\n }\n id\n ...useSelectedPriceListQuoteChange_QuoteChangeFragment\n }\n }\n ",[Bu]),Ou=({disabled:e,onClickCheckout:t,loading:a,tooltipText:o})=>{const r=q();return n.jsx(({children:e})=>o?n.jsx(i.Tooltip,{title:o,children:e}):n.jsx("div",{children:e}),{children:n.jsx(i.Button,{className:r?"w-full":"",disabled:e,onClick:t,size:r?"large":"middle",type:"primary",loading:a,children:"Proceed to checkout"})})},Zu=Wn("\n fragment CheckoutPrice_QuoteFragment on Quote {\n periodAmount\n amountDue\n quoteChanges {\n charges {\n kind\n chargeType\n }\n }\n }\n "),Ku=({quote:e,selectedPriceList:t})=>{var i,a;const o=Yn(Zu,e),r=q(),s=null!==(i=null==o?void 0:o.amountDue)&&void 0!==i?i:null==o?void 0:o.periodAmount,l=t&&void 0!==s,u=Ja(t.periodMonths),d=u?P[u]:"undefined",c=null===(a=null==o?void 0:o.quoteChanges)||void 0===a?void 0:a.some(n=>n.charges.some(n=>"SUBSCRIBE"===n.kind&&"USAGE"===n.chargeType));return n.jsxs("div",{className:"bunny-font-medium "+(r?"bunny-text-2xl":""),children:[c?"Usage based pricing":"",c&&l?" + ":"",l?`${ct(s,null==t?void 0:t.currencyId,void 0)} / ${d}`:""]})},{Text:zu}=i.Typography,Gu=Wn("\n fragment CheckoutBarSummarySection_QuoteFragment on Quote {\n quoteChanges {\n charges {\n id\n }\n }\n ...CheckoutPrice_QuoteFragment\n }\n ",[Zu]),Yu=({selectedPriceList:t,onClickCheckout:i})=>{var a;const{quote:o,isQuotePending:r,isUpdatingQuote:s}=e.useContext($u),l=Yn(Gu,o),{isInPreviewMode:u}=Gr(),{paymentPlugins:d}=Be(),c=q(),p=Boolean(null==d?void 0:d.length),m=Boolean(null===(a=null==l?void 0:l.quoteChanges)||void 0===a?void 0:a.some(n=>n.charges.length>0)),y=Boolean(!t||!m||!p||u);return n.jsxs(zu,{className:"bunny-flex bunny-items-center bunny-gap-4 "+(c?"bunny-flex-col":""),children:[l&&n.jsxs("div",{className:"bunny-flex "+(c?"items-center justify-between w-full":"flex-col"),children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-font-medium bunny-text-right",style:{fontSize:"11px"},children:"TOTAL"}),n.jsx(Ku,{quote:l,selectedPriceList:t})]}),n.jsx(Ou,{disabled:y,onClickCheckout:i,loading:r||s,tooltipText:u?"Checkout is disabled in preview mode":p?void 0:"Cannot checkout. No valid payment plugins found. Please contact your administrator."})]})},Wu=Wn("\n fragment PlanPickerCheckoutBar_QuoteFragment on Quote {\n ...Checkout_QuoteFragment\n quoteChanges {\n priceList {\n id\n }\n charges {\n priceListCharge {\n id\n }\n }\n }\n id\n }\n ",[zl]),Xu=Wn("\n fragment useQuoteUpdateFeatureAddon_QuoteFragment on Quote {\n id\n startDate\n }\n "),Ju=Wn("\n fragment FeatureAddonRow_QuoteFragment on Quote {\n ...useQuoteUpdateFeatureAddon_QuoteFragment\n }\n ",[Xu]),nd=Wn("\n fragment useToggleAddonPlan_QuoteFragment on Quote {\n quoteChanges {\n priceList {\n id\n }\n id\n }\n id\n }\n "),ed=Wn("\n fragment AddonPlanRow_QuoteFragment on Quote {\n ...useToggleAddonPlan_QuoteFragment\n }\n ",[nd]),td=Wn("\n fragment CheckoutBarInput_PriceListChargeFragment on PriceListCharge {\n name\n quantityMin\n quantityMax\n id\n feature {\n id\n }\n }\n"),id=Wn("\n fragment PlanPickerCheckoutBar_PriceListChargeFragment on PriceListCharge {\n ...CheckoutBarInput_PriceListChargeFragment\n feature {\n id\n }\n featureAddon\n id\n }\n ",[td]),ad=Wn("\n fragment CanEditChargeQuantity_PriceListChargeFragment on PriceListCharge {\n chargeType\n pricingModel\n selfServiceQuantity\n }\n");const od=Wn("\n fragment useQuoteQuantities_PriceListChargeFragment on PriceListCharge {\n feature {\n id\n }\n id\n quantityMax\n quantityMin\n selfServiceQuantity\n }\n"),rd=Wn("\n fragment useQuantityEditableCharges_PriceListChargeFragment on PriceListCharge @_unmask {\n deprecated\n id\n featureAddon\n ...CanEditChargeQuantity_PriceListChargeFragment\n ...PlanPickerCheckoutBar_PriceListChargeFragment\n ...useQuoteQuantities_PriceListChargeFragment\n }\n ",[ad,od,id]),sd=Wn("\n fragment useQuantityEditableCharges_QuoteFragment on Quote {\n quoteChanges {\n kind\n charges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n ...useSelectedPriceListQuoteChange_QuoteChangeFragment\n }\n }\n ",[ad,Bu,od,id,rd]),ld=Wn("\n fragment QuoteContext_QuoteFragment on Quote {\n id\n currencyId\n amountDue\n startDate\n quoteChanges {\n id\n kind\n priceList {\n id\n }\n charges {\n priceListCharge {\n id\n chargeType\n pricingModel\n quantityMin\n quantityMax\n selfServiceQuantity\n name\n }\n feature {\n id\n }\n quantity\n id\n }\n }\n ...PlanPickerCheckoutBar_QuoteFragment\n ...CheckoutBarSummarySection_QuoteFragment\n ...AddonPlanRow_QuoteFragment\n ...FeatureAddonRow_QuoteFragment\n ...useQuantityEditableCharges_QuoteFragment\n ...useChargeCRUD_QuoteFragment\n }\n ",[Wu,Gu,ed,Ju,sd,Vu]);const ud=Wn("\n fragment useQuantityEditableCharges_SubscriptionFragment on Subscription {\n id\n priceListId\n currentCharges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n addonSubscriptions {\n currentCharges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n }\n }\n ",[rd]);function dd({upgradingSubscription:n,pricelistId:t,quote:i}){const a=Yn(ud,n),o=Yn(sd,i),r=Uu({quoteChanges:null==o?void 0:o.quoteChanges,selectedPriceListId:t});function s(n){var e,t;return null!==(t=null===(e=null==a?void 0:a.currentCharges)||void 0===e?void 0:e.some(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n}))&&void 0!==t&&t}const l=e.useMemo(()=>{var n,e,i,r,s;const l=(null==a?void 0:a.priceListId)===t&&null!==(i=null===(e=null===(n=null==a?void 0:a.currentCharges)||void 0===n?void 0:n.flatMap(n=>n.priceListCharge))||void 0===e?void 0:e.filter(n=>null!==n))&&void 0!==i?i:[],u=null===(r=null==o?void 0:o.quoteChanges)||void 0===r?void 0:r.filter(n=>"ADJUSTMENT"!==n.kind),d=null!==(s=null==u?void 0:u.flatMap(n=>n.charges.flatMap(n=>null==n?void 0:n.priceListCharge)).filter(n=>null!==n))&&void 0!==s?s:[],c=new Set(null==l?void 0:l.map(n=>null==n?void 0:n.id)),p=null==d?void 0:d.filter(n=>!c.has(null==n?void 0:n.id));return[...l,...p]},[a,o,t]);return{quantityEditableCharges:e.useMemo(()=>{const n=null==l?void 0:l.filter(n=>function(n){const e=Yn(ad,n);return!!e&&"USAGE"!==e.chargeType&&"FLAT"!==e.pricingModel&&!!e.selfServiceQuantity}(n)),e=null==n?void 0:n.filter(n=>!(null==n?void 0:n.deprecated)||s(null==n?void 0:n.id)),t=null==e?void 0:e.filter(n=>{var e;if(null==n?void 0:n.featureAddon){const t=s(null==n?void 0:n.id),i=null===(e=null==r?void 0:r.charges)||void 0===e?void 0:e.some(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===(null==n?void 0:n.id)});return t||i}return!0});return null!=t?t:[]},[r,l]),findSubscriptionCharge:function(n){var e;return null===(e=null==a?void 0:a.currentCharges)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n})}}}const cd=Wn("\n fragment FormattedQuoteFields_QuoteFragment on Quote {\n formattedQuote {\n html\n }\n }\n"),pd=Wn("\n query quote($id: ID, $includeHtmlField: Boolean!) {\n quote(id: $id) {\n ...FormattedQuoteFields_QuoteFragment @include(if: $includeHtmlField)\n ...QuoteContext_QuoteFragment\n }\n }\n ",[cd,ld]),md=Wn("\n fragment useQuoteCreate_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n state\n }\n ",[]),yd=({maskedUpgradingSubscription:n,selectedPriceList:t,token:i})=>{var o;const{apiHost:r}=e.useContext(Jn),s=Po(),[l,u]=e.useState(),d=Yn(md,n),{data:c,isPending:p}=a.useQuery({queryKey:V({objectName:"editingQuote",id:l,token:i}),queryFn:async()=>{if(!l)throw new Error("editingQuote is undefined");const n=await(async({id:n,token:e,apiHost:t,includeHtmlField:i=!1})=>{const a=await wn(pd,{apiHost:t,token:e},{id:n,includeHtmlField:i});return null==a?void 0:a.quote})({id:l,token:i,apiHost:r,includeHtmlField:!0});return n},enabled:Boolean(l)}),{mutate:m}=a.useMutation({mutationKey:Io,mutationFn:async({subscriptionId:n,priceListId:e})=>await(({subscriptionId:n,priceListId:e,apiHost:t,token:i})=>cn({query:"mutation QuoteSubscriptionUpgrade($subscriptionId: ID!, $priceListId: ID!) {\n quoteSubscriptionUpgrade(\n subscriptionId: $subscriptionId\n priceListId: $priceListId\n ) {\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n,priceListId:e},apiHost:t,token:i}))({subscriptionId:n,priceListId:e,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionUpgrade)||void 0===e?void 0:e.quote;u(t.id)}}),{mutate:y}=a.useMutation({mutationKey:Io,mutationFn:async({subscriptionId:n})=>await(({subscriptionId:n,priceListId:e,apiHost:t,token:i})=>cn({query:"mutation QuoteSubscriptionAddon($subscriptionId: ID!, $priceListId: ID) {\n quoteSubscriptionAddon(subscriptionId: $subscriptionId, priceListId: $priceListId) {\n errors\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n,priceListId:e},apiHost:t,token:i}))({subscriptionId:n,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionAddon)||void 0===e?void 0:e.quote;u(t.id)}}),{mutate:g}=a.useMutation({mutationKey:Io,mutationFn:async({subscriptionId:n})=>await(({subscriptionId:n,apiHost:e,token:t})=>cn({query:"mutation QuoteSubscriptionActivate($subscriptionId: ID!) {\n quoteSubscriptionActivate(subscriptionId: $subscriptionId) {\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n},apiHost:e,token:t}))({subscriptionId:n,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionActivate)||void 0===e?void 0:e.quote;u(t.id)}});return e.useEffect(()=>{var n,e,i;if(!(null==d?void 0:d.id))return;if(!(null==t?void 0:t.id))return;const a=(null===(n=null==d?void 0:d.priceList)||void 0===n?void 0:n.id)===(null==t?void 0:t.id),o="TRIAL"===(null==d?void 0:d.state)&&(null===(e=null==d?void 0:d.priceList)||void 0===e?void 0:e.id)===(null==t?void 0:t.id),r="TRIAL_EXPIRED"===d.state&&(null===(i=null==d?void 0:d.priceList)||void 0===i?void 0:i.id)===(null==t?void 0:t.id);o||r?g({subscriptionId:null==d?void 0:d.id}):a?y({subscriptionId:null==d?void 0:d.id}):m({subscriptionId:null==d?void 0:d.id,priceListId:null==t?void 0:t.id})},[null==t?void 0:t.id,null==d?void 0:d.id,null===(o=null==d?void 0:d.priceList)||void 0===o?void 0:o.id]),{quote:c,isQuotePending:p||s>0}};function gd(n,e){return`${n}:${e}`}const bd=M(),hd=Wn("\n fragment useQuoteQuantities_SubscriptionFragment on Subscription {\n currentCharges {\n id\n quantity\n }\n }\n"),vd=({quantityEditableCharges:n})=>{var t;const i=Hl(),a=Yn(hd,i),{featureQuantities:o,getFeatureQuantity:r,onUpdateFeatureQuantity:s}=function({onFeatureQuantitiesChanged:n}){const[t,i]=e.useState({});return{featureQuantities:t,getFeatureQuantity:(n,e,i)=>(null!=i?i:t)[gd(n,e)],onUpdateFeatureQuantity:(e,t,a)=>{const o=gd(e,t);i(e=>{const t=e[o],i={...e,[o]:a};return t!==a&&(null==n||n(i)),i})}}}({}),u=null!==(t=e.useMemo(()=>null==n?void 0:n.map(n=>Yn(od,n)),[n]))&&void 0!==t?t:[],d=n=>{var e,t;const i=null===(e=null==n?void 0:n.feature)||void 0===e?void 0:e.id,u=null==n?void 0:n.id;if(!i||!u)return;if(!n)throw new Error("Price list charge is undefined");const d=r(i,u,o);if(void 0===d){const e=null===(t=null==a?void 0:a.currentCharges)||void 0===t?void 0:t.find(n=>{var e;return(null===(e=n.priceListCharge)||void 0===e?void 0:e.id)===u}),o=null==e?void 0:e.quantity;if(null!=o)s(i,u,o);else{const e=((n,e=1)=>{const t=(null==n?void 0:n.quantityMax)||Number.POSITIVE_INFINITY,i=(null==n?void 0:n.quantityMin)||Number.NEGATIVE_INFINITY;return(null==n?void 0:n.selfServiceQuantity)?l.clamp(e,i,t):i})(n,d);s(i,u,e)}}};return e.useEffect(()=>{null==u||u.forEach(n=>{d(n)})},[u]),{onChangeQuantity:function(n,e){var t;const i=null==u?void 0:u.find(e=>(null==e?void 0:e.id)===n),a=null===(t=null==i?void 0:i.feature)||void 0===t?void 0:t.id;a?s(a,n,e):bd("featureId not found")},getFeatureQuantity:(n,e)=>r(n,e,o),featureQuantities:o}},fd=Wn("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...QuoteContext_QuoteFragment\n id\n }\n errors\n }\n }\n ",[ld]),xd=()=>{const n=te(),e=a.useQueryClient();return{setQuoteQueryData:(t,i)=>{e.setQueryData(V({id:t,objectName:"editingQuote",token:n}),i)}}},Cd=()=>{const n=te(),{apiHost:t}=e.useContext(Jn),{setQuoteQueryData:i}=xd(),{mutate:o,isPending:r}=a.useMutation({mutationKey:Lo,mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await wn(fd,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:n=>{if(!(null==n?void 0:n.id))throw new Error("Quote ID is undefined");i(null==n?void 0:n.id,n)}});return{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}};function wd({children:t}){var i;const o=Hl(),[r,s]=e.useState(),[l,u]=e.useState(!1),d=te(),{isFeatureAddonsLoading:c,addFeatureAddonLoading:p,removeFeatureAddonLoading:m}=function(){const[n,t]=e.useState([]);return{isFeatureAddonsLoading:n.length>0,addFeatureAddonLoading:e=>{t([...n,e])},removeFeatureAddonLoading:e=>{t(n.filter(n=>n!==e))}}}(),{quoteRecalculateTaxesMutation:y,isRecalculatingTaxes:g}=Cd(),{quote:b,isQuotePending:h}=yd({maskedUpgradingSubscription:o,selectedPriceList:r,token:d}),v=Yn(ld,b),f=function(n){const e=te(),t=a.useIsFetching({queryKey:V({objectName:"editingQuote",id:null!=n?n:"",token:e})});return Boolean(n)&&t>0}(null!==(i=null==v?void 0:v.id)&&void 0!==i?i:void 0),x=Po()>0,C=f||x,{quantityEditableCharges:w}=dd({upgradingSubscription:o,pricelistId:null==r?void 0:r.id,quote:v}),{onChangeQuantity:j,getFeatureQuantity:S}=vd({quantityEditableCharges:w});return n.jsx(_u,{value:w,children:n.jsx($u.Provider,{value:{quote:v,selectedPriceList:r,isQuotePending:h,isUpdatingQuote:C,isRecalculatingTaxes:g,isAddonPlanLoading:l,setIsAddonPlanLoading:u,isFeatureAddonsLoading:c,addFeatureAddonLoading:p,removeFeatureAddonLoading:m,onClearQuote:function(){s(void 0)},onChangeSelectedPriceList:function(n){s(n)},onChangeQuantity:j,getFeatureQuantity:S,onRecalculateTaxes:n=>y({quoteId:n})},children:t})})}const[jd,Sd]=yn(),Id=Wn("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[ld]),Ld=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;return null===(l=(await wn(Id,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o})).quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},Pd=Wn("\n mutation QuoteChargeUpdate($quoteChargeId: ID!, $quantity: Int) {\n quoteChargeUpdate(quoteChargeId: $quoteChargeId, quantity: $quantity) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[ld]),kd=Wn("\n mutation QuoteChargeDelete($quoteChargeId: ID!) {\n quoteChargeDelete(quoteChargeId: $quoteChargeId) {\n errors\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n }\n ",[ld]),Nd=async({quoteChargeId:n,token:e,apiHost:t})=>{var i;return null===(i=(await wn(kd,{apiHost:t,token:e},{quoteChargeId:n})).quoteChargeDelete)||void 0===i?void 0:i.quoteCharge},Fd=M(),Dd=Wn("\n fragment useChargeCRUD_SubscriptionFragment on Subscription {\n currentCharges {\n quantity\n priceListCharge {\n id\n }\n }\n }\n"),Td=({priceListChargeId:n,featureId:t})=>{const i=te(),{apiHost:o}=e.useContext(Jn),{setQuoteQueryData:r}=xd(),s=Hl(),{quote:u,selectedPriceList:d,getFeatureQuantity:c}=e.useContext($u),p=Ru(),m=Yn(Vu,u),y=Yn(Dd,s),g=Uu({quoteChanges:null==m?void 0:m.quoteChanges,selectedPriceListId:null==d?void 0:d.id}),{mutate:b}=a.useMutation({mutationKey:Io,mutationFn:async({quoteChargeId:n,quantity:e})=>{if(!i)throw Fd("Token is undefined when updating quote charge"),new Error("Token is undefined when updating quote charge");if(!p)throw Fd("Quantity editable charges are undefined"),new Error("Quantity editable charges are undefined");return await(async(n,e,t,i)=>{var a;return null===(a=(await wn(Pd,{apiHost:t,token:i},{quoteChargeId:n,quantity:e})).quoteChargeUpdate)||void 0===a?void 0:a.quoteCharge})(n,e,o,i)},onSuccess:n=>{if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");r(m.id,n.quoteChange.quote)}}),{mutate:h}=a.useMutation({mutationKey:Io,mutationFn:Ld,onSuccess:n=>{if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");r(m.id,n.quoteChange.quote)}}),{mutate:v}=a.useMutation({mutationKey:Io,mutationFn:async n=>{if(!i)throw Fd("Token is undefined when deleting quote charge"),new Error("Token is undefined when deleting quote charge");return await Nd({quoteChargeId:n,token:i,apiHost:o})},onSuccess:n=>{var e;if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!t)throw new Error("Quote is undefined");r(m.id,t)}}),f=e.useCallback(l.debounce(e=>{var t,a,r,s,l;const u=null===(t=null==m?void 0:m.quoteChanges)||void 0===t?void 0:t.flatMap(n=>n.charges),d=null==u?void 0:u.find(e=>{var t;return(null===(t=null==e?void 0:e.priceListCharge)||void 0===t?void 0:t.id)===n}),c=null==d?void 0:d.quantity;if(void 0!==c&&c===e)return;const p=null!==(r=null===(a=null==y?void 0:y.currentCharges)||void 0===a?void 0:a.find(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n}))&&void 0!==r?r:void 0,f=null!==(s=null==p?void 0:p.quantity)&&void 0!==s?s:null;if(d){const n=d.id;if(!n)return void Fd("Quote charge ID is undefined");const t=null!==(l=null==p?void 0:p.quantity)&&void 0!==l?l:0;if(c&&t+c===e)return;return void(null!==f&&e===f?v(n):b({quoteChargeId:n,quantity:e}))}if(p){if(null!==f&&e===f)return;if(!(null==m?void 0:m.startDate))return void Fd("Quote start date is undefined");const t=null==g?void 0:g.id;if(!t)return void Fd("Quote change ID is undefined");h({apiHost:o,token:i,priceListChargeId:n,quantity:e,quoteChangeId:t,startDate:m.startDate})}},1e3),[o,n,null==m?void 0:m.id,null==m?void 0:m.startDate,g,h,b,v,y,i]);e.useEffect(()=>{if(!t)return void Fd("Feature ID is undefined");const e=c(t,n);void 0!==e&&f(e)},[null==g?void 0:g.id]),e.useEffect(()=>()=>{f.cancel()},[]);return{onQuantityChange:e.useCallback(n=>{f(n)},[f])}},{Text:qd}=i.Typography,Ad=({disabled:t,priceListCharge:a,quantity:o,onQuantityChanged:r})=>{var s,l,u,d;const c=Yn(td,a),{onQuantityChange:p}=Td({priceListChargeId:c.id,featureId:null===(s=c.feature)||void 0===s?void 0:s.id}),[m,y]=e.useState(!1),g=q();return e.useEffect(()=>{setTimeout(()=>{y(!0)},1e3),setTimeout(()=>{y(!1)},6e3)},[]),n.jsxs(qd,{className:"bunny-flex bunny-items-center bunny-gap-2 "+(g?"bunny-justify-between":""),children:[n.jsx(Md,{chargeName:c.name}),n.jsx(i.Tooltip,{onOpenChange:y,open:m,title:"Change quantity here",styles:{body:{paddingTop:"0.75rem",paddingBottom:"0.75rem"}},children:n.jsx(i.Input,{id:`${null===(l=c.name)||void 0===l?void 0:l.toLowerCase().replace(/ /g,"-")}-quantity-input`,className:g?"text-right":"",disabled:t,onChange:n=>{r(Number(n.target.value)),p(Number(n.target.value))},min:null!==(u=null==c?void 0:c.quantityMin)&&void 0!==u?u:void 0,max:null!==(d=null==c?void 0:c.quantityMax)&&void 0!==d?d:void 0,style:{minWidth:"120px"},type:"number",value:o,required:!0})})]})},Md=({chargeName:e})=>n.jsx(qd,{className:"bunny-text-slate-500 bunny-font-medium bunny-text-nowrap",style:{fontSize:"11px"},children:e.toUpperCase()}),Hd=({selectedPriceList:t,handlePortalErrors:i,onCheckoutSuccess:o})=>{const{isInPreviewMode:r}=Gr(),{quote:s,onRecalculateTaxes:l,isFeatureAddonsLoading:u,isUpdatingQuote:d,isRecalculatingTaxes:c,onChangeQuantity:p,getFeatureQuantity:m}=e.useContext($u),y=Ru(),g=Yn(Wu,s),[b,h]=e.useState(!1),v=te(),f=H(),x=a.useQueryClient(),C=q();return n.jsxs("div",{className:`bunny-plan-picker-checkout-bar bunny-flex ${C?"bunny-flex-col bunny-gap-4":"bunny-flex-row"} bunny-my-4 bunny-justify-between`,children:[n.jsx("div",{className:(C?"bunny-flex bunny-flex-col":"bunny-flex bunny-flex-wrap")+" bunny-gap-4 bunny-min-w-0",children:null==y?void 0:y.map((e,t)=>{var i,a;const o=Yn(id,e),s=null==o?void 0:o.featureAddon,l=(null===(i=null==o?void 0:o.feature)||void 0===i?void 0:i.id)?m(null===(a=null==o?void 0:o.feature)||void 0===a?void 0:a.id,o.id):void 0,d=Boolean(!g||s&&u||void 0===l);return n.jsx(Ad,{disabled:d,priceListCharge:o,quantity:l,onQuantityChanged:n=>{r||p(o.id,n)}},t)})}),n.jsx("div",{className:"bunny-shrink-0",children:n.jsx(Yu,{onClickCheckout:function(){h(!0)},selectedPriceList:t})}),n.jsx(Gl,{onCancel:()=>h(!1),onFail:n=>null==i?void 0:i(n),onSuccess:()=>{x.refetchQueries({queryKey:z({pluralType:"subscriptions",token:v})}),x.invalidateQueries({queryKey:z({pluralType:"upgradeSubscriptions",token:v})}),x.invalidateQueries({queryKey:z({pluralType:"hasActiveSubscriptions",token:v})}),x.invalidateQueries({queryKey:J({token:v})}),h(!1),f("Your subscription has been created","Checkout successful"),o()},onRecalculateTaxes:l,open:b,quote:g,token:v,isUpdatingQuote:d,isRecalculatingTaxes:c})]})},Qd=Wn("\n fragment priceListChargePriceDescription_PriceListChargeFragment on PriceListCharge {\n showPriceAsMonthly\n billingPeriod\n feature {\n unitName\n }\n }\n");function Ed(n){var e;const t=Yn(Qd,n),i=t.billingPeriod,a=i?P[i]:null,o=null===(e=t.feature)||void 0===e?void 0:e.unitName;return"ONCE"===i?"One-time":`Per ${o?`${o} / `:""}${t.showPriceAsMonthly?"month":a}`}const $d=Wn("\n fragment getPriceListUnitName_PriceListFragment on PriceList {\n charges {\n chargeType\n featureAddon\n deprecated\n feature {\n unitName\n }\n }\n }\n ",[]);const _d=Wn("\n fragment priceDescriptionString_PriceListFragment on PriceList {\n showPriceAsMonthly\n periodMonths\n ...getPriceListUnitName_PriceListFragment\n }\n ",[$d]);function Rd(n){const e=Yn(_d,n),t=Ja(e.periodMonths),i=t?P[t]:null,a=function(n){var e,t,i;const a=null===(e=Yn($d,n).charges)||void 0===e?void 0:e.filter(n=>!n.deprecated&&!n.featureAddon),o=null==a?void 0:a.filter(n=>"RECURRING"===n.chargeType),r=null==a?void 0:a.filter(n=>"USAGE"===n.chargeType);return 1===(null==o?void 0:o.length)?null===(t=o[0].feature)||void 0===t?void 0:t.unitName:1===(null==r?void 0:r.length)?null===(i=r[0].feature)||void 0===i?void 0:i.unitName:null}(e);return 0===e.periodMonths?"One-time":`Per ${a?`${a} / `:""}${e.showPriceAsMonthly?"month":i}`}const{Text:Bd}=i.Typography,Ud=Wn("\n fragment PriceTierPrice_PriceTierFragment on PriceListChargeTier {\n price\n }\n "),Vd=({currencyId:e,priceDecimals:t,tier:i})=>{const a=Yn(Ud,i);return n.jsx(Bd,{className:"bunny-text-white",children:ct(a.price,e,t)})},{Text:Od}=i.Typography,Zd=Wn("\n fragment PriceTierRow_PriceTierFragment on PriceListChargeTier {\n starts\n }\n"),Kd=({tier:e,nextTier:t})=>{const i=Yn(Zd,e),a=Yn(Zd,t),o=(null==a?void 0:a.starts)?`${null==i?void 0:i.starts} - ${a.starts-1}`:`${null==i?void 0:i.starts}+`;return n.jsx(Od,{className:"bunny-text-white",children:o})},{Text:zd}=i.Typography,Gd=Wn("\n fragment ChargePriceTiers_PriceListChargeFragment on PriceListCharge {\n id\n name\n pricingModel\n priceDecimals\n priceListChargeTiers {\n starts\n ...PriceTierRow_PriceTierFragment\n ...PriceTierPrice_PriceTierFragment\n }\n }\n ",[Zd,Ud]),Yd=({charge:e,currencyId:t})=>{var i;const a=Yn(Gd,e);return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1 bunny-w-full",children:[n.jsx(zd,{className:"bunny-text-white bunny-font-bold",children:a.name}),n.jsxs(zd,{className:"bunny-flex bunny-flex-row bunny-text-gray-400 bunny-text-xs/3",children:[Ws(a.pricingModel)," pricing -"," ",Ys(a.pricingModel)]}),n.jsx("div",{style:{maxWidth:"150px",minWidth:"50%",gap:"0.1rem",flexDirection:"column",display:"flex"},children:null===(i=a.priceListChargeTiers)||void 0===i?void 0:i.map((e,i)=>{var o,r,s;return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-w-full",children:[n.jsx(Kd,{tier:e,nextTier:null!==(r=null===(o=a.priceListChargeTiers)||void 0===o?void 0:o[i+1])&&void 0!==r?r:null}),n.jsx(Vd,{currencyId:t,priceDecimals:null!==(s=a.priceDecimals)&&void 0!==s?s:0,tier:e})]},e.starts)})})]})},Wd=Wn("\n fragment ChargeHasPriceTiers_PriceListChargeFragment on PriceListCharge {\n priceListChargeTiers {\n starts\n price\n }\n }\n ");function Xd(n){var e;const t=Yn(Wd,n);return(null===(e=t.priceListChargeTiers)||void 0===e?void 0:e.length)&&t.priceListChargeTiers.length>1}const Jd=(n,e)=>{var t,i;return(null===(t=n.priceListChargeTiers)||void 0===t?void 0:t.length)&&n.priceListChargeTiers.length>0?((n,e)=>{var t,i,a;const o=null===(i=null===(t=n.priceListChargeTiers)||void 0===t?void 0:t[0])||void 0===i?void 0:i.price;return o?ct(o,e,null!==(a=n.priceDecimals)&&void 0!==a?a:0):"DNE"})(n,e):ct(n.basePrice,e,null!==(i=n.priceDecimals)&&void 0!==i?i:0)},nc=Wn("\n fragment PricingTooltip_PriceListChargeFragment on PriceListCharge {\n priceListChargeTiers {\n starts\n price\n }\n pricingModel\n feature {\n unitName\n }\n priceDecimals\n basePrice\n name\n ...priceListChargePriceDescription_PriceListChargeFragment\n ...ChargeHasPriceTiers_PriceListChargeFragment\n ...ChargePriceTiers_PriceListChargeFragment\n }\n ",[Wd,Gd,Qd]),ec=Wn("\n fragment PricingTooltip_PriceListFragment on PriceList {\n currencyId\n monthlyBasePrice\n basePrice\n ...priceDescriptionString_PriceListFragment\n }\n ",[_d]),tc=({className:i,priceListCharges:a,currencyId:o})=>{const r=a.map(n=>Yn(nc,n)),s=e.useMemo(()=>n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-3",children:null==r?void 0:r.map((e,t)=>Xd(e)?n.jsx(Yd,{charge:e,currencyId:o},t):n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-white bunny-font-bold",children:e.name}),n.jsxs("div",{className:"bunny-text-gray-400 bunny-text-xs/3",children:[Jd(e,o)," ",Ed(e)]})]},t))}),[r,o]);return n.jsx(Do,{className:`bunny-text-gray-400 bunny-text-sm ${i}`,title:s,children:n.jsx(t.InfoCircleOutlined,{className:"bunny-text-gray-400 ",size:15})})},ic=Wn("\n fragment PriceListHasPriceTiers_PriceListFragment on PriceList {\n charges {\n ...ChargeHasPriceTiers_PriceListChargeFragment\n }\n }\n ",[Wd]);function ac(n){return!n||/^<[^>]*>(\s*)<\/[^>]*>$/.test(n)}const oc=Wn("\n fragment GetActiveCharges_PriceListChargeFragment on PriceListCharge {\n deprecated\n featureAddon\n }\n ");function rc(n){return n.filter(n=>{const e=Yn(oc,n);return!e.deprecated&&!e.featureAddon})}const sc=Wn("\n fragment BillingPeriodDescription_PriceListFragment on PriceList {\n periodMonths\n basePrice\n }\n "),lc=({priceList:e})=>{const t=Yn(sc,e),i=Ja(t.periodMonths),a=i?Ks[i]:"undefined",o=Boolean((null==t?void 0:t.basePrice)&&t.basePrice>0),r=Boolean(t.periodMonths&&t.periodMonths>1&&o);return n.jsx(n.Fragment,{children:r&&n.jsxs("div",{children:["Billed ",a]})})},{Text:uc}=i.Typography,dc=Rt.div`
143
+ `,_u=()=>n.jsxs(us,{className:"bunny-p-4 shadow-md",children:[n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:140}}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:80}}),n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:72,borderRadius:4}})]})]}),n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-3",children:[n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:100}}),n.jsx(i.Skeleton.Button,{active:!0,size:"small",style:{width:80}})]})]}),n.jsx(i.Divider,{className:"bunny-my-4",style:{width:"calc(100% + 32px)",transform:"translateX(-16px)"}}),n.jsxs("div",{className:"bunny-grid bunny-w-full",style:{gridTemplateColumns:"minmax(min-content, 26%) minmax(min-content, 20%) minmax(min-content, 18%) minmax(min-content, 18%) minmax(min-content, 18%)",rowGap:"0.75rem"},children:[Array.from({length:5}).map((e,t)=>n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:"60%"}},t)),Array.from({length:2}).map((e,t)=>Array.from({length:5}).map((e,a)=>n.jsx(i.Skeleton.Input,{active:!0,size:"small",style:{width:0===a?"80%":"60%"}},`${t}-${a}`)))]})]}),Ru=({className:e})=>n.jsx("div",{className:e,children:n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[n.jsx(_u,{}),n.jsx(_u,{})]})}),Bu=({setQuantityDrawerOpen:e})=>n.jsx(i.Button,{onClick:()=>{e(!0)},type:"default",children:"Change quantities"}),Uu=({inactiveSwitchVisible:e,showInactive:t,setShowInactive:i,setQuantityDrawerOpen:a,subscriptions:o})=>{const r=H(),s=(({subscriptions:n})=>null==n?void 0:n.some(n=>{var e;if(!n)return!1;const t=Jn(yu,n);return null===(e=null==t?void 0:t.currentCharges)||void 0===e?void 0:e.some(e=>bu({charge:e,subscription:n}))}))({subscriptions:o});return n.jsxs(n.Fragment,{children:[!r&&e&&n.jsx(Qu,{showInactive:t,setShowInactive:i}),n.jsx("div",{className:"bunny-flex bunny-grow bunny-gap-2 "+(r?"bunny-flex-col":"bunny-justify-end"),children:s&&n.jsx(Bu,{setQuantityDrawerOpen:a})})]})},Vu=e.createContext({}),[Ou,Zu]=hn();ne("\n fragment useSelectedPriceListQuoteChange_QuoteFragment on Quote {\n quoteChanges {\n id\n }\n }\n");const zu=ne("\n fragment useSelectedPriceListQuoteChange_QuoteChangeFragment on QuoteChange {\n id\n priceList {\n id\n }\n kind\n }\n");function Ku({quoteChanges:n,selectedPriceListId:t}){return e.useMemo(()=>null==n?void 0:n.find(n=>{var e;const i=Jn(zu,n);return(null===(e=null==i?void 0:i.priceList)||void 0===e?void 0:e.id)===t&&((null==(a=i)?void 0:a.kind)===io.scalar("QuoteChangeKind","UPDATE")||(null==a?void 0:a.kind)===io.scalar("QuoteChangeKind","SUBSCRIBE")||(null==a?void 0:a.kind)===io.scalar("QuoteChangeKind","ACTIVATE"));var a}),[n,t])}const Gu=ne("\n fragment useChargeCRUD_QuoteFragment on Quote {\n id\n startDate\n quoteChanges {\n subscriptionId\n charges {\n id\n quantity\n priceListCharge {\n id\n }\n }\n id\n ...useSelectedPriceListQuoteChange_QuoteChangeFragment\n }\n }\n ",[zu]),Yu=({disabled:e,onClickCheckout:t,loading:a,tooltipText:o})=>{const r=H();return n.jsx(({children:e})=>o?n.jsx(i.Tooltip,{title:o,children:e}):n.jsx("div",{children:e}),{children:n.jsx(i.Button,{className:r?"w-full":"",disabled:e,onClick:t,size:r?"large":"middle",type:"primary",loading:a,children:"Proceed to checkout"})})},Wu=ne("\n fragment CheckoutPrice_QuoteFragment on Quote {\n periodAmount\n amountDue\n quoteChanges {\n charges {\n kind\n chargeType\n }\n }\n }\n "),Xu=({quote:e,selectedPriceList:t})=>{var i,a;const o=Jn(Wu,e),r=H(),s=null!==(i=null==o?void 0:o.amountDue)&&void 0!==i?i:null==o?void 0:o.periodAmount,l=t&&void 0!==s,u=ao(t.periodMonths),d=u?F[u]:"undefined",c=null===(a=null==o?void 0:o.quoteChanges)||void 0===a?void 0:a.some(n=>n.charges.some(n=>"SUBSCRIBE"===n.kind&&"USAGE"===n.chargeType));return n.jsxs("div",{className:"bunny-font-medium "+(r?"bunny-text-2xl":""),children:[c?"Usage based pricing":"",c&&l?" + ":"",l?`${yt(s,null==t?void 0:t.currencyId,void 0)} / ${d}`:""]})},{Text:Ju}=i.Typography,nd=ne("\n fragment CheckoutBarSummarySection_QuoteFragment on Quote {\n quoteChanges {\n charges {\n id\n }\n }\n ...CheckoutPrice_QuoteFragment\n }\n ",[Wu]),ed=({selectedPriceList:t,onClickCheckout:i})=>{var a;const{quote:o,isQuotePending:r,isUpdatingQuote:s}=e.useContext(Vu),l=Jn(nd,o),{isInPreviewMode:u}=ns(),{paymentPlugins:d}=Oe(),c=H(),p=Boolean(null==d?void 0:d.length),m=Boolean(null===(a=null==l?void 0:l.quoteChanges)||void 0===a?void 0:a.some(n=>n.charges.length>0)),y=Boolean(!t||!m||!p||u);return n.jsxs(Ju,{className:"bunny-flex bunny-items-center bunny-gap-4 "+(c?"bunny-flex-col":""),children:[l&&n.jsxs("div",{className:"bunny-flex "+(c?"items-center justify-between w-full":"flex-col"),children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-font-medium bunny-text-right",style:{fontSize:"11px"},children:"TOTAL"}),n.jsx(Xu,{quote:l,selectedPriceList:t})]}),n.jsx(Yu,{disabled:y,onClickCheckout:i,loading:r||s,tooltipText:u?"Checkout is disabled in preview mode":p?void 0:"Cannot checkout. No valid payment plugins found. Please contact your administrator."})]})},td=ne("\n fragment PlanPickerCheckoutBar_QuoteFragment on Quote {\n ...Checkout_QuoteFragment\n quoteChanges {\n priceList {\n id\n }\n charges {\n priceListCharge {\n id\n }\n }\n }\n id\n }\n ",[Jl]),id=ne("\n fragment useQuoteUpdateFeatureAddon_QuoteFragment on Quote {\n id\n startDate\n }\n "),ad=ne("\n fragment FeatureAddonRow_QuoteFragment on Quote {\n ...useQuoteUpdateFeatureAddon_QuoteFragment\n }\n ",[id]),od=ne("\n fragment useToggleAddonPlan_QuoteFragment on Quote {\n quoteChanges {\n priceList {\n id\n }\n id\n }\n id\n }\n "),rd=ne("\n fragment AddonPlanRow_QuoteFragment on Quote {\n ...useToggleAddonPlan_QuoteFragment\n }\n ",[od]),sd=ne("\n fragment CheckoutBarInput_PriceListChargeFragment on PriceListCharge {\n name\n quantityMin\n quantityMax\n id\n feature {\n id\n }\n }\n"),ld=ne("\n fragment PlanPickerCheckoutBar_PriceListChargeFragment on PriceListCharge {\n ...CheckoutBarInput_PriceListChargeFragment\n feature {\n id\n }\n featureAddon\n id\n }\n ",[sd]),ud=ne("\n fragment CanEditChargeQuantity_PriceListChargeFragment on PriceListCharge {\n chargeType\n pricingModel\n selfServiceQuantity\n }\n");const dd=ne("\n fragment useQuoteQuantities_PriceListChargeFragment on PriceListCharge {\n feature {\n id\n }\n id\n quantityMax\n quantityMin\n selfServiceQuantity\n }\n"),cd=ne("\n fragment useQuantityEditableCharges_PriceListChargeFragment on PriceListCharge @_unmask {\n deprecated\n id\n featureAddon\n ...CanEditChargeQuantity_PriceListChargeFragment\n ...PlanPickerCheckoutBar_PriceListChargeFragment\n ...useQuoteQuantities_PriceListChargeFragment\n }\n ",[ud,dd,ld]),pd=ne("\n fragment useQuantityEditableCharges_QuoteFragment on Quote {\n quoteChanges {\n kind\n charges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n ...useSelectedPriceListQuoteChange_QuoteChangeFragment\n }\n }\n ",[ud,zu,dd,ld,cd]),md=ne("\n fragment QuoteContext_QuoteFragment on Quote {\n id\n currencyId\n amountDue\n startDate\n quoteChanges {\n id\n kind\n priceList {\n id\n }\n charges {\n priceListCharge {\n id\n chargeType\n pricingModel\n quantityMin\n quantityMax\n selfServiceQuantity\n name\n }\n feature {\n id\n }\n quantity\n id\n }\n }\n ...PlanPickerCheckoutBar_QuoteFragment\n ...CheckoutBarSummarySection_QuoteFragment\n ...AddonPlanRow_QuoteFragment\n ...FeatureAddonRow_QuoteFragment\n ...useQuantityEditableCharges_QuoteFragment\n ...useChargeCRUD_QuoteFragment\n }\n ",[td,nd,rd,ad,pd,Gu]);const yd=ne("\n fragment useQuantityEditableCharges_SubscriptionFragment on Subscription {\n id\n priceListId\n currentCharges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n addonSubscriptions {\n currentCharges {\n priceListCharge {\n ...useQuantityEditableCharges_PriceListChargeFragment\n }\n }\n }\n }\n ",[cd]);function gd({upgradingSubscription:n,pricelistId:t,quote:i}){const a=Jn(yd,n),o=Jn(pd,i),r=Ku({quoteChanges:null==o?void 0:o.quoteChanges,selectedPriceListId:t});function s(n){var e,t;return null!==(t=null===(e=null==a?void 0:a.currentCharges)||void 0===e?void 0:e.some(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n}))&&void 0!==t&&t}const l=e.useMemo(()=>{var n,e,i,r,s;const l=(null==a?void 0:a.priceListId)===t&&null!==(i=null===(e=null===(n=null==a?void 0:a.currentCharges)||void 0===n?void 0:n.flatMap(n=>n.priceListCharge))||void 0===e?void 0:e.filter(n=>null!==n))&&void 0!==i?i:[],u=null===(r=null==o?void 0:o.quoteChanges)||void 0===r?void 0:r.filter(n=>"ADJUSTMENT"!==n.kind),d=null!==(s=null==u?void 0:u.flatMap(n=>n.charges.flatMap(n=>null==n?void 0:n.priceListCharge)).filter(n=>null!==n))&&void 0!==s?s:[],c=new Set(null==l?void 0:l.map(n=>null==n?void 0:n.id)),p=null==d?void 0:d.filter(n=>!c.has(null==n?void 0:n.id));return[...l,...p]},[a,o,t]);return{quantityEditableCharges:e.useMemo(()=>{const n=null==l?void 0:l.filter(n=>function(n){const e=Jn(ud,n);return!!e&&"USAGE"!==e.chargeType&&"FLAT"!==e.pricingModel&&!!e.selfServiceQuantity}(n)),e=null==n?void 0:n.filter(n=>!(null==n?void 0:n.deprecated)||s(null==n?void 0:n.id)),t=null==e?void 0:e.filter(n=>{var e;if(null==n?void 0:n.featureAddon){const t=s(null==n?void 0:n.id),i=null===(e=null==r?void 0:r.charges)||void 0===e?void 0:e.some(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===(null==n?void 0:n.id)});return t||i}return!0});return null!=t?t:[]},[r,l]),findSubscriptionCharge:function(n){var e;return null===(e=null==a?void 0:a.currentCharges)||void 0===e?void 0:e.find(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n})}}}const bd=ne("\n fragment FormattedQuoteFields_QuoteFragment on Quote {\n formattedQuote {\n html\n }\n }\n"),hd=ne("\n query quote($id: ID, $includeHtmlField: Boolean!) {\n quote(id: $id) {\n ...FormattedQuoteFields_QuoteFragment @include(if: $includeHtmlField)\n ...QuoteContext_QuoteFragment\n }\n }\n ",[bd,md]),vd=ne("\n fragment useQuoteCreate_SubscriptionFragment on Subscription {\n id\n priceList {\n id\n }\n state\n }\n ",[]),fd=({maskedUpgradingSubscription:n,selectedPriceList:t,token:i})=>{var o;const{apiHost:r}=e.useContext(te),s=To(),[l,u]=e.useState(),d=Jn(vd,n),{data:c,isPending:p}=a.useQuery({queryKey:z({objectName:"editingQuote",id:l,token:i}),queryFn:async()=>{if(!l)throw new Error("editingQuote is undefined");const n=await(async({id:n,token:e,apiHost:t,includeHtmlField:i=!1})=>{const a=await In(hd,{apiHost:t,token:e},{id:n,includeHtmlField:i});return null==a?void 0:a.quote})({id:l,token:i,apiHost:r,includeHtmlField:!0});return n},enabled:Boolean(l)}),{mutate:m}=a.useMutation({mutationKey:Fo,mutationFn:async({subscriptionId:n,priceListId:e})=>await(({subscriptionId:n,priceListId:e,apiHost:t,token:i})=>yn({query:"mutation QuoteSubscriptionUpgrade($subscriptionId: ID!, $priceListId: ID!) {\n quoteSubscriptionUpgrade(\n subscriptionId: $subscriptionId\n priceListId: $priceListId\n ) {\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n,priceListId:e},apiHost:t,token:i}))({subscriptionId:n,priceListId:e,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionUpgrade)||void 0===e?void 0:e.quote;u(t.id)}}),{mutate:y}=a.useMutation({mutationKey:Fo,mutationFn:async({subscriptionId:n})=>await(({subscriptionId:n,priceListId:e,apiHost:t,token:i})=>yn({query:"mutation QuoteSubscriptionAddon($subscriptionId: ID!, $priceListId: ID) {\n quoteSubscriptionAddon(subscriptionId: $subscriptionId, priceListId: $priceListId) {\n errors\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n,priceListId:e},apiHost:t,token:i}))({subscriptionId:n,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionAddon)||void 0===e?void 0:e.quote;u(t.id)}}),{mutate:g}=a.useMutation({mutationKey:Fo,mutationFn:async({subscriptionId:n})=>await(({subscriptionId:n,apiHost:e,token:t})=>yn({query:"mutation QuoteSubscriptionActivate($subscriptionId: ID!) {\n quoteSubscriptionActivate(subscriptionId: $subscriptionId) {\n quote {\n id\n }\n }\n }",vars:{subscriptionId:n},apiHost:e,token:t}))({subscriptionId:n,apiHost:r,token:i}),onSuccess:n=>{var e;const t=null===(e=null==n?void 0:n.quoteSubscriptionActivate)||void 0===e?void 0:e.quote;u(t.id)}});return e.useEffect(()=>{var n,e,i;if(!(null==d?void 0:d.id))return;if(!(null==t?void 0:t.id))return;const a=(null===(n=null==d?void 0:d.priceList)||void 0===n?void 0:n.id)===(null==t?void 0:t.id),o="TRIAL"===(null==d?void 0:d.state)&&(null===(e=null==d?void 0:d.priceList)||void 0===e?void 0:e.id)===(null==t?void 0:t.id),r="TRIAL_EXPIRED"===d.state&&(null===(i=null==d?void 0:d.priceList)||void 0===i?void 0:i.id)===(null==t?void 0:t.id);o||r?g({subscriptionId:null==d?void 0:d.id}):a?y({subscriptionId:null==d?void 0:d.id}):m({subscriptionId:null==d?void 0:d.id,priceListId:null==t?void 0:t.id})},[null==t?void 0:t.id,null==d?void 0:d.id,null===(o=null==d?void 0:d.priceList)||void 0===o?void 0:o.id]),{quote:c,isQuotePending:p||s>0}};function xd(n,e){return`${n}:${e}`}const Cd=Q(),wd=ne("\n fragment useQuoteQuantities_SubscriptionFragment on Subscription {\n currentCharges {\n id\n quantity\n }\n }\n"),jd=({quantityEditableCharges:n})=>{var t;const i=Rl(),a=Jn(wd,i),{featureQuantities:o,getFeatureQuantity:r,onUpdateFeatureQuantity:s}=function({onFeatureQuantitiesChanged:n}){const[t,i]=e.useState({});return{featureQuantities:t,getFeatureQuantity:(n,e,i)=>(null!=i?i:t)[xd(n,e)],onUpdateFeatureQuantity:(e,t,a)=>{const o=xd(e,t);i(e=>{const t=e[o],i={...e,[o]:a};return t!==a&&(null==n||n(i)),i})}}}({}),l=null!==(t=e.useMemo(()=>null==n?void 0:n.map(n=>Jn(dd,n)),[n]))&&void 0!==t?t:[],d=n=>{var e,t;const i=null===(e=null==n?void 0:n.feature)||void 0===e?void 0:e.id,l=null==n?void 0:n.id;if(!i||!l)return;if(!n)throw new Error("Price list charge is undefined");const d=r(i,l,o);if(void 0===d){const e=null===(t=null==a?void 0:a.currentCharges)||void 0===t?void 0:t.find(n=>{var e;return(null===(e=n.priceListCharge)||void 0===e?void 0:e.id)===l}),o=null==e?void 0:e.quantity;if(null!=o)s(i,l,o);else{const e=((n,e=1)=>{const t=(null==n?void 0:n.quantityMax)||Number.POSITIVE_INFINITY,i=(null==n?void 0:n.quantityMin)||Number.NEGATIVE_INFINITY;return(null==n?void 0:n.selfServiceQuantity)?u.clamp(e,i,t):i})(n,d);s(i,l,e)}}};return e.useEffect(()=>{null==l||l.forEach(n=>{d(n)})},[l]),{onChangeQuantity:function(n,e){var t;const i=null==l?void 0:l.find(e=>(null==e?void 0:e.id)===n),a=null===(t=null==i?void 0:i.feature)||void 0===t?void 0:t.id;a?s(a,n,e):Cd("featureId not found")},getFeatureQuantity:(n,e)=>r(n,e,o),featureQuantities:o}},Sd=ne("\n mutation QuoteRecalculateTaxes($id: ID!) {\n quoteRecalculateTaxes(id: $id) {\n quote {\n ...QuoteContext_QuoteFragment\n id\n }\n errors\n }\n }\n ",[md]),Id=()=>{const n=oe(),e=a.useQueryClient();return{setQuoteQueryData:(t,i)=>{e.setQueryData(z({id:t,objectName:"editingQuote",token:n}),i)}}},Ld=()=>{const n=oe(),{apiHost:t}=e.useContext(te),{setQuoteQueryData:i}=Id(),{mutate:o,isPending:r}=a.useMutation({mutationKey:Do,mutationFn:async({quoteId:e})=>await(async({quoteId:n,apiHost:e,token:t})=>{var i;return null===(i=(await In(Sd,{apiHost:e,token:t},{id:n})).quoteRecalculateTaxes)||void 0===i?void 0:i.quote})({quoteId:e,apiHost:t,token:n}),onSuccess:n=>{if(!(null==n?void 0:n.id))throw new Error("Quote ID is undefined");i(null==n?void 0:n.id,n)}});return{quoteRecalculateTaxesMutation:o,isRecalculatingTaxes:r}};function Pd({children:t}){var i;const o=Rl(),[r,s]=e.useState(),[l,u]=e.useState(!1),d=oe(),{isFeatureAddonsLoading:c,addFeatureAddonLoading:p,removeFeatureAddonLoading:m}=function(){const[n,t]=e.useState([]);return{isFeatureAddonsLoading:n.length>0,addFeatureAddonLoading:e=>{t([...n,e])},removeFeatureAddonLoading:e=>{t(n.filter(n=>n!==e))}}}(),{quoteRecalculateTaxesMutation:y,isRecalculatingTaxes:g}=Ld(),{quote:b,isQuotePending:h}=fd({maskedUpgradingSubscription:o,selectedPriceList:r,token:d}),v=Jn(md,b),f=function(n){const e=oe(),t=a.useIsFetching({queryKey:z({objectName:"editingQuote",id:null!=n?n:"",token:e})});return Boolean(n)&&t>0}(null!==(i=null==v?void 0:v.id)&&void 0!==i?i:void 0),x=To()>0,C=f||x,{quantityEditableCharges:w}=gd({upgradingSubscription:o,pricelistId:null==r?void 0:r.id,quote:v}),{onChangeQuantity:j,getFeatureQuantity:S}=jd({quantityEditableCharges:w});return n.jsx(Ou,{value:w,children:n.jsx(Vu.Provider,{value:{quote:v,selectedPriceList:r,isQuotePending:h,isUpdatingQuote:C,isRecalculatingTaxes:g,isAddonPlanLoading:l,setIsAddonPlanLoading:u,isFeatureAddonsLoading:c,addFeatureAddonLoading:p,removeFeatureAddonLoading:m,onClearQuote:function(){s(void 0)},onChangeSelectedPriceList:function(n){s(n)},onChangeQuantity:j,getFeatureQuantity:S,onRecalculateTaxes:n=>y({quoteId:n})},children:t})})}const[kd,Nd]=hn(),Fd=ne("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[md]),Dd=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;return null===(l=(await In(Fd,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o})).quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},Td=ne("\n mutation QuoteChargeUpdate($quoteChargeId: ID!, $quantity: Int) {\n quoteChargeUpdate(quoteChargeId: $quoteChargeId, quantity: $quantity) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n errors\n }\n }\n ",[md]),qd=ne("\n mutation QuoteChargeDelete($quoteChargeId: ID!) {\n quoteChargeDelete(quoteChargeId: $quoteChargeId) {\n errors\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n }\n ",[md]),Ad=async({quoteChargeId:n,token:e,apiHost:t})=>{var i;return null===(i=(await In(qd,{apiHost:t,token:e},{quoteChargeId:n})).quoteChargeDelete)||void 0===i?void 0:i.quoteCharge},Md=Q(),Hd=ne("\n fragment useChargeCRUD_SubscriptionFragment on Subscription {\n currentCharges {\n quantity\n priceListCharge {\n id\n }\n }\n }\n"),Ed=({priceListChargeId:n,featureId:t})=>{const i=oe(),{apiHost:o}=e.useContext(te),{setQuoteQueryData:r}=Id(),s=Rl(),{quote:l,selectedPriceList:d,getFeatureQuantity:c}=e.useContext(Vu),p=Zu(),m=Jn(Gu,l),y=Jn(Hd,s),g=Ku({quoteChanges:null==m?void 0:m.quoteChanges,selectedPriceListId:null==d?void 0:d.id}),{mutate:b}=a.useMutation({mutationKey:Fo,mutationFn:async({quoteChargeId:n,quantity:e})=>{if(!i)throw Md("Token is undefined when updating quote charge"),new Error("Token is undefined when updating quote charge");if(!p)throw Md("Quantity editable charges are undefined"),new Error("Quantity editable charges are undefined");return await(async(n,e,t,i)=>{var a;return null===(a=(await In(Td,{apiHost:t,token:i},{quoteChargeId:n,quantity:e})).quoteChargeUpdate)||void 0===a?void 0:a.quoteCharge})(n,e,o,i)},onSuccess:n=>{if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");r(m.id,n.quoteChange.quote)}}),{mutate:h}=a.useMutation({mutationKey:Fo,mutationFn:Dd,onSuccess:n=>{if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");r(m.id,n.quoteChange.quote)}}),{mutate:v}=a.useMutation({mutationKey:Fo,mutationFn:async n=>{if(!i)throw Md("Token is undefined when deleting quote charge"),new Error("Token is undefined when deleting quote charge");return await Ad({quoteChargeId:n,token:i,apiHost:o})},onSuccess:n=>{var e;if(!(null==m?void 0:m.id))throw new Error("Quote ID is undefined");const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!t)throw new Error("Quote is undefined");r(m.id,t)}}),f=e.useCallback(u.debounce(e=>{var t,a,r,s,l;const u=null===(t=null==m?void 0:m.quoteChanges)||void 0===t?void 0:t.flatMap(n=>n.charges),d=null==u?void 0:u.find(e=>{var t;return(null===(t=null==e?void 0:e.priceListCharge)||void 0===t?void 0:t.id)===n}),c=null==d?void 0:d.quantity;if(void 0!==c&&c===e)return;const p=null!==(r=null===(a=null==y?void 0:y.currentCharges)||void 0===a?void 0:a.find(e=>{var t;return(null===(t=e.priceListCharge)||void 0===t?void 0:t.id)===n}))&&void 0!==r?r:void 0,f=null!==(s=null==p?void 0:p.quantity)&&void 0!==s?s:null;if(d){const n=d.id;if(!n)return void Md("Quote charge ID is undefined");const t=null!==(l=null==p?void 0:p.quantity)&&void 0!==l?l:0;if(c&&t+c===e)return;return void(null!==f&&e===f?v(n):b({quoteChargeId:n,quantity:e}))}if(p){if(null!==f&&e===f)return;if(!(null==m?void 0:m.startDate))return void Md("Quote start date is undefined");const t=null==g?void 0:g.id;if(!t)return void Md("Quote change ID is undefined");h({apiHost:o,token:i,priceListChargeId:n,quantity:e,quoteChangeId:t,startDate:m.startDate})}},1e3),[o,n,null==m?void 0:m.id,null==m?void 0:m.startDate,g,h,b,v,y,i]);e.useEffect(()=>{if(!t)return void Md("Feature ID is undefined");const e=c(t,n);void 0!==e&&f(e)},[null==g?void 0:g.id]),e.useEffect(()=>()=>{f.cancel()},[]);return{onQuantityChange:e.useCallback(n=>{f(n)},[f])}},{Text:Qd}=i.Typography,$d=({disabled:t,priceListCharge:a,quantity:o,onQuantityChanged:r})=>{var s,l,u,d;const c=Jn(sd,a),{onQuantityChange:p}=Ed({priceListChargeId:c.id,featureId:null===(s=c.feature)||void 0===s?void 0:s.id}),[m,y]=e.useState(!1),g=H();return e.useEffect(()=>{setTimeout(()=>{y(!0)},1e3),setTimeout(()=>{y(!1)},6e3)},[]),n.jsxs(Qd,{className:"bunny-flex bunny-items-center bunny-gap-2 "+(g?"bunny-justify-between":""),children:[n.jsx(_d,{chargeName:c.name}),n.jsx(i.Tooltip,{onOpenChange:y,open:m,title:"Change quantity here",styles:{body:{paddingTop:"0.75rem",paddingBottom:"0.75rem"}},children:n.jsx(i.Input,{id:`${null===(l=c.name)||void 0===l?void 0:l.toLowerCase().replace(/ /g,"-")}-quantity-input`,className:g?"text-right":"",disabled:t,onChange:n=>{r(Number(n.target.value)),p(Number(n.target.value))},min:null!==(u=null==c?void 0:c.quantityMin)&&void 0!==u?u:void 0,max:null!==(d=null==c?void 0:c.quantityMax)&&void 0!==d?d:void 0,style:{minWidth:"120px"},type:"number",value:o,required:!0})})]})},_d=({chargeName:e})=>n.jsx(Qd,{className:"bunny-text-slate-500 bunny-font-medium bunny-text-nowrap",style:{fontSize:"11px"},children:e.toUpperCase()}),Rd=({selectedPriceList:t,handlePortalErrors:i,onCheckoutSuccess:o})=>{const{isInPreviewMode:r}=ns(),{quote:s,onRecalculateTaxes:l,isFeatureAddonsLoading:u,isUpdatingQuote:d,isRecalculatingTaxes:c,onChangeQuantity:p,getFeatureQuantity:m}=e.useContext(Vu),y=Zu(),g=Jn(td,s),[b,h]=e.useState(!1),v=oe(),f=$(),x=a.useQueryClient(),C=H();return n.jsxs("div",{className:`bunny-plan-picker-checkout-bar bunny-flex ${C?"bunny-flex-col bunny-gap-4":"bunny-flex-row"} bunny-my-4 bunny-justify-between`,children:[n.jsx("div",{className:(C?"bunny-flex bunny-flex-col":"bunny-flex bunny-flex-wrap")+" bunny-gap-4 bunny-min-w-0",children:null==y?void 0:y.map((e,t)=>{var i,a;const o=Jn(ld,e),s=null==o?void 0:o.featureAddon,l=(null===(i=null==o?void 0:o.feature)||void 0===i?void 0:i.id)?m(null===(a=null==o?void 0:o.feature)||void 0===a?void 0:a.id,o.id):void 0,d=Boolean(!g||s&&u||void 0===l);return n.jsx($d,{disabled:d,priceListCharge:o,quantity:l,onQuantityChanged:n=>{r||p(o.id,n)}},t)})}),n.jsx("div",{className:"bunny-shrink-0",children:n.jsx(ed,{onClickCheckout:function(){h(!0)},selectedPriceList:t})}),n.jsx(nu,{onCancel:()=>h(!1),onFail:n=>null==i?void 0:i(n),onSuccess:()=>{x.refetchQueries({queryKey:W({pluralType:"subscriptions",token:v})}),x.invalidateQueries({queryKey:W({pluralType:"upgradeSubscriptions",token:v})}),x.invalidateQueries({queryKey:W({pluralType:"hasActiveSubscriptions",token:v})}),x.invalidateQueries({queryKey:tn({token:v})}),h(!1),f("Your subscription has been created","Checkout successful"),o()},onRecalculateTaxes:l,open:b,quote:g,token:v,isUpdatingQuote:d,isRecalculatingTaxes:c})]})},Bd=ne("\n fragment priceListChargePriceDescription_PriceListChargeFragment on PriceListCharge {\n showPriceAsMonthly\n billingPeriod\n feature {\n unitName\n }\n }\n");function Ud(n){var e;const t=Jn(Bd,n),i=t.billingPeriod,a=i?F[i]:null,o=null===(e=t.feature)||void 0===e?void 0:e.unitName;return"ONCE"===i?"One-time":`Per ${o?`${o} / `:""}${t.showPriceAsMonthly?"month":a}`}const Vd=ne("\n fragment getPriceListUnitName_PriceListFragment on PriceList {\n charges {\n chargeType\n featureAddon\n deprecated\n feature {\n unitName\n }\n }\n }\n ",[]);const Od=ne("\n fragment priceDescriptionString_PriceListFragment on PriceList {\n showPriceAsMonthly\n periodMonths\n ...getPriceListUnitName_PriceListFragment\n }\n ",[Vd]);function Zd(n){const e=Jn(Od,n),t=ao(e.periodMonths),i=t?F[t]:null,a=function(n){var e,t,i;const a=null===(e=Jn(Vd,n).charges)||void 0===e?void 0:e.filter(n=>!n.deprecated&&!n.featureAddon),o=null==a?void 0:a.filter(n=>"RECURRING"===n.chargeType),r=null==a?void 0:a.filter(n=>"USAGE"===n.chargeType);return 1===(null==o?void 0:o.length)?null===(t=o[0].feature)||void 0===t?void 0:t.unitName:1===(null==r?void 0:r.length)?null===(i=r[0].feature)||void 0===i?void 0:i.unitName:null}(e);return 0===e.periodMonths?"One-time":`Per ${a?`${a} / `:""}${e.showPriceAsMonthly?"month":i}`}const{Text:zd}=i.Typography,Kd=ne("\n fragment PriceTierPrice_PriceTierFragment on PriceListChargeTier {\n price\n }\n "),Gd=({currencyId:e,priceDecimals:t,tier:i})=>{const a=Jn(Kd,i);return n.jsx(zd,{className:"bunny-text-white",children:yt(a.price,e,t)})},{Text:Yd}=i.Typography,Wd=ne("\n fragment PriceTierRow_PriceTierFragment on PriceListChargeTier {\n starts\n }\n"),Xd=({tier:e,nextTier:t})=>{const i=Jn(Wd,e),a=Jn(Wd,t),o=(null==a?void 0:a.starts)?`${null==i?void 0:i.starts} - ${a.starts-1}`:`${null==i?void 0:i.starts}+`;return n.jsx(Yd,{className:"bunny-text-white",children:o})},{Text:Jd}=i.Typography,nc=ne("\n fragment ChargePriceTiers_PriceListChargeFragment on PriceListCharge {\n id\n name\n pricingModel\n priceDecimals\n priceListChargeTiers {\n starts\n ...PriceTierRow_PriceTierFragment\n ...PriceTierPrice_PriceTierFragment\n }\n }\n ",[Wd,Kd]),ec=({charge:e,currencyId:t})=>{var i;const a=Jn(nc,e);return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1 bunny-w-full",children:[n.jsx(Jd,{className:"bunny-text-white bunny-font-bold",children:a.name}),n.jsxs(Jd,{className:"bunny-flex bunny-flex-row bunny-text-gray-400 bunny-text-xs/3",children:[tl(a.pricingModel)," pricing -"," ",el(a.pricingModel)]}),n.jsx("div",{style:{maxWidth:"150px",minWidth:"50%",gap:"0.1rem",flexDirection:"column",display:"flex"},children:null===(i=a.priceListChargeTiers)||void 0===i?void 0:i.map((e,i)=>{var o,r,s;return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-justify-between bunny-w-full",children:[n.jsx(Xd,{tier:e,nextTier:null!==(r=null===(o=a.priceListChargeTiers)||void 0===o?void 0:o[i+1])&&void 0!==r?r:null}),n.jsx(Gd,{currencyId:t,priceDecimals:null!==(s=a.priceDecimals)&&void 0!==s?s:0,tier:e})]},e.starts)})})]})},tc=ne("\n fragment ChargeHasPriceTiers_PriceListChargeFragment on PriceListCharge {\n priceListChargeTiers {\n starts\n price\n }\n }\n ");function ic(n){var e;const t=Jn(tc,n);return(null===(e=t.priceListChargeTiers)||void 0===e?void 0:e.length)&&t.priceListChargeTiers.length>1}const ac=(n,e)=>{var t,i;return(null===(t=n.priceListChargeTiers)||void 0===t?void 0:t.length)&&n.priceListChargeTiers.length>0?((n,e)=>{var t,i,a;const o=null===(i=null===(t=n.priceListChargeTiers)||void 0===t?void 0:t[0])||void 0===i?void 0:i.price;return o?yt(o,e,null!==(a=n.priceDecimals)&&void 0!==a?a:0):"DNE"})(n,e):yt(n.basePrice,e,null!==(i=n.priceDecimals)&&void 0!==i?i:0)},oc=ne("\n fragment PricingTooltip_PriceListChargeFragment on PriceListCharge {\n priceListChargeTiers {\n starts\n price\n }\n pricingModel\n feature {\n unitName\n }\n priceDecimals\n basePrice\n name\n ...priceListChargePriceDescription_PriceListChargeFragment\n ...ChargeHasPriceTiers_PriceListChargeFragment\n ...ChargePriceTiers_PriceListChargeFragment\n }\n ",[tc,nc,Bd]),rc=ne("\n fragment PricingTooltip_PriceListFragment on PriceList {\n currencyId\n monthlyBasePrice\n basePrice\n ...priceDescriptionString_PriceListFragment\n }\n ",[Od]),sc=({className:i,priceListCharges:a,currencyId:o})=>{const r=a.map(n=>Jn(oc,n)),s=e.useMemo(()=>n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-3",children:null==r?void 0:r.map((e,t)=>ic(e)?n.jsx(ec,{charge:e,currencyId:o},t):n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-1",children:[n.jsx("div",{className:"bunny-text-white bunny-font-bold",children:e.name}),n.jsxs("div",{className:"bunny-text-gray-400 bunny-text-xs/3",children:[ac(e,o)," ",Ud(e)]})]},t))}),[r,o]);return n.jsx(Ho,{className:`bunny-text-gray-400 bunny-text-sm ${i}`,title:s,children:n.jsx(t.InfoCircleOutlined,{className:"bunny-text-gray-400 ",size:15})})},lc=ne("\n fragment PriceListHasPriceTiers_PriceListFragment on PriceList {\n charges {\n ...ChargeHasPriceTiers_PriceListChargeFragment\n }\n }\n ",[tc]);function uc(n){return!n||/^<[^>]*>(\s*)<\/[^>]*>$/.test(n)}const dc=ne("\n fragment GetActiveCharges_PriceListChargeFragment on PriceListCharge {\n deprecated\n featureAddon\n }\n ");function cc(n){return n.filter(n=>{const e=Jn(dc,n);return!e.deprecated&&!e.featureAddon})}const pc=ne("\n fragment BillingPeriodDescription_PriceListFragment on PriceList {\n periodMonths\n basePrice\n }\n "),mc=({priceList:e})=>{const t=Jn(pc,e),i=ao(t.periodMonths),a=i?Xs[i]:"undefined",o=Boolean((null==t?void 0:t.basePrice)&&t.basePrice>0),r=Boolean(t.periodMonths&&t.periodMonths>1&&o);return n.jsx(n.Fragment,{children:r&&n.jsxs("div",{children:["Billed ",a]})})},{Text:yc}=i.Typography,gc=Vt.div`
144
144
  padding: 0 !important;
145
145
  margin: 0 !important;
146
146
 
@@ -149,17 +149,17 @@
149
149
  padding: 0 !important;
150
150
  margin: 0 !important;
151
151
  }
152
- `,cc=Wn("\n fragment PriceListCardPriceDescription_PriceListFragment on PriceList {\n plan {\n pricingDescription\n }\n charges {\n ...GetActiveCharges_PriceListChargeFragment\n ...PricingTooltip_PriceListChargeFragment\n }\n currencyId\n periodMonths\n ...priceDescriptionString_PriceListFragment\n ...BillingPeriodDescription_PriceListFragment\n ...PriceListHasPriceTiers_PriceListFragment\n }\n ",[_d,sc,ic,oc,nc]),pc=({priceList:e})=>{var t,i;const a=Yn(cc,e),o=rc(null!==(t=a.charges)&&void 0!==t?t:[]),r=(n=>{var e;return null===(e=Yn(ic,n).charges)||void 0===e?void 0:e.some(Xd)})(a)||o.length>1;return a.periodMonths&&a.periodMonths<=0?null:n.jsxs(uc,{className:"bunny-price-list-card-price-description bunny-text-start",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx("div",{children:(null===(i=a.plan)||void 0===i?void 0:i.pricingDescription)&&!ac(a.plan.pricingDescription)?n.jsx(dc,{children:n.jsx(y.Markup,{content:a.plan.pricingDescription})}):Rd(a)}),r&&n.jsx(tc,{priceListCharges:o,currencyId:a.currencyId})]}),n.jsx(lc,{priceList:a})]})},mc=Wn("\n fragment canSubscriptionUpgradeFromTrial_SubscriptionFragment on Subscription {\n state\n plan {\n selfServiceBuy\n }\n }\n "),yc=Wn("\n fragment canSubscriptionUpgradeFromTrialExpired_SubscriptionFragment on Subscription {\n state\n plan {\n selfServiceBuy\n }\n }\n "),gc=Wn("\n fragment PriceListCardButton_PriceListFragment on PriceList {\n id\n plan {\n id\n pricingStyle\n contactUsLabel\n }\n }\n "),bc=Wn("\n fragment PriceListCardButtonUpgradingSubscription_SubscriptionFragment on Subscription {\n plan {\n id\n }\n ...canSubscriptionUpgradeFromTrial_SubscriptionFragment\n ...canSubscriptionUpgradeFromTrialExpired_SubscriptionFragment\n }\n ",[mc,yc]),hc=({disableSelectCurrentPlan:e,isPriceListCurrentSubscription:t,isSelected:a,priceList:o,subscriptionPlan:r})=>{var s,l;const u=Hl(),d=Yn(gc,o),c=Yn(bc,u),p=(null===(s=null==c?void 0:c.plan)||void 0===s?void 0:s.id)===(null===(l=d.plan)||void 0===l?void 0:l.id)&&!t,m=c&&(n=>{var e,t;const i=Yn(mc,n);return(null===(e=i.state)||void 0===e?void 0:e.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL")&&(null===(t=i.plan)||void 0===t?void 0:t.selfServiceBuy)||!1})(c),y=c&&(n=>{var e,t;const i=Yn(yc,n);return(null===(e=i.state)||void 0===e?void 0:e.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL_EXPIRED")&&(null===(t=i.plan)||void 0===t?void 0:t.selfServiceBuy)||!1})(c);return n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-grow bunny-w-full bunny-gap-3",children:n.jsx(i.Button,{className:"bunny-w-full",disabled:e,type:a?"primary":"default",children:(()=>{var n,e;return t&&m?"Upgrade from trial":t&&y?"Upgrade":t?"Current plan":r&&!p?"Subscribed":(null===(n=d.plan)||void 0===n?void 0:n.pricingStyle)===Wn.scalar("PlanPricingStyles","CONTACT_US")?null===(e=d.plan)||void 0===e?void 0:e.contactUsLabel:"Change to"})()})})};const vc=({className:t,text:i})=>{const a=e.useRef(null),o=((n,t)=>{const[i,a]=e.useState(!1);return e.useEffect(()=>{n.current&&a(n.current.scrollWidth>n.current.clientWidth)},[t,n]),!!t&&i})(a,i),r=n.jsx("div",{ref:a,className:`${null!=t?t:""} bunny-min-w-0 bunny-w-full bunny-overflow-x-clip bunny-text-ellipsis truncated-text__inner`,children:n.jsx(y.Markup,{content:i})}),s=n.jsx("div",{className:"bunny-min-w-0 bunny-w-full",children:r});return o?n.jsx(Do,{title:(l=i,l?l.replace(/<[^>]*>/g,"").trim():""),children:r}):s;var l},fc=({description:e,className:t})=>e?n.jsx(vc,{className:`bunny-text-gray-400 bunny-text-sm ${null!=t?t:""}`,text:e}):null,xc=Wn("\n fragment filterDeprecatedCharges_PriceListChargeFragment on PriceListCharge {\n deprecated\n removeOnRenewal\n }\n ");function Cc(n,e){const t=Yn(xc,e);if(n&&n!==Wn.scalar("QuoteChangeKind","SUBSCRIBE")&&n!==Wn.scalar("QuoteChangeKind","REINSTATE")&&n!==Wn.scalar("QuoteChangeKind","RENEW"))return!0;const i=t.deprecated;return i&&n===Wn.scalar("QuoteChangeKind","RENEW")?!t.removeOnRenewal:!i}const wc=Wn("\n fragment GetPrice_PriceListFragment on PriceList {\n showPriceAsMonthly\n monthlyBasePrice\n basePrice\n charges {\n basePrice\n chargeType\n ...filterDeprecatedCharges_PriceListChargeFragment\n ...GetActiveCharges_PriceListChargeFragment\n }\n }\n ",[xc,oc]);function jc(n){var e;const t=Yn(wc,n),i=rc(null!==(e=t.charges)&&void 0!==e?e:[]);return(null==i?void 0:i.every(n=>"USAGE"===n.chargeType))?null==i?void 0:i.reduce((n,e)=>n+e.basePrice,0):t.showPriceAsMonthly?t.monthlyBasePrice:t.basePrice}const Sc=Wn("\n fragment PriceListPriceText_PriceListFragment on PriceList {\n id\n plan {\n id\n pricingStyle\n }\n currencyId\n ...GetPrice_PriceListFragment\n }\n ",[wc]);function Ic({priceList:n}){var e,t,i;const a=Yn(Sc,n),o=jc(a),r=(()=>{var n,e;if((null===(n=a.plan)||void 0===n?void 0:n.pricingStyle)===Wn.scalar("PlanPricingStyles","PRICED")){const n=null===(e=jc(a))||void 0===e?void 0:e.toString().split(".")[1];return n?0===parseInt(n)?0:void 0:0}return 0})();return(null===(e=a.plan)||void 0===e?void 0:e.pricingStyle)&&(null===(t=a.plan)||void 0===t?void 0:t.pricingStyle)!==Wn.scalar("PlanPricingStyles","PRICED")?(null===(i=a.plan)||void 0===i?void 0:i.pricingStyle)===Wn.scalar("PlanPricingStyles","CONTACT_US")?"Custom":"Free":ct(o,a.currencyId,r)}const{Text:Lc}=i.Typography,Pc=Wn("\n fragment PriceListCardPrice_PriceListFragment on PriceList {\n ...PriceListPriceText_PriceListFragment\n }\n ",[Sc]),kc=({className:e,priceList:t})=>{const i=Yn(Pc,t);return n.jsx(Lc,{className:e||"bunny-font-medium bunny-text-3xl bunny-text-gray-900",children:Ic({priceList:i})})},{Text:Nc}=i.Typography,Fc=({planName:e,isPriceListCurrentSubscription:t,trialRemainingDays:a})=>{const{token:o}=i.theme.useToken();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[Boolean(a)&&n.jsx("div",{className:"bunny-font-medium bunny-text-secondary",style:{height:"1rem"},children:t?`Trial ends in ${a} day${1===a?"":"s"}`:" "}),n.jsx(Nc,{className:"bunny-font-medium bunny-text-xl bunny-text-left",style:{color:o.colorPrimary},children:e})]})},Dc=({children:e,noBorder:t})=>{const i=!q()&&!t;return n.jsxs("div",{className:"bunny-flex bunny-flex-col"+(i?" bunny-plan-picker-grid-cell-divider":""),children:[n.jsx("div",{className:"bunny-grow",children:e}),n.jsx("div",{className:"bunny-mt-4"})]})},{Text:Tc}=i.Typography,qc=Wn("\n fragment PriceListCardDesktop_PriceListFragment on PriceList {\n id\n deprecated\n plan {\n id\n pricingStyle\n contactUsUrl\n name\n }\n ...PriceListCardButton_PriceListFragment\n ...PriceListHasPriceTiers_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPriceDescription_PriceListFragment\n }\n ",[gc,ic,Pc,cc]),Ac=({hideButton:e,description:t,disableSelectCurrentPlan:i,isPriceListCurrentSubscription:a,isSelected:o,priceList:r,subscriptionPlan:s,trialRemainingDays:l,noBorder:u,onClickPriceListCard:d})=>{var c,p;const m=Yn(qc,r);return n.jsx(Dc,{noBorder:u,children:n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-4 bunny-px-4 ${i?"":"cursor-pointer"} bunny-box-border`,onClick:()=>{var n,e,t;i||((null===(n=m.plan)||void 0===n?void 0:n.pricingStyle)===Wn.scalar("PlanPricingStyles","CONTACT_US")?window.open(null!==(t=null===(e=m.plan)||void 0===e?void 0:e.contactUsUrl)&&void 0!==t?t:void 0,"_blank"):null==d||d(m))},style:{height:"100%"},children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-8 bunny-h-full bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-start bunny-gap-2",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx(Fc,{isPriceListCurrentSubscription:a,planName:null!==(p=null===(c=m.plan)||void 0===c?void 0:c.name)&&void 0!==p?p:"undefined",trialRemainingDays:l}),m.deprecated&&n.jsx(ea,{color:"orange",children:"Legacy"})]}),n.jsx(Tc,{children:n.jsx(fc,{description:t})})]}),n.jsxs("div",{style:{display:"grid",gridTemplateRows:"auto minmax(40px, auto)",alignItems:"start"},children:[n.jsx(kc,{priceList:m}),n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:n.jsx(pc,{priceList:m})})]})]}),!e&&n.jsx(hc,{disableSelectCurrentPlan:i,isPriceListCurrentSubscription:a,isSelected:o,priceList:m,subscriptionPlan:s})]})})},Mc=({backgroundColor:e,size:t})=>n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shrink-0",style:{width:t,height:t,backgroundColor:e},children:n.jsx("svg",{width:"8",height:"6",viewBox:"0 0 8 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M1.5 2.99992L3.16667 4.66659L6.5 1.33325",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),Hc=Wn("\n fragment PriceListCardMobile_PriceListFragment on PriceList {\n plan {\n name\n }\n ...PriceListCardPriceDescription_PriceListFragment\n ...PriceListCardButton_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardButton_PriceListFragment\n }\n ",[cc,gc,Pc,gc]),Qc=({description:e,isPriceListCurrentSubscription:t,isSelected:i,priceList:a,subscriptionPlan:o,trialRemainingDays:r,disableOnClickPriceListCard:s,onClickPriceListCard:l})=>{var u,d;const{brandColor:c}=bn(),p=Yn(Hc,a);return n.jsxs("div",{className:"bunny-relative bunny-flex bunny-flex-col bunny-border-2 bunny-border-solid bunny-rounded-lg bunny-p-4",onClick:()=>{s||null==l||l(p)},style:{minWidth:"220px",borderColor:i?c:f},children:[i&&n.jsx("div",{className:"bunny-absolute",style:{top:"10px",right:"10px"},children:n.jsx(Mc,{backgroundColor:c,size:"20px"})}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-gap-2",children:[n.jsx(Fc,{isPriceListCurrentSubscription:t,planName:null!==(d=null===(u=p.plan)||void 0===u?void 0:u.name)&&void 0!==d?d:"undefined",trialRemainingDays:r}),n.jsx(fc,{description:e})]}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-gap-2",children:[n.jsx(kc,{priceList:p}),n.jsx(pc,{priceList:p})]}),n.jsx(hc,{disableSelectCurrentPlan:s,isPriceListCurrentSubscription:t,isSelected:i,priceList:p,subscriptionPlan:o})]})]})};Wn("\n fragment hasUnpurchasedAddonPriceLists_PlanFragment on Plan {\n priceLists {\n id\n isVisible\n periodMonths\n }\n }\n ");const Ec=/<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi,$c=Wn("\n fragment PriceListCard_PriceListFragment on PriceList {\n id\n plan {\n description\n id\n }\n ...PriceListCardDesktop_PriceListFragment\n ...PriceListCardMobile_PriceListFragment\n }\n ",[qc,Hc]),_c=({hideButton:e,isSelected:t,priceList:i,subscriptions:a,trialRemainingDays:o,noBorder:r,onClickPriceListCard:s,disableCurrentPlan:l=!1})=>{var u,d,c;const p=q(),m=Hl(),y=Yn($c,i),g=((null!==(d=null===(u=y.plan)||void 0===u?void 0:u.description)&&void 0!==d?d:"")||"").replace(Ec,(n,e)=>e?" & ":"");const b=(null===(c=null==m?void 0:m.priceList)||void 0===c?void 0:c.id)===y.id,h=l,v=null==a?void 0:a.find(n=>{var e,t;return n.plan.id===(null===(e=y.plan)||void 0===e?void 0:e.id)&&n.state!==Wn.scalar("SubscriptionState","CANCELED")&&n.state!==Wn.scalar("SubscriptionState","EXPIRED")&&(null===(t=n.state)||void 0===t?void 0:t.toUpperCase())===Wn.scalar("SubscriptionState","TRIAL_EXPIRED")});return p?n.jsx(Qc,{description:g,isPriceListCurrentSubscription:b,isSelected:t,priceList:y,trialRemainingDays:o,subscriptionPlan:v,disableOnClickPriceListCard:h,onClickPriceListCard:s}):n.jsx(Ac,{hideButton:e,description:g,disableSelectCurrentPlan:h,isPriceListCurrentSubscription:b,isSelected:t,priceList:y,trialRemainingDays:o,subscriptionPlan:v,noBorder:r,onClickPriceListCard:s})},Rc=Wn('\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: "position asc") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n deprecated\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n addon\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n addonPlans {\n id\n priceLists {\n id\n periodMonths\n isVisible\n }\n }\n }\n product {\n id\n }\n charges {\n priceListChargeTiers {\n starts\n price\n }\n deprecated\n removeOnRenewal\n featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n id\n }\n ...PricingTooltip_PriceListChargeFragment\n }\n ...PriceListCard_PriceListFragment\n }\n }\n }\n ',[nc,$c]),Bc=({availableBillingPeriods:e,onChangeBillingPeriod:t,products:a,selectedBillingPeriod:o,selectedProduct:r,onChangeProduct:s})=>{const{secondaryColor:l,brandColor:u}=bn(),d=q(),{isInPreviewMode:c}=Gr();return!e||(null==e?void 0:e.length)<2?null:n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-8",children:[(null==a?void 0:a.length)&&a.length>1&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx("div",{className:"bunny-font-medium bunny-text-xs",style:{color:l},children:"Select product"}),n.jsx(Uc,{brandColor:u,children:n.jsx(i.Radio.Group,{onChange:n=>{c||s(null==a?void 0:a.find(e=>e.id===n.target.value))},value:null==r?void 0:r.id,buttonStyle:"solid",children:n.jsx(i.Space,{className:"bunny-gap-2",children:null==a?void 0:a.map(e=>n.jsx(i.Radio.Button,{value:e.id,children:e.name},e.id))})})})]}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-w-full bunny-gap-2",children:n.jsx(Vc,{className:"bunny-w-full",$isMobile:d,children:n.jsx(i.Radio.Group,{onChange:n=>{t(n.target.value)},value:o,size:"small",buttonStyle:"solid",children:null==e?void 0:e.map((e,t)=>n.jsx(i.Radio.Button,{value:Ja(e),children:Ja(e)},t))})})})]})},Uc=c.div.withConfig({shouldForwardProp:n=>!["brandColor"].includes(n)})`
152
+ `,bc=ne("\n fragment PriceListCardPriceDescription_PriceListFragment on PriceList {\n plan {\n pricingDescription\n }\n charges {\n ...GetActiveCharges_PriceListChargeFragment\n ...PricingTooltip_PriceListChargeFragment\n }\n currencyId\n periodMonths\n ...priceDescriptionString_PriceListFragment\n ...BillingPeriodDescription_PriceListFragment\n ...PriceListHasPriceTiers_PriceListFragment\n }\n ",[Od,pc,lc,dc,oc]),hc=({priceList:e})=>{var t,i;const a=Jn(bc,e),o=cc(null!==(t=a.charges)&&void 0!==t?t:[]),r=(n=>{var e;return null===(e=Jn(lc,n).charges)||void 0===e?void 0:e.some(ic)})(a)||o.length>1;return a.periodMonths&&a.periodMonths<=0?null:n.jsxs(yc,{className:"bunny-price-list-card-price-description bunny-text-start",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx("div",{children:(null===(i=a.plan)||void 0===i?void 0:i.pricingDescription)&&!uc(a.plan.pricingDescription)?n.jsx(gc,{children:n.jsx(g.Markup,{content:a.plan.pricingDescription})}):Zd(a)}),r&&n.jsx(sc,{priceListCharges:o,currencyId:a.currencyId})]}),n.jsx(mc,{priceList:a})]})},vc=ne("\n fragment canSubscriptionUpgradeFromTrial_SubscriptionFragment on Subscription {\n state\n plan {\n selfServiceBuy\n }\n }\n "),fc=ne("\n fragment canSubscriptionUpgradeFromTrialExpired_SubscriptionFragment on Subscription {\n state\n plan {\n selfServiceBuy\n }\n }\n "),xc=ne("\n fragment PriceListCardButton_PriceListFragment on PriceList {\n id\n plan {\n id\n pricingStyle\n contactUsLabel\n }\n }\n "),Cc=ne("\n fragment PriceListCardButtonUpgradingSubscription_SubscriptionFragment on Subscription {\n plan {\n id\n }\n ...canSubscriptionUpgradeFromTrial_SubscriptionFragment\n ...canSubscriptionUpgradeFromTrialExpired_SubscriptionFragment\n }\n ",[vc,fc]),wc=({disableSelectCurrentPlan:e,isPriceListCurrentSubscription:t,isSelected:a,priceList:o,subscriptionPlan:r})=>{var s,l;const u=Rl(),d=Jn(xc,o),c=Jn(Cc,u),p=(null===(s=null==c?void 0:c.plan)||void 0===s?void 0:s.id)===(null===(l=d.plan)||void 0===l?void 0:l.id)&&!t,m=c&&(n=>{var e,t;const i=Jn(vc,n);return(null===(e=i.state)||void 0===e?void 0:e.toUpperCase())===ne.scalar("SubscriptionState","TRIAL")&&(null===(t=i.plan)||void 0===t?void 0:t.selfServiceBuy)||!1})(c),y=c&&(n=>{var e,t;const i=Jn(fc,n);return(null===(e=i.state)||void 0===e?void 0:e.toUpperCase())===ne.scalar("SubscriptionState","TRIAL_EXPIRED")&&(null===(t=i.plan)||void 0===t?void 0:t.selfServiceBuy)||!1})(c);return n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-grow bunny-w-full bunny-gap-3",children:n.jsx(i.Button,{className:"bunny-w-full",disabled:e,type:a?"primary":"default",children:(()=>{var n,e;return t&&m?"Upgrade from trial":t&&y?"Upgrade":t?"Current plan":r&&!p?"Subscribed":(null===(n=d.plan)||void 0===n?void 0:n.pricingStyle)===ne.scalar("PlanPricingStyles","CONTACT_US")?null===(e=d.plan)||void 0===e?void 0:e.contactUsLabel:"Change to"})()})})};const jc=({className:t,text:i})=>{const a=e.useRef(null),o=((n,t)=>{const[i,a]=e.useState(!1);return e.useEffect(()=>{n.current&&a(n.current.scrollWidth>n.current.clientWidth)},[t,n]),!!t&&i})(a,i),r=n.jsx("div",{ref:a,className:`${null!=t?t:""} bunny-min-w-0 bunny-w-full bunny-overflow-x-clip bunny-text-ellipsis truncated-text__inner`,children:n.jsx(g.Markup,{content:i})}),s=n.jsx("div",{className:"bunny-min-w-0 bunny-w-full",children:r});return o?n.jsx(Ho,{title:(l=i,l?l.replace(/<[^>]*>/g,"").trim():""),children:r}):s;var l},Sc=({description:e,className:t})=>e?n.jsx(jc,{className:`bunny-text-gray-400 bunny-text-sm ${null!=t?t:""}`,text:e}):null,Ic=ne("\n fragment filterDeprecatedCharges_PriceListChargeFragment on PriceListCharge {\n deprecated\n removeOnRenewal\n }\n ");function Lc(n,e){const t=Jn(Ic,e);if(n&&n!==ne.scalar("QuoteChangeKind","SUBSCRIBE")&&n!==ne.scalar("QuoteChangeKind","REINSTATE")&&n!==ne.scalar("QuoteChangeKind","RENEW"))return!0;const i=t.deprecated;return i&&n===ne.scalar("QuoteChangeKind","RENEW")?!t.removeOnRenewal:!i}const Pc=ne("\n fragment GetPrice_PriceListFragment on PriceList {\n showPriceAsMonthly\n monthlyBasePrice\n basePrice\n charges {\n basePrice\n chargeType\n ...filterDeprecatedCharges_PriceListChargeFragment\n ...GetActiveCharges_PriceListChargeFragment\n }\n }\n ",[Ic,dc]);function kc(n){var e;const t=Jn(Pc,n),i=cc(null!==(e=t.charges)&&void 0!==e?e:[]);return(null==i?void 0:i.every(n=>"USAGE"===n.chargeType))?null==i?void 0:i.reduce((n,e)=>n+e.basePrice,0):t.showPriceAsMonthly?t.monthlyBasePrice:t.basePrice}const Nc=ne("\n fragment PriceListPriceText_PriceListFragment on PriceList {\n id\n plan {\n id\n pricingStyle\n }\n currencyId\n ...GetPrice_PriceListFragment\n }\n ",[Pc]);function Fc({priceList:n}){var e,t,i;const a=Jn(Nc,n),o=kc(a),r=(()=>{var n,e;if((null===(n=a.plan)||void 0===n?void 0:n.pricingStyle)===ne.scalar("PlanPricingStyles","PRICED")){const n=null===(e=kc(a))||void 0===e?void 0:e.toString().split(".")[1];return n?0===parseInt(n)?0:void 0:0}return 0})();return(null===(e=a.plan)||void 0===e?void 0:e.pricingStyle)&&(null===(t=a.plan)||void 0===t?void 0:t.pricingStyle)!==ne.scalar("PlanPricingStyles","PRICED")?(null===(i=a.plan)||void 0===i?void 0:i.pricingStyle)===ne.scalar("PlanPricingStyles","CONTACT_US")?"Custom":"Free":yt(o,a.currencyId,r)}const{Text:Dc}=i.Typography,Tc=ne("\n fragment PriceListCardPrice_PriceListFragment on PriceList {\n ...PriceListPriceText_PriceListFragment\n }\n ",[Nc]),qc=({className:e,priceList:t})=>{const i=Jn(Tc,t);return n.jsx(Dc,{className:e||"bunny-font-medium bunny-text-3xl bunny-text-gray-900",children:Fc({priceList:i})})},{Text:Ac}=i.Typography,Mc=({planName:e,isPriceListCurrentSubscription:t,trialRemainingDays:a})=>{const{token:o}=i.theme.useToken();return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-4",children:[Boolean(a)&&n.jsx("div",{className:"bunny-font-medium bunny-text-secondary",style:{height:"1rem"},children:t?`Trial ends in ${a} day${1===a?"":"s"}`:" "}),n.jsx(Ac,{className:"bunny-font-medium bunny-text-xl bunny-text-left",style:{color:o.colorPrimary},children:e})]})},Hc=({children:e,noBorder:t})=>{const i=!H()&&!t;return n.jsxs("div",{className:"bunny-flex bunny-flex-col"+(i?" bunny-plan-picker-grid-cell-divider":""),children:[n.jsx("div",{className:"bunny-grow",children:e}),n.jsx("div",{className:"bunny-mt-4"})]})},{Text:Ec}=i.Typography,Qc=ne("\n fragment PriceListCardDesktop_PriceListFragment on PriceList {\n id\n deprecated\n plan {\n id\n pricingStyle\n contactUsUrl\n name\n }\n ...PriceListCardButton_PriceListFragment\n ...PriceListHasPriceTiers_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPriceDescription_PriceListFragment\n }\n ",[xc,lc,Tc,bc]),$c=({hideButton:e,description:t,disableSelectCurrentPlan:i,isPriceListCurrentSubscription:a,isSelected:o,priceList:r,subscriptionPlan:s,trialRemainingDays:l,noBorder:u,onClickPriceListCard:d})=>{var c,p;const m=Jn(Qc,r);return n.jsx(Hc,{noBorder:u,children:n.jsxs("div",{className:`bunny-flex bunny-flex-col bunny-items-start bunny-justify-between bunny-w-full bunny-rounded-md bunny-gap-4 bunny-pt-4 bunny-px-4 ${i?"":"cursor-pointer"} bunny-box-border`,onClick:()=>{var n,e,t;i||((null===(n=m.plan)||void 0===n?void 0:n.pricingStyle)===ne.scalar("PlanPricingStyles","CONTACT_US")?window.open(null!==(t=null===(e=m.plan)||void 0===e?void 0:e.contactUsUrl)&&void 0!==t?t:void 0,"_blank"):null==d||d(m))},style:{height:"100%"},children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-8 bunny-h-full bunny-justify-between",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-start bunny-gap-2",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:[n.jsx(Mc,{isPriceListCurrentSubscription:a,planName:null!==(p=null===(c=m.plan)||void 0===c?void 0:c.name)&&void 0!==p?p:"undefined",trialRemainingDays:l}),m.deprecated&&n.jsx(ra,{color:"orange",children:"Legacy"})]}),n.jsx(Ec,{children:n.jsx(Sc,{description:t})})]}),n.jsxs("div",{style:{display:"grid",gridTemplateRows:"auto minmax(40px, auto)",alignItems:"start"},children:[n.jsx(qc,{priceList:m}),n.jsx("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center",children:n.jsx(hc,{priceList:m})})]})]}),!e&&n.jsx(wc,{disableSelectCurrentPlan:i,isPriceListCurrentSubscription:a,isSelected:o,priceList:m,subscriptionPlan:s})]})})},_c=({backgroundColor:e,size:t})=>n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shrink-0",style:{width:t,height:t,backgroundColor:e},children:n.jsx("svg",{width:"8",height:"6",viewBox:"0 0 8 6",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsx("path",{d:"M1.5 2.99992L3.16667 4.66659L6.5 1.33325",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),Rc=ne("\n fragment PriceListCardMobile_PriceListFragment on PriceList {\n plan {\n name\n }\n ...PriceListCardPriceDescription_PriceListFragment\n ...PriceListCardButton_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardButton_PriceListFragment\n }\n ",[bc,xc,Tc,xc]),Bc=({description:e,isPriceListCurrentSubscription:t,isSelected:i,priceList:a,subscriptionPlan:o,trialRemainingDays:r,disableOnClickPriceListCard:s,onClickPriceListCard:l})=>{var u,d;const{brandColor:c}=fn(),p=Jn(Rc,a);return n.jsxs("div",{className:"bunny-relative bunny-flex bunny-flex-col bunny-border-2 bunny-border-solid bunny-rounded-lg bunny-p-4",onClick:()=>{s||null==l||l(p)},style:{minWidth:"220px",borderColor:i?c:w},children:[i&&n.jsx("div",{className:"bunny-absolute",style:{top:"10px",right:"10px"},children:n.jsx(_c,{backgroundColor:c,size:"20px"})}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-grow bunny-gap-2",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-gap-2",children:[n.jsx(Mc,{isPriceListCurrentSubscription:t,planName:null!==(d=null===(u=p.plan)||void 0===u?void 0:u.name)&&void 0!==d?d:"undefined",trialRemainingDays:r}),n.jsx(Sc,{description:e})]}),n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-items-center bunny-gap-2",children:[n.jsx(qc,{priceList:p}),n.jsx(hc,{priceList:p})]}),n.jsx(wc,{disableSelectCurrentPlan:s,isPriceListCurrentSubscription:t,isSelected:i,priceList:p,subscriptionPlan:o})]})]})};ne("\n fragment hasUnpurchasedAddonPriceLists_PlanFragment on Plan {\n priceLists {\n id\n isVisible\n periodMonths\n }\n }\n ");const Uc=/<br>(?=(?:\s*<[^>]*>)*$)|(<br>)|<[^>]*>/gi,Vc=ne("\n fragment PriceListCard_PriceListFragment on PriceList {\n id\n plan {\n description\n id\n }\n ...PriceListCardDesktop_PriceListFragment\n ...PriceListCardMobile_PriceListFragment\n }\n ",[Qc,Rc]),Oc=({hideButton:e,isSelected:t,priceList:i,subscriptions:a,trialRemainingDays:o,noBorder:r,onClickPriceListCard:s,disableCurrentPlan:l=!1})=>{var u,d,c;const p=H(),m=Rl(),y=Jn(Vc,i),g=((null!==(d=null===(u=y.plan)||void 0===u?void 0:u.description)&&void 0!==d?d:"")||"").replace(Uc,(n,e)=>e?" & ":"");const b=(null===(c=null==m?void 0:m.priceList)||void 0===c?void 0:c.id)===y.id,h=l,v=null==a?void 0:a.find(n=>{var e,t;return n.plan.id===(null===(e=y.plan)||void 0===e?void 0:e.id)&&n.state!==ne.scalar("SubscriptionState","CANCELED")&&n.state!==ne.scalar("SubscriptionState","EXPIRED")&&(null===(t=n.state)||void 0===t?void 0:t.toUpperCase())===ne.scalar("SubscriptionState","TRIAL_EXPIRED")});return p?n.jsx(Bc,{description:g,isPriceListCurrentSubscription:b,isSelected:t,priceList:y,trialRemainingDays:o,subscriptionPlan:v,disableOnClickPriceListCard:h,onClickPriceListCard:s}):n.jsx($c,{hideButton:e,description:g,disableSelectCurrentPlan:h,isPriceListCurrentSubscription:b,isSelected:t,priceList:y,trialRemainingDays:o,subscriptionPlan:v,noBorder:r,onClickPriceListCard:s})},Zc=ne('\n query priceListChangeOptions($subscriptionId: ID, $productId: ID) {\n priceListChangeOptions(subscriptionId: $subscriptionId, productId: $productId) {\n products {\n everythingInPlus\n id\n name\n plansToDisplay\n features(sort: "position asc") {\n description\n id\n isVisible\n kind\n name\n position\n }\n }\n priceLists {\n deprecated\n showPriceAsMonthly\n basePrice\n currencyId\n id\n monthlyBasePrice\n periodMonths\n plan {\n code\n contactUsLabel\n contactUsUrl\n description\n id\n name\n position\n pricingDescription\n pricingStyle\n addon\n planFeatures {\n featureId\n value\n feature {\n name\n }\n }\n addonPlans {\n id\n priceLists {\n id\n periodMonths\n isVisible\n }\n }\n }\n product {\n id\n }\n charges {\n priceListChargeTiers {\n starts\n price\n }\n deprecated\n removeOnRenewal\n featureAddon\n basePrice\n billingPeriod\n chargeType\n id\n name\n priceDecimals\n pricingModel\n quantityMax\n quantityMin\n selfServiceQuantity\n priceList {\n id\n }\n feature {\n name\n unitName\n id\n }\n ...PricingTooltip_PriceListChargeFragment\n }\n ...PriceListCard_PriceListFragment\n }\n }\n }\n ',[oc,Vc]),zc=({availableBillingPeriods:e,onChangeBillingPeriod:t,products:a,selectedBillingPeriod:o,selectedProduct:r,onChangeProduct:s})=>{const{secondaryColor:l,brandColor:u}=fn(),d=H(),{isInPreviewMode:c}=ns();return!e||(null==e?void 0:e.length)<2?null:n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-8",children:[(null==a?void 0:a.length)&&a.length>1&&n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx("div",{className:"bunny-font-medium bunny-text-xs",style:{color:l},children:"Select product"}),n.jsx(Kc,{brandColor:u,children:n.jsx(i.Radio.Group,{onChange:n=>{c||s(null==a?void 0:a.find(e=>e.id===n.target.value))},value:null==r?void 0:r.id,buttonStyle:"solid",children:n.jsx(i.Space,{className:"bunny-gap-2",children:null==a?void 0:a.map(e=>n.jsx(i.Radio.Button,{value:e.id,children:e.name},e.id))})})})]}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-w-full bunny-gap-2",children:n.jsx(Gc,{className:"bunny-w-full",$isMobile:d,children:n.jsx(i.Radio.Group,{onChange:n=>{t(n.target.value)},value:o,size:"small",buttonStyle:"solid",children:null==e?void 0:e.map((e,t)=>n.jsx(i.Radio.Button,{value:ao(e),children:ao(e)},t))})})})]})},Kc=p.div.withConfig({shouldForwardProp:n=>!["brandColor"].includes(n)})`
153
153
  .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked) {
154
154
  border-color: ${n=>n.brandColor?n.brandColor:"black"} !important;
155
155
  color: ${n=>n.brandColor?n.brandColor:"black"} !important;
156
156
  }
157
- `,Vc=c.div`
157
+ `,Gc=p.div`
158
158
  .ant-radio-group {
159
159
  display: flex !important;
160
160
  align-items: center !important;
161
161
  padding: 4px !important;
162
- background-color: ${j} !important;
162
+ background-color: ${L} !important;
163
163
  border-radius: 6px !important;
164
164
  width: ${({$isMobile:n})=>n?"100%":"min-content"} !important;
165
165
  border: none !important;
@@ -184,8 +184,8 @@
184
184
  .ant-radio-button-wrapper::before {
185
185
  display: none !important;
186
186
  }
187
- `,Oc=({availablePriceLists:e,priceListStart:t,setPriceListStart:i,numberOfPlansToDisplay:a})=>n.jsxs("div",{className:"bunny-absolute bunny-flex bunny-gap-1",style:{top:"12px",right:"8px"},children:[t>0&&n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shadow bunny-p-1 bunny-cursor-pointer",onClick:()=>{i(n=>{const e=n-1;return e<0?n:e})},style:{width:"22px",height:"22px"},children:n.jsx(m.FontAwesomeIcon,{icon:p.faChevronLeft})}),t<e.length-a&&n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shadow bunny-p-1 bunny-cursor-pointer",onClick:()=>i(n=>{const t=n+1;return t>=e.length?n:t}),style:{width:"22px",height:"22px"},children:n.jsx(m.FontAwesomeIcon,{icon:p.faChevronRight})})]}),Zc=({priceList:n})=>`Everything in ${n.plan.name}, plus`;function Kc({children:e,className:t,everythingInPlus:i,plansToDisplay:a,style:o}){return n.jsx("div",{className:`${t}`,style:{...o,gridTemplateColumns:i?`repeat(${a}, minmax(120px, 1fr))`:`minmax(auto, 400px) repeat(${a}, minmax(120px, 1fr))`},children:e})}const zc=n=>{const e=[];let t={features:[]};return n.forEach(n=>{n.isVisible&&("GROUP"===n.kind?(t.features.length>0&&e.push(t),t={groupFeature:n,features:[]}):t.features.push(n))}),(t.features.length>0||t.groupFeature)&&e.push(t),0===e.length&&e.push({features:n.filter(n=>n.isVisible)}),e},Gc=({displayPriceLists:e,selectedProduct:t,plansToDisplay:i,hideBorder:a=!1,className:o})=>{const{brandColor:r}=bn(),s=zc((null==t?void 0:t.features)||[]),l=new Map;e.forEach((n,e)=>{var t;n&&(null===(t=n.plan.planFeatures)||void 0===t||t.forEach(n=>{l.has(n.featureId)||l.set(n.featureId,e)}))});const u=s.map(n=>({groupFeature:n.groupFeature,features:n.features.filter(n=>l.has(n.id))})).filter(n=>n.features.length>0),d=n=>n&&!a?" bunny-plan-picker-grid-cell-divider":"";return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-2 ${o}`,children:u.map((t,a)=>{const o=[...Array(i)].map((n,e)=>t.features.filter(n=>l.get(n.id)===e)),s=Math.max(0,...o.map(n=>n.length));return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-pt-2",children:[n.jsx(Kc,{everythingInPlus:!0,plansToDisplay:i,className:"bunny-grid bunny-w-full",children:[...Array(i)].map((i,o)=>{var r;const s=e[o-1];return n.jsxs("div",{className:"bunny-px-2",children:[0===o&&t.groupFeature&&n.jsx("div",{className:"bunny-plan-features-feature-title-group",children:null===(r=t.groupFeature.name)||void 0===r?void 0:r.toUpperCase()}),0===a&&o>0&&s&&n.jsx("div",{className:"bunny-font-medium",style:{fontSize:"13px"},children:Zc({priceList:s})})]},o)})}),n.jsx(Kc,{everythingInPlus:!0,plansToDisplay:i,className:"bunny-feature-group bunny-grid bunny-w-full",children:[...Array(s)].map((t,l)=>[...Array(i)].map((t,i)=>{const u=!!e[i-1],c=o[i][l],p=0===l?"bunny-pt-4":"bunny-pt-2",m=l===s-1?"bunny-pb-4":"bunny-pb-2";return n.jsx("div",{className:`${p} ${m} bunny-px-4 bunny-flex bunny-items-center${d(u)}`,children:c&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1 bunny-text-gray-600",style:{fontSize:"13px"},children:[n.jsx(Mc,{backgroundColor:r,size:"15px"}),c.name]})},`${a}-${l}-${i}`)}))})]},a)})})},Yc=({children:e,isFeatureGroup:t,noBorder:a,rowIndex:o})=>{const{token:r}=i.theme.useToken(),s=(({isFeatureGroup:n,rowIndex:e})=>!n&&e%2==1)({isFeatureGroup:t,rowIndex:o});return n.jsx("div",{className:"bunny-px-4 bunny-py-2"+(a?"":" bunny-plan-picker-grid-cell-divider"),style:s?{backgroundColor:r.colorFillAlter}:void 0,children:e})},Wc=Wn("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n }\n }\n ",[ld]),Xc=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;const u=await wn(Wc,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o});return null===(l=null==u?void 0:u.quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},Jc=(n,t)=>{const{apiHost:i}=e.useContext(Jn),{addFeatureAddonLoading:o,removeFeatureAddonLoading:r}=e.useContext($u),s=te(),{setQuoteQueryData:l}=xd(),u=Yn(Xu,n),d=e.useRef();const{mutate:c,isPending:p}=a.useMutation({mutationKey:Io,mutationFn:Xc,onSuccess:n=>{if(d.current=null==n?void 0:n.id,!(null==u?void 0:u.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");l(null==u?void 0:u.id,null==n?void 0:n.quoteChange.quote)}}),{mutate:m,isPending:y}=a.useMutation({mutationKey:Io,mutationFn:async({quoteChargeId:n})=>await Nd({quoteChargeId:n,token:s,apiHost:i}),onSuccess:n=>{if(d.current=void 0,!(null==u?void 0:u.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");l(null==u?void 0:u.id,null==n?void 0:n.quoteChange.quote)}}),g=p||y;return e.useEffect(()=>{d.current=void 0},[null==u?void 0:u.id]),e.useEffect(()=>(g?o(t.id):r(t.id),()=>{r(t.id)}),[g]),{handleAddFeatureAddon:function(){if(!s)throw new Error("Token is required");if(!u)throw new Error("Editing quote is required");const n=function(n){return null==n?void 0:n.quoteChanges.find(n=>n.kind===qs.UPDATE||n.kind===qs.SUBSCRIBE||n.kind===qs.ACTIVATE)}(u);if(!n)throw new Error("No available quote change for feature add-on");c({quoteChangeId:n.id,priceListChargeId:t.id,startDate:null==u?void 0:u.startDate,apiHost:i,token:s})},handleRemoveFeatureAddon:function(){d.current&&m({quoteChargeId:d.current})},isPending:g,isChecked:!y&&Boolean(d.current||p)}},np=Wn("\n fragment isAddonPurchased_PriceListChargeFragment on PriceListCharge {\n id\n featureAddon\n }\n"),ep=Wn("\n fragment isAddonPurchased_SubscriptionChargeFragment on Subscription {\n id\n charges {\n id\n priceListCharge {\n id\n featureAddon\n }\n }\n }\n");const{Text:tp}=i.Typography,ip=Wn("\n fragment FeatureAddonRow_PriceListFragment on PriceList {\n id\n currencyId\n charges {\n id\n name\n }\n }\n "),ap=Wn("\n fragment FeatureAddonRow_PriceListChargeFragment on PriceListCharge {\n id\n name\n ...isAddonPurchased_PriceListChargeFragment\n ...PricingTooltip_PriceListChargeFragment\n }\n ",[np,nc]);function op({featureAddon:t,priceList:a}){const{quote:o,selectedPriceList:r}=e.useContext($u),s=Yn(ap,t),l=Yn(ip,a),u=Yn(Ju,o),{handleAddFeatureAddon:d,handleRemoveFeatureAddon:c,isPending:p,isChecked:m}=Jc(u,s),y=Hl(),g=(null==r?void 0:r.id)===l.id,b=function(n,e){var t;const i=Yn(np,n),a=Yn(ep,e),o=null===(t=null==a?void 0:a.charges)||void 0===t?void 0:t.filter(n=>{var e;return null===(e=n.priceListCharge)||void 0===e?void 0:e.featureAddon});return!!o&&o.some(n=>{var e;return(null===(e=n.priceListCharge)||void 0===e?void 0:e.id)===i.id})}(s,y),h=!g||b,v=m||b;return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-1",children:[n.jsx(tp,{className:"bunny-flex bunny-text-sm bunny-items-center bunny-gap-1 bunny-text-gray-600",children:s.name}),n.jsx(tc,{priceListCharges:[s],currencyId:l.currencyId})]}),n.jsx(i.Switch,{id:(f=s.name,`feature-addon-switch-${f.toLowerCase().replace(/ /g,"-")}`),size:"small",loading:p,disabled:h||!u,checked:v,onChange:n=>{n?d():c()}})]});var f}const rp=Wn("\n fragment FeatureAddonsList_PriceListFragment on PriceList {\n id\n currencyId\n charges {\n id\n name\n featureAddon\n deprecated\n removeOnRenewal\n ...PricingTooltip_PriceListChargeFragment\n ...FeatureAddonRow_PriceListChargeFragment\n }\n ...PricingTooltip_PriceListFragment\n ...FeatureAddonRow_PriceListFragment\n }\n ",[nc,ec,ap,ip]);function sp({priceList:e}){var t;const i=Yn(rp,e),a=null===(t=null==i?void 0:i.charges)||void 0===t?void 0:t.filter(n=>Cc(void 0,n)).filter(n=>!0===n.featureAddon);return n.jsx(n.Fragment,{children:null==a?void 0:a.map((e,t)=>n.jsx(op,{featureAddon:e,priceList:i},t))})}const lp=Wn("\n fragment PlanFeatureAddons_PriceListFragment on PriceList {\n ...FeatureAddonsList_PriceListFragment\n }\n ",[rp]),up=({displayPriceLists:e,plansToDisplay:t,everythingInPlus:i})=>{const a=e.map(n=>Yn(lp,n)),o=(({availablePriceLists:n})=>{const e=new Set;return n.map(n=>{var t;const i=null===(t=n.plan.planFeatures)||void 0===t?void 0:t.filter(n=>!e.has(n.featureId)&&(e.add(n.featureId),!0));return{...n,plan:{...n.plan,planFeatures:i}}})})({availablePriceLists:a});return n.jsxs(Kc,{className:"bunny-grid bunny-w-full",everythingInPlus:i,plansToDisplay:t,children:[!i&&n.jsx(Yc,{isFeatureGroup:!0,noBorder:!0,rowIndex:0}),[...Array(t)].map((e,t)=>{const i=o[t],r=a[t-1];return i?n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-plan-picker-grid-cell-divider",children:n.jsx(sp,{priceList:i})},t):n.jsx("div",{className:r?"bunny-plan-picker-grid-cell-divider":void 0},t)})]})},{Text:dp}=i.Typography,cp=({isFeatureGroup:e,feature:t})=>{var i;return n.jsx(dp,{className:e?"bunny-plan-features-feature-title-group":"",children:e?null===(i=null==t?void 0:t.name)||void 0===i?void 0:i.toUpperCase():null==t?void 0:t.name})},{Text:pp}=i.Typography,mp=n=>{const e=Number(n);return isNaN(e)||""===n.trim()?n:e.toLocaleString(navigator.language)},yp=({features:t,displayPriceLists:a,plansToDisplay:o,groupIndex:r})=>{const{token:s}=i.theme.useToken();return n.jsx(Kc,{className:"bunny-feature-group bunny-grid bunny-w-full",everythingInPlus:!1,plansToDisplay:o,children:t.map((t,i)=>{const l=i,u="GROUP"===t.kind;return n.jsxs(e.Fragment,{children:[n.jsx(Yc,{isFeatureGroup:u,noBorder:!0,rowIndex:i,children:n.jsx(cp,{isFeatureGroup:u,feature:t})}),[...Array(o)].map((e,o)=>{var d;const c=a[o].plan,p=a[o-1];o+=1;let m=null===(d=null==c?void 0:c.planFeatures)||void 0===d?void 0:d.find(n=>n.featureId===(null==t?void 0:t.id));const y=`${r}-${i}-${o}`;return c?u?n.jsx(Yc,{isFeatureGroup:!0,rowIndex:l},y):n.jsx(Yc,{rowIndex:l,children:n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-text-center",children:m?(null==m?void 0:m.value)?n.jsx(pp,{className:"bunny-text-gray",children:mp(m.value)}):n.jsx(Mc,{backgroundColor:s.colorPrimary,size:"15px"}):n.jsx(pp,{className:"bunny-text-gray",children:"-"})})},y):n.jsx(Yc,{rowIndex:l,noBorder:!Boolean(p)})})]},`${r}-${i}`)})})},gp=({displayPriceLists:e,features:t,plansToDisplay:i})=>{const a=zc(t||[]);return n.jsx("div",{className:"bunny-flex bunny-flex-col",children:null==a?void 0:a.map((t,a)=>{const o=t.groupFeature,r=t.features,s=!!o;return n.jsxs("div",{children:[o?n.jsx("div",{className:"bunny-pt-4 bunny-pb-2 bunny-px-2",children:n.jsx(cp,{isFeatureGroup:s,feature:o})}):n.jsx("div",{className:"bunny-pt-4"}),n.jsx(yp,{features:r,displayPriceLists:e,plansToDisplay:i,groupIndex:a})]},a)})})},bp=c.styled(i.Modal)`
187
+ `,Yc=({availablePriceLists:e,priceListStart:t,setPriceListStart:i,numberOfPlansToDisplay:a})=>n.jsxs("div",{className:"bunny-absolute bunny-flex bunny-gap-1",style:{top:"12px",right:"8px"},children:[t>0&&n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shadow bunny-p-1 bunny-cursor-pointer",onClick:()=>{i(n=>{const e=n-1;return e<0?n:e})},style:{width:"22px",height:"22px"},children:n.jsx(y.FontAwesomeIcon,{icon:m.faChevronLeft})}),t<e.length-a&&n.jsx("div",{className:"bunny-flex bunny-items-center bunny-justify-center bunny-rounded-full bunny-shadow bunny-p-1 bunny-cursor-pointer",onClick:()=>i(n=>{const t=n+1;return t>=e.length?n:t}),style:{width:"22px",height:"22px"},children:n.jsx(y.FontAwesomeIcon,{icon:m.faChevronRight})})]}),Wc=({priceList:n})=>`Everything in ${n.plan.name}, plus`;function Xc({children:e,className:t,everythingInPlus:i,plansToDisplay:a,style:o}){return n.jsx("div",{className:`${t}`,style:{...o,gridTemplateColumns:i?`repeat(${a}, minmax(120px, 1fr))`:`minmax(auto, 400px) repeat(${a}, minmax(120px, 1fr))`},children:e})}const Jc=n=>{const e=[];let t={features:[]};return n.forEach(n=>{n.isVisible&&("GROUP"===n.kind?(t.features.length>0&&e.push(t),t={groupFeature:n,features:[]}):t.features.push(n))}),(t.features.length>0||t.groupFeature)&&e.push(t),0===e.length&&e.push({features:n.filter(n=>n.isVisible)}),e},np=({displayPriceLists:e,selectedProduct:t,plansToDisplay:i,hideBorder:a=!1,className:o})=>{const{brandColor:r}=fn(),s=Jc((null==t?void 0:t.features)||[]),l=new Map;e.forEach((n,e)=>{var t;n&&(null===(t=n.plan.planFeatures)||void 0===t||t.forEach(n=>{l.has(n.featureId)||l.set(n.featureId,e)}))});const u=s.map(n=>({groupFeature:n.groupFeature,features:n.features.filter(n=>l.has(n.id))})).filter(n=>n.features.length>0),d=n=>n&&!a?" bunny-plan-picker-grid-cell-divider":"";return n.jsx("div",{className:`bunny-flex bunny-flex-col bunny-gap-2 ${o}`,children:u.map((t,a)=>{const o=[...Array(i)].map((n,e)=>t.features.filter(n=>l.get(n.id)===e)),s=Math.max(0,...o.map(n=>n.length));return n.jsxs("div",{className:"bunny-flex bunny-flex-col bunny-gap-2 bunny-pt-2",children:[n.jsx(Xc,{everythingInPlus:!0,plansToDisplay:i,className:"bunny-grid bunny-w-full",children:[...Array(i)].map((i,o)=>{var r;const s=e[o-1];return n.jsxs("div",{className:"bunny-px-2",children:[0===o&&t.groupFeature&&n.jsx("div",{className:"bunny-plan-features-feature-title-group",children:null===(r=t.groupFeature.name)||void 0===r?void 0:r.toUpperCase()}),0===a&&o>0&&s&&n.jsx("div",{className:"bunny-font-medium",style:{fontSize:"13px"},children:Wc({priceList:s})})]},o)})}),n.jsx(Xc,{everythingInPlus:!0,plansToDisplay:i,className:"bunny-feature-group bunny-grid bunny-w-full",children:[...Array(s)].map((t,l)=>[...Array(i)].map((t,i)=>{const u=!!e[i-1],c=o[i][l],p=0===l?"bunny-pt-4":"bunny-pt-2",m=l===s-1?"bunny-pb-4":"bunny-pb-2";return n.jsx("div",{className:`${p} ${m} bunny-px-4 bunny-flex bunny-items-center${d(u)}`,children:c&&n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-1 bunny-text-gray-600",style:{fontSize:"13px"},children:[n.jsx(_c,{backgroundColor:r,size:"15px"}),c.name]})},`${a}-${l}-${i}`)}))})]},a)})})},ep=({children:e,isFeatureGroup:t,noBorder:a,rowIndex:o})=>{const{token:r}=i.theme.useToken(),s=(({isFeatureGroup:n,rowIndex:e})=>!n&&e%2==1)({isFeatureGroup:t,rowIndex:o});return n.jsx("div",{className:"bunny-px-4 bunny-py-2"+(a?"":" bunny-plan-picker-grid-cell-divider"),style:s?{backgroundColor:r.colorFillAlter}:void 0,children:e})},tp=ne("\n mutation QuoteChargeCreate(\n $quoteChangeId: ID!\n $startDate: ISO8601Date!\n $endDate: ISO8601Date\n $priceListChargeId: ID\n $subscriptionChargeId: ID\n $price: Float\n $quantity: Int\n ) {\n quoteChargeCreate(\n endDate: $endDate\n price: $price\n priceListChargeId: $priceListChargeId\n quantity: $quantity\n quoteChangeId: $quoteChangeId\n startDate: $startDate\n subscriptionChargeId: $subscriptionChargeId\n ) {\n quoteCharge {\n quoteChange {\n id\n quoteId\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n id\n }\n }\n }\n ",[md]),ip=async({price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o,token:r,apiHost:s})=>{var l;const u=await In(tp,{apiHost:s,token:r},{price:n,priceListChargeId:e,quantity:t,quoteChangeId:i,startDate:a,subscriptionChargeId:o});return null===(l=null==u?void 0:u.quoteChargeCreate)||void 0===l?void 0:l.quoteCharge},ap=(n,t)=>{const{apiHost:i}=e.useContext(te),{addFeatureAddonLoading:o,removeFeatureAddonLoading:r}=e.useContext(Vu),s=oe(),{setQuoteQueryData:l}=Id(),u=Jn(id,n),d=e.useRef();const{mutate:c,isPending:p}=a.useMutation({mutationKey:Fo,mutationFn:ip,onSuccess:n=>{if(d.current=null==n?void 0:n.id,!(null==u?void 0:u.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");l(null==u?void 0:u.id,null==n?void 0:n.quoteChange.quote)}}),{mutate:m,isPending:y}=a.useMutation({mutationKey:Fo,mutationFn:async({quoteChargeId:n})=>await Ad({quoteChargeId:n,token:s,apiHost:i}),onSuccess:n=>{if(d.current=void 0,!(null==u?void 0:u.id))throw new Error("Quote ID is undefined");if(!(null==n?void 0:n.quoteChange.quote))throw new Error("Quote is undefined");l(null==u?void 0:u.id,null==n?void 0:n.quoteChange.quote)}}),g=p||y;return e.useEffect(()=>{d.current=void 0},[null==u?void 0:u.id]),e.useEffect(()=>(g?o(t.id):r(t.id),()=>{r(t.id)}),[g]),{handleAddFeatureAddon:function(){if(!s)throw new Error("Token is required");if(!u)throw new Error("Editing quote is required");const n=function(n){return null==n?void 0:n.quoteChanges.find(n=>n.kind===Qs.UPDATE||n.kind===Qs.SUBSCRIBE||n.kind===Qs.ACTIVATE)}(u);if(!n)throw new Error("No available quote change for feature add-on");c({quoteChangeId:n.id,priceListChargeId:t.id,startDate:null==u?void 0:u.startDate,apiHost:i,token:s})},handleRemoveFeatureAddon:function(){d.current&&m({quoteChargeId:d.current})},isPending:g,isChecked:!y&&Boolean(d.current||p)}},op=ne("\n fragment isAddonPurchased_PriceListChargeFragment on PriceListCharge {\n id\n featureAddon\n }\n"),rp=ne("\n fragment isAddonPurchased_SubscriptionChargeFragment on Subscription {\n id\n charges {\n id\n priceListCharge {\n id\n featureAddon\n }\n }\n }\n");const{Text:sp}=i.Typography,lp=ne("\n fragment FeatureAddonRow_PriceListFragment on PriceList {\n id\n currencyId\n charges {\n id\n name\n }\n }\n "),up=ne("\n fragment FeatureAddonRow_PriceListChargeFragment on PriceListCharge {\n id\n name\n ...isAddonPurchased_PriceListChargeFragment\n ...PricingTooltip_PriceListChargeFragment\n }\n ",[op,oc]);function dp({featureAddon:t,priceList:a}){const{quote:o,selectedPriceList:r}=e.useContext(Vu),s=Jn(up,t),l=Jn(lp,a),u=Jn(ad,o),{handleAddFeatureAddon:d,handleRemoveFeatureAddon:c,isPending:p,isChecked:m}=ap(u,s),y=Rl(),g=(null==r?void 0:r.id)===l.id,b=function(n,e){var t;const i=Jn(op,n),a=Jn(rp,e),o=null===(t=null==a?void 0:a.charges)||void 0===t?void 0:t.filter(n=>{var e;return null===(e=n.priceListCharge)||void 0===e?void 0:e.featureAddon});return!!o&&o.some(n=>{var e;return(null===(e=n.priceListCharge)||void 0===e?void 0:e.id)===i.id})}(s,y),h=!g||b,v=m||b;return n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-flex-wrap bunny-items-center bunny-justify-between bunny-gap-1",children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-1",children:[n.jsx(sp,{className:"bunny-flex bunny-text-sm bunny-items-center bunny-gap-1 bunny-text-gray-600",children:s.name}),n.jsx(sc,{priceListCharges:[s],currencyId:l.currencyId})]}),n.jsx(i.Switch,{id:(f=s.name,`feature-addon-switch-${f.toLowerCase().replace(/ /g,"-")}`),size:"small",loading:p,disabled:h||!u,checked:v,onChange:n=>{n?d():c()}})]});var f}const cp=ne("\n fragment FeatureAddonsList_PriceListFragment on PriceList {\n id\n currencyId\n charges {\n id\n name\n featureAddon\n deprecated\n removeOnRenewal\n ...PricingTooltip_PriceListChargeFragment\n ...FeatureAddonRow_PriceListChargeFragment\n }\n ...PricingTooltip_PriceListFragment\n ...FeatureAddonRow_PriceListFragment\n }\n ",[oc,rc,up,lp]);function pp({priceList:e}){var t;const i=Jn(cp,e),a=null===(t=null==i?void 0:i.charges)||void 0===t?void 0:t.filter(n=>Lc(void 0,n)).filter(n=>!0===n.featureAddon);return n.jsx(n.Fragment,{children:null==a?void 0:a.map((e,t)=>n.jsx(dp,{featureAddon:e,priceList:i},t))})}const mp=ne("\n fragment PlanFeatureAddons_PriceListFragment on PriceList {\n ...FeatureAddonsList_PriceListFragment\n }\n ",[cp]),yp=({displayPriceLists:e,plansToDisplay:t,everythingInPlus:i})=>{const a=e.map(n=>Jn(mp,n)),o=(({availablePriceLists:n})=>{const e=new Set;return n.map(n=>{var t;const i=null===(t=n.plan.planFeatures)||void 0===t?void 0:t.filter(n=>!e.has(n.featureId)&&(e.add(n.featureId),!0));return{...n,plan:{...n.plan,planFeatures:i}}})})({availablePriceLists:a});return n.jsxs(Xc,{className:"bunny-grid bunny-w-full",everythingInPlus:i,plansToDisplay:t,children:[!i&&n.jsx(ep,{isFeatureGroup:!0,noBorder:!0,rowIndex:0}),[...Array(t)].map((e,t)=>{const i=o[t],r=a[t-1];return i?n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4 bunny-plan-picker-grid-cell-divider",children:n.jsx(pp,{priceList:i})},t):n.jsx("div",{className:r?"bunny-plan-picker-grid-cell-divider":void 0},t)})]})},{Text:gp}=i.Typography,bp=({isFeatureGroup:e,feature:t})=>{var i;return n.jsx(gp,{className:e?"bunny-plan-features-feature-title-group":"",children:e?null===(i=null==t?void 0:t.name)||void 0===i?void 0:i.toUpperCase():null==t?void 0:t.name})},{Text:hp}=i.Typography,vp=n=>{const e=Number(n);return isNaN(e)||""===n.trim()?n:e.toLocaleString(navigator.language)},fp=({features:t,displayPriceLists:a,plansToDisplay:o,groupIndex:r})=>{const{token:s}=i.theme.useToken();return n.jsx(Xc,{className:"bunny-feature-group bunny-grid bunny-w-full",everythingInPlus:!1,plansToDisplay:o,children:t.map((t,i)=>{const l=i,u="GROUP"===t.kind;return n.jsxs(e.Fragment,{children:[n.jsx(ep,{isFeatureGroup:u,noBorder:!0,rowIndex:i,children:n.jsx(bp,{isFeatureGroup:u,feature:t})}),[...Array(o)].map((e,o)=>{var d;const c=a[o].plan,p=a[o-1];o+=1;let m=null===(d=null==c?void 0:c.planFeatures)||void 0===d?void 0:d.find(n=>n.featureId===(null==t?void 0:t.id));const y=`${r}-${i}-${o}`;return c?u?n.jsx(ep,{isFeatureGroup:!0,rowIndex:l},y):n.jsx(ep,{rowIndex:l,children:n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-text-center",children:m?(null==m?void 0:m.value)?n.jsx(hp,{className:"bunny-text-gray",children:vp(m.value)}):n.jsx(_c,{backgroundColor:s.colorPrimary,size:"15px"}):n.jsx(hp,{className:"bunny-text-gray",children:"-"})})},y):n.jsx(ep,{rowIndex:l,noBorder:!Boolean(p)})})]},`${r}-${i}`)})})},xp=({displayPriceLists:e,features:t,plansToDisplay:i})=>{const a=Jc(t||[]);return n.jsx("div",{className:"bunny-flex bunny-flex-col",children:null==a?void 0:a.map((t,a)=>{const o=t.groupFeature,r=t.features,s=!!o;return n.jsxs("div",{children:[o?n.jsx("div",{className:"bunny-pt-4 bunny-pb-2 bunny-px-2",children:n.jsx(bp,{isFeatureGroup:s,feature:o})}):n.jsx("div",{className:"bunny-pt-4"}),n.jsx(fp,{features:r,displayPriceLists:e,plansToDisplay:i,groupIndex:a})]},a)})})},Cp=p.styled(i.Modal)`
188
188
  .ant-modal-content {
189
189
  padding: 0 !important;
190
190
  }
191
- `,hp=Wn("\n fragment AddonPlanModal_PriceListFragment on PriceList {\n charges {\n featureAddon\n }\n ...PriceListCard_PriceListFragment\n ...FeatureAddonsList_PriceListFragment\n }\n ",[$c,rp]);function vp({onClose:e,priceList:t}){var a,o;const r=Yn(hp,t),s=null!==(o=null===(a=null==r?void 0:r.charges)||void 0===a?void 0:a.some(n=>n.featureAddon))&&void 0!==o&&o;return r?n.jsx(bp,{open:!!r,onCancel:e,footer:null,centered:!0,children:n.jsxs("div",{className:"bunny-w-full bunny-overflow-hidden",children:[n.jsx(Kc,{className:"bunny-grid bunny-w-full",everythingInPlus:!1,plansToDisplay:1,children:r&&n.jsx(_c,{isSelected:!0,priceList:r,noBorder:!0,hideButton:!0,disableCurrentPlan:!0})}),s&&n.jsxs(n.Fragment,{children:[n.jsx(i.Divider,{className:"bunny-my-0"}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4",children:n.jsx(sp,{priceList:r})})]})]})}):null}const fp=Wn("\n mutation QuoteChangeCreate($quoteId: ID!, $priceListId: ID!, $parentQuoteChangeId: ID!) {\n quoteChangeCreate(\n quoteId: $quoteId\n priceListId: $priceListId\n parentQuoteChangeId: $parentQuoteChangeId\n ) {\n errors\n quoteChange {\n id\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n ",[ld]),xp=async({parentQuoteChangeId:n,priceListId:e,apiHost:t,token:i,quoteId:a})=>(await wn(fp,{apiHost:t,token:i},{parentQuoteChangeId:n,priceListId:e,quoteId:a})).quoteChangeCreate,Cp=Wn("\n mutation QuoteChangeDelete($id: ID!) {\n quoteChangeDelete(id: $id) {\n errors\n quoteChange {\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n ",[ld]),wp=async({id:n,apiHost:e,token:t})=>(await wn(Cp,{apiHost:e,token:t},{id:n})).quoteChangeDelete;const jp=Wn("\n fragment AddonPlanRow_PriceListFragment on PriceList {\n id\n plan {\n description\n name\n pricingDescription\n }\n ...PriceListCardPriceDescription_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPriceDescription_PriceListFragment\n }\n ",[cc,Pc,Pc,cc]);function Sp({addonPriceList:o,selectedPriceList:r,onClickSelect:s,isPurchased:l}){var u,d,c,p,m,y;const g=Yn(jp,o),{quote:b,setIsAddonPlanLoading:h}=e.useContext($u),v=Yn(ed,b),{shadow:f,isInPreviewMode:x}=Gr(),{isPending:C,addedQuoteChange:w,addAddonQuoteChange:j,deleteQuoteChange:S}=((n,t,i,o)=>{const r=te(),s=e.useRef(!1),{apiHost:l}=e.useContext(Jn),{setQuoteQueryData:u}=xd(),d=Yn(nd,n),c=e.useMemo(()=>{var n;return null===(n=null==d?void 0:d.quoteChanges)||void 0===n?void 0:n.find(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===i.id})},[d,i]),{mutate:p,isPending:m}=a.useMutation({mutationKey:Io,mutationFn:xp,onSuccess:n=>{var e;s.current=!0;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!(null==d?void 0:d.id))throw new Error("Updated quote ID not found");if(!t)throw new Error("Updated quote not found");u(null==d?void 0:d.id,t)}}),{mutate:y,isPending:g}=a.useMutation({mutationKey:Io,mutationFn:wp,onSuccess:n=>{var e;s.current=!1;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!(null==d?void 0:d.id))throw new Error("Updated quote ID not found");if(!t)throw new Error("Updated quote not found");u(null==d?void 0:d.id,t)}});return e.useEffect(()=>{o(!(!m&&!g))},[m,g]),e.useEffect(()=>{s.current=!1,o(!1)},[i]),{isPending:m||g||void 0===c,addedQuoteChange:s.current,deleteQuoteChange:function(){var n;const e=null===(n=null==d?void 0:d.quoteChanges)||void 0===n?void 0:n.find(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===t});if(!(null==e?void 0:e.id))throw new Error("Quote change ID not found");y({id:e.id,apiHost:l,token:r})},addAddonQuoteChange:function(){if(!c)throw new Error("Parent quote change not found");if(!(null==d?void 0:d.id))throw new Error("Quote ID not found");if(!c.id)throw new Error("Parent quote change ID not found");p({parentQuoteChangeId:c.id,priceListId:t,apiHost:l,token:r,quoteId:null==d?void 0:d.id})}}})(v,g.id,r,h),I=x||l,L=!ac(null===(u=g.plan)||void 0===u?void 0:u.pricingDescription);return n.jsxs("div",{className:`bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${f?`shadow-${f}`:""} bunny-mb-2`,children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-min-w-0 bunny-flex-1",children:[n.jsx(Ip,{className:"bunny-font-medium bunny-text-center bunny-text-orange-600",children:null===(d=g.plan)||void 0===d?void 0:d.name}),n.jsx("div",{className:"bunny-min-w-0 bunny-flex-1",children:n.jsx(fc,{description:null!==(p=null===(c=g.plan)||void 0===c?void 0:c.description)&&void 0!==p?p:"",className:"bunny-whitespace-nowrap"})})]}),n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-shrink-0",children:[!L&&n.jsx(Ip,{children:n.jsx(kc,{priceList:g,className:"bunny-whitespace-nowrap bunny-text-sm bunny-font-medium bunny-text-gray-900"})}),n.jsx(Ip,{children:n.jsx(pc,{priceList:g})}),n.jsx(Ip,{children:n.jsx(i.Button,{type:"link",onClick:()=>{s()},children:n.jsx(t.InfoCircleOutlined,{})})}),n.jsx(i.Switch,{id:(P=null!==(y=null===(m=g.plan)||void 0===m?void 0:m.name)&&void 0!==y?y:"",`addon-plan-switch-${P.toLowerCase().replace(/ /g,"-")}`),loading:C&&!I,checked:w||l,onChange:n=>{n?j():S()},disabled:I})]})]},g.id);var P}function Ip({children:e,className:t}){return n.jsx("div",{className:`bunny-shrink-0 ${null!=t?t:""}`,children:e})}const Lp=Wn("\n fragment AddonPlans_PlanFragment on Plan {\n id\n name\n priceLists {\n id\n name\n periodMonths\n plan {\n selfServiceBuy\n }\n ...AddonPlanModal_PriceListFragment\n ...AddonPlanRow_PriceListFragment\n }\n }\n ",[hp,jp]),Pp=Wn("\n query PriceList($id: ID!) {\n priceList(id: $id) {\n addonPlans {\n priceLists {\n isVisible\n }\n ...AddonPlans_PlanFragment\n }\n }\n }\n ",[Lp]),{Text:kp}=i.Typography,Np=({selectedPriceList:t,subscriptions:i,selectedBillingPeriod:o,className:r})=>{const[s,l]=e.useState(null),u=Hl(),d=te(),{apiHost:c}=e.useContext(Jn),{data:p}=a.useQuery({queryKey:nn({priceListId:null==t?void 0:t.id,token:d}),queryFn:()=>{if(!(null==t?void 0:t.id))throw new Error("Selected price list ID is required");return(async({token:n,id:e,apiHost:t})=>{var i;const a=await wn(Pp,{apiHost:t,token:n},{id:e}),o=null===(i=null==a?void 0:a.priceList)||void 0===i?void 0:i.addonPlans;return null==o?void 0:o.map(n=>({...n,priceLists:n.priceLists.filter(n=>n.isVisible)}))})({id:null==t?void 0:t.id,token:d,apiHost:c})},enabled:!!(null==t?void 0:t.id)}),m=null==p?void 0:p.map(n=>Yn(Lp,n)),y=m?function(n,e){return e.flatMap(n=>n.priceLists).filter(e=>e.periodMonths===no(n))}(o,m).filter(n=>{var e;return null===(e=n.plan)||void 0===e?void 0:e.selfServiceBuy}):[],g=y.find(n=>n.id===s);return n.jsxs(kp,{className:`bunny-flex bunny-flex-col ${r}`,children:[n.jsx(vp,{onClose:()=>l(null),priceList:g}),y.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-text-xs bunny-font-medium bunny-mb-2",children:"Add-on plans".toUpperCase()}),n.jsx("div",{className:"bunny-flex bunny-flex-col",children:y.map(e=>{var a;const o=null!==(a=function(n){var e,a;if(t.plan.id!==(null===(a=null===(e=null==u?void 0:u.priceList)||void 0===e?void 0:e.plan)||void 0===a?void 0:a.id))return!1;const o=i.find(n=>n.id===(null==u?void 0:u.id)),r=null==o?void 0:o.addonSubscriptions,s=null==r?void 0:r.map(n=>i.find(e=>e.id===n.id)),l=null==s?void 0:s.filter(n=>(null==n?void 0:n.state)!==Wn.scalar("SubscriptionState","CANCELED"));return null==l?void 0:l.some(e=>(null==e?void 0:e.priceList.id)===n.id)}(e))&&void 0!==a&&a;return n.jsx(Sp,{addonPriceList:e,selectedPriceList:t,onClickSelect:()=>l(e.id),isPurchased:o},e.id)})})]})]})},Fp=({availablePriceLists:t,priceListChangeOptions:a,priceListStart:o,selectedPriceList:r,selectedProduct:s,setPriceListStart:l,subscriptions:u,trialRemainingDays:d,selectedBillingPeriod:c,onClickPriceListCard:p})=>{const m=q(),{displayPriceLists:y}=e.useMemo(()=>(({availablePriceLists:n,priceListChangeOptions:e,priceListStart:t,plansToDisplay:i})=>{const a=n.slice(t,t+i);return{availablePriceListsArray:null==a?void 0:a.map(n=>{var t;return null===(t=null==e?void 0:e.priceLists)||void 0===t?void 0:t.find(e=>e.plan.id===n.plan.id)}),displayPriceLists:a}})({availablePriceLists:t,priceListChangeOptions:a,priceListStart:o,plansToDisplay:(null==s?void 0:s.plansToDisplay)||3}),[t,a,o]),g=null==s?void 0:s.everythingInPlus,b=Math.min((null==s?void 0:s.plansToDisplay)||3,t.length),h=y.some(n=>n.charges.filter(n=>Cc(void 0,n)).some(n=>n.featureAddon));return n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsxs("div",{className:"bunny-relative bunny-flex bunny-flex-col bunny-plan-picker-price-list-cards",children:[n.jsx(Oc,{availablePriceLists:t,numberOfPlansToDisplay:b,priceListStart:o,setPriceListStart:l}),n.jsxs(Kc,{className:"bunny-grid bunny-w-full",everythingInPlus:!!g,plansToDisplay:b,children:[!g&&n.jsx(Dc,{noBorder:!0}),[...Array(b)].map((e,t)=>{const i=y[t],a=y[t-1];return i?n.jsx(_c,{onClickPriceListCard:p,isSelected:i.id===(null==r?void 0:r.id),priceList:i,subscriptions:u,trialRemainingDays:d},t):n.jsx(Dc,{noBorder:!Boolean(a)},t)})]}),h&&n.jsxs(n.Fragment,{children:[!m&&n.jsx(i.Divider,{className:"bunny-my-0"}),n.jsx(up,{displayPriceLists:y,plansToDisplay:b,everythingInPlus:!!g})]})]}),g&&n.jsx(Gc,{displayPriceLists:y,plansToDisplay:b,selectedProduct:s,className:"bunny-pt-2"}),!g&&n.jsx(n.Fragment,{children:n.jsx(gp,{displayPriceLists:y,plansToDisplay:b,features:null==s?void 0:s.features})}),r&&c?n.jsx(Np,{className:"bunny-mt-4",selectedPriceList:r,subscriptions:u,selectedBillingPeriod:c}):null]})},{Text:Dp}=i.Typography,Tp=({index:e,planFeature:t})=>{const{brandColor:i}=bn();return"GROUP"===t.feature.kind?n.jsx(Dp,{className:"bunny-font-medium bunny-base-text",children:t.name}):n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(Mc,{backgroundColor:i,size:"15px"}),n.jsx(Dp,{className:"bunny-text-gray-600",children:t.feature.name})]},e)},qp=({availablePriceLists:e,priceListChangeOptions:t,selectedPriceList:i,selectedProduct:a,subscriptions:o,trialRemainingDays:r,onClickPriceListCard:s})=>{var l,u,d,c;const p=null==a?void 0:a.everythingInPlus,m=e.findIndex(n=>n.id===(null==i?void 0:i.id)),y=null===(l=e[m-1])||void 0===l?void 0:l.id,g=null===(u=null==t?void 0:t.priceLists)||void 0===u?void 0:u.find(n=>n.id===y);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-flex bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-xb",style:{flexShrink:0},children:e.map((e,t)=>n.jsx(_c,{isSelected:e.id===(null==i?void 0:i.id),priceList:e,subscriptions:o,trialRemainingDays:r,onClickPriceListCard:s},t))}),n.jsx("div",{className:"bunny-text-slate-500 bunny-pt-5 bunny-pb-4 bunny-shadow-padding-x",children:p&&g?Zc({priceList:g}):"Features"}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-x",children:null===(c=null===(d=null==i?void 0:i.plan)||void 0===d?void 0:d.planFeatures)||void 0===c?void 0:c.map((e,t)=>n.jsx(Tp,{planFeature:e,index:t},t))})]})},Ap=({availablePriceLists:e,priceListChangeOptions:t,priceListStart:i,selectedPriceList:a,selectedProduct:o,setPriceListStart:r,subscriptions:s,selectedBillingPeriod:l,onClickPriceListCard:u})=>{var d,c;const p=q(),m=Hl(),y=null===(d=null==t?void 0:t.priceLists)||void 0===d?void 0:d.find(n=>{var e;return n.id===(null===(e=null==m?void 0:m.plan)||void 0===e?void 0:e.id)}),g=st(null===(c=null==y?void 0:y.plan)||void 0===c?void 0:c.trialEndDate).diff(st(),"days");return p?n.jsx(qp,{availablePriceLists:e,priceListChangeOptions:t,selectedPriceList:a,selectedProduct:o,subscriptions:s,trialRemainingDays:g,onClickPriceListCard:u}):n.jsx(Fp,{availablePriceLists:e,priceListChangeOptions:t,priceListStart:i,selectedPriceList:a,selectedProduct:o,setPriceListStart:r,subscriptions:s,trialRemainingDays:g,selectedBillingPeriod:l,onClickPriceListCard:u})},Mp=Wn("\n fragment createAvailableBillingPeriods_SubscriptionFragment on Subscription {\n priceList {\n plan {\n addon\n }\n periodMonths\n }\n }\n "),Hp=(n,e,t)=>{var i,a,o,r,s;const l=Yn(Mp,t);if(!0===(null===(a=null===(i=null==l?void 0:l.priceList)||void 0===i?void 0:i.plan)||void 0===a?void 0:a.addon))return(null===(o=null==l?void 0:l.priceList)||void 0===o?void 0:o.periodMonths)?[null===(r=null==l?void 0:l.priceList)||void 0===r?void 0:r.periodMonths]:void 0;const u=null===(s=null==n?void 0:n.filter(n=>n.product.id===(null==e?void 0:e.id)))||void 0===s?void 0:s.filter(n=>0!==n.periodMonths).map(n=>n.periodMonths).sort((n,e)=>n-e).filter((n,e,t)=>e===t.indexOf(n));return u},Qp=Q(),Ep=Wn("\n fragment PriceListSelectorUpgradingSubscription_SubscriptionFragment on Subscription {\n priceList {\n id\n periodMonths\n plan {\n id\n addon\n }\n }\n ...createAvailableBillingPeriods_SubscriptionFragment\n }\n ",[Mp]),$p=({arePlanChangeOptionsLoading:t,areSubscriptionsLoading:i,priceListChangeOptions:a,subscriptions:o,onGoBack:r})=>{var s,l,u;const{isInPreviewMode:d}=Gr(),c=Hl(),{selectedPriceList:p,onChangeSelectedPriceList:m,onClearQuote:y}=e.useContext($u),g=Sd(),b=Yn(Ep,c),[h,v]=e.useState(),[f,x]=e.useState(null),[C,w]=e.useState(0),j=e.useMemo(()=>Hp(null==a?void 0:a.priceLists,h,b),[null==a?void 0:a.priceLists,h]),S=!0===(null===(l=null===(s=null==b?void 0:b.priceList)||void 0===s?void 0:s.plan)||void 0===l?void 0:l.addon),I=e.useMemo(()=>{var n;const e=null===(n=null==a?void 0:a.priceLists)||void 0===n?void 0:n.filter(n=>Ja(n.periodMonths)===f&&n.product.id===(null==h?void 0:h.id));return S?(null==e?void 0:e.filter(n=>{var e,t;return n.plan.id===(null===(t=null===(e=null==b?void 0:b.priceList)||void 0===e?void 0:e.plan)||void 0===t?void 0:t.id)}))||[]:e.filter(n=>!0!==n.plan.addon)||[]},[a,f,h]),L=e.useCallback(n=>{var e,t;if(x(n),w(0),p&&n!==Ja(null==p?void 0:p.periodMonths)){const i=((null===(e=null==a?void 0:a.priceLists)||void 0===e?void 0:e.filter(e=>Ja(e.periodMonths)===n))||[]).find(e=>Ja(e.periodMonths)===n&&e.plan.id===(null==p?void 0:p.plan.id)),o=i&&(null===(t=null==b?void 0:b.priceList)||void 0===t?void 0:t.id)===i.id;i||o?m(i):y()}},[p,a,b]),P=e.useCallback(n=>{const e=Hp(null==a?void 0:a.priceLists,n,b);f&&!(null==e?void 0:e.includes(no(f)))&&L(Ja(void 0!==(null==e?void 0:e[0])?e[0]:1)),v(n)},[a,f,L]),k=null===(u=null==a?void 0:a.products)||void 0===u?void 0:u[0],N=e.useMemo(()=>{var n,e,t;const i=Hp(null==a?void 0:a.priceLists,k,b),o=null==i?void 0:i.includes(no(g));if(g&&o)return g;const r=Ja(null!==(e=null===(n=null==b?void 0:b.priceList)||void 0===n?void 0:n.periodMonths)&&void 0!==e?e:null);return(null==b?void 0:b.priceList)&&r&&(null==i?void 0:i.includes(no(r)))?Ja(b.priceList.periodMonths):Ja(null!==(t=null==i?void 0:i[0])&&void 0!==t?t:null)},[b]);e.useEffect(()=>{t||i||!a||f||h||p||(N&&x(N),k&&v(k))},[x,v,f,t,i,a,p,h]),e.useEffect(()=>{var n;const e=(null===(n=null==a?void 0:a.priceLists)||void 0===n?void 0:n.filter(n=>Ja(n.periodMonths)===N&&n.product.id===(null==k?void 0:k.id)))||[],t=(null==b?void 0:b.priceList)?e.find(n=>{var e;return n.id===(null===(e=null==b?void 0:b.priceList)||void 0===e?void 0:e.id)}):void 0;!t||d||p||m(t)},[d,o,b,f]);const F=e.useCallback(n=>m(n),[d,Qp,m]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-4 bunny-justify-between bunny-items-end bunny-pb-6",children:[n.jsx(Ci,{onClick:r}),n.jsx(Bc,{availableBillingPeriods:j,onChangeBillingPeriod:L,products:null==a?void 0:a.products,selectedBillingPeriod:f,selectedProduct:h,onChangeProduct:P})]}),n.jsx(Ap,{availablePriceLists:I,priceListChangeOptions:a,priceListStart:C,selectedPriceList:p,selectedProduct:h,setPriceListStart:w,subscriptions:o,selectedBillingPeriod:f,onClickPriceListCard:F})]})},_p=({onGoBack:t,areSubscriptionsLoading:i,subscriptions:o})=>{var r;const s=te(),{apiHost:l}=e.useContext(Jn),{isInPreviewMode:u,productId:d}=Gr(),c=Hl(),{data:p,isLoading:m}=a.useQuery({queryKey:Y({subscriptionId:null==c?void 0:c.id,token:s}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t,subscriptionId:i,productId:a})=>{const o=e?void 0:t,r=await wn(Rc,{apiHost:n,token:o},{subscriptionId:i,productId:a}),{priceListChangeOptions:s}=r;return(null==s?void 0:s.priceLists)&&s.priceLists.sort((n,e)=>{var t,i,a,o;return(null!==(i=null===(t=n.plan)||void 0===t?void 0:t.position)&&void 0!==i?i:0)-(null!==(o=null===(a=e.plan)||void 0===a?void 0:a.position)&&void 0!==o?o:0)}),s})({apiHost:l,isInPreviewMode:u,token:s,subscriptionId:null==c?void 0:c.id,productId:d}),enabled:u&&Boolean(d)||Boolean(null==c?void 0:c.id)});return p?n.jsx(n.Fragment,{children:0===(null===(r=null==p?void 0:p.priceLists)||void 0===r?void 0:r.length)?n.jsx(Xr,{message:"There are no plans available"}):n.jsx($p,{arePlanChangeOptionsLoading:m,areSubscriptionsLoading:i,priceListChangeOptions:p,subscriptions:null!=o?o:[],onGoBack:t})}):null},Rp=({isInPreviewMode:e})=>e?n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-w-full bunny-rounded",children:n.jsx(i.Tag,{color:"blue",icon:n.jsx(t.InfoCircleOutlined,{}),className:"bunny-p-1 bunny-text-sm",children:"You are in preview mode. Products, plans and price lists are shown as they will appear to the customer."})}):null,Bp=Wn("\n fragment UpgradingSubscriptionContext_SubscriptionFragment on Subscription {\n id\n state\n priceList {\n id\n plan {\n id\n }\n }\n plan {\n id\n }\n ...SubscriptionsList_SubscriptionFragment\n ...QuoteCheckout_SubscriptionFragment\n ...PriceListSelectorUpgradingSubscription_SubscriptionFragment\n ...PriceListCardButtonUpgradingSubscription_SubscriptionFragment\n ...useQuantityEditableCharges_SubscriptionFragment\n ...useChargeCRUD_SubscriptionFragment\n ...useQuoteQuantities_SubscriptionFragment\n ...isAddonPurchased_SubscriptionChargeFragment\n ...useQuoteCreate_SubscriptionFragment\n }\n ",[jl,Vl,Ep,bc,ud,Dd,hd,ep,md]),Up=Wn("\n query subscriptions {\n subscriptions {\n nodes {\n id\n ...UpgradingSubscriptionContext_SubscriptionFragment\n }\n }\n }\n ",[Bp]),Vp=Q(),Op=({onChangePlanCancel:t,handlePortalErrors:i,onPaymentMethodSaved:o,onPaymentMethodRemoved:r,upgradingSubscriptionId:s,isInPreviewMode:l=!1,productId:u,className:d,shadow:c="md",defaultBillingPeriod:p})=>{var m,y,g;const b=te(),{apiHost:h}=e.useContext(Jn),{data:v,isLoading:f}=a.useQuery({queryKey:z({pluralType:"upgradeSubscriptions",token:b}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t})=>{const i=e?void 0:t;return await wn(Up,{apiHost:n,token:i},{})})({token:b,apiHost:h,isInPreviewMode:l}),enabled:!l,refetchOnMount:"always"}),x=null===(y=null===(m=null==v?void 0:v.subscriptions)||void 0===m?void 0:m.nodes)||void 0===y?void 0:y.find(n=>(null==n?void 0:n.id)===s),C=Yn(Bp,x);return f&&!l?null:C||l?n.jsx(zr,{value:{isInPreviewMode:l,productId:u,className:d,shadow:c},children:n.jsx(Yr,{initialValue:s,children:n.jsx(Ml,{value:C,children:n.jsx(Br,{value:o,children:n.jsx(_r,{value:r,children:n.jsx(jd,{value:p,children:n.jsx(wd,{children:n.jsx(Zp,{onChangePlanCancel:t,handlePortalErrors:i,subscriptions:null===(g=null==v?void 0:v.subscriptions)||void 0===g?void 0:g.nodes,subscriptionsAreLoading:f})})})})})})})}):n.jsx(Xr,{message:"Upgrading subscription not found"})},Zp=({onChangePlanCancel:t,handlePortalErrors:i,subscriptions:a,subscriptionsAreLoading:o})=>{const{isInPreviewMode:r,className:s}=Gr(),{selectedPriceList:l,onClearQuote:u}=e.useContext($u),[d,c]=e.useState(!1),p=e.useRef(null);return e.useEffect(()=>{const n=new IntersectionObserver(([n])=>{c(!n.isIntersecting)},{root:null,rootMargin:"300px 0px -20px 0px",threshold:1}),e=p.current;return e&&n.observe(e),()=>{e&&n.unobserve(e)}},[c,p]),o&&!r?n.jsx(n.Fragment,{children:"nothing returned"}):n.jsxs("div",{className:`${s}`,children:[n.jsx(Rp,{isInPreviewMode:r}),n.jsx(_p,{areSubscriptionsLoading:o,subscriptions:a,onGoBack:()=>{if(r)return Vp("You are in preview mode");u(),null==t||t()}}),n.jsx("div",{ref:p}),n.jsx("div",{className:"bunny-sticky bunny-bottom-4 bunny-transition-[margin] bunny-duration-300 "+(d?"bunny-mx-4":"bunny-mx-0"),children:l&&n.jsx(Hd,{selectedPriceList:l,handlePortalErrors:i,onCheckoutSuccess:()=>null==t?void 0:t()})})]})},Kp=({subscriptions:t,subscriptionsAreLoading:i,handlePortalErrors:o,companyName:r,noSubscriptionsComponent:s,showInactiveSubscriptionsToggle:l,onSubscriptionUpgradeClick:u})=>{const d=te(),{apiHost:c}=e.useContext(Jn),{className:p,isInPreviewMode:m,showInactiveSubscriptions:y,productId:g,shadow:b}=Gr(),h=Ur(),v=Rr(),[f,x]=Wr(),[C,w]=e.useState(!1),[j,S]=e.useState(!1),[I,L]=e.useState(!1),P=null!=y?y:C,k=e.useMemo(()=>null==t?void 0:t.map(n=>Yn(Su,n)),[t]),N=a.useQueryClient(),F=H(),D=q(),T=(()=>{const n=dn();return async(e,t,i)=>{var a;const o=await n("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }",t,i,{subscriptionIds:e});return null===(a=null==o?void 0:o.subscriptions)||void 0===a?void 0:a.nodes}})(),A=a.useMutation({mutationFn:n=>T([n],c,d),onSuccess:()=>{Iu(N,d),F("Subscription canceled")}}),M=e.useMemo(()=>null==k?void 0:k.every(n=>{const e=Yn(Su,n);return"EXPIRED"===(null==e?void 0:e.state)||"TRIAL_EXPIRED"===(null==e?void 0:e.state)||"CANCELED"===(null==e?void 0:e.state)}),[k]),Q=e.useMemo(()=>null==k?void 0:k.some(n=>{const e=Yn(Su,n);return"EXPIRED"===(null==e?void 0:e.state)||"TRIAL_EXPIRED"===(null==e?void 0:e.state)||"CANCELED"===(null==e?void 0:e.state)}),[k]),E=Boolean(l&&Q&&k&&k.length>0);return e.useEffect(()=>{M&&k&&k.length>0?w(!0):w(!1)},[M,k,j]),j||m?n.jsx(Op,{isInPreviewMode:m,productId:g,onChangePlanCancel:()=>{S(!1)},handlePortalErrors:o,upgradingSubscriptionId:f,className:p,shadow:b,onPaymentMethodSaved:h,onPaymentMethodRemoved:v}):i?n.jsx(Hu,{className:p+" bunny-pt-12"}):k?n.jsx(Zr,{value:n=>{A.mutate(n)},children:n.jsx(Vr,{value:n=>{null==u||u(n),x(n),S(!0)},children:n.jsxs("div",{className:p,children:[n.jsx(zp,{title:n.jsx(n.Fragment,{children:D&&E&&n.jsx(qu,{showInactive:P,setShowInactive:w})}),children:!D&&n.jsx(Eu,{inactiveSwitchVisible:E,showInactive:P,setShowInactive:w,setQuantityDrawerOpen:L,subscriptions:k})}),n.jsx(Ll,{companyName:r,showInactive:P,subscriptions:k,subscriptionsAreLoading:i,noSubscriptionsComponent:s}),D&&n.jsx("div",{className:"bunny-pt-4 bunny-pb-2",children:n.jsx(Eu,{inactiveSwitchVisible:E,showInactive:P,setShowInactive:w,setQuantityDrawerOpen:L,subscriptions:k})}),n.jsx(Du,{subscriptions:k,quantityDrawerOpen:I,setQuantityDrawerOpen:L,handlePortalErrors:o})]})})}):null},zp=({children:e,title:t})=>{const i=q();return n.jsxs("div",{className:"bunny-flex bunny-pb-4 "+(i?"bunny-flex-col bunny-gap-2":"bunny-items-center bunny-justify-between bunny-h-8"),children:[t&&n.jsx(Gp,{title:t}),e]})},Gp=({title:e})=>{const{secondaryColor:t}=bn();return n.jsx("div",{className:"bunny-shrink-0",style:{color:t},children:e})},Yp=({onClick:e})=>n.jsx("div",{className:"bunny-border-t bunny-border-gray-200 bunny-p-2",children:n.jsx(i.Button,{type:"text",className:"bunny-w-full bunny-text-left",onClick:e,children:"+ Add new contact"})}),Wp=Wn("\n fragment AccountContactsFragment on Contact {\n id\n email\n firstName\n lastName\n }\n ",[]),Xp=Wn("\n mutation ContactCreate($attributes: ContactAttributes!) {\n contactCreate(attributes: $attributes) {\n contact {\n id\n account {\n contacts {\n ...AccountContactsFragment\n }\n }\n }\n errors\n }\n }\n ",[Wp]),Jp=({open:t,onClose:o,accountId:r,onContactCreated:s})=>{const[l]=i.Form.useForm(),{apiHost:u}=e.useContext(Jn),d=te(),c=M(),p=H(),{setAccountContactsQueryData:m}=(()=>{const n=te(),e=a.useQueryClient();return{setAccountContactsQueryData:(t,i)=>{e.setQueryData(_({accountId:t,token:n}),i)}}})(),{mutate:y,isPending:g}=a.useMutation({mutationFn:n=>(async({attributes:n,apiHost:e,token:t})=>{var i;const a=await wn(Xp,{apiHost:e,token:t},{attributes:n});return null===(i=null==a?void 0:a.contactCreate)||void 0===i?void 0:i.contact})({attributes:n,apiHost:u,token:d}),onSuccess:n=>{var e,t;p("Contact created successfully"),n&&r&&m(r,null!==(t=null===(e=null==n?void 0:n.account)||void 0===e?void 0:e.contacts)&&void 0!==t?t:null),o(),l.resetFields();const i=n?Yn(Wp,n):null;(null==i?void 0:i.id)&&(null==s||s(i.id))}});return n.jsx(i.Modal,{title:"Add new contact",open:t,onCancel:()=>{o(),l.resetFields()},footer:[n.jsx(i.Button,{onClick:()=>{o(),l.resetFields()},children:"Cancel"},"cancel"),n.jsx(i.Button,{type:"primary",loading:g,onClick:()=>{r?l.validateFields().then(n=>{y({email:n.email||null,firstName:n.firstName||null,lastName:n.lastName||null,accountId:r,portalAccess:!0})}):c("Account ID is required to create a contact")},children:"Add contact"},"submit")],children:n.jsxs(i.Form,{form:l,layout:"vertical",className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx(i.Form.Item,{label:"First name",name:"firstName",rules:[{required:!0,message:"First name is required"}],children:n.jsx(i.Input,{placeholder:"Enter first name"})}),n.jsx(i.Form.Item,{label:"Last name",name:"lastName",rules:[{required:!1}],children:n.jsx(i.Input,{placeholder:"Enter last name"})}),n.jsx(i.Form.Item,{label:"Email",name:"email",rules:[{required:!0,message:"Email is required"},{type:"email",message:"Please enter a valid email"}],children:n.jsx(i.Input,{placeholder:"Enter email"})})]})})},nm=Wn("\n query GetAccount($id: ID!) {\n account(id: $id) {\n ...BillingDetailsSection_AccountFragment\n }\n }\n ",[Oo]),em=Wn("\n query GetAccountContacts($accountId: ID!) {\n account(id: $accountId) {\n id\n contacts {\n ...AccountContactsFragment\n }\n }\n }\n ",[Wp]),{Text:tm}=i.Typography;function im({hidePaymentMethodForm:t,countryListFilter:o}){var r,s,l;const[u,d]=e.useState(!1),[c]=i.Form.useForm(),p=i.Form.useWatch([],c),[m,y]=e.useState(!1),[g,b]=e.useState(null),{apiHost:h}=e.useContext(Jn),v=te(),f=q(),x=a.useQueryClient(),C=M(),w=H(),{currentUser:j}=mi(v),S=null===(r=null==j?void 0:j.account)||void 0===r?void 0:r.id,{data:I,isLoading:L}=a.useQuery({queryKey:$({accountId:S,token:v}),queryFn:()=>{if(!S)throw new Error("Account ID is required");return(async({accountId:n,apiHost:e,token:t})=>(await wn(nm,{apiHost:e,token:t},{id:n})).account)({accountId:S,apiHost:h,token:v})},enabled:!!S}),P=Yn(Oo,I),{data:k,isLoading:N}=a.useQuery({queryKey:_({accountId:S,token:v}),queryFn:()=>{if(!S)throw new Error("Account ID is required");return(async({accountId:n,apiHost:e,token:t})=>{var i;return null===(i=(await wn(em,{apiHost:e,token:t},{accountId:n})).account)||void 0===i?void 0:i.contacts})({accountId:S,apiHost:h,token:v})},enabled:!!S}),{mutate:F,isPending:T}=a.useMutation({mutationFn:async n=>{if(!S)throw new Error("Account ID is required");const e=await Ko({accountId:S,attributes:{name:n.name,billingStreet:n.billingStreet,billingCity:n.billingCity,billingZip:n.billingZip,billingState:n.billingState,billingCountry:n.billingCountry,taxNumber:n.taxNumber,billingContactId:n.billingContactId||null,secondaryBillingContactIds:Array.isArray(n.secondaryBillingContactIds)?n.secondaryBillingContactIds:null},token:v,apiHost:h});return x.setQueryData($({accountId:S,token:v}),e),e},onSuccess:()=>{w("Your account details have been saved"),x.invalidateQueries({queryKey:X({token:v})})}});e.useEffect(()=>{P&&c.setFieldsValue({billingStreet:P.billingStreet,billingCity:P.billingCity,billingZip:P.billingZip,billingState:P.billingState,billingCountry:P.billingCountry,billingContactId:P.billingContactId,secondaryBillingContactIds:P.secondaryBillingContactIds,taxNumber:P.taxNumber})},[P]),e.useEffect(()=>{c.validateFields({validateOnly:!0});d((()=>{if(!P)return!1;const n=c.getFieldsValue(),e={billingStreet:P.billingStreet,billingCity:P.billingCity,billingZip:P.billingZip,billingState:P.billingState,billingCountry:P.billingCountry,billingContactId:P.billingContactId,secondaryBillingContactIds:P.secondaryBillingContactIds,taxNumber:P.taxNumber};return Object.keys(e).some(t=>{const i=e[t],a=n[t];return Array.isArray(i)&&Array.isArray(a)?JSON.stringify(null==i?void 0:i.sort())!==JSON.stringify(null==a?void 0:a.sort()):a!==i})})())},[c,p,P]),e.useEffect(()=>{const n=!u;c.validateFields({validateOnly:n})},[u]);const A=e.useMemo(()=>o?D.filter(o):D,[o]),Q=L||N;return n.jsxs("div",{className:""+(f||t?"bunny-w-full":"bunny-w-1/2"),children:[n.jsxs("div",{className:"bunny-px-4",children:[n.jsxs(i.Skeleton,{loading:Q||void 0===P,children:[n.jsx("div",{className:"bunny-mb-2 bunny-pl-1",children:n.jsx(tm,{className:"bunny-font-medium bunny-text-lg",children:(null==P?void 0:P.name)||"No company name"})}),n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-2",form:c,layout:"vertical",disabled:T,autoComplete:"off",children:[n.jsx(i.Form.Item,{label:"Street address",name:"billingStreet",children:n.jsx(i.Input,{})}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{label:"City",name:"billingCity",className:"bunny-flex-1",children:n.jsx(i.Input,{})}),n.jsx(i.Form.Item,{label:"Zipcode",name:"billingZip",className:"bunny-flex-1",children:n.jsx(i.Input,{})})]}),n.jsxs("div",{className:`bunny-flex ${f?"bunny-flex-row bunny-pb-2":"bunny-flex-row"} bunny-gap-4`,children:[n.jsx("div",{className:"bunny-flex-1 bunny-w-1/2",children:n.jsx(i.Form.Item,{label:"State",name:"billingState",children:n.jsx(i.Input,{})})}),n.jsx("div",{className:"bunny-flex-1 bunny-w-1/2",children:n.jsx(i.Form.Item,{label:"Country",name:"billingCountry",children:n.jsx(i.Select,{className:"bunny-w-full",options:A,placeholder:"Select a country",popupMatchSelectWidth:!1,showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})})})]}),n.jsx(i.Form.Item,{label:"Primary billing contact",name:"billingContactId",rules:[{required:!0,message:"Primary billing contact is required"}],children:n.jsx(i.Select,{className:"bunny-w-full",placeholder:"Select a contact",options:null!==(s=null==k?void 0:k.map(n=>{var e;const t=Yn(Wp,n);return{label:(null==t?void 0:t.firstName)?`${t.firstName} ${null!==(e=t.lastName)&&void 0!==e?e:""}`:null==t?void 0:t.email,value:null==t?void 0:t.id}}))&&void 0!==s?s:[],popupRender:e=>n.jsxs(n.Fragment,{children:[e,n.jsx(Yp,{onClick:()=>y(!0)})]})})}),n.jsx(i.Form.Item,{label:"Secondary billing contacts",name:"secondaryBillingContactIds",children:n.jsx(i.Select,{className:"bunny-w-full",mode:"multiple",maxTagCount:"responsive",placeholder:"Select contacts",options:null!==(l=null==k?void 0:k.map(n=>{var e;const t=Yn(Wp,n);return{label:(null==t?void 0:t.firstName)?`${t.firstName} ${null!==(e=t.lastName)&&void 0!==e?e:""}`:null==t?void 0:t.email,value:null==t?void 0:t.id}}))&&void 0!==l?l:[],popupRender:e=>n.jsxs(n.Fragment,{children:[e,n.jsx(Yp,{onClick:()=>{b("secondary"),y(!0)}})]})})}),n.jsx(i.Form.Item,{label:"Tax ID",name:"taxNumber",tooltip:"Tax ID will be printed on quotes and invoices below the account's address",children:n.jsx(i.Input,{})})]})]}),n.jsx(i.Button,{disabled:!u||T||Q,className:"bunny-w-full bunny-mt-4",type:"primary",onClick:async()=>{c.validateFields({validateOnly:!1}).then(async()=>{try{await c.validateFields(),F(c.getFieldsValue())}catch(n){n instanceof Error?C("Failed to update account",n.message):C("Please fill out all required fields")}finally{d(!1)}})},children:"Save"})]}),n.jsx(Jp,{open:m,onClose:()=>{y(!1),b(null)},accountId:S,onContactCreated:n=>{if("primary"===g)c.setFieldValue("billingContactId",n);else if("secondary"===g){const e=c.getFieldValue("secondaryBillingContactIds")||[];e.includes(n)||c.setFieldValue("secondaryBillingContactIds",[...e,n])}b(null)}})]})}const am=()=>q()?n.jsx("div",{className:"bunny-mx-4",children:n.jsx(i.Divider,{})}):n.jsx("div",{children:n.jsx(i.Divider,{className:"bunny-h-full",type:"vertical"})}),om=({hideBillingDetailsForm:e,isUpgradeFromTrial:t,onSavePaymentMethod:i,onPaymentMethodRemoved:a})=>{const o=q(),r=H();return n.jsx("div",{className:(o||e?"bunny-w-full":"bunny-w-1/2 bunny-pt-2")+" bunny-flex bunny-justify-center bunny-px-4",children:n.jsx(vi,{onSavePaymentMethod:n=>{r(t?"Payment method saved! Your trial will automatically convert to a paid subscription.":"Payment method saved successfully!"),null==i||i(n.savedPaymentMethodResponse.paymentMethodId)},onPaymentMethodRemoved:n=>{null==a||a(n.id)}})})};exports.BillingDetails=({countryListFilter:t,hideBillingDetailsForm:i=!1,hidePaymentMethodForm:a=!1,isUpgradeFromTrial:o=!1,style:r,onSavePaymentMethod:s,onPaymentMethodRemoved:l})=>{const u=q(),{darkMode:d}=e.useContext(Jn);return n.jsx("div",{"data-slot":"billing-details-root",className:"bunny-billing-details"+(d?" bunny-billing-details--dark":""),style:r,children:n.jsxs("div",{className:"bunny-flex bunny-py-2 bunny-my-2 "+(u?"bunny-flex-col bunny-space-y-4":"bunny-flex-row"),children:[i?null:n.jsx(im,{hidePaymentMethodForm:a,countryListFilter:t}),i||a?null:n.jsx(am,{}),a?null:n.jsx(om,{hideBillingDetailsForm:i,isUpgradeFromTrial:o,onSavePaymentMethod:s,onPaymentMethodRemoved:l})]})})},exports.BunnyProvider=function({children:e,darkMode:t=!1,queryClient:i,apiHost:a,token:o,onTokenExpired:r,onUserUnavailable:s,onInvalidOrMissingAuthorization:l,suppressUserUnavailableErrorNotification:u=!1,disableErrorNotifications:d=!1,configProviderProps:c}){return n.jsx(hn,{value:{onUserUnavailable:s,onInvalidOrMissingAuthorization:l,suppressUserUnavailableErrorNotification:u,disableErrorNotifications:d},children:n.jsx(ne,{darkMode:t,queryClient:i,apiHost:a,token:o,onTokenExpired:r,configProviderProps:c,children:e})})},exports.Footer=yo,exports.Invoice=Di,exports.MiniCreditCard=we,exports.PaymentForm=vi,exports.Quote=va,exports.Quotes=function({className:t,columns:i=["date","title","amount","download","state"],filter:o,filterQuotes:r,sort:s=(n,e)=>new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime(),noQuotesMessage:u="There are no quotes",onQuoteClick:d,renderQuote:c,searchBarClassName:p,shadow:m="shadow-md",showSearchBar:y=!0,showTitle:g=!0,title:b="Past quotes",style:h,suppressQuoteDisplay:v=!1,useModal:f=!1}){const{apiHost:x}=e.useContext(Jn),C=a.useQueryClient(),[w,j]=e.useState(null),S={columns:i,kindsToShow:void 0,onTransactionClick:function(e){null==d||d(e),j(void 0!==c?c(e):n.jsx(va,{id:null==e?void 0:e.transactionableId,onQuoteAccepted:()=>{C.invalidateQueries({queryKey:B()})}}))},onTransactionDisplayClose:()=>{j(n.jsx(n.Fragment,{}))},transactionComponent:w,transactionStateRenderer:function(e){return n.jsx(ea,{color:(n=>{switch(n){case"ACCEPTED":case"APPROVED":return"green";case"IN_APPROVAL":return"orange";case"REJECTED":return"red";default:return"blue"}})(e),children:l.capitalize(l.startCase(e))})},showSearchBar:y,showTitle:g,title:b,className:t,shadow:m,searchBarClassName:p,useModal:f,suppressTransactionDisplay:v,style:h,noTransactionsMessage:u,filter:o,filterTransactions:r,sortTransactions:s,downloadTransactionLink:n=>`${x}/api/pdf/quote/${n}`,transactionDateType:"createdAt"};return n.jsx(xa.Provider,{value:S,children:n.jsx(Va,{})})},exports.Signup=function({priceListCode:e,enableTrial:t=!1,style:a,defaultFormValues:o,paymentRequiredToAcceptQuote:r,documentTemplateId:s,requiredBillingDetails:l,defaultCouponCode:u}){const[d]=i.Form.useForm(),c={enableTrial:t,paymentRequiredToAcceptQuote:r};return n.jsx(Fr,{children:n.jsx(Tr,{children:n.jsx(Ar,{children:n.jsx(Hr,{value:d,children:n.jsx(Er,{value:c,children:n.jsx(Nr,{children:n.jsx(kr,{priceListCode:e,style:a,defaultFormValues:o,documentTemplateId:s,requiredBillingDetails:l,defaultCouponCode:u})})})})})})})},exports.Subscriptions=({handlePortalErrors:t,companyName:i,isInPreviewMode:o=!1,productId:r,className:s,styles:l={},noSubscriptionsComponent:u,showInactiveSubscriptions:d,showInactiveSubscriptionsToggle:c=!0,onPaymentMethodSaved:p,onPaymentMethodRemoved:m,onSubscriptionUpgradeClick:y})=>{var g,b;const h=te(),{apiHost:v}=e.useContext(Jn),{data:f,isLoading:x}=a.useQuery({queryKey:z({pluralType:"subscriptions",token:h}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t})=>{const i=e?void 0:t;return await wn(Tu,{apiHost:n,token:i},{})})({token:h,apiHost:v,isInPreviewMode:o}),enabled:!o}),C=null===(b=null===(g=null==f?void 0:f.subscriptions)||void 0===g?void 0:g.nodes)||void 0===b?void 0:b.filter(n=>null!==n),w={...{gap:4,shadow:"md",subscriptionProductNameStyle:{fontSize:void 0,fontWeight:void 0}},...l};return n.jsx(zr,{value:{gap:w.gap,shadow:w.shadow,className:s,subscriptionProductNameStyle:w.subscriptionProductNameStyle,productId:r,isInPreviewMode:o,showInactiveSubscriptions:d},children:n.jsx(Yr,{children:n.jsx(Br,{value:p,children:n.jsx(_r,{value:m,children:n.jsx(Kp,{subscriptions:C,subscriptionsAreLoading:x,handlePortalErrors:t,companyName:i,noSubscriptionsComponent:u,showInactiveSubscriptionsToggle:c,onSubscriptionUpgradeClick:y})})})})})},exports.Transactions=function({transactionComponent:t,showSearchBar:i=!0,showTitle:o=!0,title:r="Past transactions",columns:s=["date","title","state","amount","download"],className:l,shadow:u="shadow-md",searchBarClassName:d,useModal:c=!1,onTransactionClick:p,suppressTransactionDisplay:m=!1,kindsToShow:y=[wa.INVOICE,wa.PAYMENT,wa.REFUND,wa.WRITE_OFF],style:g,filter:b,noTransactionsMessage:h,filterTransactions:v,sortTransactions:f=(n,e)=>new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime(),transactionDateType:x="createdAt",hidePaymentForm:C=!1}){const w={showSearchBar:i,showTitle:o,title:r,transactionComponent:t,columns:s,className:l,searchBarClassName:d,shadow:u,useModal:c,onTransactionClick:p,suppressTransactionDisplay:m,kindsToShow:y,style:g,filter:b,noTransactionsMessage:h,filterTransactions:v,sortTransactions:f,transactionDateType:x,hidePaymentForm:C},{apiHost:j}=e.useContext(Jn),S=te(),[I,L]=e.useState(""),P=b||(I.length>0?`filter: "transaction.amount is ${Number(I)}"`:""),{data:k}=a.useQuery({queryKey:["transactions",S,P],queryFn:()=>(async(n,e,t)=>{var i;const a=await cn({query:ja(n),apiHost:e,token:t});return null===(i=null==a?void 0:a.transactions)||void 0===i?void 0:i.nodes})(P,j,S),placeholderData:a.keepPreviousData});return n.jsx(xa.Provider,{value:w,children:n.jsx(Ua,{transactions:k,onSearchValueChanged:L,search:I})})},exports.Upgrade=Op;
191
+ `,wp=ne("\n fragment AddonPlanModal_PriceListFragment on PriceList {\n charges {\n featureAddon\n }\n ...PriceListCard_PriceListFragment\n ...FeatureAddonsList_PriceListFragment\n }\n ",[Vc,cp]);function jp({onClose:e,priceList:t}){var a,o;const r=Jn(wp,t),s=null!==(o=null===(a=null==r?void 0:r.charges)||void 0===a?void 0:a.some(n=>n.featureAddon))&&void 0!==o&&o;return r?n.jsx(Cp,{open:!!r,onCancel:e,footer:null,centered:!0,children:n.jsxs("div",{className:"bunny-w-full bunny-overflow-hidden",children:[n.jsx(Xc,{className:"bunny-grid bunny-w-full",everythingInPlus:!1,plansToDisplay:1,children:r&&n.jsx(Oc,{isSelected:!0,priceList:r,noBorder:!0,hideButton:!0,disableCurrentPlan:!0})}),s&&n.jsxs(n.Fragment,{children:[n.jsx(i.Divider,{className:"bunny-my-0"}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-p-4",children:n.jsx(pp,{priceList:r})})]})]})}):null}const Sp=ne("\n mutation QuoteChangeCreate($quoteId: ID!, $priceListId: ID!, $parentQuoteChangeId: ID!) {\n quoteChangeCreate(\n quoteId: $quoteId\n priceListId: $priceListId\n parentQuoteChangeId: $parentQuoteChangeId\n ) {\n errors\n quoteChange {\n id\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n ",[md]),Ip=async({parentQuoteChangeId:n,priceListId:e,apiHost:t,token:i,quoteId:a})=>(await In(Sp,{apiHost:t,token:i},{parentQuoteChangeId:n,priceListId:e,quoteId:a})).quoteChangeCreate,Lp=ne("\n mutation QuoteChangeDelete($id: ID!) {\n quoteChangeDelete(id: $id) {\n errors\n quoteChange {\n quote {\n ...QuoteContext_QuoteFragment\n }\n }\n }\n }\n ",[md]),Pp=async({id:n,apiHost:e,token:t})=>(await In(Lp,{apiHost:e,token:t},{id:n})).quoteChangeDelete;const kp=ne("\n fragment AddonPlanRow_PriceListFragment on PriceList {\n id\n plan {\n description\n name\n pricingDescription\n }\n ...PriceListCardPriceDescription_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPrice_PriceListFragment\n ...PriceListCardPriceDescription_PriceListFragment\n }\n ",[bc,Tc,Tc,bc]);function Np({addonPriceList:o,selectedPriceList:r,onClickSelect:s,isPurchased:l}){var u,d,c,p,m,y;const g=Jn(kp,o),{quote:b,setIsAddonPlanLoading:h}=e.useContext(Vu),v=Jn(rd,b),{shadow:f,isInPreviewMode:x}=ns(),{isPending:C,addedQuoteChange:w,addAddonQuoteChange:j,deleteQuoteChange:S}=((n,t,i,o)=>{const r=oe(),s=e.useRef(!1),{apiHost:l}=e.useContext(te),{setQuoteQueryData:u}=Id(),d=Jn(od,n),c=e.useMemo(()=>{var n;return null===(n=null==d?void 0:d.quoteChanges)||void 0===n?void 0:n.find(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===i.id})},[d,i]),{mutate:p,isPending:m}=a.useMutation({mutationKey:Fo,mutationFn:Ip,onSuccess:n=>{var e;s.current=!0;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!(null==d?void 0:d.id))throw new Error("Updated quote ID not found");if(!t)throw new Error("Updated quote not found");u(null==d?void 0:d.id,t)}}),{mutate:y,isPending:g}=a.useMutation({mutationKey:Fo,mutationFn:Pp,onSuccess:n=>{var e;s.current=!1;const t=null===(e=null==n?void 0:n.quoteChange)||void 0===e?void 0:e.quote;if(!(null==d?void 0:d.id))throw new Error("Updated quote ID not found");if(!t)throw new Error("Updated quote not found");u(null==d?void 0:d.id,t)}});return e.useEffect(()=>{o(!(!m&&!g))},[m,g]),e.useEffect(()=>{s.current=!1,o(!1)},[i]),{isPending:m||g||void 0===c,addedQuoteChange:s.current,deleteQuoteChange:function(){var n;const e=null===(n=null==d?void 0:d.quoteChanges)||void 0===n?void 0:n.find(n=>{var e;return(null===(e=n.priceList)||void 0===e?void 0:e.id)===t});if(!(null==e?void 0:e.id))throw new Error("Quote change ID not found");y({id:e.id,apiHost:l,token:r})},addAddonQuoteChange:function(){if(!c)throw new Error("Parent quote change not found");if(!(null==d?void 0:d.id))throw new Error("Quote ID not found");if(!c.id)throw new Error("Parent quote change ID not found");p({parentQuoteChangeId:c.id,priceListId:t,apiHost:l,token:r,quoteId:null==d?void 0:d.id})}}})(v,g.id,r,h),I=x||l,L=!uc(null===(u=g.plan)||void 0===u?void 0:u.pricingDescription);return n.jsxs("div",{className:`bunny-flex bunny-flex-row bunny-gap-2 bunny-justify-between bunny-items-center bunny-p-4 bunny-rounded-md bunny-bg-white ${f?`shadow-${f}`:""} bunny-mb-2`,children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-min-w-0 bunny-flex-1",children:[n.jsx(Fp,{className:"bunny-font-medium bunny-text-center bunny-text-orange-600",children:null===(d=g.plan)||void 0===d?void 0:d.name}),n.jsx("div",{className:"bunny-min-w-0 bunny-flex-1",children:n.jsx(Sc,{description:null!==(p=null===(c=g.plan)||void 0===c?void 0:c.description)&&void 0!==p?p:"",className:"bunny-whitespace-nowrap"})})]}),n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-2 bunny-items-center bunny-shrink-0",children:[!L&&n.jsx(Fp,{children:n.jsx(qc,{priceList:g,className:"bunny-whitespace-nowrap bunny-text-sm bunny-font-medium bunny-text-gray-900"})}),n.jsx(Fp,{children:n.jsx(hc,{priceList:g})}),n.jsx(Fp,{children:n.jsx(i.Button,{type:"link",onClick:()=>{s()},children:n.jsx(t.InfoCircleOutlined,{})})}),n.jsx(i.Switch,{id:(P=null!==(y=null===(m=g.plan)||void 0===m?void 0:m.name)&&void 0!==y?y:"",`addon-plan-switch-${P.toLowerCase().replace(/ /g,"-")}`),loading:C&&!I,checked:w||l,onChange:n=>{n?j():S()},disabled:I})]})]},g.id);var P}function Fp({children:e,className:t}){return n.jsx("div",{className:`bunny-shrink-0 ${null!=t?t:""}`,children:e})}const Dp=ne("\n fragment AddonPlans_PlanFragment on Plan {\n id\n name\n priceLists {\n id\n name\n periodMonths\n plan {\n selfServiceBuy\n }\n ...AddonPlanModal_PriceListFragment\n ...AddonPlanRow_PriceListFragment\n }\n }\n ",[wp,kp]),Tp=ne("\n query PriceList($id: ID!) {\n priceList(id: $id) {\n addonPlans {\n priceLists {\n isVisible\n }\n ...AddonPlans_PlanFragment\n }\n }\n }\n ",[Dp]),{Text:qp}=i.Typography,Ap=({selectedPriceList:t,subscriptions:i,selectedBillingPeriod:o,className:r})=>{const[s,l]=e.useState(null),u=Rl(),d=oe(),{apiHost:c}=e.useContext(te),{data:p}=a.useQuery({queryKey:an({priceListId:null==t?void 0:t.id,token:d}),queryFn:()=>{if(!(null==t?void 0:t.id))throw new Error("Selected price list ID is required");return(async({token:n,id:e,apiHost:t})=>{var i;const a=await In(Tp,{apiHost:t,token:n},{id:e}),o=null===(i=null==a?void 0:a.priceList)||void 0===i?void 0:i.addonPlans;return null==o?void 0:o.map(n=>({...n,priceLists:n.priceLists.filter(n=>n.isVisible)}))})({id:null==t?void 0:t.id,token:d,apiHost:c})},enabled:!!(null==t?void 0:t.id)}),m=null==p?void 0:p.map(n=>Jn(Dp,n)),y=m?function(n,e){return e.flatMap(n=>n.priceLists).filter(e=>e.periodMonths===oo(n))}(o,m).filter(n=>{var e;return null===(e=n.plan)||void 0===e?void 0:e.selfServiceBuy}):[],g=y.find(n=>n.id===s);return n.jsxs(qp,{className:`bunny-flex bunny-flex-col ${r}`,children:[n.jsx(jp,{onClose:()=>l(null),priceList:g}),y.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-text-slate-500 bunny-text-xs bunny-font-medium bunny-mb-2",children:"Add-on plans".toUpperCase()}),n.jsx("div",{className:"bunny-flex bunny-flex-col",children:y.map(e=>{var a;const o=null!==(a=function(n){var e,a;if(t.plan.id!==(null===(a=null===(e=null==u?void 0:u.priceList)||void 0===e?void 0:e.plan)||void 0===a?void 0:a.id))return!1;const o=i.find(n=>n.id===(null==u?void 0:u.id)),r=null==o?void 0:o.addonSubscriptions,s=null==r?void 0:r.map(n=>i.find(e=>e.id===n.id)),l=null==s?void 0:s.filter(n=>(null==n?void 0:n.state)!==ne.scalar("SubscriptionState","CANCELED"));return null==l?void 0:l.some(e=>(null==e?void 0:e.priceList.id)===n.id)}(e))&&void 0!==a&&a;return n.jsx(Np,{addonPriceList:e,selectedPriceList:t,onClickSelect:()=>l(e.id),isPurchased:o},e.id)})})]})]})},Mp=({availablePriceLists:t,priceListChangeOptions:a,priceListStart:o,selectedPriceList:r,selectedProduct:s,setPriceListStart:l,subscriptions:u,trialRemainingDays:d,selectedBillingPeriod:c,onClickPriceListCard:p})=>{const m=H(),{displayPriceLists:y}=e.useMemo(()=>(({availablePriceLists:n,priceListChangeOptions:e,priceListStart:t,plansToDisplay:i})=>{const a=n.slice(t,t+i);return{availablePriceListsArray:null==a?void 0:a.map(n=>{var t;return null===(t=null==e?void 0:e.priceLists)||void 0===t?void 0:t.find(e=>e.plan.id===n.plan.id)}),displayPriceLists:a}})({availablePriceLists:t,priceListChangeOptions:a,priceListStart:o,plansToDisplay:(null==s?void 0:s.plansToDisplay)||3}),[t,a,o]),g=null==s?void 0:s.everythingInPlus,b=Math.min((null==s?void 0:s.plansToDisplay)||3,t.length),h=y.some(n=>n.charges.filter(n=>Lc(void 0,n)).some(n=>n.featureAddon));return n.jsxs("div",{className:"bunny-flex bunny-flex-col",children:[n.jsxs("div",{className:"bunny-relative bunny-flex bunny-flex-col bunny-plan-picker-price-list-cards",children:[n.jsx(Yc,{availablePriceLists:t,numberOfPlansToDisplay:b,priceListStart:o,setPriceListStart:l}),n.jsxs(Xc,{className:"bunny-grid bunny-w-full",everythingInPlus:!!g,plansToDisplay:b,children:[!g&&n.jsx(Hc,{noBorder:!0}),[...Array(b)].map((e,t)=>{const i=y[t],a=y[t-1];return i?n.jsx(Oc,{onClickPriceListCard:p,isSelected:i.id===(null==r?void 0:r.id),priceList:i,subscriptions:u,trialRemainingDays:d},t):n.jsx(Hc,{noBorder:!Boolean(a)},t)})]}),h&&n.jsxs(n.Fragment,{children:[!m&&n.jsx(i.Divider,{className:"bunny-my-0"}),n.jsx(yp,{displayPriceLists:y,plansToDisplay:b,everythingInPlus:!!g})]})]}),g&&n.jsx(np,{displayPriceLists:y,plansToDisplay:b,selectedProduct:s,className:"bunny-pt-2"}),!g&&n.jsx(n.Fragment,{children:n.jsx(xp,{displayPriceLists:y,plansToDisplay:b,features:null==s?void 0:s.features})}),r&&c?n.jsx(Ap,{className:"bunny-mt-4",selectedPriceList:r,subscriptions:u,selectedBillingPeriod:c}):null]})},{Text:Hp}=i.Typography,Ep=({index:e,planFeature:t})=>{const{brandColor:i}=fn();return"GROUP"===t.feature.kind?n.jsx(Hp,{className:"bunny-font-medium bunny-base-text",children:t.name}):n.jsxs("div",{className:"bunny-flex bunny-items-center bunny-gap-2",children:[n.jsx(_c,{backgroundColor:i,size:"15px"}),n.jsx(Hp,{className:"bunny-text-gray-600",children:t.feature.name})]},e)},Qp=({availablePriceLists:e,priceListChangeOptions:t,selectedPriceList:i,selectedProduct:a,subscriptions:o,trialRemainingDays:r,onClickPriceListCard:s})=>{var l,u,d,c;const p=null==a?void 0:a.everythingInPlus,m=e.findIndex(n=>n.id===(null==i?void 0:i.id)),y=null===(l=e[m-1])||void 0===l?void 0:l.id,g=null===(u=null==t?void 0:t.priceLists)||void 0===u?void 0:u.find(n=>n.id===y);return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"bunny-flex bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-xb",style:{flexShrink:0},children:e.map((e,t)=>n.jsx(Oc,{isSelected:e.id===(null==i?void 0:i.id),priceList:e,subscriptions:o,trialRemainingDays:r,onClickPriceListCard:s},t))}),n.jsx("div",{className:"bunny-text-slate-500 bunny-pt-5 bunny-pb-4 bunny-shadow-padding-x",children:p&&g?Wc({priceList:g}):"Features"}),n.jsx("div",{className:"bunny-flex bunny-flex-col bunny-gap-4 bunny-overflow-auto bunny-shadow-padding-x",children:null===(c=null===(d=null==i?void 0:i.plan)||void 0===d?void 0:d.planFeatures)||void 0===c?void 0:c.map((e,t)=>n.jsx(Ep,{planFeature:e,index:t},t))})]})},$p=({availablePriceLists:e,priceListChangeOptions:t,priceListStart:i,selectedPriceList:a,selectedProduct:o,setPriceListStart:r,subscriptions:s,selectedBillingPeriod:l,onClickPriceListCard:u})=>{var d,c;const p=H(),m=Rl(),y=null===(d=null==t?void 0:t.priceLists)||void 0===d?void 0:d.find(n=>{var e;return n.id===(null===(e=null==m?void 0:m.plan)||void 0===e?void 0:e.id)}),g=dt(null===(c=null==y?void 0:y.plan)||void 0===c?void 0:c.trialEndDate).diff(dt(),"days");return p?n.jsx(Qp,{availablePriceLists:e,priceListChangeOptions:t,selectedPriceList:a,selectedProduct:o,subscriptions:s,trialRemainingDays:g,onClickPriceListCard:u}):n.jsx(Mp,{availablePriceLists:e,priceListChangeOptions:t,priceListStart:i,selectedPriceList:a,selectedProduct:o,setPriceListStart:r,subscriptions:s,trialRemainingDays:g,selectedBillingPeriod:l,onClickPriceListCard:u})},_p=ne("\n fragment createAvailableBillingPeriods_SubscriptionFragment on Subscription {\n priceList {\n plan {\n addon\n }\n periodMonths\n }\n }\n "),Rp=(n,e,t)=>{var i,a,o,r,s;const l=Jn(_p,t);if(!0===(null===(a=null===(i=null==l?void 0:l.priceList)||void 0===i?void 0:i.plan)||void 0===a?void 0:a.addon))return(null===(o=null==l?void 0:l.priceList)||void 0===o?void 0:o.periodMonths)?[null===(r=null==l?void 0:l.priceList)||void 0===r?void 0:r.periodMonths]:void 0;const u=null===(s=null==n?void 0:n.filter(n=>n.product.id===(null==e?void 0:e.id)))||void 0===s?void 0:s.filter(n=>0!==n.periodMonths).map(n=>n.periodMonths).sort((n,e)=>n-e).filter((n,e,t)=>e===t.indexOf(n));return u},Bp=_(),Up=ne("\n fragment PriceListSelectorUpgradingSubscription_SubscriptionFragment on Subscription {\n priceList {\n id\n periodMonths\n plan {\n id\n addon\n }\n }\n ...createAvailableBillingPeriods_SubscriptionFragment\n }\n ",[_p]),Vp=({arePlanChangeOptionsLoading:t,areSubscriptionsLoading:i,priceListChangeOptions:a,subscriptions:o,onGoBack:r})=>{var s,l,u;const{isInPreviewMode:d}=ns(),c=Rl(),{selectedPriceList:p,onChangeSelectedPriceList:m,onClearQuote:y}=e.useContext(Vu),g=Nd(),b=Jn(Up,c),[h,v]=e.useState(),[f,x]=e.useState(null),[C,w]=e.useState(0),j=e.useMemo(()=>Rp(null==a?void 0:a.priceLists,h,b),[null==a?void 0:a.priceLists,h]),S=!0===(null===(l=null===(s=null==b?void 0:b.priceList)||void 0===s?void 0:s.plan)||void 0===l?void 0:l.addon),I=e.useMemo(()=>{var n;const e=null===(n=null==a?void 0:a.priceLists)||void 0===n?void 0:n.filter(n=>ao(n.periodMonths)===f&&n.product.id===(null==h?void 0:h.id));return S?(null==e?void 0:e.filter(n=>{var e,t;return n.plan.id===(null===(t=null===(e=null==b?void 0:b.priceList)||void 0===e?void 0:e.plan)||void 0===t?void 0:t.id)}))||[]:e.filter(n=>!0!==n.plan.addon)||[]},[a,f,h]),L=e.useCallback(n=>{var e,t;if(x(n),w(0),p&&n!==ao(null==p?void 0:p.periodMonths)){const i=((null===(e=null==a?void 0:a.priceLists)||void 0===e?void 0:e.filter(e=>ao(e.periodMonths)===n))||[]).find(e=>ao(e.periodMonths)===n&&e.plan.id===(null==p?void 0:p.plan.id)),o=i&&(null===(t=null==b?void 0:b.priceList)||void 0===t?void 0:t.id)===i.id;i||o?m(i):y()}},[p,a,b]),P=e.useCallback(n=>{const e=Rp(null==a?void 0:a.priceLists,n,b);f&&!(null==e?void 0:e.includes(oo(f)))&&L(ao(void 0!==(null==e?void 0:e[0])?e[0]:1)),v(n)},[a,f,L]),k=null===(u=null==a?void 0:a.products)||void 0===u?void 0:u[0],N=e.useMemo(()=>{var n,e,t;const i=Rp(null==a?void 0:a.priceLists,k,b),o=null==i?void 0:i.includes(oo(g));if(g&&o)return g;const r=ao(null!==(e=null===(n=null==b?void 0:b.priceList)||void 0===n?void 0:n.periodMonths)&&void 0!==e?e:null);return(null==b?void 0:b.priceList)&&r&&(null==i?void 0:i.includes(oo(r)))?ao(b.priceList.periodMonths):ao(null!==(t=null==i?void 0:i[0])&&void 0!==t?t:null)},[b]);e.useEffect(()=>{t||i||!a||f||h||p||(N&&x(N),k&&v(k))},[x,v,f,t,i,a,p,h]),e.useEffect(()=>{var n;const e=(null===(n=null==a?void 0:a.priceLists)||void 0===n?void 0:n.filter(n=>ao(n.periodMonths)===N&&n.product.id===(null==k?void 0:k.id)))||[],t=(null==b?void 0:b.priceList)?e.find(n=>{var e;return n.id===(null===(e=null==b?void 0:b.priceList)||void 0===e?void 0:e.id)}):void 0;!t||d||p||m(t)},[d,o,b,f]);const F=e.useCallback(n=>m(n),[d,Bp,m]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"bunny-flex bunny-flex-row bunny-gap-4 bunny-justify-between bunny-items-end bunny-pb-6",children:[n.jsx(Si,{onClick:r}),n.jsx(zc,{availableBillingPeriods:j,onChangeBillingPeriod:L,products:null==a?void 0:a.products,selectedBillingPeriod:f,selectedProduct:h,onChangeProduct:P})]}),n.jsx($p,{availablePriceLists:I,priceListChangeOptions:a,priceListStart:C,selectedPriceList:p,selectedProduct:h,setPriceListStart:w,subscriptions:o,selectedBillingPeriod:f,onClickPriceListCard:F})]})},Op=({onGoBack:t,areSubscriptionsLoading:i,subscriptions:o})=>{var r;const s=oe(),{apiHost:l}=e.useContext(te),{isInPreviewMode:u,productId:d}=ns(),c=Rl(),{data:p,isLoading:m}=a.useQuery({queryKey:J({subscriptionId:null==c?void 0:c.id,token:s}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t,subscriptionId:i,productId:a})=>{const o=e?void 0:t,r=await In(Zc,{apiHost:n,token:o},{subscriptionId:i,productId:a}),{priceListChangeOptions:s}=r;return(null==s?void 0:s.priceLists)&&s.priceLists.sort((n,e)=>{var t,i,a,o;return(null!==(i=null===(t=n.plan)||void 0===t?void 0:t.position)&&void 0!==i?i:0)-(null!==(o=null===(a=e.plan)||void 0===a?void 0:a.position)&&void 0!==o?o:0)}),s})({apiHost:l,isInPreviewMode:u,token:s,subscriptionId:null==c?void 0:c.id,productId:d}),enabled:u&&Boolean(d)||Boolean(null==c?void 0:c.id)});return p?n.jsx(n.Fragment,{children:0===(null===(r=null==p?void 0:p.priceLists)||void 0===r?void 0:r.length)?n.jsx(is,{message:"There are no plans available"}):n.jsx(Vp,{arePlanChangeOptionsLoading:m,areSubscriptionsLoading:i,priceListChangeOptions:p,subscriptions:null!=o?o:[],onGoBack:t})}):null},Zp=({isInPreviewMode:e})=>e?n.jsx("div",{className:"bunny-flex bunny-justify-center bunny-w-full bunny-rounded",children:n.jsx(i.Tag,{color:"blue",icon:n.jsx(t.InfoCircleOutlined,{}),className:"bunny-p-1 bunny-text-sm",children:"You are in preview mode. Products, plans and price lists are shown as they will appear to the customer."})}):null,zp=ne("\n fragment UpgradingSubscriptionContext_SubscriptionFragment on Subscription {\n id\n state\n priceList {\n id\n plan {\n id\n }\n }\n plan {\n id\n }\n ...SubscriptionsList_SubscriptionFragment\n ...QuoteCheckout_SubscriptionFragment\n ...PriceListSelectorUpgradingSubscription_SubscriptionFragment\n ...PriceListCardButtonUpgradingSubscription_SubscriptionFragment\n ...useQuantityEditableCharges_SubscriptionFragment\n ...useChargeCRUD_SubscriptionFragment\n ...useQuoteQuantities_SubscriptionFragment\n ...isAddonPurchased_SubscriptionChargeFragment\n ...useQuoteCreate_SubscriptionFragment\n }\n ",[kl,Gl,Up,Cc,yd,Hd,wd,rp,vd]),Kp=ne("\n query subscriptions {\n subscriptions {\n nodes {\n id\n ...UpgradingSubscriptionContext_SubscriptionFragment\n }\n }\n }\n ",[zp]),Gp=_(),Yp=({onChangePlanCancel:t,handlePortalErrors:i,onPaymentMethodSaved:o,onPaymentMethodRemoved:r,upgradingSubscriptionId:s,isInPreviewMode:l=!1,productId:u,className:d,shadow:c="md",defaultBillingPeriod:p})=>{var m,y,g;const b=oe(),{apiHost:h}=e.useContext(te),{data:v,isLoading:f}=a.useQuery({queryKey:W({pluralType:"upgradeSubscriptions",token:b}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t})=>{const i=e?void 0:t;return await In(Kp,{apiHost:n,token:i},{})})({token:b,apiHost:h,isInPreviewMode:l}),enabled:!l,refetchOnMount:"always"}),x=null===(y=null===(m=null==v?void 0:v.subscriptions)||void 0===m?void 0:m.nodes)||void 0===y?void 0:y.find(n=>(null==n?void 0:n.id)===s),C=Jn(zp,x);return f&&!l?null:C||l?n.jsx(Jr,{value:{isInPreviewMode:l,productId:u,className:d,shadow:c},children:n.jsx(es,{initialValue:s,children:n.jsx(_l,{value:C,children:n.jsx(zr,{value:o,children:n.jsx(Or,{value:r,children:n.jsx(kd,{value:p,children:n.jsx(Pd,{children:n.jsx(Wp,{onChangePlanCancel:t,handlePortalErrors:i,subscriptions:null===(g=null==v?void 0:v.subscriptions)||void 0===g?void 0:g.nodes,subscriptionsAreLoading:f})})})})})})})}):n.jsx(is,{message:"Upgrading subscription not found"})},Wp=({onChangePlanCancel:t,handlePortalErrors:i,subscriptions:a,subscriptionsAreLoading:o})=>{const{isInPreviewMode:r,className:s}=ns(),{selectedPriceList:l,onClearQuote:u}=e.useContext(Vu),[d,c]=e.useState(!1),p=e.useRef(null);return e.useEffect(()=>{const n=new IntersectionObserver(([n])=>{c(!n.isIntersecting)},{root:null,rootMargin:"300px 0px -20px 0px",threshold:1}),e=p.current;return e&&n.observe(e),()=>{e&&n.unobserve(e)}},[c,p]),o&&!r?n.jsx(n.Fragment,{children:"nothing returned"}):n.jsxs("div",{className:`${s}`,children:[n.jsx(Zp,{isInPreviewMode:r}),n.jsx(Op,{areSubscriptionsLoading:o,subscriptions:a,onGoBack:()=>{if(r)return Gp("You are in preview mode");u(),null==t||t()}}),n.jsx("div",{ref:p}),n.jsx("div",{className:"bunny-sticky bunny-bottom-4 bunny-transition-[margin] bunny-duration-300 "+(d?"bunny-mx-4":"bunny-mx-0"),children:l&&n.jsx(Rd,{selectedPriceList:l,handlePortalErrors:i,onCheckoutSuccess:()=>null==t?void 0:t()})})]})},Xp=({subscriptions:t,subscriptionsAreLoading:i,handlePortalErrors:o,companyName:r,noSubscriptionsComponent:s,showInactiveSubscriptionsToggle:l,onSubscriptionUpgradeClick:u})=>{const d=oe(),{apiHost:c}=e.useContext(te),{className:p,isInPreviewMode:m,showInactiveSubscriptions:y,productId:g,shadow:b}=ns(),h=Kr(),v=Zr(),[f,x]=ts(),[C,w]=e.useState(!1),[j,S]=e.useState(!1),[I,L]=e.useState(!1),P=null!=y?y:C,k=e.useMemo(()=>null==t?void 0:t.map(n=>Jn(Nu,n)),[t]),N=a.useQueryClient(),F=$(),D=H(),T=(()=>{const n=mn();return async(e,t,i)=>{var a;const o=await n("\n mutation SubscriptionCancel($subscriptionIds: [ID!]!) {\n subscriptionCancel(ids: $subscriptionIds) {\n subscriptions {\n accountId\n state\n }\n }\n }",t,i,{subscriptionIds:e});return null===(a=null==o?void 0:o.subscriptions)||void 0===a?void 0:a.nodes}})(),q=a.useMutation({mutationFn:n=>T([n],c,d),onSuccess:()=>{Fu(N,d),F("Subscription canceled")}}),A=e.useMemo(()=>null==k?void 0:k.every(n=>{const e=Jn(Nu,n);return"EXPIRED"===(null==e?void 0:e.state)||"TRIAL_EXPIRED"===(null==e?void 0:e.state)||"CANCELED"===(null==e?void 0:e.state)}),[k]),M=e.useMemo(()=>null==k?void 0:k.some(n=>{const e=Jn(Nu,n);return"EXPIRED"===(null==e?void 0:e.state)||"TRIAL_EXPIRED"===(null==e?void 0:e.state)||"CANCELED"===(null==e?void 0:e.state)}),[k]),E=Boolean(l&&M&&k&&k.length>0);return e.useEffect(()=>{A&&k&&k.length>0?w(!0):w(!1)},[A,k,j]),j||m?n.jsx(Yp,{isInPreviewMode:m,productId:g,onChangePlanCancel:()=>{S(!1)},handlePortalErrors:o,upgradingSubscriptionId:f,className:p,shadow:b,onPaymentMethodSaved:h,onPaymentMethodRemoved:v}):i?n.jsx(Ru,{className:p+" bunny-pt-12"}):k?n.jsx(Wr,{value:n=>{q.mutate(n)},children:n.jsx(Gr,{value:n=>{null==u||u(n),x(n),S(!0)},children:n.jsxs("div",{className:p,children:[n.jsx(Jp,{title:n.jsx(n.Fragment,{children:D&&E&&n.jsx(Qu,{showInactive:P,setShowInactive:w})}),children:!D&&n.jsx(Uu,{inactiveSwitchVisible:E,showInactive:P,setShowInactive:w,setQuantityDrawerOpen:L,subscriptions:k})}),n.jsx(Dl,{companyName:r,showInactive:P,subscriptions:k,subscriptionsAreLoading:i,noSubscriptionsComponent:s}),D&&n.jsx("div",{className:"bunny-pt-4 bunny-pb-2",children:n.jsx(Uu,{inactiveSwitchVisible:E,showInactive:P,setShowInactive:w,setQuantityDrawerOpen:L,subscriptions:k})}),n.jsx(Hu,{subscriptions:k,quantityDrawerOpen:I,setQuantityDrawerOpen:L,handlePortalErrors:o})]})})}):null},Jp=({children:e,title:t})=>{const i=H();return n.jsxs("div",{className:"bunny-flex bunny-pb-4 "+(i?"bunny-flex-col bunny-gap-2":"bunny-items-center bunny-justify-between bunny-h-8"),children:[t&&n.jsx(nm,{title:t}),e]})},nm=({title:e})=>{const{secondaryColor:t}=fn();return n.jsx("div",{className:"bunny-shrink-0",style:{color:t},children:e})},em=({onClick:e})=>n.jsx("div",{className:"bunny-border-t bunny-border-gray-200 bunny-p-2",children:n.jsx(i.Button,{type:"text",className:"bunny-w-full bunny-text-left",onClick:e,children:"+ Add new contact"})}),tm=ne("\n fragment AccountContactsFragment on Contact {\n id\n email\n firstName\n lastName\n }\n ",[]),im=ne("\n mutation ContactCreate($attributes: ContactAttributes!) {\n contactCreate(attributes: $attributes) {\n contact {\n id\n account {\n contacts {\n ...AccountContactsFragment\n }\n }\n }\n errors\n }\n }\n ",[tm]),am=({open:t,onClose:o,accountId:r,onContactCreated:s})=>{const[l]=i.Form.useForm(),{apiHost:u}=e.useContext(te),d=oe(),c=Q(),p=$(),{setAccountContactsQueryData:m}=(()=>{const n=oe(),e=a.useQueryClient();return{setAccountContactsQueryData:(t,i)=>{e.setQueryData(U({accountId:t,token:n}),i)}}})(),{mutate:y,isPending:g}=a.useMutation({mutationFn:n=>(async({attributes:n,apiHost:e,token:t})=>{var i;const a=await In(im,{apiHost:e,token:t},{attributes:n});return null===(i=null==a?void 0:a.contactCreate)||void 0===i?void 0:i.contact})({attributes:n,apiHost:u,token:d}),onSuccess:n=>{var e,t;p("Contact created successfully"),n&&r&&m(r,null!==(t=null===(e=null==n?void 0:n.account)||void 0===e?void 0:e.contacts)&&void 0!==t?t:null),o(),l.resetFields();const i=n?Jn(tm,n):null;(null==i?void 0:i.id)&&(null==s||s(i.id))}});return n.jsx(i.Modal,{title:"Add new contact",open:t,onCancel:()=>{o(),l.resetFields()},footer:[n.jsx(i.Button,{onClick:()=>{o(),l.resetFields()},children:"Cancel"},"cancel"),n.jsx(i.Button,{type:"primary",loading:g,onClick:()=>{r?l.validateFields().then(n=>{y({email:n.email||null,firstName:n.firstName||null,lastName:n.lastName||null,accountId:r,portalAccess:!0})}):c("Account ID is required to create a contact")},children:"Add contact"},"submit")],children:n.jsxs(i.Form,{form:l,layout:"vertical",className:"bunny-flex bunny-flex-col bunny-gap-2",children:[n.jsx(i.Form.Item,{label:"First name",name:"firstName",rules:[{required:!0,message:"First name is required"}],children:n.jsx(i.Input,{placeholder:"Enter first name"})}),n.jsx(i.Form.Item,{label:"Last name",name:"lastName",rules:[{required:!1}],children:n.jsx(i.Input,{placeholder:"Enter last name"})}),n.jsx(i.Form.Item,{label:"Email",name:"email",rules:[{required:!0,message:"Email is required"},{type:"email",message:"Please enter a valid email"}],children:n.jsx(i.Input,{placeholder:"Enter email"})})]})})},om=ne("\n query GetAccount($id: ID!) {\n account(id: $id) {\n ...BillingDetailsSection_AccountFragment\n }\n }\n ",[Yo]),rm=ne("\n query GetAccountContacts($accountId: ID!) {\n account(id: $accountId) {\n id\n contacts {\n ...AccountContactsFragment\n }\n }\n }\n ",[tm]),{Text:sm}=i.Typography;function lm({hidePaymentMethodForm:t,countryListFilter:o}){var r,s,l;const[u,d]=e.useState(!1),[c]=i.Form.useForm(),p=i.Form.useWatch([],c),[m,y]=e.useState(!1),[g,b]=e.useState(null),{apiHost:h}=e.useContext(te),v=oe(),f=H(),x=a.useQueryClient(),C=Q(),w=$(),{currentUser:j}=bi(v),S=null===(r=null==j?void 0:j.account)||void 0===r?void 0:r.id,{data:I,isLoading:L}=a.useQuery({queryKey:B({accountId:S,token:v}),queryFn:()=>{if(!S)throw new Error("Account ID is required");return(async({accountId:n,apiHost:e,token:t})=>(await In(om,{apiHost:e,token:t},{id:n})).account)({accountId:S,apiHost:h,token:v})},enabled:!!S}),P=Jn(Yo,I),{data:k,isLoading:N}=a.useQuery({queryKey:U({accountId:S,token:v}),queryFn:()=>{if(!S)throw new Error("Account ID is required");return(async({accountId:n,apiHost:e,token:t})=>{var i;return null===(i=(await In(rm,{apiHost:e,token:t},{accountId:n})).account)||void 0===i?void 0:i.contacts})({accountId:S,apiHost:h,token:v})},enabled:!!S}),{mutate:F,isPending:D}=a.useMutation({mutationFn:async n=>{if(!S)throw new Error("Account ID is required");const e=await Xo({accountId:S,attributes:{name:n.name,billingStreet:n.billingStreet,billingCity:n.billingCity,billingZip:n.billingZip,billingState:n.billingState,billingCountry:n.billingCountry,taxNumber:n.taxNumber,billingContactId:n.billingContactId||null,secondaryBillingContactIds:Array.isArray(n.secondaryBillingContactIds)?n.secondaryBillingContactIds:null},token:v,apiHost:h});return x.setQueryData(B({accountId:S,token:v}),e),e},onSuccess:()=>{w("Your account details have been saved"),x.invalidateQueries({queryKey:en({token:v})})}});e.useEffect(()=>{P&&c.setFieldsValue({billingStreet:P.billingStreet,billingCity:P.billingCity,billingZip:P.billingZip,billingState:P.billingState,billingCountry:P.billingCountry,billingContactId:P.billingContactId,secondaryBillingContactIds:P.secondaryBillingContactIds,taxNumber:P.taxNumber})},[P]),e.useEffect(()=>{c.validateFields({validateOnly:!0});d((()=>{if(!P)return!1;const n=c.getFieldsValue(),e={billingStreet:P.billingStreet,billingCity:P.billingCity,billingZip:P.billingZip,billingState:P.billingState,billingCountry:P.billingCountry,billingContactId:P.billingContactId,secondaryBillingContactIds:P.secondaryBillingContactIds,taxNumber:P.taxNumber};return Object.keys(e).some(t=>{const i=e[t],a=n[t];return Array.isArray(i)&&Array.isArray(a)?JSON.stringify(null==i?void 0:i.sort())!==JSON.stringify(null==a?void 0:a.sort()):a!==i})})())},[c,p,P]),e.useEffect(()=>{const n=!u;c.validateFields({validateOnly:n})},[u]);const T=e.useMemo(()=>o?A.filter(o):A,[o]),q=L||N;return n.jsxs("div",{className:""+(f||t?"bunny-w-full":"bunny-w-1/2"),children:[n.jsxs("div",{className:"bunny-px-4",children:[n.jsxs(i.Skeleton,{loading:q||void 0===P,children:[n.jsx("div",{className:"bunny-mb-2 bunny-pl-1",children:n.jsx(sm,{className:"bunny-font-medium bunny-text-lg",children:(null==P?void 0:P.name)||"No company name"})}),n.jsxs(i.Form,{className:"bunny-flex bunny-flex-col bunny-gap-2",form:c,layout:"vertical",disabled:D,autoComplete:"off",children:[n.jsx(i.Form.Item,{label:"Street address",name:"billingStreet",children:n.jsx(i.Input,{})}),n.jsxs("div",{className:"bunny-flex bunny-gap-4",children:[n.jsx(i.Form.Item,{label:"City",name:"billingCity",className:"bunny-flex-1",children:n.jsx(i.Input,{})}),n.jsx(i.Form.Item,{label:"Zipcode",name:"billingZip",className:"bunny-flex-1",children:n.jsx(i.Input,{})})]}),n.jsxs("div",{className:`bunny-flex ${f?"bunny-flex-row bunny-pb-2":"bunny-flex-row"} bunny-gap-4`,children:[n.jsx("div",{className:"bunny-flex-1 bunny-w-1/2",children:n.jsx(i.Form.Item,{label:"State",name:"billingState",children:n.jsx(i.Input,{})})}),n.jsx("div",{className:"bunny-flex-1 bunny-w-1/2",children:n.jsx(i.Form.Item,{label:"Country",name:"billingCountry",children:n.jsx(i.Select,{className:"bunny-w-full",options:T,placeholder:"Select a country",popupMatchSelectWidth:!1,showSearch:!0,filterOption:(n,e)=>{var t,i;return(null!==(t=null==e?void 0:e.label)&&void 0!==t?t:"").toLowerCase().includes(n.toLowerCase())||(null!==(i=null==e?void 0:e.value)&&void 0!==i?i:"").toLowerCase().includes(n.toLowerCase())}})})})]}),n.jsx(i.Form.Item,{label:"Primary billing contact",name:"billingContactId",rules:[{required:!0,message:"Primary billing contact is required"}],children:n.jsx(i.Select,{className:"bunny-w-full",placeholder:"Select a contact",options:null!==(s=null==k?void 0:k.map(n=>{var e;const t=Jn(tm,n);return{label:(null==t?void 0:t.firstName)?`${t.firstName} ${null!==(e=t.lastName)&&void 0!==e?e:""}`:null==t?void 0:t.email,value:null==t?void 0:t.id}}))&&void 0!==s?s:[],popupRender:e=>n.jsxs(n.Fragment,{children:[e,n.jsx(em,{onClick:()=>y(!0)})]})})}),n.jsx(i.Form.Item,{label:"Secondary billing contacts",name:"secondaryBillingContactIds",children:n.jsx(i.Select,{className:"bunny-w-full",mode:"multiple",maxTagCount:"responsive",placeholder:"Select contacts",options:null!==(l=null==k?void 0:k.map(n=>{var e;const t=Jn(tm,n);return{label:(null==t?void 0:t.firstName)?`${t.firstName} ${null!==(e=t.lastName)&&void 0!==e?e:""}`:null==t?void 0:t.email,value:null==t?void 0:t.id}}))&&void 0!==l?l:[],popupRender:e=>n.jsxs(n.Fragment,{children:[e,n.jsx(em,{onClick:()=>{b("secondary"),y(!0)}})]})})}),n.jsx(i.Form.Item,{label:"Tax ID",name:"taxNumber",tooltip:"Tax ID will be printed on quotes and invoices below the account's address",children:n.jsx(i.Input,{})})]})]}),n.jsx(i.Button,{disabled:!u||D||q,className:"bunny-w-full bunny-mt-4",type:"primary",onClick:async()=>{c.validateFields({validateOnly:!1}).then(async()=>{try{await c.validateFields(),F(c.getFieldsValue())}catch(n){n instanceof Error?C("Failed to update account",n.message):C("Please fill out all required fields")}finally{d(!1)}})},children:"Save"})]}),n.jsx(am,{open:m,onClose:()=>{y(!1),b(null)},accountId:S,onContactCreated:n=>{if("primary"===g)c.setFieldValue("billingContactId",n);else if("secondary"===g){const e=c.getFieldValue("secondaryBillingContactIds")||[];e.includes(n)||c.setFieldValue("secondaryBillingContactIds",[...e,n])}b(null)}})]})}const um=()=>H()?n.jsx("div",{className:"bunny-mx-4",children:n.jsx(i.Divider,{})}):n.jsx("div",{children:n.jsx(i.Divider,{className:"bunny-h-full",type:"vertical"})}),dm=({hideBillingDetailsForm:e,isUpgradeFromTrial:t,onSavePaymentMethod:i,onPaymentMethodRemoved:a})=>{const o=H(),r=$();return n.jsx("div",{className:(o||e?"bunny-w-full":"bunny-w-1/2 bunny-pt-2")+" bunny-flex bunny-justify-center bunny-px-4",children:n.jsx(Ci,{onSavePaymentMethod:n=>{r(t?"Payment method saved! Your trial will automatically convert to a paid subscription.":"Payment method saved successfully!"),null==i||i(n.savedPaymentMethodResponse.paymentMethodId)},onPaymentMethodRemoved:n=>{null==a||a(n.id)}})})};exports.BillingDetails=({countryListFilter:t,hideBillingDetailsForm:i=!1,hidePaymentMethodForm:a=!1,isUpgradeFromTrial:o=!1,style:r,onSavePaymentMethod:s,onPaymentMethodRemoved:l})=>{const u=H(),{darkMode:d}=e.useContext(te);return n.jsx("div",{"data-slot":"billing-details-root",className:"bunny-billing-details"+(d?" bunny-billing-details--dark":""),style:r,children:n.jsxs("div",{className:"bunny-flex bunny-py-2 bunny-my-2 "+(u?"bunny-flex-col bunny-space-y-4":"bunny-flex-row"),children:[i?null:n.jsx(lm,{hidePaymentMethodForm:a,countryListFilter:t}),i||a?null:n.jsx(um,{}),a?null:n.jsx(dm,{hideBillingDetailsForm:i,isUpgradeFromTrial:o,onSavePaymentMethod:s,onPaymentMethodRemoved:l})]})})},exports.BunnyProvider=function({children:e,darkMode:t=!1,queryClient:i,apiHost:a,token:o,onTokenExpired:r,onUserUnavailable:s,onInvalidOrMissingAuthorization:l,suppressUserUnavailableErrorNotification:u=!1,disableErrorNotifications:d=!1,configProviderProps:c}){return n.jsx(xn,{value:{onUserUnavailable:s,onInvalidOrMissingAuthorization:l,suppressUserUnavailableErrorNotification:u,disableErrorNotifications:d},children:n.jsx(ie,{darkMode:t,queryClient:i,apiHost:a,token:o,onTokenExpired:r,configProviderProps:c,children:e})})},exports.Footer=fo,exports.Invoice=Ai,exports.MiniCreditCard=Ie,exports.PaymentForm=Ci,exports.Quote=ja,exports.Quotes=function({className:t,columns:i=["date","title","amount","download","state"],filter:o,filterQuotes:r,sort:s=(n,e)=>new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime(),noQuotesMessage:l="There are no quotes",onQuoteClick:d,renderQuote:c,searchBarClassName:p,shadow:m="shadow-md",showSearchBar:y=!0,showTitle:g=!0,title:b="Past quotes",style:h,suppressQuoteDisplay:v=!1,useModal:f=!1}){const{apiHost:x}=e.useContext(te),C=a.useQueryClient(),[w,j]=e.useState(null),S={columns:i,kindsToShow:void 0,onTransactionClick:function(e){null==d||d(e),j(void 0!==c?c(e):n.jsx(ja,{id:null==e?void 0:e.transactionableId,onQuoteAccepted:()=>{C.invalidateQueries({queryKey:O()})}}))},onTransactionDisplayClose:()=>{j(n.jsx(n.Fragment,{}))},transactionComponent:w,transactionStateRenderer:function(e){return n.jsx(ra,{color:(n=>{switch(n){case"ACCEPTED":case"APPROVED":return"green";case"IN_APPROVAL":return"orange";case"REJECTED":return"red";default:return"blue"}})(e),children:u.capitalize(u.startCase(e))})},showSearchBar:y,showTitle:g,title:b,className:t,shadow:m,searchBarClassName:p,useModal:f,suppressTransactionDisplay:v,style:h,noTransactionsMessage:l,filter:o,filterTransactions:r,sortTransactions:s,downloadTransactionLink:n=>`${x}/api/pdf/quote/${n}`,transactionDateType:"createdAt"};return n.jsx(Ia.Provider,{value:S,children:n.jsx(Ga,{})})},exports.Signup=function({priceListCode:e,enableTrial:t=!1,style:a,defaultFormValues:o,paymentRequiredToAcceptQuote:r,documentTemplateId:s,requiredBillingDetails:l,defaultCouponCode:u}){const[d]=i.Form.useForm(),c={enableTrial:t,paymentRequiredToAcceptQuote:r};return n.jsx(Mr,{children:n.jsx(Er,{children:n.jsx($r,{children:n.jsx(Rr,{value:d,children:n.jsx(Ur,{value:c,children:n.jsx(Ar,{children:n.jsx(qr,{priceListCode:e,style:a,defaultFormValues:o,documentTemplateId:s,requiredBillingDetails:l,defaultCouponCode:u})})})})})})})},exports.Subscriptions=({handlePortalErrors:t,companyName:i,isInPreviewMode:o=!1,productId:r,className:s,styles:l={},noSubscriptionsComponent:u,showInactiveSubscriptions:d,showInactiveSubscriptionsToggle:c=!0,onPaymentMethodSaved:p,onPaymentMethodRemoved:m,onSubscriptionUpgradeClick:y})=>{var g,b;const h=oe(),{apiHost:v}=e.useContext(te),{data:f,isLoading:x}=a.useQuery({queryKey:W({pluralType:"subscriptions",token:h}),queryFn:()=>(async({apiHost:n,isInPreviewMode:e,token:t})=>{const i=e?void 0:t;return await In(Eu,{apiHost:n,token:i},{})})({token:h,apiHost:v,isInPreviewMode:o}),enabled:!o}),C=null===(b=null===(g=null==f?void 0:f.subscriptions)||void 0===g?void 0:g.nodes)||void 0===b?void 0:b.filter(n=>null!==n),w={...{gap:4,shadow:"md",subscriptionProductNameStyle:{fontSize:void 0,fontWeight:void 0}},...l};return n.jsx(Jr,{value:{gap:w.gap,shadow:w.shadow,className:s,subscriptionProductNameStyle:w.subscriptionProductNameStyle,productId:r,isInPreviewMode:o,showInactiveSubscriptions:d},children:n.jsx(es,{children:n.jsx(zr,{value:p,children:n.jsx(Or,{value:m,children:n.jsx(Xp,{subscriptions:C,subscriptionsAreLoading:x,handlePortalErrors:t,companyName:i,noSubscriptionsComponent:u,showInactiveSubscriptionsToggle:c,onSubscriptionUpgradeClick:y})})})})})},exports.Transactions=function({transactionComponent:t,showSearchBar:i=!0,showTitle:o=!0,title:r="Past transactions",columns:s=["date","title","state","amount","download"],className:l,shadow:u="shadow-md",searchBarClassName:d,useModal:c=!1,onTransactionClick:p,suppressTransactionDisplay:m=!1,kindsToShow:y=[Pa.INVOICE,Pa.PAYMENT,Pa.REFUND,Pa.WRITE_OFF],style:g,filter:b,noTransactionsMessage:h,filterTransactions:v,sortTransactions:f=(n,e)=>new Date(e.createdAt).getTime()-new Date(n.createdAt).getTime(),transactionDateType:x="createdAt",hidePaymentForm:C=!1}){const w={showSearchBar:i,showTitle:o,title:r,transactionComponent:t,columns:s,className:l,searchBarClassName:d,shadow:u,useModal:c,onTransactionClick:p,suppressTransactionDisplay:m,kindsToShow:y,style:g,filter:b,noTransactionsMessage:h,filterTransactions:v,sortTransactions:f,transactionDateType:x,hidePaymentForm:C},{apiHost:j}=e.useContext(te),S=oe(),[I,L]=e.useState(""),P=b||(I.length>0?`filter: "transaction.amount is ${Number(I)}"`:""),{data:k}=a.useQuery({queryKey:["transactions",S,P],queryFn:()=>(async(n,e,t)=>{var i;const a=await yn({query:ka(n),apiHost:e,token:t});return null===(i=null==a?void 0:a.transactions)||void 0===i?void 0:i.nodes})(P,j,S),placeholderData:a.keepPreviousData});return n.jsx(Ia.Provider,{value:w,children:n.jsx(Ka,{transactions:k,onSearchValueChanged:L,search:I})})},exports.Upgrade=Yp;