@veevarts/design-system 2.0.0-alpha.55 → 2.0.0-alpha.56

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/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),h=require("react"),X=require("lucide-react"),ze=require("framer-motion"),Fn=require("@tiptap/react"),ja=require("@tiptap/core"),bc=require("@tiptap/extension-bold"),gc=require("@tiptap/extension-italic"),yc=require("@tiptap/extension-strike"),vc=require("@tiptap/extension-underline"),jc=require("@tiptap/extension-code"),wc=require("@tiptap/extension-color"),Nc=require("@tiptap/extension-highlight"),Cc=require("@tiptap/extension-link"),kc=require("@tiptap/extension-text-style"),Sc=require("@tiptap/extension-heading"),$c=require("@tiptap/extension-paragraph"),Ac=require("@tiptap/extension-bullet-list"),Dc=require("@tiptap/extension-ordered-list"),Ec=require("@tiptap/extension-task-list"),Lc=require("@tiptap/extension-task-item"),Fc=require("@tiptap/extension-list-item"),Rc=require("@tiptap/extension-code-block"),_c=require("@tiptap/extension-blockquote"),Mc=require("@tiptap/extension-horizontal-rule"),Pc=require("@tiptap/extension-hard-break"),wa=require("@tiptap/extension-history"),Ic=require("@tiptap/extension-text-align"),Tc=require("@tiptap/extension-document"),Oc=require("@tiptap/extension-text"),zc=require("@tiptap/extension-dropcursor"),Bc=require("@tiptap/extension-gapcursor"),Le={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},pe={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},be={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:ls}=Le.neutral,Vc=Le.palettes.warning[700],Uc=Le.palettes.warning[100],ft={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Ls={"--rust":Le.brand.primary[500],"--rust-fill":ft.rustFill,"--rust-border":ft.rustBorder,"--page":ft.page,"--surface":Le.neutral.white,"--border":ft.border,"--hair":ft.hair,"--ink":ls[900],"--ink2":ls[700],"--sub":ls[500],"--muted":ls[400],"--ok":Le.semantic.success,"--ok-fill":ft.okFill,"--warn":Vc,"--warn-fill":Uc,"--danger":Le.semantic.danger,"--danger-fill":ft.dangerFill,"--info":Le.semantic.info,"--info-fill":ft.infoFill};Object.fromEntries(Object.entries(Ls).map(([e,s])=>[e.replace(/^--/,""),s]));function Hc({scope:e=".acct",fontFamily:s="'NeueMontreal', system-ui, sans-serif"}={}){const n=Object.entries(Ls).map(([r,i])=>` ${r}: ${i};`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("@heroui/react"),h=require("react"),X=require("lucide-react"),Be=require("framer-motion"),_n=require("@tiptap/react"),Ca=require("@tiptap/core"),yc=require("@tiptap/extension-bold"),vc=require("@tiptap/extension-italic"),jc=require("@tiptap/extension-strike"),wc=require("@tiptap/extension-underline"),Nc=require("@tiptap/extension-code"),Cc=require("@tiptap/extension-color"),kc=require("@tiptap/extension-highlight"),Sc=require("@tiptap/extension-link"),$c=require("@tiptap/extension-text-style"),Ac=require("@tiptap/extension-heading"),Dc=require("@tiptap/extension-paragraph"),Ec=require("@tiptap/extension-bullet-list"),Lc=require("@tiptap/extension-ordered-list"),Fc=require("@tiptap/extension-task-list"),Rc=require("@tiptap/extension-task-item"),_c=require("@tiptap/extension-list-item"),Mc=require("@tiptap/extension-code-block"),Pc=require("@tiptap/extension-blockquote"),Ic=require("@tiptap/extension-horizontal-rule"),Tc=require("@tiptap/extension-hard-break"),ka=require("@tiptap/extension-history"),Oc=require("@tiptap/extension-text-align"),zc=require("@tiptap/extension-document"),Bc=require("@tiptap/extension-text"),Vc=require("@tiptap/extension-dropcursor"),Uc=require("@tiptap/extension-gapcursor"),Fe={brand:{primary:{500:"#C14615",DEFAULT:"#C14615"}},semantic:{success:"#057A54",danger:"#B62214",info:"#2563EB"},neutral:{white:"#FFFFFF",gray:{100:"#F3F4F6",200:"#E5E7EB",300:"#D1D5DB",400:"#9CA3AF",500:"#6B7280",700:"#374151",800:"#1F2937",900:"#111827"}},palettes:{warning:{100:"#fef3c7",200:"#fde68a",700:"#b45309"}}},he={xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},ge={fontFamily:{mono:'"JetBrains Mono", Consolas, monospace'},fontSize:{sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","4xl":"2.25rem"},fontWeight:{semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5"}},{gray:cs}=Fe.neutral,Hc=Fe.palettes.warning[700],Wc=Fe.palettes.warning[100],xt={rustFill:"#FBEBE4",rustBorder:"#EBC3B1",page:"#F6F7F8",border:"#E7E9EC",hair:"#EEF0F2",okFill:"#E6F4EF",dangerFill:"#FBEAE8",infoFill:"#E8EEFC"},Rs={"--rust":Fe.brand.primary[500],"--rust-fill":xt.rustFill,"--rust-border":xt.rustBorder,"--page":xt.page,"--surface":Fe.neutral.white,"--border":xt.border,"--hair":xt.hair,"--ink":cs[900],"--ink2":cs[700],"--sub":cs[500],"--muted":cs[400],"--ok":Fe.semantic.success,"--ok-fill":xt.okFill,"--warn":Hc,"--warn-fill":Wc,"--danger":Fe.semantic.danger,"--danger-fill":xt.dangerFill,"--info":Fe.semantic.info,"--info-fill":xt.infoFill};Object.fromEntries(Object.entries(Rs).map(([e,s])=>[e.replace(/^--/,""),s]));function qc({scope:e=".acct",fontFamily:s="'NeueMontreal', system-ui, sans-serif"}={}){const n=Object.entries(Rs).map(([r,i])=>` ${r}: ${i};`).join(`
2
2
  `),a=s?`
3
3
  font-family: ${s};
4
4
  color: var(--ink);`:"";return`${e} {
5
5
  ${n}${a}
6
6
  }
7
- `}const le={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Le.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...le});const _r=h.createContext(void 0);function Mr(){return h.useContext(_r)}function Wc({children:e,closeLabel:s,locale:n,reducedMotion:a="user"}){const r=Mr();return t.jsx(c.HeroUIProvider,{locale:n,reducedMotion:a,children:t.jsx(_r.Provider,{value:s??r,children:e})})}const Pr="(prefers-reduced-motion: reduce)",Ir="data-pos-reduce-motion",Ne="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Tr="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",ps=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Tr}`;function qc(){return typeof document>"u"?!1:document.documentElement.getAttribute(Ir)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Pr).matches}function Fs(){const[e,s]=h.useState(!1);return h.useEffect(()=>{const n=()=>s(qc()),a=typeof window.matchMedia=="function"?window.matchMedia(Pr):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[Ir]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const Gc="whitespace-normal overflow-visible text-clip break-words";function Kc({toastProps:e,disableAnimation:s,...n}){const a=Fs();return t.jsx(c.ToastProvider,{...n,disableAnimation:s??(a||void 0),toastProps:{...e,classNames:{...e?.classNames,title:c.cn(Gc,e?.classNames?.title)}}})}const Or=h.createContext("default");function Rs(){return h.useContext(Or)}function Yc(e){return Rs()==="touch"?"lg":e}function Qc({density:e,children:s}){return t.jsx(Or.Provider,{value:e,children:s})}function Zc(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(n).concat(Object.keys(a)).forEach(i),r}const zr=Object.freeze({left:0,top:0,width:16,height:16}),js=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Rn=Object.freeze({...zr,...js}),pn=Object.freeze({...Rn,body:"",hidden:!1});function Xc(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function Na(e,s){const n=Xc(e,s);for(const a in pn)a in js?a in e&&!(a in n)&&(n[a]=js[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function Jc(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Na(a[l]||r[l],i)}return o(s),n.forEach(o),Na(e,i)}function Br(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=Zc(e);for(const r in a){const i=a[r];i&&(s(r,Jc(e,r,i)),n.push(r))}return n}const ed={provider:"",aliases:{},not_found:{},...zr};function Ws(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function Vr(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Ws(e,ed))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Ws(i,pn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Ws(i,pn))return null}return s}const Ca=Object.create(null);function td(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function Rt(e,s){const n=Ca[e]||(Ca[e]=Object.create(null));return n[s]||(n[s]=td(e,s))}function Ur(e,s){return Vr(s)?Br(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function sd(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const Hr=/^[a-z0-9]+(-[a-z0-9]+)*$/,_s=(e,s,n,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return s&&!hs(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return s&&!hs(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!hs(l,n)?null:l}return null},hs=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let Zt=!1;function Wr(e){return typeof e=="boolean"&&(Zt=e),Zt}function ka(e){const s=typeof e=="string"?_s(e,!0,Zt):e;if(s){const n=Rt(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function nd(e,s){const n=_s(e,!0,Zt);if(!n)return!1;const a=Rt(n.provider,n.prefix);return s?sd(a,n.name,s):(a.missing.add(n.name),!0)}function ad(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),Zt&&!s&&!e.prefix){let r=!1;return Vr(e)&&(e.prefix="",Br(e,(i,o)=>{nd(i,o)&&(r=!0)})),r}const n=e.prefix;if(!hs({prefix:n,name:"a"}))return!1;const a=Rt(s,n);return!!Ur(a,e)}const qr=Object.freeze({width:null,height:null}),Gr=Object.freeze({...qr,...js}),rd=/(-?[0-9.]*[0-9]+[0-9.]*)/g,id=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Sa(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(rd);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=id.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function ld(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function od(e,s){return e?"<defs>"+e+"</defs>"+s:s}function cd(e,s,n){const a=ld(e);return od(a.defs,s+a.content+n)}const dd=e=>e==="unset"||e==="undefined"||e==="none";function ud(e,s){const n={...Rn,...e},a={...Gr,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(v=>{const b=[],y=v.hFlip,N=v.vFlip;let k=v.rotate;y?N?k+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let w;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:w=r.height/2+r.top,b.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,b.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}k%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),b.length&&(i=cd(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let x,m;o===null?(m=l===null?"1em":l==="auto"?u:l,x=Sa(m,d/u)):(x=o==="auto"?d:o,m=l===null?Sa(x,u/d):l==="auto"?u:l);const p={},f=(v,b)=>{dd(b)||(p[v]=b.toString())};f("width",x),f("height",m);const g=[r.left,r.top,d,u];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:i}}const md=/\sid="(\S+)"/g,fd="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let xd=0;function pd(e,s=fd){const n=[];let a;for(;a=md.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(xd++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const hn=Object.create(null);function hd(e,s){hn[e]=s}function bn(e){return hn[e]||hn[""]}function _n(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Mn=Object.create(null),It=["https://api.simplesvg.com","https://api.unisvg.com"],bs=[];for(;It.length>0;)It.length===1||Math.random()>.5?bs.push(It.shift()):bs.push(It.pop());Mn[""]=_n({resources:["https://api.iconify.design"].concat(bs)});function bd(e,s){const n=_n(s);return n===null?!1:(Mn[e]=n,!0)}function Pn(e){return Mn[e]}const gd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let $a=gd();function yd(e,s){const n=Pn(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function vd(e){return e===404}const jd=(e,s,n)=>{const a=[],r=yd(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function wd(e){if(typeof e=="string"){const s=Pn(e);if(s)return s.path}return"/"}const Nd=(e,s,n)=>{if(!$a){n("abort",424);return}let a=wd(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;$a(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(vd(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},Cd={prepare:jd,send:Nd};function Kr(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function kd(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||Kr([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Sd=0;function $d(e,s,n){const a=Sd++,r=Kr.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Ad(e){const s={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=Rt(i,o));let x;l in u.icons?x=s.loaded:o===""||u.missing.has(l)?x=s.missing:x=s.pending;const m={provider:i,prefix:o,name:l};x.push(m)}),s}function Dd(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?_s(r,s,n):r;i&&a.push(i)}),a}const Ed={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ld(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let A=e.resources.slice(0);for(o=[];A.length>1;){const j=Math.floor(Math.random()*A.length);o.push(A[j]),A=A.slice(0,j).concat(A.slice(j+1))}o=o.concat(A)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,x,m=null,p=[],f=[];typeof a=="function"&&f.push(a);function g(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),g(),p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function b(A,j){j&&(f=[]),typeof A=="function"&&f.push(A)}function y(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:p.length,subscribe:b,abort:v}}function N(){d="failed",f.forEach(A=>{A(void 0,x)})}function k(){p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function w(A,j,D){const S=j!=="success";switch(p=p.filter(_=>_!==A),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(j==="abort"){x=D,N();return}if(S){x=D,p.length||(o.length?$():N());return}if(g(),k(),!e.random){const _=e.resources.indexOf(A.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",f.forEach(_=>{_(D)})}function $(){if(d!=="pending")return;g();const A=o.shift();if(A===void 0){if(p.length){m=setTimeout(()=>{g(),d==="pending"&&(k(),N())},e.timeout);return}N();return}const j={status:"pending",resource:A,callback:(D,S)=>{w(j,D,S)}};p.push(j),u++,m=setTimeout($,e.rotate),n(A,s,j.callback)}return setTimeout($),y}function Yr(e){const s={...Ed,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const x=Ld(s,l,d,(m,p)=>{a(),u&&u(m,p)});return n.push(x),x}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function Aa(){}const qs=Object.create(null);function Fd(e){if(!qs[e]){const s=Pn(e);if(!s)return;const n=Yr(s),a={config:s,redundancy:n};qs[e]=a}return qs[e]}function Rd(e,s,n){let a,r;if(typeof e=="string"){const i=bn(e);if(!i)return n(void 0,424),Aa;r=i.send;const o=Fd(e);o&&(a=o.redundancy)}else{const i=_n(e);if(i){a=Yr(i);const o=e.resources?e.resources[0]:"",l=bn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),Aa):a.query(s,r,n)().abort}function Da(){}function _d(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,kd(e)}))}function Md(e){const s=[],n=[];return e.forEach(a=>{(a.match(Hr)?s:n).push(a)}),{valid:s,invalid:n}}function Tt(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!Ur(e,n).length){a();return}}catch(r){console.error(r)}a(),_d(e)}function Ea(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function Pd(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ea(e.loadIcons(r,a,n),x=>{Tt(e,r,x)});return}if(i){r.forEach(x=>{const m=i(x,a,n);Ea(m,p=>{const f=p?{prefix:a,icons:{[x]:p}}:null;Tt(e,[x],f)})});return}const{valid:o,invalid:l}=Md(r);if(l.length&&Tt(e,l,null),!o.length)return;const d=a.match(Hr)?bn(n):null;if(!d){Tt(e,o,null);return}d.prepare(n,a,o).forEach(x=>{Rd(n,x,m=>{Tt(e,x.icons,m)})})}))}const Id=(e,s)=>{const n=Dd(e,!0,Wr()),a=Ad(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Da)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:x}=d;if(x===l&&u===o)return;o=u,l=x,i.push(Rt(u,x));const m=r[u]||(r[u]=Object.create(null));m[x]||(m[x]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:x,name:m}=d,p=Rt(u,x),f=p.pendingIcons||(p.pendingIcons=new Set);f.has(m)||(f.add(m),r[u][x].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Pd(d,u)}),s?$d(s,a,i):Da};function Td(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in qr?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const Od=/[\s,]+/;function zd(e,s){s.split(Od).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Bd(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function Vd(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function Ud(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Hd(e){return"data:image/svg+xml,"+Ud(e)}function Wd(e){return'url("'+Hd(e)+'")'}let Kt;function qd(){try{Kt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Kt=null}}function Gd(e){return Kt===void 0&&qd(),Kt?Kt.createHTML(e):e}const Qr={...Gr,inline:!1},Kd={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Yd={display:"inline-block"},gn={backgroundColor:"currentColor"},Zr={backgroundColor:"transparent"},La={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Fa={WebkitMask:gn,mask:gn,background:Zr};for(const e in Fa){const s=Fa[e];for(const n in La)s[e+n]=La[n]}const Qd={...Qr,inline:!0};function Ra(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Zd=(e,s,n)=>{const a=s.inline?Qd:Qr,r=Td(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?Kd:{}};if(n){const b=_s(n,!1,!0);if(b){const y=["iconify"],N=["provider","prefix"];for(const k of N)b[k]&&y.push("iconify--"+b[k]);d.className=y.join(" ")}}for(let b in s){const y=s[b];if(y!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=y;break;case"className":d[b]=(d[b]?d[b]+" ":"")+y;break;case"inline":case"hFlip":case"vFlip":r[b]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&zd(r,y);break;case"color":o.color=y;break;case"rotate":typeof y=="string"?r[b]=Bd(y):typeof y=="number"&&(r[b]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=y)}}const u=ud(e,r),x=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,x);let b=0,y=s.id;return typeof y=="string"&&(y=y.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Gd(pd(u.body,y?()=>y+"ID"+b++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:f}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=Vd(m,{...x,width:p+"",height:f+""});return d.style={...o,"--svg":Wd(v),width:Ra(x.width),height:Ra(x.height),...Yd,...g?gn:Zr,...l},h.createElement("span",d)};Wr(!0);hd("",Cd);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!ad(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;bd(n,r)||console.error(a)}catch{console.error(a)}}}}function Xr(e){const[s,n]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(f){if(f){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const v=ka(g);if(v)return{name:g,data:v}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const f=a.callback;f&&(f(),r({}))}function u(f){if(JSON.stringify(o)!==JSON.stringify(f))return d(),l(f),!0}function x(){var f;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const v=ka(g);if(u({name:g,data:v}))if(v===void 0){const b=Id([g],x);r({callback:b})}else v&&((f=e.onLoad)===null||f===void 0||f.call(e,g))}h.useEffect(()=>(n(!0),d),[]),h.useEffect(()=>{s&&x()},[e.icon,s]);const{name:m,data:p}=o;return p?Zd({...Rn,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const M=h.forwardRef((e,s)=>Xr({...e,_ref:s}));h.forwardRef((e,s)=>Xr({inline:!0,...e,_ref:s}));const T=h.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));T.displayName="Button";function Jr({code:e,amount:s,onRemove:n,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:s})]}),t.jsx(T,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(M,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Gs(e,s){return e-s*Math.floor(e/s)}const ei=1721426;function os(e,s,n,a){s=In(e,s);let r=s-1,i=-2;return n<=2?i=0:gs(s)&&(i=-1),ei-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function gs(e){return e%4===0&&(e%100!==0||e%400===0)}function In(e,s){return e==="BC"?1-s:s}function Xd(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const Jd={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class Ms{fromJulianDay(s){let n=s,a=n-ei,r=Math.floor(a/146097),i=Gs(a,146097),o=Math.floor(i/36524),l=Gs(i,36524),d=Math.floor(l/1461),u=Gs(l,1461),x=Math.floor(u/365),m=r*400+o*100+d*4+x+(o!==4&&x!==4?1:0),[p,f]=Xd(m),g=n-os(p,f,1,1),v=2;n<os(p,f,3,1)?v=0:gs(f)&&(v=1);let b=Math.floor(((g+v)*12+373)/367),y=n-os(p,f,b,1)+1;return new Xt(p,f,b,y)}toJulianDay(s){return os(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return Jd[gs(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return gs(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function eu(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function ti(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function si(e,s){return _a(e)-_a(s)}function _a(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Ks=null;function ni(){return Ks==null&&(Ks=new Intl.DateTimeFormat().resolvedOptions().timeZone),Ks}function Ma(e){e=Tn(e,new Ms);let s=In(e.era,e.year);return ai(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ai(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function Pa(e,s){if(s==="UTC")return 0;if(e>0&&s===ni())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=ri(e,s);return ai(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const Ia=new Map;function ri(e,s){let n=Ia.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Ia.set(s,n));let a=n.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Ta=864e5;function tu(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>su(e,s,i))}function su(e,s,n){let a=ri(n,s);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function nu(e,s,n="compatible"){let a=li(e);if(s==="UTC")return Ma(a);if(s===ni()&&n==="compatible"){a=Tn(a,new Ms);let d=new Date,u=In(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=Ma(a),i=Pa(r-Ta,s),o=Pa(r+Ta,s),l=tu(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function ii(e,s,n="compatible"){return new Date(nu(e,s,n))}function li(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new ws(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function Tn(e,s){if(eu(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,_t(a),a}function On(e,s){let n=e.copy(),a="hour"in n?xi(n,s):0;yn(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,vn(n),oi(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,au(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function yn(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function vn(e){for(;e.month<1;)yn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,yn(e,1)}function au(e){for(;e.day<1;)e.month--,vn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,vn(e)}function oi(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function _t(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),oi(e)}function ci(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function di(e,s){return On(e,ci(s))}function ui(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),_t(n),n}function mi(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),fi(n),n}function ru(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=cs(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=cs(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=cs(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=cs(e.hour,24),s}function fi(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function cs(e,s){let n=e%s;return n<0&&(n+=s),n}function xi(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,ru(e)}function pi(e,s){let n=e.copy();return xi(n,s),n}function iu(e,s){return pi(e,ci(s))}function hi(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=pt(d,n,0,l.length-1,a?.round),r.era=l[d],_t(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=pt(e.year,n,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=pt(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=pt(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),_t(r),r}function bi(e,s,n,a){let r=e.copy();switch(s){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=pt(i,n,o,l,a?.round);break}case"minute":r.minute=pt(e.minute,n,0,59,a?.round);break;case"second":r.second=pt(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=pt(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function pt(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const lu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,ou=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function cu(e){let s=e.match(lu);if(!s)throw ou.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new Xt(Ys(s[1],0,9999),Ys(s[2],1,12),1);return n.day=Ys(s[3],1,n.calendar.getDaysInMonth(n)),n}function Ys(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function gi(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function yi(e){let s=Tn(e,new Ms),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function du(e){return`${yi(e)}T${gi(e)}`}function uu(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function zn(e,s,n){uu(e,s),s.set(e,n)}function vi(e){let s=typeof e[0]=="object"?e.shift():new Ms,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var mu=new WeakMap;class Xt{copy(){return this.era?new Xt(this.calendar,this.era,this.year,this.month,this.day):new Xt(this.calendar,this.year,this.month,this.day)}add(s){return On(this,s)}subtract(s){return di(this,s)}set(s){return ui(this,s)}cycle(s,n,a){return hi(this,s,n,a)}toDate(s){return ii(this,s)}toString(){return yi(this)}compare(s){return ti(this,s)}constructor(...s){zn(this,mu,{writable:!0,value:void 0});let[n,a,r,i,o]=vi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,_t(this)}}var fu=new WeakMap;class Ps{copy(){return new Ps(this.hour,this.minute,this.second,this.millisecond)}add(s){return pi(this,s)}subtract(s){return iu(this,s)}set(s){return mi(this,s)}cycle(s,n,a){return bi(this,s,n,a)}toString(){return gi(this)}compare(s){return si(this,s)}constructor(s=0,n=0,a=0,r=0){zn(this,fu,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,fi(this)}}var xu=new WeakMap;class ws{copy(){return this.era?new ws(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new ws(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return On(this,s)}subtract(s){return di(this,s)}set(s){return ui(mi(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return hi(this,s,n,a);default:return bi(this,s,n,a)}}toDate(s,n){return ii(this,s,n)}toString(){return du(this)}compare(s){let n=ti(this,s);return n===0?si(this,li(s)):n}constructor(...s){zn(this,xu,{writable:!0,value:void 0});let[n,a,r,i,o]=vi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,_t(this)}}const pu="Open time options",hu=320;function Oa(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function Qs(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Ps(s,n,a)}function bu(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function gu(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Ps(n,a));return s}function yu(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=pu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...x}=e,m=l!==void 0,[p,f]=h.useState(()=>Qs(d)),g=m?Qs(l):p,v=h.useMemo(()=>gu(s),[s]),b=N=>{m||f(N),o?.(N)},y=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(X.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:v.map(N=>{const k=g?.hour===N.hour&&g?.minute===N.minute;return t.jsx(c.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(N),children:bu(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...x,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,y]}),onChange:N=>b(Qs(N))})}function Bn(e){if(e.mode==="time")return t.jsx(yu,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=hu,disableAnimation:d=!0,classNames:u,...x}=e;return t.jsx(c.DatePicker,{...x,calendarWidth:l,classNames:{...u,popoverContent:Oa("min-w-[20rem]",u?.popoverContent),calendarContent:Oa("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:s,granularity:n="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:n})}function vu({label:e,...s}){return t.jsx("button",{...s,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function ju(e){return e!==void 0&&e.trim()!==""}function ji(e,s){const n=Mr();if(h.isValidElement(s))return s;const a=[e,n].find(ju);return a===void 0?void 0:t.jsx(vu,{label:a})}const wi=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=ji(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});wi.displayName="Drawer";const ts=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=ji(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});ts.displayName="Modal";function wu(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const nt=h.forwardRef(({popoverProps:e,...s},n)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(wu(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});nt.displayName="Select";const Nu="text-default-600 data-[hover=true]:text-default-700",Vn=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn(Nu,e?.th)}}));Vn.displayName="Table";function Cu({state:e,onSubmit:s,onRemove:n,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[x,m]=h.useState(""),p=h.useId(),[f,g]=h.useState(e);e!==f&&(g(e),e==="applied"&&m(""));const v=()=>{const N=x.trim();N&&s(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),v())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(Jr,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const y=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:x,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":y?p:void 0}),t.jsx(T,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!x.trim(),onPress:v,children:l})]}),y&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const ku={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Su({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(nt,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(X.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(nt,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(X.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function $u({isLoggedIn:e,onLogin:s,onLogout:n,labels:a}){return e?t.jsxs(T,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(T,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Au({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:x}){const m={...ku,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",x),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||s.length>0)&&t.jsx(Su,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx($u,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function Du(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Zs;const Eu=typeof document<"u"?(Zs=h.useInsertionEffect)!==null&&Zs!==void 0?Zs:h.useLayoutEffect:()=>{};function ss(e,s,n){let[a,r]=h.useState(e||s),i=h.useRef(a),o=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;Eu(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),x=h.useCallback((m,...p)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),n?.(f,...p))},[n]);return[d,x]}function Ni(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(ze.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Ci=h.forwardRef(({color:e="primary",variant:s="default",stepsCount:n=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:x="compact",stepCounterFormat:m,onStepChange:p,currentStep:f,hideProgressBars:g=!1,stepClassName:v,className:b,isDisabled:y=!1,...N},k)=>{const[w,$]=ss(f,a,p),A=h.useMemo(()=>{let j,D;const S=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":j="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":j="[--step-color:var(--heroui-secondary)]",D="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":j="[--step-color:var(--heroui-success)]",D="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":j="[--step-color:var(--heroui-warning)]",D="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":j="[--step-color:var(--heroui-danger)]",D="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":j="[--step-color:var(--heroui-default)]",D="[--step-fg-color:var(--heroui-default-foreground)]";break;default:j="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(D),S.unshift(j),S},[e]);return t.jsxs("nav",{ref:k,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",x==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",A,b),"data-testid":"stepper-list",children:Array.from({length:n})?.map((j,D)=>{const S=w===D?"active":w<D?"inactive":"complete",_=s==="activeLabel"&&S==="active"&&!!i?.[D],F=o&&S!=="active"&&!!i?.[D];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${D}`,children:[t.jsx(c.Tooltip,{content:F?i?.[D]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":S==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":y},v),onClick:()=>!y&&$(D),disabled:y,"data-testid":`stepper-step-btn-${D}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:S,className:"relative z-10",children:t.jsx(ze.m.div,{animate:S,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":S==="complete","shadow-lg":S==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:S==="complete"&&s==="default"?t.jsx(Ni,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${D}`}):t.jsx("span",{children:D+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${D}`,children:i[D]}):null]},D)}),D<n-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":D},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":D<w})})})]},D)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null]})});Ci.displayName="Stepper";function Lu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function fe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Mt(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function Un(e,s,n="en-US"){const a=Mt(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function jn(e,s,n,a){return Un(e-s,n,a)}const za={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},Fu="rgb(156 163 175)",Ru="rgb(107 114 128)",ki=h.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Fu,inactiveLabelColor:x=Ru,activeStepVariant:m="bordered",stepClassName:p,circleClassName:f,progressBarClassName:g,labelsClassName:v,labelSlotClassName:b,activeLabelClassName:y,inactiveLabelClassName:N,className:k,ariaLabel:w="Progress",invalidLabelSuffix:$=", has errors",testId:A,isStepReachable:j,...D},S){const[_,F]=ss(i,a,r),L=za[s]??za.primary,P=l??L.active,B=d??L.fg,H=(K,O)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${O+1}`;return K.invalid?`${G}${$}`:G};return t.jsxs("nav",{...D,"aria-label":w,...A?{"data-testid":A}:{},children:[t.jsx("div",{className:c.cn("flex items-center",k),children:n?.map((K,O)=>{const ne=O===_?"active":O<_?"complete":"inactive",G=j?j(O):!0;return t.jsxs(h.Fragment,{children:[t.jsx(T,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${A??"horizontal-steps"}-step-${O}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":H(K,O),"data-invalid":K.invalid?"true":void 0,isDisabled:!G,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",G?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",K.className,p),onPress:()=>{if(i===void 0){F(O);return}r?.(O)},children:t.jsx(ze.LazyMotion,{features:ze.domAnimation,children:t.jsx(ze.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?P:"transparent",borderColor:P,borderWidth:"1.5px",color:m==="solid"?B:P},complete:{backgroundColor:P,borderColor:P,borderWidth:"1.5px",color:P}},children:ne==="complete"?t.jsx(Ni,{className:"size-4",style:{color:B}}):t.jsx("span",{children:O+1})})})}),O<n.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:O<_?P:u}})]},O)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",v),children:n?.map((K,O)=>{const ne=O<=_;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ne?y:N),style:{color:ne?P:x},children:K.title})}),O<n.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},O)})})]})});ki.displayName="HorizontalSteps";function se(e){return e!=null&&e!==!1&&e!==""}const Ye=e=>Ls[e],_u={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Si={done:{icon:Ye("--ok"),meta:Ye("--sub")},"needs-fix":{icon:Ye("--warn"),meta:Ye("--warn")},optional:{icon:Ye("--muted"),meta:Ye("--sub")}},Mu=Ye("--ink"),Pu={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},Iu={ready:{fill:Ye("--ok-fill"),text:Ye("--ok")},fix:{fill:Ye("--warn-fill"),text:Ye("--warn")},live:{fill:Ye("--ok-fill"),text:Ye("--ok")}},et={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Ot={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},Ct={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function Tu({step:e,labels:s}){const n=Si[e.status];if(e.status==="optional")return t.jsxs("span",{className:et.meta,style:{color:n.meta},children:[s.optional,se(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const a=e.status==="needs-fix"&&se(e.reason)?e.reason:e.summary,r=e.status==="done"?s.done:s.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",se(a)?t.jsx("span",{className:et.meta,style:{color:n.meta},children:a}):null]})}function $i({steps:e,currentStep:s,defaultStep:n=0,onStepChange:a,isStepReachable:r,ariaLabel:i,statusLabels:o,header:l,maxHeight:d,className:u,style:x,"data-testid":m="vertical-steps",...p}){const[f,g]=ss(s,n,a);return t.jsxs("div",{...p,"data-testid":m,className:c.cn(et.root,u),style:d===void 0?x:{maxHeight:d,...x},children:[l,t.jsx("nav",{"aria-label":i,className:et.nav,children:t.jsx("ol",{className:et.list,children:e.map((v,b)=>{const y=b===f,N=r?r(b):!0;return t.jsx("li",{children:t.jsxs(T,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:v.testId??`${m}-step-${v.key}`,"data-state":v.status,"data-current":y?"true":void 0,"aria-current":y?"step":void 0,isDisabled:!N,className:c.cn(et.row,y&&et.rowCurrent),onPress:()=>g(b),children:[t.jsx(M,{"aria-hidden":!0,icon:_u[v.status],className:et.icon,style:{color:Si[v.status].icon}}),t.jsxs("span",{className:et.text,children:[t.jsx("span",{className:c.cn(et.label,y&&et.labelCurrent),style:{color:Mu},children:`${b+1}. ${v.label}`})," ",t.jsx(Tu,{step:v,labels:o})]})]})},v.key)})})})]})}$i.displayName="VerticalSteps";function Ai({variant:e,title:s,description:n,className:a,"data-testid":r="steps-readiness"}){const i=Iu[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:c.cn(Ot.root,a),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(M,{"aria-hidden":!0,icon:Pu[e],className:Ot.icon}),t.jsxs("span",{className:Ot.text,children:[t.jsx("span",{className:Ot.title,children:s})," ",se(n)?t.jsx("span",{className:Ot.description,children:n}):null]})]})}Ai.displayName="StepsReadiness";function Di({steps:e,currentStep:s,onStepChange:n,progressLabel:a,nextLabel:r,previousLabel:i=g=>g.label,finalActionLabel:o,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":x="step-pager",previousTestId:m=`${x}-prev`,nextTestId:p=`${x}-next`,finalActionTestId:f=`${x}-final`}){const g=e[s-1],v=e[s+1],b=s===e.length-1;return t.jsxs("div",{"data-testid":x,className:c.cn(Ct.root,u),children:[t.jsx("div",{className:Ct.spacer,children:g?t.jsx(T,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(M,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:Ct.arrow}),onPress:()=>n(s-1),children:i(g)}):null}),t.jsx("span",{className:Ct.progress,children:a(s+1,e.length)}),t.jsx("div",{className:Ct.endSlot,children:v?t.jsx(T,{color:"primary",testId:p,endContent:t.jsx(M,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:Ct.arrow}),onPress:()=>n(s+1),children:r(v)}):b&&o!==void 0&&l?t.jsx(T,{color:"primary",testId:f,isDisabled:d,onPress:l,children:o}):null})]})}Di.displayName="StepPager";function Ou(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const zu=e=>{const s=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Bu,{...e},s)},Bu=({allItems:e,selected:s,onSelectedChange:n,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,x]=h.useState(null),[m,p]=h.useState(null),f=h.useMemo(()=>new Set(s),[s]),g=h.useMemo(()=>new Set(e),[e]),v=h.useMemo(()=>e.filter(F=>!f.has(F)),[e,f]),b=F=>{if(F.length===0)return;const L=Array.from(new Set([...s,...F]));n(L)},y=F=>{if(F.length===0)return;const L=new Set(F);n(s.filter(P=>!L.has(P)))},N=()=>{i.length!==0&&(b(i),o([]))},k=()=>{l.length!==0&&(y(l),d([]))},w=()=>{v.length!==0&&(b(v),o([]))},$=()=>{s.length!==0&&(n([]),d([]))},A=(F,L,P)=>{const B=Math.min(L,P),H=Math.max(L,P);return F.slice(B,H+1)},j=(F,L,P)=>{if(P&&u!==null){o(A(v,u,L)),d([]),x(L);return}const B=i.includes(F);o(B?i.filter(H=>H!==F):[...i,F]),d([]),x(L)},D=(F,L,P)=>{if(P&&m!==null){d(A(s,m,L)),o([]),p(L);return}const B=l.includes(F);d(B?l.filter(H=>H!==F):[...l,F]),o([]),p(L)},S=(F,L,P)=>{const B=P==="available"?i.includes(L)?i:[L]:l.includes(L)?l:[L];F.dataTransfer.setData("text/plain",JSON.stringify({source:P,items:B})),F.dataTransfer.effectAllowed="move"},_=(F,L)=>{F.preventDefault();const P=F.dataTransfer.getData("text/plain");if(P)try{const B=JSON.parse(P),H=(B.items||[]).filter(K=>g.has(K));if(H.length===0||B.source===L)return;L==="selected"?(b(H),o([])):(y(H),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:v.map((F,L)=>{const P=i.includes(F);return t.jsx("button",{type:"button",onClick:B=>{j(F,L,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>S(B,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:k,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:v.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:$,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:s.map((F,L)=>{const P=l.includes(F);return t.jsx("button",{type:"button",onClick:B=>{D(F,L,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>S(B,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function Jt(e){return typeof e=="string"?e:e.type}function bt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function yt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const ut={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},Vu={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Uu({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=ut.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,startContent:t.jsx(X.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(X.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:Vu[o]},o))})]})}const Xs={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function Hu({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive(l)),i=r?Xs[r].icon:X.List,o=l=>{const u=ut[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:s.map(l=>{const d=Xs[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:Xs[l].label},l)})})]})}function Wu({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(r),className:`
7
+ `}const oe={line:"#E7E7E9","line-2":"#F1F1F3",hair:"#F0F0F1",page:"#FBFBFB",field:"#E5E5E5","line-strong":"#D4D4D8",ink:"#18181B",muted:"#71717A",faint:"#A1A1AA","ok-fill":"#EAF3DE",ok:"#3B6D11","warn-fill":"#FAEEDA",warn:"#854F0B","warn-icon":"#EFD9B2","danger-fill":"#FCEBEB",danger:Fe.semantic.danger,"danger-icon":"#F3D3CF","info-fill":"#EAF1FC",info:"#1D4FA8","violet-fill":"#F1ECFB",violet:"#6D28D9","neutral-fill":"#F4F4F5",neutral:"#52525B",destructive:"#A32D2D"};({...oe});const Ir=h.createContext(void 0);function Tr(){return h.useContext(Ir)}function Gc({children:e,closeLabel:s,locale:n,reducedMotion:a="user"}){const r=Tr();return t.jsx(c.HeroUIProvider,{locale:n,reducedMotion:a,children:t.jsx(Ir.Provider,{value:s??r,children:e})})}const Or="(prefers-reduced-motion: reduce)",zr="data-pos-reduce-motion",Ce="motion-reduce:transition-none [html[data-pos-reduce-motion=true]_&]:transition-none",Mn="motion-reduce:animate-none [html[data-pos-reduce-motion=true]_&]:animate-none",bs=`rounded-[0.375rem] bg-[linear-gradient(90deg,#F0F0F1_0,#F9F9FA_12.5rem,#F0F0F1_25rem)] bg-[length:50rem_100%] animate-record-shimmer ${Mn}`;function Kc(){return typeof document>"u"?!1:document.documentElement.getAttribute(zr)==="true"?!0:typeof window.matchMedia=="function"&&window.matchMedia(Or).matches}function _s(){const[e,s]=h.useState(!1);return h.useEffect(()=>{const n=()=>s(Kc()),a=typeof window.matchMedia=="function"?window.matchMedia(Or):null;a?.addEventListener?.("change",n);const r=typeof MutationObserver>"u"?null:new MutationObserver(n);return r?.observe(document.documentElement,{attributes:!0,attributeFilter:[zr]}),n(),()=>{a?.removeEventListener?.("change",n),r?.disconnect()}},[]),e}const Yc="whitespace-normal overflow-visible text-clip break-words",Tt={base:"gap-x-2 sm:w-auto sm:min-w-[356px] sm:max-w-[min(32rem,calc(100vw_-_11rem))]",closeButton:"relative inset-auto self-start shrink-0 -my-3 -me-3 h-11 w-11 min-w-11 opacity-100",closeIcon:"h-6 w-6",title:`${Yc} me-0`,description:"me-0"};function Qc(e){return{...e,base:c.cn(Tt.base,e?.base),closeButton:c.cn(Tt.closeButton,e?.closeButton),closeIcon:c.cn(Tt.closeIcon,e?.closeIcon),title:c.cn(Tt.title,e?.title),description:c.cn(Tt.description,e?.description)}}function Zc({toastProps:e,disableAnimation:s,...n}){const a=_s();return t.jsx(c.ToastProvider,{...n,disableAnimation:s??(a||void 0),toastProps:{...e,classNames:Qc(e?.classNames)}})}const Br=h.createContext("default");function Ms(){return h.useContext(Br)}function Xc(e){return Ms()==="touch"?"lg":e}function Jc({density:e,children:s}){return t.jsx(Br.Provider,{value:e,children:s})}function ed(e,s){const n=e.icons,a=e.aliases||Object.create(null),r=Object.create(null);function i(o){if(n[o])return r[o]=[];if(!(o in r)){r[o]=null;const l=a[o]&&a[o].parent,d=l&&i(l);d&&(r[o]=[l].concat(d))}return r[o]}return Object.keys(n).concat(Object.keys(a)).forEach(i),r}const Vr=Object.freeze({left:0,top:0,width:16,height:16}),Ns=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Pn=Object.freeze({...Vr,...Ns}),bn=Object.freeze({...Pn,body:"",hidden:!1});function td(e,s){const n={};!e.hFlip!=!s.hFlip&&(n.hFlip=!0),!e.vFlip!=!s.vFlip&&(n.vFlip=!0);const a=((e.rotate||0)+(s.rotate||0))%4;return a&&(n.rotate=a),n}function Sa(e,s){const n=td(e,s);for(const a in bn)a in Ns?a in e&&!(a in n)&&(n[a]=Ns[a]):a in s?n[a]=s[a]:a in e&&(n[a]=e[a]);return n}function sd(e,s,n){const a=e.icons,r=e.aliases||Object.create(null);let i={};function o(l){i=Sa(a[l]||r[l],i)}return o(s),n.forEach(o),Sa(e,i)}function Ur(e,s){const n=[];if(typeof e!="object"||typeof e.icons!="object")return n;e.not_found instanceof Array&&e.not_found.forEach(r=>{s(r,null),n.push(r)});const a=ed(e);for(const r in a){const i=a[r];i&&(s(r,sd(e,r,i)),n.push(r))}return n}const nd={provider:"",aliases:{},not_found:{},...Vr};function Gs(e,s){for(const n in s)if(n in e&&typeof e[n]!=typeof s[n])return!1;return!0}function Hr(e){if(typeof e!="object"||e===null)return null;const s=e;if(typeof s.prefix!="string"||!e.icons||typeof e.icons!="object"||!Gs(e,nd))return null;const n=s.icons;for(const r in n){const i=n[r];if(!r||typeof i.body!="string"||!Gs(i,bn))return null}const a=s.aliases||Object.create(null);for(const r in a){const i=a[r],o=i.parent;if(!r||typeof o!="string"||!n[o]&&!a[o]||!Gs(i,bn))return null}return s}const $a=Object.create(null);function ad(e,s){return{provider:e,prefix:s,icons:Object.create(null),missing:new Set}}function _t(e,s){const n=$a[e]||($a[e]=Object.create(null));return n[s]||(n[s]=ad(e,s))}function Wr(e,s){return Hr(s)?Ur(s,(n,a)=>{a?e.icons[n]=a:e.missing.add(n)}):[]}function rd(e,s,n){try{if(typeof n.body=="string")return e.icons[s]={...n},!0}catch{}return!1}const qr=/^[a-z0-9]+(-[a-z0-9]+)*$/,Ps=(e,s,n,a="")=>{const r=e.split(":");if(e.slice(0,1)==="@"){if(r.length<2||r.length>3)return null;a=r.shift().slice(1)}if(r.length>3||!r.length)return null;if(r.length>1){const l=r.pop(),d=r.pop(),u={provider:r.length>0?r[0]:a,prefix:d,name:l};return s&&!gs(u)?null:u}const i=r[0],o=i.split("-");if(o.length>1){const l={provider:a,prefix:o.shift(),name:o.join("-")};return s&&!gs(l)?null:l}if(n&&a===""){const l={provider:a,prefix:"",name:i};return s&&!gs(l,n)?null:l}return null},gs=(e,s)=>e?!!((s&&e.prefix===""||e.prefix)&&e.name):!1;let Jt=!1;function Gr(e){return typeof e=="boolean"&&(Jt=e),Jt}function Aa(e){const s=typeof e=="string"?Ps(e,!0,Jt):e;if(s){const n=_t(s.provider,s.prefix),a=s.name;return n.icons[a]||(n.missing.has(a)?null:void 0)}}function id(e,s){const n=Ps(e,!0,Jt);if(!n)return!1;const a=_t(n.provider,n.prefix);return s?rd(a,n.name,s):(a.missing.add(n.name),!0)}function ld(e,s){if(typeof e!="object")return!1;if(typeof s!="string"&&(s=e.provider||""),Jt&&!s&&!e.prefix){let r=!1;return Hr(e)&&(e.prefix="",Ur(e,(i,o)=>{id(i,o)&&(r=!0)})),r}const n=e.prefix;if(!gs({prefix:n,name:"a"}))return!1;const a=_t(s,n);return!!Wr(a,e)}const Kr=Object.freeze({width:null,height:null}),Yr=Object.freeze({...Kr,...Ns}),od=/(-?[0-9.]*[0-9]+[0-9.]*)/g,cd=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Da(e,s,n){if(s===1)return e;if(n=n||100,typeof e=="number")return Math.ceil(e*s*n)/n;if(typeof e!="string")return e;const a=e.split(od);if(a===null||!a.length)return e;const r=[];let i=a.shift(),o=cd.test(i);for(;;){if(o){const l=parseFloat(i);isNaN(l)?r.push(i):r.push(Math.ceil(l*s*n)/n)}else r.push(i);if(i=a.shift(),i===void 0)return r.join("");o=!o}}function dd(e,s="defs"){let n="";const a=e.indexOf("<"+s);for(;a>=0;){const r=e.indexOf(">",a),i=e.indexOf("</"+s);if(r===-1||i===-1)break;const o=e.indexOf(">",i);if(o===-1)break;n+=e.slice(r+1,i).trim(),e=e.slice(0,a).trim()+e.slice(o+1)}return{defs:n,content:e}}function ud(e,s){return e?"<defs>"+e+"</defs>"+s:s}function md(e,s,n){const a=dd(e);return ud(a.defs,s+a.content+n)}const fd=e=>e==="unset"||e==="undefined"||e==="none";function xd(e,s){const n={...Pn,...e},a={...Yr,...s},r={left:n.left,top:n.top,width:n.width,height:n.height};let i=n.body;[n,a].forEach(v=>{const b=[],y=v.hFlip,N=v.vFlip;let k=v.rotate;y?N?k+=2:(b.push("translate("+(r.width+r.left).toString()+" "+(0-r.top).toString()+")"),b.push("scale(-1 1)"),r.top=r.left=0):N&&(b.push("translate("+(0-r.left).toString()+" "+(r.height+r.top).toString()+")"),b.push("scale(1 -1)"),r.top=r.left=0);let w;switch(k<0&&(k-=Math.floor(k/4)*4),k=k%4,k){case 1:w=r.height/2+r.top,b.unshift("rotate(90 "+w.toString()+" "+w.toString()+")");break;case 2:b.unshift("rotate(180 "+(r.width/2+r.left).toString()+" "+(r.height/2+r.top).toString()+")");break;case 3:w=r.width/2+r.left,b.unshift("rotate(-90 "+w.toString()+" "+w.toString()+")");break}k%2===1&&(r.left!==r.top&&(w=r.left,r.left=r.top,r.top=w),r.width!==r.height&&(w=r.width,r.width=r.height,r.height=w)),b.length&&(i=md(i,'<g transform="'+b.join(" ")+'">',"</g>"))});const o=a.width,l=a.height,d=r.width,u=r.height;let x,m;o===null?(m=l===null?"1em":l==="auto"?u:l,x=Da(m,d/u)):(x=o==="auto"?d:o,m=l===null?Da(x,u/d):l==="auto"?u:l);const p={},f=(v,b)=>{fd(b)||(p[v]=b.toString())};f("width",x),f("height",m);const g=[r.left,r.top,d,u];return p.viewBox=g.join(" "),{attributes:p,viewBox:g,body:i}}const pd=/\sid="(\S+)"/g,hd="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let bd=0;function gd(e,s=hd){const n=[];let a;for(;a=pd.exec(e);)n.push(a[1]);if(!n.length)return e;const r="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(i=>{const o=typeof s=="function"?s(i):s+(bd++).toString(),l=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+o+r+"$3")}),e=e.replace(new RegExp(r,"g"),""),e}const gn=Object.create(null);function yd(e,s){gn[e]=s}function yn(e){return gn[e]||gn[""]}function In(e){let s;if(typeof e.resources=="string")s=[e.resources];else if(s=e.resources,!(s instanceof Array)||!s.length)return null;return{resources:s,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const Tn=Object.create(null),Ot=["https://api.simplesvg.com","https://api.unisvg.com"],ys=[];for(;Ot.length>0;)Ot.length===1||Math.random()>.5?ys.push(Ot.shift()):ys.push(Ot.pop());Tn[""]=In({resources:["https://api.iconify.design"].concat(ys)});function vd(e,s){const n=In(s);return n===null?!1:(Tn[e]=n,!0)}function On(e){return Tn[e]}const jd=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ea=jd();function wd(e,s){const n=On(e);if(!n)return 0;let a;if(!n.maxURL)a=0;else{let r=0;n.resources.forEach(o=>{r=Math.max(r,o.length)});const i=s+".json?icons=";a=n.maxURL-r-n.path.length-i.length}return a}function Nd(e){return e===404}const Cd=(e,s,n)=>{const a=[],r=wd(e,s),i="icons";let o={type:i,provider:e,prefix:s,icons:[]},l=0;return n.forEach((d,u)=>{l+=d.length+1,l>=r&&u>0&&(a.push(o),o={type:i,provider:e,prefix:s,icons:[]},l=d.length),o.icons.push(d)}),a.push(o),a};function kd(e){if(typeof e=="string"){const s=On(e);if(s)return s.path}return"/"}const Sd=(e,s,n)=>{if(!Ea){n("abort",424);return}let a=kd(s.provider);switch(s.type){case"icons":{const i=s.prefix,l=s.icons.join(","),d=new URLSearchParams({icons:l});a+=i+".json?"+d.toString();break}case"custom":{const i=s.uri;a+=i.slice(0,1)==="/"?i.slice(1):i;break}default:n("abort",400);return}let r=503;Ea(e+a).then(i=>{const o=i.status;if(o!==200){setTimeout(()=>{n(Nd(o)?"abort":"next",o)});return}return r=501,i.json()}).then(i=>{if(typeof i!="object"||i===null){setTimeout(()=>{i===404?n("abort",i):n("next",r)});return}setTimeout(()=>{n("success",i)})}).catch(()=>{n("next",r)})},$d={prepare:Cd,send:Sd};function Qr(e,s){e.forEach(n=>{const a=n.loaderCallbacks;a&&(n.loaderCallbacks=a.filter(r=>r.id!==s))})}function Ad(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const s=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!s.length)return;let n=!1;const a=e.provider,r=e.prefix;s.forEach(i=>{const o=i.icons,l=o.pending.length;o.pending=o.pending.filter(d=>{if(d.prefix!==r)return!0;const u=d.name;if(e.icons[u])o.loaded.push({provider:a,prefix:r,name:u});else if(e.missing.has(u))o.missing.push({provider:a,prefix:r,name:u});else return n=!0,!0;return!1}),o.pending.length!==l&&(n||Qr([e],i.id),i.callback(o.loaded.slice(0),o.missing.slice(0),o.pending.slice(0),i.abort))})}))}let Dd=0;function Ed(e,s,n){const a=Dd++,r=Qr.bind(null,n,a);if(!s.pending.length)return r;const i={id:a,icons:s,callback:e,abort:r};return n.forEach(o=>{(o.loaderCallbacks||(o.loaderCallbacks=[])).push(i)}),r}function Ld(e){const s={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((r,i)=>r.provider!==i.provider?r.provider.localeCompare(i.provider):r.prefix!==i.prefix?r.prefix.localeCompare(i.prefix):r.name.localeCompare(i.name));let a={provider:"",prefix:"",name:""};return e.forEach(r=>{if(a.name===r.name&&a.prefix===r.prefix&&a.provider===r.provider)return;a=r;const i=r.provider,o=r.prefix,l=r.name,d=n[i]||(n[i]=Object.create(null)),u=d[o]||(d[o]=_t(i,o));let x;l in u.icons?x=s.loaded:o===""||u.missing.has(l)?x=s.missing:x=s.pending;const m={provider:i,prefix:o,name:l};x.push(m)}),s}function Fd(e,s=!0,n=!1){const a=[];return e.forEach(r=>{const i=typeof r=="string"?Ps(r,s,n):r;i&&a.push(i)}),a}const Rd={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function _d(e,s,n,a){const r=e.resources.length,i=e.random?Math.floor(Math.random()*r):e.index;let o;if(e.random){let A=e.resources.slice(0);for(o=[];A.length>1;){const j=Math.floor(Math.random()*A.length);o.push(A[j]),A=A.slice(0,j).concat(A.slice(j+1))}o=o.concat(A)}else o=e.resources.slice(i).concat(e.resources.slice(0,i));const l=Date.now();let d="pending",u=0,x,m=null,p=[],f=[];typeof a=="function"&&f.push(a);function g(){m&&(clearTimeout(m),m=null)}function v(){d==="pending"&&(d="aborted"),g(),p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function b(A,j){j&&(f=[]),typeof A=="function"&&f.push(A)}function y(){return{startTime:l,payload:s,status:d,queriesSent:u,queriesPending:p.length,subscribe:b,abort:v}}function N(){d="failed",f.forEach(A=>{A(void 0,x)})}function k(){p.forEach(A=>{A.status==="pending"&&(A.status="aborted")}),p=[]}function w(A,j,D){const S=j!=="success";switch(p=p.filter(_=>_!==A),d){case"pending":break;case"failed":if(S||!e.dataAfterTimeout)return;break;default:return}if(j==="abort"){x=D,N();return}if(S){x=D,p.length||(o.length?$():N());return}if(g(),k(),!e.random){const _=e.resources.indexOf(A.resource);_!==-1&&_!==e.index&&(e.index=_)}d="completed",f.forEach(_=>{_(D)})}function $(){if(d!=="pending")return;g();const A=o.shift();if(A===void 0){if(p.length){m=setTimeout(()=>{g(),d==="pending"&&(k(),N())},e.timeout);return}N();return}const j={status:"pending",resource:A,callback:(D,S)=>{w(j,D,S)}};p.push(j),u++,m=setTimeout($,e.rotate),n(A,s,j.callback)}return setTimeout($),y}function Zr(e){const s={...Rd,...e};let n=[];function a(){n=n.filter(l=>l().status==="pending")}function r(l,d,u){const x=_d(s,l,d,(m,p)=>{a(),u&&u(m,p)});return n.push(x),x}function i(l){return n.find(d=>l(d))||null}return{query:r,find:i,setIndex:l=>{s.index=l},getIndex:()=>s.index,cleanup:a}}function La(){}const Ks=Object.create(null);function Md(e){if(!Ks[e]){const s=On(e);if(!s)return;const n=Zr(s),a={config:s,redundancy:n};Ks[e]=a}return Ks[e]}function Pd(e,s,n){let a,r;if(typeof e=="string"){const i=yn(e);if(!i)return n(void 0,424),La;r=i.send;const o=Md(e);o&&(a=o.redundancy)}else{const i=In(e);if(i){a=Zr(i);const o=e.resources?e.resources[0]:"",l=yn(o);l&&(r=l.send)}}return!a||!r?(n(void 0,424),La):a.query(s,r,n)().abort}function Fa(){}function Id(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ad(e)}))}function Td(e){const s=[],n=[];return e.forEach(a=>{(a.match(qr)?s:n).push(a)}),{valid:s,invalid:n}}function zt(e,s,n){function a(){const r=e.pendingIcons;s.forEach(i=>{r&&r.delete(i),e.icons[i]||e.missing.add(i)})}if(n&&typeof n=="object")try{if(!Wr(e,n).length){a();return}}catch(r){console.error(r)}a(),Id(e)}function Ra(e,s){e instanceof Promise?e.then(n=>{s(n)}).catch(()=>{s(null)}):s(e)}function Od(e,s){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(s).sort():e.iconsToLoad=s,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:n,prefix:a}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;const i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){Ra(e.loadIcons(r,a,n),x=>{zt(e,r,x)});return}if(i){r.forEach(x=>{const m=i(x,a,n);Ra(m,p=>{const f=p?{prefix:a,icons:{[x]:p}}:null;zt(e,[x],f)})});return}const{valid:o,invalid:l}=Td(r);if(l.length&&zt(e,l,null),!o.length)return;const d=a.match(qr)?yn(n):null;if(!d){zt(e,o,null);return}d.prepare(n,a,o).forEach(x=>{Pd(n,x,m=>{zt(e,x.icons,m)})})}))}const zd=(e,s)=>{const n=Fd(e,!0,Gr()),a=Ld(n);if(!a.pending.length){let d=!0;return s&&setTimeout(()=>{d&&s(a.loaded,a.missing,a.pending,Fa)}),()=>{d=!1}}const r=Object.create(null),i=[];let o,l;return a.pending.forEach(d=>{const{provider:u,prefix:x}=d;if(x===l&&u===o)return;o=u,l=x,i.push(_t(u,x));const m=r[u]||(r[u]=Object.create(null));m[x]||(m[x]=[])}),a.pending.forEach(d=>{const{provider:u,prefix:x,name:m}=d,p=_t(u,x),f=p.pendingIcons||(p.pendingIcons=new Set);f.has(m)||(f.add(m),r[u][x].push(m))}),i.forEach(d=>{const u=r[d.provider][d.prefix];u.length&&Od(d,u)}),s?Ed(s,a,i):Fa};function Bd(e,s){const n={...e};for(const a in s){const r=s[a],i=typeof r;a in Kr?(r===null||r&&(i==="string"||i==="number"))&&(n[a]=r):i===typeof n[a]&&(n[a]=a==="rotate"?r%4:r)}return n}const Vd=/[\s,]+/;function Ud(e,s){s.split(Vd).forEach(n=>{switch(n.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Hd(e,s=0){const n=e.replace(/^-?[0-9.]*/,"");function a(r){for(;r<0;)r+=4;return r%4}if(n===""){const r=parseInt(e);return isNaN(r)?0:a(r)}else if(n!==e){let r=0;switch(n){case"%":r=25;break;case"deg":r=90}if(r){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i=i/r,i%1===0?a(i):0)}}return s}function Wd(e,s){let n=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const a in s)n+=" "+a+'="'+s[a]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+e+"</svg>"}function qd(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Gd(e){return"data:image/svg+xml,"+qd(e)}function Kd(e){return'url("'+Gd(e)+'")'}let Qt;function Yd(){try{Qt=window.trustedTypes.createPolicy("iconify",{createHTML:e=>e})}catch{Qt=null}}function Qd(e){return Qt===void 0&&Yd(),Qt?Qt.createHTML(e):e}const Xr={...Yr,inline:!1},Zd={xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Xd={display:"inline-block"},vn={backgroundColor:"currentColor"},Jr={backgroundColor:"transparent"},_a={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ma={WebkitMask:vn,mask:vn,background:Jr};for(const e in Ma){const s=Ma[e];for(const n in _a)s[e+n]=_a[n]}const Jd={...Xr,inline:!0};function Pa(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const eu=(e,s,n)=>{const a=s.inline?Jd:Xr,r=Bd(a,s),i=s.mode||"svg",o={},l=s.style||{},d={...i==="svg"?Zd:{}};if(n){const b=Ps(n,!1,!0);if(b){const y=["iconify"],N=["provider","prefix"];for(const k of N)b[k]&&y.push("iconify--"+b[k]);d.className=y.join(" ")}}for(let b in s){const y=s[b];if(y!==void 0)switch(b){case"icon":case"style":case"children":case"onLoad":case"mode":case"ssr":case"fallback":break;case"_ref":d.ref=y;break;case"className":d[b]=(d[b]?d[b]+" ":"")+y;break;case"inline":case"hFlip":case"vFlip":r[b]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&Ud(r,y);break;case"color":o.color=y;break;case"rotate":typeof y=="string"?r[b]=Hd(y):typeof y=="number"&&(r[b]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete d["aria-hidden"];break;default:a[b]===void 0&&(d[b]=y)}}const u=xd(e,r),x=u.attributes;if(r.inline&&(o.verticalAlign="-0.125em"),i==="svg"){d.style={...o,...l},Object.assign(d,x);let b=0,y=s.id;return typeof y=="string"&&(y=y.replace(/-/g,"_")),d.dangerouslySetInnerHTML={__html:Qd(gd(u.body,y?()=>y+"ID"+b++:"iconifyReact"))},h.createElement("svg",d)}const{body:m,width:p,height:f}=e,g=i==="mask"||(i==="bg"?!1:m.indexOf("currentColor")!==-1),v=Wd(m,{...x,width:p+"",height:f+""});return d.style={...o,"--svg":Kd(v),width:Pa(x.width),height:Pa(x.height),...Xd,...g?vn:Jr,...l},h.createElement("span",d)};Gr(!0);yd("",$d);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const s=e.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof s=="object"&&s!==null&&(s instanceof Array?s:[s]).forEach(a=>{try{(typeof a!="object"||a===null||a instanceof Array||typeof a.icons!="object"||typeof a.prefix!="string"||!ld(a))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){const s=e.IconifyProviders;if(typeof s=="object"&&s!==null)for(let n in s){const a="IconifyProviders["+n+"] is invalid.";try{const r=s[n];if(typeof r!="object"||!r||r.resources===void 0)continue;vd(n,r)||console.error(a)}catch{console.error(a)}}}}function ei(e){const[s,n]=h.useState(!!e.ssr),[a,r]=h.useState({});function i(f){if(f){const g=e.icon;if(typeof g=="object")return{name:"",data:g};const v=Aa(g);if(v)return{name:g,data:v}}return{name:""}}const[o,l]=h.useState(i(!!e.ssr));function d(){const f=a.callback;f&&(f(),r({}))}function u(f){if(JSON.stringify(o)!==JSON.stringify(f))return d(),l(f),!0}function x(){var f;const g=e.icon;if(typeof g=="object"){u({name:"",data:g});return}const v=Aa(g);if(u({name:g,data:v}))if(v===void 0){const b=zd([g],x);r({callback:b})}else v&&((f=e.onLoad)===null||f===void 0||f.call(e,g))}h.useEffect(()=>(n(!0),d),[]),h.useEffect(()=>{s&&x()},[e.icon,s]);const{name:m,data:p}=o;return p?eu({...Pn,...p},e,m):e.children?e.children:e.fallback?e.fallback:h.createElement("span",{})}const M=h.forwardRef((e,s)=>ei({...e,_ref:s}));h.forwardRef((e,s)=>ei({inline:!0,...e,_ref:s}));const T=h.forwardRef(({color:e="primary",radius:s="full",testId:n="veevart-button",...a},r)=>t.jsx(c.Button,{ref:r,color:e,radius:s,"data-testid":n,...a}));T.displayName="Button";function ti({code:e,amount:s,onRemove:n,label:a="Gift Card",removeAriaLabel:r="Remove gift card",testId:i="veevart-applied-code-card"}){return t.jsx(c.Card,{"data-testid":i,shadow:"sm",className:"w-full",children:t.jsxs(c.CardBody,{className:"flex flex-row items-start justify-between gap-2 p-4",children:[t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[t.jsx("span",{className:"text-xs text-default-500",children:a}),t.jsx("span",{"data-testid":`${i}-code`,className:"truncate font-medium text-foreground",children:e}),t.jsx("span",{"data-testid":`${i}-amount`,className:"text-lg font-semibold text-primary",children:s})]}),t.jsx(T,{testId:`${i}-remove`,isIconOnly:!0,size:"sm",variant:"light","aria-label":r,onPress:n,children:t.jsx(M,{icon:"solar:close-circle-linear",className:"size-4","aria-hidden":"true"})})]})})}function Ys(e,s){return e-s*Math.floor(e/s)}const si=1721426;function ds(e,s,n,a){s=zn(e,s);let r=s-1,i=-2;return n<=2?i=0:vs(s)&&(i=-1),si-1+365*r+Math.floor(r/4)-Math.floor(r/100)+Math.floor(r/400)+Math.floor((367*n-362)/12+i+a)}function vs(e){return e%4===0&&(e%100!==0||e%400===0)}function zn(e,s){return e==="BC"?1-s:s}function tu(e){let s="AD";return e<=0&&(s="BC",e=1-e),[s,e]}const su={standard:[31,28,31,30,31,30,31,31,30,31,30,31],leapyear:[31,29,31,30,31,30,31,31,30,31,30,31]};class Is{fromJulianDay(s){let n=s,a=n-si,r=Math.floor(a/146097),i=Ys(a,146097),o=Math.floor(i/36524),l=Ys(i,36524),d=Math.floor(l/1461),u=Ys(l,1461),x=Math.floor(u/365),m=r*400+o*100+d*4+x+(o!==4&&x!==4?1:0),[p,f]=tu(m),g=n-ds(p,f,1,1),v=2;n<ds(p,f,3,1)?v=0:vs(f)&&(v=1);let b=Math.floor(((g+v)*12+373)/367),y=n-ds(p,f,b,1)+1;return new es(p,f,b,y)}toJulianDay(s){return ds(s.era,s.year,s.month,s.day)}getDaysInMonth(s){return su[vs(s.year)?"leapyear":"standard"][s.month-1]}getMonthsInYear(s){return 12}getDaysInYear(s){return vs(s.year)?366:365}getMaximumMonthsInYear(){return 12}getMaximumDaysInMonth(){return 31}getYearsInEra(s){return 9999}getEras(){return["BC","AD"]}isInverseEra(s){return s.era==="BC"}balanceDate(s){s.year<=0&&(s.era=s.era==="BC"?"AD":"BC",s.year=1-s.year)}constructor(){this.identifier="gregory"}}function nu(e,s){var n,a,r,i;return(i=(r=(n=e.isEqual)===null||n===void 0?void 0:n.call(e,s))!==null&&r!==void 0?r:(a=s.isEqual)===null||a===void 0?void 0:a.call(s,e))!==null&&i!==void 0?i:e.identifier===s.identifier}function ni(e,s){return e.calendar.toJulianDay(e)-s.calendar.toJulianDay(s)}function ai(e,s){return Ia(e)-Ia(s)}function Ia(e){return e.hour*36e5+e.minute*6e4+e.second*1e3+e.millisecond}let Qs=null;function ri(){return Qs==null&&(Qs=new Intl.DateTimeFormat().resolvedOptions().timeZone),Qs}function Ta(e){e=Bn(e,new Is);let s=zn(e.era,e.year);return ii(s,e.month,e.day,e.hour,e.minute,e.second,e.millisecond)}function ii(e,s,n,a,r,i,o){let l=new Date;return l.setUTCHours(a,r,i,o),l.setUTCFullYear(e,s-1,n),l.getTime()}function Oa(e,s){if(s==="UTC")return 0;if(e>0&&s===ri())return new Date(e).getTimezoneOffset()*-6e4;let{year:n,month:a,day:r,hour:i,minute:o,second:l}=li(e,s);return ii(n,a,r,i,o,l,0)-Math.floor(e/1e3)*1e3}const za=new Map;function li(e,s){let n=za.get(s);n||(n=new Intl.DateTimeFormat("en-US",{timeZone:s,hour12:!1,era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),za.set(s,n));let a=n.formatToParts(new Date(e)),r={};for(let i of a)i.type!=="literal"&&(r[i.type]=i.value);return{year:r.era==="BC"||r.era==="B"?-r.year+1:+r.year,month:+r.month,day:+r.day,hour:r.hour==="24"?0:+r.hour,minute:+r.minute,second:+r.second}}const Ba=864e5;function au(e,s,n,a){return(n===a?[n]:[n,a]).filter(i=>ru(e,s,i))}function ru(e,s,n){let a=li(n,s);return e.year===a.year&&e.month===a.month&&e.day===a.day&&e.hour===a.hour&&e.minute===a.minute&&e.second===a.second}function iu(e,s,n="compatible"){let a=ci(e);if(s==="UTC")return Ta(a);if(s===ri()&&n==="compatible"){a=Bn(a,new Is);let d=new Date,u=zn(a.era,a.year);return d.setFullYear(u,a.month-1,a.day),d.setHours(a.hour,a.minute,a.second,a.millisecond),d.getTime()}let r=Ta(a),i=Oa(r-Ba,s),o=Oa(r+Ba,s),l=au(a,s,r-i,r-o);if(l.length===1)return l[0];if(l.length>1)switch(n){case"compatible":case"earlier":return l[0];case"later":return l[l.length-1];case"reject":throw new RangeError("Multiple possible absolute times found")}switch(n){case"earlier":return Math.min(r-i,r-o);case"compatible":case"later":return Math.max(r-i,r-o);case"reject":throw new RangeError("No such absolute time found")}}function oi(e,s,n="compatible"){return new Date(iu(e,s,n))}function ci(e,s){let n=0,a=0,r=0,i=0;if("timeZone"in e)({hour:n,minute:a,second:r,millisecond:i}=e);else if("hour"in e&&!s)return e;return s&&({hour:n,minute:a,second:r,millisecond:i}=s),new Cs(e.calendar,e.era,e.year,e.month,e.day,n,a,r,i)}function Bn(e,s){if(nu(e.calendar,s))return e;let n=s.fromJulianDay(e.calendar.toJulianDay(e)),a=e.copy();return a.calendar=s,a.era=n.era,a.year=n.year,a.month=n.month,a.day=n.day,Mt(a),a}function Vn(e,s){let n=e.copy(),a="hour"in n?hi(n,s):0;jn(n,s.years||0),n.calendar.balanceYearMonth&&n.calendar.balanceYearMonth(n,e),n.month+=s.months||0,wn(n),di(n),n.day+=(s.weeks||0)*7,n.day+=s.days||0,n.day+=a,lu(n),n.calendar.balanceDate&&n.calendar.balanceDate(n),n.year<1&&(n.year=1,n.month=1,n.day=1);let r=n.calendar.getYearsInEra(n);if(n.year>r){var i,o;let d=(i=(o=n.calendar).isInverseEra)===null||i===void 0?void 0:i.call(o,n);n.year=r,n.month=d?1:n.calendar.getMonthsInYear(n),n.day=d?1:n.calendar.getDaysInMonth(n)}n.month<1&&(n.month=1,n.day=1);let l=n.calendar.getMonthsInYear(n);return n.month>l&&(n.month=l,n.day=n.calendar.getDaysInMonth(n)),n.day=Math.max(1,Math.min(n.calendar.getDaysInMonth(n),n.day)),n}function jn(e,s){var n,a;!((n=(a=e.calendar).isInverseEra)===null||n===void 0)&&n.call(a,e)&&(s=-s),e.year+=s}function wn(e){for(;e.month<1;)jn(e,-1),e.month+=e.calendar.getMonthsInYear(e);let s=0;for(;e.month>(s=e.calendar.getMonthsInYear(e));)e.month-=s,jn(e,1)}function lu(e){for(;e.day<1;)e.month--,wn(e),e.day+=e.calendar.getDaysInMonth(e);for(;e.day>e.calendar.getDaysInMonth(e);)e.day-=e.calendar.getDaysInMonth(e),e.month++,wn(e)}function di(e){e.month=Math.max(1,Math.min(e.calendar.getMonthsInYear(e),e.month)),e.day=Math.max(1,Math.min(e.calendar.getDaysInMonth(e),e.day))}function Mt(e){e.calendar.constrainDate&&e.calendar.constrainDate(e),e.year=Math.max(1,Math.min(e.calendar.getYearsInEra(e),e.year)),di(e)}function ui(e){let s={};for(let n in e)typeof e[n]=="number"&&(s[n]=-e[n]);return s}function mi(e,s){return Vn(e,ui(s))}function fi(e,s){let n=e.copy();return s.era!=null&&(n.era=s.era),s.year!=null&&(n.year=s.year),s.month!=null&&(n.month=s.month),s.day!=null&&(n.day=s.day),Mt(n),n}function xi(e,s){let n=e.copy();return s.hour!=null&&(n.hour=s.hour),s.minute!=null&&(n.minute=s.minute),s.second!=null&&(n.second=s.second),s.millisecond!=null&&(n.millisecond=s.millisecond),pi(n),n}function ou(e){e.second+=Math.floor(e.millisecond/1e3),e.millisecond=us(e.millisecond,1e3),e.minute+=Math.floor(e.second/60),e.second=us(e.second,60),e.hour+=Math.floor(e.minute/60),e.minute=us(e.minute,60);let s=Math.floor(e.hour/24);return e.hour=us(e.hour,24),s}function pi(e){e.millisecond=Math.max(0,Math.min(e.millisecond,1e3)),e.second=Math.max(0,Math.min(e.second,59)),e.minute=Math.max(0,Math.min(e.minute,59)),e.hour=Math.max(0,Math.min(e.hour,23))}function us(e,s){let n=e%s;return n<0&&(n+=s),n}function hi(e,s){return e.hour+=s.hours||0,e.minute+=s.minutes||0,e.second+=s.seconds||0,e.millisecond+=s.milliseconds||0,ou(e)}function bi(e,s){let n=e.copy();return hi(n,s),n}function cu(e,s){return bi(e,ui(s))}function gi(e,s,n,a){let r=e.copy();switch(s){case"era":{let l=e.calendar.getEras(),d=l.indexOf(e.era);if(d<0)throw new Error("Invalid era: "+e.era);d=ht(d,n,0,l.length-1,a?.round),r.era=l[d],Mt(r);break}case"year":var i,o;!((i=(o=r.calendar).isInverseEra)===null||i===void 0)&&i.call(o,r)&&(n=-n),r.year=ht(e.year,n,-1/0,9999,a?.round),r.year===-1/0&&(r.year=1),r.calendar.balanceYearMonth&&r.calendar.balanceYearMonth(r,e);break;case"month":r.month=ht(e.month,n,1,e.calendar.getMonthsInYear(e),a?.round);break;case"day":r.day=ht(e.day,n,1,e.calendar.getDaysInMonth(e),a?.round);break;default:throw new Error("Unsupported field "+s)}return e.calendar.balanceDate&&e.calendar.balanceDate(r),Mt(r),r}function yi(e,s,n,a){let r=e.copy();switch(s){case"hour":{let i=e.hour,o=0,l=23;if(a?.hourCycle===12){let d=i>=12;o=d?12:0,l=d?23:11}r.hour=ht(i,n,o,l,a?.round);break}case"minute":r.minute=ht(e.minute,n,0,59,a?.round);break;case"second":r.second=ht(e.second,n,0,59,a?.round);break;case"millisecond":r.millisecond=ht(e.millisecond,n,0,999,a?.round);break;default:throw new Error("Unsupported field "+s)}return r}function ht(e,s,n,a,r=!1){if(r){e+=Math.sign(s),e<n&&(e=a);let i=Math.abs(s);s>0?e=Math.ceil(e/i)*i:e=Math.floor(e/i)*i,e>a&&(e=n)}else e+=s,e<n?e=a-(n-e-1):e>a&&(e=n+(e-a-1));return e}const du=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/,uu=/^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;function mu(e){let s=e.match(du);if(!s)throw uu.test(e)?new Error(`Invalid ISO 8601 date string: ${e}. Use parseAbsolute() instead.`):new Error("Invalid ISO 8601 date string: "+e);let n=new es(Zs(s[1],0,9999),Zs(s[2],1,12),1);return n.day=Zs(s[3],1,n.calendar.getDaysInMonth(n)),n}function Zs(e,s,n){let a=Number(e);if(a<s||a>n)throw new RangeError(`Value out of range: ${s} <= ${a} <= ${n}`);return a}function vi(e){return`${String(e.hour).padStart(2,"0")}:${String(e.minute).padStart(2,"0")}:${String(e.second).padStart(2,"0")}${e.millisecond?String(e.millisecond/1e3).slice(1):""}`}function ji(e){let s=Bn(e,new Is),n;return s.era==="BC"?n=s.year===1?"0000":"-"+String(Math.abs(1-s.year)).padStart(6,"00"):n=String(s.year).padStart(4,"0"),`${n}-${String(s.month).padStart(2,"0")}-${String(s.day).padStart(2,"0")}`}function fu(e){return`${ji(e)}T${vi(e)}`}function xu(e,s){if(s.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Un(e,s,n){xu(e,s),s.set(e,n)}function wi(e){let s=typeof e[0]=="object"?e.shift():new Is,n;if(typeof e[0]=="string")n=e.shift();else{let o=s.getEras();n=o[o.length-1]}let a=e.shift(),r=e.shift(),i=e.shift();return[s,n,a,r,i]}var pu=new WeakMap;class es{copy(){return this.era?new es(this.calendar,this.era,this.year,this.month,this.day):new es(this.calendar,this.year,this.month,this.day)}add(s){return Vn(this,s)}subtract(s){return mi(this,s)}set(s){return fi(this,s)}cycle(s,n,a){return gi(this,s,n,a)}toDate(s){return oi(this,s)}toString(){return ji(this)}compare(s){return ni(this,s)}constructor(...s){Un(this,pu,{writable:!0,value:void 0});let[n,a,r,i,o]=wi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,Mt(this)}}var hu=new WeakMap;class Ts{copy(){return new Ts(this.hour,this.minute,this.second,this.millisecond)}add(s){return bi(this,s)}subtract(s){return cu(this,s)}set(s){return xi(this,s)}cycle(s,n,a){return yi(this,s,n,a)}toString(){return vi(this)}compare(s){return ai(this,s)}constructor(s=0,n=0,a=0,r=0){Un(this,hu,{writable:!0,value:void 0}),this.hour=s,this.minute=n,this.second=a,this.millisecond=r,pi(this)}}var bu=new WeakMap;class Cs{copy(){return this.era?new Cs(this.calendar,this.era,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond):new Cs(this.calendar,this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond)}add(s){return Vn(this,s)}subtract(s){return mi(this,s)}set(s){return fi(xi(this,s),s)}cycle(s,n,a){switch(s){case"era":case"year":case"month":case"day":return gi(this,s,n,a);default:return yi(this,s,n,a)}}toDate(s,n){return oi(this,s,n)}toString(){return fu(this)}compare(s){let n=ni(this,s);return n===0?ai(this,ci(s)):n}constructor(...s){Un(this,bu,{writable:!0,value:void 0});let[n,a,r,i,o]=wi(s);this.calendar=n,this.era=a,this.year=r,this.month=i,this.day=o,this.hour=s.shift()||0,this.minute=s.shift()||0,this.second=s.shift()||0,this.millisecond=s.shift()||0,Mt(this)}}const gu="Open time options",yu=320;function Va(e,s){return typeof s=="string"&&s.length>0?`${e} ${s}`:e}function Xs(e){if(!e)return null;const s="hour"in e&&typeof e.hour=="number"?e.hour:0,n="minute"in e&&typeof e.minute=="number"?e.minute:0,a="second"in e&&typeof e.second=="number"?e.second:0;return new Ts(s,n,a)}function vu(e,s){const n=new Date(2e3,0,1,e.hour,e.minute,e.second);return new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:s===12}).format(n)}function ju(e){const s=[];for(let n=0;n<24;n+=1)for(let a=0;a<60;a+=e)s.push(new Ts(n,a));return s}function wu(e){const{minuteStep:s=15,timeListClassName:n,timeListLabel:a=gu,selectorButtonProps:r,endContent:i,onChange:o,value:l,defaultValue:d,hourCycle:u=12,...x}=e,m=l!==void 0,[p,f]=h.useState(()=>Xs(d)),g=m?Xs(l):p,v=h.useMemo(()=>ju(s),[s]),b=N=>{m||f(N),o?.(N)},y=t.jsxs(c.Popover,{placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(c.Button,{isIconOnly:!0,variant:"light","aria-label":a,...r,onPress:void 0,children:t.jsx(X.Clock3,{className:"size-4",strokeWidth:1.75})})}),t.jsx(c.PopoverContent,{className:"min-w-[8.5rem] p-0",children:t.jsx(c.ScrollShadow,{className:n??"max-h-64 py-1",children:t.jsx("div",{className:"flex flex-col p-1",children:v.map(N=>{const k=g?.hour===N.hour&&g?.minute===N.minute;return t.jsx(c.Button,{variant:k?"flat":"light",color:k?"primary":"default",className:"h-9 min-w-0 justify-start px-3",onPress:()=>b(N),children:vu(N,u)},`${N.hour}:${N.minute}`)})})})})]});return t.jsx(c.TimeInput,{...x,value:m?g:void 0,defaultValue:m?void 0:d,hourCycle:u,endContent:t.jsxs("div",{className:"flex items-center gap-1",children:[i,y]}),onChange:N=>b(Xs(N))})}function Hn(e){if(e.mode==="time")return t.jsx(wu,{...e});if(e.mode==="datetime"){const{mode:r,granularity:i="minute",hideTimeZone:o=!0,calendarWidth:l=yu,disableAnimation:d=!0,classNames:u,...x}=e;return t.jsx(c.DatePicker,{...x,calendarWidth:l,classNames:{...u,popoverContent:Va("min-w-[20rem]",u?.popoverContent),calendarContent:Va("min-h-[18rem]",u?.calendarContent)},disableAnimation:d,granularity:i,hideTimeZone:o})}const{mode:s,granularity:n="day",...a}=e;return t.jsx(c.DatePicker,{...a,granularity:n})}function Nu({label:e,...s}){return t.jsx("button",{...s,"aria-label":e,children:t.jsx("svg",{"aria-hidden":"true",className:"fill-current",fill:"none",focusable:"false",height:"1em",role:"presentation",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:"1em",children:t.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})}function Cu(e){return e!==void 0&&e.trim()!==""}function Ni(e,s){const n=Tr();if(h.isValidElement(s))return s;const a=[e,n].find(Cu);return a===void 0?void 0:t.jsx(Nu,{label:a})}const Ci=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ni(e,s);return t.jsx(c.Drawer,{ref:a,...n,closeButton:r})});Ci.displayName="Drawer";const ns=h.forwardRef(({closeLabel:e,closeButton:s,...n},a)=>{const r=Ni(e,s);return t.jsx(c.Modal,{ref:a,...n,closeButton:r})});ns.displayName="Modal";function ku(e){const s=e?.closest('[role="dialog"]');return s?.parentElement??s??void 0}const at=h.forwardRef(({popoverProps:e,...s},n)=>{const a=h.useRef(null),[r,i]=h.useState(void 0),{"data-react-aria-top-layer":o,...l}=e??{},d=o==="true"||o===void 0&&r!==void 0,u={...l,disableDialogFocus:l.disableDialogFocus??(r?!0:void 0),portalContainer:l.portalContainer??r,...d?{"data-react-aria-top-layer":"true"}:{}};return h.useEffect(()=>{i(ku(a.current))},[]),t.jsx("span",{ref:a,className:"contents",children:t.jsx(c.Select,{ref:n,...s,popoverProps:u})})});at.displayName="Select";const Su="motion-reduce:animate-none motion-reduce:transition-none motion-reduce:before:animate-none motion-reduce:before:transition-none motion-reduce:after:transition-none",ie=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Skeleton,{ref:n,...s,classNames:{...e,base:c.cn(Su,e?.base)}}));ie.displayName="Skeleton";const $u="text-default-600 data-[hover=true]:text-default-700",Wn=h.forwardRef(({classNames:e,...s},n)=>t.jsx(c.Table,{ref:n,...s,classNames:{...e,th:c.cn($u,e?.th)}}));Wn.displayName="Table";function Au({state:e,onSubmit:s,onRemove:n,appliedCredit:a,errorMessage:r,label:i="Gift Card",placeholder:o="GC-XXXX-XXXX-XXXX",applyLabel:l="Apply",removeAriaLabel:d="Remove gift card",testId:u="veevart-redeem-code-input"}){const[x,m]=h.useState(""),p=h.useId(),[f,g]=h.useState(e);e!==f&&(g(e),e==="applied"&&m(""));const v=()=>{const N=x.trim();N&&s(N)},b=N=>{N.key==="Enter"&&(N.preventDefault(),v())};if(e==="applied"&&a)return t.jsx("div",{"data-testid":u,children:t.jsx(ti,{code:a.code,amount:a.amount,onRemove:n,removeAriaLabel:d,testId:`${u}-card`})});const y=e==="error"&&r!=null;return t.jsxs("div",{"data-testid":u,className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-end gap-2",children:[t.jsx(c.Input,{"data-testid":`${u}-input`,label:i,labelPlacement:"outside",variant:"bordered",radius:"lg",classNames:{label:"text-xs text-default-500 group-data-[filled-within=true]:text-default-500 group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_16px)]",inputWrapper:"border-small"},placeholder:o,value:x,onValueChange:m,onKeyDown:b,isDisabled:e==="loading",isInvalid:e==="error","aria-describedby":y?p:void 0}),t.jsx(T,{testId:`${u}-button`,isLoading:e==="loading",isDisabled:!x.trim(),onPress:v,children:l})]}),y&&t.jsx("p",{id:p,"data-testid":`${u}-error`,className:"text-tiny text-danger",children:r})]})}const Du={login:"Login",logout:"Logout",selectLanguage:"Select your language"};function Eu({languages:e,selectedLanguage:s,onLanguageChange:n,label:a}){const r=e.find(i=>i.code===s);return t.jsx("div",{className:"flex items-center",children:t.jsxs("div",{className:"relative flex items-center",children:[t.jsx(at,{"data-testid":"language-select-desktop",variant:"bordered","aria-label":a,selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"min-w-36 hidden md:inline-flex",isDisabled:e.length===0,placeholder:a,startContent:t.jsx(X.Globe,{className:"w-5 h-5 text-black"}),renderValue:()=>t.jsx("span",{children:r?.label||a}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.label,"data-testid":`language-select-option-${i.code}`,children:i.label},i.code))}),t.jsx(at,{"aria-label":a,"data-testid":"language-select-mobile",variant:"bordered",selectedKeys:s?[s]:[],onSelectionChange:i=>{const o=Array.from(i)[0]||s;n?.(o)},className:"w-24 inline-flex md:hidden",isDisabled:e.length===0,placeholder:"",startContent:t.jsx(X.Globe,{className:"w-6 h-6 text-black"}),renderValue:()=>t.jsx("span",{children:r?.code.toUpperCase()||""}),size:"md",radius:"full",children:e.map(i=>t.jsx(c.SelectItem,{textValue:i.code.toUpperCase(),"data-testid":`language-select-option-mobile-${i.code}`,children:i.code.toUpperCase()},i.code))})]})})}function Lu({isLoggedIn:e,onLogin:s,onLogout:n,labels:a}){return e?t.jsxs(T,{"data-testid":"navbar-auth-button",className:"px-2 py-1 w-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:n,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.logout})]}):t.jsxs(T,{"data-testid":"navbar-auth-button",className:"px-2 py-1 min-w-12 md:min-w-24 rounded-full bg-black text-white text-sm flex items-center",onPress:s,size:"md",children:[t.jsx(X.User,{className:"inline w-5 h-5"}),t.jsx("span",{className:"hidden md:inline",children:a.login})]})}function Fu({logo:e,languages:s=[],selectedLanguage:n,onLanguageChange:a,isLoggedIn:r,onLogin:i,onLogout:o,hasLanguages:l,hasAuth:d,labels:u={},className:x}){const m={...Du,...u};return t.jsxs("nav",{"data-testid":"navbar",className:c.cn("w-full px-4 md:px-8 py-3 bg-white border-b border-zinc-100 flex items-center justify-between",x),children:[t.jsx("div",{className:"flex items-center min-w-10",children:e&&t.jsx("a",{href:"/",className:"block",children:t.jsx("img",{"data-testid":"navbar-logo",src:e,alt:"Logo",className:"h-8 w-auto max-w-28 md:max-w-40 object-contain"})})}),t.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[(l||s.length>0)&&t.jsx(Eu,{languages:s,selectedLanguage:n,onLanguageChange:a,label:m.selectLanguage}),d&&t.jsx(Lu,{isLoggedIn:r,onLogin:i,onLogout:o,labels:m})]})]})}function Ru(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Footer, and a confirmation Card. Include title, message, confirmation number, details list, icon, and action buttons. Use Card for the confirmation content.",title:"TODO: Implement ConfirmationPageTemplate",variant:"faded",className:"max-w-2xl"})})})}var Js;const _u=typeof document<"u"?(Js=h.useInsertionEffect)!==null&&Js!==void 0?Js:h.useLayoutEffect:()=>{};function as(e,s,n){let[a,r]=h.useState(e||s),i=h.useRef(a),o=h.useRef(e!==void 0),l=e!==void 0;h.useEffect(()=>{let m=o.current;m!==l&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${m?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}.`),o.current=l},[l]);let d=l?e:a;_u(()=>{i.current=d});let[,u]=h.useReducer(()=>({}),{}),x=h.useCallback((m,...p)=>{let f=typeof m=="function"?m(i.current):m;Object.is(i.current,f)||(i.current=f,r(f),u(),n?.(f,...p))},[n]);return[d,x]}function ki(e){return t.jsx("svg",{...e,fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:t.jsx(Be.m.path,{animate:{pathLength:1},d:"M5 13l4 4L19 7",initial:{pathLength:0},strokeLinecap:"round",strokeLinejoin:"round",transition:{delay:.2,type:"tween",ease:"easeOut",duration:.3}})})}const Si=h.forwardRef(({color:e="primary",variant:s="default",stepsCount:n=3,defaultStep:a=0,label:r,stepLabels:i,showStepLabelTooltip:o=!1,stepLabelTooltipPlacement:l="top",showStepCounter:d=!1,stepCounterPosition:u="right",layout:x="compact",stepCounterFormat:m,onStepChange:p,currentStep:f,hideProgressBars:g=!1,stepClassName:v,className:b,isDisabled:y=!1,...N},k)=>{const[w,$]=as(f,a,p),A=h.useMemo(()=>{let j,D;const S=["[--active-fg-color:hsl(var(--step-fg-color))]","[--active-border-color:hsl(var(--step-color))]","[--active-color:hsl(var(--step-color))]","[--complete-background-color:hsl(var(--step-color))]","[--complete-border-color:hsl(var(--step-color))]","[--inactive-border-color:hsl(var(--heroui-default-300))]","[--inactive-color:hsl(var(--heroui-default-300))]"];switch(e){case"primary":j="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break;case"secondary":j="[--step-color:var(--heroui-secondary)]",D="[--step-fg-color:var(--heroui-secondary-foreground)]";break;case"success":j="[--step-color:var(--heroui-success)]",D="[--step-fg-color:var(--heroui-success-foreground)]";break;case"warning":j="[--step-color:var(--heroui-warning)]",D="[--step-fg-color:var(--heroui-warning-foreground)]";break;case"danger":j="[--step-color:var(--heroui-danger)]",D="[--step-fg-color:var(--heroui-danger-foreground)]";break;case"default":j="[--step-color:var(--heroui-default)]",D="[--step-fg-color:var(--heroui-default-foreground)]";break;default:j="[--step-color:var(--heroui-primary)]",D="[--step-fg-color:var(--heroui-primary-foreground)]";break}return S.unshift(D),S.unshift(j),S},[e]);return t.jsxs("nav",{ref:k,"aria-label":"Progress",className:c.cn("flex items-center overflow-x-auto",x==="spread"?"w-full justify-between gap-6":"max-w-fit gap-3",b),"data-testid":"stepper-root",...N,children:[d&&u==="left"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null,r&&t.jsx("label",{className:"text-small text-default-foreground lg:text-medium font-light whitespace-nowrap me-3","data-testid":"stepper-label",children:r}),t.jsx("ol",{className:c.cn("flex flex-row flex-nowrap gap-x-3",A,b),"data-testid":"stepper-list",children:Array.from({length:n})?.map((j,D)=>{const S=w===D?"active":w<D?"inactive":"complete",_=s==="activeLabel"&&S==="active"&&!!i?.[D],F=o&&S!=="active"&&!!i?.[D];return t.jsxs("li",{className:"relative flex shrink-0 items-center gap-x-3","data-testid":`stepper-step-${D}`,children:[t.jsx(c.Tooltip,{content:F?i?.[D]:void 0,isDisabled:!F,offset:12,placement:l,classNames:{base:"px-0 py-0",content:"rounded-full border border-default-200 bg-white px-4 py-2 text-small font-medium text-default-700 shadow-sm"},children:t.jsxs("button",{"aria-current":S==="active"?"step":void 0,className:c.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5",{"rounded-full border border-(--active-border-color)/20 bg-(--active-border-color)/10 pl-2 pr-4 py-1.5":_},{"cursor-not-allowed opacity-50":y},v),onClick:()=>!y&&$(D),disabled:y,"data-testid":`stepper-step-btn-${D}`,children:[t.jsx("div",{className:"h-full relative flex items-center",children:t.jsx(Be.LazyMotion,{features:Be.domAnimation,children:t.jsx(Be.m.div,{animate:S,className:"relative z-10",children:t.jsx(Be.m.div,{animate:S,className:c.cn("border-medium text-large text-default-foreground relative z-10 flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full font-semibold bg-white",{"border-(--complete-border-color) bg-(--complete-background-color) text-(--active-fg-color)":_,"bg-(--complete-background-color)":S==="complete","shadow-lg":S==="complete"}),initial:!1,transition:{duration:.25},variants:{inactive:{backgroundColor:"transparent",borderColor:"var(--inactive-border-color)",color:"var(--inactive-color)"},active:{backgroundColor:"transparent",borderColor:"var(--active-border-color)",color:"var(--active-color)"},complete:{backgroundColor:"var(--complete-background-color)",borderColor:"var(--complete-border-color)",color:"var(--active-fg-color)"}},children:t.jsx("div",{className:"flex items-center justify-center",children:S==="complete"&&s==="default"?t.jsx(ki,{className:"h-5 w-5 text-(--active-fg-color)","data-testid":`stepper-step-check-${D}`}):t.jsx("span",{children:D+1})})})})})}),_?t.jsx("span",{className:"pr-2 text-2xl leading-none font-medium whitespace-nowrap text-(--active-color)","data-testid":`stepper-step-label-${D}`,children:i[D]}):null]},D)}),D<n-1&&!g&&t.jsx("div",{"aria-hidden":"true",className:"pointer-events-none z-0 w-12 flex-none items-center",style:{"--idx":D},children:t.jsx("div",{className:c.cn("bg-default-200 relative h-0.5 w-full transition-colors duration-300","after:absolute after:block after:h-full after:w-0 after:bg-(--active-border-color) after:transition-[width] after:duration-300 after:content-['']",{"after:w-full":D<w})})})]},D)})}),d&&u==="right"?t.jsx("span",{className:"text-default-500 text-2xl whitespace-nowrap","data-testid":"stepper-counter",children:m?m(w+1,n):`Step ${w+1} of ${n}`}):null]})});Si.displayName="Stepper";function Mu(e){return t.jsx("div",{className:"min-h-screen flex flex-col",children:t.jsx("div",{className:"flex-1 flex items-center justify-center p-12",children:t.jsx(c.Alert,{description:"This template combines Navbar, Stepper, Footer, and an event details Card. Include event image, category/spots chips, tags, details grid, and action buttons. Use Card, CardHeader, CardBody for content structure.",title:"TODO: Implement EventDetailsTemplate",variant:"faded",className:"max-w-2xl"})})})}function xe(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n}).format(e)}catch{return`${n} ${e.toFixed(2)}`}}function Pt(e,s="en-US"){try{const n=new Intl.NumberFormat(s,{style:"currency",currency:e}).resolvedOptions();return typeof n.maximumFractionDigits=="number"?n.maximumFractionDigits:2}catch{return 2}}function qn(e,s,n="en-US"){const a=Pt(s,n),r=Math.pow(10,a);return Math.round(e*r)/r}function Nn(e,s,n,a){return qn(e-s,n,a)}const Ua={primary:{active:"hsl(var(--heroui-primary))",fg:"hsl(var(--heroui-primary-foreground))"},secondary:{active:"hsl(var(--heroui-secondary))",fg:"hsl(var(--heroui-secondary-foreground))"},success:{active:"hsl(var(--heroui-success))",fg:"hsl(var(--heroui-success-foreground))"},warning:{active:"hsl(var(--heroui-warning))",fg:"hsl(var(--heroui-warning-foreground))"},danger:{active:"hsl(var(--heroui-danger))",fg:"hsl(var(--heroui-danger-foreground))"},default:{active:"hsl(var(--heroui-default))",fg:"hsl(var(--heroui-default-foreground))"}},Pu="rgb(156 163 175)",Iu="rgb(107 114 128)",$i=h.forwardRef(function({color:s="primary",steps:n=[],defaultStep:a=0,onStepChange:r,currentStep:i,hideProgressBars:o=!1,activeColor:l,activeForegroundColor:d,inactiveColor:u=Pu,inactiveLabelColor:x=Iu,activeStepVariant:m="bordered",stepClassName:p,circleClassName:f,progressBarClassName:g,labelsClassName:v,labelSlotClassName:b,activeLabelClassName:y,inactiveLabelClassName:N,className:k,ariaLabel:w="Progress",invalidLabelSuffix:$=", has errors",testId:A,isStepReachable:j,...D},S){const[_,F]=as(i,a,r),L=Ua[s]??Ua.primary,P=l??L.active,B=d??L.fg,H=(K,O)=>{const G=K.ariaLabel??(typeof K.title=="string"?K.title:null)??`${O+1}`;return K.invalid?`${G}${$}`:G};return t.jsxs("nav",{...D,"aria-label":w,...A?{"data-testid":A}:{},children:[t.jsx("div",{className:c.cn("flex items-center",k),children:n?.map((K,O)=>{const ne=O===_?"active":O<_?"complete":"inactive",G=j?j(O):!0;return t.jsxs(h.Fragment,{children:[t.jsx(T,{ref:S,isIconOnly:!0,disableAnimation:!0,radius:"full",variant:"light",testId:`${A??"horizontal-steps"}-step-${O}`,"aria-current":ne==="active"?"step":void 0,"aria-describedby":K.describedBy,"aria-label":H(K,O),"data-invalid":K.invalid?"true":void 0,isDisabled:!G,className:c.cn("size-8 min-w-8 shrink-0 overflow-visible bg-transparent p-0","data-[hover=true]:bg-transparent",G?"cursor-pointer":"cursor-not-allowed","data-[disabled=true]:opacity-40",K.className,p),onPress:()=>{if(i===void 0){F(O);return}r?.(O)},children:t.jsx(Be.LazyMotion,{features:Be.domAnimation,children:t.jsx(Be.m.div,{animate:ne,className:c.cn("relative flex size-8 items-center justify-center rounded-full text-[13px] font-medium",f),initial:!1,transition:{duration:.2},variants:{inactive:{backgroundColor:"transparent",borderColor:u,borderWidth:"1.5px",color:u},active:{backgroundColor:m==="solid"?P:"transparent",borderColor:P,borderWidth:"1.5px",color:m==="solid"?B:P},complete:{backgroundColor:P,borderColor:P,borderWidth:"1.5px",color:P}},children:ne==="complete"?t.jsx(ki,{className:"size-4",style:{color:B}}):t.jsx("span",{children:O+1})})})}),O<n.length-1&&!o&&t.jsx("div",{"aria-hidden":!0,className:c.cn("mx-1 h-px w-6 shrink-0 transition-colors duration-300 sm:mx-1.5 sm:w-14 md:w-20",g),style:{backgroundColor:O<_?P:u}})]},O)})}),t.jsx("div",{className:c.cn("mt-2.5 hidden md:flex",v),children:n?.map((K,O)=>{const ne=O<=_;return t.jsxs(h.Fragment,{children:[t.jsx("div",{className:c.cn("relative flex w-8 shrink-0 justify-center overflow-visible",b),children:t.jsx("span",{className:c.cn("absolute left-1/2 top-0 -translate-x-1/2 whitespace-nowrap text-center text-[12px] font-medium transition-colors duration-200",ne?y:N),style:{color:ne?P:x},children:K.title})}),O<n.length-1&&!o&&t.jsx("div",{className:c.cn("mx-1 w-6 shrink-0 sm:mx-1.5 sm:w-14 md:w-20",g)})]},O)})})]})});$i.displayName="HorizontalSteps";function se(e){return e!=null&&e!==!1&&e!==""}const Qe=e=>Rs[e],Tu={done:"solar:check-circle-bold","needs-fix":"solar:danger-triangle-bold",optional:"solar:record-outline"},Ai={done:{icon:Qe("--ok"),meta:Qe("--sub")},"needs-fix":{icon:Qe("--warn"),meta:Qe("--warn")},optional:{icon:Qe("--muted"),meta:Qe("--sub")}},Ou=Qe("--ink"),zu={ready:"solar:check-circle-bold",fix:"solar:danger-triangle-bold",live:"solar:check-circle-bold"},Bu={ready:{fill:Qe("--ok-fill"),text:Qe("--ok")},fix:{fill:Qe("--warn-fill"),text:Qe("--warn")},live:{fill:Qe("--ok-fill"),text:Qe("--ok")}},tt={root:"flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain",nav:"rounded-2xl border border-acct-border bg-acct-surface p-1.5",list:"m-0 flex list-none flex-col gap-0.5 p-0",row:["h-auto min-h-0 w-full justify-start items-start gap-2.5 whitespace-normal","rounded-xl px-2.5 py-2 text-left font-normal","bg-transparent data-[hover=true]:bg-acct-page","data-[disabled=true]:opacity-40 data-[disabled=true]:cursor-not-allowed"].join(" "),rowCurrent:"bg-acct-hair data-[hover=true]:bg-acct-hair",icon:"mt-px size-5 shrink-0",text:"flex min-w-0 flex-1 flex-col gap-0.5",label:"text-sm leading-5",labelCurrent:"font-semibold",meta:"text-xs leading-4 [overflow-wrap:anywhere]"},Bt={root:"flex items-start gap-2.5 rounded-2xl px-4 py-3",icon:"mt-0.5 size-5 shrink-0",text:"flex min-w-0 flex-col",title:"text-sm font-semibold leading-5",description:"text-xs leading-4"},kt={root:"flex flex-wrap items-center justify-between gap-3",spacer:"min-w-0 flex-1 basis-0",progress:"shrink-0 text-xs text-acct-sub",endSlot:"flex min-w-0 flex-1 basis-0 justify-end",arrow:"size-4"};function Vu({step:e,labels:s}){const n=Ai[e.status];if(e.status==="optional")return t.jsxs("span",{className:tt.meta,style:{color:n.meta},children:[s.optional,se(e.summary)?t.jsxs(t.Fragment,{children:[" · ",e.summary]}):null]});const a=e.status==="needs-fix"&&se(e.reason)?e.reason:e.summary,r=e.status==="done"?s.done:s.needsFix;return t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"sr-only",children:r})," ",se(a)?t.jsx("span",{className:tt.meta,style:{color:n.meta},children:a}):null]})}function Di({steps:e,currentStep:s,defaultStep:n=0,onStepChange:a,isStepReachable:r,ariaLabel:i,statusLabels:o,header:l,maxHeight:d,className:u,style:x,"data-testid":m="vertical-steps",...p}){const[f,g]=as(s,n,a);return t.jsxs("div",{...p,"data-testid":m,className:c.cn(tt.root,u),style:d===void 0?x:{maxHeight:d,...x},children:[l,t.jsx("nav",{"aria-label":i,className:tt.nav,children:t.jsx("ol",{className:tt.list,children:e.map((v,b)=>{const y=b===f,N=r?r(b):!0;return t.jsx("li",{children:t.jsxs(T,{variant:"light",color:"default",radius:"none",disableAnimation:!0,testId:v.testId??`${m}-step-${v.key}`,"data-state":v.status,"data-current":y?"true":void 0,"aria-current":y?"step":void 0,isDisabled:!N,className:c.cn(tt.row,y&&tt.rowCurrent),onPress:()=>g(b),children:[t.jsx(M,{"aria-hidden":!0,icon:Tu[v.status],className:tt.icon,style:{color:Ai[v.status].icon}}),t.jsxs("span",{className:tt.text,children:[t.jsx("span",{className:c.cn(tt.label,y&&tt.labelCurrent),style:{color:Ou},children:`${b+1}. ${v.label}`})," ",t.jsx(Vu,{step:v,labels:o})]})]})},v.key)})})})]})}Di.displayName="VerticalSteps";function Ei({variant:e,title:s,description:n,className:a,"data-testid":r="steps-readiness"}){const i=Bu[e];return t.jsxs("div",{role:"status","data-testid":r,"data-variant":e,"data-ready":e==="fix"?"false":"true",className:c.cn(Bt.root,a),style:{backgroundColor:i.fill,color:i.text},children:[t.jsx(M,{"aria-hidden":!0,icon:zu[e],className:Bt.icon}),t.jsxs("span",{className:Bt.text,children:[t.jsx("span",{className:Bt.title,children:s})," ",se(n)?t.jsx("span",{className:Bt.description,children:n}):null]})]})}Ei.displayName="StepsReadiness";function Li({steps:e,currentStep:s,onStepChange:n,progressLabel:a,nextLabel:r,previousLabel:i=g=>g.label,finalActionLabel:o,onFinalAction:l,isFinalActionDisabled:d=!1,className:u,"data-testid":x="step-pager",previousTestId:m=`${x}-prev`,nextTestId:p=`${x}-next`,finalActionTestId:f=`${x}-final`}){const g=e[s-1],v=e[s+1],b=s===e.length-1;return t.jsxs("div",{"data-testid":x,className:c.cn(kt.root,u),children:[t.jsx("div",{className:kt.spacer,children:g?t.jsx(T,{variant:"bordered",color:"default",testId:m,startContent:t.jsx(M,{"aria-hidden":!0,icon:"solar:arrow-left-outline",className:kt.arrow}),onPress:()=>n(s-1),children:i(g)}):null}),t.jsx("span",{className:kt.progress,children:a(s+1,e.length)}),t.jsx("div",{className:kt.endSlot,children:v?t.jsx(T,{color:"primary",testId:p,endContent:t.jsx(M,{"aria-hidden":!0,icon:"solar:arrow-right-outline",className:kt.arrow}),onPress:()=>n(s+1),children:r(v)}):b&&o!==void 0&&l?t.jsx(T,{color:"primary",testId:f,isDisabled:d,onPress:l,children:o}):null})]})}Li.displayName="StepPager";function Uu(){return t.jsxs("footer",{"data-testid":"footer",className:"fixed left-0 bottom-0 w-full text-left p-4 bg-white font-inter font-light text-base text-zinc-500",children:["Powered by Veevart ® ",new Date().getFullYear()]})}const Hu=e=>{const s=h.useMemo(()=>JSON.stringify({allItems:e.allItems,selected:e.selected}),[e.allItems,e.selected]);return t.jsx(Wu,{...e},s)},Wu=({allItems:e,selected:s,onSelectedChange:n,titleLeft:a,titleRight:r})=>{const[i,o]=h.useState([]),[l,d]=h.useState([]),[u,x]=h.useState(null),[m,p]=h.useState(null),f=h.useMemo(()=>new Set(s),[s]),g=h.useMemo(()=>new Set(e),[e]),v=h.useMemo(()=>e.filter(F=>!f.has(F)),[e,f]),b=F=>{if(F.length===0)return;const L=Array.from(new Set([...s,...F]));n(L)},y=F=>{if(F.length===0)return;const L=new Set(F);n(s.filter(P=>!L.has(P)))},N=()=>{i.length!==0&&(b(i),o([]))},k=()=>{l.length!==0&&(y(l),d([]))},w=()=>{v.length!==0&&(b(v),o([]))},$=()=>{s.length!==0&&(n([]),d([]))},A=(F,L,P)=>{const B=Math.min(L,P),H=Math.max(L,P);return F.slice(B,H+1)},j=(F,L,P)=>{if(P&&u!==null){o(A(v,u,L)),d([]),x(L);return}const B=i.includes(F);o(B?i.filter(H=>H!==F):[...i,F]),d([]),x(L)},D=(F,L,P)=>{if(P&&m!==null){d(A(s,m,L)),o([]),p(L);return}const B=l.includes(F);d(B?l.filter(H=>H!==F):[...l,F]),o([]),p(L)},S=(F,L,P)=>{const B=P==="available"?i.includes(L)?i:[L]:l.includes(L)?l:[L];F.dataTransfer.setData("text/plain",JSON.stringify({source:P,items:B})),F.dataTransfer.effectAllowed="move"},_=(F,L)=>{F.preventDefault();const P=F.dataTransfer.getData("text/plain");if(P)try{const B=JSON.parse(P),H=(B.items||[]).filter(K=>g.has(K));if(H.length===0||B.source===L)return;L==="selected"?(b(H),o([])):(y(H),d([]))}catch{return}};return t.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:justify-between",children:[t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:a}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"available"),children:v.map((F,L)=>{const P=i.includes(F);return t.jsx("button",{type:"button",onClick:B=>{j(F,L,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>S(B,F,"available"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]}),t.jsxs("div",{className:"flex flex-row items-center justify-center gap-3 md:flex-col md:pt-6",children:[t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:N,isDisabled:i.length===0,"aria-label":"Move selected to right",children:"›"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-selected-to-available",onPress:k,isDisabled:l.length===0,"aria-label":"Move selected to left",children:"‹"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,"data-testid":"move-all-to-selected",onPress:w,isDisabled:v.length===0,"aria-label":"Move all to right",children:"»"}),t.jsx(T,{variant:"light",className:"h-10 w-10 min-w-0 text-2xl font-semibold text-[#E4571E] hover:bg-[#E4571E]/10",isIconOnly:!0,onPress:$,"data-testid":"move-all-to-available",isDisabled:s.length===0,"aria-label":"Move all to left",children:"«"})]}),t.jsxs("div",{className:"flex w-full flex-col gap-3 md:w-2/5",children:[t.jsx("h2",{className:"text-sm font-medium text-gray-700",children:r}),t.jsx(c.Card,{className:"w-full border border-gray-200 shadow-none",children:t.jsx(c.CardBody,{className:"h-60 gap-2 overflow-y-auto",onDragOver:F=>F.preventDefault(),onDrop:F=>_(F,"selected"),children:s.map((F,L)=>{const P=l.includes(F);return t.jsx("button",{type:"button",onClick:B=>{D(F,L,B.shiftKey)},onMouseDown:B=>{B.shiftKey&&B.preventDefault()},draggable:!0,onDragStart:B=>S(B,F,"selected"),className:`rounded-md px-3 py-2 text-left text-sm transition ${P?"bg-[#E4571E]/10 text-[#E4571E]":"text-gray-700 hover:bg-gray-100"}`,children:F},F)})})})]})]})};function ts(e){return typeof e=="string"?e:e.type}function gt({className:e}){return t.jsx("div",{className:`flex items-center h-6 ${e||""}`,children:t.jsx(c.Divider,{orientation:"vertical"})})}function vt({icon:e,label:s,isActive:n=!1,isDisabled:a=!1,onClick:r,shortcut:i,iconSize:o=16,className:l}){const d=i?`${s} (${i})`:s;return t.jsx(c.Tooltip,{content:d,placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:n?"primary":"default",variant:n?"solid":"bordered",isIconOnly:!0,isDisabled:a,onPress:r,"aria-label":s,className:l,children:t.jsx(e,{size:o})})})}const mt={bold:{execute:({editor:e})=>e.chain().focus().toggleBold().run(),canExecute:e=>e.can().chain().focus().toggleBold().run(),isActive:e=>e.isActive("bold"),shortcut:"Mod-b",label:"Bold"},italic:{execute:({editor:e})=>e.chain().focus().toggleItalic().run(),canExecute:e=>e.can().chain().focus().toggleItalic().run(),isActive:e=>e.isActive("italic"),shortcut:"Mod-i",label:"Italic"},strike:{execute:({editor:e})=>e.chain().focus().toggleStrike().run(),canExecute:e=>e.can().chain().focus().toggleStrike().run(),isActive:e=>e.isActive("strike"),shortcut:"Mod-Shift-x",label:"Strikethrough"},underline:{execute:({editor:e})=>e.chain().focus().toggleUnderline().run(),canExecute:e=>e.can().chain().focus().toggleUnderline().run(),isActive:e=>e.isActive("underline"),shortcut:"Mod-u",label:"Underline"},code:{execute:({editor:e})=>e.chain().focus().toggleCode().run(),canExecute:e=>e.can().chain().focus().toggleCode().run(),isActive:e=>e.isActive("code"),shortcut:"Mod-e",label:"Inline code"},textColor:{execute:({editor:e,config:s})=>{const n=s?.type==="textColor"?s.color:"";n?e.chain().focus().setColor(n).run():e.chain().focus().unsetColor().run()},canExecute:()=>!0,isActive:e=>e.isActive("textStyle"),label:"Text color"},highlight:{execute:({editor:e,config:s})=>{const n=s?.type==="highlight"?s.color:"";n?e.chain().focus().setHighlight({color:n}).run():e.chain().focus().unsetHighlight().run()},canExecute:()=>!0,isActive:e=>e.isActive("highlight"),label:"Highlight"},link:{execute:({editor:e,config:s})=>{const n=s?.type==="link"?s.href:"";if(n){const a=s?.type==="link"?s.target:void 0,r=s?.type==="link"?s.rel:void 0;e.chain().focus().setLink({href:n,target:a,rel:r}).run()}else e.chain().focus().unsetLink().run()},canExecute:()=>!0,isActive:e=>e.isActive("link"),shortcut:"Mod-k",label:"Link"},paragraph:{execute:({editor:e})=>e.chain().focus().setParagraph().run(),canExecute:e=>e.can().chain().focus().setParagraph().run(),isActive:e=>e.isActive("paragraph"),shortcut:"Mod-Alt-0",label:"Paragraph"},heading:{execute:({editor:e,config:s})=>{const n=s?.type==="heading"?s.level:1;e.chain().focus().toggleHeading({level:n}).run()},canExecute:(e,s)=>{const n=s?.type==="heading"?s.level:1;return e.can().chain().focus().toggleHeading({level:n}).run()},isActive:(e,s)=>s?.type==="heading"?e.isActive("heading",{level:s.level}):e.isActive("heading"),label:"Heading"},bulletList:{execute:({editor:e})=>e.chain().focus().toggleBulletList().run(),canExecute:e=>e.can().chain().focus().toggleBulletList().run(),isActive:e=>e.isActive("bulletList"),shortcut:"Mod-Shift-8",label:"Bullet list"},orderedList:{execute:({editor:e})=>e.chain().focus().toggleOrderedList().run(),canExecute:e=>e.can().chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList"),shortcut:"Mod-Shift-7",label:"Numbered list"},taskList:{execute:({editor:e})=>e.chain().focus().toggleTaskList().run(),canExecute:e=>e.can().chain().focus().toggleTaskList().run(),isActive:e=>e.isActive("taskList"),label:"Task list"},codeBlock:{execute:({editor:e})=>e.chain().focus().toggleCodeBlock().run(),canExecute:e=>e.can().chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock"),shortcut:"Mod-Alt-c",label:"Code block"},blockquote:{execute:({editor:e})=>e.chain().focus().toggleBlockquote().run(),canExecute:e=>e.can().chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote"),shortcut:"Mod-Shift-b",label:"Blockquote"},horizontalRule:{execute:({editor:e})=>e.chain().focus().setHorizontalRule().run(),canExecute:e=>e.can().chain().focus().setHorizontalRule().run(),isActive:()=>!1,label:"Horizontal rule"},hardBreak:{execute:({editor:e})=>e.chain().focus().setHardBreak().run(),canExecute:e=>e.can().chain().focus().setHardBreak().run(),isActive:()=>!1,shortcut:"Mod-Enter",label:"Line break"},textAlign:{execute:({editor:e,config:s})=>{const n=s?.type==="textAlign"?s.alignment:"left";e.chain().focus().setTextAlign(n).run()},canExecute:()=>!0,isActive:(e,s)=>s?.type==="textAlign"?e.isActive({textAlign:s.alignment}):!1,label:"Text alignment"},clearMarks:{execute:({editor:e})=>e.chain().focus().unsetAllMarks().run(),canExecute:e=>e.can().chain().focus().unsetAllMarks().run(),isActive:()=>!1,label:"Clear formatting"},clearNodes:{execute:({editor:e})=>e.chain().focus().clearNodes().run(),canExecute:e=>e.can().chain().focus().clearNodes().run(),isActive:()=>!1,label:"Clear nodes"},undo:{execute:({editor:e})=>e.chain().focus().undo().run(),canExecute:e=>e.can().chain().focus().undo().run(),isActive:()=>!1,shortcut:"Mod-z",label:"Undo"},redo:{execute:({editor:e})=>e.chain().focus().redo().run(),canExecute:e=>e.can().chain().focus().redo().run(),isActive:()=>!1,shortcut:"Mod-Shift-z",label:"Redo"}},qu={1:"Heading 1",2:"Heading 2",3:"Heading 3",4:"Heading 4",5:"Heading 5",6:"Heading 6"};function Gu({editor:e,levels:s=[1,2,3,4,5,6],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const o=()=>a(l=>l+1);return e.on("selectionUpdate",o),e.on("transaction",o),()=>{e.off("selectionUpdate",o),e.off("transaction",o)}},[e]);const r=s.find(o=>e.isActive("heading",{level:o})),i=o=>{const l=Number(o),d=mt.heading;d&&d.execute({editor:e,config:{type:"heading",level:l}})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,startContent:t.jsx(X.Heading,{size:16}),"aria-label":"Select heading level",children:r?`H${r}`:"H"})}),t.jsx(c.DropdownMenu,{"aria-label":"Heading levels",selectionMode:"single",selectedKeys:r?new Set([String(r)]):new Set,onAction:i,children:s.map(o=>t.jsx(c.DropdownItem,{startContent:e.isActive("heading",{level:o})?t.jsx(X.Check,{size:16}):t.jsx("div",{className:"w-4"}),children:qu[o]},o))})]})}const en={bulletList:{label:"Bullet List",icon:X.List},orderedList:{label:"Numbered List",icon:X.ListOrdered},taskList:{label:"Task List",icon:X.ListTodo}};function Ku({editor:e,types:s=["bulletList","orderedList","taskList"],isDisabled:n=!1}){const[,a]=h.useState(0);h.useEffect(()=>{const l=()=>a(d=>d+1);return e.on("selectionUpdate",l),e.on("transaction",l),()=>{e.off("selectionUpdate",l),e.off("transaction",l)}},[e]);const r=s.find(l=>e.isActive(l)),i=r?en[r].icon:X.List,o=l=>{const u=mt[l];u&&u.execute({editor:e})};return t.jsxs(c.Dropdown,{placement:"top-start",offset:10,children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:r?"solid":"bordered",color:r?"primary":"default",isDisabled:n,isIconOnly:!0,"aria-label":"Select list type",children:t.jsx(i,{size:16})})}),t.jsx(c.DropdownMenu,{"aria-label":"List types",selectionMode:"single",selectedKeys:r?new Set([r]):new Set,onAction:o,children:s.map(l=>{const d=en[l].icon;return t.jsx(c.DropdownItem,{startContent:t.jsx(d,{size:16}),children:en[l].label},l)})})]})}function Yu({colors:e,selectedColor:s,onColorSelect:n,columns:a=4}){return t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`},children:e.map(r=>{const i=s===r;return t.jsx("button",{type:"button",onClick:()=>n(r),className:`
8
8
  w-8 h-8 rounded-full border-2 cursor-pointer
9
9
  transition-all duration-200
10
10
  hover:scale-110 hover:shadow-md
11
11
  focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2
12
12
  ${i?"border-primary ring-2 ring-primary ring-offset-2 scale-110":"border-divider"}
13
- `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const qu=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Gu=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function Js(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Me={min:50,max:200,step:10,default:100},Ba={lineHeight:24,toolbarHeight:60},Ku={bold:X.Bold,italic:X.Italic,strike:X.Strikethrough,underline:X.Underline,code:X.Code,textColor:X.Palette,highlight:X.Highlighter,link:X.Link2,paragraph:X.FileText,heading:X.Heading,bulletList:X.List,orderedList:X.ListOrdered,taskList:X.ListTodo,codeBlock:X.CodeSquare,blockquote:X.Quote,horizontalRule:X.Minus,clearMarks:X.Eraser,clearNodes:X.Eraser,undo:X.Undo2,redo:X.Redo2,hardBreak:X.CornerDownLeft,textAlign:X.AlignLeft},Yu={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function Lt(e){return Ku[e]}function Qu({value:e,onChange:s,onApply:n,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const x=u.target.value;s(x),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!Js(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),n(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:Js(e)?e:"transparent"}})}),t.jsx(T,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!Js(e),children:t.jsx(X.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Va({editor:e,type:s,allowCustomColor:n=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=s==="textColor"?qu:Gu,x=v=>{const b=ut[s];b&&b.execute({editor:e,config:{type:s,color:v}}),o(!1),d("")},m=v=>{x(v)},p=()=>{const v=ut[s];v&&v.execute({editor:e,config:{type:s,color:""}}),o(!1)},f=s==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=s==="textColor"?X.Palette:X.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(g,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(T,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(Wu,{colors:u,onColorSelect:x}),n&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(Qu,{value:l,onChange:d,onApply:m})]})]})]})})]})}function Zu({zoom:e,onZoomChange:s,min:n=Me.min,max:a=Me.max,step:r=Me.step}){const i=()=>{const m=Math.max(n,e-r);s(m)},o=()=>{const m=Math.min(a,e+r);s(m)},l=()=>{s(Me.default)},d=e<=n,u=e>=a,x=e===Me.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(X.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:x?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:x,className:`
13
+ `,style:{backgroundColor:r},"aria-label":`Select color ${r}`,title:r},r)})})}const Qu=["#000000","#374151","#6B7280","#EF4444","#F59E0B","#10B981","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#A855F7"],Zu=["#FEF3C7","#DBEAFE","#D1FAE5","#FCE7F3","#E0E7FF","#FED7AA","#F3E8FF","#CCFBF1","#FEE2E2","#E5E7EB","#FAE8FF","#BFDBFE"];function tn(e){return/^#([0-9A-F]{3}){1,2}$/i.test(e)}const Pe={min:50,max:200,step:10,default:100},Ha={lineHeight:24,toolbarHeight:60},Xu={bold:X.Bold,italic:X.Italic,strike:X.Strikethrough,underline:X.Underline,code:X.Code,textColor:X.Palette,highlight:X.Highlighter,link:X.Link2,paragraph:X.FileText,heading:X.Heading,bulletList:X.List,orderedList:X.ListOrdered,taskList:X.ListTodo,codeBlock:X.CodeSquare,blockquote:X.Quote,horizontalRule:X.Minus,clearMarks:X.Eraser,clearNodes:X.Eraser,undo:X.Undo2,redo:X.Redo2,hardBreak:X.CornerDownLeft,textAlign:X.AlignLeft},Ju={left:X.AlignLeft,center:X.AlignCenter,right:X.AlignRight,justify:X.AlignJustify};function Ft(e){return Xu[e]}function em({value:e,onChange:s,onApply:n,placeholder:a="#000000"}){const[r,i]=h.useState(""),o=u=>{const x=u.target.value;s(x),r&&i("")},l=()=>{if(!e){i("Please enter a color");return}if(!tn(e)){i("Invalid hex color (e.g., #FF0000)");return}i(""),n(e)},d=u=>{u.key==="Enter"&&(u.preventDefault(),l())};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Input,{type:"text",value:e,onChange:o,onKeyDown:d,placeholder:a,size:"sm",variant:"bordered","aria-label":"Custom color hex code",isInvalid:!!r,errorMessage:r,startContent:t.jsx("div",{className:"w-4 h-4 rounded border border-divider",style:{backgroundColor:tn(e)?e:"transparent"}})}),t.jsx(T,{size:"sm",color:"primary",variant:"flat",isIconOnly:!0,onPress:l,"aria-label":"Apply custom color",isDisabled:!e||!tn(e),children:t.jsx(X.Check,{size:16})})]}),t.jsx("p",{className:"text-xs text-default-500",children:"Enter a hex color code (e.g., #FF0000)"})]})}function Wa({editor:e,type:s,allowCustomColor:n=!0,label:a,isDisabled:r=!1}){const[i,o]=h.useState(!1),[l,d]=h.useState(""),u=s==="textColor"?Qu:Zu,x=v=>{const b=mt[s];b&&b.execute({editor:e,config:{type:s,color:v}}),o(!1),d("")},m=v=>{x(v)},p=()=>{const v=mt[s];v&&v.execute({editor:e,config:{type:s,color:""}}),o(!1)},f=s==="textColor"?e.isActive("textStyle"):e.isActive("highlight"),g=s==="textColor"?X.Palette:X.Highlighter;return t.jsxs(c.Popover,{isOpen:i,onOpenChange:o,placement:"top",offset:10,showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:f?"solid":"bordered",color:f?"primary":"default",isIconOnly:!0,isDisabled:r,"aria-label":a,children:t.jsx(g,{size:16})})}),t.jsx(c.PopoverContent,{className:"w-64",children:t.jsxs("div",{className:"px-2 py-3 space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-sm font-semibold",children:a}),t.jsx(T,{size:"sm",variant:"light",isIconOnly:!0,onPress:p,"aria-label":"Clear color",children:t.jsx(X.X,{size:16})})]}),t.jsx(Yu,{colors:u,onColorSelect:x}),n&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs font-semibold mb-2 text-default-700",children:"Custom Color"}),t.jsx(em,{value:l,onChange:d,onApply:m})]})]})]})})]})}function tm({zoom:e,onZoomChange:s,min:n=Pe.min,max:a=Pe.max,step:r=Pe.step}){const i=()=>{const m=Math.max(n,e-r);s(m)},o=()=>{const m=Math.min(a,e+r);s(m)},l=()=>{s(Pe.default)},d=e<=n,u=e>=a,x=e===Pe.default;return t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Tooltip,{content:"Zoom out",placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:d,onPress:i,"aria-label":"Zoom out",children:t.jsx(X.ZoomOut,{size:16})})}),t.jsx(c.Tooltip,{content:x?"Zoom percentage":"Click to reset zoom",placement:"top",offset:10,children:t.jsxs("button",{type:"button",onClick:l,disabled:x,className:`
14
14
  text-xs text-default-500 min-w-[3ch] text-center px-2
15
15
  ${x?"cursor-default":"cursor-pointer hover:text-primary"}
16
- `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(X.ZoomIn,{size:16})})})]})}function Xu({editor:e,isDisabled:s=!1}){const[n,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),x=e.isActive("link"),m=f=>{if(f){const{from:g,to:v}=e.state.selection,b=e.isActive("link");let y="";if(b){const k=e.schema.marks.link,w=e.state.doc.resolve(g),$=ja.getMarkRange(w,k);$&&(y=e.state.doc.textBetween($.from,$.to,""))}else y=e.state.doc.textBetween(g,v,"");const N=e.getAttributes("link").href||"";i(y),l(N),u(b)}a(f)},p=()=>{if(o.trim()){const{from:f,to:g}=e.state.selection,v=e.schema.marks.link,b=e.state.doc.resolve(f),y=ja.getMarkRange(b,v),N=y?.from??f,k=y?.to??g,w=e.state.doc.textBetween(N,k,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:N,to:k}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(X.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:f=>i(f.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(T,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function Ju({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function Ei(e,s){const n=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>Jt(l)))).forEach(l=>{const d=ut[l];if(d)try{const u=d.canExecute?.(e)??!0,x=d.isActive?.(e)??!1;i[l]={isActive:x,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[a,r]=h.useState(n);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>Jt(d)))).forEach(d=>{const u=ut[d];if(u)try{const x=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!x,canExecute:x}}catch(x){console.warn(`Extension not available for modifier: ${d}`,x),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,n]),a}function Li(e,s){const n=h.useCallback((o,l)=>{if(!e)return;const d=ut[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=h.useCallback(o=>{n(o)},[n]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=ut[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=h.useCallback((o,l)=>{if(!e)return!1;const d=ut[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:n,toggleModifier:a,canExecute:r,isActive:i}}function em(e=Me.default){const[s,n]=h.useState(e),a=h.useCallback((l=Me.step)=>{n(d=>Math.min(Me.max,d+l))},[]),r=h.useCallback((l=Me.step)=>{n(d=>Math.max(Me.min,d-l))},[]),i=h.useCallback(()=>{n(Me.default)},[]),o=h.useCallback(l=>{const d=Math.max(Me.min,Math.min(Me.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Me.min,isMaxZoom:s>=Me.max,isDefaultZoom:s===Me.default}}const tm=["bold","italic","strike","underline","code"];function sm({editor:e,modifiers:s,onToolbarAction:n}){const a=Ei(e,s),{toggleModifier:r}=Li(e,n);if(!e)return null;const i=s.map(o=>Jt(o)).filter(o=>tm.includes(o));return i.length===0?null:t.jsx(Ju,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Lt(o);return t.jsx(yt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function nm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Ei(e,s),{toggleModifier:d,executeCommand:u}=Li(e,o);if(!e)return null;const x=s.map(j=>Jt(j)),m=x.some(j=>["bold","italic","strike","underline","code"].includes(j)),p=x.some(j=>["textColor","highlight"].includes(j)),f=x.includes("heading"),g=x.includes("textAlign"),v=x.some(j=>["bulletList","orderedList","taskList"].includes(j)),b=x.includes("blockquote"),y=x.includes("codeBlock"),N=x.includes("link"),k=x.includes("horizontalRule"),w=x.some(j=>["undo","redo"].includes(j)),$=n!==void 0&&a!==void 0,A=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${A} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(sm,{editor:e,modifiers:s,onToolbarAction:o}),(p||f||g||v||b||y||N||k||w||$)&&t.jsx(bt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("textColor")&&t.jsx(Va,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),x.includes("highlight")&&t.jsx(Va,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||g||v||b||y||N||k||w||$)&&t.jsx(bt,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(Uu,{editor:e}),(g||v||b||y||N||k||w||$)&&t.jsx(bt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(j=>{const D=Yu[j],S=e.isActive({textAlign:j});return t.jsx(yt,{icon:D,label:`Align ${j}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:j})},j)})}),(v||b||y||N||k||w||$)&&t.jsx(bt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(Hu,{editor:e,types:x.filter(j=>["bulletList","orderedList","taskList"].includes(j))}),(b||y||N||k||w||$)&&t.jsx(bt,{})]}),(b||y||N||k)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(yt,{icon:Lt("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),y&&t.jsx(yt,{icon:Lt("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(Xu,{editor:e,isDisabled:l.link?.isDisabled}),k&&t.jsx(yt,{icon:Lt("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||$)&&t.jsx(bt,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("undo")&&t.jsx(yt,{icon:Lt("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),x.includes("redo")&&t.jsx(yt,{icon:Lt("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(bt,{})]}),$&&t.jsx(Zu,{zoom:n,onZoomChange:j=>{a?.(j),o?.({type:"zoom",modifier:`${j}%`})}})]})})}const zt={bold:{category:"mark",extension:bc.Bold,priority:100},italic:{category:"mark",extension:gc.Italic,priority:100},strike:{category:"mark",extension:yc.Strike,priority:100},underline:{category:"mark",extension:vc.Underline,priority:100},code:{category:"mark",extension:jc.Code,priority:100},textColor:{category:"mark",extension:wc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:Nc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Cc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Sc.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ac.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Dc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Ec.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Rc.CodeBlock,priority:100},blockquote:{category:"node",extension:_c.Blockquote,priority:100},horizontalRule:{category:"node",extension:Mc.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Pc.HardBreak,priority:100},undo:{category:"extension",extension:wa.History,priority:50},redo:{category:"extension",extension:wa.History,priority:50},textAlign:{category:"extension",extension:Ic.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},am=[Tc.Document,Oc.Text,$c.Paragraph,kc.TextStyle.configure({HTMLAttributes:{}}),Fc.ListItem.configure({HTMLAttributes:{}}),Lc.TaskItem.configure({nested:!0}),zc.Dropcursor,Bc.Gapcursor];function rm(e){const s=[],n=new Set,a=new Set;am.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>Jt(l)),i=new Set;return r.forEach(l=>{const d=zt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=zt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(x),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=zt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(x),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(zt).find(f=>f?.extension?.name===l.name),x=Object.values(zt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(x?.priority??100)-m})}const Fi={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},im={h1:`font-size: ${be.fontSize["4xl"]}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h2:`font-size: ${be.fontSize["2xl"]}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h3:`font-size: ${be.fontSize.xl}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h4:`font-size: ${be.fontSize.lg}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h5:`font-size: ${be.fontSize.base}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,h6:`font-size: ${be.fontSize.sm}; font-weight: ${be.fontWeight.semibold}; line-height: ${be.lineHeight.tight}; margin: ${pe.md} 0 ${pe.sm} 0;`,p:`min-height: ${be.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${pe.xl}; margin: ${pe.md} 0;`,li:`display: list-item; margin: ${pe.xs} 0;`,strong:`font-weight: ${be.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Le.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${be.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${be.fontFamily.mono};`,pre:`background: ${Le.neutral.gray[800]}; border-radius: ${pe.sm}; color: ${Le.neutral.gray[100]}; font-family: ${be.fontFamily.mono}; margin: ${pe.lg} 0; padding: 0.75rem ${pe.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Le.neutral.gray[300]}; margin: ${pe.lg} 0; padding-left: ${pe.md}; color: ${Le.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Le.neutral.gray[200]}; margin: ${pe.xl} 0;`,a:`color: ${Le.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Le.palettes.warning[200]}; border-radius: ${pe.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${pe.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},lm={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function om(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(lm)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries(im)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return s}const cm=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=Fn.useCurrentEditor();return t.jsx(nm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},dm=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=Fn.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},wn=h.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=Fi.full,variant:u="bordered",initialContent:x,content:m,onContentChange:p,onUpdate:f,onToolbarAction:g,isReadOnly:v=!1,isDisabled:b=!1,includeInlineStyles:y=!0,...N}=e,{zoom:k,setZoom:w}=em(),$=Ba.lineHeight,A=n*$,j=r?void 0:a*$,D=h.useMemo(()=>rm(d),[d]),{Component:S,label:_,shouldLabelBeOutside:F,getBaseProps:L,getLabelProps:P,getInputWrapperProps:B}=c.useInput({...N,variant:u,ref:s,isMultiline:!0}),H=_?t.jsx("label",{...P(),children:_}):null,K=h.useCallback(({editor:O})=>{const ne=O.getHTML(),G=y?om(ne):ne,te=O.getJSON(),Y=O.getText(),oe=Y.length,ee=Y.split(/\s+/).filter(ie=>ie.length>0).length,J={html:G,json:te,text:Y,characters:oe,words:ee};if(p?.(J),f?.(J),"onChange"in N&&typeof N.onChange=="function"){const ie={target:{value:G},currentTarget:{value:G}};N.onChange(ie)}},[p,f,N,y]);return t.jsxs(S,{...L(),children:[F?H:null,t.jsx("div",{...B(),className:c.cn(B().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:j?`${j+Ba.toolbarHeight}px`:void 0,overflow:j?"auto":void 0},children:t.jsx(Fn.EditorProvider,{editable:!v&&!b,slotBefore:l?t.jsx(cm,{modifiers:d,zoom:k,onZoomChange:w,onToolbarAction:g}):void 0,slotAfter:t.jsx(dm,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${A}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:D,content:m||x||e.defaultValue||"",onUpdate:K})})]})});wn.displayName="TipTapEditor";const Ri=h.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx(wn,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx(wn,{...r,variant:a,ref:s}))});Ri.displayName="RichTextArea";function Ua(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function um(e="en-US",s="USD"){try{const n=new Intl.NumberFormat(e,{style:"currency",currency:s,currencyDisplay:"symbol"}),a=n.formatToParts(1),r=a.findIndex(d=>d.type==="currency"),i=a.findIndex(d=>d.type==="integer"),{minimumFractionDigits:o,maximumFractionDigits:l}=n.resolvedOptions();return{symbol:a[r]?.value??s,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:l}}}catch(n){return console.warn(`Invalid currency formatting: ${n}`),{symbol:s,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const Ha=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${Ne} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Wa=`border bg-white shadow-none ${Ne}`,mm={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${Ha} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${Wa} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${Ha} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${Wa} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},kt={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},fm={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},qa=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],xm={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},_i=({presetAmounts:e=qa,selectedDonation:s,defaultSelectedDonation:n=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:x,mobileColumns:m=2,desktopColumns:p=3,isDisabled:f=!1,buttonVariant:g="bordered",buttonColor:v="default",inputVariant:b="bordered",size:y="md",className:N="",showCard:k=!0,variant:w="pill",customAmountPlacement:$="below",isRequired:A=!1})=>{const j={...xm,...x},D=h.useId(),S=`${D}-title`,_=`${D}-custom`,F=Array.isArray(e)?e:qa,L={2:"grid-cols-2",3:"grid-cols-3"},P={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},B=`${L[m]} ${P[p]}`,[H,K]=ss(s,n,a),[O,ne]=h.useState(""),[G,te]=h.useState(!1),[Y,oe]=h.useState(0),ee=h.useCallback(ae=>{if(f)return;const Ce={amount:ae.amount,isCustom:!1,presetId:ae.id};K(Ce),ne(""),te(!1),oe(Ve=>Ve+1),r?.(Ce)},[f,K,r]),J=h.useCallback(ae=>{if(f)return;if(ne(ae!==void 0?String(ae):""),r){K(null);return}if(te(!1),ae===void 0||isNaN(ae)){K(null);return}K({amount:ae,isCustom:!0})},[f,K,r]),ie=h.useCallback(()=>{if(f)return;const ae=O!==""?parseFloat(O):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[f,O,r]),U=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),z=h.useMemo(()=>um(o,i),[o,i]),Q=ae=>H!==null&&!H.isCustom&&H.presetId===ae.id,Be=(ae,Ce)=>{const Ve=H?.isCustom===!0,at=!r&&G,ye=w==="tile"&&$==="inline",Ue=ye?t.jsx("span",{className:kt.affix,"data-testid":"donation-amounts-custom-symbol",children:z.symbol}):void 0,de=t.jsxs("div",{className:c.cn("flex items-start gap-3",ye&&kt.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(c.NumberInput,{id:_,placeholder:j.customAmountPlaceholder,"aria-label":ye?j.customAmountLabel??j.customAmountAriaLabel:j.customAmountLabel?void 0:j.customAmountAriaLabel,onInput:r?()=>{K(null),te(!0)}:()=>te(!0),onBlur:r?void 0:()=>te(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ye?z.formatOptions:U,startContent:z.position==="start"?Ue:void 0,endContent:z.position==="end"?Ue:void 0,value:O!==""?parseFloat(O):void 0,onValueChange:J,isDisabled:f,className:"flex-1",classNames:{inputWrapper:c.cn(ae.inputWrapper,Ce.wrapper,ye&&kt.inputWrapper,(Ve||at)&&ae.inputWrapperActive),input:c.cn(ae.input,Ce.input,ye&&kt.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(T,{color:"primary",variant:"solid",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]}),ve=l&&(ye?de:t.jsxs("div",{className:c.cn("flex flex-col",ae.inputBase),children:[j.customAmountLabel&&t.jsx("label",{htmlFor:_,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:j.customAmountLabel}),de]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":w,"data-custom-placement":ye?"inline":void 0,children:[j.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:j.eyebrow}),j.title&&t.jsxs("p",{id:S,className:ae.title,"data-testid":"donation-amounts-title",children:[j.title,A&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),j.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:j.caption}),(F.length>0||ye&&ve)&&t.jsxs("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:ye?kt.row:c.cn(ae.grid,w==="tile"&&B),"data-testid":"donation-amounts-presets",children:[F.map(je=>{const C=Q(je)&&!at;return t.jsxs(T,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":C,className:c.cn(ae.preset,ye&&kt.preset,C?ae.presetSelected:ae.presetIdle),onPress:()=>ee(je),isDisabled:f,"data-selected":C||void 0,"data-testid":`donation-amounts-preset-${je.id}`,children:[t.jsx("span",{className:c.cn(ae.amount,C&&ae.amountSelected),children:je.label||Ua(je.amount,o,i,w!=="pos")}),je.sublabel&&" ",je.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${je.id}-sublabel`,children:je.sublabel})]},je.id)}),ye&&ve]}),!ye&&ve]})},Fe=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{id:S,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),F.length>0&&t.jsx("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:c.cn("grid gap-3",B),"data-testid":"donation-amounts-presets",children:F.map(ae=>{const Ce=H!==null&&!H.isCustom&&H.presetId===ae.id;return t.jsx(T,{color:Ce?"primary":v,variant:Ce?"solid":g,className:"w-full","aria-pressed":Ce,onPress:()=>ee(ae),isDisabled:f,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||Ua(ae.amount,o,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{K(null),te(!0)}:void 0,variant:b,radius:"full",size:y,minValue:d,maxValue:u,step:.01,formatOptions:U,value:O!==""?parseFloat(O):void 0,onValueChange:J,isDisabled:f,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(T,{color:"primary",variant:"solid",radius:"full",size:y,className:"shrink-0",onPress:ie,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]}),Re=w==="pill"?Fe:Be(mm[w],fm[w][y]);return k?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:Re})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:Re})};_i.displayName="DonationAmounts";const pm=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},hm=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},bm=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Mi=h.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:x=!0,formatTime:m=pm,className:p,...f},g)=>{const[v,b]=ss(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),y=h.useRef(null),N=h.useRef(!1);h.useEffect(()=>()=>{y.current&&clearInterval(y.current)},[]),h.useEffect(()=>{if(!x||v<=0){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{b(A=>A<=1?(y.current&&(clearInterval(y.current),y.current=null),N.current||(N.current=!0,a?.()),0):A-1)},1e3),()=>{y.current&&(clearInterval(y.current),y.current=null)}},[x,v,b,a]),h.useEffect(()=>{v>0&&(N.current=!1)},[v]);const k=d||hm(r),w=bm(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${o} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,$[u],p),...f,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(k,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});Mi.displayName="ExpireCartTimer";const St=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(M,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),gm=({classes:e="",name:s,imageUrl:n,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:x="eager",showMoreButtonClassName:m,labels:p})=>{const[f,g]=h.useState(!1),[v,b]=h.useState(!1),y=h.useRef(null);return h.useEffect(()=>{const N=()=>{if(y.current){const k=y.current.scrollHeight>y.current.clientHeight;b(k)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&n&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(St,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(St,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(St,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(T,{onPress:()=>g(!f),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&n&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx(St,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx(St,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx(St,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(T,{onPress:()=>g(!f),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function Nn(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function ym(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const vm={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},$t=e=>typeof e=="number"&&!isNaN(e),Ns=({offer:e,quantity:s,defaultQuantity:n=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:x="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:f=!0,showPrice:g=!0,priceDisplay:v,classNames:b={},"data-testid":y,selectedColor:N="default",selectionMode:k="stepper",compact:w=!1,isSoldOut:$,isMaxReached:A,isRuleBlocked:j,statusTone:D="default",statusLabel:S,disabledReason:_,disabled:F})=>{const L=h.useMemo(()=>({...vm,...o}),[o]),[P,B]=h.useState(n),H=s!==void 0?s:P,K=!!(d||F),O=w||!!e.compact,ne=k==="press-to-add",G=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!$t(e.totalTicketsSold)||!$t(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),te=h.useMemo(()=>typeof A=="boolean"?A:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!$t(e.ticketsAllowed)?!1:H>=e.ticketsAllowed-(e.totalTicketsSold??0),[A,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,H]),Y=h.useMemo(()=>typeof j=="boolean"?j:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[j,e.isRuleBlocked]),oe=_||e.disabledReason,ee=K||G||Y,J=de=>{if(ee||de>0&&te)return;const ve=Math.max(0,H+de);s===void 0&&B(ve),a?.(e.id,ve)},ie=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),U=h.useMemo(()=>D||(G||Y?"danger":te?"warning":"default"),[D,G,Y,te]),z=h.useMemo(()=>{if(ie)return ie==="ruleBlocked"?S||oe||L.ruleBlocked:ie==="soldOut"?S||oe||L.soldOut:ie==="disabled"?S||oe||L.disabled:S||L.maxReached},[ie,S,oe,L]),Q={soldOut:"danger",ruleBlocked:U,disabled:"default",maxReached:"warning"},Be={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Fe=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",O&&"text-sm",b.name),children:e.name}),Re=()=>{if(!g)return null;const de=v?.price??e.price,ve=v?.originalPrice,je=Nn(de,i,r);if(l?.renderPrice)return l.renderPrice(de,je,e);if($t(ve)&&$t(de)&&ve>de){const E=Nn(ve,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",O&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",E,", discounted price ",je]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",O&&"text-xs",b.originalPrice),children:E}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",O&&"text-sm",b.discountedPrice),children:je})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",O&&"text-sm mt-0.5",b.price),children:je})},ae=()=>!p||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",O&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),Ce=()=>{if(!f||!$t(e.numberOfPeople)||e.numberOfPeople<=0)return null;const de=e.numberOfPeople===1?L.person:L.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,de,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",O&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(M,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",de]})},Ve=()=>{const de=H===0||ee,ve=te||ee;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:H,onIncrement:()=>J(1),onDecrement:()=>J(-1),isDecrementDisabled:de,isIncrementDisabled:ve,isDisabled:ee}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(T,{"data-testid":"offer-card-decrement-button",onPress:()=>J(-1),isDisabled:de,variant:u,color:H>0?N:x,radius:"full",isIconOnly:!0,size:O?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(M,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",O&&"text-sm"),children:H}),t.jsx(T,{"data-testid":"offer-card-increment-button",onPress:()=>J(1),isDisabled:ve,variant:u,color:H>0?N:x,radius:"full",isIconOnly:!0,size:O?"md":"sm","aria-label":"Increase quantity",children:t.jsx(M,{icon:"gravity-ui:plus",width:16})})]})},at=(de,ve)=>l?.renderDisabledState?l.renderDisabledState(de,ve):de==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(ve):de==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(ve):t.jsx(c.Chip,{"data-testid":Be[de],color:Q[de],variant:de==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",de==="maxReached"?"h-8":"h-10",de==="soldOut"&&b.soldOut,de==="maxReached"&&b.maxReachedAlert,O&&"h-8"),startContent:t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:ve})}),ye=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",O?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ee||te?"opacity-50 pointer-events-none select-none":""),children:[Fe(),Re(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",O?"mb-1":"mb-2"),children:[Ce(),ae()]})]}),!ne&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",O&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:ie&&z?at(ie,z):Ve()})]}),Ue=te&&!G&&!Y&&!K?t.jsx(ze.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:at("maxReached",z||L.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!ee&&!te&&"cursor-pointer",O&&b.compact,b.base),"data-testid":y||`offer-card-${e.id}`,isPressable:ne&&!ee&&!te,onPress:ne&&!ee&&!te?()=>J(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",O?"pb-0.5":"",b.body),children:ye}),t.jsx(ze.AnimatePresence,{children:Ue&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",O?"pt-1":"",b.footer),children:Ue})})]}):t.jsxs("div",{className:c.cn("w-full",O&&b.compact,b.base),"data-testid":y||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",O?"pb-0.5":"",b.body),children:ye}),t.jsx(ze.AnimatePresence,{children:Ue&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",O?"pt-1":"",b.footer),children:Ue})})]})};Ns.displayName="OfferCard";const Pi=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(M,{"data-testid":"offer-card-empty-icon",icon:s,width:n,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};Pi.displayName="OfferCardEmpty";const jm={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Ii=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...jm,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};Ii.displayName="OfferCardError";const wm={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},Ti=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=wm[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(c.Skeleton,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};Ti.displayName="OfferCardSkeleton";const Oi={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},zi={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},Nm={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Bi=({offers:e=[],mapOffer:s,selection:n,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:x=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:f=!0,animated:g=!0,gap:v=2,compact:b=!1,classNames:y={}})=>{const[N,k]=h.useState(a),w=n!==void 0?n:N,$=h.useCallback((F,L)=>{const P={...w,[F]:Math.max(0,L)};n===void 0&&k(P),r?.(P),i?.(F,P[F])},[w,n,r,i]),A=[...e].sort((F,L)=>(F.position??0)-(L.position??0)),j=F=>{const L=s?s(F):F,P=(w??{})[L.id]||0;return{offer:L,quantity:P,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:p,showCard:f,compact:b}},D=Nm[v],S=c.cn("grid mx-auto pt-2",D,y.base),_=F=>{const L=j(F);return t.jsx(Ns,{offer:L.offer,quantity:L.quantity,onQuantityChange:L.onQuantityChange,currency:L.currency,locale:L.locale,labels:L.labels,slots:L.slots,isDisabled:L.isDisabled,buttonVariant:L.buttonVariant,buttonColor:L.buttonColor,showCard:L.showCard,compact:L.compact,classNames:y.card},L.offer.id)};return g?t.jsx(ze.motion.div,{"data-testid":"offer-card-list",className:S,variants:Oi,initial:"hidden",animate:"show",children:t.jsx(ze.AnimatePresence,{children:A.map(F=>{const L=j(F);return t.jsx(ze.motion.div,{"data-testid":`offer-card-list-item-${L.offer.id}`,className:y.cardWrapper,variants:zi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(Ns,{offer:L.offer,quantity:L.quantity,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:p,showCard:f,compact:b||L.offer.compact,classNames:y.card})},L.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:A.map(_)})};Bi.displayName="OfferCardList";var ns=e=>e.type==="checkbox",jt=e=>e instanceof Date,qe=e=>e==null;const Vi=e=>typeof e=="object";var Ae=e=>!qe(e)&&!Array.isArray(e)&&Vi(e)&&!jt(e),Ui=e=>Ae(e)&&e.target?ns(e.target)?e.target.checked:e.target.value:e,Cm=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Hi=(e,s)=>e.has(Cm(s)),km=e=>{const s=e.constructor&&e.constructor.prototype;return Ae(s)&&s.hasOwnProperty("isPrototypeOf")},Hn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ke(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Hn&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(Ae(e)&&km(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=ke(e[r]));return a}var Is=e=>/^\w*$/.test(e),he=e=>e===void 0,Wn=e=>Array.isArray(e)?e.filter(Boolean):[],qn=e=>Wn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,s,n)=>{if(!s||!Ae(e))return n;const a=(Is(s)?[s]:qn(s)).reduce((r,i)=>qe(r)?r:r[i],e);return he(a)||a===e?he(e[s])?n:e[s]:a},Ke=e=>typeof e=="boolean",Oe=e=>typeof e=="function",xe=(e,s,n)=>{let a=-1;const r=Is(s)?[s]:qn(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=Ae(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const Cs={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},tt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},lt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Wi=h.createContext(null);Wi.displayName="HookFormControlContext";const Gn=()=>h.useContext(Wi);var qi=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==tt.all&&(s._proxyFormState[o]=!a||tt.all),n&&(n[o]=!0),e[o]}});return r};const Kn=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Sm(e){const s=Gn(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(n._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Kn(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),h.useMemo(()=>qi(o,n,d.current,!1),[o,n])}var Qe=e=>typeof e=="string",Cn=(e,s,n,a,r)=>Qe(e)?(a&&s.watch.add(e),q(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),q(n,i))):(a&&(s.watchAll=!0),n),kn=e=>qe(e)||!Vi(e);function st(e,s,n=new WeakSet){if(kn(e)||kn(s))return Object.is(e,s);if(jt(e)&&jt(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(jt(o)&&jt(l)||Ae(o)&&Ae(l)||Array.isArray(o)&&Array.isArray(l)?!st(o,l,n):!Object.is(o,l))return!1}}return!0}function $m(e){const s=Gn(),{control:n=s,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),x=h.useRef(void 0),m=h.useRef(n),p=h.useRef(a);u.current=l;const[f,g]=h.useState(()=>{const w=n._getWatch(a,d.current);return u.current?u.current(w):w}),v=h.useCallback(w=>{const $=Cn(a,n._names,w||n._formValues,!1,d.current);return u.current?u.current($):$},[n._formValues,n._names,a]),b=h.useCallback(w=>{if(!i){const $=Cn(a,n._names,w||n._formValues,!1,d.current);if(u.current){const A=u.current($);st(A,x.current)||(g(A),x.current=A)}else g($)}},[n._formValues,n._names,i,a]);Kn(()=>((m.current!==n||!st(p.current,a))&&(m.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:w=>{b(w.values)}})),[n,o,a,b]),h.useEffect(()=>n._removeUnmounted());const y=m.current!==n,N=p.current,k=h.useMemo(()=>{if(i)return null;const w=!y&&!st(N,a);return y||w?v():null},[i,y,a,N,v]);return k!==null?k:f}function Am(e){const s=Gn(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=Hi(r._names.array,n),u=h.useMemo(()=>q(r._formValues,n,q(r._defaultValues,n,o)),[r,n,o]),x=$m({control:r,name:n,defaultValue:u,exact:l}),m=Sm({control:r,name:n,exact:l}),p=h.useRef(e),f=h.useRef(void 0),g=h.useRef(r.register(n,{...e.rules,value:x,...Ke(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const v=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!q(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!q(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!q(m.validatingFields,n)},error:{enumerable:!0,get:()=>q(m.errors,n)}}),[m,n]),b=h.useCallback(w=>g.current.onChange({target:{value:Ui(w),name:n},type:Cs.CHANGE}),[n]),y=h.useCallback(()=>g.current.onBlur({target:{value:q(r._formValues,n),name:n},type:Cs.BLUR}),[n,r._formValues]),N=h.useCallback(w=>{const $=q(r._fields,n);$&&$._f&&w&&($._f.ref={focus:()=>Oe(w.focus)&&w.focus(),select:()=>Oe(w.select)&&w.select(),setCustomValidity:A=>Oe(w.setCustomValidity)&&w.setCustomValidity(A),reportValidity:()=>Oe(w.reportValidity)&&w.reportValidity()})},[r._fields,n]),k=h.useMemo(()=>({name:n,value:x,...Ke(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:b,onBlur:y,ref:N}),[n,a,m.disabled,b,y,N,x]);return h.useEffect(()=>{const w=r._options.shouldUnregister||i,$=f.current;$&&$!==n&&!d&&r.unregister($),r.register(n,{...p.current.rules,...Ke(p.current.disabled)?{disabled:p.current.disabled}:{}});const A=(j,D)=>{const S=q(r._fields,j);S&&S._f&&(S._f.mount=D)};if(A(n,!0),w){const j=ke(q(r._options.defaultValues,n,p.current.defaultValue));xe(r._defaultValues,n,j),he(q(r._formValues,n))&&xe(r._formValues,n,j)}return!d&&r.register(n),f.current=n,()=>{(d?w&&!r._state.action:w)?r.unregister(n):A(n,!1)}},[n,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),h.useMemo(()=>({field:k,formState:m,fieldState:v}),[k,m,v])}const Dm=h.createContext(null);Dm.displayName="HookFormContext";var Em=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},Yt=e=>Array.isArray(e)?e:[e],Ga=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function Gi(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&Ae(r)&&i){const o=Gi(r,i);Ae(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Te=e=>Ae(e)&&!Object.keys(e).length,Yn=e=>e.type==="file",ks=e=>{if(!Hn)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},Ki=e=>e.type==="select-multiple",Qn=e=>e.type==="radio",Lm=e=>Qn(e)||ns(e),en=e=>ks(e)&&e.isConnected;function Fm(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=he(e)?a++:e[s[a++]];return e}function Rm(e){for(const s in e)if(e.hasOwnProperty(s)&&!he(e[s]))return!1;return!0}function Se(e,s){const n=Array.isArray(s)?s:Is(s)?[s]:qn(s),a=n.length===1?e:Fm(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(Ae(a)&&Te(a)||Array.isArray(a)&&Rm(a))&&Se(e,n.slice(0,-1)),e}var _m=e=>{for(const s in e)if(Oe(e[s]))return!0;return!1};function Yi(e){return Array.isArray(e)||Ae(e)&&!_m(e)}function Sn(e,s={}){for(const n in e){const a=e[n];Yi(a)?(s[n]=Array.isArray(a)?[]:{},Sn(a,s[n])):he(a)||(s[n]=!0)}return s}function Ft(e,s,n){n||(n=Sn(s));for(const a in e){const r=e[a];if(Yi(r))he(s)||kn(n[a])?n[a]=Sn(r,Array.isArray(r)?[]:{}):Ft(r,qe(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!st(r,i)}}return n}const Ka={value:!1,isValid:!1},Ya={value:!0,isValid:!0};var Qi=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!he(e[0].attributes.value)?he(e[0].value)||e[0].value===""?Ya:{value:e[0].value,isValid:!0}:Ya:Ka}return Ka},Zi=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>he(e)?e:s?e===""?NaN:e&&+e:n&&Qe(e)?new Date(e):a?a(e):e;const Qa={isValid:!1,value:null};var Xi=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,Qa):Qa;function Za(e){const s=e.ref;return Yn(s)?s.files:Qn(s)?Xi(e.refs).value:Ki(s)?[...s.selectedOptions].map(({value:n})=>n):ns(s)?Qi(e.refs).value:Zi(he(s.value)?e.ref.value:s.value,e)}var Mm=(e,s,n,a)=>{const r={};for(const i of e){const o=q(s,i);o&&xe(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},Ss=e=>e instanceof RegExp,Bt=e=>he(e)?e:Ss(e)?e.source:Ae(e)?Ss(e.value)?e.value.source:e.value:e,Xa=e=>({isOnSubmit:!e||e===tt.onSubmit,isOnBlur:e===tt.onBlur,isOnChange:e===tt.onChange,isOnAll:e===tt.all,isOnTouch:e===tt.onTouched});const Ja="AsyncFunction";var Pm=e=>!!e&&!!e.validate&&!!(Oe(e.validate)&&e.validate.constructor.name===Ja||Ae(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===Ja)),Im=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),er=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Qt=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=q(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(Qt(l,s))break}else if(Ae(l)&&Qt(l,s))break}}};function tr(e,s,n){const a=q(e,n);if(a||Is(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=q(s,i),l=q(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:n}}var Tm=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Te(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||tt.all))},Om=(e,s,n)=>!e||!s||e===s||Yt(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),zm=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,Bm=(e,s)=>!Wn(q(e,s)).length&&Se(e,s),Vm=(e,s,n)=>{const a=Yt(q(e,n));return xe(a,"root",s[n]),xe(e,n,a),e};function sr(e,s,n="validate"){if(Qe(e)||Array.isArray(e)&&e.every(Qe)||Ke(e)&&!e)return{type:n,message:Qe(e)?e:"",ref:s}}var At=e=>Ae(e)&&!Ss(e)?e:{value:e,message:""},nr=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:x,min:m,max:p,pattern:f,validate:g,name:v,valueAsNumber:b,mount:y}=e._f,N=q(n,v);if(!y||s.has(v))return{};const k=l?l[0]:o,w=L=>{r&&k.reportValidity&&(k.setCustomValidity(Ke(L)?"":L||""),k.reportValidity())},$={},A=Qn(o),j=ns(o),D=A||j,S=(b||Yn(o))&&he(o.value)&&he(N)||ks(o)&&o.value===""||N===""||Array.isArray(N)&&!N.length,_=Em.bind(null,v,a,$),F=(L,P,B,H=lt.maxLength,K=lt.minLength)=>{const O=L?P:B;$[v]={type:L?H:K,message:O,ref:o,..._(L?H:K,O)}};if(i?!Array.isArray(N)||!N.length:d&&(!D&&(S||qe(N))||Ke(N)&&!N||j&&!Qi(l).isValid||A&&!Xi(l).isValid)){const{value:L,message:P}=Qe(d)?{value:!!d,message:d}:At(d);if(L&&($[v]={type:lt.required,message:P,ref:k,..._(lt.required,P)},!a))return w(P),$}if(!S&&(!qe(m)||!qe(p))){let L,P;const B=At(p),H=At(m);if(!qe(N)&&!isNaN(N)){const K=o.valueAsNumber||N&&+N;qe(B.value)||(L=K>B.value),qe(H.value)||(P=K<H.value)}else{const K=o.valueAsDate||new Date(N),O=te=>new Date(new Date().toDateString()+" "+te),ne=o.type=="time",G=o.type=="week";Qe(B.value)&&N&&(L=ne?O(N)>O(B.value):G?N>B.value:K>new Date(B.value)),Qe(H.value)&&N&&(P=ne?O(N)<O(H.value):G?N<H.value:K<new Date(H.value))}if((L||P)&&(F(!!L,B.message,H.message,lt.max,lt.min),!a))return w($[v].message),$}if((u||x)&&!S&&(Qe(N)||i&&Array.isArray(N))){const L=At(u),P=At(x),B=!qe(L.value)&&N.length>+L.value,H=!qe(P.value)&&N.length<+P.value;if((B||H)&&(F(B,L.message,P.message),!a))return w($[v].message),$}if(f&&!S&&Qe(N)){const{value:L,message:P}=At(f);if(Ss(L)&&!N.match(L)&&($[v]={type:lt.pattern,message:P,ref:o,..._(lt.pattern,P)},!a))return w(P),$}if(g){if(Oe(g)){const L=await g(N,n),P=sr(L,k);if(P&&($[v]={...P,..._(lt.validate,P.message)},!a))return w(P.message),$}else if(Ae(g)){let L={};for(const P in g){if(!Te(L)&&!a)break;const B=sr(await g[P](N,n),k,P);B&&(L={...B,..._(P,B.message)},w(B.message),a&&($[v]=L))}if(!Te(L)&&($[v]={ref:k,...L},!a))return $}}return w(!0),$};const Um={mode:tt.onSubmit,reValidateMode:tt.onChange,shouldFocusError:!0};function Hm(e={}){let s={...Um,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Oe(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=Ae(s.defaultValues)||Ae(s.values)?ke(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:ke(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...x};let p={...m};const f={array:Ga(),state:Ga()},g=s.criteriaMode===tt.all,v=C=>E=>{clearTimeout(u),u=setTimeout(C,E)},b=async C=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||p.isValid||C)){let E;s.resolver?(E=Te((await D()).errors),y()):E=await _(a,!0),E!==n.isValid&&f.state.next({isValid:E})}},y=(C,E)=>{!s.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((C||Array.from(l.mount)).forEach(R=>{R&&(E?xe(n.validatingFields,R,E):Se(n.validatingFields,R))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Te(n.validatingFields)}))},N=(C,E=[],R,W,V=!0,I=!0)=>{if(W&&R&&!s.disabled){if(o.action=!0,I&&Array.isArray(q(a,C))){const Z=R(q(a,C),W.argA,W.argB);V&&xe(a,C,Z)}if(I&&Array.isArray(q(n.errors,C))){const Z=R(q(n.errors,C),W.argA,W.argB);V&&xe(n.errors,C,Z),Bm(n.errors,C)}if((m.touchedFields||p.touchedFields)&&I&&Array.isArray(q(n.touchedFields,C))){const Z=R(q(n.touchedFields,C),W.argA,W.argB);V&&xe(n.touchedFields,C,Z)}(m.dirtyFields||p.dirtyFields)&&(n.dirtyFields=Ft(r,i)),f.state.next({name:C,isDirty:L(C,E),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else xe(i,C,E)},k=(C,E)=>{xe(n.errors,C,E),f.state.next({errors:n.errors})},w=C=>{n.errors=C,f.state.next({errors:n.errors,isValid:!1})},$=(C,E,R,W)=>{const V=q(a,C);if(V){const I=q(i,C,he(R)?q(r,C):R);he(I)||W&&W.defaultChecked||E?xe(i,C,E?I:Za(V._f)):H(C,I),o.mount&&!o.action&&b()}},A=(C,E,R,W,V)=>{let I=!1,Z=!1;const ue={name:C};if(!s.disabled){if(!R||W){(m.isDirty||p.isDirty)&&(Z=n.isDirty,n.isDirty=ue.isDirty=L(),I=Z!==ue.isDirty);const me=st(q(r,C),E);Z=!!q(n.dirtyFields,C),me?Se(n.dirtyFields,C):xe(n.dirtyFields,C,!0),ue.dirtyFields=n.dirtyFields,I=I||(m.dirtyFields||p.dirtyFields)&&Z!==!me}if(R){const me=q(n.touchedFields,C);me||(xe(n.touchedFields,C,R),ue.touchedFields=n.touchedFields,I=I||(m.touchedFields||p.touchedFields)&&me!==R)}I&&V&&f.state.next(ue)}return I?ue:{}},j=(C,E,R,W)=>{const V=q(n.errors,C),I=(m.isValid||p.isValid)&&Ke(E)&&n.isValid!==E;if(s.delayError&&R?(d=v(()=>k(C,R)),d(s.delayError)):(clearTimeout(u),d=null,R?xe(n.errors,C,R):Se(n.errors,C)),(R?!st(V,R):V)||!Te(W)||I){const Z={...W,...I&&Ke(E)?{isValid:E}:{},errors:n.errors,name:C};n={...n,...Z},f.state.next(Z)}},D=async C=>(y(C,!0),await s.resolver(i,s.context,Mm(C||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),S=async C=>{const{errors:E}=await D(C);if(y(C),C)for(const R of C){const W=q(E,R);W?xe(n.errors,R,W):Se(n.errors,R)}else n.errors=E;return E},_=async(C,E,R={valid:!0})=>{for(const W in C){const V=C[W];if(V){const{_f:I,...Z}=V;if(I){const ue=l.array.has(I.name),me=V._f&&Pm(V._f);me&&m.validatingFields&&y([I.name],!0);const Pe=await nr(V,l.disabled,i,g,s.shouldUseNativeValidation&&!E,ue);if(me&&m.validatingFields&&y([I.name]),Pe[I.name]&&(R.valid=!1,E||e.shouldUseNativeValidation))break;!E&&(q(Pe,I.name)?ue?Vm(n.errors,Pe,I.name):xe(n.errors,I.name,Pe[I.name]):Se(n.errors,I.name))}!Te(Z)&&await _(Z,E,R)}}return R.valid},F=()=>{for(const C of l.unMount){const E=q(a,C);E&&(E._f.refs?E._f.refs.every(R=>!en(R)):!en(E._f.ref))&&Q(C)}l.unMount=new Set},L=(C,E)=>!s.disabled&&(C&&E&&xe(i,C,E),!st(Y(),r)),P=(C,E,R)=>Cn(C,l,{...o.mount?i:he(E)?r:Qe(C)?{[C]:E}:E},R,E),B=C=>Wn(q(o.mount?i:r,C,s.shouldUnregister?q(r,C,[]):[])),H=(C,E,R={})=>{const W=q(a,C);let V=E;if(W){const I=W._f;I&&(!I.disabled&&xe(i,C,Zi(E,I)),V=ks(I.ref)&&qe(E)?"":E,Ki(I.ref)?[...I.ref.options].forEach(Z=>Z.selected=V.includes(Z.value)):I.refs?ns(I.ref)?I.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(V)?Z.checked=!!V.find(ue=>ue===Z.value):Z.checked=V===Z.value||!!V)}):I.refs.forEach(Z=>Z.checked=Z.value===V):Yn(I.ref)?I.ref.value="":(I.ref.value=V,I.ref.type||f.state.next({name:C,values:ke(i)})))}(R.shouldDirty||R.shouldTouch)&&A(C,V,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&te(C)},K=(C,E,R)=>{for(const W in E){if(!E.hasOwnProperty(W))return;const V=E[W],I=C+"."+W,Z=q(a,I);(l.array.has(C)||Ae(V)||Z&&!Z._f)&&!jt(V)?K(I,V,R):H(I,V,R)}},O=(C,E,R={})=>{const W=q(a,C),V=l.array.has(C),I=ke(E);xe(i,C,I),V?(f.array.next({name:C,values:ke(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&R.shouldDirty&&f.state.next({name:C,dirtyFields:Ft(r,i),isDirty:L(C,I)})):W&&!W._f&&!qe(I)?K(C,I,R):H(C,I,R),er(C,l)?f.state.next({...n,name:C,values:ke(i)}):f.state.next({name:o.mount?C:void 0,values:ke(i)})},ne=async C=>{o.mount=!0;const E=C.target;let R=E.name,W=!0;const V=q(a,R),I=me=>{W=Number.isNaN(me)||jt(me)&&isNaN(me.getTime())||st(me,q(i,R,me))},Z=Xa(s.mode),ue=Xa(s.reValidateMode);if(V){let me,Pe;const ht=E.type?Za(V._f):Ui(C),mt=C.type===Cs.BLUR||C.type===Cs.FOCUS_OUT,xc=!Im(V._f)&&!s.resolver&&!q(n.errors,R)&&!V._f.deps||zm(mt,q(n.touchedFields,R),n.isSubmitted,ue,Z),Us=er(R,l,mt);xe(i,R,ht),mt?(!E||!E.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),d&&d(0)):V._f.onChange&&V._f.onChange(C);const Hs=A(R,ht,mt),pc=!Te(Hs)||Us;if(!mt&&f.state.next({name:R,type:C.type,values:ke(i)}),xc)return(m.isValid||p.isValid)&&(s.mode==="onBlur"?mt&&b():mt||b()),pc&&f.state.next({name:R,...Us?{}:Hs});if(!mt&&Us&&f.state.next({...n}),s.resolver){const{errors:ya}=await D([R]);if(y([R]),I(ht),W){const hc=tr(n.errors,a,R),va=tr(ya,a,hc.name||R);me=va.error,R=va.name,Pe=Te(ya)}}else y([R],!0),me=(await nr(V,l.disabled,i,g,s.shouldUseNativeValidation))[R],y([R]),I(ht),W&&(me?Pe=!1:(m.isValid||p.isValid)&&(Pe=await _(a,!0)));W&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&te(V._f.deps),j(R,Pe,me,Hs))}},G=(C,E)=>{if(q(n.errors,E)&&C.focus)return C.focus(),1},te=async(C,E={})=>{let R,W;const V=Yt(C);if(s.resolver){const I=await S(he(C)?C:V);R=Te(I),W=C?!V.some(Z=>q(I,Z)):R}else C?(W=(await Promise.all(V.map(async I=>{const Z=q(a,I);return await _(Z&&Z._f?{[I]:Z}:Z)}))).every(Boolean),!(!W&&!n.isValid)&&b()):W=R=await _(a);return f.state.next({...!Qe(C)||(m.isValid||p.isValid)&&R!==n.isValid?{}:{name:C},...s.resolver||!C?{isValid:R}:{},errors:n.errors}),E.shouldFocus&&!W&&Qt(a,G,C?V:l.mount),W},Y=(C,E)=>{let R={...o.mount?i:r};return E&&(R=Gi(E.dirtyFields?n.dirtyFields:n.touchedFields,R)),he(C)?R:Qe(C)?q(R,C):C.map(W=>q(R,W))},oe=(C,E)=>({invalid:!!q((E||n).errors,C),isDirty:!!q((E||n).dirtyFields,C),error:q((E||n).errors,C),isValidating:!!q(n.validatingFields,C),isTouched:!!q((E||n).touchedFields,C)}),ee=C=>{C&&Yt(C).forEach(E=>Se(n.errors,E)),f.state.next({errors:C?n.errors:{}})},J=(C,E,R)=>{const W=(q(a,C,{_f:{}})._f||{}).ref,V=q(n.errors,C)||{},{ref:I,message:Z,type:ue,...me}=V;xe(n.errors,C,{...me,...E,ref:W}),f.state.next({name:C,errors:n.errors,isValid:!1}),R&&R.shouldFocus&&W&&W.focus&&W.focus()},ie=(C,E)=>Oe(C)?f.state.subscribe({next:R=>"values"in R&&C(P(void 0,E),R)}):P(C,E,!0),U=C=>f.state.subscribe({next:E=>{Om(C.name,E.name,C.exact)&&Tm(E,C.formState||m,de,C.reRenderRoot)&&C.callback({values:{...i},...n,...E,defaultValues:r})}}).unsubscribe,z=C=>(o.mount=!0,p={...p,...C.formState},U({...C,formState:{...x,...C.formState}})),Q=(C,E={})=>{for(const R of C?Yt(C):l.mount)l.mount.delete(R),l.array.delete(R),E.keepValue||(Se(a,R),Se(i,R)),!E.keepError&&Se(n.errors,R),!E.keepDirty&&Se(n.dirtyFields,R),!E.keepTouched&&Se(n.touchedFields,R),!E.keepIsValidating&&Se(n.validatingFields,R),!s.shouldUnregister&&!E.keepDefaultValue&&Se(r,R);f.state.next({values:ke(i)}),f.state.next({...n,...E.keepDirty?{isDirty:L()}:{}}),!E.keepIsValid&&b()},Be=({disabled:C,name:E})=>{if(Ke(C)&&o.mount||C||l.disabled.has(E)){const V=l.disabled.has(E)!==!!C;C?l.disabled.add(E):l.disabled.delete(E),V&&o.mount&&!o.action&&b()}},Fe=(C,E={})=>{let R=q(a,C);const W=Ke(E.disabled)||Ke(s.disabled);return xe(a,C,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:C}},name:C,mount:!0,...E}}),l.mount.add(C),R?Be({disabled:Ke(E.disabled)?E.disabled:s.disabled,name:C}):$(C,!0,E.value),{...W?{disabled:E.disabled||s.disabled}:{},...s.progressive?{required:!!E.required,min:Bt(E.min),max:Bt(E.max),minLength:Bt(E.minLength),maxLength:Bt(E.maxLength),pattern:Bt(E.pattern)}:{},name:C,onChange:ne,onBlur:ne,ref:V=>{if(V){Fe(C,E),R=q(a,C);const I=he(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,Z=Lm(I),ue=R._f.refs||[];if(Z?ue.find(me=>me===I):I===R._f.ref)return;xe(a,C,{_f:{...R._f,...Z?{refs:[...ue.filter(en),I,...Array.isArray(q(r,C))?[{}]:[]],ref:{type:I.type,name:C}}:{ref:I}}}),$(C,!1,void 0,I)}else R=q(a,C,{}),R._f&&(R._f.mount=!1),(s.shouldUnregister||E.shouldUnregister)&&!(Hi(l.array,C)&&o.action)&&l.unMount.add(C)}}},Re=()=>s.shouldFocusError&&Qt(a,G,l.mount),ae=C=>{Ke(C)&&(f.state.next({disabled:C}),Qt(a,(E,R)=>{const W=q(a,R);W&&(E.disabled=W._f.disabled||C,Array.isArray(W._f.refs)&&W._f.refs.forEach(V=>{V.disabled=W._f.disabled||C}))},0,!1))},Ce=(C,E)=>async R=>{let W;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let V=ke(i);if(f.state.next({isSubmitting:!0}),s.resolver){const{errors:I,values:Z}=await D();y(),n.errors=I,V=ke(Z)}else await _(a);if(l.disabled.size)for(const I of l.disabled)Se(V,I);if(Se(n.errors,"root"),Te(n.errors)){f.state.next({errors:{}});try{await C(V,R)}catch(I){W=I}}else E&&await E({...n.errors},R),Re(),setTimeout(Re);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Te(n.errors)&&!W,submitCount:n.submitCount+1,errors:n.errors}),W)throw W},Ve=(C,E={})=>{q(a,C)&&(he(E.defaultValue)?O(C,ke(q(r,C))):(O(C,E.defaultValue),xe(r,C,ke(E.defaultValue))),E.keepTouched||Se(n.touchedFields,C),E.keepDirty||(Se(n.dirtyFields,C),n.isDirty=E.defaultValue?L(C,ke(q(r,C))):L()),E.keepError||(Se(n.errors,C),m.isValid&&b()),f.state.next({...n}))},at=(C,E={})=>{const R=C?ke(C):r,W=ke(R),V=Te(C),I=V?r:W;if(E.keepDefaultValues||(r=R),!E.keepValues){if(E.keepDirtyValues){const Z=new Set([...l.mount,...Object.keys(Ft(r,i))]);for(const ue of Array.from(Z)){const me=q(n.dirtyFields,ue),Pe=q(i,ue),ht=q(I,ue);me&&!he(Pe)?xe(I,ue,Pe):!me&&!he(ht)&&O(ue,ht)}}else{if(Hn&&he(C))for(const Z of l.mount){const ue=q(a,Z);if(ue&&ue._f){const me=Array.isArray(ue._f.refs)?ue._f.refs[0]:ue._f.ref;if(ks(me)){const Pe=me.closest("form");if(Pe){Pe.reset();break}}}}if(E.keepFieldsRef)for(const Z of l.mount)O(Z,q(I,Z));else a={}}i=s.shouldUnregister?E.keepDefaultValues?ke(r):{}:ke(I),f.array.next({values:{...I}}),f.state.next({values:{...I}})}l={mount:E.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!E.keepIsValid||!!E.keepDirtyValues||!s.shouldUnregister&&!Te(I),o.watch=!!s.shouldUnregister,o.keepIsValid=!!E.keepIsValid,o.action=!1,E.keepErrors||(n.errors={}),f.state.next({submitCount:E.keepSubmitCount?n.submitCount:0,isDirty:V?!1:E.keepDirty?n.isDirty:!!(E.keepDefaultValues&&!st(C,r)),isSubmitted:E.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:V?{}:E.keepDirtyValues?E.keepDefaultValues&&i?Ft(r,i):n.dirtyFields:E.keepDefaultValues&&C?Ft(r,C):E.keepDirty?n.dirtyFields:{},touchedFields:E.keepTouched?n.touchedFields:{},errors:E.keepErrors?n.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ye=(C,E)=>at(Oe(C)?C(i):C,{...s.resetOptions,...E}),Ue=(C,E={})=>{const R=q(a,C),W=R&&R._f;if(W){const V=W.refs?W.refs[0]:W.ref;V.focus&&setTimeout(()=>{V.focus(),E.shouldSelect&&Oe(V.select)&&V.select()})}},de=C=>{n={...n,...C}},je={control:{register:Fe,unregister:Q,getFieldState:oe,handleSubmit:Ce,setError:J,_subscribe:U,_runSchema:D,_updateIsValidating:y,_focusError:Re,_getWatch:P,_getDirty:L,_setValid:b,_setFieldArray:N,_setDisabledField:Be,_setErrors:w,_getFieldArray:B,_reset:at,_resetDefaultValues:()=>Oe(s.defaultValues)&&s.defaultValues().then(C=>{ye(C,s.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ae,_subjects:f,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return r},get _names(){return l},set _names(C){l=C},get _formState(){return n},get _options(){return s},set _options(C){s={...s,...C}}},subscribe:z,trigger:te,register:Fe,handleSubmit:Ce,watch:ie,setValue:O,getValues:Y,reset:ye,resetField:Ve,clearErrors:ee,unregister:Q,setError:J,setFocus:Ue,getFieldState:oe};return{...je,formControl:je}}function Wm(e={}){const s=h.useRef(void 0),n=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:Oe(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Oe(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!Oe(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=Hm(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,Kn(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),h.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),h.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),h.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),h.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),h.useEffect(()=>{var o;e.values&&!st(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=h.useMemo(()=>qi(a,i),[i,a]),s.current}function qm(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function Gm(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Km(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Ym(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function Qm(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function Zn(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}Zn();const Zm={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},tn=()=>({id:Zn(),amount:0,glAccount:null,isTaxDeductible:!1}),Ji=({distribution:e,defaultDistribution:s,glAccounts:n=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:x=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:f,classNames:g={},"data-testid":v,control:b,name:y,rules:N})=>{const k={...Zm,...f},w=b!==void 0&&y!==void 0,$=Wm({defaultValues:{_internal:s||tn()}}),A=Am({control:w?b:$.control,name:w?y:"_internal",rules:w?N:void 0}),[j,D]=h.useState(s||tn()),S=w?A.field.value??tn():e??j,_=w&&!!A.fieldState?.error,F=w&&(A.fieldState?.isTouched??!1),L=_||F,P=L&&(!S.amount||S.amount<=0),B=L&&!S.glAccount,[H,K]=h.useState(S.glAccount?.name||""),O=h.useCallback(J=>{const ie={...S,...J};w&&A.field.onChange(ie),!w&&e===void 0&&D(ie),i?.(ie)},[S,e,i,w,A]),ne=h.useCallback(J=>{const ie=J||0;O({amount:ie}),o?.(ie)},[O,o]),G=h.useCallback(J=>{K(J),r?.(J)},[r]),te=h.useCallback(J=>{if(J===null){O({glAccount:null}),l?.(null);return}const U=n.find(z=>String(z.id)===String(J))||null;O({glAccount:U}),l?.(U)},[n,O,l]),Y=h.useCallback(()=>{K(""),O({glAccount:null}),l?.(null)},[O,l]),oe=h.useCallback(J=>{O({isTaxDeductible:J}),d?.(J)},[O,d]),ee=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${v||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,t.jsx(c.Tooltip,{content:k.amountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:P,errorMessage:P?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,t.jsx(c.Tooltip,{content:k.glAccountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:S.glAccount?.name??H,selectedKey:S.glAccount?.id??null,isDisabled:p,isInvalid:B,errorMessage:B?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:G,onSelectionChange:te,onClear:Y,className:g.glAccountInput,children:J=>t.jsx(c.AutocompleteItem,{textValue:J.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:J.name}),J.code&&t.jsx("span",{className:"text-xs text-default-400",children:J.code})]})},J.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:oe,isDisabled:p||!m,className:g.taxDeductibleCheckbox,children:k.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(T,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!x,onPress:ee,startContent:t.jsx(M,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:k.deleteButton})})]})})};Ji.displayName="RevenueDistributionCard";const el=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(M,{icon:s,width:n,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};el.displayName="RevenueDistributionEmpty";const Xm={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},tl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...Xm,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};tl.displayName="RevenueDistributionError";const sl=({rows:e=1,showCard:s=!0,classNames:n={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-14 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(c.Skeleton,{className:"h-4 w-20 rounded-md"}),t.jsx(c.Skeleton,{className:"h-4 w-4 rounded-full"})]}),t.jsx(c.Skeleton,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(c.Skeleton,{className:"h-5 w-5 rounded-full"}),t.jsx(c.Skeleton,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(c.Skeleton,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>r(i))})};sl.displayName="RevenueDistributionSkeleton";function Xn({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:x}){return t.jsx(ts,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[n&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(T,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:s.cancel}),t.jsx(T,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:x,children:s.confirm})]})]})})}const Jm=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function ar(e){return!e.fund&&Number(e.percentage||0)<=0}function ef({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const tf={title:"Payment assignment",saved:"Saved",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},nl={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},Vt={...nl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},sf={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},nf={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function af(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const rf=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,lf=e=>e.fund!==null;function of({assignments:e,funds:s,labels:n,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:x,footer:m,onAssignmentsChange:p,onOpenFundPicker:f,onCloseFundPicker:g,onCollapseChange:v,onSave:b}){const[y,N]=h.useState(null),k=x??y??void 0,w={...tf,...n},$=e.filter(U=>!ar(U)),j=$.filter(lf).length>0,D=h.useMemo(()=>e.filter(U=>!ar(U)).reduce((U,z)=>U+Number(z.percentage||0),0),[e]),S=Math.round(D*100)/100,_=$.some(U=>!U.fund||Number(U.percentage||0)<=0),F=j&&(S!==100||_),L=`${w.totalError} (${w.total} ${Number(D.toFixed(2))}%)`,P=ef({mode:"split",assignments:e}),B=j&&S>=100,[H,K]=h.useState(!1),[O,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(af,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:w.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:w.saved}):null]}),te=(U,z)=>{p(e.map(Q=>Q.id===U?{...Q,...z}:Q))},Y=()=>{B||p([...e,Jm()])},oe=U=>{e.length<=1||p(e.filter(z=>z.id!==U))},ee=()=>{if(!r){if(!P){ne(!0);return}if(!i){b();return}K(!0)}},J=()=>{K(!1),b()},ie=U=>{const z=u??e.find(Q=>!Q.fund)?.id??e[0]?.id;z&&(p(e.map(Q=>Q.id===z?{...Q,fund:U}:Q)),g())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!x&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:U=>v?.(!(U==="all"||Array.from(U).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":w.title,title:G,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!j&&t.jsx(c.Alert,{icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:nl,color:"default",variant:"flat",title:w.emptySplit}),j&&t.jsx(cf,{assignments:e,labels:w,total:D,hasTotalError:O&&!P||F,validationMessage:L,onSelectFund:U=>f(U),onRemoveFund:oe,onPercentageChange:(U,z)=>te(U,{percentage:rf(z)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(T,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:B,onPress:()=>j?Y():f(),children:w.assignSpecificFund}),t.jsx(T,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!P||r,onPress:ee,children:w.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(df,{funds:s,labels:w,selectedFundIds:e.map(U=>U.fund?.id).filter(Boolean),portalContainer:k,onSelect:ie,onClose:g}),t.jsx(Xn,{isOpen:H,labels:{title:w.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:w.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:w.modifyAssignedFundsWarning})]}),cancel:w.modifyAssignedFundsCancel,confirm:w.modifyAssignedFundsConfirm},icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:k,shouldBlockScroll:!1,classNames:nf,onClose:()=>K(!1),onConfirm:J})]})}function cf({assignments:e,labels:s,total:n,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(T,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(T,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:x=>l(d.id,Number(x.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:sf})}),e.length>1&&t.jsx(T,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(d.id),"aria-label":s.removeFund,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(M,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Vt,base:c.cn(Vt.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Vt.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Vt.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Vt.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function df({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const x=o.trim().toLowerCase();return x?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(x):!0});return t.jsx(ts,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:o,placeholder:s.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(T,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:s.select})]},u.id))]})]})]})})}function uf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-11 w-40 rounded-full"})]})}const mf={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function ff({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...mf,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(sn,{label:l.totalAmount,value:d.format(e)}),t.jsx(sn,{label:l.remainingBalance,value:d.format(s)}),t.jsx(sn,{label:l.amountReceived,value:d.format(n)})]})})}function sn({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const xf={monthly:1,quarterly:3,annual:12},al=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},pf=(e,s)=>new Date(e,s+1,0).getDate(),hf=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},bf=(e,s)=>{const{year:n,month:a,day:r}=al(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,pf(o,l));return new Date(o,l,d)},gf=(e,s)=>{const{year:n,month:a,day:r}=al(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function rl(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=xf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?gf(s.firstInstallmentDate,d*7):bf(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:hf(u),amount:(r+(d===0?i:0))/100}})}function yf(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function vf(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:yf(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function jf(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function wf(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const Nf=new Set(["paid","partially_refunded","refunded"]);function wt(e){return e!==void 0&&Nf.has(e)}const Cf={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},kf=["weekly","monthly","quarterly","annual"],Sf=Array.from({length:31},(e,s)=>s+1),$f=["numberOfInstallments","frequency","firstInstallmentDate"],rr=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),$s=e=>Math.round(e*100)/100,Af=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},Ts=e=>{if(!e)return null;try{return cu(e)}catch{return null}},Df=e=>Ts(e)?.day??1,Ef=(e,s)=>new Date(e,s,0).getDate(),Lf=(e,s)=>{const n=Ts(e);if(!n)return e;const a=Math.min(s,Ef(n.year,n.month));return n.set({day:a}).toString()},ir=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function Ff({mode:e,donationAmount:s,currency:n="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:x=!0,inputs:m=$f,startDate:p,firstInstallmentDateOverride:f,labels:g,classNames:v,isSaving:b=!1,showSavedIndicator:y=!1,isModeSwitchDisabled:N=!1,onModeChange:k,onAutomaticSettingsChange:w,onInstallmentsChange:$,onSave:A,onCancel:j}){const[D,S]=h.useState(o),_={...Cf,...g},F=e??D,L=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),P=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),B=F==="automatic"?wf(rl(s,P),m.includes("firstInstallmentDate")?void 0:f):r,H=h.useMemo(()=>$s(B.reduce((Q,Be)=>Q+Number(Be.amount||0),0)),[B]),K=Math.abs(H-s)>.009,O=$s(s-H)<=0,ne=h.useMemo(()=>vf(r),[r]),G=F==="manual"&&jf(ne),te=K||G,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),y?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,oe=Q=>{Q!==F&&(e||S(Q),k?.(Q),Q==="manual"&&r.length===0&&$([rr()]))},ee=(Q,Be)=>{const Fe=r.find(Re=>Re.id===Q);wt(Fe?.status)||$(r.map(Re=>Re.id===Q?{...Re,...Be}:Re))},J=()=>{$([...r,rr()])},ie=Q=>{const Be=r.find(Fe=>Fe.id===Q);wt(Be?.status)||$(r.filter(Fe=>Fe.id!==Q))},U=()=>{b||te||A?.()},z=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.content),children:[x||u||j?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[x?t.jsx(Rf,{mode:F,labels:_,onModeChange:oe,isDisabled:N,className:v?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j?t.jsx(T,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:j,children:_.cancelEdit}):null,u?t.jsx(T,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||te,onPress:U,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.preview),children:[F==="automatic"&&t.jsx(_f,{settings:P,inputs:m,labels:_,className:v?.controls,onSettingsChange:w}),B.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?_.emptyAutomatic:_.emptyManual}),B.length>0&&t.jsx(Mf,{mode:F,installments:B,rowErrors:ne,labels:_,formatter:L,locale:a,onUpdateInstallment:ee,onRemoveInstallment:ie}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(T,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:O,onPress:J,children:_.addInstallment})}),t.jsx(Of,{total:H,donationAmount:s,hasTotalMismatch:K,mode:F,installments:B,formatter:L,labels:_,className:v?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:Y,children:z},"installment-schedule")}):z})}function Rf({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function _f({settings:e,inputs:s,labels:n,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:n.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(nt,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:kf.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(Df(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(nt,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Lf(e.firstInstallmentDate,u)})},children:Sf.map(d=>t.jsx(c.SelectItem,{textValue:ir(d),children:ir(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Bn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:Ts(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(M,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function Mf({mode:e,installments:s,rowErrors:n,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Af(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const x=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),p=n.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Bn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:wt(d.status),isInvalid:x||m,errorMessage:x?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:Ts(d.dueDate),onChange:f=>o(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(If,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:wt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:f=>o(d.id,{amount:f})})}),t.jsx(Tf,{isDisabled:s.length<=1,isPaid:wt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const Pf=/^\d*(?:[.,]\d{0,2})?$/;function If({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!Pf.test(u))return;l(u);const x=Number(u.replace(",","."));i($s(Number.isFinite(x)?x:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Tf({isDisabled:e,isPaid:s,label:n,onRemove:a}){const r=t.jsx(T,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||s,onPress:a,"aria-label":n,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Of({total:e,donationAmount:s,hasTotalMismatch:n,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,x=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(x*100),p=$s(s-e),f=Math.max(p,0),g=Math.max(-p,0),v=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(x)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${o.remaining}: ${i.format(f)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:v})}function zf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-7 w-56 rounded-lg"}),t.jsx(c.Skeleton,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(c.Skeleton,{className:"h-10 w-72 rounded-full"}),t.jsx(c.Skeleton,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(c.Skeleton,{className:"h-4 w-36 rounded-md"}),t.jsx(c.Skeleton,{className:"h-9 w-full rounded-xl"})]}),t.jsx(c.Skeleton,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(c.Skeleton,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(c.Skeleton,{className:"h-8 w-full rounded-xl"})]},s))})]})}const lr={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",partially_refunded:"bg-lime-50 text-lime-800",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},il={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",partially_refunded:"Partially refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Bf={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",partiallyRefunded:il.partially_refunded,refundedAmount:"Refunded",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},Vf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Uf=[];function Hf({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=Uf,showSavedIndicator:d=!1,labels:u,isSaving:x=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:f}){const[g,v]=h.useState(null),b={...Bf,...u},[y,N]=h.useState(""),k=new Intl.NumberFormat(n,{style:"currency",currency:s}),w=e.some(S=>ll(S)!==null),$=e.some(S=>S.status==="partially_refunded"),A=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,j=h.useMemo(()=>{const S=y.trim().toLowerCase();if(!S)return e;const _=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(F=>{const L=F.status??"scheduled";return[nn(F),F.id,F.amount,F.dueDate,ys(F.dueDate,n),an(F,b.paidOn,n),rn(F,b.refundedAmount,_),L,ln(L,b.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[n,s,e,y,b.paidOn,b.refundedAmount,b.partiallyRefunded]),D=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:y,placeholder:b.searchPlaceholder,onChange:S=>N(S.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(T,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(M,{icon:"solar:pen-outline",className:"size-4"}),isLoading:x,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",j.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((S,_)=>{const F=S.status??"scheduled",L=nn(S),P=an(S,b.paidOn,n),B=rn(S,b.refundedAmount,k);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:L||`PMT-${_+1}`})]}),t.jsx(or,{status:F,label:ln(F,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:k.format(S.amount)}),B?t.jsx("p",{className:"text-xs text-default-500",children:B}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:ys(S.dueDate,n)}),P?t.jsx("p",{className:"text-xs text-default-500",children:P}):null]})]}),t.jsx(cr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:f})]})},S.id)}),j.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",j.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:w?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:$?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[j.map((S,_)=>{const F=S.status??"scheduled",L=nn(S),P=an(S,b.paidOn,n),B=rn(S,b.refundedAmount,k);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:L||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[k.format(S.amount),B?t.jsx("span",{className:"block text-xs",children:B}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[ys(S.dueDate,n),P?t.jsx("span",{className:"block text-xs",children:P}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(or,{status:F,label:ln(F,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(cr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:f})})]},S.id)}),j.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:A,children:D},"installment-table")}):D})}function nn(e){return e.name?.trim()||e.id}function an(e,s,n){return!wt(e.status)||!e.fulfilledAt?null:`${s} ${ys(e.fulfilledAt,n)}`}function ll(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function rn(e,s,n){const a=ll(e);return a===null?null:`${s} ${n.format(a)}`}function ln(e,s){return e==="partially_refunded"?s:il[e]??e}function or({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",lr[e]??lr.scheduled),startContent:t.jsx(qf,{status:e}),children:s})}function cr({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=wt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(T,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(M,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(s),children:n.payNow}):null,t.jsx(Wf,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function Wf({isFulfilled:e,showDelete:s,labels:n,portalContainer:a,onDelete:r}){const[i,o]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(M,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(M,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(Xn,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(M,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:Vf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function qf({status:e}){return e==="paid"?t.jsx(M,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(M,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(M,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(M,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(M,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(M,{icon:"solar:calendar-outline",className:"size-3"})}const Gf=/^\d{4}-\d{2}-\d{2}$/;function ys(e,s){const n=Gf.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const Kf={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},Yf=({cards:e,locale:s,currency:n,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:x,className:m=""})=>{const p=Array.isArray(e)?e:[],[f,g]=h.useState(l),[v,b]=h.useState(o),y={...Kf,...r};h.useEffect(()=>{g(l)},[l]);const N=w=>{if(w===f){d&&x?.(w);return}g(w),x?.(w)},k=w=>{b(w),u?.(w)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:y.title}),i&&t.jsx(fl,{title:y.renewalTitle,description:y.renewalDescription,value:v,onValueChange:k}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:p.map(w=>t.jsx(ol,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:s,currency:n,isSelected:f===w.id,onSelect:N},w.id))})]})},ol=({itemKey:e,name:s,type:n,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:x=!1,disabledReason:m,statusLabel:p,statusTone:f="default",className:g=""})=>{const v=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!x,y=m||p,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",x?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:x,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),n&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:n})}),y&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:y})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},dr="w-full bg-gray-100",ur={variant:"light",color:"default"},cl=({id:e,title:s,media:n,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:x,onPress:m,isPressable:p=!1,isDisabled:f=!1,compact:g=!1,className:v="",bodyClassName:b="",footerClassName:y="",dataTestId:N})=>{const k=!!(d&&d.value),w=!!u?.label,$=p&&!!m&&!w,A=!$,j=w?{variant:u?.variant??ur.variant,color:u?.color??ur.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(M,{icon:u.icon,width:16}):void 0}:null,D=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,dr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,dr,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(M,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",v),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:D}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:s}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((S,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(M,{icon:S.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:S.label})]},`${S.label}-${_}`))}):null,(k||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",y),children:[k?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),w&&A?t.jsx(T,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:j?.variant,color:j?.color,size:j?.size,startContent:j?.startContent,isDisabled:j?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),x?t.jsx("div",{className:"pt-1",children:x}):null]})]})};cl.displayName="CatalogItemCard";const Qf={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function dl({title:e,subtitle:s,price:n,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(M,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:Qf[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}dl.displayName="ProgramListItem";const Zf={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},Xf={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},Jf={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},ex={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},tx={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},sx={card:"mt-1",panel:"mt-[22px]"},nx="bg-acct-page border-acct-border text-acct-muted",ax={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},rx={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},ix={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},lx={empty:"status",error:"alert",success:"status",loading:"status"},ox={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function cx(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:ax[e];return r?t.jsx(M,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function ul({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=lx[e],ariaLive:d=ox[e],iconSize:u=24,className:x,classNames:m={},"data-testid":p="feedback-state",referenceCode:f,referenceCodeLabel:g="Reference code:"}){const v=cx(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",Zf[s],s==="card"?rx[e]:"bg-transparent",x,m.base),children:[v?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",Xf[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?nx:ix[e],m.iconWrapper),children:v}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(Jf[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(ex[s],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${p}-reference-code`,className:c.cn(tx[s],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),o?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",sx[s],m.actions),children:o}):null]})}function as(e){return t.jsx(ul,{...e})}function Jn(e){return t.jsx(as,{...e,variant:"empty"})}function ea(e){return t.jsx(ul,{...e,variant:"error"})}function ta(e){return t.jsx(as,{...e,variant:"loading"})}function ml(e){return t.jsx(as,{...e,variant:"success"})}as.displayName="FeedbackState";Jn.displayName="EmptyState";ea.displayName="ErrorState";ta.displayName="LoadingState";ml.displayName="SuccessState";const fl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},dx={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},ux=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),xl=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),mx=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),sa=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),mr=(e,s,n)=>{const a={};let r=n?s??mx(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of sa(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},fr=(e,s,n)=>`${e}::${s}::${n}`,fx=(e,s,n)=>{const a=xl(s);for(const{exhibition:r,dateGroup:i,ticket:o}of sa(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},xx=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),x=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},p=()=>{r||i<=s||a?.(i-1)},f=w=>{if(r)return;l(w.target.value);const $=parseInt(w.target.value,10);isNaN($)||a?.(Math.max(s,Math.min(n,$)))},g=w=>{const $=parseInt(w.target.value,10);if(u(!1),isNaN($)){a?.(s);return}const A=Math.max(s,Math.min(n,$));A!==$?a?.(A):l(String(A))},v=i<=s,b=i>=n,y="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",k="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:p,disabled:r||v,className:c.cn(y,r||v?k:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:x,onChange:f,onFocus:()=>u(!0),onBlur:g,disabled:r,min:s,max:n,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(y,r||b?k:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},px=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},hx=({item:e,quantity:s,onChange:n,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",x=ux(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:x.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:x.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(xx,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},bx=({exhibitionId:e,dateGroup:s,isLast:n=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!n&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,x)=>t.jsxs("div",{children:[t.jsx(hx,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),x<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),gx=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,x]=h.useState(d),m=s.dates.reduce((f,g)=>f+g.tickets.reduce((v,b)=>v+a(s.id,g.id,b.id),0),0),p=s.dates.some(f=>f.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>x(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(M,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:p?s.dates.map((f,g)=>t.jsx(bx,{exhibitionId:s.id,dateGroup:f,isLast:g===s.dates.length-1,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},f.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},yx=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...dx,...n},[u,x]=h.useState(()=>mr(l,s,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const N=sa(l).map(({exhibition:k,dateGroup:w,ticket:$})=>[fr(k.id,w.id,$.id),$]);return new Map(N)},[l]),f=fx(l,u,s),g=(N,k,w)=>u[N]?.[k]?.[w]?.selectedQuantity??0,v=()=>xl(u),b=(N,k,w,$)=>{const A=g(N,k,w),j=v()-A;if(s!==void 0&&j+$>s)return;const D=p.get(fr(N,k,w));if(!D)return;const S={...u,[N]:{...u[N],[k]:{...u[N]?.[k],[w]:{id:w,selectedQuantity:$,originalPrice:D.originalPrice,discountedPrice:D.price}}}};x(S),o?.(S)},y=N=>{const k=mr(l,s,N);x(k),o?.(k)};return h.useEffect(()=>{!m.current&&f&&(o?.(u),m.current=!0)},[f,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(px,{label:d.selectAllButtonLabel,checked:f,onChange:y})]}),l.map(N=>t.jsx(gx,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:v,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},N.id))]})},on={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},cn=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},vx=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},jx=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,pl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:x,onClear:m,appliedCount:p,countAriaLabel:f,countDisplay:g="badge",confirmLabel:v=on.confirm,clearLabel:b=on.clear,isOpen:y,defaultOpen:N=!1,onOpenChange:k,isDisabled:w=!1,closeOnConfirm:$=!0,keepOpenAfterClear:A=!1})=>{const[j,D]=h.useState(N),[S,_]=h.useState(()=>cn(u)),F=y??j,L=p??u.filter(Y=>jx(Y)).length,P=Y=>{Y&&_(cn(u)),y||D(Y),k?.(Y)},B=(Y,oe)=>{_(ee=>({...ee,[Y.id]:oe}))},H=(Y,oe)=>{_(ee=>({...ee,[Y.id]:oe?[oe]:[]}))},K=async()=>{_(cn(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),A||P(!1)},O=async()=>{const Y=vx(S,u);await x(Y),$&&P(!1)},ne=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:ee=>B(Y,ee),children:Y.options.map(ee=>t.jsx(c.Checkbox,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Y.id);const oe=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:oe,onValueChange:ee=>H(Y,ee||null),children:Y.options.map(ee=>t.jsx(c.Radio,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Y.id)},G=h.useMemo(()=>L>0?f?.(L)||`${L} filters applied`:void 0,[f,L]),te=h.useMemo(()=>L===0?e||on.noLabel:f?f(L):`${e} (${L})`,[L,e,f]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:P,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(T,{isDisabled:w,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(M,{icon:n,width:16}),t.jsx("span",{children:e}),g==="badge"&&L>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":G,children:L}):g==="summary"&&te!==e?t.jsx("span",{className:"text-xs",children:te}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>ne(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(T,{variant:"light",color:"default",size:"sm",onPress:K,children:b}),t.jsx(T,{color:"primary",size:"sm",onPress:O,children:v})]})]})})]})})};pl.displayName="FilterPopover";const wx="No sessions available for this date",Nx=e=>e==="sold-out"||e==="closed"?"danger":"success",Cx=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},xr=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",kx=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,hl=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=wx,statusLabel:u,statusTone:x,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:f,dayGroupAriaLabel:g,sessionGridAriaLabel:v,className:b,headingClassName:y,subheadingClassName:N})=>{const k=kx(n,a),w=n.find(S=>S.date===k),$=i??n.map(S=>({date:S.date,label:S.label})),A=w?.sessions??[],j=S=>S===k?"solid":"bordered",D=S=>{if(!xr(S)){if(S.id===o){l(null);return}l(S.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",y),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[$.map(S=>t.jsx(T,{size:"sm",variant:j(S.date),color:"default",className:c.cn("rounded-full",p),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":v||"Sessions",children:[A.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,A.map(S=>{const _=xr(S),F=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{D(S)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:F,isUnavailable:_}):_?`${S.startTime} ${S.endTime} sold out`:`${S.startTime} ${S.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[S.startTime," – ",S.endTime]}),t.jsx(c.Chip,{size:"sm",color:x?x(S):Nx(S.status),variant:"flat",children:u?u(S):Cx(S)})]})})},S.id)})]})]})};hl.displayName="SessionTimeline";const $n=16,dt=e=>`${e/$n}rem`;function Sx(){if(typeof document>"u"||typeof getComputedStyle!="function")return $n;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:$n}const rs=(e,s)=>e>=s*Sx(),$x=1120;function Pt(){const e=h.useRef(null),[s,n]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:s}}const Ax=48,Xe={base:"flex items-start gap-4",baseWide:"mb-5 flex-nowrap",baseNarrow:"mb-[0.875rem] flex-wrap",identity:"flex min-w-0 items-center gap-4",text:"min-w-0",titleWide:"text-[1.6875rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",titleNarrow:"text-[1.375rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",subtitleWide:"mt-[0.4375rem] max-w-[47.5rem] text-[0.875rem] leading-[1.55] text-default-500",subtitleNarrow:"mt-[0.4375rem] max-w-[47.5rem] text-[0.84375rem] leading-[1.55] text-default-500",actionsWide:"ml-auto flex shrink-0 items-center gap-2.5",actionsNarrow:"flex shrink-0 items-center gap-2.5"},Dx=(e,s)=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,bl=({title:e,subtitle:s,eyebrow:n,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:x,narrow:m,headerRef:p})=>{const f=Dx(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":x?"list":void 0,"data-size":x?m?"narrow":"wide":void 0,className:c.cn(x?c.cn(Xe.base,m?Xe.baseNarrow:Xe.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:x?Xe.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{className:x?Xe.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(x?m?Xe.titleNarrow:Xe.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(x?m?Xe.subtitleNarrow:Xe.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(x?m?Xe.actionsNarrow:Xe.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},Ex=e=>{const{ref:s,width:n}=Pt(),a=n>0&&!rs(n,Ax);return t.jsx(bl,{...e,list:!0,narrow:a,headerRef:s})},gl=e=>e.variant==="list"?t.jsx(Ex,{...e}):t.jsx(bl,{...e,list:!1,narrow:!1});gl.displayName="PageHeader";const Ze={ok:{fg:le.ok,bg:le["ok-fill"]},warn:{fg:le.warn,bg:le["warn-fill"]},danger:{fg:le.danger,bg:le["danger-fill"]},info:{fg:le.info,bg:le["info-fill"]},violet:{fg:le.violet,bg:le["violet-fill"]},neutral:{fg:le.neutral,bg:le["neutral-fill"]}};function is(e){if(e==="positive")return{color:le.ok};if(e==="negative")return{color:le.danger}}const Lx={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},An={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"},info:Ze.info,violet:Ze.violet},Fx={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Rx={sm:"px-[0.5625rem] py-[0.1875rem] text-[0.75rem]",md:"px-3 py-[0.3125rem] text-[0.8125rem]",lg:"px-3 py-[0.3125rem] text-[0.8125rem]"},_x={info:An.info,violet:An.violet},yl=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Ze[Fx[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Rx[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=An[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:_x[e];return t.jsx(c.Chip,{color:r??Lx[e],variant:n,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};yl.displayName="StatusChip";const Mx={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},ds={base:"inline-flex items-baseline gap-1 whitespace-nowrap rounded-[0.4375rem] border border-pos-hair bg-default-100",sm:"px-2 py-0.5 text-[0.75rem] leading-[1.5]",md:"px-2.5 py-1 text-[0.8125rem] leading-[1.5]",label:"font-normal text-default-600",value:"font-semibold text-default-900"},Os=({label:e,value:s,size:n="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(ds.base,ds[n],r),children:[t.jsx("span",{className:ds.label,children:e}),t.jsx("span",{className:ds.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Mx[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Os.displayName="KeyValueChip";const vl=({columns:e,rows:s=6,label:n="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,x)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,p)=>{const f=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:c.cn(ps,l.bar),style:{height:dt(a),width:m==="fill"?"60%":dt(m),maxWidth:"100%"}})},p)})},x):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,p)=>{const f=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",l.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},x))})]});vl.displayName="TableSkeleton";const jl="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",wl="px-4 text-[13.5px] text-acct-ink2 align-middle",Nl="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Cl="w-full",kl="border-t border-acct-border px-5 py-3.5",us={base:"overflow-x-auto",th:"h-auto whitespace-nowrap border-b border-pos-hair bg-transparent px-4 py-[0.875rem] text-left text-[0.6875rem] font-semibold uppercase leading-[1.5] tracking-[.055em] text-default-500 first:rounded-none last:rounded-none last:pr-3",tr:`border-t border-pos-hair transition-colors duration-[120ms] first:border-t-0 data-[focus-visible=true]:outline-offset-[-2px] [tbody>&]:hover:bg-default-50 [tbody>&]:data-[hover=true]:bg-default-50 ${Ne}`,td:"h-[3.875rem] px-4 data-[focus-visible=true]:outline-offset-[-2px] py-[0.625rem] align-middle text-[0.875rem] text-default-900 last:pr-3"},Sl=({columns:e,children:s,emptyContent:n,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&us.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(Vn,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Cl,l.table),th:c.cn(u?us.th:jl,l.th),tr:c.cn(u?us.tr:Nl,l.tr),td:c.cn(u?us.td:wl,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:x=>t.jsx(c.TableColumn,{align:x.align==="right"?"end":"start",width:x.width,children:x.label},x.key)}),t.jsx(c.TableBody,{emptyContent:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&kl,l.footer),children:a}):null]})};Sl.displayName="AdminTable";const Ut={base:"flex flex-wrap items-center gap-3 mb-4",trailing:"ml-auto",icon:"flex text-acct-muted",inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"},Px={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},Ix=48,rt={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[data-slot=filter-select-group]]:flex [&_[data-slot=filter-select-group]]:flex-wrap [&_[data-slot=filter-select-group]]:!max-w-none [&_[data-slot=filter-select]]:!max-w-none [&_[data-slot=filter-select]]:!min-w-[calc(50%-0.3125rem)] [&_[data-slot=filter-select]]:grow [&_[data-slot=filter-select]]:basis-[calc(50%-0.3125rem)]",searchWide:"ml-auto",searchFill:"min-w-[12.5rem] flex-1",searchNarrow:"basis-full",inputBaseNarrow:"w-full",inputWrapper:"h-[2.375rem] min-h-[2.375rem] !h-[2.375rem] rounded-[0.625rem] border border-pos-field bg-white pl-3 pr-3 shadow-none data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary",innerWrapper:"gap-[0.3125rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0.5",icon:"flex text-default-400 [&_svg]:size-4"},pr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},As={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},hr={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},br={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},$l=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const x=h.useRef(null),m=o==="lg",p=r&&e!==""?t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),x.current?.focus()},className:c.cn(hr.button,br[o].button),testId:`${l}-search-clear`,children:t.jsx(M,{icon:"lucide:x","aria-hidden":"true",className:br[o].icon})}):void 0;return t.jsx(c.Input,{ref:x,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&As.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&As.input,r&&hr.input)}})},Tx=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:x,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:f,width:g}=Pt(),v=g>0&&!rs(g,Ix),b=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":p,"data-variant":"framed","data-size":v?"narrow":"wide",className:c.cn(rt.base,v&&rt.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:b?rt.searchFill:v?rt.searchNarrow:rt.searchWide,children:t.jsx($l,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:x,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(rt.icon,x==="lg"&&As.icon),children:r??t.jsx(M,{icon:"lucide:search"})}),classNames:{base:b?pr.fill:v?rt.inputBaseNarrow:pr[u],inputWrapper:rt.inputWrapper,innerWrapper:rt.innerWrapper,input:rt.input}})}),d]})},Al=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:x="md",variant:m="default",className:p,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(Tx,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:x,className:p,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn(Ut.base,p),children:[t.jsx($l,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:x,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Ut.icon,x==="lg"&&As.icon),children:r}):void 0,classNames:{base:Px[u],inputWrapper:Ut.inputWrapper,input:Ut.input}}),l,d?t.jsx("div",{className:Ut.trailing,children:d}):null]});Al.displayName="AdminToolbar";const Ox="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",zx="ml-0.5 inline-flex min-w-[1.125rem] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",Bx="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",Dl=h.forwardRef(function({icon:s,children:n,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(T,{ref:d,"data-testid":o,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(M,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:zx,children:a})]}):t.jsxs(T,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(Bx,i),...l,children:[t.jsx(M,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Ox,children:a})]})});Dl.displayName="ToolbarButton";const dn="w-full mb-4 border-b border-pos-line",un=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",Ne].join(" "),Vx={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${Ne}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${Ne}`},lg:{base:dn,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${un} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${Ne}`},"sm-primary":{base:dn,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${un} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${Ne}`},"sm-secondary":{base:dn,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${un} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${Ne}`}},gr={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},Ux="data-[animated=true]:transition-none";function El({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",showDivider:o=!0,className:l,"data-testid":d="underline-tabs"}){const u=Fs(),x=Vx[r==="sm"?`sm-${i}`:r],m=r!=="md",p=e.filter(f=>f.isDisabled).map(f=>f.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:f=>n(String(f)),disabledKeys:p,disableCursorAnimation:m,"data-testid":d,"data-size":r,classNames:{...x,base:c.cn(x.base,!o&&gr.base,l),tabList:c.cn(x.tabList,!o&&gr.tabList),cursor:c.cn(x.cursor,u&&Ux),panel:"p-0"},children:e.map(f=>t.jsx(c.Tab,{title:f.label,titleValue:f.hint,"data-testid":`${d}-${f.key}`,children:f.content},f.key))})}El.displayName="UnderlineTabs";const na="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Ll="font-normal normal-case tracking-normal",Fl="ms-0.5 text-acct-danger",Rl="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",_l="after:content-none",Ml="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",Pl="size-4",Il="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",Tl=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),Ol="text-[13.5px] text-acct-ink",zl="bg-acct-page text-acct-muted cursor-default",Bl="mt-[5px] text-xs text-acct-sub",Vl="mt-[5px] text-xs text-acct-danger";function Hx({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:Fl,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function Wx({help:e,label:s,labelledBy:n,testId:a}){const r=s?{"aria-label":s}:{"aria-labelledby":n};return t.jsxs(c.Popover,{placement:"top",showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:a,className:Ml,children:t.jsx(M,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:Pl})})}),t.jsx(c.PopoverContent,{...r,"data-testid":`${a}-content`,className:Il,children:e})]})}function Ul(e,s,n,a){return t.jsxs(t.Fragment,{children:[e,s?t.jsxs("span",{className:Ll,children:[" ",s]}):null,n?t.jsx(Hx,{label:a}):null]})}const aa=({children:e,suffix:s,htmlFor:n,id:a,isRequired:r,requiredLabel:i,help:o,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const x=h.useId(),m=Ul(e,s,r,i),p=se(o),f=a??(p?x:void 0);return t.jsxs("div",{"data-testid":u,className:c.cn(na,d),children:[n?t.jsx("label",{id:f,htmlFor:n,children:m}):f?t.jsx("span",{id:f,children:m}):m,p&&f?t.jsx(Wx,{help:o,label:l,labelledBy:f,testId:`${u}-help`}):null]})};aa.displayName="AdminFieldLabel";const Hl=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:x=!1,isRequired:m=!1,requiredLabel:p,help:f,helpLabel:g,className:v,"data-testid":b="admin-text-field"})=>{const y=h.useId(),N=h.useId(),k=se(e),w=k&&se(f),$=t.jsx(c.Input,{labelPlacement:k&&!w?"outside":void 0,label:k&&!w?Ul(e,s,m,p):void 0,id:w?y:void 0,"aria-labelledby":w?N:void 0,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:x,isRequired:k&&m,validationBehavior:"aria",description:!x&&u?u:void 0,errorMessage:x?u:void 0,onValueChange:a,"data-testid":b,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",!w&&v),label:c.cn(na,_l),inputWrapper:Tl,input:c.cn(Ol,(l||o)&&"font-mono",o&&zl),description:Bl,errorMessage:Vl}});return w?t.jsxs("div",{className:c.cn("w-full",v),children:[t.jsx(aa,{id:N,htmlFor:y,suffix:s,isRequired:m,requiredLabel:p,help:f,helpLabel:g,className:Rl,"data-testid":`${b}-label`,children:e}),$]}):$};Hl.displayName="AdminTextField";const qx={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Wl=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(T,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",qx[s]),children:r.icon},r.key))});Wl.displayName="RowActions";const ql=({children:e,placeholder:s="Select…",onOpen:n,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":x="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":x,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(T,{variant:"light",radius:"none",disableAnimation:!0,onPress:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${x}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(T,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${x}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};ql.displayName="PickerRow";const De={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Gx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Kx={plain:{row:"rounded-xl px-2",hover:"hover:bg-default-100",overlay:"after:rounded-xl"},bordered:{row:"rounded-lg border border-default-200 bg-white px-3",hover:"hover:bg-default-50",overlay:"after:rounded-lg"}},Gl={md:{row:"min-h-12",content:"py-1",title:"text-sm leading-6",subtitle:"text-xs leading-4",avatar:"sm",control:"md"},lg:{row:"min-h-14",content:"py-1.5",title:"text-base leading-6",subtitle:"text-sm leading-5",avatar:"md",control:"lg"}},Yx={md:void 0,lg:"min-h-12 text-base"},Qx={none:"",sm:"gap-1",md:"gap-2"},Kl="m-0 flex list-none flex-col p-0",Dt={row:"flex items-center gap-3 px-2",avatar:{md:"size-8 shrink-0 rounded-full",lg:"size-10 shrink-0 rounded-full"},lines:"flex flex-col gap-2",title:"h-4 rounded-md",subtitle:"h-3 w-44 rounded-md",titleWidths:["w-32","w-28","w-36","w-24","w-40","w-28"]},Yl=h.createContext(!1),Zx=()=>t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:t.jsx("path",{d:"m9 5 7 7-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Xx=()=>t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"})]});function Jx(e){const s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}const Ql=({title:e,subtitle:s,leading:n,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:x,actions:m,actionsLabel:p,actionsIcon:f,size:g,variant:v="plain",isDisabled:b=!1,as:y,className:N,"data-testid":k="entity-row"})=>{const w=h.useContext(Yl),$=Rs(),A=g??($==="touch"?"lg":"md"),j=Gl[A],D=Kx[v],S=y??(w?"li":"div"),_=h.useId(),F=h.useId(),L=h.useId(),P=h.useId(),B=i!==void 0||r!==void 0,H=a!==void 0&&a.length>0,K=se(s),O=m!==void 0&&m.length>0,ne=typeof e=="string"?e:void 0,G=O&&m.some(z=>se(z.description)),te=O?m.filter(z=>z.isDisabled===!0&&se(z.description)).map(z=>`${z.label}: ${z.description}`).join(" "):"",Y=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:j.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??ne,getInitials:n.initials!==void 0?z=>z:Jx,showFallback:n.src!==void 0,classNames:{base:De.avatar},"data-testid":`${k}-leading`}):null,oe=t.jsxs(t.Fragment,{children:[Y,t.jsxs("span",{className:De.text,children:[t.jsxs("span",{className:De.titleLine,children:[t.jsx("span",{id:_,className:c.cn(De.title,j.title),title:ne,children:e}),H&&t.jsx("span",{id:F,className:De.tags,children:a.map(z=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:z.tone??"default",className:Gx[z.tone??"default"],"data-testid":`${k}-tag-${z.key}`,children:z.label},z.key))})]}),K&&t.jsx("span",{id:L,className:c.cn(De.subtitle,j.subtitle),children:s})]})]}),ee=[H?F:null,K?L:null].filter(Boolean).join(" "),J={"aria-labelledby":_,"aria-describedby":ee===""?void 0:ee,isDisabled:b,className:c.cn(De.pressTarget,D.overlay,j.content)},ie=`${k}-trigger`;let U;return i!==void 0?U=t.jsx(c.Link,{...J,"data-testid":ie,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:oe}):r!==void 0?U=t.jsx(T,{...J,testId:ie,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:oe}):U=t.jsx("div",{className:c.cn(De.content,j.content),children:oe}),t.jsxs(S,{"data-testid":k,"data-size":A,"data-disabled":b||void 0,className:c.cn(De.base,D.row,j.row,B&&!b&&D.hover,N),children:[U,(se(d)||O)&&t.jsxs("div",{className:De.side,children:[d,O&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{isIconOnly:!0,size:j.control,variant:"light",color:"default",radius:"full",isDisabled:b,"aria-label":p,"aria-describedby":te===""?void 0:P,testId:`${k}-menu-trigger`,className:De.menuTrigger,children:f??t.jsx(Xx,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${k}-menu`,className:G?De.menuWithDescriptions:void 0,disabledKeys:m.filter(z=>z.isDisabled).map(z=>z.key),onAction:z=>{m.find(Q=>Q.key===z)?.onAction()},items:m,children:z=>{const Q=z.isDisabled===!0&&se(z.description);return t.jsx(c.DropdownItem,{textValue:z.label,description:z.description,color:z.tone==="danger"?"danger":"default",className:c.cn(z.tone==="danger"&&De.dangerItem,Yx[A],Q&&De.menuItemDisabledWithDescription),classNames:{title:Q?De.menuItemDimmed:void 0,description:c.cn(De.menuItemDescription,j.subtitle)},startContent:Q&&z.icon!==void 0?t.jsx("span",{className:De.menuItemDimmedIcon,children:z.icon}):z.icon,"data-testid":z["data-testid"]??`${k}-menu-${z.key}`,children:z.label},z.key)}})]}),te!==""&&t.jsx("span",{id:P,hidden:!0,"data-testid":`${k}-menu-trigger-description`,children:te})]}),u&&t.jsx("span",{"aria-hidden":"true",className:De.chevron,"data-testid":`${k}-chevron`,children:x??t.jsx(Zx,{})})]})};Ql.displayName="EntityRow";const Zl=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(Kl,Qx[a],r),children:t.jsx(Yl.Provider,{value:!0,children:e})});Zl.displayName="EntityList";const Xl=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Rs(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=Dt;return t.jsxs("div",{"data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:Kl,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Dt.row,Gl[o].row),children:[t.jsx(c.Skeleton,{className:Dt.avatar[o]}),t.jsxs("span",{className:Dt.lines,children:[t.jsx(c.Skeleton,{className:c.cn(Dt.title,l[u%l.length])}),t.jsx(c.Skeleton,{className:Dt.subtitle})]})]},u))})]})};Xl.displayName="EntityListSkeleton";function Jl(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const eo=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:x}=Jl(e,s,n),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:x,total:n}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${x}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};eo.displayName="PaginationSummary";const zs="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",ot={base:"overflow-hidden rounded-2xl border border-pos-line bg-white",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",icon:"flex shrink-0 text-default-500 [&_svg]:size-[1.125rem]",action:"ml-auto",description:"m-0 text-[0.84375rem] leading-[1.55] text-default-500 [&_b]:font-bold [&_b]:tabular-nums [&_b]:text-default-900",footer:"flex flex-wrap gap-2",footerAfterContent:"mt-[0.875rem]",footerAfterDescription:"mt-3"},ep={card:zs,flat:""},tp={section:"flex flex-wrap items-center gap-2 px-5 pt-4",aside:"flex flex-wrap items-center gap-[0.5625rem] px-[1.125rem] pt-[0.9375rem]"},sp={section:{padded:"px-5 pb-[1.125rem] pt-[0.875rem]",rows:"px-5 pb-[1.125rem] pt-2.5",flush:"pt-3",none:""},aside:{padded:"px-[1.125rem] pb-[1.125rem] pt-3",rows:"px-[1.125rem] pb-[1.125rem] pt-3",flush:"pt-3",none:""}},to=({isLoading:e=!1,isError:s=!1,isEmpty:n=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:x,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:f,emptyActions:g,emptyContent:v,children:b,toolbar:y,variant:N="default",className:k,classNames:w={},"data-testid":$="list-panel"})=>{const A=N==="framed",j={base:c.cn("border-0 bg-transparent py-12",w.state)},D=A?{base:c.cn("px-6 py-[3.625rem]",w.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:j;let S;return e?S=r??t.jsx(ta,{title:a,classNames:j,"data-testid":`${$}-loading`}):s?S=x??t.jsx(ea,{title:i,description:o,classNames:j,"data-testid":`${$}-error`,actions:u??(d?t.jsx(T,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?S=v??t.jsx(Jn,{surface:A?"panel":void 0,title:m,description:p,icon:f,actions:g,classNames:D,"data-testid":`${$}-empty`}):S=b,t.jsxs("section",{"data-testid":$,"data-variant":A?"framed":void 0,className:c.cn(A?`overflow-hidden rounded-2xl border border-pos-line bg-white ${zs}`:"rounded-xl bg-white p-2 shadow-sm",k,w.base),children:[y,S]})};to.displayName="ListPanel";const ra=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),es=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},so=(e,s)=>{const[n,a]=h.useState(()=>s(e)),r=(es(n)??0)===(e??0)?n:s(e),i=h.useCallback(()=>{a(o=>{const l=es(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},np=/^[\d.,]+$/,no=(e,s=Object.is)=>{const n=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{n.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=h.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},ao=(e,s)=>{const n=h.useRef(null),a=h.useRef(s);return h.useLayoutEffect(()=>{a.current=s},[s]),h.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&np.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),n},ap=350,rp={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}",exactAmountLabel:"Exact",exactAmountAriaTemplate:"Exact amount {amount}",quickAmountsLabel:"Quick cash amounts",quickAmountAriaTemplate:"Add {amount}"},ip=7,lp=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,ip),op=(e,s,n)=>{if(!Number.isInteger(e))return fe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return fe(e,s,n)}},cp=(e,s)=>(e??0)===(s??0),Ht=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),dp=({dueAmount:e,received:s,defaultReceived:n=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:x=!1,className:m,"data-testid":p="cash-tender-form"})=>{const f={...rp,...i},g=Mt(e.currency,r),v=s!==void 0,[b,y]=h.useState(n??null),N=v?s:b,{draft:k,setDraft:w,normalize:$}=so(N,U=>U==null?"":String(U)),{isUntouched:A,markEdited:j,markUntouched:D}=no(N,cp),S=h.useMemo(()=>{const U=typeof N=="number"&&Number.isFinite(N)?N:0,z=jn(U,e.value,e.currency,r);return{received:U,change:z>0?z:0,isValid:U>=e.value&&U>0}},[N,e.value,e.currency,r]),_=h.useCallback(U=>{const z=U.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),F=h.useCallback(U=>{v||y(U);const z=typeof U=="number"&&Number.isFinite(U)?U:0,Q=jn(z,e.value,e.currency,r);a?.({received:z,change:Q>0?Q:0,isValid:z>=e.value&&z>0})},[v,e.value,e.currency,r,a]),L=h.useCallback(U=>{if(o)return;const z=U.replace(/[^\d.,]/g,"");if(!ra(z,g))return;const Q=es(z);Q!==null&&l!==void 0&&Q>l||(w(z),j(Q),F(Q))},[o,l,w,j,g,F]),P=ao(A,L),B=h.useMemo(()=>lp(d),[d]),H=U=>l!==void 0&&U>l,K=()=>{o||H(e.value)||(w(String(e.value)),D(),F(e.value))},O=U=>{if(o)return;const z=A()||typeof N!="number"||!Number.isFinite(N)?0:N,Q=Un(z+U,e.currency,r);H(Q)||(w(String(Q)),j(Q),F(Q))},ne=S.isValid&&S.change>0,G=!S.isValid&&S.received>0,te=fe(S.change,r,e.currency),Y=fe(e.value,r,e.currency),[oe,ee]=h.useState(""),J=h.useRef(null);h.useEffect(()=>{J.current&&clearTimeout(J.current);const U=ne?Ht(f.changeMessageTemplate,{change:te}):"",z=ne?ap:0;return J.current=setTimeout(()=>ee(U),z),()=>{J.current&&clearTimeout(J.current)}},[ne,te,f.changeMessageTemplate]);const ie=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:P,id:ie,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:k,onChange:U=>L(U.target.value),onFocus:_,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?Ht(f.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${p}-received-input`}),B.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(T,{variant:"flat",color:"primary",radius:"lg",className:"h-auto min-h-11 min-w-0 whitespace-normal px-2 py-1 text-sm font-semibold leading-tight",isDisabled:o,"aria-label":Ht(f.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[f.exactAmountLabel," ",Y]}),B.map(U=>{const z=op(U,r,e.currency);return t.jsx(T,{variant:"bordered",color:"default",radius:"lg",className:"h-auto min-h-11 min-w-0 px-2 text-base font-semibold text-default-900",isDisabled:o,"aria-label":Ht(f.quickAmountAriaTemplate,{amount:z}),onPress:()=>O(U),"data-testid":`${p}-quick-amount-${U}`,children:z},U)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:Ht(f.changeMessageTemplate,{change:te}),icon:t.jsx(M,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:oe})]})},up={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},yr=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},ro=({dueAmount:e,value:s,defaultValue:n,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:x=!1,className:m,"data-testid":p="check-tender-form"})=>{const f={...up,...r},g=s!==void 0,[v,b]=h.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??yr()}),[y,N]=h.useState(!!n?.checkNumber),k=h.useMemo(()=>g?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??yr()}:v,[g,s,v]),w=h.useCallback(F=>{g||b(F);const L=F.checkNumber.trim(),P={amount:e.value,checkNumber:L,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:L.length>0&&e.value>0};a?.(P)},[g,e.value,i,a]),$=h.useCallback(F=>L=>{l||(F==="checkNumber"&&L.length>0&&N(!0),w({...k,[F]:L}))},[k,w,l]),A=h.useCallback(()=>{l||N(!0)},[l]),j=y&&k.checkNumber.trim()==="",D=`${p}-check-number`,S=`${p}-bank-name`,_=`${p}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":p,children:[t.jsx(c.Input,{id:D,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:F=>$("checkNumber")(F.target.value),onBlur:A,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:j,errorMessage:j?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${p}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:F=>$("bankName")(F.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:f.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:F=>$("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};ro.displayName="CheckTenderForm";const mp={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},fp=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],io=({dueAmount:e,methodOptions:s=fp,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const x={...mp,...i},m=n!==void 0,[p,f]=h.useState({method:a?.method??"",reference:a?.reference??""}),g=h.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:p,[m,n,p]),v=h.useCallback($=>s.find(A=>A.value===$)?.label??"",[s]),b=h.useCallback($=>{m||f($);const A=v($.method),j={amount:e.value,method:$.method,description:A,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(j)},[m,e.value,r,v]),y=h.useCallback($=>{if(l)return;const A=typeof $=="string"?$:Array.from($)[0]?.toString()??"";b({...g,method:A})},[g,b,l]),N=h.useCallback($=>{l||b({...g,reference:$})},[g,b,l]),k=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(nt,{id:k,label:x.methodLabel,labelPlacement:"outside",placeholder:x.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:y,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map($=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),o&&t.jsx(c.Input,{id:w,label:x.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:$=>N($.target.value),placeholder:x.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};io.displayName="OtherTenderForm";const xp={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},pp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},hp={pending:"warning",recorded:"success",failed:"danger"},bp=e=>e==="pending"||e==="recorded",gp=e=>`#${e+1}`,lo=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...xp,...r},{collected:x,remaining:m,isComplete:p}=h.useMemo(()=>{const g=s.reduce((b,y)=>bp(y.status)?b+y.amount:b,0),v=Math.max(e.value-g,0);return{collected:g,remaining:v,isComplete:g>=e.value&&e.value>0}},[s,e.value]),f=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":d,children:[o==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?x:m,a,e.currency)})]}):t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${d}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:fe(p?x:m,a,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((g,v)=>t.jsx(yp,{index:v,tender:g,locale:a,currency:e.currency,removable:!!n&&g.status!=="recorded",onRemove:n?()=>n(g.id):void 0,statusLabel:f(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${v}`},g.id))]})]})};lo.displayName="SplitPaymentSummary";const yp=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const x=i?t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:gp(e)}),t.jsx(M,{icon:pp[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:fe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:hp[s.status],startContent:s.status==="recorded"?t.jsx(M,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(M,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),x&&(r?x:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:x})}))]})},vp=`
16
+ `,"aria-label":`Zoom level ${e}%`,children:[e,"%"]})}),t.jsx(c.Tooltip,{content:"Zoom in",placement:"top",offset:10,children:t.jsx(T,{size:"sm",radius:"sm",color:"default",variant:"bordered",isIconOnly:!0,isDisabled:u,onPress:o,"aria-label":"Zoom in",children:t.jsx(X.ZoomIn,{size:16})})})]})}function sm({editor:e,isDisabled:s=!1}){const[n,a]=h.useState(!1),[r,i]=h.useState(""),[o,l]=h.useState(""),[d,u]=h.useState(!1),x=e.isActive("link"),m=f=>{if(f){const{from:g,to:v}=e.state.selection,b=e.isActive("link");let y="";if(b){const k=e.schema.marks.link,w=e.state.doc.resolve(g),$=Ca.getMarkRange(w,k);$&&(y=e.state.doc.textBetween($.from,$.to,""))}else y=e.state.doc.textBetween(g,v,"");const N=e.getAttributes("link").href||"";i(y),l(N),u(b)}a(f)},p=()=>{if(o.trim()){const{from:f,to:g}=e.state.selection,v=e.schema.marks.link,b=e.state.doc.resolve(f),y=Ca.getMarkRange(b,v),N=y?.from??f,k=y?.to??g,w=e.state.doc.textBetween(N,k,"");r.trim()&&r!==w?e.chain().focus().setTextSelection({from:N,to:k}).deleteSelection().insertContent(`<a href="${o.trim()}">${r.trim()}</a>`).run():e.chain().focus().extendMarkRange("link").updateAttributes("link",{href:o.trim()}).run()}a(!1)};return t.jsxs(c.Popover,{isOpen:n,onOpenChange:m,placement:"bottom",children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{size:"sm",radius:"sm",variant:x?"solid":"bordered",color:x?"primary":"default",isIconOnly:!0,isDisabled:s,"aria-label":"Link",children:t.jsx(X.Link,{size:16})})}),t.jsx(c.PopoverContent,{children:t.jsxs("div",{className:"flex flex-col gap-3 p-3 w-72",children:[t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Name",labelPlacement:"outside",placeholder:"Link text",value:r,onChange:f=>i(f.target.value),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(c.Input,{size:"sm",variant:"bordered",label:"Link",labelPlacement:"outside",placeholder:"https://example.com",value:o,onChange:f=>l(f.target.value),onKeyDown:f=>f.key==="Enter"&&p(),classNames:{inputWrapper:"focus-within:border-default-400"}}),t.jsx(T,{size:"sm",color:"primary",onPress:p,isDisabled:!o.trim(),children:d?"Update":"Apply"})]})})]})}function nm({children:e,id:s,label:n,className:a,useButtonGroup:r=!0}){return r?t.jsx(c.ButtonGroup,{size:"sm",id:s,"aria-label":n,className:a,children:e}):t.jsx("div",{id:s,role:"group","aria-label":n,className:`flex items-center gap-2 ${a||""}`,children:e})}function Fi(e,s){const n=h.useMemo(()=>{if(!e)return{};const i={};return Array.from(new Set(s.map(l=>ts(l)))).forEach(l=>{const d=mt[l];if(d)try{const u=d.canExecute?.(e)??!0,x=d.isActive?.(e)??!1;i[l]={isActive:x,isDisabled:!u,canExecute:u}}catch(u){console.warn(`Extension not available for modifier: ${l}`,u),i[l]={isActive:!1,isDisabled:!0,canExecute:!1}}}),i},[e,s]),[a,r]=h.useState(n);return h.useEffect(()=>{if(!e)return;const i=()=>{const o={};Array.from(new Set(s.map(d=>ts(d)))).forEach(d=>{const u=mt[d];if(u)try{const x=u.canExecute?.(e)??!0,m=u.isActive?.(e)??!1;o[d]={isActive:m,isDisabled:!x,canExecute:x}}catch(x){console.warn(`Extension not available for modifier: ${d}`,x),o[d]={isActive:!1,isDisabled:!0,canExecute:!1}}}),r(o)};return e.on("selectionUpdate",i),e.on("transaction",i),()=>{e.off("selectionUpdate",i),e.off("transaction",i)}},[e,s,n]),a}function Ri(e,s){const n=h.useCallback((o,l)=>{if(!e)return;const d=mt[o];if(d)try{d.execute({editor:e,config:l}),s?.({type:"toggle",modifier:o})}catch(u){console.warn(`Failed to execute command for modifier: ${o}`,u)}},[e,s]),a=h.useCallback(o=>{n(o)},[n]),r=h.useCallback((o,l)=>{if(!e)return!1;const d=mt[o];try{return d?.canExecute?.(e,l)??!1}catch(u){return console.warn(`Failed to check canExecute for modifier: ${o}`,u),!1}},[e]),i=h.useCallback((o,l)=>{if(!e)return!1;const d=mt[o];try{return d?.isActive?.(e,l)??!1}catch(u){return console.warn(`Failed to check isActive for modifier: ${o}`,u),!1}},[e]);return{executeCommand:n,toggleModifier:a,canExecute:r,isActive:i}}function am(e=Pe.default){const[s,n]=h.useState(e),a=h.useCallback((l=Pe.step)=>{n(d=>Math.min(Pe.max,d+l))},[]),r=h.useCallback((l=Pe.step)=>{n(d=>Math.max(Pe.min,d-l))},[]),i=h.useCallback(()=>{n(Pe.default)},[]),o=h.useCallback(l=>{const d=Math.max(Pe.min,Math.min(Pe.max,l));n(d)},[]);return{zoom:s,setZoom:o,zoomIn:a,zoomOut:r,resetZoom:i,isMinZoom:s<=Pe.min,isMaxZoom:s>=Pe.max,isDefaultZoom:s===Pe.default}}const rm=["bold","italic","strike","underline","code"];function im({editor:e,modifiers:s,onToolbarAction:n}){const a=Fi(e,s),{toggleModifier:r}=Ri(e,n);if(!e)return null;const i=s.map(o=>ts(o)).filter(o=>rm.includes(o));return i.length===0?null:t.jsx(nm,{id:"text-formatting",label:"Text formatting",children:i.map(o=>{const l=a[o],d=Ft(o);return t.jsx(vt,{icon:d,label:o.charAt(0).toUpperCase()+o.slice(1),isActive:l?.isActive,isDisabled:l?.isDisabled,onClick:()=>r(o)},o)})})}function lm({editor:e,modifiers:s,zoom:n=100,onZoomChange:a,sticky:r=!0,className:i,onToolbarAction:o}){const l=Fi(e,s),{toggleModifier:d,executeCommand:u}=Ri(e,o);if(!e)return null;const x=s.map(j=>ts(j)),m=x.some(j=>["bold","italic","strike","underline","code"].includes(j)),p=x.some(j=>["textColor","highlight"].includes(j)),f=x.includes("heading"),g=x.includes("textAlign"),v=x.some(j=>["bulletList","orderedList","taskList"].includes(j)),b=x.includes("blockquote"),y=x.includes("codeBlock"),N=x.includes("link"),k=x.includes("horizontalRule"),w=x.some(j=>["undo","redo"].includes(j)),$=n!==void 0&&a!==void 0,A=r?"sticky top-0 z-10":"";return t.jsx("div",{className:`w-full p-2 bg-background border-b border-divider ${A} ${i||""}`,children:t.jsxs("div",{className:"flex flex-row flex-wrap gap-2 w-full items-center",children:[m&&t.jsxs(t.Fragment,{children:[t.jsx(im,{editor:e,modifiers:s,onToolbarAction:o}),(p||f||g||v||b||y||N||k||w||$)&&t.jsx(gt,{})]}),p&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("textColor")&&t.jsx(Wa,{editor:e,type:"textColor",label:"Text color",isDisabled:l.textColor?.isDisabled}),x.includes("highlight")&&t.jsx(Wa,{editor:e,type:"highlight",label:"Highlight",isDisabled:l.highlight?.isDisabled})]}),(f||g||v||b||y||N||k||w||$)&&t.jsx(gt,{})]}),f&&t.jsxs(t.Fragment,{children:[t.jsx(Gu,{editor:e}),(g||v||b||y||N||k||w||$)&&t.jsx(gt,{})]}),g&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1",children:["left","center","right","justify"].map(j=>{const D=Ju[j],S=e.isActive({textAlign:j});return t.jsx(vt,{icon:D,label:`Align ${j}`,isActive:S,onClick:()=>u("textAlign",{type:"textAlign",alignment:j})},j)})}),(v||b||y||N||k||w||$)&&t.jsx(gt,{})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(Ku,{editor:e,types:x.filter(j=>["bulletList","orderedList","taskList"].includes(j))}),(b||y||N||k||w||$)&&t.jsx(gt,{})]}),(b||y||N||k)&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[b&&t.jsx(vt,{icon:Ft("blockquote"),label:"Blockquote",isActive:l.blockquote?.isActive,isDisabled:l.blockquote?.isDisabled,onClick:()=>d("blockquote")}),y&&t.jsx(vt,{icon:Ft("codeBlock"),label:"Code block",isActive:l.codeBlock?.isActive,isDisabled:l.codeBlock?.isDisabled,onClick:()=>d("codeBlock")}),N&&t.jsx(sm,{editor:e,isDisabled:l.link?.isDisabled}),k&&t.jsx(vt,{icon:Ft("horizontalRule"),label:"Horizontal rule",onClick:()=>d("horizontalRule")})]}),(w||$)&&t.jsx(gt,{})]}),w&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-1",children:[x.includes("undo")&&t.jsx(vt,{icon:Ft("undo"),label:"Undo",isDisabled:l.undo?.isDisabled,onClick:()=>d("undo")}),x.includes("redo")&&t.jsx(vt,{icon:Ft("redo"),label:"Redo",isDisabled:l.redo?.isDisabled,onClick:()=>d("redo")})]}),$&&t.jsx(gt,{})]}),$&&t.jsx(tm,{zoom:n,onZoomChange:j=>{a?.(j),o?.({type:"zoom",modifier:`${j}%`})}})]})})}const Vt={bold:{category:"mark",extension:yc.Bold,priority:100},italic:{category:"mark",extension:vc.Italic,priority:100},strike:{category:"mark",extension:jc.Strike,priority:100},underline:{category:"mark",extension:wc.Underline,priority:100},code:{category:"mark",extension:Nc.Code,priority:100},textColor:{category:"mark",extension:Cc.Color,defaultOptions:{types:["textStyle","heading","paragraph","listItem","taskItem","blockquote"]},priority:90},highlight:{category:"mark",extension:kc.Highlight,defaultOptions:{multicolor:!0},priority:90},link:{category:"mark",extension:Sc.Link,defaultOptions:{autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"text-primary underline cursor-pointer"}},priority:100},heading:{category:"node",extension:Ac.Heading,defaultOptions:{levels:[1,2,3,4,5,6]},priority:100},bulletList:{category:"node",extension:Ec.BulletList,defaultOptions:{HTMLAttributes:{class:"list-disc"}},priority:90},orderedList:{category:"node",extension:Lc.OrderedList,defaultOptions:{HTMLAttributes:{class:"list-decimal"}},priority:90},taskList:{category:"node",extension:Fc.TaskList,defaultOptions:{HTMLAttributes:{class:"task-list"}},priority:90},codeBlock:{category:"node",extension:Mc.CodeBlock,priority:100},blockquote:{category:"node",extension:Pc.Blockquote,priority:100},horizontalRule:{category:"node",extension:Ic.HorizontalRule,priority:100},hardBreak:{category:"node",extension:Tc.HardBreak,priority:100},undo:{category:"extension",extension:ka.History,priority:50},redo:{category:"extension",extension:ka.History,priority:50},textAlign:{category:"extension",extension:Oc.TextAlign,defaultOptions:{types:["heading","paragraph","listItem","bulletList","orderedList","taskList","taskItem","blockquote"],alignments:["left","center","right","justify"],defaultAlignment:"left"},priority:80},clearMarks:{category:"extension",extension:null,priority:50},clearNodes:{category:"extension",extension:null,priority:50}},om=[zc.Document,Bc.Text,Dc.Paragraph,$c.TextStyle.configure({HTMLAttributes:{}}),_c.ListItem.configure({HTMLAttributes:{}}),Rc.TaskItem.configure({nested:!0}),Vc.Dropcursor,Uc.Gapcursor];function cm(e){const s=[],n=new Set,a=new Set;om.forEach(l=>{l&&(s.push(l),a.add(l.name))});const r=e.map(l=>ts(l)),i=new Set;return r.forEach(l=>{const d=Vt[l];d?.requiredExtensions&&d.requiredExtensions.forEach(u=>{i.add(u)})}),i.forEach(l=>{if(n.has(l))return;const d=Vt[l];if(!d||d.extension===null)return;const u=d.extension.name;if(a.has(u)){n.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(x),n.add(l),a.add(u)}),r.forEach(l=>{if(n.has(l))return;const d=Vt[l];if(!d){console.warn(`Extension config not found for modifier: ${l}`);return}if(d.extension===null){n.add(l);return}const u=d.extension.name;if(a.has(u)){n.add(l);return}const x=d.defaultOptions?d.extension.configure(d.defaultOptions):d.extension;s.push(x),n.add(l),a.add(u)}),s.sort((l,d)=>{const u=Object.values(Vt).find(f=>f?.extension?.name===l.name),x=Object.values(Vt).find(f=>f?.extension?.name===d.name),m=u?.priority??100;return(x?.priority??100)-m})}const _i={simple:["bold","italic","bulletList","orderedList","undo","redo"],blog:["bold","italic","underline",{type:"heading",level:2},{type:"heading",level:3},"textAlign","bulletList","orderedList","link","blockquote","undo","redo"],documentation:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"],comment:["bold","italic","link","undo","redo"],full:["bold","italic","strike","underline","code","clearMarks",{type:"heading",level:1},{type:"heading",level:2},{type:"heading",level:3},{type:"heading",level:4},{type:"heading",level:5},{type:"heading",level:6},"textAlign","bulletList","orderedList","taskList","link","textColor","highlight","codeBlock","blockquote","horizontalRule","hardBreak","undo","redo"]},dm={h1:`font-size: ${ge.fontSize["4xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h2:`font-size: ${ge.fontSize["2xl"]}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h3:`font-size: ${ge.fontSize.xl}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h4:`font-size: ${ge.fontSize.lg}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h5:`font-size: ${ge.fontSize.base}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,h6:`font-size: ${ge.fontSize.sm}; font-weight: ${ge.fontWeight.semibold}; line-height: ${ge.lineHeight.tight}; margin: ${he.md} 0 ${he.sm} 0;`,p:`min-height: ${ge.lineHeight.normal}em; margin: 0;`,ul:`list-style-type: disc; list-style-position: outside; padding-left: ${he.xl}; margin: ${he.md} 0;`,ol:`list-style-type: decimal; list-style-position: outside; padding-left: ${he.xl}; margin: ${he.md} 0;`,li:`display: list-item; margin: ${he.xs} 0;`,strong:`font-weight: ${ge.fontWeight.bold};`,em:"font-style: italic;",s:"text-decoration: line-through;",u:"text-decoration: underline;",code:`background-color: ${Fe.neutral.gray[100]}; border-radius: 0.4rem; font-size: ${ge.fontSize.sm}; padding: 0.25em 0.3em; font-family: ${ge.fontFamily.mono};`,pre:`background: ${Fe.neutral.gray[800]}; border-radius: ${he.sm}; color: ${Fe.neutral.gray[100]}; font-family: ${ge.fontFamily.mono}; margin: ${he.lg} 0; padding: 0.75rem ${he.md}; overflow-x: auto;`,blockquote:`border-left: 3px solid ${Fe.neutral.gray[300]}; margin: ${he.lg} 0; padding-left: ${he.md}; color: ${Fe.neutral.gray[500]};`,hr:`border: none; border-top: 1px solid ${Fe.neutral.gray[200]}; margin: ${he.xl} 0;`,a:`color: ${Fe.brand.primary.DEFAULT}; text-decoration: underline; cursor: pointer;`,mark:`background-color: ${Fe.palettes.warning[200]}; border-radius: ${he.xs}; padding: 0 0.125rem;`,label:`display: flex; align-items: center; gap: ${he.sm}; cursor: pointer;`,input:"cursor: pointer; margin: 0;"},um={taskList:"list-style: none; padding-left: 0; margin: 1rem 0;",taskItem:"display: flex; align-items: flex-start; gap: 0.5rem; margin: 0.5rem 0;"};function mm(e){if(!e)return e;let s=e;for(const[n,a]of Object.entries(um)){const r=new RegExp(`(<(?:ul|li)[^>]*data-type="${n}"[^>]*)>`,"gi");s=s.replace(r,(i,o)=>i.includes('style="')?i.replace(/style="([^"]*)"/,`style="$1 ${a}"`):`${o} style="${a}">`)}for(const[n,a]of Object.entries(dm)){const r=new RegExp(`<${n}(\\s[^>]*)?>`,"gi");s=s.replace(r,i=>{if(i.includes('data-type="taskList"')||i.includes('data-type="taskItem"'))return i;if(i.includes('style="'))return i.replace(/style="([^"]*)"/,`style="$1 ${a}"`);if(i.includes("style='"))return i.replace(/style='([^']*)'/,`style='$1 ${a}'`);{const o=i.indexOf(">");return`${i.slice(0,o)} style="${a}"${i.slice(o)}`}})}return s}const fm=({modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})=>{const{editor:r}=_n.useCurrentEditor();return t.jsx(lm,{editor:r,modifiers:e,zoom:s,onZoomChange:n,onToolbarAction:a})},xm=({showCharacterCount:e,showWordCount:s})=>{const{editor:n}=_n.useCurrentEditor();if(!n||!e&&!s)return null;const a=n.getText(),r=a.length,i=a.split(/\s+/).filter(o=>o.length>0).length;return t.jsxs("div",{className:"flex gap-4 text-xs text-default-500 px-2 pb-1",children:[e&&t.jsxs("span",{children:[r," characters"]}),s&&t.jsxs("span",{children:[i," words"]})]})},Cn=h.forwardRef((e,s)=>{const{minRows:n=10,maxRows:a=30,disableAutosize:r=!1,showCharacterCount:i=!1,showWordCount:o=!1,showToolbar:l=!0,modifiers:d=_i.full,variant:u="bordered",initialContent:x,content:m,onContentChange:p,onUpdate:f,onToolbarAction:g,isReadOnly:v=!1,isDisabled:b=!1,includeInlineStyles:y=!0,...N}=e,{zoom:k,setZoom:w}=am(),$=Ha.lineHeight,A=n*$,j=r?void 0:a*$,D=h.useMemo(()=>cm(d),[d]),{Component:S,label:_,shouldLabelBeOutside:F,getBaseProps:L,getLabelProps:P,getInputWrapperProps:B}=c.useInput({...N,variant:u,ref:s,isMultiline:!0}),H=_?t.jsx("label",{...P(),children:_}):null,K=h.useCallback(({editor:O})=>{const ne=O.getHTML(),G=y?mm(ne):ne,te=O.getJSON(),Y=O.getText(),ce=Y.length,ee=Y.split(/\s+/).filter(le=>le.length>0).length,J={html:G,json:te,text:Y,characters:ce,words:ee};if(p?.(J),f?.(J),"onChange"in N&&typeof N.onChange=="function"){const le={target:{value:G},currentTarget:{value:G}};N.onChange(le)}},[p,f,N,y]);return t.jsxs(S,{...L(),children:[F?H:null,t.jsx("div",{...B(),className:c.cn(B().className,"flex flex-col w-full p-0 gap-0 rich-text-editor"),style:{maxHeight:j?`${j+Ha.toolbarHeight}px`:void 0,overflow:j?"auto":void 0},children:t.jsx(_n.EditorProvider,{editable:!v&&!b,slotBefore:l?t.jsx(fm,{modifiers:d,zoom:k,onZoomChange:w,onToolbarAction:g}):void 0,slotAfter:t.jsx(xm,{showCharacterCount:i,showWordCount:o}),editorContainerProps:{className:"w-full flex-1 outline-none",style:{minHeight:`${A}px`,fontSize:`${k}%`,display:"flex",flexDirection:"column"}},editorProps:{attributes:{class:"focus:outline-none w-full h-full"}},extensions:D,content:m||x||e.defaultValue||"",onUpdate:K})})]})});Cn.displayName="TipTapEditor";const Mi=h.forwardRef((e,s)=>{const{adapter:n="tiptap",variant:a="bordered",...r}=e;return n==="tiptap"?t.jsx(Cn,{...r,variant:a,ref:s}):(console.warn(`Adapter "${n}" is not supported. Using TipTap.`),t.jsx(Cn,{...r,variant:a,ref:s}))});Mi.displayName="RichTextArea";function qa(e,s="en-US",n="USD",a=!0){try{return new Intl.NumberFormat(s,a?{style:"currency",currency:n,minimumFractionDigits:0,maximumFractionDigits:2}:{style:"currency",currency:n}).format(e)}catch(r){return console.warn(`Invalid currency formatting: ${r}`),`${n} ${e.toFixed(2)}`}}function pm(e="en-US",s="USD"){try{const n=new Intl.NumberFormat(e,{style:"currency",currency:s,currencyDisplay:"symbol"}),a=n.formatToParts(1),r=a.findIndex(d=>d.type==="currency"),i=a.findIndex(d=>d.type==="integer"),{minimumFractionDigits:o,maximumFractionDigits:l}=n.resolvedOptions();return{symbol:a[r]?.value??s,position:r>i?"end":"start",formatOptions:{style:"decimal",minimumFractionDigits:o,maximumFractionDigits:l}}}catch(n){return console.warn(`Invalid currency formatting: ${n}`),{symbol:s,position:"start",formatOptions:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2}}}}const Ga=`h-auto min-w-0 w-full flex-col gap-0 border bg-white text-center shadow-none transition-colors data-[focus-visible=true]:outline-primary ${Ce} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Ka=`border bg-white shadow-none ${Ce}`,hm={tile:{root:"flex flex-col",title:"mb-5 text-xs font-semibold uppercase tracking-[.04em] text-pos-muted",eyebrow:"mb-1 text-xs font-semibold uppercase tracking-[.08em] text-pos-muted",caption:"mb-3 text-sm text-pos-muted",grid:"grid gap-2",preset:`${Ga} rounded-xl px-1 py-3.5`,presetIdle:"border-pos-field text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",amount:"text-base font-bold leading-[1.1875rem]",amountSelected:"",sublabel:"mt-1 text-xs font-semibold text-pos-neutral",customLabel:"mb-1.5 block text-sm font-semibold text-pos-ink",inputBase:"mt-2",inputWrapper:`${Ka} rounded-xl border-pos-field px-3.5 data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.125rem_hsl(var(--heroui-primary)/0.14)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-faint"},pos:{root:"flex flex-col",title:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",eyebrow:"mb-1 text-[0.6875rem] font-semibold uppercase leading-[1.03125rem] tracking-[.08em] text-pos-muted",caption:"mb-3 text-[0.8125rem] leading-[1.21875rem] text-pos-muted",grid:"mb-3.5 grid grid-cols-[repeat(auto-fit,minmax(6rem,1fr))] gap-2.5",preset:`${Ga} rounded-[0.875rem] px-2.5 py-3`,presetIdle:"border-pos-line data-[hover=true]:border-primary data-[hover=true]:bg-white",presetSelected:"border-primary bg-primary/5 data-[hover=true]:bg-primary/5",amount:"text-[1.1875rem] font-semibold leading-[1.1875rem] text-pos-ink",amountSelected:"",sublabel:"mt-[0.3125rem] text-[0.71875rem] font-semibold leading-[0.875rem] text-pos-neutral",customLabel:"mb-1.5 block text-[0.8125rem] font-semibold leading-[1.21875rem] text-pos-ink",inputBase:"",inputWrapper:`${Ka} rounded-lg border-pos-line px-3 data-[hover=true]:border-pos-line group-data-[focus=true]:border-primary group-data-[focus=true]:data-[hover=true]:border-primary group-data-[focus=true]:shadow-[0_0_0_0.1875rem_hsl(var(--heroui-primary)/0.1)]`,inputWrapperActive:"border-primary data-[hover=true]:border-primary",input:"text-pos-ink placeholder:text-pos-muted"}},St={row:"flex flex-wrap gap-2",preset:"w-auto flex-[1_1_4.5rem] min-h-12 py-0",field:"flex-[2_1_10rem] min-w-0",inputWrapper:"h-12 min-h-12",input:"text-[0.9375rem] data-[has-start-content=true]:ps-1 data-[has-end-content=true]:pe-1",affix:"shrink-0 text-sm text-pos-neutral"},bm={tile:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-[2.375rem] min-h-[2.375rem]",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}},pos:{sm:{wrapper:"h-8 min-h-8",input:"text-sm"},md:{wrapper:"h-10 min-h-10",input:"text-sm"},lg:{wrapper:"h-12 min-h-12",input:"text-base"}}},Ya=[{id:"100",amount:100},{id:"250",amount:250},{id:"500",amount:500},{id:"1000",amount:1e3},{id:"2000",amount:2e3}],gm={title:"Donation Amount",customAmountPlaceholder:"Custom donation amount",customAmountAriaLabel:"Custom donation amount",addDonationButton:"Add Donation",presetsAriaLabel:"Suggested amounts"},Pi=({presetAmounts:e=Ya,selectedDonation:s,defaultSelectedDonation:n=null,onChange:a,onAddDonation:r,currency:i="USD",locale:o="en-US",showCustomAmount:l=!0,minCustomAmount:d=.5,maxCustomAmount:u=1e6,labels:x,mobileColumns:m=2,desktopColumns:p=3,isDisabled:f=!1,buttonVariant:g="bordered",buttonColor:v="default",inputVariant:b="bordered",size:y="md",className:N="",showCard:k=!0,variant:w="pill",customAmountPlacement:$="below",isRequired:A=!1})=>{const j={...gm,...x},D=h.useId(),S=`${D}-title`,_=`${D}-custom`,F=Array.isArray(e)?e:Ya,L={2:"grid-cols-2",3:"grid-cols-3"},P={3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},B=`${L[m]} ${P[p]}`,[H,K]=as(s,n,a),[O,ne]=h.useState(""),[G,te]=h.useState(!1),[Y,ce]=h.useState(0),ee=h.useCallback(ae=>{if(f)return;const ke={amount:ae.amount,isCustom:!1,presetId:ae.id};K(ke),ne(""),te(!1),ce(Ue=>Ue+1),r?.(ke)},[f,K,r]),J=h.useCallback(ae=>{if(f)return;if(ne(ae!==void 0?String(ae):""),r){K(null);return}if(te(!1),ae===void 0||isNaN(ae)){K(null);return}K({amount:ae,isCustom:!0})},[f,K,r]),le=h.useCallback(()=>{if(f)return;const ae=O!==""?parseFloat(O):void 0;ae===void 0||isNaN(ae)||r?.({amount:ae,isCustom:!0})},[f,O,r]),U=h.useMemo(()=>({style:"currency",currency:i,currencyDisplay:"symbol"}),[i]),z=h.useMemo(()=>pm(o,i),[o,i]),Q=ae=>H!==null&&!H.isCustom&&H.presetId===ae.id,Ve=(ae,ke)=>{const Ue=H?.isCustom===!0,rt=!r&&G,ve=w==="tile"&&$==="inline",He=ve?t.jsx("span",{className:St.affix,"data-testid":"donation-amounts-custom-symbol",children:z.symbol}):void 0,ue=t.jsxs("div",{className:c.cn("flex items-start gap-3",ve&&St.field),"data-testid":"donation-amounts-custom-field",children:[t.jsx(c.NumberInput,{id:_,placeholder:j.customAmountPlaceholder,"aria-label":ve?j.customAmountLabel??j.customAmountAriaLabel:j.customAmountLabel?void 0:j.customAmountAriaLabel,onInput:r?()=>{K(null),te(!0)}:()=>te(!0),onBlur:r?void 0:()=>te(!1),variant:"bordered",minValue:d,maxValue:u,step:.01,formatOptions:ve?z.formatOptions:U,startContent:z.position==="start"?He:void 0,endContent:z.position==="end"?He:void 0,value:O!==""?parseFloat(O):void 0,onValueChange:J,isDisabled:f,className:"flex-1",classNames:{inputWrapper:c.cn(ae.inputWrapper,ke.wrapper,ve&&St.inputWrapper,(Ue||rt)&&ae.inputWrapperActive),input:c.cn(ae.input,ke.input,ve&&St.input)},"data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(T,{color:"primary",variant:"solid",size:y,className:"shrink-0",onPress:le,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]}),je=l&&(ve?ue:t.jsxs("div",{className:c.cn("flex flex-col",ae.inputBase),children:[j.customAmountLabel&&t.jsx("label",{htmlFor:_,className:ae.customLabel,"data-testid":"donation-amounts-custom-label",children:j.customAmountLabel}),ue]}));return t.jsxs("div",{className:ae.root,"data-testid":"donation-amounts-root","data-variant":w,"data-custom-placement":ve?"inline":void 0,children:[j.eyebrow&&t.jsx("p",{className:ae.eyebrow,"data-testid":"donation-amounts-eyebrow",children:j.eyebrow}),j.title&&t.jsxs("p",{id:S,className:ae.title,"data-testid":"donation-amounts-title",children:[j.title,A&&t.jsx("span",{"aria-hidden":"true",className:"ml-0.5 text-pos-danger",children:"*"})]}),j.caption&&t.jsx("p",{className:ae.caption,"data-testid":"donation-amounts-caption",children:j.caption}),(F.length>0||ve&&je)&&t.jsxs("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:ve?St.row:c.cn(ae.grid,w==="tile"&&B),"data-testid":"donation-amounts-presets",children:[F.map(we=>{const C=Q(we)&&!rt;return t.jsxs(T,{color:"default",variant:"bordered",disableRipple:!0,"aria-pressed":C,className:c.cn(ae.preset,ve&&St.preset,C?ae.presetSelected:ae.presetIdle),onPress:()=>ee(we),isDisabled:f,"data-selected":C||void 0,"data-testid":`donation-amounts-preset-${we.id}`,children:[t.jsx("span",{className:c.cn(ae.amount,C&&ae.amountSelected),children:we.label||qa(we.amount,o,i,w!=="pos")}),we.sublabel&&" ",we.sublabel&&t.jsx("span",{className:ae.sublabel,"data-testid":`donation-amounts-preset-${we.id}-sublabel`,children:we.sublabel})]},we.id)}),ve&&je]}),!ve&&je]})},Re=t.jsxs("div",{className:"space-y-4","data-testid":"donation-amounts-root",children:[j.title&&t.jsx("h2",{id:S,className:"text-base font-semibold","data-testid":"donation-amounts-title",children:j.title}),F.length>0&&t.jsx("div",{role:"group","aria-labelledby":j.title?S:void 0,"aria-label":j.title?void 0:j.presetsAriaLabel,className:c.cn("grid gap-3",B),"data-testid":"donation-amounts-presets",children:F.map(ae=>{const ke=H!==null&&!H.isCustom&&H.presetId===ae.id;return t.jsx(T,{color:ke?"primary":v,variant:ke?"solid":g,className:"w-full","aria-pressed":ke,onPress:()=>ee(ae),isDisabled:f,"data-testid":`donation-amounts-preset-${ae.id}`,children:ae.label||qa(ae.amount,o,i)},ae.id)})}),l&&t.jsxs("div",{className:"flex gap-3 items-start",children:[t.jsx(c.NumberInput,{placeholder:j.customAmountPlaceholder,"aria-label":j.customAmountAriaLabel,onInput:r?()=>{K(null),te(!0)}:void 0,variant:b,radius:"full",size:y,minValue:d,maxValue:u,step:.01,formatOptions:U,value:O!==""?parseFloat(O):void 0,onValueChange:J,isDisabled:f,className:"flex-1 [&_[data-slot=input-wrapper]]:!h-10 [&_[data-slot=input-wrapper]]:!min-h-10","data-testid":"donation-amounts-custom-input",hideStepper:!0},r?`custom-${Y}`:H?.isCustom===!1?H.presetId:"custom"),r&&t.jsx(T,{color:"primary",variant:"solid",radius:"full",size:y,className:"shrink-0",onPress:le,isDisabled:f||!G,"data-testid":"donation-amounts-add-button",children:j.addDonationButton})]})]}),_e=w==="pill"?Re:Ve(hm[w],bm[w][y]);return k?t.jsx(c.Card,{className:c.cn("w-full",N),"data-testid":"donation-amounts-card",children:t.jsx(c.CardBody,{children:_e})}):t.jsx("div",{className:c.cn("w-full",N),"data-testid":"donation-amounts-plain",children:_e})};Pi.displayName="DonationAmounts";const ym=e=>{const s=Math.max(0,e),n=Math.floor(s/60).toString().padStart(2,"0"),a=(s%60).toString().padStart(2,"0");return`${n}:${a} minutes`},vm=e=>{switch(e){case"warning":return X.Clock;case"error":return X.AlertCircle;case"success":return X.CheckCircle;default:return X.Clock}},jm=e=>{switch(e){case"primary":return"bg-primary-500";case"secondary":return"bg-gray-700";case"success":return"bg-green-600";case"warning":return"bg-amber-500";case"danger":return"bg-red-600";default:return"bg-primary-500"}},Ii=h.forwardRef(({timeLeft:e,defaultTimeLeft:s=1200,onTimeChange:n,onExpire:a,variant:r="info",color:i="primary",message:o="Your cart expires in:",showIcon:l=!0,icon:d,position:u="fixed",autoStart:x=!0,formatTime:m=ym,className:p,...f},g)=>{const[v,b]=as(e!==void 0?Math.max(0,e):void 0,Math.max(0,s),n),y=h.useRef(null),N=h.useRef(!1);h.useEffect(()=>()=>{y.current&&clearInterval(y.current)},[]),h.useEffect(()=>{if(!x||v<=0){y.current&&(clearInterval(y.current),y.current=null);return}return y.current=setInterval(()=>{b(A=>A<=1?(y.current&&(clearInterval(y.current),y.current=null),N.current||(N.current=!0,a?.()),0):A-1)},1e3),()=>{y.current&&(clearInterval(y.current),y.current=null)}},[x,v,b,a]),h.useEffect(()=>{v>0&&(N.current=!1)},[v]);const k=d||vm(r),w=jm(i),$={fixed:"fixed top-0 left-0",sticky:"sticky top-0",static:"static"};return t.jsx("div",{ref:g,role:"banner","aria-live":"polite","aria-label":`${o} ${m(v)}`,"data-testid":"expire-cart-timer",className:c.cn("w-full text-white z-50",w,$[u],p),...f,children:t.jsx("div",{className:"container mx-auto px-4 py-3 sm:py-2.5","data-testid":"expire-cart-timer-container",children:t.jsxs("div",{className:"flex items-center justify-between gap-3 sm:gap-4",children:[t.jsxs("div",{className:"flex items-center gap-3 sm:gap-2.5 flex-1 min-w-0","data-testid":"expire-cart-timer-left",children:[l&&t.jsx("div",{className:"flex-shrink-0 w-[0.875rem] h-[0.875rem] sm:w-4 sm:h-4 rounded-full bg-white flex items-center justify-center overflow-hidden","data-testid":"expire-cart-timer-icon-wrapper",children:t.jsx(k,{className:"text-primary-500 sm:text-primary-600","aria-hidden":"true",size:14,"data-testid":"expire-cart-timer-icon"})}),t.jsx("p",{className:"text-sm sm:text-base font-medium text-white","data-testid":"expire-cart-timer-message",children:o})]}),t.jsx("div",{className:"flex-shrink-0","data-testid":"expire-cart-timer-right",children:t.jsx("span",{className:"text-sm sm:text-base font-semibold text-white","aria-label":`Time remaining: ${m(v)}`,"data-testid":"expire-cart-timer-value",children:m(v)})})]})})})});Ii.displayName="ExpireCartTimer";const $t=({icon:e,children:s,testId:n})=>t.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600","data-testid":n,children:[t.jsx(M,{icon:e,width:20,className:"text-default-500"}),t.jsx("span",{children:s})]}),wm=({classes:e="",name:s,imageUrl:n,eventDate:a,eventTime:r,location:i,description:o,showImage:l=!1,compact:d=!1,layout:u="stacked",imageLoading:x="eager",showMoreButtonClassName:m,labels:p})=>{const[f,g]=h.useState(!1),[v,b]=h.useState(!1),y=h.useRef(null);return h.useEffect(()=>{const N=()=>{if(y.current){const k=y.current.scrollHeight>y.current.clientHeight;b(k)}};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[o]),u==="horizontal"?t.jsx(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:t.jsx(c.CardBody,{className:"p-0","data-testid":"event-details-horizontal-layout",children:t.jsxs("div",{className:"flex flex-col items-start gap-5 sm:flex-row sm:gap-8",children:[l&&n&&t.jsx("div",{className:"w-full shrink-0 overflow-hidden rounded-xl aspect-[3/2] sm:w-[360px]","data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[t.jsx("h2",{className:"font-semibold text-2xl text-gray-800","data-testid":"event-details-title",children:s}),t.jsx("h3",{className:"font-semibold text-base text-gray-700","data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx($t,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx($t,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx($t,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(T,{onPress:()=>g(!f),variant:"light",className:c.cn("text-primary",m),size:"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:20}),"data-testid":"event-details-toggle-description",children:f?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})})}):t.jsxs(c.Card,{className:c.cn("border-0 shadow-none",e),"data-testid":"event-details-root",children:[t.jsxs(c.CardHeader,{className:c.cn("pt-2 pb-0 flex-col items-start",d?"space-y-1":"space-y-2"),"data-testid":"event-details-header",children:[l&&n&&t.jsx("div",{className:c.cn("w-full overflow-hidden rounded-xl","aspect-[3/1]"),"data-testid":"event-details-image-wrapper",children:t.jsx(c.Image,{removeWrapper:!0,loading:x,alt:`Event image for ${s}`,className:"w-full h-full object-cover object-center",src:n,"data-testid":"event-details-image"})}),t.jsx("h2",{className:c.cn("font-semibold text-gray-800",d?"text-base":"text-xl"),"data-testid":"event-details-title",children:s})]}),t.jsxs(c.CardBody,{className:c.cn("space-y-3",d?"py-1 space-y-2":"py-3"),"data-testid":"event-details-body",children:[t.jsx("h3",{className:c.cn("font-semibold text-base text-gray-700",d?"text-sm":""),"data-testid":"event-details-info-label",children:p.eventInformation}),t.jsxs("div",{className:"flex flex-wrap gap-4","data-testid":"event-details-info",children:[a&&t.jsx($t,{icon:"solar:calendar-minimalistic-linear",testId:"event-details-date",children:a}),r&&t.jsx($t,{icon:"solar:clock-circle-linear",testId:"event-details-time",children:r}),i&&t.jsx($t,{icon:"solar:map-point-linear",testId:"event-details-location",children:i})]}),o&&t.jsxs("div",{className:"relative","data-testid":"event-details-description-wrapper",children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{ref:y,className:c.cn("text-sm text-gray-700 leading-relaxed transition-all",d?"text-xs":"",!f&&"line-clamp-3"),"data-testid":"event-details-description",dangerouslySetInnerHTML:{__html:o}}),!f&&v&&t.jsx("div",{className:"absolute inset-x-0 -bottom-1 h-8 bg-gradient-to-t from-white via-white/70 to-transparent pointer-events-none","data-testid":"event-details-description-fade"})]}),(v||f)&&t.jsx("div",{className:"flex justify-end mt-1",children:t.jsx(T,{onPress:()=>g(!f),variant:"light",className:c.cn("text-primary",m),size:d?"sm":"md",startContent:t.jsx(M,{icon:f?"solar:eye-closed-linear":"solar:eye-linear",width:d?16:20}),"data-testid":"event-details-toggle-description",children:f?p.showLess||"Hide":p.showMore||"Show"})})]})]})]})};function kn(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Nm(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}const Cm={person:"Person",people:"People",tickets:"Tickets:",soldOut:"Sold Out",maxReached:"Maximum number of tickets allowed reached",ruleBlocked:"Unavailable for selected ticket options",disabled:"Ticket selection is unavailable"},At=e=>typeof e=="number"&&!isNaN(e),ks=({offer:e,quantity:s,defaultQuantity:n=0,onQuantityChange:a,currency:r="USD",locale:i="en-US",labels:o,slots:l,isDisabled:d=!1,buttonVariant:u="bordered",buttonColor:x="default",showCard:m=!0,showDescription:p=!0,showPeopleCount:f=!0,showPrice:g=!0,priceDisplay:v,classNames:b={},"data-testid":y,selectedColor:N="default",selectionMode:k="stepper",compact:w=!1,isSoldOut:$,isMaxReached:A,isRuleBlocked:j,statusTone:D="default",statusLabel:S,disabledReason:_,disabled:F})=>{const L=h.useMemo(()=>({...Cm,...o}),[o]),[P,B]=h.useState(n),H=s!==void 0?s:P,K=!!(d||F),O=w||!!e.compact,ne=k==="press-to-add",G=h.useMemo(()=>typeof $=="boolean"?$:typeof e.isSoldOut=="boolean"?e.isSoldOut:!At(e.totalTicketsSold)||!At(e.ticketsAllowed)?!1:e.totalTicketsSold>=e.ticketsAllowed,[$,e.isSoldOut,e.totalTicketsSold,e.ticketsAllowed]),te=h.useMemo(()=>typeof A=="boolean"?A:typeof e.isMaxReached=="boolean"?e.isMaxReached:G||!At(e.ticketsAllowed)?!1:H>=e.ticketsAllowed-(e.totalTicketsSold??0),[A,e.isMaxReached,G,e.ticketsAllowed,e.totalTicketsSold,H]),Y=h.useMemo(()=>typeof j=="boolean"?j:typeof e.isRuleBlocked=="boolean"?e.isRuleBlocked:!1,[j,e.isRuleBlocked]),ce=_||e.disabledReason,ee=K||G||Y,J=ue=>{if(ee||ue>0&&te)return;const je=Math.max(0,H+ue);s===void 0&&B(je),a?.(e.id,je)},le=h.useMemo(()=>{if(G)return"soldOut";if(Y)return"ruleBlocked";if(K)return"disabled"},[G,Y,K]),U=h.useMemo(()=>D||(G||Y?"danger":te?"warning":"default"),[D,G,Y,te]),z=h.useMemo(()=>{if(le)return le==="ruleBlocked"?S||ce||L.ruleBlocked:le==="soldOut"?S||ce||L.soldOut:le==="disabled"?S||ce||L.disabled:S||L.maxReached},[le,S,ce,L]),Q={soldOut:"danger",ruleBlocked:U,disabled:"default",maxReached:"warning"},Ve={soldOut:"offer-card-sold-out-chip",maxReached:"offer-card-max-reached-chip",ruleBlocked:"offer-card-ruleBlocked-chip",disabled:"offer-card-disabled-chip"},Re=()=>l?.renderName?l.renderName(e.name,e):t.jsx("h2",{"data-testid":"offer-card-name",className:c.cn("text-base font-medium",O&&"text-sm",b.name),children:e.name}),_e=()=>{if(!g)return null;const ue=v?.price??e.price,je=v?.originalPrice,we=kn(ue,i,r);if(l?.renderPrice)return l.renderPrice(ue,we,e);if(At(je)&&At(ue)&&je>ue){const E=kn(je,i,r);return t.jsxs("div",{"data-testid":"offer-card-price",className:c.cn("flex items-center gap-2 mt-1",O&&"mt-0.5",b.price),children:[t.jsxs("span",{className:"sr-only",children:["Original price ",E,", discounted price ",we]}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-original-price",className:c.cn("text-gray-400 line-through text-sm",O&&"text-xs",b.originalPrice),children:E}),t.jsx("span",{"aria-hidden":"true","data-testid":"offer-card-discounted-price",className:c.cn("text-primary text-base font-semibold",O&&"text-sm",b.discountedPrice),children:we})]})}return t.jsx("p",{"data-testid":"offer-card-price",className:c.cn("text-primary text-base mt-1",O&&"text-sm mt-0.5",b.price),children:we})},ae=()=>!p||!e.description?null:l?.renderDescription?l.renderDescription(e.description,e):t.jsx("p",{"data-testid":"offer-card-description",className:c.cn("mb-4 text-sm text-gray-700 leading-relaxed",O&&"mb-2 text-xs text-gray-600",b.description),children:e.description}),ke=()=>{if(!f||!At(e.numberOfPeople)||e.numberOfPeople<=0)return null;const ue=e.numberOfPeople===1?L.person:L.people;return l?.renderPeopleCount?l.renderPeopleCount(e.numberOfPeople,ue,e):t.jsxs("p",{"data-testid":"offer-card-people-count",className:c.cn("text-sm text-gray-600 flex items-center mt-2",O&&"mt-1 text-xs",b.peopleCount),children:[t.jsx(M,{icon:e.numberOfPeople<=1?"solar:user-rounded-outline":"solar:users-group-rounded-outline",width:20,className:"mr-1"}),e.numberOfPeople," ",ue]})},Ue=()=>{const ue=H===0||ee,je=te||ee;return l?.renderQuantitySelector?l.renderQuantitySelector({quantity:H,onIncrement:()=>J(1),onDecrement:()=>J(-1),isDecrementDisabled:ue,isIncrementDisabled:je,isDisabled:ee}):t.jsxs("div",{className:c.cn("flex items-center gap-2",b.quantitySelector),children:[t.jsx(T,{"data-testid":"offer-card-decrement-button",onPress:()=>J(-1),isDisabled:ue,variant:u,color:H>0?N:x,radius:"full",isIconOnly:!0,size:O?"md":"sm","aria-label":"Decrease quantity",children:t.jsx(M,{icon:"gravity-ui:minus",width:16})}),t.jsx("span",{"data-testid":"offer-card-quantity",className:c.cn("min-w-[2rem] text-center font-medium",O&&"text-sm"),children:H}),t.jsx(T,{"data-testid":"offer-card-increment-button",onPress:()=>J(1),isDisabled:je,variant:u,color:H>0?N:x,radius:"full",isIconOnly:!0,size:O?"md":"sm","aria-label":"Increase quantity",children:t.jsx(M,{icon:"gravity-ui:plus",width:16})})]})},rt=(ue,je)=>l?.renderDisabledState?l.renderDisabledState(ue,je):ue==="soldOut"&&l?.renderSoldOut?l.renderSoldOut(je):ue==="maxReached"&&l?.renderMaxReachedAlert?l.renderMaxReachedAlert(je):t.jsx(c.Chip,{"data-testid":Ve[ue],color:Q[ue],variant:ue==="maxReached"?"flat":"solid",className:c.cn("gap-2 px-4",ue==="maxReached"?"h-8":"h-10",ue==="soldOut"&&b.soldOut,ue==="maxReached"&&b.maxReachedAlert,O&&"h-8"),startContent:t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:14}),children:t.jsx("span",{className:"font-medium text-sm",children:je})}),ve=t.jsxs("div",{className:c.cn("grid grid-cols-1 md:grid-cols-1 xl:grid-cols-3 lg:grid-cols-3 items-start",O?"gap-1":"gap-2"),children:[t.jsxs("div",{className:c.cn("h-full col-span-2",ee||te?"opacity-50 pointer-events-none select-none":""),children:[Re(),_e(),t.jsxs("div",{className:c.cn("md:col-span-1 xl:col-span-2 lg:col-span-1",O?"mb-1":"mb-2"),children:[ke(),ae()]})]}),!ne&&t.jsx("div",{className:c.cn("space-x-2 pt-0 pb-2 md:p-2 h-full flex items-center justify-start md:justify-start lg:justify-end",O&&"space-x-1 pb-1 md:p-1",b.compactFooter),children:le&&z?rt(le,z):Ue()})]}),He=te&&!G&&!Y&&!K?t.jsx(Be.motion.div,{className:c.cn("w-full sm:max-w-[60%] md:max-w-[60%] lg:max-w-[60%]",b.compactFooter),initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:rt("maxReached",z||L.maxReached)}):null;return m?t.jsxs(c.Card,{className:c.cn("w-full",ne&&!ee&&!te&&"cursor-pointer",O&&b.compact,b.base),"data-testid":y||`offer-card-${e.id}`,isPressable:ne&&!ee&&!te,onPress:ne&&!ee&&!te?()=>J(1):void 0,children:[t.jsx(c.CardBody,{className:c.cn("pt-1 pb-0",O?"pb-0.5":"",b.body),children:ve}),t.jsx(Be.AnimatePresence,{children:He&&t.jsx(c.CardFooter,{className:c.cn("w-full mt-0 pt-0",O?"pt-1":"",b.footer),children:He})})]}):t.jsxs("div",{className:c.cn("w-full",O&&b.compact,b.base),"data-testid":y||`offer-card-${e.id}`,children:[t.jsx("div",{className:c.cn("pt-1 pb-0",O?"pb-0.5":"",b.body),children:ve}),t.jsx(Be.AnimatePresence,{children:He&&t.jsx("div",{className:c.cn("w-full mt-0 pt-0",O?"pt-1":"",b.footer),children:He})})]})};ks.displayName="OfferCard";const Ti=({message:e="No offers available.",icon:s="solar:ticket-sale-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i){const l=i();return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:l})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:l})}const o=t.jsxs("div",{"data-testid":"offer-card-empty-content",className:c.cn("flex flex-col items-center justify-center p-8 text-center text-gray-500",r.content),children:[t.jsx(M,{"data-testid":"offer-card-empty-icon",icon:s,width:n,className:c.cn("mb-4",r.icon)}),t.jsx("h3",{"data-testid":"offer-card-empty-message",className:c.cn("text-lg",r.message),children:e})]});return a?t.jsx(c.Card,{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-empty-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-empty",className:c.cn("w-full",r.base),children:o})};Ti.displayName="OfferCardEmpty";const km={title:"Error Fetching Offers",description:"An error occurred while fetching offers."},Oi=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...km,...s},o=t.jsx(c.Alert,{"data-testid":"offer-card-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{"data-testid":"offer-card-error-body",children:o})}):t.jsx("div",{"data-testid":"offer-card-error",className:c.cn("w-full",r.base),children:o})};Oi.displayName="OfferCardError";const Sm={1:"space-y-1",2:"space-y-2",3:"space-y-3",4:"space-y-4",5:"space-y-5",6:"space-y-6"},zi=({quantity:e=2,gap:s=4,classNames:n={}})=>{const a=Sm[s];return t.jsx("div",{"data-testid":"offer-card-skeleton-container",className:c.cn(a,n.base),children:Array.from({length:e}).map((r,i)=>t.jsxs(c.Card,{"data-testid":`offer-card-skeleton-${i}`,className:c.cn("w-full",n.card),children:[t.jsx(c.CardHeader,{"data-testid":`offer-card-skeleton-header-${i}`,className:"flex justify-between items-start pb-0",children:t.jsxs("div",{className:"space-y-2 w-full",children:[t.jsx(ie,{"data-testid":`offer-card-skeleton-title-${i}`,className:"w-1/3 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})}),t.jsx(ie,{"data-testid":`offer-card-skeleton-subtitle-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-3 bg-default-300 rounded-lg"})})]})}),t.jsx(c.CardBody,{"data-testid":`offer-card-skeleton-body-${i}`,className:"pt-2 pb-0",children:t.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-2 items-start",children:[t.jsxs("div",{className:"xl:col-span-2 space-y-2",children:[t.jsx(ie,{"data-testid":`offer-card-skeleton-people-${i}`,className:"w-1/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-300 rounded-lg"})}),t.jsx(ie,{"data-testid":`offer-card-skeleton-description-${i}`,className:"w-3/4 rounded-lg",children:t.jsx("div",{className:"h-4 bg-default-200 rounded-lg"})})]}),t.jsx("div",{className:"flex items-start justify-end",children:t.jsxs("div",{"data-testid":`offer-card-skeleton-controls-${i}`,className:"flex items-center justify-end gap-2 w-full px-4 py-2",children:[t.jsx(ie,{"data-testid":`offer-card-skeleton-label-${i}`,className:"w-24 h-4 rounded-md bg-default-200"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(ie,{"data-testid":`offer-card-skeleton-btn-dec-${i}`,className:"w-8 h-8 rounded-md bg-default-300"}),t.jsx(ie,{"data-testid":`offer-card-skeleton-btn-qty-${i}`,className:"w-8 h-8 rounded-md bg-default-200"}),t.jsx(ie,{"data-testid":`offer-card-skeleton-btn-inc-${i}`,className:"w-8 h-8 rounded-md bg-default-300"})]})]})})]})})]},i))})};zi.displayName="OfferCardSkeleton";const Bi={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.15,delayChildren:.1}}},Vi={hidden:{opacity:0,y:8},show:{opacity:1,y:0,transition:{duration:.45,ease:"easeOut"}},exit:{opacity:0,y:-5,transition:{duration:.35,ease:"easeIn"}}},$m={1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",5:"gap-5",6:"gap-6"},Ui=({offers:e=[],mapOffer:s,selection:n,defaultSelection:a={},onSelectionChange:r,onQuantityChange:i,currency:o="USD",locale:l="en-US",labels:d,slots:u,isDisabled:x=!1,buttonVariant:m="bordered",buttonColor:p="default",showCard:f=!0,animated:g=!0,gap:v=2,compact:b=!1,classNames:y={}})=>{const[N,k]=h.useState(a),w=n!==void 0?n:N,$=h.useCallback((F,L)=>{const P={...w,[F]:Math.max(0,L)};n===void 0&&k(P),r?.(P),i?.(F,P[F])},[w,n,r,i]),A=[...e].sort((F,L)=>(F.position??0)-(L.position??0)),j=F=>{const L=s?s(F):F,P=(w??{})[L.id]||0;return{offer:L,quantity:P,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:p,showCard:f,compact:b}},D=$m[v],S=c.cn("grid mx-auto pt-2",D,y.base),_=F=>{const L=j(F);return t.jsx(ks,{offer:L.offer,quantity:L.quantity,onQuantityChange:L.onQuantityChange,currency:L.currency,locale:L.locale,labels:L.labels,slots:L.slots,isDisabled:L.isDisabled,buttonVariant:L.buttonVariant,buttonColor:L.buttonColor,showCard:L.showCard,compact:L.compact,classNames:y.card},L.offer.id)};return g?t.jsx(Be.motion.div,{"data-testid":"offer-card-list",className:S,variants:Bi,initial:"hidden",animate:"show",children:t.jsx(Be.AnimatePresence,{children:A.map(F=>{const L=j(F);return t.jsx(Be.motion.div,{"data-testid":`offer-card-list-item-${L.offer.id}`,className:y.cardWrapper,variants:Vi,exit:{opacity:0,y:-20},transition:{duration:.3},children:t.jsx(ks,{offer:L.offer,quantity:L.quantity,onQuantityChange:$,currency:o,locale:l,labels:d,slots:u,isDisabled:x,buttonVariant:m,buttonColor:p,showCard:f,compact:b||L.offer.compact,classNames:y.card})},L.offer.id)})})}):t.jsx("div",{"data-testid":"offer-card-list",className:S,children:A.map(_)})};Ui.displayName="OfferCardList";var rs=e=>e.type==="checkbox",wt=e=>e instanceof Date,Ge=e=>e==null;const Hi=e=>typeof e=="object";var De=e=>!Ge(e)&&!Array.isArray(e)&&Hi(e)&&!wt(e),Wi=e=>De(e)&&e.target?rs(e.target)?e.target.checked:e.target.value:e,Am=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,qi=(e,s)=>e.has(Am(s)),Dm=e=>{const s=e.constructor&&e.constructor.prototype;return De(s)&&s.hasOwnProperty("isPrototypeOf")},Gn=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Se(e){if(e instanceof Date)return new Date(e);const s=typeof FileList<"u"&&e instanceof FileList;if(Gn&&(e instanceof Blob||s))return e;const n=Array.isArray(e);if(!n&&!(De(e)&&Dm(e)))return e;const a=n?[]:Object.create(Object.getPrototypeOf(e));for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(a[r]=Se(e[r]));return a}var Os=e=>/^\w*$/.test(e),be=e=>e===void 0,Kn=e=>Array.isArray(e)?e.filter(Boolean):[],Yn=e=>Kn(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,s,n)=>{if(!s||!De(e))return n;const a=(Os(s)?[s]:Yn(s)).reduce((r,i)=>Ge(r)?r:r[i],e);return be(a)||a===e?be(e[s])?n:e[s]:a},Ye=e=>typeof e=="boolean",ze=e=>typeof e=="function",pe=(e,s,n)=>{let a=-1;const r=Os(s)?[s]:Yn(s),i=r.length,o=i-1;for(;++a<i;){const l=r[a];let d=n;if(a!==o){const u=e[l];d=De(u)||Array.isArray(u)?u:isNaN(+r[a+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;e[l]=d,e=e[l]}};const Ss={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},st={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ot={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Gi=h.createContext(null);Gi.displayName="HookFormControlContext";const Qn=()=>h.useContext(Gi);var Ki=(e,s,n,a=!0)=>{const r={defaultValues:s._defaultValues};for(const i in e)Object.defineProperty(r,i,{get:()=>{const o=i;return s._proxyFormState[o]!==st.all&&(s._proxyFormState[o]=!a||st.all),n&&(n[o]=!0),e[o]}});return r};const Zn=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Em(e){const s=Qn(),{control:n=s,disabled:a,name:r,exact:i}=e||{},[o,l]=h.useState(n._formState),d=h.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Zn(()=>n._subscribe({name:r,formState:d.current,exact:i,callback:u=>{!a&&l({...n._formState,...u})}}),[r,a,i]),h.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),h.useMemo(()=>Ki(o,n,d.current,!1),[o,n])}var Ze=e=>typeof e=="string",Sn=(e,s,n,a,r)=>Ze(e)?(a&&s.watch.add(e),q(n,e,r)):Array.isArray(e)?e.map(i=>(a&&s.watch.add(i),q(n,i))):(a&&(s.watchAll=!0),n),$n=e=>Ge(e)||!Hi(e);function nt(e,s,n=new WeakSet){if($n(e)||$n(s))return Object.is(e,s);if(wt(e)&&wt(s))return Object.is(e.getTime(),s.getTime());const a=Object.keys(e),r=Object.keys(s);if(a.length!==r.length)return!1;if(n.has(e)||n.has(s))return!0;n.add(e),n.add(s);for(const i of a){const o=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const l=s[i];if(wt(o)&&wt(l)||De(o)&&De(l)||Array.isArray(o)&&Array.isArray(l)?!nt(o,l,n):!Object.is(o,l))return!1}}return!0}function Lm(e){const s=Qn(),{control:n=s,name:a,defaultValue:r,disabled:i,exact:o,compute:l}=e||{},d=h.useRef(r),u=h.useRef(l),x=h.useRef(void 0),m=h.useRef(n),p=h.useRef(a);u.current=l;const[f,g]=h.useState(()=>{const w=n._getWatch(a,d.current);return u.current?u.current(w):w}),v=h.useCallback(w=>{const $=Sn(a,n._names,w||n._formValues,!1,d.current);return u.current?u.current($):$},[n._formValues,n._names,a]),b=h.useCallback(w=>{if(!i){const $=Sn(a,n._names,w||n._formValues,!1,d.current);if(u.current){const A=u.current($);nt(A,x.current)||(g(A),x.current=A)}else g($)}},[n._formValues,n._names,i,a]);Zn(()=>((m.current!==n||!nt(p.current,a))&&(m.current=n,p.current=a,b()),n._subscribe({name:a,formState:{values:!0},exact:o,callback:w=>{b(w.values)}})),[n,o,a,b]),h.useEffect(()=>n._removeUnmounted());const y=m.current!==n,N=p.current,k=h.useMemo(()=>{if(i)return null;const w=!y&&!nt(N,a);return y||w?v():null},[i,y,a,N,v]);return k!==null?k:f}function Fm(e){const s=Qn(),{name:n,disabled:a,control:r=s,shouldUnregister:i,defaultValue:o,exact:l=!0}=e,d=qi(r._names.array,n),u=h.useMemo(()=>q(r._formValues,n,q(r._defaultValues,n,o)),[r,n,o]),x=Lm({control:r,name:n,defaultValue:u,exact:l}),m=Em({control:r,name:n,exact:l}),p=h.useRef(e),f=h.useRef(void 0),g=h.useRef(r.register(n,{...e.rules,value:x,...Ye(e.disabled)?{disabled:e.disabled}:{}}));p.current=e;const v=h.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!q(m.errors,n)},isDirty:{enumerable:!0,get:()=>!!q(m.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!q(m.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!q(m.validatingFields,n)},error:{enumerable:!0,get:()=>q(m.errors,n)}}),[m,n]),b=h.useCallback(w=>g.current.onChange({target:{value:Wi(w),name:n},type:Ss.CHANGE}),[n]),y=h.useCallback(()=>g.current.onBlur({target:{value:q(r._formValues,n),name:n},type:Ss.BLUR}),[n,r._formValues]),N=h.useCallback(w=>{const $=q(r._fields,n);$&&$._f&&w&&($._f.ref={focus:()=>ze(w.focus)&&w.focus(),select:()=>ze(w.select)&&w.select(),setCustomValidity:A=>ze(w.setCustomValidity)&&w.setCustomValidity(A),reportValidity:()=>ze(w.reportValidity)&&w.reportValidity()})},[r._fields,n]),k=h.useMemo(()=>({name:n,value:x,...Ye(a)||m.disabled?{disabled:m.disabled||a}:{},onChange:b,onBlur:y,ref:N}),[n,a,m.disabled,b,y,N,x]);return h.useEffect(()=>{const w=r._options.shouldUnregister||i,$=f.current;$&&$!==n&&!d&&r.unregister($),r.register(n,{...p.current.rules,...Ye(p.current.disabled)?{disabled:p.current.disabled}:{}});const A=(j,D)=>{const S=q(r._fields,j);S&&S._f&&(S._f.mount=D)};if(A(n,!0),w){const j=Se(q(r._options.defaultValues,n,p.current.defaultValue));pe(r._defaultValues,n,j),be(q(r._formValues,n))&&pe(r._formValues,n,j)}return!d&&r.register(n),f.current=n,()=>{(d?w&&!r._state.action:w)?r.unregister(n):A(n,!1)}},[n,r,d,i]),h.useEffect(()=>{r._setDisabledField({disabled:a,name:n})},[a,n,r]),h.useMemo(()=>({field:k,formState:m,fieldState:v}),[k,m,v])}const Rm=h.createContext(null);Rm.displayName="HookFormContext";var _m=(e,s,n,a,r)=>s?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[a]:r||!0}}:{},Zt=e=>Array.isArray(e)?e:[e],Qa=()=>{let e=[];return{get observers(){return e},next:r=>{for(const i of e)i.next&&i.next(r)},subscribe:r=>(e.push(r),{unsubscribe:()=>{e=e.filter(i=>i!==r)}}),unsubscribe:()=>{e=[]}}};function Yi(e,s){const n={};for(const a in e)if(e.hasOwnProperty(a)){const r=e[a],i=s[a];if(r&&De(r)&&i){const o=Yi(r,i);De(o)&&(n[a]=o)}else e[a]&&(n[a]=i)}return n}var Oe=e=>De(e)&&!Object.keys(e).length,Xn=e=>e.type==="file",$s=e=>{if(!Gn)return!1;const s=e?e.ownerDocument:0;return e instanceof(s&&s.defaultView?s.defaultView.HTMLElement:HTMLElement)},Qi=e=>e.type==="select-multiple",Jn=e=>e.type==="radio",Mm=e=>Jn(e)||rs(e),sn=e=>$s(e)&&e.isConnected;function Pm(e,s){const n=s.slice(0,-1).length;let a=0;for(;a<n;)e=be(e)?a++:e[s[a++]];return e}function Im(e){for(const s in e)if(e.hasOwnProperty(s)&&!be(e[s]))return!1;return!0}function $e(e,s){const n=Array.isArray(s)?s:Os(s)?[s]:Yn(s),a=n.length===1?e:Pm(e,n),r=n.length-1,i=n[r];return a&&delete a[i],r!==0&&(De(a)&&Oe(a)||Array.isArray(a)&&Im(a))&&$e(e,n.slice(0,-1)),e}var Tm=e=>{for(const s in e)if(ze(e[s]))return!0;return!1};function Zi(e){return Array.isArray(e)||De(e)&&!Tm(e)}function An(e,s={}){for(const n in e){const a=e[n];Zi(a)?(s[n]=Array.isArray(a)?[]:{},An(a,s[n])):be(a)||(s[n]=!0)}return s}function Rt(e,s,n){n||(n=An(s));for(const a in e){const r=e[a];if(Zi(r))be(s)||$n(n[a])?n[a]=An(r,Array.isArray(r)?[]:{}):Rt(r,Ge(s)?{}:s[a],n[a]);else{const i=s[a];n[a]=!nt(r,i)}}return n}const Za={value:!1,isValid:!1},Xa={value:!0,isValid:!0};var Xi=e=>{if(Array.isArray(e)){if(e.length>1){const s=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:s,isValid:!!s.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!be(e[0].attributes.value)?be(e[0].value)||e[0].value===""?Xa:{value:e[0].value,isValid:!0}:Xa:Za}return Za},Ji=(e,{valueAsNumber:s,valueAsDate:n,setValueAs:a})=>be(e)?e:s?e===""?NaN:e&&+e:n&&Ze(e)?new Date(e):a?a(e):e;const Ja={isValid:!1,value:null};var el=e=>Array.isArray(e)?e.reduce((s,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:s,Ja):Ja;function er(e){const s=e.ref;return Xn(s)?s.files:Jn(s)?el(e.refs).value:Qi(s)?[...s.selectedOptions].map(({value:n})=>n):rs(s)?Xi(e.refs).value:Ji(be(s.value)?e.ref.value:s.value,e)}var Om=(e,s,n,a)=>{const r={};for(const i of e){const o=q(s,i);o&&pe(r,i,o._f)}return{criteriaMode:n,names:[...e],fields:r,shouldUseNativeValidation:a}},As=e=>e instanceof RegExp,Ut=e=>be(e)?e:As(e)?e.source:De(e)?As(e.value)?e.value.source:e.value:e,tr=e=>({isOnSubmit:!e||e===st.onSubmit,isOnBlur:e===st.onBlur,isOnChange:e===st.onChange,isOnAll:e===st.all,isOnTouch:e===st.onTouched});const sr="AsyncFunction";var zm=e=>!!e&&!!e.validate&&!!(ze(e.validate)&&e.validate.constructor.name===sr||De(e.validate)&&Object.values(e.validate).find(s=>s.constructor.name===sr)),Bm=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),nr=(e,s,n)=>!n&&(s.watchAll||s.watch.has(e)||[...s.watch].some(a=>e.startsWith(a)&&/^\.\w+/.test(e.slice(a.length))));const Xt=(e,s,n,a)=>{for(const r of n||Object.keys(e)){const i=q(e,r);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&s(o.refs[0],r)&&!a)return!0;if(o.ref&&s(o.ref,o.name)&&!a)return!0;if(Xt(l,s))break}else if(De(l)&&Xt(l,s))break}}};function ar(e,s,n){const a=q(e,n);if(a||Os(n))return{error:a,name:n};const r=n.split(".");for(;r.length;){const i=r.join("."),o=q(s,i),l=q(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};r.pop()}return{name:n}}var Vm=(e,s,n,a)=>{n(e);const{name:r,...i}=e;return Oe(i)||Object.keys(i).length>=Object.keys(s).length||Object.keys(i).find(o=>s[o]===(!a||st.all))},Um=(e,s,n)=>!e||!s||e===s||Zt(e).some(a=>a&&(n?a===s:a.startsWith(s)||s.startsWith(a))),Hm=(e,s,n,a,r)=>r.isOnAll?!1:!n&&r.isOnTouch?!(s||e):(n?a.isOnBlur:r.isOnBlur)?!e:(n?a.isOnChange:r.isOnChange)?e:!0,Wm=(e,s)=>!Kn(q(e,s)).length&&$e(e,s),qm=(e,s,n)=>{const a=Zt(q(e,n));return pe(a,"root",s[n]),pe(e,n,a),e};function rr(e,s,n="validate"){if(Ze(e)||Array.isArray(e)&&e.every(Ze)||Ye(e)&&!e)return{type:n,message:Ze(e)?e:"",ref:s}}var Dt=e=>De(e)&&!As(e)?e:{value:e,message:""},ir=async(e,s,n,a,r,i)=>{const{ref:o,refs:l,required:d,maxLength:u,minLength:x,min:m,max:p,pattern:f,validate:g,name:v,valueAsNumber:b,mount:y}=e._f,N=q(n,v);if(!y||s.has(v))return{};const k=l?l[0]:o,w=L=>{r&&k.reportValidity&&(k.setCustomValidity(Ye(L)?"":L||""),k.reportValidity())},$={},A=Jn(o),j=rs(o),D=A||j,S=(b||Xn(o))&&be(o.value)&&be(N)||$s(o)&&o.value===""||N===""||Array.isArray(N)&&!N.length,_=_m.bind(null,v,a,$),F=(L,P,B,H=ot.maxLength,K=ot.minLength)=>{const O=L?P:B;$[v]={type:L?H:K,message:O,ref:o,..._(L?H:K,O)}};if(i?!Array.isArray(N)||!N.length:d&&(!D&&(S||Ge(N))||Ye(N)&&!N||j&&!Xi(l).isValid||A&&!el(l).isValid)){const{value:L,message:P}=Ze(d)?{value:!!d,message:d}:Dt(d);if(L&&($[v]={type:ot.required,message:P,ref:k,..._(ot.required,P)},!a))return w(P),$}if(!S&&(!Ge(m)||!Ge(p))){let L,P;const B=Dt(p),H=Dt(m);if(!Ge(N)&&!isNaN(N)){const K=o.valueAsNumber||N&&+N;Ge(B.value)||(L=K>B.value),Ge(H.value)||(P=K<H.value)}else{const K=o.valueAsDate||new Date(N),O=te=>new Date(new Date().toDateString()+" "+te),ne=o.type=="time",G=o.type=="week";Ze(B.value)&&N&&(L=ne?O(N)>O(B.value):G?N>B.value:K>new Date(B.value)),Ze(H.value)&&N&&(P=ne?O(N)<O(H.value):G?N<H.value:K<new Date(H.value))}if((L||P)&&(F(!!L,B.message,H.message,ot.max,ot.min),!a))return w($[v].message),$}if((u||x)&&!S&&(Ze(N)||i&&Array.isArray(N))){const L=Dt(u),P=Dt(x),B=!Ge(L.value)&&N.length>+L.value,H=!Ge(P.value)&&N.length<+P.value;if((B||H)&&(F(B,L.message,P.message),!a))return w($[v].message),$}if(f&&!S&&Ze(N)){const{value:L,message:P}=Dt(f);if(As(L)&&!N.match(L)&&($[v]={type:ot.pattern,message:P,ref:o,..._(ot.pattern,P)},!a))return w(P),$}if(g){if(ze(g)){const L=await g(N,n),P=rr(L,k);if(P&&($[v]={...P,..._(ot.validate,P.message)},!a))return w(P.message),$}else if(De(g)){let L={};for(const P in g){if(!Oe(L)&&!a)break;const B=rr(await g[P](N,n),k,P);B&&(L={...B,..._(P,B.message)},w(B.message),a&&($[v]=L))}if(!Oe(L)&&($[v]={ref:k,...L},!a))return $}}return w(!0),$};const Gm={mode:st.onSubmit,reValidateMode:st.onChange,shouldFocusError:!0};function Km(e={}){let s={...Gm,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:ze(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},a={},r=De(s.defaultValues)||De(s.values)?Se(s.defaultValues||s.values)||{}:{},i=s.shouldUnregister?{}:Se(r),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,u=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...x};let p={...m};const f={array:Qa(),state:Qa()},g=s.criteriaMode===st.all,v=C=>E=>{clearTimeout(u),u=setTimeout(C,E)},b=async C=>{if(!o.keepIsValid&&!s.disabled&&(m.isValid||p.isValid||C)){let E;s.resolver?(E=Oe((await D()).errors),y()):E=await _(a,!0),E!==n.isValid&&f.state.next({isValid:E})}},y=(C,E)=>{!s.disabled&&(m.isValidating||m.validatingFields||p.isValidating||p.validatingFields)&&((C||Array.from(l.mount)).forEach(R=>{R&&(E?pe(n.validatingFields,R,E):$e(n.validatingFields,R))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Oe(n.validatingFields)}))},N=(C,E=[],R,W,V=!0,I=!0)=>{if(W&&R&&!s.disabled){if(o.action=!0,I&&Array.isArray(q(a,C))){const Z=R(q(a,C),W.argA,W.argB);V&&pe(a,C,Z)}if(I&&Array.isArray(q(n.errors,C))){const Z=R(q(n.errors,C),W.argA,W.argB);V&&pe(n.errors,C,Z),Wm(n.errors,C)}if((m.touchedFields||p.touchedFields)&&I&&Array.isArray(q(n.touchedFields,C))){const Z=R(q(n.touchedFields,C),W.argA,W.argB);V&&pe(n.touchedFields,C,Z)}(m.dirtyFields||p.dirtyFields)&&(n.dirtyFields=Rt(r,i)),f.state.next({name:C,isDirty:L(C,E),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pe(i,C,E)},k=(C,E)=>{pe(n.errors,C,E),f.state.next({errors:n.errors})},w=C=>{n.errors=C,f.state.next({errors:n.errors,isValid:!1})},$=(C,E,R,W)=>{const V=q(a,C);if(V){const I=q(i,C,be(R)?q(r,C):R);be(I)||W&&W.defaultChecked||E?pe(i,C,E?I:er(V._f)):H(C,I),o.mount&&!o.action&&b()}},A=(C,E,R,W,V)=>{let I=!1,Z=!1;const me={name:C};if(!s.disabled){if(!R||W){(m.isDirty||p.isDirty)&&(Z=n.isDirty,n.isDirty=me.isDirty=L(),I=Z!==me.isDirty);const fe=nt(q(r,C),E);Z=!!q(n.dirtyFields,C),fe?$e(n.dirtyFields,C):pe(n.dirtyFields,C,!0),me.dirtyFields=n.dirtyFields,I=I||(m.dirtyFields||p.dirtyFields)&&Z!==!fe}if(R){const fe=q(n.touchedFields,C);fe||(pe(n.touchedFields,C,R),me.touchedFields=n.touchedFields,I=I||(m.touchedFields||p.touchedFields)&&fe!==R)}I&&V&&f.state.next(me)}return I?me:{}},j=(C,E,R,W)=>{const V=q(n.errors,C),I=(m.isValid||p.isValid)&&Ye(E)&&n.isValid!==E;if(s.delayError&&R?(d=v(()=>k(C,R)),d(s.delayError)):(clearTimeout(u),d=null,R?pe(n.errors,C,R):$e(n.errors,C)),(R?!nt(V,R):V)||!Oe(W)||I){const Z={...W,...I&&Ye(E)?{isValid:E}:{},errors:n.errors,name:C};n={...n,...Z},f.state.next(Z)}},D=async C=>(y(C,!0),await s.resolver(i,s.context,Om(C||l.mount,a,s.criteriaMode,s.shouldUseNativeValidation))),S=async C=>{const{errors:E}=await D(C);if(y(C),C)for(const R of C){const W=q(E,R);W?pe(n.errors,R,W):$e(n.errors,R)}else n.errors=E;return E},_=async(C,E,R={valid:!0})=>{for(const W in C){const V=C[W];if(V){const{_f:I,...Z}=V;if(I){const me=l.array.has(I.name),fe=V._f&&zm(V._f);fe&&m.validatingFields&&y([I.name],!0);const Ie=await ir(V,l.disabled,i,g,s.shouldUseNativeValidation&&!E,me);if(fe&&m.validatingFields&&y([I.name]),Ie[I.name]&&(R.valid=!1,E||e.shouldUseNativeValidation))break;!E&&(q(Ie,I.name)?me?qm(n.errors,Ie,I.name):pe(n.errors,I.name,Ie[I.name]):$e(n.errors,I.name))}!Oe(Z)&&await _(Z,E,R)}}return R.valid},F=()=>{for(const C of l.unMount){const E=q(a,C);E&&(E._f.refs?E._f.refs.every(R=>!sn(R)):!sn(E._f.ref))&&Q(C)}l.unMount=new Set},L=(C,E)=>!s.disabled&&(C&&E&&pe(i,C,E),!nt(Y(),r)),P=(C,E,R)=>Sn(C,l,{...o.mount?i:be(E)?r:Ze(C)?{[C]:E}:E},R,E),B=C=>Kn(q(o.mount?i:r,C,s.shouldUnregister?q(r,C,[]):[])),H=(C,E,R={})=>{const W=q(a,C);let V=E;if(W){const I=W._f;I&&(!I.disabled&&pe(i,C,Ji(E,I)),V=$s(I.ref)&&Ge(E)?"":E,Qi(I.ref)?[...I.ref.options].forEach(Z=>Z.selected=V.includes(Z.value)):I.refs?rs(I.ref)?I.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(V)?Z.checked=!!V.find(me=>me===Z.value):Z.checked=V===Z.value||!!V)}):I.refs.forEach(Z=>Z.checked=Z.value===V):Xn(I.ref)?I.ref.value="":(I.ref.value=V,I.ref.type||f.state.next({name:C,values:Se(i)})))}(R.shouldDirty||R.shouldTouch)&&A(C,V,R.shouldTouch,R.shouldDirty,!0),R.shouldValidate&&te(C)},K=(C,E,R)=>{for(const W in E){if(!E.hasOwnProperty(W))return;const V=E[W],I=C+"."+W,Z=q(a,I);(l.array.has(C)||De(V)||Z&&!Z._f)&&!wt(V)?K(I,V,R):H(I,V,R)}},O=(C,E,R={})=>{const W=q(a,C),V=l.array.has(C),I=Se(E);pe(i,C,I),V?(f.array.next({name:C,values:Se(i)}),(m.isDirty||m.dirtyFields||p.isDirty||p.dirtyFields)&&R.shouldDirty&&f.state.next({name:C,dirtyFields:Rt(r,i),isDirty:L(C,I)})):W&&!W._f&&!Ge(I)?K(C,I,R):H(C,I,R),nr(C,l)?f.state.next({...n,name:C,values:Se(i)}):f.state.next({name:o.mount?C:void 0,values:Se(i)})},ne=async C=>{o.mount=!0;const E=C.target;let R=E.name,W=!0;const V=q(a,R),I=fe=>{W=Number.isNaN(fe)||wt(fe)&&isNaN(fe.getTime())||nt(fe,q(i,R,fe))},Z=tr(s.mode),me=tr(s.reValidateMode);if(V){let fe,Ie;const bt=E.type?er(V._f):Wi(C),ft=C.type===Ss.BLUR||C.type===Ss.FOCUS_OUT,hc=!Bm(V._f)&&!s.resolver&&!q(n.errors,R)&&!V._f.deps||Hm(ft,q(n.touchedFields,R),n.isSubmitted,me,Z),Ws=nr(R,l,ft);pe(i,R,bt),ft?(!E||!E.readOnly)&&(V._f.onBlur&&V._f.onBlur(C),d&&d(0)):V._f.onChange&&V._f.onChange(C);const qs=A(R,bt,ft),bc=!Oe(qs)||Ws;if(!ft&&f.state.next({name:R,type:C.type,values:Se(i)}),hc)return(m.isValid||p.isValid)&&(s.mode==="onBlur"?ft&&b():ft||b()),bc&&f.state.next({name:R,...Ws?{}:qs});if(!ft&&Ws&&f.state.next({...n}),s.resolver){const{errors:wa}=await D([R]);if(y([R]),I(bt),W){const gc=ar(n.errors,a,R),Na=ar(wa,a,gc.name||R);fe=Na.error,R=Na.name,Ie=Oe(wa)}}else y([R],!0),fe=(await ir(V,l.disabled,i,g,s.shouldUseNativeValidation))[R],y([R]),I(bt),W&&(fe?Ie=!1:(m.isValid||p.isValid)&&(Ie=await _(a,!0)));W&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&te(V._f.deps),j(R,Ie,fe,qs))}},G=(C,E)=>{if(q(n.errors,E)&&C.focus)return C.focus(),1},te=async(C,E={})=>{let R,W;const V=Zt(C);if(s.resolver){const I=await S(be(C)?C:V);R=Oe(I),W=C?!V.some(Z=>q(I,Z)):R}else C?(W=(await Promise.all(V.map(async I=>{const Z=q(a,I);return await _(Z&&Z._f?{[I]:Z}:Z)}))).every(Boolean),!(!W&&!n.isValid)&&b()):W=R=await _(a);return f.state.next({...!Ze(C)||(m.isValid||p.isValid)&&R!==n.isValid?{}:{name:C},...s.resolver||!C?{isValid:R}:{},errors:n.errors}),E.shouldFocus&&!W&&Xt(a,G,C?V:l.mount),W},Y=(C,E)=>{let R={...o.mount?i:r};return E&&(R=Yi(E.dirtyFields?n.dirtyFields:n.touchedFields,R)),be(C)?R:Ze(C)?q(R,C):C.map(W=>q(R,W))},ce=(C,E)=>({invalid:!!q((E||n).errors,C),isDirty:!!q((E||n).dirtyFields,C),error:q((E||n).errors,C),isValidating:!!q(n.validatingFields,C),isTouched:!!q((E||n).touchedFields,C)}),ee=C=>{C&&Zt(C).forEach(E=>$e(n.errors,E)),f.state.next({errors:C?n.errors:{}})},J=(C,E,R)=>{const W=(q(a,C,{_f:{}})._f||{}).ref,V=q(n.errors,C)||{},{ref:I,message:Z,type:me,...fe}=V;pe(n.errors,C,{...fe,...E,ref:W}),f.state.next({name:C,errors:n.errors,isValid:!1}),R&&R.shouldFocus&&W&&W.focus&&W.focus()},le=(C,E)=>ze(C)?f.state.subscribe({next:R=>"values"in R&&C(P(void 0,E),R)}):P(C,E,!0),U=C=>f.state.subscribe({next:E=>{Um(C.name,E.name,C.exact)&&Vm(E,C.formState||m,ue,C.reRenderRoot)&&C.callback({values:{...i},...n,...E,defaultValues:r})}}).unsubscribe,z=C=>(o.mount=!0,p={...p,...C.formState},U({...C,formState:{...x,...C.formState}})),Q=(C,E={})=>{for(const R of C?Zt(C):l.mount)l.mount.delete(R),l.array.delete(R),E.keepValue||($e(a,R),$e(i,R)),!E.keepError&&$e(n.errors,R),!E.keepDirty&&$e(n.dirtyFields,R),!E.keepTouched&&$e(n.touchedFields,R),!E.keepIsValidating&&$e(n.validatingFields,R),!s.shouldUnregister&&!E.keepDefaultValue&&$e(r,R);f.state.next({values:Se(i)}),f.state.next({...n,...E.keepDirty?{isDirty:L()}:{}}),!E.keepIsValid&&b()},Ve=({disabled:C,name:E})=>{if(Ye(C)&&o.mount||C||l.disabled.has(E)){const V=l.disabled.has(E)!==!!C;C?l.disabled.add(E):l.disabled.delete(E),V&&o.mount&&!o.action&&b()}},Re=(C,E={})=>{let R=q(a,C);const W=Ye(E.disabled)||Ye(s.disabled);return pe(a,C,{...R||{},_f:{...R&&R._f?R._f:{ref:{name:C}},name:C,mount:!0,...E}}),l.mount.add(C),R?Ve({disabled:Ye(E.disabled)?E.disabled:s.disabled,name:C}):$(C,!0,E.value),{...W?{disabled:E.disabled||s.disabled}:{},...s.progressive?{required:!!E.required,min:Ut(E.min),max:Ut(E.max),minLength:Ut(E.minLength),maxLength:Ut(E.maxLength),pattern:Ut(E.pattern)}:{},name:C,onChange:ne,onBlur:ne,ref:V=>{if(V){Re(C,E),R=q(a,C);const I=be(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,Z=Mm(I),me=R._f.refs||[];if(Z?me.find(fe=>fe===I):I===R._f.ref)return;pe(a,C,{_f:{...R._f,...Z?{refs:[...me.filter(sn),I,...Array.isArray(q(r,C))?[{}]:[]],ref:{type:I.type,name:C}}:{ref:I}}}),$(C,!1,void 0,I)}else R=q(a,C,{}),R._f&&(R._f.mount=!1),(s.shouldUnregister||E.shouldUnregister)&&!(qi(l.array,C)&&o.action)&&l.unMount.add(C)}}},_e=()=>s.shouldFocusError&&Xt(a,G,l.mount),ae=C=>{Ye(C)&&(f.state.next({disabled:C}),Xt(a,(E,R)=>{const W=q(a,R);W&&(E.disabled=W._f.disabled||C,Array.isArray(W._f.refs)&&W._f.refs.forEach(V=>{V.disabled=W._f.disabled||C}))},0,!1))},ke=(C,E)=>async R=>{let W;R&&(R.preventDefault&&R.preventDefault(),R.persist&&R.persist());let V=Se(i);if(f.state.next({isSubmitting:!0}),s.resolver){const{errors:I,values:Z}=await D();y(),n.errors=I,V=Se(Z)}else await _(a);if(l.disabled.size)for(const I of l.disabled)$e(V,I);if($e(n.errors,"root"),Oe(n.errors)){f.state.next({errors:{}});try{await C(V,R)}catch(I){W=I}}else E&&await E({...n.errors},R),_e(),setTimeout(_e);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Oe(n.errors)&&!W,submitCount:n.submitCount+1,errors:n.errors}),W)throw W},Ue=(C,E={})=>{q(a,C)&&(be(E.defaultValue)?O(C,Se(q(r,C))):(O(C,E.defaultValue),pe(r,C,Se(E.defaultValue))),E.keepTouched||$e(n.touchedFields,C),E.keepDirty||($e(n.dirtyFields,C),n.isDirty=E.defaultValue?L(C,Se(q(r,C))):L()),E.keepError||($e(n.errors,C),m.isValid&&b()),f.state.next({...n}))},rt=(C,E={})=>{const R=C?Se(C):r,W=Se(R),V=Oe(C),I=V?r:W;if(E.keepDefaultValues||(r=R),!E.keepValues){if(E.keepDirtyValues){const Z=new Set([...l.mount,...Object.keys(Rt(r,i))]);for(const me of Array.from(Z)){const fe=q(n.dirtyFields,me),Ie=q(i,me),bt=q(I,me);fe&&!be(Ie)?pe(I,me,Ie):!fe&&!be(bt)&&O(me,bt)}}else{if(Gn&&be(C))for(const Z of l.mount){const me=q(a,Z);if(me&&me._f){const fe=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if($s(fe)){const Ie=fe.closest("form");if(Ie){Ie.reset();break}}}}if(E.keepFieldsRef)for(const Z of l.mount)O(Z,q(I,Z));else a={}}i=s.shouldUnregister?E.keepDefaultValues?Se(r):{}:Se(I),f.array.next({values:{...I}}),f.state.next({values:{...I}})}l={mount:E.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!m.isValid||!!E.keepIsValid||!!E.keepDirtyValues||!s.shouldUnregister&&!Oe(I),o.watch=!!s.shouldUnregister,o.keepIsValid=!!E.keepIsValid,o.action=!1,E.keepErrors||(n.errors={}),f.state.next({submitCount:E.keepSubmitCount?n.submitCount:0,isDirty:V?!1:E.keepDirty?n.isDirty:!!(E.keepDefaultValues&&!nt(C,r)),isSubmitted:E.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:V?{}:E.keepDirtyValues?E.keepDefaultValues&&i?Rt(r,i):n.dirtyFields:E.keepDefaultValues&&C?Rt(r,C):E.keepDirty?n.dirtyFields:{},touchedFields:E.keepTouched?n.touchedFields:{},errors:E.keepErrors?n.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:r})},ve=(C,E)=>rt(ze(C)?C(i):C,{...s.resetOptions,...E}),He=(C,E={})=>{const R=q(a,C),W=R&&R._f;if(W){const V=W.refs?W.refs[0]:W.ref;V.focus&&setTimeout(()=>{V.focus(),E.shouldSelect&&ze(V.select)&&V.select()})}},ue=C=>{n={...n,...C}},we={control:{register:Re,unregister:Q,getFieldState:ce,handleSubmit:ke,setError:J,_subscribe:U,_runSchema:D,_updateIsValidating:y,_focusError:_e,_getWatch:P,_getDirty:L,_setValid:b,_setFieldArray:N,_setDisabledField:Ve,_setErrors:w,_getFieldArray:B,_reset:rt,_resetDefaultValues:()=>ze(s.defaultValues)&&s.defaultValues().then(C=>{ve(C,s.resetOptions),f.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:ae,_subjects:f,_proxyFormState:m,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(C){o=C},get _defaultValues(){return r},get _names(){return l},set _names(C){l=C},get _formState(){return n},get _options(){return s},set _options(C){s={...s,...C}}},subscribe:z,trigger:te,register:Re,handleSubmit:ke,watch:le,setValue:O,getValues:Y,reset:ve,resetField:Ue,clearErrors:ee,unregister:Q,setError:J,setFocus:He,getFieldState:ce};return{...we,formControl:we}}function Ym(e={}){const s=h.useRef(void 0),n=h.useRef(void 0),[a,r]=h.useState({isDirty:!1,isValidating:!1,isLoading:ze(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ze(e.defaultValues)?void 0:e.defaultValues});if(!s.current)if(e.formControl)s.current={...e.formControl,formState:a},e.defaultValues&&!ze(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:o,...l}=Km(e);s.current={...l,formState:a}}const i=s.current.control;return i._options=e,Zn(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>r({...i._formState}),reRenderRoot:!0});return r(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),h.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),h.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),h.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),h.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),h.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==a.isDirty&&i._subjects.state.next({isDirty:o})}},[i,a.isDirty]),h.useEffect(()=>{var o;e.values&&!nt(e.values,n.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),n.current=e.values,r(l=>({...l}))):i._resetDefaultValues()},[i,e.values]),h.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),s.current.formState=h.useMemo(()=>Ki(a,i),[i,a]),s.current}function Qm(e,s=3){return e%1===0?e.toString():e.toFixed(s).replace(/\.?0+$/,"")}function Zm(e,s="en-US",n="USD"){try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:2,maximumFractionDigits:2}).format(e)}catch(a){return console.warn(`Invalid currency formatting: ${a}`),`${n} ${e.toFixed(2)}`}}function Xm(e="USD",s="en-US"){try{return new Intl.NumberFormat(s,{style:"currency",currency:e}).formatToParts(0).find(i=>i.type==="currency")?.value??"$"}catch{return"$"}}function Jm(e){const s=e.replace(/[^\d.,-]/g,""),n=s.match(/,\d{1,2}$/);let a;n?a=s.replace(/\./g,"").replace(",","."):a=s.replace(/,/g,"");const r=parseFloat(a);return isNaN(r)?null:r}function ef(e,s,n=.001){const a=e-s,r=Math.abs(a)<=n;return{difference:a,isBalanced:r,isUnderAllocated:!r&&a>0,isOverAllocated:!r&&a<0}}function ea(){return`dist-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}ea();const tf={amount:"Amount",glAccount:"GL Account",taxDeductible:"Tax Deductible",amountPlaceholder:"0.00",glAccountPlaceholder:"Search GL Account",noGlAccountsFound:"No GL Accounts found. Try another search term",searching:"Searching for GL Accounts...",amountTooltip:"Enter the amount for this distribution",glAccountTooltip:"Select the General Ledger account for this distribution",taxDeductibleTooltip:"Check if this distribution is tax deductible",deleteButton:"Delete",currencySymbol:"$"},nn=()=>({id:ea(),amount:0,glAccount:null,isTaxDeductible:!1}),tl=({distribution:e,defaultDistribution:s,glAccounts:n=[],isLoadingGlAccounts:a=!1,onSearchGlAccounts:r,onDistributionChange:i,onAmountChange:o,onGlAccountChange:l,onTaxDeductibleChange:d,onDelete:u,canDelete:x=!0,canEditTaxDeductible:m=!0,isDisabled:p=!1,labels:f,classNames:g={},"data-testid":v,control:b,name:y,rules:N})=>{const k={...tf,...f},w=b!==void 0&&y!==void 0,$=Ym({defaultValues:{_internal:s||nn()}}),A=Fm({control:w?b:$.control,name:w?y:"_internal",rules:w?N:void 0}),[j,D]=h.useState(s||nn()),S=w?A.field.value??nn():e??j,_=w&&!!A.fieldState?.error,F=w&&(A.fieldState?.isTouched??!1),L=_||F,P=L&&(!S.amount||S.amount<=0),B=L&&!S.glAccount,[H,K]=h.useState(S.glAccount?.name||""),O=h.useCallback(J=>{const le={...S,...J};w&&A.field.onChange(le),!w&&e===void 0&&D(le),i?.(le)},[S,e,i,w,A]),ne=h.useCallback(J=>{const le=J||0;O({amount:le}),o?.(le)},[O,o]),G=h.useCallback(J=>{K(J),r?.(J)},[r]),te=h.useCallback(J=>{if(J===null){O({glAccount:null}),l?.(null);return}const U=n.find(z=>String(z.id)===String(J))||null;O({glAccount:U}),l?.(U)},[n,O,l]),Y=h.useCallback(()=>{K(""),O({glAccount:null}),l?.(null)},[O,l]),ce=h.useCallback(J=>{O({isTaxDeductible:J}),d?.(J)},[O,d]),ee=h.useCallback(()=>{u?.()},[u]);return t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":v||"revenue-distribution-card",className:c.cn(g.base),children:t.jsxs(c.CardBody,{className:c.cn("flex flex-row flex-nowrap items-start gap-4",g.body),children:[t.jsx("div",{className:c.cn("shrink-0",g.amountContainer),children:t.jsx(c.NumberInput,{"data-testid":`${v||"revenue-distribution-card"}-amount-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.amount,t.jsx(c.Tooltip,{content:k.amountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),value:S.amount||void 0,onValueChange:ne,labelPlacement:"outside",placeholder:k.amountPlaceholder,isWheelDisabled:!0,hideStepper:!0,variant:"bordered",isDisabled:p,isInvalid:P,errorMessage:P?"Amount is required":void 0,minValue:0,step:.01,className:g.amountInput,startContent:t.jsx("div",{className:"pointer-events-none flex items-center",children:t.jsx("span",{className:"text-default-400 text-small",children:k.currencySymbol})})})}),t.jsx("div",{className:c.cn("grow",g.glAccountContainer),children:t.jsx(c.Autocomplete,{"data-testid":`${v||"revenue-distribution-card"}-gl-account-input`,label:t.jsxs("span",{className:"flex items-center gap-1",children:[k.glAccount,t.jsx(c.Tooltip,{content:k.glAccountTooltip,children:t.jsx(M,{icon:"solar:info-circle-linear",className:"text-default-400 cursor-help",width:16})})]}),isLoading:a,isClearable:!0,labelPlacement:"outside",variant:"bordered",items:n,menuTrigger:"input",inputValue:S.glAccount?.name??H,selectedKey:S.glAccount?.id??null,isDisabled:p,isInvalid:B,errorMessage:B?"GL Account is required":void 0,listboxProps:{emptyContent:a?k.searching:k.noGlAccountsFound},placeholder:k.glAccountPlaceholder,onInputChange:G,onSelectionChange:te,onClear:Y,className:g.glAccountInput,children:J=>t.jsx(c.AutocompleteItem,{textValue:J.name,children:t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{children:J.name}),J.code&&t.jsx("span",{className:"text-xs text-default-400",children:J.code})]})},J.id)})}),t.jsx("div",{className:c.cn("shrink-0 pt-6 flex items-center",g.taxDeductibleContainer),children:t.jsx(c.Checkbox,{radius:"full","data-testid":`${v||"revenue-distribution-card"}-tax-deductible`,isSelected:S.isTaxDeductible,onValueChange:ce,isDisabled:p||!m,className:g.taxDeductibleCheckbox,children:k.taxDeductible})}),t.jsx("div",{className:c.cn("shrink-0 pt-6",g.deleteContainer),children:t.jsx(T,{"data-testid":`${v||"revenue-distribution-card"}-delete-button`,size:"sm",color:"danger",variant:"flat",isDisabled:p||!x,onPress:ee,startContent:t.jsx(M,{icon:"solar:trash-bin-trash-linear",width:16}),className:c.cn("text-danger",g.deleteButton),children:k.deleteButton})})]})})};tl.displayName="RevenueDistributionCard";const sl=({message:e="No distributions configured",icon:s="solar:document-text-outline",iconSize:n=48,showCard:a=!0,classNames:r={},renderEmpty:i})=>{if(i)return t.jsx(t.Fragment,{children:i()});const o=t.jsxs("div",{className:c.cn("flex flex-col items-center justify-center py-8",r.content),children:[t.jsx(M,{icon:s,width:n,className:c.cn("text-default-300 mb-4",r.icon)}),t.jsx("p",{className:c.cn("text-default-500 text-sm text-center",r.message),children:e})]});return a?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-empty",className:c.cn("w-full",r.base),children:o})};sl.displayName="RevenueDistributionEmpty";const sf={title:"Error Loading Distributions",description:"An error occurred while loading the distribution configuration. Please try again."},nl=({error:e,labels:s,showCard:n=!0,color:a="danger",classNames:r={}})=>{const i={...sf,...s},o=t.jsx(c.Alert,{"data-testid":"revenue-distribution-error-alert",color:a,title:i.title,description:e||i.description,className:r.alert});return n?t.jsx(c.Card,{radius:"sm",shadow:"sm","data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:t.jsx(c.CardBody,{children:o})}):t.jsx("div",{"data-testid":"revenue-distribution-error",className:c.cn("w-full",r.base),children:o})};nl.displayName="RevenueDistributionError";const al=({rows:e=1,showCard:s=!0,classNames:n={}})=>{const a=Array.from({length:e},(i,o)=>o),r=i=>t.jsxs("div",{className:c.cn("flex flex-row flex-nowrap items-end gap-4",n.row),children:[t.jsxs("div",{className:"shrink-0 flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ie,{className:"h-4 w-14 rounded-md"}),t.jsx(ie,{className:"h-4 w-4 rounded-full"})]}),t.jsx(ie,{className:"h-10 w-32 rounded-lg"})]}),t.jsxs("div",{className:"grow flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ie,{className:"h-4 w-20 rounded-md"}),t.jsx(ie,{className:"h-4 w-4 rounded-full"})]}),t.jsx(ie,{className:"h-10 w-full rounded-lg"})]}),t.jsxs("div",{className:"shrink-0 pb-2 flex items-center gap-2",children:[t.jsx(ie,{className:"h-5 w-5 rounded-full"}),t.jsx(ie,{className:"h-4 w-24 rounded-md"})]}),t.jsx("div",{className:"shrink-0 pb-2",children:t.jsx(ie,{className:"h-8 w-20 rounded-lg"})})]},i);return s?t.jsx("div",{className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>t.jsx(c.Card,{radius:"md",shadow:"sm","data-testid":`revenue-distribution-skeleton-${i}`,children:t.jsx(c.CardBody,{children:r(i)})},i))}):t.jsx("div",{"data-testid":"revenue-distribution-skeleton",className:c.cn("flex flex-col gap-3",n.base),children:a.map(i=>r(i))})};al.displayName="RevenueDistributionSkeleton";function ta({isOpen:e,labels:s,icon:n,isConfirming:a=!1,confirmColor:r="danger",iconTone:i="danger",portalContainer:o,shouldBlockScroll:l,classNames:d,onClose:u,onConfirm:x}){return t.jsx(ns,{isOpen:e,size:"md",placement:"center",portalContainer:o,shouldBlockScroll:l,classNames:{...d,base:c.cn("max-w-[440px] rounded-3xl",d?.base),closeButton:c.cn("right-5 top-5 text-zinc-500",d?.closeButton)},onOpenChange:m=>!m&&u(),children:t.jsxs(c.ModalContent,{children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-start gap-4 px-7 pb-0 pt-7",children:[n&&t.jsx("span",{className:c.cn("flex h-12 w-12 shrink-0 items-center justify-center rounded-full",i==="warning"?"bg-brand/15 text-brand":"bg-danger-100 text-danger-600"),children:n}),t.jsx("span",{className:"text-lg font-semibold leading-6 text-zinc-950",children:s.title})]}),t.jsx(c.ModalBody,{className:"px-7 pb-3 pt-4",children:t.jsx("div",{className:"text-sm leading-6 text-zinc-500",children:s.description})}),t.jsxs(c.ModalFooter,{className:"grid grid-cols-2 gap-3 px-7 pb-7 pt-3",children:[t.jsx(T,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white text-sm font-normal text-zinc-900",onPress:u,children:s.cancel}),t.jsx(T,{type:"button",size:"md",color:r,radius:"full",className:c.cn("h-10 text-sm font-normal text-white",r==="danger"?"bg-danger-600":"bg-brand"),isLoading:a,onPress:x,children:s.confirm})]})]})})}const nf=()=>({id:crypto.randomUUID(),fund:null,percentage:0});function lr(e){return!e.fund&&Number(e.percentage||0)<=0}function af({mode:e,assignments:s}){const n=s.filter(i=>i.fund),a=n.reduce((i,o)=>i+Number(o.percentage||0),0),r=s.some(i=>!i.fund||Number(i.percentage||0)<=0);return n.length>=1&&!r&&Math.round(a*100)/100===100}const rf={title:"Payment assignment",saved:"Saved",singleFund:"Single fund",splitFunds:"Split across multiple funds",saveAssignment:"Save assignment",assignSpecificFund:"Assign specific fund",addFund:"Add account",emptySingle:"You have not assign any specific fund for this opportunity",emptySplit:"Select a fund and assign percentages that total 100%",selectedFund:"Selected fund",percentage:"Percentage",total:"Total",totalError:"Select a fund for each row and enter percentages that total 100%.",removeFund:"Remove fund",modalTitle:"Select an specific fund",searchPlaceholder:"Search...",glCode:"GL Code",accountName:"Specific Fund Name",type:"Type",actions:"Actions",select:"Select",noFunds:"No specific funds available",modifyAssignedFundsTitle:"Modify Assigned Funds",modifyAssignedFundsDescription:"Changing the assigned funds will only affect up and coming payments.",modifyAssignedFundsWarning:"Payments already paid will still keep the previous configuration.",modifyAssignedFundsCancel:"Cancel",modifyAssignedFundsConfirm:"Continue"},rl={base:"min-h-11 rounded-full bg-zinc-100 px-4 py-2 shadow-none",iconWrapper:"!h-4 !w-4 shrink-0 !bg-transparent !shadow-none !border-0 text-zinc-900",alertIcon:"!static !h-4 !w-4 !translate-x-0 !translate-y-0 text-zinc-900",mainWrapper:"min-w-0",title:"text-sm font-normal text-zinc-900"},Ht={...rl,base:"min-h-11 rounded-2xl px-4 py-2 shadow-none",title:"text-sm font-medium"},lf={inputWrapper:"h-9 rounded-xl border border-zinc-200 bg-white shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"},of={wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl"};function cf(){return t.jsxs("svg",{"aria-hidden":"true",className:"size-4 text-zinc-500",fill:"none",viewBox:"0 0 16 16",children:[t.jsx("rect",{x:"3",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"3",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"3",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"}),t.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.4"})]})}const df=e=>Number.isFinite(e)?Math.max(0,Math.min(100,Math.round(e*100)/100)):0,uf=e=>e.fund!==null;function mf({assignments:e,funds:s,labels:n,classNames:a,isSaving:r=!1,hasSavedAssignments:i=!1,showSavedIndicator:o=!1,isCollapsed:l,isFundPickerOpen:d=!1,activeAssignmentId:u=null,modalPortalContainer:x,footer:m,onAssignmentsChange:p,onOpenFundPicker:f,onCloseFundPicker:g,onCollapseChange:v,onSave:b}){const[y,N]=h.useState(null),k=x??y??void 0,w={...rf,...n},$=e.filter(U=>!lr(U)),j=$.filter(uf).length>0,D=h.useMemo(()=>e.filter(U=>!lr(U)).reduce((U,z)=>U+Number(z.percentage||0),0),[e]),S=Math.round(D*100)/100,_=$.some(U=>!U.fund||Number(U.percentage||0)<=0),F=j&&(S!==100||_),L=`${w.totalError} (${w.total} ${Number(D.toFixed(2))}%)`,P=af({mode:"split",assignments:e}),B=j&&S>=100,[H,K]=h.useState(!1),[O,ne]=h.useState(!1),G=t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(cf,{}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:w.title}),o?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:w.saved}):null]}),te=(U,z)=>{p(e.map(Q=>Q.id===U?{...Q,...z}:Q))},Y=()=>{B||p([...e,nf()])},ce=U=>{e.length<=1||p(e.filter(z=>z.id!==U))},ee=()=>{if(!r){if(!P){ne(!0);return}if(!i){b();return}K(!0)}},J=()=>{K(!1),b()},le=U=>{const z=u??e.find(Q=>!Q.fund)?.id??e[0]?.id;z&&(p(e.map(Q=>Q.id===z?{...Q,fund:U}:Q)),g())};return t.jsxs("div",{ref:N,className:c.cn("vvt-pa relative min-w-0 w-full font-sans text-zinc-900 [container-type:inline-size]",d&&!x&&"min-h-[560px]",a?.root),children:[t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:l===void 0?["installment-fund-assignment"]:void 0,selectedKeys:l===void 0?void 0:new Set(l?[]:["installment-fund-assignment"]),className:c.cn("w-full gap-0 px-0",a?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",a?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},onSelectionChange:U=>v?.(!(U==="all"||Array.from(U).length>0)),children:t.jsx(c.AccordionItem,{"aria-label":w.title,title:G,children:t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",a?.content),children:[t.jsxs("div",{className:"flex w-full flex-col gap-4",children:[!j&&t.jsx(c.Alert,{icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,classNames:rl,color:"default",variant:"flat",title:w.emptySplit}),j&&t.jsx(ff,{assignments:e,labels:w,total:D,hasTotalError:O&&!P||F,validationMessage:L,onSelectFund:U=>f(U),onRemoveFund:ce,onPercentageChange:(U,z)=>te(U,{percentage:df(z)})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx(T,{type:"button",size:"lg",color:"default",radius:"full",className:"h-11 bg-zinc-950 px-4 text-lg font-normal text-white disabled:opacity-50 [@container(max-width:479px)]:w-full",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:B,onPress:()=>j?Y():f(),children:w.assignSpecificFund}),t.jsx(T,{type:"button","data-testid":"installment-fund-assignment-save-button",size:"md",color:"primary",radius:"full",className:"ml-auto h-10 min-w-40 px-4 text-sm font-medium [@container(max-width:479px)]:w-full",startContent:r?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:r,isDisabled:!P||r,onPress:ee,children:w.saveAssignment})]})]}),m]})},"installment-fund-assignment")}),d&&t.jsx(xf,{funds:s,labels:w,selectedFundIds:e.map(U=>U.fund?.id).filter(Boolean),portalContainer:k,onSelect:le,onClose:g}),t.jsx(ta,{isOpen:H,labels:{title:w.modifyAssignedFundsTitle,description:t.jsxs(t.Fragment,{children:[t.jsx("p",{children:w.modifyAssignedFundsDescription}),t.jsx("p",{className:"mt-3",children:w.modifyAssignedFundsWarning})]}),cancel:w.modifyAssignedFundsCancel,confirm:w.modifyAssignedFundsConfirm},icon:t.jsx(M,{icon:"solar:info-circle-outline",className:"size-7"}),iconTone:"warning",confirmColor:"primary",portalContainer:k,shouldBlockScroll:!1,classNames:of,onClose:()=>K(!1),onConfirm:J})]})}function ff({assignments:e,labels:s,total:n,hasTotalError:a,validationMessage:r,onSelectFund:i,onRemoveFund:o,onPercentageChange:l}){return t.jsxs("div",{className:"flex flex-col gap-3",children:[e.map((d,u)=>t.jsxs("div",{"data-testid":"installment-fund-assignment-row",className:"flex min-h-15 w-full flex-wrap items-center gap-3 rounded-2xl border border-zinc-200 bg-white px-3 py-2",children:[t.jsx("div",{className:c.cn("flex min-h-11 min-w-0 basis-full items-center gap-2","[@container(min-width:560px)]:basis-0 [@container(min-width:560px)]:flex-1 [@container(min-width:560px)]:gap-4"),children:d.fund?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"min-w-0 break-words rounded-2xl bg-zinc-100 px-4 py-1.5 text-sm text-zinc-950",children:[d.fund.glCode," - ",d.fund.accountName]}),t.jsx(T,{type:"button",variant:"light",color:"primary",radius:"full",className:"flex-none px-2 text-sm font-normal",onPress:()=>i(d.id),children:"Replace"})]}):t.jsx(T,{type:"button",size:"lg",variant:"light",radius:"full",className:"max-w-full justify-start px-4 text-lg font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),onPress:()=>i(d.id),children:s.assignSpecificFund})}),t.jsx("label",{className:"flex min-w-0 flex-1 items-center [@container(min-width:560px)]:w-48 [@container(min-width:560px)]:flex-none",children:t.jsx(c.Input,{variant:"bordered",type:"number",min:0,max:100,step:.01,value:String(d.percentage||""),onChange:x=>l(d.id,Number(x.target.value)),endContent:t.jsx("span",{className:"text-sm text-zinc-500",children:"%"}),classNames:lf})}),e.length>1&&t.jsx(T,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:c.cn("h-10 w-10 flex-none p-0",u===0?"bg-danger-100 text-danger-500 opacity-60":"bg-danger-600 text-white"),style:{height:40,minWidth:40,width:40},isDisabled:u===0,onPress:()=>o(d.id),"aria-label":s.removeFund,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})})]},d.id)),t.jsx(c.Alert,{icon:t.jsx(M,{icon:a?"solar:info-circle-outline":"solar:check-circle-outline",className:"size-4"}),hideIconWrapper:!0,isClosable:!1,color:a?"warning":"success",variant:"flat",classNames:{...Ht,base:c.cn(Ht.base,a?"bg-warning-50 text-warning-700":"bg-success-50 text-success-700"),iconWrapper:c.cn(Ht.iconWrapper,a?"text-warning-700":"text-success-700"),alertIcon:c.cn(Ht.alertIcon,a?"text-warning-700":"text-success-700"),title:c.cn(Ht.title,a?"text-warning-700":"text-success-700")},title:a?r:`${s.total} ${Number(n.toFixed(2))}%`})]})}function xf({funds:e,labels:s,selectedFundIds:n,portalContainer:a,onSelect:r,onClose:i}){const[o,l]=h.useState(""),d=e.filter(u=>{if(n.includes(u.id))return!1;const x=o.trim().toLowerCase();return x?`${u.glCode} ${u.accountName} ${u.type}`.toLowerCase().includes(x):!0});return t.jsx(ns,{isOpen:!0,size:"3xl",placement:"center",scrollBehavior:"inside",shouldBlockScroll:!1,portalContainer:a,classNames:{wrapper:"!absolute !inset-0 !z-50 !h-auto !w-auto !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 !h-auto !w-auto rounded-2xl",base:"max-h-[calc(100%-2rem)] w-full max-w-3xl rounded-3xl",closeButton:"right-6 top-6 text-zinc-500"},onOpenChange:u=>!u&&i(),children:t.jsxs(c.ModalContent,{className:"max-h-full",children:[t.jsx(c.ModalHeader,{className:"px-6 pr-12 pt-6 text-xl font-semibold leading-7 text-zinc-950",children:s.modalTitle}),t.jsxs(c.ModalBody,{className:"flex min-h-0 flex-1 flex-col px-6 pb-6",children:[t.jsx(c.Input,{variant:"bordered","aria-label":s.searchPlaceholder,value:o,placeholder:s.searchPlaceholder,onChange:u=>l(u.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-5 text-zinc-500"}),classNames:{input:"text-sm placeholder:text-zinc-500",inputWrapper:"h-10 rounded-2xl border border-zinc-200 bg-white px-4 shadow-none hover:border-zinc-300 data-[hover=true]:border-zinc-300 group-data-[focus=true]:border-zinc-400 group-data-[focus-visible=true]:ring-0"}}),t.jsxs("div",{className:"mt-4 min-h-0 flex-1 overflow-auto [container-type:inline-size]",children:[t.jsxs("div",{className:"hidden grid-cols-[1fr_1.3fr_0.6fr] gap-5 border-b border-zinc-200 px-3 pb-3 text-sm font-medium leading-5 text-zinc-900 [@container(min-width:520px)]:grid",children:[t.jsx("span",{children:s.glCode}),t.jsx("span",{children:s.accountName}),t.jsx("span",{children:s.actions})]}),d.length===0&&t.jsx("div",{className:"p-4 text-sm text-zinc-500",children:s.noFunds}),d.map(u=>t.jsxs("div",{"data-testid":"installment-fund-picker-row",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 border-b border-zinc-100 px-3 py-2.5 text-sm leading-5 text-zinc-900 last:border-b-0 [@container(min-width:520px)]:grid-cols-[1fr_1.3fr_0.6fr] [@container(min-width:520px)]:gap-5 [@container(min-width:520px)]:border-b-0",children:[t.jsx("span",{className:"col-start-1 row-start-1 font-medium [@container(min-width:520px)]:font-normal",children:u.glCode}),t.jsx("span",{className:"col-start-1 row-start-2 min-w-0 break-words text-zinc-600 [@container(min-width:520px)]:col-start-2 [@container(min-width:520px)]:row-start-1 [@container(min-width:520px)]:text-zinc-900",children:u.accountName}),t.jsx(T,{type:"button",size:"sm",variant:"bordered",radius:"full",className:"col-start-2 row-span-2 row-start-1 h-9 min-w-20 border-zinc-200 bg-white text-sm font-medium text-zinc-900 [@container(min-width:520px)]:col-start-3 [@container(min-width:520px)]:row-span-1 [@container(min-width:520px)]:min-w-24",onPress:()=>r(u),children:s.select})]},u.id))]})]})]})})}function pf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(ie,{className:"h-7 w-56 rounded-lg"}),t.jsx(ie,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ie,{className:"h-10 w-72 rounded-full"}),t.jsx(ie,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(ie,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(ie,{className:"h-8 w-full rounded-xl"})]}),t.jsx(ie,{className:"h-11 w-40 rounded-full"})]})}const hf={totalAmount:"Total Amount:",remainingBalance:"Remaining Balance",amountReceived:"Amount Received:"};function bf({totalAmount:e,remainingBalance:s,amountReceived:n,currency:a="USD",locale:r="en-US",labels:i,className:o}){const l={...hf,...i},d=new Intl.NumberFormat(r,{style:"currency",currency:a});return t.jsx("div",{className:c.cn("w-full rounded-2xl border border-zinc-200 bg-white px-4 py-2.5 font-sans text-base leading-6",o),children:t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-x-5 gap-y-2",children:[t.jsx(an,{label:l.totalAmount,value:d.format(e)}),t.jsx(an,{label:l.remainingBalance,value:d.format(s)}),t.jsx(an,{label:l.amountReceived,value:d.format(n)})]})})}function an({label:e,value:s}){return t.jsxs("div",{className:"flex items-center gap-3 whitespace-nowrap",children:[t.jsx("span",{className:"font-medium text-zinc-700",children:e}),t.jsx("span",{className:"font-normal text-zinc-950",children:s})]})}const gf={monthly:1,quarterly:3,annual:12},il=e=>{const[s,n,a]=e.split("-").map(Number);return{year:s,month:n,day:a}},yf=(e,s)=>new Date(e,s+1,0).getDate(),vf=e=>{const s=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${s}-${n}-${a}`},jf=(e,s)=>{const{year:n,month:a,day:r}=il(e),i=a-1+s,o=n+Math.floor(i/12),l=(i%12+12)%12,d=Math.min(r,yf(o,l));return new Date(o,l,d)},wf=(e,s)=>{const{year:n,month:a,day:r}=il(e),i=new Date(n,a-1,r);return i.setDate(i.getDate()+s),i};function ll(e,s){const n=Math.max(1,Math.floor(s.numberOfInstallments||1)),a=Math.round(e*100),r=Math.floor(a/n),i=a-r*n,o=gf[s.frequency];return Array.from({length:n},(l,d)=>{const u=s.frequency==="weekly"?wf(s.firstInstallmentDate,d*7):jf(s.firstInstallmentDate,d*(o??1));return{id:crypto.randomUUID(),dueDate:vf(u),amount:(r+(d===0?i:0))/100}})}function Nf(e){return new Set(e.map((s,n)=>{const a=e[n+1]?.dueDate;return s.dueDate&&a&&s.dueDate>a?s.id:null}).filter(s=>!!s))}function Cf(e){return{missingDateRows:new Set(e.filter(s=>!s.dueDate).map(s=>s.id)),invalidDateRows:Nf(e),invalidAmountRows:new Set(e.filter(s=>Number(s.amount||0)<=0).map(s=>s.id))}}function kf(e){return e.missingDateRows.size>0||e.invalidDateRows.size>0||e.invalidAmountRows.size>0}function Sf(e,s){const n=e[0];return!n||!s||n.dueDate===s?e:[{...n,dueDate:s},...e.slice(1)]}const $f=new Set(["paid","partially_refunded","refunded"]);function Nt(e){return e!==void 0&&$f.has(e)}const Af={title:"Payments",saved:"Saved",automaticMode:"Auto",manualMode:"Manual",createInstallments:"Create Payments",generateSchedule:"Generate Schedule",saveInstallments:"Save Payments",cancelEdit:"Cancel",addInstallment:"Add Payment",emptyAutomatic:"No payments have been generated for this opportunity",emptyManual:"Add payments with custom dates and amounts",numberOfInstallments:"Number of payments",frequency:"Frequency",dayOfMonth:"Day of month",firstInstallmentDate:"First payment date",installment:"Payment",dueDate:"Due date",amount:"Amount",total:"Total",remaining:"Remaining",deleteInstallment:"Delete installment",weekly:"Weekly",monthly:"Monthly",quarterly:"Quarterly",annual:"Annual",totalError:"Payment total must equal the total amount",totalIncreaseWarning:"Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationTitle:"Update Donation Total",totalIncreaseConfirmationDescription:"The scheduled payments total is greater than the current donation/contribution total. Saving will update the donation/contribution total to match the scheduled payments.",totalIncreaseConfirmationCancel:"Cancel",totalIncreaseConfirmationConfirm:"Save Payments",dateOrderError:"Payment date must be on or before the next payment date.",dueDateRequiredError:"Payment date is required.",amountGreaterThanZeroError:"Payment amount must be greater than 0."},Df=["weekly","monthly","quarterly","annual"],Ef=Array.from({length:31},(e,s)=>s+1),Lf=["numberOfInstallments","frequency","firstInstallmentDate"],or=()=>({id:crypto.randomUUID(),dueDate:new Date().toISOString().slice(0,10),amount:0}),Ds=e=>Math.round(e*100)/100,Ff=(e,s)=>{const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)},zs=e=>{if(!e)return null;try{return mu(e)}catch{return null}},Rf=e=>zs(e)?.day??1,_f=(e,s)=>new Date(e,s,0).getDate(),Mf=(e,s)=>{const n=zs(e);if(!n)return e;const a=Math.min(s,_f(n.year,n.month));return n.set({day:a}).toString()},cr=e=>{const s=e%100>=11&&e%100<=13?"th":e%10===1?"st":e%10===2?"nd":e%10===3?"rd":"th";return`${e}${s}`};function Pf({mode:e,donationAmount:s,currency:n="USD",locale:a="en-US",installments:r,automaticSettings:i,defaultTab:o="automatic",showTitle:l=!0,showCard:d=!0,showSavePayment:u=!0,showTabs:x=!0,inputs:m=Lf,startDate:p,firstInstallmentDateOverride:f,labels:g,classNames:v,isSaving:b=!1,showSavedIndicator:y=!1,isModeSwitchDisabled:N=!1,onModeChange:k,onAutomaticSettingsChange:w,onInstallmentsChange:$,onSave:A,onCancel:j}){const[D,S]=h.useState(o),_={...Af,...g},F=e??D,L=h.useMemo(()=>new Intl.NumberFormat(a,{style:"currency",currency:n}),[n,a]),P=h.useMemo(()=>({...i,firstInstallmentDate:m.includes("firstInstallmentDate")?i.firstInstallmentDate:m.includes("dayOfMonth")?i.firstInstallmentDate||p||"":p||i.firstInstallmentDate}),[i,m,p]),B=F==="automatic"?Sf(ll(s,P),m.includes("firstInstallmentDate")?void 0:f):r,H=h.useMemo(()=>Ds(B.reduce((Q,Ve)=>Q+Number(Ve.amount||0),0)),[B]),K=Math.abs(H-s)>.009,O=Ds(s-H)<=0,ne=h.useMemo(()=>Cf(r),[r]),G=F==="manual"&&kf(ne),te=K||G,Y=l?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:_.title}),y?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:_.saved}):null]}):void 0,ce=Q=>{Q!==F&&(e||S(Q),k?.(Q),Q==="manual"&&r.length===0&&$([or()]))},ee=(Q,Ve)=>{const Re=r.find(_e=>_e.id===Q);Nt(Re?.status)||$(r.map(_e=>_e.id===Q?{..._e,...Ve}:_e))},J=()=>{$([...r,or()])},le=Q=>{const Ve=r.find(Re=>Re.id===Q);Nt(Ve?.status)||$(r.filter(Re=>Re.id!==Q))},U=()=>{b||te||A?.()},z=t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.content),children:[x||u||j?t.jsxs("div",{className:"flex w-full items-center justify-between gap-6",children:[x?t.jsx(If,{mode:F,labels:_,onModeChange:ce,isDisabled:N,className:v?.tabs}):null,t.jsxs("div",{className:"ml-auto flex items-center gap-3",children:[j?t.jsx(T,{type:"button","data-testid":"installment-schedule-cancel-button",size:"md",variant:"bordered",radius:"full",className:"min-w-28",isDisabled:b,onPress:j,children:_.cancelEdit}):null,u?t.jsx(T,{type:"button","data-testid":"installment-schedule-save-button",size:"md",color:"primary",radius:"full",className:"min-w-36",startContent:b?void 0:t.jsx(M,{icon:"solar:cloud-upload-outline",className:"size-4"}),isLoading:b,isDisabled:b||te,onPress:U,children:_.saveInstallments}):null]})]}):null,t.jsxs("div",{className:c.cn("flex w-full flex-col gap-4",v?.preview),children:[F==="automatic"&&t.jsx(Tf,{settings:P,inputs:m,labels:_,className:v?.controls,onSettingsChange:w}),B.length===0&&t.jsx(c.Alert,{isClosable:!1,color:"default",variant:"flat",radius:"full",title:F==="automatic"?_.emptyAutomatic:_.emptyManual}),B.length>0&&t.jsx(Of,{mode:F,installments:B,rowErrors:ne,labels:_,formatter:L,locale:a,onUpdateInstallment:ee,onRemoveInstallment:le}),F==="manual"&&t.jsx("div",{className:"flex flex-wrap gap-3",children:t.jsx(T,{type:"button",size:"md",variant:"bordered",radius:"full",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(X.Plus,{className:"size-5",strokeWidth:2}),isDisabled:O,onPress:J,children:_.addInstallment})}),t.jsx(Uf,{total:H,donationAmount:s,hasTotalMismatch:K,mode:F,installments:B,formatter:L,labels:_,className:v?.summary})]})]});return t.jsx("div",{className:c.cn("vvt-ps relative font-sans text-zinc-900",v?.root),children:d?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-schedule"],className:c.cn("w-full gap-0 px-0",v?.panel),itemClasses:{base:"w-full rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:c.cn("px-4 py-4",v?.header),title:"w-full",content:"w-full px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":_.title,title:Y,children:z},"installment-schedule")}):z})}function If({mode:e,labels:s,className:n,isDisabled:a=!1,onModeChange:r}){return t.jsxs(c.Tabs,{"aria-label":s.title,selectedKey:e,isDisabled:a,color:"primary",size:"lg",radius:"full",className:c.cn("w-fit",n),onSelectionChange:i=>r(i),children:[t.jsx(c.Tab,{title:s.automaticMode},"automatic"),t.jsx(c.Tab,{title:s.manualMode},"manual")]})}function Tf({settings:e,inputs:s,labels:n,className:a,onSettingsChange:r}){const i=o=>{if(o==="numberOfInstallments")return t.jsx("div",{className:"min-w-0",children:t.jsx(c.Input,{variant:"bordered",label:n.numberOfInstallments,labelPlacement:"outside",type:"number",min:1,step:1,value:e.numberOfInstallments>0?String(e.numberOfInstallments):"",onWheel:l=>l.currentTarget.blur(),onChange:l=>{const d=l.target.value;r({...e,numberOfInstallments:d===""?0:Math.max(1,Number(d))})}})},o);if(o==="frequency")return t.jsx("div",{className:"min-w-0",children:t.jsx(at,{variant:"bordered",label:n.frequency,labelPlacement:"outside",selectedKeys:[e.frequency],onSelectionChange:l=>{const d=Array.from(l)[0];typeof d=="string"&&r({...e,frequency:d})},children:Df.map(l=>t.jsx(c.SelectItem,{textValue:n[l],children:n[l]},l))})},o);if(o==="dayOfMonth"){const l=String(Rf(e.firstInstallmentDate));return t.jsx("div",{className:"min-w-0",children:t.jsx(at,{variant:"bordered",label:n.dayOfMonth,labelPlacement:"outside",selectedKeys:[l],onSelectionChange:d=>{const u=Number(Array.from(d)[0]);Number.isFinite(u)&&r({...e,firstInstallmentDate:Mf(e.firstInstallmentDate,u)})},children:Ef.map(d=>t.jsx(c.SelectItem,{textValue:cr(d),children:cr(d)},String(d)))})},o)}return t.jsx("div",{className:"min-w-0",children:t.jsx(Hn,{variant:"bordered",label:n.firstInstallmentDate,labelPlacement:"outside",value:zs(e.firstInstallmentDate),onChange:l=>r({...e,firstInstallmentDate:l?l.toString():""}),startContent:t.jsx(M,{icon:"solar:calendar-outline",className:"size-4 text-zinc-500"})})},o)};return s.length===0?null:t.jsx("div",{className:c.cn("grid gap-4",a),style:{gridTemplateColumns:"repeat(auto-fit, minmax(min(100%, 14rem), 1fr))"},children:s.map(i)})}function Of({mode:e,installments:s,rowErrors:n,labels:a,formatter:r,locale:i,onUpdateInstallment:o,onRemoveInstallment:l}){return e==="automatic"?t.jsx("div",{className:"rounded-2xl border border-zinc-200 bg-zinc-50 p-4",children:t.jsx("div",{className:c.cn("flex flex-col gap-3",s.length>5&&"max-h-[264px] overflow-y-auto pr-2"),children:s.map((d,u)=>t.jsxs("div",{className:c.cn("flex min-h-10 items-center justify-between rounded-xl px-4 py-2 text-base",u===0&&"border border-primary/25 bg-primary/5 text-primary"),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("span",{children:["#",u+1]}),t.jsx("span",{children:"▪"}),t.jsx("span",{children:Ff(d.dueDate,i)}),u===0&&s.length>1&&t.jsx(c.Chip,{size:"sm",color:"primary",variant:"solid",radius:"full",children:"First charge"})]}),t.jsx("span",{className:"text-zinc-950",children:r.format(d.amount)})]},d.id))})}):t.jsx("div",{className:"flex flex-col gap-2",children:s.map((d,u)=>{const x=n.missingDateRows.has(d.id),m=n.invalidDateRows.has(d.id),p=n.invalidAmountRows.has(d.id);return t.jsx("div",{className:"flex w-full flex-col gap-1",children:t.jsxs("div",{className:"grid w-full grid-cols-[2rem_minmax(0,1fr)_minmax(0,1fr)_2.25rem] items-start gap-4",children:[t.jsx("span",{className:"pt-2 text-sm font-medium text-zinc-500",children:u+1}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Hn,{variant:"bordered","aria-label":`${a.dueDate} ${u+1}`,isDisabled:Nt(d.status),isInvalid:x||m,errorMessage:x?a.dueDateRequiredError:m?a.dateOrderError:void 0,value:zs(d.dueDate),onChange:f=>o(d.id,{dueDate:f?f.toString():""})})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsx(Bf,{amount:d.amount,ariaLabel:`${a.amount} ${u+1}`,isDisabled:Nt(d.status),isInvalid:p,errorMessage:a.amountGreaterThanZeroError,onAmountChange:f=>o(d.id,{amount:f})})}),t.jsx(Vf,{isDisabled:s.length<=1,isPaid:Nt(d.status),label:a.deleteInstallment,onRemove:()=>l(d.id)})]})},d.id)})})}const zf=/^\d*(?:[.,]\d{0,2})?$/;function Bf({amount:e,ariaLabel:s,isDisabled:n,isInvalid:a,errorMessage:r,onAmountChange:i}){const[o,l]=h.useState(null);return t.jsx(c.Input,{variant:"bordered","aria-label":s,type:"text",inputMode:"decimal",autoComplete:"off",isDisabled:n,isInvalid:a,errorMessage:a?r:void 0,value:o??(e?String(e):""),onChange:d=>{const u=d.target.value.trim();if(!zf.test(u))return;l(u);const x=Number(u.replace(",","."));i(Ds(Number.isFinite(x)?x:0))},onBlur:()=>l(null),startContent:t.jsx("span",{className:"text-zinc-900",children:"$"})})}function Vf({isDisabled:e,isPaid:s,label:n,onRemove:a}){const r=t.jsx(T,{type:"button",isIconOnly:!0,variant:"flat",radius:"full",className:"h-9 w-9 flex-none bg-danger-100 p-0 text-danger-600",style:{height:36,minWidth:36,width:36},isDisabled:e||s,onPress:a,"aria-label":n,children:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"})});return s?t.jsx(c.Tooltip,{content:"This payment cannot be edited or deleted because it has already been paid.",placement:"top",children:t.jsx("span",{className:"inline-flex",children:r})}):r}function Uf({total:e,donationAmount:s,hasTotalMismatch:n,mode:a,installments:r,formatter:i,labels:o,className:l}){const d=r.length,u=r[0]?.amount??0,x=r[1]?.amount??u,m=d>1&&Math.round(u*100)!==Math.round(x*100),p=Ds(s-e),f=Math.max(p,0),g=Math.max(-p,0),v=n?t.jsxs("span",{children:[o.totalError,". Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}):a==="automatic"?m?t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records:"," ",t.jsx("strong",{children:i.format(u)})," first charge and"," ",t.jsx("strong",{children:i.format(x)})," for each remaining charge."]}):t.jsxs("span",{children:["Saving will create ",t.jsx("strong",{children:d})," scheduled payment records of"," ",t.jsx("strong",{children:i.format(u)})," each."]}):t.jsxs("span",{children:["Total scheduled: ",t.jsx("strong",{children:i.format(e)})," /"," ",t.jsx("strong",{children:i.format(s)}),"."]}),b=a==="automatic"?`Total: ${i.format(e)}`:g>0?`Exceeds by: ${i.format(g)}`:`${o.remaining}: ${i.format(f)}`;return t.jsx(c.Alert,{isClosable:!1,color:n?"danger":"default",variant:"flat",radius:"full",className:l,endContent:t.jsx("span",{className:"whitespace-nowrap",children:b}),title:v})}function Hf(){return t.jsxs("section",{className:"flex w-full flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm","aria-busy":"true",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsx(ie,{className:"h-7 w-56 rounded-lg"}),t.jsx(ie,{className:"size-8 rounded-full"})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ie,{className:"h-10 w-72 rounded-full"}),t.jsx(ie,{className:"h-10 w-40 rounded-full"})]}),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[t.jsxs("div",{className:"flex w-full max-w-[280px] flex-col gap-2",children:[t.jsx(ie,{className:"h-4 w-36 rounded-md"}),t.jsx(ie,{className:"h-9 w-full rounded-xl"})]}),t.jsx(ie,{className:"h-9 w-36 rounded-full"})]}),t.jsx("div",{className:"flex flex-col gap-3",children:Array.from({length:4}).map((e,s)=>t.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_160px] items-center gap-4 rounded-2xl border border-zinc-100 p-3",children:[t.jsx(ie,{className:"h-8 w-full max-w-xs rounded-full"}),t.jsx(ie,{className:"h-8 w-full rounded-xl"})]},s))})]})}const dr={paid:"bg-emerald-50 text-emerald-700",scheduled:"bg-blue-50 text-blue-700",schedule:"bg-blue-50 text-blue-700",payment_due:"bg-amber-50 text-amber-700",overdue:"bg-orange-50 text-orange-700",failed:"bg-red-50 text-red-700",refunded:"bg-zinc-100 text-zinc-600",partially_refunded:"bg-lime-50 text-lime-800",disputed:"bg-purple-50 text-purple-700",canceled:"bg-zinc-100 text-zinc-600",processing:"bg-sky-50 text-sky-700",pending_confirmation:"bg-indigo-50 text-indigo-700"},ol={paid:"Paid",scheduled:"Scheduled",schedule:"Scheduled",payment_due:"Payment Due",overdue:"Overdue",failed:"Failed",refunded:"Refunded",partially_refunded:"Partially refunded",disputed:"Disputed",canceled:"Canceled",processing:"Processing",pending_confirmation:"Pending Confirmation"},Wf={title:"Payments",saved:"Saved",searchLabel:"Search a payment",searchPlaceholder:"Search a payment by name, ID, or date...",editInstallments:"Edit Payment",installmentId:"Payment",amount:"Amount",scheduledDate:"Scheduled Date",paidOn:"Paid on",partiallyRefunded:ol.partially_refunded,refundedAmount:"Refunded",status:"Status",actions:"Actions",payNow:"Pay now",sendLink:"Send Link",sendLinkDescription:"Send a payment link to the contact",dangerZone:"Danger zone",deleteInstallment:"Delete Payment",deleteInstallmentDescription:"Remove Payment from Opportunity",deleteInstallmentConfirmationTitle:"Delete Payment",deleteInstallmentConfirmationDescription:t.jsxs(t.Fragment,{children:["Are you sure you want to delete this payment? ",t.jsx("strong",{children:"This action cannot be undone."})]}),deleteInstallmentConfirmationCancel:"Cancel",deleteInstallmentConfirmationConfirm:"Confirm",noInstallmentsFound:"No payments found."},qf={wrapper:"!absolute !inset-0 !z-50 !items-center !justify-center !p-4",backdrop:"!absolute !inset-0 !z-40 rounded-2xl"},Gf=[];function Kf({installments:e,currency:s,locale:n="en-US",showTitle:a=!0,showCard:r=!0,showEditPayment:i=!0,showDelete:o=!0,payNowHiddenStatuses:l=Gf,showSavedIndicator:d=!1,labels:u,isSaving:x=!1,onEditInstallments:m,onPayInstallment:p,onDeleteInstallment:f}){const[g,v]=h.useState(null),b={...Wf,...u},[y,N]=h.useState(""),k=new Intl.NumberFormat(n,{style:"currency",currency:s}),w=e.some(S=>cl(S)!==null),$=e.some(S=>S.status==="partially_refunded"),A=a?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(X.CircleDollarSign,{className:"size-4 text-zinc-500",strokeWidth:1.75}),t.jsx("span",{className:"text-base font-medium leading-6 text-zinc-950",children:b.title}),d?t.jsx(c.Chip,{size:"sm",radius:"full",color:"success",variant:"flat",children:b.saved}):null]}):void 0,j=h.useMemo(()=>{const S=y.trim().toLowerCase();if(!S)return e;const _=new Intl.NumberFormat(n,{style:"currency",currency:s});return e.filter(F=>{const L=F.status??"scheduled";return[rn(F),F.id,F.amount,F.dueDate,js(F.dueDate,n),ln(F,b.paidOn,n),on(F,b.refundedAmount,_),L,cn(L,b.partiallyRefunded)].join(" ").toLowerCase().includes(S)})},[n,s,e,y,b.paidOn,b.refundedAmount,b.partiallyRefunded]),D=t.jsxs("div",{className:"flex min-w-0 w-full flex-col gap-4 overflow-x-hidden [container-type:inline-size]",children:[t.jsxs("div",{className:"flex min-w-0 w-full flex-wrap items-end justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 w-full max-w-[280px]",children:[t.jsx("label",{className:"mb-1 block text-sm font-normal text-zinc-950",children:b.searchLabel}),t.jsx(c.Input,{variant:"bordered",size:"md",value:y,placeholder:b.searchPlaceholder,onChange:S=>N(S.target.value),startContent:t.jsx(M,{icon:"solar:magnifer-outline",className:"size-4 text-zinc-500"})})]}),i?t.jsx(T,{type:"button",variant:"bordered",radius:"full",size:"md",className:"h-10 border-zinc-200 bg-white px-4 text-sm font-normal text-zinc-900",startContent:t.jsx(M,{icon:"solar:pen-outline",className:"size-4"}),isLoading:x,onPress:m,children:b.editInstallments}):null]}),t.jsx("div",{className:c.cn("hidden [@container(max-width:767px)]:block",j.length>3&&"max-h-[560px] overflow-y-auto pr-1"),children:t.jsxs("div",{className:"flex flex-col gap-2",children:[j.map((S,_)=>{const F=S.status??"scheduled",L=rn(S),P=ln(S,b.paidOn,n),B=on(S,b.refundedAmount,k);return t.jsx(c.Card,{radius:"lg",shadow:"none",className:"border border-default-200",children:t.jsxs(c.CardBody,{className:"gap-3 p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("p",{className:"text-xs text-default-500",children:["#",_+1]}),t.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:L||`PMT-${_+1}`})]}),t.jsx(ur,{status:F,label:cn(F,b.partiallyRefunded)})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-default-500",children:b.amount}),t.jsx("p",{className:"font-medium text-foreground",children:k.format(S.amount)}),B?t.jsx("p",{className:"text-xs text-default-500",children:B}):null]}),t.jsxs("div",{className:"text-right",children:[t.jsx("p",{className:"text-xs text-default-500",children:b.scheduledDate}),t.jsx("p",{className:"font-medium text-foreground",children:js(S.dueDate,n)}),P?t.jsx("p",{className:"text-xs text-default-500",children:P}):null]})]}),t.jsx(mr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:f})]})},S.id)}),j.length===0&&t.jsx("div",{className:"rounded-lg border border-default-200 px-4 py-6 text-center text-sm text-default-500",children:b.noInstallmentsFound})]})}),t.jsx("div",{className:c.cn("w-full overflow-x-hidden [@container(max-width:767px)]:hidden",j.length>5&&"max-h-[344px] overflow-y-auto pr-1"),children:t.jsxs("table",{className:"w-full table-fixed border-collapse text-left text-sm",children:[t.jsxs("colgroup",{children:[t.jsx("col",{className:"w-12"}),t.jsx("col",{}),t.jsx("col",{className:w?"w-32":"w-24"}),t.jsx("col",{className:"w-36"}),t.jsx("col",{className:$?"w-44":"w-36"}),t.jsx("col",{className:"w-44"})]}),t.jsx("thead",{children:t.jsxs("tr",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white text-zinc-900",children:[t.jsx("th",{className:"px-2 py-3 font-medium",children:"#"}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.installmentId}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.amount}),t.jsx("th",{className:"px-2 py-3 font-medium",children:b.scheduledDate}),t.jsx("th",{className:"whitespace-nowrap px-2 py-3 font-medium",children:b.status}),t.jsx("th",{className:"whitespace-nowrap py-3 pl-4 pr-2 font-medium",children:b.actions})]})}),t.jsxs("tbody",{children:[j.map((S,_)=>{const F=S.status??"scheduled",L=rn(S),P=ln(S,b.paidOn,n),B=on(S,b.refundedAmount,k);return t.jsxs("tr",{className:"text-zinc-500",children:[t.jsx("td",{className:"px-2 py-3",children:_+1}),t.jsx("td",{className:"overflow-hidden px-2 py-3",children:t.jsx("span",{className:"block w-full truncate",children:L||`PMT-${_+1}`})}),t.jsxs("td",{className:"px-2 py-3",children:[k.format(S.amount),B?t.jsx("span",{className:"block text-xs",children:B}):null]}),t.jsxs("td",{className:"px-2 py-3",children:[js(S.dueDate,n),P?t.jsx("span",{className:"block text-xs",children:P}):null]}),t.jsx("td",{className:"whitespace-nowrap px-2 py-3",children:t.jsx(ur,{status:F,label:cn(F,b.partiallyRefunded)})}),t.jsx("td",{className:"whitespace-nowrap py-3 pl-4 pr-2",children:t.jsx(mr,{status:F,installment:S,labels:b,portalContainer:g??void 0,showDelete:o,payNowHiddenStatuses:l,onPayInstallment:p,onDeleteInstallment:f})})]},S.id)}),j.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6,className:"px-2 py-6 text-center text-zinc-500",children:b.noInstallmentsFound})})]})]})})]});return t.jsx("div",{ref:v,className:"vvt-ps relative min-w-0 w-full overflow-x-hidden [container-type:inline-size] font-sans text-zinc-900",children:r?t.jsx(c.Accordion,{variant:"splitted",defaultSelectedKeys:["installment-table"],className:"min-w-0 w-full gap-0 px-0",itemClasses:{base:"min-w-0 w-full overflow-x-hidden rounded-2xl border border-zinc-200 bg-white p-0 shadow-sm",trigger:"px-4 py-4",title:"w-full",content:"min-w-0 w-full overflow-x-hidden px-4 pb-4 pt-0",indicator:"text-zinc-500 [&>svg]:size-4"},children:t.jsx(c.AccordionItem,{"aria-label":b.title,title:A,children:D},"installment-table")}):D})}function rn(e){return e.name?.trim()||e.id}function ln(e,s,n){return!Nt(e.status)||!e.fulfilledAt?null:`${s} ${js(e.fulfilledAt,n)}`}function cl(e){const{refundedAmount:s}=e;return e.status!=="partially_refunded"||typeof s!="number"||!Number.isFinite(s)||s<=0?null:s}function on(e,s,n){const a=cl(e);return a===null?null:`${s} ${n.format(a)}`}function cn(e,s){return e==="partially_refunded"?s:ol[e]??e}function ur({status:e,label:s}){return t.jsx(c.Chip,{size:"md",radius:"lg",className:c.cn("justify-center px-4",dr[e]??dr.scheduled),startContent:t.jsx(Qf,{status:e}),children:s})}function mr({status:e,installment:s,labels:n,portalContainer:a,showDelete:r,payNowHiddenStatuses:i,onPayInstallment:o,onDeleteInstallment:l}){const d=!i.includes(e),u=Nt(e);return t.jsxs("div",{className:"flex min-w-36 items-center justify-start gap-2",children:[d?t.jsx(T,{type:"button",size:"md",color:"primary",variant:"solid",radius:"full",className:"min-w-[104px] shrink-0",isDisabled:u,startContent:t.jsx(M,{icon:"solar:dollar-minimalistic-outline",className:"size-4"}),onPress:()=>o?.(s),children:n.payNow}):null,t.jsx(Yf,{isFulfilled:u,showDelete:r,labels:n,portalContainer:a,onDelete:()=>l(s.id)})]})}function Yf({isFulfilled:e,showDelete:s,labels:n,portalContainer:a,onDelete:r}){const[i,o]=h.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{type:"button",isIconOnly:!0,size:"sm",variant:"light",className:"text-zinc-900","aria-label":"More actions",children:t.jsx(M,{icon:"solar:menu-dots-bold",className:"size-4"})})}),t.jsxs(c.DropdownMenu,{"aria-label":"Installment actions",disabledKeys:e?["send-link","delete"]:[],className:"w-72 p-2",onAction:l=>{l==="delete"&&s&&!e&&o(!0)},children:[t.jsx(c.DropdownSection,{title:"Actions",showDivider:s,children:t.jsx(c.DropdownItem,{textValue:n.sendLink,description:n.sendLinkDescription,startContent:t.jsx(M,{icon:"solar:link-outline",className:"size-5 text-zinc-500"}),children:n.sendLink},"send-link")}),s?t.jsx(c.DropdownSection,{title:n.dangerZone,children:t.jsx(c.DropdownItem,{textValue:n.deleteInstallment,className:"text-danger-600",color:"danger",description:n.deleteInstallmentDescription,startContent:t.jsx(M,{icon:"solar:trash-bin-minimalistic-outline",className:"size-5"}),children:n.deleteInstallment},"delete")}):null]})]}),s?t.jsx(ta,{isOpen:i,labels:{title:n.deleteInstallmentConfirmationTitle,description:n.deleteInstallmentConfirmationDescription,cancel:n.deleteInstallmentConfirmationCancel,confirm:n.deleteInstallmentConfirmationConfirm},icon:t.jsx(M,{icon:"solar:danger-triangle-outline",className:"size-7"}),confirmColor:"danger",portalContainer:a,shouldBlockScroll:!1,classNames:qf,onClose:()=>o(!1),onConfirm:()=>{o(!1),r()}}):null]})}function Qf({status:e}){return e==="paid"?t.jsx(M,{icon:"solar:check-circle-bold",className:"size-3"}):e==="failed"?t.jsx(M,{icon:"solar:close-circle-bold",className:"size-3"}):e==="partially_refunded"?t.jsx(M,{icon:"solar:undo-left-round-bold",className:"size-3"}):e==="processing"?t.jsx(M,{icon:"solar:refresh-circle-bold",className:"size-3"}):e==="pending_confirmation"?t.jsx(M,{icon:"solar:clock-circle-bold",className:"size-3"}):t.jsx(M,{icon:"solar:calendar-outline",className:"size-3"})}const Zf=/^\d{4}-\d{2}-\d{2}$/;function js(e,s){const n=Zf.test(e)?new Date(`${e}T00:00:00`):new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(s,{month:"short",day:"numeric",year:"numeric"}).format(n)}const Xf={title:"Select Membership",renewalTitle:"Automatic Renewal",renewalDescription:"Membership will automatically renew at the end of each period"},Jf=({cards:e,locale:s,currency:n,listHeightClassName:a="",labels:r,showRenewal:i=!0,defaultRenewalValue:o=!1,initialSelectedMembershipId:l=null,allowReselect:d=!0,onRenewalChange:u,onCardSelect:x,className:m=""})=>{const p=Array.isArray(e)?e:[],[f,g]=h.useState(l),[v,b]=h.useState(o),y={...Xf,...r};h.useEffect(()=>{g(l)},[l]);const N=w=>{if(w===f){d&&x?.(w);return}g(w),x?.(w)},k=w=>{b(w),u?.(w)};return t.jsxs("div",{className:c.cn("w-full flex flex-col gap-4 items-start p-4 h-svh",m),"data-testid":"membership-select-cards",children:[t.jsx("span",{className:"hidden","data-testid":"membership-select-cards-selected-id",children:f??""}),t.jsx("p",{className:"text-2xl font-semibold text-left","data-testid":"membership-select-cards-title",children:y.title}),i&&t.jsx(pl,{title:y.renewalTitle,description:y.renewalDescription,value:v,onValueChange:k}),t.jsx("div",{className:c.cn("w-full min-h-0 flex flex-col gap-4 overflow-y-auto",a===""?"flex-1":c.cn("shrink-0",a)),"data-testid":"membership-select-cards-list",children:p.map(w=>t.jsx(dl,{itemKey:w.id,name:w.name,type:w.type,price:w.price,locale:s,currency:n,isSelected:f===w.id,onSelect:N},w.id))})]})},dl=({itemKey:e,name:s,type:n,price:a,locale:r="en-US",currency:i="USD",showPrice:o=!0,isSelected:l=!1,onSelect:d,compact:u=!1,isDisabled:x=!1,disabledReason:m,statusLabel:p,statusTone:f="default",className:g=""})=>{const v=new Intl.NumberFormat(r,{style:"currency",currency:i,minimumFractionDigits:0,maximumFractionDigits:2}).format(a),b=!!d&&!x,y=m||p,N=()=>{b&&d?.(e)};return t.jsx(c.Card,{shadow:"none",isPressable:!!d,onPress:N,className:c.cn("w-full min-h-fit border rounded-3xl",l?"border-primary bg-primary/5":"border-default",x?"opacity-60":"",u?"rounded-2xl":"",g),"data-testid":"item-card","data-selected":l,isDisabled:x,children:t.jsxs("div",{className:c.cn("px-4 py-8 flex gap-6 items-center justify-between",u&&"px-3 py-3 gap-4"),children:[t.jsxs("div",{className:"w-max flex flex-col gap-1 items-start",children:[t.jsx("p",{className:c.cn("font-semibold text-left",u?"text-sm":"text-xl"),"data-testid":"item-card-name",children:s}),n&&t.jsx("div",{"data-testid":"item-card-type",className:"w-fit bg-default-300 px-4 py-2 text-sm rounded-xl",children:t.jsx("p",{className:"text-center",children:n})}),y&&t.jsx(c.Chip,{"data-testid":"item-card-status",color:f,size:"sm",variant:"flat",className:"px-2",children:y})]}),o&&t.jsx("p",{className:c.cn("font-semibold text-right",u?"text-lg":"text-2xl"),"data-testid":"item-card-price",children:v})]})})},fr="w-full bg-gray-100",xr={variant:"light",color:"default"},ul=({id:e,title:s,media:n,imageUrl:a,imageAlt:r,imageClassName:i="",imageAspect:o="aspect-[4/3]",meta:l=[],price:d,action:u,footer:x,onPress:m,isPressable:p=!1,isDisabled:f=!1,compact:g=!1,className:v="",bodyClassName:b="",footerClassName:y="",dataTestId:N})=>{const k=!!(d&&d.value),w=!!u?.label,$=p&&!!m&&!w,A=!$,j=w?{variant:u?.variant??xr.variant,color:u?.color??xr.color,size:u?.size??"sm",isDisabled:f||u?.isDisabled,startContent:u?.icon?t.jsx(M,{icon:u.icon,width:16}):void 0}:null,D=n??(a?t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,fr,i),children:t.jsx(c.Image,{removeWrapper:!0,src:a,alt:r||s,className:"size-full object-cover",classNames:{wrapper:"absolute inset-0"}})}):t.jsx("div",{className:c.cn("relative overflow-hidden rounded-xl",o,fr,"grid place-items-center",i),"data-testid":`catalog-item-card-${e??"media"}-fallback`,children:t.jsx(M,{icon:"solar:ticket-outline",width:48,className:"text-default-400"})}));return t.jsxs(c.Card,{"data-testid":N||`catalog-item-card-${e??"item"}`,className:c.cn("w-full overflow-hidden",v),isPressable:$,onPress:m,isDisabled:f,shadow:"sm",radius:"lg",children:[t.jsx("div",{children:D}),t.jsxs(c.CardBody,{className:c.cn("gap-3",g?"p-3":"p-4",b),children:[t.jsx("h3",{"data-testid":`catalog-item-card-title-${e??""}`,className:c.cn("line-clamp-2 text-base font-semibold text-gray-900",g?"text-sm":""),children:s}),l.length>0?t.jsx("div",{className:"flex flex-col gap-1.5 text-sm text-gray-600","data-testid":`catalog-item-card-meta-${e??""}`,children:l.map((S,_)=>t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(M,{icon:S.icon,className:"size-4 text-gray-400",width:16}),t.jsx("span",{children:S.label})]},`${S.label}-${_}`))}):null,(k||w)&&t.jsxs("div",{className:c.cn("flex items-center justify-end gap-2 pt-1 text-sm",g?"pt-0.5":"",y),children:[k?t.jsxs("span",{className:c.cn("mr-auto text-gray-500",g?"text-xs":""),"data-testid":`catalog-item-card-price-${e??""}`,children:[d?.label&&t.jsxs("span",{children:[d.label," "]}),t.jsx("span",{className:"font-semibold text-brand",children:d?.value})]}):t.jsx("span",{className:"ml-auto","aria-hidden":!0}),w&&A?t.jsx(T,{className:c.cn("rounded-full",u?.className),onPress:u?.onPress,variant:j?.variant,color:j?.color,size:j?.size,startContent:j?.startContent,isDisabled:j?.isDisabled,"aria-label":u?.ariaLabel||u?.label,children:u?.label}):null]}),x?t.jsx("div",{className:"pt-1",children:x}):null]})]})};ul.displayName="CatalogItemCard";const ex={open:"Open","selling-fast":"Selling fast","sold-out":"Sold out"};function ml({title:e,subtitle:s,price:n,imageUrl:a,status:r,isDisabled:i=!1,onPress:o,className:l}){return t.jsx(c.Card,{isPressable:!!o,isDisabled:i,onPress:o,shadow:"none",radius:"lg",className:c.cn("w-full border border-pos-hair",l),children:t.jsxs(c.CardBody,{className:"flex-row items-center gap-5 p-4",children:[t.jsx("div",{className:"grid size-[4.875rem] shrink-0 place-items-center overflow-hidden rounded-xl bg-default-100 text-default-500",children:a?t.jsx(c.Image,{removeWrapper:!0,src:a,alt:"",className:"size-full object-cover"}):t.jsx(M,{icon:"solar:ticket-outline",width:28})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h3",{className:"truncate text-lg font-semibold text-foreground",children:e}),t.jsx("p",{className:"mt-1 text-base text-default-500",children:s})]}),r?t.jsx("span",{"data-status":r,className:"rounded-full bg-default-100 px-3 py-1 text-sm font-medium text-default-600",children:ex[r]}):null,n?t.jsxs("strong",{className:"ml-5 whitespace-nowrap text-xl",children:["from ",n]}):null]})})}ml.displayName="ProgramListItem";const tx={card:"gap-3 rounded-xl border border-dashed px-6 py-12",panel:"px-6 py-[72px]"},sx={card:"size-12 rounded-2xl",panel:"size-[76px] rounded-[20px] border mb-[18px]"},nx={card:"text-base font-medium text-default-900",panel:"text-[17px] font-semibold text-acct-ink"},ax={card:"max-w-sm text-sm text-default-600",panel:"max-w-[380px] text-sm text-acct-sub mt-1.5"},rx={card:"text-xs text-default-500",panel:"text-xs text-acct-sub mt-2"},ix={card:"mt-1",panel:"mt-[22px]"},lx="bg-acct-page border-acct-border text-acct-muted",ox={empty:"solar:inbox-line-duotone",error:"solar:danger-triangle-outline",success:"solar:check-circle-bold"},cx={empty:"border-default-200 bg-white",error:"border-danger-200 bg-white",success:"border-success-100 bg-success-50/40",loading:"border-default-200 bg-white"},dx={empty:"bg-default-100 text-default-400",error:"bg-danger-50 text-danger-600",success:"bg-success-100 text-success-700",loading:"bg-primary-50 text-primary"},ux={empty:"status",error:"alert",success:"status",loading:"status"},mx={empty:"polite",error:"assertive",success:"polite",loading:"polite"};function fx(e,s,n,a){if(s===!1)return null;if(e==="loading"&&s===void 0)return t.jsx(c.Spinner,{size:"lg",color:"primary",className:a.spinner});if(h.isValidElement(s))return t.jsx(t.Fragment,{children:s});const r=typeof s=="string"?s:ox[e];return r?t.jsx(M,{icon:r,width:n,height:n,"aria-hidden":"true",className:a.icon}):null}function fl({variant:e="empty",surface:s="card",title:n,titleAs:a="p",description:r,icon:i,actions:o,role:l=ux[e],ariaLive:d=mx[e],iconSize:u=24,className:x,classNames:m={},"data-testid":p="feedback-state",referenceCode:f,referenceCodeLabel:g="Reference code:"}){const v=fx(e,i,u,m);return t.jsxs("div",{role:l,"aria-live":d,"data-variant":e,"data-testid":p,"data-surface":s,className:c.cn("flex flex-col items-center justify-center text-center",tx[s],s==="card"?cx[e]:"bg-transparent",x,m.base),children:[v?t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn("inline-flex items-center justify-center",sx[s],e==="success"&&s==="card"&&"rounded-full",s==="panel"?lx:dx[e],m.iconWrapper),children:v}):null,t.jsxs("div",{className:c.cn("flex flex-col items-center",s==="card"&&"gap-1"),children:[t.jsx(a,{"data-testid":`${p}-title`,className:c.cn(nx[s],m.title),children:n}),r?t.jsx("p",{"data-testid":`${p}-description`,className:c.cn(ax[s],m.description),children:r}):null,f?t.jsxs("p",{"data-testid":`${p}-reference-code`,className:c.cn(rx[s],m.referenceCode),children:[g," ",t.jsx("span",{className:"select-all font-mono",children:f})]}):null]}),o?t.jsx("div",{"data-testid":`${p}-actions`,className:c.cn("flex flex-wrap items-center justify-center gap-2",ix[s],m.actions),children:o}):null]})}function is(e){return t.jsx(fl,{...e})}function sa(e){return t.jsx(is,{...e,variant:"empty"})}function na(e){return t.jsx(fl,{...e,variant:"error"})}function aa(e){return t.jsx(is,{...e,variant:"loading"})}function xl(e){return t.jsx(is,{...e,variant:"success"})}is.displayName="FeedbackState";sa.displayName="EmptyState";na.displayName="ErrorState";aa.displayName="LoadingState";xl.displayName="SuccessState";const pl=({title:e,value:s,description:n,onValueChange:a,className:r=""})=>{const i=h.useId();return t.jsxs("div",{className:c.cn("w-full flex flex-row items-center",e||n?"justify-between gap-6":"justify-start",r),"data-testid":"toggle",children:[t.jsxs("div",{className:"flex flex-col items-start",children:[e&&t.jsx("label",{htmlFor:i,className:"font-medium text-left","data-testid":"toggle-title",children:e}),n&&t.jsx("p",{className:"text-left text-gray-500","data-testid":"toggle-description",children:n})]}),t.jsx(c.Switch,{id:i,isSelected:s,onValueChange:a,"data-testid":"toggle-switch"})]})},xx={ticketSelectionTitle:"Choose tickets to be upgraded",ticketsAllowedToRedeem:"Tickets allowed to redeem:",ticketsSelectedToRedeem:"Tickets selected to redeem",noUpgradeTicketsAvailable:"No upgrade tickets available to select",selectAllButtonLabel:"Select All"},px=(e,s)=>new Intl.NumberFormat(e,{style:"currency",currency:s}),hl=e=>Object.values(e).reduce((s,n)=>s+Object.values(n).reduce((a,r)=>a+Object.values(r).reduce((i,o)=>i+o.selectedQuantity,0),0),0),hx=e=>e.reduce((s,n)=>s+n.dates.reduce((a,r)=>a+r.tickets.reduce((i,o)=>i+o.max,0),0),0),ra=e=>e.flatMap(s=>s.dates.flatMap(n=>n.tickets.map(a=>({exhibition:s,dateGroup:n,ticket:a})))),pr=(e,s,n)=>{const a={};let r=n?s??hx(e):0;for(const{exhibition:i,dateGroup:o,ticket:l}of ra(e)){a[i.id]??={},a[i.id][o.id]??={};const d=n?Math.min(l.max,r):0;a[i.id][o.id][l.id]={id:l.id,selectedQuantity:d,originalPrice:l.originalPrice,discountedPrice:l.price},r-=d}return a},hr=(e,s,n)=>`${e}::${s}::${n}`,bx=(e,s,n)=>{const a=hl(s);for(const{exhibition:r,dateGroup:i,ticket:o}of ra(e)){const l=s[r.id]?.[i.id]?.[o.id]?.selectedQuantity??0,d=n===void 0?o.max:Math.min(o.max,n-(a-l));if(d>0&&l<d)return!1}return!0},gx=({initialQuantity:e=1,minQuantity:s=1,maxQuantity:n=10,onChange:a,disabled:r=!1})=>{const i=Math.max(s,Math.min(n,e)),[o,l]=h.useState(()=>String(i)),[d,u]=h.useState(!1),x=d?o:String(i),m=()=>{r||i>=n||a?.(i+1)},p=()=>{r||i<=s||a?.(i-1)},f=w=>{if(r)return;l(w.target.value);const $=parseInt(w.target.value,10);isNaN($)||a?.(Math.max(s,Math.min(n,$)))},g=w=>{const $=parseInt(w.target.value,10);if(u(!1),isNaN($)){a?.(s);return}const A=Math.max(s,Math.min(n,$));A!==$?a?.(A):l(String(A))},v=i<=s,b=i>=n,y="w-10 h-10 flex items-center justify-center border-0 rounded-full cursor-pointer transition-colors duration-150 text-white text-2xl font-regular",N="bg-primary hover:bg-primary/80",k="bg-primary/40 cursor-not-allowed";return t.jsxs("div",{className:"flex items-center gap-4","data-testid":"quantity-selector",children:[t.jsx("button",{type:"button",onClick:p,disabled:r||v,className:c.cn(y,r||v?k:N),"aria-label":"Decrement quantity","data-testid":"quantity-decrement",children:"-"}),t.jsx("input",{type:"number",value:x,onChange:f,onFocus:()=>u(!0),onBlur:g,disabled:r,min:s,max:n,step:"1",className:"w-12 h-10 rounded-md border-0 bg-zinc-100 text-center text-2xl font-medium text-zinc-900 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none","aria-label":`Selected quantity: ${i}`,"data-testid":"quantity-input"}),t.jsx("button",{type:"button",onClick:m,disabled:r||b,className:c.cn(y,r||b?k:N),"aria-label":"Increment quantity","data-testid":"quantity-increment",children:"+"})]})},yx=({label:e,checked:s=!1,onChange:n,disabled:a=!1})=>{const r=()=>{a||n?.(!s)};return t.jsxs("button",{type:"button",onClick:r,disabled:a,role:"checkbox","aria-checked":s,"data-testid":"checkbox-button","data-checked":s,className:c.cn("flex items-center gap-1.5 px-4 py-3 border-0 rounded-full cursor-pointer text-sm min-h-[30px]","outline-none select-none transition-colors bg-zinc-100 hover:bg-zinc-200 text-primary",a&&"cursor-not-allowed opacity-60"),children:[t.jsxs("span",{className:"relative flex items-center justify-center w-5 h-5 flex-shrink-0",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:()=>{},disabled:a,className:"absolute opacity-0 w-0 h-0 pointer-events-none",tabIndex:-1,readOnly:!0}),t.jsx("span",{className:c.cn("block w-3.5 h-3.5 rounded-sm relative",s?"bg-primary":"bg-white ring-1 ring-zinc-300"),children:s&&t.jsx("span",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-[60%] rotate-45 w-[3px] h-[5px] border border-white border-t-0 border-l-0","aria-hidden":"true"})})]}),t.jsx("p",{className:"flex-1 m-0 text-left leading-snug",children:e})]})},vx=({item:e,quantity:s,onChange:n,getTotalSelectedTickets:a,userMaxLimit:r,settings:i,labels:o})=>{const l=()=>{if(!a||r===void 0)return e.max;const m=a();return Math.min(e.max,r-(m-s))},d=i?.locale??"en-US",u=i?.currency??"USD",x=px(d,u);return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between bg-white px-3 py-2.5 gap-8","data-testid":"upgrade-ticket-item",children:[t.jsxs("div",{className:"min-w-0 flex flex-1 flex-col gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[t.jsxs("h3",{className:"min-w-0 text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-name",children:[e.name,typeof e.purchasedQuantity=="number"&&e.purchasedQuantity>1?t.jsx("span",{"data-testid":"ticket-purchased-quantity",children:` x${e.purchasedQuantity}`}):null]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[t.jsx("h3",{className:"line-through text-zinc-500 text-[0.9rem] font-normal m-0","data-testid":"ticket-original-price",children:x.format(e.originalPrice)}),t.jsx("h3",{className:"text-base font-semibold text-zinc-900 m-0","data-testid":"ticket-discounted-price",children:x.format(e.price)})]})]}),e.membershipName?t.jsx("div",{"data-testid":"ticket-membership-name",className:"max-w-full self-start rounded-2xl bg-default-100 px-3 py-1 text-xs text-default-700",title:e.membershipName,children:t.jsx("p",{className:"max-w-full truncate text-center",children:e.membershipName})}):null,t.jsx("div",{className:"text-sm text-zinc-500",children:t.jsxs("p",{className:"m-0","data-testid":"ticket-max",children:[o.ticketsAllowedToRedeem," ",e.max]})})]}),t.jsx(gx,{initialQuantity:s,minQuantity:0,maxQuantity:l(),onChange:n})]}),e.membershipAlert?t.jsx(c.Alert,{"data-testid":"ticket-membership-alert",color:"warning",variant:"flat",radius:"full",className:"ticket-selection-membership-alert mb-2 w-full max-w-full py-0 shadow-none",classNames:{base:"ticket-selection-membership-alert-base !min-h-8 !items-center !bg-[#F5CB24]/15 !text-[#5B2C0F] shadow-none",mainWrapper:"ticket-selection-membership-alert-main-wrapper m-0 min-h-8 !py-0 !px-0",alertIcon:"ticket-selection-membership-alert-icon w-4 h-4 !text-[#5B2C0F]",iconWrapper:"ticket-selection-membership-alert-icon-wrapper !min-w-0 !bg-transparent !border-none !shadow-none !rounded-none !p-0 !m-0 !w-4 !h-4",description:"ticket-selection-membership-alert-description !ms-2 !my-2 !text-[#5B2C0F]"},description:t.jsx("span",{className:"ticket-selection-membership-alert-description-text block w-full whitespace-normal break-words text-sm leading-4 text-[#5B2C0F]",children:e.membershipAlert})}):null]})},jx=({exhibitionId:e,dateGroup:s,isLast:n=!1,onQuantityChange:a,getTicketQuantity:r,getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d})=>t.jsxs("div",{className:c.cn("flex flex-col gap-2 pb-3",!n&&"border-b border-zinc-200"),"data-testid":"upgrade-ticket-date-group",children:[t.jsx("p",{className:"m-0 text-sm text-left text-zinc-500","data-testid":"upgrade-ticket-date",children:s.date}),s.tickets.map((u,x)=>t.jsxs("div",{children:[t.jsx(vx,{item:u,quantity:r(e,s.id,u.id),onChange:m=>a(e,s.id,u.id,m),getTotalSelectedTickets:i,userMaxLimit:o,settings:l,labels:d}),x<s.tickets.length-1?t.jsx(c.Divider,{className:"bg-zinc-200","data-testid":"upgrade-ticket-divider"}):null]},u.id))]}),wx=({title:e,exhibition:s,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l,initialExpanded:d=!1})=>{const[u,x]=h.useState(d),m=s.dates.reduce((f,g)=>f+g.tickets.reduce((v,b)=>v+a(s.id,g.id,b.id),0),0),p=s.dates.some(f=>f.tickets.length>0);return t.jsxs("div",{className:"w-full overflow-hidden border-b border-zinc-200","data-testid":"upgrade-ticket-header",children:[t.jsx("button",{type:"button",className:"flex items-center w-full px-5 py-4 border-0 cursor-pointer transition-all bg-white hover:bg-zinc-100",onClick:()=>x(!u),"aria-expanded":u,"aria-controls":`upgrade-items-${s.id}`,"data-testid":"upgrade-ticket-header-button",children:t.jsxs("div",{className:"flex justify-between items-center w-full gap-6",children:[t.jsx("h4",{className:"m-0 text-base font-semibold text-left text-zinc-900","data-testid":"upgrade-ticket-header-title",children:e}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("p",{className:"m-0 text-sm text-right text-zinc-500","data-testid":"upgrade-ticket-header-count",children:[m," ",l.ticketsSelectedToRedeem]}),t.jsx("span",{className:c.cn("inline-flex items-center justify-center text-zinc-500 text-xl transition-transform duration-200",u&&"rotate-180"),"aria-hidden":"true",children:t.jsx(M,{icon:"mdi:chevron-down"})})]})]})}),t.jsx("div",{id:`upgrade-items-${s.id}`,className:c.cn("transition-all duration-300 overflow-hidden",u?"max-h-[1000px] opacity-100":"max-h-0 opacity-0"),"aria-hidden":!u,children:u&&t.jsx("div",{className:"px-5 flex flex-col gap-6","data-testid":"upgrade-ticket-items",children:p?s.dates.map((f,g)=>t.jsx(jx,{exhibitionId:s.id,dateGroup:f,isLast:g===s.dates.length-1,onQuantityChange:n,getTicketQuantity:a,getTotalSelectedTickets:r,userMaxLimit:i,settings:o,labels:l},f.id)):t.jsx("div",{className:"px-5 py-10 text-center",children:t.jsx("p",{className:"m-0 text-zinc-500 italic",children:l.noUpgradeTicketsAvailable})})})})]})},Nx=({initialExpanded:e=!1,userMaxLimit:s,labels:n,settings:a,ticketSelectionData:r,className:i="",onSelectionChange:o})=>{const l=h.useMemo(()=>r??[],[r]),d={...xx,...n},[u,x]=h.useState(()=>pr(l,s,!0)),m=h.useRef(!1),p=h.useMemo(()=>{const N=ra(l).map(({exhibition:k,dateGroup:w,ticket:$})=>[hr(k.id,w.id,$.id),$]);return new Map(N)},[l]),f=bx(l,u,s),g=(N,k,w)=>u[N]?.[k]?.[w]?.selectedQuantity??0,v=()=>hl(u),b=(N,k,w,$)=>{const A=g(N,k,w),j=v()-A;if(s!==void 0&&j+$>s)return;const D=p.get(hr(N,k,w));if(!D)return;const S={...u,[N]:{...u[N],[k]:{...u[N]?.[k],[w]:{id:w,selectedQuantity:$,originalPrice:D.originalPrice,discountedPrice:D.price}}}};x(S),o?.(S)},y=N=>{const k=pr(l,s,N);x(k),o?.(k)};return h.useEffect(()=>{!m.current&&f&&(o?.(u),m.current=!0)},[f,u,o]),t.jsxs("div",{className:c.cn("flex flex-col w-full font-sans",i),"data-testid":"ticket-selection",children:[t.jsxs("div",{className:"flex items-center justify-between py-2 gap-4","data-testid":"ticket-selection-header",children:[t.jsx("h3",{className:"text-xl font-semibold m-0","data-testid":"ticket-selection-title",children:d.ticketSelectionTitle}),t.jsx(yx,{label:d.selectAllButtonLabel,checked:f,onChange:y})]}),l.map(N=>t.jsx(wx,{title:N.exhibitionName,exhibition:N,onQuantityChange:b,getTicketQuantity:g,getTotalSelectedTickets:v,userMaxLimit:s,settings:a,labels:d,initialExpanded:e},N.id))]})},dn={confirm:"Confirm",clear:"Clear",noLabel:"Filters"},un=e=>{const s={};for(const n of e)n.type==="checkbox"?s[n.id]=[...n.selectedValues]:s[n.id]=n.selectedValue?[n.selectedValue]:[];return s},Cx=(e,s)=>{const n={};for(const a of s){if(a.type==="checkbox"){n[a.id]=e[a.id]??[...a.selectedValues];continue}const r=e[a.id]??[];n[a.id]=r.length>0?r[0]:null}return n},kx=e=>e.type==="checkbox"?e.selectedValues.length>0:e.selectedValue!==null,bl=({triggerLabel:e,triggerAriaLabel:s,triggerIcon:n="solar:tuning-square-outline",triggerVariant:a="bordered",triggerColor:r="default",triggerSize:i="sm",triggerClassName:o,popoverClassName:l,className:d,sections:u,onConfirm:x,onClear:m,appliedCount:p,countAriaLabel:f,countDisplay:g="badge",confirmLabel:v=dn.confirm,clearLabel:b=dn.clear,isOpen:y,defaultOpen:N=!1,onOpenChange:k,isDisabled:w=!1,closeOnConfirm:$=!0,keepOpenAfterClear:A=!1})=>{const[j,D]=h.useState(N),[S,_]=h.useState(()=>un(u)),F=y??j,L=p??u.filter(Y=>kx(Y)).length,P=Y=>{Y&&_(un(u)),y||D(Y),k?.(Y)},B=(Y,ce)=>{_(ee=>({...ee,[Y.id]:ce}))},H=(Y,ce)=>{_(ee=>({...ee,[Y.id]:ce?[ce]:[]}))},K=async()=>{_(un(u.map(Y=>Y.type==="checkbox"?{...Y,selectedValues:[]}:{...Y,selectedValue:null}))),await m(),A||P(!1)},O=async()=>{const Y=Cx(S,u);await x(Y),$&&P(!1)},ne=Y=>{if(Y.type==="checkbox")return t.jsx(c.CheckboxGroup,{label:Y.label,value:S[Y.id]??[],onValueChange:ee=>B(Y,ee),children:Y.options.map(ee=>t.jsx(c.Checkbox,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Y.id);const ce=S[Y.id]?.[0]??"";return t.jsx(c.RadioGroup,{label:Y.label,value:ce,onValueChange:ee=>H(Y,ee||null),children:Y.options.map(ee=>t.jsx(c.Radio,{value:ee.value,isDisabled:ee.isDisabled,children:ee.label},ee.value))},Y.id)},G=h.useMemo(()=>L>0?f?.(L)||`${L} filters applied`:void 0,[f,L]),te=h.useMemo(()=>L===0?e||dn.noLabel:f?f(L):`${e} (${L})`,[L,e,f]);return t.jsx("div",{className:d,children:t.jsxs(c.Popover,{isOpen:F,onOpenChange:P,placement:"bottom-end",children:[t.jsx(c.PopoverTrigger,{children:t.jsxs(T,{isDisabled:w,variant:a,color:r,size:i,className:o,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":F,children:[t.jsx(M,{icon:n,width:16}),t.jsx("span",{children:e}),g==="badge"&&L>0?t.jsx("span",{className:"ml-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-gray-900 px-1.5 text-xs font-medium text-white","aria-label":G,children:L}):g==="summary"&&te!==e?t.jsx("span",{className:"text-xs",children:te}):null]})}),t.jsx(c.PopoverContent,{className:l,children:t.jsxs("div",{className:"flex w-full flex-col gap-5 px-4 py-4",children:[u.map(Y=>ne(Y)),t.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-3",children:[t.jsx(T,{variant:"light",color:"default",size:"sm",onPress:K,children:b}),t.jsx(T,{color:"primary",size:"sm",onPress:O,children:v})]})]})})]})})};bl.displayName="FilterPopover";const Sx="No sessions available for this date",$x=e=>e==="sold-out"||e==="closed"?"danger":"success",Ax=e=>{const s=e.seatsRemaining;return e.status==="sold-out"||e.status==="closed"?"Sold out":e.status==="limited"?typeof s=="number"?`${s} left`:"Limited":typeof s=="number"?`${s} seats available`:"Available"},br=e=>e.isDisabled?!0:e.status==="sold-out"||e.status==="closed",Dx=(e,s)=>s&&e.some(n=>n.date===s)?s:e[0]?.date??null,gl=({heading:e,subheading:s,days:n,selectedDate:a,onDateSelect:r,quickDates:i,selectedSessionId:o=null,onSessionSelect:l,emptyStateMessage:d=Sx,statusLabel:u,statusTone:x,sessionAriaLabel:m,dayButtonClassName:p,calendarSlot:f,dayGroupAriaLabel:g,sessionGridAriaLabel:v,className:b,headingClassName:y,subheadingClassName:N})=>{const k=Dx(n,a),w=n.find(S=>S.date===k),$=i??n.map(S=>({date:S.date,label:S.label})),A=w?.sessions??[],j=S=>S===k?"solid":"bordered",D=S=>{if(!br(S)){if(S.id===o){l(null);return}l(S.id)}};return t.jsxs("section",{className:c.cn("flex flex-col gap-4 rounded-xl bg-white p-3 sm:p-4",b),"data-testid":"session-timeline-root",children:[t.jsxs("header",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:c.cn("text-base font-semibold text-gray-900",y),children:e}),s?t.jsx("p",{className:c.cn("text-sm text-gray-700",N),children:s}):null]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":g||"Session days",children:[$.map(S=>t.jsx(T,{size:"sm",variant:j(S.date),color:"default",className:c.cn("rounded-full",p),isDisabled:S.isDisabled,onPress:()=>{r(S.date)},children:t.jsx("span",{children:S.label})},S.date)),f?t.jsx("div",{children:f}):null]}),t.jsxs("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-3","aria-label":v||"Sessions",children:[A.length===0?t.jsx("li",{className:"rounded-lg bg-white px-4 py-6 text-center text-sm text-gray-600 sm:col-span-3",children:d}):null,A.map(S=>{const _=br(S),F=S.id===o;return t.jsx("li",{className:"rounded-xl",children:t.jsx(c.Card,{shadow:"sm",radius:"lg",isPressable:!_,onPress:()=>{D(S)},"aria-disabled":_,"aria-pressed":_?void 0:F,className:c.cn("w-full",_?"bg-gray-100 opacity-70":"",F?"w-full ring-2 ring-gray-900":""),"aria-label":m?m(S,{isSelected:F,isUnavailable:_}):_?`${S.startTime} ${S.endTime} sold out`:`${S.startTime} ${S.endTime} available`,children:t.jsxs(c.CardBody,{className:"flex flex-col items-center gap-3 p-4 text-center",children:[t.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:[S.startTime," – ",S.endTime]}),t.jsx(c.Chip,{size:"sm",color:x?x(S):$x(S.status),variant:"flat",children:u?u(S):Ax(S)})]})})},S.id)})]})]})};gl.displayName="SessionTimeline";const Dn=16,ut=e=>`${e/Dn}rem`;function Ex(){if(typeof document>"u"||typeof getComputedStyle!="function")return Dn;const e=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:Dn}const ls=(e,s)=>e>=s*Ex(),Lx=1120;function It(){const e=h.useRef(null),[s,n]=h.useState(0),[,a]=h.useState("");return h.useLayoutEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const i=new ResizeObserver(o=>{const l=o[o.length-1];l&&n(l.borderBoxSize?.[0]?.inlineSize??l.contentRect.width)});return n(r.getBoundingClientRect().width),i.observe(r),()=>i.disconnect()},[]),h.useEffect(()=>{if(typeof MutationObserver>"u")return;const r=document.documentElement,i=new MutationObserver(()=>a(getComputedStyle(r).fontSize));return i.observe(r,{attributes:!0,attributeFilter:["style","class"]}),()=>i.disconnect()},[]),{ref:e,width:s}}const Fx=48,Je={base:"flex items-start gap-4",baseWide:"mb-5 flex-nowrap",baseNarrow:"mb-[0.875rem] flex-wrap",identity:"flex min-w-0 items-center gap-4",text:"min-w-0",titleWide:"text-[1.6875rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",titleNarrow:"text-[1.375rem] font-semibold leading-[1.5] tracking-[-.02em] text-default-900",subtitleWide:"mt-[0.4375rem] max-w-[47.5rem] text-[0.875rem] leading-[1.55] text-default-500",subtitleNarrow:"mt-[0.4375rem] max-w-[47.5rem] text-[0.84375rem] leading-[1.55] text-default-500",actionsWide:"ml-auto flex shrink-0 items-center gap-2.5",actionsNarrow:"flex shrink-0 items-center gap-2.5"},Rx=(e,s)=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e||s||null,yl=({title:e,subtitle:s,eyebrow:n,icon:a,initials:r,actions:i,titleAs:o="h1",className:l,classNames:d={},"data-testid":u="page-header",list:x,narrow:m,headerRef:p})=>{const f=Rx(a,r);return t.jsxs("header",{ref:p,"data-testid":u,"data-variant":x?"list":void 0,"data-size":x?m?"narrow":"wide":void 0,className:c.cn(x?c.cn(Je.base,m?Je.baseNarrow:Je.baseWide):"flex flex-wrap items-start justify-between gap-4",l,d.base),children:[t.jsxs("div",{className:x?Je.identity:"flex items-center gap-4",children:[f?t.jsx("div",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn("flex size-12 shrink-0 items-center justify-center rounded-xl bg-gray-900 text-sm font-semibold text-white",d.iconWrapper),children:f}):null,t.jsxs("div",{className:x?Je.text:void 0,children:[n?t.jsx("p",{"data-testid":`${u}-eyebrow`,className:c.cn("text-brand text-sm font-medium uppercase tracking-wide",d.eyebrow),children:n}):null,t.jsx(o,{"data-testid":`${u}-title`,className:c.cn(x?m?Je.titleNarrow:Je.titleWide:"text-3xl font-semibold text-gray-950",d.title),children:e}),s?t.jsx("p",{"data-testid":`${u}-subtitle`,className:c.cn(x?m?Je.subtitleNarrow:Je.subtitleWide:"mt-1 text-sm text-gray-600",d.subtitle),children:s}):null]})]}),i?t.jsx("div",{"data-testid":`${u}-actions`,className:c.cn(x?m?Je.actionsNarrow:Je.actionsWide:"flex flex-wrap items-center gap-2",d.actions),children:i}):null]})},_x=e=>{const{ref:s,width:n}=It(),a=n>0&&!ls(n,Fx);return t.jsx(yl,{...e,list:!0,narrow:a,headerRef:s})},vl=e=>e.variant==="list"?t.jsx(_x,{...e}):t.jsx(yl,{...e,list:!1,narrow:!1});vl.displayName="PageHeader";const Xe={ok:{fg:oe.ok,bg:oe["ok-fill"]},warn:{fg:oe.warn,bg:oe["warn-fill"]},danger:{fg:oe.danger,bg:oe["danger-fill"]},info:{fg:oe.info,bg:oe["info-fill"]},violet:{fg:oe.violet,bg:oe["violet-fill"]},neutral:{fg:oe.neutral,bg:oe["neutral-fill"]}};function os(e){if(e==="positive")return{color:oe.ok};if(e==="negative")return{color:oe.danger}}const Mx={active:"success",success:"success",draft:"warning",pending:"warning",warning:"warning",danger:"danger",archived:"default",inactive:"default",neutral:"default",info:"default",violet:"default"},En={active:{fg:"#057A54",bg:"#E6F4EF"},success:{fg:"#057A54",bg:"#E6F4EF"},draft:{fg:"#B7791F",bg:"#FBF0DD"},pending:{fg:"#B7791F",bg:"#FBF0DD"},warning:{fg:"#B7791F",bg:"#FBF0DD"},danger:{fg:"#B62214",bg:"#FBEAE8"},archived:{fg:"#9CA3AF",bg:"#F1F2F4"},inactive:{fg:"#9CA3AF",bg:"#F1F2F4"},neutral:{fg:"#9CA3AF",bg:"#F1F2F4"},info:Xe.info,violet:Xe.violet},Px={active:"ok",success:"ok",draft:"warn",pending:"warn",warning:"warn",danger:"danger",archived:"neutral",inactive:"neutral",neutral:"neutral",info:"info",violet:"violet"},Ix={sm:"px-[0.5625rem] py-[0.1875rem] text-[0.75rem]",md:"px-3 py-[0.3125rem] text-[0.8125rem]",lg:"px-3 py-[0.3125rem] text-[0.8125rem]"},Tx={info:En.info,violet:En.violet},jl=({status:e,label:s,variant:n="flat",size:a="sm",color:r,startContent:i,className:o,"data-testid":l="status-chip"})=>{if(n==="plain"){const u=Xe[Px[e]];return t.jsxs("span",{"data-testid":l,"data-status":e,"data-variant":"plain",className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full font-normal",Ix[a],"leading-[1.35]",o),style:{color:u.fg,backgroundColor:u.bg},children:[i,s]})}if(n==="dot"){const u=En[e];return t.jsxs("span",{"data-testid":l,"data-status":e,className:c.cn("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-[3px] text-[12px] font-semibold leading-[1.4]",o),style:{color:u.fg,backgroundColor:u.bg},children:[t.jsx("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full",style:{backgroundColor:"currentColor"}}),s]})}const d=r?void 0:Tx[e];return t.jsx(c.Chip,{color:r??Mx[e],variant:n,size:a,startContent:i,"data-testid":l,"data-status":e,className:c.cn("font-medium",o),style:d?{color:d.fg,backgroundColor:d.bg}:void 0,children:s})};jl.displayName="StatusChip";const Ox={sm:"gap-1 rounded-md px-2 py-0.5 text-[11.5px] leading-normal",md:"gap-1.5 rounded-lg px-2.5 py-1 text-xs leading-normal"},ms={base:"inline-flex items-baseline gap-1 whitespace-nowrap rounded-[0.4375rem] border border-pos-hair bg-default-100",sm:"px-2 py-0.5 text-[0.75rem] leading-[1.5]",md:"px-2.5 py-1 text-[0.8125rem] leading-[1.5]",label:"font-normal text-default-600",value:"font-semibold text-default-900"},Bs=({label:e,value:s,size:n="sm",variant:a="default",className:r,"data-testid":i="key-value-chip"})=>a==="record"?t.jsxs("span",{"data-testid":i,"data-variant":"record",className:c.cn(ms.base,ms[n],r),children:[t.jsx("span",{className:ms.label,children:e}),t.jsx("span",{className:ms.value,children:s})]}):t.jsxs("span",{"data-testid":i,className:c.cn("inline-flex items-baseline whitespace-nowrap border border-default-200 bg-default-100",Ox[n],r),children:[t.jsx("span",{className:"font-medium text-default-400",children:e}),t.jsx("span",{className:"font-semibold text-default-700",children:s})]});Bs.displayName="KeyValueChip";const wl=({columns:e,rows:s=6,label:n="Loading",barHeight:a=12,alignLastRight:r=!1,appearance:i="pulse",className:o,classNames:l={},"data-testid":d="table-skeleton"})=>t.jsxs("div",{role:"status","aria-busy":"true","data-testid":d,className:c.cn("w-full",o,l.base),children:[t.jsx("span",{className:"sr-only",children:n}),t.jsx("div",{"aria-hidden":"true",children:Array.from({length:s}).map((u,x)=>i==="shimmer"?t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center border-b border-pos-hair",l.row),children:e.map((m,p)=>{const f=p===e.length-1;return t.jsx("div",{className:c.cn("min-w-0 flex-1 px-4 py-5",r&&f&&"flex justify-end"),children:t.jsx("div",{className:c.cn(bs,l.bar),style:{height:ut(a),width:m==="fill"?"60%":ut(m),maxWidth:"100%"}})},p)})},x):t.jsx("div",{"data-testid":`${d}-row`,className:c.cn("flex items-center gap-3 border-t border-default-100 px-5 py-4",l.row),children:e.map((m,p)=>{const f=p===e.length-1;return t.jsx("div",{className:c.cn(m==="fill"?"flex-1":"shrink-0",r&&f&&"flex justify-end"),style:m==="fill"?void 0:{width:m},children:t.jsx("div",{className:c.cn("animate-pulse rounded bg-default-200",Mn,l.bar),style:{height:a,width:m==="fill"?"60%":m}})},p)})},x))})]});wl.displayName="TableSkeleton";const Nl="text-left text-[11px] font-semibold uppercase tracking-[.04em] text-acct-sub px-4 pt-4 pb-3 whitespace-nowrap bg-transparent",Cl="px-4 text-[13.5px] text-acct-ink2 align-middle",kl="border-t border-acct-hair transition-colors duration-150 hover:bg-acct-page data-[hover=true]:bg-acct-page",Sl="w-full",$l="border-t border-acct-border px-5 py-3.5",fs={base:"overflow-x-auto",th:"h-auto whitespace-nowrap border-b border-pos-hair bg-transparent px-4 py-[0.875rem] text-left text-[0.6875rem] font-semibold uppercase leading-[1.5] tracking-[.055em] text-default-500 first:rounded-none last:rounded-none last:pr-3",tr:`border-t border-pos-hair transition-colors duration-[120ms] first:border-t-0 data-[focus-visible=true]:outline-offset-[-2px] [tbody>&]:hover:bg-default-50 [tbody>&]:data-[hover=true]:bg-default-50 ${Ce}`,td:"h-[3.875rem] px-4 data-[focus-visible=true]:outline-offset-[-2px] py-[0.625rem] align-middle text-[0.875rem] text-default-900 last:pr-3"},Al=({columns:e,children:s,emptyContent:n,footer:a,ariaLabel:r,variant:i="default",className:o,classNames:l={},"data-testid":d="admin-table"})=>{const u=i==="framed";return t.jsxs("div",{className:c.cn(u&&fs.base,o,l.base),"data-testid":d,"data-variant":u?"framed":void 0,children:[t.jsxs(Wn,{"aria-label":r,removeWrapper:!0,classNames:{table:c.cn(Sl,l.table),th:c.cn(u?fs.th:Nl,l.th),tr:c.cn(u?fs.tr:kl,l.tr),td:c.cn(u?fs.td:Cl,l.td)},children:[t.jsx(c.TableHeader,{columns:e,children:x=>t.jsx(c.TableColumn,{align:x.align==="right"?"end":"start",width:x.width,children:x.label},x.key)}),t.jsx(c.TableBody,{emptyContent:n,children:s})]}),a?t.jsx("div",{"data-testid":`${d}-footer`,className:c.cn(!u&&$l,l.footer),children:a}):null]})};Al.displayName="AdminTable";const Wt={base:"flex flex-wrap items-center gap-3 mb-4",trailing:"ml-auto",icon:"flex text-acct-muted",inputWrapper:["h-10 min-h-10 !h-10 rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),input:"text-[13.5px] text-acct-ink"},zx={md:"w-[280px]",lg:"w-[360px]",fill:"min-w-[12.5rem] flex-1"},Bx=48,it={base:"flex flex-wrap items-center gap-2.5 border-b border-pos-hair px-4 py-[0.875rem]",narrow:"[&_[data-slot=filter-select-group]]:flex [&_[data-slot=filter-select-group]]:flex-wrap [&_[data-slot=filter-select-group]]:!max-w-none [&_[data-slot=filter-select]]:!max-w-none [&_[data-slot=filter-select]]:!min-w-[calc(50%-0.3125rem)] [&_[data-slot=filter-select]]:grow [&_[data-slot=filter-select]]:basis-[calc(50%-0.3125rem)]",searchWide:"ml-auto",searchFill:"min-w-[12.5rem] flex-1",searchNarrow:"basis-full",inputBaseNarrow:"w-full",inputWrapper:"h-[2.375rem] min-h-[2.375rem] !h-[2.375rem] rounded-[0.625rem] border border-pos-field bg-white pl-3 pr-3 shadow-none data-[hover=true]:border-pos-field group-data-[focus=true]:border-primary",innerWrapper:"gap-[0.3125rem]",input:"text-ellipsis text-[0.875rem] text-default-900 data-[has-start-content=true]:ps-0.5",icon:"flex text-default-400 [&_svg]:size-4"},gr={md:"w-[15.625rem]",lg:"w-[22.5rem]",fill:"w-full"},Es={inputWrapper:"h-12 min-h-12 !h-12",input:"text-base",icon:"[&_svg]:size-5"},yr={button:"shrink-0 text-default-500",input:"[&::-webkit-search-cancel-button]:appearance-none"},vr={md:{button:"size-8 min-w-8",icon:"size-4"},lg:{button:"size-11 min-w-11",icon:"size-5"}},Dl=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:r,clearLabel:i,size:o,dataTestId:l,startContent:d,classNames:u})=>{const x=h.useRef(null),m=o==="lg",p=r&&e!==""?t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full","aria-label":i,onPress:()=>{s(""),x.current?.focus()},className:c.cn(yr.button,vr[o].button),testId:`${l}-search-clear`,children:t.jsx(M,{icon:"lucide:x","aria-hidden":"true",className:vr[o].icon})}):void 0;return t.jsx(c.Input,{ref:x,type:"search","aria-label":n,placeholder:a??n,value:e,onValueChange:s,startContent:d,endContent:p,"data-testid":`${l}-search`,variant:"bordered",radius:"none",classNames:{base:u.base,inputWrapper:c.cn(u.inputWrapper,m&&Es.inputWrapper),innerWrapper:u.innerWrapper,input:c.cn(u.input,m&&Es.input,r&&yr.input)}})},Vx=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o,children:l,trailing:d,searchWidth:u="md",size:x,className:m,"data-testid":p="admin-toolbar"})=>{const{ref:f,width:g}=It(),v=g>0&&!ls(g,Bx),b=u==="fill";return t.jsxs("div",{ref:f,role:"search","data-testid":p,"data-variant":"framed","data-size":v?"narrow":"wide",className:c.cn(it.base,v&&it.narrow,m),children:[l,t.jsx("div",{"data-testid":`${p}-search-slot`,className:b?it.searchFill:v?it.searchNarrow:it.searchWide,children:t.jsx(Dl,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:x,dataTestId:p,startContent:t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-search-icon`,className:c.cn(it.icon,x==="lg"&&Es.icon),children:r??t.jsx(M,{icon:"lucide:search"})}),classNames:{base:b?gr.fill:v?it.inputBaseNarrow:gr[u],inputWrapper:it.inputWrapper,innerWrapper:it.innerWrapper,input:it.input}})}),d]})},El=({searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i=!1,clearLabel:o="Clear search",children:l,trailing:d,searchWidth:u="md",size:x="md",variant:m="default",className:p,"data-testid":f="admin-toolbar"})=>m==="framed"?t.jsx(Vx,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchIcon:r,searchClearable:i,clearLabel:o,trailing:d,searchWidth:u,size:x,className:p,"data-testid":f,children:l}):t.jsxs("div",{role:"search","data-testid":f,className:c.cn(Wt.base,p),children:[t.jsx(Dl,{searchValue:e,onSearchChange:s,searchLabel:n,searchPlaceholder:a,searchClearable:i,clearLabel:o,size:x,dataTestId:f,startContent:r?t.jsx("span",{"aria-hidden":"true",className:c.cn(Wt.icon,x==="lg"&&Es.icon),children:r}):void 0,classNames:{base:zx[u],inputWrapper:Wt.inputWrapper,input:Wt.input}}),l,d?t.jsx("div",{className:Wt.trailing,children:d}):null]});El.displayName="AdminToolbar";const Ux="ml-0.5 inline-flex min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",Hx="ml-0.5 inline-flex min-w-[1.125rem] items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",Wx="h-9 gap-1.5 rounded-full border border-gray-200 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 data-[pressed=true]:bg-gray-50",Ll=h.forwardRef(function({icon:s,children:n,count:a,appearance:r="pill",className:i,testId:o,...l},d){return r==="outline"?t.jsxs(T,{ref:d,"data-testid":o,"data-appearance":"outline",color:"default",variant:"bordered",radius:"md",size:"md",className:c.cn("rounded-[0.75rem] font-normal",i),...l,children:[t.jsx(M,{icon:s,className:"size-4","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Hx,children:a})]}):t.jsxs(T,{ref:d,"data-testid":o,variant:"light",size:"sm",className:c.cn(Wx,i),...l,children:[t.jsx(M,{icon:s,className:"size-4 text-gray-500","aria-hidden":!0}),t.jsx("span",{children:n}),a!==void 0&&a>0&&t.jsx("span",{className:Ux,children:a})]})});Ll.displayName="ToolbarButton";const mn="w-full mb-4 border-b border-pos-line",fn=["max-w-fit h-auto rounded-none border-b-2 border-transparent","data-[selected=true]:border-primary","data-[disabled=true]:opacity-40 data-[hover-unselected=true]:opacity-100",Ce].join(" "),qx={md:{base:"w-full mb-6",tabList:"gap-7 w-full relative rounded-none p-0 border-b border-acct-border",cursor:"w-full bg-acct-rust",tab:`max-w-fit px-0.5 h-auto pb-3 ${Ce}`,tabContent:`text-[0.9375rem] font-medium text-acct-sub group-data-[selected=true]:font-semibold group-data-[selected=true]:text-acct-rust ${Ce}`},lg:{base:mn,tabList:"w-full -mb-px gap-2 rounded-none p-0",cursor:"hidden",tab:`${fn} min-h-11 px-5 py-0`,tabContent:`text-[0.9375rem] leading-5 font-semibold text-pos-neutral group-data-[selected=true]:text-primary ${Ce}`},"sm-primary":{base:mn,tabList:"w-full -mb-px gap-6 rounded-none px-0.5 py-0",cursor:"hidden",tab:`${fn} px-0.5 py-2.5`,tabContent:`text-[0.84375rem] leading-4 font-medium text-pos-muted group-data-[selected=true]:text-pos-ink ${Ce}`},"sm-secondary":{base:mn,tabList:"w-full -mb-px gap-0 rounded-none p-0",cursor:"hidden",tab:`${fn} px-[1.125rem] py-[0.5625rem]`,tabContent:`text-[0.8125rem] leading-4 font-semibold text-pos-muted group-data-[selected=true]:text-primary ${Ce}`}},jr={base:"mb-0 border-b-0",tabList:"mb-0 border-b-0"},Gx="data-[animated=true]:transition-none";function Fl({items:e,value:s,onChange:n,ariaLabel:a,size:r="md",level:i="primary",showDivider:o=!0,className:l,"data-testid":d="underline-tabs"}){const u=_s(),x=qx[r==="sm"?`sm-${i}`:r],m=r!=="md",p=e.filter(f=>f.isDisabled).map(f=>f.key);return t.jsx(c.Tabs,{"aria-label":a,variant:"underlined",selectedKey:s,onSelectionChange:f=>n(String(f)),disabledKeys:p,disableCursorAnimation:m,"data-testid":d,"data-size":r,classNames:{...x,base:c.cn(x.base,!o&&jr.base,l),tabList:c.cn(x.tabList,!o&&jr.tabList),cursor:c.cn(x.cursor,u&&Gx),panel:"p-0"},children:e.map(f=>t.jsx(c.Tab,{title:f.label,titleValue:f.hint,"data-testid":`${d}-${f.key}`,children:f.content},f.key))})}Fl.displayName="UnderlineTabs";const ia="text-[11px] font-semibold uppercase tracking-[.04em] text-acct-muted mb-1.5",Rl="font-normal normal-case tracking-normal",_l="ms-0.5 text-acct-danger",Ml="mb-0 min-h-[calc(var(--heroui-font-size-small)_+_10px)] text-foreground",Pl="after:content-none",Il="ms-0.5 -my-1.5 size-6 min-w-6 align-middle text-acct-sub data-[hover=true]:bg-acct-page data-[hover=true]:text-acct-ink",Tl="size-4",Ol="max-w-xs rounded-xl px-3 py-2 text-xs leading-normal text-acct-ink2",zl=["h-[38px] min-h-[38px] !h-[38px] rounded-[11px] border border-acct-border bg-acct-surface px-3","data-[hover=true]:border-acct-rust-border","group-data-[focus=true]:border-acct-rust"].join(" "),Bl="text-[13.5px] text-acct-ink",Vl="bg-acct-page text-acct-muted cursor-default",Ul="mt-[5px] text-xs text-acct-sub",Hl="mt-[5px] text-xs text-acct-danger";function Kx({label:e}){return t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:_l,children:"*"}),e?t.jsxs(t.Fragment,{children:[" ",t.jsx("span",{className:"sr-only",children:e})]}):null]})}function Yx({help:e,label:s,labelledBy:n,testId:a}){const r=s?{"aria-label":s}:{"aria-labelledby":n};return t.jsxs(c.Popover,{placement:"top",showArrow:!0,children:[t.jsx(c.PopoverTrigger,{children:t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",color:"default",radius:"full",...r,testId:a,className:Il,children:t.jsx(M,{"aria-hidden":!0,icon:"solar:info-circle-outline",className:Tl})})}),t.jsx(c.PopoverContent,{...r,"data-testid":`${a}-content`,className:Ol,children:e})]})}function Wl(e,s,n,a){return t.jsxs(t.Fragment,{children:[e,s?t.jsxs("span",{className:Rl,children:[" ",s]}):null,n?t.jsx(Kx,{label:a}):null]})}const la=({children:e,suffix:s,htmlFor:n,id:a,isRequired:r,requiredLabel:i,help:o,helpLabel:l,className:d,"data-testid":u="admin-field-label"})=>{const x=h.useId(),m=Wl(e,s,r,i),p=se(o),f=a??(p?x:void 0);return t.jsxs("div",{"data-testid":u,className:c.cn(ia,d),children:[n?t.jsx("label",{id:f,htmlFor:n,children:m}):f?t.jsx("span",{id:f,children:m}):m,p&&f?t.jsx(Yx,{help:o,label:l,labelledBy:f,testId:`${u}-help`}):null]})};la.displayName="AdminFieldLabel";const ql=({label:e,labelSuffix:s,value:n,onChange:a,placeholder:r,disabled:i=!1,readOnly:o=!1,mono:l=!1,autoFocus:d=!1,hint:u,invalid:x=!1,isRequired:m=!1,requiredLabel:p,help:f,helpLabel:g,className:v,"data-testid":b="admin-text-field"})=>{const y=h.useId(),N=h.useId(),k=se(e),w=k&&se(f),$=t.jsx(c.Input,{labelPlacement:k&&!w?"outside":void 0,label:k&&!w?Wl(e,s,m,p):void 0,id:w?y:void 0,"aria-labelledby":w?N:void 0,value:n,placeholder:r,isDisabled:i,isReadOnly:o,autoFocus:d,isInvalid:x,isRequired:k&&m,validationBehavior:"aria",description:!x&&u?u:void 0,errorMessage:x?u:void 0,onValueChange:a,"data-testid":b,variant:"bordered",radius:"none",classNames:{base:c.cn("w-full",!w&&v),label:c.cn(ia,Pl),inputWrapper:zl,input:c.cn(Bl,(l||o)&&"font-mono",o&&Vl),description:Ul,errorMessage:Hl}});return w?t.jsxs("div",{className:c.cn("w-full",v),children:[t.jsx(la,{id:N,htmlFor:y,suffix:s,isRequired:m,requiredLabel:p,help:f,helpLabel:g,className:Ml,"data-testid":`${b}-label`,children:e}),$]}):$};ql.displayName="AdminTextField";const Qx={sm:"size-6 min-w-6",md:"size-[30px] min-w-[30px]"},Gl=({actions:e,size:s="md",className:n,"data-testid":a="row-actions"})=>t.jsx("div",{role:"presentation","data-testid":a,className:c.cn("inline-flex gap-0.5",n),onClick:r=>r.stopPropagation(),children:e.map(r=>t.jsx(T,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:r.onPress,isDisabled:r.disabled,"aria-label":r.label,title:r.label,"data-testid":`${a}-${r.key}`,className:c.cn("text-acct-sub data-[hover=true]:bg-acct-hair",Qx[s]),children:r.icon},r.key))});Gl.displayName="RowActions";const Kl=({children:e,placeholder:s="Select…",onOpen:n,onClear:a,ariaLabel:r,icon:i,trailingIcon:o,clearIcon:l,disabled:d=!1,className:u,"data-testid":x="picker-row"})=>{const m=e!=null;return t.jsxs("div",{"data-testid":x,className:c.cn("flex w-full min-h-10 items-center rounded-[10px] border border-acct-border bg-acct-surface px-[11px] transition-colors duration-150",d?"opacity-60":"hover:border-acct-rust-border",u),children:[t.jsxs(T,{variant:"light",radius:"none",disableAnimation:!0,onPress:n,isDisabled:d,"aria-haspopup":"dialog","aria-label":r,"data-testid":`${x}-trigger`,className:"flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-2.5 bg-transparent px-0 py-2 text-left text-inherit data-[hover=true]:bg-transparent",children:[i?t.jsx("span",{className:"flex shrink-0 text-acct-muted",children:i}):null,m?t.jsx("span",{className:"flex min-w-0 items-center gap-2",children:e}):t.jsx("span",{className:"text-[13.5px] font-semibold text-acct-sub",children:s}),o?t.jsx("span",{className:"ml-auto flex shrink-0 text-acct-muted",children:o}):null]}),m&&a?t.jsx(T,{isIconOnly:!0,variant:"light",radius:"sm",size:"sm",onPress:a,isDisabled:d,"aria-label":`Clear ${r}`,title:"Clear","data-testid":`${x}-clear`,className:"ml-1.5 size-6 min-w-6 shrink-0 text-acct-muted data-[hover=true]:bg-acct-hair",children:l}):null]})};Kl.displayName="PickerRow";const Ee={base:"relative flex w-full items-center gap-2 transition-colors",content:"flex min-w-0 flex-1 items-center gap-3 text-left",pressTarget:["static z-auto flex h-auto min-h-0 min-w-0 flex-1 items-center justify-start gap-3","overflow-visible whitespace-normal transform-none rounded-none bg-transparent px-0","text-left font-normal text-inherit no-underline","data-[hover=true]:bg-transparent data-[hover=true]:opacity-100 data-[pressed=true]:opacity-100","hover:!opacity-100 active:!opacity-100","outline-none data-[focus-visible=true]:outline-0","after:absolute after:inset-0","data-[focus-visible=true]:after:ring-2 data-[focus-visible=true]:after:ring-focus"].join(" "),text:"flex min-w-0 flex-col",titleLine:"flex min-w-0 items-center gap-2",title:"truncate font-medium text-default-900",subtitle:"truncate text-default-600",tags:"flex shrink-0 items-center gap-1",side:"relative z-10 flex shrink-0 items-center gap-1",chevron:"flex shrink-0 text-default-500",menuTrigger:"text-default-600",menuWithDescriptions:"max-w-xs",menuItemDescription:"whitespace-normal text-default-600",menuItemDisabledWithDescription:"opacity-100",menuItemDimmed:"opacity-disabled",menuItemDimmedIcon:"flex shrink-0 opacity-disabled",avatar:"shrink-0 bg-default-200 text-default-700",dangerItem:"text-danger"},Zx={default:void 0,primary:"text-primary-800",success:void 0,warning:"text-warning-800",danger:void 0},Xx={plain:{row:"rounded-xl px-2",hover:"hover:bg-default-100",overlay:"after:rounded-xl"},bordered:{row:"rounded-lg border border-default-200 bg-white px-3",hover:"hover:bg-default-50",overlay:"after:rounded-lg"}},Yl={md:{row:"min-h-12",content:"py-1",title:"text-sm leading-6",subtitle:"text-xs leading-4",avatar:"sm",control:"md"},lg:{row:"min-h-14",content:"py-1.5",title:"text-base leading-6",subtitle:"text-sm leading-5",avatar:"md",control:"lg"}},Jx={md:void 0,lg:"min-h-12 text-base"},ep={none:"",sm:"gap-1",md:"gap-2"},Ql="m-0 flex list-none flex-col p-0",Et={row:"flex items-center gap-3 px-2",avatar:{md:"size-8 shrink-0 rounded-full",lg:"size-10 shrink-0 rounded-full"},lines:"flex flex-col gap-2",title:"h-4 rounded-md",subtitle:"h-3 w-44 rounded-md",titleWidths:["w-32","w-28","w-36","w-24","w-40","w-28"]},Zl=h.createContext(!1),tp=()=>t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:t.jsx("path",{d:"m9 5 7 7-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),sp=()=>t.jsxs("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false",children:[t.jsx("circle",{cx:"5",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"12",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),t.jsx("circle",{cx:"19",cy:"12",r:"1.75",stroke:"currentColor",strokeWidth:"1.5"})]});function np(e){const s=e.trim().split(/\s+/).filter(Boolean);if(s.length===0)return"—";const n=s[0]?.charAt(0)??"",a=s.length>1?s[s.length-1]?.charAt(0)??"":"";return`${n}${a}`.toUpperCase()}const Xl=({title:e,subtitle:s,leading:n,tags:a,onPress:r,href:i,linkAs:o,"aria-haspopup":l,trailing:d,showChevron:u=!1,chevronIcon:x,actions:m,actionsLabel:p,actionsIcon:f,size:g,variant:v="plain",isDisabled:b=!1,as:y,className:N,"data-testid":k="entity-row"})=>{const w=h.useContext(Zl),$=Ms(),A=g??($==="touch"?"lg":"md"),j=Yl[A],D=Xx[v],S=y??(w?"li":"div"),_=h.useId(),F=h.useId(),L=h.useId(),P=h.useId(),B=i!==void 0||r!==void 0,H=a!==void 0&&a.length>0,K=se(s),O=m!==void 0&&m.length>0,ne=typeof e=="string"?e:void 0,G=O&&m.some(z=>se(z.description)),te=O?m.filter(z=>z.isDisabled===!0&&se(z.description)).map(z=>`${z.label}: ${z.description}`).join(" "):"",Y=n?t.jsx(c.Avatar,{"aria-hidden":"true",size:j.avatar,radius:n.shape==="square"?"lg":"full",src:n.src,icon:n.icon,name:n.icon!==void 0?void 0:n.initials??n.name??ne,getInitials:n.initials!==void 0?z=>z:np,showFallback:n.src!==void 0,classNames:{base:Ee.avatar},"data-testid":`${k}-leading`}):null,ce=t.jsxs(t.Fragment,{children:[Y,t.jsxs("span",{className:Ee.text,children:[t.jsxs("span",{className:Ee.titleLine,children:[t.jsx("span",{id:_,className:c.cn(Ee.title,j.title),title:ne,children:e}),H&&t.jsx("span",{id:F,className:Ee.tags,children:a.map(z=>t.jsx(c.Chip,{size:"sm",variant:"flat",color:z.tone??"default",className:Zx[z.tone??"default"],"data-testid":`${k}-tag-${z.key}`,children:z.label},z.key))})]}),K&&t.jsx("span",{id:L,className:c.cn(Ee.subtitle,j.subtitle),children:s})]})]}),ee=[H?F:null,K?L:null].filter(Boolean).join(" "),J={"aria-labelledby":_,"aria-describedby":ee===""?void 0:ee,isDisabled:b,className:c.cn(Ee.pressTarget,D.overlay,j.content)},le=`${k}-trigger`;let U;return i!==void 0?U=t.jsx(c.Link,{...J,"data-testid":le,as:o,href:i,color:"foreground",underline:"none",onPress:r,children:ce}):r!==void 0?U=t.jsx(T,{...J,testId:le,variant:"light",color:"default",radius:"none",disableAnimation:!0,disableRipple:!0,"aria-haspopup":l,onPress:r,children:ce}):U=t.jsx("div",{className:c.cn(Ee.content,j.content),children:ce}),t.jsxs(S,{"data-testid":k,"data-size":A,"data-disabled":b||void 0,className:c.cn(Ee.base,D.row,j.row,B&&!b&&D.hover,N),children:[U,(se(d)||O)&&t.jsxs("div",{className:Ee.side,children:[d,O&&t.jsxs(c.Dropdown,{placement:"bottom-end",children:[t.jsx(c.DropdownTrigger,{children:t.jsx(T,{isIconOnly:!0,size:j.control,variant:"light",color:"default",radius:"full",isDisabled:b,"aria-label":p,"aria-describedby":te===""?void 0:P,testId:`${k}-menu-trigger`,className:Ee.menuTrigger,children:f??t.jsx(sp,{})})}),t.jsx(c.DropdownMenu,{"aria-label":p,"data-testid":`${k}-menu`,className:G?Ee.menuWithDescriptions:void 0,disabledKeys:m.filter(z=>z.isDisabled).map(z=>z.key),onAction:z=>{m.find(Q=>Q.key===z)?.onAction()},items:m,children:z=>{const Q=z.isDisabled===!0&&se(z.description);return t.jsx(c.DropdownItem,{textValue:z.label,description:z.description,color:z.tone==="danger"?"danger":"default",className:c.cn(z.tone==="danger"&&Ee.dangerItem,Jx[A],Q&&Ee.menuItemDisabledWithDescription),classNames:{title:Q?Ee.menuItemDimmed:void 0,description:c.cn(Ee.menuItemDescription,j.subtitle)},startContent:Q&&z.icon!==void 0?t.jsx("span",{className:Ee.menuItemDimmedIcon,children:z.icon}):z.icon,"data-testid":z["data-testid"]??`${k}-menu-${z.key}`,children:z.label},z.key)}})]}),te!==""&&t.jsx("span",{id:P,hidden:!0,"data-testid":`${k}-menu-trigger-description`,children:te})]}),u&&t.jsx("span",{"aria-hidden":"true",className:Ee.chevron,"data-testid":`${k}-chevron`,children:x??t.jsx(tp,{})})]})};Xl.displayName="EntityRow";const Jl=({children:e,"aria-label":s,"aria-labelledby":n,gap:a="none",className:r,"data-testid":i="entity-list"})=>t.jsx("ul",{"aria-label":s,"aria-labelledby":n,"data-testid":i,className:c.cn(Ql,ep[a],r),children:t.jsx(Zl.Provider,{value:!0,children:e})});Jl.displayName="EntityList";const eo=({label:e,rows:s=6,size:n,className:a,"data-testid":r="entity-list-skeleton"})=>{const i=Ms(),o=n??(i==="touch"?"lg":"md"),{titleWidths:l}=Et;return t.jsxs("div",{"aria-busy":"true","data-testid":r,className:a,children:[t.jsx("span",{role:"status",className:"sr-only",children:e}),t.jsx("ul",{"aria-hidden":"true",className:Ql,children:Array.from({length:s},(d,u)=>t.jsxs("li",{"data-testid":`${r}-row`,className:c.cn(Et.row,Yl[o].row),children:[t.jsx(ie,{className:Et.avatar[o]}),t.jsxs("span",{className:Et.lines,children:[t.jsx(ie,{className:c.cn(Et.title,l[u%l.length])}),t.jsx(ie,{className:Et.subtitle})]})]},u))})]})};eo.displayName="EntityListSkeleton";function to(e,s,n){if(n<=0||s<=0||e<=0)return{from:0,to:0};const a=(e-1)*s+1;return a>n?{from:0,to:0}:{from:a,to:Math.min(n,e*s)}}const so=({page:e,pageSize:s,total:n,unit:a,announce:r=!0,format:i,className:o,classNames:l={},"data-testid":d="pagination-summary"})=>{const{from:u,to:x}=to(e,s,n),m=c.cn("font-semibold text-default-700",l.emphasis);return t.jsx("p",{"data-testid":d,"aria-live":r?"polite":void 0,className:c.cn("text-sm text-default-500",o,l.base),children:i?i({from:u,to:x,total:n}):t.jsxs(t.Fragment,{children:["Showing"," ",t.jsx("span",{"data-testid":`${d}-range`,className:m,children:u===0?0:`${u}–${x}`})," ","of"," ",t.jsx("span",{"data-testid":`${d}-total`,className:m,children:n}),a?t.jsxs(t.Fragment,{children:[" ",a]}):null]})})};so.displayName="PaginationSummary";const Vs="shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",ct={base:"overflow-hidden rounded-2xl border border-pos-line bg-white",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",icon:"flex shrink-0 text-default-500 [&_svg]:size-[1.125rem]",action:"ml-auto",description:"m-0 text-[0.84375rem] leading-[1.55] text-default-500 [&_b]:font-bold [&_b]:tabular-nums [&_b]:text-default-900",footer:"flex flex-wrap gap-2",footerAfterContent:"mt-[0.875rem]",footerAfterDescription:"mt-3"},ap={card:Vs,flat:""},rp={section:"flex flex-wrap items-center gap-2 px-5 pt-4",aside:"flex flex-wrap items-center gap-[0.5625rem] px-[1.125rem] pt-[0.9375rem]"},ip={section:{padded:"px-5 pb-[1.125rem] pt-[0.875rem]",rows:"px-5 pb-[1.125rem] pt-2.5",flush:"pt-3",none:""},aside:{padded:"px-[1.125rem] pb-[1.125rem] pt-3",rows:"px-[1.125rem] pb-[1.125rem] pt-3",flush:"pt-3",none:""}},no=({isLoading:e=!1,isError:s=!1,isEmpty:n=!1,loadingTitle:a="Loading…",loadingContent:r,errorTitle:i="Something went wrong",errorDescription:o,retryLabel:l="Retry",onRetry:d,errorActions:u,errorContent:x,emptyTitle:m="Nothing here yet",emptyDescription:p,emptyIcon:f,emptyActions:g,emptyContent:v,children:b,toolbar:y,variant:N="default",className:k,classNames:w={},"data-testid":$="list-panel"})=>{const A=N==="framed",j={base:c.cn("border-0 bg-transparent py-12",w.state)},D=A?{base:c.cn("px-6 py-[3.625rem]",w.state),iconWrapper:"mb-[1.125rem] size-[4.75rem] rounded-[1.25rem] border-0 bg-default-100 text-default-400",icon:"size-[2.875rem]",title:"text-[1.0625rem] font-semibold text-default-900",description:"mt-1.5 max-w-[26.25rem] text-[0.875rem] leading-[1.55] text-default-500",actions:"mt-[1.375rem] gap-2.5"}:j;let S;return e?S=r??t.jsx(aa,{title:a,classNames:j,"data-testid":`${$}-loading`}):s?S=x??t.jsx(na,{title:i,description:o,classNames:j,"data-testid":`${$}-error`,actions:u??(d?t.jsx(T,{color:"primary",variant:"flat",onPress:d,children:l}):void 0)}):n?S=v??t.jsx(sa,{surface:A?"panel":void 0,title:m,description:p,icon:f,actions:g,classNames:D,"data-testid":`${$}-empty`}):S=b,t.jsxs("section",{"data-testid":$,"data-variant":A?"framed":void 0,className:c.cn(A?`overflow-hidden rounded-2xl border border-pos-line bg-white ${Vs}`:"rounded-xl bg-white p-2 shadow-sm",k,w.base),children:[y,S]})};no.displayName="ListPanel";const oa=(e,s)=>s<=0?/^\d*$/.test(e):new RegExp(`^\\d*(?:[.,]\\d{0,${s}})?$`).test(e),ss=e=>{const s=Number.parseFloat(e.replace(",","."));return Number.isFinite(s)?s:null},ao=(e,s)=>{const[n,a]=h.useState(()=>s(e)),r=(ss(n)??0)===(e??0)?n:s(e),i=h.useCallback(()=>{a(o=>{const l=ss(o);return l===null?"":String(l)})},[]);return{draft:r,setDraft:a,normalize:i}},lp=/^[\d.,]+$/,ro=(e,s=Object.is)=>{const n=h.useRef(e),a=h.useRef(null);h.useLayoutEffect(()=>{n.current=e},[e]);const r=h.useCallback(()=>{const l=a.current,d=n.current;return l===null||!(s(d,l.source)||s(d,l.emitted))},[s]),i=h.useCallback(l=>{a.current={source:n.current,emitted:l}},[]),o=h.useCallback(()=>{a.current=null},[]);return h.useMemo(()=>({isUntouched:r,markEdited:i,markUntouched:o}),[r,i,o])},io=(e,s)=>{const n=h.useRef(null),a=h.useRef(s);return h.useLayoutEffect(()=>{a.current=s},[s]),h.useEffect(()=>{const r=n.current;if(!r)return;const i=l=>{e()&&(l.inputType==="insertText"&&l.data&&lp.test(l.data)?(l.preventDefault(),a.current(l.data)):l.inputType.startsWith("delete")&&(l.preventDefault(),a.current("")))},o=()=>{requestAnimationFrame(()=>{r.isConnected&&e()&&r.select()})};return r.addEventListener("beforeinput",i),r.addEventListener("pointerup",o),()=>{r.removeEventListener("beforeinput",i),r.removeEventListener("pointerup",o)}},[e]),n},op=350,cp={receivedLabel:"Cash Received",receivedPlaceholder:"$0.00",changeLabel:"Change",changeMessageTemplate:"You have to give back the client {change} in change",insufficientMessageTemplate:"Amount received must be at least {due}",exactAmountLabel:"Exact",exactAmountAriaTemplate:"Exact amount {amount}",quickAmountsLabel:"Quick cash amounts",quickAmountAriaTemplate:"Add {amount}"},dp=7,up=e=>[...new Set((e??[]).filter(s=>Number.isFinite(s)&&s>0))].sort((s,n)=>s-n).slice(0,dp),mp=(e,s,n)=>{if(!Number.isInteger(e))return xe(e,s,n);try{return new Intl.NumberFormat(s,{style:"currency",currency:n,minimumFractionDigits:0}).format(e)}catch{return xe(e,s,n)}},fp=(e,s)=>(e??0)===(s??0),qt=(e,s)=>Object.entries(s).reduce((n,[a,r])=>n.replace(`{${a}}`,r),e),xp=({dueAmount:e,received:s,defaultReceived:n=null,onChange:a,locale:r="en-US",labels:i,isDisabled:o=!1,maxAmount:l,quickAmounts:d,showExactAmount:u=!0,autoFocus:x=!1,className:m,"data-testid":p="cash-tender-form"})=>{const f={...cp,...i},g=Pt(e.currency,r),v=s!==void 0,[b,y]=h.useState(n??null),N=v?s:b,{draft:k,setDraft:w,normalize:$}=ao(N,U=>U==null?"":String(U)),{isUntouched:A,markEdited:j,markUntouched:D}=ro(N,fp),S=h.useMemo(()=>{const U=typeof N=="number"&&Number.isFinite(N)?N:0,z=Nn(U,e.value,e.currency,r);return{received:U,change:z>0?z:0,isValid:U>=e.value&&U>0}},[N,e.value,e.currency,r]),_=h.useCallback(U=>{const z=U.currentTarget;requestAnimationFrame(()=>{z.isConnected&&z.select()})},[]),F=h.useCallback(U=>{v||y(U);const z=typeof U=="number"&&Number.isFinite(U)?U:0,Q=Nn(z,e.value,e.currency,r);a?.({received:z,change:Q>0?Q:0,isValid:z>=e.value&&z>0})},[v,e.value,e.currency,r,a]),L=h.useCallback(U=>{if(o)return;const z=U.replace(/[^\d.,]/g,"");if(!oa(z,g))return;const Q=ss(z);Q!==null&&l!==void 0&&Q>l||(w(z),j(Q),F(Q))},[o,l,w,j,g,F]),P=io(A,L),B=h.useMemo(()=>up(d),[d]),H=U=>l!==void 0&&U>l,K=()=>{o||H(e.value)||(w(String(e.value)),D(),F(e.value))},O=U=>{if(o)return;const z=A()||typeof N!="number"||!Number.isFinite(N)?0:N,Q=qn(z+U,e.currency,r);H(Q)||(w(String(Q)),j(Q),F(Q))},ne=S.isValid&&S.change>0,G=!S.isValid&&S.received>0,te=xe(S.change,r,e.currency),Y=xe(e.value,r,e.currency),[ce,ee]=h.useState(""),J=h.useRef(null);h.useEffect(()=>{J.current&&clearTimeout(J.current);const U=ne?qt(f.changeMessageTemplate,{change:te}):"",z=ne?op:0;return J.current=setTimeout(()=>ee(U),z),()=>{J.current&&clearTimeout(J.current)}},[ne,te,f.changeMessageTemplate]);const le=`${p}-received`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[t.jsx(c.Input,{ref:P,id:le,label:f.receivedLabel,labelPlacement:"outside",type:"text",inputMode:g===0?"numeric":"decimal",pattern:g===0?"[0-9]*":"[0-9]*[.,]?[0-9]*",value:k,onChange:U=>L(U.target.value),onFocus:_,onBlur:$,placeholder:f.receivedPlaceholder,isDisabled:o,isInvalid:G,errorMessage:G?qt(f.insufficientMessageTemplate,{due:Y}):void 0,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${p}-received-input`}),B.length>0&&t.jsx("div",{className:"[container-type:inline-size]",children:t.jsxs("div",{role:"group","aria-label":f.quickAmountsLabel,className:"grid grid-cols-4 gap-2 [@container(min-width:55rem)]:grid-cols-8","data-testid":`${p}-quick-amounts`,children:[u&&t.jsxs(T,{variant:"flat",color:"primary",radius:"lg",className:"h-auto min-h-11 min-w-0 whitespace-normal px-2 py-1 text-sm font-semibold leading-tight",isDisabled:o,"aria-label":qt(f.exactAmountAriaTemplate,{amount:Y}),onPress:K,"data-testid":`${p}-quick-amount-exact`,children:[f.exactAmountLabel," ",Y]}),B.map(U=>{const z=mp(U,r,e.currency);return t.jsx(T,{variant:"bordered",color:"default",radius:"lg",className:"h-auto min-h-11 min-w-0 px-2 text-base font-semibold text-default-900",isDisabled:o,"aria-label":qt(f.quickAmountAriaTemplate,{amount:z}),onPress:()=>O(U),"data-testid":`${p}-quick-amount-${U}`,children:z},U)})]})}),ne&&t.jsx(c.Alert,{"data-testid":`${p}-change-alert`,color:"primary",variant:"flat",radius:"lg",title:f.changeLabel,description:qt(f.changeMessageTemplate,{change:te}),icon:t.jsx(M,{icon:"lucide:info",width:20,height:20,"aria-hidden":"true"}),"aria-live":"off",classNames:{base:"bg-info-50 text-info-700",title:"font-semibold",description:"text-sm leading-relaxed",iconWrapper:"bg-transparent shadow-none border-0"}}),t.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:ce})]})},pp={checkNumberLabel:"Check Number",checkNumberPlaceholder:"e.g. 11234",bankNameLabel:"Bank Name",bankNamePlaceholder:"e.g. Chase Bank",dateLabel:"Date",checkNumberRequiredMessage:"Check number is required"},wr=()=>{const e=new Date,s=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`},lo=({dueAmount:e,value:s,defaultValue:n,onChange:a,labels:r,hideDate:i=!1,hideBankName:o=!1,isDisabled:l=!1,checkNumberMaxLength:d=34,bankNameMaxLength:u=100,autoFocus:x=!1,className:m,"data-testid":p="check-tender-form"})=>{const f={...pp,...r},g=s!==void 0,[v,b]=h.useState({checkNumber:n?.checkNumber??"",bankName:n?.bankName??"",date:n?.date??wr()}),[y,N]=h.useState(!!n?.checkNumber),k=h.useMemo(()=>g?{checkNumber:s?.checkNumber??"",bankName:s?.bankName??"",date:s?.date??wr()}:v,[g,s,v]),w=h.useCallback(F=>{g||b(F);const L=F.checkNumber.trim(),P={amount:e.value,checkNumber:L,bankName:F.bankName.trim()||void 0,date:i?void 0:F.date,isValid:L.length>0&&e.value>0};a?.(P)},[g,e.value,i,a]),$=h.useCallback(F=>L=>{l||(F==="checkNumber"&&L.length>0&&N(!0),w({...k,[F]:L}))},[k,w,l]),A=h.useCallback(()=>{l||N(!0)},[l]),j=y&&k.checkNumber.trim()==="",D=`${p}-check-number`,S=`${p}-bank-name`,_=`${p}-date`;return t.jsxs("div",{className:c.cn("grid grid-cols-1 sm:grid-cols-2 gap-4",m),"data-testid":p,children:[t.jsx(c.Input,{id:D,label:f.checkNumberLabel,labelPlacement:"outside",type:"text",value:k.checkNumber,onChange:F=>$("checkNumber")(F.target.value),onBlur:A,placeholder:f.checkNumberPlaceholder,maxLength:d,isRequired:!0,isInvalid:j,errorMessage:j?f.checkNumberRequiredMessage:void 0,isDisabled:l,variant:"bordered",radius:"lg",autoFocus:x,"data-testid":`${p}-check-number-input`}),!o&&t.jsx(c.Input,{id:S,label:f.bankNameLabel,labelPlacement:"outside",type:"text",value:k.bankName,onChange:F=>$("bankName")(F.target.value),placeholder:f.bankNamePlaceholder,maxLength:u,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-bank-name-input`}),!i&&t.jsx(c.Input,{id:_,label:f.dateLabel,labelPlacement:"outside",type:"date",value:k.date,onChange:F=>$("date")(F.target.value),isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${p}-date-input`,className:"sm:col-span-2"})]})};lo.displayName="CheckTenderForm";const hp={methodLabel:"Method",methodPlaceholder:"Select a payment method",referenceLabel:"Reference",referencePlaceholder:"e.g. Voucher #1234",methodRequiredMessage:"Method is required"},bp=[{value:"ach",label:"ACH"},{value:"wire",label:"Wire"},{value:"gift_card",label:"Gift Card"},{value:"voucher",label:"Voucher"},{value:"other",label:"Other"}],oo=({dueAmount:e,methodOptions:s=bp,value:n,defaultValue:a,onChange:r,labels:i,showReference:o=!1,isDisabled:l=!1,className:d,"data-testid":u="other-tender-form"})=>{const x={...hp,...i},m=n!==void 0,[p,f]=h.useState({method:a?.method??"",reference:a?.reference??""}),g=h.useMemo(()=>m?{method:n?.method??"",reference:n?.reference??""}:p,[m,n,p]),v=h.useCallback($=>s.find(A=>A.value===$)?.label??"",[s]),b=h.useCallback($=>{m||f($);const A=v($.method),j={amount:e.value,method:$.method,description:A,reference:$.reference.trim()||void 0,isValid:$.method!==""};r?.(j)},[m,e.value,r,v]),y=h.useCallback($=>{if(l)return;const A=typeof $=="string"?$:Array.from($)[0]?.toString()??"";b({...g,method:A})},[g,b,l]),N=h.useCallback($=>{l||b({...g,reference:$})},[g,b,l]),k=`${u}-method`,w=`${u}-reference`;return t.jsxs("div",{className:c.cn("flex flex-col gap-3",d),"data-testid":u,children:[t.jsx(at,{id:k,label:x.methodLabel,labelPlacement:"outside",placeholder:x.methodPlaceholder,selectedKeys:g.method?[g.method]:[],onSelectionChange:y,isDisabled:l,isRequired:!0,variant:"bordered",radius:"lg","data-testid":`${u}-method-select`,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:s.map($=>t.jsx(c.SelectItem,{"data-testid":`${u}-method-option-${$.value}`,children:$.label},$.value))}),o&&t.jsx(c.Input,{id:w,label:x.referenceLabel,labelPlacement:"outside",type:"text",value:g.reference,onChange:$=>N($.target.value),placeholder:x.referencePlaceholder,isDisabled:l,variant:"bordered",radius:"lg","data-testid":`${u}-reference-input`})]})};oo.displayName="OtherTenderForm";const gp={collectedHeading:"Collected",remainingLabel:"Remaining:",completeLabel:"Complete",removeAriaLabel:"Remove this tender",removeTooltipForRecorded:"Already recorded",statusPending:"Pending",statusRecorded:"Approved",statusFailed:"Failed"},yp={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},vp={pending:"warning",recorded:"success",failed:"danger"},jp=e=>e==="pending"||e==="recorded",wp=e=>`#${e+1}`,co=({total:e,tenders:s,onRemove:n,locale:a="en-US",labels:r,hideCollectedList:i=!1,variant:o="banner",className:l,"data-testid":d="split-payment-summary"})=>{const u={...gp,...r},{collected:x,remaining:m,isComplete:p}=h.useMemo(()=>{const g=s.reduce((b,y)=>jp(y.status)?b+y.amount:b,0),v=Math.max(e.value-g,0);return{collected:g,remaining:v,isComplete:g>=e.value&&e.value>0}},[s,e.value]),f=g=>g==="pending"?u.statusPending:g==="recorded"?u.statusRecorded:u.statusFailed;return t.jsxs("div",{className:c.cn("flex flex-col gap-4",l),"data-testid":d,children:[o==="compact"?t.jsxs("div",{className:"flex items-baseline justify-between gap-3","data-testid":`${d}-remaining-banner`,children:[t.jsx("span",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("span",{className:"text-base font-semibold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(p?x:m,a,e.currency)})]}):t.jsxs("div",{className:"rounded-2xl bg-default-100 px-6 py-5 text-center","data-testid":`${d}-remaining-banner`,children:[t.jsx("div",{className:"text-sm text-default-600",children:p?u.completeLabel:u.remainingLabel}),t.jsx("div",{className:"mt-1 text-4xl font-bold tracking-tight","data-testid":`${d}-remaining-amount`,children:xe(p?x:m,a,e.currency)})]}),!i&&s.length>0&&t.jsxs("div",{className:"flex flex-col gap-2","data-testid":`${d}-collected-list`,children:[t.jsx("h3",{className:"text-base font-semibold",children:u.collectedHeading}),s.map((g,v)=>t.jsx(Np,{index:v,tender:g,locale:a,currency:e.currency,removable:!!n&&g.status!=="recorded",onRemove:n?()=>n(g.id):void 0,statusLabel:f(g.status),removeAriaLabel:u.removeAriaLabel,recordedTooltip:u.removeTooltipForRecorded,dataTestId:`${d}-row-${v}`},g.id))]})]})};co.displayName="SplitPaymentSummary";const Np=({index:e,tender:s,locale:n,currency:a,removable:r,onRemove:i,statusLabel:o,removeAriaLabel:l,recordedTooltip:d,dataTestId:u})=>{const x=i?t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:i,isDisabled:!r,"aria-label":l,"data-testid":`${u}-remove`,className:c.cn(r?"text-default-700 hover:bg-default-200":"text-default-300"),children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})}):null;return t.jsxs("div",{className:"flex items-center gap-3 rounded-xl bg-default-50 px-4 py-3 motion-safe:animate-[pp-row-in_200ms_ease-out]","data-testid":u,children:[t.jsx("span",{className:"text-sm font-medium text-default-500 w-6 shrink-0",children:wp(e)}),t.jsx(M,{icon:yp[s.type],width:20,height:20,className:"text-default-700 shrink-0","aria-hidden":"true"}),t.jsx("span",{className:"flex-1 truncate","data-testid":`${u}-label`,children:s.label}),t.jsx("span",{className:"font-semibold tabular-nums","data-testid":`${u}-amount`,children:xe(s.amount,n,a)}),t.jsx(c.Chip,{size:"sm",radius:"full",variant:"flat",color:vp[s.status],startContent:s.status==="recorded"?t.jsx(M,{icon:"lucide:check-circle",width:14,height:14,"aria-hidden":"true"}):s.status==="failed"?t.jsx(M,{icon:"lucide:alert-circle",width:14,height:14,"aria-hidden":"true"}):void 0,"data-testid":`${u}-status`,children:o}),x&&(r?x:t.jsx(c.Tooltip,{content:d,placement:"left",children:t.jsx("span",{tabIndex:0,"aria-label":d,children:x})}))]})},Cp=`
17
17
  @keyframes pp-modal-in {
18
18
  from { opacity: 0; transform: scale(0.96); }
19
19
  to { opacity: 1; transform: scale(1); }
@@ -38,5 +38,5 @@ ${n}${a}
38
38
  from { opacity: 0; transform: translateY(-6px); }
39
39
  to { opacity: 1; transform: translateY(0); }
40
40
  }
41
- `,oo=h.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:vp}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));oo.displayName="ModalShell";const co=({title:e,subtitle:s,leading:n,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(M,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});co.displayName="ModalShellHeader";const uo=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",n),"data-testid":a,children:e});uo.displayName="ModalShellFooter";const jp={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},wp={1:"grid-cols-1",2:"grid-cols-2"},vt={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${Ne} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},He={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${Ne}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},ms=e=>typeof e=="string"?t.jsx(M,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,Np=(e,s,n)=>{const a=`${e}-${s.key}`;return{badge:n&&s.badge!==void 0?`${a}-badge`:void 0,reason:`${a}-reason`,description:n&&s.description!==void 0?`${a}-description`:void 0}},Cp=e=>t.jsx("span",{"aria-hidden":"true",className:vt.icon,children:typeof e=="string"?t.jsx(M,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),fs=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${Ne}`,kp="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",vr="flex-none",Sp=typeof window<"u"?h.useLayoutEffect:h.useEffect,jr=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",mo=({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:x="md",className:m,"data-testid":p="tile-select"})=>{const f=x==="sm",g=e.find(y=>y.key===s),v=e.some(y=>y.badge!==void 0||y.isLocked===!0),b=!f&&v;return i==="compact"?t.jsx($p,{options:e,selectedKey:s,onSelect:n,ariaLabel:r,moreLabel:l,dataTestId:p,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${p}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(nt,{"aria-label":a?void 0:r,"aria-labelledby":a?`${p}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const k=Array.from(y)[0];typeof k=="string"&&n(k)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${p}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ms(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled||y.isLocked,...v&&y.description!==void 0?{description:y.description}:{},endContent:y.badge!==void 0?t.jsx("span",{className:He.badge,children:y.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:ms(y.icon)}),"data-testid":y["data-testid"]??`${p}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${p}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",f?vt.grid:"gap-3",wp[u],jp[d]),"data-size":x,children:e.map(y=>{const N=s===y.key,k=y.isLocked===!0&&y.isDisabled!==!0,w=y.lockedReason??y.badge,$=Np(p,y,b),A=[$.badge,k&&w!==void 0&&(f||w!==y.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(T,{variant:"bordered",radius:"lg","aria-pressed":N,"aria-label":y.label,"aria-disabled":k||void 0,"aria-describedby":A||void 0,isDisabled:y.isDisabled,onPress:()=>{k||n(y.key)},"data-testid":y["data-testid"]??`${p}-${y.key}`,"data-locked":k||void 0,className:f?c.cn(vt.tile,k?vt.locked:N?vt.active:vt.idle):c.cn(He.tile,b&&He.detailed,k?He.locked:N?He.active:He.idle),"data-size":x,children:[f?t.jsxs(t.Fragment,{children:[Cp(y.icon),t.jsx("span",{className:vt.label,children:y.label})]}):b?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:He.header,children:[t.jsx("span",{"aria-hidden":"true",className:k?He.lockedIcon:void 0,children:ms(y.icon)}),y.badge!==void 0?t.jsx("span",{id:$.badge,className:He.badge,children:y.badge}):null]}),t.jsx("span",{className:He.label,children:y.label}),y.description!==void 0?t.jsx("span",{id:$.description,className:c.cn(He.description,k&&He.lockedDescription),children:y.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:k?He.lockedIcon:void 0,children:ms(y.icon)}),t.jsx("span",{className:He.label,children:y.label})]}),k&&w!==void 0&&(f||w!==y.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:w}):null]},y.key)})})]})};mo.displayName="TileSelect";function $p({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),x=h.useRef(null),m=h.useMemo(()=>e.map((D,S)=>({option:D,index:S})).filter(({option:D})=>D.alwaysInMenu!==!0).map(({index:D})=>D),[e]),p=m.length<e.length,f=h.useCallback(D=>{const S=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,L)=>F.priority-L.priority||L.index-F.index),_=new Set(S.slice(0,m.length-D).map(F=>F.index));return m.filter(F=>!_.has(F))},[e,m]),[g,v]=h.useState(e.length);Sp(()=>{const D=u.current,S=x.current;if(!D||!S)return;const _=()=>{const L=Array.from(S.children),P=L.slice(0,e.length).map(G=>G.getBoundingClientRect().width),B=L[e.length]?.getBoundingClientRect().width??0,H=window.getComputedStyle(D),K=Number.parseFloat(H.columnGap)||0,O=D.clientWidth-(Number.parseFloat(H.paddingLeft)||0)-(Number.parseFloat(H.paddingRight)||0);if(O<=0||P.some(G=>G===0)){v(m.length);return}const ne=G=>{const te=p||G<m.length,Y=G+(te?1:0);return f(G).reduce((ee,J)=>ee+(P[J]??0),0)+(te?B:0)+K*(Y-1)<=O};for(let G=m.length;G>=1;G-=1)if(ne(G)){v(G);return}v(1)};_();const F=new ResizeObserver(_);return F.observe(D),()=>F.disconnect()},[e,o,f,m,p]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),N=!p&&b===m.length-1&&g===m.length?m.length:b,k=p||N<m.length,w=new Set(f(N)),$=e.filter((D,S)=>w.has(S)),A=k?e.filter((D,S)=>!w.has(S)):[],j=A.find(D=>D.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(D=>t.jsx(T,{variant:"light",radius:"full","aria-pressed":s===D.key,isDisabled:D.isDisabled||D.isLocked,onPress:()=>n(D.key),"data-testid":D["data-testid"]??`${d}-${D.key}`,className:c.cn(fs,jr(s===D.key)),children:D.label},D.key)),A.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(T,{variant:"light",radius:"full","aria-pressed":j!==void 0,"data-testid":`${d}-more`,className:c.cn(fs,"gap-1",j!==void 0?"min-w-0":"min-w-fit",jr(j!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:j?.label??o}),t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:j?[j.key]:[],disabledKeys:A.filter(D=>D.isDisabled||D.isLocked).map(D=>D.key),onAction:D=>n(String(D)),children:A.map(D=>t.jsx(c.DropdownItem,{textValue:D.label,...D.description!==void 0?{description:D.description}:{},"data-testid":D["data-testid"]??`${d}-${D.key}`,children:D.label},D.key))})]})]}),t.jsxs("div",{ref:x,"aria-hidden":"true",className:kp,children:[e.map(D=>t.jsx(T,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(fs,vr),children:D.label},D.key)),t.jsxs(T,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(fs,vr,"gap-1"),children:[o,t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const Ap={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},fo=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=Ap[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:fe(e.value,n,e.currency)})]})};fo.displayName="PaymentTotalBanner";const Dp={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},xo=({title:e,subtitle:s,backdrop:n="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Dp[n],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});xo.displayName="LoadingOverlay";const ia=({cashChange:e,label:s="Cash to return",secondaryLine:n,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(M,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:fe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),r&&t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};ia.displayName="PaymentCashChangeBanner";const po=({title:e,subtitle:s,emailLine:n,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":x="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":x,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(M,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${x}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(ia,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${x}-cash-change`}),d&&t.jsx(T,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${x}-close`,className:"mt-4 w-full",children:l})]})};po.displayName="PaymentSuccessView";const la=({heading:e,amountLabel:s,value:n,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:x,maxAmount:m,hideHeading:p=!1,className:f,"data-testid":g="payment-sub-amount-input"})=>{const v=`${g}-input`,b=n!==void 0,[y,N]=h.useState(a??""),k=b?n:y,{isUntouched:w,markEdited:$}=no(k),A=h.useCallback(S=>{if(m!==void 0){const _=Number.parseFloat(S.replace(",","."));if(Number.isFinite(_)&&_>m)return}$(S),b||N(S),r?.(S)},[m,r,$,b]),j=ao(w,A),D=h.useCallback(S=>{const _=S.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{ref:j,id:v,label:s,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:k,onChange:S=>A(S.target.value),onFocus:D,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:x,"data-testid":`${g}-field`})]})};la.displayName="PaymentSubAmountInput";const Ep={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},Lp=e=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e,oa=({isOpen:e,title:s,confirmLabel:n,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:x,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:f,"data-testid":g="confirm-dialog"})=>{const v=i??o??null,b=Ep[d],y=p?null:Lp(f??b.icon);return t.jsx(ts,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(x??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[y?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:y}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),v!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof v=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(T,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(T,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};oa.displayName="ConfirmDialog";const gt={item:"list-none",box:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",body:"gap-3 px-4 py-3",text:"flex min-w-0 flex-col gap-1",message:"text-sm text-gray-900 [overflow-wrap:anywhere]",description:"text-sm text-gray-600 [overflow-wrap:anywhere]",actions:"flex flex-wrap items-center gap-2"},Fp={danger:"bg-danger-50",warning:"bg-warning-50"},ho=({message:e,description:s,confirmLabel:n,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:x="sm",as:m="div",className:p,"data-testid":f="inline-confirm"})=>{const g=h.useId(),v=h.useId(),b=h.useRef(null),y=h.useRef(null),N=h.useRef(null),k=s!=null,w=h.useRef({isPending:l,containEscape:u,onCancel:i});w.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?y:N).current?.focus()},[]),h.useEffect(()=>{const j=b.current;if(j===null)return;const D=S=>{S.key==="Escape"&&(w.current.containEscape&&S.stopPropagation(),!w.current.isPending&&w.current.onCancel())};return j.addEventListener("keydown",D),()=>j.removeEventListener("keydown",D)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const j=b.current;if(j===null)return;const D=document.activeElement;if(l){const S=D===null||D===document.body||!j.contains(D),_=D instanceof HTMLButtonElement&&D.disabled;$.current&&(S||_)&&j.focus({preventScroll:!0});return}D===j&&(d==="confirm"?y:N).current?.focus()},[l,d]);const A=t.jsx(c.Card,{ref:b,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":k?v:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:j=>{const D=j.relatedTarget;$.current=D instanceof Node&&j.currentTarget.contains(D)},className:c.cn(gt.box,Fp[o],m==="div"&&p),"data-testid":f,children:t.jsxs(c.CardBody,{className:gt.body,children:[t.jsxs("div",{className:gt.text,children:[t.jsx("p",{id:g,className:gt.message,children:e}),k?t.jsx("p",{id:v,className:gt.description,children:s}):null]}),t.jsxs("div",{className:gt.actions,children:[t.jsx(T,{ref:y,size:x,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:n}),t.jsx(T,{ref:N,size:x,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(gt.item,p),children:A}):A};ho.displayName="InlineConfirm";const Rp={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Bs=h.createContext(Rp),ca=h.createContext(null);function _p(e){const{report:s,unreport:n}=h.useContext(Bs),a=h.useContext(ca),r=h.useId();h.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),h.useEffect(()=>()=>n(r),[n,r])}function Mp(){const{guardScope:e,bypass:s}=h.useContext(Bs);return h.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function bo(){const{guardScope:e}=h.useContext(Bs),s=h.useContext(ca);return h.useCallback(n=>e(s,n),[e,s])}const Pp=({scope:e,children:s})=>t.jsx(ca.Provider,{value:e,children:s}),go=({guard:e,children:s,title:n="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:x,report:m,unreport:p,guardScope:f}=e.internals,g=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:p}),[f,e.bypass,m,p]);return t.jsxs(Bs.Provider,{value:g,children:[s,t.jsx(oa,{isOpen:l!==null,onOpenChange:v=>{v||x()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};go.displayName="DiscardGuard";const da=h.createContext(null);function Ip(){const e=h.useContext(da),s=bo(),n=e?.back,a=h.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const Tp=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function Op(e){for(const s of e.querySelectorAll(Tp))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function wr(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const zp=new Set(["menu","listbox","dialog","grid","tree"]);function Bp(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||zp.has(n.getAttribute("role")??""))return n}return null}const Nr="react-aria-focus-scope-restore";class Vp{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&wr(s.last,n)?s.last:null)??(wr(s.entry,n)?s.entry:null)??Op(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?Bp(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const Up="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Hp="min-w-0 flex-1 truncate text-large font-semibold",Wp="flex shrink-0 items-center gap-2",qp="size-5";function Gp({panels:e,children:s}){const[n]=h.useState(()=>new Vp),{entries:a,back:r}=e,i=a[a.length-1].key,o=h.useRef(null);return h.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(Kp,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const Kp=({entryKey:e,isActive:s,canGoBack:n,back:a,memory:r,children:i})=>{const o=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const x=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Nr,x),()=>{u.removeEventListener(Nr,x),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(da.Provider,{value:d,children:t.jsx(Pp,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},yo=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(da),u=bo(),x=h.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Up,o),"data-testid":l,children:[m?t.jsx(T,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":x,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(M,{icon:"solar:arrow-left-outline",className:qp,"aria-hidden":"true"})}):null,t.jsx("h2",{id:x,className:Hp,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:Wp,children:i}):null]})};yo.displayName="ModalPanelHeader";function Yp(e){const s=h.useRef(1),[n]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(x=>{const m=`panel-${s.current}`;return s.current+=1,{key:m,panel:x}},[]),o=h.useCallback(x=>{const m=i(x);r(p=>[...p,m])},[i]),l=h.useCallback(()=>{r(x=>x.length>1?x.slice(0,-1):x)},[]),d=h.useCallback(x=>{const m=i(x);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(x=>{r([i(x===void 0?n:x)])},[i,n]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function Qp(){const e=h.useRef(new Map),[s,n]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let b=0;for(const y of e.current.values())y.isDirty&&(b+=1);n(b)},[]),d=h.useCallback((b,y)=>{e.current.set(b,y),l()},[l]),u=h.useCallback(b=>{e.current.delete(b),l()},[l]),x=h.useCallback((b,y)=>{let N=!1;for(const k of e.current.values())k.isDirty&&(b===null||k.scope===b)&&(N=!0);N?r({leave:y}):y()},[]),m=h.useCallback(b=>x(null,b),[x]),p=h.useCallback(b=>{for(const y of e.current.values())y.isDirty=!1;l(),r(null),b()},[l]),f=h.useCallback(b=>y=>{y?b(!0):m(()=>b(!1))},[m]),g=h.useCallback(()=>{const b=a?.leave;r(null),o(y=>y+1),b?.()},[a]),v=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:s>0,guard:m,bypass:p,guardOpenChange:f,internals:{pending:a,confirmKey:i,confirm:g,keepEditing:v,report:d,unreport:u,guardScope:x}}),[s,m,p,f,a,i,g,v,d,u,x])}const Zp=60,Xp=(e,s,n=Zp)=>s?e>n:e<-n,vo=(e,s)=>Math.max(0,Math.min(e,s)),Jp=160,eh=(e,s,n=Jp)=>Math.min(e,Math.max(0,s-n)),th=(e,s,n)=>vo(e-s,n),sh=(e,s,n)=>e!==null?vo(e,n):s?n:0,nh=e=>e?"":"transition-[height] duration-300 ease-out",ah=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(th(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{Xp(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Nt=(e,s)=>fe(e.value,s,e.currency),Cr=`opacity-60 transition-opacity ${Ne}`,ua=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:Ze[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&Cr),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:c.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&Cr),children:Nt(e.amount,s)}),l&&t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>n(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),se(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,x)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??x}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??x}`,className:"flex shrink-0 items-center",children:t.jsx(M,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??x)),o&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(ua,{item:u,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};ua.displayName="SummaryItemRow";const jo=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Nt(e.amount,s)})]});jo.displayName="SummaryServiceFeeRow";const ma=({row:e,locale:s,emphasized:n,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(n?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",o&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:c.cn("whitespace-nowrap",!o&&"text-base",e.amountTone==="success"&&"text-success"),children:Nt(e.amount,s)})]})};ma.displayName="SummaryTotalsLineRow";const wo=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:x,emptyState:m,compact:p=!1,classNames:f})=>{const g=(n?.length??0)>0;return t.jsxs(t.Fragment,{children:[!p&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),g?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:n.map(v=>t.jsx(ua,{item:v,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:x,compact:p},v.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(jo,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(p?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((v,b)=>t.jsx(ma,{row:v,locale:i,emphasized:!p&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:x,compact:p},v.key))})]})};wo.displayName="SummaryBody";const No=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:Nt(e.amount,s)})]})};No.displayName="SummaryGrandTotalRow";const Co=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Nt(e.amount,s)})]});Co.displayName="SummarySecondaryTotalRow";const Ds=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(T,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Ds.displayName="SummaryPrimaryCta";const ko=({title:e,total:s,secondaryTotal:n,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(M,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:Nt(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:Nt(n.amount,a)})]})]})]})});ko.displayName="SummaryCollapseHeader";const So=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(M,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});So.displayName="SummaryCartButton";const $o=({open:e,progress:s,dragging:n,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:x})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",x.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(So,{cart:i,ariaLabel:o,className:x.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(Ds,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",x.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(Ds,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",x.cta)})})]}),l&&t.jsx("div",{children:l})]});$o.displayName="SummaryActionBar";const rh="(max-width: 767px)",ih=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,lh=(e=rh)=>{const[s,n]=h.useState(()=>ih(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Ao=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:x,secondaryTotal:m,collapsible:p,isOpen:f,onToggleOpen:g,defaultOpen:v=!1,primaryAction:b,isLoading:y=!1,onRemoveItem:N,showRemoveButton:k,ctaCaption:w,ctaError:$,variant:A,cart:j,emptyState:D,labels:S,classNames:_={},density:F="default","data-testid":L="summary",className:P})=>{const B=S?.removeAriaLabel??"Remove item",H=S?.removeTotalRowAriaLabel??"Remove discount",K=S?.removePostTotalRowAriaLabel??"Remove applied code",O=S?.toggleAriaLabel??"Toggle summary",ne=S?.cartAriaLabel??"View cart",G=F==="compact",te=lh(),oe=p??(A??(te?"mobile":"main"))==="mobile",[ee,J]=h.useState(v),ie=f!==void 0,U=!oe||(ie?f:ee),z=h.useCallback(()=>{ie||J(I=>!I),g?.()},[ie,g]),[Q,Be]=h.useState(0),[Fe,Re]=h.useState(null),ae=h.useRef(null),Ce=h.useRef(null),Ve=h.useCallback(()=>{const I=ae.current;I&&Be(eh(I.scrollHeight,window.innerHeight))},[]),at=h.useCallback(I=>{Ce.current?.disconnect(),Ce.current=null,ae.current=I,I&&(Ve(),typeof ResizeObserver<"u"&&(Ce.current=new ResizeObserver(Ve),Ce.current.observe(I)))},[Ve]);h.useEffect(()=>(window.addEventListener("resize",Ve),()=>window.removeEventListener("resize",Ve)),[Ve]);const ye=ah({open:U,fullHeight:Q,setDragHeight:Re,onToggleOpen:z}),Ue=Fe!==null,de=sh(Fe,U,Q),ve=Q>0?Math.min(1,Math.max(0,de/Q)):U?1:0,je=t.jsx(No,{total:l,locale:a,compact:G,className:_.total}),C=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(I=>t.jsx(ma,{row:I,locale:a,emphasized:!1,onRemove:x,removeAriaLabel:K,showRemoveButton:k,compact:G},I.key))}),E=m&&t.jsx(Co,{secondaryTotal:m,locale:a,className:_.secondaryTotal}),R=w!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:w}),W=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:$}),V=t.jsx(wo,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:N,removeAriaLabel:B,onRemoveTotalRow:u,removeTotalRowAriaLabel:H,showRemoveButton:k,emptyState:D,compact:G,classNames:_});return oe?t.jsxs(ze.motion.section,{"data-testid":L,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ye.onDrag,onDragEnd:ye.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",P,_.base),children:[t.jsx(ko,{title:e,total:l,secondaryTotal:m,locale:a,open:U,progress:ve,dragging:Ue,toggleAriaLabel:O,onToggleOpen:z,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:de},className:c.cn("min-h-0",U&&!Ue?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",nh(Ue)),children:t.jsxs("div",{ref:at,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),je,C,E]})}),t.jsx($o,{open:U,progress:ve,dragging:Ue,primaryAction:b,isLoading:y,cart:j,cartAriaLabel:ne,ctaCaption:R,ctaError:W,onToggleOpen:z,classNames:_})]}):t.jsxs("section",{"data-testid":L,className:c.cn(G?"flex w-full flex-col gap-3 rounded-2xl border border-default-200 bg-content1 p-4":"flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",P,_.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),je,C,E,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(Ds,{action:b,disabledByLoading:y,className:c.cn("w-full",_.cta)}),W,R]})};Ao.displayName="Summary";const it={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},kr={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},oh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},ch={ariaLabel:"Progress",completed:"completed"},fa=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...ch,...i},u=e.filter(p=>p.state!=="skipped"),x=Math.max(0,u.findIndex(p=>p.id===s)),m=p=>p<x?"done":p===x?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(it.list,o),"data-testid":l,children:u.map((p,f)=>{const g=m(f),v=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(it.segment,"w-full",kr[g]),"data-testid":`${l}-segment-${p.id}`}),t.jsxs("span",{className:c.cn(it.name,oh[g]),"data-testid":`${l}-name-${p.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:it.check,"data-testid":`${l}-check-${p.id}`,children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:p.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),b=r?r(p.id,f):f<x,y=g==="active"?"step":void 0;return t.jsx("li",{className:it.item,"aria-current":a?void 0:y,"data-state":g,"data-testid":`${l}-step-${p.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(it.step,it.button),disabled:!b,"aria-current":y,onClick:()=>a(p.id),"data-testid":`${l}-button-${p.id}`,children:v}):t.jsx("div",{className:it.step,children:v})},p.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(it.bare,o),"data-testid":l,children:u.map((p,f)=>t.jsx("span",{className:c.cn(it.segment,"flex-1",kr[m(f)]),"data-state":m(f)},p.id))})};fa.displayName="StepProgress";const dh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},uh={backgroundColor:le.destructive,color:"#fff"},mh={warn:{backgroundColor:le["warn-fill"],color:le.warn},ok:{backgroundColor:le["ok-fill"],color:le.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${le.line}`}},mn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",fn="absolute top-0 h-5 w-5 opacity-0",Do=({onClose:e,steps:s,activeStepId:n,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:x,className:m,"data-testid":p="wizard-shell",children:f})=>{const g={...dh,...x},v=s.find(N=>N.id===n),b=r??e,y=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":p,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${p}-header`,children:[b&&t.jsx(T,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:b,"data-testid":`${p}-header-back`,startContent:t.jsx(M,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:y}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${p}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${p}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(fn,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(fn,"left-6"),"data-testid":`${p}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(fn,"left-12"),"data-testid":`${p}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${p}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:fe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${p}-total-of`,children:fe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(mn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:g.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(mn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:g.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:mn,style:mh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(T,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?uh:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx(fa,{steps:s,activeStepId:n,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${p}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:f}),u]})};Do.displayName="WizardShell";const fh=(e,s,n)=>Math.min(Math.max(e,s),n);function Dn(e,s,n){const a=Math.max(1,Math.trunc(s)),r=fh(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Mt(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function xh(e,s){return Dn(e,s,1)}const ph=e=>Number.isFinite(e)?e.toFixed(2):"",En=({value:e,expected:s,max:n,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,x]=h.useState(null),m=h.useRef(null),p=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",p?"border-primary bg-primary-50":"border-pos-line bg-white",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??ph(e),onChange:f=>{const g=f.target.value,v=Number.parseFloat(g.replace(",","."));n!==void 0&&Number.isFinite(v)&&v>n+.004||(x(g),Number.isFinite(v)&&v>=0?a(v):g.trim()===""&&a(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>x(null),"data-testid":d})]})};En.displayName="AmountCell";const hh={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer (price adjustment)",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},bh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",Sr="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",xn="absolute h-5 w-5 opacity-0",gh=e=>{const s=fe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=xh(e.paidAmount,e.quantity);return`${e.quantity} × ${fe(n.value,void 0,n.currency)} · ${s}`},Eo=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...hh,...o},x=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const p=s[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,v=Math.max(1,Math.trunc(m.quantity)),b=p?.quantity,y=p?.selected?Math.min(b??v,v):b??0,N=Dn(m.paidAmount,v,y).value,k=p?.amount??(p?.selected?N:0),w=y===0&&k>.004,$=j=>n(m.id,{selected:j.quantity>0||j.amount>.004,mode:"full",...j}),A=j=>{const D=Math.min(Math.max(j,0),v);$({quantity:D,amount:Dn(m.paidAmount,v,D).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(M,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??gh(m)}),w&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:fe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(En,{value:k,expected:N,max:m.paidAmount.value,onChange:j=>$({quantity:y,amount:j}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),f?t.jsx("span",{className:bh,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:Sr,"aria-label":u.decrease.replace("{name}",m.name),disabled:y===0,onClick:()=>A(y-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:y}),t.jsx("button",{type:"button",className:Sr,"aria-label":u.increase.replace("{name}",m.name),disabled:y===v,onClick:()=>A(y+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),y>=v&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(v))}),p?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),y>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(nt,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:j=>{if(j==="all")return;const D=[...j][0];D&&(r?.(m.id,D),a(m.id,D==="stock"))},"data-testid":`${g}-restock`,children:x.map(j=>t.jsx(c.SelectItem,{children:j.label},j.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(xn,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:j=>n(m.id,{selected:j,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(xn,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:y,amount:N}),className:c.cn(xn,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(M,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",fe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(En,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(M,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Eo.displayName="LineItemList";const yh={color:le.danger},Lo=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Lo.displayName="MetaCard";const Fo=({label:e,htmlFor:s,required:n,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:yh,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});Fo.displayName="MetaCard.Row";const Ro=({label:e,children:s,className:n,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});Ro.displayName="MetaCard.Section";const vh=Object.assign(Lo,{Row:Fo,Section:Ro}),_o=({heading:e,icon:s="lucide:rotate-ccw",action:n,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(M,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(M,{icon:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});_o.displayName="SectionPanel";const Mo=({name:e,detail:s,icon:n="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:n,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});Mo.displayName="CustomerCard";const jh={label:"Reason for the return",placeholder:"Select a reason…"},Po=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...jh,...i};return t.jsx(nt,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const x=[...u][0];x&&n(String(x))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};Po.displayName="ReasonSelect";const wh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Io=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...wh,...i},[u,x]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(T,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>x(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};Io.displayName="NotesField";const Nh={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},Ch="solar:close-circle-linear",kh={callout:{root:"flex items-start gap-[0.5625rem] rounded-xl px-3.5 py-3 text-[0.78125rem] leading-normal",iconWrapper:"flex h-[1.5em] shrink-0 items-center",iconSize:"1.25em",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"",actions:"mt-2 flex flex-wrap items-center gap-2",dismiss:"-my-1.5 -me-2 size-8 min-w-8 shrink-0 text-current"},banner:{root:"flex items-start gap-3.5 rounded-[0.875rem] px-[1.125rem] py-4 text-pos-ink",iconWrapper:"flex size-10 shrink-0 items-center justify-center rounded-full",iconSize:"1.375rem",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"text-[0.8125rem] text-pos-neutral",actions:"mt-3 flex flex-wrap gap-2.5",dismiss:"-my-1 -me-1.5 size-8 min-w-8 shrink-0 text-pos-neutral"}},Sh={info:{callout:"bg-pos-info-fill text-pos-info",banner:"bg-pos-info-fill",disc:"bg-pos-info/15 text-pos-info",title:"text-pos-info"},success:{callout:"bg-pos-ok-fill text-pos-ok",banner:"bg-pos-ok-fill",disc:"bg-pos-ok/15 text-pos-ok",title:"text-pos-ok"},warning:{callout:"bg-pos-warn-fill text-pos-warn",banner:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"},danger:{callout:"bg-pos-danger-fill text-pos-danger",banner:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"}},$h={info:"status",success:"status",warning:"alert",danger:"alert"};function xa({tone:e="info",variant:s="callout",title:n,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=$h[e],className:d,"data-testid":u="notice"}){const x=Fs(),m=kh[s],p=Sh[e],f=s==="banner",g=se(n),v=se(a),b=g?f?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,p.title),children:n}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:n}):null,y=v?f?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,g&&"mt-0.5"),children:a}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:a}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":s,"data-testid":u,className:c.cn(m.root,f?p.banner:p.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn(m.iconWrapper,f&&p.disc),children:t.jsx(M,{icon:Nh[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[b,y]}):t.jsxs("p",{children:[b,g&&v?" ":null,y]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(T,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":o,onPress:i,disableAnimation:x,className:c.cn(m.dismiss,Ne),"data-testid":`${u}-dismiss`,children:t.jsx(M,{icon:Ch,width:"1.125rem",height:"1.125rem"})}):null]})}xa.displayName="Notice";const $r="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Vs=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:x})=>t.jsx(xa,{variant:"banner",tone:e,title:s,description:n,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[a&&t.jsx(T,{color:"primary",className:$r,onPress:a,"data-testid":u,children:r}),t.jsx(T,{variant:"bordered",className:c.cn($r,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":x,children:o})]})});Vs.displayName="TenderBanner";const Ah={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},Dh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},To=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...Ah,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(Vs,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(x=>{const m=x.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(x.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${x.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(M,{icon:Dh[x.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:x.label}),t.jsx("span",{className:"block text-xs text-default-500",children:fe(x.maxRefundable.value,void 0,x.maxRefundable.currency)})]})]},x.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};To.displayName="TenderMethods";const Eh=e=>e.refunded!==null,Lh={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},Fh="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Rh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Oo=({parts:e,refundedSoFar:s,remaining:n,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:x,className:m,"data-testid":p="split-tender-panel"})=>{const f={...Lh,...x},g=e.filter(Eh),v=e.find(j=>j.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),y=Mt(n.currency),{draft:N,setDraft:k,normalize:w}=so(a.amount,String),$=h.useCallback(j=>{ra(j,y)&&(k(j),a.onAmountChange(es(j)??0))},[a,k,y]),A=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":p,children:[t.jsx("h3",{className:"sr-only","data-testid":`${p}-title`,children:f.title}),o&&t.jsx(Vs,{tone:A?"danger":"warning",title:A?f.declinedTitle:f.networkTitle,body:A?f.partDeclinedBody:f.partNetworkBody,onRetry:o.onRetry,retryLabel:f.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${p}-part-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{"data-testid":`${p}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:fe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",fe(s.value,void 0,s.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Fh,children:f.refundedSoFar}),g.map((j,D)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${p}-part-${j.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",D+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(M,{icon:j.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:j.label}),j.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:j.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:fe(j.refunded.value,void 0,j.refunded.currency)}),t.jsx("span",{className:c.cn(Rh,j.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:j.status==="pending"?f.pending:f.succeeded})]},j.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${p}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:f.partHeading.replace("{n}",String(g.length+1))}),v&&t.jsx("span",{className:"text-xs text-default-500",children:v})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:f.amountForPart}),t.jsx(la,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:$,onBlur:w,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(j=>{const D=j.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":D,disabled:j.disabled||d,onClick:()=>a.onTenderChange?.(j.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",D?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${j.tenderId}`,children:[j.icon&&t.jsx(M,{icon:j.icon,width:15,height:15,"aria-hidden":"true"}),j.label]},j.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(T,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${p}-back`,children:f.back}),t.jsx(T,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${p}-submit`,children:f.submit})]})]})};Oo.displayName="SplitTenderPanel";const zo="hsl(var(--heroui-primary))",_h="hsl(var(--heroui-primary) / 0.05)",Bo="hsl(var(--heroui-default-100))",Vo="hsl(var(--heroui-default-600))",pa={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},ce={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},Mh={idle:{borderColor:le.line,backgroundColor:"#fff"},selected:{borderColor:zo,backgroundColor:_h},declined:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Es={idle:{backgroundColor:Bo,color:Vo},selected:{backgroundColor:zo,color:"#fff"}},Ph={backgroundColor:Bo,color:Vo},Ih={borderColor:le.line},Ar={declined:{color:le.danger},pending:{color:le.warn,backgroundColor:le["warn-fill"]},done:{color:le.ok,backgroundColor:le["ok-fill"]}},Th={heading:"Money back to",upTo:"Up to {amount}",noCap:"Tap to add an amount",amountFor:"Amount to {method}",remove:"Remove {method}",declined:"Declined",pending:"Pending",done:"Refunded",retry:"Try again",chooseDifferent:"Choose different method"},Oh=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},zh=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",x=u==="pending"||u==="done",m=n||x,p=!!(e.removable&&l),f=e.cap?.currency??s,g=Mt(f),v=`${d}-amount`,b=a.amountFor.replace("{method}",e.label),y=h.useCallback(A=>{if(!ra(A,g))return;const j=es(A);e.cap&&j!==null&&j>e.cap.value||i(e.id,A)},[g,e.cap,e.id,i]),N=h.useCallback(A=>{const j=A.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]),k=u==="declined"?"declined":e.selected?"selected":"idle",w=e.statusLabel??(u==="idle"?void 0:a[u]),$=t.jsxs("span",{className:ce.toggleHeader,children:[t.jsx("span",{className:ce.iconBox,style:e.selected?Es.selected:Es.idle,"data-testid":`${d}-icon`,children:t.jsx(M,{icon:pa[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:ce.text,children:[t.jsx("span",{className:ce.label,children:e.label}),u==="declined"&&w?t.jsx("span",{className:ce.status,style:Ar.declined,"data-testid":`${d}-status`,children:w}):e.subtitle&&t.jsx("span",{className:ce.subtitle,children:e.subtitle})]}),x&&w&&t.jsx("span",{className:ce.badge,style:Ar[u],"data-testid":`${d}-status`,children:w})]});return t.jsxs("div",{className:ce.card,style:Mh[k],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:ce.amountSlot,children:[t.jsx("label",{htmlFor:v,className:"sr-only",children:b}),t.jsx(c.Input,{id:v,"aria-label":b,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:A=>y(A.target.value),onFocus:N,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:Oh(f)}),classNames:{inputWrapper:ce.amountWrapper,input:ce.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(ce.toggle,ce.toggleUnselected,ce.focusRing,p&&ce.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:ce.lowerSlot,style:Ph,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",fe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),p&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:n,onClick:()=>l?.(e.id),className:c.cn(ce.remove,ce.focusRing),"data-testid":`${d}-remove`,children:t.jsx(M,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},Uo=({methods:e,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:x,className:m,"data-testid":p="refund-method-cards"})=>{const f={...Th,...x};return t.jsxs("div",{className:c.cn(ce.root,m),"data-testid":p,children:[d&&t.jsx(Vs,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:ce.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:ce.eyebrowRow,children:[t.jsx("p",{className:ce.eyebrow,children:f.heading}),o&&t.jsx(Os,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:ce.grid,"data-testid":`${p}-grid`,children:[e.map(g=>t.jsx(zh,{method:g,currency:i,busy:u,labels:f,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${p}-method-${g.id}`},g.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:ce.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(ce.another,ce.focusRing),style:Ih,"data-testid":`${p}-another`,children:[t.jsx("span",{className:ce.iconBox,style:Es.idle,children:t.jsx(M,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:ce.label,children:l.label}),t.jsx("span",{className:ce.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${p}-another-menu`,children:g=>t.jsx(c.DropdownItem,{textValue:g.label,description:g.description,className:ce.menuItem,startContent:t.jsx("span",{className:ce.iconBox,style:Es.idle,children:t.jsx(M,{icon:pa[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};Uo.displayName="RefundMethodCards";const We={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},Ho="hsl(var(--heroui-primary))",Bh={idle:{borderColor:le.line,backgroundColor:"#fff"},active:{borderColor:Ho,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:le.danger,backgroundColor:le["danger-fill"]}},Dr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:Ho,color:"#fff"}},Vh={backgroundColor:"#fff",color:le.neutral},Et=e=>({color:Ze[e].fg,backgroundColor:Ze[e].bg}),Uh={queued:Et("neutral"),processing:Et("info"),waiting_reader:Et("warn"),waiting_cash:Et("warn"),done:Et("ok"),failed:Et("danger")},Hh={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},Wh={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Er={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},qh=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",Wo=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Hh,...n},o=s??e.find(qh)?.id;return t.jsxs("div",{className:c.cn(We.root,a),"data-testid":r,children:[t.jsx("p",{className:We.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:We.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,x=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:We.row,style:Bh[x],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:We.main,children:[t.jsx("span",{className:We.iconBox,style:d?Dr.active:Dr.idle,children:t.jsx(M,{icon:pa[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:We.text,children:[t.jsx("span",{className:We.label,children:l.label}),l.note&&t.jsx("span",{className:We.note,children:l.note})]}),t.jsx("span",{className:We.amount,children:fe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:We.badge,style:Uh[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(M,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[Wh[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:We.prompt,style:Vh,"data-testid":`${u}-prompt`,children:[Er[l.status]&&t.jsx(M,{icon:Er[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:We.promptText,children:l.prompt}),l.action&&t.jsx(T,{color:"primary",className:We.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};Wo.displayName="RefundProgressList";const Gh={label:"Supervisor authorization",placeholder:"••••"},qo=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...Gh,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(M,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};qo.displayName="PinField";const Kh={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},Yh={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},Qh={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},Zh="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Wt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",Xh="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",Jh=["email","print"],vs=`${Ne} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,we={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${vs}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${vs}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${vs}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},Go=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:x,onSendReceipt:m,receiptActions:p,emailReceipt:f,onDone:g,frameless:v=!1,labels:b,className:y,"data-testid":N="outcome-view"})=>{const k={...Kh,...Yh[s],...b},w=h.useId(),$=n?fe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",y),"aria-live":"polite","data-testid":N,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${N}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${Tr}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:k.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${N}-processing-total`,children:$})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!v&&Xh,y),"aria-live":"polite","data-testid":N,children:[t.jsxs("div",{className:c.cn("text-center",s==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:we.changeTitle,"data-testid":`${N}-title`,children:k.title}),t.jsx("p",{className:we.changeLabel,children:k.changeDue}),t.jsx("p",{className:we.changeAmount,"data-testid":`${N}-change`,children:fe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:we.changeCaption,"data-testid":`${N}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${N}-title`,children:k.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${N}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-reason`,children:k.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-paid-with`,children:[t.jsx("p",{className:Wt,children:k.paidWithTitle}),o.map((A,j)=>t.jsxs("div",{className:we.paidRow,"data-testid":`${N}-paid-with-${j}`,children:[A.icon&&t.jsx("span",{className:we.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(M,{icon:A.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:we.paidLabel,children:A.label}),t.jsx("span",{className:we.paidAmount,children:fe(A.amount.value,void 0,A.amount.currency)}),A.status&&t.jsx("span",{className:we.paidStatus,children:A.status})]},`${A.label}-${j}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-outcome`,children:[t.jsx("p",{className:Wt,children:k.outcomeTitle}),t.jsx("div",{className:we.groups,children:l.map((A,j)=>t.jsxs("div",{"data-testid":`${N}-outcome-${j}`,children:[t.jsx("p",{className:we.groupLabel,children:A.label}),t.jsx("ul",{className:we.groupItems,"aria-label":A.label,children:A.items.map((D,S)=>t.jsx("li",{className:we.groupItem,children:D},`${D}-${S}`))})]},`${A.label}-${j}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Wt,children:k.destinationsTitle}),a.map((A,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${N}-destination-${j}-${A.status}`,children:[t.jsx("span",{className:"font-semibold",children:A.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:fe(A.amount.value,void 0,A.amount.currency)}),t.jsx("span",{className:c.cn(Zh,Qh[A.status]),children:A.status==="succeeded"?k.succeeded:k.pending})]})]},`${A.label}-${j}`))]}),p&&p.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${N}-receipt-actions`,children:[t.jsx("p",{className:Wt,children:k.sendReceipt}),t.jsx("div",{className:we.receiptRow,children:p.map(A=>t.jsx(eb,{action:A,controls:A.expanded?w:void 0,"data-testid":`${N}-receipt-action-${A.key}`},A.key))}),f&&t.jsx(tb,{id:w,email:f,labels:k,"data-testid":`${N}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Wt,children:k.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:Jh.map(A=>{const j=x?.includes(A)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>m(A),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${Ne}`,"data-testid":`${N}-receipt-${A}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:k[A]})]},A)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${N}-authorized-by`,children:k.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(T,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${vs}`,onPress:g,"data-testid":`${N}-done`,children:k.done})})]})};Go.displayName="OutcomeView";function eb({action:e,controls:s,"data-testid":n}){return t.jsx(T,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(we.receiptAction,e.expanded&&we.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(M,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":n,children:e.label})}function tb({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:we.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(we.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:we.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(T,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:we.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(M,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${Ne}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(T,{color:"secondary",className:we.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Ie={base:"relative inline-grid min-w-[var(--filter-select-min)] max-w-max shrink grow basis-[var(--filter-select-min)] grid-cols-[minmax(0,1fr)] [--filter-select-min:6rem]",baseActive:"[--filter-select-min:8rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 max-w-[20rem] overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[2.0625rem] text-[0.875rem]",sizerActive:"pr-[3.4375rem] font-semibold",select:"w-full [contain:inline-size]",trigger:"h-[2.375rem] min-h-[2.375rem] rounded-[0.625rem] border-medium border-pos-field bg-white px-2 shadow-none data-[hover=true]:border-default-300 data-[focus=true]:border-primary data-[open=true]:border-primary data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-primary data-[focus-visible=true]:ring-offset-1",triggerActive:"!border-acct-rust-border !bg-acct-rust-fill pr-[1.875rem]",value:"text-[0.875rem] !text-default-900",valueActive:"font-semibold !text-primary-600",iconActive:"!text-primary-600",clear:"absolute right-[1.875rem] top-1/2 z-20 inline-flex size-[1.25rem] -translate-y-1/2 items-center justify-center rounded-md text-primary-600 outline-none hover:bg-white/70 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",clearIcon:"size-[0.8125rem]",optionTitle:"whitespace-normal break-words"},sb="grid shrink grow basis-0 grid-flow-col auto-cols-auto gap-2.5 [--filter-select-cap:16rem] max-w-[calc(var(--filter-select-count)*var(--filter-select-cap)+(var(--filter-select-count)-1)*0.625rem)] [&>[data-slot=filter-select]]:max-w-none",nb="calc(100vw - 1.5rem)",Ko=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(f=>f.value===s)?.label:void 0,u=h.useRef(null),x=h.useRef(null),[m,p]=h.useState();return t.jsxs("div",{ref:u,"data-testid":o,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:c.cn(Ie.base,l&&Ie.baseActive),style:i===void 0?void 0:{"--filter-select-min":dt(i)},children:[t.jsx(nt,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const g=[...f][0];a(g===void 0?null:String(g))},onOpenChange:f=>{f&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:x,placement:"bottom-start",style:{minWidth:m,maxWidth:nb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Ie.select,Ie.cell),trigger:c.cn(Ie.trigger,l&&Ie.triggerActive),value:c.cn(Ie.value,l&&Ie.valueActive),selectorIcon:c.cn(l&&Ie.iconActive)},children:n.map(f=>t.jsx(c.SelectItem,{classNames:{title:Ie.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Ie.sizer,l&&Ie.sizerActive,Ie.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${o}-clear`,className:Ie.clear,children:t.jsx(M,{icon:"lucide:x",className:Ie.clearIcon,"aria-hidden":"true"})})]})};Ko.displayName="FilterSelect";const Yo=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(sb,s),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});Yo.displayName="FilterSelectGroup";const xt={base:"flex flex-wrap items-center justify-center gap-2.5 border-t border-pos-hair px-5 py-[0.875rem] text-[0.84375rem] text-default-500",idle:"w-full",sentinel:"h-px w-full",spinner:"inline-flex",error:"text-pos-danger"},Qo=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(s),u=h.useRef(!1);return h.useEffect(()=>{d.current=s},[s]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const x=l.current;if(!x||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(x),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:xt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:xt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:xt.base,children:[t.jsx("span",{"aria-hidden":"true",className:xt.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:xt.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:xt.error,children:a}),t.jsx(T,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?xt.base:xt.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};Qo.displayName="LoadMoreFooter";const $e={base:"w-full",list:"m-0 list-none p-0",item:"relative border-b border-pos-hair last:border-b-0",card:"block w-full px-4 py-[0.875rem] text-left",cardInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ne}`,headline:"flex items-baseline gap-2.5",headlineWithActions:"pr-[3.25rem]",title:"min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]",amount:"ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900",actions:"absolute right-4 top-[0.1875rem] z-[1]",chips:"mt-[0.5625rem] flex flex-wrap gap-1.5",chipsLine:"mt-[0.5625rem] flex items-center gap-2.5",chipsInline:"flex min-w-0 flex-wrap gap-1.5",rows:"mt-[0.5625rem] block",row:"flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]",rowLabel:"shrink-0 text-default-500",rowValue:"ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]",skeletonRow:"border-b border-pos-hair p-4 last:border-b-0"},Lr=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn($e.headline,s&&$e.headlineWithActions),children:[t.jsx("span",{className:$e.title,children:e.title}),se(e.amount)&&!s&&t.jsx("span",{className:$e.amount,children:e.amount})]}),s?(se(e.chips)||se(e.amount))&&t.jsxs("span",{className:$e.chipsLine,children:[se(e.chips)&&t.jsx("span",{className:$e.chipsInline,children:e.chips}),se(e.amount)&&t.jsx("span",{className:$e.amount,children:e.amount})]}):se(e.chips)&&t.jsx("span",{className:$e.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:$e.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:$e.row,children:[t.jsx("span",{className:$e.rowLabel,children:n.label}),t.jsx("span",{className:$e.rowValue,children:n.value})]},a))})]}),Zo=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:$e.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:$e.skeletonRow,children:[t.jsx("div",{className:ps,style:{height:dt(13),width:dt(130)}}),t.jsx("div",{className:ps,style:{height:dt(11),width:"70%",marginTop:dt(10)}}),t.jsx("div",{className:ps,style:{height:dt(11),width:"45%",marginTop:dt(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:$e.list,children:e.map(o=>{const l=se(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:$e.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn($e.card,$e.cardInteractive),children:t.jsx(Lr,{item:o,withActions:l})}):t.jsx("div",{className:$e.card,children:t.jsx(Lr,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:$e.actions,children:o.actions})]},o.id)})})});Zo.displayName="CardList";const ab=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${zs}`,band:"flex items-center gap-2.5 border-b border-pos-hair bg-pos-page px-4 py-2.5",back:`inline-flex size-[1.625rem] shrink-0 items-center justify-center rounded-[0.625rem] text-default-500 outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${Ne}`,backIcon:"size-[0.875rem]",breadcrumb:"min-w-0 flex-1",breadcrumbList:"flex-nowrap gap-[0.375rem]",crumbBase:"min-w-0",crumb:"whitespace-nowrap text-[0.875rem] text-default-500 data-[disabled=true]:opacity-100 data-[current=true]:overflow-hidden data-[current=true]:font-normal data-[current=true]:text-default-900",crumbSeparator:"ms-[0.375rem] px-0 text-default-400 data-[disabled=true]:opacity-100",body:"flex flex-wrap gap-5",bodyWide:"px-5 pb-5 pt-[1.125rem]",bodyNarrow:"p-4",identity:"min-w-0 flex-[1_1_18.75rem]",title:"m-0 font-semibold tracking-[-.02em] text-default-900 [overflow-wrap:anywhere]",titleWide:"text-[1.5rem]",titleNarrow:"text-[1.3125rem]",meta:"m-0 mt-[0.6875rem] flex list-none flex-col gap-[0.4375rem] p-0",metaLine:"flex min-w-0 items-center gap-[0.5625rem] text-[0.84375rem] text-default-700",metaIcon:"flex shrink-0 text-default-400 [&_svg]:size-[0.9375rem]",metaText:"min-w-0 truncate",money:"flex flex-col gap-[0.3125rem]",moneyWide:"ml-auto min-w-[12.5rem] flex-none items-end text-right",moneyNarrow:"w-full items-start text-left",amountLabel:"text-[0.8125rem] text-default-500",amount:"whitespace-nowrap font-bold tracking-[-.03em] tabular-nums text-default-900",amountWide:"text-[1.9375rem] leading-[1.1]",amountNarrow:"text-[1.6875rem] leading-[1.1]",amountCaption:"text-[0.8125rem] text-default-500",recordId:"text-[0.8125rem] text-default-500",chips:"mt-[0.1875rem] flex flex-wrap gap-1.5",chipsWide:"justify-end",chipsNarrow:"justify-start",statItems:"m-0 mt-2.5 flex flex-wrap gap-[1.375rem]",stat:"flex flex-col-reverse",statWide:"text-right",statNarrow:"text-left",statValue:"m-0 text-[0.9375rem] font-bold tabular-nums text-default-900",statLabel:"mt-0.5 text-[0.75rem] text-default-500",statsWide:"px-5 pb-5",statsNarrow:"px-4 pb-4"},Xo=h.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));Xo.displayName="CrumbBase";const Jo=({breadcrumb:e=[],onBack:s,backLabel:n,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:x,stats:m,banner:p,"data-testid":f="record-header"})=>{const{ref:g,width:v}=Pt(),b=!rs(v,ab),y=e.length>0||!!s,N=!!(x&&x.length>0),k=!!i||se(o)||se(l)||se(d)||se(u)||N;return t.jsxs("div",{ref:g,"data-testid":f,"data-size":b?"narrow":"wide",className:re.base,children:[y&&t.jsxs("div",{"data-testid":`${f}-band`,className:re.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${f}-back`,className:re.back,children:t.jsx(M,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((w,$)=>t.jsx(c.BreadcrumbItem,{as:Xo,"data-testid":`${f}-crumb-${$}`,isDisabled:!w.onClick&&$<e.length-1,onPress:w.onClick?()=>w.onClick?.():void 0,children:w.label},$))})]}),t.jsxs("div",{className:c.cn(re.body,b?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:c.cn(re.title,b?re.titleNarrow:re.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:re.meta,children:r.map((w,$)=>t.jsxs("li",{className:re.metaLine,children:[w.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:w.icon}),t.jsx("span",{className:re.metaText,children:w.text})]},$))})]}),k&&t.jsxs("div",{"data-testid":`${f}-money`,className:c.cn(re.money,b?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),se(o)&&t.jsx("div",{"data-testid":`${f}-amount`,className:c.cn(re.amount,b?re.amountNarrow:re.amountWide),children:o}),se(l)&&t.jsx("div",{className:re.amountCaption,children:l}),se(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:re.recordId,children:d}),se(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:c.cn(re.chips,b?re.chipsNarrow:re.chipsWide),children:u}),N&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:re.statItems,children:x?.map((w,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:c.cn(re.stat,b?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:re.statLabel,children:w.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:re.statValue,style:w.tone?{color:Ze[w.tone].fg}:void 0,children:w.value})]},w.id??$))})]})]}),se(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:b?re.statsNarrow:re.statsWide,children:m}),se(p)&&t.jsx("div",{"data-testid":`${f}-banner`,children:p})]})};Jo.displayName="RecordHeader";const rb=50,qt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},ec=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=Pt(),i=se(s),o=i&&r>0&&rs(r,rb),l=t.jsx("div",{"data-testid":`${n}-main`,className:qt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:qt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(qt.base,o?qt.split:qt.stacked),children:o?[l,d]:[d,l]})};ec.displayName="RecordLayout";const ib=560,Gt={base:"grid gap-3",tile:"min-w-0 rounded-[14px] border border-pos-line bg-white px-[18px] py-4 shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",value:"text-[23px] font-bold leading-[1.2] tracking-[-.02em] tabular-nums text-default-900 [overflow-wrap:anywhere]",label:"mt-[5px] text-[13.5px] text-default-500",caption:"mt-0.5 text-[12.5px] text-default-500"},tc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=Pt(),r=a>=$x?Math.max(e.length,1):a>=ib?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:Gt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:Gt.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:Gt.value,style:i.tone?{color:Ze[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:Gt.label,children:i.label}),se(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:Gt.caption,children:i.caption})]},o))})};tc.displayName="StatTiles";const ct={base:"mb-3.5 w-full",tabList:"w-full gap-1 rounded-full border border-pos-line bg-default-100 p-1",cursor:"rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,.10)]",tab:"h-auto flex-1 data-[hover-unselected=true]:opacity-100",tabStill:"rounded-full data-[selected=true]:bg-white data-[selected=true]:shadow-[0_1px_3px_rgba(0,0,0,.10)]",tabContent:"leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"flex items-center whitespace-nowrap",icon:"flex shrink-0",count:"rounded-full bg-default-200 py-px leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},lb={md:{tab:"px-[0.875rem] py-[0.5625rem]",tabContent:"text-[0.84375rem]",title:"gap-[0.4375rem]",icon:"[&_svg]:size-4",count:"px-[0.4375rem] text-[0.71875rem]"},lg:{tab:"px-4 py-3",tabContent:"text-base",title:"gap-2",icon:"[&_svg]:size-5",count:"px-2 text-[0.8125rem]"}},ha="pill-tabs",ba=(e,s=ha)=>`${s}-tab-${e}`,ga=(e,s=ha)=>`${s}-panel-${e}`,ob=(e,s=ha)=>({role:"tabpanel",id:ga(e,s),"aria-labelledby":ba(e,s),tabIndex:0}),sc=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=Fs(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,x=lb[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:ct.base,tabList:ct.tabList,cursor:ct.cursor,tab:c.cn(ct.tab,x.tab,(l||d)&&ct.tabStill),tabContent:c.cn(x.tabContent,ct.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:ba(m.key,u),"aria-controls":ga(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(ct.title,x.title),children:[se(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(ct.icon,x.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(x.count,ct.count),children:m.count})]})},m.key)})})};sc.displayName="PillTabs";const ge={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ne}`,dot:"mt-[0.4375rem] size-[0.4375rem] shrink-0 rounded-full",body:"flex min-w-0 flex-1 flex-col",title:"text-[0.875rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",meta:"mt-1 flex min-w-0 flex-wrap items-center gap-[0.4375rem] text-[0.78125rem] text-default-500",reference:"min-w-0 font-normal text-primary [overflow-wrap:anywhere]",separator:"text-default-400",timestamp:"tabular-nums",detail:"mt-[0.1875rem] text-[0.78125rem] text-default-500 [overflow-wrap:anywhere] [text-wrap:pretty]",trailing:"max-w-[45%] min-w-min shrink-0 text-right text-[0.90625rem]",amount:"whitespace-nowrap text-[0.90625rem] font-bold tabular-nums text-default-900",note:"text-[0.78125rem] italic text-default-500 [overflow-wrap:anywhere]",footer:"flex items-baseline gap-3 border-t border-pos-line bg-pos-page px-5 py-[0.8125rem]",footerLabel:"min-w-0 text-[0.875rem] font-bold text-default-900 [overflow-wrap:anywhere]",footerAmount:"ml-auto whitespace-nowrap text-[1rem] font-bold tabular-nums text-default-900",footerNote:"border-t border-pos-hair px-5 py-[0.8125rem] text-[0.78125rem] leading-[1.6] text-default-500",empty:"px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500"},Fr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ge.dot,style:{backgroundColor:Ze[e.tone].fg}}),t.jsxs("span",{className:ge.body,children:[t.jsx("span",{className:ge.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ge.meta,children:[e.reference!=null&&t.jsx("span",{className:ge.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ge.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ge.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ge.detail,children:e.detail})]}),t.jsx("span",{className:ge.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:ge.amount,style:is(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:ge.note,style:e.noteTone==="warn"?{color:Ze.warn.fg}:void 0,children:e.note}):null})]}),nc=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ge.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ge.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:ge.base,children:[t.jsx("ul",{className:ge.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ge.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ge.row,ge.rowInteractive),children:t.jsx(Fr,{row:i,testId:o})}):t.jsx("div",{className:ge.row,children:t.jsx(Fr,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ge.footer,children:[t.jsx("span",{className:ge.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ge.footerAmount,style:is(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ge.footerNote,children:s.note})]})]});nc.displayName="AmountList";const Ge={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},ac=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ge.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ge.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ge.event,!i&&Ge.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ge.rail,children:[t.jsx("span",{className:Ge.dot,style:{backgroundColor:Ze[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ge.connector})]}),t.jsxs("div",{className:Ge.body,children:[t.jsxs("div",{className:Ge.head,children:[t.jsx("span",{className:Ge.title,children:a.title}),t.jsx("span",{className:Ge.timestamp,children:a.timestamp})]}),se(a.detail)&&t.jsx("div",{className:Ge.detail,children:a.detail}),se(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ge.actor,children:a.actor})]})]},a.id)})});ac.displayName="ActivityTimeline";const Ee={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${zs}`,header:"flex flex-wrap items-center gap-2 px-5 pt-4",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",list:"m-0 list-none p-0",item:"border-t border-pos-hair",itemFirstHeadless:"border-t-0",row:"flex w-full items-center gap-2.5 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ne}`,rowBody:"flex min-w-0 flex-1 flex-col",rowHead:"flex min-w-0 flex-wrap items-center gap-2",primaryLinked:"min-w-0 text-[0.875rem] font-normal text-primary [overflow-wrap:anywhere]",primaryPlain:"min-w-0 text-[0.875rem] font-normal text-default-900 [overflow-wrap:anywhere]",secondary:"mt-[0.1875rem] block min-w-0 truncate text-[0.8125rem] text-default-500",amount:"max-w-[45%] shrink-0 text-right text-[0.875rem] font-semibold tabular-nums text-default-900 [overflow-wrap:anywhere]",empty:"min-w-0 px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500 [overflow-wrap:anywhere]",emptyHeadless:"pt-5"},Rr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Ee.rowBody,children:[t.jsxs("span",{className:Ee.rowHead,children:[t.jsx("span",{className:e.onSelect?Ee.primaryLinked:Ee.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Ee.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Ee.amount,style:is(e.amountTone),children:e.amount})]}),rc=({title:e,count:s,rows:n,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Ee.base,children:[o&&t.jsxs("div",{className:Ee.header,children:[t.jsx("h3",{id:i,className:Ee.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Ee.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Ee.empty,!o&&Ee.emptyHeadless),children:a}):t.jsx("ul",{className:Ee.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Ee.item,d===0&&!o&&Ee.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Ee.row,Ee.rowInteractive),children:t.jsx(Rr,{row:l,testId:u})}):t.jsx("div",{className:Ee.row,children:t.jsx(Rr,{row:l,testId:u})})},l.id)})})]})};rc.displayName="RelatedRecordList";const ic=({title:e,titleAs:s="h2",icon:n,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:x="card",className:m,children:p,"data-testid":f="record-card"})=>{const g=h.useId(),v=se(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":x,role:v?"group":void 0,"aria-labelledby":v?g:void 0,className:c.cn(ot.base,ep[x],m),children:[v&&t.jsxs("div",{"data-testid":`${f}-header`,className:tp[d],children:[se(n)&&t.jsx("span",{"aria-hidden":"true",className:ot.icon,children:n}),t.jsx(s,{id:g,className:ot.title,children:e}),se(a)&&t.jsx("span",{"data-testid":`${f}-count`,className:ot.count,children:a}),r,se(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:ot.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:sp[d][u],children:[se(o)&&t.jsx("p",{"data-testid":`${f}-description`,className:ot.description,children:o}),p,se(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:c.cn(ot.footer,se(p)?ot.footerAfterContent:ot.footerAfterDescription),children:l})]})]})};ic.displayName="RecordCard";const cb={stack:"flex min-w-0 flex-col gap-[0.875rem]",grid:"grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,18.75rem),1fr))] items-start gap-[0.875rem]"},lc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(cb[e],s),children:n});lc.displayName="CardStack";const xs={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},db={regular:"py-[0.5625rem]",compact:"py-2"},oc=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:xs.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(xs.row,db[s]),children:[t.jsx("dt",{className:xs.label,children:a.label}),t.jsx("dd",{className:xs.value,children:a.value})]},a.id??r))});oc.displayName="KeyValueRows";const Je={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},cc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:Je.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=se(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:Je.row,style:r.tone?{backgroundColor:Ze[r.tone].bg}:void 0,children:[t.jsxs("div",{className:Je.body,children:[t.jsx("div",{className:Je.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:Je.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:Je.separator,children:"·"}),t.jsx("span",{className:Je.detail,children:l})]},d))})]}),t.jsxs("div",{className:Je.trailing,children:[t.jsxs("span",{className:Je.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:Je.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:Je.amount,style:o?{color:Ze.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});cc.displayName="LineItemRows";const ub=37.5,_e={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},dc=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=Pt(),o=i>0&&!rs(i,ub),l=o?_e.rowNarrow:_e.rowWide,d=o?_e.labelNarrow:_e.labelWide,u=o?_e.noteNarrow:_e.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:_e.base,children:[e.map(x=>{const m=`${a}-row-${x.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,_e.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,_e.label),children:x.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,_e.note),children:x.note}),t.jsx("span",{"data-testid":`${m}-value`,className:_e.value,style:is(x.tone),children:x.value})]},x.id)}),t.jsx("div",{className:_e.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,_e.totalRow),children:[t.jsx("span",{className:c.cn(d,_e.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:_e.totalValue,children:s.value})]})}),se(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:_e.memo,children:n})]})};dc.displayName="RecordTotals";const Ln={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},mb={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},uc=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(Ln.base,mb[e]),style:is(s),children:[a,se(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:Ln.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});uc.displayName="CellText";const mc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:Ln.chipStack,children:e});mc.displayName="ChipStack";function fc({testId:e,title:s,description:n}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}fc.displayName="SessionExpiredCard";exports.ActivityTimeline=ac;exports.AdminFieldLabel=aa;exports.AdminTable=Sl;exports.AdminTextField=Hl;exports.AdminToolbar=Al;exports.AmountList=nc;exports.AppliedCodeCard=Jr;exports.Button=T;exports.CardList=Zo;exports.CardStack=lc;exports.CashTenderForm=dp;exports.CatalogItemCard=cl;exports.CellText=uc;exports.CheckTenderForm=ro;exports.ChipStack=mc;exports.CommitmentDetails=ff;exports.ConfirmDialog=oa;exports.ConfirmationModal=Xn;exports.ConfirmationPageTemplate=Du;exports.CustomerCard=Mo;exports.DatePicker=Bn;exports.DensityProvider=Qc;exports.DimensionChip=Os;exports.DiscardGuard=go;exports.DonationAmounts=_i;exports.Drawer=wi;exports.EmptyState=Jn;exports.EntityList=Zl;exports.EntityListSkeleton=Xl;exports.EntityRow=Ql;exports.ErrorState=ea;exports.EventDetails=gm;exports.EventDetailsTemplate=Lu;exports.ExpireCartTimer=Mi;exports.FeedbackState=as;exports.FilterPopover=pl;exports.FilterSelect=Ko;exports.FilterSelectGroup=Yo;exports.Footer=Ou;exports.HeroUIProvider=Wc;exports.HorizontalSteps=ki;exports.InlineConfirm=ho;exports.InstallmentFundAssignment=of;exports.InstallmentFundAssignmentSkeleton=uf;exports.InstallmentSchedule=Ff;exports.InstallmentScheduleSkeleton=zf;exports.InstallmentTable=Hf;exports.ItemCard=ol;exports.KeyValueChip=Os;exports.KeyValueRows=oc;exports.LineItemList=Eo;exports.LineItemRows=cc;exports.ListPanel=to;exports.LoadMoreFooter=Qo;exports.LoadingOverlay=xo;exports.LoadingState=ta;exports.MembershipSelectCards=Yf;exports.MetaCard=vh;exports.Modal=ts;exports.ModalPanelHeader=yo;exports.ModalPanels=Gp;exports.ModalShell=oo;exports.ModalShellFooter=uo;exports.ModalShellHeader=co;exports.Multiselect=zu;exports.Navbar=Au;exports.NotesField=Io;exports.Notice=xa;exports.OfferCard=Ns;exports.OfferCardEmpty=Pi;exports.OfferCardError=Ii;exports.OfferCardList=Bi;exports.OfferCardSkeleton=Ti;exports.OtherTenderForm=io;exports.OutcomeView=Go;exports.PageHeader=gl;exports.PaginationSummary=eo;exports.PaymentCashChangeBanner=ia;exports.PaymentSubAmountInput=la;exports.PaymentSuccessView=po;exports.PaymentTotalBanner=fo;exports.PickerRow=ql;exports.PillTabs=sc;exports.PinField=qo;exports.ProgramListItem=dl;exports.RICH_TEXT_PRESETS=Fi;exports.ReasonSelect=Po;exports.RecordCard=ic;exports.RecordHeader=Jo;exports.RecordLayout=ec;exports.RecordTotals=dc;exports.RedeemCodeInput=Cu;exports.RefundMethodCards=Uo;exports.RefundProgressList=Wo;exports.RelatedRecordList=rc;exports.RevenueDistributionCard=Ji;exports.RevenueDistributionEmpty=el;exports.RevenueDistributionError=tl;exports.RevenueDistributionSkeleton=sl;exports.RichTextArea=Ri;exports.RowActions=Wl;exports.SectionPanel=_o;exports.Select=nt;exports.SessionExpiredCard=fc;exports.SessionTimeline=hl;exports.SplitPaymentSummary=lo;exports.SplitTenderPanel=Oo;exports.StatTiles=tc;exports.StatusChip=yl;exports.StepPager=Di;exports.StepProgress=fa;exports.Stepper=Ci;exports.StepsReadiness=Ai;exports.SuccessState=ml;exports.Summary=Ao;exports.Table=Vn;exports.TableSkeleton=vl;exports.TenderMethods=To;exports.TicketSelection=yx;exports.TileSelect=mo;exports.ToastProvider=Kc;exports.Toggle=fl;exports.ToolbarButton=Dl;exports.UnderlineTabs=El;exports.VerticalSteps=$i;exports.WizardShell=Do;exports.adminFieldErrorClass=Vl;exports.adminFieldHelpButtonClass=Ml;exports.adminFieldHelpContentClass=Il;exports.adminFieldHelpIconClass=Pl;exports.adminFieldHintClass=Bl;exports.adminFieldLabelClass=na;exports.adminFieldLabelNoAutoMarkClass=_l;exports.adminFieldLabelRowClass=Rl;exports.adminFieldLabelSuffixClass=Ll;exports.adminFieldRequiredClass=Fl;exports.adminInputClass=Ol;exports.adminInputReadOnlyClass=zl;exports.adminInputWrapperClass=Tl;exports.adminRowClass=Nl;exports.adminSurfaceCss=Hc;exports.adminSurfaceTokens=Ls;exports.adminTableClass=Cl;exports.adminTableFooterClass=kl;exports.adminTdClass=wl;exports.adminThClass=jl;exports.calculateAllocationDifference=Qm;exports.computeChange=jn;exports.currencyFractionDigits=Mt;exports.formatMoney=fe;exports.formatOfferCurrency=Nn;exports.formatRevenueAmount=qm;exports.formatRevenueCurrency=Gm;exports.generateAutomaticInstallments=rl;exports.generateDistributionId=Zn;exports.getCurrencySymbol=Km;exports.offerCardVariants=zi;exports.offerListVariants=Oi;exports.pageRange=Jl;exports.parseOfferCurrency=ym;exports.parseRevenueCurrency=Ym;exports.pillTabId=ba;exports.pillTabPanelId=ga;exports.pillTabPanelProps=ob;exports.posSurfaceTokens=le;exports.roundToCurrency=Un;exports.useControlSize=Yc;exports.useDensity=Rs;exports.useDiscardGuard=Qp;exports.useDiscardGuardActions=Mp;exports.useModalPanel=Ip;exports.useModalPanels=Yp;exports.useReportUnsavedChanges=_p;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
41
+ `,uo=h.forwardRef(({children:e,relativeOverlayRoot:s=!0,className:n,style:a,"data-testid":r="modal-shell"},i)=>t.jsxs(t.Fragment,{children:[t.jsx("style",{children:Cp}),t.jsx("div",{ref:i,"data-testid":r,style:a,className:c.cn("flex flex-col gap-4 p-4 rounded-3xl bg-white shadow-xl","md:gap-5 md:p-6",s&&"relative","motion-safe:animate-[pp-modal-in_220ms_ease-out]","motion-safe:transition-[min-height] motion-safe:duration-[420ms] motion-safe:ease-in-out",n),children:e})]}));uo.displayName="ModalShell";const mo=({title:e,subtitle:s,leading:n,titleClassName:a,onClose:r,closeLabel:i="Close",actions:o,className:l,"data-testid":d="modal-shell-header"})=>t.jsxs("header",{className:c.cn("flex items-center justify-between gap-3",l),"data-testid":d,children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n,t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:c.cn("text-xl font-semibold",a),"data-testid":`${d}-title`,children:e}),s&&t.jsx("div",{className:"text-xs font-semibold text-default-500","data-testid":`${d}-subtitle`,children:s})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[o,r&&t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-close`,children:t.jsx(M,{icon:"lucide:x",width:20,height:20,"aria-hidden":"true"})})]})]});mo.displayName="ModalShellHeader";const fo=({children:e,columns:s=2,className:n,"data-testid":a="modal-shell-footer"})=>t.jsx("footer",{className:c.cn("mt-2 gap-3",s===2?"flex flex-col md:grid md:grid-cols-2 [&>*]:w-full [&>*:first-child]:md:order-2 [&>*:nth-child(2)]:md:order-1":"grid grid-cols-1",n),"data-testid":a,children:e});fo.displayName="ModalShellFooter";const kp={2:"sm:grid-cols-2",3:"sm:grid-cols-3",4:"sm:grid-cols-4",5:"sm:grid-cols-5",6:"sm:grid-cols-6"},Sp={1:"grid-cols-1",2:"grid-cols-2"},jt={grid:"gap-2",tile:`flex flex-col items-center justify-center gap-[0.3125rem] h-auto min-h-0 min-w-0 rounded-xl border px-1 py-2.5 transition-colors ${Ce} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,idle:"border-pos-field bg-white text-pos-ink data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white",active:"border-primary bg-primary/[.09] text-primary data-[hover=true]:bg-primary/[.09]",icon:"flex h-[1.0625rem] w-[1.0625rem] items-center justify-center",label:"text-[0.71875rem] font-medium leading-[0.875rem]",locked:"cursor-not-allowed border-dashed border-pos-line-strong bg-white text-pos-muted data-[hover=true]:border-pos-line-strong data-[hover=true]:bg-white data-[pressed=true]:scale-100"},We={tile:`flex flex-col items-center justify-center gap-2 h-auto min-h-20 px-4 py-4 border bg-transparent transition-colors ${Ce}`,idle:"border-default-200 text-default-800 hover:bg-default-50",active:"border-primary bg-primary-50 text-primary",label:"text-sm font-medium",detailed:"items-start justify-start gap-1 whitespace-normal text-left",header:"mb-1 flex w-full flex-wrap items-start justify-between gap-2",description:"text-xs font-normal leading-snug text-default-600",lockedDescription:"text-default-500",badge:"shrink-0 whitespace-nowrap rounded-full bg-default-100 px-2 py-0.5 text-[11px] font-medium leading-4 text-default-600",locked:"cursor-not-allowed border-dashed border-default-300 bg-default-50 text-default-500 hover:bg-default-50 data-[hover=true]:opacity-100 data-[pressed=true]:scale-100",lockedIcon:"text-default-400"},xs=e=>typeof e=="string"?t.jsx(M,{icon:e,width:20,height:20,"aria-hidden":"true"}):e,$p=(e,s,n)=>{const a=`${e}-${s.key}`;return{badge:n&&s.badge!==void 0?`${a}-badge`:void 0,reason:`${a}-reason`,description:n&&s.description!==void 0?`${a}-description`:void 0}},Ap=e=>t.jsx("span",{"aria-hidden":"true",className:jt.icon,children:typeof e=="string"?t.jsx(M,{icon:e,width:"100%",height:"100%","aria-hidden":"true"}):e}),ps=`h-[2.125rem] min-h-0 min-w-fit flex-1 whitespace-nowrap rounded-full px-2.5 text-[0.8125rem] font-medium transition-colors ${Ce}`,Dp="pointer-events-none absolute -left-[9999px] top-0 flex flex-row gap-1 p-1 opacity-0",Nr="flex-none",Ep=typeof window<"u"?h.useLayoutEffect:h.useEffect,Cr=e=>e?"bg-white text-default-900 shadow-[0_2px_8px_rgba(0,0,0,0.06)] data-[hover=true]:bg-white data-[pressed=true]:bg-white data-[hover=true]:opacity-100":"bg-transparent text-default-600 data-[hover=true]:bg-transparent data-[pressed=true]:bg-transparent data-[hover=true]:opacity-100 data-[hover=true]:text-default-900",xo=({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r="Select an option",variant:i="tiles",maxVisible:o,moreLabel:l="More",columnsDesktop:d=3,columnsMobile:u=2,size:x="md",className:m,"data-testid":p="tile-select"})=>{const f=x==="sm",g=e.find(y=>y.key===s),v=e.some(y=>y.badge!==void 0||y.isLocked===!0),b=!f&&v;return i==="compact"?t.jsx(Lp,{options:e,selectedKey:s,onSelect:n,ariaLabel:r,moreLabel:l,dataTestId:p,...a!==void 0?{heading:a}:{},...o!==void 0?{maxVisible:o}:{},...m!==void 0?{className:m}:{}}):t.jsxs("div",{className:c.cn("flex flex-col gap-3",m),"data-testid":p,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${p}-heading`,children:a}),t.jsx("div",{className:"md:hidden",children:t.jsx(at,{"aria-label":a?void 0:r,"aria-labelledby":a?`${p}-heading`:void 0,selectedKeys:s?[s]:[],onSelectionChange:y=>{const k=Array.from(y)[0];typeof k=="string"&&n(k)},placeholder:r,variant:"bordered",radius:"lg","data-testid":`${p}-mobile-select`,startContent:g?t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:xs(g.icon)}):void 0,popoverProps:{placement:"bottom-start",classNames:{content:"bg-white border border-default-200 shadow-lg rounded-xl p-1"}},listboxProps:{classNames:{list:"max-h-[var(--popover-available-height,40vh)] overflow-y-auto"},itemClasses:{base:["rounded-lg","px-3 py-2","text-default-800","data-[hover=true]:bg-default-100","data-[selectable=true]:focus:bg-default-100","data-[selected=true]:bg-primary-50","data-[selected=true]:text-primary","data-[selected=true]:font-medium"]}},children:e.map(y=>t.jsx(c.SelectItem,{isDisabled:y.isDisabled||y.isLocked,...v&&y.description!==void 0?{description:y.description}:{},endContent:y.badge!==void 0?t.jsx("span",{className:We.badge,children:y.badge}):void 0,startContent:t.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:xs(y.icon)}),"data-testid":y["data-testid"]??`${p}-${y.key}-mobile`,children:y.label},y.key))})}),t.jsx("div",{role:"group","aria-labelledby":a?`${p}-heading`:void 0,"aria-label":a?void 0:r,className:c.cn("hidden md:grid",f?jt.grid:"gap-3",Sp[u],kp[d]),"data-size":x,children:e.map(y=>{const N=s===y.key,k=y.isLocked===!0&&y.isDisabled!==!0,w=y.lockedReason??y.badge,$=$p(p,y,b),A=[$.badge,k&&w!==void 0&&(f||w!==y.badge)?$.reason:void 0,$.description].filter(Boolean).join(" ");return t.jsxs(T,{variant:"bordered",radius:"lg","aria-pressed":N,"aria-label":y.label,"aria-disabled":k||void 0,"aria-describedby":A||void 0,isDisabled:y.isDisabled,onPress:()=>{k||n(y.key)},"data-testid":y["data-testid"]??`${p}-${y.key}`,"data-locked":k||void 0,className:f?c.cn(jt.tile,k?jt.locked:N?jt.active:jt.idle):c.cn(We.tile,b&&We.detailed,k?We.locked:N?We.active:We.idle),"data-size":x,children:[f?t.jsxs(t.Fragment,{children:[Ap(y.icon),t.jsx("span",{className:jt.label,children:y.label})]}):b?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:We.header,children:[t.jsx("span",{"aria-hidden":"true",className:k?We.lockedIcon:void 0,children:xs(y.icon)}),y.badge!==void 0?t.jsx("span",{id:$.badge,className:We.badge,children:y.badge}):null]}),t.jsx("span",{className:We.label,children:y.label}),y.description!==void 0?t.jsx("span",{id:$.description,className:c.cn(We.description,k&&We.lockedDescription),children:y.description}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:k?We.lockedIcon:void 0,children:xs(y.icon)}),t.jsx("span",{className:We.label,children:y.label})]}),k&&w!==void 0&&(f||w!==y.badge)?t.jsx("span",{id:$.reason,className:"sr-only",children:w}):null]},y.key)})})]})};xo.displayName="TileSelect";function Lp({options:e,selectedKey:s,onSelect:n,heading:a,ariaLabel:r,maxVisible:i,moreLabel:o,className:l,dataTestId:d}){const u=h.useRef(null),x=h.useRef(null),m=h.useMemo(()=>e.map((D,S)=>({option:D,index:S})).filter(({option:D})=>D.alwaysInMenu!==!0).map(({index:D})=>D),[e]),p=m.length<e.length,f=h.useCallback(D=>{const S=m.map(F=>({index:F,priority:e[F]?.priority??0})).sort((F,L)=>F.priority-L.priority||L.index-F.index),_=new Set(S.slice(0,m.length-D).map(F=>F.index));return m.filter(F=>!_.has(F))},[e,m]),[g,v]=h.useState(e.length);Ep(()=>{const D=u.current,S=x.current;if(!D||!S)return;const _=()=>{const L=Array.from(S.children),P=L.slice(0,e.length).map(G=>G.getBoundingClientRect().width),B=L[e.length]?.getBoundingClientRect().width??0,H=window.getComputedStyle(D),K=Number.parseFloat(H.columnGap)||0,O=D.clientWidth-(Number.parseFloat(H.paddingLeft)||0)-(Number.parseFloat(H.paddingRight)||0);if(O<=0||P.some(G=>G===0)){v(m.length);return}const ne=G=>{const te=p||G<m.length,Y=G+(te?1:0);return f(G).reduce((ee,J)=>ee+(P[J]??0),0)+(te?B:0)+K*(Y-1)<=O};for(let G=m.length;G>=1;G-=1)if(ne(G)){v(G);return}v(1)};_();const F=new ResizeObserver(_);return F.observe(D),()=>F.disconnect()},[e,o,f,m,p]);const b=Math.max(1,Math.min(g,i??m.length,m.length)),N=!p&&b===m.length-1&&g===m.length?m.length:b,k=p||N<m.length,w=new Set(f(N)),$=e.filter((D,S)=>w.has(S)),A=k?e.filter((D,S)=>!w.has(S)):[],j=A.find(D=>D.key===s);return t.jsxs("div",{className:c.cn("relative flex flex-col gap-3",l),"data-testid":d,children:[a&&t.jsx("h3",{className:"text-sm font-medium text-default-700",id:`${d}-heading`,children:a}),t.jsxs("div",{ref:u,role:"group","aria-labelledby":a?`${d}-heading`:void 0,"aria-label":a?void 0:r,className:"flex flex-row gap-1 rounded-full bg-default-100 p-1",children:[$.map(D=>t.jsx(T,{variant:"light",radius:"full","aria-pressed":s===D.key,isDisabled:D.isDisabled||D.isLocked,onPress:()=>n(D.key),"data-testid":D["data-testid"]??`${d}-${D.key}`,className:c.cn(ps,Cr(s===D.key)),children:D.label},D.key)),A.length>0&&t.jsxs(c.Dropdown,{placement:"bottom-end",radius:"lg",children:[t.jsx(c.DropdownTrigger,{children:t.jsxs(T,{variant:"light",radius:"full","aria-pressed":j!==void 0,"data-testid":`${d}-more`,className:c.cn(ps,"gap-1",j!==void 0?"min-w-0":"min-w-fit",Cr(j!==void 0)),children:[t.jsx("span",{className:"min-w-0 truncate",children:j?.label??o}),t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14,"aria-hidden":"true"})]})}),t.jsx(c.DropdownMenu,{"aria-label":o,className:"w-64 p-2",selectionMode:"single",selectedKeys:j?[j.key]:[],disabledKeys:A.filter(D=>D.isDisabled||D.isLocked).map(D=>D.key),onAction:D=>n(String(D)),children:A.map(D=>t.jsx(c.DropdownItem,{textValue:D.label,...D.description!==void 0?{description:D.description}:{},"data-testid":D["data-testid"]??`${d}-${D.key}`,children:D.label},D.key))})]})]}),t.jsxs("div",{ref:x,"aria-hidden":"true",className:Dp,children:[e.map(D=>t.jsx(T,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(ps,Nr),children:D.label},D.key)),t.jsxs(T,{variant:"light",radius:"full",tabIndex:-1,className:c.cn(ps,Nr,"gap-1"),children:[o,t.jsx(M,{icon:"lucide:chevron-down",width:14,height:14})]})]})]})}const Fp={subtle:{wrapper:"bg-default-100",amount:"text-default-900"},success:{wrapper:"bg-success-50 text-success-700",amount:"text-success-700"}},po=({total:e,label:s,locale:n="en-US",variant:a="subtle",className:r,"data-testid":i="payment-total-banner"})=>{const o=Fp[a];return t.jsxs("div",{"data-testid":i,className:c.cn("rounded-2xl px-6 py-5 text-center",o.wrapper,r),children:[t.jsx("div",{className:"text-sm text-default-600",children:s}),t.jsx("div",{className:c.cn("mt-1 text-4xl font-bold tracking-tight",o.amount),"data-testid":`${i}-amount`,children:xe(e.value,n,e.currency)})]})};po.displayName="PaymentTotalBanner";const Rp={white:"bg-white/70 backdrop-blur-sm",transparent:"bg-transparent"},ho=({title:e,subtitle:s,backdrop:n="white",exiting:a=!1,className:r,"data-testid":i="loading-overlay"})=>t.jsxs("div",{role:"status","aria-live":a?"off":"polite","aria-hidden":a||void 0,"data-testid":i,"data-state":a?"exiting":"visible",className:c.cn("absolute inset-0 z-10 flex flex-col items-center justify-center gap-4 rounded-3xl",Rp[n],a?"pointer-events-none motion-safe:animate-[pp-fade-out_280ms_ease-in_forwards]":"motion-safe:animate-[pp-fade-in_150ms_ease-out]",r),children:[t.jsx("div",{"aria-hidden":"true","data-testid":`${i}-spinner`,className:"h-16 w-16 rounded-full border-4 border-primary-100 border-t-primary animate-spin motion-safe:animate-[pp-scale-in_200ms_ease-out,spin_1s_linear_infinite]"}),t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xl font-semibold","data-testid":`${i}-title`,children:e}),s&&t.jsx("div",{className:"mt-1 text-sm text-default-600",children:s})]})]});ho.displayName="LoadingOverlay";const ca=({cashChange:e,label:s="Cash to return",secondaryLine:n,locale:a="en-US",onDismiss:r,dismissAriaLabel:i="Dismiss",align:o="left",className:l,"data-testid":d="payment-cash-change-banner"})=>{if(!e||e.value<=0)return null;const u=o==="center";return t.jsxs("div",{role:"status","aria-live":"polite","data-testid":d,className:c.cn("flex w-full items-center gap-3 rounded-2xl border border-info-200 bg-info-50 px-5 py-4",u?"justify-center text-center":"text-left","motion-safe:animate-[pp-slide-down_200ms_ease-out]",l),children:[t.jsx(M,{icon:"lucide:info",width:28,height:28,className:"shrink-0 text-info-700","aria-hidden":"true"}),t.jsxs("div",{className:c.cn("flex flex-col",u?"items-center":"flex-1"),children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wider text-info-700",children:s}),t.jsx("span",{className:"text-2xl font-bold text-info-700","data-testid":`${d}-amount`,children:xe(e.value,a,e.currency)}),n&&t.jsx("span",{className:"mt-0.5 text-xs text-info-700/80",children:n})]}),r&&t.jsx(T,{isIconOnly:!0,variant:"light",radius:"full",size:"sm",onPress:r,"aria-label":i,"data-testid":`${d}-dismiss`,className:"shrink-0 text-info-700 hover:bg-info-100",children:t.jsx(M,{icon:"lucide:x",width:18,height:18,"aria-hidden":"true"})})]})};ca.displayName="PaymentCashChangeBanner";const bo=({title:e,subtitle:s,emailLine:n,confirmationEmail:a,cashChange:r,cashChangeLabel:i="Cash to return",locale:o="en-US",closeLabel:l="Close",onClose:d,className:u,"data-testid":x="payment-success-view"})=>{const m=!!(r&&r.value>0);return t.jsxs("div",{"data-testid":x,className:c.cn("flex flex-col items-center gap-6 py-8 px-4 text-center","motion-safe:animate-[pp-fade-in_250ms_ease-out]",u),children:[t.jsx("div",{"aria-hidden":"true",className:"flex items-center justify-center rounded-full bg-[#A2D9C6] p-[10px]",children:t.jsx(M,{icon:"gravity-ui:circle-check-fill",width:76,height:76,className:"text-[#10B981]","aria-hidden":"true"})}),t.jsxs("div",{className:"space-y-3",children:[t.jsx("h2",{className:"text-2xl font-bold","data-testid":`${x}-title`,children:e}),t.jsx("p",{className:"text-default-700",children:s}),n&&a&&t.jsxs("p",{className:"text-default-700",children:[n,t.jsx("br",{}),t.jsx("strong",{className:"font-semibold",children:a})]})]}),m&&r&&t.jsx(ca,{cashChange:r,label:i,locale:o,align:"center",className:"max-w-[400px]","data-testid":`${x}-cash-change`}),d&&t.jsx(T,{color:"default",variant:"bordered",radius:"full",size:"lg",onPress:d,"data-testid":`${x}-close`,className:"mt-4 w-full",children:l})]})};bo.displayName="PaymentSuccessView";const da=({heading:e,amountLabel:s,value:n,defaultValue:a,onChange:r,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:u,autoFocus:x,maxAmount:m,hideHeading:p=!1,className:f,"data-testid":g="payment-sub-amount-input"})=>{const v=`${g}-input`,b=n!==void 0,[y,N]=h.useState(a??""),k=b?n:y,{isUntouched:w,markEdited:$}=ro(k),A=h.useCallback(S=>{if(m!==void 0){const _=Number.parseFloat(S.replace(",","."));if(Number.isFinite(_)&&_>m)return}$(S),b||N(S),r?.(S)},[m,r,$,b]),j=io(w,A),D=h.useCallback(S=>{const _=S.currentTarget;requestAnimationFrame(()=>{_.isConnected&&_.select()})},[]);return t.jsxs("div",{className:c.cn("flex flex-col gap-3 border-t border-default-100 pt-5",f),"data-testid":g,children:[t.jsx("h3",{className:c.cn("text-lg font-semibold",p&&"sr-only"),"data-testid":`${g}-heading`,children:e}),t.jsx(c.Input,{ref:j,id:v,label:s,labelPlacement:"outside",classNames:p?{label:"sr-only"}:void 0,type:"text",inputMode:"decimal",pattern:"[0-9]*[.,]?[0-9]*",value:k,onChange:S=>A(S.target.value),onFocus:D,onBlur:i,placeholder:o,isDisabled:l,isInvalid:d,errorMessage:d?u:void 0,variant:"bordered",radius:"lg","aria-invalid":d||void 0,autoFocus:x,"data-testid":`${g}-field`})]})};da.displayName="PaymentSubAmountInput";const _p={danger:{tile:"bg-danger-50 text-danger-600",icon:"solar:danger-circle-outline",confirmColor:"danger"},warning:{tile:"bg-warning-50 text-warning-600",icon:"solar:danger-triangle-outline",confirmColor:"warning"}},Mp=e=>typeof e=="string"?t.jsx(M,{icon:e,className:"size-5","aria-hidden":"true"}):e,ua=({isOpen:e,title:s,confirmLabel:n,onConfirm:a,onOpenChange:r,children:i,description:o,cancelLabel:l="Cancel",variant:d="danger",isPending:u=!1,isDismissable:x,isKeyboardDismissDisabled:m=!1,hideIcon:p=!1,icon:f,"data-testid":g="confirm-dialog"})=>{const v=i??o??null,b=_p[d],y=p?null:Mp(f??b.icon);return t.jsx(ns,{isOpen:e,onOpenChange:N=>r?.(N),placement:"center",size:"md",isDismissable:(x??!0)&&!u,isKeyboardDismissDisabled:m||u,hideCloseButton:u,className:"gap-4 p-6",classNames:{base:"rounded-3xl"},"data-testid":g,children:t.jsxs(c.ModalContent,{role:"alertdialog",children:[t.jsxs(c.ModalHeader,{className:"flex flex-col items-center gap-3 p-0 text-center",children:[y?t.jsx("div",{"aria-hidden":"true","data-testid":`${g}-icon`,className:c.cn("flex size-10 items-center justify-center rounded-full",b.tile),children:y}):null,t.jsx("span",{"data-testid":`${g}-title`,className:"text-lg font-semibold text-zinc-950",children:s})]}),v!==null?t.jsx(c.ModalBody,{"data-testid":`${g}-body`,className:"gap-0 p-0",children:typeof v=="string"?t.jsx("p",{className:"mx-auto max-w-sm text-center text-sm text-gray-600",children:v}):v}):null,t.jsxs(c.ModalFooter,{className:"flex flex-col-reverse gap-2 p-0 sm:flex-row sm:gap-3",children:[t.jsx(T,{variant:"bordered",color:"default",radius:"full",onPress:()=>r?.(!1),isDisabled:u,"data-testid":`${g}-dismiss`,className:"w-full sm:flex-1",children:l}),t.jsx(T,{color:b.confirmColor,variant:"solid",radius:"full",onPress:a,isLoading:u,"data-testid":`${g}-confirm`,className:"w-full sm:flex-1",children:n})]})]})})};ua.displayName="ConfirmDialog";const yt={item:"list-none",box:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",body:"gap-3 px-4 py-3",text:"flex min-w-0 flex-col gap-1",message:"text-sm text-gray-900 [overflow-wrap:anywhere]",description:"text-sm text-gray-600 [overflow-wrap:anywhere]",actions:"flex flex-wrap items-center gap-2"},Pp={danger:"bg-danger-50",warning:"bg-warning-50"},go=({message:e,description:s,confirmLabel:n,cancelLabel:a="Cancel",onConfirm:r,onCancel:i,variant:o="danger",isPending:l=!1,initialFocus:d="cancel",containEscape:u=!0,size:x="sm",as:m="div",className:p,"data-testid":f="inline-confirm"})=>{const g=h.useId(),v=h.useId(),b=h.useRef(null),y=h.useRef(null),N=h.useRef(null),k=s!=null,w=h.useRef({isPending:l,containEscape:u,onCancel:i});w.current={isPending:l,containEscape:u,onCancel:i},h.useEffect(()=>{(d==="confirm"?y:N).current?.focus()},[]),h.useEffect(()=>{const j=b.current;if(j===null)return;const D=S=>{S.key==="Escape"&&(w.current.containEscape&&S.stopPropagation(),!w.current.isPending&&w.current.onCancel())};return j.addEventListener("keydown",D),()=>j.removeEventListener("keydown",D)},[]);const $=h.useRef(!1);h.useLayoutEffect(()=>{const j=b.current;if(j===null)return;const D=document.activeElement;if(l){const S=D===null||D===document.body||!j.contains(D),_=D instanceof HTMLButtonElement&&D.disabled;$.current&&(S||_)&&j.focus({preventScroll:!0});return}D===j&&(d==="confirm"?y:N).current?.focus()},[l,d]);const A=t.jsx(c.Card,{ref:b,role:"alertdialog","aria-modal":"false","aria-labelledby":g,"aria-describedby":k?v:void 0,"aria-busy":l||void 0,tabIndex:-1,shadow:"none",radius:"lg",onFocus:()=>{$.current=!0},onBlur:j=>{const D=j.relatedTarget;$.current=D instanceof Node&&j.currentTarget.contains(D)},className:c.cn(yt.box,Pp[o],m==="div"&&p),"data-testid":f,children:t.jsxs(c.CardBody,{className:yt.body,children:[t.jsxs("div",{className:yt.text,children:[t.jsx("p",{id:g,className:yt.message,children:e}),k?t.jsx("p",{id:v,className:yt.description,children:s}):null]}),t.jsxs("div",{className:yt.actions,children:[t.jsx(T,{ref:y,size:x,color:o,variant:"solid",onPress:r,isLoading:l,"data-testid":`${f}-confirm`,children:n}),t.jsx(T,{ref:N,size:x,color:"default",variant:"light",onPress:i,isDisabled:l,"data-testid":`${f}-cancel`,children:a})]})]})});return m==="li"?t.jsx("li",{className:c.cn(yt.item,p),children:A}):A};go.displayName="InlineConfirm";const Ip={guardScope:(e,s)=>s(),bypass:e=>e(),report:()=>{},unreport:()=>{}},Us=h.createContext(Ip),ma=h.createContext(null);function Tp(e){const{report:s,unreport:n}=h.useContext(Us),a=h.useContext(ma),r=h.useId();h.useEffect(()=>{s(r,{scope:a,isDirty:e})},[s,r,a,e]),h.useEffect(()=>()=>n(r),[n,r])}function Op(){const{guardScope:e,bypass:s}=h.useContext(Us);return h.useMemo(()=>({guard:n=>e(null,n),bypass:s}),[e,s])}function yo(){const{guardScope:e}=h.useContext(Us),s=h.useContext(ma);return h.useCallback(n=>e(s,n),[e,s])}const zp=({scope:e,children:s})=>t.jsx(ma.Provider,{value:e,children:s}),vo=({guard:e,children:s,title:n="Discard changes?",description:a="What you entered will be lost.",confirmLabel:r="Discard",keepEditingLabel:i="Keep editing","data-testid":o="discard-guard"})=>{const{pending:l,confirmKey:d,confirm:u,keepEditing:x,report:m,unreport:p,guardScope:f}=e.internals,g=h.useMemo(()=>({guardScope:f,bypass:e.bypass,report:m,unreport:p}),[f,e.bypass,m,p]);return t.jsxs(Us.Provider,{value:g,children:[s,t.jsx(ua,{isOpen:l!==null,onOpenChange:v=>{v||x()},onConfirm:u,variant:"warning",title:n,description:a,confirmLabel:r,cancelLabel:i,"data-testid":o},d)]})};vo.displayName="DiscardGuard";const fa=h.createContext(null);function Bp(){const e=h.useContext(fa),s=yo(),n=e?.back,a=h.useCallback(()=>{n&&s(n)},[s,n]);return{isActive:e?.isActive??!0,canGoBack:e?.canGoBack??!1,back:a}}const Vp=["button:not([disabled])","a[href]",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(",");function Up(e){for(const s of e.querySelectorAll(Vp))if(!s.closest('[hidden], [inert], [aria-hidden="true"]'))return s;return null}function kr(e,s){return!e||!e.isConnected||!s.contains(e)||e.matches(":disabled")?!1:!e.closest("[hidden], [inert]")}const Hp=new Set(["menu","listbox","dialog","grid","tree"]);function Wp(e){for(const s of e.querySelectorAll('[aria-expanded="true"][aria-controls]')){const n=s.ownerDocument.getElementById(s.getAttribute("aria-controls")??"");if(!n?.isConnected)continue;if((s.getAttribute("aria-haspopup")??"false")!=="false"||Hp.has(n.getAttribute("role")??""))return n}return null}const Sr="react-aria-focus-scope-restore";class qp{panels=new Map;active=null;setContainer(s,n){n?this.panels.set(s,{entry:null,last:null,...this.panels.get(s),container:n}):this.panels.delete(s)}setEntry(s,n){const a=this.panels.get(s);a?a.entry=n:n&&this.panels.set(s,{container:null,entry:n,last:null})}remember(s,n){const a=this.panels.get(s);a&&(a.last=n)}setActive(s,n){this.active={key:s,isReturn:n}}focusActive(){if(!this.active)return;const s=this.panels.get(this.active.key),n=s?.container;if(!s||!n||n.contains(document.activeElement))return;((this.active.isReturn&&kr(s.last,n)?s.last:null)??(kr(s.entry,n)?s.entry:null)??Up(n))?.focus()}recoverFocus(){const s=this.active?this.panels.get(this.active.key)?.container:null,n=s?Wp(s):null;n?.focus(),n?.contains(document.activeElement)||this.focusActive()}}const Gp="flex flex-initial items-center gap-2 py-4 pl-4 pr-12 text-large font-semibold",Kp="min-w-0 flex-1 truncate text-large font-semibold",Yp="flex shrink-0 items-center gap-2",Qp="size-5";function Zp({panels:e,children:s}){const[n]=h.useState(()=>new qp),{entries:a,back:r}=e,i=a[a.length-1].key,o=h.useRef(null);return h.useLayoutEffect(()=>{const l=o.current;o.current={activeKey:i,keys:new Set(a.map(d=>d.key))},!(!l||l.activeKey===i)&&(n.setActive(i,l.keys.has(i)),n.focusActive())},[i,a,n]),t.jsx(t.Fragment,{children:a.map((l,d)=>t.jsx(Xp,{entryKey:l.key,isActive:d===a.length-1,canGoBack:d>0,back:r,memory:n,children:s(l.panel,l)},l.key))})}const Xp=({entryKey:e,isActive:s,canGoBack:n,back:a,memory:r,children:i})=>{const o=h.useRef(null),l=h.useCallback(u=>r.setEntry(e,u),[r,e]);h.useLayoutEffect(()=>{const u=o.current;if(r.setContainer(e,u),!u)return;const x=m=>{u.hidden&&(m.preventDefault(),r.recoverFocus())};return u.addEventListener(Sr,x),()=>{u.removeEventListener(Sr,x),r.setContainer(e,null)}},[r,e]);const d=h.useMemo(()=>({isActive:s,canGoBack:n,back:a,setEntryFocus:l}),[s,n,a,l]);return t.jsx(fa.Provider,{value:d,children:t.jsx(zp,{scope:e,children:t.jsx("div",{ref:o,hidden:!s,style:{display:s?"contents":"none"},onFocus:u=>{u.currentTarget.contains(u.target)&&r.remember(e,u.target)},children:i})})})},jo=({title:e,onBack:s,backLabel:n="Back",isBackDisabled:a,size:r="md",actions:i,className:o,"data-testid":l="modal-panel-header"})=>{const d=h.useContext(fa),u=yo(),x=h.useId(),m=s??(d?.canGoBack?d.back:void 0);return t.jsxs("header",{className:c.cn(Gp,o),"data-testid":l,children:[m?t.jsx(T,{ref:d?.setEntryFocus,isIconOnly:!0,variant:"light",color:"default",size:r,"aria-label":n,"aria-describedby":x,isDisabled:a,onPress:()=>u(m),"data-testid":`${l}-back`,children:t.jsx(M,{icon:"solar:arrow-left-outline",className:Qp,"aria-hidden":"true"})}):null,t.jsx("h2",{id:x,className:Kp,"data-testid":`${l}-title`,children:e}),i?t.jsx("div",{className:Yp,children:i}):null]})};jo.displayName="ModalPanelHeader";function Jp(e){const s=h.useRef(1),[n]=h.useState(e),[a,r]=h.useState(()=>[{key:"panel-0",panel:e}]),i=h.useCallback(x=>{const m=`panel-${s.current}`;return s.current+=1,{key:m,panel:x}},[]),o=h.useCallback(x=>{const m=i(x);r(p=>[...p,m])},[i]),l=h.useCallback(()=>{r(x=>x.length>1?x.slice(0,-1):x)},[]),d=h.useCallback(x=>{const m=i(x);r(p=>[...p.slice(0,-1),m])},[i]),u=h.useCallback(x=>{r([i(x===void 0?n:x)])},[i,n]);return h.useMemo(()=>({current:a[a.length-1].panel,entries:a,canGoBack:a.length>1,push:o,back:l,replace:d,reset:u}),[a,o,l,d,u])}function eh(){const e=h.useRef(new Map),[s,n]=h.useState(0),[a,r]=h.useState(null),[i,o]=h.useState(0),l=h.useCallback(()=>{let b=0;for(const y of e.current.values())y.isDirty&&(b+=1);n(b)},[]),d=h.useCallback((b,y)=>{e.current.set(b,y),l()},[l]),u=h.useCallback(b=>{e.current.delete(b),l()},[l]),x=h.useCallback((b,y)=>{let N=!1;for(const k of e.current.values())k.isDirty&&(b===null||k.scope===b)&&(N=!0);N?r({leave:y}):y()},[]),m=h.useCallback(b=>x(null,b),[x]),p=h.useCallback(b=>{for(const y of e.current.values())y.isDirty=!1;l(),r(null),b()},[l]),f=h.useCallback(b=>y=>{y?b(!0):m(()=>b(!1))},[m]),g=h.useCallback(()=>{const b=a?.leave;r(null),o(y=>y+1),b?.()},[a]),v=h.useCallback(()=>r(null),[]);return h.useMemo(()=>({isDirty:s>0,guard:m,bypass:p,guardOpenChange:f,internals:{pending:a,confirmKey:i,confirm:g,keepEditing:v,report:d,unreport:u,guardScope:x}}),[s,m,p,f,a,i,g,v,d,u,x])}const th=60,sh=(e,s,n=th)=>s?e>n:e<-n,wo=(e,s)=>Math.max(0,Math.min(e,s)),nh=160,ah=(e,s,n=nh)=>Math.min(e,Math.max(0,s-n)),rh=(e,s,n)=>wo(e-s,n),ih=(e,s,n)=>e!==null?wo(e,n):s?n:0,lh=e=>e?"":"transition-[height] duration-300 ease-out",oh=e=>({onDrag:(s,n)=>{const a=e.open?e.fullHeight:0;e.setDragHeight(rh(a,n?.offset?.y??0,e.fullHeight))},onDragEnd:(s,n)=>{sh(n?.offset?.y??0,e.open)&&e.onToggleOpen?.(),e.setDragHeight(null)}}),Ct=(e,s)=>xe(e.value,s,e.currency),$r=`opacity-60 transition-opacity ${Ce}`,xa=({item:e,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r=!0,compact:i=!1})=>{const o=!!e.children&&e.children.length>0,l=!!n&&r&&e.removable!==!1,d=e.tone?"text-default-600":"text-default-500";return t.jsxs("div",{"data-testid":`summary-item-${e.id}`,className:c.cn(i?"flex flex-col gap-1 py-3 first:pt-0":"flex flex-col gap-2",e.tone&&"-mx-2 rounded-lg px-2 py-1.5"),style:e.tone?{backgroundColor:Xe[e.tone].bg}:void 0,children:[t.jsxs("div",{className:i?"flex items-start justify-between gap-2":"flex min-h-9 items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-base text-foreground",children:[!i&&typeof e.quantity=="number"&&t.jsxs("span",{"data-testid":`summary-item-qty-${e.id}`,className:"shrink-0",children:[e.quantity," x"]}),e.leadingIcon,t.jsx("span",{"data-testid":`summary-item-name-${e.id}`,className:i?"line-clamp-2 text-sm font-semibold":c.cn("truncate",e.emphasis&&"font-medium"),children:e.name})]}),t.jsxs("div",{className:"flex shrink-0 items-center",children:[e.originalAmount&&t.jsx("span",{"data-testid":`summary-item-original-${e.id}`,className:c.cn("mr-2 whitespace-nowrap text-[0.8125rem] text-default-600 line-through",e.pending&&$r),children:e.originalAmount}),e.amount&&t.jsx("span",{"data-testid":`summary-item-amount-${e.id}`,"data-pending":e.pending?"true":void 0,className:c.cn(i?"whitespace-nowrap text-sm font-semibold text-foreground":"whitespace-nowrap text-base text-foreground",e.pending&&$r),children:Ct(e.amount,s)}),l&&t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 p-2 text-danger",i&&"-my-1.5"),"aria-label":a,"data-testid":`summary-remove-${e.id}`,onPress:()=>n(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]})]}),se(e.trailing)&&t.jsx("div",{"data-testid":`summary-item-trailing-${e.id}`,className:"flex justify-end",children:e.trailing}),e.dateLabel&&t.jsxs("div",{"data-testid":`summary-item-date-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{className:"truncate",children:e.dateLabel})]}),e.dateRange&&t.jsxs("div",{"data-testid":`summary-item-daterange-${e.id}`,className:c.cn("flex items-center gap-2 text-sm",d),children:[t.jsx(M,{icon:"lucide:calendar",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.from}),t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16,className:"shrink-0"}),t.jsx("span",{children:e.dateRange.to})]}),e.details?.map((u,x)=>t.jsxs("div",{"data-testid":`summary-item-detail-${e.id}-${u.key??x}`,className:c.cn("flex items-center justify-between gap-2",i?"text-xs":"text-sm",d),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.icon,t.jsx("span",{className:"truncate",children:u.label})]}),(u.value!=null||u.tooltip!=null)&&t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[u.value!=null&&t.jsx("span",{className:c.cn("whitespace-nowrap",u.valueTone==="primary"&&c.cn("font-medium",e.tone?"text-primary-600":"text-primary")),children:u.value}),u.tooltip!=null&&t.jsx(c.Tooltip,{content:u.tooltip,children:t.jsx("span",{"data-testid":`summary-item-detail-tooltip-${e.id}-${u.key??x}`,className:"flex shrink-0 items-center",children:t.jsx(M,{icon:"lucide:info",width:16,height:16,className:c.cn(u.valueTone==="primary"?"text-primary":"text-default-400")})})})]})]},u.key??x)),o&&t.jsx("div",{"data-testid":`summary-children-${e.id}`,className:"flex flex-col gap-2 pl-6",children:e.children.map(u=>t.jsx(xa,{item:u,locale:s,onRemove:n,removeAriaLabel:a,showRemoveButton:r,compact:i},u.id))})]})};xa.displayName="SummaryItemRow";const No=({fee:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-service-fee",className:c.cn("flex items-center justify-between gap-2",n),children:[t.jsxs("button",{type:"button",role:"switch","aria-checked":!!e.isSelected,"aria-label":typeof e.label=="string"?e.label:"Pay Service fee","data-testid":"summary-service-fee-toggle",onClick:e.onToggle,className:"flex min-w-0 items-center gap-2 text-left",children:[t.jsx("span",{"aria-hidden":"true",className:c.cn("flex size-4 shrink-0 items-center justify-center rounded-full border",e.isSelected?"border-primary":"border-default-200"),children:e.isSelected&&t.jsx("span",{className:"size-2 rounded-full bg-primary"})}),t.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e.label})]}),t.jsx("span",{"data-testid":"summary-service-fee-amount",className:"whitespace-nowrap text-base text-foreground",children:Ct(e.amount,s)})]});No.displayName="SummaryServiceFeeRow";const pa=({row:e,locale:s,emphasized:n,onRemove:a,removeAriaLabel:r,showRemoveButton:i=!0,compact:o=!1})=>{const l=!!a&&i&&!!e.id,d=t.jsx("span",{"data-testid":`summary-row-label-${e.key}`,className:o?void 0:c.cn(n?"text-xl font-semibold leading-7":"text-base"),children:e.label});return t.jsxs("div",{"data-testid":`summary-row-${e.key}`,className:o?"flex items-center justify-between text-sm text-default-500":"flex items-center justify-between text-foreground",children:[l?t.jsxs("div",{className:"flex min-w-0 items-center",children:[d,t.jsx(T,{isIconOnly:!0,size:"sm",variant:"light",radius:"full",className:c.cn("ml-1 size-8 min-w-8 shrink-0 p-2 text-danger",o&&"-my-1.5"),"aria-label":r,"data-testid":`summary-remove-row-${e.id}`,onPress:()=>a(e.id),children:t.jsx(M,{icon:"lucide:trash-2",width:16,height:16,className:"text-danger"})})]}):d,t.jsx("span",{"data-testid":`summary-row-amount-${e.key}`,className:c.cn("whitespace-nowrap",!o&&"text-base",e.amountTone==="success"&&"text-success"),children:Ct(e.amount,s)})]})};pa.displayName="SummaryTotalsLineRow";const Co=({pricesInLabel:e,currency:s,items:n,serviceFee:a,rows:r,locale:i,onRemoveItem:o,removeAriaLabel:l,onRemoveTotalRow:d,removeTotalRowAriaLabel:u,showRemoveButton:x,emptyState:m,compact:p=!1,classNames:f})=>{const g=(n?.length??0)>0;return t.jsxs(t.Fragment,{children:[!p&&t.jsxs("div",{"data-testid":"summary-prices",className:c.cn("flex items-center justify-between text-xs text-default-500",f.prices),children:[t.jsx("span",{children:e}),s!=null&&t.jsx("span",{children:s})]}),g?t.jsx("div",{className:c.cn(p?"flex flex-col divide-y divide-default-100":"flex flex-col gap-4",f.items),children:n.map(v=>t.jsx(xa,{item:v,locale:i,onRemove:o,removeAriaLabel:l,showRemoveButton:x,compact:p},v.id))}):t.jsx("div",{"data-testid":"summary-empty",children:m}),a&&t.jsxs(t.Fragment,{children:[t.jsx(c.Divider,{className:"bg-default-100"}),t.jsx(No,{fee:a,locale:i,className:f.serviceFee})]}),r&&r.length>0&&t.jsx("div",{className:c.cn(p?c.cn("flex flex-col gap-1 pt-3",!a&&"border-t border-default-100"):"flex flex-col gap-4",f.totalsRows),children:r.map((v,b)=>t.jsx(pa,{row:v,locale:i,emphasized:!p&&b===0,onRemove:d,removeAriaLabel:u,showRemoveButton:x,compact:p},v.key))})]})};Co.displayName="SummaryBody";const ko=({total:e,locale:s,compact:n=!1,className:a})=>{const r=n?"text-lg":"text-xl";return t.jsxs("div",{"data-testid":"summary-total",className:c.cn(`flex items-center justify-between ${r} font-semibold leading-7 text-foreground`,a),children:[t.jsx("span",{children:e.label??"Total"}),t.jsx("span",{"data-testid":"summary-total-amount",className:`whitespace-nowrap ${r} font-semibold leading-7`,children:Ct(e.amount,s)})]})};ko.displayName="SummaryGrandTotalRow";const So=({secondaryTotal:e,locale:s,className:n})=>t.jsxs("div",{"data-testid":"summary-secondary-total",className:c.cn("flex items-center justify-between text-lg font-semibold leading-7 text-primary",n),children:[t.jsx("span",{children:e.label}),t.jsx("span",{"data-testid":"summary-secondary-total-amount",className:"whitespace-nowrap text-lg font-semibold leading-7",children:Ct(e.amount,s)})]});So.displayName="SummarySecondaryTotalRow";const Ls=({action:e,disabledByLoading:s,className:n,testId:a="summary-cta"})=>t.jsx(T,{color:"primary",radius:"full",className:c.cn("px-[18px] py-[14px] font-medium",n),"data-testid":a,isLoading:e.isLoading,isDisabled:e.isDisabled||s,onPress:e.onPress,endContent:t.jsx(M,{icon:"lucide:arrow-right",width:16,height:16}),children:e.label});Ls.displayName="SummaryPrimaryCta";const $o=({title:e,total:s,secondaryTotal:n,locale:a,open:r,progress:i,dragging:o,toggleAriaLabel:l,onToggleOpen:d,classNames:u})=>t.jsx("h2",{children:t.jsxs("button",{type:"button","data-testid":"summary-collapse-toggle","aria-expanded":r,"aria-label":l,onClick:d,className:c.cn("-mx-4 -mt-4 grid w-[calc(100%_+_32px)] grid-cols-1 px-4 pb-4 pt-4 text-left",u.header),children:[t.jsxs("span",{"aria-hidden":!r,style:{opacity:i},className:c.cn("col-start-1 row-start-1 flex items-center justify-between",!o&&"transition-opacity duration-300"),children:[t.jsx("span",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",u.title),children:e}),t.jsx("span",{"data-testid":"summary-close","aria-hidden":"true",className:c.cn("shrink-0 text-foreground",u.closeButton),children:t.jsx(M,{icon:"lucide:x",width:20,height:20})})]}),t.jsxs("span",{"aria-hidden":r,style:{opacity:1-i},className:c.cn("col-start-1 row-start-1 flex flex-col gap-2",!o&&"transition-opacity duration-300"),children:[t.jsxs("span",{className:"flex items-center justify-between text-xl font-semibold leading-7 text-foreground",children:[t.jsx("span",{children:s.label??"Total"}),t.jsx("span",{className:"whitespace-nowrap",children:Ct(s.amount,a)})]}),n&&t.jsxs("span",{className:"flex items-center justify-between text-lg font-semibold leading-7 text-primary",children:[t.jsx("span",{children:n.label}),t.jsx("span",{className:"whitespace-nowrap",children:Ct(n.amount,a)})]})]})]})});$o.displayName="SummaryCollapseHeader";const Ao=({cart:e,ariaLabel:s,onPress:n,className:a})=>t.jsxs("button",{type:"button","data-testid":"summary-cart","aria-label":s,onClick:n,className:c.cn("relative flex size-[52px] shrink-0 items-center justify-center rounded-full border border-default-200 bg-content1",a),children:[t.jsx(M,{icon:"lucide:shopping-bag",width:24,height:24,className:"text-foreground"}),e.count!=null&&t.jsx("span",{"data-testid":"summary-cart-badge",className:"absolute -right-1 -top-1 flex size-4 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:e.count})]});Ao.displayName="SummaryCartButton";const Do=({open:e,progress:s,dragging:n,primaryAction:a,isLoading:r,cart:i,cartAriaLabel:o,ctaCaption:l,ctaError:d,onToggleOpen:u,classNames:x})=>t.jsxs("div",{"data-testid":"summary-mobile-bar",className:c.cn("flex flex-col gap-4",x.mobileBar),children:[t.jsx(c.Divider,{className:"bg-default-200"}),d&&t.jsx("div",{children:d}),t.jsxs("div",{className:"grid",children:[t.jsxs("div",{"aria-hidden":e,style:{opacity:1-s},className:c.cn("col-start-1 row-start-1 flex items-stretch gap-2.5",e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:[i&&t.jsx(Ao,{cart:i,ariaLabel:o,className:x.cart,onPress:()=>{u?.(),i.onPress?.()}}),a&&t.jsx(Ls,{action:a,disabledByLoading:r,className:c.cn("h-[52px] flex-1",x.cta),testId:"summary-cta-compact"})]}),a&&t.jsx("div",{"aria-hidden":!e,style:{opacity:s},className:c.cn("col-start-1 row-start-1 flex",!e&&"pointer-events-none",!n&&"transition-opacity duration-300"),children:t.jsx(Ls,{action:a,disabledByLoading:r,className:c.cn("h-[52px] w-full",x.cta)})})]}),l&&t.jsx("div",{children:l})]});Do.displayName="SummaryActionBar";const ch="(max-width: 767px)",dh=e=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(e).matches:!1,uh=(e=ch)=>{const[s,n]=h.useState(()=>dh(e));return h.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(e),r=()=>n(a.matches);return r(),a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),s},Eo=({title:e="Summary",pricesInLabel:s="Prices are in",currency:n,locale:a="en-US",items:r,serviceFee:i,rows:o,total:l,postTotalRows:d,onRemoveTotalRow:u,onRemovePostTotalRow:x,secondaryTotal:m,collapsible:p,isOpen:f,onToggleOpen:g,defaultOpen:v=!1,primaryAction:b,isLoading:y=!1,onRemoveItem:N,showRemoveButton:k,ctaCaption:w,ctaError:$,variant:A,cart:j,emptyState:D,labels:S,classNames:_={},density:F="default","data-testid":L="summary",className:P})=>{const B=S?.removeAriaLabel??"Remove item",H=S?.removeTotalRowAriaLabel??"Remove discount",K=S?.removePostTotalRowAriaLabel??"Remove applied code",O=S?.toggleAriaLabel??"Toggle summary",ne=S?.cartAriaLabel??"View cart",G=F==="compact",te=uh(),ce=p??(A??(te?"mobile":"main"))==="mobile",[ee,J]=h.useState(v),le=f!==void 0,U=!ce||(le?f:ee),z=h.useCallback(()=>{le||J(I=>!I),g?.()},[le,g]),[Q,Ve]=h.useState(0),[Re,_e]=h.useState(null),ae=h.useRef(null),ke=h.useRef(null),Ue=h.useCallback(()=>{const I=ae.current;I&&Ve(ah(I.scrollHeight,window.innerHeight))},[]),rt=h.useCallback(I=>{ke.current?.disconnect(),ke.current=null,ae.current=I,I&&(Ue(),typeof ResizeObserver<"u"&&(ke.current=new ResizeObserver(Ue),ke.current.observe(I)))},[Ue]);h.useEffect(()=>(window.addEventListener("resize",Ue),()=>window.removeEventListener("resize",Ue)),[Ue]);const ve=oh({open:U,fullHeight:Q,setDragHeight:_e,onToggleOpen:z}),He=Re!==null,ue=ih(Re,U,Q),je=Q>0?Math.min(1,Math.max(0,ue/Q)):U?1:0,we=t.jsx(ko,{total:l,locale:a,compact:G,className:_.total}),C=d&&d.length>0&&t.jsx("div",{"data-testid":"summary-post-total-rows",className:"flex flex-col gap-4",children:d.map(I=>t.jsx(pa,{row:I,locale:a,emphasized:!1,onRemove:x,removeAriaLabel:K,showRemoveButton:k,compact:G},I.key))}),E=m&&t.jsx(So,{secondaryTotal:m,locale:a,className:_.secondaryTotal}),R=w!=null&&t.jsx("p",{"data-testid":"summary-cta-caption",className:c.cn("text-center text-sm text-default-500",_.ctaCaption),children:w}),W=$!=null&&t.jsx("p",{role:"alert","data-testid":"summary-cta-error",className:c.cn("text-center text-sm text-danger",_.ctaError),children:$}),V=t.jsx(Co,{pricesInLabel:s,currency:n,items:r,serviceFee:i,rows:o,locale:a,onRemoveItem:N,removeAriaLabel:B,onRemoveTotalRow:u,removeTotalRowAriaLabel:H,showRemoveButton:k,emptyState:D,compact:G,classNames:_});return ce?t.jsxs(Be.motion.section,{"data-testid":L,drag:"y",dragConstraints:{top:0,bottom:0},dragElastic:.12,dragSnapToOrigin:!0,onDrag:ve.onDrag,onDragEnd:ve.onDragEnd,className:c.cn("fixed inset-x-0 bottom-0 z-50 flex max-h-full w-full flex-col rounded-t-2xl bg-content1 p-4 drop-shadow-[0_-2px_2px_rgba(0,0,0,0.1)]",P,_.base),children:[t.jsx($o,{title:e,total:l,secondaryTotal:m,locale:a,open:U,progress:je,dragging:He,toggleAriaLabel:O,onToggleOpen:z,classNames:_}),t.jsx("div",{"data-testid":"summary-reveal","aria-hidden":!U,style:{height:ue},className:c.cn("min-h-0",U&&!He?"overflow-y-auto overscroll-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden":"overflow-hidden",!U&&"pointer-events-none",lh(He)),children:t.jsxs("div",{ref:rt,className:G?"flex flex-col gap-3 pb-4":"flex flex-col gap-4 pb-4",children:[V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),we,C,E]})}),t.jsx(Do,{open:U,progress:je,dragging:He,primaryAction:b,isLoading:y,cart:j,cartAriaLabel:ne,ctaCaption:R,ctaError:W,onToggleOpen:z,classNames:_})]}):t.jsxs("section",{"data-testid":L,className:c.cn(G?"flex w-full flex-col gap-3 rounded-2xl border border-default-200 bg-content1 p-4":"flex w-full flex-col gap-4 rounded-2xl border border-default-200 bg-content1 p-4",P,_.base),children:[!G&&t.jsx("div",{className:c.cn("flex items-center justify-between",_.header),children:t.jsx("h2",{"data-testid":"summary-title",className:c.cn("text-xl font-semibold leading-7 text-foreground",_.title),children:e})}),V,!G&&t.jsx(c.Divider,{className:"bg-default-200"}),we,C,E,m&&b&&t.jsx(c.Divider,{className:"bg-default-200"}),b&&t.jsx(Ls,{action:b,disabledByLoading:y,className:c.cn("w-full",_.cta)}),W,R]})};Eo.displayName="Summary";const lt={bare:"flex gap-1.5",list:"m-0 flex list-none gap-4 p-0",item:"flex min-w-0 flex-1 flex-col",step:"flex min-w-0 flex-1 flex-col items-stretch gap-1.5 text-left",button:"cursor-pointer rounded-md border-none bg-transparent p-0 font-[inherit] outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[0.1875rem] focus-visible:outline-primary disabled:cursor-default",segment:"block h-1 rounded-full",name:"flex min-w-0 items-center gap-[0.3125rem] truncate text-xs font-semibold leading-[1.125rem]",check:"flex h-[0.8125rem] w-[0.8125rem] shrink-0"},Ar={done:"bg-pos-ok",active:"bg-primary",upcoming:"bg-pos-line"},mh={done:"text-pos-ok",active:"text-pos-ink",upcoming:"text-pos-muted"},fh={ariaLabel:"Progress",completed:"completed"},ha=({steps:e,activeStepId:s,showLabels:n=!0,onStepPress:a,isStepReachable:r,labels:i,className:o,"data-testid":l="step-progress"})=>{const d={...fh,...i},u=e.filter(p=>p.state!=="skipped"),x=Math.max(0,u.findIndex(p=>p.id===s)),m=p=>p<x?"done":p===x?"active":"upcoming";return n?t.jsx("ol",{"aria-label":d.ariaLabel,className:c.cn(lt.list,o),"data-testid":l,children:u.map((p,f)=>{const g=m(f),v=t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:c.cn(lt.segment,"w-full",Ar[g]),"data-testid":`${l}-segment-${p.id}`}),t.jsxs("span",{className:c.cn(lt.name,mh[g]),"data-testid":`${l}-name-${p.id}`,children:[g==="done"&&t.jsx("span",{"aria-hidden":"true",className:lt.check,"data-testid":`${l}-check-${p.id}`,children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})}),t.jsx("span",{className:"truncate",children:p.label}),g==="done"&&t.jsxs("span",{className:"sr-only",children:[", ",d.completed]})]})]}),b=r?r(p.id,f):f<x,y=g==="active"?"step":void 0;return t.jsx("li",{className:lt.item,"aria-current":a?void 0:y,"data-state":g,"data-testid":`${l}-step-${p.id}`,children:a?t.jsx("button",{type:"button",className:c.cn(lt.step,lt.button),disabled:!b,"aria-current":y,onClick:()=>a(p.id),"data-testid":`${l}-button-${p.id}`,children:v}):t.jsx("div",{className:lt.step,children:v})},p.id)})}):t.jsx("div",{"aria-hidden":"true",className:c.cn(lt.bare,o),"data-testid":l,children:u.map((p,f)=>t.jsx("span",{className:c.cn(lt.segment,"flex-1",Ar[m(f)]),"data-state":m(f)},p.id))})};ha.displayName="StepProgress";const xh={back:"Back",close:"Close",cancel:"Cancel",partialBadge:"Partial refund",owesBadge:"Customer owes",ofSeparator:"of"},ph={backgroundColor:oe.destructive,color:"#fff"},hh={warn:{backgroundColor:oe["warn-fill"],color:oe.warn},ok:{backgroundColor:oe["ok-fill"],color:oe.ok},neutral:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))",border:`1px solid ${oe.line}`}},xn="inline-flex h-[22px] items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",pn="absolute top-0 h-5 w-5 opacity-0",Lo=({onClose:e,steps:s,activeStepId:n,subtitle:a,onBack:r,primaryAction:i,totalRow:o,secondaryAction:l,hideChrome:d,footerSummary:u,labels:x,className:m,"data-testid":p="wizard-shell",children:f})=>{const g={...xh,...x},v=s.find(N=>N.id===n),b=r??e,y=r?g.back:g.cancel;return t.jsxs("div",{className:c.cn("flex h-full min-h-0 w-full flex-col bg-white text-default-900",m),"data-testid":p,children:[!d&&t.jsxs("header",{className:"flex shrink-0 flex-wrap items-center gap-2.5 border-b border-pos-line px-6 py-4","data-testid":`${p}-header`,children:[b&&t.jsx(T,{variant:"light",className:"h-10 min-w-0 gap-2 rounded-xl px-4 text-sm font-semibold text-default-600",onPress:b,"data-testid":`${p}-header-back`,startContent:t.jsx(M,{icon:"lucide:circle-chevron-left",width:18,height:18,"aria-hidden":"true"}),children:y}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-lg font-semibold","data-testid":`${p}-header-title`,children:v?.label??""}),a&&t.jsx("div",{className:"mt-0.5 text-[12.5px] text-default-500","data-testid":`${p}-header-subtitle`,children:a})]}),t.jsxs("div",{className:"relative flex-1","data-testid":`${p}-footer`,children:[e&&t.jsx("button",{type:"button","aria-label":g.close,onClick:e,className:c.cn(pn,"left-0"),"data-testid":`${p}-header-close`}),r&&t.jsx("button",{type:"button","aria-label":g.back,onClick:r,className:c.cn(pn,"left-6"),"data-testid":`${p}-back`}),l&&t.jsx("button",{type:"button","aria-label":l.label,disabled:l.disabled,onClick:l.onClick,className:c.cn(pn,"left-12"),"data-testid":`${p}-secondary`})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center justify-between gap-3 sm:w-auto sm:flex-nowrap sm:justify-end sm:gap-4",children:[o&&t.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[12.5px] font-semibold text-default-600","data-testid":`${p}-total`,children:[t.jsx("span",{children:o.label}),o.amount&&t.jsx("span",{className:"tabular-nums text-default-900",children:xe(o.amount.value,void 0,o.amount.currency)}),o.of&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:g.ofSeparator}),t.jsx("span",{className:"tabular-nums text-default-900","data-testid":`${p}-total-of`,children:xe(o.of.value,void 0,o.of.currency)})]}),o.badge==="partial"&&t.jsx("span",{className:c.cn(xn,"bg-pos-warn-fill text-pos-warn"),"data-testid":`${p}-total-partial`,children:g.partialBadge}),o.badge==="owes"&&t.jsx("span",{className:c.cn(xn,"border border-pos-line bg-default-100 text-default-600"),"data-testid":`${p}-total-owes`,children:g.owesBadge}),typeof o.badge=="object"&&t.jsx("span",{className:xn,style:hh[o.badge.tone],"data-tone":o.badge.tone,"data-testid":`${p}-total-badge`,children:o.badge.label})]}),t.jsx(T,{color:"primary",className:c.cn("h-12 min-w-0 rounded-[14px] px-5 text-[15px] font-semibold",i.tone==="destructive"&&"bg-pos-destructive text-white"),style:i.tone==="destructive"?ph:void 0,isLoading:i.loading,isDisabled:i.disabled,onPress:i.onClick,"data-testid":`${p}-primary`,children:i.label})]})]}),t.jsx(ha,{steps:s,activeStepId:n,showLabels:!1,className:"shrink-0 px-6 py-2.5","data-testid":`${p}-stepper`}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-[22px]","data-testid":`${p}-body`,children:f}),u]})};Lo.displayName="WizardShell";const bh=(e,s,n)=>Math.min(Math.max(e,s),n);function Ln(e,s,n){const a=Math.max(1,Math.trunc(s)),r=bh(Math.trunc(n),0,a);if(r===a)return{...e};if(r===0)return{value:0,currency:e.currency};const i=Math.pow(10,Pt(e.currency)),o=Math.round(e.value*i),l=Math.floor(o/a),d=o-l*a;return{value:(l*r+Math.min(r,d))/i,currency:e.currency}}function gh(e,s){return Ln(e,s,1)}const yh=e=>Number.isFinite(e)?e.toFixed(2):"",Fn=({value:e,expected:s,max:n,onChange:a,ariaLabel:r,isDisabled:i,className:o,"data-testid":l,inputTestId:d})=>{const[u,x]=h.useState(null),m=h.useRef(null),p=Math.abs(e-s)>.004;return t.jsxs("span",{className:c.cn("inline-flex h-11 items-center gap-px rounded-[10px] border px-2.5","focus-within:border-primary focus-within:ring-[3px] focus-within:ring-primary/10",p?"border-primary bg-primary-50":"border-pos-line bg-white",o),"data-testid":l,children:[t.jsx("span",{className:"text-[13px] text-default-600",children:"$"}),t.jsx("input",{ref:m,type:"text",inputMode:"decimal","aria-label":r,disabled:i,className:"w-full border-none bg-transparent p-0 text-right text-sm font-semibold tabular-nums text-default-900 outline-none",value:u??yh(e),onChange:f=>{const g=f.target.value,v=Number.parseFloat(g.replace(",","."));n!==void 0&&Number.isFinite(v)&&v>n+.004||(x(g),Number.isFinite(v)&&v>=0?a(v):g.trim()===""&&a(0))},onFocus:f=>f.currentTarget.select(),onBlur:()=>x(null),"data-testid":d})]})};Fn.displayName="AmountCell";const vh={refunded:"Refunded",ineligible:"Ineligible",partialLink:"Refund partial $ of this line",partialOf:"of {amount}",partialCancel:"Cancel",restockTitle:"Restock this item",restockHint:"Returns to current location.",decrease:"Decrease {name}",increase:"Increase {name}",amount:"Refund amount for {name}",adjustmentNote:"Item stays with customer (price adjustment)",maxNote:"Max {count} purchased",disposition:"Disposition",dispositionStock:"Back to stock",dispositionNoRestock:"Not restocked",dispositionDamaged:"Damaged → Cardex",amountOnlyAdd:"Refund an amount",amountOnlyTitle:"Refund an amount",amountOnlyDetail:"Not tied to an item · up to {amount} remaining",amountOnlyRemove:"Remove amount refund"},jh="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full border border-pos-line bg-default-100 px-[9px] text-xs font-medium leading-none text-default-600",Dr="flex h-11 flex-1 items-center justify-center bg-white text-lg text-default-900 outline-none transition-colors hover:bg-default-100 disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary",hn="absolute h-5 w-5 opacity-0",wh=e=>{const s=xe(e.paidAmount.value,void 0,e.paidAmount.currency);if(e.quantity<=1)return s;const n=gh(e.paidAmount,e.quantity);return`${e.quantity} × ${xe(n.value,void 0,n.currency)} · ${s}`},Fo=({items:e,selections:s,onSelectionChange:n,onRestockToggle:a,onDispositionChange:r,amountOnly:i,labels:o,className:l,"data-testid":d="line-item-list"})=>{const u={...vh,...o},x=[{key:"stock",label:u.dispositionStock},{key:"norestock",label:u.dispositionNoRestock},{key:"damaged",label:u.dispositionDamaged}];return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",l),"data-testid":d,children:[e.map(m=>{const p=s[m.id],f=m.state==="already_refunded"||m.state==="non_refundable",g=`${d}-row-${m.id}`,v=Math.max(1,Math.trunc(m.quantity)),b=p?.quantity,y=p?.selected?Math.min(b??v,v):b??0,N=Ln(m.paidAmount,v,y).value,k=p?.amount??(p?.selected?N:0),w=y===0&&k>.004,$=j=>n(m.id,{selected:j.quantity>0||j.amount>.004,mode:"full",...j}),A=j=>{const D=Math.min(Math.max(j,0),v);$({quantity:D,amount:Ln(m.paidAmount,v,D).value})};return t.jsxs("div",{className:c.cn("relative flex items-start gap-3 border-b border-pos-line-2 py-3 last:border-b-0",f&&"opacity-60"),"data-testid":g,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600","data-testid":`${g}-icon`,children:t.jsx(M,{icon:m.icon??"lucide:package",width:19,height:19,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-semibold",children:m.name}),t.jsx("p",{className:"text-[12.5px] text-default-500","data-testid":`${g}-detail`,children:m.detail??wh(m)}),w&&t.jsx("p",{className:"mt-[3px] text-[12.5px] italic text-default-500","data-testid":`${g}-adjustment-note`,children:u.adjustmentNote})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-auto sm:flex-nowrap","data-testid":`${g}-partial`,children:[f?t.jsx("span",{className:"text-sm font-semibold tabular-nums",children:xe(m.paidAmount.value,void 0,m.paidAmount.currency)}):t.jsx(Fn,{value:k,expected:N,max:m.paidAmount.value,onChange:j=>$({quantity:y,amount:j}),ariaLabel:u.amount.replace("{name}",m.name),className:"w-[120px]","data-testid":`${g}-amount`,inputTestId:`${g}-partial-input-field`}),f?t.jsx("span",{className:jh,"data-testid":`${g}-blocked`,children:m.state==="already_refunded"?u.refunded:u.ineligible}):t.jsxs("div",{role:"group","aria-label":m.name,className:"flex w-[160px] shrink-0 items-center gap-0.5 overflow-hidden rounded-[10px] border border-pos-line","data-testid":`${g}-qty`,children:[t.jsx("button",{type:"button",className:Dr,"aria-label":u.decrease.replace("{name}",m.name),disabled:y===0,onClick:()=>A(y-1),"data-testid":`${g}-qty-decrease`,children:"−"}),t.jsx("span",{"aria-live":"polite",className:"min-w-8 flex-1 text-center text-[15px] font-semibold tabular-nums","data-testid":`${g}-qty-value`,children:y}),t.jsx("button",{type:"button",className:Dr,"aria-label":u.increase.replace("{name}",m.name),disabled:y===v,onClick:()=>A(y+1),"data-testid":`${g}-qty-increase`,children:"+"})]})]})]}),y>=v&&t.jsx("p",{className:"mt-2 text-xs text-default-500","data-testid":`${g}-max-note`,children:u.maxNote.replace("{count}",String(v))}),p?.selected&&!m.restock.available&&m.restock.unavailableHint&&t.jsx("p",{className:"mt-2 text-xs text-default-500",children:m.restock.unavailableHint}),m.warning&&t.jsxs("div",{className:"mt-2.5 flex items-start gap-2 rounded-[10px] bg-pos-warn-fill px-2.5 py-2 text-[12.5px] text-pos-warn","data-testid":`${g}-warning`,children:[t.jsx(M,{icon:"gravity-ui:triangle-exclamation-fill",width:15,height:15,className:"mt-0.5 shrink-0","aria-hidden":"true"}),t.jsx("span",{children:m.warning})]}),y>0&&m.restock.available&&t.jsxs("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"mr-0.5 text-[11px] font-semibold uppercase tracking-[.04em] text-default-500",children:u.disposition}),t.jsx(at,{"aria-label":u.disposition,className:"w-[220px]",selectedKeys:[m.restock.disposition??(m.restock.on?"stock":"norestock")],onSelectionChange:j=>{if(j==="all")return;const D=[...j][0];D&&(r?.(m.id,D),a(m.id,D==="stock"))},"data-testid":`${g}-restock`,children:x.map(j=>t.jsx(c.SelectItem,{children:j.label},j.key))})]})]}),!f&&t.jsxs(t.Fragment,{children:[t.jsx(c.Checkbox,{className:c.cn(hn,"right-0 top-0 m-0 p-0"),isSelected:!!p?.selected,onValueChange:j=>n(m.id,{selected:j,mode:"full"}),"aria-label":m.name,"data-testid":`${g}-checkbox`}),t.jsx("button",{type:"button","aria-label":u.partialLink,onClick:()=>document.querySelector(`[data-testid="${g}-partial-input-field"]`)?.focus(),className:c.cn(hn,"left-0 top-0"),"data-testid":`${g}-partial-link`}),t.jsx("button",{type:"button","aria-label":u.partialCancel,onClick:()=>$({quantity:y,amount:N}),className:c.cn(hn,"left-5 top-0"),"data-testid":`${g}-partial-cancel`})]})]},m.id)}),i&&(i.value===null?t.jsxs("button",{type:"button",onClick:i.onAdd,className:"mt-1 inline-flex items-center gap-1.5 self-start rounded pt-3 text-[12.5px] font-semibold text-primary outline-none hover:text-primary-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-testid":`${d}-amount-only-add`,children:[t.jsx(M,{icon:"lucide:plus",width:13,height:13,"aria-hidden":"true"}),u.amountOnlyAdd]}):t.jsxs("div",{className:"flex items-start gap-3 border-b border-pos-line-2 pb-3 pt-5 last:border-b-0","data-testid":`${d}-amount-only`,children:[t.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:circle-dollar-sign",width:19,height:19,"aria-hidden":"true"})}),t.jsx("div",{className:"min-w-0 flex-1",children:t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-semibold",children:u.amountOnlyTitle}),t.jsx("p",{className:"text-[12.5px] text-default-500",children:u.amountOnlyDetail.replace("{amount}",xe(i.max.value,void 0,i.max.currency))})]}),t.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2.5 sm:w-[290px] sm:flex-nowrap",children:[t.jsx(Fn,{value:i.value,expected:i.value,max:i.max.value,onChange:i.onChange,ariaLabel:u.amountOnlyTitle,className:"flex-1",inputTestId:`${d}-amount-only-input`}),t.jsx("button",{type:"button","aria-label":u.amountOnlyRemove,onClick:i.onRemove,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-pos-danger-fill text-pos-danger outline-none transition-colors hover:bg-[#F8D6D6] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pos-danger","data-testid":`${d}-amount-only-remove`,children:t.jsx(M,{icon:"lucide:trash-2",width:17,height:17,"aria-hidden":"true"})})]})]})})]}))]})};Fo.displayName="LineItemList";const Nh={color:oe.danger},Ro=({children:e,className:s,"data-testid":n="meta-card"})=>t.jsx("div",{className:c.cn("mx-auto mt-[18px] flex max-w-[1040px] flex-col gap-3",s),"data-testid":n,children:t.jsx("div",{className:"rounded-[14px] border border-pos-line bg-white px-4 py-3.5 text-default-900",children:e})});Ro.displayName="MetaCard";const _o=({label:e,htmlFor:s,required:n,children:a,className:r,"data-testid":i="meta-card-row"})=>t.jsxs("div",{className:c.cn("flex flex-wrap items-center justify-between gap-4",r),"data-testid":i,children:[t.jsxs("label",{htmlFor:s,className:"text-[13px] font-medium text-default-600",children:[e,n&&t.jsx("span",{"aria-hidden":"true",className:"ms-0.5 text-danger",style:Nh,"data-testid":`${i}-required`,children:"*"})]}),t.jsx("div",{className:"w-full sm:w-[290px] sm:shrink-0",children:a})]});_o.displayName="MetaCard.Row";const Mo=({label:e,children:s,className:n,"data-testid":a="meta-card-section"})=>t.jsxs("div",{className:c.cn("mt-3.5 flex flex-col gap-2.5 border-t border-pos-line pt-3",n),"data-testid":a,children:[e&&t.jsx("p",{className:"text-[13px] font-medium text-default-600",children:e}),s]});Mo.displayName="MetaCard.Section";const Ch=Object.assign(Ro,{Row:_o,Section:Mo}),Po=({heading:e,icon:s="lucide:rotate-ccw",action:n,children:a,className:r,"data-testid":i="section-panel"})=>t.jsxs("section",{className:c.cn("mx-auto max-w-[1040px] rounded-2xl border border-pos-line bg-white px-[18px] py-4",r),"data-testid":i,children:[t.jsxs("div",{className:"mb-3 flex items-center gap-2 text-[13px] font-semibold text-default-600",children:[t.jsx(M,{icon:s,width:16,height:16,"aria-hidden":"true"}),t.jsx("h3",{"data-testid":`${i}-heading`,children:e}),t.jsx("div",{className:"flex-1"}),n&&t.jsxs("button",{type:"button",disabled:n.disabled,onClick:n.onClick,className:c.cn("inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-full border border-primary","bg-primary/5 px-3 py-[7px] text-[12.5px] font-semibold text-primary outline-none","transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${i}-action`,children:[t.jsx(M,{icon:n.icon??"lucide:plus",width:14,height:14,"aria-hidden":"true"}),n.label]})]}),a]});Po.displayName="SectionPanel";const Io=({name:e,detail:s,icon:n="lucide:users",labels:a,className:r,"data-testid":i="customer-card"})=>t.jsxs("div",{className:c.cn("mb-3.5 flex items-center gap-3 rounded-xl bg-default-100 px-3.5 py-3",r),"data-testid":i,children:[t.jsx("div",{className:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:n,width:18,height:18,"aria-hidden":"true"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"mb-0.5 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:a?.heading??"Customer"}),t.jsx("p",{className:"text-sm font-semibold","data-testid":`${i}-name`,children:e}),s&&t.jsx("p",{className:"text-[12.5px] text-default-500",children:s})]})]});Io.displayName="CustomerCard";const kh={label:"Reason for the return",placeholder:"Select a reason…"},To=({options:e,value:s,onChange:n,error:a,isRequired:r,labels:i,className:o,"data-testid":l="reason-select"})=>{const d={...kh,...i};return t.jsx(at,{label:d.label,labelPlacement:"outside",placeholder:d.placeholder,selectedKeys:s?[s]:[],isRequired:r,isInvalid:!!a,errorMessage:a,className:c.cn(o),"data-testid":l,onSelectionChange:u=>{if(u==="all")return;const x=[...u][0];x&&n(String(x))},children:e.map(u=>t.jsx(c.SelectItem,{children:u.label},u.id))})};To.displayName="ReasonSelect";const Sh={toggle:"Add a note",optionalTag:"(optional)",heading:"Additional note",placeholder:"Add a note (optional)"},Oo=({value:e,onChange:s,maxLength:n,alwaysExpanded:a=!1,hideLabel:r=!1,labels:i,className:o,"data-testid":l="notes-field"})=>{const d={...Sh,...i},[u,x]=h.useState(e!=="");return a?t.jsxs("div",{className:c.cn("flex flex-col gap-2",o),"data-testid":l,children:[!r&&t.jsx("label",{htmlFor:`${l}-textarea`,className:"text-[13px] font-medium text-default-600",children:d.heading}),t.jsx("textarea",{id:`${l}-textarea`,"aria-label":r?d.heading:void 0,value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.placeholder,className:c.cn("min-h-[52px] w-full resize-y rounded-[10px] border border-pos-line bg-white px-3 py-2.5","text-[13.5px] leading-[1.45] text-default-900 outline-none","placeholder:text-default-500","focus:border-primary focus:ring-[3px] focus:ring-primary/10"),"data-testid":`${l}-textarea`})]}):t.jsx("div",{className:c.cn(o),"data-testid":l,children:u?t.jsx(c.Textarea,{value:e,onChange:m=>s(m.target.value),maxLength:n,placeholder:d.toggle,"aria-label":d.toggle,variant:"bordered",radius:"lg","data-testid":`${l}-textarea`}):t.jsxs(T,{variant:"light",className:"h-auto min-w-0 px-1 py-0.5 text-xs font-semibold text-primary",onPress:()=>x(!0),"data-testid":`${l}-toggle`,children:[d.toggle,t.jsx("span",{className:"ml-1 font-normal text-default-400",children:d.optionalTag})]})})};Oo.displayName="NotesField";const $h={info:"solar:info-circle-bold",success:"solar:check-circle-bold",warning:"solar:danger-triangle-bold",danger:"solar:danger-circle-bold"},Ah="solar:close-circle-linear",Dh={callout:{root:"flex items-start gap-[0.5625rem] rounded-xl px-3.5 py-3 text-[0.78125rem] leading-normal",iconWrapper:"flex h-[1.5em] shrink-0 items-center",iconSize:"1.25em",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"",actions:"mt-2 flex flex-wrap items-center gap-2",dismiss:"-my-1.5 -me-2 size-8 min-w-8 shrink-0 text-current"},banner:{root:"flex items-start gap-3.5 rounded-[0.875rem] px-[1.125rem] py-4 text-pos-ink",iconWrapper:"flex size-10 shrink-0 items-center justify-center rounded-full",iconSize:"1.375rem",text:"min-w-0 flex-1 [overflow-wrap:anywhere]",title:"font-semibold",description:"text-[0.8125rem] text-pos-neutral",actions:"mt-3 flex flex-wrap gap-2.5",dismiss:"-my-1 -me-1.5 size-8 min-w-8 shrink-0 text-pos-neutral"}},Eh={info:{callout:"bg-pos-info-fill text-pos-info",banner:"bg-pos-info-fill",disc:"bg-pos-info/15 text-pos-info",title:"text-pos-info"},success:{callout:"bg-pos-ok-fill text-pos-ok",banner:"bg-pos-ok-fill",disc:"bg-pos-ok/15 text-pos-ok",title:"text-pos-ok"},warning:{callout:"bg-pos-warn-fill text-pos-warn",banner:"bg-pos-warn-fill",disc:"bg-pos-warn-icon text-pos-warn",title:"text-pos-warn"},danger:{callout:"bg-pos-danger-fill text-pos-danger",banner:"bg-pos-danger-fill",disc:"bg-pos-danger-icon text-pos-danger",title:"text-pos-danger"}},Lh={info:"status",success:"status",warning:"alert",danger:"alert"};function ba({tone:e="info",variant:s="callout",title:n,description:a,actions:r,onDismiss:i,dismissLabel:o="Dismiss",role:l=Lh[e],className:d,"data-testid":u="notice"}){const x=_s(),m=Dh[s],p=Eh[e],f=s==="banner",g=se(n),v=se(a),b=g?f?t.jsx("p",{"data-testid":`${u}-title`,className:c.cn(m.title,p.title),children:n}):t.jsx("span",{"data-testid":`${u}-title`,className:m.title,children:n}):null,y=v?f?t.jsx("p",{"data-testid":`${u}-description`,className:c.cn(m.description,g&&"mt-0.5"),children:a}):t.jsx("span",{"data-testid":`${u}-description`,className:m.description,children:a}):null;return t.jsxs("div",{role:l,"aria-live":l==="alert"?"assertive":"polite","data-tone":e,"data-variant":s,"data-testid":u,className:c.cn(m.root,f?p.banner:p.callout,d),children:[t.jsx("span",{"aria-hidden":"true","data-testid":`${u}-icon`,className:c.cn(m.iconWrapper,f&&p.disc),children:t.jsx(M,{icon:$h[e],width:m.iconSize,height:m.iconSize})}),t.jsxs("div",{className:m.text,children:[f?t.jsxs(t.Fragment,{children:[b,y]}):t.jsxs("p",{children:[b,g&&v?" ":null,y]}),r?t.jsx("div",{"data-testid":`${u}-actions`,className:m.actions,children:r}):null]}),i?t.jsx(T,{isIconOnly:!0,color:"default",size:"sm",radius:"full",variant:"light","aria-label":o,onPress:i,disableAnimation:x,className:c.cn(m.dismiss,Ce),"data-testid":`${u}-dismiss`,children:t.jsx(M,{icon:Ah,width:"1.125rem",height:"1.125rem"})}):null]})}ba.displayName="Notice";const Er="h-8 min-w-0 rounded-[0.625rem] px-3 text-[0.8125rem] font-semibold",Hs=({tone:e,title:s,body:n,onRetry:a,retryLabel:r,onChooseDifferent:i,chooseDifferentLabel:o,className:l,"data-testid":d,retryTestId:u,chooseDifferentTestId:x})=>t.jsx(ba,{variant:"banner",tone:e,title:s,description:n,className:l,"data-testid":d,actions:t.jsxs(t.Fragment,{children:[a&&t.jsx(T,{color:"primary",className:Er,onPress:a,"data-testid":u,children:r}),t.jsx(T,{variant:"bordered",className:c.cn(Er,"border-1 border-pos-line bg-white text-default-900"),onPress:i,"data-testid":x,children:o})]})});Hs.displayName="TenderBanner";const Fh={split:"Split across multiple methods",declinedTitle:"Refund declined",declinedBody:"The processor declined this refund. Nothing was sent.",networkTitle:"Network error",networkBody:"Couldn't reach the processor. Nothing was sent.",retry:"Try again",chooseDifferent:"Choose different method",destinationsHeading:"Money back to"},Rh={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",other:"lucide:more-horizontal"},zo=({tenders:e,selectedTenderId:s,onSelect:n,onSplit:a,error:r,labels:i,className:o,"data-testid":l="tender-methods"})=>{const d={...Fh,...i},u=r?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",o),"data-testid":l,children:[r&&t.jsx(Hs,{tone:u?"danger":"warning",title:u?d.declinedTitle:d.networkTitle,body:u?d.declinedBody:d.networkBody,onRetry:r.onRetry,retryLabel:d.retry,onChooseDifferent:r.onChooseDifferent,chooseDifferentLabel:d.chooseDifferent,className:"mb-[18px]","data-testid":`${l}-error`,retryTestId:`${l}-retry`,chooseDifferentTestId:`${l}-choose-different`}),t.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",children:d.title??d.destinationsHeading}),t.jsxs("div",{role:"radiogroup","aria-label":d.title??d.destinationsHeading,className:"mb-0.5 grid grid-cols-3 gap-2.5","data-testid":`${l}-tiles`,children:[e.map(x=>{const m=x.tenderId===s;return t.jsxs("button",{type:"button",role:"radio","aria-checked":m,onClick:()=>n(x.tenderId),className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] bg-white px-[15px] py-[11px] text-left","outline-none transition-colors","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",m?"border-primary bg-primary/5":"border-pos-line hover:border-primary"),"data-testid":`${l}-tile-${x.tenderId}`,children:[t.jsx("span",{className:c.cn("flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px]",m?"bg-primary text-white":"bg-default-100 text-default-600"),children:t.jsx(M,{icon:Rh[x.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-semibold",children:x.label}),t.jsx("span",{className:"block text-xs text-default-500",children:xe(x.maxRefundable.value,void 0,x.maxRefundable.currency)})]})]},x.tenderId)}),t.jsxs("button",{type:"button",onClick:a,className:c.cn("flex items-center gap-[11px] rounded-[14px] border-[1.5px] border-pos-line bg-white px-[15px] py-[11px] text-left","outline-none transition-colors hover:border-primary","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"),"data-testid":`${l}-split`,children:[t.jsx("span",{className:"flex h-[34px] w-[34px] shrink-0 items-center justify-center rounded-[10px] bg-default-100 text-default-600",children:t.jsx(M,{icon:"lucide:split",width:18,height:18,"aria-hidden":"true"})}),t.jsx("span",{className:"min-w-0 text-sm font-semibold",children:d.split})]})]})]})};zo.displayName="TenderMethods";const _h=e=>e.refunded!==null,Mh={title:"Split refund",refundedSoFar:"Refunded so far",remaining:"Remaining",amountForPart:"Amount for this part",partHeading:"Part #{n}",submit:"Refund this part →",back:"Back",partDeclinedBody:"This part was declined. Completed parts are preserved.",partNetworkBody:"Couldn't reach the processor. Completed parts are preserved.",declinedTitle:"Refund declined",networkTitle:"Network error",retry:"Try again",chooseDifferent:"Choose different method",pending:"Pending",succeeded:"Refunded"},Ph="mb-2 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",Ih="inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",Bo=({parts:e,refundedSoFar:s,remaining:n,current:a,methods:r,onRefundPart:i,partError:o,onBack:l,busy:d,hideActions:u,labels:x,className:m,"data-testid":p="split-tender-panel"})=>{const f={...Mh,...x},g=e.filter(_h),v=e.find(j=>j.tenderId===a.tenderId)?.label,b=!!(r?.length&&a.onTenderChange),y=Pt(n.currency),{draft:N,setDraft:k,normalize:w}=ao(a.amount,String),$=h.useCallback(j=>{oa(j,y)&&(k(j),a.onAmountChange(ss(j)??0))},[a,k,y]),A=o?.kind==="processor_declined";return t.jsxs("div",{className:c.cn("flex flex-col text-default-900",m),"data-testid":p,children:[t.jsx("h3",{className:"sr-only","data-testid":`${p}-title`,children:f.title}),o&&t.jsx(Hs,{tone:A?"danger":"warning",title:A?f.declinedTitle:f.networkTitle,body:A?f.partDeclinedBody:f.partNetworkBody,onRetry:o.onRetry,retryLabel:f.retry,onChooseDifferent:o.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:"mb-[18px]","data-testid":`${p}-part-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{"data-testid":`${p}-totals`,children:[t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2.5 rounded-xl bg-default-100 px-4 py-3.5",children:[t.jsx("span",{className:"text-[13px] font-semibold text-default-500",children:f.remaining}),t.jsx("span",{className:"text-[22px] font-semibold tabular-nums",children:xe(n.value,void 0,n.currency)}),t.jsxs("span",{className:"sr-only",children:[f.refundedSoFar,": ",xe(s.value,void 0,s.currency)]})]}),g.length>0&&t.jsxs("div",{children:[t.jsx("p",{className:Ph,children:f.refundedSoFar}),g.map((j,D)=>t.jsxs("div",{className:"mb-2 flex items-center gap-2.5 rounded-xl border border-pos-line px-3 py-2.5","data-testid":`${p}-part-${j.tenderId}-done`,children:[t.jsxs("span",{className:"w-[22px] shrink-0 font-bold text-default-600",children:["#",D+1]}),t.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] bg-default-100 text-default-600",children:t.jsx(M,{icon:j.icon??"lucide:credit-card",width:15,height:15,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13.5px] font-semibold",children:j.label}),j.feeNote&&t.jsx("span",{className:"block text-[11.5px] text-default-500",children:j.feeNote})]}),t.jsx("span",{className:"font-semibold tabular-nums",children:xe(j.refunded.value,void 0,j.refunded.currency)}),t.jsx("span",{className:c.cn(Ih,j.status==="pending"?"bg-pos-warn-fill text-pos-warn":"bg-pos-ok-fill text-pos-ok"),children:j.status==="pending"?f.pending:f.succeeded})]},j.tenderId))]})]}),t.jsxs("div",{className:"mt-3.5","data-testid":`${p}-current`,children:[t.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-sm font-semibold",children:f.partHeading.replace("{n}",String(g.length+1))}),v&&t.jsx("span",{className:"text-xs text-default-500",children:v})]}),t.jsx("p",{"aria-hidden":"true",className:"mb-1.5 text-[13px] font-semibold","data-testid":`${p}-amount-label`,children:f.amountForPart}),t.jsx(da,{heading:f.amountForPart,amountLabel:f.amountForPart,hideHeading:!0,placeholder:"$0.00",value:N,onChange:$,onBlur:w,maxAmount:n.value,isDisabled:d,className:"gap-0 border-t-0 pt-0","data-testid":`${p}-amount`}),b&&t.jsx("div",{className:"mt-2.5 flex gap-2","data-testid":`${p}-methods`,children:r?.map(j=>{const D=j.tenderId===a.tenderId;return t.jsxs("button",{type:"button","aria-pressed":D,disabled:j.disabled||d,onClick:()=>a.onTenderChange?.(j.tenderId),className:c.cn("flex h-11 flex-1 items-center justify-center gap-2 rounded-xl border-[1.5px] bg-white","text-[13px] font-semibold outline-none transition-colors","disabled:cursor-not-allowed disabled:opacity-50","focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",D?"border-primary bg-primary/5 text-primary":"border-pos-line text-default-600"),"data-testid":`${p}-method-${j.tenderId}`,children:[j.icon&&t.jsx(M,{icon:j.icon,width:15,height:15,"aria-hidden":"true"}),j.label]},j.tenderId)})})]}),!u&&t.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[t.jsx(T,{variant:"bordered",className:"h-12 min-w-0 flex-1 rounded-[14px] border-1 border-pos-line bg-white px-5 text-[15px] font-semibold text-default-900",onPress:l,"data-testid":`${p}-back`,children:f.back}),t.jsx(T,{color:"primary",className:"h-12 min-w-0 flex-1 rounded-[14px] px-5 text-[15px] font-semibold",isDisabled:d,isLoading:d,onPress:i,"data-testid":`${p}-submit`,children:f.submit})]})]})};Bo.displayName="SplitTenderPanel";const Vo="hsl(var(--heroui-primary))",Th="hsl(var(--heroui-primary) / 0.05)",Uo="hsl(var(--heroui-default-100))",Ho="hsl(var(--heroui-default-600))",ga={card:"lucide:credit-card",cash:"lucide:dollar-sign",check:"lucide:edit-3",store_credit:"lucide:gift",reader:"lucide:nfc",other:"lucide:more-horizontal"},de={root:"flex flex-col text-default-900",banner:"mb-[18px]",eyebrowRow:"mb-3 flex min-h-6 items-center justify-between gap-3",eyebrow:"text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",grid:"grid grid-cols-3 gap-2.5",card:"relative flex min-h-[132px] flex-col rounded-[14px] border-[1.5px] bg-white transition-colors",focusRing:"outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",toggle:"flex w-full items-center gap-[11px] rounded-[12px] px-[15px] pt-[13px] text-left disabled:cursor-not-allowed",toggleUnselected:"flex-1 flex-col items-stretch gap-3 pb-[13px]",toggleHeader:"flex w-full items-center gap-[11px]",toggleRemovable:"pr-12",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",subtitle:"block truncate text-xs text-default-500",status:"block truncate text-xs font-semibold",lowerSlot:"mt-auto flex h-11 w-full items-center rounded-[10px] px-3 text-[13px] font-medium tabular-nums",amountSlot:"mt-auto px-[15px] pb-[13px] pt-3",amountWrapper:"h-11 min-h-11 rounded-[10px] bg-white shadow-none",amountInput:"text-[15px] font-semibold tabular-nums",remove:"absolute right-1 top-1 flex h-11 w-11 items-center justify-center rounded-[10px] text-default-500 hover:text-default-900 disabled:cursor-not-allowed",badge:"inline-flex h-[22px] shrink-0 items-center whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",another:"flex min-h-[132px] w-full flex-col items-start justify-center gap-3 rounded-[14px] border-[1.5px] border-dashed bg-white px-[15px] py-[13px] text-left transition-colors disabled:cursor-not-allowed",anotherOpen:"aria-expanded:scale-100",menuItem:"py-2"},Oh={idle:{borderColor:oe.line,backgroundColor:"#fff"},selected:{borderColor:Vo,backgroundColor:Th},declined:{borderColor:oe.danger,backgroundColor:oe["danger-fill"]}},Fs={idle:{backgroundColor:Uo,color:Ho},selected:{backgroundColor:Vo,color:"#fff"}},zh={backgroundColor:Uo,color:Ho},Bh={borderColor:oe.line},Lr={declined:{color:oe.danger},pending:{color:oe.warn,backgroundColor:oe["warn-fill"]},done:{color:oe.ok,backgroundColor:oe["ok-fill"]}},Vh={heading:"Money back to",upTo:"Up to {amount}",noCap:"Tap to add an amount",amountFor:"Amount to {method}",remove:"Remove {method}",declined:"Declined",pending:"Pending",done:"Refunded",retry:"Try again",chooseDifferent:"Choose different method"},Uh=e=>{try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).formatToParts(0).find(s=>s.type==="currency")?.value??e}catch{return e}},Hh=({method:e,currency:s,busy:n,labels:a,onToggle:r,onAmountChange:i,onAmountBlur:o,onRemove:l,testId:d})=>{const u=e.status??"idle",x=u==="pending"||u==="done",m=n||x,p=!!(e.removable&&l),f=e.cap?.currency??s,g=Pt(f),v=`${d}-amount`,b=a.amountFor.replace("{method}",e.label),y=h.useCallback(A=>{if(!oa(A,g))return;const j=ss(A);e.cap&&j!==null&&j>e.cap.value||i(e.id,A)},[g,e.cap,e.id,i]),N=h.useCallback(A=>{const j=A.currentTarget;requestAnimationFrame(()=>{j.isConnected&&j.select()})},[]),k=u==="declined"?"declined":e.selected?"selected":"idle",w=e.statusLabel??(u==="idle"?void 0:a[u]),$=t.jsxs("span",{className:de.toggleHeader,children:[t.jsx("span",{className:de.iconBox,style:e.selected?Fs.selected:Fs.idle,"data-testid":`${d}-icon`,children:t.jsx(M,{icon:ga[e.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:de.text,children:[t.jsx("span",{className:de.label,children:e.label}),u==="declined"&&w?t.jsx("span",{className:de.status,style:Lr.declined,"data-testid":`${d}-status`,children:w}):e.subtitle&&t.jsx("span",{className:de.subtitle,children:e.subtitle})]}),x&&w&&t.jsx("span",{className:de.badge,style:Lr[u],"data-testid":`${d}-status`,children:w})]});return t.jsxs("div",{className:de.card,style:Oh[k],"data-selected":e.selected||void 0,"data-status":u,"data-testid":d,children:[e.selected?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-pressed":!0,disabled:m,onClick:()=>r(e.id),className:c.cn(de.toggle,de.focusRing,p&&de.toggleRemovable),"data-testid":`${d}-toggle`,children:$}),t.jsxs("div",{className:de.amountSlot,children:[t.jsx("label",{htmlFor:v,className:"sr-only",children:b}),t.jsx(c.Input,{id:v,"aria-label":b,type:"text",inputMode:"decimal",placeholder:"0.00",value:e.amount??"",onChange:A=>y(A.target.value),onFocus:N,onBlur:()=>o?.(e.id),isDisabled:m,variant:"bordered",startContent:t.jsx("span",{className:"text-[15px] font-semibold text-default-500","aria-hidden":"true",children:Uh(f)}),classNames:{inputWrapper:de.amountWrapper,input:de.amountInput},"data-testid":`${d}-amount`})]})]}):t.jsxs("button",{type:"button","aria-pressed":!1,disabled:m,onClick:()=>r(e.id),className:c.cn(de.toggle,de.toggleUnselected,de.focusRing,p&&de.toggleRemovable),"data-testid":`${d}-toggle`,children:[$,t.jsx("span",{className:de.lowerSlot,style:zh,"data-testid":`${d}-cap`,children:e.cap?a.upTo.replace("{amount}",xe(e.cap.value,void 0,e.cap.currency)):a.noCap})]}),p&&t.jsx("button",{type:"button","aria-label":a.remove.replace("{method}",e.label),disabled:n,onClick:()=>l?.(e.id),className:c.cn(de.remove,de.focusRing),"data-testid":`${d}-remove`,children:t.jsx(M,{icon:"lucide:x",width:16,height:16,"aria-hidden":"true"})})]})},Wo=({methods:e,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,currency:i="USD",paidWith:o,anotherMethod:l,error:d,busy:u=!1,labels:x,className:m,"data-testid":p="refund-method-cards"})=>{const f={...Vh,...x};return t.jsxs("div",{className:c.cn(de.root,m),"data-testid":p,children:[d&&t.jsx(Hs,{tone:d.tone,title:d.title,body:d.body,onRetry:d.onRetry,retryLabel:f.retry,onChooseDifferent:d.onChooseDifferent,chooseDifferentLabel:f.chooseDifferent,className:de.banner,"data-testid":`${p}-error`,retryTestId:`${p}-retry`,chooseDifferentTestId:`${p}-choose-different`}),t.jsxs("div",{className:de.eyebrowRow,children:[t.jsx("p",{className:de.eyebrow,children:f.heading}),o&&t.jsx(Bs,{variant:"record",label:o.label,value:o.value,"data-testid":`${p}-paid-with`})]}),t.jsxs("div",{role:"group","aria-label":f.heading,className:de.grid,"data-testid":`${p}-grid`,children:[e.map(g=>t.jsx(Hh,{method:g,currency:i,busy:u,labels:f,onToggle:s,onAmountChange:n,onAmountBlur:a,onRemove:r,testId:`${p}-method-${g.id}`},g.id)),l&&t.jsxs(c.Dropdown,{placement:"bottom-start",isDisabled:u,classNames:{trigger:de.anotherOpen},children:[t.jsx(c.DropdownTrigger,{children:t.jsxs("button",{type:"button",className:c.cn(de.another,de.focusRing),style:Bh,"data-testid":`${p}-another`,children:[t.jsx("span",{className:de.iconBox,style:Fs.idle,children:t.jsx(M,{icon:"lucide:plus",width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:de.label,children:l.label}),t.jsx("span",{className:de.subtitle,children:l.subtitle})]})]})}),t.jsx(c.DropdownMenu,{"aria-label":l.label,items:l.options,onAction:g=>l.onPick(String(g)),"data-testid":`${p}-another-menu`,children:g=>t.jsx(c.DropdownItem,{textValue:g.label,description:g.description,className:de.menuItem,startContent:t.jsx("span",{className:de.iconBox,style:Fs.idle,children:t.jsx(M,{icon:ga[g.kind],width:18,height:18,"aria-hidden":"true"})}),"data-testid":`${p}-another-option-${g.id}`,children:g.label},g.id)})]})]})]})};Wo.displayName="RefundMethodCards";const qe={root:"flex flex-col text-default-900",eyebrow:"mb-3 text-[11px] font-semibold uppercase tracking-[.08em] text-default-500",list:"flex flex-col gap-2.5",row:"flex flex-col gap-3 rounded-[14px] border-[1.5px] px-[15px] py-[13px] transition-colors",main:"flex items-center gap-[11px]",iconBox:"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-[10px]",text:"min-w-0 flex-1",label:"block truncate text-[15px] font-semibold leading-5",note:"block truncate text-xs text-default-500",amount:"shrink-0 text-[15px] font-semibold tabular-nums",badge:"inline-flex h-[22px] shrink-0 items-center gap-[5px] whitespace-nowrap rounded-full px-[9px] text-xs font-medium leading-none",prompt:"flex flex-wrap items-center gap-3 rounded-[10px] px-3 py-2",promptText:"min-w-0 flex-1 text-[13px] font-medium",action:"h-11 min-w-0 rounded-[12px] px-4 text-[14px] font-semibold"},qo="hsl(var(--heroui-primary))",Wh={idle:{borderColor:oe.line,backgroundColor:"#fff"},active:{borderColor:qo,backgroundColor:"hsl(var(--heroui-primary) / 0.05)"},failed:{borderColor:oe.danger,backgroundColor:oe["danger-fill"]}},Fr={idle:{backgroundColor:"hsl(var(--heroui-default-100))",color:"hsl(var(--heroui-default-600))"},active:{backgroundColor:qo,color:"#fff"}},qh={backgroundColor:"#fff",color:oe.neutral},Lt=e=>({color:Xe[e].fg,backgroundColor:Xe[e].bg}),Gh={queued:Lt("neutral"),processing:Lt("info"),waiting_reader:Lt("warn"),waiting_cash:Lt("warn"),done:Lt("ok"),failed:Lt("danger")},Kh={heading:"Refunding",queued:"Queued",processing:"Processing",waitingReader:"Waiting for reader",waitingCash:"Waiting for cash",done:"Refunded",failed:"Failed"},Yh={queued:"queued",processing:"processing",waiting_reader:"waitingReader",waiting_cash:"waitingCash",done:"done",failed:"failed"},Rr={waiting_reader:"lucide:nfc",waiting_cash:"lucide:banknote"},Qh=e=>e.status==="processing"||e.status==="waiting_reader"||e.status==="waiting_cash",Go=({parts:e,activeId:s,labels:n,className:a,"data-testid":r="refund-progress-list"})=>{const i={...Kh,...n},o=s??e.find(Qh)?.id;return t.jsxs("div",{className:c.cn(qe.root,a),"data-testid":r,children:[t.jsx("p",{className:qe.eyebrow,children:i.heading}),t.jsx("ol",{"aria-label":i.heading,className:qe.list,children:e.map(l=>{const d=l.id===o,u=`${r}-part-${l.id}`,x=d?"active":l.status==="failed"?"failed":"idle";return t.jsxs("li",{"aria-current":d?"step":void 0,className:qe.row,style:Wh[x],"data-status":l.status,"data-active":d||void 0,"data-testid":u,children:[t.jsxs("div",{className:qe.main,children:[t.jsx("span",{className:qe.iconBox,style:d?Fr.active:Fr.idle,children:t.jsx(M,{icon:ga[l.kind],width:18,height:18,"aria-hidden":"true"})}),t.jsxs("span",{className:qe.text,children:[t.jsx("span",{className:qe.label,children:l.label}),l.note&&t.jsx("span",{className:qe.note,children:l.note})]}),t.jsx("span",{className:qe.amount,children:xe(l.amount.value,void 0,l.amount.currency)}),t.jsxs("span",{className:qe.badge,style:Gh[l.status],"data-testid":`${u}-status`,children:[l.status==="processing"&&t.jsx(M,{icon:"lucide:loader-circle",width:12,height:12,className:"animate-spin","aria-hidden":"true"}),i[Yh[l.status]]]})]}),(l.prompt||l.action)&&t.jsxs("div",{role:"status",className:qe.prompt,style:qh,"data-testid":`${u}-prompt`,children:[Rr[l.status]&&t.jsx(M,{icon:Rr[l.status],width:18,height:18,"aria-hidden":"true"}),l.prompt&&t.jsx("span",{className:qe.promptText,children:l.prompt}),l.action&&t.jsx(T,{color:"primary",className:qe.action,onPress:l.action.onPress,isLoading:l.action.loading,isDisabled:l.action.disabled,"data-testid":`${u}-action`,children:l.action.label})]})]},l.id)})})]})};Go.displayName="RefundProgressList";const Zh={label:"Supervisor authorization",placeholder:"••••"},Ko=({pin:e,onChange:s,hint:n,error:a,labels:r,className:i,"data-testid":o="pin-field"})=>{const l={...Zh,...r};return t.jsxs("div",{className:c.cn("mx-auto max-w-[460px] rounded-[20px] border border-pos-line bg-white px-7 py-[26px]","text-center text-default-900 shadow-[0_1px_2px_rgba(0,0,0,0.05)]",i),"data-testid":o,children:[t.jsx("div",{className:"mx-auto mb-4 flex h-[70px] w-[70px] items-center justify-center rounded-full bg-pos-danger-fill text-primary",children:t.jsx(M,{icon:"lucide:lock",width:26,height:26,"aria-hidden":"true"})}),t.jsx("p",{className:"text-[17px] font-semibold",children:l.label}),n&&t.jsx("p",{className:"mt-1.5 text-[13px] text-default-500",children:n}),t.jsx(c.Input,{type:"password",inputMode:"numeric","aria-label":l.label,placeholder:l.placeholder,value:e,onChange:d=>s(d.target.value.replace(/\D/g,"").slice(0,6)),isInvalid:!!a,errorMessage:a,variant:"bordered",radius:"lg",classNames:{inputWrapper:"h-11",input:"text-center text-[28px] tracking-[.4em] tabular-nums"},className:"mx-auto mt-[18px] max-w-[160px]","data-testid":`${o}-input`})]})};Ko.displayName="PinField";const Xh={processing:"Processing refund…",title:"Refund complete",destinationsTitle:"Refund destinations",sendReceipt:"Send receipt",email:"Email",print:"Print",done:"Done",pending:"Pending",succeeded:"Refunded",reason:"Reason · {reason}",authorizedBy:"Authorized by {name}",paidWithTitle:"Paid with",outcomeTitle:"Outcome",changeDue:"Change due",emailPlaceholder:"Add email…",emailAriaLabel:"Add email address",removeEmail:"Remove {email}",sendEmail:"Send receipt"},Jh={refund:{},payment:{title:"Payment complete",done:"New sale",authorizedBy:"Handled by {name}"}},eb={succeeded:"bg-pos-ok-fill text-pos-ok",pending:"bg-pos-warn-fill text-pos-warn"},tb="inline-flex h-[1.375rem] items-center gap-[0.3125rem] whitespace-nowrap rounded-full px-[0.5625rem] text-xs font-medium leading-none",Gt="mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",sb="mx-auto max-w-[65rem] rounded-[1.25rem] border border-pos-line bg-white px-7 py-[1.625rem] shadow-[0_0.0625rem_0.125rem_rgba(0,0,0,0.05)]",nb=["email","print"],ws=`${Ce} motion-reduce:data-[pressed=true]:scale-100 [html[data-pos-reduce-motion=true]_&]:data-[pressed=true]:scale-100`,Ne={paidRow:"flex w-full items-center gap-3 border-b border-transparent py-[0.6875rem] text-left",paidIcon:"flex h-[2.125rem] w-[2.125rem] shrink-0 items-center justify-center rounded-[0.5625rem] bg-pos-neutral-fill text-pos-neutral",paidLabel:"text-sm font-semibold",paidAmount:"ml-1.5 text-sm font-semibold tabular-nums",paidStatus:"ml-auto whitespace-nowrap rounded-full bg-pos-neutral-fill px-2.5 py-1 text-[0.71875rem] font-semibold text-pos-neutral",groups:"flex w-full flex-col gap-3 border-y border-pos-line-2 py-3 text-left",groupLabel:"mb-1.5 text-[0.6875rem] font-semibold uppercase tracking-[.05em] text-pos-muted",groupItems:"flex flex-wrap gap-1.5",groupItem:"rounded-lg bg-pos-neutral-fill px-2.5 py-1 text-[0.8125rem] text-pos-ink",receiptRow:"mt-2 flex flex-wrap items-center gap-3.5",receiptAction:`h-10 min-w-0 flex-1 gap-2 rounded-xl border border-pos-line bg-white px-4 text-sm font-semibold text-pos-ink data-[hover=true]:bg-pos-neutral-fill ${ws}`,receiptActionExpanded:"bg-pos-neutral-fill",emailBox:"mt-5 flex w-full flex-col gap-2.5",chipWrap:"flex min-h-11 w-full flex-wrap items-center gap-1.5 rounded-xl border px-2 py-[0.3125rem]",chip:"inline-flex items-center gap-1 rounded-full border border-pos-line bg-pos-neutral-fill py-[0.1875rem] pl-2.5 pr-1 text-[0.8125rem] font-medium text-pos-ink",chipRemove:`h-11 w-11 min-w-0 -my-[0.8125rem] -mr-2.5 rounded-full bg-transparent text-pos-muted data-[hover=true]:bg-transparent data-[hover=true]:text-pos-ink data-[focus-visible=true]:outline-offset-[-0.5rem] ${ws}`,send:`h-10 w-full rounded-xl px-4 text-sm font-semibold ${ws}`,changeTitle:"text-[0.9375rem] font-medium text-pos-muted",changeLabel:"mt-4 text-sm font-semibold text-pos-neutral",changeAmount:"mt-0.5 text-[3.125rem] font-medium leading-[1.05] tracking-[-.02em] tabular-nums",changeCaption:"mt-2.5 text-[0.8125rem] text-pos-muted"},Yo=({state:e,kind:s="refund",total:n,destinations:a,subtitle:r,reason:i,paidWith:o,outcomeGroups:l,changeDue:d,authorizedBy:u,selectedReceipts:x,onSendReceipt:m,receiptActions:p,emailReceipt:f,onDone:g,frameless:v=!1,labels:b,className:y,"data-testid":N="outcome-view"})=>{const k={...Xh,...Jh[s],...b},w=h.useId(),$=n?xe(n.value,void 0,n.currency):null;return e==="processing"?t.jsx("div",{className:c.cn("flex flex-col items-center justify-center text-center text-pos-ink",y),"aria-live":"polite","data-testid":N,children:t.jsxs("div",{className:"flex flex-col items-center px-5 py-[3.75rem]","data-testid":`${N}-processing`,children:[t.jsx("div",{className:`mb-4 h-[3.25rem] w-[3.25rem] animate-spin rounded-full border-[0.3125rem] border-pos-neutral-fill border-t-primary ${Mn}`,role:"presentation"}),t.jsx("p",{className:"text-[1.0625rem] font-semibold",children:k.processing}),$&&t.jsx("p",{className:"mt-2 text-[0.9375rem] font-semibold tabular-nums","data-testid":`${N}-processing-total`,children:$})]})}):t.jsxs("div",{className:c.cn("flex flex-col text-pos-ink",!v&&sb,y),"aria-live":"polite","data-testid":N,children:[t.jsxs("div",{className:c.cn("text-center",s==="refund"&&"pb-0.5 pt-1"),children:[t.jsx("div",{className:"mx-auto mb-3.5 flex h-[4.875rem] w-[4.875rem] items-center justify-center rounded-full bg-pos-ok-fill text-pos-ok",children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[2.875rem] w-[2.875rem]",children:t.jsx(M,{icon:"solar:check-circle-bold",width:"100%",height:"100%"})})}),d?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:Ne.changeTitle,"data-testid":`${N}-title`,children:k.title}),t.jsx("p",{className:Ne.changeLabel,children:k.changeDue}),t.jsx("p",{className:Ne.changeAmount,"data-testid":`${N}-change`,children:xe(d.amount.value,void 0,d.amount.currency)}),d.caption&&t.jsx("p",{className:Ne.changeCaption,"data-testid":`${N}-change-caption`,children:d.caption})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-[1.375rem] font-semibold","data-testid":`${N}-title`,children:k.title}),$&&t.jsx("p",{className:"my-1 text-[1.875rem] font-semibold tabular-nums","data-testid":`${N}-total`,children:$}),r&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-subtitle`,children:r})]}),i&&t.jsx("p",{className:"text-[0.8125rem] text-pos-muted","data-testid":`${N}-reason`,children:k.reason.replace("{reason}",i)})]}),o&&o.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-paid-with`,children:[t.jsx("p",{className:Gt,children:k.paidWithTitle}),o.map((A,j)=>t.jsxs("div",{className:Ne.paidRow,"data-testid":`${N}-paid-with-${j}`,children:[A.icon&&t.jsx("span",{className:Ne.paidIcon,"aria-hidden":"true",children:t.jsx("span",{className:"flex h-4 w-4",children:t.jsx(M,{icon:A.icon,width:"100%",height:"100%"})})}),t.jsx("span",{className:Ne.paidLabel,children:A.label}),t.jsx("span",{className:Ne.paidAmount,children:xe(A.amount.value,void 0,A.amount.currency)}),A.status&&t.jsx("span",{className:Ne.paidStatus,children:A.status})]},`${A.label}-${j}`))]}),l&&l.length>0&&t.jsxs("div",{className:"mt-5 text-left","data-testid":`${N}-outcome`,children:[t.jsx("p",{className:Gt,children:k.outcomeTitle}),t.jsx("div",{className:Ne.groups,children:l.map((A,j)=>t.jsxs("div",{"data-testid":`${N}-outcome-${j}`,children:[t.jsx("p",{className:Ne.groupLabel,children:A.label}),t.jsx("ul",{className:Ne.groupItems,"aria-label":A.label,children:A.items.map((D,S)=>t.jsx("li",{className:Ne.groupItem,children:D},`${D}-${S}`))})]},`${A.label}-${j}`))})]}),a&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Gt,children:k.destinationsTitle}),a.map((A,j)=>t.jsxs("div",{className:"flex items-center justify-between gap-2.5 border-b border-pos-line-2 py-[0.6875rem] text-sm last:border-b-0","data-testid":`${N}-destination-${j}-${A.status}`,children:[t.jsx("span",{className:"font-semibold",children:A.label}),t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("span",{className:"tabular-nums text-pos-neutral",children:xe(A.amount.value,void 0,A.amount.currency)}),t.jsx("span",{className:c.cn(tb,eb[A.status]),children:A.status==="succeeded"?k.succeeded:k.pending})]})]},`${A.label}-${j}`))]}),p&&p.length>0?t.jsxs("div",{className:"mt-5 flex flex-col text-left","data-testid":`${N}-receipt-actions`,children:[t.jsx("p",{className:Gt,children:k.sendReceipt}),t.jsx("div",{className:Ne.receiptRow,children:p.map(A=>t.jsx(ab,{action:A,controls:A.expanded?w:void 0,"data-testid":`${N}-receipt-action-${A.key}`},A.key))}),f&&t.jsx(rb,{id:w,email:f,labels:k,"data-testid":`${N}-email`})]}):m&&t.jsxs("div",{className:"mt-5 text-left",children:[t.jsx("p",{className:Gt,children:k.sendReceipt}),t.jsx("div",{className:"flex flex-col gap-2",children:nb.map(A=>{const j=x?.includes(A)??!1;return t.jsxs("button",{type:"button",role:"checkbox","aria-checked":j,onClick:()=>m(A),className:`flex min-h-11 w-full items-center gap-2.5 rounded-[0.625rem] p-2 text-left text-sm outline-none transition-colors hover:bg-pos-neutral-fill focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary ${Ce}`,"data-testid":`${N}-receipt-${A}`,children:[t.jsx("span",{"aria-hidden":"true",className:"pointer-events-none flex",children:t.jsx(c.Checkbox,{isSelected:j,isReadOnly:!0,tabIndex:-1})}),t.jsx("span",{children:k[A]})]},A)})})]}),u&&t.jsx("p",{className:"mt-4 text-[0.78125rem] text-pos-muted","data-testid":`${N}-authorized-by`,children:k.authorizedBy.replace("{name}",u)}),t.jsx("div",{className:"mt-auto pt-5",children:t.jsx(T,{color:"primary",className:`h-12 w-full rounded-[0.875rem] px-5 text-[0.9375rem] font-semibold ${ws}`,onPress:g,"data-testid":`${N}-done`,children:k.done})})]})};Yo.displayName="OutcomeView";function ab({action:e,controls:s,"data-testid":n}){return t.jsx(T,{variant:"bordered",color:"default",disableRipple:!0,className:c.cn(Ne.receiptAction,e.expanded&&Ne.receiptActionExpanded),"aria-expanded":e.expanded,"aria-controls":s,isDisabled:e.isDisabled,onPress:e.onPress,startContent:e.icon?t.jsx("span",{"aria-hidden":"true",className:"flex h-4 w-4 shrink-0",children:t.jsx(M,{icon:e.icon,width:"100%",height:"100%"})}):void 0,"data-testid":n,children:e.label})}function rb({id:e,email:s,labels:n,"data-testid":a}){const r=s.isSendDisabled??s.emails.length===0;return t.jsxs("div",{id:e,className:Ne.emailBox,"data-testid":a,children:[t.jsxs("div",{className:c.cn(Ne.chipWrap,s.isInvalid?"border-pos-danger":"border-pos-line"),"data-invalid":s.isInvalid||void 0,"data-testid":`${a}-recipients`,children:[s.emails.map(i=>t.jsxs("span",{className:Ne.chip,"data-testid":`${a}-chip`,children:[i,t.jsx(T,{isIconOnly:!0,variant:"light",color:"default",disableRipple:!0,className:Ne.chipRemove,"aria-label":n.removeEmail.replace("{email}",i),onPress:()=>s.onRemoveEmail(i),"data-testid":`${a}-remove`,children:t.jsx("span",{"aria-hidden":"true",className:"flex h-[0.9375rem] w-[0.9375rem]",children:t.jsx(M,{icon:"lucide:x",width:"100%",height:"100%"})})})]},i)),t.jsx(c.Input,{"aria-label":n.emailAriaLabel,placeholder:n.emailPlaceholder,type:"email",value:s.draft,onValueChange:s.onDraftChange,onKeyDown:i=>{i.key==="Enter"&&s.draft.trim()!==""&&(i.preventDefault(),s.onAddEmail(s.draft.trim()))},isInvalid:s.isInvalid,classNames:{base:"w-auto min-w-[7.5rem] flex-1",inputWrapper:`h-[1.6875rem] min-h-[1.6875rem] bg-transparent px-0.5 py-0 shadow-none data-[hover=true]:bg-transparent group-data-[focus=true]:bg-transparent group-data-[invalid=true]:bg-transparent ${Ce}`,input:"text-[0.8125rem] text-pos-ink placeholder:text-pos-muted group-data-[invalid=true]:text-pos-ink"},"data-testid":`${a}-input`})]}),t.jsx(T,{color:"secondary",className:Ne.send,isDisabled:r,isLoading:s.isSending,onPress:s.onSend,"data-testid":`${a}-send`,children:n.sendEmail})]})}const Te={base:"relative inline-grid min-w-[var(--filter-select-min)] max-w-max shrink grow basis-[var(--filter-select-min)] grid-cols-[minmax(0,1fr)] [--filter-select-min:6rem]",baseActive:"[--filter-select-min:8rem]",cell:"[grid-area:1/1]",sizer:"invisible h-0 max-w-[20rem] overflow-hidden whitespace-nowrap border-x-2 border-transparent pl-2 pr-[2.0625rem] text-[0.875rem]",sizerActive:"pr-[3.4375rem] font-semibold",select:"w-full [contain:inline-size]",trigger:"h-[2.375rem] min-h-[2.375rem] rounded-[0.625rem] border-medium border-pos-field bg-white px-2 shadow-none data-[hover=true]:border-default-300 data-[focus=true]:border-primary data-[open=true]:border-primary data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-primary data-[focus-visible=true]:ring-offset-1",triggerActive:"!border-acct-rust-border !bg-acct-rust-fill pr-[1.875rem]",value:"text-[0.875rem] !text-default-900",valueActive:"font-semibold !text-primary-600",iconActive:"!text-primary-600",clear:"absolute right-[1.875rem] top-1/2 z-20 inline-flex size-[1.25rem] -translate-y-1/2 items-center justify-center rounded-md text-primary-600 outline-none hover:bg-white/70 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary",clearIcon:"size-[0.8125rem]",optionTitle:"whitespace-normal break-words"},ib="grid shrink grow basis-0 grid-flow-col auto-cols-auto gap-2.5 [--filter-select-cap:16rem] max-w-[calc(var(--filter-select-count)*var(--filter-select-cap)+(var(--filter-select-count)-1)*0.625rem)] [&>[data-slot=filter-select]]:max-w-none",lb="calc(100vw - 1.5rem)",Qo=({label:e,value:s,options:n,onChange:a,clearLabel:r,minWidth:i,"data-testid":o="filter-select"})=>{const l=s!==null,d=l?n.find(f=>f.value===s)?.label:void 0,u=h.useRef(null),x=h.useRef(null),[m,p]=h.useState();return t.jsxs("div",{ref:u,"data-testid":o,"data-slot":"filter-select","data-active":l?"true":void 0,title:d,className:c.cn(Te.base,l&&Te.baseActive),style:i===void 0?void 0:{"--filter-select-min":ut(i)},children:[t.jsx(at,{"aria-label":e,placeholder:e,size:"sm",variant:"bordered",radius:"md",selectedKeys:s===null?[]:[s],onSelectionChange:f=>{if(f==="all")return;const g=[...f][0];a(g===void 0?null:String(g))},onOpenChange:f=>{f&&p(u.current?.getBoundingClientRect().width)},popoverProps:{ref:x,placement:"bottom-start",style:{minWidth:m,maxWidth:lb}},"data-testid":`${o}-trigger`,classNames:{base:c.cn(Te.select,Te.cell),trigger:c.cn(Te.trigger,l&&Te.triggerActive),value:c.cn(Te.value,l&&Te.valueActive),selectorIcon:c.cn(l&&Te.iconActive)},children:n.map(f=>t.jsx(c.SelectItem,{classNames:{title:Te.optionTitle},children:f.label},f.value))}),t.jsx("span",{"aria-hidden":"true","data-testid":`${o}-sizer`,className:c.cn(Te.sizer,l&&Te.sizerActive,Te.cell),children:d??e}),l&&t.jsx("button",{type:"button","aria-label":r,onClick:()=>{a(null),u.current?.querySelector('[data-slot="trigger"]')?.focus()},"data-testid":`${o}-clear`,className:Te.clear,children:t.jsx(M,{icon:"lucide:x",className:Te.clearIcon,"aria-hidden":"true"})})]})};Qo.displayName="FilterSelect";const Zo=({children:e,className:s,"data-testid":n="filter-select-group"})=>t.jsx("div",{"data-testid":n,"data-slot":"filter-select-group",className:c.cn(ib,s),style:{"--filter-select-count":h.Children.toArray(e).length},children:e});Zo.displayName="FilterSelectGroup";const pt={base:"flex flex-wrap items-center justify-center gap-2.5 border-t border-pos-hair px-5 py-[0.875rem] text-[0.84375rem] text-default-500",idle:"w-full",sentinel:"h-px w-full",spinner:"inline-flex",error:"text-pos-danger"},Xo=({status:e,onLoadMore:s,loadingLabel:n,errorLabel:a,retryLabel:r,endLabel:i,"data-testid":o="load-more-footer"})=>{const l=h.useRef(null),d=h.useRef(s),u=h.useRef(!1);return h.useEffect(()=>{d.current=s},[s]),h.useEffect(()=>{if(e!=="idle"){u.current=!1;return}const x=l.current;if(!x||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(p=>{u.current||!p.some(f=>f.isIntersecting)||(u.current=!0,d.current())},{rootMargin:"0px 0px 200px 0px"});return m.observe(x),()=>m.disconnect()},[e]),e==="idle"?t.jsx("div",{"data-testid":o,"data-status":"idle",className:pt.idle,children:t.jsx("div",{ref:l,"aria-hidden":"true","data-testid":`${o}-sentinel`,className:pt.sentinel})}):e==="loading"?t.jsxs("div",{"data-testid":o,"data-status":"loading",role:"status","aria-live":"polite",className:pt.base,children:[t.jsx("span",{"aria-hidden":"true",className:pt.spinner,children:t.jsx(c.Spinner,{size:"sm",color:"default"})}),t.jsx("span",{"data-testid":`${o}-loading`,children:n})]}):e==="error"?t.jsxs("div",{"data-testid":o,"data-status":"error",className:pt.base,children:[t.jsx("span",{role:"alert","data-testid":`${o}-error`,className:pt.error,children:a}),t.jsx(T,{size:"sm",color:"default",variant:"bordered",radius:"md",onPress:s,testId:`${o}-retry`,children:r})]}):t.jsx("div",{"data-testid":o,"data-status":"end",className:i?pt.base:pt.idle,children:i&&t.jsx("span",{"data-testid":`${o}-end`,children:i})})};Xo.displayName="LoadMoreFooter";const Ae={base:"w-full",list:"m-0 list-none p-0",item:"relative border-b border-pos-hair last:border-b-0",card:"block w-full px-4 py-[0.875rem] text-left",cardInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ce}`,headline:"flex items-baseline gap-2.5",headlineWithActions:"pr-[3.25rem]",title:"min-w-0 text-[0.90625rem] font-semibold text-primary [overflow-wrap:anywhere]",amount:"ml-auto shrink-0 whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900",actions:"absolute right-4 top-[0.1875rem] z-[1]",chips:"mt-[0.5625rem] flex flex-wrap gap-1.5",chipsLine:"mt-[0.5625rem] flex items-center gap-2.5",chipsInline:"flex min-w-0 flex-wrap gap-1.5",rows:"mt-[0.5625rem] block",row:"flex items-baseline gap-3 py-[0.1875rem] text-[0.8125rem]",rowLabel:"shrink-0 text-default-500",rowValue:"ml-auto min-w-0 text-right text-default-700 [overflow-wrap:anywhere]",skeletonRow:"border-b border-pos-hair p-4 last:border-b-0"},_r=({item:e,withActions:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:c.cn(Ae.headline,s&&Ae.headlineWithActions),children:[t.jsx("span",{className:Ae.title,children:e.title}),se(e.amount)&&!s&&t.jsx("span",{className:Ae.amount,children:e.amount})]}),s?(se(e.chips)||se(e.amount))&&t.jsxs("span",{className:Ae.chipsLine,children:[se(e.chips)&&t.jsx("span",{className:Ae.chipsInline,children:e.chips}),se(e.amount)&&t.jsx("span",{className:Ae.amount,children:e.amount})]}):se(e.chips)&&t.jsx("span",{className:Ae.chips,children:e.chips}),e.rows&&e.rows.length>0&&t.jsx("span",{className:Ae.rows,children:e.rows.map((n,a)=>t.jsxs("span",{className:Ae.row,children:[t.jsx("span",{className:Ae.rowLabel,children:n.label}),t.jsx("span",{className:Ae.rowValue,children:n.value})]},a))})]}),Jo=({items:e,ariaLabel:s,onSelect:n,loading:a=!1,skeletonCount:r=6,"data-testid":i="card-list"})=>t.jsx("div",{"data-testid":i,className:Ae.base,children:a?t.jsx("div",{role:"status","aria-busy":"true","aria-label":s,"data-testid":`${i}-skeleton`,children:t.jsx("div",{"aria-hidden":"true",children:Array.from({length:r},(o,l)=>t.jsxs("div",{"data-testid":`${i}-skeleton-row`,className:Ae.skeletonRow,children:[t.jsx("div",{className:bs,style:{height:ut(13),width:ut(130)}}),t.jsx("div",{className:bs,style:{height:ut(11),width:"70%",marginTop:ut(10)}}),t.jsx("div",{className:bs,style:{height:ut(11),width:"45%",marginTop:ut(8)}})]},l))})}):t.jsx("ul",{"aria-label":s,className:Ae.list,children:e.map(o=>{const l=se(o.actions);return t.jsxs("li",{"data-testid":`${i}-item-${o.id}`,className:Ae.item,children:[n?t.jsx("button",{type:"button",onClick:()=>n(o.id),className:c.cn(Ae.card,Ae.cardInteractive),children:t.jsx(_r,{item:o,withActions:l})}):t.jsx("div",{className:Ae.card,children:t.jsx(_r,{item:o,withActions:l})}),l&&t.jsx("div",{"data-testid":`${i}-item-${o.id}-actions`,className:Ae.actions,children:o.actions})]},o.id)})})});Jo.displayName="CardList";const ob=48,re={base:`mb-4 overflow-hidden rounded-2xl border border-pos-line bg-white ${Vs}`,band:"flex items-center gap-2.5 border-b border-pos-hair bg-pos-page px-4 py-2.5",back:`inline-flex size-[1.625rem] shrink-0 items-center justify-center rounded-[0.625rem] text-default-500 outline-none transition-colors hover:bg-default-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${Ce}`,backIcon:"size-[0.875rem]",breadcrumb:"min-w-0 flex-1",breadcrumbList:"flex-nowrap gap-[0.375rem]",crumbBase:"min-w-0",crumb:"whitespace-nowrap text-[0.875rem] text-default-500 data-[disabled=true]:opacity-100 data-[current=true]:overflow-hidden data-[current=true]:font-normal data-[current=true]:text-default-900",crumbSeparator:"ms-[0.375rem] px-0 text-default-400 data-[disabled=true]:opacity-100",body:"flex flex-wrap gap-5",bodyWide:"px-5 pb-5 pt-[1.125rem]",bodyNarrow:"p-4",identity:"min-w-0 flex-[1_1_18.75rem]",title:"m-0 font-semibold tracking-[-.02em] text-default-900 [overflow-wrap:anywhere]",titleWide:"text-[1.5rem]",titleNarrow:"text-[1.3125rem]",meta:"m-0 mt-[0.6875rem] flex list-none flex-col gap-[0.4375rem] p-0",metaLine:"flex min-w-0 items-center gap-[0.5625rem] text-[0.84375rem] text-default-700",metaIcon:"flex shrink-0 text-default-400 [&_svg]:size-[0.9375rem]",metaText:"min-w-0 truncate",money:"flex flex-col gap-[0.3125rem]",moneyWide:"ml-auto min-w-[12.5rem] flex-none items-end text-right",moneyNarrow:"w-full items-start text-left",amountLabel:"text-[0.8125rem] text-default-500",amount:"whitespace-nowrap font-bold tracking-[-.03em] tabular-nums text-default-900",amountWide:"text-[1.9375rem] leading-[1.1]",amountNarrow:"text-[1.6875rem] leading-[1.1]",amountCaption:"text-[0.8125rem] text-default-500",recordId:"text-[0.8125rem] text-default-500",chips:"mt-[0.1875rem] flex flex-wrap gap-1.5",chipsWide:"justify-end",chipsNarrow:"justify-start",statItems:"m-0 mt-2.5 flex flex-wrap gap-[1.375rem]",stat:"flex flex-col-reverse",statWide:"text-right",statNarrow:"text-left",statValue:"m-0 text-[0.9375rem] font-bold tabular-nums text-default-900",statLabel:"mt-0.5 text-[0.75rem] text-default-500",statsWide:"px-5 pb-5",statsNarrow:"px-4 pb-4"},ec=h.forwardRef((e,s)=>t.jsx("li",{ref:s,...Object.fromEntries(Object.entries(e).filter(([n])=>n!=="data-testid"))}));ec.displayName="CrumbBase";const tc=({breadcrumb:e=[],onBack:s,backLabel:n,title:a,meta:r,amountLabel:i,amount:o,amountCaption:l,recordId:d,chips:u,statItems:x,stats:m,banner:p,"data-testid":f="record-header"})=>{const{ref:g,width:v}=It(),b=!ls(v,ob),y=e.length>0||!!s,N=!!(x&&x.length>0),k=!!i||se(o)||se(l)||se(d)||se(u)||N;return t.jsxs("div",{ref:g,"data-testid":f,"data-size":b?"narrow":"wide",className:re.base,children:[y&&t.jsxs("div",{"data-testid":`${f}-band`,className:re.band,children:[s&&t.jsx("button",{type:"button",onClick:s,"aria-label":n,"data-testid":`${f}-back`,className:re.back,children:t.jsx(M,{icon:"lucide:chevron-left",className:re.backIcon,"aria-hidden":"true"})}),t.jsx(c.Breadcrumbs,{separator:"/","data-testid":`${f}-breadcrumb`,classNames:{base:re.breadcrumb,list:re.breadcrumbList},itemClasses:{base:re.crumbBase,item:re.crumb,separator:re.crumbSeparator},children:e.map((w,$)=>t.jsx(c.BreadcrumbItem,{as:ec,"data-testid":`${f}-crumb-${$}`,isDisabled:!w.onClick&&$<e.length-1,onPress:w.onClick?()=>w.onClick?.():void 0,children:w.label},$))})]}),t.jsxs("div",{className:c.cn(re.body,b?re.bodyNarrow:re.bodyWide),children:[t.jsxs("div",{className:re.identity,children:[t.jsx("h1",{"data-testid":`${f}-title`,className:c.cn(re.title,b?re.titleNarrow:re.titleWide),children:a}),r&&r.length>0&&t.jsx("ul",{"data-testid":`${f}-meta`,className:re.meta,children:r.map((w,$)=>t.jsxs("li",{className:re.metaLine,children:[w.icon!=null&&t.jsx("span",{"aria-hidden":"true",className:re.metaIcon,children:w.icon}),t.jsx("span",{className:re.metaText,children:w.text})]},$))})]}),k&&t.jsxs("div",{"data-testid":`${f}-money`,className:c.cn(re.money,b?re.moneyNarrow:re.moneyWide),children:[i&&t.jsx("div",{className:re.amountLabel,children:i}),se(o)&&t.jsx("div",{"data-testid":`${f}-amount`,className:c.cn(re.amount,b?re.amountNarrow:re.amountWide),children:o}),se(l)&&t.jsx("div",{className:re.amountCaption,children:l}),se(d)&&t.jsx("div",{"data-testid":`${f}-record-id`,className:re.recordId,children:d}),se(u)&&t.jsx("div",{"data-testid":`${f}-chips`,className:c.cn(re.chips,b?re.chipsNarrow:re.chipsWide),children:u}),N&&t.jsx("dl",{"data-testid":`${f}-stat-items`,className:re.statItems,children:x?.map((w,$)=>t.jsxs("div",{"data-testid":`${f}-stat-${$}`,className:c.cn(re.stat,b?re.statNarrow:re.statWide),children:[t.jsx("dt",{"data-testid":`${f}-stat-${$}-label`,className:re.statLabel,children:w.label}),t.jsx("dd",{"data-testid":`${f}-stat-${$}-value`,className:re.statValue,style:w.tone?{color:Xe[w.tone].fg}:void 0,children:w.value})]},w.id??$))})]})]}),se(m)&&t.jsx("div",{"data-testid":`${f}-stats`,className:b?re.statsNarrow:re.statsWide,children:m}),se(p)&&t.jsx("div",{"data-testid":`${f}-banner`,children:p})]})};tc.displayName="RecordHeader";const cb=50,Kt={base:"grid items-start gap-4",split:"grid-cols-[minmax(0,1fr)_23.25rem]",stacked:"grid-cols-[minmax(0,1fr)]",column:"min-w-0",aside:"flex min-w-0 flex-col gap-[0.875rem]"},sc=({children:e,aside:s,"data-testid":n="record-layout"})=>{const{ref:a,width:r}=It(),i=se(s),o=i&&r>0&&ls(r,cb),l=t.jsx("div",{"data-testid":`${n}-main`,className:Kt.column,children:e},"main"),d=i?t.jsx("div",{"data-testid":`${n}-aside`,className:Kt.aside,children:s},"aside"):null;return t.jsx("div",{ref:a,"data-testid":n,"data-layout":o?"split":"stacked",className:c.cn(Kt.base,o?Kt.split:Kt.stacked),children:o?[l,d]:[d,l]})};sc.displayName="RecordLayout";const db=560,Yt={base:"grid gap-3",tile:"min-w-0 rounded-[14px] border border-pos-line bg-white px-[18px] py-4 shadow-[0_1px_4px_rgba(0,0,0,.06),0_4px_12px_rgba(0,0,0,.06)]",value:"text-[23px] font-bold leading-[1.2] tracking-[-.02em] tabular-nums text-default-900 [overflow-wrap:anywhere]",label:"mt-[5px] text-[13.5px] text-default-500",caption:"mt-0.5 text-[12.5px] text-default-500"},nc=({items:e,"data-testid":s="stat-tiles"})=>{const{ref:n,width:a}=It(),r=a>=Lx?Math.max(e.length,1):a>=db?2:1;return t.jsx("div",{ref:n,"data-testid":s,"data-columns":r,className:Yt.base,style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:e.map((i,o)=>t.jsxs("div",{"data-testid":`${s}-item-${o}`,className:Yt.tile,children:[t.jsx("div",{"data-testid":`${s}-item-${o}-value`,className:Yt.value,style:i.tone?{color:Xe[i.tone].fg}:void 0,children:i.value}),t.jsx("div",{"data-testid":`${s}-item-${o}-label`,className:Yt.label,children:i.label}),se(i.caption)&&t.jsx("div",{"data-testid":`${s}-item-${o}-caption`,className:Yt.caption,children:i.caption})]},o))})};nc.displayName="StatTiles";const dt={base:"mb-3.5 w-full",tabList:"w-full gap-1 rounded-full border border-pos-line bg-default-100 p-1",cursor:"rounded-full bg-white shadow-[0_1px_3px_rgba(0,0,0,.10)]",tab:"h-auto flex-1 data-[hover-unselected=true]:opacity-100",tabStill:"rounded-full data-[selected=true]:bg-white data-[selected=true]:shadow-[0_1px_3px_rgba(0,0,0,.10)]",tabContent:"leading-[1.5] font-normal text-default-600 group-data-[selected=true]:font-semibold group-data-[selected=true]:text-default-900",title:"flex items-center whitespace-nowrap",icon:"flex shrink-0",count:"rounded-full bg-default-200 py-px leading-[1.5] font-semibold text-default-600 group-data-[selected=true]:bg-acct-rust-fill group-data-[selected=true]:text-primary-600"},ub={md:{tab:"px-[0.875rem] py-[0.5625rem]",tabContent:"text-[0.84375rem]",title:"gap-[0.4375rem]",icon:"[&_svg]:size-4",count:"px-[0.4375rem] text-[0.71875rem]"},lg:{tab:"px-4 py-3",tabContent:"text-base",title:"gap-2",icon:"[&_svg]:size-5",count:"px-2 text-[0.8125rem]"}},ya="pill-tabs",va=(e,s=ya)=>`${s}-tab-${e}`,ja=(e,s=ya)=>`${s}-panel-${e}`,mb=(e,s=ya)=>({role:"tabpanel",id:ja(e,s),"aria-labelledby":va(e,s),tabIndex:0}),ac=({items:e,value:s,onChange:n,ariaLabel:a,idPrefix:r,size:i="md","data-testid":o="pill-tabs"})=>{const l=_s(),d=!!c.useProviderContext()?.disableAnimation,u=r??o,x=ub[i];return t.jsx(c.Tabs,{"aria-label":a,variant:"solid",radius:"full",fullWidth:!0,disableAnimation:l||void 0,selectedKey:s,onSelectionChange:m=>n(String(m)),"data-testid":o,"data-size":i,classNames:{base:dt.base,tabList:dt.tabList,cursor:dt.cursor,tab:c.cn(dt.tab,x.tab,(l||d)&&dt.tabStill),tabContent:c.cn(x.tabContent,dt.tabContent)},children:e.map(m=>{const p=m["data-testid"]??`${o}-${m.key}`;return t.jsx(c.Tab,{id:va(m.key,u),"aria-controls":ja(m.key,u),"data-testid":p,title:t.jsxs("span",{className:c.cn(dt.title,x.title),children:[se(m.icon)&&t.jsx("span",{"aria-hidden":"true","data-testid":`${p}-icon`,className:c.cn(dt.icon,x.icon),children:m.icon}),m.label,m.count!==void 0&&t.jsx("span",{"data-testid":`${p}-count`,className:c.cn(x.count,dt.count),children:m.count})]})},m.key)})})};ac.displayName="PillTabs";const ye={base:"w-full",list:"m-0 list-none p-0",item:"border-t border-pos-hair",row:"flex w-full items-start gap-3 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ce}`,dot:"mt-[0.4375rem] size-[0.4375rem] shrink-0 rounded-full",body:"flex min-w-0 flex-1 flex-col",title:"text-[0.875rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",meta:"mt-1 flex min-w-0 flex-wrap items-center gap-[0.4375rem] text-[0.78125rem] text-default-500",reference:"min-w-0 font-normal text-primary [overflow-wrap:anywhere]",separator:"text-default-400",timestamp:"tabular-nums",detail:"mt-[0.1875rem] text-[0.78125rem] text-default-500 [overflow-wrap:anywhere] [text-wrap:pretty]",trailing:"max-w-[45%] min-w-min shrink-0 text-right text-[0.90625rem]",amount:"whitespace-nowrap text-[0.90625rem] font-bold tabular-nums text-default-900",note:"text-[0.78125rem] italic text-default-500 [overflow-wrap:anywhere]",footer:"flex items-baseline gap-3 border-t border-pos-line bg-pos-page px-5 py-[0.8125rem]",footerLabel:"min-w-0 text-[0.875rem] font-bold text-default-900 [overflow-wrap:anywhere]",footerAmount:"ml-auto whitespace-nowrap text-[1rem] font-bold tabular-nums text-default-900",footerNote:"border-t border-pos-hair px-5 py-[0.8125rem] text-[0.78125rem] leading-[1.6] text-default-500",empty:"px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500"},Mr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsx("span",{"aria-hidden":"true",className:ye.dot,style:{backgroundColor:Xe[e.tone].fg}}),t.jsxs("span",{className:ye.body,children:[t.jsx("span",{className:ye.title,children:e.title}),(e.reference!=null||e.timestamp!=null)&&t.jsxs("span",{className:ye.meta,children:[e.reference!=null&&t.jsx("span",{className:ye.reference,children:e.reference}),e.reference!=null&&e.timestamp!=null&&t.jsx("span",{"aria-hidden":"true",className:ye.separator,children:"·"}),e.timestamp!=null&&t.jsx("span",{className:ye.timestamp,children:e.timestamp})]}),e.detail!=null&&t.jsx("span",{className:ye.detail,children:e.detail})]}),t.jsx("span",{className:ye.trailing,children:e.amount!=null?t.jsx("span",{"data-testid":`${s}-amount`,className:ye.amount,style:os(e.amountTone),children:e.amount}):e.note!=null?t.jsx("span",{"data-testid":`${s}-note`,className:ye.note,style:e.noteTone==="warn"?{color:Xe.warn.fg}:void 0,children:e.note}):null})]}),rc=({rows:e,footer:s,emptyContent:n,onSelect:a,"data-testid":r="amount-list"})=>e.length===0?t.jsx("div",{"data-testid":r,className:ye.base,children:n!=null&&t.jsx("div",{"data-testid":`${r}-empty`,className:ye.empty,children:n})}):t.jsxs("div",{"data-testid":r,className:ye.base,children:[t.jsx("ul",{className:ye.list,children:e.map(i=>{const o=`${r}-row-${i.id}`;return t.jsx("li",{"data-testid":o,className:ye.item,children:a?t.jsx("button",{type:"button",onClick:()=>a(i.id),className:c.cn(ye.row,ye.rowInteractive),children:t.jsx(Mr,{row:i,testId:o})}):t.jsx("div",{className:ye.row,children:t.jsx(Mr,{row:i,testId:o})})},i.id)})}),s&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"data-testid":`${r}-footer`,className:ye.footer,children:[t.jsx("span",{className:ye.footerLabel,children:s.label}),t.jsx("span",{"data-testid":`${r}-footer-amount`,className:ye.footerAmount,style:os(s.amountTone),children:s.amount})]}),s.note!=null&&t.jsx("div",{"data-testid":`${r}-footer-note`,className:ye.footerNote,children:s.note})]})]});rc.displayName="AmountList";const Ke={list:"m-0 list-none p-0 pl-0.5",event:"flex gap-3.5",eventSpaced:"pb-4",rail:"flex flex-none flex-col items-center",dot:"mt-[0.3125rem] size-2.5 rounded-full",connector:"mt-1 w-[1.5px] flex-1 bg-pos-hair",body:"min-w-0 flex-1 pb-0.5",head:"flex min-w-0 flex-wrap items-baseline gap-x-3",title:"min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",timestamp:"ml-auto min-w-0 max-w-full text-[0.8125rem] tabular-nums text-default-500 [overflow-wrap:anywhere]",detail:"mt-[0.1875rem] min-w-0 text-[0.84375rem] leading-[1.5] text-default-500 [overflow-wrap:anywhere]",actor:"mt-[0.1875rem] min-w-0 text-[0.78125rem] text-default-500 [overflow-wrap:anywhere]",empty:"text-[0.875rem] text-default-500"},ic=({events:e,emptyContent:s,"data-testid":n="activity-timeline"})=>e.length===0?t.jsx("div",{"data-testid":n,children:s!=null&&t.jsx("div",{"data-testid":`${n}-empty`,className:Ke.empty,children:s})}):t.jsx("ol",{"data-testid":n,className:Ke.list,children:e.map((a,r)=>{const i=r===e.length-1,o=`${n}-event-${a.id}`;return t.jsxs("li",{"data-testid":o,className:c.cn(Ke.event,!i&&Ke.eventSpaced),children:[t.jsxs("span",{"aria-hidden":"true",className:Ke.rail,children:[t.jsx("span",{className:Ke.dot,style:{backgroundColor:Xe[a.tone].fg}}),!i&&t.jsx("span",{"data-testid":`${o}-connector`,className:Ke.connector})]}),t.jsxs("div",{className:Ke.body,children:[t.jsxs("div",{className:Ke.head,children:[t.jsx("span",{className:Ke.title,children:a.title}),t.jsx("span",{className:Ke.timestamp,children:a.timestamp})]}),se(a.detail)&&t.jsx("div",{className:Ke.detail,children:a.detail}),se(a.actor)&&t.jsx("div",{"data-testid":`${o}-actor`,className:Ke.actor,children:a.actor})]})]},a.id)})});ic.displayName="ActivityTimeline";const Le={base:`overflow-hidden rounded-2xl border border-pos-line bg-white ${Vs}`,header:"flex flex-wrap items-center gap-2 px-5 pt-4",title:"m-0 min-w-0 text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere]",count:"rounded-full bg-default-100 px-2 py-px text-[0.75rem] font-semibold text-default-600",list:"m-0 list-none p-0",item:"border-t border-pos-hair",itemFirstHeadless:"border-t-0",row:"flex w-full items-center gap-2.5 px-5 py-3 text-left",rowInteractive:`cursor-pointer outline-none transition-colors hover:bg-default-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary ${Ce}`,rowBody:"flex min-w-0 flex-1 flex-col",rowHead:"flex min-w-0 flex-wrap items-center gap-2",primaryLinked:"min-w-0 text-[0.875rem] font-normal text-primary [overflow-wrap:anywhere]",primaryPlain:"min-w-0 text-[0.875rem] font-normal text-default-900 [overflow-wrap:anywhere]",secondary:"mt-[0.1875rem] block min-w-0 truncate text-[0.8125rem] text-default-500",amount:"max-w-[45%] shrink-0 text-right text-[0.875rem] font-semibold tabular-nums text-default-900 [overflow-wrap:anywhere]",empty:"min-w-0 px-5 pb-5 pt-[0.875rem] text-[0.875rem] text-default-500 [overflow-wrap:anywhere]",emptyHeadless:"pt-5"},Pr=({row:e,testId:s})=>t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:Le.rowBody,children:[t.jsxs("span",{className:Le.rowHead,children:[t.jsx("span",{className:e.onSelect?Le.primaryLinked:Le.primaryPlain,children:e.primary}),e.chip]}),!!e.secondary&&t.jsx("span",{className:Le.secondary,children:e.secondary})]}),!!e.amount&&t.jsx("span",{"data-testid":`${s}-amount`,className:Le.amount,style:os(e.amountTone),children:e.amount})]}),lc=({title:e,count:s,rows:n,emptyContent:a,"data-testid":r="related-record-list"})=>{const i=h.useId(),o=!!e;return t.jsxs("section",{"data-testid":r,role:o?"group":void 0,"aria-labelledby":o?i:void 0,className:Le.base,children:[o&&t.jsxs("div",{className:Le.header,children:[t.jsx("h3",{id:i,className:Le.title,children:e}),s!==void 0&&t.jsx("span",{"data-testid":`${r}-count`,className:Le.count,children:s})]}),n.length===0?!!a&&t.jsx("div",{"data-testid":`${r}-empty`,className:c.cn(Le.empty,!o&&Le.emptyHeadless),children:a}):t.jsx("ul",{className:Le.list,children:n.map((l,d)=>{const u=`${r}-row-${l.id}`;return t.jsx("li",{"data-testid":u,className:c.cn(Le.item,d===0&&!o&&Le.itemFirstHeadless),children:l.onSelect?t.jsx("button",{type:"button",onClick:l.onSelect,className:c.cn(Le.row,Le.rowInteractive),children:t.jsx(Pr,{row:l,testId:u})}):t.jsx("div",{className:Le.row,children:t.jsx(Pr,{row:l,testId:u})})},l.id)})})]})};lc.displayName="RelatedRecordList";const oc=({title:e,titleAs:s="h2",icon:n,count:a,badge:r,action:i,description:o,footer:l,variant:d="section",body:u="padded",surface:x="card",className:m,children:p,"data-testid":f="record-card"})=>{const g=h.useId(),v=se(e);return t.jsxs("section",{"data-testid":f,"data-variant":d,"data-surface":x,role:v?"group":void 0,"aria-labelledby":v?g:void 0,className:c.cn(ct.base,ap[x],m),children:[v&&t.jsxs("div",{"data-testid":`${f}-header`,className:rp[d],children:[se(n)&&t.jsx("span",{"aria-hidden":"true",className:ct.icon,children:n}),t.jsx(s,{id:g,className:ct.title,children:e}),se(a)&&t.jsx("span",{"data-testid":`${f}-count`,className:ct.count,children:a}),r,se(i)&&t.jsx("span",{"data-testid":`${f}-action`,className:ct.action,children:i})]}),t.jsxs("div",{"data-testid":`${f}-body`,className:ip[d][u],children:[se(o)&&t.jsx("p",{"data-testid":`${f}-description`,className:ct.description,children:o}),p,se(l)&&t.jsx("div",{"data-testid":`${f}-footer`,className:c.cn(ct.footer,se(p)?ct.footerAfterContent:ct.footerAfterDescription),children:l})]})]})};oc.displayName="RecordCard";const fb={stack:"flex min-w-0 flex-col gap-[0.875rem]",grid:"grid min-w-0 grid-cols-[repeat(auto-fit,minmax(min(100%,18.75rem),1fr))] items-start gap-[0.875rem]"},cc=({layout:e="stack",className:s,children:n,"data-testid":a="card-stack",...r})=>t.jsx("div",{...r,"data-testid":a,"data-layout":e,className:c.cn(fb[e],s),children:n});cc.displayName="CardStack";const hs={list:"m-0 divide-y divide-pos-hair",row:"flex items-baseline gap-3",label:"min-w-0 text-[0.84375rem] text-default-500",value:"m-0 ml-auto flex min-w-0 flex-wrap justify-end gap-[0.3125rem] text-right text-[0.875rem] text-default-900 [overflow-wrap:anywhere]"},xb={regular:"py-[0.5625rem]",compact:"py-2"},dc=({rows:e,density:s="regular","data-testid":n="key-value-rows"})=>t.jsx("dl",{"data-testid":n,className:hs.list,children:e.map((a,r)=>t.jsxs("div",{"data-testid":`${n}-row-${a.id??r}`,className:c.cn(hs.row,xb[s]),children:[t.jsx("dt",{className:hs.label,children:a.label}),t.jsx("dd",{className:hs.value,children:a.value})]},a.id??r))});dc.displayName="KeyValueRows";const et={list:"m-0 list-none p-0",row:"flex items-start gap-[0.875rem] border-t border-pos-hair px-5 py-3",body:"min-w-0 flex-1",name:"text-[0.90625rem] font-semibold text-default-900 [overflow-wrap:anywhere] [text-wrap:pretty]",details:"mt-[0.3125rem] flex flex-wrap items-center gap-[0.4375rem] text-[0.8125rem] text-default-500",separator:"text-default-400",detail:"tabular-nums",trailing:"flex shrink-0 flex-col items-end gap-1.5 text-right",amounts:"inline-flex items-baseline gap-2",original:"text-[0.8125rem] tabular-nums text-default-500 line-through",amount:"whitespace-nowrap text-[0.9375rem] font-bold tabular-nums text-default-900"},uc=({items:e,ariaLabel:s,originalAmountLabel:n,"data-testid":a="line-item-rows"})=>t.jsx("ul",{"aria-label":s,"data-testid":a,className:et.list,children:e.map(r=>{const i=`${a}-item-${r.id}`,o=se(r.originalAmount);return t.jsxs("li",{"data-testid":i,className:et.row,style:r.tone?{backgroundColor:Xe[r.tone].bg}:void 0,children:[t.jsxs("div",{className:et.body,children:[t.jsx("div",{className:et.name,children:r.name}),r.details&&r.details.length>0&&t.jsx("div",{"data-testid":`${i}-details`,className:et.details,children:r.details.map((l,d)=>t.jsxs(h.Fragment,{children:[d>0&&t.jsx("span",{"aria-hidden":"true",className:et.separator,children:"·"}),t.jsx("span",{className:et.detail,children:l})]},d))})]}),t.jsxs("div",{className:et.trailing,children:[t.jsxs("span",{className:et.amounts,children:[o&&t.jsxs("s",{"data-testid":`${i}-original`,className:et.original,children:[n&&t.jsxs("span",{className:"sr-only",children:[n," "]}),r.originalAmount]}),t.jsx("span",{"data-testid":`${i}-amount`,className:et.amount,style:o?{color:Xe.ok.fg}:void 0,children:r.amount})]}),r.chip]})]},r.id)})});uc.displayName="LineItemRows";const pb=37.5,Me={base:"mx-5 border-t border-pos-hair pb-[1.125rem] pt-2.5",rowWide:"flex items-baseline gap-4",rowNarrow:"flex flex-wrap items-baseline gap-x-3",labelWide:"shrink-0 grow-0 basis-[11.875rem]",labelNarrow:"flex-auto",noteWide:"min-w-0 flex-1",noteNarrow:"order-3 mt-px basis-full",row:"py-2",label:"text-[0.875rem] text-default-900",note:"text-[0.8125rem] text-default-500",value:"ml-auto shrink-0 whitespace-nowrap text-right text-[0.875rem] tabular-nums text-default-900",totalRule:"mt-1.5 border-t border-pos-line",totalRow:"pt-3",totalLabel:"text-[0.9375rem] font-bold text-default-900",totalValue:"ml-auto shrink-0 whitespace-nowrap text-right text-[1.0625rem] font-bold tabular-nums text-default-900",memo:"mt-2 text-[0.78125rem] leading-[1.6] text-default-500"},mc=({rows:e,total:s,memo:n,"data-testid":a="record-totals"})=>{const{ref:r,width:i}=It(),o=i>0&&!ls(i,pb),l=o?Me.rowNarrow:Me.rowWide,d=o?Me.labelNarrow:Me.labelWide,u=o?Me.noteNarrow:Me.noteWide;return t.jsxs("div",{ref:r,"data-testid":a,"data-size":o?"narrow":"wide",className:Me.base,children:[e.map(x=>{const m=`${a}-row-${x.id}`;return t.jsxs("div",{"data-testid":m,className:c.cn(l,Me.row),children:[t.jsx("span",{"data-testid":`${m}-label`,className:c.cn(d,Me.label),children:x.label}),t.jsx("span",{"data-testid":`${m}-note`,className:c.cn(u,Me.note),children:x.note}),t.jsx("span",{"data-testid":`${m}-value`,className:Me.value,style:os(x.tone),children:x.value})]},x.id)}),t.jsx("div",{className:Me.totalRule,children:t.jsxs("div",{"data-testid":`${a}-total`,className:c.cn(l,Me.totalRow),children:[t.jsx("span",{className:c.cn(d,Me.totalLabel),children:s.label}),t.jsx("span",{"data-testid":`${a}-total-value`,className:Me.totalValue,children:s.value})]})}),se(n)&&t.jsx("div",{"data-testid":`${a}-memo`,className:Me.memo,children:n})]})};mc.displayName="RecordTotals";const Rn={base:"whitespace-nowrap text-[0.875rem]",secondary:"text-default-500",chipStack:"inline-flex flex-col items-start gap-[0.3125rem]"},hb={text:"text-default-900",reference:"font-normal text-primary",amount:"font-semibold tabular-nums text-default-900"},fc=({variant:e="text",tone:s,secondary:n,children:a,"data-testid":r="cell-text"})=>t.jsxs("span",{"data-testid":r,className:c.cn(Rn.base,hb[e]),style:os(s),children:[a,se(n)&&t.jsxs("span",{"data-testid":`${r}-secondary`,className:Rn.secondary,children:[t.jsx("span",{"aria-hidden":"true",children:" · "}),n]})]});fc.displayName="CellText";const xc=({children:e,"data-testid":s="chip-stack"})=>t.jsx("span",{"data-testid":s,className:Rn.chipStack,children:e});xc.displayName="ChipStack";function pc({testId:e,title:s,description:n}){return t.jsx(c.Card,{shadow:"sm",className:"min-h-52 rounded-2xl shadow-none","data-testid":e,children:t.jsxs(c.CardBody,{className:"flex flex-col gap-2 p-4 text-sm",role:"alert",children:[t.jsx("span",{className:"font-semibold text-gray-900",children:s}),t.jsx("p",{className:"text-default-600 leading-snug",children:n})]})})}pc.displayName="SessionExpiredCard";exports.ActivityTimeline=ic;exports.AdminFieldLabel=la;exports.AdminTable=Al;exports.AdminTextField=ql;exports.AdminToolbar=El;exports.AmountList=rc;exports.AppliedCodeCard=ti;exports.Button=T;exports.CardList=Jo;exports.CardStack=cc;exports.CashTenderForm=xp;exports.CatalogItemCard=ul;exports.CellText=fc;exports.CheckTenderForm=lo;exports.ChipStack=xc;exports.CommitmentDetails=bf;exports.ConfirmDialog=ua;exports.ConfirmationModal=ta;exports.ConfirmationPageTemplate=Ru;exports.CustomerCard=Io;exports.DatePicker=Hn;exports.DensityProvider=Jc;exports.DimensionChip=Bs;exports.DiscardGuard=vo;exports.DonationAmounts=Pi;exports.Drawer=Ci;exports.EmptyState=sa;exports.EntityList=Jl;exports.EntityListSkeleton=eo;exports.EntityRow=Xl;exports.ErrorState=na;exports.EventDetails=wm;exports.EventDetailsTemplate=Mu;exports.ExpireCartTimer=Ii;exports.FeedbackState=is;exports.FilterPopover=bl;exports.FilterSelect=Qo;exports.FilterSelectGroup=Zo;exports.Footer=Uu;exports.HeroUIProvider=Gc;exports.HorizontalSteps=$i;exports.InlineConfirm=go;exports.InstallmentFundAssignment=mf;exports.InstallmentFundAssignmentSkeleton=pf;exports.InstallmentSchedule=Pf;exports.InstallmentScheduleSkeleton=Hf;exports.InstallmentTable=Kf;exports.ItemCard=dl;exports.KeyValueChip=Bs;exports.KeyValueRows=dc;exports.LineItemList=Fo;exports.LineItemRows=uc;exports.ListPanel=no;exports.LoadMoreFooter=Xo;exports.LoadingOverlay=ho;exports.LoadingState=aa;exports.MembershipSelectCards=Jf;exports.MetaCard=Ch;exports.Modal=ns;exports.ModalPanelHeader=jo;exports.ModalPanels=Zp;exports.ModalShell=uo;exports.ModalShellFooter=fo;exports.ModalShellHeader=mo;exports.Multiselect=Hu;exports.Navbar=Fu;exports.NotesField=Oo;exports.Notice=ba;exports.OfferCard=ks;exports.OfferCardEmpty=Ti;exports.OfferCardError=Oi;exports.OfferCardList=Ui;exports.OfferCardSkeleton=zi;exports.OtherTenderForm=oo;exports.OutcomeView=Yo;exports.PageHeader=vl;exports.PaginationSummary=so;exports.PaymentCashChangeBanner=ca;exports.PaymentSubAmountInput=da;exports.PaymentSuccessView=bo;exports.PaymentTotalBanner=po;exports.PickerRow=Kl;exports.PillTabs=ac;exports.PinField=Ko;exports.ProgramListItem=ml;exports.RICH_TEXT_PRESETS=_i;exports.ReasonSelect=To;exports.RecordCard=oc;exports.RecordHeader=tc;exports.RecordLayout=sc;exports.RecordTotals=mc;exports.RedeemCodeInput=Au;exports.RefundMethodCards=Wo;exports.RefundProgressList=Go;exports.RelatedRecordList=lc;exports.RevenueDistributionCard=tl;exports.RevenueDistributionEmpty=sl;exports.RevenueDistributionError=nl;exports.RevenueDistributionSkeleton=al;exports.RichTextArea=Mi;exports.RowActions=Gl;exports.SectionPanel=Po;exports.Select=at;exports.SessionExpiredCard=pc;exports.SessionTimeline=gl;exports.Skeleton=ie;exports.SplitPaymentSummary=co;exports.SplitTenderPanel=Bo;exports.StatTiles=nc;exports.StatusChip=jl;exports.StepPager=Li;exports.StepProgress=ha;exports.Stepper=Si;exports.StepsReadiness=Ei;exports.SuccessState=xl;exports.Summary=Eo;exports.Table=Wn;exports.TableSkeleton=wl;exports.TenderMethods=zo;exports.TicketSelection=Nx;exports.TileSelect=xo;exports.ToastProvider=Zc;exports.Toggle=pl;exports.ToolbarButton=Ll;exports.UnderlineTabs=Fl;exports.VerticalSteps=Di;exports.WizardShell=Lo;exports.adminFieldErrorClass=Hl;exports.adminFieldHelpButtonClass=Il;exports.adminFieldHelpContentClass=Ol;exports.adminFieldHelpIconClass=Tl;exports.adminFieldHintClass=Ul;exports.adminFieldLabelClass=ia;exports.adminFieldLabelNoAutoMarkClass=Pl;exports.adminFieldLabelRowClass=Ml;exports.adminFieldLabelSuffixClass=Rl;exports.adminFieldRequiredClass=_l;exports.adminInputClass=Bl;exports.adminInputReadOnlyClass=Vl;exports.adminInputWrapperClass=zl;exports.adminRowClass=kl;exports.adminSurfaceCss=qc;exports.adminSurfaceTokens=Rs;exports.adminTableClass=Sl;exports.adminTableFooterClass=$l;exports.adminTdClass=Cl;exports.adminThClass=Nl;exports.calculateAllocationDifference=ef;exports.computeChange=Nn;exports.currencyFractionDigits=Pt;exports.formatMoney=xe;exports.formatOfferCurrency=kn;exports.formatRevenueAmount=Qm;exports.formatRevenueCurrency=Zm;exports.generateAutomaticInstallments=ll;exports.generateDistributionId=ea;exports.getCurrencySymbol=Xm;exports.offerCardVariants=Vi;exports.offerListVariants=Bi;exports.pageRange=to;exports.parseOfferCurrency=Nm;exports.parseRevenueCurrency=Jm;exports.pillTabId=va;exports.pillTabPanelId=ja;exports.pillTabPanelProps=mb;exports.posSurfaceTokens=oe;exports.roundToCurrency=qn;exports.useControlSize=Xc;exports.useDensity=Ms;exports.useDiscardGuard=eh;exports.useDiscardGuardActions=Op;exports.useModalPanel=Bp;exports.useModalPanels=Jp;exports.useReportUnsavedChanges=Tp;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
42
42
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.ProseMirror{flex:1;width:100%;min-height:100%;height:100%;cursor:text;background-color:#fff;padding:1rem;overflow-y:auto;box-sizing:border-box}.ProseMirror p{min-height:1.5em}.dark .ProseMirror{background-color:rgb(var(--nextui-background))}.ProseMirror ul{list-style-type:disc!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ol{list-style-type:decimal!important;list-style-position:outside!important;padding-left:2rem!important;margin:1rem 0!important;display:block!important}.ProseMirror ul li,.ProseMirror ol li{display:list-item!important;list-style:inherit!important;margin:.25rem 0!important}.ProseMirror ul li p,.ProseMirror ol li p{margin:0!important;display:inline!important}.ProseMirror ul[data-type=taskList]{list-style:none!important;padding-left:0!important;margin:1rem 0!important}.ProseMirror ul[data-type=taskList] li{display:flex!important;align-items:flex-start!important;margin:.5rem 0!important}.ProseMirror ul[data-type=taskList] li label{margin-right:.5rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li input[type=checkbox]{cursor:pointer;margin-top:.25rem}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{line-height:1.2!important;margin:1rem 0 .5rem!important;font-weight:600!important}.ProseMirror h1{font-size:2rem!important}.ProseMirror h2{font-size:1.5rem!important}.ProseMirror h3{font-size:1.25rem!important}.ProseMirror h4{font-size:1.1rem!important}.ProseMirror h5{font-size:1rem!important;font-weight:600!important}.ProseMirror h6{font-size:.9rem!important;font-weight:600!important}.ProseMirror code{background-color:rgb(var(--nextui-default-100));border-radius:.4rem;color:rgb(var(--nextui-default-800));font-size:.85rem;padding:.25em .3em}.ProseMirror pre{background:rgb(var(--nextui-default-900));border-radius:.5rem;color:rgb(var(--nextui-default-50));font-family:JetBrainsMono,monospace;margin:1.5rem 0;padding:.75rem 1rem;overflow-x:auto}.ProseMirror pre code{background:none;color:inherit;font-size:.8rem;padding:0}.ProseMirror mark{background-color:#faf594;border-radius:.4rem;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:.1rem .3rem}.ProseMirror blockquote{border-left:3px solid rgb(var(--nextui-default-300));margin:1.5rem 0;padding-left:1rem;color:rgb(var(--nextui-default-600))}.ProseMirror hr{border:none;border-top:1px solid rgb(var(--nextui-divider));margin:2rem 0}.ProseMirror a{color:rgb(var(--nextui-primary));text-decoration:underline;cursor:pointer}.ProseMirror a:hover{text-decoration:underline}.ProseMirror strong{font-weight:700!important}.ProseMirror em{font-style:italic!important}.ProseMirror s{text-decoration:line-through!important}.ProseMirror u{text-decoration:underline!important}.ProseMirror .has-text-align-left,.ProseMirror [style*="text-align: left"]{text-align:left!important}.ProseMirror .has-text-align-center,.ProseMirror [style*="text-align: center"]{text-align:center!important}.ProseMirror .has-text-align-right,.ProseMirror [style*="text-align: right"]{text-align:right!important}.ProseMirror .has-text-align-justify,.ProseMirror [style*="text-align: justify"]{text-align:justify!important}.ProseMirror ul li[style*="text-align: left"],.ProseMirror ol li[style*="text-align: left"]{text-align:left!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: center"],.ProseMirror ol li[style*="text-align: center"]{text-align:center!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: right"],.ProseMirror ol li[style*="text-align: right"]{text-align:right!important;list-style-position:inside!important}.ProseMirror ul li[style*="text-align: justify"],.ProseMirror ol li[style*="text-align: justify"]{text-align:justify!important;list-style-position:inside!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: left"]{justify-content:flex-start!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: center"]{justify-content:center!important}.ProseMirror ul[data-type=taskList] li[style*="text-align: right"]{justify-content:flex-end!important}.ProseMirror p.is-editor-empty:first-child:before{color:rgb(var(--nextui-default-400));content:attr(data-placeholder);float:left;height:0;pointer-events:none}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();